lightduer_nsdl_adapter.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /**
  2. * Copyright (2017) Baidu Inc. All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. // Author: Su Hao (suhao@baidu.com)
  17. //
  18. // Description: Adapter between nsdl and Baidu CA CoAP.
  19. #ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_NSDL_ADAPTER_H
  20. #define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_NSDL_ADAPTER_H
  21. #include "ns_types.h"
  22. #include "sn_nsdl.h"
  23. #include "sn_coap_header.h"
  24. #include "lightduer_lib.h"
  25. #include "lightduer_types.h"
  26. #include "lightduer_coap.h"
  27. #ifndef MBED_CLIENT_C_VERSION
  28. #define MBED_CLIENT_C_VERSION (30001) // 3.0.1
  29. #endif
  30. /*
  31. * Set the nsdl address from ca
  32. *
  33. * @Param target, in, the target will be evaluated
  34. * @Param source, the CA address
  35. */
  36. DUER_INT void duer_nsdl_address_set(sn_nsdl_addr_s* target,
  37. const duer_addr_t* source);
  38. /*
  39. * Set the nsdl CoAP header from ca
  40. *
  41. * @Param target, in, the target will be evaluated
  42. * @Param opt, in, the CoAP options
  43. * @Param source, the CA message header
  44. */
  45. DUER_INT void duer_nsdl_header_set(sn_coap_hdr_s* target,
  46. sn_coap_options_list_s* opt,
  47. const duer_msg_t* source);
  48. /*
  49. * Set the CoAP address from nsdl
  50. *
  51. * @Param target, in, the target will be evaluated
  52. * @Param source, the nsdl address
  53. */
  54. DUER_INT void duer_coap_address_set(duer_addr_t* target,
  55. const sn_nsdl_addr_s* source);
  56. /*
  57. * Set the CoAP header from nsdl
  58. *
  59. * @Param target, in, the target will be evaluated
  60. * @Param source, the nsdl message header
  61. */
  62. DUER_INT void duer_coap_header_set(duer_msg_t* target,
  63. const sn_coap_hdr_s* source);
  64. #endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_NSDL_ADAPTER_H