1
0

network.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef INCLUDED_NETWORK_H
  2. #define INCLUDED_NETWORK_H
  3. #ifndef CONFIG
  4. #define CONFIG "config.h"
  5. #endif // CONFIG
  6. #include CONFIG
  7. #ifndef _GNU_SOURCE
  8. #define _GNU_SOURCE
  9. #endif
  10. #include "types.h"
  11. #include "output.h"
  12. #if _MSC_VER
  13. //typedef signed char int_fast8_t;
  14. //typedef unsigned char BYTE;
  15. //typedef UINT_PTR size_t;
  16. //typedef unsigned long DWORD;
  17. #define STDIN_FILENO 0
  18. #endif
  19. int_fast8_t sendrecv(SOCKET sock, BYTE *data, int len, int_fast8_t do_send);
  20. #define _recv(s, d, l) sendrecv(s, (BYTE *)d, l, 0)
  21. #define _send(s, d, l) sendrecv(s, (BYTE *)d, l, !0)
  22. #ifndef NO_SOCKETS
  23. void closeAllListeningSockets();
  24. #ifdef SIMPLE_SOCKETS
  25. int listenOnAllAddresses();
  26. #endif // SIMPLE_SOCKETS
  27. BOOL addListeningSocket(const char *const addr);
  28. __pure int_fast8_t checkProtocolStack(const int addressfamily);
  29. #if HAVE_GETIFADDR
  30. void getPrivateIPAddresses(int* numAddresses, char*** ipAddresses);
  31. #endif // HAVE_GETIFADDR
  32. #endif // NO_SOCKETS
  33. int runServer();
  34. SOCKET connectToAddress(const char *const addr, const int AddressFamily, int_fast8_t showHostName);
  35. int_fast8_t isDisconnected(const SOCKET s);
  36. #endif // INCLUDED_NETWORK_H