diff options
Diffstat (limited to 'tinySIP/src/headers')
94 files changed, 26413 insertions, 0 deletions
diff --git a/tinySIP/src/headers/tsip_header.c b/tinySIP/src/headers/tsip_header.c new file mode 100644 index 0000000..4360281 --- /dev/null +++ b/tinySIP/src/headers/tsip_header.c @@ -0,0 +1,337 @@ +/* +* 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 tsip_header.c + * @brief Defines a SIP header (field-name: field-value). + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header.h" + +#include "tinysip/headers/tsip_header_Dummy.h" + + +#include "tsk_debug.h" + +/* Compact headers: http://www.cs.columbia.edu/sip/compact.html +Abbreviation Header defined by origin (mnemonic) +a Accept-Contact draft-ietf-sip-callerprefs -- +b Referred-By -refer- "by" +c Content-Type RFC 3261 +d Request-Disposition +e Content-Encoding RFC 3261 +f From RFC 3261 +i Call-ID RFC 3261 +j Reject-Contact +k Supported RFC 3261 "know" +l Content-Length RFC 3261 +m Contact RFC 3261 "moved" +n Identity-Info +o Event -event- "occurance" +r Refer-To -refer- +s Subject RFC 3261 +t To RFC 3261 +u Allow-Events -events- "understand" +v Via RFC 3261 +y Identity +*/ + +#if TSIP_COMPACT_HEADERS +# define _Accept_Contact "a" +# define _Referred_By "b" +# define _Content_Type "c" +# define _Request_Disposition "d" +# define _Content_Encoding "e" +# define _From "f" +# define _Call_ID "i" +# define _Reject_Contact "j"; +# define _Supported "k" +# define _Content_Length "l" +# define _Contact "m" +# define _Identity_Info "n" +# define _Event "o" +# define _Refer_To "r" +# define _Subject "s" +# define _To "t"; +# define _Allow_Events "u" +# define _Via "v" +# define _Session_Expires "x" +# define _Identity "y" +#else +# define _Accept_Contact "Accept-Contact" +# define _Referred_By "Referred-By" +# define _Content_Type "Content-Type" +# define _Request_Disposition "Request-Disposition" +# define _Content_Encoding "Content-Encoding" +# define _From "From" +# define _Call_ID "Call-ID" +# define _Reject_Contact "Reject-Contact" +# define _Supported "Supported" +# define _Content_Length "Content-Length" +# define _Contact "Contact" +# define _Identity_Info "Identity-Info" +# define _Event "Event" +# define _Refer_To "Refer-To" +# define _Subject "Subject" +# define _To "To" +# define _Allow_Events "Allow-Events" +# define _Via "Via" +# define _Session_Expires "Session-Expires" +# define _Identity "Identity" +#endif + +/** Gets the name of the SIP header with a type equal to @a type. + * @param type The @a type of the header for which to retrieve the name. + * + * @return The name of the header. +**/ +const char *tsip_header_get_name(tsip_header_type_t type) +{ + switch(type) + { + case tsip_htype_Accept: return "Accept"; + case tsip_htype_Accept_Contact: return _Accept_Contact; + case tsip_htype_Accept_Encoding: return "Accept-Encoding"; + case tsip_htype_Accept_Language: return "Accept-Language"; + case tsip_htype_Accept_Resource_Priority: return "Accept-Resource-Priority"; + case tsip_htype_Alert_Info: return "Alert-Info"; + case tsip_htype_Allow: return "Allow"; + case tsip_htype_Allow_Events: return _Allow_Events; + case tsip_htype_Authentication_Info: return "Authentication-Info"; + case tsip_htype_Authorization: return "Authorization"; + case tsip_htype_Call_ID: return _Call_ID; + case tsip_htype_Call_Info: return "Call-Info"; + case tsip_htype_Contact: return _Contact; + case tsip_htype_Content_Disposition: return "Content-Disposition"; + case tsip_htype_Content_Encoding: return _Content_Encoding; + case tsip_htype_Content_Language: return "Content-Language"; + case tsip_htype_Content_Length: return _Content_Length; + case tsip_htype_Content_Type: return _Content_Type; + case tsip_htype_CSeq: return "CSeq"; + case tsip_htype_Date: return "Date"; + case tsip_htype_Error_Info: return "Error-Info"; + case tsip_htype_Event: return _Event; + case tsip_htype_Expires: return "Expires"; + case tsip_htype_From: return _From; + case tsip_htype_History_Info: return "History-Info"; + case tsip_htype_Identity: return _Identity; + case tsip_htype_Identity_Info: return _Identity_Info; + case tsip_htype_In_Reply_To: return "In-Reply-To"; + case tsip_htype_Join: return "Join"; + case tsip_htype_Max_Forwards: return "Max-Forwards"; + case tsip_htype_MIME_Version: return "MIME-Version"; + case tsip_htype_Min_Expires: return "Min-Expires"; + case tsip_htype_Min_SE: return "Min-SE"; + case tsip_htype_Organization: return "Organization"; + case tsip_htype_Path: return "Path"; + case tsip_htype_Priority: return "Priority"; + case tsip_htype_Privacy: return "Privacy"; + case tsip_htype_Proxy_Authenticate: return "Proxy-Authenticate"; + case tsip_htype_Proxy_Authorization: return "Proxy-Authorization"; + case tsip_htype_Proxy_Require: return "Proxy-Require"; + case tsip_htype_RAck: return "RAck"; + case tsip_htype_Reason: return "Reason"; + case tsip_htype_Record_Route: return "Record-Route"; + case tsip_htype_Refer_Sub: return "Refer-Sub"; + case tsip_htype_Refer_To: return _Refer_To; + case tsip_htype_Referred_By: return _Referred_By; + case tsip_htype_Reject_Contact: return _Reject_Contact; + case tsip_htype_Replaces: return "Replaces"; + case tsip_htype_Reply_To: return "Reply-To"; + case tsip_htype_Request_Disposition: return _Request_Disposition; + case tsip_htype_Require: return "Require"; + case tsip_htype_Resource_Priority: return "Resource-Priority"; + case tsip_htype_Retry_After: return "Retry-After"; + case tsip_htype_Route: return "Route"; + case tsip_htype_RSeq: return "RSeq"; + case tsip_htype_Security_Client: return "Security-Client"; + case tsip_htype_Security_Server: return "Security-Server"; + case tsip_htype_Security_Verify: return "Security-Verify"; + case tsip_htype_Server: return "Server"; + case tsip_htype_Service_Route: return "Service-Route"; + case tsip_htype_Session_Expires: return _Session_Expires; + case tsip_htype_SIP_ETag: return "SIP-ETag"; + case tsip_htype_SIP_If_Match: return "SIP-If-Match"; + case tsip_htype_Subject: return _Subject; + case tsip_htype_Subscription_State: return "Subscription-State"; + case tsip_htype_Supported: return _Supported; + case tsip_htype_Target_Dialog: return "Target-Dialog"; + case tsip_htype_Timestamp: return "Timestamp"; + case tsip_htype_To: return _To; + case tsip_htype_Unsupported: return "Unsupported"; + case tsip_htype_User_Agent: return "User-Agent"; + case tsip_htype_Via: return _Via; + case tsip_htype_Warning: return "Warning"; + case tsip_htype_WWW_Authenticate: return "WWW-Authenticate"; + case tsip_htype_P_Access_Network_Info: return "P-Access-Network-Info"; + case tsip_htype_P_Answer_State: return "P-Answer-State"; + case tsip_htype_P_Asserted_Identity: return "P-Asserted-Identity"; + case tsip_htype_P_Associated_URI: return "P-Associated-URI"; + case tsip_htype_P_Called_Party_ID: return "P-Called-Party-ID"; + case tsip_htype_P_Charging_Function_Addresses: return "P-Charging-Function-Addresses"; + case tsip_htype_P_Charging_Vector: return "P-Charging-Vector"; + case tsip_htype_P_DCS_Billing_Info: return "P-DCS-Billing-Info"; + case tsip_htype_P_DCS_LAES: return "P-DCS-LAES"; + case tsip_htype_P_DCS_OSPS: return "P-DCS-OSPS"; + case tsip_htype_P_DCS_Redirect: return "P-DCS-Redirect"; + case tsip_htype_P_DCS_Trace_Party_ID: return "P-DCS-Trace-Party-ID"; + case tsip_htype_P_Early_Media: return "P-Early-Media"; + case tsip_htype_P_Media_Authorization: return "P-Media-Authorization"; + case tsip_htype_P_Preferred_Identity: return "P-Preferred-Identity"; + case tsip_htype_P_Profile_Key: return "P-Profile-Key"; + case tsip_htype_P_User_Database: return "P-User-Database"; + case tsip_htype_P_Visited_Network_ID: return "P-Visited-Network-ID"; + + default: return "unknown-header"; + } +} + +const char *tsip_header_get_name_2(const tsip_header_t *self) +{ + if(self){ + if(self->type == tsip_htype_Dummy){ + return ((tsip_header_Dummy_t*)self)->name; + } + else{ + return tsip_header_get_name(self->type); + } + } + return "unknown-header"; +} + +char tsip_header_get_param_separator(const tsip_header_t *self) +{ + if(self) + { + switch(self->type) + { + case tsip_htype_Authorization: + case tsip_htype_Proxy_Authorization: + case tsip_htype_Proxy_Authenticate: + case tsip_htype_WWW_Authenticate: + { + return ','; + } + + default: + { + return ';'; + } + } + } + return 0; +} + +int tsip_header_serialize(const tsip_header_t *self, tsk_buffer_t *output) +{ + int ret = -1; + static const char* hname; + static char separator; + + if(self && TSIP_HEADER(self)->serialize){ + tsk_list_item_t *item; + + hname = tsip_header_get_name_2(self); + ret = 0; // for empty lists + + /* Header name */ + tsk_buffer_append_2(output, "%s: ", hname); + + /* Header value (likes calling tsip_header_value_serialize() ) */ + if((ret = TSIP_HEADER(self)->serialize(self, output))){ + // CHECK all headers return value! + //return ret; + } + + /* Parameters */ + tsk_list_foreach(item, self->params){ + tsk_param_t* param = item->data; + separator = tsip_header_get_param_separator(self); + if((ret = tsk_buffer_append_2(output, param->value?"%c%s=%s":"%c%s", separator, param->name, param->value))){ + return ret; + } + } + + /* CRLF */ + tsk_buffer_append(output, "\r\n", 2); + } + return ret; +} + +char* tsip_header_tostring(const tsip_header_t *self) +{ + tsk_buffer_t *output; + char* ret = tsk_null; + if(self && (output = tsk_buffer_create_null())){ + if(!tsip_header_serialize(self, output)){ + ret = tsk_strndup(output->data, output->size); + } + TSK_OBJECT_SAFE_FREE(output); + } + return ret; +} + +int tsip_header_value_serialize(const tsip_header_t *self, tsk_buffer_t *output) +{ + if(self && output){ + return TSIP_HEADER(self)->serialize(self, output); + } + else{ + TSK_DEBUG_ERROR("Invalid parameter"); + return -1; + } +} + +char* tsip_header_value_tostring(const tsip_header_t *self) +{ + tsk_buffer_t *output; + char* ret = tsk_null; + if(self && (output = tsk_buffer_create_null())){ + if(!tsip_header_value_serialize(self, output)){ + ret = tsk_strndup(output->data, output->size); + } + TSK_OBJECT_SAFE_FREE(output); + } + return ret; +} + +char* tsip_header_get_param_value(const tsip_header_t *self, const char* pname) +{ + const tsk_param_t* _param; + char* value = tsk_null; + + if(!self || !pname){ + return tsk_null; + } + + if(self->get_special_param_value && (value = self->get_special_param_value(self, pname))){ + return value; + } + + if((_param = tsk_params_get_param_by_name(self->params, pname))){ + return tsk_strdup(_param->value); + } + + return tsk_null; +} diff --git a/tinySIP/src/headers/tsip_header_Accept_Contact.c b/tinySIP/src/headers/tsip_header_Accept_Contact.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Accept_Contact.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Accept_Encoding.c b/tinySIP/src/headers/tsip_header_Accept_Encoding.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Accept_Encoding.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Accept_Language.c b/tinySIP/src/headers/tsip_header_Accept_Language.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Accept_Language.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Accept_Resource_Priority.c b/tinySIP/src/headers/tsip_header_Accept_Resource_Priority.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Accept_Resource_Priority.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Alert_Info.c b/tinySIP/src/headers/tsip_header_Alert_Info.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Alert_Info.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Allow.c b/tinySIP/src/headers/tsip_header_Allow.c new file mode 100644 index 0000000..db0930b --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Allow.c @@ -0,0 +1,365 @@ + +/* #line 1 "./ragel/tsip_parser_header_Allow.rl" */ +/* +* 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 tsip_header_Allow.c + * @brief SIP Allow header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Allow.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include <string.h> + +/*********************************** +* Ragel state machine. +*/ + +/* #line 66 "./ragel/tsip_parser_header_Allow.rl" */ + + + +tsip_header_Allow_t* tsip_header_Allow_create() +{ + return tsk_object_new(tsip_header_Allow_def_t); +} + +int tsip_header_Allow_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Allow_t *Allow = (const tsip_header_Allow_t *)header; + tsk_list_item_t *item; + tsk_string_t *str; + int ret = 0; + + tsk_list_foreach(item, Allow->methods){ + str = item->data; + if(item == Allow->methods->head){ + tsk_buffer_append(output, str->value, tsk_strlen(str->value)); + } + else{ + tsk_buffer_append_2(output, ",%s", str->value); + } + } + + return ret; + } + + return -1; +} + +tsip_header_Allow_t *tsip_header_Allow_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Allow_t *hdr_allow = tsip_header_Allow_create(); + + const char *tag_start = tsk_null; + + +/* #line 89 "./src/headers/tsip_header_Allow.c" */ +static const char _tsip_machine_parser_header_Allow_actions[] = { + 0, 1, 0, 1, 1, 1, 2 +}; + +static const char _tsip_machine_parser_header_Allow_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 13, + 30, 31, 47, 51, 52, 54, 57, 74, + 75, 77, 93 +}; + +static const char _tsip_machine_parser_header_Allow_trans_keys[] = { + 65, 97, 76, 108, 76, 108, 79, 111, + 87, 119, 9, 32, 58, 9, 13, 32, + 33, 37, 39, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 10, 9, + 13, 32, 33, 37, 39, 44, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 44, 10, 9, 32, 9, 32, + 44, 9, 13, 32, 33, 37, 39, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 10, 9, 32, 9, 32, 33, + 37, 39, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 0 +}; + +static const char _tsip_machine_parser_header_Allow_single_lengths[] = { + 0, 2, 2, 2, 2, 2, 3, 7, + 1, 8, 4, 1, 2, 3, 7, 1, + 2, 6, 0 +}; + +static const char _tsip_machine_parser_header_Allow_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 5, + 0, 4, 0, 0, 0, 0, 5, 0, + 0, 5, 0 +}; + +static const char _tsip_machine_parser_header_Allow_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 15, 19, + 32, 34, 47, 52, 54, 57, 61, 74, + 76, 79, 91 +}; + +static const char _tsip_machine_parser_header_Allow_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 5, 5, 1, 5, + 5, 6, 1, 6, 7, 6, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 1, + 9, 1, 10, 11, 10, 12, 12, 12, + 13, 12, 12, 12, 12, 12, 1, 14, + 15, 14, 16, 1, 17, 1, 18, 18, + 1, 18, 18, 16, 1, 16, 19, 16, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 1, 20, 1, 21, 21, 1, 21, + 21, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Allow_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 18, 10, 8, 9, 14, 10, 11, + 14, 12, 13, 15, 16, 17 +}; + +static const char _tsip_machine_parser_header_Allow_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 5, 3, 3, 0, 3, 0, 0, + 0, 0, 0, 0, 0, 0 +}; + +static const int tsip_machine_parser_header_Allow_start = 1; +static const int tsip_machine_parser_header_Allow_first_final = 18; +static const int tsip_machine_parser_header_Allow_error = 0; + +static const int tsip_machine_parser_header_Allow_en_main = 1; + + + (void)(tsip_machine_parser_header_Allow_first_final); + +/* #line 109 "./ragel/tsip_parser_header_Allow.rl" */ + (void)(eof); + (void)(void)(tsip_machine_parser_header_Allow_first_final); + (void)(void)(tsip_machine_parser_header_Allow_error); + (void)(void)(tsip_machine_parser_header_Allow_en_main); + +/* #line 173 "./src/headers/tsip_header_Allow.c" */ + { + cs = tsip_machine_parser_header_Allow_start; + } + +/* #line 114 "./ragel/tsip_parser_header_Allow.rl" */ + +/* #line 180 "./src/headers/tsip_header_Allow.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Allow_trans_keys + _tsip_machine_parser_header_Allow_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Allow_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Allow_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Allow_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Allow_indicies[_trans]; + cs = _tsip_machine_parser_header_Allow_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Allow_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Allow_actions + _tsip_machine_parser_header_Allow_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 48 "./ragel/tsip_parser_header_Allow.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 53 "./ragel/tsip_parser_header_Allow.rl" */ + { + TSK_PARSER_ADD_STRING(hdr_allow->methods); + } + break; + case 2: +/* #line 58 "./ragel/tsip_parser_header_Allow.rl" */ + { + } + break; +/* #line 271 "./src/headers/tsip_header_Allow.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 115 "./ragel/tsip_parser_header_Allow.rl" */ + + if( cs < +/* #line 287 "./src/headers/tsip_header_Allow.c" */ +18 +/* #line 116 "./ragel/tsip_parser_header_Allow.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse SIP 'Allow' header."); + TSK_OBJECT_SAFE_FREE(hdr_allow); + } + + return hdr_allow; +} + +tsk_bool_t tsip_header_Allow_allows(const tsip_header_Allow_t* self, const char* method) +{ + const tsk_list_item_t* item; + const tsk_string_t* string; + + if(!self || !method){ + TSK_DEBUG_ERROR("Invalid parameter"); + return -1; + } + + tsk_list_foreach(item, self->methods){ + if(!(string = item->data)){ + continue; + } + if(tsk_striequals(string->value, method)){ + return tsk_true; + } + } + return tsk_false; +} + + + + + +//======================================================== +// Allow header object definition +// + +static tsk_object_t* tsip_header_Allow_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Allow_t *Allow = self; + if(Allow){ + /*const char* methods = va_arg(*app, const char *); + if(methods && !tsk_strempty(methods)) + { + Allow->methods = tsip_header_Allow_parse(methods, tsk_strlen(methods)); + }*/ + TSIP_HEADER(Allow)->type = tsip_htype_Allow; + TSIP_HEADER(Allow)->serialize = tsip_header_Allow_serialize; + } + else{ + TSK_DEBUG_ERROR("Failed to create new Allow header."); + } + return self; +} + +static tsk_object_t* tsip_header_Allow_dtor(tsk_object_t *self) +{ + tsip_header_Allow_t *Allow = self; + if(Allow){ + TSK_OBJECT_SAFE_FREE(Allow->methods); + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Allow)); + } + else TSK_DEBUG_ERROR("Null Allow header."); + + return self; +} + +static const tsk_object_def_t tsip_header_Allow_def_s = +{ + sizeof(tsip_header_Allow_t), + tsip_header_Allow_ctor, + tsip_header_Allow_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Allow_def_t = &tsip_header_Allow_def_s; diff --git a/tinySIP/src/headers/tsip_header_Allow_Events.c b/tinySIP/src/headers/tsip_header_Allow_Events.c new file mode 100644 index 0000000..e86a9c4 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Allow_Events.c @@ -0,0 +1,352 @@ + +/* #line 1 "./ragel/tsip_parser_header_Allow_Events.rl" */ +/* +* 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 tsip_header_Allow_events.c + * @brief SIP Allow-Events/u header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Allow_Events.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + +#include <string.h> + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 69 "./ragel/tsip_parser_header_Allow_Events.rl" */ + + +tsip_header_Allow_Events_t* tsip_header_Allow_Events_create() +{ + return tsk_object_new(tsip_header_Allow_Events_def_t); +} + +int tsip_header_Allow_Events_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Allow_Events_t *Allow_Events = (const tsip_header_Allow_Events_t *)header; + tsk_list_item_t *item; + tsk_string_t *str; + int ret = 0; + + tsk_list_foreach(item, Allow_Events->events){ + str = item->data; + if(item == Allow_Events->events->head){ + tsk_buffer_append(output, str->value, tsk_strlen(str->value)); + } + else{ + tsk_buffer_append_2(output, ",%s", str->value); + } + } + + return ret; + } + + return -1; +} + +tsip_header_Allow_Events_t *tsip_header_Allow_Events_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Allow_Events_t *hdr_allow_events = tsip_header_Allow_Events_create(); + + const char *tag_start = tsk_null; + + +/* #line 90 "./src/headers/tsip_header_Allow_Events.c" */ +static const char _tsip_machine_parser_header_Allow_events_actions[] = { + 0, 1, 0, 1, 1, 1, 2 +}; + +static const char _tsip_machine_parser_header_Allow_events_key_offsets[] = { + 0, 0, 4, 6, 8, 10, 12, 13, + 15, 17, 19, 21, 23, 25, 28, 44, + 45, 47, 62, 79, 83, 84, 86, 89, + 90, 103 +}; + +static const char _tsip_machine_parser_header_Allow_events_trans_keys[] = { + 65, 85, 97, 117, 76, 108, 76, 108, + 79, 111, 87, 119, 45, 69, 101, 86, + 118, 69, 101, 78, 110, 84, 116, 83, + 115, 9, 32, 58, 9, 13, 32, 33, + 37, 39, 45, 126, 42, 43, 48, 57, + 65, 90, 95, 122, 10, 9, 32, 9, + 32, 33, 37, 39, 45, 126, 42, 43, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 44, 46, 126, 42, + 45, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 44, 10, 9, 32, 9, 32, + 44, 10, 33, 37, 39, 45, 126, 42, + 43, 48, 57, 65, 90, 95, 122, 0 +}; + +static const char _tsip_machine_parser_header_Allow_events_single_lengths[] = { + 0, 4, 2, 2, 2, 2, 1, 2, + 2, 2, 2, 2, 2, 3, 8, 1, + 2, 7, 9, 4, 1, 2, 3, 1, + 5, 0 +}; + +static const char _tsip_machine_parser_header_Allow_events_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 4, 0, + 0, 4, 4, 0, 0, 0, 0, 0, + 4, 0 +}; + +static const unsigned char _tsip_machine_parser_header_Allow_events_index_offsets[] = { + 0, 0, 5, 8, 11, 14, 17, 19, + 22, 25, 28, 31, 34, 37, 41, 54, + 56, 59, 71, 85, 90, 92, 95, 99, + 101, 111 +}; + +static const char _tsip_machine_parser_header_Allow_events_indicies[] = { + 0, 2, 0, 2, 1, 3, 3, 1, + 4, 4, 1, 5, 5, 1, 6, 6, + 1, 7, 1, 8, 8, 1, 9, 9, + 1, 10, 10, 1, 11, 11, 1, 12, + 12, 1, 2, 2, 1, 2, 2, 13, + 1, 13, 14, 13, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 1, 16, 1, + 17, 17, 1, 17, 17, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 1, 18, + 19, 18, 20, 20, 20, 21, 22, 20, + 20, 20, 20, 20, 1, 23, 24, 23, + 13, 1, 25, 1, 26, 26, 1, 26, + 26, 13, 1, 27, 1, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 1, 1, + 0 +}; + +static const char _tsip_machine_parser_header_Allow_events_trans_targs[] = { + 2, 0, 13, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 14, 15, 18, + 16, 17, 19, 23, 18, 14, 24, 19, + 20, 21, 22, 25 +}; + +static const char _tsip_machine_parser_header_Allow_events_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1, + 0, 0, 3, 3, 0, 3, 0, 0, + 0, 0, 0, 5 +}; + +static const int tsip_machine_parser_header_Allow_events_start = 1; +static const int tsip_machine_parser_header_Allow_events_first_final = 25; +static const int tsip_machine_parser_header_Allow_events_error = 0; + +static const int tsip_machine_parser_header_Allow_events_en_main = 1; + + +/* #line 111 "./ragel/tsip_parser_header_Allow_Events.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Allow_events_first_final); + (void)(tsip_machine_parser_header_Allow_events_error); + (void)(tsip_machine_parser_header_Allow_events_en_main); + +/* #line 184 "./src/headers/tsip_header_Allow_Events.c" */ + { + cs = tsip_machine_parser_header_Allow_events_start; + } + +/* #line 116 "./ragel/tsip_parser_header_Allow_Events.rl" */ + +/* #line 191 "./src/headers/tsip_header_Allow_Events.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Allow_events_trans_keys + _tsip_machine_parser_header_Allow_events_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Allow_events_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Allow_events_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Allow_events_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Allow_events_indicies[_trans]; + cs = _tsip_machine_parser_header_Allow_events_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Allow_events_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Allow_events_actions + _tsip_machine_parser_header_Allow_events_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 49 "./ragel/tsip_parser_header_Allow_Events.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 53 "./ragel/tsip_parser_header_Allow_Events.rl" */ + { + TSK_PARSER_ADD_STRING(hdr_allow_events->events); + } + break; + case 2: +/* #line 57 "./ragel/tsip_parser_header_Allow_Events.rl" */ + { + } + break; +/* #line 282 "./src/headers/tsip_header_Allow_Events.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 117 "./ragel/tsip_parser_header_Allow_Events.rl" */ + + if( cs < +/* #line 298 "./src/headers/tsip_header_Allow_Events.c" */ +25 +/* #line 118 "./ragel/tsip_parser_header_Allow_Events.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse SIP 'Allow-Events' header."); + TSK_OBJECT_SAFE_FREE(hdr_allow_events); + } + + return hdr_allow_events; +} + + + + + + + +//======================================================== +// Allow_events header object definition +// + +static tsk_object_t* tsip_header_Allow_Events_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Allow_Events_t *Allow_events = self; + if(Allow_events){ + TSIP_HEADER(Allow_events)->type = tsip_htype_Allow_Events; + TSIP_HEADER(Allow_events)->serialize = tsip_header_Allow_Events_serialize; + } + else{ + TSK_DEBUG_ERROR("Failed to create new Allow-Events header."); + } + return self; +} + +static tsk_object_t* tsip_header_Allow_Events_dtor(tsk_object_t *self) +{ + tsip_header_Allow_Events_t *Allow_events = self; + if(Allow_events){ + TSK_OBJECT_SAFE_FREE(Allow_events->events); + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Allow_events)); + } + else{ + TSK_DEBUG_ERROR("Null Allow-Events header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Allow_Events_def_s = +{ + sizeof(tsip_header_Allow_Events_t), + tsip_header_Allow_Events_ctor, + tsip_header_Allow_Events_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Allow_Events_def_t = &tsip_header_Allow_Events_def_s; diff --git a/tinySIP/src/headers/tsip_header_Authentication_Info.c b/tinySIP/src/headers/tsip_header_Authentication_Info.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Authentication_Info.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Authorization.c b/tinySIP/src/headers/tsip_header_Authorization.c new file mode 100644 index 0000000..92c9fdc --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Authorization.c @@ -0,0 +1,180 @@ + +/* #line 1 "tsip_parser_header_Authorization.rl" */ +/* +* 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 tsip_header_Authorization.c + * @brief SIP Proxy-Authenticate header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Authorization.h" + +#include "tinyhttp/headers/thttp_header_Authorization.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_time.h" + +#include <string.h> + +tsip_header_Authorization_t* tsip_header_Authorization_create() +{ + return tsk_object_new(tsip_header_Authorization_def_t); +} + +int tsip_header_Authorization_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Authorization_t *Authorization = (const tsip_header_Authorization_t *)header; + if(Authorization && Authorization->scheme){ + return tsk_buffer_append_2(output, "%s %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", + Authorization->scheme, + + Authorization->username ? "username=\"" : "", + Authorization->username ? Authorization->username : "", + Authorization->username ? "\"" : "", + + Authorization->realm ? ",realm=\"" : "", + Authorization->realm ? Authorization->realm : "", + Authorization->realm ? "\"" : "", + + Authorization->nonce ? ",nonce=\"" : "", + Authorization->nonce ? Authorization->nonce : "", + Authorization->nonce ? "\"" : "", + + Authorization->uri ? ",uri=\"" : "", + Authorization->uri ? Authorization->uri : "", + Authorization->uri ? "\"" : "", + + Authorization->response ? ",response=\"" : "", + Authorization->response ? Authorization->response : "", + Authorization->response ? "\"" : "", + + Authorization->algorithm ? ",algorithm=" : "", + Authorization->algorithm ? Authorization->algorithm : "", + + Authorization->cnonce ? ",cnonce=\"" : "", + Authorization->cnonce ? Authorization->cnonce : "", + Authorization->cnonce ? "\"" : "", + + Authorization->opaque ? ",opaque=\"" : "", + Authorization->opaque ? Authorization->opaque : "", + Authorization->opaque ? "\"" : "", + + Authorization->qop ? ",qop=" : "", + Authorization->qop ? Authorization->qop : "", + + Authorization->nc ? ",nc=" : "", + Authorization->nc ? Authorization->nc : "" + ); + } + } + return -1; +} + +tsip_header_Authorization_t *tsip_header_Authorization_parse(const char *data, tsk_size_t size) +{ + tsip_header_Authorization_t *hdr_sip = 0; + thttp_header_Authorization_t* hdr_http; + + if((hdr_http = thttp_header_Authorization_parse(data, size))){ + hdr_sip = tsip_header_Authorization_create(); + + hdr_sip->scheme = tsk_strdup(hdr_http->scheme); + hdr_sip->username = tsk_strdup(hdr_http->username); + hdr_sip->realm = tsk_strdup(hdr_http->realm); + hdr_sip->nonce = tsk_strdup(hdr_http->nonce); + hdr_sip->uri = tsk_strdup(hdr_http->uri); + hdr_sip->response = tsk_strdup(hdr_http->response); + hdr_sip->algorithm = tsk_strdup(hdr_http->algorithm); + hdr_sip->cnonce = tsk_strdup(hdr_http->cnonce); + hdr_sip->opaque = tsk_strdup(hdr_http->opaque); + hdr_sip->qop = tsk_strdup(hdr_http->qop); + hdr_sip->nc = tsk_strdup(hdr_http->nc); + + TSIP_HEADER(hdr_sip)->params = tsk_object_ref(THTTP_HEADER(hdr_http)->params); + + TSK_OBJECT_SAFE_FREE(hdr_http); + } + + return hdr_sip; +} + + + + + +//======================================================== +// Authorization header object definition +// + +/**@ingroup tsip_header_Authorization_group +*/ +static tsk_object_t* tsip_header_Authorization_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Authorization_t *Authorization = self; + if(Authorization){ + TSIP_HEADER(Authorization)->type = tsip_htype_Authorization; + TSIP_HEADER(Authorization)->serialize = tsip_header_Authorization_serialize; + } + else{ + TSK_DEBUG_ERROR("Failed to create new Authorization header."); + } + return self; +} + +/**@ingroup tsip_header_Authorization_group +*/ +static tsk_object_t* tsip_header_Authorization_dtor(tsk_object_t *self) +{ + tsip_header_Authorization_t *Authorization = self; + if(Authorization){ + TSK_FREE(Authorization->scheme); + TSK_FREE(Authorization->username); + TSK_FREE(Authorization->realm); + TSK_FREE(Authorization->nonce); + TSK_FREE(Authorization->uri); + TSK_FREE(Authorization->response); + TSK_FREE(Authorization->algorithm); + TSK_FREE(Authorization->cnonce); + TSK_FREE(Authorization->opaque); + TSK_FREE(Authorization->qop); + TSK_FREE(Authorization->nc); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Authorization)); + } + else TSK_DEBUG_ERROR("Null Authorization header."); + + return self; +} + +static const tsk_object_def_t tsip_header_Authorization_def_s = +{ + sizeof(tsip_header_Authorization_t), + tsip_header_Authorization_ctor, + tsip_header_Authorization_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Authorization_def_t = &tsip_header_Authorization_def_s; diff --git a/tinySIP/src/headers/tsip_header_CSeq.c b/tinySIP/src/headers/tsip_header_CSeq.c new file mode 100644 index 0000000..ca168ea --- /dev/null +++ b/tinySIP/src/headers/tsip_header_CSeq.c @@ -0,0 +1,344 @@ + +/* #line 1 "./ragel/tsip_parser_header_CSeq.rl" */ +/* +* 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 tsip_header_CSeq.c + * @brief SIP CSeq header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_CSeq.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + +extern tsip_request_type_t tsip_request_get_type(const char* method); + +/*********************************** +* Ragel state machine. +*/ + +/* #line 68 "./ragel/tsip_parser_header_CSeq.rl" */ + + + +tsip_header_CSeq_t* tsip_header_CSeq_create(int32_t seq, const char*method) +{ + return tsk_object_new(TSIP_HEADER_CSEQ_VA_ARGS(seq, method)); +} + +int tsip_header_CSeq_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_CSeq_t *CSeq = (const tsip_header_CSeq_t *)header; + return tsk_buffer_append_2(output, "%u %s", CSeq->seq, CSeq->method); + } + return -1; +} + +tsip_header_CSeq_t *tsip_header_CSeq_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_CSeq_t *hdr_cseq = tsip_header_CSeq_create(TSIP_HEADER_CSEQ_NONE, tsk_null); + + const char *tag_start = tsk_null; + + +/* #line 75 "./src/headers/tsip_header_CSeq.c" */ +static const char _tsip_machine_parser_header_CSeq_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3 +}; + +static const char _tsip_machine_parser_header_CSeq_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 11, 16, + 17, 19, 23, 28, 45, 46, 48, 64, + 79, 80 +}; + +static const char _tsip_machine_parser_header_CSeq_trans_keys[] = { + 67, 99, 83, 115, 69, 101, 81, 113, + 9, 32, 58, 9, 13, 32, 48, 57, + 10, 9, 32, 9, 32, 48, 57, 9, + 13, 32, 48, 57, 9, 13, 32, 33, + 37, 39, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 32, 33, 37, 39, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 13, 33, 37, 39, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 10, + 0 +}; + +static const char _tsip_machine_parser_header_CSeq_single_lengths[] = { + 0, 2, 2, 2, 2, 3, 3, 1, + 2, 2, 3, 7, 1, 2, 6, 5, + 1, 0 +}; + +static const char _tsip_machine_parser_header_CSeq_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 1, 1, 5, 0, 0, 5, 5, + 0, 0 +}; + +static const char _tsip_machine_parser_header_CSeq_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 16, 21, + 23, 26, 30, 35, 48, 50, 53, 65, + 76, 78 +}; + +static const char _tsip_machine_parser_header_CSeq_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 4, 4, 5, 1, + 5, 6, 5, 7, 1, 8, 1, 9, + 9, 1, 9, 9, 7, 1, 10, 11, + 10, 12, 1, 13, 14, 13, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 1, + 16, 1, 17, 17, 1, 17, 17, 15, + 15, 15, 15, 15, 15, 15, 15, 15, + 1, 18, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 1, 20, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_CSeq_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 10, + 8, 9, 11, 12, 10, 11, 12, 15, + 13, 14, 16, 15, 17 +}; + +static const char _tsip_machine_parser_header_CSeq_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 1, + 0, 0, 5, 5, 0, 0, 0, 1, + 0, 0, 3, 0, 7 +}; + +static const int tsip_machine_parser_header_CSeq_start = 1; +static const int tsip_machine_parser_header_CSeq_first_final = 17; +static const int tsip_machine_parser_header_CSeq_error = 0; + +static const int tsip_machine_parser_header_CSeq_en_main = 1; + + +/* #line 96 "./ragel/tsip_parser_header_CSeq.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_CSeq_first_final); + (void)(tsip_machine_parser_header_CSeq_error); + (void)(tsip_machine_parser_header_CSeq_en_main); + +/* #line 157 "./src/headers/tsip_header_CSeq.c" */ + { + cs = tsip_machine_parser_header_CSeq_start; + } + +/* #line 101 "./ragel/tsip_parser_header_CSeq.rl" */ + +/* #line 164 "./src/headers/tsip_header_CSeq.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_CSeq_trans_keys + _tsip_machine_parser_header_CSeq_key_offsets[cs]; + _trans = _tsip_machine_parser_header_CSeq_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_CSeq_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_CSeq_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_CSeq_indicies[_trans]; + cs = _tsip_machine_parser_header_CSeq_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_CSeq_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_CSeq_actions + _tsip_machine_parser_header_CSeq_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 48 "./ragel/tsip_parser_header_CSeq.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 52 "./ragel/tsip_parser_header_CSeq.rl" */ + { + TSK_PARSER_SET_STRING(hdr_cseq->method); + } + break; + case 2: +/* #line 56 "./ragel/tsip_parser_header_CSeq.rl" */ + { + TSK_PARSER_SET_UINT(hdr_cseq->seq); + } + break; + case 3: +/* #line 60 "./ragel/tsip_parser_header_CSeq.rl" */ + { + } + break; +/* #line 261 "./src/headers/tsip_header_CSeq.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 102 "./ragel/tsip_parser_header_CSeq.rl" */ + + if( cs < +/* #line 277 "./src/headers/tsip_header_CSeq.c" */ +17 +/* #line 103 "./ragel/tsip_parser_header_CSeq.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'CSeq' header."); + TSK_OBJECT_SAFE_FREE(hdr_cseq); + } + else { + hdr_cseq->type = tsip_request_get_type(hdr_cseq->method); + } + + return hdr_cseq; +} + + + + + + + +//======================================================== +// CSeq header object definition +// + +static tsk_object_t* tsip_header_CSeq_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_CSeq_t *CSeq = self; + if(CSeq){ + TSIP_HEADER(CSeq)->type = tsip_htype_CSeq; + TSIP_HEADER(CSeq)->serialize = tsip_header_CSeq_serialize; + CSeq->seq = va_arg(*app, uint32_t); + CSeq->method = tsk_strdup(va_arg(*app, const char*)); + + if(!tsk_strnullORempty(CSeq->method)){ + CSeq->type = tsip_request_get_type(CSeq->method); + } + else{ + CSeq->type = tsip_NONE; + } + } + else{ + TSK_DEBUG_ERROR("Failed to create new CSeq header."); + } + return self; +} + +static tsk_object_t* tsip_header_CSeq_dtor(tsk_object_t *self) +{ + tsip_header_CSeq_t *CSeq = self; + if(CSeq){ + TSK_FREE(CSeq->method); + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(CSeq)); + } + else{ + TSK_DEBUG_ERROR("Null CSeq header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_CSeq_def_s = +{ + sizeof(tsip_header_CSeq_t), + tsip_header_CSeq_ctor, + tsip_header_CSeq_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_CSeq_def_t = &tsip_header_CSeq_def_s; + diff --git a/tinySIP/src/headers/tsip_header_Call_ID.c b/tinySIP/src/headers/tsip_header_Call_ID.c new file mode 100644 index 0000000..3920b53 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Call_ID.c @@ -0,0 +1,340 @@ + +/* #line 1 "./ragel/tsip_parser_header_Call_ID.rl" */ +/* +* 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 tsip_header_Call_ID.c + * @brief SIP Call-ID/i header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Call_ID.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_time.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 68 "./ragel/tsip_parser_header_Call_ID.rl" */ + + + +tsip_header_Call_ID_t* tsip_header_Call_ID_create(const char* call_id) +{ + return tsk_object_new(TSIP_HEADER_CALL_ID_VA_ARGS(call_id)); +} + +int tsip_header_Call_ID_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Call_ID_t *Call_ID = (const tsip_header_Call_ID_t *)header; + if(Call_ID->value){ + return tsk_buffer_append(output, Call_ID->value, tsk_strlen(Call_ID->value)); + } + } + return -1; +} + +int tsip_header_Call_ID_random(tsk_uuidstring_t *result) +{ + return tsk_uuidgenerate(result); +} + +tsip_header_Call_ID_t *tsip_header_Call_ID_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Call_ID_t *hdr_call_id = tsip_header_Call_ID_create(0); + + const char *tag_start = tsk_null; + + +/* #line 85 "./src/headers/tsip_header_Call_ID.c" */ +static const char _tsip_machine_parser_header_Call_ID_actions[] = { + 0, 1, 0, 1, 1, 1, 2 +}; + +static const char _tsip_machine_parser_header_Call_ID_key_offsets[] = { + 0, 0, 4, 6, 8, 10, 11, 13, + 15, 18, 37, 38, 40, 58, 74, 75, + 91, 108 +}; + +static const char _tsip_machine_parser_header_Call_ID_trans_keys[] = { + 67, 73, 99, 105, 65, 97, 76, 108, + 76, 108, 45, 73, 105, 68, 100, 9, + 32, 58, 9, 13, 32, 37, 60, 33, + 34, 39, 43, 45, 58, 62, 63, 65, + 93, 95, 123, 125, 126, 10, 9, 32, + 9, 32, 37, 60, 33, 34, 39, 43, + 45, 58, 62, 63, 65, 93, 95, 123, + 125, 126, 13, 37, 60, 64, 33, 34, + 39, 43, 45, 58, 62, 93, 95, 123, + 125, 126, 10, 37, 60, 33, 34, 39, + 43, 45, 58, 62, 63, 65, 93, 95, + 123, 125, 126, 13, 37, 60, 33, 34, + 39, 43, 45, 58, 62, 63, 65, 93, + 95, 123, 125, 126, 0 +}; + +static const char _tsip_machine_parser_header_Call_ID_single_lengths[] = { + 0, 4, 2, 2, 2, 1, 2, 2, + 3, 5, 1, 2, 4, 4, 1, 2, + 3, 0 +}; + +static const char _tsip_machine_parser_header_Call_ID_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 7, 0, 0, 7, 6, 0, 7, + 7, 0 +}; + +static const char _tsip_machine_parser_header_Call_ID_index_offsets[] = { + 0, 0, 5, 8, 11, 14, 16, 19, + 22, 26, 39, 41, 44, 56, 67, 69, + 79, 90 +}; + +static const char _tsip_machine_parser_header_Call_ID_indicies[] = { + 0, 2, 0, 2, 1, 3, 3, 1, + 4, 4, 1, 5, 5, 1, 6, 1, + 7, 7, 1, 2, 2, 1, 2, 2, + 8, 1, 8, 9, 8, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 1, 11, + 1, 12, 12, 1, 12, 12, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 1, + 13, 14, 14, 15, 14, 14, 14, 14, + 14, 14, 1, 16, 1, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 1, 13, + 17, 17, 17, 17, 17, 17, 17, 17, + 17, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Call_ID_trans_targs[] = { + 2, 0, 8, 3, 4, 5, 6, 7, + 9, 10, 13, 11, 12, 14, 13, 15, + 17, 16 +}; + +static const char _tsip_machine_parser_header_Call_ID_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 3, 0, 0, + 5, 0 +}; + +static const int tsip_machine_parser_header_Call_ID_start = 1; +static const int tsip_machine_parser_header_Call_ID_first_final = 17; +static const int tsip_machine_parser_header_Call_ID_error = 0; + +static const int tsip_machine_parser_header_Call_ID_en_main = 1; + + +/* #line 103 "./ragel/tsip_parser_header_Call_ID.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Call_ID_first_final); + (void)(tsip_machine_parser_header_Call_ID_error); + (void)(tsip_machine_parser_header_Call_ID_en_main); + +/* #line 171 "./src/headers/tsip_header_Call_ID.c" */ + { + cs = tsip_machine_parser_header_Call_ID_start; + } + +/* #line 108 "./ragel/tsip_parser_header_Call_ID.rl" */ + +/* #line 178 "./src/headers/tsip_header_Call_ID.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Call_ID_trans_keys + _tsip_machine_parser_header_Call_ID_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Call_ID_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Call_ID_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Call_ID_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Call_ID_indicies[_trans]; + cs = _tsip_machine_parser_header_Call_ID_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Call_ID_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Call_ID_actions + _tsip_machine_parser_header_Call_ID_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 51 "./ragel/tsip_parser_header_Call_ID.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 55 "./ragel/tsip_parser_header_Call_ID.rl" */ + { + TSK_PARSER_SET_STRING(hdr_call_id->value); + } + break; + case 2: +/* #line 59 "./ragel/tsip_parser_header_Call_ID.rl" */ + { + } + break; +/* #line 269 "./src/headers/tsip_header_Call_ID.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 109 "./ragel/tsip_parser_header_Call_ID.rl" */ + + if( cs < +/* #line 285 "./src/headers/tsip_header_Call_ID.c" */ +17 +/* #line 110 "./ragel/tsip_parser_header_Call_ID.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse SIP 'Call-ID' header."); + TSK_OBJECT_SAFE_FREE(hdr_call_id); + } + + return hdr_call_id; +} + + + + + + + +//======================================================== +// Call_ID header object definition +// + +static tsk_object_t* tsip_header_Call_ID_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Call_ID_t *Call_ID = self; + if(Call_ID){ + Call_ID->value = tsk_strdup(va_arg(*app, const char *)); + TSIP_HEADER(Call_ID)->type = tsip_htype_Call_ID; + TSIP_HEADER(Call_ID)->serialize = tsip_header_Call_ID_serialize; + } + else{ + TSK_DEBUG_ERROR("Failed to create new Call-ID header."); + } + return self; +} + +static tsk_object_t* tsip_header_Call_ID_dtor(tsk_object_t *self) +{ + tsip_header_Call_ID_t *Call_ID = self; + if(Call_ID){ + TSK_FREE(Call_ID->value); + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Call_ID)); + } + else{ + TSK_DEBUG_ERROR("Null Call-ID header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Call_ID_def_s = +{ + sizeof(tsip_header_Call_ID_t), + tsip_header_Call_ID_ctor, + tsip_header_Call_ID_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Call_ID_def_t = &tsip_header_Call_ID_def_s; diff --git a/tinySIP/src/headers/tsip_header_Call_Info.c b/tinySIP/src/headers/tsip_header_Call_Info.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Call_Info.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Contact.c b/tinySIP/src/headers/tsip_header_Contact.c new file mode 100644 index 0000000..e7abd80 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Contact.c @@ -0,0 +1,702 @@ + +/* #line 1 "./ragel/tsip_parser_header_Contact.rl" */ +/* +* 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 tsip_header_Contact.c + * @brief SIP Contact/m header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Contact.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 108 "./ragel/tsip_parser_header_Contact.rl" */ + + + +tsip_header_Contact_t* tsip_header_Contact_create() +{ + return tsk_object_new(tsip_header_Contact_def_t); +} + +int tsip_header_Contact_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Contact_t *Contact = (const tsip_header_Contact_t *)header; + int ret = 0; + + /* Uri with hacked display-name*/ + if((ret = tsip_uri_serialize(Contact->uri, tsk_true, tsk_true, output))){ + return ret; + } + + /* Expires */ + if(Contact->expires >=0){ + tsk_buffer_append_2(output, ";expires=%lld", Contact->expires); + } + + return ret; + } + + return -1; +} + + +tsip_header_Contacts_L_t *tsip_header_Contact_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Contacts_L_t *hdr_contacts = tsk_list_create(); + + const char *tag_start = tsk_null; + tsip_header_Contact_t *curr_contact = 0; + + +/* #line 90 "./src/headers/tsip_header_Contact.c" */ +static const char _tsip_machine_parser_header_Contact_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3, 1, 4, 1, 5, 1, 6, 1, + 7, 2, 1, 0, 2, 3, 6, 2, + 4, 6, 2, 5, 6 +}; + +static const short _tsip_machine_parser_header_Contact_key_offsets[] = { + 0, 0, 4, 6, 8, 10, 12, 14, + 16, 19, 40, 41, 43, 64, 65, 67, + 71, 74, 75, 79, 91, 94, 94, 95, + 100, 105, 106, 108, 112, 133, 134, 136, + 157, 158, 160, 163, 180, 198, 202, 203, + 205, 213, 214, 216, 220, 226, 246, 265, + 270, 270, 275, 294, 295, 297, 315, 333, + 339, 340, 342, 347, 366, 367, 369, 388, + 389, 391, 394, 402, 403, 405, 410, 416, + 433, 440, 448, 456, 464, 466, 473, 482, + 484, 487, 489, 492, 494, 497, 500, 501, + 504, 505, 508, 509, 518, 527, 535, 543, + 551, 559, 561, 567, 576, 585, 594, 596, + 599, 602, 603, 604, 624, 644, 664, 684, + 704, 724, 742, 748, 749, 751, 756, 775, + 776, 778, 797, 804, 821, 839, 843 +}; + +static const char _tsip_machine_parser_header_Contact_trans_keys[] = { + 67, 77, 99, 109, 79, 111, 78, 110, + 84, 116, 65, 97, 67, 99, 84, 116, + 9, 32, 58, 9, 13, 32, 33, 34, + 37, 39, 42, 43, 60, 126, 45, 46, + 48, 57, 65, 90, 95, 96, 97, 122, + 10, 9, 32, 9, 13, 32, 33, 34, + 37, 39, 42, 43, 60, 126, 45, 46, + 48, 57, 65, 90, 95, 96, 97, 122, + 10, 9, 32, 9, 32, 42, 60, 9, + 13, 32, 10, 65, 90, 97, 122, 9, + 32, 43, 58, 45, 46, 48, 57, 65, + 90, 97, 122, 9, 32, 58, 62, 9, + 13, 32, 44, 59, 9, 13, 32, 44, + 59, 10, 9, 32, 9, 32, 44, 59, + 9, 13, 32, 33, 34, 37, 39, 60, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 96, 97, 122, 10, 9, 32, + 9, 13, 32, 33, 34, 37, 39, 60, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 96, 97, 122, 10, 9, 32, + 9, 32, 60, 9, 13, 32, 33, 37, + 39, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 60, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 60, 10, 9, 32, 13, 34, 92, + 127, 0, 8, 10, 31, 10, 9, 32, + 9, 13, 32, 60, 0, 9, 11, 12, + 14, 127, 9, 13, 32, 33, 37, 39, + 42, 43, 58, 126, 45, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 9, 13, + 32, 33, 37, 39, 58, 60, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 58, 60, 9, 13, + 32, 44, 59, 9, 13, 32, 33, 37, + 39, 69, 101, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 10, 9, + 32, 9, 32, 33, 37, 39, 69, 101, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 44, 59, 61, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 44, 59, 61, 10, 9, 32, 9, 32, + 44, 59, 61, 9, 13, 32, 33, 34, + 37, 39, 91, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 10, 9, + 32, 9, 13, 32, 33, 34, 37, 39, + 91, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 10, 9, 32, 9, + 32, 34, 13, 34, 92, 127, 0, 8, + 10, 31, 10, 9, 32, 9, 13, 32, + 44, 59, 0, 9, 11, 12, 14, 127, + 9, 13, 32, 33, 37, 39, 44, 59, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 58, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 58, 48, 57, 65, 70, 97, + 102, 46, 58, 93, 48, 57, 65, 70, + 97, 102, 48, 57, 46, 48, 57, 48, + 57, 46, 48, 57, 48, 57, 93, 48, + 57, 93, 48, 57, 93, 46, 48, 57, + 46, 46, 48, 57, 46, 46, 58, 93, + 48, 57, 65, 70, 97, 102, 46, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 46, + 58, 93, 48, 57, 65, 70, 97, 102, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 46, 58, 93, 48, 57, 65, 70, + 97, 102, 48, 57, 46, 48, 57, 46, + 48, 57, 46, 58, 9, 13, 32, 33, + 37, 39, 44, 59, 61, 88, 120, 126, + 42, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 33, 37, 39, 44, 59, + 61, 80, 112, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 59, 61, 73, 105, 126, + 42, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 33, 37, 39, 44, 59, + 61, 82, 114, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 59, 61, 69, 101, 126, + 42, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 33, 37, 39, 44, 59, + 61, 83, 115, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 59, 61, 126, 42, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 44, 59, 61, 10, 9, 32, 9, + 32, 44, 59, 61, 9, 13, 32, 33, + 34, 37, 39, 91, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 10, + 9, 32, 9, 13, 32, 33, 34, 37, + 39, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 44, 59, 48, 57, 9, 13, 32, 33, + 37, 39, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 60, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 60, 0 +}; + +static const char _tsip_machine_parser_header_Contact_single_lengths[] = { + 0, 4, 2, 2, 2, 2, 2, 2, + 3, 11, 1, 2, 11, 1, 2, 4, + 3, 1, 0, 4, 3, 0, 1, 5, + 5, 1, 2, 4, 9, 1, 2, 9, + 1, 2, 3, 7, 8, 4, 1, 2, + 4, 1, 2, 4, 0, 10, 9, 5, + 0, 5, 9, 1, 2, 8, 10, 6, + 1, 2, 5, 9, 1, 2, 9, 1, + 2, 3, 4, 1, 2, 5, 0, 9, + 1, 2, 2, 2, 2, 1, 3, 0, + 1, 0, 1, 0, 1, 1, 1, 1, + 1, 1, 1, 3, 3, 2, 2, 2, + 2, 2, 0, 3, 3, 3, 0, 1, + 1, 1, 1, 12, 12, 12, 12, 12, + 12, 10, 6, 1, 2, 5, 9, 1, + 2, 9, 5, 7, 8, 4, 0 +}; + +static const char _tsip_machine_parser_header_Contact_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 0, 0, 5, 0, 0, 0, + 0, 0, 2, 4, 0, 0, 0, 0, + 0, 0, 0, 0, 6, 0, 0, 6, + 0, 0, 0, 5, 5, 0, 0, 0, + 2, 0, 0, 0, 3, 5, 5, 0, + 0, 0, 5, 0, 0, 5, 4, 0, + 0, 0, 0, 5, 0, 0, 5, 0, + 0, 0, 2, 0, 0, 0, 3, 4, + 3, 3, 3, 3, 0, 3, 3, 1, + 1, 1, 1, 1, 1, 1, 0, 1, + 0, 1, 0, 3, 3, 3, 3, 3, + 3, 0, 3, 3, 3, 3, 1, 1, + 1, 0, 0, 4, 4, 4, 4, 4, + 4, 4, 0, 0, 0, 0, 5, 0, + 0, 5, 1, 5, 5, 0, 0 +}; + +static const short _tsip_machine_parser_header_Contact_index_offsets[] = { + 0, 0, 5, 8, 11, 14, 17, 20, + 23, 27, 44, 46, 49, 66, 68, 71, + 76, 80, 82, 85, 94, 98, 99, 101, + 107, 113, 115, 118, 123, 139, 141, 144, + 160, 162, 165, 169, 182, 196, 201, 203, + 206, 213, 215, 218, 223, 227, 243, 258, + 264, 265, 271, 286, 288, 291, 305, 320, + 327, 329, 332, 338, 353, 355, 358, 373, + 375, 378, 382, 389, 391, 394, 400, 404, + 418, 423, 429, 435, 441, 444, 449, 456, + 458, 461, 463, 466, 468, 471, 474, 476, + 479, 481, 484, 486, 493, 500, 506, 512, + 518, 524, 527, 531, 538, 545, 552, 554, + 557, 560, 562, 564, 581, 598, 615, 632, + 649, 666, 681, 688, 690, 693, 699, 714, + 716, 719, 734, 741, 754, 768, 773 +}; + +static const unsigned char _tsip_machine_parser_header_Contact_indicies[] = { + 0, 2, 0, 2, 1, 3, 3, 1, + 4, 4, 1, 5, 5, 1, 6, 6, + 1, 7, 7, 1, 2, 2, 1, 2, + 2, 8, 1, 9, 10, 9, 11, 12, + 11, 11, 13, 11, 14, 11, 11, 11, + 15, 11, 15, 1, 16, 1, 17, 17, + 1, 18, 19, 18, 11, 12, 11, 11, + 13, 11, 14, 11, 11, 11, 15, 11, + 15, 1, 20, 1, 21, 21, 1, 21, + 21, 22, 23, 1, 22, 24, 22, 1, + 25, 1, 26, 26, 1, 27, 27, 28, + 29, 28, 28, 28, 28, 1, 27, 27, + 29, 1, 30, 31, 30, 32, 33, 32, + 34, 35, 1, 36, 37, 36, 38, 35, + 1, 39, 1, 40, 40, 1, 40, 40, + 38, 35, 1, 41, 42, 41, 11, 12, + 11, 11, 14, 11, 11, 11, 11, 15, + 11, 15, 1, 43, 1, 44, 44, 1, + 45, 46, 45, 11, 12, 11, 11, 14, + 11, 11, 11, 11, 15, 11, 15, 1, + 47, 1, 48, 48, 1, 48, 48, 23, + 1, 49, 50, 49, 51, 51, 51, 51, + 51, 51, 51, 51, 51, 1, 52, 53, + 52, 51, 51, 51, 54, 51, 51, 51, + 51, 51, 51, 1, 55, 56, 55, 23, + 1, 57, 1, 49, 49, 1, 59, 60, + 61, 1, 1, 1, 58, 62, 1, 58, + 58, 1, 52, 53, 52, 54, 1, 58, + 58, 58, 1, 63, 50, 63, 51, 51, + 51, 51, 64, 65, 51, 64, 64, 64, + 51, 64, 1, 66, 53, 66, 51, 51, + 51, 65, 54, 51, 51, 51, 51, 51, + 51, 1, 67, 56, 67, 65, 23, 1, + 68, 69, 70, 69, 71, 72, 68, 35, + 73, 35, 74, 74, 74, 75, 75, 74, + 74, 74, 74, 74, 74, 1, 76, 1, + 77, 77, 1, 77, 77, 74, 74, 74, + 75, 75, 74, 74, 74, 74, 74, 74, + 1, 78, 79, 78, 80, 80, 80, 81, + 82, 83, 80, 80, 80, 80, 80, 1, + 84, 85, 84, 38, 35, 83, 1, 86, + 1, 87, 87, 1, 87, 87, 38, 35, + 83, 1, 83, 88, 83, 89, 90, 89, + 89, 91, 89, 89, 89, 89, 89, 89, + 1, 92, 1, 93, 93, 1, 93, 94, + 93, 89, 90, 89, 89, 91, 89, 89, + 89, 89, 89, 89, 1, 95, 1, 96, + 96, 1, 96, 96, 90, 1, 97, 98, + 99, 1, 1, 1, 90, 100, 1, 90, + 90, 1, 101, 79, 101, 81, 82, 1, + 90, 90, 90, 1, 101, 79, 101, 89, + 89, 89, 81, 82, 89, 89, 89, 89, + 89, 1, 103, 102, 102, 102, 1, 105, + 98, 104, 104, 104, 1, 105, 98, 106, + 106, 106, 1, 105, 98, 107, 107, 107, + 1, 105, 98, 1, 109, 108, 102, 102, + 1, 110, 105, 98, 111, 104, 104, 1, + 112, 1, 113, 114, 1, 115, 1, 116, + 117, 1, 118, 1, 98, 119, 1, 98, + 120, 1, 98, 1, 116, 121, 1, 116, + 1, 113, 122, 1, 113, 1, 110, 105, + 98, 123, 106, 106, 1, 110, 105, 98, + 107, 107, 107, 1, 125, 98, 124, 124, + 124, 1, 127, 98, 126, 126, 126, 1, + 127, 98, 128, 128, 128, 1, 127, 98, + 129, 129, 129, 1, 127, 98, 1, 130, + 124, 124, 1, 110, 127, 98, 131, 126, + 126, 1, 110, 127, 98, 132, 128, 128, + 1, 110, 127, 98, 129, 129, 129, 1, + 133, 1, 110, 134, 1, 110, 135, 1, + 110, 1, 109, 1, 78, 79, 78, 80, + 80, 80, 81, 82, 83, 136, 136, 80, + 80, 80, 80, 80, 1, 78, 79, 78, + 80, 80, 80, 81, 82, 83, 137, 137, + 80, 80, 80, 80, 80, 1, 78, 79, + 78, 80, 80, 80, 81, 82, 83, 138, + 138, 80, 80, 80, 80, 80, 1, 78, + 79, 78, 80, 80, 80, 81, 82, 83, + 139, 139, 80, 80, 80, 80, 80, 1, + 78, 79, 78, 80, 80, 80, 81, 82, + 83, 140, 140, 80, 80, 80, 80, 80, + 1, 78, 79, 78, 80, 80, 80, 81, + 82, 83, 141, 141, 80, 80, 80, 80, + 80, 1, 142, 79, 142, 80, 80, 80, + 81, 82, 143, 80, 80, 80, 80, 80, + 1, 144, 145, 144, 38, 35, 143, 1, + 146, 1, 147, 147, 1, 147, 147, 38, + 35, 143, 1, 143, 148, 143, 89, 90, + 89, 89, 91, 89, 89, 89, 149, 89, + 89, 1, 150, 1, 151, 151, 1, 151, + 94, 151, 89, 90, 89, 89, 91, 89, + 89, 89, 149, 89, 89, 1, 152, 153, + 152, 154, 156, 155, 1, 157, 24, 157, + 51, 51, 51, 51, 51, 51, 51, 51, + 51, 1, 158, 24, 158, 51, 51, 51, + 54, 51, 51, 51, 51, 51, 51, 1, + 159, 24, 159, 23, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Contact_trans_targs[] = { + 2, 0, 8, 3, 4, 5, 6, 7, + 9, 9, 10, 35, 40, 123, 18, 45, + 11, 12, 12, 13, 14, 15, 16, 18, + 17, 126, 19, 20, 19, 21, 22, 23, + 24, 17, 28, 50, 24, 25, 28, 26, + 27, 28, 29, 30, 31, 31, 32, 33, + 34, 36, 38, 35, 37, 32, 18, 37, + 32, 39, 40, 41, 43, 44, 42, 46, + 45, 48, 47, 47, 49, 24, 17, 28, + 50, 51, 54, 107, 52, 53, 55, 17, + 54, 28, 50, 59, 55, 56, 57, 58, + 60, 71, 66, 72, 61, 62, 63, 64, + 65, 67, 69, 70, 68, 24, 73, 106, + 74, 77, 75, 76, 78, 93, 79, 91, + 80, 81, 89, 82, 83, 87, 84, 85, + 86, 88, 90, 92, 94, 102, 95, 98, + 96, 97, 99, 100, 101, 103, 104, 105, + 108, 109, 110, 111, 112, 113, 114, 118, + 114, 115, 116, 117, 119, 122, 120, 121, + 24, 17, 28, 122, 50, 124, 125, 125 +}; + +static const char _tsip_machine_parser_header_Contact_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 3, 3, 17, 17, 17, 3, 17, + 0, 0, 3, 3, 0, 0, 0, 0, + 0, 15, 1, 0, 0, 0, 0, 7, + 13, 13, 13, 0, 0, 0, 0, 0, + 0, 3, 3, 0, 0, 3, 3, 0, + 0, 0, 0, 0, 5, 5, 5, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 0, 20, 20, 20, + 7, 0, 1, 1, 0, 0, 26, 26, + 0, 26, 11, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 26, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 26, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 23, 23, 23, 0, 9, 0, 5, 0 +}; + +static const int tsip_machine_parser_header_Contact_start = 1; +static const int tsip_machine_parser_header_Contact_first_final = 126; +static const int tsip_machine_parser_header_Contact_error = 0; + +static const int tsip_machine_parser_header_Contact_en_main = 1; + + +/* #line 151 "./ragel/tsip_parser_header_Contact.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Contact_first_final); + (void)(tsip_machine_parser_header_Contact_error); + (void)(tsip_machine_parser_header_Contact_en_main); + +/* #line 442 "./src/headers/tsip_header_Contact.c" */ + { + cs = tsip_machine_parser_header_Contact_start; + } + +/* #line 156 "./ragel/tsip_parser_header_Contact.rl" */ + +/* #line 449 "./src/headers/tsip_header_Contact.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Contact_trans_keys + _tsip_machine_parser_header_Contact_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Contact_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Contact_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Contact_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Contact_indicies[_trans]; + cs = _tsip_machine_parser_header_Contact_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Contact_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Contact_actions + _tsip_machine_parser_header_Contact_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 48 "./ragel/tsip_parser_header_Contact.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 52 "./ragel/tsip_parser_header_Contact.rl" */ + { + if(!curr_contact){ + curr_contact = tsip_header_Contact_create(); + } + } + break; + case 2: +/* #line 58 "./ragel/tsip_parser_header_Contact.rl" */ + { + if(curr_contact){ + TSK_PARSER_SET_STRING(curr_contact->display_name); + tsk_strunquote(&curr_contact->display_name); + } + } + break; + case 3: +/* #line 65 "./ragel/tsip_parser_header_Contact.rl" */ + { + if(curr_contact && !curr_contact->uri){ + int len = (int)(p - tag_start); + if((curr_contact->uri = tsip_uri_parse(tag_start, (tsk_size_t)len)) && curr_contact->display_name){ + curr_contact->uri->display_name = tsk_strdup(curr_contact->display_name); + } + } + } + break; + case 4: +/* #line 74 "./ragel/tsip_parser_header_Contact.rl" */ + { + if(curr_contact){ + TSK_PARSER_SET_INTEGER(curr_contact->expires); + } + } + break; + case 5: +/* #line 80 "./ragel/tsip_parser_header_Contact.rl" */ + { + if(curr_contact){ + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(curr_contact)); + } + } + break; + case 6: +/* #line 86 "./ragel/tsip_parser_header_Contact.rl" */ + { + if(curr_contact){ + tsk_list_push_back_data(hdr_contacts, ((void**) &curr_contact)); + } + } + break; + case 7: +/* #line 92 "./ragel/tsip_parser_header_Contact.rl" */ + { + } + break; +/* #line 586 "./src/headers/tsip_header_Contact.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 157 "./ragel/tsip_parser_header_Contact.rl" */ + + if( cs < +/* #line 602 "./src/headers/tsip_header_Contact.c" */ +126 +/* #line 158 "./ragel/tsip_parser_header_Contact.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse SIP 'Contact' header."); + TSK_OBJECT_SAFE_FREE(curr_contact); + TSK_OBJECT_SAFE_FREE(hdr_contacts); + } + + return hdr_contacts; +} + + + + +//======================================================== +// Contact header object definition +// + +static tsk_object_t* tsip_header_Contact_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Contact_t *Contact = self; + if(Contact){ + TSIP_HEADER(Contact)->type = tsip_htype_Contact; + TSIP_HEADER(Contact)->serialize = tsip_header_Contact_serialize; + Contact->expires = -1; + } + else{ + TSK_DEBUG_ERROR("Failed to create new Contact header."); + } + return self; +} + +static tsk_object_t* tsip_header_Contact_dtor(tsk_object_t *self) +{ + tsip_header_Contact_t *Contact = self; + if(Contact){ + TSK_FREE(Contact->display_name); + TSK_OBJECT_SAFE_FREE(Contact->uri); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Contact)); + } + else{ + TSK_DEBUG_ERROR("Null Contact header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Contact_def_s = +{ + sizeof(tsip_header_Contact_t), + tsip_header_Contact_ctor, + tsip_header_Contact_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Contact_def_t = &tsip_header_Contact_def_s; + + +////======================================================== +//// Contact object definition +//// +// +///**@ingroup tsip_header_Contact_group +//*/ +//static tsk_object_t* tsip_contact_ctor(tsk_object_t *self, va_list * app) +//{ +// tsip_contact_t *contact = self; +// if(contact) +// { +// contact->expires = -1; +// } +// else +// { +// TSK_DEBUG_ERROR("Failed to create new Contact object."); +// } +// return self; +//} +// +//static tsk_object_t* tsip_contact_dtor(tsk_object_t *self) +//{ +// tsip_contact_t *contact = self; +// if(contact) +// { +// TSK_FREE(contact->display_name); +// TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(contact)); +// +// TSK_OBJECT_SAFE_FREE(contact->uri); +// } +// else TSK_DEBUG_ERROR("Null Contact object."); +// +// return self; +//} +// +//static const tsk_object_def_t tsip_contact_def_s = +//{ +// sizeof(tsip_contact_t), +// tsip_contact_ctor, +// tsip_contact_dtor, +// 0 +//}; +//const void *tsip_contact_def_t = &tsip_contact_def_s; diff --git a/tinySIP/src/headers/tsip_header_Content_Disposition.c b/tinySIP/src/headers/tsip_header_Content_Disposition.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Content_Disposition.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Content_Encoding.c b/tinySIP/src/headers/tsip_header_Content_Encoding.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Content_Encoding.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Content_Language.c b/tinySIP/src/headers/tsip_header_Content_Language.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Content_Language.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Content_Length.c b/tinySIP/src/headers/tsip_header_Content_Length.c new file mode 100644 index 0000000..d209be8 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Content_Length.c @@ -0,0 +1,325 @@ + +/* #line 1 "./ragel/tsip_parser_header_Content_Length.rl" */ +/* +* 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 tsip_header_Content_Length.c + * @brief SIP Content-Length/l header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Content_Length.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 62 "./ragel/tsip_parser_header_Content_Length.rl" */ + + + +tsip_header_Content_Length_t* tsip_header_Content_Length_create(uint32_t length) +{ + return tsk_object_new(TSIP_HEADER_CONTENT_LENGTH_VA_ARGS(length)); +} + +tsip_header_Content_Length_t* tsip_header_Content_Length_create_null() +{ + return tsip_header_Content_Length_create(0); +} + +int tsip_header_Content_Length_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Content_Length_t *Content_Length = (const tsip_header_Content_Length_t *)header; + return tsk_buffer_append_2(output, "%u", Content_Length->length); + } + + return -1; +} + +tsip_header_Content_Length_t *tsip_header_Content_Length_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Content_Length_t *hdr_clength = tsip_header_Content_Length_create(0); + + const char *tag_start = tsk_null; + + +/* #line 79 "./src/headers/tsip_header_Content_Length.c" */ +static const char _tsip_machine_parser_header_Content_Length_actions[] = { + 0, 1, 0, 1, 1, 1, 2 +}; + +static const char _tsip_machine_parser_header_Content_Length_key_offsets[] = { + 0, 0, 4, 6, 8, 10, 12, 14, + 16, 17, 19, 21, 23, 25, 27, 29, + 32, 37, 38, 40, 44, 47, 48 +}; + +static const char _tsip_machine_parser_header_Content_Length_trans_keys[] = { + 67, 76, 99, 108, 79, 111, 78, 110, + 84, 116, 69, 101, 78, 110, 84, 116, + 45, 76, 108, 69, 101, 78, 110, 71, + 103, 84, 116, 72, 104, 9, 32, 58, + 9, 13, 32, 48, 57, 10, 9, 32, + 9, 32, 48, 57, 13, 48, 57, 10, + 0 +}; + +static const char _tsip_machine_parser_header_Content_Length_single_lengths[] = { + 0, 4, 2, 2, 2, 2, 2, 2, + 1, 2, 2, 2, 2, 2, 2, 3, + 3, 1, 2, 2, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Content_Length_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 1, 1, 0, 0 +}; + +static const char _tsip_machine_parser_header_Content_Length_index_offsets[] = { + 0, 0, 5, 8, 11, 14, 17, 20, + 23, 25, 28, 31, 34, 37, 40, 43, + 47, 52, 54, 57, 61, 64, 66 +}; + +static const char _tsip_machine_parser_header_Content_Length_indicies[] = { + 0, 2, 0, 2, 1, 3, 3, 1, + 4, 4, 1, 5, 5, 1, 6, 6, + 1, 7, 7, 1, 8, 8, 1, 9, + 1, 10, 10, 1, 11, 11, 1, 12, + 12, 1, 13, 13, 1, 14, 14, 1, + 2, 2, 1, 2, 2, 15, 1, 15, + 16, 15, 17, 1, 18, 1, 19, 19, + 1, 19, 19, 17, 1, 20, 21, 1, + 22, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Content_Length_trans_targs[] = { + 2, 0, 15, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 16, + 17, 20, 18, 19, 21, 20, 22 +}; + +static const char _tsip_machine_parser_header_Content_Length_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 3, 0, 5 +}; + +static const int tsip_machine_parser_header_Content_Length_start = 1; +static const int tsip_machine_parser_header_Content_Length_first_final = 22; +static const int tsip_machine_parser_header_Content_Length_error = 0; + +static const int tsip_machine_parser_header_Content_Length_en_main = 1; + + +/* #line 96 "./ragel/tsip_parser_header_Content_Length.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Content_Length_first_final); + (void)(tsip_machine_parser_header_Content_Length_error); + (void)(tsip_machine_parser_header_Content_Length_en_main); + +/* #line 155 "./src/headers/tsip_header_Content_Length.c" */ + { + cs = tsip_machine_parser_header_Content_Length_start; + } + +/* #line 101 "./ragel/tsip_parser_header_Content_Length.rl" */ + +/* #line 162 "./src/headers/tsip_header_Content_Length.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Content_Length_trans_keys + _tsip_machine_parser_header_Content_Length_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Content_Length_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Content_Length_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Content_Length_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Content_Length_indicies[_trans]; + cs = _tsip_machine_parser_header_Content_Length_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Content_Length_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Content_Length_actions + _tsip_machine_parser_header_Content_Length_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 46 "./ragel/tsip_parser_header_Content_Length.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 50 "./ragel/tsip_parser_header_Content_Length.rl" */ + { + TSK_PARSER_SET_INTEGER(hdr_clength->length); + } + break; + case 2: +/* #line 54 "./ragel/tsip_parser_header_Content_Length.rl" */ + { + } + break; +/* #line 253 "./src/headers/tsip_header_Content_Length.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 102 "./ragel/tsip_parser_header_Content_Length.rl" */ + + if( cs < +/* #line 269 "./src/headers/tsip_header_Content_Length.c" */ +22 +/* #line 103 "./ragel/tsip_parser_header_Content_Length.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse SIP 'Content-Length' header."); + TSK_OBJECT_SAFE_FREE(hdr_clength); + } + + return hdr_clength; +} + + + + + + + +//======================================================== +// Content_Length header object definition +// + +static tsk_object_t* tsip_header_Content_Length_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Content_Length_t *Content_Length = self; + if(Content_Length){ + Content_Length->length = va_arg(*app, uint32_t); + + TSIP_HEADER(Content_Length)->type = tsip_htype_Content_Length; + TSIP_HEADER(Content_Length)->serialize = tsip_header_Content_Length_serialize; + } + else{ + TSK_DEBUG_ERROR("Failed to create new Content_Length header."); + } + return self; +} + +static tsk_object_t* tsip_header_Content_Length_dtor(tsk_object_t *self) +{ + tsip_header_Content_Length_t *Content_Length = self; + if(Content_Length){ + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Content_Length)); + } + else{ + TSK_DEBUG_ERROR("Null Content_Length header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Content_Length_def_s = +{ + sizeof(tsip_header_Content_Length_t), + tsip_header_Content_Length_ctor, + tsip_header_Content_Length_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Content_Length_def_t = &tsip_header_Content_Length_def_s; + diff --git a/tinySIP/src/headers/tsip_header_Content_Type.c b/tinySIP/src/headers/tsip_header_Content_Type.c new file mode 100644 index 0000000..2dda910 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Content_Type.c @@ -0,0 +1,425 @@ + +/* #line 1 "./ragel/tsip_parser_header_Content_Type.rl" */ +/* +* 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 tsip_header_Content_Type.c + * @brief SIP Content-Type/c header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Content_Type.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 81 "./ragel/tsip_parser_header_Content_Type.rl" */ + + +tsip_header_Content_Type_t* tsip_header_Content_Type_create(const char* type) +{ + return tsk_object_new(TSIP_HEADER_CONTENT_TYPE_VA_ARGS(type)); +} + +tsip_header_Content_Type_t* tsip_header_Content_Type_create_null() +{ + return tsip_header_Content_Type_create(tsk_null); +} + +int tsip_header_Content_Type_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Content_Type_t *Content_Type = (const tsip_header_Content_Type_t *)header; + if(Content_Type->type){ + return tsk_buffer_append(output, Content_Type->type, tsk_strlen(Content_Type->type)); + } + else{ + return -2; + } + } + + return -1; +} + +tsip_header_Content_Type_t *tsip_header_Content_Type_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Content_Type_t *hdr_ctype = tsip_header_Content_Type_create_null(); + + const char *tag_start = tsk_null; + + +/* #line 85 "./src/headers/tsip_header_Content_Type.c" */ +static const char _tsip_machine_parser_header_Content_Type_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3 +}; + +static const short _tsip_machine_parser_header_Content_Type_key_offsets[] = { + 0, 0, 2, 7, 10, 27, 28, 30, + 46, 62, 66, 67, 69, 72, 89, 90, + 92, 108, 126, 130, 131, 133, 136, 153, + 154, 156, 172, 190, 194, 195, 197, 200, + 218, 219, 221, 239, 240, 242, 245, 253, + 254, 256, 260, 261, 267, 285, 287, 289, + 291, 293, 295, 296, 298, 300, 302, 304 +}; + +static const char _tsip_machine_parser_header_Content_Type_trans_keys[] = { + 67, 99, 9, 32, 58, 79, 111, 9, + 32, 58, 9, 13, 32, 33, 37, 39, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 10, 9, 32, 9, 32, + 33, 37, 39, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 47, 126, 42, 43, + 45, 57, 65, 90, 95, 122, 9, 13, + 32, 47, 10, 9, 32, 9, 32, 47, + 9, 13, 32, 33, 37, 39, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 10, 9, 32, 9, 32, 33, 37, + 39, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 59, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 59, 10, 9, 32, 9, 32, 59, + 9, 13, 32, 33, 37, 39, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 10, 9, 32, 9, 32, 33, 37, + 39, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 61, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 61, 10, 9, 32, 9, 32, 61, + 9, 13, 32, 33, 34, 37, 39, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 10, 9, 32, 9, 13, 32, + 33, 34, 37, 39, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 10, + 9, 32, 9, 32, 34, 13, 34, 92, + 127, 0, 8, 10, 31, 10, 9, 32, + 9, 13, 32, 59, 10, 0, 9, 11, + 12, 14, 127, 9, 13, 32, 33, 37, + 39, 59, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 78, 110, 84, + 116, 69, 101, 78, 110, 84, 116, 45, + 84, 116, 89, 121, 80, 112, 69, 101, + 0 +}; + +static const char _tsip_machine_parser_header_Content_Type_single_lengths[] = { + 0, 2, 5, 3, 7, 1, 2, 6, + 8, 4, 1, 2, 3, 7, 1, 2, + 6, 8, 4, 1, 2, 3, 7, 1, + 2, 6, 8, 4, 1, 2, 3, 8, + 1, 2, 8, 1, 2, 3, 4, 1, + 2, 4, 1, 0, 8, 2, 2, 2, + 2, 2, 1, 2, 2, 2, 2, 0 +}; + +static const char _tsip_machine_parser_header_Content_Type_range_lengths[] = { + 0, 0, 0, 0, 5, 0, 0, 5, + 4, 0, 0, 0, 0, 5, 0, 0, + 5, 5, 0, 0, 0, 0, 5, 0, + 0, 5, 5, 0, 0, 0, 0, 5, + 0, 0, 5, 0, 0, 0, 2, 0, + 0, 0, 0, 3, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static const short _tsip_machine_parser_header_Content_Type_index_offsets[] = { + 0, 0, 3, 9, 13, 26, 28, 31, + 43, 56, 61, 63, 66, 70, 83, 85, + 88, 100, 114, 119, 121, 124, 128, 141, + 143, 146, 158, 172, 177, 179, 182, 186, + 200, 202, 205, 219, 221, 224, 228, 235, + 237, 240, 245, 247, 251, 265, 268, 271, + 274, 277, 280, 282, 285, 288, 291, 294 +}; + +static const char _tsip_machine_parser_header_Content_Type_indicies[] = { + 0, 0, 1, 2, 2, 3, 4, 4, + 1, 2, 2, 3, 1, 3, 5, 3, + 6, 6, 6, 6, 6, 6, 6, 6, + 6, 1, 7, 1, 8, 8, 1, 8, + 8, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 1, 9, 10, 9, 11, 11, + 11, 12, 11, 11, 11, 11, 11, 1, + 9, 10, 9, 12, 1, 13, 1, 14, + 14, 1, 14, 14, 12, 1, 12, 15, + 12, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 1, 17, 1, 18, 18, 1, + 18, 18, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 1, 19, 20, 19, 16, + 16, 16, 21, 16, 16, 16, 16, 16, + 16, 1, 22, 23, 22, 24, 1, 25, + 1, 26, 26, 1, 26, 26, 24, 1, + 24, 27, 24, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 1, 29, 1, 30, + 30, 1, 30, 30, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 1, 31, 32, + 31, 33, 33, 33, 34, 33, 33, 33, + 33, 33, 33, 1, 31, 32, 31, 34, + 1, 35, 1, 36, 36, 1, 36, 36, + 34, 1, 34, 37, 34, 38, 39, 38, + 38, 38, 38, 38, 38, 38, 38, 1, + 40, 1, 41, 41, 1, 41, 42, 41, + 38, 39, 38, 38, 38, 38, 38, 38, + 38, 38, 1, 43, 1, 44, 44, 1, + 44, 44, 39, 1, 45, 46, 47, 1, + 1, 1, 39, 48, 1, 39, 39, 1, + 49, 50, 49, 51, 1, 52, 1, 39, + 39, 39, 1, 49, 50, 49, 38, 38, + 38, 51, 38, 38, 38, 38, 38, 38, + 1, 53, 53, 1, 54, 54, 1, 55, + 55, 1, 56, 56, 1, 57, 57, 1, + 58, 1, 59, 59, 1, 60, 60, 1, + 61, 61, 1, 2, 2, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Content_Type_trans_targs[] = { + 2, 0, 3, 4, 45, 5, 8, 6, + 7, 9, 10, 8, 13, 11, 12, 14, + 17, 15, 16, 18, 42, 22, 18, 19, + 22, 20, 21, 23, 26, 24, 25, 27, + 28, 26, 31, 29, 30, 32, 44, 38, + 33, 34, 35, 36, 37, 39, 41, 43, + 40, 18, 42, 22, 55, 46, 47, 48, + 49, 50, 51, 52, 53, 54 +}; + +static const char _tsip_machine_parser_header_Content_Type_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 3, 3, 3, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 5, 5, 7, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; + +static const int tsip_machine_parser_header_Content_Type_start = 1; +static const int tsip_machine_parser_header_Content_Type_first_final = 55; +static const int tsip_machine_parser_header_Content_Type_error = 0; + +static const int tsip_machine_parser_header_Content_Type_en_main = 1; + + +/* #line 119 "./ragel/tsip_parser_header_Content_Type.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Content_Type_first_final); + (void)(tsip_machine_parser_header_Content_Type_error); + (void)(tsip_machine_parser_header_Content_Type_en_main); + +/* #line 248 "./src/headers/tsip_header_Content_Type.c" */ + { + cs = tsip_machine_parser_header_Content_Type_start; + } + +/* #line 124 "./ragel/tsip_parser_header_Content_Type.rl" */ + +/* #line 255 "./src/headers/tsip_header_Content_Type.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Content_Type_trans_keys + _tsip_machine_parser_header_Content_Type_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Content_Type_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Content_Type_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Content_Type_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Content_Type_indicies[_trans]; + cs = _tsip_machine_parser_header_Content_Type_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Content_Type_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Content_Type_actions + _tsip_machine_parser_header_Content_Type_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 48 "./ragel/tsip_parser_header_Content_Type.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 52 "./ragel/tsip_parser_header_Content_Type.rl" */ + { + TSK_PARSER_SET_STRING(hdr_ctype->type); + } + break; + case 2: +/* #line 56 "./ragel/tsip_parser_header_Content_Type.rl" */ + { + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(hdr_ctype)); + } + break; + case 3: +/* #line 60 "./ragel/tsip_parser_header_Content_Type.rl" */ + { + } + break; +/* #line 352 "./src/headers/tsip_header_Content_Type.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 125 "./ragel/tsip_parser_header_Content_Type.rl" */ + + if( cs < +/* #line 368 "./src/headers/tsip_header_Content_Type.c" */ +55 +/* #line 126 "./ragel/tsip_parser_header_Content_Type.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse SIP 'Content-Type' header."); + TSK_OBJECT_SAFE_FREE(hdr_ctype); + } + + return hdr_ctype; +} + + + + + + + +//======================================================== +// Content_Type header object definition +// + +static tsk_object_t* tsip_header_Content_Type_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Content_Type_t *Content_Type = self; + if(Content_Type){ + TSIP_HEADER(Content_Type)->type = tsip_htype_Content_Type; + TSIP_HEADER(Content_Type)->serialize = tsip_header_Content_Type_serialize; + + Content_Type->type = tsk_strdup( va_arg(*app, const char*) ); + } + else{ + TSK_DEBUG_ERROR("Failed to create new Content_Type header."); + } + return self; +} + +static tsk_object_t* tsip_header_Content_Type_dtor(tsk_object_t *self) +{ + tsip_header_Content_Type_t *Content_Type = self; + if(Content_Type){ + TSK_FREE(Content_Type->type); + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Content_Type)); + } + else{ + TSK_DEBUG_ERROR("Null Content_Type header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Content_Type_def_s = +{ + sizeof(tsip_header_Content_Type_t), + tsip_header_Content_Type_ctor, + tsip_header_Content_Type_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Content_Type_def_t = &tsip_header_Content_Type_def_s; + diff --git a/tinySIP/src/headers/tsip_header_Date.c b/tinySIP/src/headers/tsip_header_Date.c new file mode 100644 index 0000000..f457c30 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Date.c @@ -0,0 +1,466 @@ + +/* #line 1 "./ragel/tsip_parser_header_Date.rl" */ +/* +* 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 tsip_header_Date.c + * @brief SIP DUmmy header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Date.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 96 "./ragel/tsip_parser_header_Date.rl" */ + + +tsip_header_Date_t* tsip_header_Date_create(const char* wkday, const char* month, int8_t day, int16_t year, int8_t h, int8_t m, int8_t s) +{ + return tsk_object_new(TSIP_HEADER_DATE_VA_ARGS(wkday, month, day, year, h, m, s)); +} + +tsip_header_Date_t* tsip_header_Date_create_null() +{ + return tsip_header_Date_create(tsk_null, tsk_null, -1, -1, -1, -1, -1); +} + +int tsip_header_Date_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + /* Date: Wed, 28 Apr 2010 23:42:50 GMT */ + if(header){ + const tsip_header_Date_t *Date = (const tsip_header_Date_t *)header; + if(Date->month){ + tsk_buffer_append_2(output, "%s, %d %s %d %d:%d:%d GMT", + Date->wkday, Date->day, Date->month, Date->year, Date->time.h, Date->time.m, Date->time.s); + } + return 0; + } + + return -1; +} + +tsip_header_Date_t *tsip_header_Date_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Date_t *hdr_Date = tsip_header_Date_create_null(); + + const char *tag_start = tsk_null; + + +/* #line 87 "./src/headers/tsip_header_Date.c" */ +static const char _tsip_machine_parser_header_Date_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3, 1, 4, 1, 5, 1, 6, 1, + 7, 1, 8 +}; + +static const unsigned char _tsip_machine_parser_header_Date_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 11, 24, + 25, 27, 39, 41, 43, 44, 45, 47, + 49, 50, 66, 70, 72, 73, 75, 77, + 79, 81, 82, 84, 86, 87, 89, 91, + 92, 94, 96, 97, 99, 101, 103, 104, + 105, 107, 109, 111, 113, 115, 119, 121, + 125, 127, 131, 133, 135, 137, 139, 141, + 143, 145, 147, 151, 153, 157, 159, 161, + 163, 165 +}; + +static const char _tsip_machine_parser_header_Date_trans_keys[] = { + 68, 100, 65, 97, 84, 116, 69, 101, + 9, 32, 58, 9, 13, 32, 70, 77, + 83, 84, 87, 102, 109, 115, 116, 119, + 10, 9, 32, 9, 32, 70, 77, 83, + 84, 87, 102, 109, 115, 116, 119, 82, + 114, 73, 105, 44, 32, 48, 57, 48, + 57, 32, 65, 68, 70, 74, 77, 78, + 79, 83, 97, 100, 102, 106, 109, 110, + 111, 115, 80, 85, 112, 117, 82, 114, + 32, 48, 57, 48, 57, 48, 57, 48, + 57, 32, 48, 57, 48, 57, 58, 48, + 57, 48, 57, 58, 48, 57, 48, 57, + 32, 71, 103, 77, 109, 84, 116, 13, + 10, 71, 103, 69, 101, 67, 99, 69, + 101, 66, 98, 65, 85, 97, 117, 78, + 110, 76, 78, 108, 110, 65, 97, 82, + 89, 114, 121, 79, 111, 86, 118, 67, + 99, 84, 116, 69, 101, 80, 112, 79, + 111, 78, 110, 65, 85, 97, 117, 84, + 116, 72, 85, 104, 117, 85, 117, 69, + 101, 69, 101, 68, 100, 0 +}; + +static const char _tsip_machine_parser_header_Date_single_lengths[] = { + 0, 2, 2, 2, 2, 3, 13, 1, + 2, 12, 2, 2, 1, 1, 0, 0, + 1, 16, 4, 2, 1, 0, 0, 0, + 0, 1, 0, 0, 1, 0, 0, 1, + 0, 0, 1, 2, 2, 2, 1, 1, + 2, 2, 2, 2, 2, 4, 2, 4, + 2, 4, 2, 2, 2, 2, 2, 2, + 2, 2, 4, 2, 4, 2, 2, 2, + 2, 0 +}; + +static const char _tsip_machine_parser_header_Date_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 1, + 0, 0, 0, 0, 0, 1, 1, 1, + 1, 0, 1, 1, 0, 1, 1, 0, + 1, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0 +}; + +static const short _tsip_machine_parser_header_Date_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 16, 30, + 32, 35, 48, 51, 54, 56, 58, 60, + 62, 64, 81, 86, 89, 91, 93, 95, + 97, 99, 101, 103, 105, 107, 109, 111, + 113, 115, 117, 119, 122, 125, 128, 130, + 132, 135, 138, 141, 144, 147, 152, 155, + 160, 163, 168, 171, 174, 177, 180, 183, + 186, 189, 192, 197, 200, 205, 208, 211, + 214, 217 +}; + +static const char _tsip_machine_parser_header_Date_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 4, 4, 5, 1, + 5, 6, 5, 7, 8, 9, 10, 11, + 7, 8, 9, 10, 11, 1, 12, 1, + 13, 13, 1, 13, 13, 7, 8, 9, + 10, 11, 7, 8, 9, 10, 11, 1, + 14, 14, 1, 15, 15, 1, 16, 1, + 17, 1, 18, 1, 19, 1, 20, 1, + 21, 22, 23, 24, 25, 26, 27, 28, + 21, 22, 23, 24, 25, 26, 27, 28, + 1, 29, 30, 29, 30, 1, 31, 31, + 1, 32, 1, 33, 1, 34, 1, 35, + 1, 36, 1, 37, 1, 38, 1, 39, + 1, 40, 1, 41, 1, 42, 1, 43, + 1, 44, 1, 45, 1, 46, 1, 47, + 47, 1, 48, 48, 1, 49, 49, 1, + 50, 1, 51, 1, 31, 31, 1, 52, + 52, 1, 31, 31, 1, 53, 53, 1, + 31, 31, 1, 54, 55, 54, 55, 1, + 31, 31, 1, 31, 31, 31, 31, 1, + 56, 56, 1, 31, 31, 31, 31, 1, + 57, 57, 1, 31, 31, 1, 58, 58, + 1, 31, 31, 1, 59, 59, 1, 31, + 31, 1, 60, 60, 1, 15, 15, 1, + 61, 60, 61, 60, 1, 15, 15, 1, + 62, 63, 62, 63, 1, 15, 15, 1, + 15, 15, 1, 64, 64, 1, 15, 15, + 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Date_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 10, + 56, 58, 60, 63, 8, 9, 11, 12, + 13, 14, 15, 16, 17, 18, 41, 43, + 45, 48, 50, 52, 54, 19, 40, 20, + 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 65, 42, 44, 46, 47, + 49, 51, 53, 55, 57, 59, 61, 62, + 64 +}; + +static const char _tsip_machine_parser_header_Date_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 1, + 1, 1, 1, 1, 0, 0, 0, 0, + 3, 0, 1, 0, 5, 1, 1, 1, + 1, 1, 1, 1, 1, 0, 0, 0, + 7, 1, 0, 0, 0, 9, 1, 0, + 11, 1, 0, 13, 1, 0, 15, 0, + 0, 0, 0, 17, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0 +}; + +static const int tsip_machine_parser_header_Date_start = 1; +static const int tsip_machine_parser_header_Date_first_final = 65; +static const int tsip_machine_parser_header_Date_error = 0; + +static const int tsip_machine_parser_header_Date_en_main = 1; + + +/* #line 134 "./ragel/tsip_parser_header_Date.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Date_first_final); + (void)(tsip_machine_parser_header_Date_error); + (void)(tsip_machine_parser_header_Date_en_main); + +/* #line 234 "./src/headers/tsip_header_Date.c" */ + { + cs = tsip_machine_parser_header_Date_start; + } + +/* #line 139 "./ragel/tsip_parser_header_Date.rl" */ + +/* #line 241 "./src/headers/tsip_header_Date.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Date_trans_keys + _tsip_machine_parser_header_Date_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Date_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Date_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Date_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Date_indicies[_trans]; + cs = _tsip_machine_parser_header_Date_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Date_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Date_actions + _tsip_machine_parser_header_Date_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 50 "./ragel/tsip_parser_header_Date.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 54 "./ragel/tsip_parser_header_Date.rl" */ + { + TSK_PARSER_SET_STRING(hdr_Date->wkday); + } + break; + case 2: +/* #line 58 "./ragel/tsip_parser_header_Date.rl" */ + { + TSK_PARSER_SET_INTEGER(hdr_Date->day); + } + break; + case 3: +/* #line 62 "./ragel/tsip_parser_header_Date.rl" */ + { + TSK_PARSER_SET_STRING(hdr_Date->month); + } + break; + case 4: +/* #line 66 "./ragel/tsip_parser_header_Date.rl" */ + { + TSK_PARSER_SET_INTEGER(hdr_Date->year); + } + break; + case 5: +/* #line 70 "./ragel/tsip_parser_header_Date.rl" */ + { + TSK_PARSER_SET_INTEGER(hdr_Date->time.h); + } + break; + case 6: +/* #line 74 "./ragel/tsip_parser_header_Date.rl" */ + { + TSK_PARSER_SET_INTEGER(hdr_Date->time.m); + } + break; + case 7: +/* #line 78 "./ragel/tsip_parser_header_Date.rl" */ + { + TSK_PARSER_SET_INTEGER(hdr_Date->time.s); + } + break; + case 8: +/* #line 82 "./ragel/tsip_parser_header_Date.rl" */ + { + } + break; +/* #line 368 "./src/headers/tsip_header_Date.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 140 "./ragel/tsip_parser_header_Date.rl" */ + + if( cs < +/* #line 384 "./src/headers/tsip_header_Date.c" */ +65 +/* #line 141 "./ragel/tsip_parser_header_Date.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Date' header."); + TSK_OBJECT_SAFE_FREE(hdr_Date); + } + + return hdr_Date; +} + + + + + + + +//======================================================== +// Date header object definition +// + +static tsk_object_t* tsip_header_Date_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Date_t *Date = self; + if(Date){ + const char* wkday; + const char* month; + TSIP_HEADER(Date)->type = tsip_htype_Date; + TSIP_HEADER(Date)->serialize = tsip_header_Date_serialize; + Date->day = Date->time.h = Date->time.m = Date->time.s = -1; + Date->year = -1; + + if((wkday = va_arg(*app, const char*))){ + month = va_arg(*app, const char*); + + Date->wkday = tsk_strdup(wkday); + Date->month = tsk_strdup(month); + +#if defined __GNUC__ + Date->day = (int8_t)va_arg(*app, int); + Date->year = (int16_t)va_arg(*app, int); + Date->time.h = (int8_t)va_arg(*app, int); + Date->time.m = (int8_t)va_arg(*app, int); + Date->time.s = (int8_t)va_arg(*app, int); +#else + Date->day = va_arg(*app, int8_t); + Date->year = va_arg(*app, int16_t); + Date->time.h = va_arg(*app, int8_t); + Date->time.m = va_arg(*app, int8_t); + Date->time.s = va_arg(*app, int8_t); +#endif + } + } + else{ + TSK_DEBUG_ERROR("Failed to create new Date header."); + } + return self; +} + +static tsk_object_t* tsip_header_Date_dtor(tsk_object_t *self) +{ + tsip_header_Date_t *Date = self; + if(Date){ + TSK_FREE(Date->wkday); + TSK_FREE(Date->month); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Date)); + } + else{ + TSK_DEBUG_ERROR("Null Date header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Date_def_s = +{ + sizeof(tsip_header_Date_t), + tsip_header_Date_ctor, + tsip_header_Date_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Date_def_t = &tsip_header_Date_def_s; + diff --git a/tinySIP/src/headers/tsip_header_Dummy.c b/tinySIP/src/headers/tsip_header_Dummy.c new file mode 100644 index 0000000..9c5dd18 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Dummy.c @@ -0,0 +1,331 @@ + +/* #line 1 "./ragel/tsip_parser_header_Dummy.rl" */ +/* +* 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 tsip_header_Dummy.c + * @brief SIP DUmmy header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Dummy.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 70 "./ragel/tsip_parser_header_Dummy.rl" */ + + +tsip_header_Dummy_t* tsip_header_Dummy_create(const char* name, const char* value) +{ + return tsk_object_new(TSIP_HEADER_DUMMY_VA_ARGS(name, value)); +} + +tsip_header_Dummy_t* tsip_header_Dummy_create_null() +{ + return tsip_header_Dummy_create(tsk_null, tsk_null); +} + +int tsip_header_Dummy_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Dummy_t *Dummy = (const tsip_header_Dummy_t *)header; + if(Dummy->value){ + tsk_buffer_append(output, Dummy->value, tsk_strlen(Dummy->value)); + } + return 0; + } + + return -1; +} + +tsip_header_Dummy_t *tsip_header_Dummy_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Dummy_t *hdr_Dummy = tsip_header_Dummy_create_null(); + + const char *tag_start = tsk_null; + + +/* #line 85 "./src/headers/tsip_header_Dummy.c" */ +static const char _tsip_machine_parser_header_Dummy_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3, 2, 0, 2 +}; + +static const char _tsip_machine_parser_header_Dummy_key_offsets[] = { + 0, 0, 14, 31, 34, 37, 38, 39, + 40, 42, 45 +}; + +static const char _tsip_machine_parser_header_Dummy_trans_keys[] = { + 33, 37, 39, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 32, + 33, 37, 39, 58, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 9, + 32, 58, 9, 13, 32, 13, 10, 10, + 9, 32, 9, 13, 32, 0 +}; + +static const char _tsip_machine_parser_header_Dummy_single_lengths[] = { + 0, 4, 7, 3, 3, 1, 1, 1, + 2, 3, 0 +}; + +static const char _tsip_machine_parser_header_Dummy_range_lengths[] = { + 0, 5, 5, 0, 0, 0, 0, 0, + 0, 0, 0 +}; + +static const char _tsip_machine_parser_header_Dummy_index_offsets[] = { + 0, 0, 10, 23, 27, 31, 33, 35, + 37, 40, 44 +}; + +static const char _tsip_machine_parser_header_Dummy_indicies[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 2, 2, 3, 3, 3, 4, + 3, 3, 3, 3, 3, 3, 1, 5, + 5, 6, 1, 6, 8, 6, 7, 10, + 9, 11, 1, 12, 1, 13, 13, 1, + 13, 14, 13, 7, 1, 0 +}; + +static const char _tsip_machine_parser_header_Dummy_trans_targs[] = { + 2, 0, 3, 2, 4, 3, 4, 5, + 7, 5, 6, 10, 8, 9, 6 +}; + +static const char _tsip_machine_parser_header_Dummy_trans_actions[] = { + 1, 0, 3, 0, 3, 0, 0, 1, + 0, 0, 5, 7, 0, 0, 9 +}; + +static const int tsip_machine_parser_header_Dummy_start = 1; +static const int tsip_machine_parser_header_Dummy_first_final = 10; +static const int tsip_machine_parser_header_Dummy_error = 0; + +static const int tsip_machine_parser_header_Dummy_en_main = 1; + + +/* #line 106 "./ragel/tsip_parser_header_Dummy.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Dummy_first_final); + (void)(tsip_machine_parser_header_Dummy_error); + (void)(tsip_machine_parser_header_Dummy_en_main); + +/* #line 152 "./src/headers/tsip_header_Dummy.c" */ + { + cs = tsip_machine_parser_header_Dummy_start; + } + +/* #line 111 "./ragel/tsip_parser_header_Dummy.rl" */ + +/* #line 159 "./src/headers/tsip_header_Dummy.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Dummy_trans_keys + _tsip_machine_parser_header_Dummy_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Dummy_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Dummy_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Dummy_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Dummy_indicies[_trans]; + cs = _tsip_machine_parser_header_Dummy_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Dummy_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Dummy_actions + _tsip_machine_parser_header_Dummy_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 50 "./ragel/tsip_parser_header_Dummy.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 54 "./ragel/tsip_parser_header_Dummy.rl" */ + { + TSK_PARSER_SET_STRING(hdr_Dummy->name); + } + break; + case 2: +/* #line 58 "./ragel/tsip_parser_header_Dummy.rl" */ + { + TSK_PARSER_SET_STRING(hdr_Dummy->value); + } + break; + case 3: +/* #line 62 "./ragel/tsip_parser_header_Dummy.rl" */ + { + } + break; +/* #line 256 "./src/headers/tsip_header_Dummy.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 112 "./ragel/tsip_parser_header_Dummy.rl" */ + + if( cs < +/* #line 272 "./src/headers/tsip_header_Dummy.c" */ +10 +/* #line 113 "./ragel/tsip_parser_header_Dummy.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Dummy' header."); + TSK_OBJECT_SAFE_FREE(hdr_Dummy); + } + + return hdr_Dummy; +} + + + + + + + +//======================================================== +// Dummy header object definition +// + +static tsk_object_t* tsip_header_Dummy_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Dummy_t *Dummy = self; + if(Dummy){ + TSIP_HEADER(Dummy)->type = tsip_htype_Dummy; + TSIP_HEADER(Dummy)->serialize = tsip_header_Dummy_serialize; + + Dummy->name = tsk_strdup(va_arg(*app, const char*)); + Dummy->value = tsk_strdup(va_arg(*app, const char*)); + } + else{ + TSK_DEBUG_ERROR("Failed to create new Dummy header."); + } + return self; +} + +static tsk_object_t* tsip_header_Dummy_dtor(tsk_object_t *self) +{ + tsip_header_Dummy_t *Dummy = self; + if(Dummy){ + TSK_FREE(Dummy->name); + TSK_FREE(Dummy->value); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Dummy)); + } + else{ + TSK_DEBUG_ERROR("Null Dummy header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Dummy_def_s = +{ + sizeof(tsip_header_Dummy_t), + tsip_header_Dummy_ctor, + tsip_header_Dummy_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Dummy_def_t = &tsip_header_Dummy_def_s; diff --git a/tinySIP/src/headers/tsip_header_Error_Info.c b/tinySIP/src/headers/tsip_header_Error_Info.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Error_Info.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Event.c b/tinySIP/src/headers/tsip_header_Event.c new file mode 100644 index 0000000..8268fa5 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Event.c @@ -0,0 +1,462 @@ + +/* #line 1 "./ragel/tsip_parser_header_Event.rl" */ +/* +* 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 tsip_header_Event.c + * @brief SIP Event/o header as per RFC 3265.. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Event.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 75 "./ragel/tsip_parser_header_Event.rl" */ + + + +tsip_header_Event_t* tsip_header_Event_create(const char* package) +{ + return tsk_object_new(TSIP_HEADER_EVENT_VA_ARGS(package)); +} + +int tsip_header_Event_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Event_t *Event = (const tsip_header_Event_t *)header; + if(Event->package){ + return tsk_buffer_append(output, Event->package, tsk_strlen(Event->package)); + } + return 0; + } + + return -1; +} + +tsip_header_Event_t *tsip_header_Event_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Event_t *hdr_event = tsip_header_Event_create(tsk_null); + + const char *tag_start = tsk_null; + + +/* #line 81 "./src/headers/tsip_header_Event.c" */ +static const char _tsip_machine_parser_header_Event_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3 +}; + +static const short _tsip_machine_parser_header_Event_key_offsets[] = { + 0, 0, 4, 6, 8, 10, 12, 15, + 31, 32, 34, 49, 67, 71, 72, 74, + 77, 94, 95, 97, 113, 132, 137, 138, + 140, 144, 163, 164, 166, 185, 186, 188, + 191, 199, 200, 202, 206, 207, 213, 231, + 238, 246, 254, 262, 264, 271, 280, 282, + 285, 287, 290, 292, 295, 298, 299, 302, + 303, 306, 307, 316, 325, 333, 341, 349, + 357, 359, 365, 374, 383, 392, 394, 397, + 400, 401, 402, 415 +}; + +static const char _tsip_machine_parser_header_Event_trans_keys[] = { + 69, 79, 101, 111, 86, 118, 69, 101, + 78, 110, 84, 116, 9, 32, 58, 9, + 13, 32, 33, 37, 39, 45, 126, 42, + 43, 48, 57, 65, 90, 95, 122, 10, + 9, 32, 9, 32, 33, 37, 39, 45, + 126, 42, 43, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 45, + 46, 59, 126, 42, 43, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 59, 10, + 9, 32, 9, 32, 59, 9, 13, 32, + 33, 37, 39, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 10, 9, + 32, 9, 32, 33, 37, 39, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 59, + 61, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 59, + 61, 10, 9, 32, 9, 32, 59, 61, + 9, 13, 32, 33, 34, 37, 39, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 10, 9, 32, 9, 13, + 32, 33, 34, 37, 39, 91, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 10, 9, 32, 9, 32, 34, 13, + 34, 92, 127, 0, 8, 10, 31, 10, + 9, 32, 9, 13, 32, 59, 10, 0, + 9, 11, 12, 14, 127, 9, 13, 32, + 33, 37, 39, 59, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 58, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 58, 48, 57, 65, 70, 97, 102, 46, + 58, 93, 48, 57, 65, 70, 97, 102, + 48, 57, 46, 48, 57, 48, 57, 46, + 48, 57, 48, 57, 93, 48, 57, 93, + 48, 57, 93, 46, 48, 57, 46, 46, + 48, 57, 46, 46, 58, 93, 48, 57, + 65, 70, 97, 102, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 58, 93, 48, + 57, 65, 70, 97, 102, 58, 93, 48, + 57, 65, 70, 97, 102, 58, 93, 48, + 57, 65, 70, 97, 102, 58, 93, 48, + 57, 65, 70, 97, 102, 58, 93, 48, + 57, 65, 70, 97, 102, 46, 58, 93, + 48, 57, 65, 70, 97, 102, 46, 58, + 93, 48, 57, 65, 70, 97, 102, 46, + 58, 93, 48, 57, 65, 70, 97, 102, + 48, 57, 46, 48, 57, 46, 48, 57, + 46, 58, 33, 37, 39, 45, 126, 42, + 43, 48, 57, 65, 90, 95, 122, 0 +}; + +static const char _tsip_machine_parser_header_Event_single_lengths[] = { + 0, 4, 2, 2, 2, 2, 3, 8, + 1, 2, 7, 10, 4, 1, 2, 3, + 7, 1, 2, 6, 9, 5, 1, 2, + 4, 9, 1, 2, 9, 1, 2, 3, + 4, 1, 2, 4, 1, 0, 8, 1, + 2, 2, 2, 2, 1, 3, 0, 1, + 0, 1, 0, 1, 1, 1, 1, 1, + 1, 1, 3, 3, 2, 2, 2, 2, + 2, 0, 3, 3, 3, 0, 1, 1, + 1, 1, 5, 0 +}; + +static const char _tsip_machine_parser_header_Event_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 4, + 0, 0, 4, 4, 0, 0, 0, 0, + 5, 0, 0, 5, 5, 0, 0, 0, + 0, 5, 0, 0, 5, 0, 0, 0, + 2, 0, 0, 0, 0, 3, 5, 3, + 3, 3, 3, 0, 3, 3, 1, 1, + 1, 1, 1, 1, 1, 0, 1, 0, + 1, 0, 3, 3, 3, 3, 3, 3, + 0, 3, 3, 3, 3, 1, 1, 1, + 0, 0, 4, 0 +}; + +static const short _tsip_machine_parser_header_Event_index_offsets[] = { + 0, 0, 5, 8, 11, 14, 17, 21, + 34, 36, 39, 51, 66, 71, 73, 76, + 80, 93, 95, 98, 110, 125, 131, 133, + 136, 141, 156, 158, 161, 176, 178, 181, + 185, 192, 194, 197, 202, 204, 208, 222, + 227, 233, 239, 245, 248, 253, 260, 262, + 265, 267, 270, 272, 275, 278, 280, 283, + 285, 288, 290, 297, 304, 310, 316, 322, + 328, 331, 335, 342, 349, 356, 358, 361, + 364, 366, 368, 378 +}; + +static const char _tsip_machine_parser_header_Event_indicies[] = { + 0, 2, 0, 2, 1, 3, 3, 1, + 4, 4, 1, 5, 5, 1, 2, 2, + 1, 2, 2, 6, 1, 6, 7, 6, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 1, 9, 1, 10, 10, 1, 10, + 10, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 1, 11, 12, 11, 13, 13, + 13, 13, 14, 15, 13, 13, 13, 13, + 13, 1, 16, 17, 16, 18, 1, 19, + 1, 20, 20, 1, 20, 20, 18, 1, + 18, 21, 18, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 1, 23, 1, 24, + 24, 1, 24, 24, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 1, 25, 26, + 25, 27, 27, 27, 28, 29, 27, 27, + 27, 27, 27, 27, 1, 30, 31, 30, + 18, 29, 1, 32, 1, 33, 33, 1, + 33, 33, 18, 29, 1, 29, 34, 29, + 35, 36, 35, 35, 37, 35, 35, 35, + 35, 35, 35, 1, 38, 1, 39, 39, + 1, 39, 40, 39, 35, 36, 35, 35, + 37, 35, 35, 35, 35, 35, 35, 1, + 41, 1, 42, 42, 1, 42, 42, 36, + 1, 43, 44, 45, 1, 1, 1, 36, + 46, 1, 36, 36, 1, 47, 26, 47, + 28, 1, 48, 1, 36, 36, 36, 1, + 47, 26, 47, 35, 35, 35, 28, 35, + 35, 35, 35, 35, 35, 1, 50, 49, + 49, 49, 1, 52, 44, 51, 51, 51, + 1, 52, 44, 53, 53, 53, 1, 52, + 44, 54, 54, 54, 1, 52, 44, 1, + 56, 55, 49, 49, 1, 57, 52, 44, + 58, 51, 51, 1, 59, 1, 60, 61, + 1, 62, 1, 63, 64, 1, 65, 1, + 44, 66, 1, 44, 67, 1, 44, 1, + 63, 68, 1, 63, 1, 60, 69, 1, + 60, 1, 57, 52, 44, 70, 53, 53, + 1, 57, 52, 44, 54, 54, 54, 1, + 72, 44, 71, 71, 71, 1, 74, 44, + 73, 73, 73, 1, 74, 44, 75, 75, + 75, 1, 74, 44, 76, 76, 76, 1, + 74, 44, 1, 77, 71, 71, 1, 57, + 74, 44, 78, 73, 73, 1, 57, 74, + 44, 79, 75, 75, 1, 57, 74, 44, + 76, 76, 76, 1, 80, 1, 57, 81, + 1, 57, 82, 1, 57, 1, 56, 1, + 13, 13, 13, 13, 13, 13, 13, 13, + 13, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Event_trans_targs[] = { + 2, 0, 6, 3, 4, 5, 7, 8, + 11, 9, 10, 12, 36, 11, 74, 16, + 12, 13, 16, 14, 15, 17, 20, 18, + 19, 21, 36, 20, 16, 25, 21, 22, + 23, 24, 26, 38, 32, 39, 27, 28, + 29, 30, 31, 33, 35, 37, 34, 12, + 75, 40, 73, 41, 44, 42, 43, 45, + 60, 46, 58, 47, 48, 56, 49, 50, + 54, 51, 52, 53, 55, 57, 59, 61, + 69, 62, 65, 63, 64, 66, 67, 68, + 70, 71, 72 +}; + +static const char _tsip_machine_parser_header_Event_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 3, 3, 0, 0, 3, + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 5, 5, 0, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 5, + 7, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0 +}; + +static const int tsip_machine_parser_header_Event_start = 1; +static const int tsip_machine_parser_header_Event_first_final = 75; +static const int tsip_machine_parser_header_Event_error = 0; + +static const int tsip_machine_parser_header_Event_en_main = 1; + + +/* #line 107 "./ragel/tsip_parser_header_Event.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Event_first_final); + (void)(tsip_machine_parser_header_Event_error); + (void)(tsip_machine_parser_header_Event_en_main); + +/* #line 286 "./src/headers/tsip_header_Event.c" */ + { + cs = tsip_machine_parser_header_Event_start; + } + +/* #line 112 "./ragel/tsip_parser_header_Event.rl" */ + +/* #line 293 "./src/headers/tsip_header_Event.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Event_trans_keys + _tsip_machine_parser_header_Event_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Event_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Event_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Event_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Event_indicies[_trans]; + cs = _tsip_machine_parser_header_Event_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Event_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Event_actions + _tsip_machine_parser_header_Event_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 50 "./ragel/tsip_parser_header_Event.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 54 "./ragel/tsip_parser_header_Event.rl" */ + { + TSK_PARSER_SET_STRING(hdr_event->package); + } + break; + case 2: +/* #line 58 "./ragel/tsip_parser_header_Event.rl" */ + { + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(hdr_event)); + } + break; + case 3: +/* #line 62 "./ragel/tsip_parser_header_Event.rl" */ + { + } + break; +/* #line 390 "./src/headers/tsip_header_Event.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 113 "./ragel/tsip_parser_header_Event.rl" */ + + if( cs < +/* #line 406 "./src/headers/tsip_header_Event.c" */ +75 +/* #line 114 "./ragel/tsip_parser_header_Event.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Event' header."); + TSK_OBJECT_SAFE_FREE(hdr_event); + } + + return hdr_event; +} + + + + + + + +//======================================================== +// Event header object definition +// + +static tsk_object_t* tsip_header_Event_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Event_t *Event = self; + if(Event){ + TSIP_HEADER(Event)->type = tsip_htype_Event; + TSIP_HEADER(Event)->serialize = tsip_header_Event_serialize; + Event->package = tsk_strdup(va_arg(*app, const char*)); + } + else{ + TSK_DEBUG_ERROR("Failed to create new Event header."); + } + return self; +} + +static tsk_object_t* tsip_header_Event_dtor(tsk_object_t *self) +{ + tsip_header_Event_t *Event = self; + if(Event){ + TSK_FREE(Event->package); + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Event)); + } + else{ + TSK_DEBUG_ERROR("Null Event header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Event_def_s = +{ + sizeof(tsip_header_Event_t), + tsip_header_Event_ctor, + tsip_header_Event_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Event_def_t = &tsip_header_Event_def_s; + diff --git a/tinySIP/src/headers/tsip_header_Expires.c b/tinySIP/src/headers/tsip_header_Expires.c new file mode 100644 index 0000000..8516b74 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Expires.c @@ -0,0 +1,312 @@ + +/* #line 1 "./ragel/tsip_parser_header_Expires.rl" */ +/* +* 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 tsip_header_Expires.c + * @brief SIP Expires header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Expires.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 64 "./ragel/tsip_parser_header_Expires.rl" */ + + +tsip_header_Expires_t* tsip_header_Expires_create(int64_t delta_seconds) +{ + return tsk_object_new(TSIP_HEADER_EXPIRES_VA_ARGS(delta_seconds)); +} + +int tsip_header_Expires_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Expires_t *Expires = (const tsip_header_Expires_t *)header; + if(Expires->delta_seconds >=0){ + return tsk_buffer_append_2(output, "%lld", Expires->delta_seconds); + } + return 0; + } + + return -1; +} + +tsip_header_Expires_t *tsip_header_Expires_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Expires_t *hdr_expires = tsip_header_Expires_create(TSIP_HEADER_EXPIRES_NONE); + + const char *tag_start = tsk_null; + + +/* #line 78 "./src/headers/tsip_header_Expires.c" */ +static const char _tsip_machine_parser_header_Expires_actions[] = { + 0, 1, 0, 1, 1, 1, 2 +}; + +static const char _tsip_machine_parser_header_Expires_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 12, + 14, 17, 22, 23, 25, 29, 32, 33 +}; + +static const char _tsip_machine_parser_header_Expires_trans_keys[] = { + 69, 101, 88, 120, 80, 112, 73, 105, + 82, 114, 69, 101, 83, 115, 9, 32, + 58, 9, 13, 32, 48, 57, 10, 9, + 32, 9, 32, 48, 57, 13, 48, 57, + 10, 0 +}; + +static const char _tsip_machine_parser_header_Expires_single_lengths[] = { + 0, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 1, 2, 2, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Expires_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 1, 1, 0, 0 +}; + +static const char _tsip_machine_parser_header_Expires_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 15, 18, + 21, 25, 30, 32, 35, 39, 42, 44 +}; + +static const char _tsip_machine_parser_header_Expires_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 5, 5, 1, 6, + 6, 1, 7, 7, 1, 7, 7, 8, + 1, 8, 9, 8, 10, 1, 11, 1, + 12, 12, 1, 12, 12, 10, 1, 13, + 14, 1, 15, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Expires_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 13, 11, 12, 14, 13, 15 +}; + +static const char _tsip_machine_parser_header_Expires_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 3, 0, 5 +}; + +static const int tsip_machine_parser_header_Expires_start = 1; +static const int tsip_machine_parser_header_Expires_first_final = 15; +static const int tsip_machine_parser_header_Expires_error = 0; + +static const int tsip_machine_parser_header_Expires_en_main = 1; + + +/* #line 95 "./ragel/tsip_parser_header_Expires.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Expires_first_final); + (void)(tsip_machine_parser_header_Expires_error); + (void)(tsip_machine_parser_header_Expires_en_main); + +/* #line 143 "./src/headers/tsip_header_Expires.c" */ + { + cs = tsip_machine_parser_header_Expires_start; + } + +/* #line 100 "./ragel/tsip_parser_header_Expires.rl" */ + +/* #line 150 "./src/headers/tsip_header_Expires.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Expires_trans_keys + _tsip_machine_parser_header_Expires_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Expires_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Expires_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Expires_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Expires_indicies[_trans]; + cs = _tsip_machine_parser_header_Expires_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Expires_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Expires_actions + _tsip_machine_parser_header_Expires_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 48 "./ragel/tsip_parser_header_Expires.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 52 "./ragel/tsip_parser_header_Expires.rl" */ + { + TSK_PARSER_SET_INTEGER(hdr_expires->delta_seconds); + } + break; + case 2: +/* #line 56 "./ragel/tsip_parser_header_Expires.rl" */ + { + } + break; +/* #line 241 "./src/headers/tsip_header_Expires.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 101 "./ragel/tsip_parser_header_Expires.rl" */ + + if( cs < +/* #line 257 "./src/headers/tsip_header_Expires.c" */ +15 +/* #line 102 "./ragel/tsip_parser_header_Expires.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Expires' header."); + TSK_OBJECT_SAFE_FREE(hdr_expires); + } + + return hdr_expires; +} + + + + + + + +//======================================================== +// Expires header object definition +// + +static tsk_object_t* tsip_header_Expires_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Expires_t *Expires = self; + if(Expires){ + TSIP_HEADER(Expires)->type = tsip_htype_Expires; + TSIP_HEADER(Expires)->serialize = tsip_header_Expires_serialize; + Expires->delta_seconds = va_arg(*app, int64_t); + } + else{ + TSK_DEBUG_ERROR("Failed to create new Expires header."); + } + return self; +} + +static tsk_object_t* tsip_header_Expires_dtor(tsk_object_t *self) +{ + tsip_header_Expires_t *Expires = self; + if(Expires){ + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Expires)); + } + else{ + TSK_DEBUG_ERROR("Null Expires header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Expires_def_s = +{ + sizeof(tsip_header_Expires_t), + tsip_header_Expires_ctor, + tsip_header_Expires_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Expires_def_t = &tsip_header_Expires_def_s; + diff --git a/tinySIP/src/headers/tsip_header_From.c b/tinySIP/src/headers/tsip_header_From.c new file mode 100644 index 0000000..1877356 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_From.c @@ -0,0 +1,581 @@ + +/* #line 1 "./ragel/tsip_parser_header_From.rl" */ +/* +* 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 tsip_header_From.c + * @brief SIP From/f header as per RFC 3261 subclause 20.20. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_From.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 89 "./ragel/tsip_parser_header_From.rl" */ + + + +tsip_header_From_t* tsip_header_From_create(const char* display_name, const tsip_uri_t* uri, const char* tag) +{ + return tsk_object_new(TSIP_HEADER_FROM_VA_ARGS(display_name, uri, tag)); +} + +int tsip_header_From_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + int ret = -1; + if(header){ + const tsip_header_From_t *From = (const tsip_header_From_t *)header; + + /* Uri with hacked display-name*/ + if((ret = tsip_uri_serialize(From->uri, tsk_true, tsk_true, output))){ + return ret; + } + if(From->tag){ + ret = tsk_buffer_append_2(output, ";tag=%s", From->tag); + } + } + return ret; +} + +tsip_header_From_t *tsip_header_From_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_From_t *hdr_from = tsip_header_From_create(tsk_null, tsk_null, tsk_null); + + const char *tag_start = tsk_null; + + +/* #line 83 "./src/headers/tsip_header_From.c" */ +static const char _tsip_machine_parser_header_From_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3, 1, 4, 1, 5 +}; + +static const short _tsip_machine_parser_header_From_key_offsets[] = { + 0, 0, 2, 7, 10, 31, 32, 34, + 55, 56, 58, 61, 65, 77, 80, 80, + 81, 85, 89, 90, 92, 95, 114, 115, + 117, 135, 154, 159, 160, 162, 166, 185, + 186, 188, 207, 208, 210, 213, 221, 222, + 224, 228, 229, 235, 253, 260, 268, 276, + 284, 286, 293, 302, 304, 307, 309, 312, + 314, 317, 320, 321, 324, 325, 328, 329, + 338, 347, 355, 363, 371, 379, 381, 387, + 396, 405, 414, 416, 419, 422, 423, 424, + 445, 466, 485, 490, 491, 493, 497, 516, + 517, 519, 538, 556, 573, 591, 595, 596, + 598, 606, 607, 609, 613, 619, 639, 658, + 663, 663, 667, 669, 671 +}; + +static const char _tsip_machine_parser_header_From_trans_keys[] = { + 70, 102, 9, 32, 58, 82, 114, 9, + 32, 58, 9, 13, 32, 33, 34, 37, + 39, 60, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 10, + 9, 32, 9, 13, 32, 33, 34, 37, + 39, 60, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 10, + 9, 32, 9, 32, 60, 65, 90, 97, + 122, 9, 32, 43, 58, 45, 46, 48, + 57, 65, 90, 97, 122, 9, 32, 58, + 62, 9, 13, 32, 59, 9, 13, 32, + 59, 10, 9, 32, 9, 32, 59, 9, + 13, 32, 33, 37, 39, 84, 116, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 10, 9, 32, 9, 32, 33, + 37, 39, 84, 116, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 59, 61, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 59, 61, 10, + 9, 32, 9, 32, 59, 61, 9, 13, + 32, 33, 34, 37, 39, 91, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 10, 9, 32, 9, 13, 32, 33, + 34, 37, 39, 91, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 10, + 9, 32, 9, 32, 34, 13, 34, 92, + 127, 0, 8, 10, 31, 10, 9, 32, + 9, 13, 32, 59, 10, 0, 9, 11, + 12, 14, 127, 9, 13, 32, 33, 37, + 39, 59, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 58, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 58, 48, + 57, 65, 70, 97, 102, 46, 58, 93, + 48, 57, 65, 70, 97, 102, 48, 57, + 46, 48, 57, 48, 57, 46, 48, 57, + 48, 57, 93, 48, 57, 93, 48, 57, + 93, 46, 48, 57, 46, 46, 48, 57, + 46, 46, 58, 93, 48, 57, 65, 70, + 97, 102, 46, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 46, 58, 93, 48, 57, + 65, 70, 97, 102, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 46, 58, 93, + 48, 57, 65, 70, 97, 102, 48, 57, + 46, 48, 57, 46, 48, 57, 46, 58, + 9, 13, 32, 33, 37, 39, 59, 61, + 65, 97, 126, 42, 43, 45, 46, 48, + 57, 66, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 59, 61, 71, 103, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 59, 61, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 59, 61, 10, 9, 32, 9, 32, 59, + 61, 9, 13, 32, 33, 34, 37, 39, + 91, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 10, 9, 32, 9, + 13, 32, 33, 34, 37, 39, 91, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 59, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 60, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 60, 10, 9, 32, 13, 34, + 92, 127, 0, 8, 10, 31, 10, 9, + 32, 9, 13, 32, 60, 0, 9, 11, + 12, 14, 127, 9, 13, 32, 33, 37, + 39, 42, 43, 58, 126, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 9, + 13, 32, 33, 37, 39, 58, 60, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 58, 60, 9, + 13, 32, 59, 79, 111, 77, 109, 0 +}; + +static const char _tsip_machine_parser_header_From_single_lengths[] = { + 0, 2, 5, 3, 9, 1, 2, 9, + 1, 2, 3, 0, 4, 3, 0, 1, + 4, 4, 1, 2, 3, 9, 1, 2, + 8, 9, 5, 1, 2, 4, 9, 1, + 2, 9, 1, 2, 3, 4, 1, 2, + 4, 1, 0, 8, 1, 2, 2, 2, + 2, 1, 3, 0, 1, 0, 1, 0, + 1, 1, 1, 1, 1, 1, 1, 3, + 3, 2, 2, 2, 2, 2, 0, 3, + 3, 3, 0, 1, 1, 1, 1, 11, + 11, 9, 5, 1, 2, 4, 9, 1, + 2, 9, 8, 7, 8, 4, 1, 2, + 4, 1, 2, 4, 0, 10, 9, 5, + 0, 4, 2, 2, 0 +}; + +static const char _tsip_machine_parser_header_From_range_lengths[] = { + 0, 0, 0, 0, 6, 0, 0, 6, + 0, 0, 0, 2, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 5, 0, 0, + 5, 5, 0, 0, 0, 0, 5, 0, + 0, 5, 0, 0, 0, 2, 0, 0, + 0, 0, 3, 5, 3, 3, 3, 3, + 0, 3, 3, 1, 1, 1, 1, 1, + 1, 1, 0, 1, 0, 1, 0, 3, + 3, 3, 3, 3, 3, 0, 3, 3, + 3, 3, 1, 1, 1, 0, 0, 5, + 5, 5, 0, 0, 0, 0, 5, 0, + 0, 5, 5, 5, 5, 0, 0, 0, + 2, 0, 0, 0, 3, 5, 5, 0, + 0, 0, 0, 0, 0 +}; + +static const short _tsip_machine_parser_header_From_index_offsets[] = { + 0, 0, 3, 9, 13, 29, 31, 34, + 50, 52, 55, 59, 62, 71, 75, 76, + 78, 83, 88, 90, 93, 97, 112, 114, + 117, 131, 146, 152, 154, 157, 162, 177, + 179, 182, 197, 199, 202, 206, 213, 215, + 218, 223, 225, 229, 243, 248, 254, 260, + 266, 269, 274, 281, 283, 286, 288, 291, + 293, 296, 299, 301, 304, 306, 309, 311, + 318, 325, 331, 337, 343, 349, 352, 356, + 363, 370, 377, 379, 382, 385, 387, 389, + 406, 423, 438, 444, 446, 449, 454, 469, + 471, 474, 489, 503, 516, 530, 535, 537, + 540, 547, 549, 552, 557, 561, 577, 592, + 598, 599, 604, 607, 610 +}; + +static const unsigned char _tsip_machine_parser_header_From_indicies[] = { + 0, 0, 1, 2, 2, 3, 4, 4, + 1, 2, 2, 3, 1, 3, 5, 3, + 6, 7, 6, 6, 8, 6, 6, 6, + 6, 9, 6, 9, 1, 10, 1, 11, + 11, 1, 11, 12, 11, 6, 7, 6, + 6, 8, 6, 6, 6, 6, 9, 6, + 9, 1, 13, 1, 14, 14, 1, 14, + 14, 8, 1, 15, 15, 1, 16, 16, + 17, 18, 17, 17, 17, 17, 1, 16, + 16, 18, 1, 19, 20, 19, 21, 22, + 21, 23, 1, 21, 24, 21, 23, 1, + 25, 1, 26, 26, 1, 26, 26, 23, + 1, 23, 27, 23, 28, 28, 28, 29, + 29, 28, 28, 28, 28, 28, 28, 1, + 30, 1, 31, 31, 1, 31, 31, 28, + 28, 28, 29, 29, 28, 28, 28, 28, + 28, 28, 1, 32, 33, 32, 34, 34, + 34, 35, 36, 34, 34, 34, 34, 34, + 34, 1, 37, 38, 37, 23, 36, 1, + 39, 1, 40, 40, 1, 40, 40, 23, + 36, 1, 36, 41, 36, 42, 43, 42, + 42, 44, 42, 42, 42, 42, 42, 42, + 1, 45, 1, 46, 46, 1, 46, 47, + 46, 42, 43, 42, 42, 44, 42, 42, + 42, 42, 42, 42, 1, 48, 1, 49, + 49, 1, 49, 49, 43, 1, 50, 51, + 52, 1, 1, 1, 43, 53, 1, 43, + 43, 1, 54, 33, 54, 35, 1, 55, + 1, 43, 43, 43, 1, 54, 33, 54, + 42, 42, 42, 35, 42, 42, 42, 42, + 42, 42, 1, 57, 56, 56, 56, 1, + 59, 51, 58, 58, 58, 1, 59, 51, + 60, 60, 60, 1, 59, 51, 61, 61, + 61, 1, 59, 51, 1, 63, 62, 56, + 56, 1, 64, 59, 51, 65, 58, 58, + 1, 66, 1, 67, 68, 1, 69, 1, + 70, 71, 1, 72, 1, 51, 73, 1, + 51, 74, 1, 51, 1, 70, 75, 1, + 70, 1, 67, 76, 1, 67, 1, 64, + 59, 51, 77, 60, 60, 1, 64, 59, + 51, 61, 61, 61, 1, 79, 51, 78, + 78, 78, 1, 81, 51, 80, 80, 80, + 1, 81, 51, 82, 82, 82, 1, 81, + 51, 83, 83, 83, 1, 81, 51, 1, + 84, 78, 78, 1, 64, 81, 51, 85, + 80, 80, 1, 64, 81, 51, 86, 82, + 82, 1, 64, 81, 51, 83, 83, 83, + 1, 87, 1, 64, 88, 1, 64, 89, + 1, 64, 1, 63, 1, 32, 33, 32, + 34, 34, 34, 35, 36, 90, 90, 34, + 34, 34, 34, 34, 34, 1, 32, 33, + 32, 34, 34, 34, 35, 36, 91, 91, + 34, 34, 34, 34, 34, 34, 1, 92, + 33, 92, 34, 34, 34, 35, 93, 34, + 34, 34, 34, 34, 34, 1, 94, 95, + 94, 23, 93, 1, 96, 1, 97, 97, + 1, 97, 97, 23, 93, 1, 93, 98, + 93, 99, 43, 99, 99, 44, 99, 99, + 99, 99, 99, 99, 1, 100, 1, 101, + 101, 1, 101, 47, 101, 99, 43, 99, + 99, 44, 99, 99, 99, 99, 99, 99, + 1, 102, 103, 102, 104, 104, 104, 105, + 104, 104, 104, 104, 104, 104, 1, 106, + 107, 106, 108, 108, 108, 108, 108, 108, + 108, 108, 108, 1, 109, 110, 109, 108, + 108, 108, 111, 108, 108, 108, 108, 108, + 108, 1, 112, 12, 112, 8, 1, 113, + 1, 106, 106, 1, 115, 116, 117, 1, + 1, 1, 114, 118, 1, 114, 114, 1, + 109, 110, 109, 111, 1, 114, 114, 114, + 1, 119, 107, 119, 108, 108, 108, 108, + 120, 121, 108, 120, 120, 120, 108, 120, + 1, 122, 110, 122, 108, 108, 108, 121, + 111, 108, 108, 108, 108, 108, 108, 1, + 123, 12, 123, 121, 8, 1, 124, 125, + 126, 125, 127, 124, 128, 128, 1, 2, + 2, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_From_trans_targs[] = { + 2, 0, 3, 4, 106, 5, 91, 96, + 11, 101, 6, 7, 8, 9, 10, 12, + 13, 12, 14, 15, 16, 17, 41, 21, + 18, 19, 20, 22, 25, 79, 23, 24, + 26, 41, 25, 21, 30, 26, 27, 28, + 29, 31, 43, 37, 44, 32, 33, 34, + 35, 36, 38, 40, 42, 39, 17, 108, + 45, 78, 46, 49, 47, 48, 50, 65, + 51, 63, 52, 53, 61, 54, 55, 59, + 56, 57, 58, 60, 62, 64, 66, 74, + 67, 70, 68, 69, 71, 72, 73, 75, + 76, 77, 80, 81, 82, 86, 82, 83, + 84, 85, 87, 90, 88, 89, 17, 41, + 90, 21, 92, 94, 91, 93, 8, 11, + 93, 95, 96, 97, 99, 100, 98, 102, + 101, 104, 103, 103, 105, 17, 41, 21, + 107 +}; + +static const char _tsip_machine_parser_header_From_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 1, 1, + 0, 1, 0, 0, 0, 0, 0, 1, + 0, 0, 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 1, 1, 0, 0, + 9, 9, 0, 9, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 9, 11, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 9, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 7, 7, + 0, 7, 0, 0, 0, 5, 5, 5, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 0, 3, 3, 3, + 0 +}; + +static const int tsip_machine_parser_header_From_start = 1; +static const int tsip_machine_parser_header_From_first_final = 108; +static const int tsip_machine_parser_header_From_error = 0; + +static const int tsip_machine_parser_header_From_en_main = 1; + + +/* #line 125 "./ragel/tsip_parser_header_From.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_From_first_final); + (void)(tsip_machine_parser_header_From_error); + (void)(tsip_machine_parser_header_From_en_main); + +/* #line 377 "./src/headers/tsip_header_From.c" */ + { + cs = tsip_machine_parser_header_From_start; + } + +/* #line 130 "./ragel/tsip_parser_header_From.rl" */ + +/* #line 384 "./src/headers/tsip_header_From.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_From_trans_keys + _tsip_machine_parser_header_From_key_offsets[cs]; + _trans = _tsip_machine_parser_header_From_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_From_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_From_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_From_indicies[_trans]; + cs = _tsip_machine_parser_header_From_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_From_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_From_actions + _tsip_machine_parser_header_From_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 48 "./ragel/tsip_parser_header_From.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 52 "./ragel/tsip_parser_header_From.rl" */ + { + int len = (int)(p - tag_start); + if(hdr_from && !hdr_from->uri){ + if((hdr_from->uri = tsip_uri_parse(tag_start, (tsk_size_t)len)) && hdr_from->display_name){ + hdr_from->uri->display_name = tsk_strdup(hdr_from->display_name); + } + } + } + break; + case 2: +/* #line 61 "./ragel/tsip_parser_header_From.rl" */ + { + TSK_PARSER_SET_STRING(hdr_from->display_name); + tsk_strunquote(&hdr_from->display_name); + } + break; + case 3: +/* #line 66 "./ragel/tsip_parser_header_From.rl" */ + { + TSK_PARSER_SET_STRING(hdr_from->tag); + } + break; + case 4: +/* #line 70 "./ragel/tsip_parser_header_From.rl" */ + { + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(hdr_from)); + } + break; + case 5: +/* #line 74 "./ragel/tsip_parser_header_From.rl" */ + { + } + break; +/* #line 499 "./src/headers/tsip_header_From.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 131 "./ragel/tsip_parser_header_From.rl" */ + + if( cs < +/* #line 515 "./src/headers/tsip_header_From.c" */ +108 +/* #line 132 "./ragel/tsip_parser_header_From.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'From' header."); + TSK_OBJECT_SAFE_FREE(hdr_from); + } + + return hdr_from; +} + + + + + + + +//======================================================== +// From header object definition +// + +static tsk_object_t* tsip_header_From_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_From_t *From = self; + if(From){ + const char* display_name = va_arg(*app, const char *); + const tsip_uri_t* uri = va_arg(*app, const tsip_uri_t *); + const char* tag = va_arg(*app, const char *); + + From->display_name = tsk_strdup(display_name); + if(uri) From->uri = tsk_object_ref((void *)uri); + From->tag = tsk_strdup(tag); + + TSIP_HEADER(From)->type = tsip_htype_From; + TSIP_HEADER(From)->serialize = tsip_header_From_serialize; + } + else{ + TSK_DEBUG_ERROR("Failed to create new From header."); + } + return self; +} + +static tsk_object_t* tsip_header_From_dtor(tsk_object_t *self) +{ + tsip_header_From_t *From = self; + if(From){ + TSK_FREE(From->display_name); + TSK_FREE(From->tag); + + TSK_OBJECT_SAFE_FREE(From->uri); + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(From)); + } + else{ + TSK_DEBUG_ERROR("Null From header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_From_def_s = +{ + sizeof(tsip_header_From_t), + tsip_header_From_ctor, + tsip_header_From_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_From_def_t = &tsip_header_From_def_s; + diff --git a/tinySIP/src/headers/tsip_header_History_Info.c b/tinySIP/src/headers/tsip_header_History_Info.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_History_Info.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Identity.c b/tinySIP/src/headers/tsip_header_Identity.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Identity.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Identity_Info.c b/tinySIP/src/headers/tsip_header_Identity_Info.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Identity_Info.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_In_Reply_To.c b/tinySIP/src/headers/tsip_header_In_Reply_To.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_In_Reply_To.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Join.c b/tinySIP/src/headers/tsip_header_Join.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Join.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_MIME_Version.c b/tinySIP/src/headers/tsip_header_MIME_Version.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_MIME_Version.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Max_Forwards.c b/tinySIP/src/headers/tsip_header_Max_Forwards.c new file mode 100644 index 0000000..c4e47f0 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Max_Forwards.c @@ -0,0 +1,321 @@ + +/* #line 1 "./ragel/tsip_parser_header_Max_Forwards.rl" */ +/* +* 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 tsip_header_Max_Forwards.c + * @brief SIP Max-Forwards header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Max_Forwards.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 64 "./ragel/tsip_parser_header_Max_Forwards.rl" */ + + + +tsip_header_Max_Forwards_t* tsip_header_Max_Forwards_create(int32_t max) +{ + return tsk_object_new(TSIP_HEADER_MAX_FORWARDS_VA_ARGS(max)); +} + +int tsip_header_Max_Forwards_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Max_Forwards_t *Max_Forwards = (const tsip_header_Max_Forwards_t *)header; + if(Max_Forwards->value >= 0){ + return tsk_buffer_append_2(output, "%d", Max_Forwards->value); + } + return 0; + } + + return -1; +} + +tsip_header_Max_Forwards_t *tsip_header_Max_Forwards_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Max_Forwards_t *hdr_maxf = tsip_header_Max_Forwards_create(TSIP_HEADER_MAX_FORWARDS_NONE); + + const char *tag_start = tsk_null; + + +/* #line 79 "./src/headers/tsip_header_Max_Forwards.c" */ +static const char _tsip_machine_parser_header_Max_Forwards_actions[] = { + 0, 1, 0, 1, 1, 1, 2 +}; + +static const char _tsip_machine_parser_header_Max_Forwards_key_offsets[] = { + 0, 0, 2, 4, 6, 7, 9, 11, + 13, 15, 17, 19, 21, 23, 26, 31, + 32, 34, 38, 41, 42 +}; + +static const char _tsip_machine_parser_header_Max_Forwards_trans_keys[] = { + 77, 109, 65, 97, 88, 120, 45, 70, + 102, 79, 111, 82, 114, 87, 119, 65, + 97, 82, 114, 68, 100, 83, 115, 9, + 32, 58, 9, 13, 32, 48, 57, 10, + 9, 32, 9, 32, 48, 57, 13, 48, + 57, 10, 0 +}; + +static const char _tsip_machine_parser_header_Max_Forwards_single_lengths[] = { + 0, 2, 2, 2, 1, 2, 2, 2, + 2, 2, 2, 2, 2, 3, 3, 1, + 2, 2, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Max_Forwards_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 1, 1, 0, 0 +}; + +static const char _tsip_machine_parser_header_Max_Forwards_index_offsets[] = { + 0, 0, 3, 6, 9, 11, 14, 17, + 20, 23, 26, 29, 32, 35, 39, 44, + 46, 49, 53, 56, 58 +}; + +static const char _tsip_machine_parser_header_Max_Forwards_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 1, 5, 5, 1, 6, 6, + 1, 7, 7, 1, 8, 8, 1, 9, + 9, 1, 10, 10, 1, 11, 11, 1, + 12, 12, 1, 12, 12, 13, 1, 13, + 14, 13, 15, 1, 16, 1, 17, 17, + 1, 17, 17, 15, 1, 18, 19, 1, + 20, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Max_Forwards_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 18, + 16, 17, 19, 18, 20 +}; + +static const char _tsip_machine_parser_header_Max_Forwards_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1, + 0, 0, 3, 0, 5 +}; + +static const int tsip_machine_parser_header_Max_Forwards_start = 1; +static const int tsip_machine_parser_header_Max_Forwards_first_final = 20; +static const int tsip_machine_parser_header_Max_Forwards_error = 0; + +static const int tsip_machine_parser_header_Max_Forwards_en_main = 1; + + +/* #line 96 "./ragel/tsip_parser_header_Max_Forwards.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Max_Forwards_first_final); + (void)(tsip_machine_parser_header_Max_Forwards_error); + (void)(tsip_machine_parser_header_Max_Forwards_en_main); + +/* #line 153 "./src/headers/tsip_header_Max_Forwards.c" */ + { + cs = tsip_machine_parser_header_Max_Forwards_start; + } + +/* #line 101 "./ragel/tsip_parser_header_Max_Forwards.rl" */ + +/* #line 160 "./src/headers/tsip_header_Max_Forwards.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Max_Forwards_trans_keys + _tsip_machine_parser_header_Max_Forwards_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Max_Forwards_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Max_Forwards_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Max_Forwards_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Max_Forwards_indicies[_trans]; + cs = _tsip_machine_parser_header_Max_Forwards_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Max_Forwards_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Max_Forwards_actions + _tsip_machine_parser_header_Max_Forwards_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 48 "./ragel/tsip_parser_header_Max_Forwards.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 52 "./ragel/tsip_parser_header_Max_Forwards.rl" */ + { + TSK_PARSER_SET_INTEGER(hdr_maxf->value); + } + break; + case 2: +/* #line 56 "./ragel/tsip_parser_header_Max_Forwards.rl" */ + { + } + break; +/* #line 251 "./src/headers/tsip_header_Max_Forwards.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 102 "./ragel/tsip_parser_header_Max_Forwards.rl" */ + + if( cs < +/* #line 267 "./src/headers/tsip_header_Max_Forwards.c" */ +20 +/* #line 103 "./ragel/tsip_parser_header_Max_Forwards.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Max-Forward' header."); + TSK_OBJECT_SAFE_FREE(hdr_maxf); + } + + return hdr_maxf; +} + + + + + + + +//======================================================== +// Max_Forwards header object definition +// + +static tsk_object_t* tsip_header_Max_Forwards_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Max_Forwards_t *Max_Forwards = self; + if(Max_Forwards){ + TSIP_HEADER(Max_Forwards)->type = tsip_htype_Max_Forwards; + TSIP_HEADER(Max_Forwards)->serialize = tsip_header_Max_Forwards_serialize; + Max_Forwards->value = va_arg(*app, int32_t); + } + else{ + TSK_DEBUG_ERROR("Failed to create new Max_Forwards header."); + } + return self; +} + +static tsk_object_t* tsip_header_Max_Forwards_dtor(tsk_object_t *self) +{ + tsip_header_Max_Forwards_t *Max_Forwards = self; + if(Max_Forwards){ + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Max_Forwards)); + } + else{ + TSK_DEBUG_ERROR("Null Max_Forwards header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Max_Forwards_def_s = +{ + sizeof(tsip_header_Max_Forwards_t), + tsip_header_Max_Forwards_ctor, + tsip_header_Max_Forwards_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Max_Forwards_def_t = &tsip_header_Max_Forwards_def_s; diff --git a/tinySIP/src/headers/tsip_header_Min_Expires.c b/tinySIP/src/headers/tsip_header_Min_Expires.c new file mode 100644 index 0000000..70dfed9 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Min_Expires.c @@ -0,0 +1,326 @@ + +/* #line 1 "./ragel/tsip_parser_header_Min_Expires.rl" */ +/* +* 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 tsip_header_Min_Expires.c + * @brief SIP Min-Expiress header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Min_Expires.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 64 "./ragel/tsip_parser_header_Min_Expires.rl" */ + + +tsip_header_Min_Expires_t* tsip_header_Min_Expires_create(int32_t value) +{ + return tsk_object_new(TSIP_HEADER_MIN_EXPIRES_VA_ARGS(value)); +} + +tsip_header_Min_Expires_t* tsip_header_Min_Expires_create_null() +{ + return tsip_header_Min_Expires_create(TSIP_HEADER_MIN_EXPIRES_NONE); +} + +int tsip_header_Min_Expires_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Min_Expires_t *Min_Expires = (const tsip_header_Min_Expires_t *)header; + if(Min_Expires->value >=0){ + return tsk_buffer_append_2(output, "%d", Min_Expires->value); + } + return 0; + } + + return -1; +} + +tsip_header_Min_Expires_t *tsip_header_Min_Expires_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Min_Expires_t *hdr_minE = tsip_header_Min_Expires_create_null(); + + const char *tag_start = tsk_null; + + +/* #line 83 "./src/headers/tsip_header_Min_Expires.c" */ +static const char _tsip_machine_parser_header_Min_Expires_actions[] = { + 0, 1, 0, 1, 1, 1, 2 +}; + +static const char _tsip_machine_parser_header_Min_Expires_key_offsets[] = { + 0, 0, 2, 4, 6, 7, 9, 11, + 13, 15, 17, 19, 21, 24, 29, 30, + 32, 36, 39, 40 +}; + +static const char _tsip_machine_parser_header_Min_Expires_trans_keys[] = { + 77, 109, 73, 105, 78, 110, 45, 69, + 101, 88, 120, 80, 112, 73, 105, 82, + 114, 69, 101, 83, 115, 9, 32, 58, + 9, 13, 32, 48, 57, 10, 9, 32, + 9, 32, 48, 57, 13, 48, 57, 10, + 0 +}; + +static const char _tsip_machine_parser_header_Min_Expires_single_lengths[] = { + 0, 2, 2, 2, 1, 2, 2, 2, + 2, 2, 2, 2, 3, 3, 1, 2, + 2, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Min_Expires_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 1, 1, 0, 0 +}; + +static const char _tsip_machine_parser_header_Min_Expires_index_offsets[] = { + 0, 0, 3, 6, 9, 11, 14, 17, + 20, 23, 26, 29, 32, 36, 41, 43, + 46, 50, 53, 55 +}; + +static const char _tsip_machine_parser_header_Min_Expires_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 1, 5, 5, 1, 6, 6, + 1, 7, 7, 1, 8, 8, 1, 9, + 9, 1, 10, 10, 1, 11, 11, 1, + 11, 11, 12, 1, 12, 13, 12, 14, + 1, 15, 1, 16, 16, 1, 16, 16, + 14, 1, 17, 18, 1, 19, 1, 1, + 0 +}; + +static const char _tsip_machine_parser_header_Min_Expires_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 17, 15, + 16, 18, 17, 19 +}; + +static const char _tsip_machine_parser_header_Min_Expires_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 3, 0, 5 +}; + +static const int tsip_machine_parser_header_Min_Expires_start = 1; +static const int tsip_machine_parser_header_Min_Expires_first_final = 19; +static const int tsip_machine_parser_header_Min_Expires_error = 0; + +static const int tsip_machine_parser_header_Min_Expires_en_main = 1; + + +/* #line 100 "./ragel/tsip_parser_header_Min_Expires.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Min_Expires_first_final); + (void)(tsip_machine_parser_header_Min_Expires_error); + (void)(tsip_machine_parser_header_Min_Expires_en_main); + +/* #line 157 "./src/headers/tsip_header_Min_Expires.c" */ + { + cs = tsip_machine_parser_header_Min_Expires_start; + } + +/* #line 105 "./ragel/tsip_parser_header_Min_Expires.rl" */ + +/* #line 164 "./src/headers/tsip_header_Min_Expires.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Min_Expires_trans_keys + _tsip_machine_parser_header_Min_Expires_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Min_Expires_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Min_Expires_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Min_Expires_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Min_Expires_indicies[_trans]; + cs = _tsip_machine_parser_header_Min_Expires_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Min_Expires_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Min_Expires_actions + _tsip_machine_parser_header_Min_Expires_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 48 "./ragel/tsip_parser_header_Min_Expires.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 52 "./ragel/tsip_parser_header_Min_Expires.rl" */ + { + TSK_PARSER_SET_INTEGER(hdr_minE->value); + } + break; + case 2: +/* #line 56 "./ragel/tsip_parser_header_Min_Expires.rl" */ + { + } + break; +/* #line 255 "./src/headers/tsip_header_Min_Expires.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 106 "./ragel/tsip_parser_header_Min_Expires.rl" */ + + if( cs < +/* #line 271 "./src/headers/tsip_header_Min_Expires.c" */ +19 +/* #line 107 "./ragel/tsip_parser_header_Min_Expires.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Min-Expires' header."); + TSK_OBJECT_SAFE_FREE(hdr_minE); + } + + return hdr_minE; +} + + + + + + + +//======================================================== +// Min-Expires header object definition +// + +static tsk_object_t* tsip_header_Min_Expires_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Min_Expires_t *Min_Expires = self; + if(Min_Expires){ + TSIP_HEADER(Min_Expires)->type = tsip_htype_Min_Expires; + TSIP_HEADER(Min_Expires)->serialize = tsip_header_Min_Expires_serialize; + Min_Expires->value = va_arg(*app, int32_t); + } + else{ + TSK_DEBUG_ERROR("Failed to create new Min_Expires header."); + } + return self; +} + +static tsk_object_t* tsip_header_Min_Expires_dtor(tsk_object_t *self) +{ + tsip_header_Min_Expires_t *Min_Expires = self; + if(Min_Expires) + { + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Min_Expires)); + } + else{ + TSK_DEBUG_ERROR("Null Min_Expires header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Min_Expires_def_s = +{ + sizeof(tsip_header_Min_Expires_t), + tsip_header_Min_Expires_ctor, + tsip_header_Min_Expires_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Min_Expires_def_t = &tsip_header_Min_Expires_def_s; diff --git a/tinySIP/src/headers/tsip_header_Min_SE.c b/tinySIP/src/headers/tsip_header_Min_SE.c new file mode 100644 index 0000000..7d2dd66 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Min_SE.c @@ -0,0 +1,449 @@ + +/* #line 1 "./ragel/tsip_parser_header_Min_SE.rl" */ + +/* +* 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 tsip_header_Min_SE.c + * @brief SIP Min-SE header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Min_SE.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 69 "./ragel/tsip_parser_header_Min_SE.rl" */ + + +tsip_header_Min_SE_t* tsip_header_Min_SE_create(int64_t delta_seconds) +{ + return tsk_object_new(TSIP_HEADER_MIN_SE_VA_ARGS(delta_seconds)); +} + +int tsip_header_Min_SE_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Min_SE_t *MinSE = (const tsip_header_Min_SE_t *)header; + if(MinSE->delta_seconds >=0){ + return tsk_buffer_append_2(output, "%lld", MinSE->delta_seconds); + } + return 0; + } + + return -1; +} + +tsip_header_Min_SE_t *tsip_header_Min_SE_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Min_SE_t *hdr_minse = tsip_header_Min_SE_create(TSIP_SESSION_EXPIRES_MIN_VALUE); + + const char *tag_start = tsk_null; + + +/* #line 79 "./src/headers/tsip_header_Min_SE.c" */ +static const char _tsip_machine_parser_header_Min_SE_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3 +}; + +static const short _tsip_machine_parser_header_Min_SE_key_offsets[] = { + 0, 0, 2, 4, 6, 7, 9, 11, + 14, 19, 20, 22, 26, 32, 36, 37, + 39, 42, 59, 60, 62, 78, 97, 102, + 103, 105, 109, 128, 129, 131, 150, 151, + 153, 156, 164, 165, 167, 171, 172, 178, + 196, 203, 211, 219, 227, 229, 236, 245, + 247, 250, 252, 255, 257, 260, 263, 264, + 267, 268, 271, 272, 281, 290, 298, 306, + 314, 322, 324, 330, 339, 348, 357, 359, + 362, 365, 366, 367 +}; + +static const char _tsip_machine_parser_header_Min_SE_trans_keys[] = { + 77, 109, 73, 105, 78, 110, 45, 83, + 115, 69, 101, 9, 32, 58, 9, 13, + 32, 48, 57, 10, 9, 32, 9, 32, + 48, 57, 9, 13, 32, 59, 48, 57, + 9, 13, 32, 59, 10, 9, 32, 9, + 32, 59, 9, 13, 32, 33, 37, 39, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 10, 9, 32, 9, 32, + 33, 37, 39, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 59, 61, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 59, 61, 10, 9, + 32, 9, 32, 59, 61, 9, 13, 32, + 33, 34, 37, 39, 91, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 10, 9, 32, 9, 13, 32, 33, 34, + 37, 39, 91, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 10, 9, + 32, 9, 32, 34, 13, 34, 92, 127, + 0, 8, 10, 31, 10, 9, 32, 9, + 13, 32, 59, 10, 0, 9, 11, 12, + 14, 127, 9, 13, 32, 33, 37, 39, + 59, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 58, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 58, 48, 57, + 65, 70, 97, 102, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 48, 57, 46, + 48, 57, 48, 57, 46, 48, 57, 48, + 57, 93, 48, 57, 93, 48, 57, 93, + 46, 48, 57, 46, 46, 48, 57, 46, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 46, 58, 93, 48, 57, 65, 70, + 97, 102, 58, 93, 48, 57, 65, 70, + 97, 102, 58, 93, 48, 57, 65, 70, + 97, 102, 58, 93, 48, 57, 65, 70, + 97, 102, 58, 93, 48, 57, 65, 70, + 97, 102, 58, 93, 48, 57, 65, 70, + 97, 102, 46, 58, 93, 48, 57, 65, + 70, 97, 102, 46, 58, 93, 48, 57, + 65, 70, 97, 102, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 48, 57, 46, + 48, 57, 46, 48, 57, 46, 58, 0 +}; + +static const char _tsip_machine_parser_header_Min_SE_single_lengths[] = { + 0, 2, 2, 2, 1, 2, 2, 3, + 3, 1, 2, 2, 4, 4, 1, 2, + 3, 7, 1, 2, 6, 9, 5, 1, + 2, 4, 9, 1, 2, 9, 1, 2, + 3, 4, 1, 2, 4, 1, 0, 8, + 1, 2, 2, 2, 2, 1, 3, 0, + 1, 0, 1, 0, 1, 1, 1, 1, + 1, 1, 1, 3, 3, 2, 2, 2, + 2, 2, 0, 3, 3, 3, 0, 1, + 1, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Min_SE_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 1, 1, 0, 0, 0, + 0, 5, 0, 0, 5, 5, 0, 0, + 0, 0, 5, 0, 0, 5, 0, 0, + 0, 2, 0, 0, 0, 0, 3, 5, + 3, 3, 3, 3, 0, 3, 3, 1, + 1, 1, 1, 1, 1, 1, 0, 1, + 0, 1, 0, 3, 3, 3, 3, 3, + 3, 0, 3, 3, 3, 3, 1, 1, + 1, 0, 0, 0 +}; + +static const short _tsip_machine_parser_header_Min_SE_index_offsets[] = { + 0, 0, 3, 6, 9, 11, 14, 17, + 21, 26, 28, 31, 35, 41, 46, 48, + 51, 55, 68, 70, 73, 85, 100, 106, + 108, 111, 116, 131, 133, 136, 151, 153, + 156, 160, 167, 169, 172, 177, 179, 183, + 197, 202, 208, 214, 220, 223, 228, 235, + 237, 240, 242, 245, 247, 250, 253, 255, + 258, 260, 263, 265, 272, 279, 285, 291, + 297, 303, 306, 310, 317, 324, 331, 333, + 336, 339, 341, 343 +}; + +static const char _tsip_machine_parser_header_Min_SE_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 1, 5, 5, 1, 6, 6, + 1, 6, 6, 7, 1, 7, 8, 7, + 9, 1, 10, 1, 11, 11, 1, 11, + 11, 9, 1, 12, 13, 12, 15, 14, + 1, 16, 17, 16, 18, 1, 19, 1, + 20, 20, 1, 20, 20, 18, 1, 18, + 21, 18, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 1, 23, 1, 24, 24, + 1, 24, 24, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 1, 25, 26, 25, + 27, 27, 27, 28, 29, 27, 27, 27, + 27, 27, 27, 1, 30, 31, 30, 18, + 29, 1, 32, 1, 33, 33, 1, 33, + 33, 18, 29, 1, 29, 34, 29, 35, + 36, 35, 35, 37, 35, 35, 35, 35, + 35, 35, 1, 38, 1, 39, 39, 1, + 39, 40, 39, 35, 36, 35, 35, 37, + 35, 35, 35, 35, 35, 35, 1, 41, + 1, 42, 42, 1, 42, 42, 36, 1, + 43, 44, 45, 1, 1, 1, 36, 46, + 1, 36, 36, 1, 47, 26, 47, 28, + 1, 48, 1, 36, 36, 36, 1, 47, + 26, 47, 35, 35, 35, 28, 35, 35, + 35, 35, 35, 35, 1, 50, 49, 49, + 49, 1, 52, 44, 51, 51, 51, 1, + 52, 44, 53, 53, 53, 1, 52, 44, + 54, 54, 54, 1, 52, 44, 1, 56, + 55, 49, 49, 1, 57, 52, 44, 58, + 51, 51, 1, 59, 1, 60, 61, 1, + 62, 1, 63, 64, 1, 65, 1, 44, + 66, 1, 44, 67, 1, 44, 1, 63, + 68, 1, 63, 1, 60, 69, 1, 60, + 1, 57, 52, 44, 70, 53, 53, 1, + 57, 52, 44, 54, 54, 54, 1, 72, + 44, 71, 71, 71, 1, 74, 44, 73, + 73, 73, 1, 74, 44, 75, 75, 75, + 1, 74, 44, 76, 76, 76, 1, 74, + 44, 1, 77, 71, 71, 1, 57, 74, + 44, 78, 73, 73, 1, 57, 74, 44, + 79, 75, 75, 1, 57, 74, 44, 76, + 76, 76, 1, 80, 1, 57, 81, 1, + 57, 82, 1, 57, 1, 56, 1, 1, + 0 +}; + +static const char _tsip_machine_parser_header_Min_SE_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 12, 10, 11, 13, 37, 12, 17, + 13, 14, 17, 15, 16, 18, 21, 19, + 20, 22, 37, 21, 17, 26, 22, 23, + 24, 25, 27, 39, 33, 40, 28, 29, + 30, 31, 32, 34, 36, 38, 35, 13, + 75, 41, 74, 42, 45, 43, 44, 46, + 61, 47, 59, 48, 49, 57, 50, 51, + 55, 52, 53, 54, 56, 58, 60, 62, + 70, 63, 66, 64, 65, 67, 68, 69, + 71, 72, 73 +}; + +static const char _tsip_machine_parser_header_Min_SE_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 3, 3, 0, 3, + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 5, 5, 0, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 5, + 7, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0 +}; + +static const int tsip_machine_parser_header_Min_SE_start = 1; +static const int tsip_machine_parser_header_Min_SE_first_final = 75; +static const int tsip_machine_parser_header_Min_SE_error = 0; + +static const int tsip_machine_parser_header_Min_SE_en_main = 1; + + +/* #line 100 "./ragel/tsip_parser_header_Min_SE.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Min_SE_first_final); + (void)(tsip_machine_parser_header_Min_SE_error); + (void)(tsip_machine_parser_header_Min_SE_en_main); + +/* #line 274 "./src/headers/tsip_header_Min_SE.c" */ + { + cs = tsip_machine_parser_header_Min_SE_start; + } + +/* #line 105 "./ragel/tsip_parser_header_Min_SE.rl" */ + +/* #line 281 "./src/headers/tsip_header_Min_SE.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Min_SE_trans_keys + _tsip_machine_parser_header_Min_SE_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Min_SE_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Min_SE_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Min_SE_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Min_SE_indicies[_trans]; + cs = _tsip_machine_parser_header_Min_SE_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Min_SE_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Min_SE_actions + _tsip_machine_parser_header_Min_SE_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 49 "./ragel/tsip_parser_header_Min_SE.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 53 "./ragel/tsip_parser_header_Min_SE.rl" */ + { + TSK_PARSER_SET_INTEGER(hdr_minse->delta_seconds); + } + break; + case 2: +/* #line 57 "./ragel/tsip_parser_header_Min_SE.rl" */ + { + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(hdr_minse)); + } + break; + case 3: +/* #line 61 "./ragel/tsip_parser_header_Min_SE.rl" */ + { + } + break; +/* #line 378 "./src/headers/tsip_header_Min_SE.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 106 "./ragel/tsip_parser_header_Min_SE.rl" */ + + if( cs < +/* #line 394 "./src/headers/tsip_header_Min_SE.c" */ +75 +/* #line 107 "./ragel/tsip_parser_header_Min_SE.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Min-SE' header."); + TSK_OBJECT_SAFE_FREE(hdr_minse); + } + + return hdr_minse; +} + + + + + + + +//======================================================== +// MinSE header object definition +// + +static tsk_object_t* tsip_header_Min_SE_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Min_SE_t *MinSE = self; + if(MinSE){ + TSIP_HEADER(MinSE)->type = tsip_htype_Min_SE; + TSIP_HEADER(MinSE)->serialize = tsip_header_Min_SE_serialize; + MinSE->delta_seconds = va_arg(*app, int64_t); + } + else{ + TSK_DEBUG_ERROR("Failed to create new MinSE header."); + } + return self; +} + +static tsk_object_t* tsip_header_Min_SE_dtor(tsk_object_t *self) +{ + tsip_header_Min_SE_t *MinSE = self; + if(MinSE){ + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(MinSE)); + } + else{ + TSK_DEBUG_ERROR("Null MinSE header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Min_SE_def_s = +{ + sizeof(tsip_header_Min_SE_t), + tsip_header_Min_SE_ctor, + tsip_header_Min_SE_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Min_SE_def_t = &tsip_header_Min_SE_def_s; + diff --git a/tinySIP/src/headers/tsip_header_Organization.c b/tinySIP/src/headers/tsip_header_Organization.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Organization.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_P_Access_Network_Info.c b/tinySIP/src/headers/tsip_header_P_Access_Network_Info.c new file mode 100644 index 0000000..54e95c7 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_P_Access_Network_Info.c @@ -0,0 +1,345 @@ + +/* #line 1 "./ragel/tsip_parser_header_P_Access_Network_Info.rl" */ +/* +* 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 tsip_header_P_Access_Network_Info.c + * @brief SIP P_Access_Network_Info header as per RFC 3455. + * + * Header field where proxy ACK BYE CAN INV OPT REG + ___________________________________________________________ + P-Access-Network-Info dr - o - o o o + + Header field SUB NOT PRA INF UPD MSG REF + ___________________________________________________________ + P-Access-Network-Info o o o o o o o + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_P_Access_Network_Info.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 74 "./ragel/tsip_parser_header_P_Access_Network_Info.rl" */ + + + +tsip_header_P_Access_Network_Info_t* tsip_header_P_Access_Network_Info_create(const char* value) +{ + return tsk_object_new(TSIP_HEADER_P_ACCESS_NETWORK_INFO_VA_ARGS(value)); +} + +tsip_header_P_Access_Network_Info_t* tsip_header_P_Access_Network_Info_create_null() +{ + return tsip_header_P_Access_Network_Info_create(tsk_null); +} + +int tsip_header_P_Access_Network_Info_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_P_Access_Network_Info_t *P_Access_Network_Info = (const tsip_header_P_Access_Network_Info_t *)header; + if(P_Access_Network_Info->value){ + tsk_buffer_append(output, P_Access_Network_Info->value, tsk_strlen(P_Access_Network_Info->value)); + } + return 0; + } + + return -1; +} + +tsip_header_P_Access_Network_Info_t *tsip_header_P_Access_Network_Info_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_P_Access_Network_Info_t *hdr_ani = tsip_header_P_Access_Network_Info_create_null(); + + const char *tag_start = tsk_null; + + +/* #line 94 "./src/headers/tsip_header_P_Access_Network_Info.c" */ +static const char _tsip_machine_parser_header_P_Access_Network_Info_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 2, + 0, 1 +}; + +static const char _tsip_machine_parser_header_P_Access_Network_Info_key_offsets[] = { + 0, 0, 2, 3, 5, 7, 9, 11, + 13, 15, 16, 18, 20, 22, 24, 26, + 28, 30, 31, 33, 35, 37, 39, 42, + 45, 46, 47 +}; + +static const char _tsip_machine_parser_header_P_Access_Network_Info_trans_keys[] = { + 80, 112, 45, 65, 97, 67, 99, 67, + 99, 69, 101, 83, 115, 83, 115, 45, + 78, 110, 69, 101, 84, 116, 87, 119, + 79, 111, 82, 114, 75, 107, 45, 73, + 105, 78, 110, 70, 102, 79, 111, 9, + 32, 58, 9, 13, 32, 13, 10, 0 +}; + +static const char _tsip_machine_parser_header_P_Access_Network_Info_single_lengths[] = { + 0, 2, 1, 2, 2, 2, 2, 2, + 2, 1, 2, 2, 2, 2, 2, 2, + 2, 1, 2, 2, 2, 2, 3, 3, + 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_P_Access_Network_Info_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0 +}; + +static const char _tsip_machine_parser_header_P_Access_Network_Info_index_offsets[] = { + 0, 0, 3, 5, 8, 11, 14, 17, + 20, 23, 25, 28, 31, 34, 37, 40, + 43, 46, 48, 51, 54, 57, 60, 64, + 68, 70, 72 +}; + +static const char _tsip_machine_parser_header_P_Access_Network_Info_indicies[] = { + 0, 0, 1, 2, 1, 3, 3, 1, + 4, 4, 1, 5, 5, 1, 6, 6, + 1, 7, 7, 1, 8, 8, 1, 9, + 1, 10, 10, 1, 11, 11, 1, 12, + 12, 1, 13, 13, 1, 14, 14, 1, + 15, 15, 1, 16, 16, 1, 17, 1, + 18, 18, 1, 19, 19, 1, 20, 20, + 1, 21, 21, 1, 21, 21, 22, 1, + 24, 25, 24, 23, 27, 26, 28, 1, + 1, 0 +}; + +static const char _tsip_machine_parser_header_P_Access_Network_Info_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, + 23, 25, 24, 25, 26 +}; + +static const char _tsip_machine_parser_header_P_Access_Network_Info_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1, + 1, 7, 0, 3, 5 +}; + +static const int tsip_machine_parser_header_P_Access_Network_Info_start = 1; +static const int tsip_machine_parser_header_P_Access_Network_Info_first_final = 26; +static const int tsip_machine_parser_header_P_Access_Network_Info_error = 0; + +static const int tsip_machine_parser_header_P_Access_Network_Info_en_main = 1; + + +/* #line 111 "./ragel/tsip_parser_header_P_Access_Network_Info.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_P_Access_Network_Info_first_final); + (void)(tsip_machine_parser_header_P_Access_Network_Info_error); + (void)(tsip_machine_parser_header_P_Access_Network_Info_en_main); + +/* #line 177 "./src/headers/tsip_header_P_Access_Network_Info.c" */ + { + cs = tsip_machine_parser_header_P_Access_Network_Info_start; + } + +/* #line 116 "./ragel/tsip_parser_header_P_Access_Network_Info.rl" */ + +/* #line 184 "./src/headers/tsip_header_P_Access_Network_Info.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_P_Access_Network_Info_trans_keys + _tsip_machine_parser_header_P_Access_Network_Info_key_offsets[cs]; + _trans = _tsip_machine_parser_header_P_Access_Network_Info_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_P_Access_Network_Info_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_P_Access_Network_Info_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_P_Access_Network_Info_indicies[_trans]; + cs = _tsip_machine_parser_header_P_Access_Network_Info_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_P_Access_Network_Info_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_P_Access_Network_Info_actions + _tsip_machine_parser_header_P_Access_Network_Info_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 58 "./ragel/tsip_parser_header_P_Access_Network_Info.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 62 "./ragel/tsip_parser_header_P_Access_Network_Info.rl" */ + { + TSK_PARSER_SET_STRING(hdr_ani->value); + } + break; + case 2: +/* #line 66 "./ragel/tsip_parser_header_P_Access_Network_Info.rl" */ + { + } + break; +/* #line 275 "./src/headers/tsip_header_P_Access_Network_Info.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 117 "./ragel/tsip_parser_header_P_Access_Network_Info.rl" */ + + if( cs < +/* #line 291 "./src/headers/tsip_header_P_Access_Network_Info.c" */ +26 +/* #line 118 "./ragel/tsip_parser_header_P_Access_Network_Info.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'P-Access-Network-Info' header."); + TSK_OBJECT_SAFE_FREE(hdr_ani); + } + + return hdr_ani; +} + + + + + + + +//======================================================== +// P_Access_Network_Info header object definition +// + +static tsk_object_t* tsip_header_P_Access_Network_Info_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_P_Access_Network_Info_t *P_Access_Network_Info = self; + if(P_Access_Network_Info){ + P_Access_Network_Info->value = tsk_strdup(va_arg(*app, const char *)); + TSIP_HEADER(P_Access_Network_Info)->type = tsip_htype_P_Access_Network_Info; + TSIP_HEADER(P_Access_Network_Info)->serialize = tsip_header_P_Access_Network_Info_serialize; + } + else{ + TSK_DEBUG_ERROR("Failed to create new P_Access_Network_Info header."); + } + return self; +} + +static tsk_object_t* tsip_header_P_Access_Network_Info_dtor(tsk_object_t *self) +{ + tsip_header_P_Access_Network_Info_t *P_Access_Network_Info = self; + if(P_Access_Network_Info){ + TSK_FREE(P_Access_Network_Info->value); + } + else{ + TSK_DEBUG_ERROR("Null P_Access_Network_Info header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_P_Access_Network_Info_def_s = +{ + sizeof(tsip_header_P_Access_Network_Info_t), + tsip_header_P_Access_Network_Info_ctor, + tsip_header_P_Access_Network_Info_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_P_Access_Network_Info_def_t = &tsip_header_P_Access_Network_Info_def_s; diff --git a/tinySIP/src/headers/tsip_header_P_Answer_State.c b/tinySIP/src/headers/tsip_header_P_Answer_State.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_P_Answer_State.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_P_Asserted_Identity.c b/tinySIP/src/headers/tsip_header_P_Asserted_Identity.c new file mode 100644 index 0000000..e7fbf57 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_P_Asserted_Identity.c @@ -0,0 +1,1429 @@ + +/* #line 1 "./ragel/tsip_parser_header_P_Asserted_Identity.rl" */ +/* +* 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 tsip_header_P_Asserted_Identity.c + * @brief SIP P-Asserted-Identity header as per RFC 3325. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_P_Asserted_Identity.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_time.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 100 "./ragel/tsip_parser_header_P_Asserted_Identity.rl" */ + + +tsip_header_P_Asserted_Identity_t* tsip_header_P_Asserted_Identity_create() +{ + return tsk_object_new(tsip_header_P_Asserted_Identity_def_t); +} + +int tsip_header_P_Asserted_Identity_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_P_Asserted_Identity_t *P_Asserted_Identity = (const tsip_header_P_Asserted_Identity_t *)header; + int ret = 0; + + /* Uri with hacked display-name*/ + if((ret = tsip_uri_serialize(P_Asserted_Identity->uri, tsk_true, tsk_true, output))){ + return ret; + } + + return ret; + } + + return -1; +} + +tsip_header_P_Asserted_Identities_L_t *tsip_header_P_Asserted_Identity_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_P_Asserted_Identities_L_t *hdr_p_asserted_identities = tsk_list_create(); + + const char *tag_start = tsk_null; + tsip_header_P_Asserted_Identity_t *curr_p_asserted_identity = 0; + + +/* #line 86 "./src/headers/tsip_header_P_Asserted_Identity.c" */ +static const char _tsip_machine_parser_header_P_Asserted_Identity_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3, 1, 4, 1, 5, 2, 1, 0, + 2, 3, 4, 3, 1, 3, 4, 3, + 2, 3, 4, 3, 3, 4, 1, 3, + 3, 4, 2 +}; + +static const short _tsip_machine_parser_header_P_Asserted_Identity_key_offsets[] = { + 0, 0, 2, 3, 5, 7, 9, 11, + 13, 15, 17, 19, 20, 22, 24, 26, + 28, 30, 32, 34, 36, 39, 60, 61, + 63, 84, 85, 87, 90, 94, 106, 109, + 109, 110, 114, 115, 136, 137, 139, 160, + 177, 195, 199, 200, 202, 210, 211, 213, + 217, 223, 243, 262, 267, 267, 271, 289, + 305, 322, 327, 335, 348, 353, 357, 362, + 381, 398, 416, 422, 431, 441, 447, 472, + 494, 517, 526, 537, 562, 585, 594, 599, + 623, 644, 666, 674, 684, 708, 730, 750, + 769, 774, 774, 778, 798, 814, 831, 836, + 844, 857, 862, 866, 871, 892, 909, 927, + 933, 942, 952, 958, 983, 1005, 1028, 1037, + 1048, 1074, 1098, 1108, 1118, 1143, 1165, 1188, + 1197, 1223, 1247, 1253, 1257, 1275, 1284, 1308, + 1329, 1351, 1359, 1383, 1405, 1413, 1426, 1431, + 1435, 1440, 1459, 1476, 1494, 1500, 1509, 1513, + 1533, 1549, 1566, 1571, 1580, 1585, 1609, 1630, + 1652, 1660, 1670, 1694, 1716, 1736, 1754, 1764, + 1770, 1795, 1817, 1840, 1849, 1860, 1885, 1908, + 1914, 1916, 1919, 1923, 1928, 1929, 1934, 1953, + 1970, 1988, 1994, 2003, 2017, 2023, 2028, 2038, + 2044, 2069, 2091, 2114, 2123, 2134, 2159, 2182, + 2192, 2217, 2238, 2259, 2278, 2285, 2290, 2301, + 2326, 2352, 2376, 2385, 2390, 2414, 2435, 2457, + 2465, 2475, 2500, 2523, 2532, 2541, 2565, 2586, + 2608, 2616, 2641, 2664, 2673, 2697, 2717, 2737, + 2755, 2761, 2765, 2775, 2799, 2824, 2847 +}; + +static const char _tsip_machine_parser_header_P_Asserted_Identity_trans_keys[] = { + 80, 112, 45, 65, 97, 83, 115, 83, + 115, 69, 101, 82, 114, 84, 116, 69, + 101, 68, 100, 45, 73, 105, 68, 100, + 69, 101, 78, 110, 84, 116, 73, 105, + 84, 116, 89, 121, 9, 32, 58, 9, + 13, 32, 33, 34, 37, 39, 60, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 96, 97, 122, 10, 9, 32, 9, + 13, 32, 33, 34, 37, 39, 60, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 96, 97, 122, 10, 9, 32, 9, + 32, 60, 65, 90, 97, 122, 9, 32, + 43, 58, 45, 46, 48, 57, 65, 90, + 97, 122, 9, 32, 58, 62, 9, 13, + 32, 44, 10, 9, 13, 32, 33, 34, + 37, 39, 60, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 96, 97, 122, + 10, 9, 32, 9, 13, 32, 33, 34, + 37, 39, 60, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 96, 97, 122, + 9, 13, 32, 33, 37, 39, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 60, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 60, 10, + 9, 32, 13, 34, 92, 127, 0, 8, + 10, 31, 10, 9, 32, 9, 13, 32, + 60, 0, 9, 11, 12, 14, 127, 9, + 13, 32, 33, 37, 39, 42, 43, 58, + 126, 45, 46, 48, 57, 65, 90, 95, + 96, 97, 122, 9, 13, 32, 33, 37, + 39, 58, 60, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 58, 60, 9, 13, 32, 44, 9, + 13, 32, 33, 34, 37, 39, 44, 60, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 60, 126, 42, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 44, 60, 9, + 13, 32, 44, 65, 90, 97, 122, 9, + 13, 32, 44, 58, 43, 46, 48, 57, + 65, 90, 97, 122, 9, 13, 32, 44, + 58, 9, 13, 32, 44, 9, 13, 32, + 44, 62, 9, 13, 32, 33, 34, 37, + 39, 44, 60, 62, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 62, 126, 42, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 44, 60, 62, 126, + 42, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 44, 60, 62, 9, 13, + 32, 44, 62, 65, 90, 97, 122, 9, + 13, 32, 34, 44, 62, 92, 127, 0, + 31, 9, 13, 32, 44, 60, 62, 9, + 13, 32, 33, 34, 37, 39, 44, 60, + 62, 92, 126, 127, 0, 31, 42, 46, + 48, 57, 65, 90, 95, 96, 97, 122, + 9, 13, 32, 33, 34, 37, 39, 44, + 62, 92, 126, 127, 0, 31, 42, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 34, 37, 39, 44, 60, 62, + 92, 126, 127, 0, 31, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 44, 62, 0, 8, 11, 127, 9, 13, + 32, 34, 44, 60, 62, 92, 127, 0, + 31, 9, 13, 32, 33, 34, 37, 39, + 42, 44, 62, 92, 126, 127, 0, 31, + 43, 46, 48, 57, 65, 90, 95, 96, + 97, 122, 9, 13, 32, 33, 34, 37, + 39, 44, 60, 62, 92, 126, 127, 0, + 31, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 34, 44, 92, 127, + 0, 31, 9, 13, 32, 44, 60, 9, + 13, 32, 33, 34, 37, 39, 44, 60, + 92, 126, 127, 0, 31, 42, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 9, + 13, 32, 33, 34, 37, 39, 44, 92, + 126, 127, 0, 31, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 34, 37, 39, 44, 60, 92, 126, 127, + 0, 31, 42, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 44, 0, 8, + 11, 127, 9, 13, 32, 34, 44, 60, + 92, 127, 0, 31, 9, 13, 32, 33, + 34, 37, 39, 42, 44, 92, 126, 127, + 0, 31, 43, 46, 48, 57, 65, 90, + 95, 96, 97, 122, 9, 13, 32, 33, + 34, 37, 39, 44, 60, 92, 126, 127, + 0, 31, 42, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 42, 43, 58, 126, 45, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 9, 13, + 32, 33, 37, 39, 58, 60, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 58, 60, 9, 13, + 32, 44, 9, 13, 32, 33, 34, 37, + 39, 44, 60, 126, 42, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 9, 13, + 32, 33, 37, 39, 44, 126, 42, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 44, 60, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 44, 60, 9, 13, 32, 44, + 65, 90, 97, 122, 9, 13, 32, 44, + 58, 43, 46, 48, 57, 65, 90, 97, + 122, 9, 13, 32, 44, 58, 9, 13, + 32, 44, 9, 13, 32, 44, 62, 9, + 13, 32, 33, 34, 37, 39, 44, 60, + 62, 126, 42, 46, 48, 57, 65, 90, + 95, 96, 97, 122, 9, 13, 32, 33, + 37, 39, 44, 62, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 60, 62, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 44, 60, 62, 9, 13, 32, + 44, 62, 65, 90, 97, 122, 9, 13, + 32, 34, 44, 62, 92, 127, 0, 31, + 9, 13, 32, 44, 60, 62, 9, 13, + 32, 33, 34, 37, 39, 44, 60, 62, + 92, 126, 127, 0, 31, 42, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 9, + 13, 32, 33, 34, 37, 39, 44, 62, + 92, 126, 127, 0, 31, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 34, 37, 39, 44, 60, 62, 92, + 126, 127, 0, 31, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 44, + 62, 0, 8, 11, 127, 9, 13, 32, + 34, 44, 60, 62, 92, 127, 0, 31, + 9, 13, 32, 33, 34, 37, 39, 42, + 44, 58, 62, 92, 126, 127, 0, 31, + 43, 46, 48, 57, 65, 90, 95, 96, + 97, 122, 9, 13, 32, 33, 34, 37, + 39, 44, 58, 60, 62, 92, 126, 127, + 0, 31, 42, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 34, 44, 62, + 92, 127, 0, 31, 9, 13, 32, 34, + 44, 62, 92, 127, 0, 31, 9, 13, + 32, 33, 34, 37, 39, 44, 60, 62, + 92, 126, 127, 0, 31, 42, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 9, + 13, 32, 33, 34, 37, 39, 44, 62, + 92, 126, 127, 0, 31, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 34, 37, 39, 44, 60, 62, 92, + 126, 127, 0, 31, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 44, + 62, 0, 8, 11, 127, 9, 13, 32, + 33, 34, 37, 39, 42, 44, 58, 62, + 92, 126, 127, 0, 31, 43, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 9, + 13, 32, 33, 34, 37, 39, 44, 58, + 60, 62, 92, 126, 127, 0, 31, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 44, 58, 60, 9, 13, 32, + 44, 9, 13, 32, 33, 34, 37, 39, + 44, 60, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 34, 44, + 92, 127, 0, 31, 9, 13, 32, 33, + 34, 37, 39, 44, 60, 92, 126, 127, + 0, 31, 42, 46, 48, 57, 65, 90, + 95, 96, 97, 122, 9, 13, 32, 33, + 34, 37, 39, 44, 92, 126, 127, 0, + 31, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 34, 37, 39, + 44, 60, 92, 126, 127, 0, 31, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 44, 0, 8, 11, 127, 9, + 13, 32, 33, 34, 37, 39, 42, 44, + 92, 126, 127, 0, 31, 43, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 9, + 13, 32, 33, 34, 37, 39, 44, 60, + 92, 126, 127, 0, 31, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 44, 65, 90, 97, 122, 9, 13, 32, + 44, 58, 43, 46, 48, 57, 65, 90, + 97, 122, 9, 13, 32, 44, 58, 9, + 13, 32, 44, 9, 13, 32, 44, 62, + 9, 13, 32, 33, 34, 37, 39, 44, + 60, 62, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 44, 62, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 60, 62, 126, 42, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 44, 60, 62, 9, 13, 32, 44, + 62, 65, 90, 97, 122, 9, 13, 32, + 44, 9, 13, 32, 33, 34, 37, 39, + 44, 60, 126, 42, 46, 48, 57, 65, + 90, 95, 96, 97, 122, 9, 13, 32, + 33, 37, 39, 44, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 60, 126, 42, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 44, 60, 9, 13, 32, 34, 44, + 92, 127, 0, 31, 9, 13, 32, 44, + 60, 9, 13, 32, 33, 34, 37, 39, + 44, 60, 92, 126, 127, 0, 31, 42, + 46, 48, 57, 65, 90, 95, 96, 97, + 122, 9, 13, 32, 33, 34, 37, 39, + 44, 92, 126, 127, 0, 31, 42, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 34, 37, 39, 44, 60, 92, + 126, 127, 0, 31, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 44, + 0, 8, 11, 127, 9, 13, 32, 34, + 44, 60, 92, 127, 0, 31, 9, 13, + 32, 33, 34, 37, 39, 42, 44, 92, + 126, 127, 0, 31, 43, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 9, 13, + 32, 33, 34, 37, 39, 44, 60, 92, + 126, 127, 0, 31, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 42, 44, 58, 126, 43, 46, + 48, 57, 65, 90, 95, 96, 97, 122, + 9, 13, 32, 33, 37, 39, 44, 58, + 60, 126, 42, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 34, 44, 62, + 92, 127, 0, 31, 9, 13, 32, 44, + 60, 62, 9, 13, 32, 33, 34, 37, + 39, 44, 60, 62, 92, 126, 127, 0, + 31, 42, 46, 48, 57, 65, 90, 95, + 96, 97, 122, 9, 13, 32, 33, 34, + 37, 39, 44, 62, 92, 126, 127, 0, + 31, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 34, 37, 39, + 44, 60, 62, 92, 126, 127, 0, 31, + 42, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 44, 62, 0, 8, 11, + 127, 9, 13, 32, 34, 44, 60, 62, + 92, 127, 0, 31, 9, 13, 32, 33, + 34, 37, 39, 42, 44, 62, 92, 126, + 127, 0, 31, 43, 46, 48, 57, 65, + 90, 95, 96, 97, 122, 9, 13, 32, + 33, 34, 37, 39, 44, 60, 62, 92, + 126, 127, 0, 31, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 58, + 60, 62, 10, 62, 9, 32, 62, 9, + 32, 60, 62, 62, 65, 90, 97, 122, + 62, 9, 13, 32, 44, 62, 9, 13, + 32, 33, 34, 37, 39, 44, 60, 62, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 62, 126, 42, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 44, 60, 62, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 44, + 60, 62, 9, 13, 32, 44, 62, 65, + 90, 97, 122, 9, 13, 32, 44, 58, + 62, 43, 46, 48, 57, 65, 90, 97, + 122, 9, 13, 32, 44, 58, 62, 9, + 13, 32, 44, 62, 9, 13, 32, 34, + 44, 62, 92, 127, 0, 31, 9, 13, + 32, 44, 60, 62, 9, 13, 32, 33, + 34, 37, 39, 44, 60, 62, 92, 126, + 127, 0, 31, 42, 46, 48, 57, 65, + 90, 95, 96, 97, 122, 9, 13, 32, + 33, 34, 37, 39, 44, 62, 92, 126, + 127, 0, 31, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 34, + 37, 39, 44, 60, 62, 92, 126, 127, + 0, 31, 42, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 44, 62, 0, + 8, 11, 127, 9, 13, 32, 34, 44, + 60, 62, 92, 127, 0, 31, 9, 13, + 32, 33, 34, 37, 39, 42, 44, 62, + 92, 126, 127, 0, 31, 43, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 9, + 13, 32, 33, 34, 37, 39, 44, 60, + 62, 92, 126, 127, 0, 31, 42, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 34, 44, 62, 92, 127, 0, 31, + 9, 13, 32, 33, 34, 37, 39, 44, + 60, 62, 92, 126, 127, 0, 31, 42, + 46, 48, 57, 65, 90, 95, 96, 97, + 122, 9, 13, 32, 33, 34, 37, 39, + 44, 60, 62, 126, 42, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 9, 13, + 32, 33, 37, 39, 42, 44, 58, 62, + 126, 43, 46, 48, 57, 65, 90, 95, + 96, 97, 122, 9, 13, 32, 33, 37, + 39, 44, 58, 60, 62, 126, 42, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 44, 58, 60, 62, 9, 13, 32, + 44, 62, 9, 13, 32, 34, 44, 60, + 62, 92, 127, 0, 31, 9, 13, 32, + 33, 34, 37, 39, 44, 60, 62, 92, + 126, 127, 0, 31, 42, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 9, 13, + 32, 33, 34, 37, 39, 42, 44, 58, + 62, 92, 126, 127, 0, 31, 43, 46, + 48, 57, 65, 90, 95, 96, 97, 122, + 9, 13, 32, 33, 34, 37, 39, 44, + 58, 60, 62, 92, 126, 127, 0, 31, + 42, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 34, 44, 92, 127, 0, + 31, 9, 13, 32, 44, 60, 9, 13, + 32, 33, 34, 37, 39, 44, 60, 92, + 126, 127, 0, 31, 42, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 9, 13, + 32, 33, 34, 37, 39, 44, 92, 126, + 127, 0, 31, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 34, + 37, 39, 44, 60, 92, 126, 127, 0, + 31, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 44, 0, 8, 11, + 127, 9, 13, 32, 34, 44, 60, 92, + 127, 0, 31, 9, 13, 32, 33, 34, + 37, 39, 42, 44, 58, 92, 126, 127, + 0, 31, 43, 46, 48, 57, 65, 90, + 95, 96, 97, 122, 9, 13, 32, 33, + 34, 37, 39, 44, 58, 60, 92, 126, + 127, 0, 31, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 34, 44, + 92, 127, 0, 31, 9, 13, 32, 34, + 44, 92, 127, 0, 31, 9, 13, 32, + 33, 34, 37, 39, 44, 60, 92, 126, + 127, 0, 31, 42, 46, 48, 57, 65, + 90, 95, 96, 97, 122, 9, 13, 32, + 33, 34, 37, 39, 44, 92, 126, 127, + 0, 31, 42, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 34, 37, + 39, 44, 60, 92, 126, 127, 0, 31, + 42, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 44, 0, 8, 11, 127, + 9, 13, 32, 33, 34, 37, 39, 42, + 44, 58, 92, 126, 127, 0, 31, 43, + 46, 48, 57, 65, 90, 95, 96, 97, + 122, 9, 13, 32, 33, 34, 37, 39, + 44, 58, 60, 92, 126, 127, 0, 31, + 42, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 34, 44, 92, 127, 0, + 31, 9, 13, 32, 33, 34, 37, 39, + 44, 60, 92, 126, 127, 0, 31, 42, + 46, 48, 57, 65, 90, 95, 96, 97, + 122, 9, 13, 32, 33, 34, 37, 39, + 44, 60, 126, 42, 46, 48, 57, 65, + 90, 95, 96, 97, 122, 9, 13, 32, + 33, 37, 39, 42, 44, 58, 126, 43, + 46, 48, 57, 65, 90, 95, 96, 97, + 122, 9, 13, 32, 33, 37, 39, 44, + 58, 60, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 44, 58, + 60, 9, 13, 32, 44, 9, 13, 32, + 34, 44, 60, 92, 127, 0, 31, 9, + 13, 32, 33, 34, 37, 39, 44, 60, + 92, 126, 127, 0, 31, 42, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 9, + 13, 32, 33, 34, 37, 39, 42, 44, + 58, 92, 126, 127, 0, 31, 43, 46, + 48, 57, 65, 90, 95, 96, 97, 122, + 9, 13, 32, 33, 34, 37, 39, 44, + 58, 60, 92, 126, 127, 0, 31, 42, + 46, 48, 57, 65, 90, 95, 122, 0 +}; + +static const char _tsip_machine_parser_header_P_Asserted_Identity_single_lengths[] = { + 0, 2, 1, 2, 2, 2, 2, 2, + 2, 2, 2, 1, 2, 2, 2, 2, + 2, 2, 2, 2, 3, 9, 1, 2, + 9, 1, 2, 3, 0, 4, 3, 0, + 1, 4, 1, 9, 1, 2, 9, 7, + 8, 4, 1, 2, 4, 1, 2, 4, + 0, 10, 9, 5, 0, 4, 10, 8, + 9, 5, 4, 5, 5, 4, 5, 11, + 9, 10, 6, 5, 8, 6, 13, 12, + 13, 5, 9, 13, 13, 7, 5, 12, + 11, 12, 4, 8, 12, 12, 10, 9, + 5, 0, 4, 10, 8, 9, 5, 4, + 5, 5, 4, 5, 11, 9, 10, 6, + 5, 8, 6, 13, 12, 13, 5, 9, + 14, 14, 8, 8, 13, 12, 13, 5, + 14, 14, 6, 4, 10, 7, 12, 11, + 12, 4, 12, 12, 4, 5, 5, 4, + 5, 11, 9, 10, 6, 5, 4, 10, + 8, 9, 5, 7, 5, 12, 11, 12, + 4, 8, 12, 12, 10, 10, 8, 6, + 13, 12, 13, 5, 9, 13, 13, 6, + 2, 3, 4, 1, 1, 5, 11, 9, + 10, 6, 5, 6, 6, 5, 8, 6, + 13, 12, 13, 5, 9, 13, 13, 8, + 13, 11, 11, 11, 7, 5, 9, 13, + 14, 14, 7, 5, 12, 11, 12, 4, + 8, 13, 13, 7, 7, 12, 11, 12, + 4, 13, 13, 7, 12, 10, 10, 10, + 6, 4, 8, 12, 13, 13, 0 +}; + +static const char _tsip_machine_parser_header_P_Asserted_Identity_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 6, 0, 0, + 6, 0, 0, 0, 2, 4, 0, 0, + 0, 0, 0, 6, 0, 0, 6, 5, + 5, 0, 0, 0, 2, 0, 0, 0, + 3, 5, 5, 0, 0, 0, 4, 4, + 4, 0, 2, 4, 0, 0, 0, 4, + 4, 4, 0, 2, 1, 0, 6, 5, + 5, 2, 1, 6, 5, 1, 0, 6, + 5, 5, 2, 1, 6, 5, 5, 5, + 0, 0, 0, 5, 4, 4, 0, 2, + 4, 0, 0, 0, 5, 4, 4, 0, + 2, 1, 0, 6, 5, 5, 2, 1, + 6, 5, 1, 1, 6, 5, 5, 2, + 6, 5, 0, 0, 4, 1, 6, 5, + 5, 2, 6, 5, 2, 4, 0, 0, + 0, 4, 4, 4, 0, 2, 0, 5, + 4, 4, 0, 1, 0, 6, 5, 5, + 2, 1, 6, 5, 5, 4, 1, 0, + 6, 5, 5, 2, 1, 6, 5, 0, + 0, 0, 0, 2, 0, 0, 4, 4, + 4, 0, 2, 4, 0, 0, 1, 0, + 6, 5, 5, 2, 1, 6, 5, 1, + 6, 5, 5, 4, 0, 0, 1, 6, + 6, 5, 1, 0, 6, 5, 5, 2, + 1, 6, 5, 1, 1, 6, 5, 5, + 2, 6, 5, 1, 6, 5, 5, 4, + 0, 0, 1, 6, 6, 5, 0 +}; + +static const short _tsip_machine_parser_header_P_Asserted_Identity_index_offsets[] = { + 0, 0, 3, 5, 8, 11, 14, 17, + 20, 23, 26, 29, 31, 34, 37, 40, + 43, 46, 49, 52, 55, 59, 75, 77, + 80, 96, 98, 101, 105, 108, 117, 121, + 122, 124, 129, 131, 147, 149, 152, 168, + 181, 195, 200, 202, 205, 212, 214, 217, + 222, 226, 242, 257, 263, 264, 269, 284, + 297, 311, 317, 324, 334, 340, 345, 351, + 367, 381, 396, 403, 411, 421, 428, 448, + 466, 485, 493, 504, 524, 543, 552, 558, + 577, 594, 612, 619, 629, 648, 666, 682, + 697, 703, 704, 709, 725, 738, 752, 758, + 765, 775, 781, 786, 792, 809, 823, 838, + 845, 853, 863, 870, 890, 908, 927, 935, + 946, 967, 987, 997, 1007, 1027, 1045, 1064, + 1072, 1093, 1113, 1120, 1125, 1140, 1149, 1168, + 1185, 1203, 1210, 1229, 1247, 1254, 1264, 1270, + 1275, 1281, 1297, 1311, 1326, 1333, 1341, 1346, + 1362, 1375, 1389, 1395, 1404, 1410, 1429, 1446, + 1464, 1471, 1481, 1500, 1518, 1534, 1549, 1559, + 1566, 1586, 1604, 1623, 1631, 1642, 1662, 1681, + 1688, 1691, 1695, 1700, 1704, 1706, 1712, 1728, + 1742, 1757, 1764, 1772, 1783, 1790, 1796, 1806, + 1813, 1833, 1851, 1870, 1878, 1889, 1909, 1928, + 1938, 1958, 1975, 1992, 2008, 2016, 2022, 2033, + 2053, 2074, 2094, 2103, 2109, 2128, 2145, 2163, + 2170, 2180, 2200, 2219, 2228, 2237, 2256, 2273, + 2291, 2298, 2318, 2337, 2346, 2365, 2381, 2397, + 2412, 2419, 2424, 2434, 2453, 2473, 2492 +}; + +static const unsigned char _tsip_machine_parser_header_P_Asserted_Identity_trans_targs[] = { + 2, 2, 0, 3, 0, 4, 4, 0, + 5, 5, 0, 6, 6, 0, 7, 7, + 0, 8, 8, 0, 9, 9, 0, 10, + 10, 0, 11, 11, 0, 12, 0, 13, + 13, 0, 14, 14, 0, 15, 15, 0, + 16, 16, 0, 17, 17, 0, 18, 18, + 0, 19, 19, 0, 20, 20, 0, 20, + 20, 21, 0, 21, 22, 21, 39, 44, + 39, 39, 28, 39, 39, 39, 39, 86, + 39, 86, 0, 23, 0, 24, 24, 0, + 24, 25, 24, 39, 44, 39, 39, 28, + 39, 39, 39, 39, 86, 39, 86, 0, + 26, 0, 27, 27, 0, 27, 27, 28, + 0, 29, 29, 0, 30, 30, 29, 31, + 29, 29, 29, 29, 0, 30, 30, 31, + 0, 32, 33, 32, 33, 34, 33, 35, + 0, 230, 0, 35, 36, 35, 39, 44, + 39, 39, 28, 39, 39, 39, 39, 49, + 39, 49, 0, 37, 0, 38, 38, 0, + 38, 25, 38, 39, 44, 39, 39, 28, + 39, 39, 39, 39, 49, 39, 49, 0, + 40, 42, 40, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 0, 41, 25, 41, + 39, 39, 39, 28, 39, 39, 39, 39, + 39, 39, 0, 41, 25, 41, 28, 0, + 43, 0, 40, 40, 0, 45, 47, 48, + 0, 0, 0, 44, 46, 0, 44, 44, + 0, 41, 25, 41, 28, 0, 44, 44, + 44, 0, 50, 42, 50, 39, 39, 39, + 39, 49, 52, 39, 49, 49, 49, 39, + 49, 0, 51, 25, 51, 39, 39, 39, + 52, 28, 39, 39, 39, 39, 39, 39, + 0, 51, 25, 51, 52, 28, 0, 53, + 53, 34, 53, 54, 53, 54, 34, 54, + 55, 77, 55, 55, 54, 58, 55, 55, + 55, 55, 55, 53, 56, 34, 56, 55, + 55, 55, 54, 55, 55, 55, 55, 55, + 53, 57, 34, 57, 55, 55, 55, 54, + 58, 55, 55, 55, 55, 55, 53, 57, + 34, 57, 54, 58, 53, 53, 34, 53, + 54, 59, 59, 53, 60, 34, 60, 54, + 61, 59, 59, 59, 59, 53, 60, 34, + 60, 54, 61, 53, 62, 34, 62, 63, + 62, 62, 34, 62, 63, 53, 62, 63, + 34, 63, 64, 68, 64, 64, 63, 67, + 53, 64, 64, 64, 64, 64, 62, 65, + 34, 65, 64, 64, 64, 63, 53, 64, + 64, 64, 64, 64, 62, 66, 34, 66, + 64, 64, 64, 63, 67, 53, 64, 64, + 64, 64, 64, 62, 66, 34, 66, 63, + 67, 53, 62, 62, 34, 62, 63, 53, + 62, 62, 62, 68, 34, 68, 69, 70, + 53, 73, 62, 62, 68, 66, 34, 66, + 63, 67, 53, 62, 63, 34, 63, 71, + 74, 71, 71, 70, 67, 53, 73, 71, + 62, 62, 71, 71, 75, 71, 75, 68, + 72, 34, 72, 71, 69, 71, 71, 70, + 53, 73, 71, 62, 62, 71, 71, 71, + 71, 68, 66, 34, 66, 71, 69, 71, + 71, 70, 67, 53, 73, 71, 62, 62, + 71, 71, 71, 71, 68, 68, 34, 68, + 70, 53, 68, 68, 62, 66, 34, 66, + 69, 70, 67, 53, 73, 62, 62, 68, + 76, 34, 76, 71, 69, 71, 71, 71, + 70, 53, 73, 71, 62, 62, 75, 75, + 75, 71, 75, 68, 51, 34, 51, 71, + 69, 71, 71, 70, 28, 53, 73, 71, + 62, 62, 71, 71, 71, 71, 68, 77, + 34, 77, 78, 79, 82, 53, 53, 77, + 57, 34, 57, 54, 58, 53, 54, 34, + 54, 80, 83, 80, 80, 79, 58, 82, + 80, 53, 53, 80, 80, 84, 80, 84, + 77, 81, 34, 81, 80, 78, 80, 80, + 79, 82, 80, 53, 53, 80, 80, 80, + 80, 77, 57, 34, 57, 80, 78, 80, + 80, 79, 58, 82, 80, 53, 53, 80, + 80, 80, 80, 77, 77, 34, 77, 79, + 77, 77, 53, 57, 34, 57, 78, 79, + 58, 82, 53, 53, 77, 85, 34, 85, + 80, 78, 80, 80, 80, 79, 82, 80, + 53, 53, 84, 84, 84, 80, 84, 77, + 51, 34, 51, 80, 78, 80, 80, 79, + 28, 82, 80, 53, 53, 80, 80, 80, + 80, 77, 87, 42, 87, 39, 39, 39, + 39, 86, 89, 39, 86, 86, 86, 39, + 86, 0, 88, 25, 88, 39, 39, 39, + 89, 28, 39, 39, 39, 39, 39, 39, + 0, 88, 25, 88, 89, 28, 0, 90, + 90, 34, 90, 91, 90, 91, 34, 91, + 92, 202, 92, 92, 91, 95, 92, 92, + 92, 222, 92, 222, 90, 93, 34, 93, + 92, 92, 92, 91, 92, 92, 92, 92, + 92, 90, 94, 34, 94, 92, 92, 92, + 91, 95, 92, 92, 92, 92, 92, 90, + 94, 34, 94, 91, 95, 90, 90, 34, + 90, 91, 96, 96, 90, 97, 34, 97, + 91, 98, 96, 96, 96, 96, 90, 97, + 34, 97, 91, 98, 90, 99, 34, 99, + 100, 99, 99, 34, 99, 100, 90, 99, + 100, 34, 100, 101, 105, 101, 101, 100, + 104, 90, 101, 101, 101, 194, 101, 194, + 99, 102, 34, 102, 101, 101, 101, 100, + 90, 101, 101, 101, 101, 101, 99, 103, + 34, 103, 101, 101, 101, 100, 104, 90, + 101, 101, 101, 101, 101, 99, 103, 34, + 103, 100, 104, 90, 99, 99, 34, 99, + 100, 90, 99, 99, 99, 105, 34, 105, + 106, 107, 90, 110, 99, 99, 105, 103, + 34, 103, 100, 104, 90, 99, 100, 34, + 100, 108, 111, 108, 108, 107, 104, 90, + 110, 108, 99, 99, 108, 108, 112, 108, + 112, 105, 109, 34, 109, 108, 106, 108, + 108, 107, 90, 110, 108, 99, 99, 108, + 108, 108, 108, 105, 103, 34, 103, 108, + 106, 108, 108, 107, 104, 90, 110, 108, + 99, 99, 108, 108, 108, 108, 105, 105, + 34, 105, 107, 90, 105, 105, 99, 103, + 34, 103, 106, 107, 104, 90, 110, 99, + 99, 105, 113, 34, 113, 108, 106, 108, + 108, 108, 107, 114, 90, 110, 108, 99, + 99, 112, 112, 112, 108, 112, 105, 51, + 34, 51, 108, 106, 108, 108, 107, 114, + 28, 90, 110, 108, 99, 99, 108, 108, + 108, 108, 105, 115, 34, 115, 106, 199, + 90, 119, 99, 99, 115, 115, 34, 115, + 106, 116, 90, 119, 99, 99, 115, 100, + 34, 100, 117, 111, 117, 117, 116, 104, + 90, 119, 117, 99, 99, 117, 117, 120, + 117, 120, 115, 118, 34, 118, 117, 106, + 117, 117, 116, 90, 119, 117, 99, 99, + 117, 117, 117, 117, 115, 103, 34, 103, + 117, 106, 117, 117, 116, 104, 90, 119, + 117, 99, 99, 117, 117, 117, 117, 115, + 115, 34, 115, 116, 90, 115, 115, 99, + 121, 34, 121, 117, 106, 117, 117, 117, + 116, 191, 90, 119, 117, 99, 99, 120, + 120, 120, 117, 120, 115, 122, 34, 122, + 117, 106, 117, 117, 116, 191, 132, 90, + 119, 117, 99, 99, 117, 117, 117, 117, + 115, 122, 34, 122, 54, 123, 132, 53, + 53, 34, 53, 124, 53, 124, 34, 124, + 55, 125, 55, 55, 54, 58, 55, 55, + 55, 55, 55, 53, 125, 34, 125, 78, + 126, 129, 53, 53, 125, 54, 34, 54, + 127, 83, 127, 127, 126, 58, 129, 127, + 53, 53, 127, 127, 130, 127, 130, 125, + 128, 34, 128, 127, 78, 127, 127, 126, + 129, 127, 53, 53, 127, 127, 127, 127, + 125, 57, 34, 57, 127, 78, 127, 127, + 126, 58, 129, 127, 53, 53, 127, 127, + 127, 127, 125, 125, 34, 125, 126, 125, + 125, 53, 131, 34, 131, 127, 78, 127, + 127, 127, 126, 129, 127, 53, 53, 130, + 130, 130, 127, 130, 125, 122, 34, 122, + 127, 78, 127, 127, 126, 132, 129, 127, + 53, 53, 127, 127, 127, 127, 125, 53, + 34, 53, 54, 133, 133, 53, 134, 34, + 134, 54, 135, 133, 133, 133, 133, 53, + 134, 34, 134, 54, 135, 53, 136, 34, + 136, 137, 136, 136, 34, 136, 137, 142, + 136, 137, 34, 137, 138, 158, 138, 138, + 137, 141, 142, 138, 138, 138, 138, 138, + 136, 139, 34, 139, 138, 138, 138, 137, + 142, 138, 138, 138, 138, 138, 136, 140, + 34, 140, 138, 138, 138, 137, 141, 142, + 138, 138, 138, 138, 138, 136, 140, 34, + 140, 137, 141, 142, 136, 136, 34, 136, + 137, 142, 136, 136, 136, 142, 34, 142, + 143, 53, 143, 34, 143, 144, 147, 144, + 144, 54, 132, 144, 144, 144, 156, 144, + 156, 53, 145, 34, 145, 144, 144, 144, + 54, 144, 144, 144, 144, 144, 53, 146, + 34, 146, 144, 144, 144, 54, 132, 144, + 144, 144, 144, 144, 53, 146, 34, 146, + 54, 132, 53, 147, 34, 147, 148, 149, + 152, 53, 53, 147, 146, 34, 146, 54, + 132, 53, 54, 34, 54, 150, 153, 150, + 150, 149, 58, 152, 150, 53, 53, 150, + 150, 154, 150, 154, 147, 151, 34, 151, + 150, 148, 150, 150, 149, 152, 150, 53, + 53, 150, 150, 150, 150, 147, 57, 34, + 57, 150, 148, 150, 150, 149, 58, 152, + 150, 53, 53, 150, 150, 150, 150, 147, + 147, 34, 147, 149, 147, 147, 53, 146, + 34, 146, 78, 79, 132, 82, 53, 53, + 77, 155, 34, 155, 150, 148, 150, 150, + 150, 149, 152, 150, 53, 53, 154, 154, + 154, 150, 154, 147, 51, 34, 51, 150, + 148, 150, 150, 149, 28, 152, 150, 53, + 53, 150, 150, 150, 150, 147, 157, 34, + 157, 144, 144, 144, 144, 54, 123, 144, + 156, 156, 156, 144, 156, 53, 122, 34, + 122, 144, 144, 144, 54, 123, 132, 144, + 144, 144, 144, 144, 53, 158, 34, 158, + 159, 160, 142, 163, 136, 136, 158, 140, + 34, 140, 137, 141, 142, 136, 137, 34, + 137, 161, 164, 161, 161, 160, 141, 142, + 163, 161, 136, 136, 161, 161, 165, 161, + 165, 158, 162, 34, 162, 161, 159, 161, + 161, 160, 142, 163, 161, 136, 136, 161, + 161, 161, 161, 158, 140, 34, 140, 161, + 159, 161, 161, 160, 141, 142, 163, 161, + 136, 136, 161, 161, 161, 161, 158, 158, + 34, 158, 160, 142, 158, 158, 136, 140, + 34, 140, 159, 160, 141, 142, 163, 136, + 136, 158, 166, 34, 166, 161, 159, 161, + 161, 161, 160, 142, 163, 161, 136, 136, + 165, 165, 165, 161, 165, 158, 167, 34, + 167, 161, 159, 161, 161, 160, 171, 142, + 163, 161, 136, 136, 161, 161, 161, 161, + 158, 167, 168, 167, 172, 171, 33, 32, + 169, 33, 32, 170, 170, 33, 32, 170, + 170, 171, 33, 32, 33, 32, 32, 32, + 142, 173, 173, 34, 173, 174, 142, 173, + 174, 34, 174, 175, 182, 175, 175, 174, + 178, 142, 175, 175, 175, 175, 175, 173, + 176, 34, 176, 175, 175, 175, 174, 142, + 175, 175, 175, 175, 175, 173, 177, 34, + 177, 175, 175, 175, 174, 178, 142, 175, + 175, 175, 175, 175, 173, 177, 34, 177, + 174, 178, 142, 173, 173, 34, 173, 174, + 142, 179, 179, 173, 180, 34, 180, 174, + 181, 142, 179, 179, 179, 179, 173, 180, + 34, 180, 174, 181, 142, 173, 136, 34, + 136, 137, 33, 136, 182, 34, 182, 183, + 184, 33, 187, 173, 173, 182, 177, 34, + 177, 174, 178, 142, 173, 174, 34, 174, + 185, 188, 185, 185, 184, 178, 33, 187, + 185, 173, 173, 185, 185, 189, 185, 189, + 182, 186, 34, 186, 185, 183, 185, 185, + 184, 33, 187, 185, 173, 173, 185, 185, + 185, 185, 182, 177, 34, 177, 185, 183, + 185, 185, 184, 178, 33, 187, 185, 173, + 173, 185, 185, 185, 185, 182, 182, 34, + 182, 184, 33, 182, 182, 173, 177, 34, + 177, 183, 184, 178, 33, 187, 173, 173, + 182, 190, 34, 190, 185, 183, 185, 185, + 185, 184, 33, 187, 185, 173, 173, 189, + 189, 189, 185, 189, 182, 167, 34, 167, + 185, 183, 185, 185, 184, 171, 33, 187, + 185, 173, 173, 185, 185, 185, 185, 182, + 115, 34, 115, 106, 192, 90, 119, 99, + 99, 115, 193, 34, 193, 117, 198, 117, + 117, 116, 104, 90, 119, 117, 99, 99, + 117, 117, 120, 117, 120, 115, 193, 34, + 193, 101, 115, 101, 101, 100, 104, 90, + 101, 101, 101, 194, 101, 194, 99, 195, + 34, 195, 101, 101, 101, 101, 100, 197, + 90, 101, 194, 194, 194, 101, 194, 99, + 196, 34, 196, 101, 101, 101, 100, 197, + 104, 90, 101, 101, 101, 101, 101, 99, + 196, 34, 196, 100, 197, 104, 90, 99, + 99, 34, 99, 193, 90, 99, 103, 34, + 103, 106, 116, 104, 90, 119, 99, 99, + 115, 193, 34, 193, 117, 198, 117, 117, + 116, 104, 90, 119, 117, 99, 99, 117, + 117, 200, 117, 200, 115, 201, 34, 201, + 117, 106, 117, 117, 117, 116, 191, 90, + 119, 117, 99, 99, 200, 200, 200, 117, + 200, 115, 51, 34, 51, 117, 106, 117, + 117, 116, 191, 28, 90, 119, 117, 99, + 99, 117, 117, 117, 117, 115, 202, 34, + 202, 203, 204, 207, 90, 90, 202, 94, + 34, 94, 91, 95, 90, 91, 34, 91, + 205, 208, 205, 205, 204, 95, 207, 205, + 90, 90, 205, 205, 209, 205, 209, 202, + 206, 34, 206, 205, 203, 205, 205, 204, + 207, 205, 90, 90, 205, 205, 205, 205, + 202, 94, 34, 94, 205, 203, 205, 205, + 204, 95, 207, 205, 90, 90, 205, 205, + 205, 205, 202, 202, 34, 202, 204, 202, + 202, 90, 94, 34, 94, 203, 204, 95, + 207, 90, 90, 202, 210, 34, 210, 205, + 203, 205, 205, 205, 204, 211, 207, 205, + 90, 90, 209, 209, 209, 205, 209, 202, + 51, 34, 51, 205, 203, 205, 205, 204, + 211, 28, 207, 205, 90, 90, 205, 205, + 205, 205, 202, 212, 34, 212, 203, 227, + 216, 90, 90, 212, 212, 34, 212, 203, + 213, 216, 90, 90, 212, 91, 34, 91, + 214, 208, 214, 214, 213, 95, 216, 214, + 90, 90, 214, 214, 217, 214, 217, 212, + 215, 34, 215, 214, 203, 214, 214, 213, + 216, 214, 90, 90, 214, 214, 214, 214, + 212, 94, 34, 94, 214, 203, 214, 214, + 213, 95, 216, 214, 90, 90, 214, 214, + 214, 214, 212, 212, 34, 212, 213, 212, + 212, 90, 218, 34, 218, 214, 203, 214, + 214, 214, 213, 219, 216, 214, 90, 90, + 217, 217, 217, 214, 217, 212, 122, 34, + 122, 214, 203, 214, 214, 213, 219, 132, + 216, 214, 90, 90, 214, 214, 214, 214, + 212, 212, 34, 212, 203, 220, 216, 90, + 90, 212, 221, 34, 221, 214, 226, 214, + 214, 213, 95, 216, 214, 90, 90, 214, + 214, 217, 214, 217, 212, 221, 34, 221, + 92, 212, 92, 92, 91, 95, 92, 92, + 92, 222, 92, 222, 90, 223, 34, 223, + 92, 92, 92, 92, 91, 225, 92, 222, + 222, 222, 92, 222, 90, 224, 34, 224, + 92, 92, 92, 91, 225, 95, 92, 92, + 92, 92, 92, 90, 224, 34, 224, 91, + 225, 95, 90, 90, 34, 90, 221, 90, + 94, 34, 94, 203, 213, 95, 216, 90, + 90, 212, 221, 34, 221, 214, 226, 214, + 214, 213, 95, 216, 214, 90, 90, 214, + 214, 228, 214, 228, 212, 229, 34, 229, + 214, 203, 214, 214, 214, 213, 219, 216, + 214, 90, 90, 228, 228, 228, 214, 228, + 212, 51, 34, 51, 214, 203, 214, 214, + 213, 219, 28, 216, 214, 90, 90, 214, + 214, 214, 214, 212, 0, 0 +}; + +static const char _tsip_machine_parser_header_P_Asserted_Identity_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 3, 3, 3, 13, 13, + 13, 13, 3, 13, 13, 13, 13, 13, + 13, 13, 0, 0, 0, 0, 0, 0, + 3, 3, 3, 13, 13, 13, 13, 3, + 13, 13, 13, 13, 13, 13, 13, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 7, 0, 9, 9, 9, 9, + 0, 11, 0, 3, 3, 3, 13, 13, + 13, 13, 3, 13, 13, 13, 13, 13, + 13, 13, 0, 0, 0, 0, 0, 0, + 3, 3, 3, 13, 13, 13, 13, 3, + 13, 13, 13, 13, 13, 13, 13, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 5, 5, 5, + 0, 0, 0, 5, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 5, 5, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 5, 5, 0, 0, 0, + 0, 5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 0, 19, 16, 19, + 13, 13, 13, 13, 16, 3, 13, 13, + 13, 13, 13, 0, 16, 16, 16, 0, + 0, 0, 16, 0, 0, 0, 0, 0, + 0, 23, 16, 23, 0, 0, 0, 16, + 5, 0, 0, 0, 0, 0, 0, 16, + 16, 16, 16, 0, 0, 16, 16, 16, + 16, 1, 1, 0, 16, 16, 16, 16, + 0, 0, 0, 0, 0, 0, 16, 16, + 16, 16, 0, 0, 16, 16, 16, 16, + 0, 16, 16, 16, 16, 7, 0, 19, + 16, 19, 13, 13, 13, 13, 16, 3, + 7, 13, 13, 13, 13, 13, 0, 16, + 16, 16, 0, 0, 0, 16, 7, 0, + 0, 0, 0, 0, 0, 23, 16, 23, + 0, 0, 0, 16, 5, 7, 0, 0, + 0, 0, 0, 0, 16, 16, 16, 16, + 0, 7, 0, 16, 16, 16, 16, 7, + 1, 1, 0, 16, 16, 16, 0, 16, + 7, 0, 0, 0, 0, 23, 16, 23, + 16, 5, 7, 0, 19, 16, 19, 13, + 13, 13, 13, 16, 3, 7, 0, 13, + 0, 0, 13, 13, 13, 13, 13, 0, + 16, 16, 16, 0, 0, 0, 0, 16, + 7, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 23, 16, 23, 0, 0, 0, + 0, 16, 5, 7, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 16, 16, 16, + 16, 7, 0, 0, 0, 23, 16, 23, + 0, 16, 5, 7, 0, 0, 0, 0, + 16, 16, 16, 0, 0, 0, 0, 0, + 16, 7, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 5, 16, 5, 0, + 0, 0, 0, 16, 5, 7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 16, + 16, 16, 0, 16, 0, 0, 0, 0, + 23, 16, 23, 16, 5, 0, 19, 16, + 19, 13, 13, 13, 13, 16, 3, 0, + 13, 0, 0, 13, 13, 13, 13, 13, + 0, 16, 16, 16, 0, 0, 0, 0, + 16, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 23, 16, 23, 0, 0, 0, + 0, 16, 5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 16, 16, 16, 16, + 0, 0, 0, 23, 16, 23, 0, 16, + 5, 0, 0, 0, 0, 16, 16, 16, + 0, 0, 0, 0, 0, 16, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 5, 16, 5, 0, 0, 0, 0, 16, + 5, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 5, 5, 0, 0, 0, + 0, 5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 0, 27, 16, 27, + 13, 13, 13, 13, 16, 3, 13, 13, + 13, 13, 13, 13, 0, 16, 16, 16, + 0, 0, 0, 16, 0, 0, 0, 0, + 0, 0, 31, 16, 31, 0, 0, 0, + 16, 5, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 0, 0, 16, 16, + 16, 16, 1, 1, 0, 16, 16, 16, + 16, 0, 0, 0, 0, 0, 0, 16, + 16, 16, 16, 0, 0, 16, 16, 16, + 16, 0, 16, 16, 16, 16, 7, 0, + 27, 16, 27, 13, 13, 13, 13, 16, + 3, 7, 13, 13, 13, 13, 13, 13, + 0, 16, 16, 16, 0, 0, 0, 16, + 7, 0, 0, 0, 0, 0, 0, 31, + 16, 31, 0, 0, 0, 16, 5, 7, + 0, 0, 0, 0, 0, 0, 16, 16, + 16, 16, 0, 7, 0, 16, 16, 16, + 16, 7, 1, 1, 0, 16, 16, 16, + 0, 16, 7, 0, 0, 0, 0, 31, + 16, 31, 16, 5, 7, 0, 27, 16, + 27, 13, 13, 13, 13, 16, 3, 7, + 0, 13, 0, 0, 13, 13, 13, 13, + 13, 0, 16, 16, 16, 0, 0, 0, + 0, 16, 7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 31, 16, 31, 0, + 0, 0, 0, 16, 5, 7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 16, + 16, 16, 16, 7, 0, 0, 0, 31, + 16, 31, 0, 16, 5, 7, 0, 0, + 0, 0, 16, 16, 16, 0, 0, 0, + 0, 0, 16, 0, 7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 5, + 16, 5, 0, 0, 0, 0, 16, 0, + 5, 7, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 16, 16, 16, 0, 16, + 7, 0, 0, 0, 0, 16, 16, 16, + 0, 16, 7, 0, 0, 0, 0, 27, + 16, 27, 13, 13, 13, 13, 16, 3, + 7, 0, 13, 0, 0, 13, 13, 13, + 13, 13, 0, 16, 16, 16, 0, 0, + 0, 0, 16, 7, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 31, 16, 31, + 0, 0, 0, 0, 16, 5, 7, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 7, 0, 0, 0, + 16, 16, 16, 0, 0, 0, 0, 0, + 16, 0, 7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 23, 16, 23, + 0, 0, 0, 0, 16, 0, 5, 7, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 16, 16, 16, 16, 0, 0, 0, + 16, 16, 16, 16, 0, 19, 16, 19, + 13, 13, 13, 13, 16, 3, 13, 13, + 13, 13, 13, 0, 16, 16, 16, 0, + 16, 0, 0, 0, 0, 19, 16, 19, + 13, 13, 13, 13, 16, 3, 0, 13, + 0, 0, 13, 13, 13, 13, 13, 0, + 16, 16, 16, 0, 0, 0, 0, 16, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 23, 16, 23, 0, 0, 0, 0, + 16, 5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 16, 16, 16, 16, 0, + 0, 0, 16, 16, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 23, 16, 23, + 0, 0, 0, 0, 16, 5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 16, + 16, 16, 16, 1, 1, 0, 16, 16, + 16, 16, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 0, 0, 16, 16, + 16, 16, 0, 16, 16, 16, 16, 7, + 0, 19, 16, 19, 13, 13, 13, 13, + 16, 3, 7, 13, 13, 13, 13, 13, + 0, 16, 16, 16, 0, 0, 0, 16, + 7, 0, 0, 0, 0, 0, 0, 23, + 16, 23, 0, 0, 0, 16, 5, 7, + 0, 0, 0, 0, 0, 0, 16, 16, + 16, 16, 0, 7, 0, 16, 16, 16, + 16, 7, 1, 1, 0, 16, 16, 16, + 16, 0, 19, 16, 19, 13, 13, 13, + 13, 16, 3, 13, 13, 13, 13, 13, + 13, 0, 16, 16, 16, 0, 0, 0, + 16, 0, 0, 0, 0, 0, 0, 23, + 16, 23, 0, 0, 0, 16, 5, 0, + 0, 0, 0, 0, 0, 16, 16, 16, + 16, 0, 0, 16, 16, 16, 0, 16, + 0, 0, 0, 0, 23, 16, 23, 16, + 5, 0, 19, 16, 19, 13, 13, 13, + 13, 16, 3, 0, 13, 0, 0, 13, + 13, 13, 13, 13, 0, 16, 16, 16, + 0, 0, 0, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 23, 16, + 23, 0, 0, 0, 0, 16, 5, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 0, 0, 0, 23, + 16, 23, 0, 16, 5, 0, 0, 0, + 0, 16, 16, 16, 0, 0, 0, 0, + 0, 16, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 5, 16, 5, 0, + 0, 0, 0, 16, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 16, 16, + 16, 0, 0, 0, 0, 16, 0, 0, + 0, 0, 0, 0, 0, 0, 23, 16, + 23, 0, 0, 0, 16, 0, 5, 0, + 0, 0, 0, 0, 0, 16, 16, 16, + 0, 16, 7, 0, 0, 0, 0, 23, + 16, 23, 16, 5, 7, 0, 19, 16, + 19, 13, 13, 13, 13, 16, 3, 7, + 0, 13, 0, 0, 13, 13, 13, 13, + 13, 0, 16, 16, 16, 0, 0, 0, + 0, 16, 7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 23, 16, 23, 0, + 0, 0, 0, 16, 5, 7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 16, + 16, 16, 16, 7, 0, 0, 0, 23, + 16, 23, 0, 16, 5, 7, 0, 0, + 0, 0, 16, 16, 16, 0, 0, 0, + 0, 0, 16, 7, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 5, 16, + 5, 0, 0, 0, 0, 16, 5, 7, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 7, 0, + 0, 7, 0, 0, 0, 7, 0, 0, + 0, 0, 7, 0, 7, 1, 1, 0, + 7, 0, 16, 16, 16, 16, 7, 0, + 19, 16, 19, 13, 13, 13, 13, 16, + 3, 7, 13, 13, 13, 13, 13, 0, + 16, 16, 16, 0, 0, 0, 16, 7, + 0, 0, 0, 0, 0, 0, 23, 16, + 23, 0, 0, 0, 16, 5, 7, 0, + 0, 0, 0, 0, 0, 16, 16, 16, + 16, 0, 7, 0, 16, 16, 16, 16, + 7, 1, 1, 0, 16, 16, 16, 16, + 0, 7, 0, 0, 0, 0, 0, 16, + 16, 16, 16, 0, 7, 0, 16, 16, + 16, 16, 7, 0, 16, 16, 16, 0, + 16, 7, 0, 0, 0, 0, 23, 16, + 23, 16, 5, 7, 0, 19, 16, 19, + 13, 13, 13, 13, 16, 3, 7, 0, + 13, 0, 0, 13, 13, 13, 13, 13, + 0, 16, 16, 16, 0, 0, 0, 0, + 16, 7, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 23, 16, 23, 0, 0, + 0, 0, 16, 5, 7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 16, 16, + 16, 16, 7, 0, 0, 0, 23, 16, + 23, 0, 16, 5, 7, 0, 0, 0, + 0, 16, 16, 16, 0, 0, 0, 0, + 0, 16, 7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 5, 16, 5, + 0, 0, 0, 0, 16, 5, 7, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 0, 16, 7, 0, 0, + 0, 0, 27, 16, 27, 13, 13, 13, + 13, 16, 3, 7, 0, 13, 0, 0, + 13, 13, 13, 13, 13, 0, 27, 16, + 27, 13, 13, 13, 13, 16, 3, 7, + 13, 13, 13, 13, 13, 13, 0, 16, + 16, 16, 0, 0, 0, 0, 16, 0, + 7, 0, 0, 0, 0, 0, 0, 0, + 31, 16, 31, 0, 0, 0, 16, 0, + 5, 7, 0, 0, 0, 0, 0, 0, + 16, 16, 16, 16, 0, 0, 7, 0, + 16, 16, 16, 16, 7, 0, 31, 16, + 31, 0, 16, 5, 7, 0, 0, 0, + 0, 27, 16, 27, 13, 13, 13, 13, + 16, 3, 7, 0, 13, 0, 0, 13, + 13, 13, 13, 13, 0, 16, 16, 16, + 0, 0, 0, 0, 0, 16, 0, 7, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 16, 5, 0, 0, 0, + 0, 16, 0, 5, 7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 16, 16, + 16, 0, 16, 0, 0, 0, 0, 31, + 16, 31, 16, 5, 0, 27, 16, 27, + 13, 13, 13, 13, 16, 3, 0, 13, + 0, 0, 13, 13, 13, 13, 13, 0, + 16, 16, 16, 0, 0, 0, 0, 16, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 31, 16, 31, 0, 0, 0, 0, + 16, 5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 16, 16, 16, 16, 0, + 0, 0, 31, 16, 31, 0, 16, 5, + 0, 0, 0, 0, 16, 16, 16, 0, + 0, 0, 0, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 5, 16, 5, 0, 0, 0, 0, 16, + 0, 5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 16, 16, 16, 0, 16, + 0, 0, 0, 0, 16, 16, 16, 0, + 16, 0, 0, 0, 0, 27, 16, 27, + 13, 13, 13, 13, 16, 3, 0, 13, + 0, 0, 13, 13, 13, 13, 13, 0, + 16, 16, 16, 0, 0, 0, 0, 16, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 31, 16, 31, 0, 0, 0, 0, + 16, 5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 16, 16, 16, 16, 0, + 0, 0, 16, 16, 16, 0, 0, 0, + 0, 0, 16, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 23, 16, + 23, 0, 0, 0, 0, 16, 0, 5, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 16, 16, 16, 0, 16, 0, 0, + 0, 0, 27, 16, 27, 13, 13, 13, + 13, 16, 3, 0, 13, 0, 0, 13, + 13, 13, 13, 13, 0, 27, 16, 27, + 13, 13, 13, 13, 16, 3, 13, 13, + 13, 13, 13, 13, 0, 16, 16, 16, + 0, 0, 0, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 31, 16, 31, + 0, 0, 0, 16, 0, 5, 0, 0, + 0, 0, 0, 0, 16, 16, 16, 16, + 0, 0, 0, 16, 16, 16, 16, 0, + 31, 16, 31, 0, 16, 5, 0, 0, + 0, 0, 27, 16, 27, 13, 13, 13, + 13, 16, 3, 0, 13, 0, 0, 13, + 13, 13, 13, 13, 0, 16, 16, 16, + 0, 0, 0, 0, 0, 16, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 16, 5, 0, 0, 0, 0, + 16, 0, 5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; + +static const int tsip_machine_parser_header_P_Asserted_Identity_start = 1; +static const int tsip_machine_parser_header_P_Asserted_Identity_first_final = 230; +static const int tsip_machine_parser_header_P_Asserted_Identity_error = 0; + +static const int tsip_machine_parser_header_P_Asserted_Identity_en_main = 1; + + +/* #line 136 "./ragel/tsip_parser_header_P_Asserted_Identity.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_P_Asserted_Identity_first_final); + (void)(tsip_machine_parser_header_P_Asserted_Identity_error); + (void)(tsip_machine_parser_header_P_Asserted_Identity_en_main); + +/* #line 1225 "./src/headers/tsip_header_P_Asserted_Identity.c" */ + { + cs = tsip_machine_parser_header_P_Asserted_Identity_start; + } + +/* #line 141 "./ragel/tsip_parser_header_P_Asserted_Identity.rl" */ + +/* #line 1232 "./src/headers/tsip_header_P_Asserted_Identity.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_P_Asserted_Identity_trans_keys + _tsip_machine_parser_header_P_Asserted_Identity_key_offsets[cs]; + _trans = _tsip_machine_parser_header_P_Asserted_Identity_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_P_Asserted_Identity_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_P_Asserted_Identity_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + cs = _tsip_machine_parser_header_P_Asserted_Identity_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_P_Asserted_Identity_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_P_Asserted_Identity_actions + _tsip_machine_parser_header_P_Asserted_Identity_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 51 "./ragel/tsip_parser_header_P_Asserted_Identity.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 55 "./ragel/tsip_parser_header_P_Asserted_Identity.rl" */ + { + if(!curr_p_asserted_identity){ + curr_p_asserted_identity = tsip_header_P_Asserted_Identity_create(); + } + } + break; + case 2: +/* #line 61 "./ragel/tsip_parser_header_P_Asserted_Identity.rl" */ + { + if(curr_p_asserted_identity){ + TSK_PARSER_SET_STRING(curr_p_asserted_identity->display_name); + tsk_strunquote(&curr_p_asserted_identity->display_name); + } + } + break; + case 3: +/* #line 68 "./ragel/tsip_parser_header_P_Asserted_Identity.rl" */ + { + if(curr_p_asserted_identity && !curr_p_asserted_identity->uri){ + int len = (int)(p - tag_start); + if(curr_p_asserted_identity && !curr_p_asserted_identity->uri){ + if((curr_p_asserted_identity->uri = tsip_uri_parse(tag_start, (tsk_size_t)len)) && curr_p_asserted_identity->display_name){ + curr_p_asserted_identity->uri->display_name = tsk_strdup(curr_p_asserted_identity->display_name); + } + } + } + } + break; + case 4: +/* #line 79 "./ragel/tsip_parser_header_P_Asserted_Identity.rl" */ + { + if(curr_p_asserted_identity){ + tsk_list_push_back_data(hdr_p_asserted_identities, ((void**) &curr_p_asserted_identity)); + } + } + break; + case 5: +/* #line 85 "./ragel/tsip_parser_header_P_Asserted_Identity.rl" */ + { + } + break; +/* #line 1354 "./src/headers/tsip_header_P_Asserted_Identity.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 142 "./ragel/tsip_parser_header_P_Asserted_Identity.rl" */ + + if( cs < +/* #line 1370 "./src/headers/tsip_header_P_Asserted_Identity.c" */ +230 +/* #line 143 "./ragel/tsip_parser_header_P_Asserted_Identity.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'P-Asserted-Identity' header."); + TSK_OBJECT_SAFE_FREE(curr_p_asserted_identity); + TSK_OBJECT_SAFE_FREE(hdr_p_asserted_identities); + } + + return hdr_p_asserted_identities; +} + + + + + +//======================================================== +// P_Asserted_Identity header object definition +// + +/**@ingroup tsip_header_P_Asserted_Identity_group +*/ +static tsk_object_t* tsip_header_P_Asserted_Identity_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_P_Asserted_Identity_t *P_Asserted_Identity = self; + if(P_Asserted_Identity){ + TSIP_HEADER(P_Asserted_Identity)->type = tsip_htype_P_Asserted_Identity; + TSIP_HEADER(P_Asserted_Identity)->serialize = tsip_header_P_Asserted_Identity_serialize; + } + else{ + TSK_DEBUG_ERROR("Failed to create new P_Asserted_Identity header."); + } + return self; +} + +/**@ingroup tsip_header_P_Asserted_Identity_group +*/ +static tsk_object_t* tsip_header_P_Asserted_Identity_dtor(tsk_object_t *self) +{ + tsip_header_P_Asserted_Identity_t *P_Asserted_Identity = self; + if(P_Asserted_Identity){ + TSK_FREE(P_Asserted_Identity->display_name); + TSK_OBJECT_SAFE_FREE(P_Asserted_Identity->uri); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(P_Asserted_Identity)); + } + else{ + TSK_DEBUG_ERROR("Null P_Asserted_Identity header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_P_Asserted_Identity_def_s = +{ + sizeof(tsip_header_P_Asserted_Identity_t), + tsip_header_P_Asserted_Identity_ctor, + tsip_header_P_Asserted_Identity_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_P_Asserted_Identity_def_t = &tsip_header_P_Asserted_Identity_def_s; diff --git a/tinySIP/src/headers/tsip_header_P_Associated_URI.c b/tinySIP/src/headers/tsip_header_P_Associated_URI.c new file mode 100644 index 0000000..54c5e19 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_P_Associated_URI.c @@ -0,0 +1,558 @@ + +/* #line 1 "./ragel/tsip_parser_header_P_Associated_URI.rl" */ +/* +* 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 tsip_header_P_Associated_URI.c + * @brief SIP P-Associated-URI header as per RFC 3455. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_P_Associated_URI.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_time.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 106 "./ragel/tsip_parser_header_P_Associated_URI.rl" */ + + +tsip_header_P_Associated_URI_t* tsip_header_P_Associated_URI_create(const tsip_uri_t* uri) +{ + return tsk_object_new(TSIP_HEADER_P_ASSOCIATED_URI_VA_ARGS(uri)); +} + +tsip_header_P_Associated_URI_t* tsip_header_P_Associated_URI_create_null() +{ + return tsip_header_P_Associated_URI_create(tsk_null); +} + +int tsip_header_P_Associated_URI_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_P_Associated_URI_t *P_Associated_URI = (const tsip_header_P_Associated_URI_t *)header; + int ret = 0; + + /* Uri with hacked display-name*/ + if((ret = tsip_uri_serialize(P_Associated_URI->uri, tsk_true, tsk_true, output))){ + return ret; + } + + return ret; + } + + return -1; +} + +tsip_header_P_Associated_URIs_L_t *tsip_header_P_Associated_URI_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_P_Associated_URIs_L_t *hdr_p_associated_uris = tsk_list_create(); + + const char *tag_start = tsk_null; + tsip_header_P_Associated_URI_t *curr_p_associated_uri = tsk_null; + + +/* #line 91 "./src/headers/tsip_header_P_Associated_URI.c" */ +static const char _tsip_machine_parser_header_P_Associated_URI_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3, 1, 4, 1, 5, 1, 6, 2, + 1, 0, 2, 4, 5 +}; + +static const short _tsip_machine_parser_header_P_Associated_URI_key_offsets[] = { + 0, 0, 2, 3, 5, 7, 9, 11, + 13, 15, 17, 19, 21, 23, 24, 26, + 28, 30, 33, 52, 53, 55, 74, 75, + 77, 80, 84, 96, 99, 99, 100, 105, + 106, 123, 124, 126, 142, 160, 166, 167, + 169, 174, 193, 194, 196, 215, 216, 218, + 221, 229, 230, 232, 237, 242, 243, 245, + 249, 255, 272, 279, 287, 295, 303, 305, + 312, 321, 323, 326, 328, 331, 333, 336, + 339, 340, 343, 344, 347, 348, 357, 366, + 374, 382, 390, 398, 400, 406, 415, 424, + 433, 435, 438, 441, 442, 443, 460, 478, + 482, 483, 485, 493, 494, 496, 500, 506 +}; + +static const char _tsip_machine_parser_header_P_Associated_URI_trans_keys[] = { + 80, 112, 45, 65, 97, 83, 115, 83, + 115, 79, 111, 67, 99, 73, 105, 65, + 97, 84, 116, 69, 101, 68, 100, 45, + 85, 117, 82, 114, 73, 105, 9, 32, + 58, 9, 13, 32, 33, 34, 37, 39, + 60, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 10, 9, 32, 9, + 13, 32, 33, 34, 37, 39, 60, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 10, 9, 32, 9, 32, 60, + 65, 90, 97, 122, 9, 32, 43, 58, + 45, 46, 48, 57, 65, 90, 97, 122, + 9, 32, 58, 62, 9, 13, 32, 44, + 59, 10, 9, 13, 32, 33, 37, 39, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 10, 9, 32, 9, 32, + 33, 37, 39, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 44, 59, 61, 126, + 42, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 44, 59, 61, 10, 9, + 32, 9, 32, 44, 59, 61, 9, 13, + 32, 33, 34, 37, 39, 91, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 10, 9, 32, 9, 13, 32, 33, + 34, 37, 39, 91, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 10, + 9, 32, 9, 32, 34, 13, 34, 92, + 127, 0, 8, 10, 31, 10, 9, 32, + 9, 13, 32, 44, 59, 9, 13, 32, + 44, 59, 10, 9, 32, 9, 32, 44, + 59, 0, 9, 11, 12, 14, 127, 9, + 13, 32, 33, 37, 39, 44, 59, 126, + 42, 46, 48, 57, 65, 90, 95, 122, + 58, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 58, 48, 57, 65, 70, 97, 102, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 48, 57, 46, 48, 57, 48, 57, + 46, 48, 57, 48, 57, 93, 48, 57, + 93, 48, 57, 93, 46, 48, 57, 46, + 46, 48, 57, 46, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 46, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 46, 58, + 93, 48, 57, 65, 70, 97, 102, 46, + 58, 93, 48, 57, 65, 70, 97, 102, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 48, 57, 46, 48, 57, 46, 48, + 57, 46, 58, 9, 13, 32, 33, 37, + 39, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 60, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 60, 10, 9, 32, 13, 34, 92, + 127, 0, 8, 10, 31, 10, 9, 32, + 9, 13, 32, 60, 0, 9, 11, 12, + 14, 127, 0 +}; + +static const char _tsip_machine_parser_header_P_Associated_URI_single_lengths[] = { + 0, 2, 1, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 2, 2, + 2, 3, 9, 1, 2, 9, 1, 2, + 3, 0, 4, 3, 0, 1, 5, 1, + 7, 1, 2, 6, 10, 6, 1, 2, + 5, 9, 1, 2, 9, 1, 2, 3, + 4, 1, 2, 5, 5, 1, 2, 4, + 0, 9, 1, 2, 2, 2, 2, 1, + 3, 0, 1, 0, 1, 0, 1, 1, + 1, 1, 1, 1, 1, 3, 3, 2, + 2, 2, 2, 2, 0, 3, 3, 3, + 0, 1, 1, 1, 1, 7, 8, 4, + 1, 2, 4, 1, 2, 4, 0, 0 +}; + +static const char _tsip_machine_parser_header_P_Associated_URI_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 0, 5, 0, 0, + 0, 2, 4, 0, 0, 0, 0, 0, + 5, 0, 0, 5, 4, 0, 0, 0, + 0, 5, 0, 0, 5, 0, 0, 0, + 2, 0, 0, 0, 0, 0, 0, 0, + 3, 4, 3, 3, 3, 3, 0, 3, + 3, 1, 1, 1, 1, 1, 1, 1, + 0, 1, 0, 1, 0, 3, 3, 3, + 3, 3, 3, 0, 3, 3, 3, 3, + 1, 1, 1, 0, 0, 5, 5, 0, + 0, 0, 2, 0, 0, 0, 3, 0 +}; + +static const short _tsip_machine_parser_header_P_Associated_URI_index_offsets[] = { + 0, 0, 3, 5, 8, 11, 14, 17, + 20, 23, 26, 29, 32, 35, 37, 40, + 43, 46, 50, 65, 67, 70, 85, 87, + 90, 94, 97, 106, 110, 111, 113, 119, + 121, 134, 136, 139, 151, 166, 173, 175, + 178, 184, 199, 201, 204, 219, 221, 224, + 228, 235, 237, 240, 246, 252, 254, 257, + 262, 266, 280, 285, 291, 297, 303, 306, + 311, 318, 320, 323, 325, 328, 330, 333, + 336, 338, 341, 343, 346, 348, 355, 362, + 368, 374, 380, 386, 389, 393, 400, 407, + 414, 416, 419, 422, 424, 426, 439, 453, + 458, 460, 463, 470, 472, 475, 480, 484 +}; + +static const char _tsip_machine_parser_header_P_Associated_URI_indicies[] = { + 0, 0, 1, 2, 1, 3, 3, 1, + 4, 4, 1, 5, 5, 1, 6, 6, + 1, 7, 7, 1, 8, 8, 1, 9, + 9, 1, 10, 10, 1, 11, 11, 1, + 12, 12, 1, 13, 1, 14, 14, 1, + 15, 15, 1, 16, 16, 1, 16, 16, + 17, 1, 18, 19, 18, 20, 21, 20, + 20, 22, 20, 20, 20, 20, 20, 20, + 1, 23, 1, 24, 24, 1, 25, 26, + 25, 20, 21, 20, 20, 22, 20, 20, + 20, 20, 20, 20, 1, 27, 1, 28, + 28, 1, 28, 28, 29, 1, 30, 30, + 1, 31, 31, 32, 33, 32, 32, 32, + 32, 1, 31, 31, 33, 1, 34, 35, + 34, 36, 37, 36, 38, 39, 1, 40, + 1, 39, 41, 39, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 1, 43, 1, + 44, 44, 1, 44, 44, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 1, 45, + 46, 45, 47, 47, 47, 48, 49, 50, + 47, 47, 47, 47, 47, 1, 51, 52, + 51, 17, 39, 50, 1, 53, 1, 54, + 54, 1, 54, 54, 17, 39, 50, 1, + 50, 55, 50, 56, 57, 56, 56, 58, + 56, 56, 56, 56, 56, 56, 1, 59, + 1, 60, 60, 1, 60, 61, 60, 56, + 57, 56, 56, 58, 56, 56, 56, 56, + 56, 56, 1, 62, 1, 63, 63, 1, + 63, 63, 57, 1, 64, 65, 66, 1, + 1, 1, 57, 67, 1, 57, 57, 1, + 68, 46, 68, 48, 49, 1, 69, 70, + 69, 17, 39, 1, 71, 1, 72, 72, + 1, 72, 72, 17, 39, 1, 57, 57, + 57, 1, 68, 46, 68, 56, 56, 56, + 48, 49, 56, 56, 56, 56, 56, 1, + 74, 73, 73, 73, 1, 76, 65, 75, + 75, 75, 1, 76, 65, 77, 77, 77, + 1, 76, 65, 78, 78, 78, 1, 76, + 65, 1, 80, 79, 73, 73, 1, 81, + 76, 65, 82, 75, 75, 1, 83, 1, + 84, 85, 1, 86, 1, 87, 88, 1, + 89, 1, 65, 90, 1, 65, 91, 1, + 65, 1, 87, 92, 1, 87, 1, 84, + 93, 1, 84, 1, 81, 76, 65, 94, + 77, 77, 1, 81, 76, 65, 78, 78, + 78, 1, 96, 65, 95, 95, 95, 1, + 98, 65, 97, 97, 97, 1, 98, 65, + 99, 99, 99, 1, 98, 65, 100, 100, + 100, 1, 98, 65, 1, 101, 95, 95, + 1, 81, 98, 65, 102, 97, 97, 1, + 81, 98, 65, 103, 99, 99, 1, 81, + 98, 65, 100, 100, 100, 1, 104, 1, + 81, 105, 1, 81, 106, 1, 81, 1, + 80, 1, 107, 108, 107, 109, 109, 109, + 109, 109, 109, 109, 109, 109, 1, 110, + 111, 110, 109, 109, 109, 112, 109, 109, + 109, 109, 109, 109, 1, 113, 114, 113, + 29, 1, 115, 1, 107, 107, 1, 117, + 118, 119, 1, 1, 1, 116, 120, 1, + 116, 116, 1, 110, 111, 110, 112, 1, + 116, 116, 116, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_P_Associated_URI_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 18, 19, 93, 98, 25, 20, + 21, 21, 22, 23, 24, 25, 26, 27, + 26, 28, 29, 30, 30, 31, 18, 32, + 103, 33, 36, 34, 35, 37, 31, 36, + 18, 32, 41, 37, 38, 39, 40, 42, + 57, 48, 58, 43, 44, 45, 46, 47, + 49, 51, 56, 50, 52, 52, 53, 54, + 55, 59, 92, 60, 63, 61, 62, 64, + 79, 65, 77, 66, 67, 75, 68, 69, + 73, 70, 71, 72, 74, 76, 78, 80, + 88, 81, 84, 82, 83, 85, 86, 87, + 89, 90, 91, 94, 96, 93, 95, 22, + 25, 95, 22, 97, 98, 99, 101, 102, + 100 +}; + +static const char _tsip_machine_parser_header_P_Associated_URI_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 3, 3, 15, 15, 3, 0, + 0, 3, 3, 0, 0, 0, 1, 0, + 0, 0, 0, 7, 11, 11, 11, 0, + 13, 0, 1, 0, 0, 18, 18, 0, + 18, 9, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 18, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 5, 5, + 5, 0, 0, 0, 0, 0, 0, 0, + 0 +}; + +static const int tsip_machine_parser_header_P_Associated_URI_start = 1; +static const int tsip_machine_parser_header_P_Associated_URI_first_final = 103; +static const int tsip_machine_parser_header_P_Associated_URI_error = 0; + +static const int tsip_machine_parser_header_P_Associated_URI_en_main = 1; + + +/* #line 147 "./ragel/tsip_parser_header_P_Associated_URI.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_P_Associated_URI_first_final); + (void)(tsip_machine_parser_header_P_Associated_URI_error); + (void)(tsip_machine_parser_header_P_Associated_URI_en_main); + +/* #line 344 "./src/headers/tsip_header_P_Associated_URI.c" */ + { + cs = tsip_machine_parser_header_P_Associated_URI_start; + } + +/* #line 152 "./ragel/tsip_parser_header_P_Associated_URI.rl" */ + +/* #line 351 "./src/headers/tsip_header_P_Associated_URI.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_P_Associated_URI_trans_keys + _tsip_machine_parser_header_P_Associated_URI_key_offsets[cs]; + _trans = _tsip_machine_parser_header_P_Associated_URI_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_P_Associated_URI_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_P_Associated_URI_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_P_Associated_URI_indicies[_trans]; + cs = _tsip_machine_parser_header_P_Associated_URI_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_P_Associated_URI_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_P_Associated_URI_actions + _tsip_machine_parser_header_P_Associated_URI_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 51 "./ragel/tsip_parser_header_P_Associated_URI.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 55 "./ragel/tsip_parser_header_P_Associated_URI.rl" */ + { + if(!curr_p_associated_uri){ + curr_p_associated_uri = tsip_header_P_Associated_URI_create_null(); + } + } + break; + case 2: +/* #line 61 "./ragel/tsip_parser_header_P_Associated_URI.rl" */ + { + if(curr_p_associated_uri){ + TSK_PARSER_SET_STRING(curr_p_associated_uri->display_name); + tsk_strunquote(&curr_p_associated_uri->display_name); + } + } + break; + case 3: +/* #line 68 "./ragel/tsip_parser_header_P_Associated_URI.rl" */ + { + if(curr_p_associated_uri && !curr_p_associated_uri->uri){ + int len = (int)(p - tag_start); + if(curr_p_associated_uri && !curr_p_associated_uri->uri){ + if((curr_p_associated_uri->uri = tsip_uri_parse(tag_start, (tsk_size_t)len)) && curr_p_associated_uri->display_name){ + curr_p_associated_uri->uri->display_name = tsk_strdup(curr_p_associated_uri->display_name); + } + } + } + } + break; + case 4: +/* #line 79 "./ragel/tsip_parser_header_P_Associated_URI.rl" */ + { + if(curr_p_associated_uri){ + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(curr_p_associated_uri)); + } + } + break; + case 5: +/* #line 85 "./ragel/tsip_parser_header_P_Associated_URI.rl" */ + { + if(curr_p_associated_uri){ + tsk_list_push_back_data(hdr_p_associated_uris, ((void**) &curr_p_associated_uri)); + } + } + break; + case 6: +/* #line 91 "./ragel/tsip_parser_header_P_Associated_URI.rl" */ + { + } + break; +/* #line 482 "./src/headers/tsip_header_P_Associated_URI.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 153 "./ragel/tsip_parser_header_P_Associated_URI.rl" */ + + if( cs < +/* #line 498 "./src/headers/tsip_header_P_Associated_URI.c" */ +103 +/* #line 154 "./ragel/tsip_parser_header_P_Associated_URI.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'P-Associated-URI' header."); + TSK_OBJECT_SAFE_FREE(curr_p_associated_uri); + TSK_OBJECT_SAFE_FREE(hdr_p_associated_uris); + } + + return hdr_p_associated_uris; +} + + + + + +//======================================================== +// P_Associated_URI header object definition +// + +static tsk_object_t* tsip_header_P_Associated_URI_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_P_Associated_URI_t *P_Associated_URI = self; + if(P_Associated_URI){ + const tsip_uri_t* uri = va_arg(*app, const tsip_uri_t*); + + TSIP_HEADER(P_Associated_URI)->type = tsip_htype_P_Associated_URI; + TSIP_HEADER(P_Associated_URI)->serialize = tsip_header_P_Associated_URI_serialize; + if(uri){ + P_Associated_URI->uri = tsk_object_ref((void*)uri); + } + } + else{ + TSK_DEBUG_ERROR("Failed to create new P_Associated_URI header."); + } + return self; +} + +static tsk_object_t* tsip_header_P_Associated_URI_dtor(tsk_object_t *self) +{ + tsip_header_P_Associated_URI_t *P_Associated_URI = self; + if(P_Associated_URI){ + TSK_FREE(P_Associated_URI->display_name); + TSK_OBJECT_SAFE_FREE(P_Associated_URI->uri); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(P_Associated_URI)); + } + else{ + TSK_DEBUG_ERROR("Null P_Associated_URI header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_P_Associated_URI_def_s = +{ + sizeof(tsip_header_P_Associated_URI_t), + tsip_header_P_Associated_URI_ctor, + tsip_header_P_Associated_URI_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_P_Associated_URI_def_t = &tsip_header_P_Associated_URI_def_s; diff --git a/tinySIP/src/headers/tsip_header_P_Called_Party_ID.c b/tinySIP/src/headers/tsip_header_P_Called_Party_ID.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_P_Called_Party_ID.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_P_Charging_Function_Addresses.c b/tinySIP/src/headers/tsip_header_P_Charging_Function_Addresses.c new file mode 100644 index 0000000..6cd979a --- /dev/null +++ b/tinySIP/src/headers/tsip_header_P_Charging_Function_Addresses.c @@ -0,0 +1,749 @@ + +/* #line 1 "./ragel/tsip_parser_header_P_Charging_Function_Addresses.rl" */ +/* +* 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 tsip_header_P_Charging_Function_Addresses.c + * @brief SIP P-Charging-Function-Addresses header as per RFC 3455. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_P_Charging_Function_Addresses.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_time.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 97 "./ragel/tsip_parser_header_P_Charging_Function_Addresses.rl" */ + + + +tsip_header_P_Charging_Function_Addresses_t* tsip_header_P_Charging_Function_Addresses_create() +{ + return tsk_object_new(tsip_header_P_Charging_Function_Addresses_def_t); +} + +int tsip_header_P_Charging_Function_Addresses_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_P_Charging_Function_Addresses_t *P_Charging_Function_Addresses = (const tsip_header_P_Charging_Function_Addresses_t *)header; + return tsk_buffer_append_2(output, "%s%s%s%s%s", + P_Charging_Function_Addresses->ecf ? "ecf=" : "", + P_Charging_Function_Addresses->ecf ? P_Charging_Function_Addresses->ecf : "", + + (P_Charging_Function_Addresses->ecf && P_Charging_Function_Addresses->ccf) ? ";" : "", + + P_Charging_Function_Addresses->ccf ? "ccf=" : "", + P_Charging_Function_Addresses->ccf ? P_Charging_Function_Addresses->ccf : "" + ); + } + + return -1; +} + +tsip_header_P_Charging_Function_Addressess_L_t *tsip_header_P_Charging_Function_Addresses_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_P_Charging_Function_Addressess_L_t *hdr_p_charging_function_addressess = tsk_list_create(); + + const char *tag_start = tsk_null; + tsip_header_P_Charging_Function_Addresses_t *curr_p_charging_function_addresses = 0; + + +/* #line 88 "./src/headers/tsip_header_P_Charging_Function_Addresses.c" */ +static const char _tsip_machine_parser_header_P_Charging_Function_Addresses_actions[] = { + 0, 1, 6, 2, 1, 0, 2, 4, + 5, 3, 2, 4, 5, 3, 3, 4, + 5 +}; + +static const short _tsip_machine_parser_header_P_Charging_Function_Addresses_key_offsets[] = { + 0, 0, 2, 3, 5, 7, 9, 11, + 13, 15, 17, 19, 20, 22, 24, 26, + 28, 30, 32, 34, 36, 37, 39, 41, + 43, 45, 47, 49, 51, 53, 55, 58, + 79, 80, 82, 102, 121, 126, 127, 129, + 133, 152, 153, 155, 174, 175, 177, 180, + 188, 189, 191, 195, 199, 200, 202, 205, + 206, 212, 230, 237, 245, 253, 261, 263, + 270, 279, 281, 284, 286, 289, 291, 294, + 297, 298, 301, 302, 305, 306, 315, 324, + 332, 340, 348, 356, 358, 364, 373, 382, + 391, 393, 396, 399, 400, 401, 422, 443, + 462, 467, 468, 470, 474, 493, 494, 496, + 515, 516, 518, 521, 529, 530, 532, 536, + 542, 560, 567, 575, 583, 591, 593, 600, + 609, 611, 614, 616, 619, 621, 624, 627, + 628, 631, 632, 635, 636, 645, 654, 662, + 670, 678, 686, 688, 694, 703, 712, 721, + 723, 726, 729, 730, 731, 752, 773, 792, + 797, 798, 800, 804, 823, 824, 826, 845, + 846, 848, 851, 859, 860, 862, 866, 872, + 890, 897, 905, 913, 921, 923, 930, 939, + 941, 944, 946, 949, 951, 954, 957, 958, + 961, 962, 965, 966, 975, 984, 992, 1000, + 1008, 1016, 1018, 1024, 1033, 1042, 1051, 1053, + 1056, 1059, 1060, 1061 +}; + +static const char _tsip_machine_parser_header_P_Charging_Function_Addresses_trans_keys[] = { + 80, 112, 45, 67, 99, 72, 104, 65, + 97, 82, 114, 71, 103, 73, 105, 78, + 110, 71, 103, 45, 70, 102, 85, 117, + 78, 110, 67, 99, 84, 116, 73, 105, + 79, 111, 78, 110, 45, 65, 97, 68, + 100, 68, 100, 82, 114, 69, 101, 83, + 115, 83, 115, 69, 101, 83, 115, 9, + 32, 58, 9, 13, 32, 33, 37, 39, + 67, 69, 99, 101, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 10, + 9, 32, 9, 32, 33, 37, 39, 67, + 69, 99, 101, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 59, 61, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 59, 61, 10, 9, + 32, 9, 32, 59, 61, 9, 13, 32, + 33, 34, 37, 39, 91, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 10, 9, 32, 9, 13, 32, 33, 34, + 37, 39, 91, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 10, 9, + 32, 9, 32, 34, 13, 34, 92, 127, + 0, 8, 10, 31, 10, 9, 32, 9, + 13, 32, 59, 9, 13, 32, 59, 10, + 9, 32, 9, 32, 59, 10, 0, 9, + 11, 12, 14, 127, 9, 13, 32, 33, + 37, 39, 59, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 58, 48, + 57, 65, 70, 97, 102, 58, 93, 48, + 57, 65, 70, 97, 102, 58, 93, 48, + 57, 65, 70, 97, 102, 58, 93, 48, + 57, 65, 70, 97, 102, 58, 93, 58, + 48, 57, 65, 70, 97, 102, 46, 58, + 93, 48, 57, 65, 70, 97, 102, 48, + 57, 46, 48, 57, 48, 57, 46, 48, + 57, 48, 57, 93, 48, 57, 93, 48, + 57, 93, 46, 48, 57, 46, 46, 48, + 57, 46, 46, 58, 93, 48, 57, 65, + 70, 97, 102, 46, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 46, 58, 93, + 48, 57, 65, 70, 97, 102, 46, 58, + 93, 48, 57, 65, 70, 97, 102, 48, + 57, 46, 48, 57, 46, 48, 57, 46, + 58, 9, 13, 32, 33, 37, 39, 59, + 61, 67, 99, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 59, 61, 70, 102, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 59, 61, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 59, 61, 10, 9, 32, 9, 32, + 59, 61, 9, 13, 32, 33, 34, 37, + 39, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 13, 32, 33, 34, 37, 39, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 10, 9, 32, 9, 32, + 34, 13, 34, 92, 127, 0, 8, 10, + 31, 10, 9, 32, 9, 13, 32, 59, + 0, 9, 11, 12, 14, 127, 9, 13, + 32, 33, 37, 39, 59, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 58, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 58, 48, 57, 65, 70, 97, 102, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 48, 57, 46, 48, 57, 48, 57, + 46, 48, 57, 48, 57, 93, 48, 57, + 93, 48, 57, 93, 46, 48, 57, 46, + 46, 48, 57, 46, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 46, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 46, 58, + 93, 48, 57, 65, 70, 97, 102, 46, + 58, 93, 48, 57, 65, 70, 97, 102, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 48, 57, 46, 48, 57, 46, 48, + 57, 46, 58, 9, 13, 32, 33, 37, + 39, 59, 61, 67, 99, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 33, 37, 39, 59, 61, + 70, 102, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 59, 61, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 59, 61, 10, 9, 32, + 9, 32, 59, 61, 9, 13, 32, 33, + 34, 37, 39, 91, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 10, + 9, 32, 9, 13, 32, 33, 34, 37, + 39, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 32, 34, 13, 34, 92, 127, 0, + 8, 10, 31, 10, 9, 32, 9, 13, + 32, 59, 0, 9, 11, 12, 14, 127, + 9, 13, 32, 33, 37, 39, 59, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 58, 48, 57, 65, 70, 97, + 102, 58, 93, 48, 57, 65, 70, 97, + 102, 58, 93, 48, 57, 65, 70, 97, + 102, 58, 93, 48, 57, 65, 70, 97, + 102, 58, 93, 58, 48, 57, 65, 70, + 97, 102, 46, 58, 93, 48, 57, 65, + 70, 97, 102, 48, 57, 46, 48, 57, + 48, 57, 46, 48, 57, 48, 57, 93, + 48, 57, 93, 48, 57, 93, 46, 48, + 57, 46, 46, 48, 57, 46, 46, 58, + 93, 48, 57, 65, 70, 97, 102, 46, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 46, 58, 93, 48, 57, 65, 70, + 97, 102, 46, 58, 93, 48, 57, 65, + 70, 97, 102, 48, 57, 46, 48, 57, + 46, 48, 57, 46, 58, 0 +}; + +static const char _tsip_machine_parser_header_P_Charging_Function_Addresses_single_lengths[] = { + 0, 2, 1, 2, 2, 2, 2, 2, + 2, 2, 2, 1, 2, 2, 2, 2, + 2, 2, 2, 2, 1, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 3, 11, + 1, 2, 10, 9, 5, 1, 2, 4, + 9, 1, 2, 9, 1, 2, 3, 4, + 1, 2, 4, 4, 1, 2, 3, 1, + 0, 8, 1, 2, 2, 2, 2, 1, + 3, 0, 1, 0, 1, 0, 1, 1, + 1, 1, 1, 1, 1, 3, 3, 2, + 2, 2, 2, 2, 0, 3, 3, 3, + 0, 1, 1, 1, 1, 11, 11, 9, + 5, 1, 2, 4, 9, 1, 2, 9, + 1, 2, 3, 4, 1, 2, 4, 0, + 8, 1, 2, 2, 2, 2, 1, 3, + 0, 1, 0, 1, 0, 1, 1, 1, + 1, 1, 1, 1, 3, 3, 2, 2, + 2, 2, 2, 0, 3, 3, 3, 0, + 1, 1, 1, 1, 11, 11, 9, 5, + 1, 2, 4, 9, 1, 2, 9, 1, + 2, 3, 4, 1, 2, 4, 0, 8, + 1, 2, 2, 2, 2, 1, 3, 0, + 1, 0, 1, 0, 1, 1, 1, 1, + 1, 1, 1, 3, 3, 2, 2, 2, + 2, 2, 0, 3, 3, 3, 0, 1, + 1, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_P_Charging_Function_Addresses_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 5, + 0, 0, 5, 5, 0, 0, 0, 0, + 5, 0, 0, 5, 0, 0, 0, 2, + 0, 0, 0, 0, 0, 0, 0, 0, + 3, 5, 3, 3, 3, 3, 0, 3, + 3, 1, 1, 1, 1, 1, 1, 1, + 0, 1, 0, 1, 0, 3, 3, 3, + 3, 3, 3, 0, 3, 3, 3, 3, + 1, 1, 1, 0, 0, 5, 5, 5, + 0, 0, 0, 0, 5, 0, 0, 5, + 0, 0, 0, 2, 0, 0, 0, 3, + 5, 3, 3, 3, 3, 0, 3, 3, + 1, 1, 1, 1, 1, 1, 1, 0, + 1, 0, 1, 0, 3, 3, 3, 3, + 3, 3, 0, 3, 3, 3, 3, 1, + 1, 1, 0, 0, 5, 5, 5, 0, + 0, 0, 0, 5, 0, 0, 5, 0, + 0, 0, 2, 0, 0, 0, 3, 5, + 3, 3, 3, 3, 0, 3, 3, 1, + 1, 1, 1, 1, 1, 1, 0, 1, + 0, 1, 0, 3, 3, 3, 3, 3, + 3, 0, 3, 3, 3, 3, 1, 1, + 1, 0, 0, 0 +}; + +static const short _tsip_machine_parser_header_P_Charging_Function_Addresses_index_offsets[] = { + 0, 0, 3, 5, 8, 11, 14, 17, + 20, 23, 26, 29, 31, 34, 37, 40, + 43, 46, 49, 52, 55, 57, 60, 63, + 66, 69, 72, 75, 78, 81, 84, 88, + 105, 107, 110, 126, 141, 147, 149, 152, + 157, 172, 174, 177, 192, 194, 197, 201, + 208, 210, 213, 218, 223, 225, 228, 232, + 234, 238, 252, 257, 263, 269, 275, 278, + 283, 290, 292, 295, 297, 300, 302, 305, + 308, 310, 313, 315, 318, 320, 327, 334, + 340, 346, 352, 358, 361, 365, 372, 379, + 386, 388, 391, 394, 396, 398, 415, 432, + 447, 453, 455, 458, 463, 478, 480, 483, + 498, 500, 503, 507, 514, 516, 519, 524, + 528, 542, 547, 553, 559, 565, 568, 573, + 580, 582, 585, 587, 590, 592, 595, 598, + 600, 603, 605, 608, 610, 617, 624, 630, + 636, 642, 648, 651, 655, 662, 669, 676, + 678, 681, 684, 686, 688, 705, 722, 737, + 743, 745, 748, 753, 768, 770, 773, 788, + 790, 793, 797, 804, 806, 809, 814, 818, + 832, 837, 843, 849, 855, 858, 863, 870, + 872, 875, 877, 880, 882, 885, 888, 890, + 893, 895, 898, 900, 907, 914, 920, 926, + 932, 938, 941, 945, 952, 959, 966, 968, + 971, 974, 976, 978 +}; + +static const unsigned char _tsip_machine_parser_header_P_Charging_Function_Addresses_indicies[] = { + 0, 0, 1, 2, 1, 3, 3, 1, + 4, 4, 1, 5, 5, 1, 6, 6, + 1, 7, 7, 1, 8, 8, 1, 9, + 9, 1, 10, 10, 1, 11, 1, 12, + 12, 1, 13, 13, 1, 14, 14, 1, + 15, 15, 1, 16, 16, 1, 17, 17, + 1, 18, 18, 1, 19, 19, 1, 20, + 1, 21, 21, 1, 22, 22, 1, 23, + 23, 1, 24, 24, 1, 25, 25, 1, + 26, 26, 1, 27, 27, 1, 28, 28, + 1, 29, 29, 1, 29, 29, 30, 1, + 30, 31, 30, 32, 32, 32, 33, 34, + 33, 34, 32, 32, 32, 32, 32, 32, + 1, 35, 1, 36, 36, 1, 36, 36, + 32, 32, 32, 33, 34, 33, 34, 32, + 32, 32, 32, 32, 32, 1, 37, 38, + 37, 39, 39, 39, 40, 41, 39, 39, + 39, 39, 39, 39, 1, 42, 43, 42, + 30, 41, 1, 44, 1, 45, 45, 1, + 45, 45, 30, 41, 1, 41, 46, 41, + 47, 48, 47, 47, 49, 47, 47, 47, + 47, 47, 47, 1, 50, 1, 51, 51, + 1, 51, 52, 51, 47, 48, 47, 47, + 49, 47, 47, 47, 47, 47, 47, 1, + 53, 1, 54, 54, 1, 54, 54, 48, + 1, 55, 56, 57, 1, 1, 1, 48, + 58, 1, 48, 48, 1, 59, 38, 59, + 40, 1, 60, 61, 60, 30, 1, 62, + 1, 63, 63, 1, 63, 63, 30, 1, + 64, 1, 48, 48, 48, 1, 59, 38, + 59, 47, 47, 47, 40, 47, 47, 47, + 47, 47, 47, 1, 66, 65, 65, 65, + 1, 68, 56, 67, 67, 67, 1, 68, + 56, 69, 69, 69, 1, 68, 56, 70, + 70, 70, 1, 68, 56, 1, 72, 71, + 65, 65, 1, 73, 68, 56, 74, 67, + 67, 1, 75, 1, 76, 77, 1, 78, + 1, 79, 80, 1, 81, 1, 56, 82, + 1, 56, 83, 1, 56, 1, 79, 84, + 1, 79, 1, 76, 85, 1, 76, 1, + 73, 68, 56, 86, 69, 69, 1, 73, + 68, 56, 70, 70, 70, 1, 88, 56, + 87, 87, 87, 1, 90, 56, 89, 89, + 89, 1, 90, 56, 91, 91, 91, 1, + 90, 56, 92, 92, 92, 1, 90, 56, + 1, 93, 87, 87, 1, 73, 90, 56, + 94, 89, 89, 1, 73, 90, 56, 95, + 91, 91, 1, 73, 90, 56, 92, 92, + 92, 1, 96, 1, 73, 97, 1, 73, + 98, 1, 73, 1, 72, 1, 37, 38, + 37, 39, 39, 39, 40, 41, 99, 99, + 39, 39, 39, 39, 39, 39, 1, 37, + 38, 37, 39, 39, 39, 40, 41, 100, + 100, 39, 39, 39, 39, 39, 39, 1, + 101, 38, 101, 39, 39, 39, 40, 102, + 39, 39, 39, 39, 39, 39, 1, 103, + 104, 103, 30, 102, 1, 105, 1, 106, + 106, 1, 106, 106, 30, 102, 1, 102, + 107, 102, 108, 109, 108, 108, 110, 108, + 108, 108, 108, 108, 108, 1, 111, 1, + 112, 112, 1, 112, 113, 112, 108, 109, + 108, 108, 110, 108, 108, 108, 108, 108, + 108, 1, 114, 1, 115, 115, 1, 115, + 115, 109, 1, 116, 117, 118, 1, 1, + 1, 109, 119, 1, 109, 109, 1, 120, + 121, 120, 122, 1, 109, 109, 109, 1, + 120, 121, 120, 108, 108, 108, 122, 108, + 108, 108, 108, 108, 108, 1, 124, 123, + 123, 123, 1, 126, 117, 125, 125, 125, + 1, 126, 117, 127, 127, 127, 1, 126, + 117, 128, 128, 128, 1, 126, 117, 1, + 130, 129, 123, 123, 1, 131, 126, 117, + 132, 125, 125, 1, 133, 1, 134, 135, + 1, 136, 1, 137, 138, 1, 139, 1, + 117, 140, 1, 117, 141, 1, 117, 1, + 137, 142, 1, 137, 1, 134, 143, 1, + 134, 1, 131, 126, 117, 144, 127, 127, + 1, 131, 126, 117, 128, 128, 128, 1, + 146, 117, 145, 145, 145, 1, 148, 117, + 147, 147, 147, 1, 148, 117, 149, 149, + 149, 1, 148, 117, 150, 150, 150, 1, + 148, 117, 1, 151, 145, 145, 1, 131, + 148, 117, 152, 147, 147, 1, 131, 148, + 117, 153, 149, 149, 1, 131, 148, 117, + 150, 150, 150, 1, 154, 1, 131, 155, + 1, 131, 156, 1, 131, 1, 130, 1, + 37, 38, 37, 39, 39, 39, 40, 41, + 157, 157, 39, 39, 39, 39, 39, 39, + 1, 37, 38, 37, 39, 39, 39, 40, + 41, 158, 158, 39, 39, 39, 39, 39, + 39, 1, 159, 38, 159, 39, 39, 39, + 40, 160, 39, 39, 39, 39, 39, 39, + 1, 161, 162, 161, 30, 160, 1, 163, + 1, 164, 164, 1, 164, 164, 30, 160, + 1, 160, 165, 160, 166, 167, 166, 166, + 168, 166, 166, 166, 166, 166, 166, 1, + 169, 1, 170, 170, 1, 170, 171, 170, + 166, 167, 166, 166, 168, 166, 166, 166, + 166, 166, 166, 1, 172, 1, 173, 173, + 1, 173, 173, 167, 1, 174, 175, 176, + 1, 1, 1, 167, 177, 1, 167, 167, + 1, 178, 179, 178, 180, 1, 167, 167, + 167, 1, 178, 179, 178, 166, 166, 166, + 180, 166, 166, 166, 166, 166, 166, 1, + 182, 181, 181, 181, 1, 184, 175, 183, + 183, 183, 1, 184, 175, 185, 185, 185, + 1, 184, 175, 186, 186, 186, 1, 184, + 175, 1, 188, 187, 181, 181, 1, 189, + 184, 175, 190, 183, 183, 1, 191, 1, + 192, 193, 1, 194, 1, 195, 196, 1, + 197, 1, 175, 198, 1, 175, 199, 1, + 175, 1, 195, 200, 1, 195, 1, 192, + 201, 1, 192, 1, 189, 184, 175, 202, + 185, 185, 1, 189, 184, 175, 186, 186, + 186, 1, 204, 175, 203, 203, 203, 1, + 206, 175, 205, 205, 205, 1, 206, 175, + 207, 207, 207, 1, 206, 175, 208, 208, + 208, 1, 206, 175, 1, 209, 203, 203, + 1, 189, 206, 175, 210, 205, 205, 1, + 189, 206, 175, 211, 207, 207, 1, 189, + 206, 175, 208, 208, 208, 1, 212, 1, + 189, 213, 1, 189, 214, 1, 189, 1, + 188, 1, 1, 0 +}; + +static const unsigned char _tsip_machine_parser_header_P_Charging_Function_Addresses_trans_targs[] = { + 2, 0, 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, + 35, 93, 148, 33, 34, 36, 55, 35, + 31, 40, 36, 37, 38, 39, 41, 57, + 47, 58, 42, 43, 44, 45, 46, 48, + 50, 56, 49, 51, 51, 52, 53, 54, + 203, 59, 92, 60, 63, 61, 62, 64, + 79, 65, 77, 66, 67, 75, 68, 69, + 73, 70, 71, 72, 74, 76, 78, 80, + 88, 81, 84, 82, 83, 85, 86, 87, + 89, 90, 91, 94, 95, 96, 100, 96, + 97, 98, 99, 101, 112, 107, 113, 102, + 103, 104, 105, 106, 108, 110, 111, 109, + 51, 55, 31, 114, 147, 115, 118, 116, + 117, 119, 134, 120, 132, 121, 122, 130, + 123, 124, 128, 125, 126, 127, 129, 131, + 133, 135, 143, 136, 139, 137, 138, 140, + 141, 142, 144, 145, 146, 149, 150, 151, + 155, 151, 152, 153, 154, 156, 167, 162, + 168, 157, 158, 159, 160, 161, 163, 165, + 166, 164, 51, 55, 31, 169, 202, 170, + 173, 171, 172, 174, 189, 175, 187, 176, + 177, 185, 178, 179, 183, 180, 181, 182, + 184, 186, 188, 190, 198, 191, 194, 192, + 193, 195, 196, 197, 199, 200, 201 +}; + +static const char _tsip_machine_parser_header_P_Charging_Function_Addresses_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 3, 3, 3, 0, 0, 6, 6, 0, + 6, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 6, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 6, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 9, 9, 9, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 6, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 13, 13, 13, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 +}; + +static const int tsip_machine_parser_header_P_Charging_Function_Addresses_start = 1; +static const int tsip_machine_parser_header_P_Charging_Function_Addresses_first_final = 203; +static const int tsip_machine_parser_header_P_Charging_Function_Addresses_error = 0; + +static const int tsip_machine_parser_header_P_Charging_Function_Addresses_en_main = 1; + + +/* #line 135 "./ragel/tsip_parser_header_P_Charging_Function_Addresses.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_P_Charging_Function_Addresses_first_final); + (void)(tsip_machine_parser_header_P_Charging_Function_Addresses_error); + (void)(tsip_machine_parser_header_P_Charging_Function_Addresses_en_main); + +/* #line 546 "./src/headers/tsip_header_P_Charging_Function_Addresses.c" */ + { + cs = tsip_machine_parser_header_P_Charging_Function_Addresses_start; + } + +/* #line 140 "./ragel/tsip_parser_header_P_Charging_Function_Addresses.rl" */ + +/* #line 553 "./src/headers/tsip_header_P_Charging_Function_Addresses.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_P_Charging_Function_Addresses_trans_keys + _tsip_machine_parser_header_P_Charging_Function_Addresses_key_offsets[cs]; + _trans = _tsip_machine_parser_header_P_Charging_Function_Addresses_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_P_Charging_Function_Addresses_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_P_Charging_Function_Addresses_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_P_Charging_Function_Addresses_indicies[_trans]; + cs = _tsip_machine_parser_header_P_Charging_Function_Addresses_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_P_Charging_Function_Addresses_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_P_Charging_Function_Addresses_actions + _tsip_machine_parser_header_P_Charging_Function_Addresses_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 51 "./ragel/tsip_parser_header_P_Charging_Function_Addresses.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 55 "./ragel/tsip_parser_header_P_Charging_Function_Addresses.rl" */ + { + if(!curr_p_charging_function_addresses){ + curr_p_charging_function_addresses = tsip_header_P_Charging_Function_Addresses_create(); + } + } + break; + case 2: +/* #line 61 "./ragel/tsip_parser_header_P_Charging_Function_Addresses.rl" */ + { + if(!curr_p_charging_function_addresses->ccf){ + TSK_PARSER_SET_STRING(curr_p_charging_function_addresses->ccf); + } + } + break; + case 3: +/* #line 67 "./ragel/tsip_parser_header_P_Charging_Function_Addresses.rl" */ + { + if(!curr_p_charging_function_addresses->ecf){ + TSK_PARSER_SET_STRING(curr_p_charging_function_addresses->ecf); + } + } + break; + case 4: +/* #line 73 "./ragel/tsip_parser_header_P_Charging_Function_Addresses.rl" */ + { + if(curr_p_charging_function_addresses){ + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(curr_p_charging_function_addresses)); + } + } + break; + case 5: +/* #line 79 "./ragel/tsip_parser_header_P_Charging_Function_Addresses.rl" */ + { + if(curr_p_charging_function_addresses){ + tsk_list_push_back_data(hdr_p_charging_function_addressess, ((void**) &curr_p_charging_function_addresses)); + } + } + break; + case 6: +/* #line 85 "./ragel/tsip_parser_header_P_Charging_Function_Addresses.rl" */ + { + } + break; +/* #line 678 "./src/headers/tsip_header_P_Charging_Function_Addresses.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 141 "./ragel/tsip_parser_header_P_Charging_Function_Addresses.rl" */ + + if( cs < +/* #line 694 "./src/headers/tsip_header_P_Charging_Function_Addresses.c" */ +203 +/* #line 142 "./ragel/tsip_parser_header_P_Charging_Function_Addresses.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'P-Charging-Function-Addresses' header."); + TSK_OBJECT_SAFE_FREE(curr_p_charging_function_addresses); + TSK_OBJECT_SAFE_FREE(hdr_p_charging_function_addressess); + } + + return hdr_p_charging_function_addressess; +} + + + + + +//======================================================== +// P_Charging_Function_Addresses header object definition +// + +static tsk_object_t* tsip_header_P_Charging_Function_Addresses_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_P_Charging_Function_Addresses_t *P_Charging_Function_Addresses = self; + if(P_Charging_Function_Addresses){ + TSIP_HEADER(P_Charging_Function_Addresses)->type = tsip_htype_P_Charging_Function_Addresses; + TSIP_HEADER(P_Charging_Function_Addresses)->serialize = tsip_header_P_Charging_Function_Addresses_serialize; + } + else{ + TSK_DEBUG_ERROR("Failed to create new P_Charging_Function_Addresses header."); + } + return self; +} + +static tsk_object_t* tsip_header_P_Charging_Function_Addresses_dtor(tsk_object_t *self) +{ + tsip_header_P_Charging_Function_Addresses_t *P_Charging_Function_Addresses = self; + if(P_Charging_Function_Addresses){ + TSK_FREE(P_Charging_Function_Addresses->ecf); + TSK_FREE(P_Charging_Function_Addresses->ccf); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(P_Charging_Function_Addresses)); + } + else{ + TSK_DEBUG_ERROR("Null P_Charging_Function_Addresses header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_P_Charging_Function_Addresses_def_s = +{ + sizeof(tsip_header_P_Charging_Function_Addresses_t), + tsip_header_P_Charging_Function_Addresses_ctor, + tsip_header_P_Charging_Function_Addresses_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_P_Charging_Function_Addresses_def_t = &tsip_header_P_Charging_Function_Addresses_def_s; diff --git a/tinySIP/src/headers/tsip_header_P_Charging_Vector.c b/tinySIP/src/headers/tsip_header_P_Charging_Vector.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_P_Charging_Vector.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_P_DCS_Billing_Info.c b/tinySIP/src/headers/tsip_header_P_DCS_Billing_Info.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_P_DCS_Billing_Info.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_P_DCS_LAES.c b/tinySIP/src/headers/tsip_header_P_DCS_LAES.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_P_DCS_LAES.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_P_DCS_OSPS.c b/tinySIP/src/headers/tsip_header_P_DCS_OSPS.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_P_DCS_OSPS.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_P_DCS_Redirect.c b/tinySIP/src/headers/tsip_header_P_DCS_Redirect.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_P_DCS_Redirect.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_P_DCS_Trace_Party_ID.c b/tinySIP/src/headers/tsip_header_P_DCS_Trace_Party_ID.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_P_DCS_Trace_Party_ID.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_P_Early_Media.c b/tinySIP/src/headers/tsip_header_P_Early_Media.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_P_Early_Media.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_P_Media_Authorization.c b/tinySIP/src/headers/tsip_header_P_Media_Authorization.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_P_Media_Authorization.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_P_Preferred_Identity.c b/tinySIP/src/headers/tsip_header_P_Preferred_Identity.c new file mode 100644 index 0000000..334cfe6 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_P_Preferred_Identity.c @@ -0,0 +1,669 @@ + +/* #line 1 "./ragel/tsip_parser_header_P_Preferred_Identity.rl" */ +/* +* 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 tsip_header_P_Preferred_Identity.c + * @brief SIP P-Preferred-Identity header as per RFC 3325. + * Header field where proxy ACK BYE CAN INV OPT REG + * ------------ ----- ----- --- --- --- --- --- --- + * P-Preferred-Identity adr - o - o o - + * + * + * SUB NOT REF INF UPD PRA + * --- --- --- --- --- --- + * o o o - - - + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_P_Preferred_Identity.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 94 "./ragel/tsip_parser_header_P_Preferred_Identity.rl" */ + + + +tsip_header_P_Preferred_Identity_t* tsip_header_P_Preferred_Identity_create(const tsip_uri_t* uri) +{ + return tsk_object_new(TSIP_HEADER_P_PREFERRED_IDENTITY_VA_ARGS(uri)); +} + +tsip_header_P_Preferred_Identity_t* tsip_header_P_Preferred_Identity_create_null() +{ + return tsip_header_P_Preferred_Identity_create(tsk_null); +} + +int tsip_header_Preferred_Identity_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + int ret; + const tsip_header_P_Preferred_Identity_t *P_Preferred_Identity = (const tsip_header_P_Preferred_Identity_t *)header; + + /* Uri with hacked display-name*/ + if((ret = tsip_uri_serialize(P_Preferred_Identity->uri, tsk_true, tsk_true, output))){ + return ret; + } + return ret; + } + return -1; +} + +tsip_header_P_Preferred_Identity_t *tsip_header_P_Preferred_Identity_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_P_Preferred_Identity_t *hdr_pi = tsip_header_P_Preferred_Identity_create_null(); + + const char *tag_start = tsk_null; + + +/* #line 94 "./src/headers/tsip_header_P_Preferred_Identity.c" */ +static const char _tsip_machine_parser_header_P_Preferred_Identity_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3, 2, 1, 2, 2, 2, 1 +}; + +static const short _tsip_machine_parser_header_P_Preferred_Identity_key_offsets[] = { + 0, 0, 2, 3, 5, 7, 9, 11, + 13, 15, 17, 19, 21, 22, 24, 26, + 28, 30, 32, 34, 36, 38, 41, 62, + 63, 65, 86, 87, 89, 92, 96, 108, + 111, 111, 112, 116, 117, 138, 139, 141, + 162, 179, 197, 201, 202, 204, 212, 213, + 215, 219, 225, 237, 240, 240, 244, 264, + 280, 297, 302, 310, 323, 328, 332, 337, + 358, 375, 393, 399, 408, 418, 424, 449, + 471, 494, 503, 514, 523, 528, 552, 573, + 595, 603, 613, 625, 628, 628, 632, 652, + 668, 685, 690, 698, 711, 716, 720, 725, + 746, 763, 781, 787, 796, 806, 812, 837, + 859, 882, 891, 902, 911, 916, 940, 961, + 983, 991, 1001 +}; + +static const char _tsip_machine_parser_header_P_Preferred_Identity_trans_keys[] = { + 80, 112, 45, 80, 112, 82, 114, 69, + 101, 70, 102, 69, 101, 82, 114, 82, + 114, 69, 101, 68, 100, 45, 73, 105, + 68, 100, 69, 101, 78, 110, 84, 116, + 73, 105, 84, 116, 89, 121, 9, 32, + 58, 9, 13, 32, 33, 34, 37, 39, + 60, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 10, 9, + 32, 9, 13, 32, 33, 34, 37, 39, + 60, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 10, 9, + 32, 9, 32, 60, 65, 90, 97, 122, + 9, 32, 43, 58, 45, 46, 48, 57, + 65, 90, 97, 122, 9, 32, 58, 62, + 9, 13, 32, 44, 10, 9, 13, 32, + 33, 34, 37, 39, 60, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 96, + 97, 122, 10, 9, 32, 9, 13, 32, + 33, 34, 37, 39, 60, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 96, + 97, 122, 9, 13, 32, 33, 37, 39, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 60, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 60, 10, 9, 32, 13, 34, 92, 127, + 0, 8, 10, 31, 10, 9, 32, 9, + 13, 32, 60, 0, 9, 11, 12, 14, + 127, 9, 32, 43, 58, 45, 46, 48, + 57, 65, 90, 97, 122, 9, 32, 58, + 9, 13, 32, 44, 9, 13, 32, 33, + 34, 37, 39, 44, 60, 126, 42, 46, + 48, 57, 65, 90, 95, 96, 97, 122, + 9, 13, 32, 33, 37, 39, 44, 126, + 42, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 33, 37, 39, 44, 60, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 44, 60, 9, 13, + 32, 44, 65, 90, 97, 122, 9, 13, + 32, 44, 58, 43, 46, 48, 57, 65, + 90, 97, 122, 9, 13, 32, 44, 58, + 9, 13, 32, 44, 9, 13, 32, 44, + 62, 9, 13, 32, 33, 34, 37, 39, + 44, 60, 62, 126, 42, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 9, 13, + 32, 33, 37, 39, 44, 62, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 44, 60, 62, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 44, 60, 62, 9, + 13, 32, 44, 62, 65, 90, 97, 122, + 9, 13, 32, 34, 44, 62, 92, 127, + 0, 31, 9, 13, 32, 44, 60, 62, + 9, 13, 32, 33, 34, 37, 39, 44, + 60, 62, 92, 126, 127, 0, 31, 42, + 46, 48, 57, 65, 90, 95, 96, 97, + 122, 9, 13, 32, 33, 34, 37, 39, + 44, 62, 92, 126, 127, 0, 31, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 34, 37, 39, 44, 60, + 62, 92, 126, 127, 0, 31, 42, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 44, 62, 0, 8, 11, 127, 9, + 13, 32, 34, 44, 60, 62, 92, 127, + 0, 31, 9, 13, 32, 34, 44, 92, + 127, 0, 31, 9, 13, 32, 44, 60, + 9, 13, 32, 33, 34, 37, 39, 44, + 60, 92, 126, 127, 0, 31, 42, 46, + 48, 57, 65, 90, 95, 96, 97, 122, + 9, 13, 32, 33, 34, 37, 39, 44, + 92, 126, 127, 0, 31, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 34, 37, 39, 44, 60, 92, 126, + 127, 0, 31, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 44, 0, + 8, 11, 127, 9, 13, 32, 34, 44, + 60, 92, 127, 0, 31, 9, 32, 43, + 58, 45, 46, 48, 57, 65, 90, 97, + 122, 9, 32, 58, 9, 13, 32, 44, + 9, 13, 32, 33, 34, 37, 39, 44, + 60, 126, 42, 46, 48, 57, 65, 90, + 95, 96, 97, 122, 9, 13, 32, 33, + 37, 39, 44, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 60, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 44, 60, 9, 13, 32, 44, 65, 90, + 97, 122, 9, 13, 32, 44, 58, 43, + 46, 48, 57, 65, 90, 97, 122, 9, + 13, 32, 44, 58, 9, 13, 32, 44, + 9, 13, 32, 44, 62, 9, 13, 32, + 33, 34, 37, 39, 44, 60, 62, 126, + 42, 46, 48, 57, 65, 90, 95, 96, + 97, 122, 9, 13, 32, 33, 37, 39, + 44, 62, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 44, 60, 62, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 44, 60, 62, 9, 13, 32, 44, 62, + 65, 90, 97, 122, 9, 13, 32, 34, + 44, 62, 92, 127, 0, 31, 9, 13, + 32, 44, 60, 62, 9, 13, 32, 33, + 34, 37, 39, 44, 60, 62, 92, 126, + 127, 0, 31, 42, 46, 48, 57, 65, + 90, 95, 96, 97, 122, 9, 13, 32, + 33, 34, 37, 39, 44, 62, 92, 126, + 127, 0, 31, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 34, + 37, 39, 44, 60, 62, 92, 126, 127, + 0, 31, 42, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 44, 62, 0, + 8, 11, 127, 9, 13, 32, 34, 44, + 60, 62, 92, 127, 0, 31, 9, 13, + 32, 34, 44, 92, 127, 0, 31, 9, + 13, 32, 44, 60, 9, 13, 32, 33, + 34, 37, 39, 44, 60, 92, 126, 127, + 0, 31, 42, 46, 48, 57, 65, 90, + 95, 96, 97, 122, 9, 13, 32, 33, + 34, 37, 39, 44, 92, 126, 127, 0, + 31, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 34, 37, 39, + 44, 60, 92, 126, 127, 0, 31, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 44, 0, 8, 11, 127, 9, + 13, 32, 34, 44, 60, 92, 127, 0, + 31, 0 +}; + +static const char _tsip_machine_parser_header_P_Preferred_Identity_single_lengths[] = { + 0, 2, 1, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 1, 2, 2, 2, + 2, 2, 2, 2, 2, 3, 9, 1, + 2, 9, 1, 2, 3, 0, 4, 3, + 0, 1, 4, 1, 9, 1, 2, 9, + 7, 8, 4, 1, 2, 4, 1, 2, + 4, 0, 4, 3, 0, 4, 10, 8, + 9, 5, 4, 5, 5, 4, 5, 11, + 9, 10, 6, 5, 8, 6, 13, 12, + 13, 5, 9, 7, 5, 12, 11, 12, + 4, 8, 4, 3, 0, 4, 10, 8, + 9, 5, 4, 5, 5, 4, 5, 11, + 9, 10, 6, 5, 8, 6, 13, 12, + 13, 5, 9, 7, 5, 12, 11, 12, + 4, 8, 0 +}; + +static const char _tsip_machine_parser_header_P_Preferred_Identity_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 6, 0, + 0, 6, 0, 0, 0, 2, 4, 0, + 0, 0, 0, 0, 6, 0, 0, 6, + 5, 5, 0, 0, 0, 2, 0, 0, + 0, 3, 4, 0, 0, 0, 5, 4, + 4, 0, 2, 4, 0, 0, 0, 5, + 4, 4, 0, 2, 1, 0, 6, 5, + 5, 2, 1, 1, 0, 6, 5, 5, + 2, 1, 4, 0, 0, 0, 5, 4, + 4, 0, 2, 4, 0, 0, 0, 5, + 4, 4, 0, 2, 1, 0, 6, 5, + 5, 2, 1, 1, 0, 6, 5, 5, + 2, 1, 0 +}; + +static const short _tsip_machine_parser_header_P_Preferred_Identity_index_offsets[] = { + 0, 0, 3, 5, 8, 11, 14, 17, + 20, 23, 26, 29, 32, 34, 37, 40, + 43, 46, 49, 52, 55, 58, 62, 78, + 80, 83, 99, 101, 104, 108, 111, 120, + 124, 125, 127, 132, 134, 150, 152, 155, + 171, 184, 198, 203, 205, 208, 215, 217, + 220, 225, 229, 238, 242, 243, 248, 264, + 277, 291, 297, 304, 314, 320, 325, 331, + 348, 362, 377, 384, 392, 402, 409, 429, + 447, 466, 474, 485, 494, 500, 519, 536, + 554, 561, 571, 580, 584, 585, 590, 606, + 619, 633, 639, 646, 656, 662, 667, 673, + 690, 704, 719, 726, 734, 744, 751, 771, + 789, 808, 816, 827, 836, 842, 861, 878, + 896, 903, 913 +}; + +static const unsigned char _tsip_machine_parser_header_P_Preferred_Identity_indicies[] = { + 0, 0, 1, 2, 1, 3, 3, 1, + 4, 4, 1, 5, 5, 1, 6, 6, + 1, 7, 7, 1, 8, 8, 1, 9, + 9, 1, 10, 10, 1, 11, 11, 1, + 12, 1, 13, 13, 1, 14, 14, 1, + 15, 15, 1, 16, 16, 1, 17, 17, + 1, 18, 18, 1, 19, 19, 1, 20, + 20, 1, 20, 20, 21, 1, 21, 22, + 21, 23, 24, 23, 23, 25, 23, 23, + 23, 23, 26, 23, 26, 1, 27, 1, + 28, 28, 1, 28, 29, 28, 23, 24, + 23, 23, 25, 23, 23, 23, 23, 26, + 23, 26, 1, 30, 1, 31, 31, 1, + 31, 31, 25, 1, 32, 32, 1, 33, + 33, 34, 35, 34, 34, 34, 34, 1, + 33, 33, 35, 1, 36, 37, 36, 38, + 39, 38, 40, 1, 41, 1, 40, 42, + 40, 23, 24, 23, 23, 25, 23, 23, + 23, 23, 43, 23, 43, 1, 44, 1, + 45, 45, 1, 45, 29, 45, 23, 24, + 23, 23, 25, 23, 23, 23, 23, 43, + 23, 43, 1, 46, 47, 46, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 1, + 49, 50, 49, 48, 48, 48, 51, 48, + 48, 48, 48, 48, 48, 1, 52, 29, + 52, 25, 1, 53, 1, 46, 46, 1, + 55, 56, 57, 1, 1, 1, 54, 58, + 1, 54, 54, 1, 49, 50, 49, 51, + 1, 54, 54, 54, 1, 59, 59, 60, + 61, 60, 60, 60, 60, 1, 59, 59, + 61, 1, 62, 63, 64, 63, 65, 62, + 65, 64, 65, 66, 67, 66, 66, 65, + 68, 66, 66, 66, 69, 66, 69, 62, + 70, 64, 70, 71, 71, 71, 65, 71, + 71, 71, 71, 71, 62, 72, 64, 72, + 71, 71, 71, 65, 73, 71, 71, 71, + 71, 71, 62, 74, 64, 74, 65, 68, + 62, 63, 64, 63, 65, 75, 75, 62, + 76, 64, 76, 65, 78, 77, 77, 77, + 77, 62, 76, 64, 76, 65, 78, 62, + 80, 64, 80, 81, 79, 80, 64, 80, + 81, 63, 79, 81, 64, 81, 82, 83, + 82, 82, 81, 84, 63, 82, 82, 82, + 85, 82, 85, 79, 86, 64, 86, 87, + 87, 87, 81, 63, 87, 87, 87, 87, + 87, 79, 88, 64, 88, 87, 87, 87, + 81, 89, 63, 87, 87, 87, 87, 87, + 79, 90, 64, 90, 81, 84, 63, 79, + 80, 64, 80, 81, 63, 85, 85, 79, + 92, 64, 92, 93, 94, 63, 95, 79, + 79, 91, 88, 64, 88, 81, 89, 63, + 79, 81, 64, 81, 96, 97, 96, 96, + 94, 84, 63, 95, 96, 79, 79, 96, + 96, 83, 96, 83, 91, 98, 64, 98, + 99, 93, 99, 99, 94, 63, 95, 99, + 79, 79, 99, 99, 99, 99, 91, 88, + 64, 88, 99, 93, 99, 99, 94, 89, + 63, 95, 99, 79, 79, 99, 99, 99, + 99, 91, 92, 64, 92, 94, 63, 91, + 91, 79, 88, 64, 88, 93, 94, 89, + 63, 95, 79, 79, 91, 101, 64, 101, + 102, 103, 104, 62, 62, 100, 72, 64, + 72, 65, 73, 62, 65, 64, 65, 105, + 106, 105, 105, 103, 68, 104, 105, 62, + 62, 105, 105, 67, 105, 67, 100, 107, + 64, 107, 108, 102, 108, 108, 103, 104, + 108, 62, 62, 108, 108, 108, 108, 100, + 72, 64, 72, 108, 102, 108, 108, 103, + 73, 104, 108, 62, 62, 108, 108, 108, + 108, 100, 101, 64, 101, 103, 100, 100, + 62, 72, 64, 72, 102, 103, 73, 104, + 62, 62, 100, 109, 109, 110, 111, 110, + 110, 110, 110, 1, 109, 109, 111, 1, + 112, 113, 64, 113, 114, 112, 114, 64, + 114, 115, 116, 115, 115, 114, 117, 115, + 115, 115, 118, 115, 118, 112, 119, 64, + 119, 120, 120, 120, 114, 120, 120, 120, + 120, 120, 112, 121, 64, 121, 120, 120, + 120, 114, 122, 120, 120, 120, 120, 120, + 112, 123, 64, 123, 114, 117, 112, 113, + 64, 113, 114, 124, 124, 112, 125, 64, + 125, 114, 127, 126, 126, 126, 126, 112, + 125, 64, 125, 114, 127, 112, 129, 64, + 129, 130, 128, 129, 64, 129, 130, 113, + 128, 130, 64, 130, 131, 132, 131, 131, + 130, 133, 113, 131, 131, 131, 134, 131, + 134, 128, 135, 64, 135, 136, 136, 136, + 130, 113, 136, 136, 136, 136, 136, 128, + 137, 64, 137, 136, 136, 136, 130, 138, + 113, 136, 136, 136, 136, 136, 128, 139, + 64, 139, 130, 133, 113, 128, 129, 64, + 129, 130, 113, 134, 134, 128, 141, 64, + 141, 142, 143, 113, 144, 128, 128, 140, + 137, 64, 137, 130, 138, 113, 128, 130, + 64, 130, 145, 146, 145, 145, 143, 133, + 113, 144, 145, 128, 128, 145, 145, 132, + 145, 132, 140, 147, 64, 147, 148, 142, + 148, 148, 143, 113, 144, 148, 128, 128, + 148, 148, 148, 148, 140, 137, 64, 137, + 148, 142, 148, 148, 143, 138, 113, 144, + 148, 128, 128, 148, 148, 148, 148, 140, + 141, 64, 141, 143, 113, 140, 140, 128, + 137, 64, 137, 142, 143, 138, 113, 144, + 128, 128, 140, 150, 64, 150, 151, 152, + 153, 112, 112, 149, 121, 64, 121, 114, + 122, 112, 114, 64, 114, 154, 155, 154, + 154, 152, 117, 153, 154, 112, 112, 154, + 154, 116, 154, 116, 149, 156, 64, 156, + 157, 151, 157, 157, 152, 153, 157, 112, + 112, 157, 157, 157, 157, 149, 121, 64, + 121, 157, 151, 157, 157, 152, 122, 153, + 157, 112, 112, 157, 157, 157, 157, 149, + 150, 64, 150, 152, 149, 149, 112, 121, + 64, 121, 151, 152, 122, 153, 112, 112, + 149, 1, 0 +}; + +static const char _tsip_machine_parser_header_P_Preferred_Identity_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 40, + 45, 29, 82, 24, 25, 26, 27, 28, + 30, 31, 30, 32, 33, 34, 34, 35, + 36, 114, 37, 50, 38, 39, 41, 43, + 40, 42, 26, 29, 42, 44, 45, 46, + 48, 49, 47, 51, 50, 52, 53, 53, + 35, 54, 55, 75, 58, 53, 56, 55, + 57, 58, 57, 59, 60, 59, 61, 62, + 62, 63, 64, 68, 67, 62, 65, 64, + 66, 67, 66, 68, 68, 69, 70, 73, + 71, 74, 72, 71, 75, 75, 76, 77, + 80, 78, 81, 79, 78, 83, 82, 84, + 85, 85, 86, 87, 107, 90, 85, 88, + 87, 89, 90, 89, 91, 92, 91, 93, + 94, 94, 95, 96, 100, 99, 94, 97, + 96, 98, 99, 98, 100, 100, 101, 102, + 105, 103, 106, 104, 103, 107, 107, 108, + 109, 112, 110, 113, 111, 110 +}; + +static const char _tsip_machine_parser_header_P_Preferred_Identity_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1, + 1, 0, 1, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 3, 0, 0, + 0, 7, 0, 1, 0, 0, 0, 0, + 0, 5, 5, 5, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 3, + 3, 3, 1, 1, 0, 1, 3, 0, + 12, 5, 3, 1, 3, 0, 0, 0, + 3, 3, 1, 1, 0, 1, 3, 0, + 12, 5, 3, 0, 3, 0, 3, 0, + 1, 1, 3, 0, 0, 3, 0, 3, + 0, 1, 1, 3, 0, 0, 0, 0, + 0, 3, 3, 1, 1, 0, 1, 3, + 0, 9, 5, 3, 1, 3, 0, 0, + 0, 3, 3, 1, 1, 0, 1, 3, + 0, 9, 5, 3, 0, 3, 0, 3, + 0, 1, 1, 3, 0, 0, 3, 0, + 3, 0, 1, 1, 3, 0 +}; + +static const int tsip_machine_parser_header_P_Preferred_Identity_start = 1; +static const int tsip_machine_parser_header_P_Preferred_Identity_first_final = 114; +static const int tsip_machine_parser_header_P_Preferred_Identity_error = 0; + +static const int tsip_machine_parser_header_P_Preferred_Identity_en_main = 1; + + +/* #line 133 "./ragel/tsip_parser_header_P_Preferred_Identity.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_P_Preferred_Identity_first_final); + (void)(tsip_machine_parser_header_P_Preferred_Identity_error); + (void)(tsip_machine_parser_header_P_Preferred_Identity_en_main); + +/* #line 478 "./src/headers/tsip_header_P_Preferred_Identity.c" */ + { + cs = tsip_machine_parser_header_P_Preferred_Identity_start; + } + +/* #line 138 "./ragel/tsip_parser_header_P_Preferred_Identity.rl" */ + +/* #line 485 "./src/headers/tsip_header_P_Preferred_Identity.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_P_Preferred_Identity_trans_keys + _tsip_machine_parser_header_P_Preferred_Identity_key_offsets[cs]; + _trans = _tsip_machine_parser_header_P_Preferred_Identity_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_P_Preferred_Identity_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_P_Preferred_Identity_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_P_Preferred_Identity_indicies[_trans]; + cs = _tsip_machine_parser_header_P_Preferred_Identity_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_P_Preferred_Identity_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_P_Preferred_Identity_actions + _tsip_machine_parser_header_P_Preferred_Identity_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 56 "./ragel/tsip_parser_header_P_Preferred_Identity.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 60 "./ragel/tsip_parser_header_P_Preferred_Identity.rl" */ + { + if(!hdr_pi->uri) /* Only one URI */{ + int len = (int)(p - tag_start); + if(hdr_pi && !hdr_pi->uri){ + if((hdr_pi->uri = tsip_uri_parse(tag_start, (tsk_size_t)len)) && hdr_pi->display_name){ + hdr_pi->uri->display_name = tsk_strdup(hdr_pi->display_name); + } + } + } + } + break; + case 2: +/* #line 71 "./ragel/tsip_parser_header_P_Preferred_Identity.rl" */ + { + if(!hdr_pi->display_name){ + TSK_PARSER_SET_STRING(hdr_pi->display_name); + tsk_strunquote(&hdr_pi->display_name); + } + + } + break; + case 3: +/* #line 79 "./ragel/tsip_parser_header_P_Preferred_Identity.rl" */ + { + } + break; +/* #line 593 "./src/headers/tsip_header_P_Preferred_Identity.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 139 "./ragel/tsip_parser_header_P_Preferred_Identity.rl" */ + + if( cs < +/* #line 609 "./src/headers/tsip_header_P_Preferred_Identity.c" */ +114 +/* #line 140 "./ragel/tsip_parser_header_P_Preferred_Identity.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'P-Preferred-Identity' header."); + TSK_OBJECT_SAFE_FREE(hdr_pi); + } + + return hdr_pi; +} + + + + + + + +//======================================================== +// P_Preferred_Identity header object definition +// + +static tsk_object_t* tsip_header_P_Preferred_Identity_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_P_Preferred_Identity_t *P_Preferred_Identity = self; + if(P_Preferred_Identity){ + const tsip_uri_t* uri = va_arg(*app, const tsip_uri_t*); + + TSIP_HEADER(P_Preferred_Identity)->type = tsip_htype_P_Preferred_Identity; + TSIP_HEADER(P_Preferred_Identity)->serialize = tsip_header_Preferred_Identity_serialize; + + if(uri){ + P_Preferred_Identity->uri = tsk_object_ref((void*)uri); + } + } + else{ + TSK_DEBUG_ERROR("Failed to create new P_Preferred_Identity header."); + } + return self; +} + +static tsk_object_t* tsip_header_P_Preferred_Identity_dtor(tsk_object_t *self) +{ + tsip_header_P_Preferred_Identity_t *P_Preferred_Identity = self; + if(P_Preferred_Identity){ + TSK_FREE(P_Preferred_Identity->display_name); + TSK_OBJECT_SAFE_FREE(P_Preferred_Identity->uri); + } + else{ + TSK_DEBUG_ERROR("Null P_Preferred_Identity header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_P_Preferred_Identity_def_s = +{ + sizeof(tsip_header_P_Preferred_Identity_t), + tsip_header_P_Preferred_Identity_ctor, + tsip_header_P_Preferred_Identity_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_P_Preferred_Identity_def_t = &tsip_header_P_Preferred_Identity_def_s; diff --git a/tinySIP/src/headers/tsip_header_P_Profile_Key.c b/tinySIP/src/headers/tsip_header_P_Profile_Key.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_P_Profile_Key.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_P_User_Database.c b/tinySIP/src/headers/tsip_header_P_User_Database.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_P_User_Database.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_P_Visited_Network_ID.c b/tinySIP/src/headers/tsip_header_P_Visited_Network_ID.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_P_Visited_Network_ID.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Path.c b/tinySIP/src/headers/tsip_header_Path.c new file mode 100644 index 0000000..e8cca53 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Path.c @@ -0,0 +1,543 @@ + +/* #line 1 "./ragel/tsip_parser_header_Path.rl" */ +/* +* 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 tsip_header_Path.c + * @brief SIP Service-Path header as per RFC 3608. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Path.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_time.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 107 "./ragel/tsip_parser_header_Path.rl" */ + + + +tsip_header_Path_t* tsip_header_Path_create(const tsip_uri_t* uri) +{ + return tsk_object_new(TSIP_HEADER_PATH_VA_ARGS(uri)); +} + +tsip_header_Path_t* tsip_header_Path_create_null() +{ + return tsip_header_Path_create(tsk_null); +} + +int tsip_header_Path_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Path_t *Path = (const tsip_header_Path_t *)header; + int ret = 0; + + /* Uri with hacked display-name*/ + if((ret = tsip_uri_serialize(Path->uri, tsk_true, tsk_true, output))){ + return ret; + } + + return ret; + } + + return -1; +} + +tsip_header_Paths_L_t *tsip_header_Path_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Paths_L_t *hdr_paths = tsk_list_create(); + + const char *tag_start = tsk_null; + tsip_header_Path_t *curr_path = tsk_null; + + +/* #line 92 "./src/headers/tsip_header_Path.c" */ +static const char _tsip_machine_parser_header_Path_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3, 1, 4, 1, 5, 1, 6, 2, + 1, 0, 2, 4, 5 +}; + +static const short _tsip_machine_parser_header_Path_key_offsets[] = { + 0, 0, 1, 2, 3, 4, 7, 26, + 27, 29, 48, 49, 51, 54, 58, 70, + 73, 73, 74, 79, 80, 97, 98, 100, + 116, 134, 140, 141, 143, 148, 167, 168, + 170, 189, 190, 192, 195, 203, 204, 206, + 211, 216, 217, 219, 223, 229, 246, 253, + 261, 269, 277, 279, 286, 295, 297, 300, + 302, 305, 307, 310, 313, 314, 317, 318, + 321, 322, 331, 340, 348, 356, 364, 372, + 374, 380, 389, 398, 407, 409, 412, 415, + 416, 417, 434, 452, 456, 457, 459, 467, + 468, 470, 474, 480 +}; + +static const char _tsip_machine_parser_header_Path_trans_keys[] = { + 80, 97, 116, 104, 9, 32, 58, 9, + 13, 32, 33, 34, 37, 39, 60, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 10, 9, 32, 9, 13, 32, + 33, 34, 37, 39, 60, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 10, 9, 32, 9, 32, 60, 65, 90, + 97, 122, 9, 32, 43, 58, 45, 46, + 48, 57, 65, 90, 97, 122, 9, 32, + 58, 62, 9, 13, 32, 44, 59, 10, + 9, 13, 32, 33, 37, 39, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 10, 9, 32, 9, 32, 33, 37, + 39, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 59, 61, 126, 42, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 44, 59, 61, 10, 9, 32, 9, + 32, 44, 59, 61, 9, 13, 32, 33, + 34, 37, 39, 91, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 10, + 9, 32, 9, 13, 32, 33, 34, 37, + 39, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 32, 34, 13, 34, 92, 127, 0, + 8, 10, 31, 10, 9, 32, 9, 13, + 32, 44, 59, 9, 13, 32, 44, 59, + 10, 9, 32, 9, 32, 44, 59, 0, + 9, 11, 12, 14, 127, 9, 13, 32, + 33, 37, 39, 44, 59, 126, 42, 46, + 48, 57, 65, 90, 95, 122, 58, 48, + 57, 65, 70, 97, 102, 58, 93, 48, + 57, 65, 70, 97, 102, 58, 93, 48, + 57, 65, 70, 97, 102, 58, 93, 48, + 57, 65, 70, 97, 102, 58, 93, 58, + 48, 57, 65, 70, 97, 102, 46, 58, + 93, 48, 57, 65, 70, 97, 102, 48, + 57, 46, 48, 57, 48, 57, 46, 48, + 57, 48, 57, 93, 48, 57, 93, 48, + 57, 93, 46, 48, 57, 46, 46, 48, + 57, 46, 46, 58, 93, 48, 57, 65, + 70, 97, 102, 46, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 46, 58, 93, + 48, 57, 65, 70, 97, 102, 46, 58, + 93, 48, 57, 65, 70, 97, 102, 48, + 57, 46, 48, 57, 46, 48, 57, 46, + 58, 9, 13, 32, 33, 37, 39, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 60, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 60, + 10, 9, 32, 13, 34, 92, 127, 0, + 8, 10, 31, 10, 9, 32, 9, 13, + 32, 60, 0, 9, 11, 12, 14, 127, + 0 +}; + +static const char _tsip_machine_parser_header_Path_single_lengths[] = { + 0, 1, 1, 1, 1, 3, 9, 1, + 2, 9, 1, 2, 3, 0, 4, 3, + 0, 1, 5, 1, 7, 1, 2, 6, + 10, 6, 1, 2, 5, 9, 1, 2, + 9, 1, 2, 3, 4, 1, 2, 5, + 5, 1, 2, 4, 0, 9, 1, 2, + 2, 2, 2, 1, 3, 0, 1, 0, + 1, 0, 1, 1, 1, 1, 1, 1, + 1, 3, 3, 2, 2, 2, 2, 2, + 0, 3, 3, 3, 0, 1, 1, 1, + 1, 7, 8, 4, 1, 2, 4, 1, + 2, 4, 0, 0 +}; + +static const char _tsip_machine_parser_header_Path_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 5, 0, + 0, 5, 0, 0, 0, 2, 4, 0, + 0, 0, 0, 0, 5, 0, 0, 5, + 4, 0, 0, 0, 0, 5, 0, 0, + 5, 0, 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 3, 4, 3, 3, + 3, 3, 0, 3, 3, 1, 1, 1, + 1, 1, 1, 1, 0, 1, 0, 1, + 0, 3, 3, 3, 3, 3, 3, 0, + 3, 3, 3, 3, 1, 1, 1, 0, + 0, 5, 5, 0, 0, 0, 2, 0, + 0, 0, 3, 0 +}; + +static const short _tsip_machine_parser_header_Path_index_offsets[] = { + 0, 0, 2, 4, 6, 8, 12, 27, + 29, 32, 47, 49, 52, 56, 59, 68, + 72, 73, 75, 81, 83, 96, 98, 101, + 113, 128, 135, 137, 140, 146, 161, 163, + 166, 181, 183, 186, 190, 197, 199, 202, + 208, 214, 216, 219, 224, 228, 242, 247, + 253, 259, 265, 268, 273, 280, 282, 285, + 287, 290, 292, 295, 298, 300, 303, 305, + 308, 310, 317, 324, 330, 336, 342, 348, + 351, 355, 362, 369, 376, 378, 381, 384, + 386, 388, 401, 415, 420, 422, 425, 432, + 434, 437, 442, 446 +}; + +static const char _tsip_machine_parser_header_Path_indicies[] = { + 0, 1, 2, 1, 3, 1, 4, 1, + 4, 4, 5, 1, 6, 7, 6, 8, + 9, 8, 8, 10, 8, 8, 8, 8, + 8, 8, 1, 11, 1, 12, 12, 1, + 13, 14, 13, 8, 9, 8, 8, 10, + 8, 8, 8, 8, 8, 8, 1, 15, + 1, 16, 16, 1, 16, 16, 17, 1, + 18, 18, 1, 19, 19, 20, 21, 20, + 20, 20, 20, 1, 19, 19, 21, 1, + 22, 23, 22, 24, 25, 24, 26, 27, + 1, 28, 1, 27, 29, 27, 30, 30, + 30, 30, 30, 30, 30, 30, 30, 1, + 31, 1, 32, 32, 1, 32, 32, 30, + 30, 30, 30, 30, 30, 30, 30, 30, + 1, 33, 34, 33, 35, 35, 35, 36, + 37, 38, 35, 35, 35, 35, 35, 1, + 39, 40, 39, 5, 27, 38, 1, 41, + 1, 42, 42, 1, 42, 42, 5, 27, + 38, 1, 38, 43, 38, 44, 45, 44, + 44, 46, 44, 44, 44, 44, 44, 44, + 1, 47, 1, 48, 48, 1, 48, 49, + 48, 44, 45, 44, 44, 46, 44, 44, + 44, 44, 44, 44, 1, 50, 1, 51, + 51, 1, 51, 51, 45, 1, 52, 53, + 54, 1, 1, 1, 45, 55, 1, 45, + 45, 1, 56, 34, 56, 36, 37, 1, + 57, 58, 57, 5, 27, 1, 59, 1, + 60, 60, 1, 60, 60, 5, 27, 1, + 45, 45, 45, 1, 56, 34, 56, 44, + 44, 44, 36, 37, 44, 44, 44, 44, + 44, 1, 62, 61, 61, 61, 1, 64, + 53, 63, 63, 63, 1, 64, 53, 65, + 65, 65, 1, 64, 53, 66, 66, 66, + 1, 64, 53, 1, 68, 67, 61, 61, + 1, 69, 64, 53, 70, 63, 63, 1, + 71, 1, 72, 73, 1, 74, 1, 75, + 76, 1, 77, 1, 53, 78, 1, 53, + 79, 1, 53, 1, 75, 80, 1, 75, + 1, 72, 81, 1, 72, 1, 69, 64, + 53, 82, 65, 65, 1, 69, 64, 53, + 66, 66, 66, 1, 84, 53, 83, 83, + 83, 1, 86, 53, 85, 85, 85, 1, + 86, 53, 87, 87, 87, 1, 86, 53, + 88, 88, 88, 1, 86, 53, 1, 89, + 83, 83, 1, 69, 86, 53, 90, 85, + 85, 1, 69, 86, 53, 91, 87, 87, + 1, 69, 86, 53, 88, 88, 88, 1, + 92, 1, 69, 93, 1, 69, 94, 1, + 69, 1, 68, 1, 95, 96, 95, 97, + 97, 97, 97, 97, 97, 97, 97, 97, + 1, 98, 99, 98, 97, 97, 97, 100, + 97, 97, 97, 97, 97, 97, 1, 101, + 102, 101, 17, 1, 103, 1, 95, 95, + 1, 105, 106, 107, 1, 1, 1, 104, + 108, 1, 104, 104, 1, 98, 99, 98, + 100, 1, 104, 104, 104, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Path_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 6, 7, + 81, 86, 13, 8, 9, 9, 10, 11, + 12, 13, 14, 15, 14, 16, 17, 18, + 18, 19, 6, 20, 91, 21, 24, 22, + 23, 25, 19, 24, 6, 20, 29, 25, + 26, 27, 28, 30, 45, 36, 46, 31, + 32, 33, 34, 35, 37, 39, 44, 38, + 40, 40, 41, 42, 43, 47, 80, 48, + 51, 49, 50, 52, 67, 53, 65, 54, + 55, 63, 56, 57, 61, 58, 59, 60, + 62, 64, 66, 68, 76, 69, 72, 70, + 71, 73, 74, 75, 77, 78, 79, 82, + 84, 81, 83, 10, 13, 83, 10, 85, + 86, 87, 89, 90, 88 +}; + +static const char _tsip_machine_parser_header_Path_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 3, 3, + 15, 15, 3, 0, 0, 3, 3, 0, + 0, 0, 1, 0, 0, 0, 0, 7, + 11, 11, 11, 0, 13, 0, 1, 0, + 0, 18, 18, 0, 18, 9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 18, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 5, 5, 0, 0, 0, + 0, 0, 0, 0, 0 +}; + +static const int tsip_machine_parser_header_Path_start = 1; +static const int tsip_machine_parser_header_Path_first_final = 91; +static const int tsip_machine_parser_header_Path_error = 0; + +static const int tsip_machine_parser_header_Path_en_main = 1; + + +/* #line 149 "./ragel/tsip_parser_header_Path.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Path_first_final); + (void)(tsip_machine_parser_header_Path_error); + (void)(tsip_machine_parser_header_Path_en_main); + +/* #line 329 "./src/headers/tsip_header_Path.c" */ + { + cs = tsip_machine_parser_header_Path_start; + } + +/* #line 154 "./ragel/tsip_parser_header_Path.rl" */ + +/* #line 336 "./src/headers/tsip_header_Path.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Path_trans_keys + _tsip_machine_parser_header_Path_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Path_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Path_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Path_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Path_indicies[_trans]; + cs = _tsip_machine_parser_header_Path_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Path_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Path_actions + _tsip_machine_parser_header_Path_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 51 "./ragel/tsip_parser_header_Path.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 55 "./ragel/tsip_parser_header_Path.rl" */ + { + if(!curr_path){ + curr_path = tsip_header_Path_create_null(); + } + } + break; + case 2: +/* #line 61 "./ragel/tsip_parser_header_Path.rl" */ + { + if(curr_path){ + TSK_PARSER_SET_STRING(curr_path->display_name); + tsk_strunquote(&curr_path->display_name); + } + } + break; + case 3: +/* #line 68 "./ragel/tsip_parser_header_Path.rl" */ + { + if(curr_path && !curr_path->uri){ + int len = (int)(p - tag_start); + if(curr_path && !curr_path->uri){ + if((curr_path->uri = tsip_uri_parse(tag_start, (tsk_size_t)len)) && curr_path->display_name){ + curr_path->uri->display_name = tsk_strdup(curr_path->display_name); + } + } + } + } + break; + case 4: +/* #line 79 "./ragel/tsip_parser_header_Path.rl" */ + { + if(curr_path){ + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(curr_path)); + } + } + break; + case 5: +/* #line 85 "./ragel/tsip_parser_header_Path.rl" */ + { + if(curr_path){ + tsk_list_push_back_data(hdr_paths, ((void**) &curr_path)); + } + } + break; + case 6: +/* #line 91 "./ragel/tsip_parser_header_Path.rl" */ + { + } + break; +/* #line 467 "./src/headers/tsip_header_Path.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 155 "./ragel/tsip_parser_header_Path.rl" */ + + if( cs < +/* #line 483 "./src/headers/tsip_header_Path.c" */ +91 +/* #line 156 "./ragel/tsip_parser_header_Path.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Path' header."); + TSK_OBJECT_SAFE_FREE(curr_path); + TSK_OBJECT_SAFE_FREE(hdr_paths); + } + + return hdr_paths; +} + + + + + +//======================================================== +// Path header object definition +// + +static tsk_object_t* tsip_header_Path_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Path_t *Path = self; + if(Path){ + const tsip_uri_t* uri = va_arg(*app, const tsip_uri_t*); + + TSIP_HEADER(Path)->type = tsip_htype_Path; + TSIP_HEADER(Path)->serialize = tsip_header_Path_serialize; + if(uri){ + Path->uri = tsk_object_ref((void*)uri); + } + } + else{ + TSK_DEBUG_ERROR("Failed to create new Path header."); + } + return self; +} + +static tsk_object_t* tsip_header_Path_dtor(tsk_object_t *self) +{ + tsip_header_Path_t *Path = self; + if(Path){ + TSK_FREE(Path->display_name); + TSK_OBJECT_SAFE_FREE(Path->uri); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Path)); + } + else{ + TSK_DEBUG_ERROR("Null Path header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Path_def_s = +{ + sizeof(tsip_header_Path_t), + tsip_header_Path_ctor, + tsip_header_Path_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Path_def_t = &tsip_header_Path_def_s; diff --git a/tinySIP/src/headers/tsip_header_Priority.c b/tinySIP/src/headers/tsip_header_Priority.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Priority.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Privacy.c b/tinySIP/src/headers/tsip_header_Privacy.c new file mode 100644 index 0000000..905b28c --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Privacy.c @@ -0,0 +1,489 @@ + +/* #line 1 "./ragel/tsip_parser_header_Privacy.rl" */ +/* +* 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 tsip_header_Privacy.c + * @brief SIP Privacy header. + * + * Header field where proxy ACK BYE CAN INV OPT REG + * ___________________________________________________________ + * Privacy amrd o o o o o o + * + * Header field SUB NOT PRK IFO UPD MSG + * ___________________________________________________________ + * Privacy o o o o o o + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Privacy.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 75 "./ragel/tsip_parser_header_Privacy.rl" */ + + +tsip_header_Privacy_t* tsip_header_Privacy_create() +{ + return tsk_object_new(tsip_header_Privacy_def_t); +} + +int tsip_header_Privacy_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Privacy_t *Privacy = (const tsip_header_Privacy_t *)header; + tsk_list_item_t *item; + tsk_string_t *str; + int ret = 0; + + tsk_list_foreach(item, Privacy->values){ + str = item->data; + if(item == Privacy->values->head){ + ret = tsk_buffer_append(output, str->value, tsk_strlen(str->value)); + } + else{ + ret = tsk_buffer_append_2(output, ";%s", str->value); + } + } + + return ret; + } + + return -1; +} + + +tsip_header_Privacy_t *tsip_header_Privacy_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Privacy_t *hdr_privacy = tsip_header_Privacy_create(); + + const char *tag_start = tsk_null; + + +/* #line 100 "./src/headers/tsip_header_Privacy.c" */ +static const char _tsip_machine_parser_header_Privacy_actions[] = { + 0, 1, 0, 1, 1, 1, 2 +}; + +static const short _tsip_machine_parser_header_Privacy_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 12, + 14, 17, 46, 47, 49, 77, 93, 94, + 120, 138, 156, 174, 192, 210, 228, 246, + 248, 268, 286, 304, 322, 340, 358, 376, + 394, 412, 430, 448, 466, 484, 502, 520, + 538, 556, 574, 592, 610, 628 +}; + +static const char _tsip_machine_parser_header_Privacy_trans_keys[] = { + 80, 112, 82, 114, 73, 105, 86, 118, + 65, 97, 67, 99, 89, 121, 9, 32, + 58, 9, 13, 32, 33, 37, 39, 67, + 72, 73, 78, 83, 85, 99, 104, 105, + 110, 115, 117, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 10, 9, + 32, 9, 32, 33, 37, 39, 67, 72, + 73, 78, 83, 85, 99, 104, 105, 110, + 115, 117, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 13, 33, 37, + 39, 59, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 33, 37, + 39, 67, 72, 73, 78, 83, 85, 99, + 104, 105, 110, 115, 117, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 13, 33, 37, 39, 59, 82, 114, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 13, 33, 37, 39, 59, 73, + 105, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 13, 33, 37, 39, + 59, 84, 116, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 13, 33, + 37, 39, 59, 73, 105, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 13, 33, 37, 39, 59, 67, 99, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 13, 33, 37, 39, 59, 65, + 97, 126, 42, 43, 45, 46, 48, 57, + 66, 90, 95, 122, 13, 33, 37, 39, + 59, 76, 108, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 13, 59, + 13, 33, 37, 39, 59, 69, 73, 101, + 105, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 13, 33, 37, 39, + 59, 65, 97, 126, 42, 43, 45, 46, + 48, 57, 66, 90, 95, 122, 13, 33, + 37, 39, 59, 68, 100, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 13, 33, 37, 39, 59, 69, 101, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 13, 33, 37, 39, 59, 82, + 114, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 13, 33, 37, 39, + 59, 83, 115, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 13, 33, + 37, 39, 59, 84, 116, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 13, 33, 37, 39, 59, 79, 111, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 13, 33, 37, 39, 59, 82, + 114, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 13, 33, 37, 39, + 59, 89, 121, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 13, 33, + 37, 39, 59, 68, 100, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 13, 33, 37, 39, 59, 79, 111, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 13, 33, 37, 39, 59, 78, + 110, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 13, 33, 37, 39, + 59, 69, 101, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 13, 33, + 37, 39, 59, 69, 101, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 13, 33, 37, 39, 59, 83, 115, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 13, 33, 37, 39, 59, 83, + 115, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 13, 33, 37, 39, + 59, 73, 105, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 13, 33, + 37, 39, 59, 79, 111, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 13, 33, 37, 39, 59, 78, 110, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 13, 33, 37, 39, 59, 83, + 115, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 0 +}; + +static const char _tsip_machine_parser_header_Privacy_single_lengths[] = { + 0, 2, 2, 2, 2, 2, 2, 2, + 3, 19, 1, 2, 18, 6, 1, 16, + 8, 8, 8, 8, 8, 8, 8, 2, + 10, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 0 +}; + +static const char _tsip_machine_parser_header_Privacy_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 0, 0, 5, 5, 0, 5, + 5, 5, 5, 5, 5, 5, 5, 0, + 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 0 +}; + +static const short _tsip_machine_parser_header_Privacy_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 15, 18, + 21, 25, 50, 52, 55, 79, 91, 93, + 115, 129, 143, 157, 171, 185, 199, 213, + 216, 232, 246, 260, 274, 288, 302, 316, + 330, 344, 358, 372, 386, 400, 414, 428, + 442, 456, 470, 484, 498, 512 +}; + +static const char _tsip_machine_parser_header_Privacy_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 5, 5, 1, 6, + 6, 1, 7, 7, 1, 7, 7, 8, + 1, 8, 9, 8, 10, 10, 10, 11, + 12, 13, 14, 15, 16, 11, 12, 13, + 14, 15, 16, 10, 10, 10, 10, 10, + 10, 1, 17, 1, 18, 18, 1, 18, + 18, 10, 10, 10, 11, 12, 13, 14, + 15, 16, 11, 12, 13, 14, 15, 16, + 10, 10, 10, 10, 10, 10, 1, 19, + 20, 20, 20, 21, 20, 20, 20, 20, + 20, 20, 1, 22, 1, 10, 10, 10, + 11, 12, 13, 14, 15, 16, 11, 12, + 13, 14, 15, 16, 10, 10, 10, 10, + 10, 10, 1, 19, 20, 20, 20, 21, + 23, 23, 20, 20, 20, 20, 20, 20, + 1, 19, 20, 20, 20, 21, 24, 24, + 20, 20, 20, 20, 20, 20, 1, 19, + 20, 20, 20, 21, 25, 25, 20, 20, + 20, 20, 20, 20, 1, 19, 20, 20, + 20, 21, 26, 26, 20, 20, 20, 20, + 20, 20, 1, 19, 20, 20, 20, 21, + 27, 27, 20, 20, 20, 20, 20, 20, + 1, 19, 20, 20, 20, 21, 28, 28, + 20, 20, 20, 20, 20, 20, 1, 19, + 20, 20, 20, 21, 29, 29, 20, 20, + 20, 20, 20, 20, 1, 19, 21, 1, + 19, 20, 20, 20, 21, 30, 31, 30, + 31, 20, 20, 20, 20, 20, 20, 1, + 19, 20, 20, 20, 21, 32, 32, 20, + 20, 20, 20, 20, 20, 1, 19, 20, + 20, 20, 21, 33, 33, 20, 20, 20, + 20, 20, 20, 1, 19, 20, 20, 20, + 21, 34, 34, 20, 20, 20, 20, 20, + 20, 1, 19, 20, 20, 20, 21, 29, + 29, 20, 20, 20, 20, 20, 20, 1, + 19, 20, 20, 20, 21, 35, 35, 20, + 20, 20, 20, 20, 20, 1, 19, 20, + 20, 20, 21, 36, 36, 20, 20, 20, + 20, 20, 20, 1, 19, 20, 20, 20, + 21, 37, 37, 20, 20, 20, 20, 20, + 20, 1, 19, 20, 20, 20, 21, 38, + 38, 20, 20, 20, 20, 20, 20, 1, + 19, 20, 20, 20, 21, 29, 29, 20, + 20, 20, 20, 20, 20, 1, 19, 20, + 20, 20, 21, 29, 29, 20, 20, 20, + 20, 20, 20, 1, 19, 20, 20, 20, + 21, 39, 39, 20, 20, 20, 20, 20, + 20, 1, 19, 20, 20, 20, 21, 40, + 40, 20, 20, 20, 20, 20, 20, 1, + 19, 20, 20, 20, 21, 29, 29, 20, + 20, 20, 20, 20, 20, 1, 19, 20, + 20, 20, 21, 41, 41, 20, 20, 20, + 20, 20, 20, 1, 19, 20, 20, 20, + 21, 42, 42, 20, 20, 20, 20, 20, + 20, 1, 19, 20, 20, 20, 21, 43, + 43, 20, 20, 20, 20, 20, 20, 1, + 19, 20, 20, 20, 21, 44, 44, 20, + 20, 20, 20, 20, 20, 1, 19, 20, + 20, 20, 21, 45, 45, 20, 20, 20, + 20, 20, 20, 1, 19, 20, 20, 20, + 21, 29, 29, 20, 20, 20, 20, 20, + 20, 1, 19, 20, 20, 20, 21, 33, + 33, 20, 20, 20, 20, 20, 20, 1, + 1, 0 +}; + +static const char _tsip_machine_parser_header_Privacy_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 13, 16, 24, 34, 35, 38, + 44, 11, 12, 14, 13, 15, 45, 17, + 18, 19, 20, 21, 22, 23, 25, 29, + 26, 27, 28, 30, 31, 32, 33, 36, + 37, 39, 40, 41, 42, 43 +}; + +static const char _tsip_machine_parser_header_Privacy_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 1, 1, 1, 1, 1, + 1, 0, 0, 3, 0, 3, 5, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; + +static const int tsip_machine_parser_header_Privacy_start = 1; +static const int tsip_machine_parser_header_Privacy_first_final = 45; +static const int tsip_machine_parser_header_Privacy_error = 0; + +static const int tsip_machine_parser_header_Privacy_en_main = 1; + + +/* #line 118 "./ragel/tsip_parser_header_Privacy.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Privacy_first_final); + (void)(tsip_machine_parser_header_Privacy_error); + (void)(tsip_machine_parser_header_Privacy_en_main); + +/* #line 322 "./src/headers/tsip_header_Privacy.c" */ + { + cs = tsip_machine_parser_header_Privacy_start; + } + +/* #line 123 "./ragel/tsip_parser_header_Privacy.rl" */ + +/* #line 329 "./src/headers/tsip_header_Privacy.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Privacy_trans_keys + _tsip_machine_parser_header_Privacy_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Privacy_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Privacy_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Privacy_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Privacy_indicies[_trans]; + cs = _tsip_machine_parser_header_Privacy_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Privacy_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Privacy_actions + _tsip_machine_parser_header_Privacy_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 58 "./ragel/tsip_parser_header_Privacy.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 62 "./ragel/tsip_parser_header_Privacy.rl" */ + { + TSK_PARSER_ADD_STRING(hdr_privacy->values); + } + break; + case 2: +/* #line 66 "./ragel/tsip_parser_header_Privacy.rl" */ + { + } + break; +/* #line 420 "./src/headers/tsip_header_Privacy.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 124 "./ragel/tsip_parser_header_Privacy.rl" */ + + if( cs < +/* #line 436 "./src/headers/tsip_header_Privacy.c" */ +45 +/* #line 125 "./ragel/tsip_parser_header_Privacy.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Privacy' header."); + TSK_OBJECT_SAFE_FREE(hdr_privacy); + } + + return hdr_privacy; +} + + + + + + + +//======================================================== +// Privacy header object definition +// + +static tsk_object_t* tsip_header_Privacy_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Privacy_t *Privacy = self; + if(Privacy){ + TSIP_HEADER(Privacy)->type = tsip_htype_Privacy; + TSIP_HEADER(Privacy)->serialize = tsip_header_Privacy_serialize; + } + else{ + TSK_DEBUG_ERROR("Failed to create new Privacy header."); + } + return self; +} + +static tsk_object_t* tsip_header_Privacy_dtor(tsk_object_t *self) +{ + tsip_header_Privacy_t *Privacy = self; + if(Privacy){ + TSK_OBJECT_SAFE_FREE(Privacy->values); + } + else{ + TSK_DEBUG_ERROR("Null Privacy header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Privacy_def_s = +{ + sizeof(tsip_header_Privacy_t), + tsip_header_Privacy_ctor, + tsip_header_Privacy_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Privacy_def_t = &tsip_header_Privacy_def_s; diff --git a/tinySIP/src/headers/tsip_header_Proxy_Authenticate.c b/tinySIP/src/headers/tsip_header_Proxy_Authenticate.c new file mode 100644 index 0000000..952882a --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Proxy_Authenticate.c @@ -0,0 +1,161 @@ + +/* #line 1 "tsip_parser_header_Proxy_Authenticate.rl" */ +/* +* 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 tsip_header_Proxy_Authenticate.c + * @brief SIP Proxy-Authenticate header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Proxy_Authenticate.h" + +#include "tinyhttp/headers/thttp_header_WWW_Authenticate.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_time.h" + +#include <string.h> + +tsip_header_Proxy_Authenticate_t* tsip_header_Proxy_Authenticate_create() +{ + return tsk_object_new(tsip_header_Proxy_Authenticate_def_t); +} + +int tsip_header_Proxy_Authenticate_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Proxy_Authenticate_t *Proxy_Authenticate = (const tsip_header_Proxy_Authenticate_t*)header; + if(Proxy_Authenticate && Proxy_Authenticate->scheme){ + return tsk_buffer_append_2(output, "%s realm=\"%s\"%s%s%s%s%s%s%s%s%s%s%s%s,stale=%s%s%s", + Proxy_Authenticate->scheme, + Proxy_Authenticate->realm ? Proxy_Authenticate->realm : "", + + Proxy_Authenticate->domain ? ",domain=\"" : "", + Proxy_Authenticate->domain ? Proxy_Authenticate->domain : "", + Proxy_Authenticate->domain ? "\"" : "", + + + Proxy_Authenticate->qop ? ",qop=\"" : "", + Proxy_Authenticate->qop ? Proxy_Authenticate->qop : "", + Proxy_Authenticate->qop ? "\"" : "", + + + Proxy_Authenticate->nonce ? ",nonce=\"" : "", + Proxy_Authenticate->nonce ? Proxy_Authenticate->nonce : "", + Proxy_Authenticate->nonce ? "\"" : "", + + Proxy_Authenticate->opaque ? ",opaque=\"" : "", + Proxy_Authenticate->opaque ? Proxy_Authenticate->opaque : "", + Proxy_Authenticate->opaque ? "\"" : "", + + Proxy_Authenticate->stale ? "TRUE" : "FALSE", + + Proxy_Authenticate->algorithm ? ",algorithm=" : "", + Proxy_Authenticate->algorithm ? Proxy_Authenticate->algorithm : "" + ); + } + } + return -1; +} + +tsip_header_Proxy_Authenticate_t *tsip_header_Proxy_Authenticate_parse(const char *data, tsk_size_t size) +{ + tsip_header_Proxy_Authenticate_t *sip_hdr = 0; + thttp_header_Proxy_Authenticate_t* http_hdr; + + if((http_hdr = thttp_header_Proxy_Authenticate_parse(data, size))){ + sip_hdr = tsip_header_Proxy_Authenticate_create(); + + sip_hdr->scheme = tsk_strdup(http_hdr->scheme); + sip_hdr->realm = tsk_strdup(http_hdr->realm); + sip_hdr->domain = tsk_strdup(http_hdr->domain); + sip_hdr->nonce = tsk_strdup(http_hdr->nonce); + sip_hdr->opaque = tsk_strdup(http_hdr->opaque); + sip_hdr->algorithm = tsk_strdup(http_hdr->algorithm); + sip_hdr->qop = tsk_strdup(http_hdr->qop); + sip_hdr->stale = http_hdr->stale; + + TSIP_HEADER(sip_hdr)->params = tsk_object_ref(THTTP_HEADER(http_hdr)->params); + + TSK_OBJECT_SAFE_FREE(http_hdr); + } + + return sip_hdr; +} + + + + +//======================================================== +// Proxy_Authenticate header object definition +// + +/**@ingroup tsip_header_Proxy_Authenticate_group +*/ +static tsk_object_t* tsip_header_Proxy_Authenticate_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Proxy_Authenticate_t *Proxy_Authenticate = self; + if(Proxy_Authenticate){ + TSIP_HEADER(Proxy_Authenticate)->type = tsip_htype_Proxy_Authenticate; + TSIP_HEADER(Proxy_Authenticate)->serialize = tsip_header_Proxy_Authenticate_serialize; + } + else{ + TSK_DEBUG_ERROR("Failed to create new Proxy_Authenticate header."); + } + return self; +} + +/**@ingroup tsip_header_Proxy_Authenticate_group +*/ +static tsk_object_t* tsip_header_Proxy_Authenticate_dtor(tsk_object_t *self) +{ + tsip_header_Proxy_Authenticate_t *Proxy_Authenticate = self; + if(Proxy_Authenticate){ + TSK_FREE(Proxy_Authenticate->scheme); + TSK_FREE(Proxy_Authenticate->realm); + TSK_FREE(Proxy_Authenticate->domain); + TSK_FREE(Proxy_Authenticate->nonce); + TSK_FREE(Proxy_Authenticate->opaque); + TSK_FREE(Proxy_Authenticate->algorithm); + TSK_FREE(Proxy_Authenticate->qop); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Proxy_Authenticate)); + } + else{ + TSK_DEBUG_ERROR("Null Proxy_Authenticate header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Proxy_Authenticate_def_s = +{ + sizeof(tsip_header_Proxy_Authenticate_t), + tsip_header_Proxy_Authenticate_ctor, + tsip_header_Proxy_Authenticate_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Proxy_Authenticate_def_t = &tsip_header_Proxy_Authenticate_def_s; diff --git a/tinySIP/src/headers/tsip_header_Proxy_Authorization.c b/tinySIP/src/headers/tsip_header_Proxy_Authorization.c new file mode 100644 index 0000000..dac8a97 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Proxy_Authorization.c @@ -0,0 +1,182 @@ + +/* #line 1 "tsip_parser_header_Proxy_Authorization.rl" */ +/* +* 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 tsip_header_Proxy_Authorization.c + * @brief SIP Proxy-Authenticate header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Proxy_Authorization.h" + +#include "tinyhttp/headers/thttp_header_Authorization.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_time.h" + +#include <string.h> + +tsip_header_Proxy_Authorization_t* tsip_header_Proxy_Authorization_create() +{ + return tsk_object_new(tsip_header_Proxy_Authorization_def_t); +} + +int tsip_header_Proxy_Authorization_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Proxy_Authorization_t *Proxy_Authorization = (const tsip_header_Proxy_Authorization_t *)header; + if(Proxy_Authorization && Proxy_Authorization->scheme){ + return tsk_buffer_append_2(output, "%s %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", + Proxy_Authorization->scheme, + + Proxy_Authorization->username ? "username=\"" : "", + Proxy_Authorization->username ? Proxy_Authorization->username : "", + Proxy_Authorization->username ? "\"" : "", + + Proxy_Authorization->realm ? ",realm=\"" : "", + Proxy_Authorization->realm ? Proxy_Authorization->realm : "", + Proxy_Authorization->realm ? "\"" : "", + + Proxy_Authorization->nonce ? ",nonce=\"" : "", + Proxy_Authorization->nonce ? Proxy_Authorization->nonce : "", + Proxy_Authorization->nonce ? "\"" : "", + + Proxy_Authorization->uri ? ",uri=\"" : "", + Proxy_Authorization->uri ? Proxy_Authorization->uri : "", + Proxy_Authorization->uri ? "\"" : "", + + Proxy_Authorization->response ? ",response=\"" : "", + Proxy_Authorization->response ? Proxy_Authorization->response : "", + Proxy_Authorization->response ? "\"" : "", + + Proxy_Authorization->algorithm ? ",algorithm=" : "", + Proxy_Authorization->algorithm ? Proxy_Authorization->algorithm : "", + + Proxy_Authorization->cnonce ? ",cnonce=\"" : "", + Proxy_Authorization->cnonce ? Proxy_Authorization->cnonce : "", + Proxy_Authorization->cnonce ? "\"" : "", + + Proxy_Authorization->opaque ? ",opaque=\"" : "", + Proxy_Authorization->opaque ? Proxy_Authorization->opaque : "", + Proxy_Authorization->opaque ? "\"" : "", + + Proxy_Authorization->qop ? ",qop=" : "", + Proxy_Authorization->qop ? Proxy_Authorization->qop : "", + + Proxy_Authorization->nc ? ",nc=" : "", + Proxy_Authorization->nc ? Proxy_Authorization->nc : "" + ); + } + } + return -1; +} + +tsip_header_Proxy_Authorization_t *tsip_header_Proxy_Authorization_parse(const char *data, tsk_size_t size) +{ + tsip_header_Proxy_Authorization_t *hdr_sip = 0; + thttp_header_Proxy_Authorization_t* hdr_http; + + if((hdr_http = thttp_header_Proxy_Authorization_parse(data, size))){ + hdr_sip = tsip_header_Proxy_Authorization_create(); + + hdr_sip->scheme = tsk_strdup(hdr_http->scheme); + hdr_sip->username = tsk_strdup(hdr_http->username); + hdr_sip->realm = tsk_strdup(hdr_http->realm); + hdr_sip->nonce = tsk_strdup(hdr_http->nonce); + hdr_sip->uri = tsk_strdup(hdr_http->uri); + hdr_sip->response = tsk_strdup(hdr_http->response); + hdr_sip->algorithm = tsk_strdup(hdr_http->algorithm); + hdr_sip->cnonce = tsk_strdup(hdr_http->cnonce); + hdr_sip->opaque = tsk_strdup(hdr_http->opaque); + hdr_sip->qop = tsk_strdup(hdr_http->qop); + hdr_sip->nc = tsk_strdup(hdr_http->nc); + + TSIP_HEADER(hdr_sip)->params = tsk_object_ref(THTTP_HEADER(hdr_http)->params); + + TSK_OBJECT_SAFE_FREE(hdr_http); + } + + return hdr_sip; +} + + + + + + + +//======================================================== +// Proxy_Authorization header object definition +// + +/**@ingroup tsip_header_Proxy_Authorization_group +*/ +static tsk_object_t* tsip_header_Proxy_Authorization_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Proxy_Authorization_t *Proxy_Authorization = self; + if(Proxy_Authorization){ + TSIP_HEADER(Proxy_Authorization)->type = tsip_htype_Proxy_Authorization; + TSIP_HEADER(Proxy_Authorization)->serialize = tsip_header_Proxy_Authorization_serialize; + } + else{ + TSK_DEBUG_ERROR("Failed to create new Proxy_Authorization header."); + } + return self; +} + +/**@ingroup tsip_header_Proxy_Authorization_group +*/ +static tsk_object_t* tsip_header_Proxy_Authorization_dtor(tsk_object_t *self) +{ + tsip_header_Proxy_Authorization_t *Proxy_Authorization = self; + if(Proxy_Authorization){ + TSK_FREE(Proxy_Authorization->scheme); + TSK_FREE(Proxy_Authorization->username); + TSK_FREE(Proxy_Authorization->realm); + TSK_FREE(Proxy_Authorization->nonce); + TSK_FREE(Proxy_Authorization->uri); + TSK_FREE(Proxy_Authorization->response); + TSK_FREE(Proxy_Authorization->algorithm); + TSK_FREE(Proxy_Authorization->cnonce); + TSK_FREE(Proxy_Authorization->opaque); + TSK_FREE(Proxy_Authorization->qop); + TSK_FREE(Proxy_Authorization->nc); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Proxy_Authorization)); + } + else TSK_DEBUG_ERROR("Null Proxy_Authorization header."); + + return self; +} + +static const tsk_object_def_t tsip_header_Proxy_Authorization_def_s = +{ + sizeof(tsip_header_Proxy_Authorization_t), + tsip_header_Proxy_Authorization_ctor, + tsip_header_Proxy_Authorization_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Proxy_Authorization_def_t = &tsip_header_Proxy_Authorization_def_s; diff --git a/tinySIP/src/headers/tsip_header_Proxy_Require.c b/tinySIP/src/headers/tsip_header_Proxy_Require.c new file mode 100644 index 0000000..a0d69f4 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Proxy_Require.c @@ -0,0 +1,364 @@ + +/* #line 1 "./ragel/tsip_parser_header_Proxy_Require.rl" */ + +/* +* 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 tsip_header_Proxy_Require.c + * @brief SIP Proxy-Require header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Proxy_Require.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + +#include <string.h> + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 66 "./ragel/tsip_parser_header_Proxy_Require.rl" */ + + + +tsip_header_Proxy_Require_t* tsip_header_Proxy_Require_create(const char* option) +{ + return tsk_object_new(TSIP_HEADER_PROXY_REQUIRE_VA_ARGS(option)); +} + +tsip_header_Proxy_Require_t* tsip_header_Proxy_Require_create_null() +{ + return tsip_header_Proxy_Require_create(tsk_null); +} + +int tsip_header_Proxy_Require_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Proxy_Require_t *Proxy_Require = (const tsip_header_Proxy_Require_t *)header; + tsk_list_item_t *item; + tsk_string_t *str; + int ret = 0; + + tsk_list_foreach(item, Proxy_Require->options){ + str = item->data; + if(item == Proxy_Require->options->head){ + ret = tsk_buffer_append(output, str->value, tsk_strlen(str->value)); + } + else{ + ret = tsk_buffer_append_2(output, ",%s", str->value); + } + } + + return ret; + } + + return -1; +} + +tsip_header_Proxy_Require_t *tsip_header_Proxy_Require_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Proxy_Require_t *hdr_proxyrequire = tsip_header_Proxy_Require_create_null(); + + const char *tag_start = tsk_null; + + +/* #line 97 "./src/headers/tsip_header_Proxy_Require.c" */ +static const char _tsip_machine_parser_header_Proxy_Require_actions[] = { + 0, 1, 0, 1, 1, 1, 2 +}; + +static const char _tsip_machine_parser_header_Proxy_Require_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 11, + 13, 15, 17, 19, 21, 23, 25, 28, + 45, 46, 48, 64, 80, 84, 85, 87, + 90, 91 +}; + +static const char _tsip_machine_parser_header_Proxy_Require_trans_keys[] = { + 80, 112, 82, 114, 79, 111, 88, 120, + 89, 121, 45, 82, 114, 69, 101, 81, + 113, 85, 117, 73, 105, 82, 114, 69, + 101, 9, 32, 58, 9, 13, 32, 33, + 37, 39, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 32, 33, 37, 39, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 33, 37, 39, 44, 126, + 42, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 44, 10, 9, 32, 9, + 32, 44, 10, 0 +}; + +static const char _tsip_machine_parser_header_Proxy_Require_single_lengths[] = { + 0, 2, 2, 2, 2, 2, 1, 2, + 2, 2, 2, 2, 2, 2, 3, 7, + 1, 2, 6, 8, 4, 1, 2, 3, + 1, 0 +}; + +static const char _tsip_machine_parser_header_Proxy_Require_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 5, + 0, 0, 5, 4, 0, 0, 0, 0, + 0, 0 +}; + +static const char _tsip_machine_parser_header_Proxy_Require_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 15, 17, + 20, 23, 26, 29, 32, 35, 38, 42, + 55, 57, 60, 72, 85, 90, 92, 95, + 99, 101 +}; + +static const char _tsip_machine_parser_header_Proxy_Require_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 5, 5, 1, 6, + 1, 7, 7, 1, 8, 8, 1, 9, + 9, 1, 10, 10, 1, 11, 11, 1, + 12, 12, 1, 13, 13, 1, 13, 13, + 14, 1, 14, 15, 14, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 1, 17, + 1, 18, 18, 1, 18, 18, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 1, + 19, 20, 19, 21, 21, 21, 22, 21, + 21, 21, 21, 21, 1, 23, 24, 23, + 14, 1, 25, 1, 26, 26, 1, 26, + 26, 14, 1, 27, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Proxy_Require_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 19, 17, 18, 20, 24, 19, 15, 20, + 21, 22, 23, 25 +}; + +static const char _tsip_machine_parser_header_Proxy_Require_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 3, 3, 0, 3, 0, + 0, 0, 0, 5 +}; + +static const int tsip_machine_parser_header_Proxy_Require_start = 1; +static const int tsip_machine_parser_header_Proxy_Require_first_final = 25; +static const int tsip_machine_parser_header_Proxy_Require_error = 0; + +static const int tsip_machine_parser_header_Proxy_Require_en_main = 1; + + +/* #line 114 "./ragel/tsip_parser_header_Proxy_Require.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Proxy_Require_first_final); + (void)(tsip_machine_parser_header_Proxy_Require_error); + (void)(tsip_machine_parser_header_Proxy_Require_en_main); + +/* #line 188 "./src/headers/tsip_header_Proxy_Require.c" */ + { + cs = tsip_machine_parser_header_Proxy_Require_start; + } + +/* #line 119 "./ragel/tsip_parser_header_Proxy_Require.rl" */ + +/* #line 195 "./src/headers/tsip_header_Proxy_Require.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Proxy_Require_trans_keys + _tsip_machine_parser_header_Proxy_Require_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Proxy_Require_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Proxy_Require_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Proxy_Require_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Proxy_Require_indicies[_trans]; + cs = _tsip_machine_parser_header_Proxy_Require_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Proxy_Require_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Proxy_Require_actions + _tsip_machine_parser_header_Proxy_Require_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 50 "./ragel/tsip_parser_header_Proxy_Require.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 54 "./ragel/tsip_parser_header_Proxy_Require.rl" */ + { + TSK_PARSER_ADD_STRING(hdr_proxyrequire->options); + } + break; + case 2: +/* #line 58 "./ragel/tsip_parser_header_Proxy_Require.rl" */ + { + } + break; +/* #line 286 "./src/headers/tsip_header_Proxy_Require.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 120 "./ragel/tsip_parser_header_Proxy_Require.rl" */ + + if( cs < +/* #line 302 "./src/headers/tsip_header_Proxy_Require.c" */ +25 +/* #line 121 "./ragel/tsip_parser_header_Proxy_Require.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Privacy' header."); + TSK_OBJECT_SAFE_FREE(hdr_proxyrequire); + } + + return hdr_proxyrequire; +} + + + + + + + +//======================================================== +// Proxy_Require header object definition +// + +static tsk_object_t* tsip_header_Proxy_Require_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Proxy_Require_t *Proxy_Require = self; + if(Proxy_Require){ + const char* option; + + TSIP_HEADER(Proxy_Require)->type = tsip_htype_Proxy_Require; + TSIP_HEADER(Proxy_Require)->serialize = tsip_header_Proxy_Require_serialize; + + if((option = va_arg(*app, const char*))){ + tsk_string_t* string = tsk_string_create(option); + Proxy_Require->options = tsk_list_create(); + + tsk_list_push_back_data(Proxy_Require->options, ((void**) &string)); + } + } + else{ + TSK_DEBUG_ERROR("Failed to create new Proxy_Require header."); + } + return self; +} + +static tsk_object_t* tsip_header_Proxy_Require_dtor(tsk_object_t *self) +{ + tsip_header_Proxy_Require_t *Proxy_Require = self; + if(Proxy_Require){ + TSK_OBJECT_SAFE_FREE(Proxy_Require->options); + } + else{ + TSK_DEBUG_ERROR("Null Proxy_Require header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Proxy_Require_def_s = +{ + sizeof(tsip_header_Proxy_Require_t), + tsip_header_Proxy_Require_ctor, + tsip_header_Proxy_Require_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Proxy_Require_def_t = &tsip_header_Proxy_Require_def_s; diff --git a/tinySIP/src/headers/tsip_header_RAck.c b/tinySIP/src/headers/tsip_header_RAck.c new file mode 100644 index 0000000..4040c8c --- /dev/null +++ b/tinySIP/src/headers/tsip_header_RAck.c @@ -0,0 +1,355 @@ + +/* #line 1 "./ragel/tsip_parser_header_RAck.rl" */ + + +/* +* 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 tsip_header_RAck.c + * @brief SIP RAck header as per RFC 3262. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_RAck.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 73 "./ragel/tsip_parser_header_RAck.rl" */ + + + +tsip_header_RAck_t* tsip_header_RAck_create(uint32_t seq, uint32_t cseq, const char* method) +{ + return tsk_object_new(TSIP_HEADER_RACK_VA_ARGS(seq, cseq, method)); +} + +tsip_header_RAck_t* tsip_header_RAck_create_null() +{ + return tsip_header_RAck_create(0, 0, tsk_null); +} + +int tsip_header_RAck_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_RAck_t *RAck = (const tsip_header_RAck_t *)header; + return tsk_buffer_append_2(output, "%u %u %s", RAck->seq, RAck->cseq, RAck->method); + } + return -1; +} + +tsip_header_RAck_t *tsip_header_RAck_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_RAck_t *hdr_rack = tsip_header_RAck_create_null(); + + const char *tag_start = tsk_null; + + +/* #line 81 "./src/headers/tsip_header_RAck.c" */ +static const char _tsip_machine_parser_header_RAck_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3, 1, 4 +}; + +static const char _tsip_machine_parser_header_RAck_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 11, 16, + 17, 19, 23, 28, 33, 34, 36, 40, + 45, 62, 63, 65, 81, 96, 97 +}; + +static const char _tsip_machine_parser_header_RAck_trans_keys[] = { + 82, 114, 65, 97, 67, 99, 75, 107, + 9, 32, 58, 9, 13, 32, 48, 57, + 10, 9, 32, 9, 32, 48, 57, 9, + 13, 32, 48, 57, 9, 13, 32, 48, + 57, 10, 9, 32, 9, 32, 48, 57, + 9, 13, 32, 48, 57, 9, 13, 32, + 33, 37, 39, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 10, 9, + 32, 9, 32, 33, 37, 39, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 13, 33, 37, 39, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 10, 0 +}; + +static const char _tsip_machine_parser_header_RAck_single_lengths[] = { + 0, 2, 2, 2, 2, 3, 3, 1, + 2, 2, 3, 3, 1, 2, 2, 3, + 7, 1, 2, 6, 5, 1, 0 +}; + +static const char _tsip_machine_parser_header_RAck_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 1, 1, 1, 0, 0, 1, 1, + 5, 0, 0, 5, 5, 0, 0 +}; + +static const char _tsip_machine_parser_header_RAck_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 16, 21, + 23, 26, 30, 35, 40, 42, 45, 49, + 54, 67, 69, 72, 84, 95, 97 +}; + +static const char _tsip_machine_parser_header_RAck_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 4, 4, 5, 1, + 5, 6, 5, 7, 1, 8, 1, 9, + 9, 1, 9, 9, 7, 1, 10, 11, + 10, 12, 1, 13, 14, 13, 15, 1, + 16, 1, 17, 17, 1, 17, 17, 15, + 1, 18, 19, 18, 20, 1, 21, 22, + 21, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 1, 24, 1, 25, 25, 1, + 25, 25, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 1, 26, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 1, 28, + 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_RAck_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 10, + 8, 9, 11, 12, 10, 11, 12, 15, + 13, 14, 16, 17, 15, 16, 17, 20, + 18, 19, 21, 20, 22 +}; + +static const char _tsip_machine_parser_header_RAck_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 1, + 0, 0, 3, 3, 0, 0, 0, 1, + 0, 0, 5, 5, 0, 0, 0, 1, + 0, 0, 7, 0, 9 +}; + +static const int tsip_machine_parser_header_RAck_start = 1; +static const int tsip_machine_parser_header_RAck_first_final = 22; +static const int tsip_machine_parser_header_RAck_error = 0; + +static const int tsip_machine_parser_header_RAck_en_main = 1; + + +/* #line 106 "./ragel/tsip_parser_header_RAck.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_RAck_first_final); + (void)(tsip_machine_parser_header_RAck_error); + (void)(tsip_machine_parser_header_RAck_en_main); + +/* #line 170 "./src/headers/tsip_header_RAck.c" */ + { + cs = tsip_machine_parser_header_RAck_start; + } + +/* #line 111 "./ragel/tsip_parser_header_RAck.rl" */ + +/* #line 177 "./src/headers/tsip_header_RAck.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_RAck_trans_keys + _tsip_machine_parser_header_RAck_key_offsets[cs]; + _trans = _tsip_machine_parser_header_RAck_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_RAck_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_RAck_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_RAck_indicies[_trans]; + cs = _tsip_machine_parser_header_RAck_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_RAck_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_RAck_actions + _tsip_machine_parser_header_RAck_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 49 "./ragel/tsip_parser_header_RAck.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 53 "./ragel/tsip_parser_header_RAck.rl" */ + { + TSK_PARSER_SET_UINT(hdr_rack->seq); + } + break; + case 2: +/* #line 57 "./ragel/tsip_parser_header_RAck.rl" */ + { + TSK_PARSER_SET_UINT(hdr_rack->cseq); + } + break; + case 3: +/* #line 61 "./ragel/tsip_parser_header_RAck.rl" */ + { + TSK_PARSER_SET_STRING(hdr_rack->method); + } + break; + case 4: +/* #line 65 "./ragel/tsip_parser_header_RAck.rl" */ + { + } + break; +/* #line 280 "./src/headers/tsip_header_RAck.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 112 "./ragel/tsip_parser_header_RAck.rl" */ + + if( cs < +/* #line 296 "./src/headers/tsip_header_RAck.c" */ +22 +/* #line 113 "./ragel/tsip_parser_header_RAck.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'RAck' header."); + TSK_OBJECT_SAFE_FREE(hdr_rack); + } + + return hdr_rack; +} + + + + + + + +//======================================================== +// RAck header object definition +// + +static tsk_object_t* tsip_header_RAck_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_RAck_t *RAck = self; + if(RAck){ + TSIP_HEADER(RAck)->type = tsip_htype_RAck; + TSIP_HEADER(RAck)->serialize = tsip_header_RAck_serialize; + RAck->seq = va_arg(*app, uint32_t); + RAck->cseq = va_arg(*app, uint32_t); + RAck->method = tsk_strdup( va_arg(*app, const char*) ); + } + else{ + TSK_DEBUG_ERROR("Failed to create new RAck header."); + } + return self; +} + +static tsk_object_t* tsip_header_RAck_dtor(tsk_object_t *self) +{ + tsip_header_RAck_t *RAck = self; + if(RAck){ + TSK_FREE(RAck->method); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(RAck)); + } + else{ + TSK_DEBUG_ERROR("Null RAck header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_RAck_def_s = +{ + sizeof(tsip_header_RAck_t), + tsip_header_RAck_ctor, + tsip_header_RAck_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_RAck_def_t = &tsip_header_RAck_def_s; + diff --git a/tinySIP/src/headers/tsip_header_RSeq.c b/tinySIP/src/headers/tsip_header_RSeq.c new file mode 100644 index 0000000..0e419b4 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_RSeq.c @@ -0,0 +1,313 @@ + +/* #line 1 "./ragel/tsip_parser_header_RSeq.rl" */ + +/* +* 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 tsip_header_RSeq.c + * @brief SIP RSeq header as per RFC 3262. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_RSeq.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 65 "./ragel/tsip_parser_header_RSeq.rl" */ + + + +tsip_header_RSeq_t* tsip_header_RSeq_create(uint32_t seq) +{ + return tsk_object_new(TSIP_HEADER_RSEQ_VA_ARGS(seq)); +} + +tsip_header_RSeq_t* tsip_header_RSeq_create_null() +{ + return tsip_header_RSeq_create(0); +} + +int tsip_header_RSeq_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_RSeq_t *RSeq = (const tsip_header_RSeq_t *)header; + return tsk_buffer_append_2(output, "%u", RSeq->seq); + } + return -1; +} + +tsip_header_RSeq_t *tsip_header_RSeq_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_RSeq_t *hdr_rseq = tsip_header_RSeq_create_null(); + + const char *tag_start = tsk_null; + + +/* #line 81 "./src/headers/tsip_header_RSeq.c" */ +static const char _tsip_machine_parser_header_RSeq_actions[] = { + 0, 1, 0, 1, 1, 1, 2 +}; + +static const char _tsip_machine_parser_header_RSeq_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 11, 16, + 17, 19, 23, 26, 27 +}; + +static const char _tsip_machine_parser_header_RSeq_trans_keys[] = { + 82, 114, 83, 115, 69, 101, 81, 113, + 9, 32, 58, 9, 13, 32, 48, 57, + 10, 9, 32, 9, 32, 48, 57, 13, + 48, 57, 10, 0 +}; + +static const char _tsip_machine_parser_header_RSeq_single_lengths[] = { + 0, 2, 2, 2, 2, 3, 3, 1, + 2, 2, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_RSeq_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 1, 1, 0, 0 +}; + +static const char _tsip_machine_parser_header_RSeq_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 16, 21, + 23, 26, 30, 33, 35 +}; + +static const char _tsip_machine_parser_header_RSeq_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 4, 4, 5, 1, + 5, 6, 5, 7, 1, 8, 1, 9, + 9, 1, 9, 9, 7, 1, 10, 11, + 1, 12, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_RSeq_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 10, + 8, 9, 11, 10, 12 +}; + +static const char _tsip_machine_parser_header_RSeq_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 1, + 0, 0, 3, 0, 5 +}; + +static const int tsip_machine_parser_header_RSeq_start = 1; +static const int tsip_machine_parser_header_RSeq_first_final = 12; +static const int tsip_machine_parser_header_RSeq_error = 0; + +static const int tsip_machine_parser_header_RSeq_en_main = 1; + + +/* #line 98 "./ragel/tsip_parser_header_RSeq.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_RSeq_first_final); + (void)(tsip_machine_parser_header_RSeq_error); + (void)(tsip_machine_parser_header_RSeq_en_main); + +/* #line 144 "./src/headers/tsip_header_RSeq.c" */ + { + cs = tsip_machine_parser_header_RSeq_start; + } + +/* #line 103 "./ragel/tsip_parser_header_RSeq.rl" */ + +/* #line 151 "./src/headers/tsip_header_RSeq.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_RSeq_trans_keys + _tsip_machine_parser_header_RSeq_key_offsets[cs]; + _trans = _tsip_machine_parser_header_RSeq_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_RSeq_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_RSeq_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_RSeq_indicies[_trans]; + cs = _tsip_machine_parser_header_RSeq_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_RSeq_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_RSeq_actions + _tsip_machine_parser_header_RSeq_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 49 "./ragel/tsip_parser_header_RSeq.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 53 "./ragel/tsip_parser_header_RSeq.rl" */ + { + TSK_PARSER_SET_UINT(hdr_rseq->seq); + } + break; + case 2: +/* #line 57 "./ragel/tsip_parser_header_RSeq.rl" */ + { + } + break; +/* #line 242 "./src/headers/tsip_header_RSeq.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 104 "./ragel/tsip_parser_header_RSeq.rl" */ + + if( cs < +/* #line 258 "./src/headers/tsip_header_RSeq.c" */ +12 +/* #line 105 "./ragel/tsip_parser_header_RSeq.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'RSeq' header."); + TSK_OBJECT_SAFE_FREE(hdr_rseq); + } + + return hdr_rseq; +} + + + + + + + +//======================================================== +// RSeq header object definition +// + +static tsk_object_t* tsip_header_RSeq_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_RSeq_t *RSeq = self; + if(RSeq){ + TSIP_HEADER(RSeq)->type = tsip_htype_RSeq; + TSIP_HEADER(RSeq)->serialize = tsip_header_RSeq_serialize; + RSeq->seq = va_arg(*app, uint32_t); + } + else{ + TSK_DEBUG_ERROR("Failed to create new RSeq header."); + } + return self; +} + +static tsk_object_t* tsip_header_RSeq_dtor(tsk_object_t *self) +{ + tsip_header_RSeq_t *RSeq = self; + if(RSeq){ + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(RSeq)); + } + else{ + TSK_DEBUG_ERROR("Null RSeq header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_RSeq_def_s = +{ + sizeof(tsip_header_RSeq_t), + tsip_header_RSeq_ctor, + tsip_header_RSeq_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_RSeq_def_t = &tsip_header_RSeq_def_s; + diff --git a/tinySIP/src/headers/tsip_header_Reason.c b/tinySIP/src/headers/tsip_header_Reason.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Reason.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Record_Route.c b/tinySIP/src/headers/tsip_header_Record_Route.c new file mode 100644 index 0000000..08e610f --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Record_Route.c @@ -0,0 +1,554 @@ + +/* #line 1 "./ragel/tsip_parser_header_Record_Route.rl" */ +/* +* 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 tsip_header_Record_Route.c + * @brief SIP Record-Route header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Record_Route.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_time.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 105 "./ragel/tsip_parser_header_Record_Route.rl" */ + + + +tsip_header_Record_Route_t* tsip_header_Record_Route_create(const tsip_uri_t* uri) +{ + return tsk_object_new(TSIP_HEADER_RECORD_ROUTE_VA_ARGS(uri)); +} + +tsip_header_Record_Route_t* tsip_header_Record_Route_create_null() +{ + return tsip_header_Record_Route_create(tsk_null); +} + +int tsip_header_Record_Route_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + int ret; + const tsip_header_Record_Route_t *Record_Route = (const tsip_header_Record_Route_t *)header; + + /* Uri with hacked display-name*/ + if((ret = tsip_uri_serialize(Record_Route->uri, tsk_true, tsk_true, output))){ + return ret; + } + return ret; + } + return -1; +} + + tsip_header_Record_Routes_L_t* tsip_header_Record_Route_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Record_Routes_L_t *hdr_record_routes = tsk_list_create(); + tsip_header_Record_Route_t *curr_route = tsk_null; + + const char *tag_start = tsk_null; + + +/* #line 90 "./src/headers/tsip_header_Record_Route.c" */ +static const char _tsip_machine_parser_header_Record_Route_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3, 1, 4, 1, 5, 1, 6, 2, + 1, 0, 2, 4, 5 +}; + +static const short _tsip_machine_parser_header_Record_Route_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 12, + 13, 15, 17, 19, 21, 23, 26, 45, + 46, 48, 67, 68, 70, 73, 77, 89, + 92, 92, 93, 98, 99, 116, 117, 119, + 135, 153, 159, 160, 162, 167, 186, 187, + 189, 208, 209, 211, 214, 222, 223, 225, + 230, 235, 236, 238, 242, 248, 265, 272, + 280, 288, 296, 298, 305, 314, 316, 319, + 321, 324, 326, 329, 332, 333, 336, 337, + 340, 341, 350, 359, 367, 375, 383, 391, + 393, 399, 408, 417, 426, 428, 431, 434, + 435, 436, 453, 471, 475, 476, 478, 486, + 487, 489, 493, 499 +}; + +static const char _tsip_machine_parser_header_Record_Route_trans_keys[] = { + 82, 114, 69, 101, 67, 99, 79, 111, + 82, 114, 68, 100, 45, 82, 114, 79, + 111, 85, 117, 84, 116, 69, 101, 9, + 32, 58, 9, 13, 32, 33, 34, 37, + 39, 60, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 13, 32, 33, 34, 37, 39, 60, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 10, 9, 32, 9, 32, + 60, 65, 90, 97, 122, 9, 32, 43, + 58, 45, 46, 48, 57, 65, 90, 97, + 122, 9, 32, 58, 62, 9, 13, 32, + 44, 59, 10, 9, 13, 32, 33, 37, + 39, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 10, 9, 32, 9, + 32, 33, 37, 39, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 44, 59, 61, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 44, 59, 61, 10, + 9, 32, 9, 32, 44, 59, 61, 9, + 13, 32, 33, 34, 37, 39, 91, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 10, 9, 32, 9, 13, 32, + 33, 34, 37, 39, 91, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 10, 9, 32, 9, 32, 34, 13, 34, + 92, 127, 0, 8, 10, 31, 10, 9, + 32, 9, 13, 32, 44, 59, 9, 13, + 32, 44, 59, 10, 9, 32, 9, 32, + 44, 59, 0, 9, 11, 12, 14, 127, + 9, 13, 32, 33, 37, 39, 44, 59, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 58, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 58, 48, 57, 65, 70, 97, + 102, 46, 58, 93, 48, 57, 65, 70, + 97, 102, 48, 57, 46, 48, 57, 48, + 57, 46, 48, 57, 48, 57, 93, 48, + 57, 93, 48, 57, 93, 46, 48, 57, + 46, 46, 48, 57, 46, 46, 58, 93, + 48, 57, 65, 70, 97, 102, 46, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 46, + 58, 93, 48, 57, 65, 70, 97, 102, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 46, 58, 93, 48, 57, 65, 70, + 97, 102, 48, 57, 46, 48, 57, 46, + 48, 57, 46, 58, 9, 13, 32, 33, + 37, 39, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 60, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 60, 10, 9, 32, 13, 34, + 92, 127, 0, 8, 10, 31, 10, 9, + 32, 9, 13, 32, 60, 0, 9, 11, + 12, 14, 127, 0 +}; + +static const char _tsip_machine_parser_header_Record_Route_single_lengths[] = { + 0, 2, 2, 2, 2, 2, 2, 1, + 2, 2, 2, 2, 2, 3, 9, 1, + 2, 9, 1, 2, 3, 0, 4, 3, + 0, 1, 5, 1, 7, 1, 2, 6, + 10, 6, 1, 2, 5, 9, 1, 2, + 9, 1, 2, 3, 4, 1, 2, 5, + 5, 1, 2, 4, 0, 9, 1, 2, + 2, 2, 2, 1, 3, 0, 1, 0, + 1, 0, 1, 1, 1, 1, 1, 1, + 1, 3, 3, 2, 2, 2, 2, 2, + 0, 3, 3, 3, 0, 1, 1, 1, + 1, 7, 8, 4, 1, 2, 4, 1, + 2, 4, 0, 0 +}; + +static const char _tsip_machine_parser_header_Record_Route_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 5, 0, + 0, 5, 0, 0, 0, 2, 4, 0, + 0, 0, 0, 0, 5, 0, 0, 5, + 4, 0, 0, 0, 0, 5, 0, 0, + 5, 0, 0, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 3, 4, 3, 3, + 3, 3, 0, 3, 3, 1, 1, 1, + 1, 1, 1, 1, 0, 1, 0, 1, + 0, 3, 3, 3, 3, 3, 3, 0, + 3, 3, 3, 3, 1, 1, 1, 0, + 0, 5, 5, 0, 0, 0, 2, 0, + 0, 0, 3, 0 +}; + +static const short _tsip_machine_parser_header_Record_Route_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 15, 18, + 20, 23, 26, 29, 32, 35, 39, 54, + 56, 59, 74, 76, 79, 83, 86, 95, + 99, 100, 102, 108, 110, 123, 125, 128, + 140, 155, 162, 164, 167, 173, 188, 190, + 193, 208, 210, 213, 217, 224, 226, 229, + 235, 241, 243, 246, 251, 255, 269, 274, + 280, 286, 292, 295, 300, 307, 309, 312, + 314, 317, 319, 322, 325, 327, 330, 332, + 335, 337, 344, 351, 357, 363, 369, 375, + 378, 382, 389, 396, 403, 405, 408, 411, + 413, 415, 428, 442, 447, 449, 452, 459, + 461, 464, 469, 473 +}; + +static const char _tsip_machine_parser_header_Record_Route_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 5, 5, 1, 6, + 6, 1, 7, 1, 8, 8, 1, 9, + 9, 1, 10, 10, 1, 11, 11, 1, + 12, 12, 1, 12, 12, 13, 1, 14, + 15, 14, 16, 17, 16, 16, 18, 16, + 16, 16, 16, 16, 16, 1, 19, 1, + 20, 20, 1, 21, 22, 21, 16, 17, + 16, 16, 18, 16, 16, 16, 16, 16, + 16, 1, 23, 1, 24, 24, 1, 24, + 24, 25, 1, 26, 26, 1, 27, 27, + 28, 29, 28, 28, 28, 28, 1, 27, + 27, 29, 1, 30, 31, 30, 32, 33, + 32, 34, 35, 1, 36, 1, 35, 37, + 35, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 1, 39, 1, 40, 40, 1, + 40, 40, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 1, 41, 42, 41, 43, + 43, 43, 44, 45, 46, 43, 43, 43, + 43, 43, 1, 47, 48, 47, 13, 35, + 46, 1, 49, 1, 50, 50, 1, 50, + 50, 13, 35, 46, 1, 46, 51, 46, + 52, 53, 52, 52, 54, 52, 52, 52, + 52, 52, 52, 1, 55, 1, 56, 56, + 1, 56, 57, 56, 52, 53, 52, 52, + 54, 52, 52, 52, 52, 52, 52, 1, + 58, 1, 59, 59, 1, 59, 59, 53, + 1, 60, 61, 62, 1, 1, 1, 53, + 63, 1, 53, 53, 1, 64, 42, 64, + 44, 45, 1, 65, 66, 65, 13, 35, + 1, 67, 1, 68, 68, 1, 68, 68, + 13, 35, 1, 53, 53, 53, 1, 64, + 42, 64, 52, 52, 52, 44, 45, 52, + 52, 52, 52, 52, 1, 70, 69, 69, + 69, 1, 72, 61, 71, 71, 71, 1, + 72, 61, 73, 73, 73, 1, 72, 61, + 74, 74, 74, 1, 72, 61, 1, 76, + 75, 69, 69, 1, 77, 72, 61, 78, + 71, 71, 1, 79, 1, 80, 81, 1, + 82, 1, 83, 84, 1, 85, 1, 61, + 86, 1, 61, 87, 1, 61, 1, 83, + 88, 1, 83, 1, 80, 89, 1, 80, + 1, 77, 72, 61, 90, 73, 73, 1, + 77, 72, 61, 74, 74, 74, 1, 92, + 61, 91, 91, 91, 1, 94, 61, 93, + 93, 93, 1, 94, 61, 95, 95, 95, + 1, 94, 61, 96, 96, 96, 1, 94, + 61, 1, 97, 91, 91, 1, 77, 94, + 61, 98, 93, 93, 1, 77, 94, 61, + 99, 95, 95, 1, 77, 94, 61, 96, + 96, 96, 1, 100, 1, 77, 101, 1, + 77, 102, 1, 77, 1, 76, 1, 103, + 104, 103, 105, 105, 105, 105, 105, 105, + 105, 105, 105, 1, 106, 107, 106, 105, + 105, 105, 108, 105, 105, 105, 105, 105, + 105, 1, 109, 110, 109, 25, 1, 111, + 1, 103, 103, 1, 113, 114, 115, 1, + 1, 1, 112, 116, 1, 112, 112, 1, + 106, 107, 106, 108, 1, 112, 112, 112, + 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Record_Route_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 14, 15, + 89, 94, 21, 16, 17, 17, 18, 19, + 20, 21, 22, 23, 22, 24, 25, 26, + 26, 27, 14, 28, 99, 29, 32, 30, + 31, 33, 27, 32, 14, 28, 37, 33, + 34, 35, 36, 38, 53, 44, 54, 39, + 40, 41, 42, 43, 45, 47, 52, 46, + 48, 48, 49, 50, 51, 55, 88, 56, + 59, 57, 58, 60, 75, 61, 73, 62, + 63, 71, 64, 65, 69, 66, 67, 68, + 70, 72, 74, 76, 84, 77, 80, 78, + 79, 81, 82, 83, 85, 86, 87, 90, + 92, 89, 91, 18, 21, 91, 18, 93, + 94, 95, 97, 98, 96 +}; + +static const char _tsip_machine_parser_header_Record_Route_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 3, 3, + 15, 15, 3, 0, 0, 3, 3, 0, + 0, 0, 1, 0, 0, 0, 0, 7, + 11, 11, 11, 0, 13, 0, 1, 0, + 0, 18, 18, 0, 18, 9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 18, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 5, 5, 0, 0, 0, + 0, 0, 0, 0, 0 +}; + +static const int tsip_machine_parser_header_Record_Route_start = 1; +static const int tsip_machine_parser_header_Record_Route_first_final = 99; +static const int tsip_machine_parser_header_Record_Route_error = 0; + +static const int tsip_machine_parser_header_Record_Route_en_main = 1; + + +/* #line 145 "./ragel/tsip_parser_header_Record_Route.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Record_Route_first_final); + (void)(tsip_machine_parser_header_Record_Route_error); + (void)(tsip_machine_parser_header_Record_Route_en_main); + +/* #line 339 "./src/headers/tsip_header_Record_Route.c" */ + { + cs = tsip_machine_parser_header_Record_Route_start; + } + +/* #line 150 "./ragel/tsip_parser_header_Record_Route.rl" */ + +/* #line 346 "./src/headers/tsip_header_Record_Route.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Record_Route_trans_keys + _tsip_machine_parser_header_Record_Route_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Record_Route_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Record_Route_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Record_Route_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Record_Route_indicies[_trans]; + cs = _tsip_machine_parser_header_Record_Route_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Record_Route_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Record_Route_actions + _tsip_machine_parser_header_Record_Route_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 51 "./ragel/tsip_parser_header_Record_Route.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 55 "./ragel/tsip_parser_header_Record_Route.rl" */ + { + if(!curr_route){ + curr_route = tsip_header_Record_Route_create_null(); + } + } + break; + case 2: +/* #line 61 "./ragel/tsip_parser_header_Record_Route.rl" */ + { + if(curr_route){ + TSK_PARSER_SET_STRING(curr_route->display_name); + tsk_strunquote(&curr_route->display_name); + } + } + break; + case 3: +/* #line 68 "./ragel/tsip_parser_header_Record_Route.rl" */ + { + if(curr_route && !curr_route->uri){ + int len = (int)(p - tag_start); + if(curr_route && !curr_route->uri){ + if((curr_route->uri = tsip_uri_parse(tag_start, (tsk_size_t)len)) && curr_route->display_name){ + curr_route->uri->display_name = tsk_strdup(curr_route->display_name); + } + } + } + } + break; + case 4: +/* #line 79 "./ragel/tsip_parser_header_Record_Route.rl" */ + { + if(curr_route){ + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(curr_route)); + } + } + break; + case 5: +/* #line 85 "./ragel/tsip_parser_header_Record_Route.rl" */ + { + if(curr_route){ + tsk_list_push_back_data(hdr_record_routes, ((void**) &curr_route)); + } + } + break; + case 6: +/* #line 91 "./ragel/tsip_parser_header_Record_Route.rl" */ + { + } + break; +/* #line 477 "./src/headers/tsip_header_Record_Route.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 151 "./ragel/tsip_parser_header_Record_Route.rl" */ + + if( cs < +/* #line 493 "./src/headers/tsip_header_Record_Route.c" */ +99 +/* #line 152 "./ragel/tsip_parser_header_Record_Route.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Record-Route' header."); + TSK_OBJECT_SAFE_FREE(curr_route); + TSK_OBJECT_SAFE_FREE(hdr_record_routes); + } + + return hdr_record_routes; +} + + + + + + + +//======================================================== +// Record_Route header object definition +// + +static tsk_object_t* tsip_header_Record_Route_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Record_Route_t *Record_Route = self; + if(Record_Route){ + const tsip_uri_t* uri = va_arg(*app, const tsip_uri_t *); + + if(uri){ + Record_Route->uri = tsk_object_ref((void*)uri); + } + TSIP_HEADER(Record_Route)->type = tsip_htype_Record_Route; + TSIP_HEADER(Record_Route)->serialize = tsip_header_Record_Route_serialize; + } + else{ + TSK_DEBUG_ERROR("Failed to create new Record_Route header."); + } + return self; +} + +static tsk_object_t* tsip_header_Record_Route_dtor(tsk_object_t *self) +{ + tsip_header_Record_Route_t *Record_Route = self; + if(Record_Route){ + TSK_FREE(Record_Route->display_name); + TSK_OBJECT_SAFE_FREE(Record_Route->uri); + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Record_Route)); + } + else{ + TSK_DEBUG_ERROR("Null Record_Route header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Record_Route_def_s = +{ + sizeof(tsip_header_Record_Route_t), + tsip_header_Record_Route_ctor, + tsip_header_Record_Route_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Record_Route_def_t = &tsip_header_Record_Route_def_s; diff --git a/tinySIP/src/headers/tsip_header_Refer_Sub.c b/tinySIP/src/headers/tsip_header_Refer_Sub.c new file mode 100644 index 0000000..10628c3 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Refer_Sub.c @@ -0,0 +1,471 @@ + +/* #line 1 "./ragel/tsip_parser_header_Refer_Sub.rl" */ + +/* +* 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 tsip_header_Refer_Sub.c + * @brief SIP header 'Refer-Sub' as per 4488. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Refer_Sub.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + +#include <string.h> + +/*********************************** +* Ragel state machine. +*/ + +/* #line 73 "./ragel/tsip_parser_header_Refer_Sub.rl" */ + + +tsip_header_Refer_Sub_t* tsip_header_Refer_Sub_create(tsk_bool_t sub) +{ + return tsk_object_new(TSIP_HEADER_REFER_SUB_VA_ARGS(sub)); +} + +tsip_header_Refer_Sub_t* tsip_header_Refer_Sub_create_null() +{ + return tsip_header_Refer_Sub_create(tsk_true); +} + +int tsip_header_Refer_Sub_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Refer_Sub_t *Refer_Sub = (const tsip_header_Refer_Sub_t *)header; + return tsk_buffer_append(output, Refer_Sub->sub ? "true" : "false", Refer_Sub->sub ? 4 : 5); + } + + return -1; +} + +tsip_header_Refer_Sub_t *tsip_header_Refer_Sub_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Refer_Sub_t *hdr_rsub = tsip_header_Refer_Sub_create_null(); + + const char *tag_start = tsk_null; + + +/* #line 81 "./src/headers/tsip_header_Refer_Sub.c" */ +static const char _tsip_machine_parser_header_Refer_Sub_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3, 1, 4 +}; + +static const short _tsip_machine_parser_header_Refer_Sub_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 11, + 13, 15, 17, 20, 27, 28, 30, 36, + 38, 40, 42, 44, 48, 52, 53, 55, + 58, 75, 76, 78, 94, 113, 118, 119, + 121, 125, 144, 145, 147, 166, 167, 169, + 172, 180, 181, 183, 187, 188, 194, 212, + 219, 227, 235, 243, 245, 252, 261, 263, + 266, 268, 271, 273, 276, 279, 280, 283, + 284, 287, 288, 297, 306, 314, 322, 330, + 338, 340, 346, 355, 364, 373, 375, 378, + 381, 382, 383, 385, 387, 389, 393 +}; + +static const char _tsip_machine_parser_header_Refer_Sub_trans_keys[] = { + 82, 114, 69, 101, 70, 102, 69, 101, + 82, 114, 45, 83, 115, 85, 117, 66, + 98, 9, 32, 58, 9, 13, 32, 70, + 84, 102, 116, 10, 9, 32, 9, 32, + 70, 84, 102, 116, 65, 97, 76, 108, + 83, 115, 69, 101, 9, 13, 32, 59, + 9, 13, 32, 59, 10, 9, 32, 9, + 32, 59, 9, 13, 32, 33, 37, 39, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 10, 9, 32, 9, 32, + 33, 37, 39, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 59, 61, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 59, 61, 10, 9, + 32, 9, 32, 59, 61, 9, 13, 32, + 33, 34, 37, 39, 91, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 10, 9, 32, 9, 13, 32, 33, 34, + 37, 39, 91, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 10, 9, + 32, 9, 32, 34, 13, 34, 92, 127, + 0, 8, 10, 31, 10, 9, 32, 9, + 13, 32, 59, 10, 0, 9, 11, 12, + 14, 127, 9, 13, 32, 33, 37, 39, + 59, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 58, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 58, 48, 57, + 65, 70, 97, 102, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 48, 57, 46, + 48, 57, 48, 57, 46, 48, 57, 48, + 57, 93, 48, 57, 93, 48, 57, 93, + 46, 48, 57, 46, 46, 48, 57, 46, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 46, 58, 93, 48, 57, 65, 70, + 97, 102, 58, 93, 48, 57, 65, 70, + 97, 102, 58, 93, 48, 57, 65, 70, + 97, 102, 58, 93, 48, 57, 65, 70, + 97, 102, 58, 93, 48, 57, 65, 70, + 97, 102, 58, 93, 48, 57, 65, 70, + 97, 102, 46, 58, 93, 48, 57, 65, + 70, 97, 102, 46, 58, 93, 48, 57, + 65, 70, 97, 102, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 48, 57, 46, + 48, 57, 46, 48, 57, 46, 58, 82, + 114, 85, 117, 69, 101, 9, 13, 32, + 59, 0 +}; + +static const char _tsip_machine_parser_header_Refer_Sub_single_lengths[] = { + 0, 2, 2, 2, 2, 2, 1, 2, + 2, 2, 3, 7, 1, 2, 6, 2, + 2, 2, 2, 4, 4, 1, 2, 3, + 7, 1, 2, 6, 9, 5, 1, 2, + 4, 9, 1, 2, 9, 1, 2, 3, + 4, 1, 2, 4, 1, 0, 8, 1, + 2, 2, 2, 2, 1, 3, 0, 1, + 0, 1, 0, 1, 1, 1, 1, 1, + 1, 1, 3, 3, 2, 2, 2, 2, + 2, 0, 3, 3, 3, 0, 1, 1, + 1, 1, 2, 2, 2, 4, 0 +}; + +static const char _tsip_machine_parser_header_Refer_Sub_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 5, 0, 0, 5, 5, 0, 0, 0, + 0, 5, 0, 0, 5, 0, 0, 0, + 2, 0, 0, 0, 0, 3, 5, 3, + 3, 3, 3, 0, 3, 3, 1, 1, + 1, 1, 1, 1, 1, 0, 1, 0, + 1, 0, 3, 3, 3, 3, 3, 3, + 0, 3, 3, 3, 3, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0 +}; + +static const short _tsip_machine_parser_header_Refer_Sub_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 15, 17, + 20, 23, 26, 30, 38, 40, 43, 50, + 53, 56, 59, 62, 67, 72, 74, 77, + 81, 94, 96, 99, 111, 126, 132, 134, + 137, 142, 157, 159, 162, 177, 179, 182, + 186, 193, 195, 198, 203, 205, 209, 223, + 228, 234, 240, 246, 249, 254, 261, 263, + 266, 268, 271, 273, 276, 279, 281, 284, + 286, 289, 291, 298, 305, 311, 317, 323, + 329, 332, 336, 343, 350, 357, 359, 362, + 365, 367, 369, 372, 375, 378, 383 +}; + +static const char _tsip_machine_parser_header_Refer_Sub_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 5, 5, 1, 6, + 1, 7, 7, 1, 8, 8, 1, 9, + 9, 1, 9, 9, 10, 1, 10, 11, + 10, 12, 13, 12, 13, 1, 14, 1, + 15, 15, 1, 15, 15, 12, 13, 12, + 13, 1, 16, 16, 1, 17, 17, 1, + 18, 18, 1, 19, 19, 1, 20, 21, + 20, 22, 1, 23, 24, 23, 25, 1, + 26, 1, 27, 27, 1, 27, 27, 25, + 1, 25, 28, 25, 29, 29, 29, 29, + 29, 29, 29, 29, 29, 1, 30, 1, + 31, 31, 1, 31, 31, 29, 29, 29, + 29, 29, 29, 29, 29, 29, 1, 32, + 33, 32, 34, 34, 34, 35, 36, 34, + 34, 34, 34, 34, 34, 1, 37, 38, + 37, 25, 36, 1, 39, 1, 40, 40, + 1, 40, 40, 25, 36, 1, 36, 41, + 36, 42, 43, 42, 42, 44, 42, 42, + 42, 42, 42, 42, 1, 45, 1, 46, + 46, 1, 46, 47, 46, 42, 43, 42, + 42, 44, 42, 42, 42, 42, 42, 42, + 1, 48, 1, 49, 49, 1, 49, 49, + 43, 1, 50, 51, 52, 1, 1, 1, + 43, 53, 1, 43, 43, 1, 54, 33, + 54, 35, 1, 55, 1, 43, 43, 43, + 1, 54, 33, 54, 42, 42, 42, 35, + 42, 42, 42, 42, 42, 42, 1, 57, + 56, 56, 56, 1, 59, 51, 58, 58, + 58, 1, 59, 51, 60, 60, 60, 1, + 59, 51, 61, 61, 61, 1, 59, 51, + 1, 63, 62, 56, 56, 1, 64, 59, + 51, 65, 58, 58, 1, 66, 1, 67, + 68, 1, 69, 1, 70, 71, 1, 72, + 1, 51, 73, 1, 51, 74, 1, 51, + 1, 70, 75, 1, 70, 1, 67, 76, + 1, 67, 1, 64, 59, 51, 77, 60, + 60, 1, 64, 59, 51, 61, 61, 61, + 1, 79, 51, 78, 78, 78, 1, 81, + 51, 80, 80, 80, 1, 81, 51, 82, + 82, 82, 1, 81, 51, 83, 83, 83, + 1, 81, 51, 1, 84, 78, 78, 1, + 64, 81, 51, 85, 80, 80, 1, 64, + 81, 51, 86, 82, 82, 1, 64, 81, + 51, 83, 83, 83, 1, 87, 1, 64, + 88, 1, 64, 89, 1, 64, 1, 63, + 1, 90, 90, 1, 91, 91, 1, 92, + 92, 1, 93, 94, 93, 95, 1, 1, + 0 +}; + +static const char _tsip_machine_parser_header_Refer_Sub_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 15, 82, 13, 14, + 16, 17, 18, 19, 20, 44, 24, 20, + 21, 24, 22, 23, 25, 28, 26, 27, + 29, 44, 28, 24, 33, 29, 30, 31, + 32, 34, 46, 40, 47, 35, 36, 37, + 38, 39, 41, 43, 45, 42, 20, 86, + 48, 81, 49, 52, 50, 51, 53, 68, + 54, 66, 55, 56, 64, 57, 58, 62, + 59, 60, 61, 63, 65, 67, 69, 77, + 70, 73, 71, 72, 74, 75, 76, 78, + 79, 80, 83, 84, 85, 20, 44, 24 +}; + +static const char _tsip_machine_parser_header_Refer_Sub_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 1, 0, 0, + 0, 0, 0, 0, 5, 5, 5, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 7, 7, 0, 7, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 7, 9, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 3, 3, 3 +}; + +static const int tsip_machine_parser_header_Refer_Sub_start = 1; +static const int tsip_machine_parser_header_Refer_Sub_first_final = 86; +static const int tsip_machine_parser_header_Refer_Sub_error = 0; + +static const int tsip_machine_parser_header_Refer_Sub_en_main = 1; + + +/* #line 106 "./ragel/tsip_parser_header_Refer_Sub.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Refer_Sub_first_final); + (void)(tsip_machine_parser_header_Refer_Sub_error); + (void)(tsip_machine_parser_header_Refer_Sub_en_main); + +/* #line 291 "./src/headers/tsip_header_Refer_Sub.c" */ + { + cs = tsip_machine_parser_header_Refer_Sub_start; + } + +/* #line 111 "./ragel/tsip_parser_header_Refer_Sub.rl" */ + +/* #line 298 "./src/headers/tsip_header_Refer_Sub.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Refer_Sub_trans_keys + _tsip_machine_parser_header_Refer_Sub_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Refer_Sub_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Refer_Sub_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Refer_Sub_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Refer_Sub_indicies[_trans]; + cs = _tsip_machine_parser_header_Refer_Sub_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Refer_Sub_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Refer_Sub_actions + _tsip_machine_parser_header_Refer_Sub_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 49 "./ragel/tsip_parser_header_Refer_Sub.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 53 "./ragel/tsip_parser_header_Refer_Sub.rl" */ + { + hdr_rsub->sub = tsk_true; + } + break; + case 2: +/* #line 56 "./ragel/tsip_parser_header_Refer_Sub.rl" */ + { + hdr_rsub->sub = tsk_false; + } + break; + case 3: +/* #line 59 "./ragel/tsip_parser_header_Refer_Sub.rl" */ + { + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(hdr_rsub)); + } + break; + case 4: +/* #line 63 "./ragel/tsip_parser_header_Refer_Sub.rl" */ + { + } + break; +/* #line 401 "./src/headers/tsip_header_Refer_Sub.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 112 "./ragel/tsip_parser_header_Refer_Sub.rl" */ + + if( cs < +/* #line 417 "./src/headers/tsip_header_Refer_Sub.c" */ +86 +/* #line 113 "./ragel/tsip_parser_header_Refer_Sub.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Refer-Sub' header."); + TSK_OBJECT_SAFE_FREE(hdr_rsub); + } + + return hdr_rsub; +} + + + + + + + +//======================================================== +// Refer_Sub header object definition +// + +static tsk_object_t* tsip_header_Refer_Sub_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Refer_Sub_t *Refer_Sub = self; + if(Refer_Sub){ + TSIP_HEADER(Refer_Sub)->type = tsip_htype_Refer_Sub; + TSIP_HEADER(Refer_Sub)->serialize = tsip_header_Refer_Sub_serialize; + Refer_Sub->sub = va_arg(*app, tsk_bool_t); + } + else{ + TSK_DEBUG_ERROR("Failed to create new Refer_Sub header."); + } + return self; +} + +static tsk_object_t* tsip_header_Refer_Sub_dtor(tsk_object_t *self) +{ + tsip_header_Refer_Sub_t *Refer_Sub = self; + if(Refer_Sub){ + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Refer_Sub)); + } + else{ + TSK_DEBUG_ERROR("Null Refer_Sub header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Refer_Sub_def_s = +{ + sizeof(tsip_header_Refer_Sub_t), + tsip_header_Refer_Sub_ctor, + tsip_header_Refer_Sub_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Refer_Sub_def_t = &tsip_header_Refer_Sub_def_s; diff --git a/tinySIP/src/headers/tsip_header_Refer_To.c b/tinySIP/src/headers/tsip_header_Refer_To.c new file mode 100644 index 0000000..1e3d259 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Refer_To.c @@ -0,0 +1,837 @@ + +/* #line 1 "./ragel/tsip_parser_header_Refer_To.rl" */ + +/* +* 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 tsip_header_Refer_To.c + * @brief SIP Refer-To header as per RFC 3515. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Refer_To.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 89 "./ragel/tsip_parser_header_Refer_To.rl" */ + + + +tsip_header_Refer_To_t* tsip_header_Refer_To_create(const tsip_uri_t* uri) +{ + return tsk_object_new(TSIP_HEADER_REFER_TO_VA_ARGS(uri)); +} + +tsip_header_Refer_To_t* tsip_header_Refer_To_create_null() +{ + return tsip_header_Refer_To_create(tsk_null); +} + +int tsip_header_Refer_To_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + int ret; + const tsip_header_Refer_To_t *Refer_To = (const tsip_header_Refer_To_t *)header; + + /* Uri with hacked display-name*/ + if((ret = tsip_uri_serialize(Refer_To->uri, tsk_true, tsk_true, output))){ + return ret; + } + return ret; + } + return -1; +} + +tsip_header_Refer_To_t *tsip_header_Refer_To_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Refer_To_t *r_to = tsip_header_Refer_To_create_null(); + + const char *tag_start = tsk_null; + + +/* #line 87 "./src/headers/tsip_header_Refer_To.c" */ +static const char _tsip_machine_parser_header_Refer_To_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3, 1, 4, 2, 1, 3 +}; + +static const short _tsip_machine_parser_header_Refer_To_key_offsets[] = { + 0, 0, 2, 7, 10, 31, 32, 34, + 55, 56, 58, 61, 65, 77, 80, 80, + 81, 85, 86, 103, 104, 106, 122, 141, + 146, 147, 149, 153, 172, 173, 175, 194, + 195, 197, 200, 208, 209, 211, 215, 219, + 220, 222, 225, 231, 249, 256, 264, 272, + 280, 282, 289, 298, 300, 303, 305, 308, + 310, 313, 316, 317, 320, 321, 324, 325, + 334, 343, 351, 359, 367, 375, 377, 383, + 392, 401, 410, 412, 415, 418, 419, 420, + 437, 455, 459, 460, 462, 470, 471, 473, + 477, 483, 495, 498, 498, 502, 520, 539, + 544, 564, 582, 591, 595, 618, 642, 652, + 676, 699, 707, 716, 732, 749, 766, 783, + 794, 810, 828, 839, 851, 862, 874, 885, + 897, 909, 919, 931, 941, 953, 963, 981, + 999, 1016, 1033, 1050, 1067, 1078, 1093, 1111, + 1129, 1147, 1158, 1170, 1182, 1192, 1202, 1213, + 1225, 1237, 1249, 1255, 1266, 1279, 1285, 1292, + 1298, 1305, 1311, 1318, 1325, 1330, 1337, 1342, + 1349, 1354, 1367, 1380, 1392, 1404, 1416, 1428, + 1434, 1444, 1457, 1470, 1483, 1489, 1496, 1503, + 1508, 1513, 1515, 1517, 1519, 1520, 1522, 1524 +}; + +static const char _tsip_machine_parser_header_Refer_To_trans_keys[] = { + 82, 114, 9, 32, 58, 69, 101, 9, + 32, 58, 9, 13, 32, 33, 34, 37, + 39, 60, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 10, + 9, 32, 9, 13, 32, 33, 34, 37, + 39, 60, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 10, + 9, 32, 9, 32, 60, 65, 90, 97, + 122, 9, 32, 43, 58, 45, 46, 48, + 57, 65, 90, 97, 122, 9, 32, 58, + 62, 9, 13, 32, 59, 10, 9, 13, + 32, 33, 37, 39, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 10, + 9, 32, 9, 32, 33, 37, 39, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 59, 61, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 59, 61, 10, 9, 32, 9, 32, 59, + 61, 9, 13, 32, 33, 34, 37, 39, + 91, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 10, 9, 32, 9, + 13, 32, 33, 34, 37, 39, 91, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 10, 9, 32, 9, 32, 34, + 13, 34, 92, 127, 0, 8, 10, 31, + 10, 9, 32, 9, 13, 32, 59, 9, + 13, 32, 59, 10, 9, 32, 9, 32, + 59, 0, 9, 11, 12, 14, 127, 9, + 13, 32, 33, 37, 39, 59, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 58, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 58, 48, 57, 65, 70, 97, + 102, 46, 58, 93, 48, 57, 65, 70, + 97, 102, 48, 57, 46, 48, 57, 48, + 57, 46, 48, 57, 48, 57, 93, 48, + 57, 93, 48, 57, 93, 46, 48, 57, + 46, 46, 48, 57, 46, 46, 58, 93, + 48, 57, 65, 70, 97, 102, 46, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 46, + 58, 93, 48, 57, 65, 70, 97, 102, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 46, 58, 93, 48, 57, 65, 70, + 97, 102, 48, 57, 46, 48, 57, 46, + 48, 57, 46, 58, 9, 13, 32, 33, + 37, 39, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 60, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 60, 10, 9, 32, 13, 34, + 92, 127, 0, 8, 10, 31, 10, 9, + 32, 9, 13, 32, 60, 0, 9, 11, + 12, 14, 127, 9, 32, 43, 58, 45, + 46, 48, 57, 65, 90, 97, 122, 9, + 32, 58, 9, 13, 32, 59, 9, 13, + 32, 33, 37, 39, 59, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 33, 37, 39, 59, 61, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 59, 61, + 9, 13, 32, 33, 34, 37, 39, 59, + 91, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 59, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 34, 59, 92, 127, 0, 31, 9, + 13, 32, 59, 9, 13, 32, 33, 34, + 37, 39, 59, 92, 126, 127, 0, 31, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 34, 37, + 39, 59, 61, 92, 126, 127, 0, 31, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 34, 59, 61, + 92, 127, 0, 31, 9, 13, 32, 33, + 34, 37, 39, 59, 91, 92, 126, 127, + 0, 31, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 34, 37, 39, 59, 92, 126, 127, 0, + 31, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 59, 0, + 8, 11, 127, 9, 13, 32, 34, 59, + 92, 127, 0, 31, 9, 13, 32, 34, + 58, 59, 92, 127, 0, 31, 48, 57, + 65, 70, 97, 102, 9, 13, 32, 34, + 58, 59, 92, 93, 127, 0, 31, 48, + 57, 65, 70, 97, 102, 9, 13, 32, + 34, 58, 59, 92, 93, 127, 0, 31, + 48, 57, 65, 70, 97, 102, 9, 13, + 32, 34, 58, 59, 92, 93, 127, 0, + 31, 48, 57, 65, 70, 97, 102, 9, + 13, 32, 34, 58, 59, 92, 93, 127, + 0, 31, 9, 13, 32, 34, 58, 59, + 92, 127, 0, 31, 48, 57, 65, 70, + 97, 102, 9, 13, 32, 34, 46, 58, + 59, 92, 93, 127, 0, 31, 48, 57, + 65, 70, 97, 102, 9, 13, 32, 34, + 59, 92, 127, 0, 31, 48, 57, 9, + 13, 32, 34, 46, 59, 92, 127, 0, + 31, 48, 57, 9, 13, 32, 34, 59, + 92, 127, 0, 31, 48, 57, 9, 13, + 32, 34, 46, 59, 92, 127, 0, 31, + 48, 57, 9, 13, 32, 34, 59, 92, + 127, 0, 31, 48, 57, 9, 13, 32, + 34, 59, 92, 93, 127, 0, 31, 48, + 57, 9, 13, 32, 34, 59, 92, 93, + 127, 0, 31, 48, 57, 9, 13, 32, + 34, 59, 92, 93, 127, 0, 31, 9, + 13, 32, 34, 46, 59, 92, 127, 0, + 31, 48, 57, 9, 13, 32, 34, 46, + 59, 92, 127, 0, 31, 9, 13, 32, + 34, 46, 59, 92, 127, 0, 31, 48, + 57, 9, 13, 32, 34, 46, 59, 92, + 127, 0, 31, 9, 13, 32, 34, 46, + 58, 59, 92, 93, 127, 0, 31, 48, + 57, 65, 70, 97, 102, 9, 13, 32, + 34, 46, 58, 59, 92, 93, 127, 0, + 31, 48, 57, 65, 70, 97, 102, 9, + 13, 32, 34, 58, 59, 92, 93, 127, + 0, 31, 48, 57, 65, 70, 97, 102, + 9, 13, 32, 34, 58, 59, 92, 93, + 127, 0, 31, 48, 57, 65, 70, 97, + 102, 9, 13, 32, 34, 58, 59, 92, + 93, 127, 0, 31, 48, 57, 65, 70, + 97, 102, 9, 13, 32, 34, 58, 59, + 92, 93, 127, 0, 31, 48, 57, 65, + 70, 97, 102, 9, 13, 32, 34, 58, + 59, 92, 93, 127, 0, 31, 9, 13, + 32, 34, 59, 92, 127, 0, 31, 48, + 57, 65, 70, 97, 102, 9, 13, 32, + 34, 46, 58, 59, 92, 93, 127, 0, + 31, 48, 57, 65, 70, 97, 102, 9, + 13, 32, 34, 46, 58, 59, 92, 93, + 127, 0, 31, 48, 57, 65, 70, 97, + 102, 9, 13, 32, 34, 46, 58, 59, + 92, 93, 127, 0, 31, 48, 57, 65, + 70, 97, 102, 9, 13, 32, 34, 59, + 92, 127, 0, 31, 48, 57, 9, 13, + 32, 34, 46, 59, 92, 127, 0, 31, + 48, 57, 9, 13, 32, 34, 46, 59, + 92, 127, 0, 31, 48, 57, 9, 13, + 32, 34, 46, 59, 92, 127, 0, 31, + 9, 13, 32, 34, 58, 59, 92, 127, + 0, 31, 9, 13, 32, 58, 59, 48, + 57, 65, 70, 97, 102, 9, 13, 32, + 58, 59, 93, 48, 57, 65, 70, 97, + 102, 9, 13, 32, 58, 59, 93, 48, + 57, 65, 70, 97, 102, 9, 13, 32, + 58, 59, 93, 48, 57, 65, 70, 97, + 102, 9, 13, 32, 58, 59, 93, 9, + 13, 32, 58, 59, 48, 57, 65, 70, + 97, 102, 9, 13, 32, 46, 58, 59, + 93, 48, 57, 65, 70, 97, 102, 9, + 13, 32, 59, 48, 57, 9, 13, 32, + 46, 59, 48, 57, 9, 13, 32, 59, + 48, 57, 9, 13, 32, 46, 59, 48, + 57, 9, 13, 32, 59, 48, 57, 9, + 13, 32, 59, 93, 48, 57, 9, 13, + 32, 59, 93, 48, 57, 9, 13, 32, + 59, 93, 9, 13, 32, 46, 59, 48, + 57, 9, 13, 32, 46, 59, 9, 13, + 32, 46, 59, 48, 57, 9, 13, 32, + 46, 59, 9, 13, 32, 46, 58, 59, + 93, 48, 57, 65, 70, 97, 102, 9, + 13, 32, 46, 58, 59, 93, 48, 57, + 65, 70, 97, 102, 9, 13, 32, 58, + 59, 93, 48, 57, 65, 70, 97, 102, + 9, 13, 32, 58, 59, 93, 48, 57, + 65, 70, 97, 102, 9, 13, 32, 58, + 59, 93, 48, 57, 65, 70, 97, 102, + 9, 13, 32, 58, 59, 93, 48, 57, + 65, 70, 97, 102, 9, 13, 32, 58, + 59, 93, 9, 13, 32, 59, 48, 57, + 65, 70, 97, 102, 9, 13, 32, 46, + 58, 59, 93, 48, 57, 65, 70, 97, + 102, 9, 13, 32, 46, 58, 59, 93, + 48, 57, 65, 70, 97, 102, 9, 13, + 32, 46, 58, 59, 93, 48, 57, 65, + 70, 97, 102, 9, 13, 32, 59, 48, + 57, 9, 13, 32, 46, 59, 48, 57, + 9, 13, 32, 46, 59, 48, 57, 9, + 13, 32, 46, 59, 9, 13, 32, 58, + 59, 70, 102, 69, 101, 82, 114, 45, + 84, 116, 79, 111, 0 +}; + +static const char _tsip_machine_parser_header_Refer_To_single_lengths[] = { + 0, 2, 5, 3, 9, 1, 2, 9, + 1, 2, 3, 0, 4, 3, 0, 1, + 4, 1, 7, 1, 2, 6, 9, 5, + 1, 2, 4, 9, 1, 2, 9, 1, + 2, 3, 4, 1, 2, 4, 4, 1, + 2, 3, 0, 8, 1, 2, 2, 2, + 2, 1, 3, 0, 1, 0, 1, 0, + 1, 1, 1, 1, 1, 1, 1, 3, + 3, 2, 2, 2, 2, 2, 0, 3, + 3, 3, 0, 1, 1, 1, 1, 7, + 8, 4, 1, 2, 4, 1, 2, 4, + 0, 4, 3, 0, 4, 8, 9, 5, + 10, 8, 7, 4, 11, 12, 8, 12, + 11, 4, 7, 8, 9, 9, 9, 9, + 8, 10, 7, 8, 7, 8, 7, 8, + 8, 8, 8, 8, 8, 8, 10, 10, + 9, 9, 9, 9, 9, 7, 10, 10, + 10, 7, 8, 8, 8, 8, 5, 6, + 6, 6, 6, 5, 7, 4, 5, 4, + 5, 4, 5, 5, 5, 5, 5, 5, + 5, 7, 7, 6, 6, 6, 6, 6, + 4, 7, 7, 7, 4, 5, 5, 5, + 5, 2, 2, 2, 1, 2, 2, 0 +}; + +static const char _tsip_machine_parser_header_Refer_To_range_lengths[] = { + 0, 0, 0, 0, 6, 0, 0, 6, + 0, 0, 0, 2, 4, 0, 0, 0, + 0, 0, 5, 0, 0, 5, 5, 0, + 0, 0, 0, 5, 0, 0, 5, 0, + 0, 0, 2, 0, 0, 0, 0, 0, + 0, 0, 3, 5, 3, 3, 3, 3, + 0, 3, 3, 1, 1, 1, 1, 1, + 1, 1, 0, 1, 0, 1, 0, 3, + 3, 3, 3, 3, 3, 0, 3, 3, + 3, 3, 1, 1, 1, 0, 0, 5, + 5, 0, 0, 0, 2, 0, 0, 0, + 3, 4, 0, 0, 0, 5, 5, 0, + 5, 5, 1, 0, 6, 6, 1, 6, + 6, 2, 1, 4, 4, 4, 4, 1, + 4, 4, 2, 2, 2, 2, 2, 2, + 2, 1, 2, 1, 2, 1, 4, 4, + 4, 4, 4, 4, 1, 4, 4, 4, + 4, 2, 2, 2, 1, 1, 3, 3, + 3, 3, 0, 3, 3, 1, 1, 1, + 1, 1, 1, 1, 0, 1, 0, 1, + 0, 3, 3, 3, 3, 3, 3, 0, + 3, 3, 3, 3, 1, 1, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static const short _tsip_machine_parser_header_Refer_To_index_offsets[] = { + 0, 0, 3, 9, 13, 29, 31, 34, + 50, 52, 55, 59, 62, 71, 75, 76, + 78, 83, 85, 98, 100, 103, 115, 130, + 136, 138, 141, 146, 161, 163, 166, 181, + 183, 186, 190, 197, 199, 202, 207, 212, + 214, 217, 221, 225, 239, 244, 250, 256, + 262, 265, 270, 277, 279, 282, 284, 287, + 289, 292, 295, 297, 300, 302, 305, 307, + 314, 321, 327, 333, 339, 345, 348, 352, + 359, 366, 373, 375, 378, 381, 383, 385, + 398, 412, 417, 419, 422, 429, 431, 434, + 439, 443, 452, 456, 457, 462, 476, 491, + 497, 513, 527, 536, 541, 559, 578, 588, + 607, 625, 632, 641, 654, 668, 682, 696, + 707, 720, 735, 745, 756, 766, 777, 787, + 798, 809, 819, 830, 840, 851, 861, 876, + 891, 905, 919, 933, 947, 958, 970, 985, + 1000, 1015, 1025, 1036, 1047, 1057, 1067, 1076, + 1086, 1096, 1106, 1113, 1122, 1133, 1139, 1146, + 1152, 1159, 1165, 1172, 1179, 1185, 1192, 1198, + 1205, 1211, 1222, 1233, 1243, 1253, 1263, 1273, + 1280, 1288, 1299, 1310, 1321, 1327, 1334, 1341, + 1347, 1353, 1356, 1359, 1362, 1364, 1367, 1370 +}; + +static const unsigned char _tsip_machine_parser_header_Refer_To_indicies[] = { + 0, 0, 1, 2, 2, 3, 4, 4, + 1, 2, 2, 3, 1, 3, 5, 3, + 6, 7, 6, 6, 8, 6, 6, 6, + 6, 9, 6, 9, 1, 10, 1, 11, + 11, 1, 11, 12, 11, 6, 7, 6, + 6, 8, 6, 6, 6, 6, 9, 6, + 9, 1, 13, 1, 14, 14, 1, 14, + 14, 8, 1, 15, 15, 1, 16, 16, + 17, 18, 17, 17, 17, 17, 1, 16, + 16, 18, 1, 19, 20, 19, 21, 22, + 21, 23, 1, 24, 1, 23, 25, 23, + 26, 26, 26, 26, 26, 26, 26, 26, + 26, 1, 27, 1, 28, 28, 1, 28, + 28, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 1, 29, 30, 29, 31, 31, + 31, 32, 33, 31, 31, 31, 31, 31, + 31, 1, 34, 35, 34, 23, 33, 1, + 36, 1, 37, 37, 1, 37, 37, 23, + 33, 1, 33, 38, 33, 39, 40, 39, + 39, 41, 39, 39, 39, 39, 39, 39, + 1, 42, 1, 43, 43, 1, 43, 44, + 43, 39, 40, 39, 39, 41, 39, 39, + 39, 39, 39, 39, 1, 45, 1, 46, + 46, 1, 46, 46, 40, 1, 47, 48, + 49, 1, 1, 1, 40, 50, 1, 40, + 40, 1, 51, 30, 51, 32, 1, 52, + 53, 52, 23, 1, 54, 1, 55, 55, + 1, 55, 55, 23, 1, 40, 40, 40, + 1, 51, 30, 51, 39, 39, 39, 32, + 39, 39, 39, 39, 39, 39, 1, 57, + 56, 56, 56, 1, 59, 48, 58, 58, + 58, 1, 59, 48, 60, 60, 60, 1, + 59, 48, 61, 61, 61, 1, 59, 48, + 1, 63, 62, 56, 56, 1, 64, 59, + 48, 65, 58, 58, 1, 66, 1, 67, + 68, 1, 69, 1, 70, 71, 1, 72, + 1, 48, 73, 1, 48, 74, 1, 48, + 1, 70, 75, 1, 70, 1, 67, 76, + 1, 67, 1, 64, 59, 48, 77, 60, + 60, 1, 64, 59, 48, 61, 61, 61, + 1, 79, 48, 78, 78, 78, 1, 81, + 48, 80, 80, 80, 1, 81, 48, 82, + 82, 82, 1, 81, 48, 83, 83, 83, + 1, 81, 48, 1, 84, 78, 78, 1, + 64, 81, 48, 85, 80, 80, 1, 64, + 81, 48, 86, 82, 82, 1, 64, 81, + 48, 83, 83, 83, 1, 87, 1, 64, + 88, 1, 64, 89, 1, 64, 1, 63, + 1, 90, 91, 90, 92, 92, 92, 92, + 92, 92, 92, 92, 92, 1, 93, 94, + 93, 92, 92, 92, 95, 92, 92, 92, + 92, 92, 92, 1, 96, 12, 96, 8, + 1, 97, 1, 90, 90, 1, 99, 100, + 101, 1, 1, 1, 98, 102, 1, 98, + 98, 1, 93, 94, 93, 95, 1, 98, + 98, 98, 1, 103, 103, 104, 105, 104, + 104, 104, 104, 1, 103, 103, 105, 1, + 106, 107, 108, 107, 109, 106, 109, 108, + 109, 110, 110, 110, 109, 110, 110, 110, + 110, 110, 110, 106, 111, 112, 111, 113, + 113, 113, 114, 115, 113, 113, 113, 113, + 113, 113, 106, 116, 108, 116, 109, 115, + 106, 117, 108, 117, 118, 119, 118, 118, + 109, 120, 118, 118, 118, 118, 118, 118, + 106, 121, 112, 121, 118, 118, 118, 114, + 118, 118, 118, 118, 118, 118, 106, 122, + 108, 122, 123, 124, 125, 106, 106, 119, + 121, 112, 121, 114, 106, 124, 108, 124, + 126, 123, 126, 126, 124, 125, 126, 106, + 106, 126, 126, 126, 126, 126, 119, 127, + 112, 127, 128, 123, 128, 128, 129, 130, + 125, 128, 106, 106, 128, 128, 128, 128, + 128, 119, 131, 108, 131, 123, 124, 130, + 125, 106, 106, 119, 132, 108, 132, 133, + 134, 133, 133, 124, 135, 125, 133, 106, + 106, 133, 133, 133, 133, 133, 119, 136, + 112, 136, 133, 123, 133, 133, 129, 125, + 133, 106, 106, 133, 133, 133, 133, 133, + 119, 122, 108, 122, 124, 119, 119, 106, + 136, 112, 136, 123, 129, 125, 106, 106, + 119, 122, 108, 122, 123, 138, 124, 125, + 106, 106, 137, 137, 137, 119, 122, 108, + 122, 123, 140, 124, 125, 134, 106, 106, + 139, 139, 139, 119, 122, 108, 122, 123, + 140, 124, 125, 134, 106, 106, 141, 141, + 141, 119, 122, 108, 122, 123, 140, 124, + 125, 134, 106, 106, 142, 142, 142, 119, + 122, 108, 122, 123, 140, 124, 125, 134, + 106, 106, 119, 122, 108, 122, 123, 144, + 124, 125, 106, 106, 143, 137, 137, 119, + 122, 108, 122, 123, 145, 140, 124, 125, + 134, 106, 106, 146, 139, 139, 119, 122, + 108, 122, 123, 124, 125, 106, 106, 147, + 119, 122, 108, 122, 123, 148, 124, 125, + 106, 106, 149, 119, 122, 108, 122, 123, + 124, 125, 106, 106, 150, 119, 122, 108, + 122, 123, 151, 124, 125, 106, 106, 152, + 119, 122, 108, 122, 123, 124, 125, 106, + 106, 153, 119, 122, 108, 122, 123, 124, + 125, 134, 106, 106, 154, 119, 122, 108, + 122, 123, 124, 125, 134, 106, 106, 155, + 119, 122, 108, 122, 123, 124, 125, 134, + 106, 106, 119, 122, 108, 122, 123, 151, + 124, 125, 106, 106, 156, 119, 122, 108, + 122, 123, 151, 124, 125, 106, 106, 119, + 122, 108, 122, 123, 148, 124, 125, 106, + 106, 157, 119, 122, 108, 122, 123, 148, + 124, 125, 106, 106, 119, 122, 108, 122, + 123, 145, 140, 124, 125, 134, 106, 106, + 158, 141, 141, 119, 122, 108, 122, 123, + 145, 140, 124, 125, 134, 106, 106, 142, + 142, 142, 119, 122, 108, 122, 123, 160, + 124, 125, 134, 106, 106, 159, 159, 159, + 119, 122, 108, 122, 123, 162, 124, 125, + 134, 106, 106, 161, 161, 161, 119, 122, + 108, 122, 123, 162, 124, 125, 134, 106, + 106, 163, 163, 163, 119, 122, 108, 122, + 123, 162, 124, 125, 134, 106, 106, 164, + 164, 164, 119, 122, 108, 122, 123, 162, + 124, 125, 134, 106, 106, 119, 122, 108, + 122, 123, 124, 125, 106, 106, 165, 159, + 159, 119, 122, 108, 122, 123, 145, 162, + 124, 125, 134, 106, 106, 166, 161, 161, + 119, 122, 108, 122, 123, 145, 162, 124, + 125, 134, 106, 106, 167, 163, 163, 119, + 122, 108, 122, 123, 145, 162, 124, 125, + 134, 106, 106, 164, 164, 164, 119, 122, + 108, 122, 123, 124, 125, 106, 106, 168, + 119, 122, 108, 122, 123, 145, 124, 125, + 106, 106, 169, 119, 122, 108, 122, 123, + 145, 124, 125, 106, 106, 170, 119, 122, + 108, 122, 123, 145, 124, 125, 106, 106, + 119, 122, 108, 122, 123, 144, 124, 125, + 106, 106, 119, 107, 108, 107, 172, 109, + 171, 171, 171, 106, 107, 108, 107, 174, + 109, 123, 173, 173, 173, 106, 107, 108, + 107, 174, 109, 123, 175, 175, 175, 106, + 107, 108, 107, 174, 109, 123, 176, 176, + 176, 106, 107, 108, 107, 174, 109, 123, + 106, 107, 108, 107, 178, 109, 177, 171, + 171, 106, 107, 108, 107, 179, 174, 109, + 123, 180, 173, 173, 106, 107, 108, 107, + 109, 181, 106, 107, 108, 107, 182, 109, + 183, 106, 107, 108, 107, 109, 184, 106, + 107, 108, 107, 185, 109, 186, 106, 107, + 108, 107, 109, 187, 106, 107, 108, 107, + 109, 123, 188, 106, 107, 108, 107, 109, + 123, 189, 106, 107, 108, 107, 109, 123, + 106, 107, 108, 107, 185, 109, 190, 106, + 107, 108, 107, 185, 109, 106, 107, 108, + 107, 182, 109, 191, 106, 107, 108, 107, + 182, 109, 106, 107, 108, 107, 179, 174, + 109, 123, 192, 175, 175, 106, 107, 108, + 107, 179, 174, 109, 123, 176, 176, 176, + 106, 107, 108, 107, 194, 109, 123, 193, + 193, 193, 106, 107, 108, 107, 196, 109, + 123, 195, 195, 195, 106, 107, 108, 107, + 196, 109, 123, 197, 197, 197, 106, 107, + 108, 107, 196, 109, 123, 198, 198, 198, + 106, 107, 108, 107, 196, 109, 123, 106, + 107, 108, 107, 109, 199, 193, 193, 106, + 107, 108, 107, 179, 196, 109, 123, 200, + 195, 195, 106, 107, 108, 107, 179, 196, + 109, 123, 201, 197, 197, 106, 107, 108, + 107, 179, 196, 109, 123, 198, 198, 198, + 106, 107, 108, 107, 109, 202, 106, 107, + 108, 107, 179, 109, 203, 106, 107, 108, + 107, 179, 109, 204, 106, 107, 108, 107, + 179, 109, 106, 107, 108, 107, 178, 109, + 106, 205, 205, 1, 206, 206, 1, 207, + 207, 1, 208, 1, 209, 209, 1, 2, + 2, 1, 1, 0 +}; + +static const unsigned char _tsip_machine_parser_header_Refer_To_trans_targs[] = { + 2, 0, 3, 4, 177, 5, 79, 84, + 11, 89, 6, 7, 8, 9, 10, 12, + 13, 12, 14, 15, 16, 16, 17, 18, + 183, 19, 22, 20, 21, 23, 17, 22, + 18, 27, 23, 24, 25, 26, 28, 43, + 34, 44, 29, 30, 31, 32, 33, 35, + 37, 42, 36, 38, 38, 39, 40, 41, + 45, 78, 46, 49, 47, 48, 50, 65, + 51, 63, 52, 53, 61, 54, 55, 59, + 56, 57, 58, 60, 62, 64, 66, 74, + 67, 70, 68, 69, 71, 72, 73, 75, + 76, 77, 80, 82, 79, 81, 8, 11, + 81, 83, 84, 85, 87, 88, 86, 90, + 89, 91, 92, 92, 17, 93, 94, 95, + 17, 94, 93, 96, 95, 96, 97, 98, + 142, 92, 98, 99, 100, 105, 101, 102, + 101, 100, 103, 102, 103, 104, 106, 107, + 98, 108, 141, 109, 112, 110, 111, 113, + 128, 114, 126, 115, 116, 124, 117, 118, + 122, 119, 120, 121, 123, 125, 127, 129, + 137, 130, 133, 131, 132, 134, 135, 136, + 138, 139, 140, 143, 176, 144, 147, 145, + 146, 148, 163, 149, 161, 150, 151, 159, + 152, 153, 157, 154, 155, 156, 158, 160, + 162, 164, 172, 165, 168, 166, 167, 169, + 170, 171, 173, 174, 175, 178, 179, 180, + 181, 182 +}; + +static const char _tsip_machine_parser_header_Refer_To_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 1, 1, + 0, 1, 0, 0, 0, 0, 0, 1, + 0, 0, 0, 0, 3, 0, 0, 0, + 9, 0, 1, 0, 0, 7, 7, 0, + 7, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 5, 5, 5, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 3, 3, 3, 1, 11, + 11, 0, 11, 0, 3, 3, 0, 0, + 0, 11, 3, 0, 3, 0, 1, 11, + 0, 11, 0, 3, 3, 0, 0, 0, + 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0 +}; + +static const int tsip_machine_parser_header_Refer_To_start = 1; +static const int tsip_machine_parser_header_Refer_To_first_final = 183; +static const int tsip_machine_parser_header_Refer_To_error = 0; + +static const int tsip_machine_parser_header_Refer_To_en_main = 1; + + +/* #line 128 "./ragel/tsip_parser_header_Refer_To.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Refer_To_first_final); + (void)(tsip_machine_parser_header_Refer_To_error); + (void)(tsip_machine_parser_header_Refer_To_en_main); + +/* #line 639 "./src/headers/tsip_header_Refer_To.c" */ + { + cs = tsip_machine_parser_header_Refer_To_start; + } + +/* #line 133 "./ragel/tsip_parser_header_Refer_To.rl" */ + +/* #line 646 "./src/headers/tsip_header_Refer_To.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Refer_To_trans_keys + _tsip_machine_parser_header_Refer_To_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Refer_To_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Refer_To_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Refer_To_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Refer_To_indicies[_trans]; + cs = _tsip_machine_parser_header_Refer_To_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Refer_To_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Refer_To_actions + _tsip_machine_parser_header_Refer_To_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 49 "./ragel/tsip_parser_header_Refer_To.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 53 "./ragel/tsip_parser_header_Refer_To.rl" */ + { + if(!r_to->uri) /* Only one URI */{ + int len = (int)(p - tag_start); + if(r_to && !r_to->uri){ + if((r_to->uri = tsip_uri_parse(tag_start, (tsk_size_t)len)) && r_to->display_name){ + r_to->uri->display_name = tsk_strdup(r_to->display_name); + } + } + } + } + break; + case 2: +/* #line 64 "./ragel/tsip_parser_header_Refer_To.rl" */ + { + if(!r_to->display_name){ + TSK_PARSER_SET_STRING(r_to->display_name); + tsk_strunquote(&r_to->display_name); + } + } + break; + case 3: +/* #line 71 "./ragel/tsip_parser_header_Refer_To.rl" */ + { + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(r_to)); + } + break; + case 4: +/* #line 75 "./ragel/tsip_parser_header_Refer_To.rl" */ + { + } + break; +/* #line 759 "./src/headers/tsip_header_Refer_To.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 134 "./ragel/tsip_parser_header_Refer_To.rl" */ + + if( cs < +/* #line 775 "./src/headers/tsip_header_Refer_To.c" */ +183 +/* #line 135 "./ragel/tsip_parser_header_Refer_To.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Refer-To' header."); + TSK_OBJECT_SAFE_FREE(r_to); + } + + return r_to; +} + + + + + + + +//======================================================== +// Refer_To header object definition +// + +static tsk_object_t* tsip_header_Refer_To_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Refer_To_t *Refer_To = self; + if(Refer_To){ + const tsip_uri_t* uri = va_arg(*app, const tsip_uri_t*); + + TSIP_HEADER(Refer_To)->type = tsip_htype_Refer_To; + TSIP_HEADER(Refer_To)->serialize = tsip_header_Refer_To_serialize; + + if(uri){ + Refer_To->uri = tsk_object_ref((void*)uri); + } + } + else{ + TSK_DEBUG_ERROR("Failed to create new Refer_To header."); + } + return self; +} + +static tsk_object_t* tsip_header_Refer_To_dtor(tsk_object_t *self) +{ + tsip_header_Refer_To_t *Refer_To = self; + if(Refer_To){ + TSK_FREE(Refer_To->display_name); + TSK_OBJECT_SAFE_FREE(Refer_To->uri); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Refer_To)); + } + else{ + TSK_DEBUG_ERROR("Null Refer_To header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Refer_To_def_s = +{ + sizeof(tsip_header_Refer_To_t), + tsip_header_Refer_To_ctor, + tsip_header_Refer_To_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Refer_To_def_t = &tsip_header_Refer_To_def_s; diff --git a/tinySIP/src/headers/tsip_header_Referred_By.c b/tinySIP/src/headers/tsip_header_Referred_By.c new file mode 100644 index 0000000..47fae1d --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Referred_By.c @@ -0,0 +1,1372 @@ + +/* #line 1 "./ragel/tsip_parser_header_Referred_By.rl" */ + +/* +* 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 tsip_header_Referred_By.c + * @brief SIP Referred-By header as per RFC 3892. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Referred_By.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 95 "./ragel/tsip_parser_header_Referred_By.rl" */ + + + +tsip_header_Referred_By_t* tsip_header_Referred_By_create(const tsip_uri_t* uri, const char* cid) +{ + return tsk_object_new(TSIP_HEADER_REFERRED_BY_VA_ARGS(uri, cid)); +} + +tsip_header_Referred_By_t* tsip_header_Referred_By_create_null() +{ + return tsip_header_Referred_By_create(tsk_null, tsk_null); +} + +int tsip_header_Referred_By_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + int ret; + const tsip_header_Referred_By_t *Referred_By = (const tsip_header_Referred_By_t *)header; + + /* Uri with hacked display-name*/ + if((ret = tsip_uri_serialize(Referred_By->uri, tsk_true, tsk_true, output))){ + return ret; + } + /* cid */ + if(Referred_By->cid && (ret = tsk_buffer_append_2(output, ";cid=%s", Referred_By->cid))){ + return ret; + } + return ret; + } + return -1; +} + +tsip_header_Referred_By_t *tsip_header_Referred_By_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Referred_By_t *r_by = tsip_header_Referred_By_create_null(); + + const char *tag_start = tsk_null; + + +/* #line 91 "./src/headers/tsip_header_Referred_By.c" */ +static const char _tsip_machine_parser_header_Referred_By_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3, 1, 4, 1, 5, 2, 1, 0, + 2, 1, 3, 2, 1, 4, 2, 3, + 4, 3, 1, 3, 4 +}; + +static const short _tsip_machine_parser_header_Referred_By_key_offsets[] = { + 0, 0, 4, 7, 28, 29, 31, 52, + 53, 55, 58, 62, 74, 77, 77, 78, + 82, 83, 102, 103, 105, 123, 142, 147, + 148, 150, 154, 173, 174, 176, 195, 196, + 198, 201, 209, 210, 212, 216, 220, 221, + 223, 226, 232, 250, 257, 265, 273, 281, + 283, 290, 299, 301, 304, 306, 309, 311, + 314, 317, 318, 321, 322, 325, 326, 335, + 344, 352, 360, 368, 376, 378, 384, 393, + 402, 411, 413, 416, 419, 420, 421, 442, + 463, 482, 487, 488, 490, 494, 513, 514, + 516, 535, 536, 538, 541, 562, 585, 609, + 631, 635, 639, 660, 684, 708, 731, 755, + 779, 802, 817, 833, 849, 865, 875, 890, + 907, 917, 928, 938, 949, 959, 970, 981, + 990, 998, 1009, 1018, 1029, 1038, 1055, 1072, + 1088, 1104, 1120, 1136, 1146, 1160, 1177, 1194, + 1211, 1221, 1232, 1243, 1252, 1261, 1278, 1296, + 1300, 1301, 1303, 1311, 1312, 1314, 1318, 1324, + 1336, 1339, 1339, 1343, 1363, 1382, 1387, 1407, + 1425, 1434, 1438, 1463, 1487, 1497, 1521, 1544, + 1552, 1561, 1577, 1594, 1611, 1628, 1639, 1655, + 1673, 1684, 1696, 1707, 1719, 1730, 1742, 1754, + 1764, 1776, 1786, 1798, 1808, 1826, 1844, 1861, + 1878, 1895, 1912, 1923, 1938, 1956, 1974, 1992, + 2003, 2015, 2027, 2037, 2047, 2073, 2099, 2123, + 2133, 2157, 2179, 2203, 2225, 2250, 2273, 2277, + 2281, 2303, 2328, 2353, 2377, 2402, 2427, 2451, + 2467, 2484, 2501, 2518, 2529, 2545, 2563, 2574, + 2586, 2597, 2609, 2620, 2632, 2644, 2654, 2663, + 2675, 2685, 2697, 2707, 2725, 2743, 2760, 2777, + 2794, 2811, 2822, 2837, 2855, 2873, 2891, 2902, + 2914, 2926, 2936, 2946, 2957, 2969, 2981, 2993, + 2999, 3010, 3023, 3029, 3036, 3042, 3049, 3055, + 3062, 3069, 3074, 3081, 3086, 3093, 3098, 3111, + 3124, 3136, 3148, 3160, 3172, 3178, 3188, 3201, + 3214, 3227, 3233, 3240, 3247, 3252, 3257, 3278, + 3299, 3318, 3323, 3343, 3345, 3347, 3349, 3351, + 3353, 3355, 3357, 3358, 3360, 3362 +}; + +static const char _tsip_machine_parser_header_Referred_By_trans_keys[] = { + 66, 82, 98, 114, 9, 32, 58, 9, + 13, 32, 33, 34, 37, 39, 60, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 96, 97, 122, 10, 9, 32, 9, + 13, 32, 33, 34, 37, 39, 60, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 96, 97, 122, 10, 9, 32, 9, + 32, 60, 65, 90, 97, 122, 9, 32, + 43, 58, 45, 46, 48, 57, 65, 90, + 97, 122, 9, 32, 58, 62, 9, 13, + 32, 59, 10, 9, 13, 32, 33, 37, + 39, 67, 99, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 10, 9, + 32, 9, 32, 33, 37, 39, 67, 99, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 59, 61, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 59, 61, 10, 9, 32, 9, 32, + 59, 61, 9, 13, 32, 33, 34, 37, + 39, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 13, 32, 33, 34, 37, 39, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 10, 9, 32, 9, 32, + 34, 13, 34, 92, 127, 0, 8, 10, + 31, 10, 9, 32, 9, 13, 32, 59, + 9, 13, 32, 59, 10, 9, 32, 9, + 32, 59, 0, 9, 11, 12, 14, 127, + 9, 13, 32, 33, 37, 39, 59, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 58, 48, 57, 65, 70, 97, + 102, 58, 93, 48, 57, 65, 70, 97, + 102, 58, 93, 48, 57, 65, 70, 97, + 102, 58, 93, 48, 57, 65, 70, 97, + 102, 58, 93, 58, 48, 57, 65, 70, + 97, 102, 46, 58, 93, 48, 57, 65, + 70, 97, 102, 48, 57, 46, 48, 57, + 48, 57, 46, 48, 57, 48, 57, 93, + 48, 57, 93, 48, 57, 93, 46, 48, + 57, 46, 46, 48, 57, 46, 46, 58, + 93, 48, 57, 65, 70, 97, 102, 46, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 46, 58, 93, 48, 57, 65, 70, + 97, 102, 46, 58, 93, 48, 57, 65, + 70, 97, 102, 48, 57, 46, 48, 57, + 46, 48, 57, 46, 58, 9, 13, 32, + 33, 37, 39, 59, 61, 73, 105, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 59, 61, 68, 100, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 59, 61, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 59, 61, 10, + 9, 32, 9, 32, 59, 61, 9, 13, + 32, 33, 34, 37, 39, 91, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 10, 9, 32, 9, 13, 32, 33, + 34, 37, 39, 91, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 10, + 9, 32, 9, 32, 34, 13, 33, 34, + 37, 39, 45, 92, 126, 127, 0, 8, + 10, 31, 42, 43, 48, 57, 65, 90, + 95, 122, 13, 33, 34, 37, 39, 45, + 46, 64, 92, 126, 127, 0, 8, 10, + 31, 42, 43, 48, 57, 65, 90, 95, + 122, 13, 33, 34, 37, 39, 45, 91, + 92, 126, 127, 0, 8, 10, 31, 42, + 43, 48, 57, 65, 90, 95, 96, 97, + 122, 13, 33, 34, 37, 39, 45, 46, + 92, 126, 127, 0, 8, 10, 31, 42, + 43, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 59, 9, 13, 32, 59, 13, + 33, 34, 37, 39, 45, 92, 126, 127, + 0, 8, 10, 31, 42, 43, 48, 57, + 65, 90, 95, 122, 13, 33, 34, 37, + 39, 45, 46, 92, 126, 127, 0, 8, + 10, 31, 42, 43, 48, 57, 65, 90, + 95, 96, 97, 122, 13, 33, 34, 37, + 39, 45, 46, 92, 126, 127, 0, 8, + 10, 31, 42, 43, 48, 57, 65, 90, + 95, 96, 97, 122, 13, 33, 34, 37, + 39, 45, 92, 126, 127, 0, 8, 10, + 31, 42, 43, 48, 57, 65, 90, 95, + 96, 97, 122, 13, 33, 34, 37, 39, + 45, 46, 92, 126, 127, 0, 8, 10, + 31, 42, 43, 48, 57, 65, 90, 95, + 96, 97, 122, 13, 33, 34, 37, 39, + 45, 46, 92, 126, 127, 0, 8, 10, + 31, 42, 43, 48, 57, 65, 90, 95, + 96, 97, 122, 13, 33, 34, 37, 39, + 45, 92, 126, 127, 0, 8, 10, 31, + 42, 43, 48, 57, 65, 90, 95, 96, + 97, 122, 13, 34, 58, 92, 127, 0, + 8, 10, 31, 48, 57, 65, 70, 97, + 102, 13, 34, 58, 92, 93, 127, 0, + 8, 10, 31, 48, 57, 65, 70, 97, + 102, 13, 34, 58, 92, 93, 127, 0, + 8, 10, 31, 48, 57, 65, 70, 97, + 102, 13, 34, 58, 92, 93, 127, 0, + 8, 10, 31, 48, 57, 65, 70, 97, + 102, 13, 34, 58, 92, 93, 127, 0, + 8, 10, 31, 13, 34, 58, 92, 127, + 0, 8, 10, 31, 48, 57, 65, 70, + 97, 102, 13, 34, 46, 58, 92, 93, + 127, 0, 8, 10, 31, 48, 57, 65, + 70, 97, 102, 13, 34, 92, 127, 0, + 8, 10, 31, 48, 57, 13, 34, 46, + 92, 127, 0, 8, 10, 31, 48, 57, + 13, 34, 92, 127, 0, 8, 10, 31, + 48, 57, 13, 34, 46, 92, 127, 0, + 8, 10, 31, 48, 57, 13, 34, 92, + 127, 0, 8, 10, 31, 48, 57, 13, + 34, 92, 93, 127, 0, 8, 10, 31, + 48, 57, 13, 34, 92, 93, 127, 0, + 8, 10, 31, 48, 57, 13, 34, 92, + 93, 127, 0, 8, 10, 31, 13, 34, + 92, 127, 0, 8, 10, 31, 13, 34, + 46, 92, 127, 0, 8, 10, 31, 48, + 57, 13, 34, 46, 92, 127, 0, 8, + 10, 31, 13, 34, 46, 92, 127, 0, + 8, 10, 31, 48, 57, 13, 34, 46, + 92, 127, 0, 8, 10, 31, 13, 34, + 46, 58, 92, 93, 127, 0, 8, 10, + 31, 48, 57, 65, 70, 97, 102, 13, + 34, 46, 58, 92, 93, 127, 0, 8, + 10, 31, 48, 57, 65, 70, 97, 102, + 13, 34, 58, 92, 93, 127, 0, 8, + 10, 31, 48, 57, 65, 70, 97, 102, + 13, 34, 58, 92, 93, 127, 0, 8, + 10, 31, 48, 57, 65, 70, 97, 102, + 13, 34, 58, 92, 93, 127, 0, 8, + 10, 31, 48, 57, 65, 70, 97, 102, + 13, 34, 58, 92, 93, 127, 0, 8, + 10, 31, 48, 57, 65, 70, 97, 102, + 13, 34, 58, 92, 93, 127, 0, 8, + 10, 31, 13, 34, 92, 127, 0, 8, + 10, 31, 48, 57, 65, 70, 97, 102, + 13, 34, 46, 58, 92, 93, 127, 0, + 8, 10, 31, 48, 57, 65, 70, 97, + 102, 13, 34, 46, 58, 92, 93, 127, + 0, 8, 10, 31, 48, 57, 65, 70, + 97, 102, 13, 34, 46, 58, 92, 93, + 127, 0, 8, 10, 31, 48, 57, 65, + 70, 97, 102, 13, 34, 92, 127, 0, + 8, 10, 31, 48, 57, 13, 34, 46, + 92, 127, 0, 8, 10, 31, 48, 57, + 13, 34, 46, 92, 127, 0, 8, 10, + 31, 48, 57, 13, 34, 46, 92, 127, + 0, 8, 10, 31, 13, 34, 58, 92, + 127, 0, 8, 10, 31, 9, 13, 32, + 33, 37, 39, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 60, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 60, 10, 9, 32, 13, + 34, 92, 127, 0, 8, 10, 31, 10, + 9, 32, 9, 13, 32, 60, 0, 9, + 11, 12, 14, 127, 9, 32, 43, 58, + 45, 46, 48, 57, 65, 90, 97, 122, + 9, 32, 58, 9, 13, 32, 59, 9, + 13, 32, 33, 37, 39, 59, 67, 99, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 59, 61, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 59, 61, 9, 13, 32, 33, 34, + 37, 39, 59, 91, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 59, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 34, 59, 92, 127, + 0, 31, 9, 13, 32, 59, 9, 13, + 32, 33, 34, 37, 39, 59, 67, 92, + 99, 126, 127, 0, 31, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 34, 37, 39, 59, 61, + 92, 126, 127, 0, 31, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 34, 59, 61, 92, 127, 0, + 31, 9, 13, 32, 33, 34, 37, 39, + 59, 91, 92, 126, 127, 0, 31, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 34, 37, 39, + 59, 92, 126, 127, 0, 31, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 59, 0, 8, 11, 127, + 9, 13, 32, 34, 59, 92, 127, 0, + 31, 9, 13, 32, 34, 58, 59, 92, + 127, 0, 31, 48, 57, 65, 70, 97, + 102, 9, 13, 32, 34, 58, 59, 92, + 93, 127, 0, 31, 48, 57, 65, 70, + 97, 102, 9, 13, 32, 34, 58, 59, + 92, 93, 127, 0, 31, 48, 57, 65, + 70, 97, 102, 9, 13, 32, 34, 58, + 59, 92, 93, 127, 0, 31, 48, 57, + 65, 70, 97, 102, 9, 13, 32, 34, + 58, 59, 92, 93, 127, 0, 31, 9, + 13, 32, 34, 58, 59, 92, 127, 0, + 31, 48, 57, 65, 70, 97, 102, 9, + 13, 32, 34, 46, 58, 59, 92, 93, + 127, 0, 31, 48, 57, 65, 70, 97, + 102, 9, 13, 32, 34, 59, 92, 127, + 0, 31, 48, 57, 9, 13, 32, 34, + 46, 59, 92, 127, 0, 31, 48, 57, + 9, 13, 32, 34, 59, 92, 127, 0, + 31, 48, 57, 9, 13, 32, 34, 46, + 59, 92, 127, 0, 31, 48, 57, 9, + 13, 32, 34, 59, 92, 127, 0, 31, + 48, 57, 9, 13, 32, 34, 59, 92, + 93, 127, 0, 31, 48, 57, 9, 13, + 32, 34, 59, 92, 93, 127, 0, 31, + 48, 57, 9, 13, 32, 34, 59, 92, + 93, 127, 0, 31, 9, 13, 32, 34, + 46, 59, 92, 127, 0, 31, 48, 57, + 9, 13, 32, 34, 46, 59, 92, 127, + 0, 31, 9, 13, 32, 34, 46, 59, + 92, 127, 0, 31, 48, 57, 9, 13, + 32, 34, 46, 59, 92, 127, 0, 31, + 9, 13, 32, 34, 46, 58, 59, 92, + 93, 127, 0, 31, 48, 57, 65, 70, + 97, 102, 9, 13, 32, 34, 46, 58, + 59, 92, 93, 127, 0, 31, 48, 57, + 65, 70, 97, 102, 9, 13, 32, 34, + 58, 59, 92, 93, 127, 0, 31, 48, + 57, 65, 70, 97, 102, 9, 13, 32, + 34, 58, 59, 92, 93, 127, 0, 31, + 48, 57, 65, 70, 97, 102, 9, 13, + 32, 34, 58, 59, 92, 93, 127, 0, + 31, 48, 57, 65, 70, 97, 102, 9, + 13, 32, 34, 58, 59, 92, 93, 127, + 0, 31, 48, 57, 65, 70, 97, 102, + 9, 13, 32, 34, 58, 59, 92, 93, + 127, 0, 31, 9, 13, 32, 34, 59, + 92, 127, 0, 31, 48, 57, 65, 70, + 97, 102, 9, 13, 32, 34, 46, 58, + 59, 92, 93, 127, 0, 31, 48, 57, + 65, 70, 97, 102, 9, 13, 32, 34, + 46, 58, 59, 92, 93, 127, 0, 31, + 48, 57, 65, 70, 97, 102, 9, 13, + 32, 34, 46, 58, 59, 92, 93, 127, + 0, 31, 48, 57, 65, 70, 97, 102, + 9, 13, 32, 34, 59, 92, 127, 0, + 31, 48, 57, 9, 13, 32, 34, 46, + 59, 92, 127, 0, 31, 48, 57, 9, + 13, 32, 34, 46, 59, 92, 127, 0, + 31, 48, 57, 9, 13, 32, 34, 46, + 59, 92, 127, 0, 31, 9, 13, 32, + 34, 58, 59, 92, 127, 0, 31, 9, + 13, 32, 33, 34, 37, 39, 59, 61, + 73, 92, 105, 126, 127, 0, 31, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 34, 37, 39, + 59, 61, 68, 92, 100, 126, 127, 0, + 31, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 34, + 37, 39, 59, 61, 92, 126, 127, 0, + 31, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 34, 59, + 61, 92, 127, 0, 31, 9, 13, 32, + 33, 34, 37, 39, 59, 91, 92, 126, + 127, 0, 31, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 34, 37, 39, 45, 59, 92, 126, + 127, 0, 31, 42, 43, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 34, + 37, 39, 45, 46, 59, 64, 92, 126, + 127, 0, 31, 42, 43, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 34, + 37, 39, 45, 59, 92, 126, 127, 0, + 31, 42, 43, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 34, 37, 39, + 45, 59, 91, 92, 126, 127, 0, 31, + 42, 43, 48, 57, 65, 90, 95, 96, + 97, 122, 9, 13, 32, 33, 34, 37, + 39, 45, 46, 59, 92, 126, 127, 0, + 31, 42, 43, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 59, 9, 13, 32, + 59, 9, 13, 32, 33, 34, 37, 39, + 45, 59, 92, 126, 127, 0, 31, 42, + 43, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 34, 37, 39, 45, 46, + 59, 92, 126, 127, 0, 31, 42, 43, + 48, 57, 65, 90, 95, 96, 97, 122, + 9, 13, 32, 33, 34, 37, 39, 45, + 46, 59, 92, 126, 127, 0, 31, 42, + 43, 48, 57, 65, 90, 95, 96, 97, + 122, 9, 13, 32, 33, 34, 37, 39, + 45, 59, 92, 126, 127, 0, 31, 42, + 43, 48, 57, 65, 90, 95, 96, 97, + 122, 9, 13, 32, 33, 34, 37, 39, + 45, 46, 59, 92, 126, 127, 0, 31, + 42, 43, 48, 57, 65, 90, 95, 96, + 97, 122, 9, 13, 32, 33, 34, 37, + 39, 45, 46, 59, 92, 126, 127, 0, + 31, 42, 43, 48, 57, 65, 90, 95, + 96, 97, 122, 9, 13, 32, 33, 34, + 37, 39, 45, 59, 92, 126, 127, 0, + 31, 42, 43, 48, 57, 65, 90, 95, + 96, 97, 122, 9, 13, 32, 34, 58, + 59, 92, 127, 0, 31, 48, 57, 65, + 70, 97, 102, 9, 13, 32, 34, 58, + 59, 92, 93, 127, 0, 31, 48, 57, + 65, 70, 97, 102, 9, 13, 32, 34, + 58, 59, 92, 93, 127, 0, 31, 48, + 57, 65, 70, 97, 102, 9, 13, 32, + 34, 58, 59, 92, 93, 127, 0, 31, + 48, 57, 65, 70, 97, 102, 9, 13, + 32, 34, 58, 59, 92, 93, 127, 0, + 31, 9, 13, 32, 34, 58, 59, 92, + 127, 0, 31, 48, 57, 65, 70, 97, + 102, 9, 13, 32, 34, 46, 58, 59, + 92, 93, 127, 0, 31, 48, 57, 65, + 70, 97, 102, 9, 13, 32, 34, 59, + 92, 127, 0, 31, 48, 57, 9, 13, + 32, 34, 46, 59, 92, 127, 0, 31, + 48, 57, 9, 13, 32, 34, 59, 92, + 127, 0, 31, 48, 57, 9, 13, 32, + 34, 46, 59, 92, 127, 0, 31, 48, + 57, 9, 13, 32, 34, 59, 92, 127, + 0, 31, 48, 57, 9, 13, 32, 34, + 59, 92, 93, 127, 0, 31, 48, 57, + 9, 13, 32, 34, 59, 92, 93, 127, + 0, 31, 48, 57, 9, 13, 32, 34, + 59, 92, 93, 127, 0, 31, 9, 13, + 32, 34, 59, 92, 127, 0, 31, 9, + 13, 32, 34, 46, 59, 92, 127, 0, + 31, 48, 57, 9, 13, 32, 34, 46, + 59, 92, 127, 0, 31, 9, 13, 32, + 34, 46, 59, 92, 127, 0, 31, 48, + 57, 9, 13, 32, 34, 46, 59, 92, + 127, 0, 31, 9, 13, 32, 34, 46, + 58, 59, 92, 93, 127, 0, 31, 48, + 57, 65, 70, 97, 102, 9, 13, 32, + 34, 46, 58, 59, 92, 93, 127, 0, + 31, 48, 57, 65, 70, 97, 102, 9, + 13, 32, 34, 58, 59, 92, 93, 127, + 0, 31, 48, 57, 65, 70, 97, 102, + 9, 13, 32, 34, 58, 59, 92, 93, + 127, 0, 31, 48, 57, 65, 70, 97, + 102, 9, 13, 32, 34, 58, 59, 92, + 93, 127, 0, 31, 48, 57, 65, 70, + 97, 102, 9, 13, 32, 34, 58, 59, + 92, 93, 127, 0, 31, 48, 57, 65, + 70, 97, 102, 9, 13, 32, 34, 58, + 59, 92, 93, 127, 0, 31, 9, 13, + 32, 34, 59, 92, 127, 0, 31, 48, + 57, 65, 70, 97, 102, 9, 13, 32, + 34, 46, 58, 59, 92, 93, 127, 0, + 31, 48, 57, 65, 70, 97, 102, 9, + 13, 32, 34, 46, 58, 59, 92, 93, + 127, 0, 31, 48, 57, 65, 70, 97, + 102, 9, 13, 32, 34, 46, 58, 59, + 92, 93, 127, 0, 31, 48, 57, 65, + 70, 97, 102, 9, 13, 32, 34, 59, + 92, 127, 0, 31, 48, 57, 9, 13, + 32, 34, 46, 59, 92, 127, 0, 31, + 48, 57, 9, 13, 32, 34, 46, 59, + 92, 127, 0, 31, 48, 57, 9, 13, + 32, 34, 46, 59, 92, 127, 0, 31, + 9, 13, 32, 34, 58, 59, 92, 127, + 0, 31, 9, 13, 32, 58, 59, 48, + 57, 65, 70, 97, 102, 9, 13, 32, + 58, 59, 93, 48, 57, 65, 70, 97, + 102, 9, 13, 32, 58, 59, 93, 48, + 57, 65, 70, 97, 102, 9, 13, 32, + 58, 59, 93, 48, 57, 65, 70, 97, + 102, 9, 13, 32, 58, 59, 93, 9, + 13, 32, 58, 59, 48, 57, 65, 70, + 97, 102, 9, 13, 32, 46, 58, 59, + 93, 48, 57, 65, 70, 97, 102, 9, + 13, 32, 59, 48, 57, 9, 13, 32, + 46, 59, 48, 57, 9, 13, 32, 59, + 48, 57, 9, 13, 32, 46, 59, 48, + 57, 9, 13, 32, 59, 48, 57, 9, + 13, 32, 59, 93, 48, 57, 9, 13, + 32, 59, 93, 48, 57, 9, 13, 32, + 59, 93, 9, 13, 32, 46, 59, 48, + 57, 9, 13, 32, 46, 59, 9, 13, + 32, 46, 59, 48, 57, 9, 13, 32, + 46, 59, 9, 13, 32, 46, 58, 59, + 93, 48, 57, 65, 70, 97, 102, 9, + 13, 32, 46, 58, 59, 93, 48, 57, + 65, 70, 97, 102, 9, 13, 32, 58, + 59, 93, 48, 57, 65, 70, 97, 102, + 9, 13, 32, 58, 59, 93, 48, 57, + 65, 70, 97, 102, 9, 13, 32, 58, + 59, 93, 48, 57, 65, 70, 97, 102, + 9, 13, 32, 58, 59, 93, 48, 57, + 65, 70, 97, 102, 9, 13, 32, 58, + 59, 93, 9, 13, 32, 59, 48, 57, + 65, 70, 97, 102, 9, 13, 32, 46, + 58, 59, 93, 48, 57, 65, 70, 97, + 102, 9, 13, 32, 46, 58, 59, 93, + 48, 57, 65, 70, 97, 102, 9, 13, + 32, 46, 58, 59, 93, 48, 57, 65, + 70, 97, 102, 9, 13, 32, 59, 48, + 57, 9, 13, 32, 46, 59, 48, 57, + 9, 13, 32, 46, 59, 48, 57, 9, + 13, 32, 46, 59, 9, 13, 32, 58, + 59, 9, 13, 32, 33, 37, 39, 59, + 61, 73, 105, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 59, 61, 68, 100, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 59, 61, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 59, 61, 9, 13, 32, 33, 34, + 37, 39, 59, 91, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 69, + 101, 70, 102, 69, 101, 82, 114, 82, + 114, 69, 101, 68, 100, 45, 66, 98, + 89, 121, 0 +}; + +static const char _tsip_machine_parser_header_Referred_By_single_lengths[] = { + 0, 4, 3, 9, 1, 2, 9, 1, + 2, 3, 0, 4, 3, 0, 1, 4, + 1, 9, 1, 2, 8, 9, 5, 1, + 2, 4, 9, 1, 2, 9, 1, 2, + 3, 4, 1, 2, 4, 4, 1, 2, + 3, 0, 8, 1, 2, 2, 2, 2, + 1, 3, 0, 1, 0, 1, 0, 1, + 1, 1, 1, 1, 1, 1, 3, 3, + 2, 2, 2, 2, 2, 0, 3, 3, + 3, 0, 1, 1, 1, 1, 11, 11, + 9, 5, 1, 2, 4, 9, 1, 2, + 9, 1, 2, 3, 9, 11, 10, 10, + 4, 4, 9, 10, 10, 9, 10, 10, + 9, 5, 6, 6, 6, 6, 5, 7, + 4, 5, 4, 5, 4, 5, 5, 5, + 4, 5, 5, 5, 5, 7, 7, 6, + 6, 6, 6, 6, 4, 7, 7, 7, + 4, 5, 5, 5, 5, 7, 8, 4, + 1, 2, 4, 1, 2, 4, 0, 4, + 3, 0, 4, 10, 9, 5, 10, 8, + 7, 4, 13, 12, 8, 12, 11, 4, + 7, 8, 9, 9, 9, 9, 8, 10, + 7, 8, 7, 8, 7, 8, 8, 8, + 8, 8, 8, 8, 10, 10, 9, 9, + 9, 9, 9, 7, 10, 10, 10, 7, + 8, 8, 8, 8, 14, 14, 12, 8, + 12, 12, 14, 12, 13, 13, 4, 4, + 12, 13, 13, 12, 13, 13, 12, 8, + 9, 9, 9, 9, 8, 10, 7, 8, + 7, 8, 7, 8, 8, 8, 7, 8, + 8, 8, 8, 10, 10, 9, 9, 9, + 9, 9, 7, 10, 10, 10, 7, 8, + 8, 8, 8, 5, 6, 6, 6, 6, + 5, 7, 4, 5, 4, 5, 4, 5, + 5, 5, 5, 5, 5, 5, 7, 7, + 6, 6, 6, 6, 6, 4, 7, 7, + 7, 4, 5, 5, 5, 5, 11, 11, + 9, 5, 10, 2, 2, 2, 2, 2, + 2, 2, 1, 2, 2, 0 +}; + +static const char _tsip_machine_parser_header_Referred_By_range_lengths[] = { + 0, 0, 0, 6, 0, 0, 6, 0, + 0, 0, 2, 4, 0, 0, 0, 0, + 0, 5, 0, 0, 5, 5, 0, 0, + 0, 0, 5, 0, 0, 5, 0, 0, + 0, 2, 0, 0, 0, 0, 0, 0, + 0, 3, 5, 3, 3, 3, 3, 0, + 3, 3, 1, 1, 1, 1, 1, 1, + 1, 0, 1, 0, 1, 0, 3, 3, + 3, 3, 3, 3, 0, 3, 3, 3, + 3, 1, 1, 1, 0, 0, 5, 5, + 5, 0, 0, 0, 0, 5, 0, 0, + 5, 0, 0, 0, 6, 6, 7, 6, + 0, 0, 6, 7, 7, 7, 7, 7, + 7, 5, 5, 5, 5, 2, 5, 5, + 3, 3, 3, 3, 3, 3, 3, 2, + 2, 3, 2, 3, 2, 5, 5, 5, + 5, 5, 5, 2, 5, 5, 5, 5, + 3, 3, 3, 2, 2, 5, 5, 0, + 0, 0, 2, 0, 0, 0, 3, 4, + 0, 0, 0, 5, 5, 0, 5, 5, + 1, 0, 6, 6, 1, 6, 6, 2, + 1, 4, 4, 4, 4, 1, 4, 4, + 2, 2, 2, 2, 2, 2, 2, 1, + 2, 1, 2, 1, 4, 4, 4, 4, + 4, 4, 1, 4, 4, 4, 4, 2, + 2, 2, 1, 1, 6, 6, 6, 1, + 6, 5, 5, 5, 6, 5, 0, 0, + 5, 6, 6, 6, 6, 6, 6, 4, + 4, 4, 4, 1, 4, 4, 2, 2, + 2, 2, 2, 2, 2, 1, 1, 2, + 1, 2, 1, 4, 4, 4, 4, 4, + 4, 1, 4, 4, 4, 4, 2, 2, + 2, 1, 1, 3, 3, 3, 3, 0, + 3, 3, 1, 1, 1, 1, 1, 1, + 1, 0, 1, 0, 1, 0, 3, 3, + 3, 3, 3, 3, 0, 3, 3, 3, + 3, 1, 1, 1, 0, 0, 5, 5, + 5, 0, 5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; + +static const short _tsip_machine_parser_header_Referred_By_index_offsets[] = { + 0, 0, 5, 9, 25, 27, 30, 46, + 48, 51, 55, 58, 67, 71, 72, 74, + 79, 81, 96, 98, 101, 115, 130, 136, + 138, 141, 146, 161, 163, 166, 181, 183, + 186, 190, 197, 199, 202, 207, 212, 214, + 217, 221, 225, 239, 244, 250, 256, 262, + 265, 270, 277, 279, 282, 284, 287, 289, + 292, 295, 297, 300, 302, 305, 307, 314, + 321, 327, 333, 339, 345, 348, 352, 359, + 366, 373, 375, 378, 381, 383, 385, 402, + 419, 434, 440, 442, 445, 450, 465, 467, + 470, 485, 487, 490, 494, 510, 528, 546, + 563, 568, 573, 589, 607, 625, 642, 660, + 678, 695, 706, 718, 730, 742, 751, 762, + 775, 783, 792, 800, 809, 817, 826, 835, + 843, 850, 859, 867, 876, 884, 897, 910, + 922, 934, 946, 958, 967, 977, 990, 1003, + 1016, 1024, 1033, 1042, 1050, 1058, 1071, 1085, + 1090, 1092, 1095, 1102, 1104, 1107, 1112, 1116, + 1125, 1129, 1130, 1135, 1151, 1166, 1172, 1188, + 1202, 1211, 1216, 1236, 1255, 1265, 1284, 1302, + 1309, 1318, 1331, 1345, 1359, 1373, 1384, 1397, + 1412, 1422, 1433, 1443, 1454, 1464, 1475, 1486, + 1496, 1507, 1517, 1528, 1538, 1553, 1568, 1582, + 1596, 1610, 1624, 1635, 1647, 1662, 1677, 1692, + 1702, 1713, 1724, 1734, 1744, 1765, 1786, 1805, + 1815, 1834, 1852, 1872, 1890, 1910, 1929, 1934, + 1939, 1957, 1977, 1997, 2016, 2036, 2056, 2075, + 2088, 2102, 2116, 2130, 2141, 2154, 2169, 2179, + 2190, 2200, 2211, 2221, 2232, 2243, 2253, 2262, + 2273, 2283, 2294, 2304, 2319, 2334, 2348, 2362, + 2376, 2390, 2401, 2413, 2428, 2443, 2458, 2468, + 2479, 2490, 2500, 2510, 2519, 2529, 2539, 2549, + 2556, 2565, 2576, 2582, 2589, 2595, 2602, 2608, + 2615, 2622, 2628, 2635, 2641, 2648, 2654, 2665, + 2676, 2686, 2696, 2706, 2716, 2723, 2731, 2742, + 2753, 2764, 2770, 2777, 2784, 2790, 2796, 2813, + 2830, 2845, 2851, 2867, 2870, 2873, 2876, 2879, + 2882, 2885, 2888, 2890, 2893, 2896 +}; + +static const short _tsip_machine_parser_header_Referred_By_indicies[] = { + 0, 2, 0, 2, 1, 0, 0, 3, + 1, 3, 4, 3, 5, 6, 5, 5, + 7, 5, 5, 5, 5, 8, 5, 8, + 1, 9, 1, 10, 10, 1, 10, 11, + 10, 5, 6, 5, 5, 7, 5, 5, + 5, 5, 8, 5, 8, 1, 12, 1, + 13, 13, 1, 13, 13, 7, 1, 14, + 14, 1, 15, 15, 16, 17, 16, 16, + 16, 16, 1, 15, 15, 17, 1, 18, + 19, 18, 20, 21, 20, 22, 1, 23, + 1, 22, 24, 22, 25, 25, 25, 26, + 26, 25, 25, 25, 25, 25, 25, 1, + 27, 1, 28, 28, 1, 28, 28, 25, + 25, 25, 26, 26, 25, 25, 25, 25, + 25, 25, 1, 29, 30, 29, 31, 31, + 31, 32, 33, 31, 31, 31, 31, 31, + 31, 1, 34, 35, 34, 22, 33, 1, + 36, 1, 37, 37, 1, 37, 37, 22, + 33, 1, 33, 38, 33, 39, 40, 39, + 39, 41, 39, 39, 39, 39, 39, 39, + 1, 42, 1, 43, 43, 1, 43, 44, + 43, 39, 40, 39, 39, 41, 39, 39, + 39, 39, 39, 39, 1, 45, 1, 46, + 46, 1, 46, 46, 40, 1, 47, 48, + 49, 1, 1, 1, 40, 50, 1, 40, + 40, 1, 51, 30, 51, 32, 1, 52, + 53, 52, 22, 1, 54, 1, 55, 55, + 1, 55, 55, 22, 1, 40, 40, 40, + 1, 51, 30, 51, 39, 39, 39, 32, + 39, 39, 39, 39, 39, 39, 1, 57, + 56, 56, 56, 1, 59, 48, 58, 58, + 58, 1, 59, 48, 60, 60, 60, 1, + 59, 48, 61, 61, 61, 1, 59, 48, + 1, 63, 62, 56, 56, 1, 64, 59, + 48, 65, 58, 58, 1, 66, 1, 67, + 68, 1, 69, 1, 70, 71, 1, 72, + 1, 48, 73, 1, 48, 74, 1, 48, + 1, 70, 75, 1, 70, 1, 67, 76, + 1, 67, 1, 64, 59, 48, 77, 60, + 60, 1, 64, 59, 48, 61, 61, 61, + 1, 79, 48, 78, 78, 78, 1, 81, + 48, 80, 80, 80, 1, 81, 48, 82, + 82, 82, 1, 81, 48, 83, 83, 83, + 1, 81, 48, 1, 84, 78, 78, 1, + 64, 81, 48, 85, 80, 80, 1, 64, + 81, 48, 86, 82, 82, 1, 64, 81, + 48, 83, 83, 83, 1, 87, 1, 64, + 88, 1, 64, 89, 1, 64, 1, 63, + 1, 29, 30, 29, 31, 31, 31, 32, + 33, 90, 90, 31, 31, 31, 31, 31, + 31, 1, 29, 30, 29, 31, 31, 31, + 32, 33, 91, 91, 31, 31, 31, 31, + 31, 31, 1, 92, 30, 92, 31, 31, + 31, 32, 93, 31, 31, 31, 31, 31, + 31, 1, 94, 95, 94, 22, 93, 1, + 96, 1, 97, 97, 1, 97, 97, 22, + 93, 1, 98, 99, 98, 39, 100, 39, + 39, 41, 39, 39, 39, 39, 39, 39, + 1, 101, 1, 102, 102, 1, 103, 104, + 103, 39, 100, 39, 39, 41, 39, 39, + 39, 39, 39, 39, 1, 105, 1, 106, + 106, 1, 106, 106, 107, 1, 47, 108, + 48, 108, 108, 108, 49, 108, 1, 1, + 1, 108, 108, 108, 108, 40, 47, 108, + 48, 108, 108, 108, 107, 109, 49, 108, + 1, 1, 1, 108, 108, 108, 108, 40, + 47, 110, 48, 110, 110, 110, 113, 49, + 110, 1, 1, 1, 110, 111, 112, 110, + 112, 40, 47, 110, 114, 110, 110, 110, + 115, 49, 110, 1, 1, 1, 110, 110, + 110, 110, 40, 116, 117, 116, 118, 1, + 119, 120, 119, 121, 1, 47, 110, 48, + 110, 110, 110, 49, 110, 1, 1, 1, + 110, 110, 110, 110, 40, 47, 110, 114, + 110, 110, 122, 123, 49, 110, 1, 1, + 1, 110, 111, 111, 110, 111, 40, 47, + 110, 114, 110, 110, 122, 115, 49, 110, + 1, 1, 1, 110, 111, 111, 110, 111, + 40, 47, 110, 48, 110, 110, 110, 49, + 110, 1, 1, 1, 110, 111, 112, 110, + 112, 40, 47, 110, 114, 110, 110, 124, + 125, 49, 110, 1, 1, 1, 110, 112, + 112, 110, 112, 40, 47, 110, 114, 110, + 110, 124, 115, 49, 110, 1, 1, 1, + 110, 112, 112, 110, 112, 40, 47, 110, + 114, 110, 110, 110, 49, 110, 1, 1, + 1, 110, 111, 112, 110, 112, 40, 47, + 48, 127, 49, 1, 1, 1, 126, 126, + 126, 40, 47, 48, 129, 49, 130, 1, + 1, 1, 128, 128, 128, 40, 47, 48, + 129, 49, 130, 1, 1, 1, 131, 131, + 131, 40, 47, 48, 129, 49, 130, 1, + 1, 1, 132, 132, 132, 40, 47, 48, + 129, 49, 130, 1, 1, 1, 40, 47, + 48, 134, 49, 1, 1, 1, 133, 126, + 126, 40, 47, 48, 135, 129, 49, 130, + 1, 1, 1, 136, 128, 128, 40, 47, + 48, 49, 1, 1, 1, 137, 40, 47, + 48, 138, 49, 1, 1, 1, 139, 40, + 47, 48, 49, 1, 1, 1, 140, 40, + 47, 48, 141, 49, 1, 1, 1, 142, + 40, 47, 48, 49, 1, 1, 1, 143, + 40, 47, 48, 49, 130, 1, 1, 1, + 144, 40, 47, 48, 49, 130, 1, 1, + 1, 145, 40, 47, 48, 49, 130, 1, + 1, 1, 40, 47, 114, 49, 1, 1, + 1, 40, 47, 48, 141, 49, 1, 1, + 1, 146, 40, 47, 48, 141, 49, 1, + 1, 1, 40, 47, 48, 138, 49, 1, + 1, 1, 147, 40, 47, 48, 138, 49, + 1, 1, 1, 40, 47, 48, 135, 129, + 49, 130, 1, 1, 1, 148, 131, 131, + 40, 47, 48, 135, 129, 49, 130, 1, + 1, 1, 132, 132, 132, 40, 47, 48, + 150, 49, 130, 1, 1, 1, 149, 149, + 149, 40, 47, 48, 152, 49, 130, 1, + 1, 1, 151, 151, 151, 40, 47, 48, + 152, 49, 130, 1, 1, 1, 153, 153, + 153, 40, 47, 48, 152, 49, 130, 1, + 1, 1, 154, 154, 154, 40, 47, 48, + 152, 49, 130, 1, 1, 1, 40, 47, + 48, 49, 1, 1, 1, 155, 149, 149, + 40, 47, 48, 135, 152, 49, 130, 1, + 1, 1, 156, 151, 151, 40, 47, 48, + 135, 152, 49, 130, 1, 1, 1, 157, + 153, 153, 40, 47, 48, 135, 152, 49, + 130, 1, 1, 1, 154, 154, 154, 40, + 47, 48, 49, 1, 1, 1, 158, 40, + 47, 48, 135, 49, 1, 1, 1, 159, + 40, 47, 48, 135, 49, 1, 1, 1, + 160, 40, 47, 48, 135, 49, 1, 1, + 1, 40, 47, 48, 134, 49, 1, 1, + 1, 40, 161, 162, 161, 163, 163, 163, + 163, 163, 163, 163, 163, 163, 1, 164, + 165, 164, 163, 163, 163, 166, 163, 163, + 163, 163, 163, 163, 1, 167, 11, 167, + 7, 1, 168, 1, 161, 161, 1, 170, + 171, 172, 1, 1, 1, 169, 173, 1, + 169, 169, 1, 164, 165, 164, 166, 1, + 169, 169, 169, 1, 174, 174, 175, 176, + 175, 175, 175, 175, 1, 174, 174, 176, + 1, 177, 178, 179, 178, 180, 177, 180, + 179, 180, 181, 181, 181, 180, 182, 182, + 181, 181, 181, 181, 181, 181, 177, 183, + 184, 183, 185, 185, 185, 186, 187, 185, + 185, 185, 185, 185, 185, 177, 188, 179, + 188, 180, 187, 177, 189, 179, 189, 190, + 191, 190, 190, 180, 192, 190, 190, 190, + 190, 190, 190, 177, 193, 184, 193, 190, + 190, 190, 186, 190, 190, 190, 190, 190, + 190, 177, 194, 179, 194, 195, 196, 197, + 177, 177, 191, 193, 184, 193, 186, 177, + 196, 179, 196, 198, 195, 198, 198, 196, + 199, 197, 199, 198, 177, 177, 198, 198, + 198, 198, 198, 191, 200, 184, 200, 201, + 195, 201, 201, 202, 203, 197, 201, 177, + 177, 201, 201, 201, 201, 201, 191, 204, + 179, 204, 195, 196, 203, 197, 177, 177, + 191, 205, 179, 205, 206, 207, 206, 206, + 196, 208, 197, 206, 177, 177, 206, 206, + 206, 206, 206, 191, 209, 184, 209, 206, + 195, 206, 206, 202, 197, 206, 177, 177, + 206, 206, 206, 206, 206, 191, 194, 179, + 194, 196, 191, 191, 177, 209, 184, 209, + 195, 202, 197, 177, 177, 191, 194, 179, + 194, 195, 211, 196, 197, 177, 177, 210, + 210, 210, 191, 194, 179, 194, 195, 213, + 196, 197, 207, 177, 177, 212, 212, 212, + 191, 194, 179, 194, 195, 213, 196, 197, + 207, 177, 177, 214, 214, 214, 191, 194, + 179, 194, 195, 213, 196, 197, 207, 177, + 177, 215, 215, 215, 191, 194, 179, 194, + 195, 213, 196, 197, 207, 177, 177, 191, + 194, 179, 194, 195, 217, 196, 197, 177, + 177, 216, 210, 210, 191, 194, 179, 194, + 195, 218, 213, 196, 197, 207, 177, 177, + 219, 212, 212, 191, 194, 179, 194, 195, + 196, 197, 177, 177, 220, 191, 194, 179, + 194, 195, 221, 196, 197, 177, 177, 222, + 191, 194, 179, 194, 195, 196, 197, 177, + 177, 223, 191, 194, 179, 194, 195, 224, + 196, 197, 177, 177, 225, 191, 194, 179, + 194, 195, 196, 197, 177, 177, 226, 191, + 194, 179, 194, 195, 196, 197, 207, 177, + 177, 227, 191, 194, 179, 194, 195, 196, + 197, 207, 177, 177, 228, 191, 194, 179, + 194, 195, 196, 197, 207, 177, 177, 191, + 194, 179, 194, 195, 224, 196, 197, 177, + 177, 229, 191, 194, 179, 194, 195, 224, + 196, 197, 177, 177, 191, 194, 179, 194, + 195, 221, 196, 197, 177, 177, 230, 191, + 194, 179, 194, 195, 221, 196, 197, 177, + 177, 191, 194, 179, 194, 195, 218, 213, + 196, 197, 207, 177, 177, 231, 214, 214, + 191, 194, 179, 194, 195, 218, 213, 196, + 197, 207, 177, 177, 215, 215, 215, 191, + 194, 179, 194, 195, 233, 196, 197, 207, + 177, 177, 232, 232, 232, 191, 194, 179, + 194, 195, 235, 196, 197, 207, 177, 177, + 234, 234, 234, 191, 194, 179, 194, 195, + 235, 196, 197, 207, 177, 177, 236, 236, + 236, 191, 194, 179, 194, 195, 235, 196, + 197, 207, 177, 177, 237, 237, 237, 191, + 194, 179, 194, 195, 235, 196, 197, 207, + 177, 177, 191, 194, 179, 194, 195, 196, + 197, 177, 177, 238, 232, 232, 191, 194, + 179, 194, 195, 218, 235, 196, 197, 207, + 177, 177, 239, 234, 234, 191, 194, 179, + 194, 195, 218, 235, 196, 197, 207, 177, + 177, 240, 236, 236, 191, 194, 179, 194, + 195, 218, 235, 196, 197, 207, 177, 177, + 237, 237, 237, 191, 194, 179, 194, 195, + 196, 197, 177, 177, 241, 191, 194, 179, + 194, 195, 218, 196, 197, 177, 177, 242, + 191, 194, 179, 194, 195, 218, 196, 197, + 177, 177, 243, 191, 194, 179, 194, 195, + 218, 196, 197, 177, 177, 191, 194, 179, + 194, 195, 217, 196, 197, 177, 177, 191, + 200, 184, 200, 201, 195, 201, 201, 202, + 203, 244, 197, 244, 201, 177, 177, 201, + 201, 201, 201, 201, 191, 200, 184, 200, + 201, 195, 201, 201, 202, 203, 245, 197, + 245, 201, 177, 177, 201, 201, 201, 201, + 201, 191, 246, 184, 246, 201, 195, 201, + 201, 202, 247, 197, 201, 177, 177, 201, + 201, 201, 201, 201, 191, 248, 179, 248, + 195, 196, 247, 197, 177, 177, 191, 249, + 179, 249, 206, 250, 206, 206, 196, 208, + 197, 206, 177, 177, 206, 206, 206, 206, + 206, 191, 209, 184, 209, 251, 195, 251, + 251, 251, 202, 197, 251, 177, 177, 251, + 251, 251, 251, 191, 194, 179, 194, 251, + 195, 251, 251, 251, 252, 196, 253, 197, + 251, 177, 177, 251, 251, 251, 251, 191, + 194, 179, 194, 251, 195, 251, 251, 251, + 196, 197, 251, 177, 177, 251, 251, 251, + 251, 191, 194, 179, 194, 254, 195, 254, + 254, 254, 196, 257, 197, 254, 177, 177, + 254, 255, 256, 254, 256, 191, 194, 179, + 194, 254, 258, 254, 254, 254, 259, 196, + 197, 254, 177, 177, 254, 254, 254, 254, + 191, 260, 261, 260, 262, 177, 263, 264, + 263, 265, 177, 194, 179, 194, 254, 195, + 254, 254, 254, 196, 197, 254, 177, 177, + 254, 254, 254, 254, 191, 194, 179, 194, + 254, 258, 254, 254, 266, 267, 196, 197, + 254, 177, 177, 254, 255, 255, 254, 255, + 191, 194, 179, 194, 254, 258, 254, 254, + 266, 259, 196, 197, 254, 177, 177, 254, + 255, 255, 254, 255, 191, 194, 179, 194, + 254, 195, 254, 254, 254, 196, 197, 254, + 177, 177, 254, 255, 256, 254, 256, 191, + 194, 179, 194, 254, 258, 254, 254, 268, + 269, 196, 197, 254, 177, 177, 254, 256, + 256, 254, 256, 191, 194, 179, 194, 254, + 258, 254, 254, 268, 259, 196, 197, 254, + 177, 177, 254, 256, 256, 254, 256, 191, + 194, 179, 194, 254, 258, 254, 254, 254, + 196, 197, 254, 177, 177, 254, 255, 256, + 254, 256, 191, 194, 179, 194, 195, 271, + 196, 197, 177, 177, 270, 270, 270, 191, + 194, 179, 194, 195, 273, 196, 197, 274, + 177, 177, 272, 272, 272, 191, 194, 179, + 194, 195, 273, 196, 197, 274, 177, 177, + 275, 275, 275, 191, 194, 179, 194, 195, + 273, 196, 197, 274, 177, 177, 276, 276, + 276, 191, 194, 179, 194, 195, 273, 196, + 197, 274, 177, 177, 191, 194, 179, 194, + 195, 278, 196, 197, 177, 177, 277, 270, + 270, 191, 194, 179, 194, 195, 279, 273, + 196, 197, 274, 177, 177, 280, 272, 272, + 191, 194, 179, 194, 195, 196, 197, 177, + 177, 281, 191, 194, 179, 194, 195, 282, + 196, 197, 177, 177, 283, 191, 194, 179, + 194, 195, 196, 197, 177, 177, 284, 191, + 194, 179, 194, 195, 285, 196, 197, 177, + 177, 286, 191, 194, 179, 194, 195, 196, + 197, 177, 177, 287, 191, 194, 179, 194, + 195, 196, 197, 274, 177, 177, 288, 191, + 194, 179, 194, 195, 196, 197, 274, 177, + 177, 289, 191, 194, 179, 194, 195, 196, + 197, 274, 177, 177, 191, 194, 179, 194, + 258, 196, 197, 177, 177, 191, 194, 179, + 194, 195, 285, 196, 197, 177, 177, 290, + 191, 194, 179, 194, 195, 285, 196, 197, + 177, 177, 191, 194, 179, 194, 195, 282, + 196, 197, 177, 177, 291, 191, 194, 179, + 194, 195, 282, 196, 197, 177, 177, 191, + 194, 179, 194, 195, 279, 273, 196, 197, + 274, 177, 177, 292, 275, 275, 191, 194, + 179, 194, 195, 279, 273, 196, 197, 274, + 177, 177, 276, 276, 276, 191, 194, 179, + 194, 195, 294, 196, 197, 274, 177, 177, + 293, 293, 293, 191, 194, 179, 194, 195, + 296, 196, 197, 274, 177, 177, 295, 295, + 295, 191, 194, 179, 194, 195, 296, 196, + 197, 274, 177, 177, 297, 297, 297, 191, + 194, 179, 194, 195, 296, 196, 197, 274, + 177, 177, 298, 298, 298, 191, 194, 179, + 194, 195, 296, 196, 197, 274, 177, 177, + 191, 194, 179, 194, 195, 196, 197, 177, + 177, 299, 293, 293, 191, 194, 179, 194, + 195, 279, 296, 196, 197, 274, 177, 177, + 300, 295, 295, 191, 194, 179, 194, 195, + 279, 296, 196, 197, 274, 177, 177, 301, + 297, 297, 191, 194, 179, 194, 195, 279, + 296, 196, 197, 274, 177, 177, 298, 298, + 298, 191, 194, 179, 194, 195, 196, 197, + 177, 177, 302, 191, 194, 179, 194, 195, + 279, 196, 197, 177, 177, 303, 191, 194, + 179, 194, 195, 279, 196, 197, 177, 177, + 304, 191, 194, 179, 194, 195, 279, 196, + 197, 177, 177, 191, 194, 179, 194, 195, + 278, 196, 197, 177, 177, 191, 178, 179, + 178, 306, 180, 305, 305, 305, 177, 178, + 179, 178, 308, 180, 195, 307, 307, 307, + 177, 178, 179, 178, 308, 180, 195, 309, + 309, 309, 177, 178, 179, 178, 308, 180, + 195, 310, 310, 310, 177, 178, 179, 178, + 308, 180, 195, 177, 178, 179, 178, 312, + 180, 311, 305, 305, 177, 178, 179, 178, + 313, 308, 180, 195, 314, 307, 307, 177, + 178, 179, 178, 180, 315, 177, 178, 179, + 178, 316, 180, 317, 177, 178, 179, 178, + 180, 318, 177, 178, 179, 178, 319, 180, + 320, 177, 178, 179, 178, 180, 321, 177, + 178, 179, 178, 180, 195, 322, 177, 178, + 179, 178, 180, 195, 323, 177, 178, 179, + 178, 180, 195, 177, 178, 179, 178, 319, + 180, 324, 177, 178, 179, 178, 319, 180, + 177, 178, 179, 178, 316, 180, 325, 177, + 178, 179, 178, 316, 180, 177, 178, 179, + 178, 313, 308, 180, 195, 326, 309, 309, + 177, 178, 179, 178, 313, 308, 180, 195, + 310, 310, 310, 177, 178, 179, 178, 328, + 180, 195, 327, 327, 327, 177, 178, 179, + 178, 330, 180, 195, 329, 329, 329, 177, + 178, 179, 178, 330, 180, 195, 331, 331, + 331, 177, 178, 179, 178, 330, 180, 195, + 332, 332, 332, 177, 178, 179, 178, 330, + 180, 195, 177, 178, 179, 178, 180, 333, + 327, 327, 177, 178, 179, 178, 313, 330, + 180, 195, 334, 329, 329, 177, 178, 179, + 178, 313, 330, 180, 195, 335, 331, 331, + 177, 178, 179, 178, 313, 330, 180, 195, + 332, 332, 332, 177, 178, 179, 178, 180, + 336, 177, 178, 179, 178, 313, 180, 337, + 177, 178, 179, 178, 313, 180, 338, 177, + 178, 179, 178, 313, 180, 177, 178, 179, + 178, 312, 180, 177, 183, 184, 183, 185, + 185, 185, 186, 187, 339, 339, 185, 185, + 185, 185, 185, 185, 177, 183, 184, 183, + 185, 185, 185, 186, 187, 340, 340, 185, + 185, 185, 185, 185, 185, 177, 341, 184, + 341, 185, 185, 185, 186, 342, 185, 185, + 185, 185, 185, 185, 177, 343, 179, 343, + 180, 342, 177, 344, 179, 344, 190, 345, + 190, 190, 180, 192, 190, 190, 190, 190, + 190, 190, 177, 346, 346, 1, 347, 347, + 1, 348, 348, 1, 349, 349, 1, 350, + 350, 1, 351, 351, 1, 352, 352, 1, + 353, 1, 354, 354, 1, 0, 0, 1, + 1, 0 +}; + +static const short _tsip_machine_parser_header_Referred_By_trans_targs[] = { + 2, 0, 299, 3, 4, 141, 146, 10, + 151, 5, 6, 7, 8, 9, 11, 12, + 11, 13, 14, 15, 15, 16, 17, 309, + 18, 21, 78, 19, 20, 22, 16, 21, + 17, 26, 22, 23, 24, 25, 27, 42, + 33, 43, 28, 29, 30, 31, 32, 34, + 36, 41, 35, 37, 37, 38, 39, 40, + 44, 77, 45, 48, 46, 47, 49, 64, + 50, 62, 51, 52, 60, 53, 54, 58, + 55, 56, 57, 59, 61, 63, 65, 73, + 66, 69, 67, 68, 70, 71, 72, 74, + 75, 76, 79, 80, 81, 85, 81, 82, + 83, 84, 85, 86, 92, 87, 88, 88, + 89, 90, 91, 92, 93, 94, 95, 99, + 102, 105, 96, 98, 97, 16, 17, 97, + 16, 17, 100, 101, 103, 104, 106, 140, + 107, 110, 120, 108, 109, 111, 127, 112, + 125, 113, 114, 123, 115, 116, 121, 117, + 118, 119, 122, 124, 126, 128, 136, 129, + 132, 130, 131, 133, 134, 135, 137, 138, + 139, 142, 144, 141, 143, 7, 10, 143, + 145, 146, 147, 149, 150, 148, 152, 151, + 153, 154, 154, 16, 155, 156, 294, 157, + 16, 156, 155, 158, 157, 158, 159, 160, + 259, 154, 160, 161, 162, 167, 163, 204, + 164, 163, 162, 165, 164, 165, 166, 168, + 169, 160, 170, 203, 171, 174, 172, 173, + 175, 190, 176, 188, 177, 178, 186, 179, + 180, 184, 181, 182, 183, 185, 187, 189, + 191, 199, 192, 195, 193, 194, 196, 197, + 198, 200, 201, 202, 205, 206, 207, 208, + 207, 208, 209, 210, 211, 212, 213, 217, + 220, 223, 214, 216, 215, 16, 155, 215, + 16, 155, 218, 219, 221, 222, 224, 258, + 225, 228, 238, 226, 227, 229, 245, 230, + 243, 231, 232, 241, 233, 234, 239, 235, + 236, 237, 240, 242, 244, 246, 254, 247, + 250, 248, 249, 251, 252, 253, 255, 256, + 257, 260, 293, 261, 264, 262, 263, 265, + 280, 266, 278, 267, 268, 276, 269, 270, + 274, 271, 272, 273, 275, 277, 279, 281, + 289, 282, 285, 283, 284, 286, 287, 288, + 290, 291, 292, 295, 296, 297, 298, 297, + 298, 211, 300, 301, 302, 303, 304, 305, + 306, 307, 308 +}; + +static const char _tsip_machine_parser_header_Referred_By_trans_actions[] = { + 0, 0, 0, 0, 0, 1, 1, 0, + 1, 0, 0, 0, 0, 0, 1, 0, + 0, 0, 0, 3, 0, 0, 0, 11, + 0, 1, 1, 0, 0, 9, 9, 0, + 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 9, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 9, 0, 0, 0, + 0, 0, 1, 1, 1, 0, 0, 1, + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 22, 22, 22, 7, + 7, 7, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 5, 5, 5, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 3, 3, 3, 1, 1, 19, + 19, 0, 19, 0, 3, 3, 0, 0, + 0, 19, 3, 0, 3, 0, 1, 1, + 19, 0, 19, 0, 3, 3, 0, 0, + 0, 19, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 19, 0, + 3, 13, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 25, 25, 25, 16, + 16, 16, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 19, 0, 3, + 13, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0 +}; + +static const int tsip_machine_parser_header_Referred_By_start = 1; +static const int tsip_machine_parser_header_Referred_By_first_final = 309; +static const int tsip_machine_parser_header_Referred_By_error = 0; + +static const int tsip_machine_parser_header_Referred_By_en_main = 1; + + +/* #line 138 "./ragel/tsip_parser_header_Referred_By.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Referred_By_first_final); + (void)(tsip_machine_parser_header_Referred_By_error); + (void)(tsip_machine_parser_header_Referred_By_en_main); + +/* #line 1166 "./src/headers/tsip_header_Referred_By.c" */ + { + cs = tsip_machine_parser_header_Referred_By_start; + } + +/* #line 143 "./ragel/tsip_parser_header_Referred_By.rl" */ + +/* #line 1173 "./src/headers/tsip_header_Referred_By.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Referred_By_trans_keys + _tsip_machine_parser_header_Referred_By_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Referred_By_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Referred_By_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Referred_By_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Referred_By_indicies[_trans]; + cs = _tsip_machine_parser_header_Referred_By_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Referred_By_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Referred_By_actions + _tsip_machine_parser_header_Referred_By_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 49 "./ragel/tsip_parser_header_Referred_By.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 53 "./ragel/tsip_parser_header_Referred_By.rl" */ + { + if(!r_by->uri) /* Only one URI */{ + int len = (int)(p - tag_start); + if(r_by && !r_by->uri){ + if((r_by->uri = tsip_uri_parse(tag_start, (tsk_size_t)len)) && r_by->display_name){ + r_by->uri->display_name = tsk_strdup(r_by->display_name); + } + } + } + } + break; + case 2: +/* #line 64 "./ragel/tsip_parser_header_Referred_By.rl" */ + { + if(!r_by->display_name){ + TSK_PARSER_SET_STRING(r_by->display_name); + tsk_strunquote(&r_by->display_name); + } + } + break; + case 3: +/* #line 71 "./ragel/tsip_parser_header_Referred_By.rl" */ + { + TSK_PARSER_SET_STRING(r_by->cid); + } + break; + case 4: +/* #line 75 "./ragel/tsip_parser_header_Referred_By.rl" */ + { + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(r_by)); + } + break; + case 5: +/* #line 79 "./ragel/tsip_parser_header_Referred_By.rl" */ + { + } + break; +/* #line 1292 "./src/headers/tsip_header_Referred_By.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 144 "./ragel/tsip_parser_header_Referred_By.rl" */ + + if( cs < +/* #line 1308 "./src/headers/tsip_header_Referred_By.c" */ +309 +/* #line 145 "./ragel/tsip_parser_header_Referred_By.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Referred-By' header."); + TSK_OBJECT_SAFE_FREE(r_by); + } + + return r_by; +} + + + + + + + +//======================================================== +// Referred_By header object definition +// + +static tsk_object_t* tsip_header_Referred_By_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Referred_By_t *Referred_By = self; + if(Referred_By){ + const tsip_uri_t* uri = va_arg(*app, const tsip_uri_t*); + const char* cid = va_arg(*app, const char*); + + TSIP_HEADER(Referred_By)->type = tsip_htype_Referred_By; + TSIP_HEADER(Referred_By)->serialize = tsip_header_Referred_By_serialize; + + Referred_By->uri = tsk_object_ref((void*)uri); + Referred_By->cid = tsk_strdup(cid); + } + else{ + TSK_DEBUG_ERROR("Failed to create new Referred_By header."); + } + return self; +} + +static tsk_object_t* tsip_header_Referred_By_dtor(tsk_object_t *self) +{ + tsip_header_Referred_By_t *Referred_By = self; + if(Referred_By){ + TSK_FREE(Referred_By->display_name); + TSK_OBJECT_SAFE_FREE(Referred_By->uri); + TSK_FREE(Referred_By->cid); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Referred_By)); + } + else{ + TSK_DEBUG_ERROR("Null Referred_By header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Referred_By_def_s = +{ + sizeof(tsip_header_Referred_By_t), + tsip_header_Referred_By_ctor, + tsip_header_Referred_By_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Referred_By_def_t = &tsip_header_Referred_By_def_s; + diff --git a/tinySIP/src/headers/tsip_header_Reject_Contact.c b/tinySIP/src/headers/tsip_header_Reject_Contact.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Reject_Contact.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Replaces.c b/tinySIP/src/headers/tsip_header_Replaces.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Replaces.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Reply_To.c b/tinySIP/src/headers/tsip_header_Reply_To.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Reply_To.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Request_Disposition.c b/tinySIP/src/headers/tsip_header_Request_Disposition.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Request_Disposition.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Require.c b/tinySIP/src/headers/tsip_header_Require.c new file mode 100644 index 0000000..6f2e4a1 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Require.c @@ -0,0 +1,354 @@ + +/* #line 1 "./ragel/tsip_parser_header_Require.rl" */ +/* +* 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 tsip_header_Require.c + * @brief SIP Require header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Require.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 66 "./ragel/tsip_parser_header_Require.rl" */ + + +tsip_header_Require_t* tsip_header_Require_create(const char* option) +{ + return tsk_object_new(TSIP_HEADER_REQUIRE_VA_ARGS(option)); +} + +tsip_header_Require_t* tsip_header_Require_create_null() +{ + return tsip_header_Require_create(tsk_null); +} + +int tsip_header_Require_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Require_t *Require = (const tsip_header_Require_t *)header; + tsk_list_item_t *item; + tsk_string_t *str; + int ret = 0; + + tsk_list_foreach(item, Require->options){ + str = item->data; + if(item == Require->options->head){ + ret = tsk_buffer_append(output, str->value, tsk_strlen(str->value)); + } + else{ + ret = tsk_buffer_append_2(output, ",%s", str->value); + } + } + + return ret; + } + + return -1; +} + +tsip_header_Require_t *tsip_header_Require_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Require_t *hdr_require = tsip_header_Require_create_null(); + + const char *tag_start = tsk_null; + + +/* #line 96 "./src/headers/tsip_header_Require.c" */ +static const char _tsip_machine_parser_header_Require_actions[] = { + 0, 1, 0, 1, 1, 1, 2 +}; + +static const char _tsip_machine_parser_header_Require_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 12, + 14, 17, 34, 35, 37, 53, 69, 73, + 74, 76, 79, 80 +}; + +static const char _tsip_machine_parser_header_Require_trans_keys[] = { + 82, 114, 69, 101, 81, 113, 85, 117, + 73, 105, 82, 114, 69, 101, 9, 32, + 58, 9, 13, 32, 33, 37, 39, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 10, 9, 32, 9, 32, 33, + 37, 39, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 44, 10, 9, 32, 9, 32, 44, 10, + 0 +}; + +static const char _tsip_machine_parser_header_Require_single_lengths[] = { + 0, 2, 2, 2, 2, 2, 2, 2, + 3, 7, 1, 2, 6, 8, 4, 1, + 2, 3, 1, 0 +}; + +static const char _tsip_machine_parser_header_Require_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 0, 0, 5, 4, 0, 0, + 0, 0, 0, 0 +}; + +static const char _tsip_machine_parser_header_Require_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 15, 18, + 21, 25, 38, 40, 43, 55, 68, 73, + 75, 78, 82, 84 +}; + +static const char _tsip_machine_parser_header_Require_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 5, 5, 1, 6, + 6, 1, 7, 7, 1, 7, 7, 8, + 1, 8, 9, 8, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 1, 11, 1, + 12, 12, 1, 12, 12, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 1, 13, + 14, 13, 15, 15, 15, 16, 15, 15, + 15, 15, 15, 1, 17, 18, 17, 8, + 1, 19, 1, 20, 20, 1, 20, 20, + 8, 1, 21, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Require_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 13, 11, 12, 14, 18, 13, + 9, 14, 15, 16, 17, 19 +}; + +static const char _tsip_machine_parser_header_Require_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 3, 3, 0, + 3, 0, 0, 0, 0, 5 +}; + +static const int tsip_machine_parser_header_Require_start = 1; +static const int tsip_machine_parser_header_Require_first_final = 19; +static const int tsip_machine_parser_header_Require_error = 0; + +static const int tsip_machine_parser_header_Require_en_main = 1; + + +/* #line 113 "./ragel/tsip_parser_header_Require.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Require_first_final); + (void)(tsip_machine_parser_header_Require_error); + (void)(tsip_machine_parser_header_Require_en_main); + +/* #line 178 "./src/headers/tsip_header_Require.c" */ + { + cs = tsip_machine_parser_header_Require_start; + } + +/* #line 118 "./ragel/tsip_parser_header_Require.rl" */ + +/* #line 185 "./src/headers/tsip_header_Require.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Require_trans_keys + _tsip_machine_parser_header_Require_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Require_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Require_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Require_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Require_indicies[_trans]; + cs = _tsip_machine_parser_header_Require_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Require_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Require_actions + _tsip_machine_parser_header_Require_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 50 "./ragel/tsip_parser_header_Require.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 54 "./ragel/tsip_parser_header_Require.rl" */ + { + TSK_PARSER_ADD_STRING(hdr_require->options); + } + break; + case 2: +/* #line 58 "./ragel/tsip_parser_header_Require.rl" */ + { + } + break; +/* #line 276 "./src/headers/tsip_header_Require.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 119 "./ragel/tsip_parser_header_Require.rl" */ + + if( cs < +/* #line 292 "./src/headers/tsip_header_Require.c" */ +19 +/* #line 120 "./ragel/tsip_parser_header_Require.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Require' header."); + TSK_OBJECT_SAFE_FREE(hdr_require); + } + + return hdr_require; +} + + + + + + + +//======================================================== +// Require header object definition +// + +static tsk_object_t* tsip_header_Require_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Require_t *Require = self; + if(Require){ + const char* option; + + TSIP_HEADER(Require)->type = tsip_htype_Require; + TSIP_HEADER(Require)->serialize = tsip_header_Require_serialize; + + if((option = va_arg(*app, const char*))){ + tsk_string_t* string = tsk_string_create(option); + Require->options = tsk_list_create(); + + tsk_list_push_back_data(Require->options, ((void**) &string)); + } + } + else{ + TSK_DEBUG_ERROR("Failed to create new Require header."); + } + return self; +} + +static tsk_object_t* tsip_header_Require_dtor(tsk_object_t *self) +{ + tsip_header_Require_t *Require = self; + if(Require){ + TSK_OBJECT_SAFE_FREE(Require->options); + } + else{ + TSK_DEBUG_ERROR("Null Require header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Require_def_s = +{ + sizeof(tsip_header_Require_t), + tsip_header_Require_ctor, + tsip_header_Require_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Require_def_t = &tsip_header_Require_def_s; diff --git a/tinySIP/src/headers/tsip_header_Resource_Priority.c b/tinySIP/src/headers/tsip_header_Resource_Priority.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Resource_Priority.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Retry_After.c b/tinySIP/src/headers/tsip_header_Retry_After.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Retry_After.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Route.c b/tinySIP/src/headers/tsip_header_Route.c new file mode 100644 index 0000000..02ad312 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Route.c @@ -0,0 +1,545 @@ + +/* #line 1 "./ragel/tsip_parser_header_Route.rl" */ +/* +* 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 tsip_header_Route.c + * @brief SIP Route header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Route.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_time.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 110 "./ragel/tsip_parser_header_Route.rl" */ + + +tsip_header_Route_t* tsip_header_Route_create(const tsip_uri_t* uri) +{ + return tsk_object_new(TSIP_HEADER_ROUTE_VA_ARGS(uri)); +} + +tsip_header_Route_t* tsip_header_Route_create_null() +{ + return tsip_header_Route_create(tsk_null); +} + + +int tsip_header_Route_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Route_t *Route = (const tsip_header_Route_t *)header; + int ret = 0; + + /* Uri with hacked display-name*/ + if((ret = tsip_uri_serialize(Route->uri, tsk_true, tsk_true, output))){ + return ret; + } + + return ret; + } + + return -1; +} + +tsip_header_Routes_L_t *tsip_header_Route_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Routes_L_t *hdr_routes = tsk_list_create(); + + const char *tag_start = tsk_null; + tsip_header_Route_t *curr_route = tsk_null; + + +/* #line 92 "./src/headers/tsip_header_Route.c" */ +static const char _tsip_machine_parser_header_Route_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3, 1, 4, 1, 5, 1, 6, 2, + 1, 0, 2, 4, 5 +}; + +static const short _tsip_machine_parser_header_Route_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 13, + 32, 33, 35, 54, 55, 57, 60, 64, + 76, 79, 79, 80, 85, 86, 103, 104, + 106, 122, 140, 146, 147, 149, 154, 173, + 174, 176, 195, 196, 198, 201, 209, 210, + 212, 217, 222, 223, 225, 229, 235, 252, + 259, 267, 275, 283, 285, 292, 301, 303, + 306, 308, 311, 313, 316, 319, 320, 323, + 324, 327, 328, 337, 346, 354, 362, 370, + 378, 380, 386, 395, 404, 413, 415, 418, + 421, 422, 423, 440, 458, 462, 463, 465, + 473, 474, 476, 480, 486 +}; + +static const char _tsip_machine_parser_header_Route_trans_keys[] = { + 82, 114, 79, 111, 85, 117, 84, 116, + 69, 101, 9, 32, 58, 9, 13, 32, + 33, 34, 37, 39, 60, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 10, 9, 32, 9, 13, 32, 33, 34, + 37, 39, 60, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 10, 9, + 32, 9, 32, 60, 65, 90, 97, 122, + 9, 32, 43, 58, 45, 46, 48, 57, + 65, 90, 97, 122, 9, 32, 58, 62, + 9, 13, 32, 44, 59, 10, 9, 13, + 32, 33, 37, 39, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 10, + 9, 32, 9, 32, 33, 37, 39, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 44, + 59, 61, 10, 9, 32, 9, 32, 44, + 59, 61, 9, 13, 32, 33, 34, 37, + 39, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 13, 32, 33, 34, 37, 39, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 10, 9, 32, 9, 32, + 34, 13, 34, 92, 127, 0, 8, 10, + 31, 10, 9, 32, 9, 13, 32, 44, + 59, 9, 13, 32, 44, 59, 10, 9, + 32, 9, 32, 44, 59, 0, 9, 11, + 12, 14, 127, 9, 13, 32, 33, 37, + 39, 44, 59, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 58, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 58, 48, 57, + 65, 70, 97, 102, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 48, 57, 46, + 48, 57, 48, 57, 46, 48, 57, 48, + 57, 93, 48, 57, 93, 48, 57, 93, + 46, 48, 57, 46, 46, 48, 57, 46, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 46, 58, 93, 48, 57, 65, 70, + 97, 102, 58, 93, 48, 57, 65, 70, + 97, 102, 58, 93, 48, 57, 65, 70, + 97, 102, 58, 93, 48, 57, 65, 70, + 97, 102, 58, 93, 48, 57, 65, 70, + 97, 102, 58, 93, 48, 57, 65, 70, + 97, 102, 46, 58, 93, 48, 57, 65, + 70, 97, 102, 46, 58, 93, 48, 57, + 65, 70, 97, 102, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 48, 57, 46, + 48, 57, 46, 48, 57, 46, 58, 9, + 13, 32, 33, 37, 39, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 33, 37, 39, 60, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 60, 10, 9, + 32, 13, 34, 92, 127, 0, 8, 10, + 31, 10, 9, 32, 9, 13, 32, 60, + 0, 9, 11, 12, 14, 127, 0 +}; + +static const char _tsip_machine_parser_header_Route_single_lengths[] = { + 0, 2, 2, 2, 2, 2, 3, 9, + 1, 2, 9, 1, 2, 3, 0, 4, + 3, 0, 1, 5, 1, 7, 1, 2, + 6, 10, 6, 1, 2, 5, 9, 1, + 2, 9, 1, 2, 3, 4, 1, 2, + 5, 5, 1, 2, 4, 0, 9, 1, + 2, 2, 2, 2, 1, 3, 0, 1, + 0, 1, 0, 1, 1, 1, 1, 1, + 1, 1, 3, 3, 2, 2, 2, 2, + 2, 0, 3, 3, 3, 0, 1, 1, + 1, 1, 7, 8, 4, 1, 2, 4, + 1, 2, 4, 0, 0 +}; + +static const char _tsip_machine_parser_header_Route_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 5, + 0, 0, 5, 0, 0, 0, 2, 4, + 0, 0, 0, 0, 0, 5, 0, 0, + 5, 4, 0, 0, 0, 0, 5, 0, + 0, 5, 0, 0, 0, 2, 0, 0, + 0, 0, 0, 0, 0, 3, 4, 3, + 3, 3, 3, 0, 3, 3, 1, 1, + 1, 1, 1, 1, 1, 0, 1, 0, + 1, 0, 3, 3, 3, 3, 3, 3, + 0, 3, 3, 3, 3, 1, 1, 1, + 0, 0, 5, 5, 0, 0, 0, 2, + 0, 0, 0, 3, 0 +}; + +static const short _tsip_machine_parser_header_Route_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 15, 19, + 34, 36, 39, 54, 56, 59, 63, 66, + 75, 79, 80, 82, 88, 90, 103, 105, + 108, 120, 135, 142, 144, 147, 153, 168, + 170, 173, 188, 190, 193, 197, 204, 206, + 209, 215, 221, 223, 226, 231, 235, 249, + 254, 260, 266, 272, 275, 280, 287, 289, + 292, 294, 297, 299, 302, 305, 307, 310, + 312, 315, 317, 324, 331, 337, 343, 349, + 355, 358, 362, 369, 376, 383, 385, 388, + 391, 393, 395, 408, 422, 427, 429, 432, + 439, 441, 444, 449, 453 +}; + +static const char _tsip_machine_parser_header_Route_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 5, 5, 1, 5, + 5, 6, 1, 7, 8, 7, 9, 10, + 9, 9, 11, 9, 9, 9, 9, 9, + 9, 1, 12, 1, 13, 13, 1, 14, + 15, 14, 9, 10, 9, 9, 11, 9, + 9, 9, 9, 9, 9, 1, 16, 1, + 17, 17, 1, 17, 17, 18, 1, 19, + 19, 1, 20, 20, 21, 22, 21, 21, + 21, 21, 1, 20, 20, 22, 1, 23, + 24, 23, 25, 26, 25, 27, 28, 1, + 29, 1, 28, 30, 28, 31, 31, 31, + 31, 31, 31, 31, 31, 31, 1, 32, + 1, 33, 33, 1, 33, 33, 31, 31, + 31, 31, 31, 31, 31, 31, 31, 1, + 34, 35, 34, 36, 36, 36, 37, 38, + 39, 36, 36, 36, 36, 36, 1, 40, + 41, 40, 6, 28, 39, 1, 42, 1, + 43, 43, 1, 43, 43, 6, 28, 39, + 1, 39, 44, 39, 45, 46, 45, 45, + 47, 45, 45, 45, 45, 45, 45, 1, + 48, 1, 49, 49, 1, 49, 50, 49, + 45, 46, 45, 45, 47, 45, 45, 45, + 45, 45, 45, 1, 51, 1, 52, 52, + 1, 52, 52, 46, 1, 53, 54, 55, + 1, 1, 1, 46, 56, 1, 46, 46, + 1, 57, 35, 57, 37, 38, 1, 58, + 59, 58, 6, 28, 1, 60, 1, 61, + 61, 1, 61, 61, 6, 28, 1, 46, + 46, 46, 1, 57, 35, 57, 45, 45, + 45, 37, 38, 45, 45, 45, 45, 45, + 1, 63, 62, 62, 62, 1, 65, 54, + 64, 64, 64, 1, 65, 54, 66, 66, + 66, 1, 65, 54, 67, 67, 67, 1, + 65, 54, 1, 69, 68, 62, 62, 1, + 70, 65, 54, 71, 64, 64, 1, 72, + 1, 73, 74, 1, 75, 1, 76, 77, + 1, 78, 1, 54, 79, 1, 54, 80, + 1, 54, 1, 76, 81, 1, 76, 1, + 73, 82, 1, 73, 1, 70, 65, 54, + 83, 66, 66, 1, 70, 65, 54, 67, + 67, 67, 1, 85, 54, 84, 84, 84, + 1, 87, 54, 86, 86, 86, 1, 87, + 54, 88, 88, 88, 1, 87, 54, 89, + 89, 89, 1, 87, 54, 1, 90, 84, + 84, 1, 70, 87, 54, 91, 86, 86, + 1, 70, 87, 54, 92, 88, 88, 1, + 70, 87, 54, 89, 89, 89, 1, 93, + 1, 70, 94, 1, 70, 95, 1, 70, + 1, 69, 1, 96, 97, 96, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 1, + 99, 100, 99, 98, 98, 98, 101, 98, + 98, 98, 98, 98, 98, 1, 102, 103, + 102, 18, 1, 104, 1, 96, 96, 1, + 106, 107, 108, 1, 1, 1, 105, 109, + 1, 105, 105, 1, 99, 100, 99, 101, + 1, 105, 105, 105, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Route_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 7, + 8, 82, 87, 14, 9, 10, 10, 11, + 12, 13, 14, 15, 16, 15, 17, 18, + 19, 19, 20, 7, 21, 92, 22, 25, + 23, 24, 26, 20, 25, 7, 21, 30, + 26, 27, 28, 29, 31, 46, 37, 47, + 32, 33, 34, 35, 36, 38, 40, 45, + 39, 41, 41, 42, 43, 44, 48, 81, + 49, 52, 50, 51, 53, 68, 54, 66, + 55, 56, 64, 57, 58, 62, 59, 60, + 61, 63, 65, 67, 69, 77, 70, 73, + 71, 72, 74, 75, 76, 78, 79, 80, + 83, 85, 82, 84, 11, 14, 84, 11, + 86, 87, 88, 90, 91, 89 +}; + +static const char _tsip_machine_parser_header_Route_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 3, + 3, 15, 15, 3, 0, 0, 3, 3, + 0, 0, 0, 1, 0, 0, 0, 0, + 7, 11, 11, 11, 0, 13, 0, 1, + 0, 0, 18, 18, 0, 18, 9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 18, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 5, 5, 5, 0, 0, + 0, 0, 0, 0, 0, 0 +}; + +static const int tsip_machine_parser_header_Route_start = 1; +static const int tsip_machine_parser_header_Route_first_final = 92; +static const int tsip_machine_parser_header_Route_error = 0; + +static const int tsip_machine_parser_header_Route_en_main = 1; + + +/* #line 152 "./ragel/tsip_parser_header_Route.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Route_first_final); + (void)(tsip_machine_parser_header_Route_error); + (void)(tsip_machine_parser_header_Route_en_main); + +/* #line 330 "./src/headers/tsip_header_Route.c" */ + { + cs = tsip_machine_parser_header_Route_start; + } + +/* #line 157 "./ragel/tsip_parser_header_Route.rl" */ + +/* #line 337 "./src/headers/tsip_header_Route.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Route_trans_keys + _tsip_machine_parser_header_Route_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Route_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Route_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Route_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Route_indicies[_trans]; + cs = _tsip_machine_parser_header_Route_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Route_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Route_actions + _tsip_machine_parser_header_Route_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 51 "./ragel/tsip_parser_header_Route.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 55 "./ragel/tsip_parser_header_Route.rl" */ + { + if(!curr_route){ + curr_route = tsip_header_Route_create_null(); + } + } + break; + case 2: +/* #line 61 "./ragel/tsip_parser_header_Route.rl" */ + { + if(curr_route){ + TSK_PARSER_SET_STRING(curr_route->display_name); + tsk_strunquote(&curr_route->display_name); + } + } + break; + case 3: +/* #line 68 "./ragel/tsip_parser_header_Route.rl" */ + { + if(curr_route && !curr_route->uri){ + int len = (int)(p - tag_start); + if(curr_route && !curr_route->uri){ + if((curr_route->uri = tsip_uri_parse(tag_start, (tsk_size_t)len)) && curr_route->display_name){ + curr_route->uri->display_name = tsk_strdup(curr_route->display_name); + } + } + } + } + break; + case 4: +/* #line 79 "./ragel/tsip_parser_header_Route.rl" */ + { + if(curr_route){ + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(curr_route)); + } + } + break; + case 5: +/* #line 85 "./ragel/tsip_parser_header_Route.rl" */ + { + if(curr_route){ + tsk_list_push_back_data(hdr_routes, ((void**) &curr_route)); + } + } + break; + case 6: +/* #line 91 "./ragel/tsip_parser_header_Route.rl" */ + { + } + break; +/* #line 468 "./src/headers/tsip_header_Route.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 158 "./ragel/tsip_parser_header_Route.rl" */ + + if( cs < +/* #line 484 "./src/headers/tsip_header_Route.c" */ +92 +/* #line 159 "./ragel/tsip_parser_header_Route.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Route' header."); + TSK_OBJECT_SAFE_FREE(curr_route); + TSK_OBJECT_SAFE_FREE(hdr_routes); + } + + return hdr_routes; +} + + + + + +//======================================================== +// Route header object definition +// + +static tsk_object_t* tsip_header_Route_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Route_t *Route = self; + if(Route){ + const tsip_uri_t* uri = va_arg(*app, const tsip_uri_t*); + + TSIP_HEADER(Route)->type = tsip_htype_Route; + TSIP_HEADER(Route)->serialize = tsip_header_Route_serialize; + + if(uri){ + Route->uri = tsk_object_ref((void*)uri); + } + } + else{ + TSK_DEBUG_ERROR("Failed to create new Route header."); + } + return self; +} + +static tsk_object_t* tsip_header_Route_dtor(tsk_object_t *self) +{ + tsip_header_Route_t *Route = self; + if(Route){ + TSK_FREE(Route->display_name); + TSK_OBJECT_SAFE_FREE(Route->uri); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Route)); + } + else{ + TSK_DEBUG_ERROR("Null Route header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Route_def_s = +{ + sizeof(tsip_header_Route_t), + tsip_header_Route_ctor, + tsip_header_Route_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Route_def_t = &tsip_header_Route_def_s; diff --git a/tinySIP/src/headers/tsip_header_SIP_ETag.c b/tinySIP/src/headers/tsip_header_SIP_ETag.c new file mode 100644 index 0000000..f48a26a --- /dev/null +++ b/tinySIP/src/headers/tsip_header_SIP_ETag.c @@ -0,0 +1,333 @@ + +/* #line 1 "./ragel/tsip_parser_header_SIP_ETag.rl" */ + +/* +* 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 tsip_header_SIP_ETag.c + * @brief SIP SIP-ETag header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_SIP_ETag.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 67 "./ragel/tsip_parser_header_SIP_ETag.rl" */ + + +tsip_header_SIP_ETag_t* tsip_header_SIP_ETag_create(const char* etag) +{ + return tsk_object_new(TSIP_HEADER_SIP_ETAG_VA_ARGS(etag)); +} + +tsip_header_SIP_ETag_t* tsip_header_SIP_ETag_create_null() +{ + return tsip_header_SIP_ETag_create(tsk_null); +} + +int tsip_header_SIP_ETag_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_SIP_ETag_t *SIP_ETag = (const tsip_header_SIP_ETag_t *)header; + if(SIP_ETag->value){ + return tsk_buffer_append(output, SIP_ETag->value, tsk_strlen(SIP_ETag->value)); + } + return 0; + } + + return -1; +} + +tsip_header_SIP_ETag_t *tsip_header_SIP_ETag_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_SIP_ETag_t *hdr_etag = tsip_header_SIP_ETag_create_null(); + + const char *tag_start = tsk_null; + + +/* #line 86 "./src/headers/tsip_header_SIP_ETag.c" */ +static const char _tsip_machine_parser_header_SIP_ETag_actions[] = { + 0, 1, 0, 1, 1, 1, 2 +}; + +static const char _tsip_machine_parser_header_SIP_ETag_key_offsets[] = { + 0, 0, 2, 4, 6, 7, 9, 11, + 13, 15, 18, 35, 36, 38, 54, 69, + 70 +}; + +static const char _tsip_machine_parser_header_SIP_ETag_trans_keys[] = { + 83, 115, 73, 105, 80, 112, 45, 69, + 101, 84, 116, 65, 97, 71, 103, 9, + 32, 58, 9, 13, 32, 33, 37, 39, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 10, 9, 32, 9, 32, + 33, 37, 39, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 13, 33, + 37, 39, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 0 +}; + +static const char _tsip_machine_parser_header_SIP_ETag_single_lengths[] = { + 0, 2, 2, 2, 1, 2, 2, 2, + 2, 3, 7, 1, 2, 6, 5, 1, + 0 +}; + +static const char _tsip_machine_parser_header_SIP_ETag_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 0, 5, 5, 0, + 0 +}; + +static const char _tsip_machine_parser_header_SIP_ETag_index_offsets[] = { + 0, 0, 3, 6, 9, 11, 14, 17, + 20, 23, 27, 40, 42, 45, 57, 68, + 70 +}; + +static const char _tsip_machine_parser_header_SIP_ETag_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 1, 5, 5, 1, 6, 6, + 1, 7, 7, 1, 8, 8, 1, 8, + 8, 9, 1, 9, 10, 9, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 1, + 12, 1, 13, 13, 1, 13, 13, 11, + 11, 11, 11, 11, 11, 11, 11, 11, + 1, 14, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 1, 16, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_SIP_ETag_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 14, 12, 13, 15, 14, + 16 +}; + +static const char _tsip_machine_parser_header_SIP_ETag_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 3, 0, + 5 +}; + +static const int tsip_machine_parser_header_SIP_ETag_start = 1; +static const int tsip_machine_parser_header_SIP_ETag_first_final = 16; +static const int tsip_machine_parser_header_SIP_ETag_error = 0; + +static const int tsip_machine_parser_header_SIP_ETag_en_main = 1; + + +/* #line 103 "./ragel/tsip_parser_header_SIP_ETag.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_SIP_ETag_first_final); + (void)(tsip_machine_parser_header_SIP_ETag_error); + (void)(tsip_machine_parser_header_SIP_ETag_en_main); + +/* #line 164 "./src/headers/tsip_header_SIP_ETag.c" */ + { + cs = tsip_machine_parser_header_SIP_ETag_start; + } + +/* #line 108 "./ragel/tsip_parser_header_SIP_ETag.rl" */ + +/* #line 171 "./src/headers/tsip_header_SIP_ETag.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_SIP_ETag_trans_keys + _tsip_machine_parser_header_SIP_ETag_key_offsets[cs]; + _trans = _tsip_machine_parser_header_SIP_ETag_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_SIP_ETag_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_SIP_ETag_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_SIP_ETag_indicies[_trans]; + cs = _tsip_machine_parser_header_SIP_ETag_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_SIP_ETag_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_SIP_ETag_actions + _tsip_machine_parser_header_SIP_ETag_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 51 "./ragel/tsip_parser_header_SIP_ETag.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 55 "./ragel/tsip_parser_header_SIP_ETag.rl" */ + { + TSK_PARSER_SET_STRING(hdr_etag->value); + } + break; + case 2: +/* #line 59 "./ragel/tsip_parser_header_SIP_ETag.rl" */ + { + } + break; +/* #line 262 "./src/headers/tsip_header_SIP_ETag.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 109 "./ragel/tsip_parser_header_SIP_ETag.rl" */ + + if( cs < +/* #line 278 "./src/headers/tsip_header_SIP_ETag.c" */ +16 +/* #line 110 "./ragel/tsip_parser_header_SIP_ETag.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'SIP-ETag' header."); + TSK_OBJECT_SAFE_FREE(hdr_etag); + } + + return hdr_etag; +} + + + + + + + +//======================================================== +// SIP_ETag header object definition +// + +static tsk_object_t* tsip_header_SIP_ETag_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_SIP_ETag_t *SIP_ETag = self; + if(SIP_ETag){ + TSIP_HEADER(SIP_ETag)->type = tsip_htype_SIP_ETag; + TSIP_HEADER(SIP_ETag)->serialize = tsip_header_SIP_ETag_serialize; + SIP_ETag->value = tsk_strdup(va_arg(*app, const char*)); + } + else{ + TSK_DEBUG_ERROR("Failed to create new SIP_ETag header."); + } + return self; +} + +static tsk_object_t* tsip_header_SIP_ETag_dtor(tsk_object_t *self) +{ + tsip_header_SIP_ETag_t *SIP_ETag = self; + if(SIP_ETag){ + TSK_FREE(SIP_ETag->value); + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(SIP_ETag)); + } + else{ + TSK_DEBUG_ERROR("Null SIP_ETag header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_SIP_ETag_def_s = +{ + sizeof(tsip_header_SIP_ETag_t), + tsip_header_SIP_ETag_ctor, + tsip_header_SIP_ETag_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_SIP_ETag_def_t = &tsip_header_SIP_ETag_def_s; diff --git a/tinySIP/src/headers/tsip_header_SIP_If_Match.c b/tinySIP/src/headers/tsip_header_SIP_If_Match.c new file mode 100644 index 0000000..9bcc1c1 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_SIP_If_Match.c @@ -0,0 +1,338 @@ + +/* #line 1 "./ragel/tsip_parser_header_SIP_If_Match.rl" */ + +/* +* 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 tsip_header_SIP_If_Match.c + * @brief SIP SIP-If-Match header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_SIP_If_Match.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 67 "./ragel/tsip_parser_header_SIP_If_Match.rl" */ + + + +tsip_header_SIP_If_Match_t* tsip_header_SIP_If_Match_create(const char* etag) +{ + return tsk_object_new(TSIP_HEADER_SIP_IF_MATCH_VA_ARGS(etag)); +} + +tsip_header_SIP_If_Match_t* tsip_header_SIP_If_Match_create_null() +{ + return tsip_header_SIP_If_Match_create(tsk_null); +} + +int tsip_header_SIP_If_Match_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_SIP_If_Match_t *SIP_If_Match = (const tsip_header_SIP_If_Match_t *)header; + if(SIP_If_Match->value){ + return tsk_buffer_append(output, SIP_If_Match->value, tsk_strlen(SIP_If_Match->value)); + } + return 0; + } + + return -1; +} + +tsip_header_SIP_If_Match_t *tsip_header_SIP_If_Match_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_SIP_If_Match_t *hdr_ifmatch = tsip_header_SIP_If_Match_create_null(); + + const char *tag_start = tsk_null; + + +/* #line 87 "./src/headers/tsip_header_SIP_If_Match.c" */ +static const char _tsip_machine_parser_header_SIP_If_Match_actions[] = { + 0, 1, 0, 1, 1, 1, 2 +}; + +static const char _tsip_machine_parser_header_SIP_If_Match_key_offsets[] = { + 0, 0, 2, 4, 6, 7, 9, 11, + 12, 14, 16, 18, 20, 22, 25, 42, + 43, 45, 61, 76, 77 +}; + +static const char _tsip_machine_parser_header_SIP_If_Match_trans_keys[] = { + 83, 115, 73, 105, 80, 112, 45, 73, + 105, 70, 102, 45, 77, 109, 65, 97, + 84, 116, 67, 99, 72, 104, 9, 32, + 58, 9, 13, 32, 33, 37, 39, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 10, 9, 32, 9, 32, 33, + 37, 39, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 13, 33, 37, + 39, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 10, 0 +}; + +static const char _tsip_machine_parser_header_SIP_If_Match_single_lengths[] = { + 0, 2, 2, 2, 1, 2, 2, 1, + 2, 2, 2, 2, 2, 3, 7, 1, + 2, 6, 5, 1, 0 +}; + +static const char _tsip_machine_parser_header_SIP_If_Match_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 5, 0, + 0, 5, 5, 0, 0 +}; + +static const char _tsip_machine_parser_header_SIP_If_Match_index_offsets[] = { + 0, 0, 3, 6, 9, 11, 14, 17, + 19, 22, 25, 28, 31, 34, 38, 51, + 53, 56, 68, 79, 81 +}; + +static const char _tsip_machine_parser_header_SIP_If_Match_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 1, 5, 5, 1, 6, 6, + 1, 7, 1, 8, 8, 1, 9, 9, + 1, 10, 10, 1, 11, 11, 1, 12, + 12, 1, 12, 12, 13, 1, 13, 14, + 13, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 1, 16, 1, 17, 17, 1, + 17, 17, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 1, 18, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 1, 20, + 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_SIP_If_Match_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 18, + 16, 17, 19, 18, 20 +}; + +static const char _tsip_machine_parser_header_SIP_If_Match_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1, + 0, 0, 3, 0, 5 +}; + +static const int tsip_machine_parser_header_SIP_If_Match_start = 1; +static const int tsip_machine_parser_header_SIP_If_Match_first_final = 20; +static const int tsip_machine_parser_header_SIP_If_Match_error = 0; + +static const int tsip_machine_parser_header_SIP_If_Match_en_main = 1; + + +/* #line 104 "./ragel/tsip_parser_header_SIP_If_Match.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_SIP_If_Match_first_final); + (void)(tsip_machine_parser_header_SIP_If_Match_error); + (void)(tsip_machine_parser_header_SIP_If_Match_en_main); + +/* #line 168 "./src/headers/tsip_header_SIP_If_Match.c" */ + { + cs = tsip_machine_parser_header_SIP_If_Match_start; + } + +/* #line 109 "./ragel/tsip_parser_header_SIP_If_Match.rl" */ + +/* #line 175 "./src/headers/tsip_header_SIP_If_Match.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_SIP_If_Match_trans_keys + _tsip_machine_parser_header_SIP_If_Match_key_offsets[cs]; + _trans = _tsip_machine_parser_header_SIP_If_Match_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_SIP_If_Match_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_SIP_If_Match_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_SIP_If_Match_indicies[_trans]; + cs = _tsip_machine_parser_header_SIP_If_Match_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_SIP_If_Match_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_SIP_If_Match_actions + _tsip_machine_parser_header_SIP_If_Match_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 51 "./ragel/tsip_parser_header_SIP_If_Match.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 55 "./ragel/tsip_parser_header_SIP_If_Match.rl" */ + { + TSK_PARSER_SET_STRING(hdr_ifmatch->value); + } + break; + case 2: +/* #line 59 "./ragel/tsip_parser_header_SIP_If_Match.rl" */ + { + } + break; +/* #line 266 "./src/headers/tsip_header_SIP_If_Match.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 110 "./ragel/tsip_parser_header_SIP_If_Match.rl" */ + + if( cs < +/* #line 282 "./src/headers/tsip_header_SIP_If_Match.c" */ +20 +/* #line 111 "./ragel/tsip_parser_header_SIP_If_Match.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'SIP-If-Match' header."); + TSK_OBJECT_SAFE_FREE(hdr_ifmatch); + } + + return hdr_ifmatch; +} + + + + + + + +//======================================================== +// SIP_If_Match header object definition +// + +static tsk_object_t* tsip_header_SIP_If_Match_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_SIP_If_Match_t *SIP_If_Match = self; + if(SIP_If_Match){ + TSIP_HEADER(SIP_If_Match)->type = tsip_htype_SIP_If_Match; + TSIP_HEADER(SIP_If_Match)->serialize = tsip_header_SIP_If_Match_serialize; + SIP_If_Match->value = tsk_strdup(va_arg(*app, const char*)); + } + else{ + TSK_DEBUG_ERROR("Failed to create new SIP_If_Match header."); + } + return self; +} + +static tsk_object_t* tsip_header_SIP_If_Match_dtor(tsk_object_t *self) +{ + tsip_header_SIP_If_Match_t *SIP_If_Match = self; + if(SIP_If_Match){ + TSK_FREE(SIP_If_Match->value); + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(SIP_If_Match)); + } + else{ + TSK_DEBUG_ERROR("Null SIP_If_Match header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_SIP_If_Match_def_s = +{ + sizeof(tsip_header_SIP_If_Match_t), + tsip_header_SIP_If_Match_ctor, + tsip_header_SIP_If_Match_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_SIP_If_Match_def_t = &tsip_header_SIP_If_Match_def_s; + diff --git a/tinySIP/src/headers/tsip_header_Security_Client.c b/tinySIP/src/headers/tsip_header_Security_Client.c new file mode 100644 index 0000000..4f5c47e --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Security_Client.c @@ -0,0 +1,969 @@ + +/* #line 1 "./ragel/tsip_parser_header_Security_Client.rl" */ +/* +* 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 tsip_header_Security_Client.c + * @brief SIP Security-Client header as per RFC 3329. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Security_Client.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_time.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 147 "./ragel/tsip_parser_header_Security_Client.rl" */ + + +tsip_header_Security_Client_t* tsip_header_Security_Client_create(const char* mech, const char* alg, const char* prot, const char* mod, const char* ealg, tnet_port_t port_c, tnet_port_t port_s, uint32_t spi_c, uint32_t spi_s) +{ + return tsk_object_new(TSIP_HEADER_SECURITY_CLIENT_VA_ARGS(mech, alg, prot, mod, ealg, port_c, port_s, spi_c, spi_s)); +} + +tsip_header_Security_Client_t* tsip_header_Security_Client_create_null() +{ + return tsip_header_Security_Client_create(tsk_null, tsk_null, tsk_null, tsk_null, tsk_null, 0, 0, 0, 0); +} + + +int tsip_header_Security_Client_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Security_Client_t *Security_Client = (const tsip_header_Security_Client_t *)header; + int ret = 0; + + // ipsec-3gpp; alg=hmac-md5-96; ealg=des-ede3-cbc; mod=trans; spi-c=1111; spi-s=2222; port-c=5062; port-s=5064 + if(tsk_striequals(Security_Client->mech, "ipsec-3gpp")){ + ret = tsk_buffer_append_2(output, "%s%s%s%s%s%s%s%s%s;spi-c=%u;spi-s=%u;port-c=%u;port-s=%u", + Security_Client->mech, + + Security_Client->alg ? ";alg=" : "", + Security_Client->alg ? Security_Client->alg : "", + + Security_Client->ealg ? ";ealg=" : "", + Security_Client->ealg ? Security_Client->ealg : "", + + Security_Client->prot ? ";prot=" : "", + Security_Client->prot ? Security_Client->prot : "", + + Security_Client->prot ? ";mod=" : "", + Security_Client->prot ? Security_Client->mod : "", + + Security_Client->spi_c, + Security_Client->spi_s, + Security_Client->port_c, + Security_Client->port_s + ); + } + else if(Security_Client->mech){ + ret = tsk_buffer_append(output, Security_Client->mech, tsk_strlen(Security_Client->mech)); + } + + if(Security_Client->q >= 0){ + /* qvalue = ("0" [ "." 0*3DIGIT ] ) / ( "1" [ "." 0*3("0") ] ) */ + ret = tsk_buffer_append_2(output, ";q=%1.3f", Security_Client->q); + } + + return ret; + } + + return -1; +} + +tsip_header_Security_Clients_L_t *tsip_header_Security_Client_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Security_Clients_L_t *hdr_securityclients = tsk_list_create(); + + const char *tag_start = tsk_null; + tsip_header_Security_Client_t *curr_securityclient = tsk_null; + + +/* #line 116 "./src/headers/tsip_header_Security_Client.c" */ +static const char _tsip_machine_parser_header_Security_Client_actions[] = { + 0, 1, 0, 1, 3, 1, 4, 1, + 5, 1, 6, 1, 7, 1, 8, 1, + 9, 1, 10, 1, 11, 1, 12, 1, + 13, 2, 1, 0, 2, 3, 2, 2, + 4, 2, 2, 5, 2, 2, 6, 2, + 2, 7, 2, 2, 8, 2, 2, 9, + 2, 2, 10, 2, 2, 11, 2, 2, + 12, 2 +}; + +static const short _tsip_machine_parser_header_Security_Client_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 12, + 14, 16, 17, 19, 21, 23, 25, 27, + 29, 32, 49, 50, 52, 68, 85, 90, + 91, 93, 97, 124, 125, 127, 153, 171, + 177, 178, 180, 185, 204, 205, 207, 226, + 227, 229, 232, 240, 241, 243, 248, 249, + 255, 272, 279, 287, 295, 303, 305, 312, + 321, 323, 326, 328, 331, 333, 336, 339, + 340, 343, 344, 347, 348, 357, 366, 374, + 382, 390, 398, 400, 406, 415, 424, 433, + 435, 438, 441, 442, 443, 463, 483, 501, + 507, 508, 510, 515, 534, 535, 537, 556, + 573, 593, 613, 633, 651, 657, 658, 660, + 665, 684, 685, 687, 706, 723, 745, 765, + 785, 804, 826, 844, 850, 851, 853, 858, + 877, 878, 880, 899, 906, 924, 930, 931, + 933, 938, 957, 958, 960, 979, 986, 1006, + 1026, 1044, 1050, 1051, 1053, 1058, 1077, 1078, + 1080, 1099, 1116, 1134, 1140, 1141, 1143, 1148, + 1169, 1170, 1172, 1193, 1199, 1206, 1213, 1220, + 1225, 1231, 1237, 1243, 1249, 1269, 1289, 1308, + 1330, 1348, 1354, 1355, 1357, 1362, 1381, 1382, + 1384, 1403, 1410, 1428, 1434, 1435, 1437, 1442, + 1461, 1462, 1464, 1483, 1490 +}; + +static const char _tsip_machine_parser_header_Security_Client_trans_keys[] = { + 83, 115, 69, 101, 67, 99, 85, 117, + 82, 114, 73, 105, 84, 116, 89, 121, + 45, 67, 99, 76, 108, 73, 105, 69, + 101, 78, 110, 84, 116, 9, 32, 58, + 9, 13, 32, 33, 37, 39, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 10, 9, 32, 9, 32, 33, 37, + 39, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 59, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 44, 59, 10, 9, 32, 9, 32, 44, + 59, 9, 13, 32, 33, 37, 39, 65, + 69, 80, 81, 83, 97, 101, 112, 113, + 115, 126, 42, 43, 45, 46, 48, 57, + 66, 90, 95, 122, 10, 9, 32, 9, + 32, 33, 37, 39, 65, 69, 80, 81, + 83, 97, 101, 112, 113, 115, 126, 42, + 43, 45, 46, 48, 57, 66, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 44, 59, + 61, 10, 9, 32, 9, 32, 44, 59, + 61, 9, 13, 32, 33, 34, 37, 39, + 91, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 10, 9, 32, 9, + 13, 32, 33, 34, 37, 39, 91, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 10, 9, 32, 9, 32, 34, + 13, 34, 92, 127, 0, 8, 10, 31, + 10, 9, 32, 9, 13, 32, 44, 59, + 10, 0, 9, 11, 12, 14, 127, 9, + 13, 32, 33, 37, 39, 44, 59, 126, + 42, 46, 48, 57, 65, 90, 95, 122, + 58, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 58, 48, 57, 65, 70, 97, 102, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 48, 57, 46, 48, 57, 48, 57, + 46, 48, 57, 48, 57, 93, 48, 57, + 93, 48, 57, 93, 46, 48, 57, 46, + 46, 48, 57, 46, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 46, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 46, 58, + 93, 48, 57, 65, 70, 97, 102, 46, + 58, 93, 48, 57, 65, 70, 97, 102, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 48, 57, 46, 48, 57, 46, 48, + 57, 46, 58, 9, 13, 32, 33, 37, + 39, 44, 59, 61, 76, 108, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 44, 59, 61, + 71, 103, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 44, 59, 61, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 44, 59, 61, 10, 9, 32, 9, 32, + 44, 59, 61, 9, 13, 32, 33, 34, + 37, 39, 91, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 10, 9, + 32, 9, 13, 32, 33, 34, 37, 39, + 91, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 59, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 59, 61, 65, 97, + 126, 42, 46, 48, 57, 66, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 76, 108, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 59, 61, 71, 103, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 44, 59, + 61, 10, 9, 32, 9, 32, 44, 59, + 61, 9, 13, 32, 33, 34, 37, 39, + 91, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 10, 9, 32, 9, + 13, 32, 33, 34, 37, 39, 91, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 44, 59, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 44, 59, 61, 79, 82, 111, 114, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 82, 114, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 59, 61, 84, 116, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 45, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 59, 61, 67, 83, 99, + 115, 126, 42, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 44, + 59, 61, 10, 9, 32, 9, 32, 44, + 59, 61, 9, 13, 32, 33, 34, 37, + 39, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 13, 32, 33, 34, 37, 39, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 44, 59, + 48, 57, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 44, + 59, 61, 10, 9, 32, 9, 32, 44, + 59, 61, 9, 13, 32, 33, 34, 37, + 39, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 13, 32, 33, 34, 37, 39, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 44, 59, + 48, 57, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 79, 111, 126, 42, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 44, 59, 61, 84, + 116, 126, 42, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 44, + 59, 61, 10, 9, 32, 9, 32, 44, + 59, 61, 9, 13, 32, 33, 34, 37, + 39, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 13, 32, 33, 34, 37, 39, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 44, 59, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 59, 61, 126, 42, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 44, 59, 61, 10, 9, 32, 9, + 32, 44, 59, 61, 9, 13, 32, 33, + 34, 37, 39, 48, 49, 91, 126, 42, + 43, 45, 46, 50, 57, 65, 90, 95, + 122, 10, 9, 32, 9, 13, 32, 33, + 34, 37, 39, 48, 49, 91, 126, 42, + 43, 45, 46, 50, 57, 65, 90, 95, + 122, 9, 13, 32, 44, 46, 59, 9, + 13, 32, 44, 59, 48, 57, 9, 13, + 32, 44, 59, 48, 57, 9, 13, 32, + 44, 59, 48, 57, 9, 13, 32, 44, + 59, 9, 13, 32, 44, 46, 59, 9, + 13, 32, 44, 48, 59, 9, 13, 32, + 44, 48, 59, 9, 13, 32, 44, 48, + 59, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 80, 112, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 59, 61, 73, 105, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 45, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 59, 61, 67, 83, 99, + 115, 126, 42, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 44, + 59, 61, 10, 9, 32, 9, 32, 44, + 59, 61, 9, 13, 32, 33, 34, 37, + 39, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 13, 32, 33, 34, 37, 39, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 44, 59, + 48, 57, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 44, + 59, 61, 10, 9, 32, 9, 32, 44, + 59, 61, 9, 13, 32, 33, 34, 37, + 39, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 13, 32, 33, 34, 37, 39, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 44, 59, + 48, 57, 0 +}; + +static const char _tsip_machine_parser_header_Security_Client_single_lengths[] = { + 0, 2, 2, 2, 2, 2, 2, 2, + 2, 1, 2, 2, 2, 2, 2, 2, + 3, 7, 1, 2, 6, 9, 5, 1, + 2, 4, 17, 1, 2, 16, 10, 6, + 1, 2, 5, 9, 1, 2, 9, 1, + 2, 3, 4, 1, 2, 5, 1, 0, + 9, 1, 2, 2, 2, 2, 1, 3, + 0, 1, 0, 1, 0, 1, 1, 1, + 1, 1, 1, 1, 3, 3, 2, 2, + 2, 2, 2, 0, 3, 3, 3, 0, + 1, 1, 1, 1, 12, 12, 10, 6, + 1, 2, 5, 9, 1, 2, 9, 9, + 12, 12, 12, 10, 6, 1, 2, 5, + 9, 1, 2, 9, 9, 14, 12, 12, + 11, 14, 10, 6, 1, 2, 5, 9, + 1, 2, 9, 5, 10, 6, 1, 2, + 5, 9, 1, 2, 9, 5, 12, 12, + 10, 6, 1, 2, 5, 9, 1, 2, + 9, 9, 10, 6, 1, 2, 5, 11, + 1, 2, 11, 6, 5, 5, 5, 5, + 6, 6, 6, 6, 12, 12, 11, 14, + 10, 6, 1, 2, 5, 9, 1, 2, + 9, 5, 10, 6, 1, 2, 5, 9, + 1, 2, 9, 5, 0 +}; + +static const char _tsip_machine_parser_header_Security_Client_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 0, 0, 5, 4, 0, 0, + 0, 0, 5, 0, 0, 5, 4, 0, + 0, 0, 0, 5, 0, 0, 5, 0, + 0, 0, 2, 0, 0, 0, 0, 3, + 4, 3, 3, 3, 3, 0, 3, 3, + 1, 1, 1, 1, 1, 1, 1, 0, + 1, 0, 1, 0, 3, 3, 3, 3, + 3, 3, 0, 3, 3, 3, 3, 1, + 1, 1, 0, 0, 4, 4, 4, 0, + 0, 0, 0, 5, 0, 0, 5, 4, + 4, 4, 4, 4, 0, 0, 0, 0, + 5, 0, 0, 5, 4, 4, 4, 4, + 4, 4, 4, 0, 0, 0, 0, 5, + 0, 0, 5, 1, 4, 0, 0, 0, + 0, 5, 0, 0, 5, 1, 4, 4, + 4, 0, 0, 0, 0, 5, 0, 0, + 5, 4, 4, 0, 0, 0, 0, 5, + 0, 0, 5, 0, 1, 1, 1, 0, + 0, 0, 0, 0, 4, 4, 4, 4, + 4, 0, 0, 0, 0, 5, 0, 0, + 5, 1, 4, 0, 0, 0, 0, 5, + 0, 0, 5, 1, 0 +}; + +static const short _tsip_machine_parser_header_Security_Client_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 15, 18, + 21, 24, 26, 29, 32, 35, 38, 41, + 44, 48, 61, 63, 66, 78, 92, 98, + 100, 103, 108, 131, 133, 136, 158, 173, + 180, 182, 185, 191, 206, 208, 211, 226, + 228, 231, 235, 242, 244, 247, 253, 255, + 259, 273, 278, 284, 290, 296, 299, 304, + 311, 313, 316, 318, 321, 323, 326, 329, + 331, 334, 336, 339, 341, 348, 355, 361, + 367, 373, 379, 382, 386, 393, 400, 407, + 409, 412, 415, 417, 419, 436, 453, 468, + 475, 477, 480, 486, 501, 503, 506, 521, + 535, 552, 569, 586, 601, 608, 610, 613, + 619, 634, 636, 639, 654, 668, 687, 704, + 721, 737, 756, 771, 778, 780, 783, 789, + 804, 806, 809, 824, 831, 846, 853, 855, + 858, 864, 879, 881, 884, 899, 906, 923, + 940, 955, 962, 964, 967, 973, 988, 990, + 993, 1008, 1022, 1037, 1044, 1046, 1049, 1055, + 1072, 1074, 1077, 1094, 1101, 1108, 1115, 1122, + 1128, 1135, 1142, 1149, 1156, 1173, 1190, 1206, + 1225, 1240, 1247, 1249, 1252, 1258, 1273, 1275, + 1278, 1293, 1300, 1315, 1322, 1324, 1327, 1333, + 1348, 1350, 1353, 1368, 1375 +}; + +static const unsigned char _tsip_machine_parser_header_Security_Client_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 5, 5, 1, 6, + 6, 1, 7, 7, 1, 8, 8, 1, + 9, 1, 10, 10, 1, 11, 11, 1, + 12, 12, 1, 13, 13, 1, 14, 14, + 1, 15, 15, 1, 15, 15, 16, 1, + 16, 17, 16, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 1, 19, 1, 20, + 20, 1, 20, 20, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 1, 21, 22, + 21, 23, 23, 23, 24, 25, 23, 23, + 23, 23, 23, 1, 26, 27, 26, 16, + 28, 1, 29, 1, 30, 30, 1, 30, + 30, 16, 28, 1, 28, 31, 28, 32, + 32, 32, 33, 34, 35, 36, 37, 33, + 34, 35, 36, 37, 32, 32, 32, 32, + 32, 32, 1, 38, 1, 39, 39, 1, + 39, 39, 32, 32, 32, 33, 34, 35, + 36, 37, 33, 34, 35, 36, 37, 32, + 32, 32, 32, 32, 32, 1, 40, 41, + 40, 42, 42, 42, 43, 44, 45, 42, + 42, 42, 42, 42, 1, 46, 47, 46, + 16, 28, 45, 1, 48, 1, 49, 49, + 1, 49, 49, 16, 28, 45, 1, 45, + 50, 45, 51, 52, 51, 51, 53, 51, + 51, 51, 51, 51, 51, 1, 54, 1, + 55, 55, 1, 55, 56, 55, 51, 52, + 51, 51, 53, 51, 51, 51, 51, 51, + 51, 1, 57, 1, 58, 58, 1, 58, + 58, 52, 1, 59, 60, 61, 1, 1, + 1, 52, 62, 1, 52, 52, 1, 63, + 41, 63, 43, 44, 1, 64, 1, 52, + 52, 52, 1, 63, 41, 63, 51, 51, + 51, 43, 44, 51, 51, 51, 51, 51, + 1, 66, 65, 65, 65, 1, 68, 60, + 67, 67, 67, 1, 68, 60, 69, 69, + 69, 1, 68, 60, 70, 70, 70, 1, + 68, 60, 1, 72, 71, 65, 65, 1, + 73, 68, 60, 74, 67, 67, 1, 75, + 1, 76, 77, 1, 78, 1, 79, 80, + 1, 81, 1, 60, 82, 1, 60, 83, + 1, 60, 1, 79, 84, 1, 79, 1, + 76, 85, 1, 76, 1, 73, 68, 60, + 86, 69, 69, 1, 73, 68, 60, 70, + 70, 70, 1, 88, 60, 87, 87, 87, + 1, 90, 60, 89, 89, 89, 1, 90, + 60, 91, 91, 91, 1, 90, 60, 92, + 92, 92, 1, 90, 60, 1, 93, 87, + 87, 1, 73, 90, 60, 94, 89, 89, + 1, 73, 90, 60, 95, 91, 91, 1, + 73, 90, 60, 92, 92, 92, 1, 96, + 1, 73, 97, 1, 73, 98, 1, 73, + 1, 72, 1, 40, 41, 40, 42, 42, + 42, 43, 44, 45, 99, 99, 42, 42, + 42, 42, 42, 1, 40, 41, 40, 42, + 42, 42, 43, 44, 45, 100, 100, 42, + 42, 42, 42, 42, 1, 101, 41, 101, + 42, 42, 42, 43, 44, 102, 42, 42, + 42, 42, 42, 1, 103, 104, 103, 16, + 28, 102, 1, 105, 1, 106, 106, 1, + 106, 106, 16, 28, 102, 1, 102, 107, + 102, 108, 52, 108, 108, 53, 108, 108, + 108, 108, 108, 108, 1, 109, 1, 110, + 110, 1, 110, 56, 110, 108, 52, 108, + 108, 53, 108, 108, 108, 108, 108, 108, + 1, 111, 112, 111, 113, 113, 113, 114, + 115, 113, 113, 113, 113, 113, 1, 40, + 41, 40, 42, 42, 42, 43, 44, 45, + 116, 116, 42, 42, 42, 42, 42, 1, + 40, 41, 40, 42, 42, 42, 43, 44, + 45, 117, 117, 42, 42, 42, 42, 42, + 1, 40, 41, 40, 42, 42, 42, 43, + 44, 45, 118, 118, 42, 42, 42, 42, + 42, 1, 119, 41, 119, 42, 42, 42, + 43, 44, 120, 42, 42, 42, 42, 42, + 1, 121, 122, 121, 16, 28, 120, 1, + 123, 1, 124, 124, 1, 124, 124, 16, + 28, 120, 1, 120, 125, 120, 126, 52, + 126, 126, 53, 126, 126, 126, 126, 126, + 126, 1, 127, 1, 128, 128, 1, 128, + 56, 128, 126, 52, 126, 126, 53, 126, + 126, 126, 126, 126, 126, 1, 129, 130, + 129, 131, 131, 131, 132, 133, 131, 131, + 131, 131, 131, 1, 40, 41, 40, 42, + 42, 42, 43, 44, 45, 134, 135, 134, + 135, 42, 42, 42, 42, 42, 1, 40, + 41, 40, 42, 42, 42, 43, 44, 45, + 136, 136, 42, 42, 42, 42, 42, 1, + 40, 41, 40, 42, 42, 42, 43, 44, + 45, 137, 137, 42, 42, 42, 42, 42, + 1, 40, 41, 40, 42, 42, 42, 43, + 138, 44, 45, 42, 42, 42, 42, 42, + 1, 40, 41, 40, 42, 42, 42, 43, + 44, 45, 139, 140, 139, 140, 42, 42, + 42, 42, 42, 1, 141, 41, 141, 42, + 42, 42, 43, 44, 142, 42, 42, 42, + 42, 42, 1, 143, 144, 143, 16, 28, + 142, 1, 145, 1, 146, 146, 1, 146, + 146, 16, 28, 142, 1, 142, 147, 142, + 51, 52, 51, 51, 53, 51, 51, 51, + 148, 51, 51, 1, 149, 1, 150, 150, + 1, 150, 56, 150, 51, 52, 51, 51, + 53, 51, 51, 51, 148, 51, 51, 1, + 151, 152, 151, 153, 155, 154, 1, 156, + 41, 156, 42, 42, 42, 43, 44, 157, + 42, 42, 42, 42, 42, 1, 158, 159, + 158, 16, 28, 157, 1, 160, 1, 161, + 161, 1, 161, 161, 16, 28, 157, 1, + 157, 162, 157, 51, 52, 51, 51, 53, + 51, 51, 51, 163, 51, 51, 1, 164, + 1, 165, 165, 1, 165, 56, 165, 51, + 52, 51, 51, 53, 51, 51, 51, 163, + 51, 51, 1, 166, 167, 166, 168, 170, + 169, 1, 40, 41, 40, 42, 42, 42, + 43, 44, 45, 171, 171, 42, 42, 42, + 42, 42, 1, 40, 41, 40, 42, 42, + 42, 43, 44, 45, 172, 172, 42, 42, + 42, 42, 42, 1, 173, 41, 173, 42, + 42, 42, 43, 44, 174, 42, 42, 42, + 42, 42, 1, 175, 176, 175, 16, 28, + 174, 1, 177, 1, 178, 178, 1, 178, + 178, 16, 28, 174, 1, 174, 179, 174, + 180, 52, 180, 180, 53, 180, 180, 180, + 180, 180, 180, 1, 181, 1, 182, 182, + 1, 182, 56, 182, 180, 52, 180, 180, + 53, 180, 180, 180, 180, 180, 180, 1, + 183, 184, 183, 185, 185, 185, 186, 187, + 185, 185, 185, 185, 185, 1, 188, 41, + 188, 42, 42, 42, 43, 44, 189, 42, + 42, 42, 42, 42, 1, 190, 191, 190, + 16, 28, 189, 1, 192, 1, 193, 193, + 1, 193, 193, 16, 28, 189, 1, 189, + 194, 189, 51, 52, 51, 51, 195, 196, + 53, 51, 51, 51, 51, 51, 51, 1, + 197, 1, 198, 198, 1, 198, 56, 198, + 51, 52, 51, 51, 195, 196, 53, 51, + 51, 51, 51, 51, 51, 1, 199, 200, + 199, 201, 202, 203, 1, 199, 200, 199, + 201, 203, 204, 1, 199, 200, 199, 201, + 203, 205, 1, 199, 200, 199, 201, 203, + 206, 1, 199, 200, 199, 201, 203, 1, + 199, 200, 199, 201, 207, 203, 1, 199, + 200, 199, 201, 208, 203, 1, 199, 200, + 199, 201, 209, 203, 1, 199, 200, 199, + 201, 206, 203, 1, 40, 41, 40, 42, + 42, 42, 43, 44, 45, 210, 210, 42, + 42, 42, 42, 42, 1, 40, 41, 40, + 42, 42, 42, 43, 44, 45, 211, 211, + 42, 42, 42, 42, 42, 1, 40, 41, + 40, 42, 42, 42, 43, 212, 44, 45, + 42, 42, 42, 42, 42, 1, 40, 41, + 40, 42, 42, 42, 43, 44, 45, 213, + 214, 213, 214, 42, 42, 42, 42, 42, + 1, 215, 41, 215, 42, 42, 42, 43, + 44, 216, 42, 42, 42, 42, 42, 1, + 217, 218, 217, 16, 28, 216, 1, 219, + 1, 220, 220, 1, 220, 220, 16, 28, + 216, 1, 216, 221, 216, 51, 52, 51, + 51, 53, 51, 51, 51, 222, 51, 51, + 1, 223, 1, 224, 224, 1, 224, 56, + 224, 51, 52, 51, 51, 53, 51, 51, + 51, 222, 51, 51, 1, 225, 226, 225, + 227, 229, 228, 1, 230, 41, 230, 42, + 42, 42, 43, 44, 231, 42, 42, 42, + 42, 42, 1, 232, 233, 232, 16, 28, + 231, 1, 234, 1, 235, 235, 1, 235, + 235, 16, 28, 231, 1, 231, 236, 231, + 51, 52, 51, 51, 53, 51, 51, 51, + 237, 51, 51, 1, 238, 1, 239, 239, + 1, 239, 56, 239, 51, 52, 51, 51, + 53, 51, 51, 51, 237, 51, 51, 1, + 240, 241, 240, 242, 244, 243, 1, 1, + 0 +}; + +static const unsigned char _tsip_machine_parser_header_Security_Client_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 21, 19, 20, 22, 46, 21, + 17, 26, 22, 23, 26, 24, 25, 27, + 30, 84, 96, 109, 146, 164, 28, 29, + 31, 46, 30, 17, 26, 35, 31, 32, + 33, 34, 36, 48, 42, 49, 37, 38, + 39, 40, 41, 43, 45, 47, 44, 22, + 188, 50, 83, 51, 54, 52, 53, 55, + 70, 56, 68, 57, 58, 66, 59, 60, + 64, 61, 62, 63, 65, 67, 69, 71, + 79, 72, 75, 73, 74, 76, 77, 78, + 80, 81, 82, 85, 86, 87, 91, 87, + 88, 89, 90, 92, 95, 93, 94, 22, + 46, 95, 17, 26, 97, 98, 99, 100, + 104, 100, 101, 102, 103, 105, 108, 106, + 107, 22, 46, 108, 17, 26, 110, 134, + 111, 112, 113, 114, 124, 115, 119, 115, + 116, 117, 118, 120, 123, 121, 122, 22, + 46, 17, 123, 26, 125, 129, 125, 126, + 127, 128, 130, 133, 131, 132, 22, 46, + 17, 133, 26, 135, 136, 137, 141, 137, + 138, 139, 140, 142, 145, 143, 144, 22, + 46, 145, 17, 26, 147, 151, 147, 148, + 149, 150, 152, 155, 160, 153, 154, 22, + 46, 17, 156, 26, 157, 158, 159, 161, + 162, 163, 165, 166, 167, 168, 178, 169, + 173, 169, 170, 171, 172, 174, 177, 175, + 176, 22, 46, 17, 177, 26, 179, 183, + 179, 180, 181, 182, 184, 187, 185, 186, + 22, 46, 17, 187, 26 +}; + +static const char _tsip_machine_parser_header_Security_Client_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 25, 0, 0, 28, 28, 0, + 28, 3, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 0, 0, + 55, 55, 0, 55, 21, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 55, + 23, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 55, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 46, + 46, 0, 46, 15, 0, 0, 0, 55, + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 43, 43, 0, 43, 13, 0, 0, + 0, 0, 0, 0, 0, 55, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 34, + 34, 34, 0, 7, 55, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 31, 31, + 31, 0, 5, 0, 0, 55, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 49, + 49, 0, 49, 17, 55, 0, 0, 0, + 0, 0, 0, 1, 1, 0, 0, 52, + 52, 52, 0, 19, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 55, + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 40, 40, 40, 0, 11, 55, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 37, 37, 37, 0, 9 +}; + +static const int tsip_machine_parser_header_Security_Client_start = 1; +static const int tsip_machine_parser_header_Security_Client_first_final = 188; +static const int tsip_machine_parser_header_Security_Client_error = 0; + +static const int tsip_machine_parser_header_Security_Client_en_main = 1; + + +/* #line 213 "./ragel/tsip_parser_header_Security_Client.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Security_Client_first_final); + (void)(tsip_machine_parser_header_Security_Client_error); + (void)(tsip_machine_parser_header_Security_Client_en_main); + +/* #line 683 "./src/headers/tsip_header_Security_Client.c" */ + { + cs = tsip_machine_parser_header_Security_Client_start; + } + +/* #line 218 "./ragel/tsip_parser_header_Security_Client.rl" */ + +/* #line 690 "./src/headers/tsip_header_Security_Client.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Security_Client_trans_keys + _tsip_machine_parser_header_Security_Client_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Security_Client_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Security_Client_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Security_Client_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Security_Client_indicies[_trans]; + cs = _tsip_machine_parser_header_Security_Client_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Security_Client_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Security_Client_actions + _tsip_machine_parser_header_Security_Client_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 51 "./ragel/tsip_parser_header_Security_Client.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 55 "./ragel/tsip_parser_header_Security_Client.rl" */ + { + if(!curr_securityclient){ + curr_securityclient = tsip_header_Security_Client_create_null(); + } + } + break; + case 2: +/* #line 61 "./ragel/tsip_parser_header_Security_Client.rl" */ + { + if(curr_securityclient){ + tsk_list_push_back_data(hdr_securityclients, ((void**) &curr_securityclient)); + } + } + break; + case 3: +/* #line 67 "./ragel/tsip_parser_header_Security_Client.rl" */ + { + if(curr_securityclient){ + TSK_PARSER_SET_STRING(curr_securityclient->mech); + } + } + break; + case 4: +/* #line 73 "./ragel/tsip_parser_header_Security_Client.rl" */ + { + if(curr_securityclient){ + TSK_PARSER_SET_INT(curr_securityclient->port_s); + } + } + break; + case 5: +/* #line 79 "./ragel/tsip_parser_header_Security_Client.rl" */ + { + if(curr_securityclient){ + TSK_PARSER_SET_INT(curr_securityclient->port_c); + } + } + break; + case 6: +/* #line 85 "./ragel/tsip_parser_header_Security_Client.rl" */ + { + if(curr_securityclient){ + TSK_PARSER_SET_UINT(curr_securityclient->spi_s); + } + } + break; + case 7: +/* #line 91 "./ragel/tsip_parser_header_Security_Client.rl" */ + { + if(curr_securityclient){ + TSK_PARSER_SET_UINT(curr_securityclient->spi_c); + } + } + break; + case 8: +/* #line 97 "./ragel/tsip_parser_header_Security_Client.rl" */ + { + if(curr_securityclient){ + TSK_PARSER_SET_STRING(curr_securityclient->ealg); + } + } + break; + case 9: +/* #line 103 "./ragel/tsip_parser_header_Security_Client.rl" */ + { + if(curr_securityclient){ + TSK_PARSER_SET_STRING(curr_securityclient->alg); + } + } + break; + case 10: +/* #line 109 "./ragel/tsip_parser_header_Security_Client.rl" */ + { + if(curr_securityclient){ + TSK_PARSER_SET_STRING(curr_securityclient->prot); + } + } + break; + case 11: +/* #line 115 "./ragel/tsip_parser_header_Security_Client.rl" */ + { + if(curr_securityclient){ + TSK_PARSER_SET_DOUBLE(curr_securityclient->q); + } + } + break; + case 12: +/* #line 121 "./ragel/tsip_parser_header_Security_Client.rl" */ + { + if(curr_securityclient){ + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(curr_securityclient)); + } + } + break; + case 13: +/* #line 127 "./ragel/tsip_parser_header_Security_Client.rl" */ + { + } + break; +/* #line 871 "./src/headers/tsip_header_Security_Client.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 219 "./ragel/tsip_parser_header_Security_Client.rl" */ + + if( cs < +/* #line 887 "./src/headers/tsip_header_Security_Client.c" */ +188 +/* #line 220 "./ragel/tsip_parser_header_Security_Client.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Security-Client' header."); + TSK_OBJECT_SAFE_FREE(curr_securityclient); + TSK_OBJECT_SAFE_FREE(hdr_securityclients); + } + + return hdr_securityclients; +} + + + + + +//======================================================== +// Security_Client header object definition +// + +static tsk_object_t* tsip_header_Security_Client_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Security_Client_t *Security_Client = self; + if(Security_Client){ + const char* mech = va_arg(*app, const char*); + + TSIP_HEADER(Security_Client)->type = tsip_htype_Security_Client; + TSIP_HEADER(Security_Client)->serialize = tsip_header_Security_Client_serialize; + + Security_Client->q = -1; + + if(mech){ + Security_Client->mech = tsk_strdup(mech); + Security_Client->alg = tsk_strdup(va_arg(*app, const char*)); + Security_Client->prot = tsk_strdup(va_arg(*app, const char*)); + Security_Client->mod = tsk_strdup(va_arg(*app, const char*)); + Security_Client->ealg = tsk_strdup(va_arg(*app, const char*)); +#if defined(__GNUC__) + Security_Client->port_c = (tnet_port_t)va_arg(*app, unsigned); + Security_Client->port_s = (tnet_port_t)va_arg(*app, unsigned); +#else + Security_Client->port_c = va_arg(*app, tnet_port_t); + Security_Client->port_s = va_arg(*app, tnet_port_t); +#endif + Security_Client->spi_c = va_arg(*app, uint32_t); + Security_Client->spi_s = va_arg(*app, uint32_t); + } + } + else{ + TSK_DEBUG_ERROR("Failed to create new Security_Client header."); + } + return self; +} + +static tsk_object_t* tsip_header_Security_Client_dtor(tsk_object_t *self) +{ + tsip_header_Security_Client_t *Security_Client = self; + if(Security_Client){ + TSK_FREE(Security_Client->mech); + TSK_FREE(Security_Client->alg); + TSK_FREE(Security_Client->prot); + TSK_FREE(Security_Client->mod); + TSK_FREE(Security_Client->ealg); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Security_Client)); + } + else{ + TSK_DEBUG_ERROR("Null Security_Client header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Security_Client_def_s = +{ + sizeof(tsip_header_Security_Client_t), + tsip_header_Security_Client_ctor, + tsip_header_Security_Client_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Security_Client_def_t = &tsip_header_Security_Client_def_s; diff --git a/tinySIP/src/headers/tsip_header_Security_Server.c b/tinySIP/src/headers/tsip_header_Security_Server.c new file mode 100644 index 0000000..7554571 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Security_Server.c @@ -0,0 +1,949 @@ + +/* #line 1 "./ragel/tsip_parser_header_Security_Server.rl" */ + +/* +* 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 tsip_header_Security_Server.c + * @brief SIP Security-Server header as per RFC 3329. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Security_Server.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_time.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 148 "./ragel/tsip_parser_header_Security_Server.rl" */ + + +tsip_header_Security_Server_t* tsip_header_Security_Server_create() +{ + return tsk_object_new(TSIP_HEADER_SECURITY_SERVER_VA_ARGS()); +} + +tsip_header_Security_Server_t* tsip_header_Security_Server_create_null() +{ + return tsip_header_Security_Server_create(); +} + +int tsip_header_Security_Server_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Security_Server_t *Security_Server = (const tsip_header_Security_Server_t *)header; + int ret = 0; + + // ipsec-3gpp; alg=hmac-md5-96; ealg=des-ede3-cbc; spi-c=1111; spi-s=2222; port-c=5062; port-s=5064 + if(tsk_striequals(Security_Server->mech, "ipsec-3gpp")){ + ret = tsk_buffer_append_2(output, "%s%s%s%s%s%s%s;spi-c=%u;spi-s=%u;port-c=%u;port-s=%u", + Security_Server->mech, + + Security_Server->alg ? ";alg=" : "", + Security_Server->alg ? Security_Server->alg : "", + + Security_Server->ealg ? ";ealg=" : "", + Security_Server->ealg ? Security_Server->ealg : "", + + Security_Server->prot ? ";prot=" : "", + Security_Server->prot ? Security_Server->prot : "", + + Security_Server->spi_c, + Security_Server->spi_s, + Security_Server->port_c, + Security_Server->port_s + ); + } + else if(Security_Server->mech){ + ret = tsk_buffer_append(output, Security_Server->mech, tsk_strlen(Security_Server->mech)); + } + + if(Security_Server->q >= 0){ + /* qvalue = ("0" [ "." 0*3DIGIT ] ) / ( "1" [ "." 0*3("0") ] ) */ + ret = tsk_buffer_append_2(output, ";q=%1.3f", Security_Server->q); + } + + return ret; + } + + return -1; +} + + +tsip_header_Security_Servers_L_t *tsip_header_Security_Server_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Security_Servers_L_t *hdr_securityservers = tsk_list_create(); + + const char *tag_start = tsk_null; + tsip_header_Security_Server_t *curr_securityserver = tsk_null; + + +/* #line 117 "./src/headers/tsip_header_Security_Server.c" */ +static const char _tsip_machine_parser_header_Security_Server_actions[] = { + 0, 1, 0, 1, 3, 1, 4, 1, + 5, 1, 6, 1, 7, 1, 8, 1, + 9, 1, 10, 1, 11, 1, 12, 1, + 13, 2, 1, 0, 2, 3, 2, 2, + 4, 2, 2, 5, 2, 2, 6, 2, + 2, 7, 2, 2, 8, 2, 2, 9, + 2, 2, 10, 2, 2, 11, 2, 2, + 12, 2 +}; + +static const short _tsip_machine_parser_header_Security_Server_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 12, + 14, 16, 17, 19, 21, 23, 25, 27, + 29, 32, 49, 50, 52, 68, 85, 90, + 91, 93, 97, 124, 125, 127, 153, 171, + 177, 178, 180, 185, 204, 205, 207, 226, + 227, 229, 232, 240, 241, 243, 248, 249, + 255, 272, 279, 287, 295, 303, 305, 312, + 321, 323, 326, 328, 331, 333, 336, 339, + 340, 343, 344, 347, 348, 357, 366, 374, + 382, 390, 398, 400, 406, 415, 424, 433, + 435, 438, 441, 442, 443, 463, 483, 501, + 507, 508, 510, 515, 534, 535, 537, 556, + 573, 593, 613, 633, 651, 657, 658, 660, + 665, 684, 685, 687, 706, 723, 745, 765, + 785, 804, 826, 844, 850, 851, 853, 858, + 877, 878, 880, 899, 906, 924, 930, 931, + 933, 938, 957, 958, 960, 979, 986, 1006, + 1026, 1044, 1050, 1051, 1053, 1058, 1077, 1078, + 1080, 1099, 1116, 1134, 1140, 1141, 1143, 1148, + 1169, 1170, 1172, 1193, 1199, 1206, 1213, 1220, + 1225, 1231, 1237, 1243, 1249, 1269, 1289, 1308, + 1330, 1348, 1354, 1355, 1357, 1362, 1381, 1382, + 1384, 1403, 1410, 1428, 1434, 1435, 1437, 1442, + 1461, 1462, 1464, 1483, 1490 +}; + +static const char _tsip_machine_parser_header_Security_Server_trans_keys[] = { + 83, 115, 69, 101, 67, 99, 85, 117, + 82, 114, 73, 105, 84, 116, 89, 121, + 45, 83, 115, 69, 101, 82, 114, 86, + 118, 69, 101, 82, 114, 9, 32, 58, + 9, 13, 32, 33, 37, 39, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 10, 9, 32, 9, 32, 33, 37, + 39, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 59, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 44, 59, 10, 9, 32, 9, 32, 44, + 59, 9, 13, 32, 33, 37, 39, 65, + 69, 80, 81, 83, 97, 101, 112, 113, + 115, 126, 42, 43, 45, 46, 48, 57, + 66, 90, 95, 122, 10, 9, 32, 9, + 32, 33, 37, 39, 65, 69, 80, 81, + 83, 97, 101, 112, 113, 115, 126, 42, + 43, 45, 46, 48, 57, 66, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 44, 59, + 61, 10, 9, 32, 9, 32, 44, 59, + 61, 9, 13, 32, 33, 34, 37, 39, + 91, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 10, 9, 32, 9, + 13, 32, 33, 34, 37, 39, 91, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 10, 9, 32, 9, 32, 34, + 13, 34, 92, 127, 0, 8, 10, 31, + 10, 9, 32, 9, 13, 32, 44, 59, + 10, 0, 9, 11, 12, 14, 127, 9, + 13, 32, 33, 37, 39, 44, 59, 126, + 42, 46, 48, 57, 65, 90, 95, 122, + 58, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 58, 48, 57, 65, 70, 97, 102, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 48, 57, 46, 48, 57, 48, 57, + 46, 48, 57, 48, 57, 93, 48, 57, + 93, 48, 57, 93, 46, 48, 57, 46, + 46, 48, 57, 46, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 46, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 46, 58, + 93, 48, 57, 65, 70, 97, 102, 46, + 58, 93, 48, 57, 65, 70, 97, 102, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 48, 57, 46, 48, 57, 46, 48, + 57, 46, 58, 9, 13, 32, 33, 37, + 39, 44, 59, 61, 76, 108, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 44, 59, 61, + 71, 103, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 44, 59, 61, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 44, 59, 61, 10, 9, 32, 9, 32, + 44, 59, 61, 9, 13, 32, 33, 34, + 37, 39, 91, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 10, 9, + 32, 9, 13, 32, 33, 34, 37, 39, + 91, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 59, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 59, 61, 65, 97, + 126, 42, 46, 48, 57, 66, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 76, 108, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 59, 61, 71, 103, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 44, 59, + 61, 10, 9, 32, 9, 32, 44, 59, + 61, 9, 13, 32, 33, 34, 37, 39, + 91, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 10, 9, 32, 9, + 13, 32, 33, 34, 37, 39, 91, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 44, 59, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 44, 59, 61, 79, 82, 111, 114, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 82, 114, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 59, 61, 84, 116, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 45, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 59, 61, 67, 83, 99, + 115, 126, 42, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 44, + 59, 61, 10, 9, 32, 9, 32, 44, + 59, 61, 9, 13, 32, 33, 34, 37, + 39, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 13, 32, 33, 34, 37, 39, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 44, 59, + 48, 57, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 44, + 59, 61, 10, 9, 32, 9, 32, 44, + 59, 61, 9, 13, 32, 33, 34, 37, + 39, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 13, 32, 33, 34, 37, 39, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 44, 59, + 48, 57, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 79, 111, 126, 42, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 44, 59, 61, 84, + 116, 126, 42, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 44, + 59, 61, 10, 9, 32, 9, 32, 44, + 59, 61, 9, 13, 32, 33, 34, 37, + 39, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 13, 32, 33, 34, 37, 39, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 44, 59, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 59, 61, 126, 42, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 44, 59, 61, 10, 9, 32, 9, + 32, 44, 59, 61, 9, 13, 32, 33, + 34, 37, 39, 48, 49, 91, 126, 42, + 43, 45, 46, 50, 57, 65, 90, 95, + 122, 10, 9, 32, 9, 13, 32, 33, + 34, 37, 39, 48, 49, 91, 126, 42, + 43, 45, 46, 50, 57, 65, 90, 95, + 122, 9, 13, 32, 44, 46, 59, 9, + 13, 32, 44, 59, 48, 57, 9, 13, + 32, 44, 59, 48, 57, 9, 13, 32, + 44, 59, 48, 57, 9, 13, 32, 44, + 59, 9, 13, 32, 44, 46, 59, 9, + 13, 32, 44, 48, 59, 9, 13, 32, + 44, 48, 59, 9, 13, 32, 44, 48, + 59, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 80, 112, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 59, 61, 73, 105, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 45, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 59, 61, 67, 83, 99, + 115, 126, 42, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 44, + 59, 61, 10, 9, 32, 9, 32, 44, + 59, 61, 9, 13, 32, 33, 34, 37, + 39, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 13, 32, 33, 34, 37, 39, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 44, 59, + 48, 57, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 44, + 59, 61, 10, 9, 32, 9, 32, 44, + 59, 61, 9, 13, 32, 33, 34, 37, + 39, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 13, 32, 33, 34, 37, 39, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 44, 59, + 48, 57, 0 +}; + +static const char _tsip_machine_parser_header_Security_Server_single_lengths[] = { + 0, 2, 2, 2, 2, 2, 2, 2, + 2, 1, 2, 2, 2, 2, 2, 2, + 3, 7, 1, 2, 6, 9, 5, 1, + 2, 4, 17, 1, 2, 16, 10, 6, + 1, 2, 5, 9, 1, 2, 9, 1, + 2, 3, 4, 1, 2, 5, 1, 0, + 9, 1, 2, 2, 2, 2, 1, 3, + 0, 1, 0, 1, 0, 1, 1, 1, + 1, 1, 1, 1, 3, 3, 2, 2, + 2, 2, 2, 0, 3, 3, 3, 0, + 1, 1, 1, 1, 12, 12, 10, 6, + 1, 2, 5, 9, 1, 2, 9, 9, + 12, 12, 12, 10, 6, 1, 2, 5, + 9, 1, 2, 9, 9, 14, 12, 12, + 11, 14, 10, 6, 1, 2, 5, 9, + 1, 2, 9, 5, 10, 6, 1, 2, + 5, 9, 1, 2, 9, 5, 12, 12, + 10, 6, 1, 2, 5, 9, 1, 2, + 9, 9, 10, 6, 1, 2, 5, 11, + 1, 2, 11, 6, 5, 5, 5, 5, + 6, 6, 6, 6, 12, 12, 11, 14, + 10, 6, 1, 2, 5, 9, 1, 2, + 9, 5, 10, 6, 1, 2, 5, 9, + 1, 2, 9, 5, 0 +}; + +static const char _tsip_machine_parser_header_Security_Server_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 0, 0, 5, 4, 0, 0, + 0, 0, 5, 0, 0, 5, 4, 0, + 0, 0, 0, 5, 0, 0, 5, 0, + 0, 0, 2, 0, 0, 0, 0, 3, + 4, 3, 3, 3, 3, 0, 3, 3, + 1, 1, 1, 1, 1, 1, 1, 0, + 1, 0, 1, 0, 3, 3, 3, 3, + 3, 3, 0, 3, 3, 3, 3, 1, + 1, 1, 0, 0, 4, 4, 4, 0, + 0, 0, 0, 5, 0, 0, 5, 4, + 4, 4, 4, 4, 0, 0, 0, 0, + 5, 0, 0, 5, 4, 4, 4, 4, + 4, 4, 4, 0, 0, 0, 0, 5, + 0, 0, 5, 1, 4, 0, 0, 0, + 0, 5, 0, 0, 5, 1, 4, 4, + 4, 0, 0, 0, 0, 5, 0, 0, + 5, 4, 4, 0, 0, 0, 0, 5, + 0, 0, 5, 0, 1, 1, 1, 0, + 0, 0, 0, 0, 4, 4, 4, 4, + 4, 0, 0, 0, 0, 5, 0, 0, + 5, 1, 4, 0, 0, 0, 0, 5, + 0, 0, 5, 1, 0 +}; + +static const short _tsip_machine_parser_header_Security_Server_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 15, 18, + 21, 24, 26, 29, 32, 35, 38, 41, + 44, 48, 61, 63, 66, 78, 92, 98, + 100, 103, 108, 131, 133, 136, 158, 173, + 180, 182, 185, 191, 206, 208, 211, 226, + 228, 231, 235, 242, 244, 247, 253, 255, + 259, 273, 278, 284, 290, 296, 299, 304, + 311, 313, 316, 318, 321, 323, 326, 329, + 331, 334, 336, 339, 341, 348, 355, 361, + 367, 373, 379, 382, 386, 393, 400, 407, + 409, 412, 415, 417, 419, 436, 453, 468, + 475, 477, 480, 486, 501, 503, 506, 521, + 535, 552, 569, 586, 601, 608, 610, 613, + 619, 634, 636, 639, 654, 668, 687, 704, + 721, 737, 756, 771, 778, 780, 783, 789, + 804, 806, 809, 824, 831, 846, 853, 855, + 858, 864, 879, 881, 884, 899, 906, 923, + 940, 955, 962, 964, 967, 973, 988, 990, + 993, 1008, 1022, 1037, 1044, 1046, 1049, 1055, + 1072, 1074, 1077, 1094, 1101, 1108, 1115, 1122, + 1128, 1135, 1142, 1149, 1156, 1173, 1190, 1206, + 1225, 1240, 1247, 1249, 1252, 1258, 1273, 1275, + 1278, 1293, 1300, 1315, 1322, 1324, 1327, 1333, + 1348, 1350, 1353, 1368, 1375 +}; + +static const unsigned char _tsip_machine_parser_header_Security_Server_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 5, 5, 1, 6, + 6, 1, 7, 7, 1, 8, 8, 1, + 9, 1, 10, 10, 1, 11, 11, 1, + 12, 12, 1, 13, 13, 1, 14, 14, + 1, 15, 15, 1, 15, 15, 16, 1, + 16, 17, 16, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 1, 19, 1, 20, + 20, 1, 20, 20, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 1, 21, 22, + 21, 23, 23, 23, 24, 25, 23, 23, + 23, 23, 23, 1, 26, 27, 26, 16, + 28, 1, 29, 1, 30, 30, 1, 30, + 30, 16, 28, 1, 28, 31, 28, 32, + 32, 32, 33, 34, 35, 36, 37, 33, + 34, 35, 36, 37, 32, 32, 32, 32, + 32, 32, 1, 38, 1, 39, 39, 1, + 39, 39, 32, 32, 32, 33, 34, 35, + 36, 37, 33, 34, 35, 36, 37, 32, + 32, 32, 32, 32, 32, 1, 40, 41, + 40, 42, 42, 42, 43, 44, 45, 42, + 42, 42, 42, 42, 1, 46, 47, 46, + 16, 28, 45, 1, 48, 1, 49, 49, + 1, 49, 49, 16, 28, 45, 1, 45, + 50, 45, 51, 52, 51, 51, 53, 51, + 51, 51, 51, 51, 51, 1, 54, 1, + 55, 55, 1, 55, 56, 55, 51, 52, + 51, 51, 53, 51, 51, 51, 51, 51, + 51, 1, 57, 1, 58, 58, 1, 58, + 58, 52, 1, 59, 60, 61, 1, 1, + 1, 52, 62, 1, 52, 52, 1, 63, + 41, 63, 43, 44, 1, 64, 1, 52, + 52, 52, 1, 63, 41, 63, 51, 51, + 51, 43, 44, 51, 51, 51, 51, 51, + 1, 66, 65, 65, 65, 1, 68, 60, + 67, 67, 67, 1, 68, 60, 69, 69, + 69, 1, 68, 60, 70, 70, 70, 1, + 68, 60, 1, 72, 71, 65, 65, 1, + 73, 68, 60, 74, 67, 67, 1, 75, + 1, 76, 77, 1, 78, 1, 79, 80, + 1, 81, 1, 60, 82, 1, 60, 83, + 1, 60, 1, 79, 84, 1, 79, 1, + 76, 85, 1, 76, 1, 73, 68, 60, + 86, 69, 69, 1, 73, 68, 60, 70, + 70, 70, 1, 88, 60, 87, 87, 87, + 1, 90, 60, 89, 89, 89, 1, 90, + 60, 91, 91, 91, 1, 90, 60, 92, + 92, 92, 1, 90, 60, 1, 93, 87, + 87, 1, 73, 90, 60, 94, 89, 89, + 1, 73, 90, 60, 95, 91, 91, 1, + 73, 90, 60, 92, 92, 92, 1, 96, + 1, 73, 97, 1, 73, 98, 1, 73, + 1, 72, 1, 40, 41, 40, 42, 42, + 42, 43, 44, 45, 99, 99, 42, 42, + 42, 42, 42, 1, 40, 41, 40, 42, + 42, 42, 43, 44, 45, 100, 100, 42, + 42, 42, 42, 42, 1, 101, 41, 101, + 42, 42, 42, 43, 44, 102, 42, 42, + 42, 42, 42, 1, 103, 104, 103, 16, + 28, 102, 1, 105, 1, 106, 106, 1, + 106, 106, 16, 28, 102, 1, 102, 107, + 102, 108, 52, 108, 108, 53, 108, 108, + 108, 108, 108, 108, 1, 109, 1, 110, + 110, 1, 110, 56, 110, 108, 52, 108, + 108, 53, 108, 108, 108, 108, 108, 108, + 1, 111, 112, 111, 113, 113, 113, 114, + 115, 113, 113, 113, 113, 113, 1, 40, + 41, 40, 42, 42, 42, 43, 44, 45, + 116, 116, 42, 42, 42, 42, 42, 1, + 40, 41, 40, 42, 42, 42, 43, 44, + 45, 117, 117, 42, 42, 42, 42, 42, + 1, 40, 41, 40, 42, 42, 42, 43, + 44, 45, 118, 118, 42, 42, 42, 42, + 42, 1, 119, 41, 119, 42, 42, 42, + 43, 44, 120, 42, 42, 42, 42, 42, + 1, 121, 122, 121, 16, 28, 120, 1, + 123, 1, 124, 124, 1, 124, 124, 16, + 28, 120, 1, 120, 125, 120, 126, 52, + 126, 126, 53, 126, 126, 126, 126, 126, + 126, 1, 127, 1, 128, 128, 1, 128, + 56, 128, 126, 52, 126, 126, 53, 126, + 126, 126, 126, 126, 126, 1, 129, 130, + 129, 131, 131, 131, 132, 133, 131, 131, + 131, 131, 131, 1, 40, 41, 40, 42, + 42, 42, 43, 44, 45, 134, 135, 134, + 135, 42, 42, 42, 42, 42, 1, 40, + 41, 40, 42, 42, 42, 43, 44, 45, + 136, 136, 42, 42, 42, 42, 42, 1, + 40, 41, 40, 42, 42, 42, 43, 44, + 45, 137, 137, 42, 42, 42, 42, 42, + 1, 40, 41, 40, 42, 42, 42, 43, + 138, 44, 45, 42, 42, 42, 42, 42, + 1, 40, 41, 40, 42, 42, 42, 43, + 44, 45, 139, 140, 139, 140, 42, 42, + 42, 42, 42, 1, 141, 41, 141, 42, + 42, 42, 43, 44, 142, 42, 42, 42, + 42, 42, 1, 143, 144, 143, 16, 28, + 142, 1, 145, 1, 146, 146, 1, 146, + 146, 16, 28, 142, 1, 142, 147, 142, + 51, 52, 51, 51, 53, 51, 51, 51, + 148, 51, 51, 1, 149, 1, 150, 150, + 1, 150, 56, 150, 51, 52, 51, 51, + 53, 51, 51, 51, 148, 51, 51, 1, + 151, 152, 151, 153, 155, 154, 1, 156, + 41, 156, 42, 42, 42, 43, 44, 157, + 42, 42, 42, 42, 42, 1, 158, 159, + 158, 16, 28, 157, 1, 160, 1, 161, + 161, 1, 161, 161, 16, 28, 157, 1, + 157, 162, 157, 51, 52, 51, 51, 53, + 51, 51, 51, 163, 51, 51, 1, 164, + 1, 165, 165, 1, 165, 56, 165, 51, + 52, 51, 51, 53, 51, 51, 51, 163, + 51, 51, 1, 166, 167, 166, 168, 170, + 169, 1, 40, 41, 40, 42, 42, 42, + 43, 44, 45, 171, 171, 42, 42, 42, + 42, 42, 1, 40, 41, 40, 42, 42, + 42, 43, 44, 45, 172, 172, 42, 42, + 42, 42, 42, 1, 173, 41, 173, 42, + 42, 42, 43, 44, 174, 42, 42, 42, + 42, 42, 1, 175, 176, 175, 16, 28, + 174, 1, 177, 1, 178, 178, 1, 178, + 178, 16, 28, 174, 1, 174, 179, 174, + 180, 52, 180, 180, 53, 180, 180, 180, + 180, 180, 180, 1, 181, 1, 182, 182, + 1, 182, 56, 182, 180, 52, 180, 180, + 53, 180, 180, 180, 180, 180, 180, 1, + 183, 184, 183, 185, 185, 185, 186, 187, + 185, 185, 185, 185, 185, 1, 188, 41, + 188, 42, 42, 42, 43, 44, 189, 42, + 42, 42, 42, 42, 1, 190, 191, 190, + 16, 28, 189, 1, 192, 1, 193, 193, + 1, 193, 193, 16, 28, 189, 1, 189, + 194, 189, 51, 52, 51, 51, 195, 196, + 53, 51, 51, 51, 51, 51, 51, 1, + 197, 1, 198, 198, 1, 198, 56, 198, + 51, 52, 51, 51, 195, 196, 53, 51, + 51, 51, 51, 51, 51, 1, 199, 200, + 199, 201, 202, 203, 1, 199, 200, 199, + 201, 203, 204, 1, 199, 200, 199, 201, + 203, 205, 1, 199, 200, 199, 201, 203, + 206, 1, 199, 200, 199, 201, 203, 1, + 199, 200, 199, 201, 207, 203, 1, 199, + 200, 199, 201, 208, 203, 1, 199, 200, + 199, 201, 209, 203, 1, 199, 200, 199, + 201, 206, 203, 1, 40, 41, 40, 42, + 42, 42, 43, 44, 45, 210, 210, 42, + 42, 42, 42, 42, 1, 40, 41, 40, + 42, 42, 42, 43, 44, 45, 211, 211, + 42, 42, 42, 42, 42, 1, 40, 41, + 40, 42, 42, 42, 43, 212, 44, 45, + 42, 42, 42, 42, 42, 1, 40, 41, + 40, 42, 42, 42, 43, 44, 45, 213, + 214, 213, 214, 42, 42, 42, 42, 42, + 1, 215, 41, 215, 42, 42, 42, 43, + 44, 216, 42, 42, 42, 42, 42, 1, + 217, 218, 217, 16, 28, 216, 1, 219, + 1, 220, 220, 1, 220, 220, 16, 28, + 216, 1, 216, 221, 216, 51, 52, 51, + 51, 53, 51, 51, 51, 222, 51, 51, + 1, 223, 1, 224, 224, 1, 224, 56, + 224, 51, 52, 51, 51, 53, 51, 51, + 51, 222, 51, 51, 1, 225, 226, 225, + 227, 229, 228, 1, 230, 41, 230, 42, + 42, 42, 43, 44, 231, 42, 42, 42, + 42, 42, 1, 232, 233, 232, 16, 28, + 231, 1, 234, 1, 235, 235, 1, 235, + 235, 16, 28, 231, 1, 231, 236, 231, + 51, 52, 51, 51, 53, 51, 51, 51, + 237, 51, 51, 1, 238, 1, 239, 239, + 1, 239, 56, 239, 51, 52, 51, 51, + 53, 51, 51, 51, 237, 51, 51, 1, + 240, 241, 240, 242, 244, 243, 1, 1, + 0 +}; + +static const unsigned char _tsip_machine_parser_header_Security_Server_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 21, 19, 20, 22, 46, 21, + 17, 26, 22, 23, 26, 24, 25, 27, + 30, 84, 96, 109, 146, 164, 28, 29, + 31, 46, 30, 17, 26, 35, 31, 32, + 33, 34, 36, 48, 42, 49, 37, 38, + 39, 40, 41, 43, 45, 47, 44, 22, + 188, 50, 83, 51, 54, 52, 53, 55, + 70, 56, 68, 57, 58, 66, 59, 60, + 64, 61, 62, 63, 65, 67, 69, 71, + 79, 72, 75, 73, 74, 76, 77, 78, + 80, 81, 82, 85, 86, 87, 91, 87, + 88, 89, 90, 92, 95, 93, 94, 22, + 46, 95, 17, 26, 97, 98, 99, 100, + 104, 100, 101, 102, 103, 105, 108, 106, + 107, 22, 46, 108, 17, 26, 110, 134, + 111, 112, 113, 114, 124, 115, 119, 115, + 116, 117, 118, 120, 123, 121, 122, 22, + 46, 17, 123, 26, 125, 129, 125, 126, + 127, 128, 130, 133, 131, 132, 22, 46, + 17, 133, 26, 135, 136, 137, 141, 137, + 138, 139, 140, 142, 145, 143, 144, 22, + 46, 145, 17, 26, 147, 151, 147, 148, + 149, 150, 152, 155, 160, 153, 154, 22, + 46, 17, 156, 26, 157, 158, 159, 161, + 162, 163, 165, 166, 167, 168, 178, 169, + 173, 169, 170, 171, 172, 174, 177, 175, + 176, 22, 46, 17, 177, 26, 179, 183, + 179, 180, 181, 182, 184, 187, 185, 186, + 22, 46, 17, 187, 26 +}; + +static const char _tsip_machine_parser_header_Security_Server_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 25, 0, 0, 28, 28, 0, + 28, 3, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 0, 0, + 55, 55, 0, 55, 21, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 55, + 23, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 55, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 46, + 46, 0, 46, 15, 0, 0, 0, 55, + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 43, 43, 0, 43, 13, 0, 0, + 0, 0, 0, 0, 0, 55, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 34, + 34, 34, 0, 7, 55, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 31, 31, + 31, 0, 5, 0, 0, 55, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 49, + 49, 0, 49, 17, 55, 0, 0, 0, + 0, 0, 0, 1, 1, 0, 0, 52, + 52, 52, 0, 19, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 55, + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 40, 40, 40, 0, 11, 55, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 37, 37, 37, 0, 9 +}; + +static const int tsip_machine_parser_header_Security_Server_start = 1; +static const int tsip_machine_parser_header_Security_Server_first_final = 188; +static const int tsip_machine_parser_header_Security_Server_error = 0; + +static const int tsip_machine_parser_header_Security_Server_en_main = 1; + + +/* #line 214 "./ragel/tsip_parser_header_Security_Server.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Security_Server_first_final); + (void)(tsip_machine_parser_header_Security_Server_error); + (void)(tsip_machine_parser_header_Security_Server_en_main); + +/* #line 684 "./src/headers/tsip_header_Security_Server.c" */ + { + cs = tsip_machine_parser_header_Security_Server_start; + } + +/* #line 219 "./ragel/tsip_parser_header_Security_Server.rl" */ + +/* #line 691 "./src/headers/tsip_header_Security_Server.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Security_Server_trans_keys + _tsip_machine_parser_header_Security_Server_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Security_Server_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Security_Server_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Security_Server_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Security_Server_indicies[_trans]; + cs = _tsip_machine_parser_header_Security_Server_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Security_Server_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Security_Server_actions + _tsip_machine_parser_header_Security_Server_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 52 "./ragel/tsip_parser_header_Security_Server.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 56 "./ragel/tsip_parser_header_Security_Server.rl" */ + { + if(!curr_securityserver){ + curr_securityserver = tsip_header_Security_Server_create_null(); + } + } + break; + case 2: +/* #line 62 "./ragel/tsip_parser_header_Security_Server.rl" */ + { + if(curr_securityserver){ + tsk_list_push_back_data(hdr_securityservers, ((void**) &curr_securityserver)); + } + } + break; + case 3: +/* #line 68 "./ragel/tsip_parser_header_Security_Server.rl" */ + { + if(curr_securityserver){ + TSK_PARSER_SET_STRING(curr_securityserver->mech); + } + } + break; + case 4: +/* #line 74 "./ragel/tsip_parser_header_Security_Server.rl" */ + { + if(curr_securityserver){ + TSK_PARSER_SET_INT(curr_securityserver->port_s); + } + } + break; + case 5: +/* #line 80 "./ragel/tsip_parser_header_Security_Server.rl" */ + { + if(curr_securityserver){ + TSK_PARSER_SET_INT(curr_securityserver->port_c); + } + } + break; + case 6: +/* #line 86 "./ragel/tsip_parser_header_Security_Server.rl" */ + { + if(curr_securityserver){ + TSK_PARSER_SET_UINT(curr_securityserver->spi_s); + } + } + break; + case 7: +/* #line 92 "./ragel/tsip_parser_header_Security_Server.rl" */ + { + if(curr_securityserver){ + TSK_PARSER_SET_UINT(curr_securityserver->spi_c); + } + } + break; + case 8: +/* #line 98 "./ragel/tsip_parser_header_Security_Server.rl" */ + { + if(curr_securityserver){ + TSK_PARSER_SET_STRING(curr_securityserver->ealg); + } + } + break; + case 9: +/* #line 104 "./ragel/tsip_parser_header_Security_Server.rl" */ + { + if(curr_securityserver){ + TSK_PARSER_SET_STRING(curr_securityserver->alg); + } + } + break; + case 10: +/* #line 110 "./ragel/tsip_parser_header_Security_Server.rl" */ + { + if(curr_securityserver){ + TSK_PARSER_SET_STRING(curr_securityserver->prot); + } + } + break; + case 11: +/* #line 116 "./ragel/tsip_parser_header_Security_Server.rl" */ + { + if(curr_securityserver){ + TSK_PARSER_SET_DOUBLE(curr_securityserver->q); + } + } + break; + case 12: +/* #line 122 "./ragel/tsip_parser_header_Security_Server.rl" */ + { + if(curr_securityserver){ + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(curr_securityserver)); + } + } + break; + case 13: +/* #line 128 "./ragel/tsip_parser_header_Security_Server.rl" */ + { + } + break; +/* #line 872 "./src/headers/tsip_header_Security_Server.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 220 "./ragel/tsip_parser_header_Security_Server.rl" */ + + if( cs < +/* #line 888 "./src/headers/tsip_header_Security_Server.c" */ +188 +/* #line 221 "./ragel/tsip_parser_header_Security_Server.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Security-Server' header."); + TSK_OBJECT_SAFE_FREE(curr_securityserver); + TSK_OBJECT_SAFE_FREE(hdr_securityservers); + } + + return hdr_securityservers; +} + + + + + +//======================================================== +// Security_Server header object definition +// + +static tsk_object_t* tsip_header_Security_Server_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Security_Server_t *Security_Server = self; + if(Security_Server){ + + TSIP_HEADER(Security_Server)->type = tsip_htype_Security_Server; + TSIP_HEADER(Security_Server)->serialize = tsip_header_Security_Server_serialize; + + Security_Server->q = -1; + } + else{ + TSK_DEBUG_ERROR("Failed to create new Security_Server header."); + } + return self; +} + +static tsk_object_t* tsip_header_Security_Server_dtor(tsk_object_t *self) +{ + tsip_header_Security_Server_t *Security_Server = self; + if(Security_Server){ + TSK_FREE(Security_Server->mech); + TSK_FREE(Security_Server->alg); + TSK_FREE(Security_Server->prot); + TSK_FREE(Security_Server->mod); + TSK_FREE(Security_Server->ealg); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Security_Server)); + } + else{ + TSK_DEBUG_ERROR("Null Security_Server header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Security_Server_def_s = +{ + sizeof(tsip_header_Security_Server_t), + tsip_header_Security_Server_ctor, + tsip_header_Security_Server_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Security_Server_def_t = &tsip_header_Security_Server_def_s; diff --git a/tinySIP/src/headers/tsip_header_Security_Verify.c b/tinySIP/src/headers/tsip_header_Security_Verify.c new file mode 100644 index 0000000..fc87164 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Security_Verify.c @@ -0,0 +1,948 @@ + +/* #line 1 "./ragel/tsip_parser_header_Security_Verify.rl" */ +/* +* 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 tsip_header_Security_Verify.c + * @brief SIP Security-Verify header as per RFC 3329. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Security_Verify.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_time.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 147 "./ragel/tsip_parser_header_Security_Verify.rl" */ + + +tsip_header_Security_Verify_t* tsip_header_Security_Verify_create() +{ + return tsk_object_new(TSIP_HEADER_SECURITY_VERIFY_VA_ARGS()); +} + +tsip_header_Security_Verify_t* tsip_header_Security_Verify_create_null() +{ + return tsip_header_Security_Verify_create(); +} + +int tsip_header_Security_Verify_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Security_Verify_t *Security_Verify = (const tsip_header_Security_Verify_t *)header; + int ret = 0; + + // ipsec-3gpp; alg=hmac-md5-96; ealg=des-ede3-cbc; spi-c=1111; spi-s=2222; port-c=5062; port-s=5064 + if(tsk_striequals(Security_Verify->mech, "ipsec-3gpp")){ + ret = tsk_buffer_append_2(output, "%s%s%s%s%s%s%s;spi-c=%u;spi-s=%u;port-c=%u;port-s=%u", + Security_Verify->mech, + + Security_Verify->alg ? ";alg=" : "", + Security_Verify->alg ? Security_Verify->alg : "", + + Security_Verify->ealg ? ";ealg=" : "", + Security_Verify->ealg ? Security_Verify->ealg : "", + + Security_Verify->prot ? ";prot=" : "", + Security_Verify->prot ? Security_Verify->prot : "", + + Security_Verify->spi_c, + Security_Verify->spi_s, + Security_Verify->port_c, + Security_Verify->port_s + ); + } + else if(Security_Verify->mech){ + tsk_buffer_append(output, Security_Verify->mech, tsk_strlen(Security_Verify->mech)); + } + + if(Security_Verify->q >= 0){ + /* qvalue = ("0" [ "." 0*3DIGIT ] ) / ( "1" [ "." 0*3("0") ] ) */ + tsk_buffer_append_2(output, ";q=%1.3f", Security_Verify->q); + } + + return ret; + } + + return -1; +} + +tsip_header_Security_Verifies_L_t *tsip_header_Security_Verify_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Security_Verifies_L_t *hdr_securityverifies = tsk_list_create(); + + const char *tag_start = tsk_null; + tsip_header_Security_Verify_t *curr_securityverify = tsk_null; + + +/* #line 115 "./src/headers/tsip_header_Security_Verify.c" */ +static const char _tsip_machine_parser_header_Security_Verify_actions[] = { + 0, 1, 0, 1, 3, 1, 4, 1, + 5, 1, 6, 1, 7, 1, 8, 1, + 9, 1, 10, 1, 11, 1, 12, 1, + 13, 2, 1, 0, 2, 3, 2, 2, + 4, 2, 2, 5, 2, 2, 6, 2, + 2, 7, 2, 2, 8, 2, 2, 9, + 2, 2, 10, 2, 2, 11, 2, 2, + 12, 2 +}; + +static const short _tsip_machine_parser_header_Security_Verify_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 12, + 14, 16, 17, 19, 21, 23, 25, 27, + 29, 32, 49, 50, 52, 68, 85, 90, + 91, 93, 97, 124, 125, 127, 153, 171, + 177, 178, 180, 185, 204, 205, 207, 226, + 227, 229, 232, 240, 241, 243, 248, 249, + 255, 272, 279, 287, 295, 303, 305, 312, + 321, 323, 326, 328, 331, 333, 336, 339, + 340, 343, 344, 347, 348, 357, 366, 374, + 382, 390, 398, 400, 406, 415, 424, 433, + 435, 438, 441, 442, 443, 463, 483, 501, + 507, 508, 510, 515, 534, 535, 537, 556, + 573, 593, 613, 633, 651, 657, 658, 660, + 665, 684, 685, 687, 706, 723, 745, 765, + 785, 804, 826, 844, 850, 851, 853, 858, + 877, 878, 880, 899, 906, 924, 930, 931, + 933, 938, 957, 958, 960, 979, 986, 1006, + 1026, 1044, 1050, 1051, 1053, 1058, 1077, 1078, + 1080, 1099, 1116, 1134, 1140, 1141, 1143, 1148, + 1169, 1170, 1172, 1193, 1199, 1206, 1213, 1220, + 1225, 1231, 1237, 1243, 1249, 1269, 1289, 1308, + 1330, 1348, 1354, 1355, 1357, 1362, 1381, 1382, + 1384, 1403, 1410, 1428, 1434, 1435, 1437, 1442, + 1461, 1462, 1464, 1483, 1490 +}; + +static const char _tsip_machine_parser_header_Security_Verify_trans_keys[] = { + 83, 115, 69, 101, 67, 99, 85, 117, + 82, 114, 73, 105, 84, 116, 89, 121, + 45, 86, 118, 69, 101, 82, 114, 73, + 105, 70, 102, 89, 121, 9, 32, 58, + 9, 13, 32, 33, 37, 39, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 10, 9, 32, 9, 32, 33, 37, + 39, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 59, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 44, 59, 10, 9, 32, 9, 32, 44, + 59, 9, 13, 32, 33, 37, 39, 65, + 69, 80, 81, 83, 97, 101, 112, 113, + 115, 126, 42, 43, 45, 46, 48, 57, + 66, 90, 95, 122, 10, 9, 32, 9, + 32, 33, 37, 39, 65, 69, 80, 81, + 83, 97, 101, 112, 113, 115, 126, 42, + 43, 45, 46, 48, 57, 66, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 44, 59, + 61, 10, 9, 32, 9, 32, 44, 59, + 61, 9, 13, 32, 33, 34, 37, 39, + 91, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 10, 9, 32, 9, + 13, 32, 33, 34, 37, 39, 91, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 10, 9, 32, 9, 32, 34, + 13, 34, 92, 127, 0, 8, 10, 31, + 10, 9, 32, 9, 13, 32, 44, 59, + 10, 0, 9, 11, 12, 14, 127, 9, + 13, 32, 33, 37, 39, 44, 59, 126, + 42, 46, 48, 57, 65, 90, 95, 122, + 58, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 58, 48, 57, 65, 70, 97, 102, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 48, 57, 46, 48, 57, 48, 57, + 46, 48, 57, 48, 57, 93, 48, 57, + 93, 48, 57, 93, 46, 48, 57, 46, + 46, 48, 57, 46, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 46, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 46, 58, + 93, 48, 57, 65, 70, 97, 102, 46, + 58, 93, 48, 57, 65, 70, 97, 102, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 48, 57, 46, 48, 57, 46, 48, + 57, 46, 58, 9, 13, 32, 33, 37, + 39, 44, 59, 61, 76, 108, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 44, 59, 61, + 71, 103, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 44, 59, 61, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 44, 59, 61, 10, 9, 32, 9, 32, + 44, 59, 61, 9, 13, 32, 33, 34, + 37, 39, 91, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 10, 9, + 32, 9, 13, 32, 33, 34, 37, 39, + 91, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 59, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 59, 61, 65, 97, + 126, 42, 46, 48, 57, 66, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 76, 108, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 59, 61, 71, 103, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 44, 59, + 61, 10, 9, 32, 9, 32, 44, 59, + 61, 9, 13, 32, 33, 34, 37, 39, + 91, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 10, 9, 32, 9, + 13, 32, 33, 34, 37, 39, 91, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 44, 59, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 44, 59, 61, 79, 82, 111, 114, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 82, 114, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 59, 61, 84, 116, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 45, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 59, 61, 67, 83, 99, + 115, 126, 42, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 44, + 59, 61, 10, 9, 32, 9, 32, 44, + 59, 61, 9, 13, 32, 33, 34, 37, + 39, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 13, 32, 33, 34, 37, 39, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 44, 59, + 48, 57, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 44, + 59, 61, 10, 9, 32, 9, 32, 44, + 59, 61, 9, 13, 32, 33, 34, 37, + 39, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 13, 32, 33, 34, 37, 39, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 44, 59, + 48, 57, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 79, 111, 126, 42, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 44, 59, 61, 84, + 116, 126, 42, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 44, + 59, 61, 10, 9, 32, 9, 32, 44, + 59, 61, 9, 13, 32, 33, 34, 37, + 39, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 13, 32, 33, 34, 37, 39, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 44, 59, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 59, 61, 126, 42, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 44, 59, 61, 10, 9, 32, 9, + 32, 44, 59, 61, 9, 13, 32, 33, + 34, 37, 39, 48, 49, 91, 126, 42, + 43, 45, 46, 50, 57, 65, 90, 95, + 122, 10, 9, 32, 9, 13, 32, 33, + 34, 37, 39, 48, 49, 91, 126, 42, + 43, 45, 46, 50, 57, 65, 90, 95, + 122, 9, 13, 32, 44, 46, 59, 9, + 13, 32, 44, 59, 48, 57, 9, 13, + 32, 44, 59, 48, 57, 9, 13, 32, + 44, 59, 48, 57, 9, 13, 32, 44, + 59, 9, 13, 32, 44, 46, 59, 9, + 13, 32, 44, 48, 59, 9, 13, 32, + 44, 48, 59, 9, 13, 32, 44, 48, + 59, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 80, 112, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 59, 61, 73, 105, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 45, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 44, 59, 61, 67, 83, 99, + 115, 126, 42, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 44, + 59, 61, 10, 9, 32, 9, 32, 44, + 59, 61, 9, 13, 32, 33, 34, 37, + 39, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 13, 32, 33, 34, 37, 39, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 44, 59, + 48, 57, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 126, 42, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 44, + 59, 61, 10, 9, 32, 9, 32, 44, + 59, 61, 9, 13, 32, 33, 34, 37, + 39, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 10, 9, 32, + 9, 13, 32, 33, 34, 37, 39, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 44, 59, + 48, 57, 0 +}; + +static const char _tsip_machine_parser_header_Security_Verify_single_lengths[] = { + 0, 2, 2, 2, 2, 2, 2, 2, + 2, 1, 2, 2, 2, 2, 2, 2, + 3, 7, 1, 2, 6, 9, 5, 1, + 2, 4, 17, 1, 2, 16, 10, 6, + 1, 2, 5, 9, 1, 2, 9, 1, + 2, 3, 4, 1, 2, 5, 1, 0, + 9, 1, 2, 2, 2, 2, 1, 3, + 0, 1, 0, 1, 0, 1, 1, 1, + 1, 1, 1, 1, 3, 3, 2, 2, + 2, 2, 2, 0, 3, 3, 3, 0, + 1, 1, 1, 1, 12, 12, 10, 6, + 1, 2, 5, 9, 1, 2, 9, 9, + 12, 12, 12, 10, 6, 1, 2, 5, + 9, 1, 2, 9, 9, 14, 12, 12, + 11, 14, 10, 6, 1, 2, 5, 9, + 1, 2, 9, 5, 10, 6, 1, 2, + 5, 9, 1, 2, 9, 5, 12, 12, + 10, 6, 1, 2, 5, 9, 1, 2, + 9, 9, 10, 6, 1, 2, 5, 11, + 1, 2, 11, 6, 5, 5, 5, 5, + 6, 6, 6, 6, 12, 12, 11, 14, + 10, 6, 1, 2, 5, 9, 1, 2, + 9, 5, 10, 6, 1, 2, 5, 9, + 1, 2, 9, 5, 0 +}; + +static const char _tsip_machine_parser_header_Security_Verify_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 0, 0, 5, 4, 0, 0, + 0, 0, 5, 0, 0, 5, 4, 0, + 0, 0, 0, 5, 0, 0, 5, 0, + 0, 0, 2, 0, 0, 0, 0, 3, + 4, 3, 3, 3, 3, 0, 3, 3, + 1, 1, 1, 1, 1, 1, 1, 0, + 1, 0, 1, 0, 3, 3, 3, 3, + 3, 3, 0, 3, 3, 3, 3, 1, + 1, 1, 0, 0, 4, 4, 4, 0, + 0, 0, 0, 5, 0, 0, 5, 4, + 4, 4, 4, 4, 0, 0, 0, 0, + 5, 0, 0, 5, 4, 4, 4, 4, + 4, 4, 4, 0, 0, 0, 0, 5, + 0, 0, 5, 1, 4, 0, 0, 0, + 0, 5, 0, 0, 5, 1, 4, 4, + 4, 0, 0, 0, 0, 5, 0, 0, + 5, 4, 4, 0, 0, 0, 0, 5, + 0, 0, 5, 0, 1, 1, 1, 0, + 0, 0, 0, 0, 4, 4, 4, 4, + 4, 0, 0, 0, 0, 5, 0, 0, + 5, 1, 4, 0, 0, 0, 0, 5, + 0, 0, 5, 1, 0 +}; + +static const short _tsip_machine_parser_header_Security_Verify_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 15, 18, + 21, 24, 26, 29, 32, 35, 38, 41, + 44, 48, 61, 63, 66, 78, 92, 98, + 100, 103, 108, 131, 133, 136, 158, 173, + 180, 182, 185, 191, 206, 208, 211, 226, + 228, 231, 235, 242, 244, 247, 253, 255, + 259, 273, 278, 284, 290, 296, 299, 304, + 311, 313, 316, 318, 321, 323, 326, 329, + 331, 334, 336, 339, 341, 348, 355, 361, + 367, 373, 379, 382, 386, 393, 400, 407, + 409, 412, 415, 417, 419, 436, 453, 468, + 475, 477, 480, 486, 501, 503, 506, 521, + 535, 552, 569, 586, 601, 608, 610, 613, + 619, 634, 636, 639, 654, 668, 687, 704, + 721, 737, 756, 771, 778, 780, 783, 789, + 804, 806, 809, 824, 831, 846, 853, 855, + 858, 864, 879, 881, 884, 899, 906, 923, + 940, 955, 962, 964, 967, 973, 988, 990, + 993, 1008, 1022, 1037, 1044, 1046, 1049, 1055, + 1072, 1074, 1077, 1094, 1101, 1108, 1115, 1122, + 1128, 1135, 1142, 1149, 1156, 1173, 1190, 1206, + 1225, 1240, 1247, 1249, 1252, 1258, 1273, 1275, + 1278, 1293, 1300, 1315, 1322, 1324, 1327, 1333, + 1348, 1350, 1353, 1368, 1375 +}; + +static const unsigned char _tsip_machine_parser_header_Security_Verify_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 5, 5, 1, 6, + 6, 1, 7, 7, 1, 8, 8, 1, + 9, 1, 10, 10, 1, 11, 11, 1, + 12, 12, 1, 13, 13, 1, 14, 14, + 1, 15, 15, 1, 15, 15, 16, 1, + 16, 17, 16, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 1, 19, 1, 20, + 20, 1, 20, 20, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 1, 21, 22, + 21, 23, 23, 23, 24, 25, 23, 23, + 23, 23, 23, 1, 26, 27, 26, 16, + 28, 1, 29, 1, 30, 30, 1, 30, + 30, 16, 28, 1, 28, 31, 28, 32, + 32, 32, 33, 34, 35, 36, 37, 33, + 34, 35, 36, 37, 32, 32, 32, 32, + 32, 32, 1, 38, 1, 39, 39, 1, + 39, 39, 32, 32, 32, 33, 34, 35, + 36, 37, 33, 34, 35, 36, 37, 32, + 32, 32, 32, 32, 32, 1, 40, 41, + 40, 42, 42, 42, 43, 44, 45, 42, + 42, 42, 42, 42, 1, 46, 47, 46, + 16, 28, 45, 1, 48, 1, 49, 49, + 1, 49, 49, 16, 28, 45, 1, 45, + 50, 45, 51, 52, 51, 51, 53, 51, + 51, 51, 51, 51, 51, 1, 54, 1, + 55, 55, 1, 55, 56, 55, 51, 52, + 51, 51, 53, 51, 51, 51, 51, 51, + 51, 1, 57, 1, 58, 58, 1, 58, + 58, 52, 1, 59, 60, 61, 1, 1, + 1, 52, 62, 1, 52, 52, 1, 63, + 41, 63, 43, 44, 1, 64, 1, 52, + 52, 52, 1, 63, 41, 63, 51, 51, + 51, 43, 44, 51, 51, 51, 51, 51, + 1, 66, 65, 65, 65, 1, 68, 60, + 67, 67, 67, 1, 68, 60, 69, 69, + 69, 1, 68, 60, 70, 70, 70, 1, + 68, 60, 1, 72, 71, 65, 65, 1, + 73, 68, 60, 74, 67, 67, 1, 75, + 1, 76, 77, 1, 78, 1, 79, 80, + 1, 81, 1, 60, 82, 1, 60, 83, + 1, 60, 1, 79, 84, 1, 79, 1, + 76, 85, 1, 76, 1, 73, 68, 60, + 86, 69, 69, 1, 73, 68, 60, 70, + 70, 70, 1, 88, 60, 87, 87, 87, + 1, 90, 60, 89, 89, 89, 1, 90, + 60, 91, 91, 91, 1, 90, 60, 92, + 92, 92, 1, 90, 60, 1, 93, 87, + 87, 1, 73, 90, 60, 94, 89, 89, + 1, 73, 90, 60, 95, 91, 91, 1, + 73, 90, 60, 92, 92, 92, 1, 96, + 1, 73, 97, 1, 73, 98, 1, 73, + 1, 72, 1, 40, 41, 40, 42, 42, + 42, 43, 44, 45, 99, 99, 42, 42, + 42, 42, 42, 1, 40, 41, 40, 42, + 42, 42, 43, 44, 45, 100, 100, 42, + 42, 42, 42, 42, 1, 101, 41, 101, + 42, 42, 42, 43, 44, 102, 42, 42, + 42, 42, 42, 1, 103, 104, 103, 16, + 28, 102, 1, 105, 1, 106, 106, 1, + 106, 106, 16, 28, 102, 1, 102, 107, + 102, 108, 52, 108, 108, 53, 108, 108, + 108, 108, 108, 108, 1, 109, 1, 110, + 110, 1, 110, 56, 110, 108, 52, 108, + 108, 53, 108, 108, 108, 108, 108, 108, + 1, 111, 112, 111, 113, 113, 113, 114, + 115, 113, 113, 113, 113, 113, 1, 40, + 41, 40, 42, 42, 42, 43, 44, 45, + 116, 116, 42, 42, 42, 42, 42, 1, + 40, 41, 40, 42, 42, 42, 43, 44, + 45, 117, 117, 42, 42, 42, 42, 42, + 1, 40, 41, 40, 42, 42, 42, 43, + 44, 45, 118, 118, 42, 42, 42, 42, + 42, 1, 119, 41, 119, 42, 42, 42, + 43, 44, 120, 42, 42, 42, 42, 42, + 1, 121, 122, 121, 16, 28, 120, 1, + 123, 1, 124, 124, 1, 124, 124, 16, + 28, 120, 1, 120, 125, 120, 126, 52, + 126, 126, 53, 126, 126, 126, 126, 126, + 126, 1, 127, 1, 128, 128, 1, 128, + 56, 128, 126, 52, 126, 126, 53, 126, + 126, 126, 126, 126, 126, 1, 129, 130, + 129, 131, 131, 131, 132, 133, 131, 131, + 131, 131, 131, 1, 40, 41, 40, 42, + 42, 42, 43, 44, 45, 134, 135, 134, + 135, 42, 42, 42, 42, 42, 1, 40, + 41, 40, 42, 42, 42, 43, 44, 45, + 136, 136, 42, 42, 42, 42, 42, 1, + 40, 41, 40, 42, 42, 42, 43, 44, + 45, 137, 137, 42, 42, 42, 42, 42, + 1, 40, 41, 40, 42, 42, 42, 43, + 138, 44, 45, 42, 42, 42, 42, 42, + 1, 40, 41, 40, 42, 42, 42, 43, + 44, 45, 139, 140, 139, 140, 42, 42, + 42, 42, 42, 1, 141, 41, 141, 42, + 42, 42, 43, 44, 142, 42, 42, 42, + 42, 42, 1, 143, 144, 143, 16, 28, + 142, 1, 145, 1, 146, 146, 1, 146, + 146, 16, 28, 142, 1, 142, 147, 142, + 51, 52, 51, 51, 53, 51, 51, 51, + 148, 51, 51, 1, 149, 1, 150, 150, + 1, 150, 56, 150, 51, 52, 51, 51, + 53, 51, 51, 51, 148, 51, 51, 1, + 151, 152, 151, 153, 155, 154, 1, 156, + 41, 156, 42, 42, 42, 43, 44, 157, + 42, 42, 42, 42, 42, 1, 158, 159, + 158, 16, 28, 157, 1, 160, 1, 161, + 161, 1, 161, 161, 16, 28, 157, 1, + 157, 162, 157, 51, 52, 51, 51, 53, + 51, 51, 51, 163, 51, 51, 1, 164, + 1, 165, 165, 1, 165, 56, 165, 51, + 52, 51, 51, 53, 51, 51, 51, 163, + 51, 51, 1, 166, 167, 166, 168, 170, + 169, 1, 40, 41, 40, 42, 42, 42, + 43, 44, 45, 171, 171, 42, 42, 42, + 42, 42, 1, 40, 41, 40, 42, 42, + 42, 43, 44, 45, 172, 172, 42, 42, + 42, 42, 42, 1, 173, 41, 173, 42, + 42, 42, 43, 44, 174, 42, 42, 42, + 42, 42, 1, 175, 176, 175, 16, 28, + 174, 1, 177, 1, 178, 178, 1, 178, + 178, 16, 28, 174, 1, 174, 179, 174, + 180, 52, 180, 180, 53, 180, 180, 180, + 180, 180, 180, 1, 181, 1, 182, 182, + 1, 182, 56, 182, 180, 52, 180, 180, + 53, 180, 180, 180, 180, 180, 180, 1, + 183, 184, 183, 185, 185, 185, 186, 187, + 185, 185, 185, 185, 185, 1, 188, 41, + 188, 42, 42, 42, 43, 44, 189, 42, + 42, 42, 42, 42, 1, 190, 191, 190, + 16, 28, 189, 1, 192, 1, 193, 193, + 1, 193, 193, 16, 28, 189, 1, 189, + 194, 189, 51, 52, 51, 51, 195, 196, + 53, 51, 51, 51, 51, 51, 51, 1, + 197, 1, 198, 198, 1, 198, 56, 198, + 51, 52, 51, 51, 195, 196, 53, 51, + 51, 51, 51, 51, 51, 1, 199, 200, + 199, 201, 202, 203, 1, 199, 200, 199, + 201, 203, 204, 1, 199, 200, 199, 201, + 203, 205, 1, 199, 200, 199, 201, 203, + 206, 1, 199, 200, 199, 201, 203, 1, + 199, 200, 199, 201, 207, 203, 1, 199, + 200, 199, 201, 208, 203, 1, 199, 200, + 199, 201, 209, 203, 1, 199, 200, 199, + 201, 206, 203, 1, 40, 41, 40, 42, + 42, 42, 43, 44, 45, 210, 210, 42, + 42, 42, 42, 42, 1, 40, 41, 40, + 42, 42, 42, 43, 44, 45, 211, 211, + 42, 42, 42, 42, 42, 1, 40, 41, + 40, 42, 42, 42, 43, 212, 44, 45, + 42, 42, 42, 42, 42, 1, 40, 41, + 40, 42, 42, 42, 43, 44, 45, 213, + 214, 213, 214, 42, 42, 42, 42, 42, + 1, 215, 41, 215, 42, 42, 42, 43, + 44, 216, 42, 42, 42, 42, 42, 1, + 217, 218, 217, 16, 28, 216, 1, 219, + 1, 220, 220, 1, 220, 220, 16, 28, + 216, 1, 216, 221, 216, 51, 52, 51, + 51, 53, 51, 51, 51, 222, 51, 51, + 1, 223, 1, 224, 224, 1, 224, 56, + 224, 51, 52, 51, 51, 53, 51, 51, + 51, 222, 51, 51, 1, 225, 226, 225, + 227, 229, 228, 1, 230, 41, 230, 42, + 42, 42, 43, 44, 231, 42, 42, 42, + 42, 42, 1, 232, 233, 232, 16, 28, + 231, 1, 234, 1, 235, 235, 1, 235, + 235, 16, 28, 231, 1, 231, 236, 231, + 51, 52, 51, 51, 53, 51, 51, 51, + 237, 51, 51, 1, 238, 1, 239, 239, + 1, 239, 56, 239, 51, 52, 51, 51, + 53, 51, 51, 51, 237, 51, 51, 1, + 240, 241, 240, 242, 244, 243, 1, 1, + 0 +}; + +static const unsigned char _tsip_machine_parser_header_Security_Verify_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 21, 19, 20, 22, 46, 21, + 17, 26, 22, 23, 26, 24, 25, 27, + 30, 84, 96, 109, 146, 164, 28, 29, + 31, 46, 30, 17, 26, 35, 31, 32, + 33, 34, 36, 48, 42, 49, 37, 38, + 39, 40, 41, 43, 45, 47, 44, 22, + 188, 50, 83, 51, 54, 52, 53, 55, + 70, 56, 68, 57, 58, 66, 59, 60, + 64, 61, 62, 63, 65, 67, 69, 71, + 79, 72, 75, 73, 74, 76, 77, 78, + 80, 81, 82, 85, 86, 87, 91, 87, + 88, 89, 90, 92, 95, 93, 94, 22, + 46, 95, 17, 26, 97, 98, 99, 100, + 104, 100, 101, 102, 103, 105, 108, 106, + 107, 22, 46, 108, 17, 26, 110, 134, + 111, 112, 113, 114, 124, 115, 119, 115, + 116, 117, 118, 120, 123, 121, 122, 22, + 46, 17, 123, 26, 125, 129, 125, 126, + 127, 128, 130, 133, 131, 132, 22, 46, + 17, 133, 26, 135, 136, 137, 141, 137, + 138, 139, 140, 142, 145, 143, 144, 22, + 46, 145, 17, 26, 147, 151, 147, 148, + 149, 150, 152, 155, 160, 153, 154, 22, + 46, 17, 156, 26, 157, 158, 159, 161, + 162, 163, 165, 166, 167, 168, 178, 169, + 173, 169, 170, 171, 172, 174, 177, 175, + 176, 22, 46, 17, 177, 26, 179, 183, + 179, 180, 181, 182, 184, 187, 185, 186, + 22, 46, 17, 187, 26 +}; + +static const char _tsip_machine_parser_header_Security_Verify_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 25, 0, 0, 28, 28, 0, + 28, 3, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 0, 0, + 55, 55, 0, 55, 21, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 55, + 23, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 55, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 46, + 46, 0, 46, 15, 0, 0, 0, 55, + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 43, 43, 0, 43, 13, 0, 0, + 0, 0, 0, 0, 0, 55, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 34, + 34, 34, 0, 7, 55, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 31, 31, + 31, 0, 5, 0, 0, 55, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 49, + 49, 0, 49, 17, 55, 0, 0, 0, + 0, 0, 0, 1, 1, 0, 0, 52, + 52, 52, 0, 19, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 55, + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 40, 40, 40, 0, 11, 55, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 37, 37, 37, 0, 9 +}; + +static const int tsip_machine_parser_header_Security_Verify_start = 1; +static const int tsip_machine_parser_header_Security_Verify_first_final = 188; +static const int tsip_machine_parser_header_Security_Verify_error = 0; + +static const int tsip_machine_parser_header_Security_Verify_en_main = 1; + + +/* #line 212 "./ragel/tsip_parser_header_Security_Verify.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Security_Verify_first_final); + (void)(tsip_machine_parser_header_Security_Verify_error); + (void)(tsip_machine_parser_header_Security_Verify_en_main); + +/* #line 682 "./src/headers/tsip_header_Security_Verify.c" */ + { + cs = tsip_machine_parser_header_Security_Verify_start; + } + +/* #line 217 "./ragel/tsip_parser_header_Security_Verify.rl" */ + +/* #line 689 "./src/headers/tsip_header_Security_Verify.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Security_Verify_trans_keys + _tsip_machine_parser_header_Security_Verify_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Security_Verify_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Security_Verify_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Security_Verify_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Security_Verify_indicies[_trans]; + cs = _tsip_machine_parser_header_Security_Verify_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Security_Verify_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Security_Verify_actions + _tsip_machine_parser_header_Security_Verify_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 51 "./ragel/tsip_parser_header_Security_Verify.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 55 "./ragel/tsip_parser_header_Security_Verify.rl" */ + { + if(!curr_securityverify){ + curr_securityverify = tsip_header_Security_Verify_create_null(); + } + } + break; + case 2: +/* #line 61 "./ragel/tsip_parser_header_Security_Verify.rl" */ + { + if(curr_securityverify){ + tsk_list_push_back_data(hdr_securityverifies, ((void**) &curr_securityverify)); + } + } + break; + case 3: +/* #line 67 "./ragel/tsip_parser_header_Security_Verify.rl" */ + { + if(curr_securityverify){ + TSK_PARSER_SET_STRING(curr_securityverify->mech); + } + } + break; + case 4: +/* #line 73 "./ragel/tsip_parser_header_Security_Verify.rl" */ + { + if(curr_securityverify){ + TSK_PARSER_SET_INT(curr_securityverify->port_s); + } + } + break; + case 5: +/* #line 79 "./ragel/tsip_parser_header_Security_Verify.rl" */ + { + if(curr_securityverify){ + TSK_PARSER_SET_INT(curr_securityverify->port_c); + } + } + break; + case 6: +/* #line 85 "./ragel/tsip_parser_header_Security_Verify.rl" */ + { + if(curr_securityverify){ + TSK_PARSER_SET_UINT(curr_securityverify->spi_s); + } + } + break; + case 7: +/* #line 91 "./ragel/tsip_parser_header_Security_Verify.rl" */ + { + if(curr_securityverify){ + TSK_PARSER_SET_UINT(curr_securityverify->spi_c); + } + } + break; + case 8: +/* #line 97 "./ragel/tsip_parser_header_Security_Verify.rl" */ + { + if(curr_securityverify){ + TSK_PARSER_SET_STRING(curr_securityverify->ealg); + } + } + break; + case 9: +/* #line 103 "./ragel/tsip_parser_header_Security_Verify.rl" */ + { + if(curr_securityverify){ + TSK_PARSER_SET_STRING(curr_securityverify->alg); + } + } + break; + case 10: +/* #line 109 "./ragel/tsip_parser_header_Security_Verify.rl" */ + { + if(curr_securityverify){ + TSK_PARSER_SET_STRING(curr_securityverify->prot); + } + } + break; + case 11: +/* #line 115 "./ragel/tsip_parser_header_Security_Verify.rl" */ + { + if(curr_securityverify){ + TSK_PARSER_SET_DOUBLE(curr_securityverify->q); + } + } + break; + case 12: +/* #line 121 "./ragel/tsip_parser_header_Security_Verify.rl" */ + { + if(curr_securityverify){ + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(curr_securityverify)); + } + } + break; + case 13: +/* #line 127 "./ragel/tsip_parser_header_Security_Verify.rl" */ + { + } + break; +/* #line 870 "./src/headers/tsip_header_Security_Verify.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 218 "./ragel/tsip_parser_header_Security_Verify.rl" */ + + if( cs < +/* #line 886 "./src/headers/tsip_header_Security_Verify.c" */ +188 +/* #line 219 "./ragel/tsip_parser_header_Security_Verify.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Security-Verify' header."); + TSK_OBJECT_SAFE_FREE(curr_securityverify); + TSK_OBJECT_SAFE_FREE(hdr_securityverifies); + } + + return hdr_securityverifies; +} + + + + + +//======================================================== +// Security_Verify header object definition +// + +static tsk_object_t* tsip_header_Security_Verify_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Security_Verify_t *Security_Verify = self; + if(Security_Verify){ + + TSIP_HEADER(Security_Verify)->type = tsip_htype_Security_Verify; + TSIP_HEADER(Security_Verify)->serialize = tsip_header_Security_Verify_serialize; + + Security_Verify->q = -1; + } + else{ + TSK_DEBUG_ERROR("Failed to create new Security_Verify header."); + } + return self; +} + +static tsk_object_t* tsip_header_Security_Verify_dtor(tsk_object_t *self) +{ + tsip_header_Security_Verify_t *Security_Verify = self; + if(Security_Verify){ + TSK_FREE(Security_Verify->mech); + TSK_FREE(Security_Verify->alg); + TSK_FREE(Security_Verify->prot); + TSK_FREE(Security_Verify->mod); + TSK_FREE(Security_Verify->ealg); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Security_Verify)); + } + else{ + TSK_DEBUG_ERROR("Null Security_Verify header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Security_Verify_def_s = +{ + sizeof(tsip_header_Security_Verify_t), + tsip_header_Security_Verify_ctor, + tsip_header_Security_Verify_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Security_Verify_def_t = &tsip_header_Security_Verify_def_s; + diff --git a/tinySIP/src/headers/tsip_header_Server.c b/tinySIP/src/headers/tsip_header_Server.c new file mode 100644 index 0000000..130aa05 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Server.c @@ -0,0 +1,316 @@ + +/* #line 1 "./ragel/tsip_parser_header_Server.rl" */ +/* +* 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 tsip_header_Server.c + * @brief SIP Server header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Server.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 71 "./ragel/tsip_parser_header_Server.rl" */ + + +tsip_header_Server_t* tsip_header_server_create(const char* server) +{ + return tsk_object_new(TSIP_HEADER_SERVER_VA_ARGS(server)); +} + +tsip_header_Server_t* tsip_header_server_create_null() +{ + return tsip_header_server_create(tsk_null); +} + +int tsip_header_Server_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Server_t *Server = (const tsip_header_Server_t *)header; + if(Server->value){ + return tsk_buffer_append(output, Server->value, tsk_strlen(Server->value)); + } + return 0; + } + + return -1; +} + +tsip_header_Server_t *tsip_header_Server_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Server_t *hdr_server = tsip_header_server_create_null(); + + const char *tag_start = tsk_null; + + +/* #line 85 "./src/headers/tsip_header_Server.c" */ +static const char _tsip_machine_parser_header_Server_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 2, + 0, 1 +}; + +static const char _tsip_machine_parser_header_Server_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 12, + 15, 18, 19, 20 +}; + +static const char _tsip_machine_parser_header_Server_trans_keys[] = { + 83, 115, 69, 101, 82, 114, 86, 118, + 69, 101, 82, 114, 9, 32, 58, 9, + 13, 32, 13, 10, 0 +}; + +static const char _tsip_machine_parser_header_Server_single_lengths[] = { + 0, 2, 2, 2, 2, 2, 2, 3, + 3, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Server_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; + +static const char _tsip_machine_parser_header_Server_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 15, 18, + 22, 26, 28, 30 +}; + +static const char _tsip_machine_parser_header_Server_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 5, 5, 1, 6, + 6, 1, 6, 6, 7, 1, 9, 10, + 9, 8, 12, 11, 13, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Server_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 8, 10, 9, 10, 11 +}; + +static const char _tsip_machine_parser_header_Server_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 7, 0, 3, 5 +}; + +static const int tsip_machine_parser_header_Server_start = 1; +static const int tsip_machine_parser_header_Server_first_final = 11; +static const int tsip_machine_parser_header_Server_error = 0; + +static const int tsip_machine_parser_header_Server_en_main = 1; + + +/* #line 107 "./ragel/tsip_parser_header_Server.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Server_first_final); + (void)(tsip_machine_parser_header_Server_error); + (void)(tsip_machine_parser_header_Server_en_main); + +/* #line 147 "./src/headers/tsip_header_Server.c" */ + { + cs = tsip_machine_parser_header_Server_start; + } + +/* #line 112 "./ragel/tsip_parser_header_Server.rl" */ + +/* #line 154 "./src/headers/tsip_header_Server.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Server_trans_keys + _tsip_machine_parser_header_Server_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Server_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Server_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Server_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Server_indicies[_trans]; + cs = _tsip_machine_parser_header_Server_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Server_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Server_actions + _tsip_machine_parser_header_Server_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 50 "./ragel/tsip_parser_header_Server.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 54 "./ragel/tsip_parser_header_Server.rl" */ + { + TSK_PARSER_SET_STRING(hdr_server->value); + } + break; + case 2: +/* #line 58 "./ragel/tsip_parser_header_Server.rl" */ + { + } + break; +/* #line 245 "./src/headers/tsip_header_Server.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 113 "./ragel/tsip_parser_header_Server.rl" */ + + if( cs < +/* #line 261 "./src/headers/tsip_header_Server.c" */ +11 +/* #line 114 "./ragel/tsip_parser_header_Server.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Server' header."); + TSK_OBJECT_SAFE_FREE(hdr_server); + } + + return hdr_server; +} + + + + + + + +//======================================================== +// Server header object definition +// + +static tsk_object_t* tsip_header_Server_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Server_t *Server = self; + if(Server){ + TSIP_HEADER(Server)->type = tsip_htype_Server; + TSIP_HEADER(Server)->serialize = tsip_header_Server_serialize; + Server->value = tsk_strdup(va_arg(*app, const char*)); + } + else{ + TSK_DEBUG_ERROR("Failed to create new Server header."); + } + return self; +} + +static tsk_object_t* tsip_header_Server_dtor(tsk_object_t *self) +{ + tsip_header_Server_t *Server = self; + if(Server){ + TSK_FREE(Server->value); + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Server)); + } + else{ + TSK_DEBUG_ERROR("Null Server header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Server_def_s = +{ + sizeof(tsip_header_Server_t), + tsip_header_Server_ctor, + tsip_header_Server_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Server_def_t = &tsip_header_Server_def_s; diff --git a/tinySIP/src/headers/tsip_header_Service_Route.c b/tinySIP/src/headers/tsip_header_Service_Route.c new file mode 100644 index 0000000..0ff1947 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Service_Route.c @@ -0,0 +1,552 @@ + +/* #line 1 "./ragel/tsip_parser_header_Service_Route.rl" */ +/* +* 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 tsip_header_Service_Route.c + * @brief SIP Service-Route header as per RFC 3608. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Service_Route.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_time.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 107 "./ragel/tsip_parser_header_Service_Route.rl" */ + + +tsip_header_Service_Route_t* tsip_header_Service_Route_create(const tsip_uri_t* uri) +{ + return tsk_object_new(TSIP_HEADER_SERVICE_ROUTE_VA_ARGS(uri)); +} + +tsip_header_Service_Route_t* tsip_header_Service_Route_create_null() +{ + return tsip_header_Service_Route_create(tsk_null); +} + +int tsip_header_Service_Route_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Service_Route_t *Service_Route = (const tsip_header_Service_Route_t *)header; + int ret = 0; + + /* Uri with hacked display-name*/ + if((ret = tsip_uri_serialize(Service_Route->uri, tsk_true, tsk_true, output))){ + return ret; + } + + return ret; + } + + return -1; +} + +tsip_header_Service_Routes_L_t *tsip_header_Service_Route_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Service_Routes_L_t *hdr_services = tsk_list_create(); + + const char *tag_start = tsk_null; + tsip_header_Service_Route_t *curr_service = tsk_null; + + +/* #line 91 "./src/headers/tsip_header_Service_Route.c" */ +static const char _tsip_machine_parser_header_Service_Route_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3, 1, 4, 1, 5, 1, 6, 2, + 1, 0, 2, 4, 5 +}; + +static const short _tsip_machine_parser_header_Service_Route_key_offsets[] = { + 0, 0, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 16, + 35, 36, 38, 57, 58, 60, 63, 67, + 79, 82, 82, 83, 88, 89, 106, 107, + 109, 125, 143, 149, 150, 152, 157, 176, + 177, 179, 198, 199, 201, 204, 212, 213, + 215, 220, 225, 226, 228, 232, 238, 255, + 262, 270, 278, 286, 288, 295, 304, 306, + 309, 311, 314, 316, 319, 322, 323, 326, + 327, 330, 331, 340, 349, 357, 365, 373, + 381, 383, 389, 398, 407, 416, 418, 421, + 424, 425, 426, 443, 461, 465, 466, 468, + 476, 477, 479, 483, 489 +}; + +static const char _tsip_machine_parser_header_Service_Route_trans_keys[] = { + 83, 101, 114, 118, 105, 99, 101, 45, + 82, 111, 117, 116, 101, 9, 32, 58, + 9, 13, 32, 33, 34, 37, 39, 60, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 10, 9, 32, 9, 13, + 32, 33, 34, 37, 39, 60, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 10, 9, 32, 9, 32, 60, 65, + 90, 97, 122, 9, 32, 43, 58, 45, + 46, 48, 57, 65, 90, 97, 122, 9, + 32, 58, 62, 9, 13, 32, 44, 59, + 10, 9, 13, 32, 33, 37, 39, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 10, 9, 32, 9, 32, 33, + 37, 39, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 59, 61, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 44, 59, 61, 10, 9, 32, + 9, 32, 44, 59, 61, 9, 13, 32, + 33, 34, 37, 39, 91, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 10, 9, 32, 9, 13, 32, 33, 34, + 37, 39, 91, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 10, 9, + 32, 9, 32, 34, 13, 34, 92, 127, + 0, 8, 10, 31, 10, 9, 32, 9, + 13, 32, 44, 59, 9, 13, 32, 44, + 59, 10, 9, 32, 9, 32, 44, 59, + 0, 9, 11, 12, 14, 127, 9, 13, + 32, 33, 37, 39, 44, 59, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 58, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 58, 48, 57, 65, 70, 97, 102, 46, + 58, 93, 48, 57, 65, 70, 97, 102, + 48, 57, 46, 48, 57, 48, 57, 46, + 48, 57, 48, 57, 93, 48, 57, 93, + 48, 57, 93, 46, 48, 57, 46, 46, + 48, 57, 46, 46, 58, 93, 48, 57, + 65, 70, 97, 102, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 58, 93, 48, + 57, 65, 70, 97, 102, 58, 93, 48, + 57, 65, 70, 97, 102, 58, 93, 48, + 57, 65, 70, 97, 102, 58, 93, 48, + 57, 65, 70, 97, 102, 58, 93, 48, + 57, 65, 70, 97, 102, 46, 58, 93, + 48, 57, 65, 70, 97, 102, 46, 58, + 93, 48, 57, 65, 70, 97, 102, 46, + 58, 93, 48, 57, 65, 70, 97, 102, + 48, 57, 46, 48, 57, 46, 48, 57, + 46, 58, 9, 13, 32, 33, 37, 39, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 60, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 60, 10, 9, 32, 13, 34, 92, 127, + 0, 8, 10, 31, 10, 9, 32, 9, + 13, 32, 60, 0, 9, 11, 12, 14, + 127, 0 +}; + +static const char _tsip_machine_parser_header_Service_Route_single_lengths[] = { + 0, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 3, 9, + 1, 2, 9, 1, 2, 3, 0, 4, + 3, 0, 1, 5, 1, 7, 1, 2, + 6, 10, 6, 1, 2, 5, 9, 1, + 2, 9, 1, 2, 3, 4, 1, 2, + 5, 5, 1, 2, 4, 0, 9, 1, + 2, 2, 2, 2, 1, 3, 0, 1, + 0, 1, 0, 1, 1, 1, 1, 1, + 1, 1, 3, 3, 2, 2, 2, 2, + 2, 0, 3, 3, 3, 0, 1, 1, + 1, 1, 7, 8, 4, 1, 2, 4, + 1, 2, 4, 0, 0 +}; + +static const char _tsip_machine_parser_header_Service_Route_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 5, + 0, 0, 5, 0, 0, 0, 2, 4, + 0, 0, 0, 0, 0, 5, 0, 0, + 5, 4, 0, 0, 0, 0, 5, 0, + 0, 5, 0, 0, 0, 2, 0, 0, + 0, 0, 0, 0, 0, 3, 4, 3, + 3, 3, 3, 0, 3, 3, 1, 1, + 1, 1, 1, 1, 1, 0, 1, 0, + 1, 0, 3, 3, 3, 3, 3, 3, + 0, 3, 3, 3, 3, 1, 1, 1, + 0, 0, 5, 5, 0, 0, 0, 2, + 0, 0, 0, 3, 0 +}; + +static const short _tsip_machine_parser_header_Service_Route_index_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 12, + 14, 16, 18, 20, 22, 24, 26, 30, + 45, 47, 50, 65, 67, 70, 74, 77, + 86, 90, 91, 93, 99, 101, 114, 116, + 119, 131, 146, 153, 155, 158, 164, 179, + 181, 184, 199, 201, 204, 208, 215, 217, + 220, 226, 232, 234, 237, 242, 246, 260, + 265, 271, 277, 283, 286, 291, 298, 300, + 303, 305, 308, 310, 313, 316, 318, 321, + 323, 326, 328, 335, 342, 348, 354, 360, + 366, 369, 373, 380, 387, 394, 396, 399, + 402, 404, 406, 419, 433, 438, 440, 443, + 450, 452, 455, 460, 464 +}; + +static const char _tsip_machine_parser_header_Service_Route_indicies[] = { + 0, 1, 2, 1, 3, 1, 4, 1, + 5, 1, 6, 1, 7, 1, 8, 1, + 9, 1, 10, 1, 11, 1, 12, 1, + 13, 1, 13, 13, 14, 1, 15, 16, + 15, 17, 18, 17, 17, 19, 17, 17, + 17, 17, 17, 17, 1, 20, 1, 21, + 21, 1, 22, 23, 22, 17, 18, 17, + 17, 19, 17, 17, 17, 17, 17, 17, + 1, 24, 1, 25, 25, 1, 25, 25, + 26, 1, 27, 27, 1, 28, 28, 29, + 30, 29, 29, 29, 29, 1, 28, 28, + 30, 1, 31, 32, 31, 33, 34, 33, + 35, 36, 1, 37, 1, 36, 38, 36, + 39, 39, 39, 39, 39, 39, 39, 39, + 39, 1, 40, 1, 41, 41, 1, 41, + 41, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 1, 42, 43, 42, 44, 44, + 44, 45, 46, 47, 44, 44, 44, 44, + 44, 1, 48, 49, 48, 14, 36, 47, + 1, 50, 1, 51, 51, 1, 51, 51, + 14, 36, 47, 1, 47, 52, 47, 53, + 54, 53, 53, 55, 53, 53, 53, 53, + 53, 53, 1, 56, 1, 57, 57, 1, + 57, 58, 57, 53, 54, 53, 53, 55, + 53, 53, 53, 53, 53, 53, 1, 59, + 1, 60, 60, 1, 60, 60, 54, 1, + 61, 62, 63, 1, 1, 1, 54, 64, + 1, 54, 54, 1, 65, 43, 65, 45, + 46, 1, 66, 67, 66, 14, 36, 1, + 68, 1, 69, 69, 1, 69, 69, 14, + 36, 1, 54, 54, 54, 1, 65, 43, + 65, 53, 53, 53, 45, 46, 53, 53, + 53, 53, 53, 1, 71, 70, 70, 70, + 1, 73, 62, 72, 72, 72, 1, 73, + 62, 74, 74, 74, 1, 73, 62, 75, + 75, 75, 1, 73, 62, 1, 77, 76, + 70, 70, 1, 78, 73, 62, 79, 72, + 72, 1, 80, 1, 81, 82, 1, 83, + 1, 84, 85, 1, 86, 1, 62, 87, + 1, 62, 88, 1, 62, 1, 84, 89, + 1, 84, 1, 81, 90, 1, 81, 1, + 78, 73, 62, 91, 74, 74, 1, 78, + 73, 62, 75, 75, 75, 1, 93, 62, + 92, 92, 92, 1, 95, 62, 94, 94, + 94, 1, 95, 62, 96, 96, 96, 1, + 95, 62, 97, 97, 97, 1, 95, 62, + 1, 98, 92, 92, 1, 78, 95, 62, + 99, 94, 94, 1, 78, 95, 62, 100, + 96, 96, 1, 78, 95, 62, 97, 97, + 97, 1, 101, 1, 78, 102, 1, 78, + 103, 1, 78, 1, 77, 1, 104, 105, + 104, 106, 106, 106, 106, 106, 106, 106, + 106, 106, 1, 107, 108, 107, 106, 106, + 106, 109, 106, 106, 106, 106, 106, 106, + 1, 110, 111, 110, 26, 1, 112, 1, + 104, 104, 1, 114, 115, 116, 1, 1, + 1, 113, 117, 1, 113, 113, 1, 107, + 108, 107, 109, 1, 113, 113, 113, 1, + 1, 0 +}; + +static const char _tsip_machine_parser_header_Service_Route_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 15, + 16, 90, 95, 22, 17, 18, 18, 19, + 20, 21, 22, 23, 24, 23, 25, 26, + 27, 27, 28, 15, 29, 100, 30, 33, + 31, 32, 34, 28, 33, 15, 29, 38, + 34, 35, 36, 37, 39, 54, 45, 55, + 40, 41, 42, 43, 44, 46, 48, 53, + 47, 49, 49, 50, 51, 52, 56, 89, + 57, 60, 58, 59, 61, 76, 62, 74, + 63, 64, 72, 65, 66, 70, 67, 68, + 69, 71, 73, 75, 77, 85, 78, 81, + 79, 80, 82, 83, 84, 86, 87, 88, + 91, 93, 90, 92, 19, 22, 92, 19, + 94, 95, 96, 98, 99, 97 +}; + +static const char _tsip_machine_parser_header_Service_Route_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 3, + 3, 15, 15, 3, 0, 0, 3, 3, + 0, 0, 0, 1, 0, 0, 0, 0, + 7, 11, 11, 11, 0, 13, 0, 1, + 0, 0, 18, 18, 0, 18, 9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 18, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 5, 5, 5, 0, 0, + 0, 0, 0, 0, 0, 0 +}; + +static const int tsip_machine_parser_header_Service_Route_start = 1; +static const int tsip_machine_parser_header_Service_Route_first_final = 100; +static const int tsip_machine_parser_header_Service_Route_error = 0; + +static const int tsip_machine_parser_header_Service_Route_en_main = 1; + + +/* #line 148 "./ragel/tsip_parser_header_Service_Route.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Service_Route_first_final); + (void)(tsip_machine_parser_header_Service_Route_error); + (void)(tsip_machine_parser_header_Service_Route_en_main); + +/* #line 338 "./src/headers/tsip_header_Service_Route.c" */ + { + cs = tsip_machine_parser_header_Service_Route_start; + } + +/* #line 153 "./ragel/tsip_parser_header_Service_Route.rl" */ + +/* #line 345 "./src/headers/tsip_header_Service_Route.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Service_Route_trans_keys + _tsip_machine_parser_header_Service_Route_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Service_Route_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Service_Route_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Service_Route_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Service_Route_indicies[_trans]; + cs = _tsip_machine_parser_header_Service_Route_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Service_Route_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Service_Route_actions + _tsip_machine_parser_header_Service_Route_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 51 "./ragel/tsip_parser_header_Service_Route.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 55 "./ragel/tsip_parser_header_Service_Route.rl" */ + { + if(!curr_service){ + curr_service = tsip_header_Service_Route_create_null(); + } + } + break; + case 2: +/* #line 61 "./ragel/tsip_parser_header_Service_Route.rl" */ + { + if(curr_service){ + TSK_PARSER_SET_STRING(curr_service->display_name); + tsk_strunquote(&curr_service->display_name); + } + } + break; + case 3: +/* #line 68 "./ragel/tsip_parser_header_Service_Route.rl" */ + { + if(curr_service && !curr_service->uri){ + int len = (int)(p - tag_start); + if(curr_service && !curr_service->uri){ + if((curr_service->uri = tsip_uri_parse(tag_start, (tsk_size_t)len)) && curr_service->display_name){ + curr_service->uri->display_name = tsk_strdup(curr_service->display_name); + } + } + } + } + break; + case 4: +/* #line 79 "./ragel/tsip_parser_header_Service_Route.rl" */ + { + if(curr_service){ + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(curr_service)); + } + } + break; + case 5: +/* #line 85 "./ragel/tsip_parser_header_Service_Route.rl" */ + { + if(curr_service){ + tsk_list_push_back_data(hdr_services, ((void**) &curr_service)); + } + } + break; + case 6: +/* #line 91 "./ragel/tsip_parser_header_Service_Route.rl" */ + { + } + break; +/* #line 476 "./src/headers/tsip_header_Service_Route.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 154 "./ragel/tsip_parser_header_Service_Route.rl" */ + + if( cs < +/* #line 492 "./src/headers/tsip_header_Service_Route.c" */ +100 +/* #line 155 "./ragel/tsip_parser_header_Service_Route.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Service-Route' header."); + TSK_OBJECT_SAFE_FREE(curr_service); + TSK_OBJECT_SAFE_FREE(hdr_services); + } + + return hdr_services; +} + + + + + +//======================================================== +// Service_Route header object definition +// + +static tsk_object_t* tsip_header_Service_Route_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Service_Route_t *Service_Route = self; + if(Service_Route){ + const tsip_uri_t* uri = va_arg(*app, const tsip_uri_t*); + + TSIP_HEADER(Service_Route)->type = tsip_htype_Service_Route; + TSIP_HEADER(Service_Route)->serialize = tsip_header_Service_Route_serialize; + if(uri){ + Service_Route->uri = tsk_object_ref((void*)uri); + } + } + else{ + TSK_DEBUG_ERROR("Failed to create new Service_Route header."); + } + return self; +} + +static tsk_object_t* tsip_header_Service_Route_dtor(tsk_object_t *self) +{ + tsip_header_Service_Route_t *Service_Route = self; + if(Service_Route){ + TSK_FREE(Service_Route->display_name); + TSK_OBJECT_SAFE_FREE(Service_Route->uri); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Service_Route)); + } + else{ + TSK_DEBUG_ERROR("Null Service_Route header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Service_Route_def_s = +{ + sizeof(tsip_header_Service_Route_t), + tsip_header_Service_Route_ctor, + tsip_header_Service_Route_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Service_Route_def_t = &tsip_header_Service_Route_def_s; diff --git a/tinySIP/src/headers/tsip_header_Session_Expires.c b/tinySIP/src/headers/tsip_header_Session_Expires.c new file mode 100644 index 0000000..567aefd --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Session_Expires.c @@ -0,0 +1,563 @@ + +/* #line 1 "./ragel/tsip_parser_header_Session_Expires.rl" */ + + +/* +* 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 tsip_header_Session_Expires.c + * @brief SIP Min-SE header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Session_Expires.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 79 "./ragel/tsip_parser_header_Session_Expires.rl" */ + + +tsip_header_Session_Expires_t* tsip_header_Session_Expires_create(int64_t delta_seconds, tsk_bool_t refresher_uas) +{ + return tsk_object_new(TSIP_HEADER_SESSION_EXPIRES_VA_ARGS(delta_seconds, refresher_uas)); +} + +int tsip_header_Session_Expires_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Session_Expires_t *Session_Expires = (const tsip_header_Session_Expires_t *)header; + if(Session_Expires->delta_seconds >=0){ + return tsk_buffer_append_2(output, "%lld;refresher=%s", + Session_Expires->delta_seconds, Session_Expires->refresher_uas ? "uas" : "uac"); + } + return 0; + } + + return -1; +} + +tsip_header_Session_Expires_t *tsip_header_Session_Expires_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Session_Expires_t *hdr_session_expires = tsip_header_Session_Expires_create(TSIP_SESSION_EXPIRES_DEFAULT_VALUE, tsk_false); + + const char *tag_start = tsk_null; + + +/* #line 81 "./src/headers/tsip_header_Session_Expires.c" */ +static const char _tsip_machine_parser_header_Session_Expires_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3, 1, 4, 1, 5 +}; + +static const short _tsip_machine_parser_header_Session_Expires_key_offsets[] = { + 0, 0, 4, 6, 8, 10, 12, 14, + 16, 17, 19, 21, 23, 25, 27, 29, + 31, 34, 39, 40, 42, 46, 52, 56, + 57, 59, 62, 81, 82, 84, 102, 121, + 126, 127, 129, 133, 152, 153, 155, 174, + 175, 177, 180, 188, 189, 191, 195, 196, + 202, 220, 227, 235, 243, 251, 253, 260, + 269, 271, 274, 276, 279, 281, 284, 287, + 288, 291, 292, 295, 296, 305, 314, 322, + 330, 338, 346, 348, 354, 363, 372, 381, + 383, 386, 389, 390, 391, 412, 433, 454, + 475, 496, 517, 538, 559, 578, 583, 584, + 586, 590, 611, 612, 614, 635, 655, 677, + 681, 685 +}; + +static const char _tsip_machine_parser_header_Session_Expires_trans_keys[] = { + 83, 88, 115, 120, 69, 101, 83, 115, + 83, 115, 73, 105, 79, 111, 78, 110, + 45, 69, 101, 88, 120, 80, 112, 73, + 105, 82, 114, 69, 101, 83, 115, 9, + 32, 58, 9, 13, 32, 48, 57, 10, + 9, 32, 9, 32, 48, 57, 9, 13, + 32, 59, 48, 57, 9, 13, 32, 59, + 10, 9, 32, 9, 32, 59, 9, 13, + 32, 33, 37, 39, 82, 114, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 10, 9, 32, 9, 32, 33, 37, + 39, 82, 114, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 59, 61, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 59, 61, 10, 9, + 32, 9, 32, 59, 61, 9, 13, 32, + 33, 34, 37, 39, 91, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 10, 9, 32, 9, 13, 32, 33, 34, + 37, 39, 91, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 10, 9, + 32, 9, 32, 34, 13, 34, 92, 127, + 0, 8, 10, 31, 10, 9, 32, 9, + 13, 32, 59, 10, 0, 9, 11, 12, + 14, 127, 9, 13, 32, 33, 37, 39, + 59, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 58, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 58, 48, 57, + 65, 70, 97, 102, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 48, 57, 46, + 48, 57, 48, 57, 46, 48, 57, 48, + 57, 93, 48, 57, 93, 48, 57, 93, + 46, 48, 57, 46, 46, 48, 57, 46, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 46, 58, 93, 48, 57, 65, 70, + 97, 102, 58, 93, 48, 57, 65, 70, + 97, 102, 58, 93, 48, 57, 65, 70, + 97, 102, 58, 93, 48, 57, 65, 70, + 97, 102, 58, 93, 48, 57, 65, 70, + 97, 102, 58, 93, 48, 57, 65, 70, + 97, 102, 46, 58, 93, 48, 57, 65, + 70, 97, 102, 46, 58, 93, 48, 57, + 65, 70, 97, 102, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 48, 57, 46, + 48, 57, 46, 48, 57, 46, 58, 9, + 13, 32, 33, 37, 39, 59, 61, 69, + 101, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 59, 61, 70, 102, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 59, + 61, 82, 114, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 59, 61, 69, 101, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 59, 61, 83, 115, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 33, 37, 39, 59, 61, + 72, 104, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 59, 61, 69, 101, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 59, 61, 82, 114, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 59, 61, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 59, 61, 10, + 9, 32, 9, 32, 59, 61, 9, 13, + 32, 33, 34, 37, 39, 85, 91, 117, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 10, 9, 32, 9, 13, + 32, 33, 34, 37, 39, 85, 91, 117, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 59, 65, 97, 126, 42, 43, 45, + 46, 48, 57, 66, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 59, 67, 83, + 99, 115, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 59, 9, 13, 32, 59, 0 +}; + +static const char _tsip_machine_parser_header_Session_Expires_single_lengths[] = { + 0, 4, 2, 2, 2, 2, 2, 2, + 1, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 1, 2, 2, 4, 4, 1, + 2, 3, 9, 1, 2, 8, 9, 5, + 1, 2, 4, 9, 1, 2, 9, 1, + 2, 3, 4, 1, 2, 4, 1, 0, + 8, 1, 2, 2, 2, 2, 1, 3, + 0, 1, 0, 1, 0, 1, 1, 1, + 1, 1, 1, 1, 3, 3, 2, 2, + 2, 2, 2, 0, 3, 3, 3, 0, + 1, 1, 1, 1, 11, 11, 11, 11, + 11, 11, 11, 11, 9, 5, 1, 2, + 4, 11, 1, 2, 11, 10, 12, 4, + 4, 0 +}; + +static const char _tsip_machine_parser_header_Session_Expires_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 1, 1, 0, 0, + 0, 0, 5, 0, 0, 5, 5, 0, + 0, 0, 0, 5, 0, 0, 5, 0, + 0, 0, 2, 0, 0, 0, 0, 3, + 5, 3, 3, 3, 3, 0, 3, 3, + 1, 1, 1, 1, 1, 1, 1, 0, + 1, 0, 1, 0, 3, 3, 3, 3, + 3, 3, 0, 3, 3, 3, 3, 1, + 1, 1, 0, 0, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 0, 0, 0, + 0, 5, 0, 0, 5, 5, 5, 0, + 0, 0 +}; + +static const short _tsip_machine_parser_header_Session_Expires_index_offsets[] = { + 0, 0, 5, 8, 11, 14, 17, 20, + 23, 25, 28, 31, 34, 37, 40, 43, + 46, 50, 55, 57, 60, 64, 70, 75, + 77, 80, 84, 99, 101, 104, 118, 133, + 139, 141, 144, 149, 164, 166, 169, 184, + 186, 189, 193, 200, 202, 205, 210, 212, + 216, 230, 235, 241, 247, 253, 256, 261, + 268, 270, 273, 275, 278, 280, 283, 286, + 288, 291, 293, 296, 298, 305, 312, 318, + 324, 330, 336, 339, 343, 350, 357, 364, + 366, 369, 372, 374, 376, 393, 410, 427, + 444, 461, 478, 495, 512, 527, 533, 535, + 538, 543, 560, 562, 565, 582, 598, 616, + 621, 626 +}; + +static const char _tsip_machine_parser_header_Session_Expires_indicies[] = { + 0, 2, 0, 2, 1, 3, 3, 1, + 4, 4, 1, 5, 5, 1, 6, 6, + 1, 7, 7, 1, 8, 8, 1, 9, + 1, 10, 10, 1, 11, 11, 1, 12, + 12, 1, 13, 13, 1, 14, 14, 1, + 15, 15, 1, 2, 2, 1, 2, 2, + 16, 1, 16, 17, 16, 18, 1, 19, + 1, 20, 20, 1, 20, 20, 18, 1, + 21, 22, 21, 24, 23, 1, 25, 26, + 25, 27, 1, 28, 1, 29, 29, 1, + 29, 29, 27, 1, 27, 30, 27, 31, + 31, 31, 32, 32, 31, 31, 31, 31, + 31, 31, 1, 33, 1, 34, 34, 1, + 34, 34, 31, 31, 31, 32, 32, 31, + 31, 31, 31, 31, 31, 1, 35, 36, + 35, 37, 37, 37, 38, 39, 37, 37, + 37, 37, 37, 37, 1, 40, 41, 40, + 27, 39, 1, 42, 1, 43, 43, 1, + 43, 43, 27, 39, 1, 39, 44, 39, + 45, 46, 45, 45, 47, 45, 45, 45, + 45, 45, 45, 1, 48, 1, 49, 49, + 1, 49, 50, 49, 45, 46, 45, 45, + 47, 45, 45, 45, 45, 45, 45, 1, + 51, 1, 52, 52, 1, 52, 52, 46, + 1, 53, 54, 55, 1, 1, 1, 46, + 56, 1, 46, 46, 1, 57, 36, 57, + 38, 1, 58, 1, 46, 46, 46, 1, + 57, 36, 57, 45, 45, 45, 38, 45, + 45, 45, 45, 45, 45, 1, 60, 59, + 59, 59, 1, 62, 54, 61, 61, 61, + 1, 62, 54, 63, 63, 63, 1, 62, + 54, 64, 64, 64, 1, 62, 54, 1, + 66, 65, 59, 59, 1, 67, 62, 54, + 68, 61, 61, 1, 69, 1, 70, 71, + 1, 72, 1, 73, 74, 1, 75, 1, + 54, 76, 1, 54, 77, 1, 54, 1, + 73, 78, 1, 73, 1, 70, 79, 1, + 70, 1, 67, 62, 54, 80, 63, 63, + 1, 67, 62, 54, 64, 64, 64, 1, + 82, 54, 81, 81, 81, 1, 84, 54, + 83, 83, 83, 1, 84, 54, 85, 85, + 85, 1, 84, 54, 86, 86, 86, 1, + 84, 54, 1, 87, 81, 81, 1, 67, + 84, 54, 88, 83, 83, 1, 67, 84, + 54, 89, 85, 85, 1, 67, 84, 54, + 86, 86, 86, 1, 90, 1, 67, 91, + 1, 67, 92, 1, 67, 1, 66, 1, + 35, 36, 35, 37, 37, 37, 38, 39, + 93, 93, 37, 37, 37, 37, 37, 37, + 1, 35, 36, 35, 37, 37, 37, 38, + 39, 94, 94, 37, 37, 37, 37, 37, + 37, 1, 35, 36, 35, 37, 37, 37, + 38, 39, 95, 95, 37, 37, 37, 37, + 37, 37, 1, 35, 36, 35, 37, 37, + 37, 38, 39, 96, 96, 37, 37, 37, + 37, 37, 37, 1, 35, 36, 35, 37, + 37, 37, 38, 39, 97, 97, 37, 37, + 37, 37, 37, 37, 1, 35, 36, 35, + 37, 37, 37, 38, 39, 98, 98, 37, + 37, 37, 37, 37, 37, 1, 35, 36, + 35, 37, 37, 37, 38, 39, 99, 99, + 37, 37, 37, 37, 37, 37, 1, 35, + 36, 35, 37, 37, 37, 38, 39, 100, + 100, 37, 37, 37, 37, 37, 37, 1, + 101, 36, 101, 37, 37, 37, 38, 102, + 37, 37, 37, 37, 37, 37, 1, 103, + 104, 103, 27, 102, 1, 105, 1, 106, + 106, 1, 106, 106, 27, 102, 1, 102, + 107, 102, 45, 46, 45, 45, 108, 47, + 108, 45, 45, 45, 45, 45, 45, 1, + 109, 1, 110, 110, 1, 110, 50, 110, + 45, 46, 45, 45, 108, 47, 108, 45, + 45, 45, 45, 45, 45, 1, 57, 36, + 57, 45, 45, 45, 38, 111, 111, 45, + 45, 45, 45, 45, 45, 1, 57, 36, + 57, 45, 45, 45, 38, 112, 113, 112, + 113, 45, 45, 45, 45, 45, 45, 1, + 114, 115, 114, 116, 1, 117, 118, 117, + 119, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Session_Expires_trans_targs[] = { + 2, 0, 16, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, + 17, 18, 21, 19, 20, 22, 46, 21, + 26, 22, 23, 26, 24, 25, 27, 30, + 84, 28, 29, 31, 46, 30, 26, 35, + 31, 32, 33, 34, 36, 48, 42, 49, + 37, 38, 39, 40, 41, 43, 45, 47, + 44, 22, 105, 50, 83, 51, 54, 52, + 53, 55, 70, 56, 68, 57, 58, 66, + 59, 60, 64, 61, 62, 63, 65, 67, + 69, 71, 79, 72, 75, 73, 74, 76, + 77, 78, 80, 81, 82, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 97, 93, + 94, 95, 96, 98, 101, 99, 100, 102, + 103, 104, 22, 46, 26, 22, 46, 26 +}; + +static const char _tsip_machine_parser_header_Session_Expires_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 3, 3, 0, + 3, 0, 0, 0, 0, 0, 0, 1, + 1, 0, 0, 9, 9, 0, 9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 9, 11, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 9, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, + 0, 0, 7, 7, 7, 5, 5, 5 +}; + +static const int tsip_machine_parser_header_Session_Expires_start = 1; +static const int tsip_machine_parser_header_Session_Expires_first_final = 105; +static const int tsip_machine_parser_header_Session_Expires_error = 0; + +static const int tsip_machine_parser_header_Session_Expires_en_main = 1; + + +/* #line 111 "./ragel/tsip_parser_header_Session_Expires.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Session_Expires_first_final); + (void)(tsip_machine_parser_header_Session_Expires_error); + (void)(tsip_machine_parser_header_Session_Expires_en_main); + +/* #line 375 "./src/headers/tsip_header_Session_Expires.c" */ + { + cs = tsip_machine_parser_header_Session_Expires_start; + } + +/* #line 116 "./ragel/tsip_parser_header_Session_Expires.rl" */ + +/* #line 382 "./src/headers/tsip_header_Session_Expires.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Session_Expires_trans_keys + _tsip_machine_parser_header_Session_Expires_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Session_Expires_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Session_Expires_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Session_Expires_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Session_Expires_indicies[_trans]; + cs = _tsip_machine_parser_header_Session_Expires_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Session_Expires_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Session_Expires_actions + _tsip_machine_parser_header_Session_Expires_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 50 "./ragel/tsip_parser_header_Session_Expires.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 54 "./ragel/tsip_parser_header_Session_Expires.rl" */ + { + TSK_PARSER_SET_INTEGER(hdr_session_expires->delta_seconds); + } + break; + case 2: +/* #line 58 "./ragel/tsip_parser_header_Session_Expires.rl" */ + { + hdr_session_expires->refresher_uas = tsk_true; + } + break; + case 3: +/* #line 61 "./ragel/tsip_parser_header_Session_Expires.rl" */ + { + hdr_session_expires->refresher_uas = tsk_false; + } + break; + case 4: +/* #line 65 "./ragel/tsip_parser_header_Session_Expires.rl" */ + { + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(hdr_session_expires)); + } + break; + case 5: +/* #line 69 "./ragel/tsip_parser_header_Session_Expires.rl" */ + { + } + break; +/* #line 491 "./src/headers/tsip_header_Session_Expires.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 117 "./ragel/tsip_parser_header_Session_Expires.rl" */ + + if( cs < +/* #line 507 "./src/headers/tsip_header_Session_Expires.c" */ +105 +/* #line 118 "./ragel/tsip_parser_header_Session_Expires.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Session-Expires' header."); + TSK_OBJECT_SAFE_FREE(hdr_session_expires); + } + + return hdr_session_expires; +} + + + + + + + +//======================================================== +// Session_Expires header object definition +// + +static tsk_object_t* tsip_header_Session_Expires_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Session_Expires_t *Session_Expires = self; + if(Session_Expires){ + TSIP_HEADER(Session_Expires)->type = tsip_htype_Session_Expires; + TSIP_HEADER(Session_Expires)->serialize = tsip_header_Session_Expires_serialize; + Session_Expires->delta_seconds = va_arg(*app, int64_t); + Session_Expires->refresher_uas = va_arg(*app, tsk_bool_t); + } + else{ + TSK_DEBUG_ERROR("Failed to create new Session-Expires header."); + } + return self; +} + +static tsk_object_t* tsip_header_Session_Expires_dtor(tsk_object_t *self) +{ + tsip_header_Session_Expires_t *Session_Expires = self; + if(Session_Expires){ + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Session_Expires)); + } + else{ + TSK_DEBUG_ERROR("Null Session-Expires header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Session_Expires_def_s = +{ + sizeof(tsip_header_Session_Expires_t), + tsip_header_Session_Expires_ctor, + tsip_header_Session_Expires_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Session_Expires_def_t = &tsip_header_Session_Expires_def_s; + diff --git a/tinySIP/src/headers/tsip_header_Subject.c b/tinySIP/src/headers/tsip_header_Subject.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Subject.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Subscription_State.c b/tinySIP/src/headers/tsip_header_Subscription_State.c new file mode 100644 index 0000000..bfb3b30 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Subscription_State.c @@ -0,0 +1,700 @@ + +/* #line 1 "./ragel/tsip_parser_header_Subscription_State.rl" */ +/* +* 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 tsip_header_Subscription_State.c + * @brief SIP Subscription_State header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Subscription_State.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 81 "./ragel/tsip_parser_header_Subscription_State.rl" */ + + +tsip_header_Subscription_State_t* tsip_header_Subscription_State_create() +{ + return tsk_object_new(tsip_header_Subscription_State_def_t); +} + + +int tsip_header_Subscription_State_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Subscription_State_t *Subscription_State = (const tsip_header_Subscription_State_t *)header; + int ret; + + ret = tsk_buffer_append_2(output, "%s%s%s", + Subscription_State->state, + + Subscription_State->reason ? ";reason=" : "", + Subscription_State->reason ? Subscription_State->reason : "" + ); + if(!ret && Subscription_State->expires>=0){ + ret = tsk_buffer_append_2(output, ";expires=%d", Subscription_State->expires); + } + if(!ret && Subscription_State->retry_after>=0){ + ret = tsk_buffer_append_2(output, ";retry-after=%d", Subscription_State->retry_after); + } + + return ret; + } + + return -1; +} + +tsip_header_Subscription_State_t *tsip_header_Subscription_State_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Subscription_State_t *hdr_Subscription_State = tsip_header_Subscription_State_create(); + + const char *tag_start = tsk_null; + + +/* #line 91 "./src/headers/tsip_header_Subscription_State.c" */ +static const char _tsip_machine_parser_header_Subscription_State_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3, 1, 4, 1, 5, 1, 6 +}; + +static const short _tsip_machine_parser_header_Subscription_State_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 12, + 14, 16, 18, 20, 22, 24, 25, 27, + 29, 31, 33, 35, 38, 55, 56, 58, + 74, 92, 96, 97, 99, 102, 123, 124, + 126, 146, 165, 170, 171, 173, 177, 196, + 197, 199, 218, 219, 221, 224, 232, 233, + 235, 239, 240, 246, 264, 271, 279, 287, + 295, 297, 304, 313, 315, 318, 320, 323, + 325, 328, 331, 332, 335, 336, 339, 340, + 349, 358, 366, 374, 382, 390, 392, 398, + 407, 416, 425, 427, 430, 433, 434, 435, + 456, 477, 498, 519, 540, 561, 580, 585, + 586, 588, 592, 611, 612, 614, 633, 639, + 660, 683, 704, 725, 746, 765, 770, 771, + 773, 777, 796, 797, 799, 818, 836, 857, + 878, 897, 918, 939, 960, 981, 1002, 1021, + 1026, 1027, 1029, 1033, 1052, 1053, 1055, 1074, + 1080 +}; + +static const char _tsip_machine_parser_header_Subscription_State_trans_keys[] = { + 83, 115, 85, 117, 66, 98, 83, 115, + 67, 99, 82, 114, 73, 105, 80, 112, + 84, 116, 73, 105, 79, 111, 78, 110, + 45, 83, 115, 84, 116, 65, 97, 84, + 116, 69, 101, 9, 32, 58, 9, 13, + 32, 33, 37, 39, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 10, + 9, 32, 9, 32, 33, 37, 39, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 59, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 59, + 10, 9, 32, 9, 32, 59, 9, 13, + 32, 33, 37, 39, 69, 82, 101, 114, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 10, 9, 32, 9, 32, + 33, 37, 39, 69, 82, 101, 114, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 59, 61, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 59, 61, 10, 9, 32, 9, 32, 59, + 61, 9, 13, 32, 33, 34, 37, 39, + 91, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 10, 9, 32, 9, + 13, 32, 33, 34, 37, 39, 91, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 10, 9, 32, 9, 32, 34, + 13, 34, 92, 127, 0, 8, 10, 31, + 10, 9, 32, 9, 13, 32, 59, 10, + 0, 9, 11, 12, 14, 127, 9, 13, + 32, 33, 37, 39, 59, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 58, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 58, 48, 57, 65, 70, 97, 102, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 48, 57, 46, 48, 57, 48, 57, + 46, 48, 57, 48, 57, 93, 48, 57, + 93, 48, 57, 93, 46, 48, 57, 46, + 46, 48, 57, 46, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 46, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 46, 58, + 93, 48, 57, 65, 70, 97, 102, 46, + 58, 93, 48, 57, 65, 70, 97, 102, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 48, 57, 46, 48, 57, 46, 48, + 57, 46, 58, 9, 13, 32, 33, 37, + 39, 59, 61, 88, 120, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 33, 37, 39, 59, 61, + 80, 112, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 59, 61, 73, 105, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 59, 61, 82, 114, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 59, 61, 69, + 101, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 59, 61, 83, 115, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 59, + 61, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 59, + 61, 10, 9, 32, 9, 32, 59, 61, + 9, 13, 32, 33, 34, 37, 39, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 10, 9, 32, 9, 13, + 32, 33, 34, 37, 39, 91, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 59, 48, 57, 9, + 13, 32, 33, 37, 39, 59, 61, 69, + 101, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 59, 61, 65, 84, 97, 116, + 126, 42, 43, 45, 46, 48, 57, 66, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 59, 61, 83, 115, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 33, 37, 39, 59, 61, + 79, 111, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 59, 61, 78, 110, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 59, 61, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 59, 61, 10, 9, 32, 9, 32, 59, + 61, 9, 13, 32, 33, 34, 37, 39, + 91, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 10, 9, 32, 9, + 13, 32, 33, 34, 37, 39, 91, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 59, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 59, 61, 82, 114, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 59, + 61, 89, 121, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 45, 46, 59, 61, + 126, 42, 43, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 59, + 61, 65, 97, 126, 42, 43, 45, 46, + 48, 57, 66, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 59, 61, 70, 102, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 59, 61, 84, 116, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 33, 37, 39, 59, 61, + 69, 101, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 59, 61, 82, 114, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 59, 61, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 59, 61, 10, 9, 32, 9, 32, 59, + 61, 9, 13, 32, 33, 34, 37, 39, + 91, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 10, 9, 32, 9, + 13, 32, 33, 34, 37, 39, 91, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 59, 48, 57, + 0 +}; + +static const char _tsip_machine_parser_header_Subscription_State_single_lengths[] = { + 0, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 2, 2, + 2, 2, 2, 3, 7, 1, 2, 6, + 8, 4, 1, 2, 3, 11, 1, 2, + 10, 9, 5, 1, 2, 4, 9, 1, + 2, 9, 1, 2, 3, 4, 1, 2, + 4, 1, 0, 8, 1, 2, 2, 2, + 2, 1, 3, 0, 1, 0, 1, 0, + 1, 1, 1, 1, 1, 1, 1, 3, + 3, 2, 2, 2, 2, 2, 0, 3, + 3, 3, 0, 1, 1, 1, 1, 11, + 11, 11, 11, 11, 11, 9, 5, 1, + 2, 4, 9, 1, 2, 9, 4, 11, + 13, 11, 11, 11, 9, 5, 1, 2, + 4, 9, 1, 2, 9, 8, 11, 11, + 11, 11, 11, 11, 11, 11, 9, 5, + 1, 2, 4, 9, 1, 2, 9, 4, + 0 +}; + +static const char _tsip_machine_parser_header_Subscription_State_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 5, 0, 0, 5, + 5, 0, 0, 0, 0, 5, 0, 0, + 5, 5, 0, 0, 0, 0, 5, 0, + 0, 5, 0, 0, 0, 2, 0, 0, + 0, 0, 3, 5, 3, 3, 3, 3, + 0, 3, 3, 1, 1, 1, 1, 1, + 1, 1, 0, 1, 0, 1, 0, 3, + 3, 3, 3, 3, 3, 0, 3, 3, + 3, 3, 1, 1, 1, 0, 0, 5, + 5, 5, 5, 5, 5, 5, 0, 0, + 0, 0, 5, 0, 0, 5, 1, 5, + 5, 5, 5, 5, 5, 0, 0, 0, + 0, 5, 0, 0, 5, 5, 5, 5, + 4, 5, 5, 5, 5, 5, 5, 0, + 0, 0, 0, 5, 0, 0, 5, 1, + 0 +}; + +static const short _tsip_machine_parser_header_Subscription_State_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 15, 18, + 21, 24, 27, 30, 33, 36, 38, 41, + 44, 47, 50, 53, 57, 70, 72, 75, + 87, 101, 106, 108, 111, 115, 132, 134, + 137, 153, 168, 174, 176, 179, 184, 199, + 201, 204, 219, 221, 224, 228, 235, 237, + 240, 245, 247, 251, 265, 270, 276, 282, + 288, 291, 296, 303, 305, 308, 310, 313, + 315, 318, 321, 323, 326, 328, 331, 333, + 340, 347, 353, 359, 365, 371, 374, 378, + 385, 392, 399, 401, 404, 407, 409, 411, + 428, 445, 462, 479, 496, 513, 528, 534, + 536, 539, 544, 559, 561, 564, 579, 585, + 602, 621, 638, 655, 672, 687, 693, 695, + 698, 703, 718, 720, 723, 738, 752, 769, + 786, 802, 819, 836, 853, 870, 887, 902, + 908, 910, 913, 918, 933, 935, 938, 953, + 959 +}; + +static const unsigned char _tsip_machine_parser_header_Subscription_State_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 5, 5, 1, 6, + 6, 1, 7, 7, 1, 8, 8, 1, + 9, 9, 1, 10, 10, 1, 11, 11, + 1, 12, 12, 1, 13, 1, 14, 14, + 1, 15, 15, 1, 16, 16, 1, 17, + 17, 1, 18, 18, 1, 18, 18, 19, + 1, 19, 20, 19, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 1, 22, 1, + 23, 23, 1, 23, 23, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 1, 24, + 25, 24, 26, 26, 26, 27, 26, 26, + 26, 26, 26, 26, 1, 28, 29, 28, + 30, 1, 31, 1, 32, 32, 1, 32, + 32, 30, 1, 30, 33, 30, 34, 34, + 34, 35, 36, 35, 36, 34, 34, 34, + 34, 34, 34, 1, 37, 1, 38, 38, + 1, 38, 38, 34, 34, 34, 35, 36, + 35, 36, 34, 34, 34, 34, 34, 34, + 1, 39, 40, 39, 41, 41, 41, 42, + 43, 41, 41, 41, 41, 41, 41, 1, + 44, 45, 44, 30, 43, 1, 46, 1, + 47, 47, 1, 47, 47, 30, 43, 1, + 43, 48, 43, 49, 50, 49, 49, 51, + 49, 49, 49, 49, 49, 49, 1, 52, + 1, 53, 53, 1, 53, 54, 53, 49, + 50, 49, 49, 51, 49, 49, 49, 49, + 49, 49, 1, 55, 1, 56, 56, 1, + 56, 56, 50, 1, 57, 58, 59, 1, + 1, 1, 50, 60, 1, 50, 50, 1, + 61, 40, 61, 42, 1, 62, 1, 50, + 50, 50, 1, 61, 40, 61, 49, 49, + 49, 42, 49, 49, 49, 49, 49, 49, + 1, 64, 63, 63, 63, 1, 66, 58, + 65, 65, 65, 1, 66, 58, 67, 67, + 67, 1, 66, 58, 68, 68, 68, 1, + 66, 58, 1, 70, 69, 63, 63, 1, + 71, 66, 58, 72, 65, 65, 1, 73, + 1, 74, 75, 1, 76, 1, 77, 78, + 1, 79, 1, 58, 80, 1, 58, 81, + 1, 58, 1, 77, 82, 1, 77, 1, + 74, 83, 1, 74, 1, 71, 66, 58, + 84, 67, 67, 1, 71, 66, 58, 68, + 68, 68, 1, 86, 58, 85, 85, 85, + 1, 88, 58, 87, 87, 87, 1, 88, + 58, 89, 89, 89, 1, 88, 58, 90, + 90, 90, 1, 88, 58, 1, 91, 85, + 85, 1, 71, 88, 58, 92, 87, 87, + 1, 71, 88, 58, 93, 89, 89, 1, + 71, 88, 58, 90, 90, 90, 1, 94, + 1, 71, 95, 1, 71, 96, 1, 71, + 1, 70, 1, 39, 40, 39, 41, 41, + 41, 42, 43, 97, 97, 41, 41, 41, + 41, 41, 41, 1, 39, 40, 39, 41, + 41, 41, 42, 43, 98, 98, 41, 41, + 41, 41, 41, 41, 1, 39, 40, 39, + 41, 41, 41, 42, 43, 99, 99, 41, + 41, 41, 41, 41, 41, 1, 39, 40, + 39, 41, 41, 41, 42, 43, 100, 100, + 41, 41, 41, 41, 41, 41, 1, 39, + 40, 39, 41, 41, 41, 42, 43, 101, + 101, 41, 41, 41, 41, 41, 41, 1, + 39, 40, 39, 41, 41, 41, 42, 43, + 102, 102, 41, 41, 41, 41, 41, 41, + 1, 103, 40, 103, 41, 41, 41, 42, + 104, 41, 41, 41, 41, 41, 41, 1, + 105, 106, 105, 30, 104, 1, 107, 1, + 108, 108, 1, 108, 108, 30, 104, 1, + 104, 109, 104, 49, 50, 49, 49, 51, + 49, 49, 49, 110, 49, 49, 1, 111, + 1, 112, 112, 1, 112, 54, 112, 49, + 50, 49, 49, 51, 49, 49, 49, 110, + 49, 49, 1, 113, 114, 113, 116, 115, + 1, 39, 40, 39, 41, 41, 41, 42, + 43, 117, 117, 41, 41, 41, 41, 41, + 41, 1, 39, 40, 39, 41, 41, 41, + 42, 43, 118, 119, 118, 119, 41, 41, + 41, 41, 41, 41, 1, 39, 40, 39, + 41, 41, 41, 42, 43, 120, 120, 41, + 41, 41, 41, 41, 41, 1, 39, 40, + 39, 41, 41, 41, 42, 43, 121, 121, + 41, 41, 41, 41, 41, 41, 1, 39, + 40, 39, 41, 41, 41, 42, 43, 122, + 122, 41, 41, 41, 41, 41, 41, 1, + 123, 40, 123, 41, 41, 41, 42, 124, + 41, 41, 41, 41, 41, 41, 1, 125, + 126, 125, 30, 124, 1, 127, 1, 128, + 128, 1, 128, 128, 30, 124, 1, 124, + 129, 124, 130, 50, 130, 130, 51, 130, + 130, 130, 130, 130, 130, 1, 131, 1, + 132, 132, 1, 132, 54, 132, 130, 50, + 130, 130, 51, 130, 130, 130, 130, 130, + 130, 1, 133, 134, 133, 135, 135, 135, + 136, 135, 135, 135, 135, 135, 135, 1, + 39, 40, 39, 41, 41, 41, 42, 43, + 137, 137, 41, 41, 41, 41, 41, 41, + 1, 39, 40, 39, 41, 41, 41, 42, + 43, 138, 138, 41, 41, 41, 41, 41, + 41, 1, 39, 40, 39, 41, 41, 41, + 139, 41, 42, 43, 41, 41, 41, 41, + 41, 1, 39, 40, 39, 41, 41, 41, + 42, 43, 140, 140, 41, 41, 41, 41, + 41, 41, 1, 39, 40, 39, 41, 41, + 41, 42, 43, 141, 141, 41, 41, 41, + 41, 41, 41, 1, 39, 40, 39, 41, + 41, 41, 42, 43, 142, 142, 41, 41, + 41, 41, 41, 41, 1, 39, 40, 39, + 41, 41, 41, 42, 43, 143, 143, 41, + 41, 41, 41, 41, 41, 1, 39, 40, + 39, 41, 41, 41, 42, 43, 144, 144, + 41, 41, 41, 41, 41, 41, 1, 145, + 40, 145, 41, 41, 41, 42, 146, 41, + 41, 41, 41, 41, 41, 1, 147, 148, + 147, 30, 146, 1, 149, 1, 150, 150, + 1, 150, 150, 30, 146, 1, 146, 151, + 146, 49, 50, 49, 49, 51, 49, 49, + 49, 152, 49, 49, 1, 153, 1, 154, + 154, 1, 154, 54, 154, 49, 50, 49, + 49, 51, 49, 49, 49, 152, 49, 49, + 1, 155, 156, 155, 158, 157, 1, 1, + 0 +}; + +static const unsigned char _tsip_machine_parser_header_Subscription_State_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 24, 22, 23, + 25, 49, 24, 29, 25, 26, 29, 27, + 28, 30, 33, 87, 103, 31, 32, 34, + 49, 33, 29, 38, 34, 35, 36, 37, + 39, 51, 45, 52, 40, 41, 42, 43, + 44, 46, 48, 50, 47, 25, 136, 53, + 86, 54, 57, 55, 56, 58, 73, 59, + 71, 60, 61, 69, 62, 63, 67, 64, + 65, 66, 68, 70, 72, 74, 82, 75, + 78, 76, 77, 79, 80, 81, 83, 84, + 85, 88, 89, 90, 91, 92, 93, 94, + 98, 94, 95, 96, 97, 99, 102, 100, + 101, 25, 49, 102, 29, 104, 105, 118, + 106, 107, 108, 109, 113, 109, 110, 111, + 112, 114, 117, 115, 116, 25, 49, 117, + 29, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 131, 127, 128, 129, 130, 132, + 135, 133, 134, 25, 49, 135, 29 +}; + +static const char _tsip_machine_parser_header_Subscription_State_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 3, 3, 0, 3, 0, 0, 0, 0, + 0, 0, 1, 1, 1, 0, 0, 11, + 11, 0, 11, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 11, 13, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 11, + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 7, 7, 0, 7, 0, 0, 0, + 0, 0, 0, 11, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 5, 5, 0, + 5, 0, 0, 0, 0, 0, 0, 0, + 0, 11, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 9, 9, 0, 9 +}; + +static const int tsip_machine_parser_header_Subscription_State_start = 1; +static const int tsip_machine_parser_header_Subscription_State_first_final = 136; +static const int tsip_machine_parser_header_Subscription_State_error = 0; + +static const int tsip_machine_parser_header_Subscription_State_en_main = 1; + + +/* #line 125 "./ragel/tsip_parser_header_Subscription_State.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Subscription_State_first_final); + (void)(tsip_machine_parser_header_Subscription_State_error); + (void)(tsip_machine_parser_header_Subscription_State_en_main); + +/* #line 503 "./src/headers/tsip_header_Subscription_State.c" */ + { + cs = tsip_machine_parser_header_Subscription_State_start; + } + +/* #line 130 "./ragel/tsip_parser_header_Subscription_State.rl" */ + +/* #line 510 "./src/headers/tsip_header_Subscription_State.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Subscription_State_trans_keys + _tsip_machine_parser_header_Subscription_State_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Subscription_State_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Subscription_State_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Subscription_State_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Subscription_State_indicies[_trans]; + cs = _tsip_machine_parser_header_Subscription_State_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Subscription_State_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Subscription_State_actions + _tsip_machine_parser_header_Subscription_State_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 48 "./ragel/tsip_parser_header_Subscription_State.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 52 "./ragel/tsip_parser_header_Subscription_State.rl" */ + { + TSK_PARSER_SET_STRING(hdr_Subscription_State->state); + } + break; + case 2: +/* #line 56 "./ragel/tsip_parser_header_Subscription_State.rl" */ + { + TSK_PARSER_SET_STRING(hdr_Subscription_State->reason); + } + break; + case 3: +/* #line 60 "./ragel/tsip_parser_header_Subscription_State.rl" */ + { + TSK_PARSER_SET_INTEGER(hdr_Subscription_State->expires); + } + break; + case 4: +/* #line 64 "./ragel/tsip_parser_header_Subscription_State.rl" */ + { + TSK_PARSER_SET_INTEGER(hdr_Subscription_State->retry_after); + } + break; + case 5: +/* #line 68 "./ragel/tsip_parser_header_Subscription_State.rl" */ + { + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(hdr_Subscription_State)); + } + break; + case 6: +/* #line 72 "./ragel/tsip_parser_header_Subscription_State.rl" */ + { + } + break; +/* #line 625 "./src/headers/tsip_header_Subscription_State.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 131 "./ragel/tsip_parser_header_Subscription_State.rl" */ + + if( cs < +/* #line 641 "./src/headers/tsip_header_Subscription_State.c" */ +136 +/* #line 132 "./ragel/tsip_parser_header_Subscription_State.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Subscription-State' header."); + TSK_OBJECT_SAFE_FREE(hdr_Subscription_State); + } + + return hdr_Subscription_State; +} + + + + + + + +//======================================================== +// Subscription_State header object definition +// + +static tsk_object_t* tsip_header_Subscription_State_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Subscription_State_t *Subscription_State = self; + if(Subscription_State){ + TSIP_HEADER(Subscription_State)->type = tsip_htype_Subscription_State; + TSIP_HEADER(Subscription_State)->serialize = tsip_header_Subscription_State_serialize; + + Subscription_State->expires = -1; + Subscription_State->retry_after = -1; + } + else{ + TSK_DEBUG_ERROR("Failed to create new Subscription_State header."); + } + return self; +} + +static tsk_object_t* tsip_header_Subscription_State_dtor(tsk_object_t *self) +{ + tsip_header_Subscription_State_t *Subscription_State = self; + if(Subscription_State){ + TSK_FREE(Subscription_State->state); + TSK_FREE(Subscription_State->reason); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Subscription_State)); + } + else{ + TSK_DEBUG_ERROR("Null Subscription_State header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Subscription_State_def_s = +{ + sizeof(tsip_header_Subscription_State_t), + tsip_header_Subscription_State_ctor, + tsip_header_Subscription_State_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Subscription_State_def_t = &tsip_header_Subscription_State_def_s; diff --git a/tinySIP/src/headers/tsip_header_Supported.c b/tinySIP/src/headers/tsip_header_Supported.c new file mode 100644 index 0000000..2028bfd --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Supported.c @@ -0,0 +1,361 @@ + +/* #line 1 "./ragel/tsip_parser_header_Supported.rl" */ +/* +* 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 tsip_header_Supported.c + * @brief SIP Supported/k header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Supported.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 66 "./ragel/tsip_parser_header_Supported.rl" */ + + +tsip_header_Supported_t* tsip_header_Supported_create(const char* option) +{ + return tsk_object_new(TSIP_HEADER_SUPPORTED_VA_ARGS(option)); +} + +tsip_header_Supported_t* tsip_header_Supported_create_null() +{ + return tsip_header_Supported_create(tsk_null); +} + +int tsip_header_Supported_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Supported_t *Supported = (const tsip_header_Supported_t *)header; + tsk_list_item_t *item; + tsk_string_t *str; + int ret = 0; + + tsk_list_foreach(item, Supported->options){ + str = item->data; + if(item == Supported->options->head){ + ret = tsk_buffer_append(output, str->value, tsk_strlen(str->value)); + } + else{ + ret = tsk_buffer_append_2(output, ",%s", str->value); + } + } + + return ret; + } + + return -1; +} + +tsip_header_Supported_t *tsip_header_Supported_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Supported_t *hdr_supported = tsip_header_Supported_create_null(); + + const char *tag_start = tsk_null; + + +/* #line 96 "./src/headers/tsip_header_Supported.c" */ +static const char _tsip_machine_parser_header_Supported_actions[] = { + 0, 1, 0, 1, 1, 1, 2 +}; + +static const char _tsip_machine_parser_header_Supported_key_offsets[] = { + 0, 0, 4, 7, 24, 25, 41, 45, + 46, 48, 51, 68, 69, 71, 87, 89, + 91, 93, 95, 97, 99, 101, 103 +}; + +static const char _tsip_machine_parser_header_Supported_trans_keys[] = { + 75, 83, 107, 115, 9, 32, 58, 9, + 13, 32, 33, 37, 39, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 10, 9, 13, 32, 33, 37, 39, 44, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 44, 10, 9, 32, + 9, 32, 44, 9, 13, 32, 33, 37, + 39, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 10, 9, 32, 9, + 32, 33, 37, 39, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 85, + 117, 80, 112, 80, 112, 79, 111, 82, + 114, 84, 116, 69, 101, 68, 100, 0 +}; + +static const char _tsip_machine_parser_header_Supported_single_lengths[] = { + 0, 4, 3, 7, 1, 8, 4, 1, + 2, 3, 7, 1, 2, 6, 2, 2, + 2, 2, 2, 2, 2, 2, 0 +}; + +static const char _tsip_machine_parser_header_Supported_range_lengths[] = { + 0, 0, 0, 5, 0, 4, 0, 0, + 0, 0, 5, 0, 0, 5, 0, 0, + 0, 0, 0, 0, 0, 0, 0 +}; + +static const unsigned char _tsip_machine_parser_header_Supported_index_offsets[] = { + 0, 0, 5, 9, 22, 24, 37, 42, + 44, 47, 51, 64, 66, 69, 81, 84, + 87, 90, 93, 96, 99, 102, 105 +}; + +static const char _tsip_machine_parser_header_Supported_indicies[] = { + 0, 2, 0, 2, 1, 0, 0, 3, + 1, 3, 4, 3, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 1, 6, 1, + 7, 8, 7, 9, 9, 9, 10, 9, + 9, 9, 9, 9, 1, 11, 12, 11, + 13, 1, 14, 1, 15, 15, 1, 15, + 15, 13, 1, 13, 16, 13, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 1, + 17, 1, 18, 18, 1, 18, 18, 5, + 5, 5, 5, 5, 5, 5, 5, 5, + 1, 19, 19, 1, 20, 20, 1, 21, + 21, 1, 22, 22, 1, 23, 23, 1, + 24, 24, 1, 25, 25, 1, 0, 0, + 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Supported_trans_targs[] = { + 2, 0, 14, 3, 4, 5, 22, 6, + 4, 5, 10, 6, 7, 10, 8, 9, + 11, 12, 13, 15, 16, 17, 18, 19, + 20, 21 +}; + +static const char _tsip_machine_parser_header_Supported_trans_actions[] = { + 0, 0, 0, 0, 0, 1, 5, 3, + 3, 0, 3, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0 +}; + +static const int tsip_machine_parser_header_Supported_start = 1; +static const int tsip_machine_parser_header_Supported_first_final = 22; +static const int tsip_machine_parser_header_Supported_error = 0; + +static const int tsip_machine_parser_header_Supported_en_main = 1; + + +/* #line 113 "./ragel/tsip_parser_header_Supported.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Supported_first_final); + (void)(tsip_machine_parser_header_Supported_error); + (void)(tsip_machine_parser_header_Supported_en_main); + +/* #line 185 "./src/headers/tsip_header_Supported.c" */ + { + cs = tsip_machine_parser_header_Supported_start; + } + +/* #line 118 "./ragel/tsip_parser_header_Supported.rl" */ + +/* #line 192 "./src/headers/tsip_header_Supported.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Supported_trans_keys + _tsip_machine_parser_header_Supported_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Supported_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Supported_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Supported_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Supported_indicies[_trans]; + cs = _tsip_machine_parser_header_Supported_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Supported_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Supported_actions + _tsip_machine_parser_header_Supported_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 50 "./ragel/tsip_parser_header_Supported.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 54 "./ragel/tsip_parser_header_Supported.rl" */ + { + TSK_PARSER_ADD_STRING(hdr_supported->options); + } + break; + case 2: +/* #line 58 "./ragel/tsip_parser_header_Supported.rl" */ + { + } + break; +/* #line 283 "./src/headers/tsip_header_Supported.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 119 "./ragel/tsip_parser_header_Supported.rl" */ + + if( cs < +/* #line 299 "./src/headers/tsip_header_Supported.c" */ +22 +/* #line 120 "./ragel/tsip_parser_header_Supported.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Supported' header."); + TSK_OBJECT_SAFE_FREE(hdr_supported); + } + + return hdr_supported; +} + + + + + + + +//======================================================== +// Supported header object definition +// + +static tsk_object_t* tsip_header_Supported_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Supported_t *Supported = self; + if(Supported){ + const char* option; + + TSIP_HEADER(Supported)->type = tsip_htype_Supported; + TSIP_HEADER(Supported)->serialize = tsip_header_Supported_serialize; + + if((option = va_arg(*app, const char*))){ + tsk_string_t* string = tsk_string_create(option); + Supported->options = tsk_list_create(); + + tsk_list_push_back_data(Supported->options, ((void**) &string)); + } + } + else{ + TSK_DEBUG_ERROR("Failed to create new Supported header."); + } + return self; +} + +static tsk_object_t* tsip_header_Supported_dtor(tsk_object_t *self) +{ + tsip_header_Supported_t *Supported = self; + if(Supported){ + TSK_OBJECT_SAFE_FREE(Supported->options); + } + else{ + TSK_DEBUG_ERROR("Null Supported header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Supported_def_s = +{ + sizeof(tsip_header_Supported_t), + tsip_header_Supported_ctor, + tsip_header_Supported_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Supported_def_t = &tsip_header_Supported_def_s; diff --git a/tinySIP/src/headers/tsip_header_Target_Dialog.c b/tinySIP/src/headers/tsip_header_Target_Dialog.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Target_Dialog.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_Timestamp.c b/tinySIP/src/headers/tsip_header_Timestamp.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Timestamp.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_To.c b/tinySIP/src/headers/tsip_header_To.c new file mode 100644 index 0000000..0c053a6 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_To.c @@ -0,0 +1,953 @@ + +/* #line 1 "./ragel/tsip_parser_header_To.rl" */ +/* +* 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 tsip_header_To.c + * @brief SIP To/t header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_To.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 89 "./ragel/tsip_parser_header_To.rl" */ + + +tsip_header_To_t* tsip_header_To_create(const char* display_name, const tsip_uri_t* uri, const char* tag) +{ + return tsk_object_new(TSIP_HEADER_TO_VA_ARGS(display_name, uri, tag)); +} + +tsip_header_To_t* tsip_header_To_create_null() +{ + return tsip_header_To_create(tsk_null, tsk_null, tsk_null); +} + +int tsip_header_To_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + int ret = 0; + const tsip_header_To_t *To = (const tsip_header_To_t *)header; + + /* Uri with hacked display-name*/ + if((ret = tsip_uri_serialize(To->uri, tsk_true, tsk_true, output))){ + return ret; + } + if(To->tag && (ret = tsk_buffer_append_2(output, ";tag=%s", To->tag))){ + return ret; + } + return ret; + } + return -1; +} + +tsip_header_To_t *tsip_header_To_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_To_t *hdr_to = tsip_header_To_create_null(); + + const char *tag_start = tsk_null; + + +/* #line 88 "./src/headers/tsip_header_To.c" */ +static const char _tsip_machine_parser_header_To_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3, 1, 4, 1, 5, 2, 1, 3, + 2, 1, 4 +}; + +static const short _tsip_machine_parser_header_To_key_offsets[] = { + 0, 0, 2, 7, 10, 31, 32, 34, + 55, 56, 58, 61, 65, 77, 80, 80, + 81, 85, 86, 105, 106, 108, 126, 145, + 150, 151, 153, 157, 176, 177, 179, 198, + 199, 201, 204, 212, 213, 215, 219, 223, + 224, 226, 229, 235, 253, 260, 268, 276, + 284, 286, 293, 302, 304, 307, 309, 312, + 314, 317, 320, 321, 324, 325, 328, 329, + 338, 347, 355, 363, 371, 379, 381, 387, + 396, 405, 414, 416, 419, 422, 423, 424, + 445, 466, 485, 490, 491, 493, 497, 516, + 517, 519, 538, 556, 573, 591, 595, 596, + 598, 606, 607, 609, 613, 619, 639, 658, + 663, 663, 667, 687, 706, 711, 731, 749, + 758, 762, 787, 811, 821, 845, 868, 876, + 885, 901, 918, 935, 952, 963, 979, 997, + 1008, 1020, 1031, 1043, 1054, 1066, 1078, 1088, + 1100, 1110, 1122, 1132, 1150, 1168, 1185, 1202, + 1219, 1236, 1247, 1262, 1280, 1298, 1316, 1327, + 1339, 1351, 1361, 1371, 1397, 1423, 1447, 1457, + 1481, 1504, 1515, 1527, 1539, 1551, 1557, 1568, + 1581, 1587, 1594, 1600, 1607, 1613, 1620, 1627, + 1632, 1639, 1644, 1651, 1656, 1669, 1682, 1694, + 1706, 1718, 1730, 1736, 1746, 1759, 1772, 1785, + 1791, 1798, 1805, 1810, 1815, 1836, 1857, 1876, + 1881, 1901, 1919 +}; + +static const char _tsip_machine_parser_header_To_trans_keys[] = { + 84, 116, 9, 32, 58, 79, 111, 9, + 32, 58, 9, 13, 32, 33, 34, 37, + 39, 60, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 10, + 9, 32, 9, 13, 32, 33, 34, 37, + 39, 60, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 10, + 9, 32, 9, 32, 60, 65, 90, 97, + 122, 9, 32, 43, 58, 45, 46, 48, + 57, 65, 90, 97, 122, 9, 32, 58, + 62, 9, 13, 32, 59, 10, 9, 13, + 32, 33, 37, 39, 84, 116, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 10, 9, 32, 9, 32, 33, 37, + 39, 84, 116, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 59, 61, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 59, 61, 10, 9, + 32, 9, 32, 59, 61, 9, 13, 32, + 33, 34, 37, 39, 91, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 10, 9, 32, 9, 13, 32, 33, 34, + 37, 39, 91, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 10, 9, + 32, 9, 32, 34, 13, 34, 92, 127, + 0, 8, 10, 31, 10, 9, 32, 9, + 13, 32, 59, 9, 13, 32, 59, 10, + 9, 32, 9, 32, 59, 0, 9, 11, + 12, 14, 127, 9, 13, 32, 33, 37, + 39, 59, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 58, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 58, 48, + 57, 65, 70, 97, 102, 46, 58, 93, + 48, 57, 65, 70, 97, 102, 48, 57, + 46, 48, 57, 48, 57, 46, 48, 57, + 48, 57, 93, 48, 57, 93, 48, 57, + 93, 46, 48, 57, 46, 46, 48, 57, + 46, 46, 58, 93, 48, 57, 65, 70, + 97, 102, 46, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 58, 93, 48, 57, 65, + 70, 97, 102, 46, 58, 93, 48, 57, + 65, 70, 97, 102, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 46, 58, 93, + 48, 57, 65, 70, 97, 102, 48, 57, + 46, 48, 57, 46, 48, 57, 46, 58, + 9, 13, 32, 33, 37, 39, 59, 61, + 65, 97, 126, 42, 43, 45, 46, 48, + 57, 66, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 59, 61, 71, 103, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 59, 61, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 59, 61, 10, 9, 32, 9, 32, 59, + 61, 9, 13, 32, 33, 34, 37, 39, + 91, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 10, 9, 32, 9, + 13, 32, 33, 34, 37, 39, 91, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 59, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 60, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 60, 10, 9, 32, 13, 34, + 92, 127, 0, 8, 10, 31, 10, 9, + 32, 9, 13, 32, 60, 0, 9, 11, + 12, 14, 127, 9, 13, 32, 33, 37, + 39, 42, 43, 58, 126, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 9, + 13, 32, 33, 37, 39, 58, 60, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 58, 60, 9, + 13, 32, 59, 9, 13, 32, 33, 37, + 39, 59, 84, 116, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 59, 61, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 59, 61, 9, + 13, 32, 33, 34, 37, 39, 59, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 59, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 34, 59, 92, 127, 0, 31, 9, 13, + 32, 59, 9, 13, 32, 33, 34, 37, + 39, 59, 84, 92, 116, 126, 127, 0, + 31, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 34, + 37, 39, 59, 61, 92, 126, 127, 0, + 31, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 34, 59, + 61, 92, 127, 0, 31, 9, 13, 32, + 33, 34, 37, 39, 59, 91, 92, 126, + 127, 0, 31, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 34, 37, 39, 59, 92, 126, 127, + 0, 31, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 59, + 0, 8, 11, 127, 9, 13, 32, 34, + 59, 92, 127, 0, 31, 9, 13, 32, + 34, 58, 59, 92, 127, 0, 31, 48, + 57, 65, 70, 97, 102, 9, 13, 32, + 34, 58, 59, 92, 93, 127, 0, 31, + 48, 57, 65, 70, 97, 102, 9, 13, + 32, 34, 58, 59, 92, 93, 127, 0, + 31, 48, 57, 65, 70, 97, 102, 9, + 13, 32, 34, 58, 59, 92, 93, 127, + 0, 31, 48, 57, 65, 70, 97, 102, + 9, 13, 32, 34, 58, 59, 92, 93, + 127, 0, 31, 9, 13, 32, 34, 58, + 59, 92, 127, 0, 31, 48, 57, 65, + 70, 97, 102, 9, 13, 32, 34, 46, + 58, 59, 92, 93, 127, 0, 31, 48, + 57, 65, 70, 97, 102, 9, 13, 32, + 34, 59, 92, 127, 0, 31, 48, 57, + 9, 13, 32, 34, 46, 59, 92, 127, + 0, 31, 48, 57, 9, 13, 32, 34, + 59, 92, 127, 0, 31, 48, 57, 9, + 13, 32, 34, 46, 59, 92, 127, 0, + 31, 48, 57, 9, 13, 32, 34, 59, + 92, 127, 0, 31, 48, 57, 9, 13, + 32, 34, 59, 92, 93, 127, 0, 31, + 48, 57, 9, 13, 32, 34, 59, 92, + 93, 127, 0, 31, 48, 57, 9, 13, + 32, 34, 59, 92, 93, 127, 0, 31, + 9, 13, 32, 34, 46, 59, 92, 127, + 0, 31, 48, 57, 9, 13, 32, 34, + 46, 59, 92, 127, 0, 31, 9, 13, + 32, 34, 46, 59, 92, 127, 0, 31, + 48, 57, 9, 13, 32, 34, 46, 59, + 92, 127, 0, 31, 9, 13, 32, 34, + 46, 58, 59, 92, 93, 127, 0, 31, + 48, 57, 65, 70, 97, 102, 9, 13, + 32, 34, 46, 58, 59, 92, 93, 127, + 0, 31, 48, 57, 65, 70, 97, 102, + 9, 13, 32, 34, 58, 59, 92, 93, + 127, 0, 31, 48, 57, 65, 70, 97, + 102, 9, 13, 32, 34, 58, 59, 92, + 93, 127, 0, 31, 48, 57, 65, 70, + 97, 102, 9, 13, 32, 34, 58, 59, + 92, 93, 127, 0, 31, 48, 57, 65, + 70, 97, 102, 9, 13, 32, 34, 58, + 59, 92, 93, 127, 0, 31, 48, 57, + 65, 70, 97, 102, 9, 13, 32, 34, + 58, 59, 92, 93, 127, 0, 31, 9, + 13, 32, 34, 59, 92, 127, 0, 31, + 48, 57, 65, 70, 97, 102, 9, 13, + 32, 34, 46, 58, 59, 92, 93, 127, + 0, 31, 48, 57, 65, 70, 97, 102, + 9, 13, 32, 34, 46, 58, 59, 92, + 93, 127, 0, 31, 48, 57, 65, 70, + 97, 102, 9, 13, 32, 34, 46, 58, + 59, 92, 93, 127, 0, 31, 48, 57, + 65, 70, 97, 102, 9, 13, 32, 34, + 59, 92, 127, 0, 31, 48, 57, 9, + 13, 32, 34, 46, 59, 92, 127, 0, + 31, 48, 57, 9, 13, 32, 34, 46, + 59, 92, 127, 0, 31, 48, 57, 9, + 13, 32, 34, 46, 59, 92, 127, 0, + 31, 9, 13, 32, 34, 58, 59, 92, + 127, 0, 31, 9, 13, 32, 33, 34, + 37, 39, 59, 61, 65, 92, 97, 126, + 127, 0, 31, 42, 43, 45, 46, 48, + 57, 66, 90, 95, 122, 9, 13, 32, + 33, 34, 37, 39, 59, 61, 71, 92, + 103, 126, 127, 0, 31, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 34, 37, 39, 59, 61, + 92, 126, 127, 0, 31, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 34, 59, 61, 92, 127, 0, + 31, 9, 13, 32, 33, 34, 37, 39, + 59, 91, 92, 126, 127, 0, 31, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 34, 37, 39, + 59, 92, 126, 127, 0, 31, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 58, 59, 48, 57, 65, + 70, 97, 102, 9, 13, 32, 58, 59, + 93, 48, 57, 65, 70, 97, 102, 9, + 13, 32, 58, 59, 93, 48, 57, 65, + 70, 97, 102, 9, 13, 32, 58, 59, + 93, 48, 57, 65, 70, 97, 102, 9, + 13, 32, 58, 59, 93, 9, 13, 32, + 58, 59, 48, 57, 65, 70, 97, 102, + 9, 13, 32, 46, 58, 59, 93, 48, + 57, 65, 70, 97, 102, 9, 13, 32, + 59, 48, 57, 9, 13, 32, 46, 59, + 48, 57, 9, 13, 32, 59, 48, 57, + 9, 13, 32, 46, 59, 48, 57, 9, + 13, 32, 59, 48, 57, 9, 13, 32, + 59, 93, 48, 57, 9, 13, 32, 59, + 93, 48, 57, 9, 13, 32, 59, 93, + 9, 13, 32, 46, 59, 48, 57, 9, + 13, 32, 46, 59, 9, 13, 32, 46, + 59, 48, 57, 9, 13, 32, 46, 59, + 9, 13, 32, 46, 58, 59, 93, 48, + 57, 65, 70, 97, 102, 9, 13, 32, + 46, 58, 59, 93, 48, 57, 65, 70, + 97, 102, 9, 13, 32, 58, 59, 93, + 48, 57, 65, 70, 97, 102, 9, 13, + 32, 58, 59, 93, 48, 57, 65, 70, + 97, 102, 9, 13, 32, 58, 59, 93, + 48, 57, 65, 70, 97, 102, 9, 13, + 32, 58, 59, 93, 48, 57, 65, 70, + 97, 102, 9, 13, 32, 58, 59, 93, + 9, 13, 32, 59, 48, 57, 65, 70, + 97, 102, 9, 13, 32, 46, 58, 59, + 93, 48, 57, 65, 70, 97, 102, 9, + 13, 32, 46, 58, 59, 93, 48, 57, + 65, 70, 97, 102, 9, 13, 32, 46, + 58, 59, 93, 48, 57, 65, 70, 97, + 102, 9, 13, 32, 59, 48, 57, 9, + 13, 32, 46, 59, 48, 57, 9, 13, + 32, 46, 59, 48, 57, 9, 13, 32, + 46, 59, 9, 13, 32, 58, 59, 9, + 13, 32, 33, 37, 39, 59, 61, 65, + 97, 126, 42, 43, 45, 46, 48, 57, + 66, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 59, 61, 71, 103, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 59, + 61, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 59, + 61, 9, 13, 32, 33, 34, 37, 39, + 59, 91, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 59, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 0 +}; + +static const char _tsip_machine_parser_header_To_single_lengths[] = { + 0, 2, 5, 3, 9, 1, 2, 9, + 1, 2, 3, 0, 4, 3, 0, 1, + 4, 1, 9, 1, 2, 8, 9, 5, + 1, 2, 4, 9, 1, 2, 9, 1, + 2, 3, 4, 1, 2, 4, 4, 1, + 2, 3, 0, 8, 1, 2, 2, 2, + 2, 1, 3, 0, 1, 0, 1, 0, + 1, 1, 1, 1, 1, 1, 1, 3, + 3, 2, 2, 2, 2, 2, 0, 3, + 3, 3, 0, 1, 1, 1, 1, 11, + 11, 9, 5, 1, 2, 4, 9, 1, + 2, 9, 8, 7, 8, 4, 1, 2, + 4, 1, 2, 4, 0, 10, 9, 5, + 0, 4, 10, 9, 5, 10, 8, 7, + 4, 13, 12, 8, 12, 11, 4, 7, + 8, 9, 9, 9, 9, 8, 10, 7, + 8, 7, 8, 7, 8, 8, 8, 8, + 8, 8, 8, 10, 10, 9, 9, 9, + 9, 9, 7, 10, 10, 10, 7, 8, + 8, 8, 8, 14, 14, 12, 8, 12, + 11, 5, 6, 6, 6, 6, 5, 7, + 4, 5, 4, 5, 4, 5, 5, 5, + 5, 5, 5, 5, 7, 7, 6, 6, + 6, 6, 6, 4, 7, 7, 7, 4, + 5, 5, 5, 5, 11, 11, 9, 5, + 10, 8, 0 +}; + +static const char _tsip_machine_parser_header_To_range_lengths[] = { + 0, 0, 0, 0, 6, 0, 0, 6, + 0, 0, 0, 2, 4, 0, 0, 0, + 0, 0, 5, 0, 0, 5, 5, 0, + 0, 0, 0, 5, 0, 0, 5, 0, + 0, 0, 2, 0, 0, 0, 0, 0, + 0, 0, 3, 5, 3, 3, 3, 3, + 0, 3, 3, 1, 1, 1, 1, 1, + 1, 1, 0, 1, 0, 1, 0, 3, + 3, 3, 3, 3, 3, 0, 3, 3, + 3, 3, 1, 1, 1, 0, 0, 5, + 5, 5, 0, 0, 0, 0, 5, 0, + 0, 5, 5, 5, 5, 0, 0, 0, + 2, 0, 0, 0, 3, 5, 5, 0, + 0, 0, 5, 5, 0, 5, 5, 1, + 0, 6, 6, 1, 6, 6, 2, 1, + 4, 4, 4, 4, 1, 4, 4, 2, + 2, 2, 2, 2, 2, 2, 1, 2, + 1, 2, 1, 4, 4, 4, 4, 4, + 4, 1, 4, 4, 4, 4, 2, 2, + 2, 1, 1, 6, 6, 6, 1, 6, + 6, 3, 3, 3, 3, 0, 3, 3, + 1, 1, 1, 1, 1, 1, 1, 0, + 1, 0, 1, 0, 3, 3, 3, 3, + 3, 3, 0, 3, 3, 3, 3, 1, + 1, 1, 0, 0, 5, 5, 5, 0, + 5, 5, 0 +}; + +static const short _tsip_machine_parser_header_To_index_offsets[] = { + 0, 0, 3, 9, 13, 29, 31, 34, + 50, 52, 55, 59, 62, 71, 75, 76, + 78, 83, 85, 100, 102, 105, 119, 134, + 140, 142, 145, 150, 165, 167, 170, 185, + 187, 190, 194, 201, 203, 206, 211, 216, + 218, 221, 225, 229, 243, 248, 254, 260, + 266, 269, 274, 281, 283, 286, 288, 291, + 293, 296, 299, 301, 304, 306, 309, 311, + 318, 325, 331, 337, 343, 349, 352, 356, + 363, 370, 377, 379, 382, 385, 387, 389, + 406, 423, 438, 444, 446, 449, 454, 469, + 471, 474, 489, 503, 516, 530, 535, 537, + 540, 547, 549, 552, 557, 561, 577, 592, + 598, 599, 604, 620, 635, 641, 657, 671, + 680, 685, 705, 724, 734, 753, 771, 778, + 787, 800, 814, 828, 842, 853, 866, 881, + 891, 902, 912, 923, 933, 944, 955, 965, + 976, 986, 997, 1007, 1022, 1037, 1051, 1065, + 1079, 1093, 1104, 1116, 1131, 1146, 1161, 1171, + 1182, 1193, 1203, 1213, 1234, 1255, 1274, 1284, + 1303, 1321, 1330, 1340, 1350, 1360, 1367, 1376, + 1387, 1393, 1400, 1406, 1413, 1419, 1426, 1433, + 1439, 1446, 1452, 1459, 1465, 1476, 1487, 1497, + 1507, 1517, 1527, 1534, 1542, 1553, 1564, 1575, + 1581, 1588, 1595, 1601, 1607, 1624, 1641, 1656, + 1662, 1678, 1692 +}; + +static const unsigned char _tsip_machine_parser_header_To_indicies[] = { + 0, 0, 1, 2, 2, 3, 2, 2, + 1, 2, 2, 3, 1, 3, 4, 3, + 5, 6, 5, 5, 7, 5, 5, 5, + 5, 8, 5, 8, 1, 9, 1, 10, + 10, 1, 10, 11, 10, 5, 6, 5, + 5, 7, 5, 5, 5, 5, 8, 5, + 8, 1, 12, 1, 13, 13, 1, 13, + 13, 7, 1, 14, 14, 1, 15, 15, + 16, 17, 16, 16, 16, 16, 1, 15, + 15, 17, 1, 18, 19, 18, 20, 21, + 20, 22, 1, 23, 1, 22, 24, 22, + 25, 25, 25, 26, 26, 25, 25, 25, + 25, 25, 25, 1, 27, 1, 28, 28, + 1, 28, 28, 25, 25, 25, 26, 26, + 25, 25, 25, 25, 25, 25, 1, 29, + 30, 29, 31, 31, 31, 32, 33, 31, + 31, 31, 31, 31, 31, 1, 34, 35, + 34, 22, 33, 1, 36, 1, 37, 37, + 1, 37, 37, 22, 33, 1, 33, 38, + 33, 39, 40, 39, 39, 41, 39, 39, + 39, 39, 39, 39, 1, 42, 1, 43, + 43, 1, 43, 44, 43, 39, 40, 39, + 39, 41, 39, 39, 39, 39, 39, 39, + 1, 45, 1, 46, 46, 1, 46, 46, + 40, 1, 47, 48, 49, 1, 1, 1, + 40, 50, 1, 40, 40, 1, 51, 30, + 51, 32, 1, 52, 53, 52, 22, 1, + 54, 1, 55, 55, 1, 55, 55, 22, + 1, 40, 40, 40, 1, 51, 30, 51, + 39, 39, 39, 32, 39, 39, 39, 39, + 39, 39, 1, 57, 56, 56, 56, 1, + 59, 48, 58, 58, 58, 1, 59, 48, + 60, 60, 60, 1, 59, 48, 61, 61, + 61, 1, 59, 48, 1, 63, 62, 56, + 56, 1, 64, 59, 48, 65, 58, 58, + 1, 66, 1, 67, 68, 1, 69, 1, + 70, 71, 1, 72, 1, 48, 73, 1, + 48, 74, 1, 48, 1, 70, 75, 1, + 70, 1, 67, 76, 1, 67, 1, 64, + 59, 48, 77, 60, 60, 1, 64, 59, + 48, 61, 61, 61, 1, 79, 48, 78, + 78, 78, 1, 81, 48, 80, 80, 80, + 1, 81, 48, 82, 82, 82, 1, 81, + 48, 83, 83, 83, 1, 81, 48, 1, + 84, 78, 78, 1, 64, 81, 48, 85, + 80, 80, 1, 64, 81, 48, 86, 82, + 82, 1, 64, 81, 48, 83, 83, 83, + 1, 87, 1, 64, 88, 1, 64, 89, + 1, 64, 1, 63, 1, 29, 30, 29, + 31, 31, 31, 32, 33, 90, 90, 31, + 31, 31, 31, 31, 31, 1, 29, 30, + 29, 31, 31, 31, 32, 33, 91, 91, + 31, 31, 31, 31, 31, 31, 1, 92, + 30, 92, 31, 31, 31, 32, 93, 31, + 31, 31, 31, 31, 31, 1, 94, 95, + 94, 22, 93, 1, 96, 1, 97, 97, + 1, 97, 97, 22, 93, 1, 93, 98, + 93, 99, 40, 99, 99, 41, 99, 99, + 99, 99, 99, 99, 1, 100, 1, 101, + 101, 1, 101, 44, 101, 99, 40, 99, + 99, 41, 99, 99, 99, 99, 99, 99, + 1, 102, 103, 102, 104, 104, 104, 105, + 104, 104, 104, 104, 104, 104, 1, 106, + 107, 106, 108, 108, 108, 108, 108, 108, + 108, 108, 108, 1, 109, 110, 109, 108, + 108, 108, 111, 108, 108, 108, 108, 108, + 108, 1, 112, 11, 112, 7, 1, 113, + 1, 106, 106, 1, 115, 116, 117, 1, + 1, 1, 114, 118, 1, 114, 114, 1, + 109, 110, 109, 111, 1, 114, 114, 114, + 1, 119, 107, 119, 108, 108, 108, 108, + 120, 121, 108, 120, 120, 120, 108, 120, + 1, 122, 110, 122, 108, 108, 108, 121, + 111, 108, 108, 108, 108, 108, 108, 1, + 123, 11, 123, 121, 7, 1, 124, 125, + 126, 125, 127, 124, 127, 126, 127, 128, + 128, 128, 127, 129, 129, 128, 128, 128, + 128, 128, 128, 124, 130, 131, 130, 132, + 132, 132, 133, 134, 132, 132, 132, 132, + 132, 132, 124, 135, 126, 135, 127, 134, + 124, 136, 126, 136, 137, 138, 137, 137, + 127, 139, 137, 137, 137, 137, 137, 137, + 124, 140, 131, 140, 137, 137, 137, 133, + 137, 137, 137, 137, 137, 137, 124, 141, + 126, 141, 142, 143, 144, 124, 124, 138, + 140, 131, 140, 133, 124, 143, 126, 143, + 145, 142, 145, 145, 143, 146, 144, 146, + 145, 124, 124, 145, 145, 145, 145, 145, + 138, 147, 131, 147, 148, 142, 148, 148, + 149, 150, 144, 148, 124, 124, 148, 148, + 148, 148, 148, 138, 151, 126, 151, 142, + 143, 150, 144, 124, 124, 138, 152, 126, + 152, 153, 154, 153, 153, 143, 155, 144, + 153, 124, 124, 153, 153, 153, 153, 153, + 138, 156, 131, 156, 153, 142, 153, 153, + 149, 144, 153, 124, 124, 153, 153, 153, + 153, 153, 138, 141, 126, 141, 143, 138, + 138, 124, 156, 131, 156, 142, 149, 144, + 124, 124, 138, 141, 126, 141, 142, 158, + 143, 144, 124, 124, 157, 157, 157, 138, + 141, 126, 141, 142, 160, 143, 144, 154, + 124, 124, 159, 159, 159, 138, 141, 126, + 141, 142, 160, 143, 144, 154, 124, 124, + 161, 161, 161, 138, 141, 126, 141, 142, + 160, 143, 144, 154, 124, 124, 162, 162, + 162, 138, 141, 126, 141, 142, 160, 143, + 144, 154, 124, 124, 138, 141, 126, 141, + 142, 164, 143, 144, 124, 124, 163, 157, + 157, 138, 141, 126, 141, 142, 165, 160, + 143, 144, 154, 124, 124, 166, 159, 159, + 138, 141, 126, 141, 142, 143, 144, 124, + 124, 167, 138, 141, 126, 141, 142, 168, + 143, 144, 124, 124, 169, 138, 141, 126, + 141, 142, 143, 144, 124, 124, 170, 138, + 141, 126, 141, 142, 171, 143, 144, 124, + 124, 172, 138, 141, 126, 141, 142, 143, + 144, 124, 124, 173, 138, 141, 126, 141, + 142, 143, 144, 154, 124, 124, 174, 138, + 141, 126, 141, 142, 143, 144, 154, 124, + 124, 175, 138, 141, 126, 141, 142, 143, + 144, 154, 124, 124, 138, 141, 126, 141, + 142, 171, 143, 144, 124, 124, 176, 138, + 141, 126, 141, 142, 171, 143, 144, 124, + 124, 138, 141, 126, 141, 142, 168, 143, + 144, 124, 124, 177, 138, 141, 126, 141, + 142, 168, 143, 144, 124, 124, 138, 141, + 126, 141, 142, 165, 160, 143, 144, 154, + 124, 124, 178, 161, 161, 138, 141, 126, + 141, 142, 165, 160, 143, 144, 154, 124, + 124, 162, 162, 162, 138, 141, 126, 141, + 142, 180, 143, 144, 154, 124, 124, 179, + 179, 179, 138, 141, 126, 141, 142, 182, + 143, 144, 154, 124, 124, 181, 181, 181, + 138, 141, 126, 141, 142, 182, 143, 144, + 154, 124, 124, 183, 183, 183, 138, 141, + 126, 141, 142, 182, 143, 144, 154, 124, + 124, 184, 184, 184, 138, 141, 126, 141, + 142, 182, 143, 144, 154, 124, 124, 138, + 141, 126, 141, 142, 143, 144, 124, 124, + 185, 179, 179, 138, 141, 126, 141, 142, + 165, 182, 143, 144, 154, 124, 124, 186, + 181, 181, 138, 141, 126, 141, 142, 165, + 182, 143, 144, 154, 124, 124, 187, 183, + 183, 138, 141, 126, 141, 142, 165, 182, + 143, 144, 154, 124, 124, 184, 184, 184, + 138, 141, 126, 141, 142, 143, 144, 124, + 124, 188, 138, 141, 126, 141, 142, 165, + 143, 144, 124, 124, 189, 138, 141, 126, + 141, 142, 165, 143, 144, 124, 124, 190, + 138, 141, 126, 141, 142, 165, 143, 144, + 124, 124, 138, 141, 126, 141, 142, 164, + 143, 144, 124, 124, 138, 147, 131, 147, + 148, 142, 148, 148, 149, 150, 191, 144, + 191, 148, 124, 124, 148, 148, 148, 148, + 148, 138, 147, 131, 147, 148, 142, 148, + 148, 149, 150, 192, 144, 192, 148, 124, + 124, 148, 148, 148, 148, 148, 138, 193, + 131, 193, 148, 142, 148, 148, 149, 194, + 144, 148, 124, 124, 148, 148, 148, 148, + 148, 138, 195, 126, 195, 142, 143, 194, + 144, 124, 124, 138, 196, 126, 196, 197, + 154, 197, 197, 143, 155, 144, 197, 124, + 124, 197, 197, 197, 197, 197, 138, 198, + 199, 198, 200, 142, 200, 200, 201, 144, + 200, 124, 124, 200, 200, 200, 200, 200, + 138, 125, 126, 125, 203, 127, 202, 202, + 202, 124, 125, 126, 125, 205, 127, 142, + 204, 204, 204, 124, 125, 126, 125, 205, + 127, 142, 206, 206, 206, 124, 125, 126, + 125, 205, 127, 142, 207, 207, 207, 124, + 125, 126, 125, 205, 127, 142, 124, 125, + 126, 125, 209, 127, 208, 202, 202, 124, + 125, 126, 125, 210, 205, 127, 142, 211, + 204, 204, 124, 125, 126, 125, 127, 212, + 124, 125, 126, 125, 213, 127, 214, 124, + 125, 126, 125, 127, 215, 124, 125, 126, + 125, 216, 127, 217, 124, 125, 126, 125, + 127, 218, 124, 125, 126, 125, 127, 142, + 219, 124, 125, 126, 125, 127, 142, 220, + 124, 125, 126, 125, 127, 142, 124, 125, + 126, 125, 216, 127, 221, 124, 125, 126, + 125, 216, 127, 124, 125, 126, 125, 213, + 127, 222, 124, 125, 126, 125, 213, 127, + 124, 125, 126, 125, 210, 205, 127, 142, + 223, 206, 206, 124, 125, 126, 125, 210, + 205, 127, 142, 207, 207, 207, 124, 125, + 126, 125, 225, 127, 142, 224, 224, 224, + 124, 125, 126, 125, 227, 127, 142, 226, + 226, 226, 124, 125, 126, 125, 227, 127, + 142, 228, 228, 228, 124, 125, 126, 125, + 227, 127, 142, 229, 229, 229, 124, 125, + 126, 125, 227, 127, 142, 124, 125, 126, + 125, 127, 230, 224, 224, 124, 125, 126, + 125, 210, 227, 127, 142, 231, 226, 226, + 124, 125, 126, 125, 210, 227, 127, 142, + 232, 228, 228, 124, 125, 126, 125, 210, + 227, 127, 142, 229, 229, 229, 124, 125, + 126, 125, 127, 233, 124, 125, 126, 125, + 210, 127, 234, 124, 125, 126, 125, 210, + 127, 235, 124, 125, 126, 125, 210, 127, + 124, 125, 126, 125, 209, 127, 124, 130, + 131, 130, 132, 132, 132, 133, 134, 236, + 236, 132, 132, 132, 132, 132, 132, 124, + 130, 131, 130, 132, 132, 132, 133, 134, + 237, 237, 132, 132, 132, 132, 132, 132, + 124, 238, 131, 238, 132, 132, 132, 133, + 239, 132, 132, 132, 132, 132, 132, 124, + 240, 126, 240, 127, 239, 124, 241, 126, + 241, 242, 138, 242, 242, 127, 139, 242, + 242, 242, 242, 242, 242, 124, 243, 199, + 243, 244, 244, 244, 245, 244, 244, 244, + 244, 244, 244, 124, 1, 0 +}; + +static const unsigned char _tsip_machine_parser_header_To_trans_targs[] = { + 2, 0, 3, 4, 5, 91, 96, 11, + 101, 6, 7, 8, 9, 10, 12, 13, + 12, 14, 15, 16, 16, 17, 18, 202, + 19, 22, 79, 20, 21, 23, 17, 22, + 18, 27, 23, 24, 25, 26, 28, 43, + 34, 44, 29, 30, 31, 32, 33, 35, + 37, 42, 36, 38, 38, 39, 40, 41, + 45, 78, 46, 49, 47, 48, 50, 65, + 51, 63, 52, 53, 61, 54, 55, 59, + 56, 57, 58, 60, 62, 64, 66, 74, + 67, 70, 68, 69, 71, 72, 73, 75, + 76, 77, 80, 81, 82, 86, 82, 83, + 84, 85, 87, 90, 88, 89, 38, 17, + 90, 18, 92, 94, 91, 93, 8, 11, + 93, 95, 96, 97, 99, 100, 98, 102, + 101, 104, 103, 103, 105, 105, 17, 106, + 107, 196, 108, 17, 107, 106, 109, 108, + 109, 110, 111, 161, 105, 111, 112, 113, + 118, 114, 155, 115, 114, 113, 116, 115, + 116, 117, 119, 120, 111, 121, 154, 122, + 125, 123, 124, 126, 141, 127, 139, 128, + 129, 137, 130, 131, 135, 132, 133, 134, + 136, 138, 140, 142, 150, 143, 146, 144, + 145, 147, 148, 149, 151, 152, 153, 156, + 157, 158, 159, 158, 159, 160, 111, 17, + 160, 113, 162, 195, 163, 166, 164, 165, + 167, 182, 168, 180, 169, 170, 178, 171, + 172, 176, 173, 174, 175, 177, 179, 181, + 183, 191, 184, 187, 185, 186, 188, 189, + 190, 192, 193, 194, 197, 198, 199, 200, + 199, 200, 201, 105, 201, 106 +}; + +static const char _tsip_machine_parser_header_To_trans_actions[] = { + 0, 0, 0, 0, 0, 1, 1, 0, + 1, 0, 0, 0, 0, 0, 1, 0, + 0, 0, 0, 3, 0, 0, 0, 11, + 0, 1, 1, 0, 0, 9, 9, 0, + 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 9, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 9, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 7, 7, + 0, 7, 0, 0, 0, 5, 5, 5, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 0, 3, 3, 3, + 1, 1, 16, 16, 0, 16, 0, 3, + 3, 0, 0, 0, 16, 3, 0, 3, + 0, 1, 1, 16, 0, 16, 0, 3, + 3, 0, 0, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 16, 0, 3, 3, 1, 13, 13, + 0, 13, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 16, 0, + 3, 3, 1, 13, 0, 13 +}; + +static const int tsip_machine_parser_header_To_start = 1; +static const int tsip_machine_parser_header_To_first_final = 202; +static const int tsip_machine_parser_header_To_error = 0; + +static const int tsip_machine_parser_header_To_en_main = 1; + + +/* #line 130 "./ragel/tsip_parser_header_To.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_To_first_final); + (void)(tsip_machine_parser_header_To_error); + (void)(tsip_machine_parser_header_To_en_main); + +/* #line 750 "./src/headers/tsip_header_To.c" */ + { + cs = tsip_machine_parser_header_To_start; + } + +/* #line 135 "./ragel/tsip_parser_header_To.rl" */ + +/* #line 757 "./src/headers/tsip_header_To.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_To_trans_keys + _tsip_machine_parser_header_To_key_offsets[cs]; + _trans = _tsip_machine_parser_header_To_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_To_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_To_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_To_indicies[_trans]; + cs = _tsip_machine_parser_header_To_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_To_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_To_actions + _tsip_machine_parser_header_To_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 48 "./ragel/tsip_parser_header_To.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 52 "./ragel/tsip_parser_header_To.rl" */ + { + int len = (int)(p - tag_start); + if(hdr_to && !hdr_to->uri){ + if((hdr_to->uri = tsip_uri_parse(tag_start, (tsk_size_t)len)) && hdr_to->display_name){ + hdr_to->uri->display_name = tsk_strdup(hdr_to->display_name); + } + } + } + break; + case 2: +/* #line 61 "./ragel/tsip_parser_header_To.rl" */ + { + TSK_PARSER_SET_STRING(hdr_to->display_name); + tsk_strunquote(&hdr_to->display_name); + } + break; + case 3: +/* #line 66 "./ragel/tsip_parser_header_To.rl" */ + { + TSK_PARSER_SET_STRING(hdr_to->tag); + } + break; + case 4: +/* #line 70 "./ragel/tsip_parser_header_To.rl" */ + { + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(hdr_to)); + } + break; + case 5: +/* #line 74 "./ragel/tsip_parser_header_To.rl" */ + { + } + break; +/* #line 872 "./src/headers/tsip_header_To.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 136 "./ragel/tsip_parser_header_To.rl" */ + + if( cs < +/* #line 888 "./src/headers/tsip_header_To.c" */ +202 +/* #line 137 "./ragel/tsip_parser_header_To.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'To' header."); + TSK_OBJECT_SAFE_FREE(hdr_to); + } + + return hdr_to; +} + + + + + + + +//======================================================== +// To header object definition +// + +static tsk_object_t* tsip_header_To_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_To_t *To = self; + if(To){ + const char* display_name = va_arg(*app, const char *); + const tsip_uri_t* uri = va_arg(*app, const tsip_uri_t *); + const char* tag = va_arg(*app, const char *); + + To->display_name = tsk_strdup(display_name); + if(uri) To->uri = tsk_object_ref((void *)uri); + To->tag = tsk_strdup(tag); + + TSIP_HEADER(To)->type = tsip_htype_To; + TSIP_HEADER(To)->serialize = tsip_header_To_serialize; + } + else{ + TSK_DEBUG_ERROR("Failed to create new To header."); + } + return self; +} + +static tsk_object_t* tsip_header_To_dtor(tsk_object_t *self) +{ + tsip_header_To_t *To = self; + if(To){ + TSK_FREE(To->display_name); + TSK_FREE(To->tag); + + TSK_OBJECT_SAFE_FREE(To->uri); + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(To)); + } + else{ + TSK_DEBUG_ERROR("Null To header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_To_def_s = +{ + sizeof(tsip_header_To_t), + tsip_header_To_ctor, + tsip_header_To_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_To_def_t = &tsip_header_To_def_s; diff --git a/tinySIP/src/headers/tsip_header_Unsupported.c b/tinySIP/src/headers/tsip_header_Unsupported.c new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Unsupported.c @@ -0,0 +1 @@ + diff --git a/tinySIP/src/headers/tsip_header_User_Agent.c b/tinySIP/src/headers/tsip_header_User_Agent.c new file mode 100644 index 0000000..a054de7 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_User_Agent.c @@ -0,0 +1,319 @@ + +/* #line 1 "./ragel/tsip_parser_header_User_Agent.rl" */ +/* +* 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 tsip_header_User_Agent.c + * @brief SIP User-Agent/t header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_User_Agent.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + +#include <string.h> + +/*********************************** +* Ragel state machine. +*/ + +/* #line 64 "./ragel/tsip_parser_header_User_Agent.rl" */ + + +tsip_header_User_Agent_t* tsip_header_User_Agent_create(const char* ua) +{ + return tsk_object_new(TSIP_HEADER_USER_AGENT_VA_ARGS(ua)); +} + +tsip_header_User_Agent_t* tsip_header_User_Agent_create_null() +{ + return tsip_header_User_Agent_create(tsk_null); +} + +int tsip_header_User_Agent_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_User_Agent_t *User_Agent = (const tsip_header_User_Agent_t *)header; + if(User_Agent->value){ + return tsk_buffer_append(output, User_Agent->value, tsk_strlen(User_Agent->value)); + } + return 0; + } + + return -1; +} + +tsip_header_User_Agent_t *tsip_header_User_Agent_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_User_Agent_t *hdr_user_agent = tsip_header_User_Agent_create_null(); + + const char *tag_start = tsk_null; + + +/* #line 83 "./src/headers/tsip_header_User_Agent.c" */ +static const char _tsip_machine_parser_header_User_Agent_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 2, + 0, 1 +}; + +static const char _tsip_machine_parser_header_User_Agent_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 9, 11, + 13, 15, 17, 19, 22, 25, 26, 27 +}; + +static const char _tsip_machine_parser_header_User_Agent_trans_keys[] = { + 85, 117, 83, 115, 69, 101, 82, 114, + 45, 65, 97, 71, 103, 69, 101, 78, + 110, 84, 116, 9, 32, 58, 9, 13, + 32, 13, 10, 0 +}; + +static const char _tsip_machine_parser_header_User_Agent_single_lengths[] = { + 0, 2, 2, 2, 2, 1, 2, 2, + 2, 2, 2, 3, 3, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_User_Agent_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static const char _tsip_machine_parser_header_User_Agent_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 14, 17, + 20, 23, 26, 29, 33, 37, 39, 41 +}; + +static const char _tsip_machine_parser_header_User_Agent_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 5, 1, 6, 6, + 1, 7, 7, 1, 8, 8, 1, 9, + 9, 1, 10, 10, 1, 10, 10, 11, + 1, 13, 14, 13, 12, 16, 15, 17, + 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_User_Agent_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 12, 14, 13, + 14, 15 +}; + +static const char _tsip_machine_parser_header_User_Agent_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 1, 7, 0, + 3, 5 +}; + +static const int tsip_machine_parser_header_User_Agent_start = 1; +static const int tsip_machine_parser_header_User_Agent_first_final = 15; +static const int tsip_machine_parser_header_User_Agent_error = 0; + +static const int tsip_machine_parser_header_User_Agent_en_main = 1; + + +/* #line 100 "./ragel/tsip_parser_header_User_Agent.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_User_Agent_first_final); + (void)(tsip_machine_parser_header_User_Agent_error); + (void)(tsip_machine_parser_header_User_Agent_en_main); + +/* #line 150 "./src/headers/tsip_header_User_Agent.c" */ + { + cs = tsip_machine_parser_header_User_Agent_start; + } + +/* #line 105 "./ragel/tsip_parser_header_User_Agent.rl" */ + +/* #line 157 "./src/headers/tsip_header_User_Agent.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_User_Agent_trans_keys + _tsip_machine_parser_header_User_Agent_key_offsets[cs]; + _trans = _tsip_machine_parser_header_User_Agent_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_User_Agent_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_User_Agent_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_User_Agent_indicies[_trans]; + cs = _tsip_machine_parser_header_User_Agent_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_User_Agent_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_User_Agent_actions + _tsip_machine_parser_header_User_Agent_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 48 "./ragel/tsip_parser_header_User_Agent.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 52 "./ragel/tsip_parser_header_User_Agent.rl" */ + { + TSK_PARSER_SET_STRING(hdr_user_agent->value); + } + break; + case 2: +/* #line 56 "./ragel/tsip_parser_header_User_Agent.rl" */ + { + } + break; +/* #line 248 "./src/headers/tsip_header_User_Agent.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 106 "./ragel/tsip_parser_header_User_Agent.rl" */ + + if( cs < +/* #line 264 "./src/headers/tsip_header_User_Agent.c" */ +15 +/* #line 107 "./ragel/tsip_parser_header_User_Agent.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'User-Agent' header."); + TSK_OBJECT_SAFE_FREE(hdr_user_agent); + } + + return hdr_user_agent; +} + + + + + + + +//======================================================== +// User_Agent header object definition +// + +static tsk_object_t* tsip_header_User_Agent_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_User_Agent_t *User_Agent = self; + if(User_Agent){ + TSIP_HEADER(User_Agent)->type = tsip_htype_User_Agent; + TSIP_HEADER(User_Agent)->serialize = tsip_header_User_Agent_serialize; + User_Agent->value = tsk_strdup(va_arg(*app, const char*)); + } + else{ + TSK_DEBUG_ERROR("Failed to create new User_Agent header."); + } + return self; +} + +static tsk_object_t* tsip_header_User_Agent_dtor(tsk_object_t *self) +{ + tsip_header_User_Agent_t *User_Agent = self; + if(User_Agent){ + TSK_FREE(User_Agent->value); + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(User_Agent)); + } + else{ + TSK_DEBUG_ERROR("Null User_Agent header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_User_Agent_def_s = +{ + sizeof(tsip_header_User_Agent_t), + tsip_header_User_Agent_ctor, + tsip_header_User_Agent_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_User_Agent_def_t = &tsip_header_User_Agent_def_s; diff --git a/tinySIP/src/headers/tsip_header_Via.c b/tinySIP/src/headers/tsip_header_Via.c new file mode 100644 index 0000000..aef8ce8 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Via.c @@ -0,0 +1,1417 @@ + +/* #line 1 "./ragel/tsip_parser_header_Via.rl" */ +/* +* 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 tsip_header_Via.c + * @brief SIP Via/v header as per RFC 3261 subclause 20.42. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Via.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 142 "./ragel/tsip_parser_header_Via.rl" */ + + + +tsip_header_Via_t* tsip_header_Via_create(const char* proto_name, const char* proto_version, const char* transport, const char* host, uint16_t port) +{ + return tsk_object_new(TSIP_HEADER_VIA_VA_ARGS(proto_name, proto_version, transport, host, port)); +} +tsip_header_Via_t* tsip_header_Via_create_null() +{ + return tsip_header_Via_create(tsk_null, tsk_null, tsk_null, tsk_null, 0); +} + +int tsip_header_Via_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Via_t *Via = (const tsip_header_Via_t *)header; + tsk_istr_t port, rport, ttl; + int ipv6 = (Via->host && tsk_strcontains(Via->host, tsk_strlen(Via->host), ":")); + + if(Via->port){ + tsk_itoa(Via->port, &port); + } + if(Via->rport){ + tsk_itoa(Via->rport, &rport); + } + if(Via->ttl){ + tsk_itoa(Via->ttl, &ttl); + } + + /* SIP/2.0/UDP [::]:1988;test=1234;comp=sigcomp;rport=254;ttl=457;received=192.0.2.101;branch=z9hG4bK1245420841406\r\n" */ + return tsk_buffer_append_2(output, "%s/%s/%s %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", + + Via->proto_name ? Via->proto_name : "SIP", + + Via->proto_version ? Via->proto_version : "2.0", + + Via->transport ? Via->transport : "UDP", + + ipv6 ? "[" : "", + Via->host ? Via->host : "127.0.0.1", + ipv6 ? "]" : "", + + Via->port ? ":" : "", + Via->port ? port : "", + + Via->maddr ? ";maddr=" : "", + Via->maddr ? Via->maddr : "", + + Via->sigcomp_id ? ";sigcomp-id=" : "", + Via->sigcomp_id ? Via->sigcomp_id : "", + + Via->comp ? ";comp=" : "", + Via->comp ? Via->comp : "", + + Via->rport>=0 ? (Via->rport>0?";rport=":";rport") : "", + Via->rport>0 ? rport : "", + + Via->ttl>=0 ? (Via->ttl>0?";ttl=":";ttl") : "", + Via->ttl>0 ? ttl : "", + + Via->received ? ";received=" : "", + Via->received ? Via->received : "", + + Via->branch ? ";branch=" : "", + Via->branch ? Via->branch : "" + ); + } + return -1; +} + +char* tsip_header_Via_get_special_param_value(const tsip_header_t* header, const char* pname) +{ + if(header){ + const tsip_header_Via_t *Via = (const tsip_header_Via_t *)header; + if(tsk_striequals(pname, "maddr")){ + return tsk_strdup(Via->maddr); + } + else if(tsk_striequals(pname, "sigcomp-id")){ + return tsk_strdup(Via->sigcomp_id); + } + else if(tsk_striequals(pname, "comp")){ + return tsk_strdup(Via->comp); + } + else if(tsk_striequals(pname, "rport")){ + tsk_istr_t rport; + tsk_itoa(Via->rport, &rport); + + return tsk_strdup(rport); + } + else if(tsk_striequals(pname, "received")){ + return tsk_strdup(Via->received); + } + else if(tsk_striequals(pname, "branch")){ + return tsk_strdup(Via->branch); + } + } + return tsk_null; +} + +tsip_header_Vias_L_t *tsip_header_Via_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Vias_L_t *hdr_vias = tsk_list_create(); + tsip_header_Via_t *curr_via = tsk_null; + + const char *tag_start = tsk_null; + + +/* #line 156 "./src/headers/tsip_header_Via.c" */ +static const char _tsip_machine_parser_header_Via_actions[] = { + 0, 1, 0, 1, 2, 1, 3, 1, + 4, 1, 5, 1, 6, 1, 7, 1, + 8, 1, 9, 1, 10, 1, 11, 1, + 13, 1, 14, 1, 16, 2, 1, 0, + 2, 4, 15, 2, 5, 15, 2, 7, + 15, 2, 8, 15, 2, 9, 15, 2, + 10, 15, 2, 11, 15, 2, 12, 13, + 2, 13, 15, 2, 14, 15, 3, 12, + 13, 15 +}; + +static const short _tsip_machine_parser_header_Via_key_offsets[] = { + 0, 0, 2, 7, 10, 27, 28, 30, + 46, 62, 66, 67, 69, 72, 89, 90, + 92, 108, 124, 128, 129, 131, 134, 151, + 152, 154, 170, 187, 197, 198, 200, 209, + 217, 224, 232, 238, 252, 258, 259, 261, + 266, 271, 272, 274, 278, 285, 290, 291, + 293, 297, 324, 325, 327, 353, 371, 377, + 378, 380, 385, 404, 405, 407, 426, 427, + 429, 432, 440, 441, 443, 448, 449, 455, + 472, 479, 487, 495, 503, 505, 512, 521, + 523, 526, 528, 531, 533, 536, 539, 540, + 543, 544, 547, 548, 557, 566, 574, 582, + 590, 598, 600, 606, 615, 624, 633, 635, + 638, 641, 642, 643, 663, 683, 703, 723, + 743, 761, 767, 768, 770, 775, 794, 795, + 797, 816, 833, 853, 873, 893, 911, 917, + 918, 920, 925, 944, 945, 947, 966, 983, + 1003, 1023, 1043, 1063, 1081, 1087, 1088, 1090, + 1095, 1116, 1117, 1119, 1140, 1161, 1181, 1202, + 1221, 1234, 1241, 1252, 1260, 1267, 1273, 1292, + 1313, 1332, 1353, 1372, 1385, 1398, 1411, 1432, + 1453, 1474, 1495, 1516, 1537, 1544, 1552, 1560, + 1568, 1570, 1577, 1586, 1588, 1591, 1593, 1596, + 1598, 1601, 1604, 1605, 1610, 1613, 1614, 1617, + 1618, 1627, 1636, 1644, 1652, 1660, 1668, 1670, + 1676, 1685, 1694, 1703, 1705, 1708, 1711, 1712, + 1713, 1735, 1755, 1775, 1795, 1815, 1835, 1855, + 1873, 1879, 1880, 1882, 1887, 1913, 1914, 1916, + 1942, 1955, 1957, 1960, 1962, 1965, 1967, 1974, + 1981, 1986, 1989, 1990, 1993, 1994, 2007, 2020, + 2026, 2033, 2045, 2057, 2069, 2081, 2087, 2093, + 2106, 2119, 2132, 2134, 2137, 2140, 2141, 2153, + 2165, 2177, 2178, 2198, 2218, 2238, 2244, 2250, + 2251, 2253, 2258, 2263, 2264, 2266, 2270, 2277, + 2297, 2317, 2335, 2341, 2342, 2344, 2349, 2368, + 2369, 2371, 2390, 2397, 2404, 2409, 2416, 2428, + 2434, 2442, 2448, 2456, 2462, 2476, 2490, 2504, + 2512, 2520, 2528, 2536, 2544, 2552, 2559, 2567, + 2575, 2583, 2585, 2592, 2601, 2603, 2606, 2608, + 2611, 2613, 2616, 2619, 2620, 2626, 2629, 2630, + 2633, 2634, 2643, 2652, 2660, 2668, 2676, 2684, + 2686, 2692, 2701, 2710, 2719, 2721, 2724, 2727, + 2728, 2729, 2731 +}; + +static const char _tsip_machine_parser_header_Via_trans_keys[] = { + 86, 118, 9, 32, 58, 73, 105, 9, + 32, 58, 9, 13, 32, 33, 37, 39, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 10, 9, 32, 9, 32, + 33, 37, 39, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 47, 126, 42, 43, + 45, 57, 65, 90, 95, 122, 9, 13, + 32, 47, 10, 9, 32, 9, 32, 47, + 9, 13, 32, 33, 37, 39, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 10, 9, 32, 9, 32, 33, 37, + 39, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 9, 13, 32, 33, + 37, 39, 47, 126, 42, 43, 45, 57, + 65, 90, 95, 122, 9, 13, 32, 47, + 10, 9, 32, 9, 32, 47, 9, 13, + 32, 33, 37, 39, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 10, + 9, 32, 9, 32, 33, 37, 39, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 91, 48, + 57, 65, 90, 97, 122, 10, 9, 32, + 9, 32, 91, 48, 57, 65, 90, 97, + 122, 45, 46, 48, 57, 65, 90, 97, + 122, 45, 48, 57, 65, 90, 97, 122, + 45, 46, 48, 57, 65, 90, 97, 122, + 48, 57, 65, 90, 97, 122, 9, 13, + 32, 44, 45, 46, 58, 59, 48, 57, + 65, 90, 97, 122, 9, 13, 32, 44, + 58, 59, 10, 9, 32, 9, 32, 44, + 58, 59, 9, 13, 32, 48, 57, 10, + 9, 32, 9, 32, 48, 57, 9, 13, + 32, 44, 59, 48, 57, 9, 13, 32, + 44, 59, 10, 9, 32, 9, 32, 44, + 59, 9, 13, 32, 33, 37, 39, 66, + 67, 77, 82, 84, 98, 99, 109, 114, + 116, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 10, 9, 32, 9, + 32, 33, 37, 39, 66, 67, 77, 82, + 84, 98, 99, 109, 114, 116, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 44, 59, + 61, 10, 9, 32, 9, 32, 44, 59, + 61, 9, 13, 32, 33, 34, 37, 39, + 91, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 10, 9, 32, 9, + 13, 32, 33, 34, 37, 39, 91, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 10, 9, 32, 9, 32, 34, + 13, 34, 92, 127, 0, 8, 10, 31, + 10, 9, 32, 9, 13, 32, 44, 59, + 10, 0, 9, 11, 12, 14, 127, 9, + 13, 32, 33, 37, 39, 44, 59, 126, + 42, 46, 48, 57, 65, 90, 95, 122, + 58, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 58, 48, 57, 65, 70, 97, 102, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 48, 57, 46, 48, 57, 48, 57, + 46, 48, 57, 48, 57, 93, 48, 57, + 93, 48, 57, 93, 46, 48, 57, 46, + 46, 48, 57, 46, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 46, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 46, 58, + 93, 48, 57, 65, 70, 97, 102, 46, + 58, 93, 48, 57, 65, 70, 97, 102, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 48, 57, 46, 48, 57, 46, 48, + 57, 46, 58, 9, 13, 32, 33, 37, + 39, 44, 59, 61, 82, 114, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 44, 59, 61, + 65, 97, 126, 42, 46, 48, 57, 66, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 44, 59, 61, 78, 110, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 44, 59, 61, + 67, 99, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 44, 59, 61, 72, 104, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 44, 59, 61, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 44, 59, 61, 10, + 9, 32, 9, 32, 44, 59, 61, 9, + 13, 32, 33, 34, 37, 39, 91, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 10, 9, 32, 9, 13, 32, + 33, 34, 37, 39, 91, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 9, 13, 32, 33, 37, 39, 44, 59, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 79, 111, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 59, 61, 77, 109, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 80, 112, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 59, 61, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 44, 59, 61, 10, 9, 32, + 9, 32, 44, 59, 61, 9, 13, 32, + 33, 34, 37, 39, 91, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 10, 9, 32, 9, 13, 32, 33, 34, + 37, 39, 91, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 44, 59, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 44, 59, 61, + 65, 97, 126, 42, 46, 48, 57, 66, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 44, 59, 61, 68, 100, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 44, 59, 61, + 68, 100, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 44, 59, 61, 82, 114, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 44, 59, 61, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 44, 59, 61, 10, + 9, 32, 9, 32, 44, 59, 61, 9, + 13, 32, 33, 34, 37, 39, 91, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 96, 97, 122, 10, 9, 32, 9, + 13, 32, 33, 34, 37, 39, 91, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 96, 97, 122, 9, 13, 32, 33, + 37, 39, 44, 45, 46, 59, 126, 42, + 43, 48, 57, 65, 90, 95, 96, 97, + 122, 9, 13, 32, 33, 37, 39, 44, + 45, 59, 126, 42, 46, 48, 57, 65, + 90, 95, 96, 97, 122, 9, 13, 32, + 33, 37, 39, 44, 45, 46, 59, 126, + 42, 43, 48, 57, 65, 90, 95, 96, + 97, 122, 9, 13, 32, 33, 37, 39, + 44, 59, 126, 42, 46, 48, 57, 65, + 90, 95, 96, 97, 122, 9, 13, 32, + 44, 45, 46, 59, 48, 57, 65, 90, + 97, 122, 45, 48, 57, 65, 90, 97, + 122, 9, 13, 32, 44, 59, 48, 57, + 65, 90, 97, 122, 45, 46, 48, 57, + 65, 90, 97, 122, 45, 48, 57, 65, + 90, 97, 122, 48, 57, 65, 90, 97, + 122, 9, 13, 32, 33, 37, 39, 44, + 59, 126, 42, 46, 48, 57, 65, 90, + 95, 96, 97, 122, 9, 13, 32, 33, + 37, 39, 44, 45, 46, 59, 126, 42, + 43, 48, 57, 65, 90, 95, 96, 97, + 122, 9, 13, 32, 33, 37, 39, 44, + 59, 126, 42, 46, 48, 57, 65, 90, + 95, 96, 97, 122, 9, 13, 32, 33, + 37, 39, 44, 45, 46, 59, 126, 42, + 43, 48, 57, 65, 90, 95, 96, 97, + 122, 9, 13, 32, 33, 37, 39, 44, + 59, 126, 42, 46, 48, 57, 65, 90, + 95, 96, 97, 122, 9, 13, 32, 44, + 45, 46, 59, 48, 57, 65, 90, 97, + 122, 9, 13, 32, 44, 45, 46, 59, + 48, 57, 65, 90, 97, 122, 9, 13, + 32, 44, 45, 46, 59, 48, 57, 65, + 90, 97, 122, 9, 13, 32, 33, 37, + 39, 44, 45, 46, 59, 126, 42, 43, + 48, 57, 65, 90, 95, 96, 97, 122, + 9, 13, 32, 33, 37, 39, 44, 45, + 46, 59, 126, 42, 43, 48, 57, 65, + 90, 95, 96, 97, 122, 9, 13, 32, + 33, 37, 39, 44, 45, 46, 59, 126, + 42, 43, 48, 57, 65, 90, 95, 96, + 97, 122, 9, 13, 32, 33, 37, 39, + 44, 45, 46, 59, 126, 42, 43, 48, + 57, 65, 90, 95, 96, 97, 122, 9, + 13, 32, 33, 37, 39, 44, 45, 46, + 59, 126, 42, 43, 48, 57, 65, 90, + 95, 96, 97, 122, 9, 13, 32, 33, + 37, 39, 44, 45, 46, 59, 126, 42, + 43, 48, 57, 65, 90, 95, 96, 97, + 122, 58, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 48, 57, 65, 70, 97, 102, + 58, 93, 58, 48, 57, 65, 70, 97, + 102, 46, 58, 93, 48, 57, 65, 70, + 97, 102, 48, 57, 46, 48, 57, 48, + 57, 46, 48, 57, 48, 57, 93, 48, + 57, 93, 48, 57, 93, 9, 13, 32, + 44, 59, 46, 48, 57, 46, 46, 48, + 57, 46, 46, 58, 93, 48, 57, 65, + 70, 97, 102, 46, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 46, 58, 93, + 48, 57, 65, 70, 97, 102, 46, 58, + 93, 48, 57, 65, 70, 97, 102, 48, + 57, 46, 48, 57, 46, 48, 57, 46, + 58, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 69, 80, 101, 112, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 44, 59, 61, + 67, 99, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 44, 59, 61, 69, 101, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 44, 59, 61, + 73, 105, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 44, 59, 61, 86, 118, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 44, 59, 61, + 69, 101, 126, 42, 46, 48, 57, 65, + 90, 95, 122, 9, 13, 32, 33, 37, + 39, 44, 59, 61, 68, 100, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 33, 37, 39, 44, 59, 61, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 44, 59, 61, 10, + 9, 32, 9, 32, 44, 59, 61, 9, + 13, 32, 33, 34, 37, 39, 58, 91, + 126, 42, 43, 45, 46, 48, 57, 65, + 70, 71, 90, 95, 96, 97, 102, 103, + 122, 10, 9, 32, 9, 13, 32, 33, + 34, 37, 39, 58, 91, 126, 42, 43, + 45, 46, 48, 57, 65, 70, 71, 90, + 95, 96, 97, 102, 103, 122, 9, 13, + 32, 44, 46, 58, 59, 48, 57, 65, + 70, 97, 102, 48, 57, 46, 48, 57, + 48, 57, 46, 48, 57, 48, 57, 9, + 13, 32, 44, 59, 48, 57, 9, 13, + 32, 44, 59, 48, 57, 9, 13, 32, + 44, 59, 46, 48, 57, 46, 46, 48, + 57, 46, 9, 13, 32, 44, 46, 58, + 59, 48, 57, 65, 70, 97, 102, 9, + 13, 32, 44, 46, 58, 59, 48, 57, + 65, 70, 97, 102, 9, 13, 32, 44, + 58, 59, 58, 48, 57, 65, 70, 97, + 102, 9, 13, 32, 44, 58, 59, 48, + 57, 65, 70, 97, 102, 9, 13, 32, + 44, 58, 59, 48, 57, 65, 70, 97, + 102, 9, 13, 32, 44, 58, 59, 48, + 57, 65, 70, 97, 102, 9, 13, 32, + 44, 58, 59, 48, 57, 65, 70, 97, + 102, 9, 13, 32, 44, 58, 59, 48, + 57, 65, 70, 97, 102, 9, 13, 32, + 44, 46, 58, 59, 48, 57, 65, 70, + 97, 102, 9, 13, 32, 44, 46, 58, + 59, 48, 57, 65, 70, 97, 102, 9, + 13, 32, 44, 46, 58, 59, 48, 57, + 65, 70, 97, 102, 48, 57, 46, 48, + 57, 46, 48, 57, 46, 9, 13, 32, + 44, 58, 59, 48, 57, 65, 70, 97, + 102, 9, 13, 32, 44, 58, 59, 48, + 57, 65, 70, 97, 102, 9, 13, 32, + 44, 58, 59, 48, 57, 65, 70, 97, + 102, 58, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 79, 111, 126, 42, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 33, 37, 39, 44, 59, 61, 82, + 114, 126, 42, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 33, 37, 39, + 44, 59, 61, 84, 116, 126, 42, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 44, 59, 61, 9, 13, 32, 44, + 59, 61, 10, 9, 32, 9, 32, 44, + 59, 61, 9, 13, 32, 48, 57, 10, + 9, 32, 9, 32, 48, 57, 9, 13, + 32, 44, 59, 48, 57, 9, 13, 32, + 33, 37, 39, 44, 59, 61, 84, 116, + 126, 42, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 39, 44, + 59, 61, 76, 108, 126, 42, 46, 48, + 57, 65, 90, 95, 122, 9, 13, 32, + 33, 37, 39, 44, 59, 61, 126, 42, + 46, 48, 57, 65, 90, 95, 122, 9, + 13, 32, 44, 59, 61, 10, 9, 32, + 9, 32, 44, 59, 61, 9, 13, 32, + 33, 34, 37, 39, 91, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 10, 9, 32, 9, 13, 32, 33, 34, + 37, 39, 91, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 9, 13, + 32, 44, 59, 48, 57, 9, 13, 32, + 44, 59, 48, 57, 9, 13, 32, 44, + 59, 45, 48, 57, 65, 90, 97, 122, + 9, 13, 32, 44, 58, 59, 48, 57, + 65, 90, 97, 122, 48, 57, 65, 90, + 97, 122, 45, 46, 48, 57, 65, 90, + 97, 122, 48, 57, 65, 90, 97, 122, + 45, 46, 48, 57, 65, 90, 97, 122, + 48, 57, 65, 90, 97, 122, 9, 13, + 32, 44, 45, 46, 58, 59, 48, 57, + 65, 90, 97, 122, 9, 13, 32, 44, + 45, 46, 58, 59, 48, 57, 65, 90, + 97, 122, 9, 13, 32, 44, 45, 46, + 58, 59, 48, 57, 65, 90, 97, 122, + 45, 46, 48, 57, 65, 90, 97, 122, + 45, 46, 48, 57, 65, 90, 97, 122, + 45, 46, 48, 57, 65, 90, 97, 122, + 45, 46, 48, 57, 65, 90, 97, 122, + 45, 46, 48, 57, 65, 90, 97, 122, + 45, 46, 48, 57, 65, 90, 97, 122, + 58, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 58, 48, 57, 65, 70, 97, 102, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 48, 57, 46, 48, 57, 48, 57, + 46, 48, 57, 48, 57, 93, 48, 57, + 93, 48, 57, 93, 9, 13, 32, 44, + 58, 59, 46, 48, 57, 46, 46, 48, + 57, 46, 46, 58, 93, 48, 57, 65, + 70, 97, 102, 46, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 58, 93, 48, 57, + 65, 70, 97, 102, 46, 58, 93, 48, + 57, 65, 70, 97, 102, 46, 58, 93, + 48, 57, 65, 70, 97, 102, 46, 58, + 93, 48, 57, 65, 70, 97, 102, 48, + 57, 46, 48, 57, 46, 48, 57, 46, + 58, 65, 97, 0 +}; + +static const char _tsip_machine_parser_header_Via_single_lengths[] = { + 0, 2, 5, 3, 7, 1, 2, 6, + 8, 4, 1, 2, 3, 7, 1, 2, + 6, 8, 4, 1, 2, 3, 7, 1, + 2, 6, 7, 4, 1, 2, 3, 2, + 1, 2, 0, 8, 6, 1, 2, 5, + 3, 1, 2, 2, 5, 5, 1, 2, + 4, 17, 1, 2, 16, 10, 6, 1, + 2, 5, 9, 1, 2, 9, 1, 2, + 3, 4, 1, 2, 5, 1, 0, 9, + 1, 2, 2, 2, 2, 1, 3, 0, + 1, 0, 1, 0, 1, 1, 1, 1, + 1, 1, 1, 3, 3, 2, 2, 2, + 2, 2, 0, 3, 3, 3, 0, 1, + 1, 1, 1, 12, 12, 12, 12, 12, + 10, 6, 1, 2, 5, 9, 1, 2, + 9, 9, 12, 12, 12, 10, 6, 1, + 2, 5, 9, 1, 2, 9, 9, 12, + 12, 12, 12, 10, 6, 1, 2, 5, + 9, 1, 2, 9, 11, 10, 11, 9, + 7, 1, 5, 2, 1, 0, 9, 11, + 9, 11, 9, 7, 7, 7, 11, 11, + 11, 11, 11, 11, 1, 2, 2, 2, + 2, 1, 3, 0, 1, 0, 1, 0, + 1, 1, 1, 5, 1, 1, 1, 1, + 3, 3, 2, 2, 2, 2, 2, 0, + 3, 3, 3, 0, 1, 1, 1, 1, + 14, 12, 12, 12, 12, 12, 12, 10, + 6, 1, 2, 5, 10, 1, 2, 10, + 7, 0, 1, 0, 1, 0, 5, 5, + 5, 1, 1, 1, 1, 7, 7, 6, + 1, 6, 6, 6, 6, 6, 0, 7, + 7, 7, 0, 1, 1, 1, 6, 6, + 6, 1, 12, 12, 12, 6, 6, 1, + 2, 5, 3, 1, 2, 2, 5, 12, + 12, 10, 6, 1, 2, 5, 9, 1, + 2, 9, 5, 5, 5, 1, 6, 0, + 2, 0, 2, 0, 8, 8, 8, 2, + 2, 2, 2, 2, 2, 1, 2, 2, + 2, 2, 1, 3, 0, 1, 0, 1, + 0, 1, 1, 1, 6, 1, 1, 1, + 1, 3, 3, 2, 2, 2, 2, 2, + 0, 3, 3, 3, 0, 1, 1, 1, + 1, 2, 0 +}; + +static const char _tsip_machine_parser_header_Via_range_lengths[] = { + 0, 0, 0, 0, 5, 0, 0, 5, + 4, 0, 0, 0, 0, 5, 0, 0, + 5, 4, 0, 0, 0, 0, 5, 0, + 0, 5, 5, 3, 0, 0, 3, 3, + 3, 3, 3, 3, 0, 0, 0, 0, + 1, 0, 0, 1, 1, 0, 0, 0, + 0, 5, 0, 0, 5, 4, 0, 0, + 0, 0, 5, 0, 0, 5, 0, 0, + 0, 2, 0, 0, 0, 0, 3, 4, + 3, 3, 3, 3, 0, 3, 3, 1, + 1, 1, 1, 1, 1, 1, 0, 1, + 0, 1, 0, 3, 3, 3, 3, 3, + 3, 0, 3, 3, 3, 3, 1, 1, + 1, 0, 0, 4, 4, 4, 4, 4, + 4, 0, 0, 0, 0, 5, 0, 0, + 5, 4, 4, 4, 4, 4, 0, 0, + 0, 0, 5, 0, 0, 5, 4, 4, + 4, 4, 4, 4, 0, 0, 0, 0, + 6, 0, 0, 6, 5, 5, 5, 5, + 3, 3, 3, 3, 3, 3, 5, 5, + 5, 5, 5, 3, 3, 3, 5, 5, + 5, 5, 5, 5, 3, 3, 3, 3, + 0, 3, 3, 1, 1, 1, 1, 1, + 1, 1, 0, 0, 1, 0, 1, 0, + 3, 3, 3, 3, 3, 3, 0, 3, + 3, 3, 3, 1, 1, 1, 0, 0, + 4, 4, 4, 4, 4, 4, 4, 4, + 0, 0, 0, 0, 8, 0, 0, 8, + 3, 1, 1, 1, 1, 1, 1, 1, + 0, 1, 0, 1, 0, 3, 3, 0, + 3, 3, 3, 3, 3, 0, 3, 3, + 3, 3, 1, 1, 1, 0, 3, 3, + 3, 0, 4, 4, 4, 0, 0, 0, + 0, 0, 1, 0, 0, 1, 1, 4, + 4, 4, 0, 0, 0, 0, 5, 0, + 0, 5, 1, 1, 0, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 0, 3, 3, 1, 1, 1, 1, + 1, 1, 1, 0, 0, 1, 0, 1, + 0, 3, 3, 3, 3, 3, 3, 0, + 3, 3, 3, 3, 1, 1, 1, 0, + 0, 0, 0 +}; + +static const short _tsip_machine_parser_header_Via_index_offsets[] = { + 0, 0, 3, 9, 13, 26, 28, 31, + 43, 56, 61, 63, 66, 70, 83, 85, + 88, 100, 113, 118, 120, 123, 127, 140, + 142, 145, 157, 170, 178, 180, 183, 190, + 196, 201, 207, 211, 223, 230, 232, 235, + 241, 246, 248, 251, 255, 262, 268, 270, + 273, 278, 301, 303, 306, 328, 343, 350, + 352, 355, 361, 376, 378, 381, 396, 398, + 401, 405, 412, 414, 417, 423, 425, 429, + 443, 448, 454, 460, 466, 469, 474, 481, + 483, 486, 488, 491, 493, 496, 499, 501, + 504, 506, 509, 511, 518, 525, 531, 537, + 543, 549, 552, 556, 563, 570, 577, 579, + 582, 585, 587, 589, 606, 623, 640, 657, + 674, 689, 696, 698, 701, 707, 722, 724, + 727, 742, 756, 773, 790, 807, 822, 829, + 831, 834, 840, 855, 857, 860, 875, 889, + 906, 923, 940, 957, 972, 979, 981, 984, + 990, 1006, 1008, 1011, 1027, 1044, 1060, 1077, + 1092, 1103, 1108, 1117, 1123, 1128, 1132, 1147, + 1164, 1179, 1196, 1211, 1222, 1233, 1244, 1261, + 1278, 1295, 1312, 1329, 1346, 1351, 1357, 1363, + 1369, 1372, 1377, 1384, 1386, 1389, 1391, 1394, + 1396, 1399, 1402, 1404, 1410, 1413, 1415, 1418, + 1420, 1427, 1434, 1440, 1446, 1452, 1458, 1461, + 1465, 1472, 1479, 1486, 1488, 1491, 1494, 1496, + 1498, 1517, 1534, 1551, 1568, 1585, 1602, 1619, + 1634, 1641, 1643, 1646, 1652, 1671, 1673, 1676, + 1695, 1706, 1708, 1711, 1713, 1716, 1718, 1725, + 1732, 1738, 1741, 1743, 1746, 1748, 1759, 1770, + 1777, 1782, 1792, 1802, 1812, 1822, 1829, 1833, + 1844, 1855, 1866, 1868, 1871, 1874, 1876, 1886, + 1896, 1906, 1908, 1925, 1942, 1959, 1966, 1973, + 1975, 1978, 1984, 1989, 1991, 1994, 1998, 2005, + 2022, 2039, 2054, 2061, 2063, 2066, 2072, 2087, + 2089, 2092, 2107, 2114, 2121, 2127, 2132, 2142, + 2146, 2152, 2156, 2162, 2166, 2178, 2190, 2202, + 2208, 2214, 2220, 2226, 2232, 2238, 2243, 2249, + 2255, 2261, 2264, 2269, 2276, 2278, 2281, 2283, + 2286, 2288, 2291, 2294, 2296, 2303, 2306, 2308, + 2311, 2313, 2320, 2327, 2333, 2339, 2345, 2351, + 2354, 2358, 2365, 2372, 2379, 2381, 2384, 2387, + 2389, 2391, 2394 +}; + +static const short _tsip_machine_parser_header_Via_indicies[] = { + 0, 0, 1, 2, 2, 3, 4, 4, + 1, 2, 2, 3, 1, 3, 5, 3, + 6, 6, 6, 6, 6, 6, 6, 6, + 6, 1, 7, 1, 8, 8, 1, 8, + 8, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 1, 9, 10, 9, 11, 11, + 11, 12, 11, 11, 11, 11, 11, 1, + 13, 14, 13, 15, 1, 16, 1, 17, + 17, 1, 17, 17, 15, 1, 15, 18, + 15, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 1, 20, 1, 21, 21, 1, + 21, 21, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 1, 22, 23, 22, 24, + 24, 24, 25, 24, 24, 24, 24, 24, + 1, 26, 27, 26, 28, 1, 29, 1, + 30, 30, 1, 30, 30, 28, 1, 28, + 31, 28, 32, 32, 32, 32, 32, 32, + 32, 32, 32, 1, 33, 1, 34, 34, + 1, 34, 34, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 1, 35, 36, 35, + 37, 37, 37, 37, 37, 37, 37, 37, + 37, 1, 38, 39, 38, 42, 40, 41, + 41, 1, 43, 1, 44, 44, 1, 44, + 44, 42, 40, 41, 41, 1, 45, 46, + 47, 48, 48, 1, 45, 48, 48, 48, + 1, 45, 49, 48, 48, 48, 1, 48, + 50, 50, 1, 51, 52, 51, 53, 54, + 55, 56, 57, 50, 50, 50, 1, 58, + 59, 58, 3, 60, 61, 1, 62, 1, + 63, 63, 1, 63, 63, 3, 60, 61, + 1, 60, 64, 60, 65, 1, 66, 1, + 67, 67, 1, 67, 67, 65, 1, 68, + 69, 68, 70, 72, 71, 1, 73, 74, + 73, 3, 61, 1, 75, 1, 76, 76, + 1, 76, 76, 3, 61, 1, 61, 77, + 61, 78, 78, 78, 79, 80, 81, 82, + 83, 79, 80, 81, 82, 83, 78, 78, + 78, 78, 78, 78, 1, 84, 1, 85, + 85, 1, 85, 85, 78, 78, 78, 79, + 80, 81, 82, 83, 79, 80, 81, 82, + 83, 78, 78, 78, 78, 78, 78, 1, + 86, 87, 86, 88, 88, 88, 89, 90, + 91, 88, 88, 88, 88, 88, 1, 92, + 93, 92, 3, 61, 91, 1, 94, 1, + 95, 95, 1, 95, 95, 3, 61, 91, + 1, 91, 96, 91, 97, 98, 97, 97, + 99, 97, 97, 97, 97, 97, 97, 1, + 100, 1, 101, 101, 1, 101, 102, 101, + 97, 98, 97, 97, 99, 97, 97, 97, + 97, 97, 97, 1, 103, 1, 104, 104, + 1, 104, 104, 98, 1, 105, 106, 107, + 1, 1, 1, 98, 108, 1, 98, 98, + 1, 109, 87, 109, 89, 90, 1, 110, + 1, 98, 98, 98, 1, 109, 87, 109, + 97, 97, 97, 89, 90, 97, 97, 97, + 97, 97, 1, 112, 111, 111, 111, 1, + 114, 106, 113, 113, 113, 1, 114, 106, + 115, 115, 115, 1, 114, 106, 116, 116, + 116, 1, 114, 106, 1, 118, 117, 111, + 111, 1, 119, 114, 106, 120, 113, 113, + 1, 121, 1, 122, 123, 1, 124, 1, + 125, 126, 1, 127, 1, 106, 128, 1, + 106, 129, 1, 106, 1, 125, 130, 1, + 125, 1, 122, 131, 1, 122, 1, 119, + 114, 106, 132, 115, 115, 1, 119, 114, + 106, 116, 116, 116, 1, 134, 106, 133, + 133, 133, 1, 136, 106, 135, 135, 135, + 1, 136, 106, 137, 137, 137, 1, 136, + 106, 138, 138, 138, 1, 136, 106, 1, + 139, 133, 133, 1, 119, 136, 106, 140, + 135, 135, 1, 119, 136, 106, 141, 137, + 137, 1, 119, 136, 106, 138, 138, 138, + 1, 142, 1, 119, 143, 1, 119, 144, + 1, 119, 1, 118, 1, 86, 87, 86, + 88, 88, 88, 89, 90, 91, 145, 145, + 88, 88, 88, 88, 88, 1, 86, 87, + 86, 88, 88, 88, 89, 90, 91, 146, + 146, 88, 88, 88, 88, 88, 1, 86, + 87, 86, 88, 88, 88, 89, 90, 91, + 147, 147, 88, 88, 88, 88, 88, 1, + 86, 87, 86, 88, 88, 88, 89, 90, + 91, 148, 148, 88, 88, 88, 88, 88, + 1, 86, 87, 86, 88, 88, 88, 89, + 90, 91, 149, 149, 88, 88, 88, 88, + 88, 1, 150, 87, 150, 88, 88, 88, + 89, 90, 151, 88, 88, 88, 88, 88, + 1, 152, 153, 152, 3, 61, 151, 1, + 154, 1, 155, 155, 1, 155, 155, 3, + 61, 151, 1, 151, 156, 151, 157, 98, + 157, 157, 99, 157, 157, 157, 157, 157, + 157, 1, 158, 1, 159, 159, 1, 159, + 102, 159, 157, 98, 157, 157, 99, 157, + 157, 157, 157, 157, 157, 1, 160, 161, + 160, 162, 162, 162, 163, 164, 162, 162, + 162, 162, 162, 1, 86, 87, 86, 88, + 88, 88, 89, 90, 91, 165, 165, 88, + 88, 88, 88, 88, 1, 86, 87, 86, + 88, 88, 88, 89, 90, 91, 166, 166, + 88, 88, 88, 88, 88, 1, 86, 87, + 86, 88, 88, 88, 89, 90, 91, 167, + 167, 88, 88, 88, 88, 88, 1, 168, + 87, 168, 88, 88, 88, 89, 90, 169, + 88, 88, 88, 88, 88, 1, 170, 171, + 170, 3, 61, 169, 1, 172, 1, 173, + 173, 1, 173, 173, 3, 61, 169, 1, + 169, 174, 169, 175, 98, 175, 175, 99, + 175, 175, 175, 175, 175, 175, 1, 176, + 1, 177, 177, 1, 177, 102, 177, 175, + 98, 175, 175, 99, 175, 175, 175, 175, + 175, 175, 1, 178, 179, 178, 180, 180, + 180, 181, 182, 180, 180, 180, 180, 180, + 1, 86, 87, 86, 88, 88, 88, 89, + 90, 91, 183, 183, 88, 88, 88, 88, + 88, 1, 86, 87, 86, 88, 88, 88, + 89, 90, 91, 184, 184, 88, 88, 88, + 88, 88, 1, 86, 87, 86, 88, 88, + 88, 89, 90, 91, 185, 185, 88, 88, + 88, 88, 88, 1, 86, 87, 86, 88, + 88, 88, 89, 90, 91, 186, 186, 88, + 88, 88, 88, 88, 1, 187, 87, 187, + 88, 88, 88, 89, 90, 188, 88, 88, + 88, 88, 88, 1, 189, 190, 189, 3, + 61, 188, 1, 191, 1, 192, 192, 1, + 192, 192, 3, 61, 188, 1, 188, 193, + 188, 97, 98, 97, 97, 196, 97, 97, + 97, 194, 195, 97, 195, 1, 197, 1, + 198, 198, 1, 198, 102, 198, 97, 98, + 97, 97, 196, 97, 97, 97, 194, 195, + 97, 195, 1, 109, 87, 109, 97, 97, + 97, 89, 199, 200, 90, 97, 97, 201, + 202, 97, 202, 1, 109, 87, 109, 97, + 97, 97, 89, 199, 90, 97, 97, 202, + 202, 97, 202, 1, 109, 87, 109, 97, + 97, 97, 89, 199, 203, 90, 97, 97, + 202, 202, 97, 202, 1, 109, 87, 109, + 97, 97, 97, 89, 90, 97, 97, 202, + 204, 97, 204, 1, 205, 206, 205, 207, + 208, 209, 210, 204, 204, 204, 1, 208, + 204, 204, 204, 1, 205, 206, 205, 207, + 210, 211, 204, 204, 1, 212, 213, 211, + 211, 211, 1, 212, 211, 211, 211, 1, + 211, 204, 204, 1, 109, 87, 109, 97, + 97, 97, 89, 90, 97, 97, 214, 204, + 97, 204, 1, 109, 87, 109, 97, 97, + 97, 89, 199, 215, 90, 97, 97, 216, + 202, 97, 202, 1, 109, 87, 109, 97, + 97, 97, 89, 90, 97, 97, 217, 204, + 97, 204, 1, 109, 87, 109, 97, 97, + 97, 89, 199, 218, 90, 97, 97, 219, + 202, 97, 202, 1, 109, 87, 109, 97, + 97, 97, 89, 90, 97, 97, 220, 204, + 97, 204, 1, 205, 206, 205, 207, 212, + 213, 210, 221, 211, 211, 1, 205, 206, + 205, 207, 212, 213, 210, 222, 211, 211, + 1, 205, 206, 205, 207, 212, 213, 210, + 211, 211, 211, 1, 109, 87, 109, 97, + 97, 97, 89, 199, 218, 90, 97, 97, + 223, 202, 97, 202, 1, 109, 87, 109, + 97, 97, 97, 89, 199, 218, 90, 97, + 97, 202, 202, 97, 202, 1, 109, 87, + 109, 97, 97, 97, 89, 199, 215, 90, + 97, 97, 224, 202, 97, 202, 1, 109, + 87, 109, 97, 97, 97, 89, 199, 215, + 90, 97, 97, 202, 202, 97, 202, 1, + 109, 87, 109, 97, 97, 97, 89, 199, + 200, 90, 97, 97, 225, 202, 97, 202, + 1, 109, 87, 109, 97, 97, 97, 89, + 199, 200, 90, 97, 97, 202, 202, 97, + 202, 1, 227, 226, 226, 226, 1, 229, + 230, 228, 228, 228, 1, 229, 230, 231, + 231, 231, 1, 229, 230, 232, 232, 232, + 1, 229, 230, 1, 234, 233, 226, 226, + 1, 235, 229, 230, 236, 228, 228, 1, + 237, 1, 238, 239, 1, 240, 1, 241, + 242, 1, 243, 1, 230, 244, 1, 230, + 245, 1, 230, 1, 205, 206, 205, 207, + 210, 1, 241, 246, 1, 241, 1, 238, + 247, 1, 238, 1, 235, 229, 230, 248, + 231, 231, 1, 235, 229, 230, 232, 232, + 232, 1, 250, 230, 249, 249, 249, 1, + 252, 230, 251, 251, 251, 1, 252, 230, + 253, 253, 253, 1, 252, 230, 254, 254, + 254, 1, 252, 230, 1, 255, 249, 249, + 1, 235, 252, 230, 256, 251, 251, 1, + 235, 252, 230, 257, 253, 253, 1, 235, + 252, 230, 254, 254, 254, 1, 258, 1, + 235, 259, 1, 235, 260, 1, 235, 1, + 234, 1, 86, 87, 86, 88, 88, 88, + 89, 90, 91, 261, 262, 261, 262, 88, + 88, 88, 88, 88, 1, 86, 87, 86, + 88, 88, 88, 89, 90, 91, 263, 263, + 88, 88, 88, 88, 88, 1, 86, 87, + 86, 88, 88, 88, 89, 90, 91, 264, + 264, 88, 88, 88, 88, 88, 1, 86, + 87, 86, 88, 88, 88, 89, 90, 91, + 265, 265, 88, 88, 88, 88, 88, 1, + 86, 87, 86, 88, 88, 88, 89, 90, + 91, 266, 266, 88, 88, 88, 88, 88, + 1, 86, 87, 86, 88, 88, 88, 89, + 90, 91, 267, 267, 88, 88, 88, 88, + 88, 1, 86, 87, 86, 88, 88, 88, + 89, 90, 91, 268, 268, 88, 88, 88, + 88, 88, 1, 269, 87, 269, 88, 88, + 88, 89, 90, 270, 88, 88, 88, 88, + 88, 1, 271, 272, 271, 3, 61, 270, + 1, 273, 1, 274, 274, 1, 274, 274, + 3, 61, 270, 1, 270, 275, 270, 97, + 98, 97, 97, 277, 99, 97, 97, 97, + 276, 278, 97, 97, 278, 97, 1, 279, + 1, 280, 280, 1, 280, 102, 280, 97, + 98, 97, 97, 277, 99, 97, 97, 97, + 276, 278, 97, 97, 278, 97, 1, 281, + 282, 281, 283, 284, 286, 287, 285, 288, + 288, 1, 289, 1, 290, 291, 1, 292, + 1, 293, 294, 1, 295, 1, 281, 282, + 281, 283, 287, 296, 1, 281, 282, 281, + 283, 287, 297, 1, 281, 282, 281, 283, + 287, 1, 293, 298, 1, 293, 1, 290, + 299, 1, 290, 1, 281, 282, 281, 283, + 284, 286, 287, 300, 301, 301, 1, 281, + 282, 281, 283, 284, 286, 287, 302, 302, + 302, 1, 281, 282, 281, 283, 286, 287, + 1, 304, 303, 305, 305, 1, 281, 282, + 281, 283, 307, 287, 306, 306, 306, 1, + 281, 282, 281, 283, 309, 287, 308, 308, + 308, 1, 281, 282, 281, 283, 309, 287, + 310, 310, 310, 1, 281, 282, 281, 283, + 309, 287, 311, 311, 311, 1, 281, 282, + 281, 283, 309, 287, 1, 312, 306, 306, + 1, 281, 282, 281, 283, 284, 309, 287, + 313, 308, 308, 1, 281, 282, 281, 283, + 284, 309, 287, 314, 310, 310, 1, 281, + 282, 281, 283, 284, 309, 287, 311, 311, + 311, 1, 315, 1, 284, 316, 1, 284, + 317, 1, 284, 1, 281, 282, 281, 283, + 286, 287, 288, 288, 288, 1, 281, 282, + 281, 283, 286, 287, 301, 301, 301, 1, + 281, 282, 281, 283, 286, 287, 302, 302, + 302, 1, 304, 1, 86, 87, 86, 88, + 88, 88, 89, 90, 91, 318, 318, 88, + 88, 88, 88, 88, 1, 86, 87, 86, + 88, 88, 88, 89, 90, 91, 319, 319, + 88, 88, 88, 88, 88, 1, 86, 87, + 86, 88, 88, 88, 89, 90, 91, 320, + 320, 88, 88, 88, 88, 88, 1, 321, + 322, 321, 323, 324, 325, 1, 326, 327, + 326, 3, 61, 325, 1, 328, 1, 329, + 329, 1, 329, 329, 3, 61, 325, 1, + 325, 330, 325, 331, 1, 332, 1, 333, + 333, 1, 333, 333, 331, 1, 334, 335, + 334, 336, 338, 337, 1, 86, 87, 86, + 88, 88, 88, 89, 90, 91, 339, 339, + 88, 88, 88, 88, 88, 1, 86, 87, + 86, 88, 88, 88, 89, 90, 91, 340, + 340, 88, 88, 88, 88, 88, 1, 341, + 87, 341, 88, 88, 88, 89, 90, 342, + 88, 88, 88, 88, 88, 1, 343, 344, + 343, 3, 61, 342, 1, 345, 1, 346, + 346, 1, 346, 346, 3, 61, 342, 1, + 342, 347, 342, 97, 98, 97, 97, 99, + 97, 97, 97, 348, 97, 97, 1, 349, + 1, 350, 350, 1, 350, 102, 350, 97, + 98, 97, 97, 99, 97, 97, 97, 348, + 97, 97, 1, 351, 352, 351, 353, 355, + 354, 1, 351, 352, 351, 353, 355, 356, + 1, 351, 352, 351, 353, 355, 1, 54, + 50, 50, 50, 1, 51, 52, 51, 53, + 56, 57, 48, 50, 50, 1, 357, 50, + 50, 1, 45, 358, 359, 48, 48, 1, + 360, 50, 50, 1, 45, 361, 362, 48, + 48, 1, 363, 50, 50, 1, 51, 52, + 51, 53, 45, 49, 56, 57, 364, 48, + 48, 1, 51, 52, 51, 53, 45, 49, + 56, 57, 365, 48, 48, 1, 51, 52, + 51, 53, 45, 49, 56, 57, 48, 48, + 48, 1, 45, 361, 366, 48, 48, 1, + 45, 361, 48, 48, 48, 1, 45, 358, + 367, 48, 48, 1, 45, 358, 48, 48, + 48, 1, 45, 46, 368, 48, 48, 1, + 45, 46, 48, 48, 48, 1, 370, 369, + 369, 369, 1, 372, 373, 371, 371, 371, + 1, 372, 373, 374, 374, 374, 1, 372, + 373, 375, 375, 375, 1, 372, 373, 1, + 377, 376, 369, 369, 1, 378, 372, 373, + 379, 371, 371, 1, 380, 1, 381, 382, + 1, 383, 1, 384, 385, 1, 386, 1, + 373, 387, 1, 373, 388, 1, 373, 1, + 51, 52, 51, 53, 56, 57, 1, 384, + 389, 1, 384, 1, 381, 390, 1, 381, + 1, 378, 372, 373, 391, 374, 374, 1, + 378, 372, 373, 375, 375, 375, 1, 393, + 373, 392, 392, 392, 1, 395, 373, 394, + 394, 394, 1, 395, 373, 396, 396, 396, + 1, 395, 373, 397, 397, 397, 1, 395, + 373, 1, 398, 392, 392, 1, 378, 395, + 373, 399, 394, 394, 1, 378, 395, 373, + 400, 396, 396, 1, 378, 395, 373, 397, + 397, 397, 1, 401, 1, 378, 402, 1, + 378, 403, 1, 378, 1, 377, 1, 2, + 2, 1, 1, 0 +}; + +static const short _tsip_machine_parser_header_Via_trans_targs[] = { + 2, 0, 3, 4, 337, 5, 8, 6, + 7, 9, 10, 8, 13, 9, 10, 13, + 11, 12, 14, 17, 15, 16, 18, 19, + 17, 22, 18, 19, 22, 20, 21, 23, + 26, 24, 25, 27, 28, 26, 27, 28, + 31, 35, 301, 29, 30, 32, 287, 299, + 33, 34, 35, 36, 69, 4, 285, 286, + 40, 49, 36, 37, 40, 49, 38, 39, + 41, 44, 42, 43, 45, 69, 4, 44, + 49, 45, 46, 47, 48, 50, 53, 107, + 122, 135, 208, 271, 51, 52, 54, 69, + 53, 4, 49, 58, 54, 55, 56, 57, + 59, 71, 65, 72, 60, 61, 62, 63, + 64, 66, 68, 70, 67, 45, 338, 73, + 106, 74, 77, 75, 76, 78, 93, 79, + 91, 80, 81, 89, 82, 83, 87, 84, + 85, 86, 88, 90, 92, 94, 102, 95, + 98, 96, 97, 99, 100, 101, 103, 104, + 105, 108, 109, 110, 111, 112, 113, 117, + 113, 114, 115, 116, 118, 121, 119, 120, + 45, 69, 121, 4, 49, 123, 124, 125, + 126, 130, 126, 127, 128, 129, 131, 134, + 132, 133, 45, 69, 134, 4, 49, 136, + 137, 138, 139, 140, 144, 140, 141, 142, + 143, 145, 148, 152, 172, 146, 147, 149, + 158, 170, 150, 151, 152, 45, 69, 4, + 153, 154, 49, 155, 156, 157, 159, 160, + 168, 161, 162, 166, 163, 164, 165, 167, + 169, 171, 173, 207, 174, 177, 187, 175, + 176, 178, 194, 179, 192, 180, 181, 190, + 182, 183, 188, 184, 185, 186, 189, 191, + 193, 195, 203, 196, 199, 197, 198, 200, + 201, 202, 204, 205, 206, 209, 258, 210, + 211, 212, 213, 214, 215, 216, 220, 216, + 217, 218, 219, 221, 224, 257, 254, 222, + 223, 45, 69, 4, 225, 237, 240, 49, + 255, 226, 227, 235, 228, 229, 233, 230, + 231, 232, 234, 236, 238, 256, 239, 224, + 241, 254, 242, 250, 243, 246, 244, 245, + 247, 248, 249, 251, 252, 253, 259, 260, + 261, 262, 69, 4, 49, 266, 262, 263, + 264, 265, 267, 270, 268, 269, 45, 69, + 4, 270, 49, 272, 273, 274, 278, 274, + 275, 276, 277, 279, 282, 280, 281, 45, + 69, 4, 283, 49, 284, 288, 289, 297, + 290, 291, 295, 292, 293, 294, 296, 298, + 300, 302, 336, 303, 306, 316, 304, 305, + 307, 323, 308, 321, 309, 310, 319, 311, + 312, 317, 313, 314, 315, 318, 320, 322, + 324, 332, 325, 328, 326, 327, 329, 330, + 331, 333, 334, 335 +}; + +static const char _tsip_machine_parser_header_Via_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 29, 0, + 0, 3, 3, 0, 3, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 5, 5, + 0, 5, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 11, 11, 0, 0, 0, + 1, 1, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 32, 32, 32, 0, 0, + 7, 7, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 35, 35, 35, 0, + 9, 0, 0, 0, 0, 0, 1, 1, + 1, 1, 1, 1, 0, 0, 59, 59, + 0, 59, 25, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 59, 27, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 59, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 47, 47, 0, 47, 19, 0, 0, 0, + 59, 0, 0, 0, 0, 0, 0, 1, + 0, 0, 50, 50, 0, 50, 21, 0, + 0, 0, 0, 59, 0, 0, 0, 0, + 0, 0, 1, 1, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 41, 41, 41, + 0, 0, 15, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 59, 0, 0, + 0, 0, 0, 0, 1, 1, 1, 0, + 0, 44, 44, 44, 0, 0, 0, 17, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 56, 56, 56, 23, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 62, 62, + 62, 0, 53, 0, 0, 59, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 38, + 38, 38, 0, 13, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0 +}; + +static const int tsip_machine_parser_header_Via_start = 1; +static const int tsip_machine_parser_header_Via_first_final = 338; +static const int tsip_machine_parser_header_Via_error = 0; + +static const int tsip_machine_parser_header_Via_en_main = 1; + + +/* #line 253 "./ragel/tsip_parser_header_Via.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Via_first_final); + (void)(tsip_machine_parser_header_Via_error); + (void)(tsip_machine_parser_header_Via_en_main); + +/* #line 1122 "./src/headers/tsip_header_Via.c" */ + { + cs = tsip_machine_parser_header_Via_start; + } + +/* #line 258 "./ragel/tsip_parser_header_Via.rl" */ + +/* #line 1129 "./src/headers/tsip_header_Via.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Via_trans_keys + _tsip_machine_parser_header_Via_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Via_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Via_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Via_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Via_indicies[_trans]; + cs = _tsip_machine_parser_header_Via_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Via_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Via_actions + _tsip_machine_parser_header_Via_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 47 "./ragel/tsip_parser_header_Via.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 51 "./ragel/tsip_parser_header_Via.rl" */ + { + if(!curr_via){ + curr_via = tsip_header_Via_create_null(); + } + } + break; + case 2: +/* #line 57 "./ragel/tsip_parser_header_Via.rl" */ + { + TSK_PARSER_SET_STRING(curr_via->proto_name); + } + break; + case 3: +/* #line 61 "./ragel/tsip_parser_header_Via.rl" */ + { + TSK_PARSER_SET_STRING(curr_via->proto_version); + } + break; + case 4: +/* #line 65 "./ragel/tsip_parser_header_Via.rl" */ + { + TSK_PARSER_SET_STRING(curr_via->host); + if(curr_via->host && *curr_via->host == '['){ + tsk_strunquote_2(&curr_via->host, '[', ']'); + } + } + break; + case 5: +/* #line 72 "./ragel/tsip_parser_header_Via.rl" */ + { + TSK_PARSER_SET_INTEGER(curr_via->port); + } + break; + case 6: +/* #line 76 "./ragel/tsip_parser_header_Via.rl" */ + { + TSK_PARSER_SET_STRING(curr_via->transport); + } + break; + case 7: +/* #line 80 "./ragel/tsip_parser_header_Via.rl" */ + { + TSK_PARSER_SET_INTEGER(curr_via->ttl); + } + break; + case 8: +/* #line 84 "./ragel/tsip_parser_header_Via.rl" */ + { + TSK_PARSER_SET_STRING(curr_via->maddr); + } + break; + case 9: +/* #line 88 "./ragel/tsip_parser_header_Via.rl" */ + { + TSK_PARSER_SET_STRING(curr_via->received); + } + break; + case 10: +/* #line 92 "./ragel/tsip_parser_header_Via.rl" */ + { + TSK_PARSER_SET_STRING(curr_via->branch); + } + break; + case 11: +/* #line 96 "./ragel/tsip_parser_header_Via.rl" */ + { + TSK_PARSER_SET_STRING(curr_via->comp); + } + break; + case 12: +/* #line 100 "./ragel/tsip_parser_header_Via.rl" */ + { + TSK_PARSER_SET_INTEGER(curr_via->rport); + } + break; + case 13: +/* #line 104 "./ragel/tsip_parser_header_Via.rl" */ + { + if(curr_via->rport <0){ + curr_via->rport = 0; + } + } + break; + case 14: +/* #line 110 "./ragel/tsip_parser_header_Via.rl" */ + { + TSK_PARSER_ADD_PARAM(TSIP_HEADER_PARAMS(curr_via)); + } + break; + case 15: +/* #line 114 "./ragel/tsip_parser_header_Via.rl" */ + { + if(curr_via){ + tsk_list_push_back_data(hdr_vias, ((void**) &curr_via)); + } + } + break; + case 16: +/* #line 120 "./ragel/tsip_parser_header_Via.rl" */ + { + + } + break; +/* #line 1314 "./src/headers/tsip_header_Via.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 259 "./ragel/tsip_parser_header_Via.rl" */ + + if( cs < +/* #line 1330 "./src/headers/tsip_header_Via.c" */ +338 +/* #line 260 "./ragel/tsip_parser_header_Via.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Via' header."); + TSK_OBJECT_SAFE_FREE(curr_via); + TSK_OBJECT_SAFE_FREE(hdr_vias); + } + + return hdr_vias; +} + + + + + + + + + + + +//======================================================== +// Via header object definition +// + +static tsk_object_t* tsip_header_Via_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Via_t *via = self; + if(via){ + const char* proto_name = va_arg(*app, const char *); + const char* proto_version = va_arg(*app, const char *); + const char* transport = va_arg(*app, const char *); + const char* host = va_arg(*app, const char *); +#if defined(__GNUC__) + uint16_t port = (uint16_t)va_arg(*app, unsigned); +#else + uint16_t port = va_arg(*app, uint16_t); +#endif + + if(proto_name) via->proto_name = tsk_strdup(proto_name); + if(proto_version) via->proto_version = tsk_strdup(proto_version); + if(transport) via->transport = tsk_strdup(transport); + if(host) via->host = tsk_strdup(host); + via->port = port; + + via->rport = -1; + via->ttl = -1; + + TSIP_HEADER(via)->type = tsip_htype_Via; + TSIP_HEADER(via)->serialize = tsip_header_Via_serialize; + TSIP_HEADER(via)->get_special_param_value = tsip_header_Via_get_special_param_value; + } + else{ + TSK_DEBUG_ERROR("Failed to create new Via header."); + } + return self; +} + +static tsk_object_t* tsip_header_Via_dtor(tsk_object_t *self) +{ + tsip_header_Via_t *via = self; + if(via){ + TSK_FREE(via->branch); + TSK_FREE(via->comp); + TSK_FREE(via->host); + TSK_FREE(via->maddr); + TSK_FREE(via->proto_name); + TSK_FREE(via->proto_version); + TSK_FREE(via->received); + TSK_FREE(via->sigcomp_id); + TSK_FREE(via->transport); + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(via)); + } + else{ + TSK_DEBUG_ERROR("Null Via header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Via_def_s = +{ + sizeof(tsip_header_Via_t), + tsip_header_Via_ctor, + tsip_header_Via_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Via_def_t = &tsip_header_Via_def_s; diff --git a/tinySIP/src/headers/tsip_header_WWW_Authenticate.c b/tinySIP/src/headers/tsip_header_WWW_Authenticate.c new file mode 100644 index 0000000..203486f --- /dev/null +++ b/tinySIP/src/headers/tsip_header_WWW_Authenticate.c @@ -0,0 +1,160 @@ + +/* #line 1 "tsip_parser_header_WWW_Authenticate.rl" */ +/* +* 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 tsip_header_WWW_Authenticate.c + * @brief SIP WWW-Authenticate header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_WWW_Authenticate.h" + +#include "tinyhttp/headers/thttp_header_WWW_Authenticate.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_time.h" + +#include <string.h> + +tsip_header_WWW_Authenticate_t* tsip_header_WWW_Authenticate_create() +{ + return tsk_object_new(tsip_header_WWW_Authenticate_def_t); +} + +int tsip_header_WWW_Authenticate_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_WWW_Authenticate_t *WWW_Authenticate = (const tsip_header_WWW_Authenticate_t *)header; + if(WWW_Authenticate && WWW_Authenticate->scheme){ + return tsk_buffer_append_2(output, "%s realm=\"%s\"%s%s%s%s%s%s%s%s%s%s%s%s,stale=%s%s%s", + WWW_Authenticate->scheme, + WWW_Authenticate->realm ? WWW_Authenticate->realm : "", + + WWW_Authenticate->domain ? ",domain=\"" : "", + WWW_Authenticate->domain ? WWW_Authenticate->domain : "", + WWW_Authenticate->domain ? "\"" : "", + + + WWW_Authenticate->qop ? ",qop=\"" : "", + WWW_Authenticate->qop ? WWW_Authenticate->qop : "", + WWW_Authenticate->qop ? "\"" : "", + + + WWW_Authenticate->nonce ? ",nonce=\"" : "", + WWW_Authenticate->nonce ? WWW_Authenticate->nonce : "", + WWW_Authenticate->nonce ? "\"" : "", + + WWW_Authenticate->opaque ? ",opaque=\"" : "", + WWW_Authenticate->opaque ? WWW_Authenticate->opaque : "", + WWW_Authenticate->opaque ? "\"" : "", + + WWW_Authenticate->stale ? "TRUE" : "FALSE", + + WWW_Authenticate->algorithm ? ",algorithm=" : "", + WWW_Authenticate->algorithm ? WWW_Authenticate->algorithm : "" + ); + } + } + return -1; +} + +tsip_header_WWW_Authenticate_t *tsip_header_WWW_Authenticate_parse(const char *data, tsk_size_t size) +{ + tsip_header_WWW_Authenticate_t *sip_hdr = 0; + thttp_header_WWW_Authenticate_t* http_hdr; + + if((http_hdr = thttp_header_WWW_Authenticate_parse(data, size))){ + sip_hdr = tsip_header_WWW_Authenticate_create(); + + sip_hdr->scheme = tsk_strdup(http_hdr->scheme); + sip_hdr->realm = tsk_strdup(http_hdr->realm); + sip_hdr->domain = tsk_strdup(http_hdr->domain); + sip_hdr->nonce = tsk_strdup(http_hdr->nonce); + sip_hdr->opaque = tsk_strdup(http_hdr->opaque); + sip_hdr->algorithm = tsk_strdup(http_hdr->algorithm); + sip_hdr->qop = tsk_strdup(http_hdr->qop); + sip_hdr->stale = http_hdr->stale; + + TSIP_HEADER(sip_hdr)->params = tsk_object_ref(THTTP_HEADER(http_hdr)->params); + + TSK_OBJECT_SAFE_FREE(http_hdr); + } + + return sip_hdr; +} + + + + + + + +//======================================================== +// WWW_Authenticate header object definition +// + +static tsk_object_t* tsip_header_WWW_Authenticate_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_WWW_Authenticate_t *WWW_Authenticate = self; + if(WWW_Authenticate){ + TSIP_HEADER(WWW_Authenticate)->type = tsip_htype_WWW_Authenticate; + TSIP_HEADER(WWW_Authenticate)->serialize = tsip_header_WWW_Authenticate_serialize; + } + else{ + TSK_DEBUG_ERROR("Failed to create new WWW_Authenticate header."); + } + return self; +} + +static tsk_object_t* tsip_header_WWW_Authenticate_dtor(tsk_object_t *self) +{ + tsip_header_WWW_Authenticate_t *WWW_Authenticate = self; + if(WWW_Authenticate){ + TSK_FREE(WWW_Authenticate->scheme); + TSK_FREE(WWW_Authenticate->realm); + TSK_FREE(WWW_Authenticate->domain); + TSK_FREE(WWW_Authenticate->nonce); + TSK_FREE(WWW_Authenticate->opaque); + TSK_FREE(WWW_Authenticate->algorithm); + TSK_FREE(WWW_Authenticate->qop); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(WWW_Authenticate)); + } + else{ + TSK_DEBUG_ERROR("Null WWW_Authenticate header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_WWW_Authenticate_def_s = +{ + sizeof(tsip_header_WWW_Authenticate_t), + tsip_header_WWW_Authenticate_ctor, + tsip_header_WWW_Authenticate_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_WWW_Authenticate_def_t = &tsip_header_WWW_Authenticate_def_s; diff --git a/tinySIP/src/headers/tsip_header_Warning.c b/tinySIP/src/headers/tsip_header_Warning.c new file mode 100644 index 0000000..ed7b3d9 --- /dev/null +++ b/tinySIP/src/headers/tsip_header_Warning.c @@ -0,0 +1,554 @@ + +/* #line 1 "./ragel/tsip_parser_header_Warning.rl" */ +/* +* 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 tsip_header_Warning.c + * @brief SIP Warning header. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_Warning.h" + +#include "tinysip/parsers/tsip_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_time.h" + +#include <string.h> + + + +/*********************************** +* Ragel state machine. +*/ + +/* #line 98 "./ragel/tsip_parser_header_Warning.rl" */ + + +tsip_header_Warning_t* tsip_header_Warning_create() +{ + return tsk_object_new(tsip_header_Warning_def_t); +} + +int tsip_header_Warning_serialize(const tsip_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tsip_header_Warning_t *Warning = (const tsip_header_Warning_t *)header; + return tsk_buffer_append_2(output, "%d %s %s", + Warning->code, Warning->agent, Warning->text); /* warn-code SP warn-agent SP warn-text */ + } + + return -1; +} + +tsip_header_Warnings_L_t *tsip_header_Warning_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tsip_header_Warnings_L_t *hdr_warnings = tsk_list_create(); + + const char *tag_start = tsk_null; + tsip_header_Warning_t *curr_warning = 0; + + +/* #line 80 "./src/headers/tsip_header_Warning.c" */ +static const char _tsip_machine_parser_header_Warning_actions[] = { + 0, 1, 0, 1, 2, 1, 4, 1, + 6, 2, 1, 0, 2, 3, 5 +}; + +static const short _tsip_machine_parser_header_Warning_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 12, + 14, 17, 22, 23, 25, 29, 31, 33, + 34, 51, 66, 70, 74, 75, 77, 80, + 88, 89, 91, 95, 99, 100, 102, 105, + 106, 112, 129, 146, 163, 180, 198, 215, + 233, 235, 238, 255, 272, 289, 306, 323, + 341, 359, 377, 394, 411, 428, 445, 462, + 479, 486, 494, 502, 510, 512, 519, 528, + 530, 533, 535, 538, 540, 543, 546, 547, + 549, 552, 553, 556, 557, 566, 575, 583, + 591, 599, 607, 609, 615, 624, 633, 642, + 644, 647, 650, 651, 652 +}; + +static const char _tsip_machine_parser_header_Warning_trans_keys[] = { + 87, 119, 65, 97, 82, 114, 78, 110, + 73, 105, 78, 110, 71, 103, 9, 32, + 58, 9, 13, 32, 48, 57, 10, 9, + 32, 9, 32, 48, 57, 48, 57, 48, + 57, 32, 33, 37, 39, 91, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 96, 97, 122, 32, 33, 37, 39, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 9, 13, 32, 34, 9, 13, + 32, 34, 10, 9, 32, 9, 32, 34, + 13, 34, 92, 127, 0, 8, 10, 31, + 10, 9, 32, 9, 13, 32, 44, 9, + 13, 32, 44, 10, 9, 32, 9, 32, + 44, 10, 0, 9, 11, 12, 14, 127, + 32, 33, 37, 39, 45, 46, 126, 42, + 43, 48, 57, 65, 90, 95, 96, 97, + 122, 32, 33, 37, 39, 45, 46, 126, + 42, 43, 48, 57, 65, 90, 95, 96, + 97, 122, 32, 33, 37, 39, 45, 46, + 126, 42, 43, 48, 57, 65, 90, 95, + 96, 97, 122, 32, 33, 37, 39, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 96, 97, 122, 32, 33, 37, 39, + 45, 46, 58, 126, 42, 43, 48, 57, + 65, 90, 95, 96, 97, 122, 32, 33, + 37, 39, 45, 46, 126, 42, 43, 48, + 57, 65, 90, 95, 96, 97, 122, 32, + 33, 37, 39, 58, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 96, 97, + 122, 48, 57, 32, 48, 57, 32, 33, + 37, 39, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 32, + 33, 37, 39, 45, 46, 126, 42, 43, + 48, 57, 65, 90, 95, 96, 97, 122, + 32, 33, 37, 39, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 96, 97, + 122, 32, 33, 37, 39, 45, 46, 126, + 42, 43, 48, 57, 65, 90, 95, 96, + 97, 122, 32, 33, 37, 39, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 96, 97, 122, 32, 33, 37, 39, 45, + 46, 58, 126, 42, 43, 48, 57, 65, + 90, 95, 96, 97, 122, 32, 33, 37, + 39, 45, 46, 58, 126, 42, 43, 48, + 57, 65, 90, 95, 96, 97, 122, 32, + 33, 37, 39, 45, 46, 58, 126, 42, + 43, 48, 57, 65, 90, 95, 96, 97, + 122, 32, 33, 37, 39, 45, 46, 126, + 42, 43, 48, 57, 65, 90, 95, 96, + 97, 122, 32, 33, 37, 39, 45, 46, + 126, 42, 43, 48, 57, 65, 90, 95, + 96, 97, 122, 32, 33, 37, 39, 45, + 46, 126, 42, 43, 48, 57, 65, 90, + 95, 96, 97, 122, 32, 33, 37, 39, + 45, 46, 126, 42, 43, 48, 57, 65, + 90, 95, 96, 97, 122, 32, 33, 37, + 39, 45, 46, 126, 42, 43, 48, 57, + 65, 90, 95, 96, 97, 122, 32, 33, + 37, 39, 45, 46, 126, 42, 43, 48, + 57, 65, 90, 95, 96, 97, 122, 58, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 48, 57, 65, 70, 97, 102, 58, 93, + 58, 48, 57, 65, 70, 97, 102, 46, + 58, 93, 48, 57, 65, 70, 97, 102, + 48, 57, 46, 48, 57, 48, 57, 46, + 48, 57, 48, 57, 93, 48, 57, 93, + 48, 57, 93, 32, 58, 46, 48, 57, + 46, 46, 48, 57, 46, 46, 58, 93, + 48, 57, 65, 70, 97, 102, 46, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 58, + 93, 48, 57, 65, 70, 97, 102, 46, + 58, 93, 48, 57, 65, 70, 97, 102, + 46, 58, 93, 48, 57, 65, 70, 97, + 102, 46, 58, 93, 48, 57, 65, 70, + 97, 102, 48, 57, 46, 48, 57, 46, + 48, 57, 46, 58, 0 +}; + +static const char _tsip_machine_parser_header_Warning_single_lengths[] = { + 0, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 1, 2, 2, 0, 0, 1, + 5, 5, 4, 4, 1, 2, 3, 4, + 1, 2, 4, 4, 1, 2, 3, 1, + 0, 7, 7, 7, 5, 8, 7, 6, + 0, 1, 5, 7, 5, 7, 5, 8, + 8, 8, 7, 7, 7, 7, 7, 7, + 1, 2, 2, 2, 2, 1, 3, 0, + 1, 0, 1, 0, 1, 1, 1, 2, + 1, 1, 1, 1, 3, 3, 2, 2, + 2, 2, 2, 0, 3, 3, 3, 0, + 1, 1, 1, 1, 0 +}; + +static const char _tsip_machine_parser_header_Warning_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 1, 1, 1, 0, + 6, 5, 0, 0, 0, 0, 0, 2, + 0, 0, 0, 0, 0, 0, 0, 0, + 3, 5, 5, 5, 6, 5, 5, 6, + 1, 1, 6, 5, 6, 5, 6, 5, + 5, 5, 5, 5, 5, 5, 5, 5, + 3, 3, 3, 3, 0, 3, 3, 1, + 1, 1, 1, 1, 1, 1, 0, 0, + 1, 0, 1, 0, 3, 3, 3, 3, + 3, 3, 0, 3, 3, 3, 3, 1, + 1, 1, 0, 0, 0 +}; + +static const short _tsip_machine_parser_header_Warning_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 15, 18, + 21, 25, 30, 32, 35, 39, 41, 43, + 45, 57, 68, 73, 78, 80, 83, 87, + 94, 96, 99, 104, 109, 111, 114, 118, + 120, 124, 137, 150, 163, 175, 189, 202, + 215, 217, 220, 232, 245, 257, 270, 282, + 296, 310, 324, 337, 350, 363, 376, 389, + 402, 407, 413, 419, 425, 428, 433, 440, + 442, 445, 447, 450, 452, 455, 458, 460, + 463, 466, 468, 471, 473, 480, 487, 493, + 499, 505, 511, 514, 518, 525, 532, 539, + 541, 544, 547, 549, 551 +}; + +static const char _tsip_machine_parser_header_Warning_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 5, 5, 1, 6, + 6, 1, 7, 7, 1, 7, 7, 8, + 1, 8, 9, 8, 10, 1, 11, 1, + 12, 12, 1, 12, 12, 10, 1, 13, + 1, 14, 1, 15, 1, 16, 16, 16, + 19, 16, 16, 16, 17, 18, 16, 18, + 1, 20, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 1, 22, 23, 22, 24, + 1, 25, 26, 25, 27, 1, 28, 1, + 29, 29, 1, 29, 29, 27, 1, 30, + 31, 32, 1, 1, 1, 27, 33, 1, + 27, 27, 1, 34, 35, 34, 36, 1, + 37, 38, 37, 8, 1, 39, 1, 40, + 40, 1, 40, 40, 8, 1, 41, 1, + 27, 27, 27, 1, 20, 21, 21, 21, + 42, 43, 21, 21, 44, 45, 21, 45, + 1, 20, 21, 21, 21, 42, 21, 21, + 21, 45, 45, 21, 45, 1, 20, 21, + 21, 21, 42, 46, 21, 21, 45, 45, + 21, 45, 1, 20, 21, 21, 21, 21, + 21, 21, 45, 47, 21, 47, 1, 20, + 21, 21, 21, 48, 49, 50, 21, 21, + 47, 47, 21, 47, 1, 20, 21, 21, + 21, 48, 21, 21, 21, 47, 47, 21, + 47, 1, 20, 21, 21, 21, 50, 21, + 21, 21, 45, 47, 21, 47, 1, 51, + 1, 20, 51, 1, 20, 21, 21, 21, + 21, 21, 21, 52, 47, 21, 47, 1, + 20, 21, 21, 21, 42, 53, 21, 21, + 54, 45, 21, 45, 1, 20, 21, 21, + 21, 21, 21, 21, 55, 47, 21, 47, + 1, 20, 21, 21, 21, 42, 56, 21, + 21, 57, 45, 21, 45, 1, 20, 21, + 21, 21, 21, 21, 21, 58, 47, 21, + 47, 1, 20, 21, 21, 21, 42, 46, + 50, 21, 21, 59, 45, 21, 45, 1, + 20, 21, 21, 21, 42, 46, 50, 21, + 21, 60, 45, 21, 45, 1, 20, 21, + 21, 21, 42, 46, 50, 21, 21, 45, + 45, 21, 45, 1, 20, 21, 21, 21, + 42, 56, 21, 21, 61, 45, 21, 45, + 1, 20, 21, 21, 21, 42, 56, 21, + 21, 45, 45, 21, 45, 1, 20, 21, + 21, 21, 42, 53, 21, 21, 62, 45, + 21, 45, 1, 20, 21, 21, 21, 42, + 53, 21, 21, 45, 45, 21, 45, 1, + 20, 21, 21, 21, 42, 43, 21, 21, + 63, 45, 21, 45, 1, 20, 21, 21, + 21, 42, 43, 21, 21, 45, 45, 21, + 45, 1, 65, 64, 64, 64, 1, 67, + 68, 66, 66, 66, 1, 67, 68, 69, + 69, 69, 1, 67, 68, 70, 70, 70, + 1, 67, 68, 1, 72, 71, 64, 64, + 1, 73, 67, 68, 74, 66, 66, 1, + 75, 1, 76, 77, 1, 78, 1, 79, + 80, 1, 81, 1, 68, 82, 1, 68, + 83, 1, 68, 1, 20, 50, 1, 79, + 84, 1, 79, 1, 76, 85, 1, 76, + 1, 73, 67, 68, 86, 69, 69, 1, + 73, 67, 68, 70, 70, 70, 1, 88, + 68, 87, 87, 87, 1, 90, 68, 89, + 89, 89, 1, 90, 68, 91, 91, 91, + 1, 90, 68, 92, 92, 92, 1, 90, + 68, 1, 93, 87, 87, 1, 73, 90, + 68, 94, 89, 89, 1, 73, 90, 68, + 95, 91, 91, 1, 73, 90, 68, 92, + 92, 92, 1, 96, 1, 73, 97, 1, + 73, 98, 1, 73, 1, 72, 1, 1, + 0 +}; + +static const char _tsip_machine_parser_header_Warning_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 13, 11, 12, 14, 15, 16, + 17, 33, 37, 56, 18, 17, 19, 20, + 23, 19, 20, 23, 21, 22, 24, 26, + 32, 25, 27, 31, 9, 27, 28, 29, + 30, 92, 34, 42, 54, 35, 36, 37, + 38, 39, 40, 41, 43, 44, 52, 45, + 46, 50, 47, 48, 49, 51, 53, 55, + 57, 91, 58, 61, 71, 59, 60, 62, + 78, 63, 76, 64, 65, 74, 66, 67, + 72, 68, 69, 70, 73, 75, 77, 79, + 87, 80, 83, 81, 82, 84, 85, 86, + 88, 89, 90 +}; + +static const char _tsip_machine_parser_header_Warning_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 9, 0, 0, 0, 0, 5, + 1, 1, 1, 1, 3, 0, 1, 1, + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 12, 12, 12, 0, 0, 0, + 0, 7, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0 +}; + +static const int tsip_machine_parser_header_Warning_start = 1; +static const int tsip_machine_parser_header_Warning_first_final = 92; +static const int tsip_machine_parser_header_Warning_error = 0; + +static const int tsip_machine_parser_header_Warning_en_main = 1; + + +/* #line 128 "./ragel/tsip_parser_header_Warning.rl" */ + (void)(eof); + (void)(tsip_machine_parser_header_Warning_first_final); + (void)(tsip_machine_parser_header_Warning_error); + (void)(tsip_machine_parser_header_Warning_en_main); + +/* #line 349 "./src/headers/tsip_header_Warning.c" */ + { + cs = tsip_machine_parser_header_Warning_start; + } + +/* #line 133 "./ragel/tsip_parser_header_Warning.rl" */ + +/* #line 356 "./src/headers/tsip_header_Warning.c" */ + { + int _klen; + unsigned int _trans; + const char *_acts; + unsigned int _nacts; + const char *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _keys = _tsip_machine_parser_header_Warning_trans_keys + _tsip_machine_parser_header_Warning_key_offsets[cs]; + _trans = _tsip_machine_parser_header_Warning_index_offsets[cs]; + + _klen = _tsip_machine_parser_header_Warning_single_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( (*p) < *_mid ) + _upper = _mid - 1; + else if ( (*p) > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tsip_machine_parser_header_Warning_range_lengths[cs]; + if ( _klen > 0 ) { + const char *_lower = _keys; + const char *_mid; + const char *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( (*p) < _mid[0] ) + _upper = _mid - 2; + else if ( (*p) > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tsip_machine_parser_header_Warning_indicies[_trans]; + cs = _tsip_machine_parser_header_Warning_trans_targs[_trans]; + + if ( _tsip_machine_parser_header_Warning_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tsip_machine_parser_header_Warning_actions + _tsip_machine_parser_header_Warning_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 51 "./ragel/tsip_parser_header_Warning.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 55 "./ragel/tsip_parser_header_Warning.rl" */ + { + if(!curr_warning){ + curr_warning = tsip_header_Warning_create(); + } + } + break; + case 2: +/* #line 61 "./ragel/tsip_parser_header_Warning.rl" */ + { + if(curr_warning){ + TSK_PARSER_SET_STRING(curr_warning->agent); + } + } + break; + case 3: +/* #line 67 "./ragel/tsip_parser_header_Warning.rl" */ + { + if(curr_warning){ + TSK_PARSER_SET_STRING(curr_warning->text); + } + } + break; + case 4: +/* #line 73 "./ragel/tsip_parser_header_Warning.rl" */ + { + if(curr_warning){ + TSK_PARSER_SET_INTEGER(curr_warning->code); + } + } + break; + case 5: +/* #line 79 "./ragel/tsip_parser_header_Warning.rl" */ + { + if(curr_warning){ + tsk_list_push_back_data(hdr_warnings, ((void**) &curr_warning)); + } + } + break; + case 6: +/* #line 85 "./ragel/tsip_parser_header_Warning.rl" */ + { + } + break; +/* #line 481 "./src/headers/tsip_header_Warning.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 134 "./ragel/tsip_parser_header_Warning.rl" */ + + if( cs < +/* #line 497 "./src/headers/tsip_header_Warning.c" */ +92 +/* #line 135 "./ragel/tsip_parser_header_Warning.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Warning' header."); + TSK_OBJECT_SAFE_FREE(curr_warning); + TSK_OBJECT_SAFE_FREE(hdr_warnings); + } + + return hdr_warnings; +} + + + + + +//======================================================== +// Warning header object definition +// + +static tsk_object_t* tsip_header_Warning_ctor(tsk_object_t *self, va_list * app) +{ + tsip_header_Warning_t *Warning = self; + if(Warning){ + TSIP_HEADER(Warning)->type = tsip_htype_Warning; + TSIP_HEADER(Warning)->serialize = tsip_header_Warning_serialize; + + Warning->code = -1; + } + else{ + TSK_DEBUG_ERROR("Failed to create new Warning header."); + } + return self; +} + +static tsk_object_t* tsip_header_Warning_dtor(tsk_object_t *self) +{ + tsip_header_Warning_t *Warning = self; + if(Warning){ + TSK_FREE(Warning->agent); + TSK_FREE(Warning->text); + + TSK_OBJECT_SAFE_FREE(TSIP_HEADER_PARAMS(Warning)); + } + else{ + TSK_DEBUG_ERROR("Null Warning header."); + } + + return self; +} + +static const tsk_object_def_t tsip_header_Warning_def_s = +{ + sizeof(tsip_header_Warning_t), + tsip_header_Warning_ctor, + tsip_header_Warning_dtor, + tsk_null +}; +const tsk_object_def_t *tsip_header_Warning_def_t = &tsip_header_Warning_def_s; diff --git a/tinySIP/src/headers/tsip_header_accept.c b/tinySIP/src/headers/tsip_header_accept.c new file mode 100644 index 0000000..6ddfcdf --- /dev/null +++ b/tinySIP/src/headers/tsip_header_accept.c @@ -0,0 +1,30 @@ +/* +* 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 tsip_header_accept.c + * @brief SIP header 'Accept'. + * + * @author Mamadou Diop <diopmamadou(at)doubango[dot]org> + * + + */ +#include "tinysip/headers/tsip_header_accept.h" |