tsms_tpdu_submit.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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_submit.h
  23. * @brief SMS TPDU SMS-SUBMIT (MO) message as per 3GPP TS 23.040 section 9.2.2.2.
  24. *
  25. * @author Mamadou Diop <diopmamadou [at) doubango (DOT) org>
  26. *
  27. */
  28. #ifndef TINYSMS_TSMS_TPDU_SUBMIT_H
  29. #define TINYSMS_TSMS_TPDU_SUBMIT_H
  30. #include "tinysms_config.h"
  31. #include "tinysms/tsms_common.h"
  32. TSMS_BEGIN_DECLS
  33. /** SMS @a SMS-SUBMIT message as per 3GPP TS 23.040 section 9.2.2.2
  34. */
  35. typedef struct tsms_tpdu_submit_s {
  36. TSMS_DECLARE_TPDU_MESSAGE;
  37. tsms_address_t* smsc;
  38. /** TP Reject Duplicates (M - 1b)
  39. * Parameter indicating whether or not the SC shall accept an SMS SUBMIT for an
  40. * SM still held in the SC which has the same TP MR and the same TP DA as a
  41. * previously submitted SM from the same OA. */
  42. unsigned rd:1;
  43. /** TP Validity Period Format (M - 2b)
  44. * Parameter indicating whether or not the TP VP field is present. */
  45. tsms_tpdu_vpf_t vpf;
  46. /** TP Reply Path (M - 1b)
  47. * Parameter indicating the request for Reply Path. */
  48. unsigned rp:1;
  49. /** TP User Data Header Indicator (O - 1b)
  50. * Parameter indicating that the TP UD field contains a Header. */
  51. unsigned udhi:1;
  52. /** TP Status Report Request (O - 1b)
  53. * Parameter indicating if the MS is requesting a status report. */
  54. unsigned srr:1;
  55. /** TP Message Reference (M - I)
  56. * Parameter identifying the SMS SUBMIT. */
  57. uint8_t mr;
  58. /** TP Destination Address (M - 2-12o)
  59. * Address of the destination SME. */
  60. tsms_address_t* da;
  61. /** TP Protocol Identifier (M - o)
  62. * Parameter identifying the above layer protocol, if any. */
  63. //(base)uint8_t pid;
  64. /** TP Data Coding Scheme (M - o)
  65. * Parameter identifying the coding scheme within the TP User Data. */
  66. //(base)uint8_t dcs;
  67. /** TP Validity Period (O - o/7o)
  68. * Parameter identifying the time from where the message is no longer valid. */
  69. uint8_t vp[7];
  70. /** TP User Data Length (M - I)
  71. * Parameter indicating the length of the TP User Data field to follow. */
  72. //(base)uint8_t udl;
  73. /** TP User Data (O - v)
  74. * User data. */
  75. //(base)tsk_buffer_t* ud;
  76. }
  77. tsms_tpdu_submit_t;
  78. /** cast any pointer to tsms_tpdu_submit_t* */
  79. #define TSMS_TPDU_SUBMIT(self) ((tsms_tpdu_submit_t*)(self))
  80. TINYSMS_API tsms_tpdu_submit_t* tsms_tpdu_submit_create(uint8_t mr, const tsms_address_string_t smsc, const tsms_address_string_t dest);
  81. /**@ingroup tsms_tpdu_group
  82. * @def tsms_tpdu_submit_serialize
  83. * Serializes a @a SMS-SUBMIT message as binary content.
  84. * @param self A pointer to the @a SMS-SUBMIT (@ref tsms_tpdu_submit_t) message to serialize.
  85. * @param output A pointer to the output buffer. Should be valid.
  86. * @retval Zero if succeed and non-zero error code otherwise.
  87. *
  88. * See For more information, see @ref tsms_tpdu_group_SUBMIT "SMS-SUBMIT".
  89. */
  90. /**@ingroup tsms_tpdu_group
  91. * @def tsms_tpdu_submit_tohexastring
  92. * Serializes a @a SMS-SUBMIT message as hexa-string content.
  93. * @param self A pointer to the @a SMS-SUBMIT (@ref tsms_tpdu_submit_t) message to serialize.
  94. * @retval A pointer to the hexa-string if succeed and Null otherwise.
  95. *
  96. * See For more information, see @ref tsms_tpdu_group_SUBMIT "SMS-SUBMIT".
  97. */
  98. /**@ingroup tsms_tpdu_group
  99. * @def tsms_tpdu_submit_set_userdata
  100. * Sets the content of the @a SMS-SUBMIT message.
  101. * @param self A pointer to the @a SMS-SUBMIT (@ref tsms_tpdu_submit_t).
  102. * @param udata A pointer to the content.
  103. * @param alpha The alphabet used to encode the content.
  104. * @retval Zero if succeed and non-zero error code otherwise.
  105. *
  106. * See For more information, see @ref tsms_tpdu_group_SUBMIT "SMS-SUBMIT".
  107. */
  108. #define tsms_tpdu_submit_serialize(self, output) tsms_tpdu_message_serialize(TSMS_TPDU_MESSAGE(self), output, tsk_true)
  109. #define tsms_tpdu_submit_tostring(self) tsms_tpdu_message_tostring(TSMS_TPDU_MESSAGE(self), tsk_true)
  110. #define tsms_tpdu_submit_tohexastring(self) tsms_tpdu_message_tohexastring(TSMS_TPDU_MESSAGE(self), tsk_true)
  111. #define tsms_tpdu_submit_set_userdata(self, udata, alpha) tsms_tpdu_message_set_userdata(TSMS_TPDU_MESSAGE(self), udata, alpha)
  112. TINYSMS_GEXTERN const tsk_object_def_t *tsms_tpdu_submit_def_t;
  113. TSMS_END_DECLS
  114. #endif /* TINYSMS_TSMS_TPDU_SUBMIT_H */