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