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