network.h 955 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. int_fast8_t sendrecv(SOCKET sock, BYTE *data, int len, int_fast8_t do_send);
  12. #define _recv(s, d, l) sendrecv(s, (BYTE *)d, l, 0)
  13. #define _send(s, d, l) sendrecv(s, (BYTE *)d, l, !0)
  14. #ifndef NO_SOCKETS
  15. void closeAllListeningSockets();
  16. #ifdef SIMPLE_SOCKETS
  17. int listenOnAllAddresses();
  18. #endif // SIMPLE_SOCKETS
  19. BOOL addListeningSocket(const char *const addr);
  20. __pure int_fast8_t checkProtocolStack(const int addressfamily);
  21. #if HAVE_GETIFADDR
  22. void getPrivateIPAddresses(int* numAddresses, char*** ipAddresses);
  23. #endif // HAVE_GETIFADDR
  24. #endif // NO_SOCKETS
  25. int runServer();
  26. SOCKET connectToAddress(const char *const addr, const int AddressFamily, int_fast8_t showHostName);
  27. int_fast8_t isDisconnected(const SOCKET s);
  28. #endif // INCLUDED_NETWORK_H