updated to 2.6.12.2-vs2.0-rc5
[util-vserver.git] / util-vserver / kernel / network.h
index 1389af8..f475b3f 100644 (file)
@@ -1,22 +1,43 @@
 #ifndef _VX_NETWORK_H
 #define _VX_NETWORK_H
 
+#include <linux/types.h>
+
+
+#define MAX_N_CONTEXT  65535   /* Arbitrary limit */
+
+#define NX_DYNAMIC_ID  ((uint32_t)-1)          /* id for dynamic context */
 
 #define NB_IPV4ROOT    16
 
+
+/* context flags */
+
+#define NXF_STATE_SETUP                (1ULL<<32)
+
+#define NXF_STATE_HELPER       (1ULL<<36)
+
+#define NXF_INIT_SET           (0)
+
+
 #ifdef __KERNEL__
 
 #include <linux/list.h>
 #include <linux/spinlock.h>
-#include <linux/utsname.h>
-#include <asm/resource.h>
+#include <linux/rcupdate.h>
 #include <asm/atomic.h>
 
 
-struct ip_info {
-       struct list_head ip_list;       /* linked list of ipinfos */
-       nid_t ip_id;                    /* vnet id */
-       atomic_t ip_refcount;
+struct nx_info {
+       struct hlist_node nx_hlist;     /* linked list of nxinfos */
+       nid_t nx_id;                    /* vnet id */
+       atomic_t nx_usecnt;             /* usage count */
+       atomic_t nx_tasks;              /* tasks count */
+       int nx_state;                   /* context state */
+
+       uint64_t nx_flags;              /* network flag word */
+       uint64_t nx_ncaps;              /* network capabilities */
+
        int nbipv4;
        __u32 ipv4[NB_IPV4ROOT];        /* Process can only bind to these IPs */
                                        /* The first one is used to connect */
@@ -26,19 +47,38 @@ struct ip_info {
                                        /* Used to select the proper source */
                                        /* address for sockets */
        __u32 v4_bcast;                 /* Broadcast address to receive UDP  */
+
+       char nx_name[65];               /* network context name */
 };
 
 
-extern spinlock_t iplist_lock;
-extern struct list_head ip_infos;
+/* status flags */
+
+#define NXS_HASHED      0x0001
+#define NXS_SHUTDOWN    0x0100
+#define NXS_RELEASED    0x8000
+
+extern struct nx_info *locate_nx_info(int);
+extern struct nx_info *locate_or_create_nx_info(int);
+
+extern int get_nid_list(int, unsigned int *, int);
+extern int nid_is_hashed(nid_t);
+
+extern int nx_migrate_task(struct task_struct *, struct nx_info *);
+
+extern long vs_net_change(struct nx_info *, unsigned int);
 
+struct in_ifaddr;
+struct net_device;
 
-void free_ip_info(struct ip_info *);
-struct ip_info *create_ip_info(void);
+int ifa_in_nx_info(struct in_ifaddr *, struct nx_info *);
+int dev_in_nx_info(struct net_device *, struct nx_info *);
 
-extern struct ip_info *find_ip_info(int);
-extern int ip_info_id_valid(int);
+struct sock;
 
+int nx_addr_conflict(struct nx_info *, uint32_t, struct sock *);
 
 #endif /* __KERNEL__ */
+#else  /* _VX_NETWORK_H */
+#warning duplicate inclusion
 #endif /* _VX_NETWORK_H */