280459fb0b2619ded00ce874565a5d6c93ef6c49
[powerpc.git] / arch / um / include / net_kern.h
1 /* 
2  * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3  * Licensed under the GPL
4  */
5
6 #ifndef __UM_NET_KERN_H
7 #define __UM_NET_KERN_H
8
9 #include <linux/netdevice.h>
10 #include <linux/platform_device.h>
11 #include <linux/skbuff.h>
12 #include <linux/socket.h>
13 #include <linux/list.h>
14
15 struct uml_net {
16         struct list_head list;
17         struct net_device *dev;
18         struct platform_device pdev;
19         int index;
20         unsigned char mac[ETH_ALEN];
21 };
22
23 struct uml_net_private {
24         struct list_head list;
25         spinlock_t lock;
26         struct net_device *dev;
27         struct timer_list tl;
28         struct net_device_stats stats;
29         int fd;
30         unsigned char mac[ETH_ALEN];
31         unsigned short (*protocol)(struct sk_buff *);
32         int (*open)(void *);
33         void (*close)(int, void *);
34         void (*remove)(void *);
35         int (*read)(int, struct sk_buff **skb, struct uml_net_private *);
36         int (*write)(int, struct sk_buff **skb, struct uml_net_private *);
37         
38         void (*add_address)(unsigned char *, unsigned char *, void *);
39         void (*delete_address)(unsigned char *, unsigned char *, void *);
40         int (*set_mtu)(int mtu, void *);
41         int user[1];
42 };
43
44 struct net_kern_info {
45         void (*init)(struct net_device *, void *);
46         unsigned short (*protocol)(struct sk_buff *);
47         int (*read)(int, struct sk_buff **skb, struct uml_net_private *);
48         int (*write)(int, struct sk_buff **skb, struct uml_net_private *);
49 };
50
51 struct transport {
52         struct list_head list;
53         char *name;
54         int (*setup)(char *, char **, void *);
55         const struct net_user_info *user;
56         const struct net_kern_info *kern;
57         int private_size;
58         int setup_size;
59 };
60
61 extern struct net_device *ether_init(int);
62 extern unsigned short ether_protocol(struct sk_buff *);
63 extern struct sk_buff *ether_adjust_skb(struct sk_buff *skb, int extra);
64 extern int tap_setup_common(char *str, char *type, char **dev_name, 
65                             char **mac_out, char **gate_addr);
66 extern void register_transport(struct transport *new);
67 extern unsigned short eth_protocol(struct sk_buff *skb);
68
69 #endif