netif.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* $OpenBSD: netif.h,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */
  2. /* $NetBSD: netif.h,v 1.4 1995/09/14 23:45:30 pk Exp $ */
  3. #ifndef __SYS_LIBNETBOOT_NETIF_H
  4. #define __SYS_LIBNETBOOT_NETIF_H
  5. #include "iodesc.h"
  6. struct netif_driver {
  7. char *netif_bname;
  8. int (*netif_match)(struct netif *, void *);
  9. int (*netif_probe)(struct netif *, void *);
  10. void (*netif_init)(struct iodesc *, void *);
  11. int (*netif_get)(struct iodesc *, void *, size_t, time_t);
  12. int (*netif_put)(struct iodesc *, void *, size_t);
  13. void (*netif_end)(struct netif *);
  14. struct netif_dif *netif_ifs;
  15. int netif_nifs;
  16. };
  17. struct netif_dif {
  18. int dif_unit;
  19. int dif_nsel;
  20. struct netif_stats *dif_stats;
  21. void *dif_private;
  22. /* the following fields are used internally by the netif layer */
  23. u_long dif_used;
  24. };
  25. struct netif_stats {
  26. int collisions;
  27. int collision_error;
  28. int missed;
  29. int sent;
  30. int received;
  31. int deferred;
  32. int overflow;
  33. };
  34. struct netif {
  35. struct netif_driver *nif_driver;
  36. int nif_unit;
  37. int nif_sel;
  38. void *nif_devdata;
  39. };
  40. extern struct netif_driver *netif_drivers[]; /* machdep */
  41. extern int n_netif_drivers;
  42. extern int netif_debug;
  43. void netif_init(void);
  44. struct netif *netif_select(void *);
  45. int netif_probe(struct netif *, void *);
  46. void netif_attach(struct netif *, struct iodesc *, void *);
  47. void netif_detach(struct netif *);
  48. ssize_t netif_get(struct iodesc *, void *, size_t, time_t);
  49. ssize_t netif_put(struct iodesc *, void *, size_t);
  50. int netif_open(void *);
  51. int netif_close(int);
  52. struct iodesc *socktodesc(int);
  53. #endif /* __SYS_LIBNETBOOT_NETIF_H */