2bae9358d7
FossilOrigin-Name: c53d95729c009f8f80a7d63847cef7668ff73f8af0523ab65f7734696f85399c
29 lines
463 B
C
29 lines
463 B
C
|
|
#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
#include <netinet/in.h>
|
|
#include <string.h>
|
|
|
|
#include "sock.h"
|
|
|
|
void sock_copyaddr(struct sockaddr_storage *dst, const struct sockaddr * src){
|
|
int salen;
|
|
/* determine length */
|
|
switch(src->sa_family){
|
|
case AF_INET:
|
|
salen = sizeof(struct sockaddr_in);
|
|
break;
|
|
#ifdef WITH_IPV6
|
|
case AF_INET6:
|
|
salen = sizeof(struct sockaddr_in6);
|
|
break;
|
|
#endif
|
|
default:
|
|
return;
|
|
}
|
|
|
|
memcpy(dst,src,salen);
|
|
|
|
}
|
|
|