Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 1 | #ifndef _OSMOCORE_SOCKET_H |
| 2 | #define _OSMOCORE_SOCKET_H |
| 3 | |
| 4 | #include <stdint.h> |
Harald Welte | e476442 | 2011-05-22 12:25:57 +0200 | [diff] [blame] | 5 | |
| 6 | struct sockaddr; |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 7 | |
Pablo Neira Ayuso | 0849c9a | 2011-06-09 15:04:30 +0200 | [diff] [blame] | 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 | |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 13 | int osmo_sock_init(uint16_t family, uint16_t type, uint8_t proto, |
Pablo Neira Ayuso | 0849c9a | 2011-06-09 15:04:30 +0200 | [diff] [blame] | 14 | const char *host, uint16_t port, unsigned int flags); |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 15 | |
Harald Welte | 68b1574 | 2011-05-22 21:47:29 +0200 | [diff] [blame] | 16 | int osmo_sock_init_ofd(struct osmo_fd *ofd, int family, int type, int proto, |
Pablo Neira Ayuso | 0849c9a | 2011-06-09 15:04:30 +0200 | [diff] [blame] | 17 | const char *host, uint16_t port, unsigned int flags); |
Harald Welte | 68b1574 | 2011-05-22 21:47:29 +0200 | [diff] [blame] | 18 | |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 19 | int osmo_sock_init_sa(struct sockaddr *ss, uint16_t type, |
Pablo Neira Ayuso | 0849c9a | 2011-06-09 15:04:30 +0200 | [diff] [blame] | 20 | uint8_t proto, unsigned int flags); |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 21 | |
| 22 | /* determine if the given address is a local address */ |
Harald Welte | e476442 | 2011-05-22 12:25:57 +0200 | [diff] [blame] | 23 | int osmo_sockaddr_is_local(struct sockaddr *addr, unsigned int addrlen); |
Harald Welte | 33cb71a | 2011-05-21 18:54:32 +0200 | [diff] [blame] | 24 | |
| 25 | #endif /* _OSMOCORE_SOCKET_H */ |