This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / include / linux / vserver / network.h
1 #ifndef _VX_NETWORK_H
2 #define _VX_NETWORK_H
3
4 #define MAX_N_CONTEXT   65535   /* Arbitrary limit */
5
6 #define IP_DYNAMIC_ID   ((uint32_t)-1)          /* id for dynamic context */
7
8 #define NB_IPV4ROOT     16
9
10 #ifdef  __KERNEL__
11
12 #include <linux/list.h>
13 #include <linux/spinlock.h>
14 #include <linux/utsname.h>
15 #include <asm/resource.h>
16 #include <asm/atomic.h>
17
18
19 struct nx_info {
20         struct list_head nx_list;       /* linked list of nxinfos */
21         nid_t nx_id;                    /* vnet id */
22         atomic_t nx_refcount;
23
24         uint64_t nx_flags;              /* network flag word */
25         uint64_t nx_ncaps;              /* network capabilities */
26
27         int nbipv4;
28         __u32 ipv4[NB_IPV4ROOT];        /* Process can only bind to these IPs */
29                                         /* The first one is used to connect */
30                                         /* and for bind any service */
31                                         /* The other must be used explicity */
32         __u32 mask[NB_IPV4ROOT];        /* Netmask for each ipv4 */
33                                         /* Used to select the proper source */
34                                         /* address for sockets */
35         __u32 v4_bcast;                 /* Broadcast address to receive UDP  */
36
37         char nx_name[65];               /* network context name */
38 };
39
40
41 extern spinlock_t nxlist_lock;
42 extern struct list_head nx_infos;
43
44
45 void free_nx_info(struct nx_info *);
46 struct nx_info *create_nx_info(void);
47
48 extern struct nx_info *find_nx_info(int);
49 extern int nx_info_id_valid(int);
50
51 struct in_ifaddr;
52 struct net_device;
53
54 int ifa_in_nx_info(struct in_ifaddr *, struct nx_info *);
55 int dev_in_nx_info(struct net_device *, struct nx_info *);
56
57
58 #endif  /* __KERNEL__ */
59
60 #include "switch.h"
61
62 /* vinfo commands */
63
64 #define VCMD_task_nid           VC_CMD(VINFO, 2, 0)
65
66 #ifdef  __KERNEL__
67 extern int vc_task_nid(uint32_t, void __user *);
68
69 #endif  /* __KERNEL__ */
70
71 #define VCMD_nx_info            VC_CMD(VINFO, 6, 0)
72
73 struct  vcmd_nx_info_v0 {
74         uint32_t nid;
75         /* more to come */      
76 };
77
78 #ifdef  __KERNEL__
79 extern int vc_nx_info(uint32_t, void __user *);
80
81 #endif  /* __KERNEL__ */
82
83 #define VCMD_net_create         VC_CMD(VNET, 1, 0)
84 #define VCMD_net_migrate        VC_CMD(NETMIG, 1, 0)
85
86 #define VCMD_net_add            VC_CMD(NETALT, 1, 0)
87 #define VCMD_net_remove         VC_CMD(NETALT, 2, 0)
88
89 struct  vcmd_net_nx_v0 {
90         uint16_t type;
91         uint16_t count;
92         uint32_t ip[4];
93         uint32_t mask[4];
94         /* more to come */      
95 };
96
97 //      IPN_TYPE_IPV4   
98
99
100 #ifdef  __KERNEL__
101 extern int vc_net_create(uint32_t, void __user *);
102 extern int vc_net_migrate(uint32_t, void __user *);
103
104 #endif  /* __KERNEL__ */
105
106 #define VCMD_get_nflags         VC_CMD(FLAGS, 5, 0)
107 #define VCMD_set_nflags         VC_CMD(FLAGS, 6, 0)
108
109 struct  vcmd_net_flags_v0 {
110         uint64_t flagword;
111         uint64_t mask;
112 };
113
114 #ifdef  __KERNEL__
115 extern int vc_get_nflags(uint32_t, void __user *);
116 extern int vc_set_nflags(uint32_t, void __user *);
117
118 #endif  /* __KERNEL__ */
119
120 #define IPF_STATE_SETUP         (1ULL<<32)
121
122
123 #define IPF_ONE_TIME            (0x0001ULL<<32)
124
125 #define VCMD_get_ncaps          VC_CMD(FLAGS, 7, 0)
126 #define VCMD_set_ncaps          VC_CMD(FLAGS, 8, 0)
127
128 struct  vcmd_net_caps_v0 {
129         uint64_t ncaps;
130         uint64_t cmask;
131 };
132
133 #ifdef  __KERNEL__
134 extern int vc_get_ncaps(uint32_t, void __user *);
135 extern int vc_set_ncaps(uint32_t, void __user *);
136
137 #endif  /* __KERNEL__ */
138
139 #define IPC_WOSSNAME            0x00000001
140
141
142 #endif  /* _VX_NETWORK_H */