f4ebe841a5
FossilOrigin-Name: 8a43dd9d05a4cb73210243ddd8df2a26f16c7ef2c4d4e36ab446de1f65d88223
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);
|
|
|
|
}
|
|
|