lokinet/include/llarp/net.h

38 lines
749 B
C
Raw Normal View History

2018-04-08 12:18:16 +00:00
#ifndef LLARP_NET_H
#define LLARP_NET_H
#if defined(_WIN32) || defined(__MINGW32__)
2018-07-25 00:39:52 +00:00
#include <winsock2.h>
#include <ws2tcpip.h>
#include <wspiapi.h>
// because this shit is not defined for Windows NT reeeee
#ifndef _MSC_VER
#ifdef __cplusplus
2018-08-08 13:09:07 +00:00
extern "C"
{
#endif
2018-08-08 13:09:07 +00:00
const char*
inet_ntop(int af, const void* src, char* dst, size_t size);
int
inet_pton(int af, const char* src, void* dst);
#ifdef __cplusplus
}
#endif
#endif
#ifndef ssize_t
#define ssize_t long
#endif
typedef unsigned short in_port_t;
typedef unsigned int in_addr_t;
2018-07-25 00:39:52 +00:00
#else
#include <arpa/inet.h>
2018-01-08 13:49:05 +00:00
#include <netinet/in.h>
2018-07-25 00:42:14 +00:00
#include <sys/socket.h>
2018-07-25 00:39:52 +00:00
#endif
#include <stdbool.h>
2018-01-29 14:27:24 +00:00
#include <sys/types.h>
2018-01-08 13:49:05 +00:00
bool
llarp_getifaddr(const char* ifname, int af, struct sockaddr* addr);
2018-01-08 13:49:05 +00:00
#endif