Skip to content

Instantly share code, notes, and snippets.

@rfht
Created March 20, 2018 16:13
Show Gist options
  • Select an option

  • Save rfht/74ca9b700e692467636401f807e6edd8 to your computer and use it in GitHub Desktop.

Select an option

Save rfht/74ca9b700e692467636401f807e6edd8 to your computer and use it in GitHub Desktop.
networking-posix.c on various stages of openbsd build WITHOUT downstream patch
/**
* \file
* Modern posix networking code
*
* Author:
* Rodrigo Kumpera ([email protected])
*
* (C) 2015 Xamarin
*/
#include <config.h>
#include <glib.h>
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#ifdef HAVE_NET_IF_H
#include <net/if.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_GETIFADDRS
#include <ifaddrs.h>
#endif
#include <mono/utils/networking.h>
#include <mono/utils/mono-threads-coop.h>
static void*
get_address_from_sockaddr (struct sockaddr *sa)
{
switch (sa->sa_family) {
case AF_INET:
return &((struct sockaddr_in*)sa)->sin_addr;
case AF_INET6:
return &((struct sockaddr_in6*)sa)->sin6_addr;
}
return NULL;
}
/**
* \file
* Modern posix networking code
*
* Author:
* Rodrigo Kumpera ([email protected])
*
* (C) 2015 Xamarin
*/
#include <config.h>
#include <glib.h>
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#ifdef HAVE_NET_IF_H
#include <net/if.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_GETIFADDRS
#include <ifaddrs.h>
#endif
#include <mono/utils/networking.h>
#include <mono/utils/mono-threads-coop.h>
static void*
get_address_from_sockaddr (struct sockaddr *sa)
{
switch (sa->sa_family) {
case AF_INET:
return &((struct sockaddr_in*)sa)->sin_addr;
case AF_INET6:
return &((struct sockaddr_in6*)sa)->sin6_addr;
}
return NULL;
}
/**
* \file
* Modern posix networking code
*
* Author:
* Rodrigo Kumpera ([email protected])
*
* (C) 2015 Xamarin
*/
#include <config.h>
#include <glib.h>
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#ifdef HAVE_NET_IF_H
#include <net/if.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_GETIFADDRS
#include <ifaddrs.h>
#endif
#include <mono/utils/networking.h>
#include <mono/utils/mono-threads-coop.h>
static void*
get_address_from_sockaddr (struct sockaddr *sa)
{
switch (sa->sa_family) {
case AF_INET:
return &((struct sockaddr_in*)sa)->sin_addr;
case AF_INET6:
return &((struct sockaddr_in6*)sa)->sin6_addr;
}
return NULL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment