network.h 842 B

12345678910111213141516171819202122232425262728293031323334353637
  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. #endif // NO_SOCKETS
  22. int runServer();
  23. SOCKET connectToAddress(const char *const addr, const int AddressFamily, int_fast8_t showHostName);
  24. int_fast8_t isDisconnected(const SOCKET s);
  25. #endif // INCLUDED_NETWORK_H