rpc_stub_defs.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _RPC_STUB_DEFS_H_
  13. #define _RPC_STUB_DEFS_H_
  14. #include "rpc_daemon.h"
  15. #include "rpc_config.h"
  16. #include "rpc_features.h"
  17. #include <assert.h>
  18. #include <stdlib.h>
  19. #include <string.h>
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. #define CHECK_IPAR_SIZE(size) \
  24. static_assert((size) <= CONFIG_RPC_PACKET_SIZE_MAX - sizeof(rpcCallHeader_t), \
  25. "RPC packet size should be smaller than CONFIG_RPC_PACKET_SIZE_MAX"); \
  26. static_assert((size) % 8 == 0, "RPC packet size should be 8 bytes aligned")
  27. #define CHECK_OPAR_SIZE(size) \
  28. static_assert((size) <= CONFIG_RPC_PACKET_SIZE_MAX - sizeof(rpcRespHeader_t), \
  29. "RPC packet size should be smaller than CONFIG_RPC_PACKET_SIZE_MAX"); \
  30. static_assert((size) % 8 == 0, "RPC packet size should be 8 bytes aligned")
  31. #ifdef __cplusplus
  32. }
  33. #endif
  34. #endif