summaryrefslogtreecommitdiff
path: root/klibc/include/sys/socket.h
blob: cbc2b8959146488ec177726e58704297eaa7af22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * sys/socket.h
 */

#ifndef _SYS_SOCKET_H
#define _SYS_SOCKET_H

#include <klibc/extern.h>
#include <klibc/compiler.h>
#include <linux/socket.h>

/* For some reason these may be protected by __KERNEL__ in asm/socket.h */
#ifndef SOCK_STREAM
# define SOCK_STREAM    1
# define SOCK_DGRAM     2
# define SOCK_RAW       3
# define SOCK_RDM       4
# define SOCK_SEQPACKET 5
# define SOCK_PACKET    10
#endif

#ifdef __i386__
# define __socketcall __extern __cdecl
#else
# define __socketcall __extern
#endif

typedef int socklen_t;

__socketcall int socket(int, int, int);
__socketcall int bind(int, struct sockaddr *, int);
__socketcall int connect(int, struct sockaddr *, socklen_t);
__socketcall int listen(int, int);
__socketcall int accept(int, struct sockaddr *, socklen_t *);
__socketcall int getsockname(int, struct sockaddr *, socklen_t *);
__socketcall int getpeername(int, struct sockaddr *, socklen_t *);
__socketcall int socketpair(int, int, int, int *);
__extern     int send(int, const void *, size_t, unsigned int);
__socketcall int sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t);
__extern     int recv(int, void *, size_t, unsigned int);
__socketcall int recvfrom(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *);
__socketcall int shutdown(int, int);
__socketcall int setsockopt(int, int, int, const void *, socklen_t);
__socketcall int getsockopt(int, int, int, void *, socklen_t *);
__socketcall int sendmsg(int, const struct msghdr *, unsigned int);
__socketcall int recvmsg(int, struct msghdr *, unsigned int);

#undef __socketcall

#endif /* _SYS_SOCKET_H */