File: defs_freebsd.go

package info (click to toggle)
golang-golang-x-net-dev 1%3A0.0%2Bgit20181201.351d144%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster, buster-backports, experimental
  • size: 5,676 kB
  • sloc: makefile: 53; asm: 18
file content (337 lines) | stat: -rw-r--r-- 8,387 bytes parent folder | download | duplicates (29)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build ignore

package route

/*
#include <sys/socket.h>
#include <sys/sysctl.h>

#include <net/if.h>
#include <net/if_dl.h>
#include <net/route.h>

#include <netinet/in.h>

struct if_data_freebsd7 {
	u_char ifi_type;
	u_char ifi_physical;
	u_char ifi_addrlen;
	u_char ifi_hdrlen;
	u_char ifi_link_state;
	u_char ifi_spare_char1;
	u_char ifi_spare_char2;
	u_char ifi_datalen;
	u_long ifi_mtu;
	u_long ifi_metric;
	u_long ifi_baudrate;
	u_long ifi_ipackets;
	u_long ifi_ierrors;
	u_long ifi_opackets;
	u_long ifi_oerrors;
	u_long ifi_collisions;
	u_long ifi_ibytes;
	u_long ifi_obytes;
	u_long ifi_imcasts;
	u_long ifi_omcasts;
	u_long ifi_iqdrops;
	u_long ifi_noproto;
	u_long ifi_hwassist;
	time_t __ifi_epoch;
	struct timeval __ifi_lastchange;
};

struct if_data_freebsd8 {
	u_char ifi_type;
	u_char ifi_physical;
	u_char ifi_addrlen;
	u_char ifi_hdrlen;
	u_char ifi_link_state;
	u_char ifi_spare_char1;
	u_char ifi_spare_char2;
	u_char ifi_datalen;
	u_long ifi_mtu;
	u_long ifi_metric;
	u_long ifi_baudrate;
	u_long ifi_ipackets;
	u_long ifi_ierrors;
	u_long ifi_opackets;
	u_long ifi_oerrors;
	u_long ifi_collisions;
	u_long ifi_ibytes;
	u_long ifi_obytes;
	u_long ifi_imcasts;
	u_long ifi_omcasts;
	u_long ifi_iqdrops;
	u_long ifi_noproto;
	u_long ifi_hwassist;
	time_t __ifi_epoch;
	struct timeval __ifi_lastchange;
};

struct if_data_freebsd9 {
	u_char ifi_type;
	u_char ifi_physical;
	u_char ifi_addrlen;
	u_char ifi_hdrlen;
	u_char ifi_link_state;
	u_char ifi_spare_char1;
	u_char ifi_spare_char2;
	u_char ifi_datalen;
	u_long ifi_mtu;
	u_long ifi_metric;
	u_long ifi_baudrate;
	u_long ifi_ipackets;
	u_long ifi_ierrors;
	u_long ifi_opackets;
	u_long ifi_oerrors;
	u_long ifi_collisions;
	u_long ifi_ibytes;
	u_long ifi_obytes;
	u_long ifi_imcasts;
	u_long ifi_omcasts;
	u_long ifi_iqdrops;
	u_long ifi_noproto;
	u_long ifi_hwassist;
	time_t __ifi_epoch;
	struct timeval __ifi_lastchange;
};

struct if_data_freebsd10 {
	u_char ifi_type;
	u_char ifi_physical;
	u_char ifi_addrlen;
	u_char ifi_hdrlen;
	u_char ifi_link_state;
	u_char ifi_vhid;
	u_char ifi_baudrate_pf;
	u_char ifi_datalen;
	u_long ifi_mtu;
	u_long ifi_metric;
	u_long ifi_baudrate;
	u_long ifi_ipackets;
	u_long ifi_ierrors;
	u_long ifi_opackets;
	u_long ifi_oerrors;
	u_long ifi_collisions;
	u_long ifi_ibytes;
	u_long ifi_obytes;
	u_long ifi_imcasts;
	u_long ifi_omcasts;
	u_long ifi_iqdrops;
	u_long ifi_noproto;
	uint64_t ifi_hwassist;
	time_t __ifi_epoch;
	struct timeval __ifi_lastchange;
};

struct if_data_freebsd11 {
	uint8_t ifi_type;
	uint8_t ifi_physical;
	uint8_t ifi_addrlen;
	uint8_t ifi_hdrlen;
	uint8_t ifi_link_state;
	uint8_t ifi_vhid;
	uint16_t ifi_datalen;
	uint32_t ifi_mtu;
	uint32_t ifi_metric;
	uint64_t ifi_baudrate;
	uint64_t ifi_ipackets;
	uint64_t ifi_ierrors;
	uint64_t ifi_opackets;
	uint64_t ifi_oerrors;
	uint64_t ifi_collisions;
	uint64_t ifi_ibytes;
	uint64_t ifi_obytes;
	uint64_t ifi_imcasts;
	uint64_t ifi_omcasts;
	uint64_t ifi_iqdrops;
	uint64_t ifi_oqdrops;
	uint64_t ifi_noproto;
	uint64_t ifi_hwassist;
	union {
		time_t tt;
		uint64_t ph;
	} __ifi_epoch;
	union {
		struct timeval tv;
		struct {
			uint64_t ph1;
			uint64_t ph2;
		} ph;
	} __ifi_lastchange;
};

struct if_msghdr_freebsd7 {
	u_short ifm_msglen;
	u_char ifm_version;
	u_char ifm_type;
	int ifm_addrs;
	int ifm_flags;
	u_short ifm_index;
	struct if_data_freebsd7 ifm_data;
};

struct if_msghdr_freebsd8 {
	u_short ifm_msglen;
	u_char ifm_version;
	u_char ifm_type;
	int ifm_addrs;
	int ifm_flags;
	u_short ifm_index;
	struct if_data_freebsd8 ifm_data;
};

struct if_msghdr_freebsd9 {
	u_short ifm_msglen;
	u_char ifm_version;
	u_char ifm_type;
	int ifm_addrs;
	int ifm_flags;
	u_short ifm_index;
	struct if_data_freebsd9 ifm_data;
};

struct if_msghdr_freebsd10 {
	u_short ifm_msglen;
	u_char ifm_version;
	u_char ifm_type;
	int ifm_addrs;
	int ifm_flags;
	u_short ifm_index;
	struct if_data_freebsd10 ifm_data;
};

struct if_msghdr_freebsd11 {
	u_short ifm_msglen;
	u_char ifm_version;
	u_char ifm_type;
	int ifm_addrs;
	int ifm_flags;
	u_short ifm_index;
	struct if_data_freebsd11 ifm_data;
};
*/
import "C"

