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.

ip6.h 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #ifndef _GPXE_IP6_H
  2. #define _GPXE_IP6_H
  3. /** @file
  4. *
  5. * IP6 protocol
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER );
  9. #include <stdint.h>
  10. #include <gpxe/in.h>
  11. /* IP6 constants */
  12. #define IP6_VERSION 0x6
  13. #define IP6_HOP_LIMIT 255
  14. /**
  15. * I/O buffer contents
  16. * This is duplicated in tcp.h and here. Ideally it should go into iobuf.h
  17. */
  18. #define MAX_HDR_LEN 100
  19. #define MAX_IOB_LEN 1500
  20. #define MIN_IOB_LEN MAX_HDR_LEN + 100 /* To account for padding by LL */
  21. #define IP6_EQUAL( in6_addr1, in6_addr2 ) \
  22. ( memcmp ( ( char* ) &( in6_addr1 ), ( char* ) &( in6_addr2 ),\
  23. sizeof ( struct in6_addr ) ) == 0 )
  24. #define IS_UNSPECIFIED( addr ) \
  25. ( ( (addr).in6_u.u6_addr32[0] == 0x00000000 ) && \
  26. ( (addr).in6_u.u6_addr32[1] == 0x00000000 ) && \
  27. ( (addr).in6_u.u6_addr32[2] == 0x00000000 ) && \
  28. ( (addr).in6_u.u6_addr32[3] == 0x00000000 ) )
  29. /* IP6 header */
  30. struct ip6_header {
  31. uint32_t ver_traffic_class_flow_label;
  32. uint16_t payload_len;
  33. uint8_t nxt_hdr;
  34. uint8_t hop_limit;
  35. struct in6_addr src;
  36. struct in6_addr dest;
  37. };
  38. /* IP6 pseudo header */
  39. struct ipv6_pseudo_header {
  40. struct in6_addr src;
  41. struct in6_addr dest;
  42. uint8_t zero_padding;
  43. uint8_t nxt_hdr;
  44. uint16_t len;
  45. };
  46. /* Next header numbers */
  47. #define IP6_HOPBYHOP 0x00
  48. #define IP6_ROUTING 0x43
  49. #define IP6_FRAGMENT 0x44
  50. #define IP6_AUTHENTICATION 0x51
  51. #define IP6_DEST_OPTS 0x60
  52. #define IP6_ESP 0x50
  53. #define IP6_ICMP6 0x58
  54. #define IP6_NO_HEADER 0x59
  55. struct io_buffer;
  56. struct net_device;
  57. struct net_protocol;
  58. extern struct net_protocol ipv6_protocol;
  59. extern struct tcpip_net_protocol ipv6_tcpip_protocol;
  60. extern char * inet6_ntoa ( struct in6_addr in6 );
  61. extern int add_ipv6_address ( struct net_device *netdev,
  62. struct in6_addr prefix, int prefix_len,
  63. struct in6_addr address,
  64. struct in6_addr gateway );
  65. extern void del_ipv6_address ( struct net_device *netdev );
  66. #endif /* _GPXE_IP6_H */