blob: f7de6df60dd717f1ba2a16fc563ecee853a5fe7a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 Virobbc5b212005-11-01 15:14:05 +00009#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>
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
15struct 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 int have_mac;
22};
23
24struct 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;
30 int fd;
31 unsigned char mac[ETH_ALEN];
32 int have_mac;
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
46struct 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
53struct transport {
54 struct list_head list;
55 char *name;
56 int (*setup)(char *, char **, void *);
57 struct net_user_info *user;
58 struct net_kern_info *kern;
59 int private_size;
60 int setup_size;
61};
62
63extern struct net_device *ether_init(int);
64extern unsigned short ether_protocol(struct sk_buff *);
65extern int setup_etheraddr(char *str, unsigned char *addr);
66extern struct sk_buff *ether_adjust_skb(struct sk_buff *skb, int extra);
67extern int tap_setup_common(char *str, char *type, char **dev_name,
68 char **mac_out, char **gate_addr);
69extern void register_transport(struct transport *new);
70extern unsigned short eth_protocol(struct sk_buff *skb);
71
72#endif
73
74/*
75 * Overrides for Emacs so that we follow Linus's tabbing style.
76 * Emacs will notice this stuff at the end of the file and automatically
77 * adjust the settings for this buffer only. This must remain at the end
78 * of the file.
79 * ---------------------------------------------------------------------------
80 * Local variables:
81 * c-file-style: "linux"
82 * End:
83 */