mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
cleanup: Pull #include
directives to the beginning of the file.
We won't be allowing includes to appear after other declarations.
This commit is contained in:
parent
9e659e6577
commit
3f0ab46229
|
@ -10,6 +10,34 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
||||||
|
// The mingw32/64 Windows library warns about including winsock2.h after
|
||||||
|
// windows.h even though with the above it's a valid thing to do. So, to make
|
||||||
|
// mingw32 headers happy, we include winsock2.h first.
|
||||||
|
#include <winsock2.h>
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <ws2tcpip.h>
|
||||||
|
|
||||||
|
#include <iphlpapi.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
#include <linux/netdevice.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
|
#include <net/if.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#define MAX_INTERFACES 16
|
#define MAX_INTERFACES 16
|
||||||
|
@ -25,16 +53,6 @@ static IP_Port broadcast_ip_ports[MAX_INTERFACES];
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
||||||
|
|
||||||
// The mingw32/64 Windows library warns about including winsock2.h after
|
|
||||||
// windows.h even though with the above it's a valid thing to do. So, to make
|
|
||||||
// mingw32 headers happy, we include winsock2.h first.
|
|
||||||
#include <winsock2.h>
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
#include <ws2tcpip.h>
|
|
||||||
|
|
||||||
#include <iphlpapi.h>
|
|
||||||
|
|
||||||
static void fetch_broadcast_info(uint16_t port)
|
static void fetch_broadcast_info(uint16_t port)
|
||||||
{
|
{
|
||||||
IP_ADAPTER_INFO *pAdapterInfo = (IP_ADAPTER_INFO *)malloc(sizeof(IP_ADAPTER_INFO));
|
IP_ADAPTER_INFO *pAdapterInfo = (IP_ADAPTER_INFO *)malloc(sizeof(IP_ADAPTER_INFO));
|
||||||
|
@ -104,20 +122,6 @@ static void fetch_broadcast_info(uint16_t port)
|
||||||
|
|
||||||
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#ifdef __linux__
|
|
||||||
#include <linux/netdevice.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
|
||||||
#include <net/if.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void fetch_broadcast_info(uint16_t port)
|
static void fetch_broadcast_info(uint16_t port)
|
||||||
{
|
{
|
||||||
/* Not sure how many platforms this will run on,
|
/* Not sure how many platforms this will run on,
|
||||||
|
@ -204,6 +208,7 @@ static void fetch_broadcast_info(uint16_t port)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Send packet to all IPv4 broadcast addresses
|
/* Send packet to all IPv4 broadcast addresses
|
||||||
*
|
*
|
||||||
* return 1 if sent to at least one broadcast target.
|
* return 1 if sent to at least one broadcast target.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user