summaryrefslogtreecommitdiffstats
path: root/tinySMS/include/tinysms/tpdu
diff options
context:
space:
mode:
Diffstat (limited to 'tinySMS/include/tinysms/tpdu')
-rw-r--r--tinySMS/include/tinysms/tpdu/tsms_tpdu_command.h134
-rw-r--r--tinySMS/include/tinysms/tpdu/tsms_tpdu_deliver.h126
-rw-r--r--tinySMS/include/tinysms/tpdu/tsms_tpdu_report.h119
-rw-r--r--tinySMS/include/tinysms/tpdu/tsms_tpdu_status_report.h187
-rw-r--r--tinySMS/include/tinysms/tpdu/tsms_tpdu_submit.h130
5 files changed, 696 insertions, 0 deletions
diff --git a/tinySMS/include/tinysms/tpdu/tsms_tpdu_command.h b/tinySMS/include/tinysms/tpdu/tsms_tpdu_command.h
new file mode 100644
index 0000000..c83c6b9
--- /dev/null
+++ b/tinySMS/include/tinysms/tpdu/tsms_tpdu_command.h
@@ -0,0 +1,134 @@
+/*
+* Copyright (C) 2009 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+
+/**@file tsms_tpdu_command.h
+ * @brief SMS TPDU SMS-COMMAND message as per 3GPP TS 23.040 section 9.2.2.4.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYSMS_TSMS_TPDU_COMMAND_H
+#define TINYSMS_TSMS_TPDU_COMMAND_H
+
+#include "tinysms_config.h"
+
+#include "tinysms/tsms_common.h"
+
+TSMS_BEGIN_DECLS
+
+/** TP-Command-Type (TP-CT) as per 3GPP TS 23.040 section 9.2.3.19.
+* An 8-bit field.
+*/
+typedef enum tsms_tpdu_cmd_e
+{
+ tsms_tpdu_cmd_rel = 0x00, /**< Enquiry relating to previously submitted short message. */
+ tsms_tpdu_cmd_cancel = 0x01, /**< Cancel Status Report Request relating to previously submitted short message. */
+ tsms_tpdu_cmd_delete = 0x02, /**< Delete previously submitted Short Message. */
+ tsms_tpdu_cmd_enable_status = 0x03, /**< Enable Status Report Request relating to previously submitted short message. */
+ /* 00000100..00011111 ==> Reserved */
+ /* 11100000..11111111 ==> Values specific for each SC */
+}
+tsms_tpdu_cmd_t;
+
+
+/** SMS TPDU SMS-COMMAND message as per 3GPP TS 23.040 section 9.2.2.4.
+*/
+typedef struct tsms_tpdu_command_s
+{
+ TSMS_DECLARE_TPDU_MESSAGE;
+
+ tsms_address_t* smsc;
+
+ /** TP-User-Data-Header-Indication (O - 1b)
+ * Parameter indicating that the TP-CD field contains a Header. */
+ unsigned udhi:1;
+ /** TP Status Report Request (O - 1b)
+ * Parameter indicating if the SMS Command is requesting a status report. */
+ unsigned srr:1;
+ /** TP Message Reference (M - I)
+ * Parameter identifying the SMS COMMAND. */
+ uint8_t mr;
+ /** TP Protocol Identifier (M - o)
+ * Parameter identifying the above layer protocol, if any. */
+ //(base)uint8_t pid;
+ /** TP Command Type (M - o)
+ * Parameter specifying which operation is to be performed on a SM.
+ * See section 9.2.3.19 */
+ tsms_tpdu_cmd_t ct;
+ /** TP Message Number (M - o)
+ * Parameter indicating which SM in the SC to operate on.
+ * See section 9.2.3.18 */
+ uint8_t mn;
+ /** TP Destination Address (M - 2-12o)
+ * Parameter indicating the Destination Address to which the TP Command refers. */
+ tsms_address_t* da;
+ /** TP Command Data Length (M - o)
+ * Parameter indicating the length of the TP-CD field in octets. */
+ //(base)uint8_t cdl;
+ /** TP Command Data (O - o)
+ * Parameter containing user data. */
+ //(base)uint8_t cd;
+}
+tsms_tpdu_command_t;
+
+/** cast any pointer to @ref tsms_tpdu_command_t* */
+#define TSMS_TPDU_COMMAND(self) ((tsms_tpdu_command_t*)(self))
+
+TINYSMS_API tsms_tpdu_command_t* tsms_tpdu_command_create(uint8_t mr, const tsms_address_string_t smsc, const tsms_address_string_t dest, uint8_t msg_num, tsms_tpdu_cmd_t cmd);
+
+/**@ingroup tsms_tpdu_group
+* @def tsms_tpdu_command_serialize
+* Serializes a @a SMS-COMMAND message as binary content.
+* @param self A pointer to the @a SMS-COMMAND (@ref tsms_tpdu_command_t) message to serialize.
+* @param output A pointer to the output buffer. Should be valid.
+* @retval Zero if succeed and non-zero error code otherwise.
+*
+* See For more information, see @ref tsms_tpdu_group_COMMAND "SMS-COMMAND".
+*/
+/**@ingroup tsms_tpdu_group
+* @def tsms_tpdu_command_tohexastring
+* Serializes a @a SMS-COMMAND message as hexa-string content.
+* @param self A pointer to the @a SMS-COMMAND (@ref tsms_tpdu_command_t) message to serialize.
+* @retval A pointer to the hexa-string if succeed and Null otherwise.
+*
+* See For more information, see @ref tsms_tpdu_group_COMMAND "SMS-COMMAND".
+*/
+/**@ingroup tsms_tpdu_group
+* @def tsms_tpdu_command_set_cmddata
+* Sets the content of the @a SMS-COMMAND message.
+* @param self A pointer to the @a SMS-COMMAND (@ref tsms_tpdu_command_t).
+* @param cdata A pointer to the content.
+* @retval Zero if succeed and non-zero error code otherwise.
+*
+* See For more information, see @ref tsms_tpdu_group_COMMAND "SMS-COMMAND".
+*/
+#define tsms_tpdu_command_serialize(self, output) tsms_tpdu_message_serialize(TSMS_TPDU_MESSAGE(self), output, tsk_true)
+#define tsms_tpdu_command_tostring(self) tsms_tpdu_message_tostring(TSMS_TPDU_MESSAGE(self), tsk_true)
+#define tsms_tpdu_command_tohexastring(self) tsms_tpdu_message_tohexastring(TSMS_TPDU_MESSAGE(self), tsk_true)
+#define tsms_tpdu_command_set_cmddata(self, cdata) tsms_tpdu_message_set_userdata(TSMS_TPDU_MESSAGE(self), cdata, tsms_alpha_8bit)
+
+TINYSMS_GEXTERN const tsk_object_def_t *tsms_tpdu_command_def_t;
+
+TSMS_END_DECLS
+
+#endif /* TINYSMS_TSMS_TPDU_COMMAND_H */
diff --git a/tinySMS/include/tinysms/tpdu/tsms_tpdu_deliver.h b/tinySMS/include/tinysms/tpdu/tsms_tpdu_deliver.h
new file mode 100644
index 0000000..2f49c52
--- /dev/null
+++ b/tinySMS/include/tinysms/tpdu/tsms_tpdu_deliver.h
@@ -0,0 +1,126 @@
+/*
+* Copyright (C) 2009 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+
+/**@file tsms_tpdu_deliver.h
+ * @brief SMS TPDU SMS-DELIVER message as per 3GPP TS 23.040 section 9.2.2.1.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYSMS_TSMS_TPDU_DELIVER_H
+#define TINYSMS_TSMS_TPDU_DELIVER_H
+
+#include "tinysms_config.h"
+
+#include "tinysms/tsms_common.h"
+
+
+TSMS_BEGIN_DECLS
+
+/** SMS TPDU SMS-DELIVER message as per 3GPP TS 23.040 section 9.2.2.1.
+*/
+typedef struct tsms_tpdu_deliver_s
+{
+ TSMS_DECLARE_TPDU_MESSAGE;
+
+ tsms_address_t* smsc;
+
+ /** TP More Messages to Send (M - 1b)
+ * Parameter indicating whether or not there are more messages to send. */
+ unsigned mms:1;
+ /** TP-Loop-Prevention (O - 1b)
+ * Parameter indicating that SMS applications should inhibit forwarding or automatic message generation that could cause infinite looping. */
+ unsigned lp:2;
+ /** TP Reply Path (M - 1b)
+ * Parameter indicating the request for Reply Path.
+ Section 9.2.3.28 */
+ unsigned rp:1;
+ /** TP User Data Header Indicator (O - 1b)
+ * Parameter indicating that the TP UD field contains a Header. */
+ unsigned udhi:1;
+ /** TP Status Report Indicator (O - 1b)
+ * Parameter indicating if the SME has requested a status report. */
+ unsigned sri:1;
+ /** TP Originating Address (M - 2-12o)
+ * Address of the originating SME. */
+ tsms_address_t* oa;
+ /** TP Protocol Identifier (M - o)
+ * Parameter identifying the above layer protocol, if any. */
+ //(base)uint8_t pid;
+ /** TP Data Coding Scheme (M - o)
+ * Parameter identifying the coding scheme within the TP-User-Data. */
+ //(base)uint8_t dcs;
+ /** TP Service Centre Time Stamp (M - 7o)
+ * Parameter identifying time when the SC received the message. */
+ uint8_t scts[7];
+ /** TP User Data Length (M - I)
+ * Parameter indicating the length of the TP User Data field to follow. */
+ //(base)uint8_t udl;
+ /** TP User Data (O - v)
+ * User data. */
+ //(base)tsk_buffer_t* ud;
+}
+tsms_tpdu_deliver_t;
+
+/** cast any pointer to @ref tsms_tpdu_deliver_t* */
+#define TSMS_TPDU_DELIVER(self) ((tsms_tpdu_deliver_t*)(self))
+
+TINYSMS_API tsms_tpdu_deliver_t* tsms_tpdu_deliver_create(const tsms_address_string_t smsc, const tsms_address_string_t orig);
+
+/**@ingroup tsms_tpdu_group
+* @def tsms_tpdu_deliver_serialize
+* Serializes a @a SMS-DELIVER message as binary content.
+* @param self A pointer to the @a SMS-DELIVER (@ref tsms_tpdu_deliver_t) message to serialize.
+* @param output A pointer to the output buffer. Should be valid.
+* @retval Zero if succeed and non-zero error code otherwise.
+*
+* See For more information, see @ref tsms_tpdu_group_DELIVER "SMS-DELIVER".
+*/
+/**@ingroup tsms_tpdu_group
+* @def tsms_tpdu_deliver_tohexastring
+* Serializes a @a SMS-DELIVER message as hexa-string content.
+* @param self A pointer to the @a SMS-DELIVER (@ref tsms_tpdu_deliver_t) message to serialize.
+* @retval A pointer to the hexa-string if succeed and Null otherwise.
+*
+* See For more information, see @ref tsms_tpdu_group_DELIVER "SMS-DELIVER".
+*/
+/**@ingroup tsms_tpdu_group
+* @def tsms_tpdu_deliver_set_userdata
+* Sets the content of the @a SMS-DELIVER message.
+* @param self A pointer to the @a SMS-DELIVER (@ref tsms_tpdu_deliver_t).
+* @param udata A pointer to the content.
+* @param alpha The alphabet used to encode the content.
+* @retval Zero if succeed and non-zero error code otherwise.
+*
+* See For more information, see @ref tsms_tpdu_group_DELIVER "SMS-DELIVER".
+*/
+#define tsms_tpdu_deliver_serialize(self, output) tsms_tpdu_message_serialize(TSMS_TPDU_MESSAGE(self), output, tsk_false)
+#define tsms_tpdu_deliver_tostring(self) tsms_tpdu_message_tostring(TSMS_TPDU_MESSAGE(self), tsk_false)
+#define tsms_tpdu_deliver_tohexastring(self) tsms_tpdu_message_tohexastring(TSMS_TPDU_MESSAGE(self), tsk_false)
+#define tsms_tpdu_deliver_set_userdata(self, udata, alpha) tsms_tpdu_message_set_userdata(TSMS_TPDU_MESSAGE(self), udata, alpha)
+
+TINYSMS_GEXTERN const tsk_object_def_t *tsms_tpdu_deliver_def_t;
+
+TSMS_END_DECLS
+
+#endif /* TINYSMS_TSMS_TPDU_DELIVER_H */
diff --git a/tinySMS/include/tinysms/tpdu/tsms_tpdu_report.h b/tinySMS/include/tinysms/tpdu/tsms_tpdu_report.h
new file mode 100644
index 0000000..e04e2d9
--- /dev/null
+++ b/tinySMS/include/tinysms/tpdu/tsms_tpdu_report.h
@@ -0,0 +1,119 @@
+/*
+* Copyright (C) 2009 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+
+/**@file tsms_tpdu_report.h
+ * @brief SMS TPDU SMS-DELIVER-REPORT and SMS-SUBMIT-REPORT message as per 3GPP TS 23.040 section 9.2.2.1a and 9.2.2.2a.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYSMS_TSMS_TPDU_REPORT_H
+#define TINYSMS_TSMS_TPDU_REPORT_H
+
+#include "tinysms_config.h"
+
+#include "tinysms/tsms_common.h"
+
+
+TSMS_BEGIN_DECLS
+
+/** SMS TPDU SMS-DELIVER-REPORT or SMS-SUBMIT-REPORT
+* message as per 3GPP TS 23.040 section 9.2.2.1a or 9.2.2.2a.
+*/
+typedef struct tsms_tpdu_report_s
+{
+ TSMS_DECLARE_TPDU_MESSAGE;
+
+ tsms_address_t* smsc;
+
+ /** Indicates whether the Report is for RP-ERROR or not (RP-ACK).*/
+ tsk_bool_t error;
+
+ /** TP-User-Data-Header-Indication (O - 1b)
+ * Parameter indicating that the TP-UD field contains a Header. */
+ unsigned udhi:1;
+ /** TP Failure Cause (M - I)
+ * Parameter indicating the reason for SMS DELIVER/SUBMIT failure.
+ See clause 9.2.3.22 */
+ uint8_t fcs;
+ /** TP Parameter Indicator (M - o)
+ * Parameter indicating the presence of any of the optional parameters which follow. */
+ uint8_t pi;
+ /** TP Service Centre Time Stamp (M - 7o)
+ * Parameter identifying the time when the SC received the SMS DELIVER/SUBMIT.
+ * See clause 9.2.3.11. */
+ uint8_t scts[7];
+ /** TP Protocol Identifier (O - o)
+ * See clause 9.2.3.9. */
+ //(base)uint8_t pid;
+ /** TP Data Coding Scheme (O - o)
+ * See clause 9.2.3.10. */
+ //(base)uint8_t dcs;
+ /** TP User Data Length (O- o)
+ * See clause 9.2.3.16. */
+ //(base)uint8_t udl;
+ /** TP User Data (O - v)
+ * User data. */
+ //(base)tsk_buffer_t* ud;
+}
+tsms_tpdu_report_t;
+
+/** cast any pointer to @ref tsms_tpdu_report_t* */
+#define TSMS_TPDU_REPORT(self) ((tsms_tpdu_report_t*)(self))
+
+TINYSMS_API tsms_tpdu_report_t* tsms_tpdu_report_create(const tsms_address_string_t smsc, tsk_bool_t submit, tsk_bool_t error);
+TINYSMS_API int tsms_tpdu_report_set_fcs(tsms_tpdu_report_t* self, uint8_t code);
+
+#define TSMS_TPDU_REPORT_IS_MO(self) (TSMS_TPDU_MESSAGE(self)->mti == tsms_tpdu_mti_deliver_report_mo)
+
+/**@ingroup tsms_tpdu_group
+* @def tsms_tpdu_report_serialize
+* Serializes a @a SMS-DELIVER-REPORT or @a SMS-SUBMIT-REPORT message as binary content.
+* @param self A pointer to the @a SMS-DELIVER-REPORT or @a SMS-SUBMIT-REPORT (@ref tsms_tpdu_report_t) message to serialize.
+* @param output A pointer to the output buffer. Should be valid.
+* @retval Zero if succeed and non-zero error code otherwise.
+*/
+/**@ingroup tsms_tpdu_group
+* @def tsms_tpdu_report_tohexastring
+* Serializes a @a SMS-DELIVER-REPORT or @a SMS-SUBMIT-REPORT message as hexa-string content.
+* @param self A pointer to the @a SMS-DELIVER-REPORT or @a SMS-SUBMIT-REPORTT (@ref tsms_tpdu_report_t) message to serialize.
+* @retval A pointer to the hexa-string if succeed and Null otherwise.
+*/
+/**@ingroup tsms_tpdu_group
+* @def tsms_tpdu_report_set_userdata
+* Sets the content of the @a SMS-DELIVER-REPORT or @a SMS-SUBMIT-REPORT message.
+* @param self A pointer to the @a SMS-DELIVER-REPORT or @a SMS-SUBMIT-REPORT (@ref tsms_tpdu_report_t).
+* @param udata A pointer to the content.
+* @param alpha The alphabet used to encode the content.
+* @retval Zero if succeed and non-zero error code otherwise.
+*/
+#define tsms_tpdu_report_serialize(self, output) tsms_tpdu_message_serialize(TSMS_TPDU_MESSAGE(self), output, TSMS_TPDU_REPORT_IS_MO(self))
+#define tsms_tpdu_report_tostring(self) tsms_tpdu_message_tostring(TSMS_TPDU_MESSAGE(self), TSMS_TPDU_REPORT_IS_MO(self))
+#define tsms_tpdu_report_tohexastring(self) tsms_tpdu_message_tohexastring(TSMS_TPDU_MESSAGE(self), TSMS_TPDU_REPORT_IS_MO(self))
+#define tsms_tpdu_report_set_userdata(self, udata, alpha) tsms_tpdu_message_set_userdata(TSMS_TPDU_MESSAGE(self), udata, alpha)
+
+TINYSMS_GEXTERN const tsk_object_def_t *tsms_tpdu_report_def_t;
+
+TSMS_END_DECLS
+
+#endif /* TINYSMS_TSMS_TPDU_REPORT_H */
diff --git a/tinySMS/include/tinysms/tpdu/tsms_tpdu_status_report.h b/tinySMS/include/tinysms/tpdu/tsms_tpdu_status_report.h
new file mode 100644
index 0000000..38935d6
--- /dev/null
+++ b/tinySMS/include/tinysms/tpdu/tsms_tpdu_status_report.h
@@ -0,0 +1,187 @@
+/*
+* Copyright (C) 2009 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+
+/**@file tsms_tpdu_status_report.h
+ * @brief SMS TPDU SMS-STATUS-REPORT message as per 3GPP TS 23.040 section 9.2.2.3.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYSMS_TSMS_TPDU_STATUS_REPORT_H
+#define TINYSMS_TSMS_TPDU_STATUS_REPORT_H
+
+#include "tinysms_config.h"
+
+#include "tinysms/tsms_common.h"
+
+
+TSMS_BEGIN_DECLS
+
+/** 3GPP TS 23.040 v910 section 9.2.3.15 (TP-ST).
+* Used in SMS-STATUS-REPORT message.
+*/
+typedef enum tsms_tpdu_status_type_e
+{
+ /*== Short message transaction completed ==*/
+ tsms_tpdu_status_received = 0x00, /**< Short message received by the SME. */
+ tsms_tpdu_status_forwarded = 0x01, /**< Short message forwarded by the SC to the SME but the SC is unable to confirm delivery. */
+ tsms_tpdu_status_replaced = 0x02, /**< Short message replaced by the SC. */
+ /* 0000011..0001111 Reserved */
+ /* 0010000..0011111 Values specific to each SC */
+
+ /*== Temporary error, SC still trying to transfer SM ==*/
+ tsms_tpdu_status_congestion = 0x20, /**< Congestion. */
+ tsms_tpdu_status_busy = 0x21, /**< ME busy. */
+ tsms_tpdu_status_no_response = 0x22, /**< No response from SME. */
+ tsms_tpdu_status_serv_rejected = 0x23, /**< Service rejected. */
+ tsms_tpdu_status_no_qos = 0x24, /**< Quality of service not available. */
+ tsms_tpdu_status_error_in_sme= 0x25, /**< Error in SME. */
+ /* 0100110..0101111 Reserved */
+ /* 0110000..0111111 Values specific to each SC */
+
+ /*== Permanent error, SC is not making any more transfer attempts ==*/
+ tsms_tpdu_status_remote_error = 0x40, /**< Remote procedure error. */
+ tsms_tpdu_status_incompatible_dest = 0x41, /**< Incompatible destination. */
+ tsms_tpdu_status_conn_rejected = 0x42, /**< Connection rejected by SME. */
+ tsms_tpdu_status_not_obtainable = 0x43, /**< Not obtainable. */
+ tsms_tpdu_status_no_qos_2 = 0x44, /**< Quality of service not available. */
+ tsms_tpdu_status_no_inter_avail = 0x45, /**< No interworking available. */
+ tsms_tpdu_status_vp_expired = 0x46, /**< SM Validity Period Expired. */
+ tsms_tpdu_status_deleted_by_orig = 0x47, /**< SM Deleted by originating SME. */
+ tsms_tpdu_status_deleted_by_admin = 0x48, /**< SM Deleted by SC Administration. */
+ 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). */
+ /* 1001010..1001111 Reserved */
+ /* 1010000..1011111 Values specific to each SC */
+
+ /*== Temporary error, SC is not making any more transfer attempts ==*/
+ tsms_tpdu_status_congestion_3 = 0x50, /**< Congestion. */
+ tsms_tpdu_status_busy_3 = 0x51, /**< SME busy. */
+ tsms_tpdu_status_no_response_3 = 0x52, /**< No response from SME. */
+ tsms_tpdu_status_serv_rejected_3 = 0x53, /**< Service rejected. */
+ tsms_tpdu_status_temp_no_qos_3 = 0x54, /**< Quality of service not available. */
+ tsms_tpdu_status_error_in_sme_3 = 0x55, /**< Error in SME. */
+ /* 1100110..1101001 Reserved */
+ /* 1101010..1101111 Reserved */
+ /* 1110000..1111111 Values specific to each SC */
+
+}
+tsms_tpdu_status_type_t;
+
+/** SMS TPDU SMS-STATUS-REPORT message as per 3GPP TS 23.040 section 9.2.2.3.
+*/
+typedef struct tsms_tpdu_status_report_s
+{
+ TSMS_DECLARE_TPDU_MESSAGE;
+
+ tsms_address_t* smsc;
+
+ /** TP User Data Header Indicator (O - 1b)
+ * Parameter indicating that the TP UD field contains a Header. */
+ unsigned udhi:1;
+ /** TP More Messages to Send (M - 1b)
+ * Parameter indicating whether or not there are more messages to send. */
+ unsigned mms:1;
+ /** TP-Loop-Prevention (O - 1b)
+ * Parameter indicating that SMS applications should inhibit forwarding or automatic message generation that could cause infinite looping.
+ Section 9.2.3.28 */
+ unsigned lp:1;
+ /** TP Status Report Qualifier (M - 1b)
+ * Parameter indicating whether the previously submitted TPDU was an SMS-SUBMIT or an SMS COMMAND. */
+ unsigned srq:1;
+ /** TP Message Reference (M - I)
+ * Parameter identifying the previously submitted SMS SUBMIT or SMS COMMAND.
+ * See section 9.2.3.26. */
+ unsigned mr;
+ /** TP Recipient Address (M - 2-12o)
+ * Address of the recipient of the previously submitted mobile originated short message. */
+ tsms_address_t* ra;
+ /** TP Service Centre Time Stamp (M - 7o)
+ * Parameter identifying time when the SC received the previously sent SMS SUBMIT. */
+ uint8_t scts[7];
+ /** TP Discharge Time (M 7o)
+ * Parameter identifying the time associated with a particular TP ST outcome. */
+ uint8_t dt[7];
+ /** TP Status (M - o)
+ * Parameter identifying the status of the previously sent mobile originated short message. */
+ tsms_tpdu_status_type_t st;
+ /** TP-Parameter-Indicator (O - o)
+ * Parameter indicating the presence of any of the optional parameters which follow. */
+ uint8_t pi;
+ /** TP Protocol Identifier (O - o)
+ * See clause 9.2.3.9. TP-PID of original SMS-SUBMIT. */
+ //(base)uint8_t pid;
+ /** TP Data Coding Scheme (O - o)
+ * See clause 9.2.3.10. */
+ //(base)uint8_t dcs;
+ /** TP User Data Length (O- o)
+ * See clause 9.2.3.16. */
+ //(base)uint8_t udl;
+ /** TP User Data (O - v)
+ * User data. See clause 9.2.3.24. */
+ //(base)uint8_t* ud;
+}
+tsms_tpdu_status_report_t;
+
+/** cast any pointer to @ref tsms_tpdu_status_report_t* */
+#define TSMS_TPDU_STATUS_REPORT(self) ((tsms_tpdu_status_report_t*)(self))
+
+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);
+
+/**@ingroup tsms_tpdu_group
+* @def tsms_tpdu_status_report_serialize
+* Serializes a @a SMS-STATUS-REPORT message as binary content.
+* @param self A pointer to the @a SMS-STATUS-REPORT (@ref tsms_tpdu_status_report_t) message to serialize.
+* @param output A pointer to the output buffer. Should be valid.
+* @retval Zero if succeed and non-zero error code otherwise.
+*
+* See For more information, see @ref tsms_tpdu_group_STATUS_REPORT "SMS-STATUS-REPORT".
+*/
+/**@ingroup tsms_tpdu_group
+* @def tsms_tpdu_status_report_tohexastring
+* Serializes a @a SMS-STATUS-REPORT message as hexa-string content.
+* @param self A pointer to the @a SMS-STATUS-REPORT (@ref tsms_tpdu_status_report_t) message to serialize.
+* @retval A pointer to the hexa-string if succeed and Null otherwise.
+*
+* See For more information, see @ref tsms_tpdu_group_STATUS_REPORT "SMS-STATUS-REPORT".
+*/
+/**@ingroup tsms_tpdu_group
+* @def tsms_tpdu_status_report_set_userdata
+* Sets the content of the @a SMS-STATUS-REPORT message.
+* @param self A pointer to the @a SMS-STATUS-REPORT (@ref tsms_tpdu_status_report_t).
+* @param udata A pointer to the content.
+* @param alpha The alphabet used to encode the content.
+* @retval Zero if succeed and non-zero error code otherwise.
+*
+* See For more information, see @ref tsms_tpdu_group_STATUS_REPORT "SMS-STATUS-REPORT".
+*/
+#define tsms_tpdu_status_report_serialize(self, output) tsms_tpdu_message_serialize(TSMS_TPDU_MESSAGE(self), output, tsk_false)
+#define tsms_tpdu_status_report_tostring(self) tsms_tpdu_message_tostring(TSMS_TPDU_MESSAGE(self), tsk_false)
+#define tsms_tpdu_status_report_tohexastring(self) tsms_tpdu_message_tohexastring(TSMS_TPDU_MESSAGE(self), tsk_false)
+#define tsms_tpdu_status_report_set_userdata(self, udata, alpha) tsms_tpdu_message_set_userdata(TSMS_TPDU_MESSAGE(self), udata, alpha)
+
+TINYSMS_GEXTERN const tsk_object_def_t *tsms_tpdu_status_report_def_t;
+
+TSMS_END_DECLS
+
+
+#endif /* TINYSMS_TSMS_TPDU_STATUS_REPORT_H */
diff --git a/tinySMS/include/tinysms/tpdu/tsms_tpdu_submit.h b/tinySMS/include/tinysms/tpdu/tsms_tpdu_submit.h
new file mode 100644
index 0000000..dae8313
--- /dev/null
+++ b/tinySMS/include/tinysms/tpdu/tsms_tpdu_submit.h
@@ -0,0 +1,130 @@
+/*
+* Copyright (C) 2009 Mamadou Diop.
+*
+* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
+*
+* This file is part of Open Source Doubango Framework.
+*
+* DOUBANGO is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* DOUBANGO is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with DOUBANGO.
+*
+*/
+
+/**@file tsms_tpdu_submit.h
+ * @brief SMS TPDU SMS-SUBMIT (MO) message as per 3GPP TS 23.040 section 9.2.2.2.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYSMS_TSMS_TPDU_SUBMIT_H
+#define TINYSMS_TSMS_TPDU_SUBMIT_H
+
+#include "tinysms_config.h"
+
+#include "tinysms/tsms_common.h"
+
+TSMS_BEGIN_DECLS
+
+
+/** SMS @a SMS-SUBMIT message as per 3GPP TS 23.040 section 9.2.2.2
+*/
+typedef struct tsms_tpdu_submit_s
+{
+ TSMS_DECLARE_TPDU_MESSAGE;
+
+ tsms_address_t* smsc;
+
+ /** TP Reject Duplicates (M - 1b)
+ * Parameter indicating whether or not the SC shall accept an SMS SUBMIT for an
+ * SM still held in the SC which has the same TP MR and the same TP DA as a
+ * previously submitted SM from the same OA. */
+ unsigned rd:1;
+ /** TP Validity Period Format (M - 2b)
+ * Parameter indicating whether or not the TP VP field is present. */
+ tsms_tpdu_vpf_t vpf;
+ /** TP Reply Path (M - 1b)
+ * Parameter indicating the request for Reply Path. */
+ unsigned rp:1;
+ /** TP User Data Header Indicator (O - 1b)
+ * Parameter indicating that the TP UD field contains a Header. */
+ unsigned udhi:1;
+ /** TP Status Report Request (O - 1b)
+ * Parameter indicating if the MS is requesting a status report. */
+ unsigned srr:1;
+ /** TP Message Reference (M - I)
+ * Parameter identifying the SMS SUBMIT. */
+ uint8_t mr;
+ /** TP Destination Address (M - 2-12o)
+ * Address of the destination SME. */
+ tsms_address_t* da;
+ /** TP Protocol Identifier (M - o)
+ * Parameter identifying the above layer protocol, if any. */
+ //(base)uint8_t pid;
+ /** TP Data Coding Scheme (M - o)
+ * Parameter identifying the coding scheme within the TP User Data. */
+ //(base)uint8_t dcs;
+ /** TP Validity Period (O - o/7o)
+ * Parameter identifying the time from where the message is no longer valid. */
+ uint8_t vp[7];
+ /** TP User Data Length (M - I)
+ * Parameter indicating the length of the TP User Data field to follow. */
+ //(base)uint8_t udl;
+ /** TP User Data (O - v)
+ * User data. */
+ //(base)tsk_buffer_t* ud;
+}
+tsms_tpdu_submit_t;
+
+/** cast any pointer to tsms_tpdu_submit_t* */
+#define TSMS_TPDU_SUBMIT(self) ((tsms_tpdu_submit_t*)(self))
+
+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);
+
+/**@ingroup tsms_tpdu_group
+* @def tsms_tpdu_submit_serialize
+* Serializes a @a SMS-SUBMIT message as binary content.
+* @param self A pointer to the @a SMS-SUBMIT (@ref tsms_tpdu_submit_t) message to serialize.
+* @param output A pointer to the output buffer. Should be valid.
+* @retval Zero if succeed and non-zero error code otherwise.
+*
+* See For more information, see @ref tsms_tpdu_group_SUBMIT "SMS-SUBMIT".
+*/
+/**@ingroup tsms_tpdu_group
+* @def tsms_tpdu_submit_tohexastring
+* Serializes a @a SMS-SUBMIT message as hexa-string content.
+* @param self A pointer to the @a SMS-SUBMIT (@ref tsms_tpdu_submit_t) message to serialize.
+* @retval A pointer to the hexa-string if succeed and Null otherwise.
+*
+* See For more information, see @ref tsms_tpdu_group_SUBMIT "SMS-SUBMIT".
+*/
+/**@ingroup tsms_tpdu_group
+* @def tsms_tpdu_submit_set_userdata
+* Sets the content of the @a SMS-SUBMIT message.
+* @param self A pointer to the @a SMS-SUBMIT (@ref tsms_tpdu_submit_t).
+* @param udata A pointer to the content.
+* @param alpha The alphabet used to encode the content.
+* @retval Zero if succeed and non-zero error code otherwise.
+*
+* See For more information, see @ref tsms_tpdu_group_SUBMIT "SMS-SUBMIT".
+*/
+#define tsms_tpdu_submit_serialize(self, output) tsms_tpdu_message_serialize(TSMS_TPDU_MESSAGE(self), output, tsk_true)
+#define tsms_tpdu_submit_tostring(self) tsms_tpdu_message_tostring(TSMS_TPDU_MESSAGE(self), tsk_true)
+#define tsms_tpdu_submit_tohexastring(self) tsms_tpdu_message_tohexastring(TSMS_TPDU_MESSAGE(self), tsk_true)
+#define tsms_tpdu_submit_set_userdata(self, udata, alpha) tsms_tpdu_message_set_userdata(TSMS_TPDU_MESSAGE(self), udata, alpha)
+
+TINYSMS_GEXTERN const tsk_object_def_t *tsms_tpdu_submit_def_t;
+
+TSMS_END_DECLS
+
+#endif /* TINYSMS_TSMS_TPDU_SUBMIT_H */
OpenPOWER on IntegriCloud