upgrade to vserver 1.9.3.17
[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 void free_nx_info(struct nx_info *);
51
52 extern struct nx_info *locate_nx_info(int);
53 extern struct nx_info *locate_or_create_nx_info(int);
54
55 extern int get_nid_list(int, unsigned int *, int);
56 extern int nx_info_is_hashed(nid_t);
57
58 extern int nx_migrate_task(struct task_struct *, struct nx_info *);
59
60 struct in_ifaddr;
61 struct net_device;
62
63 int ifa_in_nx_info(struct in_ifaddr *, struct nx_info *);
64 int dev_in_nx_info(struct net_device *, struct nx_info *);
65
66 struct sock;
67
68 int nx_addr_conflict(struct nx_info *, uint32_t, struct sock *);
69
70 #endif  /* __KERNEL__ */
71 #else   /* _VX_NETWORK_H */
72 #warning duplicate inclusion
73 #endif  /* _VX_NETWORK_H */