net_kern.h 1.9 KB
Newer Older
1
/*
J
Jeff Dike 已提交
2
 * Copyright (C) 2002 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
L
Linus Torvalds 已提交
3 4 5 6 7 8
 * Licensed under the GPL
 */

#ifndef __UM_NET_KERN_H
#define __UM_NET_KERN_H

9 10 11 12 13
#include <linux/netdevice.h>
#include <linux/platform_device.h>
#include <linux/skbuff.h>
#include <linux/socket.h>
#include <linux/list.h>
14
#include <linux/workqueue.h>
L
Linus Torvalds 已提交
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29

struct uml_net {
	struct list_head list;
	struct net_device *dev;
	struct platform_device pdev;
	int index;
	unsigned char mac[ETH_ALEN];
};

struct uml_net_private {
	struct list_head list;
	spinlock_t lock;
	struct net_device *dev;
	struct timer_list tl;
	struct net_device_stats stats;
30
	struct work_struct work;
L
Linus Torvalds 已提交
31 32
	int fd;
	unsigned char mac[ETH_ALEN];
J
Jeff Dike 已提交
33
	int max_packet;
L
Linus Torvalds 已提交
34 35 36 37
	unsigned short (*protocol)(struct sk_buff *);
	int (*open)(void *);
	void (*close)(int, void *);
	void (*remove)(void *);
J
Jeff Dike 已提交
38 39
	int (*read)(int, struct sk_buff *skb, struct uml_net_private *);
	int (*write)(int, struct sk_buff *skb, struct uml_net_private *);
40

L
Linus Torvalds 已提交
41 42
	void (*add_address)(unsigned char *, unsigned char *, void *);
	void (*delete_address)(unsigned char *, unsigned char *, void *);
43
	char user[0];
L
Linus Torvalds 已提交
44 45 46 47 48
};

struct net_kern_info {
	void (*init)(struct net_device *, void *);
	unsigned short (*protocol)(struct sk_buff *);
J
Jeff Dike 已提交
49 50
	int (*read)(int, struct sk_buff *skb, struct uml_net_private *);
	int (*write)(int, struct sk_buff *skb, struct uml_net_private *);
L
Linus Torvalds 已提交
51 52 53 54
};

struct transport {
	struct list_head list;
55 56
	const char *name;
	int (* const setup)(char *, char **, void *);
J
Jeff Dike 已提交
57 58
	const struct net_user_info *user;
	const struct net_kern_info *kern;
59 60
	const int private_size;
	const int setup_size;
L
Linus Torvalds 已提交
61 62 63 64
};

extern struct net_device *ether_init(int);
extern unsigned short ether_protocol(struct sk_buff *);
65
extern int tap_setup_common(char *str, char *type, char **dev_name,
L
Linus Torvalds 已提交
66 67 68 69 70
			    char **mac_out, char **gate_addr);
extern void register_transport(struct transport *new);
extern unsigned short eth_protocol(struct sk_buff *skb);

#endif