mirror of https://gerrit.osmocom.org/libosmocore
socket.h: Reorder sockaddr APIs to have them all together
Change-Id: Iab2ee2854be8027ee5978e06a83248b530a39bf7
This commit is contained in:
parent
8deedfa281
commit
3c12f557bd
|
@ -30,6 +30,31 @@ struct osmo_sockaddr {
|
||||||
} u;
|
} u;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int osmo_sockaddr_is_local(struct sockaddr *addr, unsigned int addrlen);
|
||||||
|
|
||||||
|
unsigned int osmo_sockaddr_to_str_and_uint(char *addr, unsigned int addr_len, uint16_t *port,
|
||||||
|
const struct sockaddr *sa);
|
||||||
|
size_t osmo_sockaddr_in_to_str_and_uint(char *addr, unsigned int addr_len, uint16_t *port,
|
||||||
|
const struct sockaddr_in *sin);
|
||||||
|
|
||||||
|
const char *osmo_sockaddr_ntop(const struct sockaddr *sa, char *dst);
|
||||||
|
uint16_t osmo_sockaddr_port(const struct sockaddr *sa);
|
||||||
|
void osmo_sockaddr_set_port(struct sockaddr *sa, uint16_t port);
|
||||||
|
|
||||||
|
int osmo_sockaddr_local_ip(struct osmo_sockaddr *local_ip,
|
||||||
|
const struct osmo_sockaddr *remote_ip);
|
||||||
|
int osmo_sockaddr_cmp(const struct osmo_sockaddr *a,
|
||||||
|
const struct osmo_sockaddr *b);
|
||||||
|
|
||||||
|
int osmo_sockaddr_to_octets(uint8_t *dst, size_t dst_maxlen, const struct osmo_sockaddr *os);
|
||||||
|
int osmo_sockaddr_from_octets(struct osmo_sockaddr *os, const void *src, size_t src_len);
|
||||||
|
|
||||||
|
const char *osmo_sockaddr_to_str(const struct osmo_sockaddr *sockaddr);
|
||||||
|
char *osmo_sockaddr_to_str_buf(char *buf, size_t buf_len,
|
||||||
|
const struct osmo_sockaddr *sockaddr);
|
||||||
|
int osmo_sockaddr_to_str_buf2(char *buf, size_t buf_len, const struct osmo_sockaddr *sockaddr);
|
||||||
|
char *osmo_sockaddr_to_str_c(void *ctx, const struct osmo_sockaddr *sockaddr);
|
||||||
|
|
||||||
/* flags for osmo_sock_init. */
|
/* flags for osmo_sock_init. */
|
||||||
/*! connect the socket to a remote peer */
|
/*! connect the socket to a remote peer */
|
||||||
#define OSMO_SOCK_F_CONNECT (1 << 0)
|
#define OSMO_SOCK_F_CONNECT (1 << 0)
|
||||||
|
@ -87,17 +112,6 @@ int osmo_sock_init_osa_ofd(struct osmo_fd *ofd, int type, int proto,
|
||||||
int osmo_sock_init_sa(struct sockaddr *ss, uint16_t type,
|
int osmo_sock_init_sa(struct sockaddr *ss, uint16_t type,
|
||||||
uint8_t proto, unsigned int flags);
|
uint8_t proto, unsigned int flags);
|
||||||
|
|
||||||
int osmo_sockaddr_is_local(struct sockaddr *addr, unsigned int addrlen);
|
|
||||||
|
|
||||||
unsigned int osmo_sockaddr_to_str_and_uint(char *addr, unsigned int addr_len, uint16_t *port,
|
|
||||||
const struct sockaddr *sa);
|
|
||||||
size_t osmo_sockaddr_in_to_str_and_uint(char *addr, unsigned int addr_len, uint16_t *port,
|
|
||||||
const struct sockaddr_in *sin);
|
|
||||||
|
|
||||||
const char *osmo_sockaddr_ntop(const struct sockaddr *sa, char *dst);
|
|
||||||
uint16_t osmo_sockaddr_port(const struct sockaddr *sa);
|
|
||||||
void osmo_sockaddr_set_port(struct sockaddr *sa, uint16_t port);
|
|
||||||
|
|
||||||
int osmo_sock_unix_init(uint16_t type, uint8_t proto,
|
int osmo_sock_unix_init(uint16_t type, uint8_t proto,
|
||||||
const char *socket_path, unsigned int flags);
|
const char *socket_path, unsigned int flags);
|
||||||
|
|
||||||
|
@ -123,20 +137,6 @@ int osmo_sock_mcast_subscribe(int fd, const char *grp_addr);
|
||||||
|
|
||||||
int osmo_sock_local_ip(char *local_ip, const char *remote_ip);
|
int osmo_sock_local_ip(char *local_ip, const char *remote_ip);
|
||||||
|
|
||||||
int osmo_sockaddr_local_ip(struct osmo_sockaddr *local_ip,
|
|
||||||
const struct osmo_sockaddr *remote_ip);
|
|
||||||
int osmo_sockaddr_cmp(const struct osmo_sockaddr *a,
|
|
||||||
const struct osmo_sockaddr *b);
|
|
||||||
|
|
||||||
int osmo_sockaddr_to_octets(uint8_t *dst, size_t dst_maxlen, const struct osmo_sockaddr *os);
|
|
||||||
int osmo_sockaddr_from_octets(struct osmo_sockaddr *os, const void *src, size_t src_len);
|
|
||||||
|
|
||||||
const char *osmo_sockaddr_to_str(const struct osmo_sockaddr *sockaddr);
|
|
||||||
char *osmo_sockaddr_to_str_buf(char *buf, size_t buf_len,
|
|
||||||
const struct osmo_sockaddr *sockaddr);
|
|
||||||
int osmo_sockaddr_to_str_buf2(char *buf, size_t buf_len, const struct osmo_sockaddr *sockaddr);
|
|
||||||
char *osmo_sockaddr_to_str_c(void *ctx, const struct osmo_sockaddr *sockaddr);
|
|
||||||
|
|
||||||
int osmo_sock_set_dscp(int fd, uint8_t dscp);
|
int osmo_sock_set_dscp(int fd, uint8_t dscp);
|
||||||
int osmo_sock_set_priority(int fd, int prio);
|
int osmo_sock_set_priority(int fd, int prio);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue