tsms_tpdu_status_report.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /*
  2. * Copyright (C) 2009 Mamadou Diop.
  3. *
  4. * Contact: Mamadou Diop <diopmamadou [at) doubango (DOT) org>
  5. *
  6. * This file is part of Open Source Doubango Framework.
  7. *
  8. * DOUBANGO is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * DOUBANGO 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
  19. * along with DOUBANGO.
  20. *
  21. */
  22. /**@file tsms_tpdu_status_report.h
  23. * @brief SMS TPDU SMS-STATUS-REPORT message as per 3GPP TS 23.040 section 9.2.2.3.
  24. *
  25. * @author Mamadou Diop <diopmamadou [at) doubango (DOT) org>
  26. *
  27. */
  28. #ifndef TINYSMS_TSMS_TPDU_STATUS_REPORT_H
  29. #define TINYSMS_TSMS_TPDU_STATUS_REPORT_H
  30. #include "tinysms_config.h"
  31. #include "tinysms/tsms_common.h"
  32. TSMS_BEGIN_DECLS
  33. /** 3GPP TS 23.040 v910 section 9.2.3.15 (TP-ST).
  34. * Used in SMS-STATUS-REPORT message.
  35. */
  36. typedef enum tsms_tpdu_status_type_e {
  37. /*== Short message transaction completed ==*/
  38. tsms_tpdu_status_received = 0x00, /**< Short message received by the SME. */
  39. tsms_tpdu_status_forwarded = 0x01, /**< Short message forwarded by the SC to the SME but the SC is unable to confirm delivery. */
  40. tsms_tpdu_status_replaced = 0x02, /**< Short message replaced by the SC. */
  41. /* 0000011..0001111 Reserved */
  42. /* 0010000..0011111 Values specific to each SC */
  43. /*== Temporary error, SC still trying to transfer SM ==*/
  44. tsms_tpdu_status_congestion = 0x20, /**< Congestion. */
  45. tsms_tpdu_status_busy = 0x21, /**< ME busy. */
  46. tsms_tpdu_status_no_response = 0x22, /**< No response from SME. */
  47. tsms_tpdu_status_serv_rejected = 0x23, /**< Service rejected. */
  48. tsms_tpdu_status_no_qos = 0x24, /**< Quality of service not available. */
  49. tsms_tpdu_status_error_in_sme= 0x25, /**< Error in SME. */
  50. /* 0100110..0101111 Reserved */
  51. /* 0110000..0111111 Values specific to each SC */
  52. /*== Permanent error, SC is not making any more transfer attempts ==*/
  53. tsms_tpdu_status_remote_error = 0x40, /**< Remote procedure error. */
  54. tsms_tpdu_status_incompatible_dest = 0x41, /**< Incompatible destination. */
  55. tsms_tpdu_status_conn_rejected = 0x42, /**< Connection rejected by SME. */
  56. tsms_tpdu_status_not_obtainable = 0x43, /**< Not obtainable. */
  57. tsms_tpdu_status_no_qos_2 = 0x44, /**< Quality of service not available. */
  58. tsms_tpdu_status_no_inter_avail = 0x45, /**< No interworking available. */
  59. tsms_tpdu_status_vp_expired = 0x46, /**< SM Validity Period Expired. */
  60. tsms_tpdu_status_deleted_by_orig = 0x47, /**< SM Deleted by originating SME. */
  61. tsms_tpdu_status_deleted_by_admin = 0x48, /**< SM Deleted by SC Administration. */
  62. tsms_tpdu_status_sm_not_exist = 0x49, /**< SM does not exist (The SM may have previously existed in the SC but the SC no longer has knowledge of it or the SM may never have previously existed in the SC). */
  63. /* 1001010..1001111 Reserved */
  64. /* 1010000..1011111 Values specific to each SC */
  65. /*== Temporary error, SC is not making any more transfer attempts ==*/
  66. tsms_tpdu_status_congestion_3 = 0x50, /**< Congestion. */
  67. tsms_tpdu_status_busy_3 = 0x51, /**< SME busy. */
  68. tsms_tpdu_status_no_response_3 = 0x52, /**< No response from SME. */
  69. tsms_tpdu_status_serv_rejected_3 = 0x53, /**< Service rejected. */
  70. tsms_tpdu_status_temp_no_qos_3 = 0x54, /**< Quality of service not available. */
  71. tsms_tpdu_status_error_in_sme_3 = 0x55, /**< Error in SME. */
  72. /* 1100110..1101001 Reserved */
  73. /* 1101010..1101111 Reserved */
  74. /* 1110000..1111111 Values specific to each SC */
  75. }
  76. tsms_tpdu_status_type_t;
  77. /** SMS TPDU SMS-STATUS-REPORT message as per 3GPP TS 23.040 section 9.2.2.3.
  78. */
  79. typedef struct tsms_tpdu_status_report_s {
  80. TSMS_DECLARE_TPDU_MESSAGE;
  81. tsms_address_t* smsc;
  82. /** TP User Data Header Indicator (O - 1b)
  83. * Parameter indicating that the TP UD field contains a Header. */
  84. unsigned udhi:1;
  85. /** TP More Messages to Send (M - 1b)
  86. * Parameter indicating whether or not there are more messages to send. */
  87. unsigned mms:1;
  88. /** TP-Loop-Prevention (O - 1b)
  89. * Parameter indicating that SMS applications should inhibit forwarding or automatic message generation that could cause infinite looping.
  90. Section 9.2.3.28 */
  91. unsigned lp:1;
  92. /** TP Status Report Qualifier (M - 1b)
  93. * Parameter indicating whether the previously submitted TPDU was an SMS-SUBMIT or an SMS COMMAND. */
  94. unsigned srq:1;
  95. /** TP Message Reference (M - I)
  96. * Parameter identifying the previously submitted SMS SUBMIT or SMS COMMAND.
  97. * See section 9.2.3.26. */
  98. unsigned mr;
  99. /** TP Recipient Address (M - 2-12o)
  100. * Address of the recipient of the previously submitted mobile originated short message. */
  101. tsms_address_t* ra;
  102. /** TP Service Centre Time Stamp (M - 7o)
  103. * Parameter identifying time when the SC received the previously sent SMS SUBMIT. */
  104. uint8_t scts[7];
  105. /** TP Discharge Time (M 7o)
  106. * Parameter identifying the time associated with a particular TP ST outcome. */
  107. uint8_t dt[7];
  108. /** TP Status (M - o)
  109. * Parameter identifying the status of the previously sent mobile originated short message. */
  110. tsms_tpdu_status_type_t st;
  111. /** TP-Parameter-Indicator (O - o)
  112. * Parameter indicating the presence of any of the optional parameters which follow. */
  113. uint8_t pi;
  114. /** TP Protocol Identifier (O - o)
  115. * See clause 9.2.3.9. TP-PID of original SMS-SUBMIT. */
  116. //(base)uint8_t pid;
  117. /** TP Data Coding Scheme (O - o)
  118. * See clause 9.2.3.10. */
  119. //(base)uint8_t dcs;
  120. /** TP User Data Length (O- o)
  121. * See clause 9.2.3.16. */
  122. //(base)uint8_t udl;
  123. /** TP User Data (O - v)
  124. * User data. See clause 9.2.3.24. */
  125. //(base)uint8_t* ud;
  126. }
  127. tsms_tpdu_status_report_t;
  128. /** cast any pointer to @ref tsms_tpdu_status_report_t* */
  129. #define TSMS_TPDU_STATUS_REPORT(self) ((tsms_tpdu_status_report_t*)(self))
  130. TINYSMS_API tsms_tpdu_status_report_t* tsms_tpdu_status_report_create(uint8_t mr, const tsms_address_string_t smsc, const tsms_address_string_t recipient, tsms_tpdu_status_type_t status, tsk_bool_t submit);
  131. /**@ingroup tsms_tpdu_group
  132. * @def tsms_tpdu_status_report_serialize
  133. * Serializes a @a SMS-STATUS-REPORT message as binary content.
  134. * @param self A pointer to the @a SMS-STATUS-REPORT (@ref tsms_tpdu_status_report_t) message to serialize.
  135. * @param output A pointer to the output buffer. Should be valid.
  136. * @retval Zero if succeed and non-zero error code otherwise.
  137. *
  138. * See For more information, see @ref tsms_tpdu_group_STATUS_REPORT "SMS-STATUS-REPORT".
  139. */
  140. /**@ingroup tsms_tpdu_group
  141. * @def tsms_tpdu_status_report_tohexastring
  142. * Serializes a @a SMS-STATUS-REPORT message as hexa-string content.
  143. * @param self A pointer to the @a SMS-STATUS-REPORT (@ref tsms_tpdu_status_report_t) message to serialize.
  144. * @retval A pointer to the hexa-string if succeed and Null otherwise.
  145. *
  146. * See For more information, see @ref tsms_tpdu_group_STATUS_REPORT "SMS-STATUS-REPORT".
  147. */
  148. /**@ingroup tsms_tpdu_group
  149. * @def tsms_tpdu_status_report_set_userdata
  150. * Sets the content of the @a SMS-STATUS-REPORT message.
  151. * @param self A pointer to the @a SMS-STATUS-REPORT (@ref tsms_tpdu_status_report_t).
  152. * @param udata A pointer to the content.
  153. * @param alpha The alphabet used to encode the content.
  154. * @retval Zero if succeed and non-zero error code otherwise.
  155. *
  156. * See For more information, see @ref tsms_tpdu_group_STATUS_REPORT "SMS-STATUS-REPORT".
  157. */
  158. #define tsms_tpdu_status_report_serialize(self, output) tsms_tpdu_message_serialize(TSMS_TPDU_MESSAGE(self), output, tsk_false)
  159. #define tsms_tpdu_status_report_tostring(self) tsms_tpdu_message_tostring(TSMS_TPDU_MESSAGE(self), tsk_false)
  160. #define tsms_tpdu_status_report_tohexastring(self) tsms_tpdu_message_tohexastring(TSMS_TPDU_MESSAGE(self), tsk_false)
  161. #define tsms_tpdu_status_report_set_userdata(self, udata, alpha) tsms_tpdu_message_set_userdata(TSMS_TPDU_MESSAGE(self), udata, alpha)
  162. TINYSMS_GEXTERN const tsk_object_def_t *tsms_tpdu_status_report_def_t;
  163. TSMS_END_DECLS
  164. #endif /* TINYSMS_TSMS_TPDU_STATUS_REPORT_H */