updated to 2.6.13.3-vs2.1.0-rc4 headers
[util-vserver.git] / util-vserver / kernel / 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 /* network flags */
15
16 #define NXF_STATE_SETUP         (1ULL<<32)
17
18 #define NXF_SC_HELPER           (1ULL<<36)
19
20 #define NXF_ONE_TIME            (0x0001ULL<<32)
21
22 #define NXF_INIT_SET            (0)
23
24
25 /* address types */
26
27 #define NXA_TYPE_IPV4           1
28 #define NXA_TYPE_IPV6           2
29
30 #define NXA_MOD_BCAST           (1<<8)
31
32 #define NXA_TYPE_ANY            (~0)
33
34
35 #ifdef  __KERNEL__
36
37 #include <linux/list.h>
38 #include <linux/spinlock.h>
39 #include <linux/rcupdate.h>
40 #include <asm/atomic.h>
41
42
43 struct nx_info {
44         struct hlist_node nx_hlist;     /* linked list of nxinfos */
45         nid_t nx_id;                    /* vnet id */
46         atomic_t nx_usecnt;             /* usage count */
47         atomic_t nx_tasks;              /* tasks count */
48         int nx_state;                   /* context state */
49
50         uint64_t nx_flags;              /* network flag word */
51         uint64_t nx_ncaps;              /* network capabilities */
52
53         int nbipv4;
54         __u32 ipv4[NB_IPV4ROOT];        /* Process can only bind to these IPs */
55                                         /* The first one is used to connect */
56                                         /* and for bind any service */
57                                         /* The other must be used explicity */
58         __u32 mask[NB_IPV4ROOT];        /* Netmask for each ipv4 */
59                                         /* Used to select the proper source */
60                                         /* address for sockets */
61         __u32 v4_bcast;                 /* Broadcast address to receive UDP  */
62
63         char nx_name[65];               /* network context name */
64 };
65
66
67 /* status flags */
68
69 #define NXS_HASHED      0x0001
70 #define NXS_SHUTDOWN    0x0100
71 #define NXS_RELEASED    0x8000
72
73 extern struct nx_info *lookup_nx_info(int);
74
75 extern int get_nid_list(int, unsigned int *, int);
76 extern int nid_is_hashed(nid_t);
77
78 extern int nx_migrate_task(struct task_struct *, struct nx_info *);
79
80 extern long vs_net_change(struct nx_info *, unsigned int);
81
82 struct in_ifaddr;
83 struct net_device;
84
85 int ifa_in_nx_info(struct in_ifaddr *, struct nx_info *);
86 int dev_in_nx_info(struct net_device *, struct nx_info *);
87
88 struct sock;
89
90 int nx_addr_conflict(struct nx_info *, uint32_t, struct sock *);
91
92 #endif  /* __KERNEL__ */
93 #else   /* _VX_NETWORK_H */
94 #warning duplicate inclusion
95 #endif  /* _VX_NETWORK_H */