1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
/*
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]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>
*
*/
#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);
TSK_DEBUG_INFO("SigComp - Presence dict State id=");
tcomp_buffer_print(pres_dict->identifier);
}
else{
TSK_DEBUG_ERROR("Failed to create Presence dictionary.");
}
}
return tsk_object_ref(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);
TSK_DEBUG_INFO("SigComp - SIP dict State id=");
tcomp_buffer_print(sip_dict->identifier);
}
else{
TSK_DEBUG_ERROR("Failed to create SIP/SDP dictionary.");
}
}
return tsk_object_ref(sip_dict);
}
|