You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ip.h 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef _GPXE_IP_H
  2. #define _GPXE_IP_H
  3. /** @file
  4. *
  5. * IP protocol
  6. *
  7. */
  8. #include <ip.h>
  9. #include <gpxe/retry.h>
  10. /* IP constants */
  11. #define IP_VER 0x40U
  12. #define IP_MASK_VER 0xf0U
  13. #define IP_MASK_HLEN 0x0fU
  14. #define IP_MASK_OFFSET 0x1fffU
  15. #define IP_MASK_DONOTFRAG 0x4000U
  16. #define IP_MASK_MOREFRAGS 0x2000U
  17. #define IP_PSHLEN 12
  18. /* IP header defaults */
  19. #define IP_TOS 0
  20. #define IP_TTL 64
  21. #define IP_FRAG_IOB_SIZE 1500
  22. #define IP_FRAG_TIMEOUT 50
  23. /* IP4 pseudo header */
  24. struct ipv4_pseudo_header {
  25. struct in_addr src;
  26. struct in_addr dest;
  27. uint8_t zero_padding;
  28. uint8_t protocol;
  29. uint16_t len;
  30. };
  31. /** An IPv4 address/routing table entry */
  32. struct ipv4_miniroute {
  33. /** List of miniroutes */
  34. struct list_head list;
  35. /** Network device */
  36. struct net_device *netdev;
  37. /** IPv4 address */
  38. struct in_addr address;
  39. /** Subnet mask */
  40. struct in_addr netmask;
  41. /** Gateway address */
  42. struct in_addr gateway;
  43. };
  44. /* Fragment reassembly buffer */
  45. struct frag_buffer {
  46. /* Identification number */
  47. uint16_t ident;
  48. /* Source network address */
  49. struct in_addr src;
  50. /* Destination network address */
  51. struct in_addr dest;
  52. /* Reassembled I/O buffer */
  53. struct io_buffer *frag_iob;
  54. /* Reassembly timer */
  55. struct retry_timer frag_timer;
  56. /* List of fragment reassembly buffers */
  57. struct list_head list;
  58. };
  59. struct io_buffer;
  60. struct net_device;
  61. struct net_protocol;
  62. struct tcpip_protocol;
  63. extern struct list_head ipv4_miniroutes;
  64. extern struct net_protocol ipv4_protocol;
  65. extern int add_ipv4_address ( struct net_device *netdev,
  66. struct in_addr address, struct in_addr netmask,
  67. struct in_addr gateway );
  68. extern void del_ipv4_address ( struct net_device *netdev );
  69. #endif /* _GPXE_IP_H */