summaryrefslogtreecommitdiffstats
path: root/tinySIGCOMP/src/tcomp_dicts.c
diff options
context:
space:
mode:
Diffstat (limited to 'tinySIGCOMP/src/tcomp_dicts.c')
-rw-r--r--tinySIGCOMP/src/tcomp_dicts.c100
1 files changed, 100 insertions, 0 deletions
diff --git a/tinySIGCOMP/src/tcomp_dicts.c b/tinySIGCOMP/src/tcomp_dicts.c
new file mode 100644
index 0000000..ede9efe
--- /dev/null
+++ b/tinySIGCOMP/src/tcomp_dicts.c
@@ -0,0 +1,100 @@
+/*
+* Copyright (C) 2009-2010 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 tcomp_dicts.c
+ * @brief SigComp Dictionaries
+ *
+ * @author Mamadou Diop <diopmamadou(at)yahoo.fr>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#include "tcomp_dicts.h"
+#include "tcomp_buffer.h"
+
+#include "tcomp_rfc3485_dictionary_sip.h"
+#include "tcomp_rfc5112_dictionary_presence.h"
+
+#include "tsk_debug.h"
+
+/**Presence-Specific Static Dictionary for Signaling Compression as per RFC 5112.
+*/
+tcomp_dictionary_t* tcomp_dicts_create_presence_dict()
+{
+ static const char *pres_dict_data = RFC5112_DICTIONARY_PRESENCE_VALUE;
+ static tcomp_dictionary_t * pres_dict = tsk_null;
+
+ if(!pres_dict)
+ {
+ pres_dict = tcomp_state_create(
+ RFC5112_DICTIONARY_PRESENCE_VALUE_LENGTH,
+ RFC5112_DICTIONARY_PRESENCE_STATE_ADDRESS,
+ RFC5112_DICTIONARY_PRESENCE_STATE_INSTRUCTION,
+ RFC5112_DICTIONARY_PRESENCE_MINIMUM_ACCESS_LENGTH,
+ 65535);
+
+ if(pres_dict){
+ tcomp_buffer_referenceBuff(pres_dict->value, (uint8_t*)pres_dict_data, RFC5112_DICTIONARY_PRESENCE_VALUE_LENGTH);
+ tcomp_state_makeValid(pres_dict);
+ }
+ else{
+ TSK_DEBUG_ERROR("Failed to create Presence dictionary.");
+ }
+ }
+ else{
+ pres_dict = tsk_object_ref(pres_dict);
+ }
+
+ return pres_dict;
+}
+
+/**The Session Initiation Protocol (SIP) and Session Description Protocol (SDP) Static Dictionary for Signaling Compression as per RFC 3485.
+*/
+tcomp_dictionary_t* tcomp_dicts_create_sip_dict()
+{
+
+ static const char *sip_dict_data = RFC3485_DICTIONARY_SIP_VALUE;
+ static tcomp_dictionary_t *sip_dict = tsk_null;
+
+ if(!sip_dict){
+ sip_dict = tcomp_state_create(
+ RFC3485_DICTIONARY_SIP_VALUE_LENGTH,
+ RFC3485_DICTIONARY_SIP_STATE_ADDRESS,
+ RFC3485_DICTIONARY_SIP_STATE_INSTRUCTION,
+ RFC3485_DICTIONARY_SIP_MINIMUM_ACCESS_LENGTH,
+ 65535);
+
+ if(sip_dict){
+ tcomp_buffer_referenceBuff(sip_dict->value, (uint8_t*)sip_dict_data, RFC3485_DICTIONARY_SIP_VALUE_LENGTH);
+ tcomp_state_makeValid(sip_dict);
+ }
+ else{
+ TSK_DEBUG_ERROR("Failed to create SIP/SDP dictionary.");
+ }
+ }
+ else{
+ /* take ownership */
+ sip_dict = tsk_object_ref(sip_dict);
+ }
+
+ return sip_dict;
+}
+
OpenPOWER on IntegriCloud