net_kern.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (C) 2002 Jeff Dike (jdike@karaya.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. unsigned char mac[ETH_ALEN];
  19. };
  20. struct uml_net_private {
  21. struct list_head list;
  22. spinlock_t lock;
  23. struct net_device *dev;
  24. struct timer_list tl;
  25. struct net_device_stats stats;
  26. struct work_struct work;
  27. int fd;
  28. unsigned char mac[ETH_ALEN];
  29. unsigned short (*protocol)(struct sk_buff *);
  30. int (*open)(void *);
  31. void (*close)(int, void *);
  32. void (*remove)(void *);
  33. int (*read)(int, struct sk_buff **skb, struct uml_net_private *);
  34. int (*write)(int, struct sk_buff **skb, struct uml_net_private *);
  35. void (*add_address)(unsigned char *, unsigned char *, void *);
  36. void (*delete_address)(unsigned char *, unsigned char *, void *);
  37. int (*set_mtu)(int mtu, void *);
  38. int user[1];
  39. };
  40. struct net_kern_info {
  41. void (*init)(struct net_device *, void *);
  42. unsigned short (*protocol)(struct sk_buff *);
  43. int (*read)(int, struct sk_buff **skb, struct uml_net_private *);
  44. int (*write)(int, struct sk_buff **skb, struct uml_net_private *);
  45. };
  46. struct transport {
  47. struct list_head list;
  48. const char *name;
  49. int (* const setup)(char *, char **, void *);
  50. const struct net_user_info *user;
  51. const struct net_kern_info *kern;
  52. const int private_size;
  53. const int setup_size;
  54. };
  55. extern struct net_device *ether_init(int);
  56. extern unsigned short ether_protocol(struct sk_buff *);
  57. extern struct sk_buff *ether_adjust_skb(struct sk_buff *skb, int extra);
  58. extern int tap_setup_common(char *str, char *type, char **dev_name,
  59. char **mac_out, char **gate_addr);
  60. extern void register_transport(struct transport *new);
  61. extern unsigned short eth_protocol(struct sk_buff *skb);
  62. #endif