PageRenderTime 29ms CodeModel.GetById 0ms RepoModel.GetById 1ms app.codeStats 0ms

servers/lwip/driver.h

http://www.minix3.org/
C Header | 56 lines | 42 code | 10 blank | 4 comment | 0 complexity | 8de49af2746c8c1e9585ae5913e4327f MD5 | raw file
Possible License(s): MIT, WTFPL, AGPL-1.0, BSD-3-Clause, GPL-3.0, LGPL-2.0, JSON, 0BSD
  1. #ifndef __LWIP_DRIVER_H_
  2. #define __LWIP_DRIVER_H_
  3. #include <minix/endpoint.h>
  4. #include <minix/ds.h>
  5. #include <lwip/pbuf.h>
  6. #define NIC_NAME_LEN 6
  7. #define DRV_NAME_LEN DS_MAX_KEYLEN
  8. #define TX_IOVEC_NUM 16 /* something the drivers assume */
  9. struct packet_q {
  10. struct packet_q * next;
  11. unsigned buf_len;
  12. char buf[];
  13. };
  14. #define DRV_IDLE 0
  15. #define DRV_SENDING 1
  16. #define DRV_RECEIVING 2
  17. struct nic {
  18. unsigned flags;
  19. char name[NIC_NAME_LEN];
  20. char drv_name[DRV_NAME_LEN];
  21. endpoint_t drv_ep;
  22. int is_default;
  23. int state;
  24. cp_grant_id_t rx_iogrant;
  25. iovec_s_t rx_iovec[1];
  26. struct pbuf * rx_pbuf;
  27. cp_grant_id_t tx_iogrant;
  28. iovec_s_t tx_iovec[TX_IOVEC_NUM];
  29. struct packet_q * tx_head;
  30. struct packet_q * tx_tail;
  31. void * tx_buffer;
  32. struct netif netif;
  33. unsigned max_pkt_sz;
  34. unsigned min_pkt_sz;
  35. struct socket * raw_socket;
  36. };
  37. int driver_tx_enqueue(struct nic * nic, struct pbuf * pbuf);
  38. void driver_tx_dequeue(struct nic * nic);
  39. struct packet_q * driver_tx_head(struct nic * nic);
  40. /*
  41. * Transmit the next packet in the TX queue of this device. Returns 1 if
  42. * success, 0 otherwise.
  43. */
  44. int driver_tx(struct nic * nic);
  45. int raw_socket_input(struct pbuf * pbuf, struct nic * nic);
  46. #endif /* __LWIP_DRIVER_H_ */