defs_freebsd.go 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. // Copyright 2016 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // +build ignore
  5. package route
  6. /*
  7. #include <sys/socket.h>
  8. #include <sys/sysctl.h>
  9. #include <net/if.h>
  10. #include <net/if_dl.h>
  11. #include <net/route.h>
  12. #include <netinet/in.h>
  13. struct if_data_freebsd7 {
  14. u_char ifi_type;
  15. u_char ifi_physical;
  16. u_char ifi_addrlen;
  17. u_char ifi_hdrlen;
  18. u_char ifi_link_state;
  19. u_char ifi_spare_char1;
  20. u_char ifi_spare_char2;
  21. u_char ifi_datalen;
  22. u_long ifi_mtu;
  23. u_long ifi_metric;
  24. u_long ifi_baudrate;
  25. u_long ifi_ipackets;
  26. u_long ifi_ierrors;
  27. u_long ifi_opackets;
  28. u_long ifi_oerrors;
  29. u_long ifi_collisions;
  30. u_long ifi_ibytes;
  31. u_long ifi_obytes;
  32. u_long ifi_imcasts;
  33. u_long ifi_omcasts;
  34. u_long ifi_iqdrops;
  35. u_long ifi_noproto;
  36. u_long ifi_hwassist;
  37. time_t __ifi_epoch;
  38. struct timeval __ifi_lastchange;
  39. };
  40. struct if_data_freebsd8 {
  41. u_char ifi_type;
  42. u_char ifi_physical;
  43. u_char ifi_addrlen;
  44. u_char ifi_hdrlen;
  45. u_char ifi_link_state;
  46. u_char ifi_spare_char1;
  47. u_char ifi_spare_char2;
  48. u_char ifi_datalen;
  49. u_long ifi_mtu;
  50. u_long ifi_metric;
  51. u_long ifi_baudrate;
  52. u_long ifi_ipackets;
  53. u_long ifi_ierrors;
  54. u_long ifi_opackets;
  55. u_long ifi_oerrors;
  56. u_long ifi_collisions;
  57. u_long ifi_ibytes;
  58. u_long ifi_obytes;
  59. u_long ifi_imcasts;
  60. u_long ifi_omcasts;
  61. u_long ifi_iqdrops;
  62. u_long ifi_noproto;
  63. u_long ifi_hwassist;
  64. time_t __ifi_epoch;
  65. struct timeval __ifi_lastchange;
  66. };
  67. struct if_data_freebsd9 {
  68. u_char ifi_type;
  69. u_char ifi_physical;
  70. u_char ifi_addrlen;
  71. u_char ifi_hdrlen;
  72. u_char ifi_link_state;
  73. u_char ifi_spare_char1;
  74. u_char ifi_spare_char2;
  75. u_char ifi_datalen;
  76. u_long ifi_mtu;
  77. u_long ifi_metric;
  78. u_long ifi_baudrate;
  79. u_long ifi_ipackets;
  80. u_long ifi_ierrors;
  81. u_long ifi_opackets;
  82. u_long ifi_oerrors;
  83. u_long ifi_collisions;
  84. u_long ifi_ibytes;
  85. u_long ifi_obytes;
  86. u_long ifi_imcasts;
  87. u_long ifi_omcasts;
  88. u_long ifi_iqdrops;
  89. u_long ifi_noproto;
  90. u_long ifi_hwassist;
  91. time_t __ifi_epoch;
  92. struct timeval __ifi_lastchange;
  93. };
  94. struct if_data_freebsd10 {
  95. u_char ifi_type;
  96. u_char ifi_physical;
  97. u_char ifi_addrlen;
  98. u_char ifi_hdrlen;
  99. u_char ifi_link_state;
  100. u_char ifi_vhid;
  101. u_char ifi_baudrate_pf;
  102. u_char ifi_datalen;
  103. u_long ifi_mtu;
  104. u_long ifi_metric;
  105. u_long ifi_baudrate;
  106. u_long ifi_ipackets;
  107. u_long ifi_ierrors;
  108. u_long ifi_opackets;
  109. u_long ifi_oerrors;
  110. u_long ifi_collisions;
  111. u_long ifi_ibytes;
  112. u_long ifi_obytes;
  113. u_long ifi_imcasts;
  114. u_long ifi_omcasts;
  115. u_long ifi_iqdrops;
  116. u_long ifi_noproto;
  117. uint64_t ifi_hwassist;
  118. time_t __ifi_epoch;
  119. struct timeval __ifi_lastchange;
  120. };
  121. struct if_data_freebsd11 {
  122. uint8_t ifi_type;
  123. uint8_t ifi_physical;
  124. uint8_t ifi_addrlen;
  125. uint8_t ifi_hdrlen;
  126. uint8_t ifi_link_state;
  127. uint8_t ifi_vhid;
  128. uint16_t ifi_datalen;
  129. uint32_t ifi_mtu;
  130. uint32_t ifi_metric;
  131. uint64_t ifi_baudrate;
  132. uint64_t ifi_ipackets;
  133. uint64_t ifi_ierrors;
  134. uint64_t ifi_opackets;
  135. uint64_t ifi_oerrors;
  136. uint64_t ifi_collisions;
  137. uint64_t ifi_ibytes;
  138. uint64_t ifi_obytes;
  139. uint64_t ifi_imcasts;
  140. uint64_t ifi_omcasts;
  141. uint64_t ifi_iqdrops;
  142. uint64_t ifi_oqdrops;
  143. uint64_t ifi_noproto;
  144. uint64_t ifi_hwassist;
  145. union {
  146. time_t tt;
  147. uint64_t ph;
  148. } __ifi_epoch;
  149. union {
  150. struct timeval tv;
  151. struct {
  152. uint64_t ph1;
  153. uint64_t ph2;
  154. } ph;
  155. } __ifi_lastchange;
  156. };
  157. struct if_msghdr_freebsd7 {
  158. u_short ifm_msglen;
  159. u_char ifm_version;
  160. u_char ifm_type;
  161. int ifm_addrs;
  162. int ifm_flags;
  163. u_short ifm_index;
  164. struct if_data_freebsd7 ifm_data;
  165. };
  166. struct if_msghdr_freebsd8 {
  167. u_short ifm_msglen;
  168. u_char ifm_version;
  169. u_char ifm_type;
  170. int ifm_addrs;
  171. int ifm_flags;
  172. u_short ifm_index;
  173. struct if_data_freebsd8 ifm_data;
  174. };
  175. struct if_msghdr_freebsd9 {
  176. u_short ifm_msglen;
  177. u_char ifm_version;
  178. u_char ifm_type;
  179. int ifm_addrs;
  180. int ifm_flags;
  181. u_short ifm_index;
  182. struct if_data_freebsd9 ifm_data;
  183. };
  184. struct if_msghdr_freebsd10 {
  185. u_short ifm_msglen;
  186. u_char ifm_version;
  187. u_char ifm_type;
  188. int ifm_addrs;
  189. int ifm_flags;
  190. u_short ifm_index;
  191. struct if_data_freebsd10 ifm_data;
  192. };
  193. struct if_msghdr_freebsd11 {
  194. u_short ifm_msglen;
  195. u_char ifm_version;
  196. u_char ifm_type;
  197. int ifm_addrs;
  198. int ifm_flags;
  199. u_short ifm_index;
  200. struct if_data_freebsd11 ifm_data;
  201. };
  202. */
  203. import "C"
  204. const (
  205. sysAF_UNSPEC = C.AF_UNSPEC
  206. sysAF_INET = C.AF_INET
  207. sysAF_ROUTE = C.AF_ROUTE
  208. sysAF_LINK = C.AF_LINK
  209. sysAF_INET6 = C.AF_INET6
  210. sysSOCK_RAW = C.SOCK_RAW
  211. sysNET_RT_DUMP = C.NET_RT_DUMP
  212. sysNET_RT_FLAGS = C.NET_RT_FLAGS
  213. sysNET_RT_IFLIST = C.NET_RT_IFLIST
  214. sysNET_RT_IFMALIST = C.NET_RT_IFMALIST
  215. sysNET_RT_IFLISTL = C.NET_RT_IFLISTL
  216. )
  217. const (
  218. sysCTL_MAXNAME = C.CTL_MAXNAME
  219. sysCTL_UNSPEC = C.CTL_UNSPEC
  220. sysCTL_KERN = C.CTL_KERN
  221. sysCTL_VM = C.CTL_VM
  222. sysCTL_VFS = C.CTL_VFS
  223. sysCTL_NET = C.CTL_NET
  224. sysCTL_DEBUG = C.CTL_DEBUG
  225. sysCTL_HW = C.CTL_HW
  226. sysCTL_MACHDEP = C.CTL_MACHDEP
  227. sysCTL_USER = C.CTL_USER
  228. sysCTL_P1003_1B = C.CTL_P1003_1B
  229. )
  230. const (
  231. sysRTM_VERSION = C.RTM_VERSION
  232. sysRTM_ADD = C.RTM_ADD
  233. sysRTM_DELETE = C.RTM_DELETE
  234. sysRTM_CHANGE = C.RTM_CHANGE
  235. sysRTM_GET = C.RTM_GET
  236. sysRTM_LOSING = C.RTM_LOSING
  237. sysRTM_REDIRECT = C.RTM_REDIRECT
  238. sysRTM_MISS = C.RTM_MISS
  239. sysRTM_LOCK = C.RTM_LOCK
  240. sysRTM_RESOLVE = C.RTM_RESOLVE
  241. sysRTM_NEWADDR = C.RTM_NEWADDR
  242. sysRTM_DELADDR = C.RTM_DELADDR
  243. sysRTM_IFINFO = C.RTM_IFINFO
  244. sysRTM_NEWMADDR = C.RTM_NEWMADDR
  245. sysRTM_DELMADDR = C.RTM_DELMADDR
  246. sysRTM_IFANNOUNCE = C.RTM_IFANNOUNCE
  247. sysRTM_IEEE80211 = C.RTM_IEEE80211
  248. sysRTA_DST = C.RTA_DST
  249. sysRTA_GATEWAY = C.RTA_GATEWAY
  250. sysRTA_NETMASK = C.RTA_NETMASK
  251. sysRTA_GENMASK = C.RTA_GENMASK
  252. sysRTA_IFP = C.RTA_IFP
  253. sysRTA_IFA = C.RTA_IFA
  254. sysRTA_AUTHOR = C.RTA_AUTHOR
  255. sysRTA_BRD = C.RTA_BRD
  256. sysRTAX_DST = C.RTAX_DST
  257. sysRTAX_GATEWAY = C.RTAX_GATEWAY
  258. sysRTAX_NETMASK = C.RTAX_NETMASK
  259. sysRTAX_GENMASK = C.RTAX_GENMASK
  260. sysRTAX_IFP = C.RTAX_IFP
  261. sysRTAX_IFA = C.RTAX_IFA
  262. sysRTAX_AUTHOR = C.RTAX_AUTHOR
  263. sysRTAX_BRD = C.RTAX_BRD
  264. sysRTAX_MAX = C.RTAX_MAX
  265. )
  266. const (
  267. sizeofIfMsghdrlFreeBSD10 = C.sizeof_struct_if_msghdrl
  268. sizeofIfaMsghdrFreeBSD10 = C.sizeof_struct_ifa_msghdr
  269. sizeofIfaMsghdrlFreeBSD10 = C.sizeof_struct_ifa_msghdrl
  270. sizeofIfmaMsghdrFreeBSD10 = C.sizeof_struct_ifma_msghdr
  271. sizeofIfAnnouncemsghdrFreeBSD10 = C.sizeof_struct_if_announcemsghdr
  272. sizeofRtMsghdrFreeBSD10 = C.sizeof_struct_rt_msghdr
  273. sizeofRtMetricsFreeBSD10 = C.sizeof_struct_rt_metrics
  274. sizeofIfMsghdrFreeBSD7 = C.sizeof_struct_if_msghdr_freebsd7
  275. sizeofIfMsghdrFreeBSD8 = C.sizeof_struct_if_msghdr_freebsd8
  276. sizeofIfMsghdrFreeBSD9 = C.sizeof_struct_if_msghdr_freebsd9
  277. sizeofIfMsghdrFreeBSD10 = C.sizeof_struct_if_msghdr_freebsd10
  278. sizeofIfMsghdrFreeBSD11 = C.sizeof_struct_if_msghdr_freebsd11
  279. sizeofIfDataFreeBSD7 = C.sizeof_struct_if_data_freebsd7
  280. sizeofIfDataFreeBSD8 = C.sizeof_struct_if_data_freebsd8
  281. sizeofIfDataFreeBSD9 = C.sizeof_struct_if_data_freebsd9
  282. sizeofIfDataFreeBSD10 = C.sizeof_struct_if_data_freebsd10
  283. sizeofIfDataFreeBSD11 = C.sizeof_struct_if_data_freebsd11
  284. sizeofIfMsghdrlFreeBSD10Emu = C.sizeof_struct_if_msghdrl
  285. sizeofIfaMsghdrFreeBSD10Emu = C.sizeof_struct_ifa_msghdr
  286. sizeofIfaMsghdrlFreeBSD10Emu = C.sizeof_struct_ifa_msghdrl
  287. sizeofIfmaMsghdrFreeBSD10Emu = C.sizeof_struct_ifma_msghdr
  288. sizeofIfAnnouncemsghdrFreeBSD10Emu = C.sizeof_struct_if_announcemsghdr
  289. sizeofRtMsghdrFreeBSD10Emu = C.sizeof_struct_rt_msghdr
  290. sizeofRtMetricsFreeBSD10Emu = C.sizeof_struct_rt_metrics
  291. sizeofIfMsghdrFreeBSD7Emu = C.sizeof_struct_if_msghdr_freebsd7
  292. sizeofIfMsghdrFreeBSD8Emu = C.sizeof_struct_if_msghdr_freebsd8
  293. sizeofIfMsghdrFreeBSD9Emu = C.sizeof_struct_if_msghdr_freebsd9
  294. sizeofIfMsghdrFreeBSD10Emu = C.sizeof_struct_if_msghdr_freebsd10
  295. sizeofIfMsghdrFreeBSD11Emu = C.sizeof_struct_if_msghdr_freebsd11
  296. sizeofIfDataFreeBSD7Emu = C.sizeof_struct_if_data_freebsd7
  297. sizeofIfDataFreeBSD8Emu = C.sizeof_struct_if_data_freebsd8
  298. sizeofIfDataFreeBSD9Emu = C.sizeof_struct_if_data_freebsd9
  299. sizeofIfDataFreeBSD10Emu = C.sizeof_struct_if_data_freebsd10
  300. sizeofIfDataFreeBSD11Emu = C.sizeof_struct_if_data_freebsd11
  301. sizeofSockaddrStorage = C.sizeof_struct_sockaddr_storage
  302. sizeofSockaddrInet = C.sizeof_struct_sockaddr_in
  303. sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
  304. )