summaryrefslogtreecommitdiffstats
path: root/tinySMS/include
diff options
context:
space:
mode:
Diffstat (limited to 'tinySMS/include')
-rw-r--r--tinySMS/include/tinysms.h33
-rw-r--r--tinySMS/include/tinysms/rpdu/tsms_rpdu.h249
-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
-rw-r--r--tinySMS/include/tinysms/tsms.h40
-rw-r--r--tinySMS/include/tinysms/tsms_address.h127
-rw-r--r--tinySMS/include/tinysms/tsms_common.h209
-rw-r--r--tinySMS/include/tinysms/tsms_etsi_gsm_03_38.h168
-rw-r--r--tinySMS/include/tinysms/tsms_packing.h49
-rw-r--r--tinySMS/include/tinysms_config.h82
13 files changed, 1653 insertions, 0 deletions
diff --git a/tinySMS/include/tinysms.h b/tinySMS/include/tinysms.h
new file mode 100644
index 0000000..fa264e2
--- /dev/null
+++ b/tinySMS/include/tinysms.h
@@ -0,0 +1,33 @@
+/*
+* 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.
+*
+*/
+#include "tinysms/tsms_packing.h"
+
+// SM-RL
+#include "tinysms/rpdu/tsms_rpdu.h"
+
+// SM-TL
+#include "tinysms/tpdu/tsms_tpdu_submit.h"
+#include "tinysms/tpdu/tsms_tpdu_deliver.h"
+#include "tinysms/tpdu/tsms_tpdu_report.h"
+#include "tinysms/tpdu/tsms_tpdu_command.h"
+#include "tinysms/tpdu/tsms_tpdu_status_report.h"
+
diff --git a/tinySMS/include/tinysms/rpdu/tsms_rpdu.h b/tinySMS/include/tinysms/rpdu/tsms_rpdu.h
new file mode 100644
index 0000000..274ee9a
--- /dev/null
+++ b/tinySMS/include/tinysms/rpdu/tsms_rpdu.h
@@ -0,0 +1,249 @@
+/*
+* 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_rpdu.h
+ * @brief SMS RPDU encoder/decoder as per 3GPP TS 23.011.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYSMS_TSMS_RPDU_H
+#define TINYSMS_TSMS_RPDU_H
+
+#include "tinysms_config.h"
+
+#include "tinysms/tsms_common.h"
+
+TSMS_BEGIN_DECLS
+
+/** @a RP-DATA as per 3GPP TS 24.011 section 7.3.1. */
+typedef struct tsms_rpdu_data_s
+{
+ TSMS_DECLARE_RPDU_MESSAGE;
+
+ // section 8.2.5.1
+ tsms_address_t *oa;
+ //section 8.2.5.2
+ tsms_address_t *da;
+ // section 8.2.5.3
+ tsk_buffer_t* udata;
+}
+tsms_rpdu_data_t;
+
+/** cast any pointer to @ref tsms_rpdu_data_t* */
+#define TSMS_RPDU_DATA(self) ((tsms_rpdu_data_t*)(self))
+
+TINYSMS_API tsms_rpdu_data_t* tsms_rpdu_data_create(uint8_t mr, const tsms_address_string_t smsc, const tsms_tpdu_message_t* tpdu, tsk_bool_t MobOrig);
+
+/**@ingroup tsms_rpdu_group
+* @def tsms_rpdu_data_create_mo
+* Creates a Mobile Originated @a RP-DATA message.
+* @a RP-DATA messages are use to relay the TPDUs.
+* For more information, please refer to 3GPP TS 24.011 section 7.3.1.
+* @param mr @a RP-Message Reference as per 3GPP TS 24.011 section 8.2.3.
+* @param smsc The address of the SMSC. e.g. "+331253688".
+* @param tpdu A Pointer to the @a TP-Message to relay.
+* @retval Mobile Originated @a RP-DATA message.
+* @sa @ref tsms_rpdu_data_create_mt<br>@ref tsms_rpdu_data_create
+*
+* See For more information, see @ref tsms_rpdu_group_DATA "RP-DATA".
+*/
+/**@ingroup tsms_rpdu_group
+* @def tsms_rpdu_data_create_mt
+* Creates a Mobile Terminated @a RP-DATA message.
+* @a RP-DATA messages are use to relay the TPDUs.
+* For more information, please refer to 3GPP TS 24.011 section 7.3.1.
+* @param mr RP-Message Reference as per 3GPP TS 24.011 section 8.2.3.
+* @param smsc The address of the SMSC. e.g. "+331253688".
+* @param tpdu A Pointer to the @a TP-Message to relay.
+* @retval Mobile Terminated RP-DATA message.
+* @sa @ref tsms_rpdu_data_create_mo<br>@ref tsms_rpdu_data_create
+*
+* See For more information, see @ref tsms_rpdu_group_DATA "RP-DATA".
+*/
+/**@ingroup tsms_rpdu_group
+* @def tsms_rpdu_data_serialize
+* Serialize a @a RP-DATA message as binary content.
+* @param self A pointer to the @a RP-DATA message to serialize.
+* @param output A pointer to the @a output buffer.
+* @retval Zero if succeed and non-zero error code otherwise.
+*
+* @sa @ref tsms_rpdu_message_serialize
+*
+* See For more information, see @ref tsms_rpdu_group_DATA "RP-DATA".
+*/
+#define tsms_rpdu_data_create_mo(mr, smsc, tpdu) tsms_rpdu_data_create(mr, smsc, tpdu, tsk_true)
+#define tsms_rpdu_data_create_mt(mr, smsc, tpdu) tsms_rpdu_data_create(mr, smsc, tpdu, tsk_false)
+#define tsms_rpdu_data_serialize(self, output) tsms_rpdu_message_serialize(TSMS_RPDU_MESSAGE(self), output)
+
+// set tpdu
+
+TINYSMS_GEXTERN const tsk_object_def_t *tsms_rpdu_data_def_t;
+
+/** RP-SMMA as per 3GPP TS 24.011 section 7.3.2. */
+typedef struct tsms_rpdu_smma_s
+{
+ TSMS_DECLARE_RPDU_MESSAGE;
+}
+tsms_rpdu_smma_t;
+
+/** cast any pointer to @ref tsms_rpdu_smma_t* */
+#define TSMS_RPDU_SMMA(self) ((tsms_rpdu_smma_t*)(self))
+
+TINYSMS_API tsms_rpdu_smma_t* tsms_rpdu_smma_create(uint8_t mr);
+
+/**@ingroup tsms_rpdu_group
+* @def tsms_rpdu_smma_serialize
+* Serialize a @a RP-SMMA message as binary content.
+* @param self A pointer to the @a RP-SMMA message to serialize.
+* @param output A pointer to the @a output buffer.
+* @retval Zero if succeed and non-zero error code otherwise.
+*
+* @sa @ref tsms_rpdu_message_serialize
+*
+* See For more information, see @ref tsms_rpdu_group_SMMA "RP-SMMA".
+*/
+#define tsms_rpdu_smma_serialize(self, output) tsms_rpdu_message_serialize(TSMS_RPDU_MESSAGE(self), output)
+
+TINYSMS_GEXTERN const tsk_object_def_t *tsms_rpdu_smma_def_t;
+
+/** RP-ACK as per 3GPP TS 24.011 section 7.3.3. */
+typedef struct tsms_rpdu_ack_s
+{
+ TSMS_DECLARE_RPDU_MESSAGE;
+
+ // section 8.2.5.3
+ tsk_buffer_t* udata;
+}
+tsms_rpdu_ack_t;
+
+/** cast any pointer to @ref tsms_rpdu_ack_t* */
+#define TSMS_RPDU_ACK(self) ((tsms_rpdu_ack_t*)(self))
+
+TINYSMS_API tsms_rpdu_ack_t* tsms_rpdu_ack_create(uint8_t mr, const tsms_tpdu_message_t* tpdu, tsk_bool_t MobOrig);
+
+/**@ingroup tsms_rpdu_group
+* @def tsms_rpdu_ack_create_mo
+* Creates a Mobile Originated @a RP-ACK message.
+* @a RP-ACK is sent between the MSC and the mobile station in both directions and used to relay the acknowledgement of a RP-DATA or RP-SMMA message reception.
+* For more information, please refer to 3GPP TS 24.011 section 7.3.2.3
+* @param mr @a RP-Message Reference as per 3GPP TS 24.011 section 8.2.3.
+* @param tpdu A Pointer to the @a TP-Message to include as RP-User data.
+* @retval Mobile Originated @a RP-ACK message.
+* @sa @ref tsms_rpdu_ack_create_mt<br>@ref tsms_rpdu_ack_create
+*
+* See For more information, see @ref tsms_rpdu_group_ACK "RP-ACK".
+*/
+/**@ingroup tsms_rpdu_group
+* @def tsms_rpdu_ack_create_mt
+* Creates a Mobile Terminated @a RP-ACK message.
+* @a RP-ACK is sent between the MSC and the mobile station in both directions and used to relay the acknowledgement of a RP-DATA or RP-SMMA message reception.
+* For more information, please refer to 3GPP TS 24.011 section 7.3.2.3
+* @param mr @a RP-Message Reference as per 3GPP TS 24.011 section 8.2.3.
+* @param tpdu A Pointer to the @a TP-Message to include as RP-User data.
+* @retval Mobile Terminated @a RP-ACK message.
+* @sa @ref tsms_rpdu_ack_create_mo<br>@ref tsms_rpdu_ack_create
+*
+* See For more information, see @ref tsms_rpdu_group_ACK "RP-ACK".
+*/
+/**@ingroup tsms_rpdu_group
+* @def tsms_rpdu_ack_serialize
+* Serialize a @a RP-ACK message as binary content.
+* @param self A pointer to the @a RP-ACK message to serialize.
+* @param output A pointer to the @a output buffer.
+* @retval Zero if succeed and non-zero error code otherwise.
+*
+* @sa @ref tsms_rpdu_message_serialize
+*
+* See For more information, see @ref tsms_rpdu_group_ACK "RP-ACK".
+*/
+#define tsms_rpdu_ack_create_mo(mr, tpdu) tsms_rpdu_ack_create(mr, tpdu, tsk_true)
+#define tsms_rpdu_ack_create_mt(mr, tpdu) tsms_rpdu_ack_create(mr, tpdu, tsk_false)
+#define tsms_rpdu_ack_serialize(self, output) tsms_rpdu_message_serialize(TSMS_RPDU_MESSAGE(self), output)
+
+TINYSMS_GEXTERN const tsk_object_def_t *tsms_rpdu_ack_def_t;
+
+/** RP-ERROR as per 3GPP TS 24.011 section 7.3.4. */
+typedef struct tsms_rpdu_error_s
+{
+ TSMS_DECLARE_RPDU_MESSAGE;
+
+ // section 8.2.5.4
+ uint8_t cause [3]; //2-3o
+ // section 8.2.5.3
+ tsk_buffer_t* udata;
+}
+tsms_rpdu_error_t;
+
+/** cast any pointer to @ref tsms_rpdu_error_t* */
+#define TSMS_RPDU_ERROR(self) ((tsms_rpdu_error_t*)(self))
+
+TINYSMS_API tsms_rpdu_error_t* tsms_rpdu_error_create(uint8_t mr, const tsms_tpdu_message_t* tpdu, uint8_t cause, tsk_bool_t MobOrig);
+
+/**@ingroup tsms_rpdu_group
+* @def tsms_rpdu_error_create_mo
+* Creates a Mobile Originated @a RP-ERROR message.
+* @a RP-ERROR is sent between the MSC and the mobile station in both directions and used to relay an error cause from an erroneous short message or notification transfer attempt.
+* For more information, please refer to 3GPP TS 24.011 section 7.3.2.4.
+* @param mr @a RP-Message Reference as per 3GPP TS 24.011 section 8.2.3.
+* @param tpdu A Pointer to the @a TP-Message to include as RP-User data.
+* @param cause RP-Cause value as per 3GPP TS 24.011 section 8.2.5.4.
+* @retval Mobile Originated @a RP-ERROR message.
+* @sa @ref tsms_rpdu_error_create_mt<br>@ref tsms_rpdu_error_create
+*
+* See For more information, see @ref tsms_rpdu_group_ERROR "RP-ERROR".
+*/
+/**@ingroup tsms_rpdu_group
+* @def tsms_rpdu_error_create_mt
+* Creates a Mobile Terminated @a RP-ERROR message.
+* @a RP-ERROR is sent between the MSC and the mobile station in both directions and used to relay an error cause from an erroneous short message or notification transfer attempt.
+* For more information, please refer to 3GPP TS 24.011 section 7.3.2.4.
+* @param mr @a RP-Message Reference as per 3GPP TS 24.011 section 8.2.3.
+* @param tpdu A Pointer to the @a TP-Message to include as RP-User data.
+* @param cause RP-Cause value as per 3GPP TS 24.011 section 8.2.5.4.
+* @retval Mobile Terminated @a RP-ERROR message.
+* @sa @ref tsms_rpdu_error_create_mo<br>@ref tsms_rpdu_error_create
+*
+* See For more information, see @ref tsms_rpdu_group_ERROR "RP-ERROR".
+*/
+/**@ingroup tsms_rpdu_group
+* @def tsms_rpdu_error_serialize
+* Serialize a @a RP-ERROR message as binary content.
+* @param self A pointer to the @a RP-ERROR message to serialize.
+* @param output A pointer to the @a output buffer.
+* @retval Zero if succeed and non-zero error code otherwise.
+*
+* @sa @ref tsms_rpdu_message_serialize
+*
+* See For more information, see @ref tsms_rpdu_group_ERROR "RP-ERROR".
+*/
+#define tsms_rpdu_error_create_mo(mr, tpdu, cause) tsms_rpdu_error_create(mr, tpdu, cause, tsk_true)
+#define tsms_rpdu_error_create_mt(mr, tpdu, cause) tsms_rpdu_error_create(mr, tpdu, cause, tsk_false)
+#define tsms_rpdu_error_serialize(self, output) tsms_rpdu_message_serialize(TSMS_RPDU_MESSAGE(self), output)
+
+TINYSMS_GEXTERN const tsk_object_def_t *tsms_rpdu_error_def_t;
+
+
+TSMS_END_DECLS
+
+#endif /* TINYSMS_TSMS_RPDU_H */
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 */
diff --git a/tinySMS/include/tinysms/tsms.h b/tinySMS/include/tinysms/tsms.h
new file mode 100644
index 0000000..037715b
--- /dev/null
+++ b/tinySMS/include/tinysms/tsms.h
@@ -0,0 +1,40 @@
+/*
+* 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.h
+ * @brief SMS over IP Networks.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYSMS_TSMS_H
+#define TINYSMS_TSMS_H
+
+#include "tinysms_config.h"
+
+TSMS_BEGIN_DECLS
+
+
+TSMS_END_DECLS
+
+#endif /* TINYSMS_TSMS_H */
diff --git a/tinySMS/include/tinysms/tsms_address.h b/tinySMS/include/tinysms/tsms_address.h
new file mode 100644
index 0000000..1e1d77b
--- /dev/null
+++ b/tinySMS/include/tinysms/tsms_address.h
@@ -0,0 +1,127 @@
+/*
+* 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_address.h
+ * @brief SMS address encoder/decoder.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYSMS_TSMS_ADDRESS_H
+#define TINYSMS_TSMS_ADDRESS_H
+
+#include "tinysms_config.h"
+
+#include "tsk_buffer.h"
+
+TSMS_BEGIN_DECLS
+
+typedef uint8_t tsms_address_string_t[13]; /* 12 + (+) */
+
+/** Address type
+*/
+typedef enum tsms_address_type_e
+{
+ tsms_addr_oa,
+ tsms_addr_da,
+ tsms_addr_smsc,
+}
+tsms_address_type_t;
+
+/** Type-of-number
+* 3GPP TS 23.040 v910 section 9.1.2.5.
+*/
+typedef enum tsms_address_ton_e
+{
+ /** "Unknown" is used when the user or network has no a priori information about the numbering plan. In
+ this case, the Address-Value field is organized according to the network dialling plan, e.g. prefix or
+ escape digits might be present.*/
+ tsms_addr_ton_unknown = 0x00, // 0b000
+ /** International number
+ The international format shall be accepted also when the message is destined to a recipient in the
+ same country as the MSC. */
+ tsms_addr_ton_international = 0x01, // 0b001
+ /** National number
+ Prefix or escape digits shall not be included */
+ tsms_addr_ton_national = 0x02, // 0b010
+ /** "Network specific number" is used to indicate administration/service number specific to the serving
+ network, e.g. used to access an operator. */
+ tsms_addr_ton_network_specific = 0x03, // 0b011
+ /** "Subscriber number" is used when a specific short number representation is stored in one or more
+ SCs as part of a higher layer application. (Note that "Subscriber number" shall only be used in
+ connection with the proper PID referring to this application). */
+ tsms_addr_ton_subscriber = 0x04, // 0b100
+ /** Alphanumeric, (coded according to GSM TS 03.38 7-bit default alphabet) */
+ tsms_addr_ton_alphanumeric = 0x05, // 0b101
+ /** Abbreviated number */
+ tsms_addr_ton_abbreviated = 0x06, // 0b110
+ /** Reserved for extension */
+ tsms_addr_ton_reserved = 0x07, // 0b111
+}
+tsms_address_ton_t;
+
+/** Numbering-Plan-Identification
+* 3GPP TS 23.040 v910 section 9.1.2.5.
+*/
+typedef enum tsms_address_npi_e
+{
+ /* 0000 */ tsms_addr_npi_unknown = 0x00, /**< Unknown */
+ /* 0001 */ tsms_addr_npi_isdn = 0x01, /**< ISDN/telephone numbering plan (E.164/E.163) */
+ /* 0011 */ tsms_addr_npi_x121 = 0x03, /**< Data numbering plan (X.121) */
+ /* 0100 */ tsms_addr_npi_telex = 0x04, /**< Telex numbering plan */
+ /* 1000 */ tsms_addr_npi_national = 0x08, /**< National numbering plan */
+ /* 1001 */ tsms_addr_npi_private = 0x09, /**< Private numbering plan */
+ /* 1010 */ tsms_addr_npi_ermes = 0x0A, /**< ERMES numbering plan (ETSI DE/PS 3 01-3) */
+ /* 1111 */ tsms_addr_npi_reserved = 0x0F, /**< Reserved for extension */
+}
+tsms_address_npi_t;
+
+/** Address
+*/
+typedef struct tsms_address_s
+{
+ TSK_DECLARE_OBJECT;
+
+ // Address Type
+ tsms_address_ton_t ton; /**< Type-of-number */
+ tsms_address_npi_t npi; /**< Numbering-Plan-Identification */
+
+ tsms_address_type_t type;
+ char* digits; /* BCD digits */
+}
+tsms_address_t;
+
+int tsms_address_serialize(const tsms_address_t* address, tsk_buffer_t* output);
+tsms_address_t* tsms_address_deserialize(const void* data, tsk_size_t size, tsms_address_type_t xtype, tsk_size_t *length);
+
+
+tsms_address_t* tsms_address_create(const tsms_address_string_t digits, tsms_address_type_t type);
+tsms_address_t* tsms_address_oa_create(const tsms_address_string_t digits);
+tsms_address_t* tsms_address_da_create(const tsms_address_string_t digits);
+tsms_address_t* tsms_address_smsc_create(const tsms_address_string_t digits);
+
+TINYSMS_GEXTERN const tsk_object_def_t *tsms_address_def_t;
+
+TSMS_END_DECLS
+
+#endif /* TSMS_BEGIN_DECLS */
diff --git a/tinySMS/include/tinysms/tsms_common.h b/tinySMS/include/tinysms/tsms_common.h
new file mode 100644
index 0000000..6a3ac8c
--- /dev/null
+++ b/tinySMS/include/tinysms/tsms_common.h
@@ -0,0 +1,209 @@
+/*
+* 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_common.h
+ * @brief SMS Commons (3GPP TS 23.038 and al.).
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYSMS_TSMS_COMMON_H
+#define TINYSMS_TSMS_COMMON_H
+
+#include "tinysms_config.h"
+
+#include "tinysms/tsms_address.h"
+
+#include "tsk_buffer.h"
+
+TSMS_BEGIN_DECLS
+
+/** SMS alphabet values as per 3GPP TS 23.038 v911 section 4.
+* Part of TP-DCS (SMS Data Coding Scheme).
+*/
+typedef enum tsms_alphabet_e
+{
+ /*11*/ tsms_alpha_reserved = 0x03,
+ /*00*/ tsms_alpha_7bit = 0x00,
+ /*01*/ tsms_alpha_8bit = 0x01,
+ /*10*/ tsms_alpha_ucs2 = 0x02
+}
+tsms_alphabet_t;
+
+/* 3GPP TS 23.038 v911 section 4 */
+#define TSMS_ALPHA_FROM_DCS(dcs) (((dcs) & 0x0C) >> 2) /* Bit3 and Bit2 */
+
+
+/* ======================== TPDU ========================
+=========================================================*/
+
+/** 3GPP TS 23.040 - 9.2.3.1 TP Message Type Indicator (TP MTI) */
+typedef enum tsms_tpdu_mti_e
+{
+ /*0 0*/ tsms_tpdu_mti_deliver_mt = 0x00, /**< SMS-DELIVER (in the direction SC to MS)*/
+ /*0 0*/ tsms_tpdu_mti_deliver_report_mo = 0x00, /**< SMS-DELIVER-REPORT (in the direction MS to SC)*/
+ /*1 0*/ tsms_tpdu_mti_status_report_mt = 0x02, /**< SMS-STATUS-REPORT (in the direction SC to MS)*/
+ /*1 0*/ tsms_tpdu_mti_command_mo = 0x02, /**< SMS-COMMAND (in the direction MS to SC)*/
+ /*0 1*/ tsms_tpdu_mti_submit_mo = 0x01, /**< SMS-SUBMIT (in the direction MS to SC)*/
+ /*0 1*/ tsms_tpdu_mti_submit_report_mt = 0x01, /**< SMS-SUBMIT-REPORT (in the direction SC to MS)*/
+ /*1 1*/ tsms_tpdu_mti_reserved = 0x03 /**< Reserved*/
+}
+tsms_tpdu_mti_t;
+
+#define TSMS_TPDU_MTI_IS_RESERVED(mti) ((mti) == tsms_tpdu_mti_reserved)
+#define TSMS_TPDU_MTI_IS_MO(mti) (((mti) == tsms_tpdu_mti_deliver_report_mo) || ((mti) == tsms_tpdu_mti_command_mo) || ((mti) == tsms_tpdu_mti_submit_mo))
+
+/** 3GPP TS 23.040 - 9.2.3.1 TP Message Type Indicator (TP MTI) */
+typedef enum tsms_tpdu_vpf_e
+{
+ // Bit4 and Bit3
+ /*0 0*/ tsms_tpdu_vpf_not_present = 0x00, /**< TP VP field not present */
+ /*1 0*/ tsms_tpdu_vpf_relative = 0x02, /**< TP VP field present - relative format*/
+ /*0 1*/ tsms_tpdu_vpf_enhanced = 0x01, /**< TP-VP field present - enhanced format */
+ /*1 1*/ tsms_tpdu_vpf_absolute = 0x03, /**< TP VP field present - absolute format */
+}
+tsms_tpdu_vpf_t;
+
+/** SM-TL base type as per 3GPP TS 23.040 section 9.2.
+*/
+typedef struct tsms_tpdu_message_s
+{
+ TSK_DECLARE_OBJECT;
+
+ tsk_bool_t MobOrig;
+
+ /** TP Message Type Indicator (TP MTI) as per TS 23.040 section 9.2.3.1. 2-bit field. */
+ tsms_tpdu_mti_t mti;
+ /** TP Protocol Identifier (M - o)
+ * Parameter identifying the above layer protocol, if any. */
+ uint8_t pid;
+ /** TP Data Coding Scheme (M - o)
+ * Parameter identifying the coding scheme within the TP-User-Data. */
+ uint8_t dcs;
+ /** TP User Data Length (M - I)
+ * Parameter indicating the length of the TP User Data field to follow. */
+ uint8_t udl;
+ /** TP User Data (O - v)
+ * User data. */
+ tsk_buffer_t* ud;
+}
+tsms_tpdu_message_t;
+
+#define TSMS_DECLARE_TPDU_MESSAGE tsms_tpdu_message_t tpdu
+#define TSMS_TPDU_MESSAGE(self) ((tsms_tpdu_message_t*)(self))
+
+/**@ingroup tsms_tpdu_group
+* @def tsms_tpdu_message_serialize_mo
+* Serialize an outgoing (MS to SC) @a TP-Message as binary content.
+* @param self The @a TP-Message (any SMS-*) to serialize.
+* @param output A pointer to the @a output buffer.
+* @retval Zero if succeed and non-zero error code otherwise.
+*/
+/**@ingroup tsms_tpdu_group
+* @def tsms_tpdu_message_serialize_mt
+* Serialize an incoming (SC to MS) @a TP-Message as binary content.
+* @param self The @a TP-Message (SMS-SUBMIT, SMS-DELIVER, SMS-COMMAND ...) to serialize.
+* @param output A pointer to the @a output buffer.
+* @retval Zero if succeed and non-zero error code otherwise.
+*/
+/**@ingroup tsms_tpdu_group
+* @def tsms_tpdu_message_deserialize_mo
+* Deserialize the outgoing (MO to SC) binary content as a @a TP-Message.
+* @param data A pointer to the binary data.
+* @param size The size of the buffer holding the binary data.
+* @retval @ref tsms_tpdu_message_t if succeed and Null otherwise.
+*/
+/**@ingroup tsms_tpdu_group
+* @def tsms_tpdu_message_deserialize_mt
+* Deserialize the incoming (SC to MS) binary content as a @a TP-Message.
+* @param data A pointer to the binary data.
+* @param size The size of the buffer holding the binary data.
+* @retval @ref tsms_tpdu_message_t if succeed and Null otherwise.
+*/
+
+int tsms_tpdu_message_init(tsms_tpdu_message_t* self, tsms_tpdu_mti_t mti);
+TINYSMS_API int tsms_tpdu_message_serialize(const tsms_tpdu_message_t* self, tsk_buffer_t* output, tsk_bool_t MobOrig);
+#define tsms_tpdu_message_serialize_mo(self, output) tsms_tpdu_message_serialize(self, output, tsk_true)
+#define tsms_tpdu_message_serialize_mt(self, output) tsms_tpdu_message_serialize(self, output, tsk_false)
+TINYSMS_API tsms_tpdu_message_t* tsms_tpdu_message_deserialize(const void* data, tsk_size_t size, tsk_bool_t MobOrig);
+#define tsms_tpdu_message_deserialize_mo(data, size) tsms_tpdu_message_deserialize(data, size, tsk_true)
+#define tsms_tpdu_message_deserialize_mt(data, size) tsms_tpdu_message_deserialize(data, size, tsk_false)
+TINYSMS_API char* tsms_tpdu_message_tostring(const tsms_tpdu_message_t* self, tsk_bool_t MobOrig);
+TINYSMS_API char* tsms_tpdu_message_tohexastring(const tsms_tpdu_message_t* self, tsk_bool_t MobOrig);
+TINYSMS_API char* tsms_tpdu_message_get_payload(const tsms_tpdu_message_t* self);
+TINYSMS_API int tsms_tpdu_message_set_userdata(tsms_tpdu_message_t* self, const tsk_buffer_t* udata, tsms_alphabet_t alpha);
+int tsms_tpdu_message_deinit(tsms_tpdu_message_t* self);
+
+#define TSMS_TPDU_DEFAULT_PID 0x00 /**< 3GPP TS 23.040 section 9.2.3.9 - TP-Protocol-Identifier (TP-PID) */
+#define TSMS_TPDU_DEFAULT_DCS 0x00 /**< 3GPP TS 23.040 section 9.2.3.10 - TP-Data-Coding-Scheme (TP-DCS) (default class, 7 bit message) + GSM 03.38*/
+#define TSMS_TPDU_DEFAULT_VP 0xAA /**< 3GPP TS 23.040 section 9.2.3.12 - TP-Validity-Period */
+#define TSMS_TPDU_DEFAULT_VPF tsms_tpdu_vpf_relative /**< 3GPP TS 23.040 section 9.2.3.3 - TP Validity Period Format (TP VPF) */
+#define TSMS_TPDU_DEFAULT_FCS 0xFF /**< 3GPP TS 23.040 section 9.2.3.22 - TP-Failure-Cause (TP-FCS) */
+#define TSMS_TPDU_DEFAULT_PI 0x00 /**< 3GPP TS 23.040 section 9.2.3.27 - TP-Parameter-Indicator (TP-PI) */
+#define TSMS_TPDU_DEFAULT_SCTS "00000000000000" /**< 3GPP TS 23.040 section 9.2.3.11 - TP-Service-Centre-Time-Stamp (TP-SCTS) */
+#define TSMS_TPDU_DEFAULT_MMS 0x01 /**< 3GPP TS 23.040 section 9.2.3.2 - TP More Messages to Send (TP-MMS) */
+
+/**< Indicates whether to append SMSC address at the begining of the TPDU content.
+*/
+#define TSMS_TPDU_APPEND_SMSC 0
+
+/* ======================== RPDU ========================
+=========================================================*/
+
+/** RP-MTI types as per 3GPP TS 24.011 section 8.2.2
+* 3bit field located in the first octet of all RP-Messages. */
+typedef enum tsms_rpdu_type_e
+{
+ /*000*/ tsms_rpdu_type_data_mo = 0x00, /**< RP-DATA message ms->n */
+ /*001*/ tsms_rpdu_type_data_mt = 0x01, /**< RP-DATA message n->ms */
+ /*010*/ tsms_rpdu_type_ack_mo = 0x02, /**< RP-ACK message ms->n */
+ /*011*/ tsms_rpdu_type_ack_mt = 0x03, /**< RP-ACK message n->ms */
+ /*100*/ tsms_rpdu_type_error_mo = 0x04, /**< RP-ERROR message ms->n */
+ /*101*/ tsms_rpdu_type_error_mt = 0x05, /**< RP-ERROR message n->ms */
+ /*110*/ tsms_rpdu_type_smma_mo = 0x06, /**< RP-SMMA message ms->n */
+}
+tsms_rpdu_type_t;
+
+#define TSMS_RPDU_TYPE_IS_MO(type) (((type) == tsms_rpdu_type_data_mo) \
+ || ((type) == tsms_rpdu_type_ack_mo) \
+ || ((type) == tsms_rpdu_type_error_mo) \
+ || ((type) == tsms_rpdu_type_smma_mo))
+
+typedef struct tsms_rpdu_message_s
+{
+ TSK_DECLARE_OBJECT;
+
+ tsms_rpdu_type_t mti;
+ uint8_t mr; /**< Message Reference. */
+}
+tsms_rpdu_message_t;
+#define TSMS_DECLARE_RPDU_MESSAGE tsms_rpdu_message_t rpdu
+#define TSMS_RPDU_MESSAGE(self) ((tsms_rpdu_message_t*)(self))
+
+TINYSMS_API int tsms_rpdu_message_serialize(const tsms_rpdu_message_t* self, tsk_buffer_t* output);
+TINYSMS_API tsms_rpdu_message_t* tsms_rpdu_message_deserialize(const void* data, tsk_size_t size);
+TINYSMS_API char* tsms_rpdu_message_tohexastring(const tsms_rpdu_message_t* self);
+
+TSMS_END_DECLS
+
+#endif /* TINYSMS_TSMS_COMMON_H */
diff --git a/tinySMS/include/tinysms/tsms_etsi_gsm_03_38.h b/tinySMS/include/tinysms/tsms_etsi_gsm_03_38.h
new file mode 100644
index 0000000..57b408c
--- /dev/null
+++ b/tinySMS/include/tinysms/tsms_etsi_gsm_03_38.h
@@ -0,0 +1,168 @@
+/*
+* 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.h
+ * @brief GSM 7 bit Default Alphabet as per 3GPP TS 23.038 v911 section 6.2.1.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYSMS_TSMS_ETSI_GSM_03_38_H
+#define TINYSMS_TSMS_ETSI_GSM_03_38_H
+
+#include "tinysms_config.h"
+
+TSMS_BEGIN_DECLS
+
+#define TSMS_ETSI_GSM_03_38_COUNT 123
+static uint16_t TSMS_ETSI_GSM_03_38[TSMS_ETSI_GSM_03_38_COUNT][2] =
+{
+ 0x00, 0x0040 ,//# COMMERCIAL AT
+ 0x01, 0x00A3 ,//# POUND SIGN
+ 0x02, 0x0024 ,//# DOLLAR SIGN
+ 0x03, 0x00A5 ,//# YEN SIGN
+ 0x04, 0x00E8 ,//# LATIN SMALL LETTER E WITH GRAVE
+ 0x05, 0x00E9 ,//# LATIN SMALL LETTER E WITH ACUTE
+ 0x06, 0x00F9 ,//# LATIN SMALL LETTER U WITH GRAVE
+ 0x07, 0x00EC ,//# LATIN SMALL LETTER I WITH GRAVE
+ 0x08, 0x00F2 ,//# LATIN SMALL LETTER O WITH GRAVE
+ 0x09, 0x00E7 ,//# LATIN SMALL LETTER C WITH CEDILLA
+ 0x0B, 0x00D8 ,//# LATIN CAPITAL LETTER O WITH STROKE
+ 0x0C, 0x00F8 ,//# LATIN SMALL LETTER O WITH STROKE
+ 0x0E, 0x00C5 ,//# LATIN CAPITAL LETTER A WITH RING ABOVE
+ 0x0F, 0x00E5 ,//# LATIN SMALL LETTER A WITH RING ABOVE
+ 0x11, 0x005F ,//# LOW LINE
+ 0x1B14, 0x005E ,//# CIRCUMFLEX ACCENT
+ 0x1B28, 0x007B ,//# LEFT CURLY BRACKET
+ 0x1B29, 0x007D ,//# RIGHT CURLY BRACKET
+ 0x1B2F, 0x005C ,//# REVERSE SOLIDUS
+ 0x1B3C, 0x005B ,//# LEFT SQUARE BRACKET
+ 0x1B3D, 0x007E ,//# TILDE
+ 0x1B3E, 0x005D ,//# RIGHT SQUARE BRACKET
+ 0x1B40, 0x007C ,//# VERTICAL LINE
+ 0x1C, 0x00C6 ,//# LATIN CAPITAL LETTER AE
+ 0x1D, 0x00E6 ,//# LATIN SMALL LETTER AE
+ 0x1E, 0x00DF ,//# LATIN SMALL LETTER SHARP S (German)
+ 0x1F, 0x00C9 ,//# LATIN CAPITAL LETTER E WITH ACUTE
+ 0x20, 0x0020 ,//# SPACE
+ 0x21, 0x0021 ,//# EXCLAMATION MARK
+ 0x22, 0x0022 ,//# QUOTATION MARK
+ 0x23, 0x0023 ,//# NUMBER SIGN
+ 0x24, 0x00A4 ,//# CURRENCY SIGN
+ 0x25, 0x0025 ,//# PERCENT SIGN
+ 0x26, 0x0026 ,//# AMPERSAND
+ 0x27, 0x0027 ,//# APOSTROPHE
+ 0x28, 0x0028 ,//# LEFT PARENTHESIS
+ 0x29, 0x0029 ,//# RIGHT PARENTHESIS
+ 0x2A, 0x002A ,//# ASTERISK
+ 0x2B, 0x002B ,//# PLUS SIGN
+ 0x2C, 0x002C ,//# COMMA
+ 0x2D, 0x002D ,//# HYPHEN-MINUS
+ 0x2E, 0x002E ,//# FULL STOP
+ 0x2F, 0x002F ,//# SOLIDUS
+ 0x30, 0x0030 ,//# DIGIT ZERO
+ 0x31, 0x0031 ,//# DIGIT ONE
+ 0x32, 0x0032 ,//# DIGIT TWO
+ 0x33, 0x0033 ,//# DIGIT THREE
+ 0x34, 0x0034 ,//# DIGIT FOUR
+ 0x35, 0x0035 ,//# DIGIT FIVE
+ 0x36, 0x0036 ,//# DIGIT SIX
+ 0x37, 0x0037 ,//# DIGIT SEVEN
+ 0x38, 0x0038 ,//# DIGIT EIGHT
+ 0x39, 0x0039 ,//# DIGIT NINE
+ 0x3A, 0x003A ,//# COLON
+ 0x3B, 0x003B ,//# SEMICOLON
+ 0x3C, 0x003C ,//# LESS-THAN SIGN
+ 0x3D, 0x003D ,//# EQUALS SIGN
+ 0x3E, 0x003E ,//# GREATER-THAN SIGN
+ 0x3F, 0x003F ,//# QUESTION MARK
+ 0x40, 0x00A1 ,//# INVERTED EXCLAMATION MARK
+ 0x41, 0x0041 ,//# LATIN CAPITAL LETTER A
+ 0x42, 0x0042 ,//# LATIN CAPITAL LETTER B
+ //,//#0x42 0x0392 ,//# GREEK CAPITAL LETTER BETA
+ 0x43, 0x0043 ,//# LATIN CAPITAL LETTER C
+ 0x44, 0x0044 ,//# LATIN CAPITAL LETTER D
+ 0x45, 0x0045 ,//# LATIN CAPITAL LETTER E
+ 0x46, 0x0046 ,//# LATIN CAPITAL LETTER F
+ 0x47, 0x0047 ,//# LATIN CAPITAL LETTER G
+ 0x48, 0x0048 ,//# LATIN CAPITAL LETTER H
+ 0x49, 0x0049 ,//# LATIN CAPITAL LETTER I
+ 0x4A, 0x004A ,//# LATIN CAPITAL LETTER J
+ 0x4B, 0x004B ,//# LATIN CAPITAL LETTER K
+ 0x4C, 0x004C ,//# LATIN CAPITAL LETTER L
+ 0x4D, 0x004D ,//# LATIN CAPITAL LETTER M
+ 0x4E, 0x004E ,//# LATIN CAPITAL LETTER N
+ 0x4F, 0x004F ,//# LATIN CAPITAL LETTER O
+ 0x50, 0x0050 ,//# LATIN CAPITAL LETTER P
+ 0x51, 0x0051 ,//# LATIN CAPITAL LETTER Q
+ 0x52, 0x0052 ,//# LATIN CAPITAL LETTER R
+ 0x53, 0x0053 ,//# LATIN CAPITAL LETTER S
+ 0x54, 0x0054 ,//# LATIN CAPITAL LETTER T
+ 0x55, 0x0055 ,//# LATIN CAPITAL LETTER U
+ 0x56, 0x0056 ,//# LATIN CAPITAL LETTER V
+ 0x57, 0x0057 ,//# LATIN CAPITAL LETTER W
+ 0x58, 0x0058 ,//# LATIN CAPITAL LETTER X
+ 0x59, 0x0059 ,//# LATIN CAPITAL LETTER Y
+ 0x5A, 0x005A ,//# LATIN CAPITAL LETTER Z
+ 0x5B, 0x00C4 ,//# LATIN CAPITAL LETTER A WITH DIAERESIS
+ 0x5C, 0x00D6 ,//# LATIN CAPITAL LETTER O WITH DIAERESIS
+ 0x5D, 0x00D1 ,//# LATIN CAPITAL LETTER N WITH TILDE
+ 0x5E, 0x00DC ,//# LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x5F, 0x00A7 ,//# SECTION SIGN
+ 0x60, 0x00BF ,//# INVERTED QUESTION MARK
+ 0x61, 0x0061 ,//# LATIN SMALL LETTER A
+ 0x62, 0x0062 ,//# LATIN SMALL LETTER B
+ 0x63, 0x0063 ,//# LATIN SMALL LETTER C
+ 0x64, 0x0064 ,//# LATIN SMALL LETTER D
+ 0x65, 0x0065 ,//# LATIN SMALL LETTER E
+ 0x66, 0x0066 ,//# LATIN SMALL LETTER F
+ 0x67, 0x0067 ,//# LATIN SMALL LETTER G
+ 0x68, 0x0068 ,//# LATIN SMALL LETTER H
+ 0x69, 0x0069 ,//# LATIN SMALL LETTER I
+ 0x6A, 0x006A ,//# LATIN SMALL LETTER J
+ 0x6B, 0x006B ,//# LATIN SMALL LETTER K
+ 0x6C, 0x006C ,//# LATIN SMALL LETTER L
+ 0x6D, 0x006D ,//# LATIN SMALL LETTER M
+ 0x6E, 0x006E ,//# LATIN SMALL LETTER N
+ 0x6F, 0x006F ,//# LATIN SMALL LETTER O
+ 0x70, 0x0070 ,//# LATIN SMALL LETTER P
+ 0x71, 0x0071 ,//# LATIN SMALL LETTER Q
+ 0x72, 0x0072 ,//# LATIN SMALL LETTER R
+ 0x73, 0x0073 ,//# LATIN SMALL LETTER S
+ 0x74, 0x0074 ,//# LATIN SMALL LETTER T
+ 0x75, 0x0075 ,//# LATIN SMALL LETTER U
+ 0x76, 0x0076 ,//# LATIN SMALL LETTER V
+ 0x77, 0x0077 ,//# LATIN SMALL LETTER W
+ 0x78, 0x0078 ,//# LATIN SMALL LETTER X
+ 0x79, 0x0079 ,//# LATIN SMALL LETTER Y
+ 0x7A, 0x007A ,//# LATIN SMALL LETTER Z
+ 0x7B, 0x00E4 ,//# LATIN SMALL LETTER A WITH DIAERESIS
+ 0x7C, 0x00F6 ,//# LATIN SMALL LETTER O WITH DIAERESIS
+ 0x7D, 0x00F1 ,//# LATIN SMALL LETTER N WITH TILDE
+ 0x7E, 0x00FC ,//# LATIN SMALL LETTER U WITH DIAERESIS
+ 0x7F, 0x00E0 ,//# LATIN SMALL LETTER A WITH GRAVE
+};
+
+TSMS_END_DECLS
+
+#endif /* TINYSMS_TSMS_ETSI_GSM_03_38_H */
diff --git a/tinySMS/include/tinysms/tsms_packing.h b/tinySMS/include/tinysms/tsms_packing.h
new file mode 100644
index 0000000..d0649b9
--- /dev/null
+++ b/tinySMS/include/tinysms/tsms_packing.h
@@ -0,0 +1,49 @@
+/*
+* 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_packing.h
+ * @brief SMS Packing (3GPP TS 23.038 subclause 6.1.2).
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#ifndef TINYSMS_TSMS_PACKING_H
+#define TINYSMS_TSMS_PACKING_H
+
+#include "tinysms_config.h"
+
+#include "tsk_buffer.h"
+
+TSMS_BEGIN_DECLS
+
+TINYSMS_API tsk_buffer_t* tsms_pack_to_7bit(const char* ascii);
+TINYSMS_API tsk_buffer_t* tsms_pack_to_ucs2(const char* ascii);
+TINYSMS_API tsk_buffer_t* tsms_pack_to_8bit(const char* ascii);
+
+TINYSMS_API char* tsms_pack_from_7bit(const void* gsm7bit, tsk_size_t size);
+TINYSMS_API char* tsms_pack_from_ucs2(const void* ucs2, tsk_size_t size);
+TINYSMS_API char* tsms_pack_from_8bit(const void* gsm8bit, tsk_size_t size);
+
+TSMS_END_DECLS
+
+#endif /* TINYSMS_TSMS_PACKING_H */
diff --git a/tinySMS/include/tinysms_config.h b/tinySMS/include/tinysms_config.h
new file mode 100644
index 0000000..ba2c0a5
--- /dev/null
+++ b/tinySMS/include/tinysms_config.h
@@ -0,0 +1,82 @@
+/*
+* 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.
+*
+*/
+
+#ifndef TINYSMS_CONFIG_H
+#define TINYSMS_CONFIG_H
+
+#if HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#ifdef __SYMBIAN32__
+#undef _WIN32 /* Because of WINSCW */
+#endif
+
+/* Windows (XP/Vista/7/CE and Windows Mobile) macro definition.
+*/
+#if defined(WIN32)|| defined(_WIN32) || defined(_WIN32_WCE)
+# define TSMS_UNDER_WINDOWS 1
+#endif
+
+#if (TSMS_UNDER_WINDOWS || defined(__SYMBIAN32__)) && defined(TINYSMS_EXPORTS)
+# define TINYSMS_API __declspec(dllexport)
+# define TINYSMS_GEXTERN __declspec(dllexport)
+#elif (TSMS_UNDER_WINDOWS || defined(__SYMBIAN32__)) /*&& defined(TINYSMS_IMPORTS)*/
+# define TINYSMS_API __declspec(dllimport)
+# define TINYSMS_GEXTERN __declspec(dllimport)
+#else
+# define TINYSMS_API
+# define TINYSMS_GEXTERN extern
+#endif
+
+/* Guards against C++ name mangling
+*/
+#ifdef __cplusplus
+# define TSMS_BEGIN_DECLS extern "C" {
+# define TSMS_END_DECLS }
+#else
+# define TSMS_BEGIN_DECLS
+# define TSMS_END_DECLS
+#endif
+
+/* Disable some well-known warnings
+*/
+#ifdef _MSC_VER
+# define _CRT_SECURE_NO_WARNINGS
+#endif
+
+/* Detecting C99 compilers
+ */
+#if (__STDC_VERSION__ == 199901L) && !defined(__C99__)
+# define __C99__
+#endif
+
+#include <stdint.h>
+#ifdef __SYMBIAN32__
+#include <stdlib.h>
+#endif
+
+#if HAVE_CONFIG_H
+ #include "../config.h"
+#endif
+
+#endif // TINYSMS_CONFIG_H
OpenPOWER on IntegriCloud