github.com/lianghucheng/zrddz@v0.0.0-20200923083010-c71f680932e2/src/golang.org/x/net/route/defs_freebsd.go (about)

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