5df4362cfe63f6e23cb8859efde4337bee0a8a90
[project/libubox.git] / usock.h
1 /*
2  * usock - socket helper functions
3  *
4  * Copyright (C) 2010 Steven Barth <steven@midlink.org>
5  * Copyright (C) 2011-2012 Felix Fietkau <nbd@openwrt.org>
6  *
7  * Permission to use, copy, modify, and/or distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 #ifndef USOCK_H_
20 #define USOCK_H_
21
22 #define USOCK_TCP 0
23 #define USOCK_UDP 1
24
25 #define USOCK_SERVER            0x0100
26 #define USOCK_NOCLOEXEC         0x0200
27 #define USOCK_NONBLOCK          0x0400
28 #define USOCK_NUMERIC           0x0800
29 #define USOCK_IPV6ONLY          0x2000
30 #define USOCK_IPV4ONLY          0x4000
31 #define USOCK_UNIX              0x8000
32
33 int usock(int type, const char *host, const char *service);
34
35 #endif /* USOCK_H_ */