net_kern.h 2.15 KB
Newer Older
1 2 3 4 5 6 7 8 9
#ifndef __UM_NET_KERN_H
#define __UM_NET_KERN_H

#include "linux/netdevice.h"
#include "linux/skbuff.h"
#include "linux/socket.h"
#include "linux/list.h"

struct uml_net {
10
	struct list_head list;
11
	struct net_device *dev;
12
	int index;
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
	unsigned char mac[ETH_ALEN];
	int have_mac;
};

struct uml_net_private {
	struct list_head list;
	spinlock_t lock;
	struct net_device *dev;
	struct timer_list tl;
	struct net_device_stats stats;
	int fd;
	unsigned char mac[ETH_ALEN];
	int have_mac;
	unsigned short (*protocol)(struct sk_buff *);
	int (*open)(void *);
	void (*close)(int, void *);
	void (*remove)(void *);
	int (*read)(int, struct sk_buff **skb, struct uml_net_private *);
	int (*write)(int, struct sk_buff **skb, struct uml_net_private *);
	
	void (*add_address)(unsigned char *, unsigned char *, void *);
	void (*delete_address)(unsigned char *, unsigned char *, void *);
	int (*set_mtu)(int mtu, void *);
	int user[1];
};

struct net_kern_info {
40
	void (*init)(struct net_device *, void *);
41 42 43 44 45 46 47 48
	unsigned short (*protocol)(struct sk_buff *);
	int (*read)(int, struct sk_buff **skb, struct uml_net_private *);
	int (*write)(int, struct sk_buff **skb, struct uml_net_private *);
};

struct transport {
	struct list_head list;
	char *name;
49 50 51 52 53
	int (*setup)(char *, char **, void *);
	struct net_user_info *user;
	struct net_kern_info *kern;
	int private_size;
	int setup_size;
54 55 56 57 58 59 60
};

extern struct net_device *ether_init(int);
extern unsigned short ether_protocol(struct sk_buff *);
extern int setup_etheraddr(char *str, unsigned char *addr);
extern struct sk_buff *ether_adjust_skb(struct sk_buff *skb, int extra);
extern int tap_setup_common(char *str, char *type, char **dev_name, 
61
			    char **mac_out, char **gate_addr);
62
extern void register_transport(struct transport *new);
63
extern unsigned short eth_protocol(struct sk_buff *skb);
64 65 66 67 68 69 70 71 72 73 74 75 76

#endif

/*
 * Overrides for Emacs so that we follow Linus's tabbing style.
 * Emacs will notice this stuff at the end of the file and automatically
 * adjust the settings for this buffer only.  This must remain at the end
 * of the file.
 * ---------------------------------------------------------------------------
 * Local variables:
 * c-file-style: "linux"
 * End:
 */