2019-08-25 09:49:19 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2007-02-10 09:43:56 +00:00
|
|
|
/*
|
2007-10-16 08:27:31 +00:00
|
|
|
* Copyright (C) 2002 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __UM_NET_KERN_H
|
|
|
|
#define __UM_NET_KERN_H
|
|
|
|
|
2005-11-01 15:14:05 +00:00
|
|
|
#include <linux/netdevice.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/skbuff.h>
|
|
|
|
#include <linux/socket.h>
|
|
|
|
#include <linux/list.h>
|
2006-12-13 08:33:50 +00:00
|
|
|
#include <linux/workqueue.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
struct uml_net {
|
|
|
|
struct list_head list;
|
|
|
|
struct net_device *dev;
|
|
|
|
struct platform_device pdev;
|
|
|
|
int index;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct uml_net_private {
|
|
|
|
struct list_head list;
|
|
|
|
spinlock_t lock;
|
|
|
|
struct net_device *dev;
|
|
|
|
struct timer_list tl;
|
2009-03-26 15:11:16 +00:00
|
|
|
|
2006-12-13 08:33:50 +00:00
|
|
|
struct work_struct work;
|
2005-04-16 22:20:36 +00:00
|
|
|
int fd;
|
|
|
|
unsigned char mac[ETH_ALEN];
|
2007-10-16 08:27:31 +00:00
|
|
|
int max_packet;
|
2005-04-16 22:20:36 +00:00
|
|
|
unsigned short (*protocol)(struct sk_buff *);
|
|
|
|
int (*open)(void *);
|
|
|
|
void (*close)(int, void *);
|
|
|
|
void (*remove)(void *);
|
2007-10-16 08:27:31 +00:00
|
|
|
int (*read)(int, struct sk_buff *skb, struct uml_net_private *);
|
|
|
|
int (*write)(int, struct sk_buff *skb, struct uml_net_private *);
|
2007-02-10 09:43:56 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
void (*add_address)(unsigned char *, unsigned char *, void *);
|
|
|
|
void (*delete_address)(unsigned char *, unsigned char *, void *);
|
2007-05-06 21:51:15 +00:00
|
|
|
char user[0];
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct net_kern_info {
|
|
|
|
void (*init)(struct net_device *, void *);
|
|
|
|
unsigned short (*protocol)(struct sk_buff *);
|
2007-10-16 08:27:31 +00:00
|
|
|
int (*read)(int, struct sk_buff *skb, struct uml_net_private *);
|
|
|
|
int (*write)(int, struct sk_buff *skb, struct uml_net_private *);
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct transport {
|
|
|
|
struct list_head list;
|
2007-02-10 09:43:56 +00:00
|
|
|
const char *name;
|
|
|
|
int (* const setup)(char *, char **, void *);
|
2006-09-27 08:50:33 +00:00
|
|
|
const struct net_user_info *user;
|
|
|
|
const struct net_kern_info *kern;
|
2007-02-10 09:43:56 +00:00
|
|
|
const int private_size;
|
|
|
|
const int setup_size;
|
2005-04-16 22:20:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct net_device *ether_init(int);
|
|
|
|
extern unsigned short ether_protocol(struct sk_buff *);
|
2007-02-10 09:43:56 +00:00
|
|
|
extern int tap_setup_common(char *str, char *type, char **dev_name,
|
2005-04-16 22:20:36 +00:00
|
|
|
char **mac_out, char **gate_addr);
|
|
|
|
extern void register_transport(struct transport *new);
|
|
|
|
extern unsigned short eth_protocol(struct sk_buff *skb);
|
2017-11-20 21:17:59 +00:00
|
|
|
extern void uml_net_setup_etheraddr(struct net_device *dev, char *str);
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
#endif
|