1 #ifndef _SOCKET_H
2 #define _SOCKET_H
3
4 struct sockaddr {
5 u_short sa_family;
6 char sa_data[14];
7 };
8
9
10
11
12 #define SOCK_STREAM 1
13 #define SOCK_DGRAM 2
14 #define SOCK_SEQPACKET 3
15 #define SOCK_RAW 4
16
17
18
19
20 #define AF_UNSPEC 0
21 #define AF_UNIX 1
22 #define AF_INET 2
23
24
25
26
27 #define PF_UNIX AF_UNIX
28 #define PF_INET AF_INET
29
30 int socket(int family, int type, int protocol);
31 int socketpair(int family, int type, int protocol, int sockvec[2]);
32 int bind(int sockfd, struct sockaddr *my_addr, int addrlen);
33 int connect(int sockfd, struct sockaddr *serv_addr, int addrlen);
34 int listen(int sockfd, int backlog);
35 int accept(int sockfd, struct sockaddr *peer, int *paddrlen);
36 int getsockname(int sockfd, struct sockaddr *addr, int *paddrlen);
37 int getpeername(int sockfd, struct sockaddr *peer, int *paddrlen);
38
39 #endif