mac_mlme_orphan.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /**
  2. * Copyright (c) 2016 - 2020 Nordic Semiconductor ASA and Luxoft Global Operations Gmbh.
  3. *
  4. * All Rights Reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without modification,
  7. * are permitted provided that the following conditions are met:
  8. *
  9. *
  10. * 1. Redistributions of source code must retain the above copyright notice, this
  11. * list of conditions and the following disclaimer.
  12. *
  13. * 2. Redistributions in binary form, except as embedded into a Nordic
  14. * Semiconductor ASA integrated circuit in a product or a software update for
  15. * such product, must reproduce the above copyright notice, this list of
  16. * conditions and the following disclaimer in the documentation and/or other
  17. * materials provided with the distribution.
  18. *
  19. * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
  20. * contributors may be used to endorse or promote products derived from this
  21. * software without specific prior written permission.
  22. *
  23. * 4. This software, with or without modification, must only be used with a
  24. * Nordic Semiconductor ASA integrated circuit.
  25. *
  26. * 5. Any software provided in binary form under this license must not be reverse
  27. * engineered, decompiled, modified and/or disassembled.
  28. *
  29. *
  30. * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
  31. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  32. * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
  33. * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
  34. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  35. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  36. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  37. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  38. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  39. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40. *
  41. */
  42. #ifndef MAC_MLME_ORPHAN_H_INCLUDED
  43. #define MAC_MLME_ORPHAN_H_INCLUDED
  44. #if (CONFIG_ORPHAN_ENABLED == 1)
  45. #include <stdint.h>
  46. #include <stdbool.h>
  47. #include "mac_common.h"
  48. /** @file
  49. * The MAC MLME Orphan module declares the MAC Orphan routines and
  50. * necessary types/macros according to the MAC specification.
  51. *
  52. * @defgroup mac_orphan MAC MLME Orphan API
  53. * @ingroup mac_15_4
  54. * @{
  55. * @brief Module to declare MAC MLME Orphan API.
  56. * @details The MAC Orphan module declares routines and necessary types to deal with the Orphan devices
  57. * according to the MAC specification. More specifically, MAC MLME Orphan indication aka
  58. * mlme_orphan_ind(), MAC MLME Orphan response aka mlme_orphan_resp() primitives are declared.
  59. */
  60. /**
  61. * @brief MLME-ORPHAN.indication
  62. *
  63. * @details The MLME-ORPHAN.indication primitive allows the MLME of a coordinator
  64. * to notify the next higher layer of the presence of an orphaned device.
  65. *
  66. * In accordance with IEEE Std 802.15.4-2006, section 7.1.8.1
  67. */
  68. typedef struct
  69. {
  70. /** The address of the orphaned device. */
  71. uint64_t orphan_address;
  72. #if (CONFIG_SECURE == 1)
  73. uint8_t security_level; /**< Security level. */
  74. uint8_t key_id_mode; /**< Key ID mode. */
  75. uint64_t key_source; /**< Key source. */
  76. uint8_t key_index; /**< Key index. */
  77. #endif
  78. } mlme_orphan_ind_t;
  79. /**
  80. * @brief MLME-ORPHAN.response
  81. *
  82. * @details The MLME-ORPHAN.response primitive allows the next higher layer of a coordinator
  83. * to respond to the MLME-ORPHAN.indication primitive.
  84. *
  85. * In accordance with IEEE Std 802.15.4-2006, section 7.1.8.2
  86. */
  87. typedef struct
  88. {
  89. /** Do not edit this field. */
  90. mac_abstract_req_t service;
  91. /** The address of the orphaned device. */
  92. uint64_t orphan_address;
  93. /**
  94. * The 16-bit short address allocated to the orphaned device if it is associated with this
  95. * coordinator. The special short address 0xfffe indicates that no short address was
  96. * allocated, and the device will use its 64-bit extended address in all communications.
  97. * If the device was not associated with this coordinator, this field will contain the
  98. * value 0xffff and be ignored on receipt.
  99. */
  100. uint16_t short_address;
  101. /** TRUE if the orphaned device is associated with this coordinator or FALSE otherwise. */
  102. bool associated_member;
  103. #if (CONFIG_SECURE == 1)
  104. uint8_t security_level; /**< Security level. */
  105. uint8_t key_id_mode; /**< Key ID mode. */
  106. uint64_t key_source; /**< Key source. */
  107. uint8_t key_index; /**< Key index. */
  108. #endif
  109. } mlme_orphan_resp_t;
  110. /**
  111. * @brief MLME-ORPHAN.indication handler
  112. *
  113. * @details The MLME-ORPHAN.indication primitive is generated by the MLME of a coordinator
  114. * and issued to its next higher layer on receipt of an orphan notification command (see 7.3.6).
  115. *
  116. * @param ind MLME-ORPHAN.indication structure.
  117. *
  118. * In accordance with IEEE Std 802.15.4-2006, section 7.1.8.1
  119. */
  120. extern void mlme_orphan_ind(mlme_orphan_ind_t * ind);
  121. /**
  122. * @brief MLME-ORPHAN.response handler
  123. *
  124. * @details The MLME-ORPHAN.response primitive is generated by the next higher layer and issued to its MLME
  125. * when it reaches a decision about whether the orphaned device indicated in the MLME-ORPHAN.indication
  126. * primitive is associated.
  127. *
  128. * @param resp MLME-ORPHAN.response structure.
  129. *
  130. * In accordance with IEEE Std 802.15.4-2006, section 7.1.8.2
  131. */
  132. void mlme_orphan_resp(mlme_orphan_resp_t * resp);
  133. /** @} */
  134. #endif // (CONFIG_ORPHAN_ENABLED == 1)
  135. #endif // MAC_MLME_ORPHAN_H_INCLUDED