golang.org/x/net@v0.25.1-0.20240516223405-c87a5b62e243/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  
     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  	sizeofIfMsghdrlFreeBSD10        = C.sizeof_struct_if_msghdrl
   222  	sizeofIfaMsghdrFreeBSD10        = C.sizeof_struct_ifa_msghdr
   223  	sizeofIfaMsghdrlFreeBSD10       = C.sizeof_struct_ifa_msghdrl
   224  	sizeofIfmaMsghdrFreeBSD10       = C.sizeof_struct_ifma_msghdr
   225  	sizeofIfAnnouncemsghdrFreeBSD10 = C.sizeof_struct_if_announcemsghdr
   226  
   227  	sizeofRtMsghdrFreeBSD10  = C.sizeof_struct_rt_msghdr
   228  	sizeofRtMetricsFreeBSD10 = C.sizeof_struct_rt_metrics
   229  
   230  	sizeofIfMsghdrFreeBSD7  = C.sizeof_struct_if_msghdr_freebsd7
   231  	sizeofIfMsghdrFreeBSD8  = C.sizeof_struct_if_msghdr_freebsd8
   232  	sizeofIfMsghdrFreeBSD9  = C.sizeof_struct_if_msghdr_freebsd9
   233  	sizeofIfMsghdrFreeBSD10 = C.sizeof_struct_if_msghdr_freebsd10
   234  	sizeofIfMsghdrFreeBSD11 = C.sizeof_struct_if_msghdr_freebsd11
   235  
   236  	sizeofIfDataFreeBSD7  = C.sizeof_struct_if_data_freebsd7
   237  	sizeofIfDataFreeBSD8  = C.sizeof_struct_if_data_freebsd8
   238  	sizeofIfDataFreeBSD9  = C.sizeof_struct_if_data_freebsd9
   239  	sizeofIfDataFreeBSD10 = C.sizeof_struct_if_data_freebsd10
   240  	sizeofIfDataFreeBSD11 = C.sizeof_struct_if_data_freebsd11
   241  
   242  	sizeofIfMsghdrlFreeBSD10Emu        = C.sizeof_struct_if_msghdrl
   243  	sizeofIfaMsghdrFreeBSD10Emu        = C.sizeof_struct_ifa_msghdr
   244  	sizeofIfaMsghdrlFreeBSD10Emu       = C.sizeof_struct_ifa_msghdrl
   245  	sizeofIfmaMsghdrFreeBSD10Emu       = C.sizeof_struct_ifma_msghdr
   246  	sizeofIfAnnouncemsghdrFreeBSD10Emu = C.sizeof_struct_if_announcemsghdr
   247  
   248  	sizeofRtMsghdrFreeBSD10Emu  = C.sizeof_struct_rt_msghdr
   249  	sizeofRtMetricsFreeBSD10Emu = C.sizeof_struct_rt_metrics
   250  
   251  	sizeofIfMsghdrFreeBSD7Emu  = C.sizeof_struct_if_msghdr_freebsd7
   252  	sizeofIfMsghdrFreeBSD8Emu  = C.sizeof_struct_if_msghdr_freebsd8
   253  	sizeofIfMsghdrFreeBSD9Emu  = C.sizeof_struct_if_msghdr_freebsd9
   254  	sizeofIfMsghdrFreeBSD10Emu = C.sizeof_struct_if_msghdr_freebsd10
   255  	sizeofIfMsghdrFreeBSD11Emu = C.sizeof_struct_if_msghdr_freebsd11
   256  
   257  	sizeofIfDataFreeBSD7Emu  = C.sizeof_struct_if_data_freebsd7
   258  	sizeofIfDataFreeBSD8Emu  = C.sizeof_struct_if_data_freebsd8
   259  	sizeofIfDataFreeBSD9Emu  = C.sizeof_struct_if_data_freebsd9
   260  	sizeofIfDataFreeBSD10Emu = C.sizeof_struct_if_data_freebsd10
   261  	sizeofIfDataFreeBSD11Emu = C.sizeof_struct_if_data_freebsd11
   262  
   263  	sizeofSockaddrStorage = C.sizeof_struct_sockaddr_storage
   264  	sizeofSockaddrInet    = C.sizeof_struct_sockaddr_in
   265  	sizeofSockaddrInet6   = C.sizeof_struct_sockaddr_in6
   266  )