cc.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /**
  2. * @file cc.h
  3. * @author Ambroz Bizjak <[email protected]>
  4. *
  5. * @section LICENSE
  6. *
  7. * This file is part of BadVPN.
  8. *
  9. * BadVPN is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2
  11. * as published by the Free Software Foundation.
  12. *
  13. * BadVPN is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along
  19. * with this program; if not, write to the Free Software Foundation, Inc.,
  20. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  21. */
  22. #ifndef LWIP_CUSTOM_CC_H
  23. #define LWIP_CUSTOM_CC_H
  24. #include <inttypes.h>
  25. #include <stdlib.h>
  26. #include <errno.h>
  27. #include <misc/debug.h>
  28. #include <misc/byteorder.h>
  29. #define u8_t uint8_t
  30. #define s8_t int8_t
  31. #define u16_t uint16_t
  32. #define s16_t int16_t
  33. #define u32_t uint32_t
  34. #define s32_t int32_t
  35. #define mem_ptr_t uintptr_t
  36. #define PACK_STRUCT_STRUCT __attribute__((packed))
  37. #define LWIP_PLATFORM_DIAG(x) DEBUG x
  38. #define LWIP_PLATFORM_ASSERT(x) ({ DEBUG("lwip assertion failure: %s", (x)); abort(); })
  39. #define U16_F PRIu16
  40. #define S16_F PRId16
  41. #define X16_F PRIx16
  42. #define U32_F PRIu32
  43. #define S32_F PRId32
  44. #define X32_F PRIx32
  45. #define SZT_F "zu"
  46. #define LWIP_PLATFORM_BYTESWAP 1
  47. #define LWIP_PLATFORM_HTONS(x) hton16(x)
  48. #define LWIP_PLATFORM_HTONL(x) hton32(x)
  49. // for BYTE_ORDER
  50. #ifdef BADVPN_USE_WINAPI
  51. #include <sys/param.h>
  52. #else
  53. #include <endian.h>
  54. #endif
  55. #endif