Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Al Viro | bbc5b21 | 2005-11-01 15:14:05 +0000 | [diff] [blame] | 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> |
Peter Zijlstra | eff3b63 | 2006-12-13 00:33:50 -0800 | [diff] [blame^] | 14 | #include <linux/workqueue.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | |
| 16 | struct uml_net { |
| 17 | struct list_head list; |
| 18 | struct net_device *dev; |
| 19 | struct platform_device pdev; |
| 20 | int index; |
| 21 | unsigned char mac[ETH_ALEN]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | }; |
| 23 | |
| 24 | struct uml_net_private { |
| 25 | struct list_head list; |
| 26 | spinlock_t lock; |
| 27 | struct net_device *dev; |
| 28 | struct timer_list tl; |
| 29 | struct net_device_stats stats; |
Peter Zijlstra | eff3b63 | 2006-12-13 00:33:50 -0800 | [diff] [blame^] | 30 | struct work_struct work; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | int fd; |
| 32 | unsigned char mac[ETH_ALEN]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | unsigned short (*protocol)(struct sk_buff *); |
| 34 | int (*open)(void *); |
| 35 | void (*close)(int, void *); |
| 36 | void (*remove)(void *); |
| 37 | int (*read)(int, struct sk_buff **skb, struct uml_net_private *); |
| 38 | int (*write)(int, struct sk_buff **skb, struct uml_net_private *); |
| 39 | |
| 40 | void (*add_address)(unsigned char *, unsigned char *, void *); |
| 41 | void (*delete_address)(unsigned char *, unsigned char *, void *); |
| 42 | int (*set_mtu)(int mtu, void *); |
| 43 | int user[1]; |
| 44 | }; |
| 45 | |
| 46 | struct net_kern_info { |
| 47 | void (*init)(struct net_device *, void *); |
| 48 | unsigned short (*protocol)(struct sk_buff *); |
| 49 | int (*read)(int, struct sk_buff **skb, struct uml_net_private *); |
| 50 | int (*write)(int, struct sk_buff **skb, struct uml_net_private *); |
| 51 | }; |
| 52 | |
| 53 | struct transport { |
| 54 | struct list_head list; |
| 55 | char *name; |
| 56 | int (*setup)(char *, char **, void *); |
Jeff Dike | 5e7672e | 2006-09-27 01:50:33 -0700 | [diff] [blame] | 57 | const struct net_user_info *user; |
| 58 | const struct net_kern_info *kern; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | int private_size; |
| 60 | int setup_size; |
| 61 | }; |
| 62 | |
| 63 | extern struct net_device *ether_init(int); |
| 64 | extern unsigned short ether_protocol(struct sk_buff *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | extern struct sk_buff *ether_adjust_skb(struct sk_buff *skb, int extra); |
| 66 | extern int tap_setup_common(char *str, char *type, char **dev_name, |
| 67 | char **mac_out, char **gate_addr); |
| 68 | extern void register_transport(struct transport *new); |
| 69 | extern unsigned short eth_protocol(struct sk_buff *skb); |
| 70 | |
| 71 | #endif |