Skip to content

Commit

Permalink
Add a missing library function
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishcoleman committed Aug 2, 2023
1 parent ba1121a commit 0e9f00e
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/win32/edge_utils_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,39 @@

/* ************************************** */

#ifndef _WIN64
/*
* This function was not included in windows until after Windows XP
*/

const char *inet_ntop (int af, const void *src, char *dst, socklen_t size) {
if(af == AF_INET) {
struct sockaddr_in in;
memset(&in, 0, sizeof(in));

in.sin_family = AF_INET;
memcpy(&in.sin_addr, src, sizeof(in.sin_addr));
getnameinfo((struct sockaddr *)&in,sizeof(in),dst,size,NULL,0,NI_NUMERICHOST);
return dst;
}

if(af == AF_INET6) {
struct sockaddr_in6 in6;
memset(&in6, 0, sizeof(in6));

in6.sin6_family = AF_INET6;
memcpy(&in6.sin6_addr, src, sizeof(in6.sin6_addr));
getnameinfo((struct sockaddr *)&in6,sizeof(in6),dst,size,NULL,0,NI_NUMERICHOST);
return dst;
}

return NULL;
}

#endif /* _WIN64 */

/* ************************************** */

static DWORD* tunReadThread (LPVOID lpArg) {

struct tunread_arg *arg = (struct tunread_arg*)lpArg;
Expand Down

0 comments on commit 0e9f00e

Please sign in to comment.