const (
	sysAF_UNSPEC = C.AF_UNSPEC
	sysAF_INET   = C.AF_INET
	sysAF_ROUTE  = C.AF_ROUTE
	sysAF_LINK   = C.AF_LINK
	sysAF_INET6  = C.AF_INET6

	sysSOCK_RAW = C.SOCK_RAW

	sysNET_RT_DUMP     = C.NET_RT_DUMP
	sysNET_RT_FLAGS    = C.NET_RT_FLAGS
	sysNET_RT_IFLIST   = C.NET_RT_IFLIST
	sysNET_RT_IFMALIST = C.NET_RT_IFMALIST
	sysNET_RT_IFLISTL  = C.NET_RT_IFLISTL
)

const (
	sysCTL_MAXNAME = C.CTL_MAXNAME

	sysCTL_UNSPEC   = C.CTL_UNSPEC
	sysCTL_KERN     = C.CTL_KERN
	sysCTL_VM       = C.CTL_VM
	sysCTL_VFS      = C.CTL_VFS
	sysCTL_NET      = C.CTL_NET
	sysCTL_DEBUG    = C.CTL_DEBUG
	sysCTL_HW       = C.CTL_HW
	sysCTL_MACHDEP  = C.CTL_MACHDEP
	sysCTL_USER     = C.CTL_USER
	sysCTL_P1003_1B = C.CTL_P1003_1B
)

const (
	sysRTM_VERSION = C.RTM_VERSION

	sysRTM_ADD        = C.RTM_ADD
	sysRTM_DELETE     = C.RTM_DELETE
	sysRTM_CHANGE     = C.RTM_CHANGE
	sysRTM_GET        = C.RTM_GET
	sysRTM_LOSING     = C.RTM_LOSING
	sysRTM_REDIRECT   = C.RTM_REDIRECT
	sysRTM_MISS       = C.RTM_MISS
	sysRTM_LOCK       = C.RTM_LOCK
	sysRTM_RESOLVE    = C.RTM_RESOLVE
	sysRTM_NEWADDR    = C.RTM_NEWADDR
	sysRTM_DELADDR    = C.RTM_DELADDR
	sysRTM_IFINFO     = C.RTM_IFINFO
	sysRTM_NEWMADDR   = C.RTM_NEWMADDR
	sysRTM_DELMADDR   = C.RTM_DELMADDR
	sysRTM_IFANNOUNCE = C.RTM_IFANNOUNCE
	sysRTM_IEEE80211  = C.RTM_IEEE80211

	sysRTA_DST     = C.RTA_DST
	sysRTA_GATEWAY = C.RTA_GATEWAY
	sysRTA_NETMASK = C.RTA_NETMASK
	sysRTA_GENMASK = C.RTA_GENMASK
	sysRTA_IFP     = C.RTA_IFP
	sysRTA_IFA     = C.RTA_IFA
	sysRTA_AUTHOR  = C.RTA_AUTHOR
	sysRTA_BRD     = C.RTA_BRD

	sysRTAX_DST     = C.RTAX_DST
	sysRTAX_GATEWAY = C.RTAX_GATEWAY
	sysRTAX_NETMASK = C.RTAX_NETMASK
	sysRTAX_GENMASK = C.RTAX_GENMASK
	sysRTAX_IFP     = C.RTAX_IFP
	sysRTAX_IFA     = C.RTAX_IFA
	sysRTAX_AUTHOR  = C.RTAX_AUTHOR
	sysRTAX_BRD     = C.RTAX_BRD
	sysRTAX_MAX     = C.RTAX_MAX
)

