source: trunk/minix/include/sys/socket.h@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 2.4 KB
Line 
1/*
2sys/socket.h
3*/
4
5#ifndef SYS_SOCKET_H
6#define SYS_SOCKET_H
7
8/* Can we include <stdint.h> here or do we need an additional header that is
9 * safe to include?
10 */
11#include <stdint.h>
12
13/* Open Group Base Specifications Issue 6 (not complete) */
14#include <net/gen/socket.h>
15
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
21
22#define SOL_SOCKET 0xFFFF
23
24#define SO_DEBUG 0x0001
25#define SO_REUSEADDR 0x0004
26#define SO_KEEPALIVE 0x0008
27
28#define SO_SNDBUF 0x1001 /* send buffer size */
29#define SO_RCVBUF 0x1002 /* receive buffer size */
30#define SO_ERROR 0x1007 /* get and clear error status */
31
32/* The how argument to shutdown */
33#define SHUT_RD 0 /* No further reads */
34#define SHUT_WR 1 /* No further writes */
35#define SHUT_RDWR 2 /* No further reads and writes */
36
37#ifndef _SA_FAMILY_T
38#define _SA_FAMILY_T
39typedef uint8_t sa_family_t;
40#endif /* _SA_FAMILY_T */
41
42typedef int32_t socklen_t;
43
44struct sockaddr
45{
46 sa_family_t sa_family;
47 char sa_data[8]; /* Big enough for sockaddr_in */
48};
49
50_PROTOTYPE( int accept, (int _socket,
51 struct sockaddr *_RESTRICT _address,
52 socklen_t *_RESTRICT _address_len) );
53_PROTOTYPE( int bind, (int _socket, const struct sockaddr *_address,
54 socklen_t _address_len) );
55_PROTOTYPE( int connect, (int _socket, const struct sockaddr *_address,
56 socklen_t _address_len) );
57_PROTOTYPE( int getpeername, (int _socket,
58 struct sockaddr *_RESTRICT _address,
59 socklen_t *_RESTRICT _address_len) );
60_PROTOTYPE( int getsockname, (int _socket,
61 struct sockaddr *_RESTRICT _address,
62 socklen_t *_RESTRICT _address_len) );
63_PROTOTYPE( int setsockopt,(int _socket, int _level, int _option_name,
64 const void *_option_value, socklen_t _option_len) );
65_PROTOTYPE( int getsockopt, (int _socket, int _level, int _option_name,
66 void *_RESTRICT _option_value, socklen_t *_RESTRICT _option_len));
67_PROTOTYPE( int listen, (int _socket, int _backlog) );
68_PROTOTYPE( ssize_t recvfrom, (int _socket, void *_RESTRICT _buffer,
69 size_t _length, int _flags, struct sockaddr *_RESTRICT _address,
70 socklen_t *_RESTRICT _address_len) );
71_PROTOTYPE( ssize_t sendto, (int _socket, const void *_message,
72 size_t _length, int _flags, const struct sockaddr *_dest_addr,
73 socklen_t _dest_len) );
74_PROTOTYPE( int shutdown, (int _socket, int _how) );
75_PROTOTYPE( int socket, (int _domain, int _type, int _protocol) );
76
77#endif /* SYS_SOCKET_H */
Note: See TracBrowser for help on using the repository browser.