if_arp.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /* Nonstandard header */
  2. #ifndef _NET_IF_ARP_H
  3. #define _NET_IF_ARP_H
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. #include <inttypes.h>
  8. #include <sys/types.h>
  9. #include <sys/socket.h>
  10. #define MAX_ADDR_LEN 7
  11. #define ARPOP_REQUEST 1
  12. #define ARPOP_REPLY 2
  13. #define ARPOP_RREQUEST 3
  14. #define ARPOP_RREPLY 4
  15. #define ARPOP_InREQUEST 8
  16. #define ARPOP_InREPLY 9
  17. #define ARPOP_NAK 10
  18. struct arphdr {
  19. uint16_t ar_hrd;
  20. uint16_t ar_pro;
  21. uint8_t ar_hln;
  22. uint8_t ar_pln;
  23. uint16_t ar_op;
  24. };
  25. #define ARPHRD_NETROM 0
  26. #define ARPHRD_ETHER 1
  27. #define ARPHRD_EETHER 2
  28. #define ARPHRD_AX25 3
  29. #define ARPHRD_PRONET 4
  30. #define ARPHRD_CHAOS 5
  31. #define ARPHRD_IEEE802 6
  32. #define ARPHRD_ARCNET 7
  33. #define ARPHRD_APPLETLK 8
  34. #define ARPHRD_DLCI 15
  35. #define ARPHRD_ATM 19
  36. #define ARPHRD_METRICOM 23
  37. #define ARPHRD_IEEE1394 24
  38. #define ARPHRD_EUI64 27
  39. #define ARPHRD_INFINIBAND 32
  40. #define ARPHRD_SLIP 256
  41. #define ARPHRD_CSLIP 257
  42. #define ARPHRD_SLIP6 258
  43. #define ARPHRD_CSLIP6 259
  44. #define ARPHRD_RSRVD 260
  45. #define ARPHRD_ADAPT 264
  46. #define ARPHRD_ROSE 270
  47. #define ARPHRD_X25 271
  48. #define ARPHRD_HWX25 272
  49. #define ARPHRD_CAN 280
  50. #define ARPHRD_PPP 512
  51. #define ARPHRD_CISCO 513
  52. #define ARPHRD_HDLC ARPHRD_CISCO
  53. #define ARPHRD_LAPB 516
  54. #define ARPHRD_DDCMP 517
  55. #define ARPHRD_RAWHDLC 518
  56. #define ARPHRD_TUNNEL 768
  57. #define ARPHRD_TUNNEL6 769
  58. #define ARPHRD_FRAD 770
  59. #define ARPHRD_SKIP 771
  60. #define ARPHRD_LOOPBACK 772
  61. #define ARPHRD_LOCALTLK 773
  62. #define ARPHRD_FDDI 774
  63. #define ARPHRD_BIF 775
  64. #define ARPHRD_SIT 776
  65. #define ARPHRD_IPDDP 777
  66. #define ARPHRD_IPGRE 778
  67. #define ARPHRD_PIMREG 779
  68. #define ARPHRD_HIPPI 780
  69. #define ARPHRD_ASH 781
  70. #define ARPHRD_ECONET 782
  71. #define ARPHRD_IRDA 783
  72. #define ARPHRD_FCPP 784
  73. #define ARPHRD_FCAL 785
  74. #define ARPHRD_FCPL 786
  75. #define ARPHRD_FCFABRIC 787
  76. #define ARPHRD_IEEE802_TR 800
  77. #define ARPHRD_IEEE80211 801
  78. #define ARPHRD_IEEE80211_PRISM 802
  79. #define ARPHRD_IEEE80211_RADIOTAP 803
  80. #define ARPHRD_IEEE802154 804
  81. #define ARPHRD_IEEE802154_MONITOR 805
  82. #define ARPHRD_PHONET 820
  83. #define ARPHRD_PHONET_PIPE 821
  84. #define ARPHRD_CAIF 822
  85. #define ARPHRD_IP6GRE 823
  86. #define ARPHRD_NETLINK 824
  87. #define ARPHRD_VOID 0xFFFF
  88. #define ARPHRD_NONE 0xFFFE
  89. struct arpreq {
  90. struct sockaddr arp_pa;
  91. struct sockaddr arp_ha;
  92. int arp_flags;
  93. struct sockaddr arp_netmask;
  94. char arp_dev[16];
  95. };
  96. struct arpreq_old {
  97. struct sockaddr arp_pa;
  98. struct sockaddr arp_ha;
  99. int arp_flags;
  100. struct sockaddr arp_netmask;
  101. };
  102. #define ATF_COM 0x02
  103. #define ATF_PERM 0x04
  104. #define ATF_PUBL 0x08
  105. #define ATF_USETRAILERS 0x10
  106. #define ATF_NETMASK 0x20
  107. #define ATF_DONTPUB 0x40
  108. #define ATF_MAGIC 0x80
  109. #define ARPD_UPDATE 0x01
  110. #define ARPD_LOOKUP 0x02
  111. #define ARPD_FLUSH 0x03
  112. struct arpd_request {
  113. unsigned short req;
  114. uint32_t ip;
  115. unsigned long dev;
  116. unsigned long stamp;
  117. unsigned long updated;
  118. unsigned char ha[MAX_ADDR_LEN];
  119. };
  120. #ifdef __cplusplus
  121. }
  122. #endif
  123. #endif