unix.h 859 B

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. @file unix.h
  3. @brief ENet Unix header
  4. */
  5. #ifndef __ENET_UNIX_H__
  6. #define __ENET_UNIX_H__
  7. #include <stdlib.h>
  8. #include <sys/types.h>
  9. #include <netinet/in.h>
  10. typedef int ENetSocket;
  11. enum
  12. {
  13. ENET_SOCKET_NULL = -1
  14. };
  15. #define ENET_HOST_TO_NET_16(value) (htons (value)) /**< macro that converts host to net byte-order of a 16-bit value */
  16. #define ENET_HOST_TO_NET_32(value) (htonl (value)) /**< macro that converts host to net byte-order of a 32-bit value */
  17. #define ENET_NET_TO_HOST_16(value) (ntohs (value)) /**< macro that converts net to host byte-order of a 16-bit value */
  18. #define ENET_NET_TO_HOST_32(value) (ntohl (value)) /**< macro that converts net to host byte-order of a 32-bit value */
  19. typedef struct
  20. {
  21. void * data;
  22. size_t dataLength;
  23. } ENetBuffer;
  24. #define ENET_CALLBACK
  25. #define ENET_API extern
  26. #endif /* __ENET_UNIX_H__ */