vserver 1.9.5.x5
[linux-2.6.git] / include / linux / vserver / network.h
1 #ifndef _VX_NETWORK_H
2 #define _VX_NETWORK_H
3
4 #include <linux/types.h>
5
6
7 #define MAX_N_CONTEXT   65535   /* Arbitrary limit */
8
9 #define NX_DYNAMIC_ID   ((uint32_t)-1)          /* id for dynamic context */
10
11 #define NB_IPV4ROOT     16
12
13
14 #ifdef  __KERNEL__
15
16 #include <linux/list.h>
17 #include <linux/spinlock.h>
18 #include <linux/rcupdate.h>
19 #include <asm/atomic.h>
20
21
22 struct nx_info {
23         struct hlist_node nx_hlist;     /* linked list of nxinfos */
24         struct rcu_head nx_rcu;         /* the rcu head */
25         nid_t nx_id;                    /* vnet id */
26         atomic_t nx_usecnt;             /* usage count */
27         atomic_t nx_refcnt;             /* reference count */
28
29         uint64_t nx_flags;              /* network flag word */
30         uint64_t nx_ncaps;              /* network capabilities */
31
32         int nbipv4;
33         __u32 ipv4[NB_IPV4ROOT];        /* Process can only bind to these IPs */
34                                         /* The first one is used to connect */
35                                         /* and for bind any service */
36                                         /* The other must be used explicity */
37         __u32 mask[NB_IPV4ROOT];        /* Netmask for each ipv4 */
38                                         /* Used to select the proper source */
39                                         /* address for sockets */
40         __u32 v4_bcast;                 /* Broadcast address to receive UDP  */
41
42         char nx_name[65];               /* network context name */
43 };
44
45
46 struct rcu_head;
47
48 extern void unhash_nx_info(struct nx_info *);
49
50 extern struct nx_info *locate_nx_info(int);
51 extern struct nx_info *locate_or_create_nx_info(int);
52
53 extern int get_nid_list(int, unsigned int *, int);
54 extern int nid_is_hashed(nid_t);
55
56 extern int nx_migrate_task(struct task_struct *, struct nx_info *);
57
58 struct in_ifaddr;
59 struct net_device;
60
61 int ifa_in_nx_info(struct in_ifaddr *, struct nx_info *);
62 int dev_in_nx_info(struct net_device *, struct nx_info *);
63
64 struct sock;
65
66 int nx_addr_conflict(struct nx_info *, uint32_t, struct sock *);
67
68 #endif  /* __KERNEL__ */
69 #else   /* _VX_NETWORK_H */
70 #warning duplicate inclusion
71 #endif  /* _VX_NETWORK_H */