blob: 012ac87d49004ee5d2d584a74a1274b2d20e2d07 [file] [log] [blame]
Jeff Dike4ea21cd2007-02-10 01:43:56 -08001/*
Jeff Dikeb53f35a2007-10-16 01:27:31 -07002 * Copyright (C) 2002 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 * 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>
Peter Zijlstraeff3b632006-12-13 00:33:50 -080014#include <linux/workqueue.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
16struct uml_net {
17 struct list_head list;
18 struct net_device *dev;
19 struct platform_device pdev;
20 int index;
Linus Torvalds1da177e2005-04-16 15:20:36 -070021};
22
23struct uml_net_private {
24 struct list_head list;
25 spinlock_t lock;
26 struct net_device *dev;
27 struct timer_list tl;
Stephen Hemmingercfa87072009-03-26 15:11:16 +000028
Peter Zijlstraeff3b632006-12-13 00:33:50 -080029 struct work_struct work;
Linus Torvalds1da177e2005-04-16 15:20:36 -070030 int fd;
31 unsigned char mac[ETH_ALEN];
Jeff Dikeb53f35a2007-10-16 01:27:31 -070032 int max_packet;
Linus Torvalds1da177e2005-04-16 15:20:36 -070033 unsigned short (*protocol)(struct sk_buff *);
34 int (*open)(void *);
35 void (*close)(int, void *);
36 void (*remove)(void *);
Jeff Dikeb53f35a2007-10-16 01:27:31 -070037 int (*read)(int, struct sk_buff *skb, struct uml_net_private *);
38 int (*write)(int, struct sk_buff *skb, struct uml_net_private *);
Jeff Dike4ea21cd2007-02-10 01:43:56 -080039
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 void (*add_address)(unsigned char *, unsigned char *, void *);
41 void (*delete_address)(unsigned char *, unsigned char *, void *);
Paolo 'Blaisorblade' Giarrussoc74c69b2007-05-06 14:51:15 -070042 char user[0];
Linus Torvalds1da177e2005-04-16 15:20:36 -070043};
44
45struct net_kern_info {
46 void (*init)(struct net_device *, void *);
47 unsigned short (*protocol)(struct sk_buff *);
Jeff Dikeb53f35a2007-10-16 01:27:31 -070048 int (*read)(int, struct sk_buff *skb, struct uml_net_private *);
49 int (*write)(int, struct sk_buff *skb, struct uml_net_private *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070050};
51
52struct transport {
53 struct list_head list;
Jeff Diked3b7f692007-02-10 01:43:56 -080054 const char *name;
55 int (* const setup)(char *, char **, void *);
Jeff Dike5e7672e2006-09-27 01:50:33 -070056 const struct net_user_info *user;
57 const struct net_kern_info *kern;
Jeff Diked3b7f692007-02-10 01:43:56 -080058 const int private_size;
59 const int setup_size;
Linus Torvalds1da177e2005-04-16 15:20:36 -070060};
61
62extern struct net_device *ether_init(int);
63extern unsigned short ether_protocol(struct sk_buff *);
Jeff Dike4ea21cd2007-02-10 01:43:56 -080064extern int tap_setup_common(char *str, char *type, char **dev_name,
Linus Torvalds1da177e2005-04-16 15:20:36 -070065 char **mac_out, char **gate_addr);
66extern void register_transport(struct transport *new);
67extern unsigned short eth_protocol(struct sk_buff *skb);
68
69#endif