github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/netbsd/socket_inet.txt (about)

     1  # Copyright 2017 syzkaller project authors. All rights reserved.
     2  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  include <stddef.h>
     5  include <sys/types.h>
     6  include <sys/socket.h>
     7  include <sys/sockio.h>
     8  include <netinet/in.h>
     9  
    10  # IP sockets
    11  
    12  resource sock_in[sock]
    13  
    14  sockaddr_in {
    15  	family	const[AF_INET, int16]
    16  	port	sock_port
    17  	pad	array[const[0, int8], 8]
    18  }
    19  
    20  socket$inet(domain const[AF_INET], type flags[socket_type], proto int8) sock_in
    21  accept$inet(fd sock_in, peer ptr[out, sockaddr_in, opt], peerlen ptr[inout, len[peer, int32]]) sock_in
    22  bind$inet(fd sock_in, addr ptr[in, sockaddr_in], addrlen len[addr])
    23  connect$inet(fd sock_in, addr ptr[in, sockaddr_in], addrlen len[addr])
    24  sendto$inet(fd sock_in, buf buffer[in], len len[buf], f flags[send_flags], addr ptr[in, sockaddr_in, opt], addrlen len[addr])
    25  recvfrom$inet(fd sock_in, buf buffer[out], len len[buf], f flags[recv_flags], addr ptr[in, sockaddr_in, opt], addrlen len[addr])
    26  getsockname$inet(fd sock_in, addr ptr[out, sockaddr_in], addrlen ptr[inout, len[addr, int32]])
    27  getpeername$inet(fd sock_in, peer ptr[out, sockaddr_in], peerlen ptr[inout, len[peer, int32]])
    28  
    29  # Generic IP options
    30  
    31  # Specific IP options
    32  
    33  sockopt_opt_ip_opts = IP_OPTIONS
    34  
    35  getsockopt$inet_opts(fd sock_in, level const[IPPROTO_IP], optname flags[sockopt_opt_ip_opts], optval buffer[out], optlen ptr[inout, len[optval, int32]])
    36  setsockopt$inet_opts(fd sock_in, level const[IPPROTO_IP], optname flags[sockopt_opt_ip_opts], optval buffer[in], optlen len[optval])