Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include "unp.h"
int sock_bind_wild(int sockfd, int family);
/* Returns: 0 if OK, -1 on error */
int sock_cmp_addr(const struct sockaddr *sockaddr1,
const struct sockaddr *sockaddr2, socklen_t addrlen);
/* Returns: 0 if addresses are of the same family and ports are equal,
else nonzero
*/
int sock_cmp_port(const struct sockaddr *sockaddr1,
const struct sockaddr *sockaddr2, socklen_t addrlen);
/* Returns: 0 if addresses are of the same family and ports are equal,
else nonzero
*/
int sock_get_port(const struct sockaddr *sockaddr, socklen_t addrlen);
/* Returns: non-negative port number for IPv4 or IPv6 address, else -1 */
char *sock_ntop_host(const struct sockaddr *sockaddr, socklen_t addrlen);
/* Returns: non-null pointer if OK, NULL on error */
void sock_set_addr(const struct sockaddr *sockaddr, socklen_t addrlen,
void *ptr);
void sock_set_port(const struct sockaddr *sockaddr, socklen_t addrlen,
int port);
void sock_set_wild(struct sockaddr *sockaddr, socklen_t addrlen);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment