fix off-by-one error in OSMO_NUM_DLIB
[osmocom-bb.git] / include / osmocom / core / socket.h
1 #ifndef _OSMOCORE_SOCKET_H
2 #define _OSMOCORE_SOCKET_H
3
4 #include <stdint.h>
5
6 struct sockaddr;
7
8 /* flags for osmo_sock_init. */
9 #define OSMO_SOCK_F_CONNECT     (1 << 0)
10 #define OSMO_SOCK_F_BIND        (1 << 1)
11 #define OSMO_SOCK_F_NONBLOCK    (1 << 2)
12
13 int osmo_sock_init(uint16_t family, uint16_t type, uint8_t proto,
14                    const char *host, uint16_t port, unsigned int flags);
15
16 int osmo_sock_init_ofd(struct osmo_fd *ofd, int family, int type, int proto,
17                         const char *host, uint16_t port, unsigned int flags);
18
19 int osmo_sock_init_sa(struct sockaddr *ss, uint16_t type,
20                       uint8_t proto, unsigned int flags);
21
22 /* determine if the given address is a local address */
23 int osmo_sockaddr_is_local(struct sockaddr *addr, unsigned int addrlen);
24
25 #endif /* _OSMOCORE_SOCKET_H */