MS_ltrn_api.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. /**
  2. * \file MS_ltrn_api.h
  3. *
  4. * \brief This file defines the Mesh Lower Transport Application Interface - includes
  5. * Data Structures and Methods.
  6. */
  7. /*
  8. * Copyright (C) 2017. Mindtree Ltd.
  9. * All rights reserved.
  10. */
  11. #ifndef _H_MS_LTRN_API_
  12. #define _H_MS_LTRN_API_
  13. /* --------------------------------------------- Header File Inclusion */
  14. /* Network API Header File */
  15. #include "MS_net_api.h"
  16. /* --------------------------------------------- Global Definitions */
  17. /**
  18. * \defgroup ltrn_module LTRANSPORT (Mesh Lower Transport Layer)
  19. * \{
  20. * This section describes the interfaces & APIs offered by the EtherMind
  21. * Mesh Lower Transport (LTRANSPORT) module to the Application and other upper
  22. * layers of the stack.
  23. */
  24. /**
  25. * \defgroup ltrn_defines Defines
  26. * \{
  27. * Describes defines for the module.
  28. */
  29. /**
  30. * \defgroup ltrn_constants Constants
  31. * \{
  32. * Describes Constants defined by the module.
  33. */
  34. /** Unsgemented Access Message */
  35. #define MS_UNSEGMENTED_ACCESS_MSG 0x00
  36. /** Segmented Access Message */
  37. #define MS_SEGMENTED_ACCESS_MSG 0x01
  38. /** Unsegmented Control Message */
  39. #define MS_UNSEGMENTED_CTRL_MSG 0x02
  40. /** Segmented Control Message */
  41. #define MS_SEGMENTED_CTRL_MSG 0x03
  42. /** Transport Message Type */
  43. typedef UCHAR MS_TRN_MSG_TYPE;
  44. /** Transport Layer Control Packet */
  45. #define MS_TRN_CTRL_PKT 0x01
  46. /** Access Layer Packet */
  47. #define MS_TRN_ACCESS_PKT 0x00
  48. /** \} */
  49. /**
  50. * \defgroup ltrn_events Events
  51. * \{
  52. * This section lists the Asynchronous Events notified to Application by the
  53. * Module.
  54. */
  55. /** \} */
  56. /** \} */
  57. /**
  58. * \defgroup ltrn_marcos Utility Macros
  59. * \{
  60. * Initialization and other Utility Macros offered by the module.
  61. */
  62. /** \} */
  63. /* --------------------------------------------- Data Types/ Structures */
  64. /**
  65. * \addtogroup ltrn_defines Defines
  66. * \{
  67. */
  68. /**
  69. * \addtogroup ltrn_structures Structures
  70. * \{
  71. */
  72. /** LPN Handle */
  73. typedef UINT8 LPN_HANDLE;
  74. /** \} */
  75. /** \} */
  76. /**
  77. * \defgroup ltrn_cb Application Callback
  78. * \{
  79. * This Section Describes the module Notification Callback interface offered
  80. * to the application
  81. */
  82. /**
  83. * Lower TRANSPORT Application Asynchronous Notification Callback.
  84. *
  85. * Lower TRANSPORT calls the registered callback to indicate events occurred to the
  86. * application.
  87. *
  88. * \param net_hdr Network Header.
  89. * \param subnet_handle Associated Subnet Handle.
  90. * \param data_param Data associated with the event if any or NULL.
  91. * \param data_len Size of the event data. 0 if event data is NULL.
  92. */
  93. typedef API_RESULT (*LTRN_NTF_CB)
  94. (
  95. MS_NET_HEADER * net_hdr,
  96. MS_SUBNET_HANDLE subnet_handle,
  97. UCHAR szmic,
  98. UCHAR * data_param,
  99. UINT16 data_len
  100. ) DECL_REENTRANT;
  101. /** \} */
  102. /**
  103. * \addtogroup ltrn_defines Defines
  104. * \{
  105. */
  106. /**
  107. * \addtogroup ltrn_structures Structures
  108. * \{
  109. */
  110. /** \} */
  111. /** \} */
  112. /** TCF (Transport Control Field) - Transport Field Value */
  113. /* --------------------------------------------- Function */
  114. /**
  115. * \defgroup ltrn_api_defs API Definitions
  116. * \{
  117. * This section describes the EtherMind Mesh Lower Transport Layer APIs.
  118. */
  119. #ifdef __cplusplus
  120. extern "C" {
  121. #endif
  122. /**
  123. * \brief Register Inerface with Lower Transport Layer
  124. *
  125. * \par Description
  126. * This routine registers interface with the Lower Transport Layer.
  127. * Transport Layer supports single Application, hence this rouine shall be called once.
  128. *
  129. * \param [in] ltrn_cb
  130. * Upper Layer Notification Callback
  131. *
  132. * \return API_SUCCESS or an error code indicating reason for failure
  133. */
  134. API_RESULT MS_ltrn_register
  135. (
  136. /* IN */ LTRN_NTF_CB ltrn_cb
  137. );
  138. /**
  139. * \brief API to send transport PDUs
  140. *
  141. * \par Description
  142. * This routine sends transport PDUs to peer device.
  143. *
  144. * \param [in] src_addr
  145. * Source Address
  146. *
  147. * \param [in] dst_addr
  148. * Destination Address
  149. *
  150. * \param [in] subnet_handle
  151. * Handle identifying the Subnet
  152. *
  153. * \param [in] msg_type
  154. * Transport Message Type
  155. *
  156. * \param [in] ttl
  157. * Time to Live
  158. *
  159. * \param [in] akf
  160. * Application Key Flag
  161. *
  162. * \param [in] aid
  163. * Application Key Identifier
  164. *
  165. * \param [in] seq_num
  166. * Sequence Number to be used for the Packet
  167. *
  168. * \param [in] buffer
  169. * Transport Packet
  170. *
  171. * \param [in] buffer_len
  172. * Transport Packet Length
  173. *
  174. * \param [in] reliable
  175. * If requires lower transport Ack, set reliable as TRUE
  176. *
  177. * \return API_SUCCESS or an error code indicating reason for failure
  178. */
  179. API_RESULT MS_ltrn_send_pdu
  180. (
  181. /* IN */ MS_NET_ADDR src_addr,
  182. /* IN */ MS_NET_ADDR dst_addr,
  183. /* IN */ MS_SUBNET_HANDLE subnet_handle,
  184. /* IN */ MS_TRN_MSG_TYPE msg_type,
  185. /* IN */ UINT8 ttl,
  186. /* IN */ UINT8 akf,
  187. /* IN */ UINT8 aid,
  188. /* IN */ UINT32 seq_num,
  189. /* IN */ UCHAR * buffer,
  190. /* IN */ UINT16 buffer_len,
  191. /* IN */ UINT8 reliable
  192. );
  193. /**
  194. * \brief To clear all Segmentation and Reassembly Contexts
  195. *
  196. * \par Description
  197. * This routine clears all Segmentation and Reassembly Contexts.
  198. *
  199. * \return API_SUCCESS or an error code indicating reason for failure
  200. */
  201. API_RESULT MS_ltrn_clear_sar_contexts(void);
  202. #ifdef __cplusplus
  203. };
  204. #endif
  205. /** \} */
  206. /** \} */
  207. #endif /* _H_MS_LTRN_API_ */