defs_freebsd.go 8.0 KB

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