15 #include <arpa/inet.h>
18 #define OSMO_SOCK_NAME_MAXLEN (2 + INET6_ADDRSTRLEN + 1 + 5 + 3 + 2 + INET6_ADDRSTRLEN + 1 + 5 + 1)
27 #define OSMO_SOCK_F_CONNECT (1 << 0)
29 #define OSMO_SOCK_F_BIND (1 << 1)
31 #define OSMO_SOCK_F_NONBLOCK (1 << 2)
33 #define OSMO_SOCK_F_NO_MCAST_LOOP (1 << 3)
35 #define OSMO_SOCK_F_NO_MCAST_ALL (1 << 4)
37 #define OSMO_SOCK_F_UDP_REUSEADDR (1 << 5)
40 const char *
host, uint16_t port,
unsigned int flags);
43 const char *local_host, uint16_t local_port,
44 const char *remote_host, uint16_t remote_port,
unsigned int flags);
47 const char *
host, uint16_t port,
unsigned int flags);
50 const char *local_host, uint16_t local_port,
51 const char *remote_host, uint16_t remote_port,
unsigned int flags);
54 uint8_t proto,
unsigned int flags);
59 const struct sockaddr *sa);
61 const struct sockaddr_in *sin);
64 const char *socket_path,
unsigned int flags);
67 const char *socket_path,
unsigned int flags);
int osmo_sock_get_local_ip_port(int fd, char *port, size_t len)
unsigned int osmo_sockaddr_to_str_and_uint(char *addr, unsigned int addr_len, uint16_t *port, const struct sockaddr *sa)
int osmo_sock_init_ofd(struct osmo_fd *ofd, int family, int type, int proto, const char *host, uint16_t port, unsigned int flags)
int osmo_sock_mcast_loop_set(int fd, bool enable)
int osmo_sock_get_name_buf(char *str, size_t str_len, int fd)
size_t osmo_sockaddr_in_to_str_and_uint(char *addr, unsigned int addr_len, uint16_t *port, const struct sockaddr_in *sin)
int osmo_sock_get_ip_and_port(int fd, char *ip, size_t ip_len, char *port, size_t port_len, bool local)
int osmo_sock_mcast_ttl_set(int fd, uint8_t ttl)
int osmo_sock_local_ip(char *local_ip, const char *remote_ip)
int osmo_sock_init2_ofd(struct osmo_fd *ofd, int family, int type, int proto, const char *local_host, uint16_t local_port, const char *remote_host, uint16_t remote_port, unsigned int flags)
int osmo_sock_init(uint16_t family, uint16_t type, uint8_t proto, const char *host, uint16_t port, unsigned int flags)
int osmo_sock_mcast_all_set(int fd, bool enable)
int osmo_sock_mcast_subscribe(int fd, const char *grp_addr)
int osmo_sock_init_sa(struct sockaddr *ss, uint16_t type, uint8_t proto, unsigned int flags)
int osmo_sockaddr_is_local(struct sockaddr *addr, unsigned int addrlen)
char * osmo_sock_get_name(const void *ctx, int fd)
int osmo_sock_init2(uint16_t family, uint16_t type, uint8_t proto, const char *local_host, uint16_t local_port, const char *remote_host, uint16_t remote_port, unsigned int flags)
int osmo_sock_get_remote_ip_port(int fd, char *port, size_t len)
uint8_t type
see GSMTAP_TYPE_*
Definition: gsmtap.h:115
static size_t len(const char *str)
int osmo_sock_get_local_ip(int fd, char *host, size_t len)
int osmo_sock_unix_init(uint16_t type, uint8_t proto, const char *socket_path, unsigned int flags)
int osmo_sock_get_remote_ip(int fd, char *host, size_t len)
Structure representing a file dsecriptor.
Definition: select.h:28
int osmo_sock_unix_init_ofd(struct osmo_fd *ofd, uint16_t type, uint8_t proto, const char *socket_path, unsigned int flags)
const char * osmo_sock_get_name2(int fd)
int fd
actual operating-system level file decriptor
Definition: select.h:32