add swifi to the build/install.
[minix.git] / include / sys / socket.h
blob85e16960d845b34103767bcde0a66c9e16ff91e0
1 /*
2 sys/socket.h
3 */
5 #ifndef SYS_SOCKET_H
6 #define SYS_SOCKET_H
8 /* Can we include <stdint.h> here or do we need an additional header that is
9 * safe to include?
11 #include <stdint.h>
13 /* Open Group Base Specifications Issue 6 (not complete) */
14 #include <net/gen/socket.h>
16 #define SOCK_STREAM 1
17 #define SOCK_DGRAM 2
18 #define SOCK_RAW 3
19 #define SOCK_RDM 4
20 #define SOCK_SEQPACKET 5
22 #define SOL_SOCKET 0xFFFF
24 #define SO_DEBUG 0x0001
25 #define SO_REUSEADDR 0x0004
26 #define SO_KEEPALIVE 0x0008
27 #define SO_TYPE 0x0010 /* get socket type, SOCK_STREAM or SOCK_DGRAM */
29 #define SO_SNDBUF 0x1001 /* send buffer size */
30 #define SO_RCVBUF 0x1002 /* receive buffer size */
31 #define SO_ERROR 0x1007 /* get and clear error status */
33 /* The how argument to shutdown */
34 #define SHUT_RD 0 /* No further reads */
35 #define SHUT_WR 1 /* No further writes */
36 #define SHUT_RDWR 2 /* No further reads and writes */
38 #ifndef _SA_FAMILY_T
39 #define _SA_FAMILY_T
40 typedef uint8_t sa_family_t;
41 #endif /* _SA_FAMILY_T */
43 typedef int32_t socklen_t;
45 struct sockaddr
47 sa_family_t sa_family;
48 char sa_data[8]; /* Big enough for sockaddr_in */
51 _PROTOTYPE( int accept, (int _socket,
52 struct sockaddr *_RESTRICT _address,
53 socklen_t *_RESTRICT _address_len) );
54 _PROTOTYPE( int bind, (int _socket, const struct sockaddr *_address,
55 socklen_t _address_len) );
56 _PROTOTYPE( int connect, (int _socket, const struct sockaddr *_address,
57 socklen_t _address_len) );
58 _PROTOTYPE( int getpeername, (int _socket,
59 struct sockaddr *_RESTRICT _address,
60 socklen_t *_RESTRICT _address_len) );
61 _PROTOTYPE( int getsockname, (int _socket,
62 struct sockaddr *_RESTRICT _address,
63 socklen_t *_RESTRICT _address_len) );
64 _PROTOTYPE( int setsockopt,(int _socket, int _level, int _option_name,
65 const void *_option_value, socklen_t _option_len) );
66 _PROTOTYPE( int getsockopt, (int _socket, int _level, int _option_name,
67 void *_RESTRICT _option_value, socklen_t *_RESTRICT _option_len));
68 _PROTOTYPE( int listen, (int _socket, int _backlog) );
69 _PROTOTYPE( ssize_t recv, (int _socket, void *_buffer, size_t _length,
70 int _flags) );
71 _PROTOTYPE( ssize_t recvfrom, (int _socket, void *_RESTRICT _buffer,
72 size_t _length, int _flags, struct sockaddr *_RESTRICT _address,
73 socklen_t *_RESTRICT _address_len) );
74 _PROTOTYPE( ssize_t send, (int _socket, const void *_buffer,
75 size_t _length, int _flags) );
76 _PROTOTYPE( ssize_t sendto, (int _socket, const void *_message,
77 size_t _length, int _flags, const struct sockaddr *_dest_addr,
78 socklen_t _dest_len) );
79 _PROTOTYPE( int shutdown, (int _socket, int _how) );
80 _PROTOTYPE( int socket, (int _domain, int _type, int _protocol) );
82 /* The following constants are often used in applications, but are not defined
83 * by POSIX.
85 #define PF_INET AF_INET
86 #define PF_INET6 AF_INET6
87 #define PF_UNIX AF_UNIX
88 #define PF_UNSPEC AF_UNSPEC
90 /* based on http://tools.ietf.org/html/rfc2553 */
91 struct sockaddr_storage
93 sa_family_t __ss_family;
94 char __ss_pad1[6];
95 #ifdef __LONG_LONG_SUPPORTED
96 int64_t __ss_align;
97 #else
98 int32_t __ss_align[2];
99 #endif
100 char __ss_pad2[112];
103 #endif /* SYS_SOCKET_H */