Global replace of Nicira Networks.
[sliver-openvswitch.git] / include / sparse / sys / socket.h
1 /*
2  * Copyright (c) 2011, 2012 Nicira, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __CHECKER__
18 #error "Use this header only with sparse.  It is not a correct implementation."
19 #endif
20
21 #ifndef __SYS_SOCKET_SPARSE
22 #define __SYS_SOCKET_SPARSE 1
23
24 #include "openvswitch/types.h"
25 #include <sys/uio.h>
26
27 typedef unsigned short int sa_family_t;
28 typedef __socklen_t socklen_t;
29
30 struct sockaddr {
31     sa_family_t sa_family;
32     char sa_data[64];
33 };
34
35 struct sockaddr_storage {
36     sa_family_t ss_family;
37     char sa_data[64];
38 };
39
40 struct msghdr {
41     void *msg_name;
42     socklen_t      msg_namelen;
43     struct iovec  *msg_iov;
44     int            msg_iovlen;
45     void          *msg_control;
46     socklen_t      msg_controllen;
47     int            msg_flags;
48 };
49
50 enum {
51     SOCK_DGRAM,
52     SOCK_RAW,
53     SOCK_SEQPACKET,
54     SOCK_STREAM
55 };
56
57 enum {
58     SOL_SOCKET
59 };
60
61 enum {
62     SO_ACCEPTCONN,
63     SO_BROADCAST,
64     SO_DEBUG,
65     SO_DONTROUTE,
66     SO_ERROR,
67     SO_KEEPALIVE,
68     SO_LINGER,
69     SO_OOBINLINE,
70     SO_RCVBUF,
71     SO_RCVLOWAT,
72     SO_RCVTIMEO,
73     SO_REUSEADDR,
74     SO_SNDBUF,
75     SO_SNDLOWAT,
76     SO_SNDTIMEO,
77     SO_TYPE,
78     SO_RCVBUFFORCE
79 };
80
81 enum {
82     MSG_CTRUNC,
83     MSG_DONTROUTE,
84     MSG_EOR,
85     MSG_OOB,
86     MSG_NOSIGNAL,
87     MSG_PEEK,
88     MSG_TRUNC,
89     MSG_WAITALL,
90     MSG_DONTWAIT
91 };
92
93 enum {
94     AF_UNSPEC,
95     PF_UNSPEC = AF_UNSPEC,
96     AF_INET,
97     PF_INET = AF_INET,
98     AF_INET6,
99     PF_INET6 = AF_INET6,
100     AF_UNIX,
101     PF_UNIX = AF_UNIX,
102     AF_NETLINK,
103     PF_NETLINK = AF_NETLINK,
104     AF_PACKET,
105     PF_PACKET = AF_PACKET
106 };
107
108 enum {
109     SHUT_RD,
110     SHUT_RDWR,
111     SHUT_WR
112 };
113
114 int accept(int, struct sockaddr *, socklen_t *);
115 int bind(int, const struct sockaddr *, socklen_t);
116 int connect(int, const struct sockaddr *, socklen_t);
117 int getpeername(int, struct sockaddr *, socklen_t *);
118 int getsockname(int, struct sockaddr *, socklen_t *);
119 int getsockopt(int, int, int, void *, socklen_t *);
120 int listen(int, int);
121 ssize_t recv(int, void *, size_t, int);
122 ssize_t recvfrom(int, void *, size_t, int, struct sockaddr *, socklen_t *);
123 ssize_t recvmsg(int, struct msghdr *, int);
124 ssize_t send(int, const void *, size_t, int);
125 ssize_t sendmsg(int, const struct msghdr *, int);
126 ssize_t sendto(int, const void *, size_t, int, const struct sockaddr *,
127                socklen_t);
128 int setsockopt(int, int, int, const void *, socklen_t);
129 int shutdown(int, int);
130 int sockatmark(int);
131 int socket(int, int, int);
132 int socketpair(int, int, int, int[2]);
133
134 #endif /* <sys/socket.h> for sparse */