xamarin_getifaddrs.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef __XAMARIN_GETIFADDRS_H
  2. #include "monodroid.h"
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. /* We're implementing getifaddrs behavior, this is the structure we use. It is exactly the same as
  7. * struct ifaddrs defined in ifaddrs.h but since bionics doesn't have it we need to mirror it here.
  8. */
  9. struct _monodroid_ifaddrs
  10. {
  11. struct _monodroid_ifaddrs *ifa_next; /* Pointer to the next structure. */
  12. char *ifa_name; /* Name of this network interface. */
  13. unsigned int ifa_flags; /* Flags as from SIOCGIFFLAGS ioctl. */
  14. struct sockaddr *ifa_addr; /* Network address of this interface. */
  15. struct sockaddr *ifa_netmask; /* Netmask of this interface. */
  16. union
  17. {
  18. /* At most one of the following two is valid. If the IFF_BROADCAST
  19. bit is set in `ifa_flags', then `ifa_broadaddr' is valid. If the
  20. IFF_POINTOPOINT bit is set, then `ifa_dstaddr' is valid.
  21. It is never the case that both these bits are set at once. */
  22. struct sockaddr *ifu_broadaddr; /* Broadcast address of this interface. */
  23. struct sockaddr *ifu_dstaddr; /* Point-to-point destination address. */
  24. } ifa_ifu;
  25. /* These very same macros are defined by <net/if.h> for `struct ifaddr'.
  26. So if they are defined already, the existing definitions will be fine. */
  27. # ifndef _monodroid_ifa_broadaddr
  28. # define _monodroid_ifa_broadaddr ifa_ifu.ifu_broadaddr
  29. # endif
  30. # ifndef _monodroid_ifa_dstaddr
  31. # define _monodroid_ifa_dstaddr ifa_ifu.ifu_dstaddr
  32. # endif
  33. void *ifa_data; /* Address-specific data (may be unused). */
  34. };
  35. void _monodroid_getifaddrs_init(void);
  36. MONO_API int _monodroid_getifaddrs(struct _monodroid_ifaddrs **ifap);
  37. MONO_API void _monodroid_freeifaddrs(struct _monodroid_ifaddrs *ifa);
  38. #ifdef __cplusplus
  39. }
  40. #endif
  41. #endif