net_kern.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright (C) 2002 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
  3. * Licensed under the GPL
  4. */
  5. #ifndef __UM_NET_KERN_H
  6. #define __UM_NET_KERN_H
  7. #include <linux/netdevice.h>
  8. #include <linux/platform_device.h>
  9. #include <linux/skbuff.h>
  10. #include <linux/socket.h>
  11. #include <linux/list.h>
  12. #include <linux/workqueue.h>
  13. struct uml_net {
  14. struct list_head list;
  15. struct net_device *dev;
  16. struct platform_device pdev;
  17. int index;
  18. };
  19. struct uml_net_private {
  20. struct list_head list;
  21. spinlock_t lock;
  22. struct net_device *dev;
  23. struct timer_list tl;
  24. struct work_struct work;
  25. int fd;
  26. unsigned char mac[ETH_ALEN];
  27. int max_packet;
  28. unsigned short (*protocol)(struct sk_buff *);
  29. int (*open)(void *);
  30. void (*close)(int, void *);
  31. void (*remove)(void *);
  32. int (*read)(int, struct sk_buff *skb, struct uml_net_private *);
  33. int (*write)(int, struct sk_buff *skb, struct uml_net_private *);
  34. void (*add_address)(unsigned char *, unsigned char *, void *);
  35. void (*delete_address)(unsigned char *, unsigned char *, void *);
  36. char user[0];
  37. };
  38. struct net_kern_info {
  39. void (*init)(struct net_device *, void *);
  40. unsigned short (*protocol)(struct sk_buff *);
  41. int (*read)(int, struct sk_buff *skb, struct uml_net_private *);
  42. int (*write)(int, struct sk_buff *skb, struct uml_net_private *);
  43. };
  44. struct transport {
  45. struct list_head list;
  46. const char *name;
  47. int (* const setup)(char *, char **, void *);
  48. const struct net_user_info *user;
  49. const struct net_kern_info *kern;
  50. const int private_size;
  51. const int setup_size;
  52. };
  53. extern struct net_device *ether_init(int);
  54. extern unsigned short ether_protocol(struct sk_buff *);
  55. extern int tap_setup_common(char *str, char *type, char **dev_name,
  56. char **mac_out, char **gate_addr);
  57. extern void register_transport(struct transport *new);
  58. extern unsigned short eth_protocol(struct sk_buff *skb);
  59. #endif