The OpenD Programming Language

1 //Written in the D programming language
2 
3 /++
4     D header file for Linux's linux/if_arp.h.
5 
6     Copyright: Copyright 2023
7     License:   $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
8     Authors:   $(HTTP jmdavisprog.com, Jonathan M Davis)
9  +/
10 module core.sys.linux.linux.if_arp;
11 
12 version (linux):
13 extern(C):
14 @nogc:
15 nothrow:
16 
17 import core.sys.posix.net.if_ : IF_NAMESIZE;
18 import core.sys.posix.sys.socket : sockaddr;
19 
20 enum : ushort
21 {
22     ARPHRD_NETROM     = 0,
23     ARPHRD_ETHER      = 1,
24     ARPHRD_EETHER     = 2,
25     ARPHRD_AX25       = 3,
26     ARPHRD_PRONET     = 4,
27     ARPHRD_CHAOS      = 5,
28     ARPHRD_IEEE802    = 6,
29     ARPHRD_ARCNET     = 7,
30     ARPHRD_APPLETLK   = 8,
31     ARPHRD_DLCI       =15,
32     ARPHRD_ATM        =19,
33     ARPHRD_METRICOM   = 23,
34     ARPHRD_IEEE1394   = 24,
35     ARPHRD_EUI64      = 27,
36     ARPHRD_INFINIBAND = 32,
37 
38     ARPHRD_SLIP    = 256,
39     ARPHRD_CSLIP   = 257,
40     ARPHRD_SLIP6   = 258,
41     ARPHRD_CSLIP6  = 259,
42     ARPHRD_RSRVD   = 260,
43     ARPHRD_ADAPT   = 264,
44     ARPHRD_ROSE    = 270,
45     ARPHRD_X25     = 271,
46     ARPHRD_HWX25   = 272,
47     ARPHRD_CAN     = 280,
48     ARPHRD_MCTP    = 290,
49     ARPHRD_PPP     = 512,
50     ARPHRD_CISCO   = 513,
51     ARPHRD_HDLC    = ARPHRD_CISCO,
52     ARPHRD_LAPB    = 516,
53     ARPHRD_DDCMP   = 517,
54     ARPHRD_RAWHDLC = 518,
55     ARPHRD_RAWIP   = 519,
56 
57     ARPHRD_TUNNEL   = 768,
58     ARPHRD_TUNNEL6  = 769,
59     ARPHRD_FRAD     = 770,
60     ARPHRD_SKIP     = 771,
61     ARPHRD_LOOPBACK = 772,
62     ARPHRD_LOCALTLK = 773,
63     ARPHRD_FDDI     = 774,
64     ARPHRD_BIF      = 775,
65     ARPHRD_SIT      = 776,
66     ARPHRD_IPDDP    = 777,
67     ARPHRD_IPGRE    = 778,
68     ARPHRD_PIMREG   = 779,
69     ARPHRD_HIPPI    = 780,
70     ARPHRD_ASH      = 781,
71     ARPHRD_ECONET   = 782,
72     ARPHRD_IRDA     = 783,
73 
74     ARPHRD_FCPP     = 784,
75     ARPHRD_FCAL     = 785,
76     ARPHRD_FCPL     = 786,
77     ARPHRD_FCFABRIC = 787,
78 
79     ARPHRD_IEEE802_TR         = 800,
80     ARPHRD_IEEE80211          = 801,
81     ARPHRD_IEEE80211_PRISM    = 802,
82     ARPHRD_IEEE80211_RADIOTAP = 803,
83     ARPHRD_IEEE802154         = 804,
84     ARPHRD_IEEE802154_MONITOR = 805,
85 
86     ARPHRD_PHONET      = 820,
87     ARPHRD_PHONET_PIPE = 821,
88     ARPHRD_CAIF        = 822,
89     ARPHRD_IP6GRE      = 823,
90     ARPHRD_NETLINK     = 824,
91     ARPHRD_6LOWPAN     = 825,
92     ARPHRD_VSOCKMON    = 826,
93 
94     ARPHRD_VOID = 0xFFFF,
95     ARPHRD_NONE = 0xFFFE,
96 }
97 
98 enum : ushort
99 {
100     ARPOP_REQUEST   = 1,
101     ARPOP_REPLY     = 2,
102     ARPOP_RREQUEST  = 3,
103     ARPOP_RREPLY    = 4,
104     ARPOP_InREQUEST = 8,
105     ARPOP_InREPLY   = 9,
106     ARPOP_NAK       = 10,
107 }
108 
109 struct arpreq
110 {
111     sockaddr          arp_pa;
112     sockaddr          arp_ha;
113     int               arp_flags;
114     sockaddr          arp_netmask;
115     char[IF_NAMESIZE] arp_dev;
116 }
117 
118 enum
119 {
120     ATF_COM         = 0x02,
121     ATF_PERM        = 0x04,
122     ATF_PUBL        = 0x08,
123     ATF_USETRAILERS = 0x10,
124     ATF_NETMASK     = 0x20,
125 
126     ATF_DONTPUB     = 0x40,
127 }
128 
129 struct arphdr
130 {
131     ushort ar_hrd;
132     ushort ar_pro;
133     ubyte  ar_hln;
134     ubyte  ar_pln;
135     ushort ar_op;
136 }