blob: 5c367f22595bd5bf915b4c55e33892d4833f17e5 [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;
21 unsigned char mac[ETH_ALEN];
Linus Torvalds1da177e2005-04-16 15:20:36 -070022};
23
24struct uml_net_private {
25 struct list_head list;
26 spinlock_t lock;
27 struct net_device *dev;
28 struct timer_list tl;
Stephen Hemmingercfa87072009-03-26 15:11:16 +000029
Peter Zijlstraeff3b632006-12-13 00:33:50 -080030 struct work_struct work;
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 int fd;
32 unsigned char mac[ETH_ALEN];
Jeff Dikeb53f35a2007-10-16 01:27:31 -070033 int max_packet;
Linus Torvalds1da177e2005-04-16 15:20:36 -070034 unsigned short (*protocol)(struct sk_buff *);
35 int (*open)(void *);
36 void (*close)(int, void *);
37 void (*remove)(void *);
Jeff Dikeb53f35a2007-10-16 01:27:31 -070038 int (*read)(int, struct sk_buff *skb, struct uml_net_private *);
39 int (*write)(int, struct sk_buff *skb, struct uml_net_private *);
Jeff Dike4ea21cd2007-02-10 01:43:56 -080040
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 void (*add_address)(unsigned char *, unsigned char *, void *);
42 void (*delete_address)(unsigned char *, unsigned char *, void *);
Paolo 'Blaisorblade' Giarrussoc74c69b2007-05-06 14:51:15 -070043 char user[0];
Linus Torvalds1da177e2005-04-16 15:20:36 -070044};
45
46struct net_kern_info {
47 void (*init)(struct net_device *, void *);
48 unsigned short (*protocol)(struct sk_buff *);
Jeff Dikeb53f35a2007-10-16 01:27:31 -070049 int (*read)(int, struct sk_buff *skb, struct uml_net_private *);
50 int (*write)(int, struct sk_buff *skb, struct uml_net_private *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070051};
52
53struct transport {
54 struct list_head list;
Jeff Diked3b7f692007-02-10 01:43:56 -080055 const char *name;
56 int (* const setup)(char *, char **, void *);
Jeff Dike5e7672e2006-09-27 01:50:33 -070057 const struct net_user_info *user;
58 const struct net_kern_info *kern;
Jeff Diked3b7f692007-02-10 01:43:56 -080059 const int private_size;
60 const int setup_size;
Linus Torvalds1da177e2005-04-16 15:20:36 -070061};
62
63extern struct net_device *ether_init(int);
64extern unsigned short ether_protocol(struct sk_buff *);
Jeff Dike4ea21cd2007-02-10 01:43:56 -080065extern int tap_setup_common(char *str, char *type, char **dev_name,
Linus Torvalds1da177e2005-04-16 15:20:36 -070066 char **mac_out, char **gate_addr);
67extern void register_transport(struct transport *new);
68extern unsigned short eth_protocol(struct sk_buff *skb);
69
70#endif