nghttp2_net.h 863 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (C) 2015-2018 Alibaba Group Holding Limited
  3. */
  4. #ifndef NGHTTP2_NET_H
  5. #define NGHTTP2_NET_H
  6. #ifndef LITTLE_ENDIAN
  7. #define LITTLE_ENDIAN 1234
  8. #endif
  9. #ifndef BIG_ENDIAN
  10. #define BIG_ENDIAN 4321
  11. #endif
  12. #define IOT_BYTE_ORDER LITTLE_ENDIAN
  13. #if IOT_BYTE_ORDER == BIG_ENDIAN
  14. #define nghttp2_htonl(x) (x)
  15. #define nghttp2_htons(x) (x)
  16. #define nghttp2_ntohl(x) (x)
  17. #define nghttp2_ntohs(x) (x)
  18. #else
  19. /* Windows requires ws2_32 library for ntonl family functions. We
  20. define inline functions for those function so that we don't have
  21. dependeny on that lib. */
  22. #ifdef _MSC_VER
  23. #define STIN
  24. #else
  25. #define STIN
  26. #endif
  27. STIN uint32_t nghttp2_htonl(uint32_t hostlong);
  28. STIN uint16_t nghttp2_htons(uint16_t hostshort);
  29. STIN uint32_t nghttp2_ntohl(uint32_t netlong);
  30. STIN uint16_t nghttp2_ntohs(uint16_t netshort);
  31. #endif
  32. #endif /* NGHTTP2_NET_H */