Jeff Dike | 4ea21cd | 2007-02-10 01:43:56 -0800 | [diff] [blame] | 1 | /* |
Jeff Dike | b53f35a | 2007-10-16 01:27:31 -0700 | [diff] [blame] | 2 | * Copyright (C) 2002 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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; |
Stephen Hemminger | cfa8707 | 2009-03-26 15:11:16 +0000 | [diff] [blame] | 28 | |
Peter Zijlstra | eff3b63 | 2006-12-13 00:33:50 -0800 | [diff] [blame] | 29 | struct work_struct work; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | int fd; |
| 31 | unsigned char mac[ETH_ALEN]; |
Jeff Dike | b53f35a | 2007-10-16 01:27:31 -0700 | [diff] [blame] | 32 | int max_packet; |
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 *); |
Jeff Dike | b53f35a | 2007-10-16 01:27:31 -0700 | [diff] [blame] | 37 | int (*read)(int, struct sk_buff *skb, struct uml_net_private *); |
| 38 | int (*write)(int, struct sk_buff *skb, struct uml_net_private *); |
Jeff Dike | 4ea21cd | 2007-02-10 01:43:56 -0800 | [diff] [blame] | 39 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | void (*add_address)(unsigned char *, unsigned char *, void *); |
| 41 | void (*delete_address)(unsigned char *, unsigned char *, void *); |
Paolo 'Blaisorblade' Giarrusso | c74c69b | 2007-05-06 14:51:15 -0700 | [diff] [blame] | 42 | char user[0]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | struct net_kern_info { |
| 46 | void (*init)(struct net_device *, void *); |
| 47 | unsigned short (*protocol)(struct sk_buff *); |
Jeff Dike | b53f35a | 2007-10-16 01:27:31 -0700 | [diff] [blame] | 48 | int (*read)(int, struct sk_buff *skb, struct uml_net_private *); |
| 49 | int (*write)(int, struct sk_buff *skb, struct uml_net_private *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | }; |
| 51 | |
| 52 | struct transport { |
| 53 | struct list_head list; |
Jeff Dike | d3b7f69 | 2007-02-10 01:43:56 -0800 | [diff] [blame] | 54 | const char *name; |
| 55 | int (* const setup)(char *, char **, void *); |
Jeff Dike | 5e7672e | 2006-09-27 01:50:33 -0700 | [diff] [blame] | 56 | const struct net_user_info *user; |
| 57 | const struct net_kern_info *kern; |
Jeff Dike | d3b7f69 | 2007-02-10 01:43:56 -0800 | [diff] [blame] | 58 | const int private_size; |
| 59 | const int setup_size; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | extern struct net_device *ether_init(int); |
| 63 | extern unsigned short ether_protocol(struct sk_buff *); |
Jeff Dike | 4ea21cd | 2007-02-10 01:43:56 -0800 | [diff] [blame] | 64 | extern int tap_setup_common(char *str, char *type, char **dev_name, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |