Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

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