const (
	sizeofIfMsghdrlFreeBSD10        = C.sizeof_struct_if_msghdrl
	sizeofIfaMsghdrFreeBSD10        = C.sizeof_struct_ifa_msghdr
	sizeofIfaMsghdrlFreeBSD10       = C.sizeof_struct_ifa_msghdrl
	sizeofIfmaMsghdrFreeBSD10       = C.sizeof_struct_ifma_msghdr
	sizeofIfAnnouncemsghdrFreeBSD10 = C.sizeof_struct_if_announcemsghdr

	sizeofRtMsghdrFreeBSD10  = C.sizeof_struct_rt_msghdr
	sizeofRtMetricsFreeBSD10 = C.sizeof_struct_rt_metrics

	sizeofIfMsghdrFreeBSD7  = C.sizeof_struct_if_msghdr_freebsd7
	sizeofIfMsghdrFreeBSD8  = C.sizeof_struct_if_msghdr_freebsd8
	sizeofIfMsghdrFreeBSD9  = C.sizeof_struct_if_msghdr_freebsd9
	sizeofIfMsghdrFreeBSD10 = C.sizeof_struct_if_msghdr_freebsd10
	sizeofIfMsghdrFreeBSD11 = C.sizeof_struct_if_msghdr_freebsd11

	sizeofIfDataFreeBSD7  = C.sizeof_struct_if_data_freebsd7
	sizeofIfDataFreeBSD8  = C.sizeof_struct_if_data_freebsd8
	sizeofIfDataFreeBSD9  = C.sizeof_struct_if_data_freebsd9
	sizeofIfDataFreeBSD10 = C.sizeof_struct_if_data_freebsd10
	sizeofIfDataFreeBSD11 = C.sizeof_struct_if_data_freebsd11

	sizeofIfMsghdrlFreeBSD10Emu        = C.sizeof_struct_if_msghdrl
	sizeofIfaMsghdrFreeBSD10Emu        = C.sizeof_struct_ifa_msghdr
	sizeofIfaMsghdrlFreeBSD10Emu       = C.sizeof_struct_ifa_msghdrl
	sizeofIfmaMsghdrFreeBSD10Emu       = C.sizeof_struct_ifma_msghdr
	sizeofIfAnnouncemsghdrFreeBSD10Emu = C.sizeof_struct_if_announcemsghdr

	sizeofRtMsghdrFreeBSD10Emu  = C.sizeof_struct_rt_msghdr
	sizeofRtMetricsFreeBSD10Emu = C.sizeof_struct_rt_metrics

	sizeofIfMsghdrFreeBSD7Emu  = C.sizeof_struct_if_msghdr_freebsd7
	sizeofIfMsghdrFreeBSD8Emu  = C.sizeof_struct_if_msghdr_freebsd8
	sizeofIfMsghdrFreeBSD9Emu  = C.sizeof_struct_if_msghdr_freebsd9
	sizeofIfMsghdrFreeBSD10Emu = C.sizeof_struct_if_msghdr_freebsd10
	sizeofIfMsghdrFreeBSD11Emu = C.sizeof_struct_if_msghdr_freebsd11

	sizeofIfDataFreeBSD7Emu  = C.sizeof_struct_if_data_freebsd7
	sizeofIfDataFreeBSD8Emu  = C.sizeof_struct_if_data_freebsd8
	sizeofIfDataFreeBSD9Emu  = C.sizeof_struct_if_data_freebsd9
	sizeofIfDataFreeBSD10Emu = C.sizeof_struct_if_data_freebsd10
	sizeofIfDataFreeBSD11Emu = C.sizeof_struct_if_data_freebsd11

	sizeofSockaddrStorage = C.sizeof_struct_sockaddr_storage
	sizeofSockaddrInet    = C.sizeof_struct_sockaddr_in
	sizeofSockaddrInet6   = C.sizeof_struct_sockaddr_in6
)