diff options
author | Mamadou DIOP <bossiel@yahoo.fr> | 2015-08-17 01:56:35 +0200 |
---|---|---|
committer | Mamadou DIOP <bossiel@yahoo.fr> | 2015-08-17 01:56:35 +0200 |
commit | 631fffee8a28b1bec5ed1f1d26a20e0135967f99 (patch) | |
tree | 74afe3bf3efe15aa82bcd0272b2b0f4d48c2d837 /tinyMSRP/src | |
parent | 7908865936604036e6f200f1b5e069f8752f3a3a (diff) | |
download | doubango-631fffee8a28b1bec5ed1f1d26a20e0135967f99.zip doubango-631fffee8a28b1bec5ed1f1d26a20e0135967f99.tar.gz |
-
Diffstat (limited to 'tinyMSRP/src')
27 files changed, 11529 insertions, 0 deletions
diff --git a/tinyMSRP/src/headers/tmsrp_header.c b/tinyMSRP/src/headers/tmsrp_header.c new file mode 100644 index 0000000..b7aab62 --- /dev/null +++ b/tinyMSRP/src/headers/tmsrp_header.c @@ -0,0 +1,112 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tmsrp_header.c + * @brief Defines a MSRP header (hname ":" SP hval CRLF). + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#include "tinymsrp/headers/tmsrp_header.h" + +#include "tinymsrp/headers/tmsrp_header_Dummy.h" + +#include "tsk_string.h" + +/** Gets the name of the MSRP 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* tmsrp_header_get_name(tmsrp_header_type_t type) +{ + switch(type) + { + case tmsrp_htype_Authentication_Info: return "Authentication-Info"; + case tmsrp_htype_Authorization: return "Authorization"; + case tmsrp_htype_Byte_Range: return "Byte-Range"; + case tmsrp_htype_Content_Type: return "Content-Type"; + case tmsrp_htype_Expires: return "Expires"; + case tmsrp_htype_Failure_Report: return "Failure-Report"; + case tmsrp_htype_From_Path: return "From-Path"; + case tmsrp_htype_Max_Expires: return "Max-Expires"; + case tmsrp_htype_Message_ID: return "Message-ID"; + case tmsrp_htype_Min_Expires: return "Min-Expires"; + case tmsrp_htype_Status: return "Status"; + case tmsrp_htype_Success_Report: return "Success-Report"; + case tmsrp_htype_To_Path: return "To-Path"; + case tmsrp_htype_Use_Path: return "Use-Path"; + case tmsrp_htype_WWW_Authenticate: return "WWW-Authenticate"; + + default: return "unknown-header"; + } +} + +const char* tmsrp_header_get_nameex(const tmsrp_header_t *self) +{ + if(self){ + if(self->type == tmsrp_htype_Dummy){ + return ((tmsrp_header_Dummy_t*)(self))->name; + } + else{ + return tmsrp_header_get_name(self->type); + } + } + return "unknown-header"; +} + + +int tmsrp_header_serialize(const tmsrp_header_t *self, tsk_buffer_t *output) +{ + int ret = -1; + if(!self || !output){ + return -1; + } + + /* Name */ + tsk_buffer_append_2(output, "%s: ", tmsrp_header_get_nameex(self)); + + /* Value */ + if((ret = self->tostring(self, output))){ + // Abort? + } + + /* CRLF*/ + ret = tsk_buffer_append(output, "\r\n", 2); + + return ret; +} + +char* tmsrp_header_tostring(const tmsrp_header_t *self) +{ + char* ret = tsk_null; + tsk_buffer_t* buffer; + if(self && self->tostring){ + if((buffer = tsk_buffer_create_null())){ + self->tostring(self, buffer); + ret = tsk_strndup(buffer->data, buffer->size); + TSK_OBJECT_SAFE_FREE(buffer); + } + } + return ret; +}
\ No newline at end of file diff --git a/tinyMSRP/src/headers/tmsrp_header_Authentication-Info.c b/tinyMSRP/src/headers/tmsrp_header_Authentication-Info.c new file mode 100644 index 0000000..9007823 --- /dev/null +++ b/tinyMSRP/src/headers/tmsrp_header_Authentication-Info.c @@ -0,0 +1,2 @@ + +/* #line 1 "./ragel/tmsrp_parser_header_Authentication-Info.rl" */ diff --git a/tinyMSRP/src/headers/tmsrp_header_Authorization.c b/tinyMSRP/src/headers/tmsrp_header_Authorization.c new file mode 100644 index 0000000..0b61d02 --- /dev/null +++ b/tinyMSRP/src/headers/tmsrp_header_Authorization.c @@ -0,0 +1,181 @@ + +/* #line 1 "tmsrp_parser_header_Authorization.rl" */ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tmsrp_header_Authorization.c + * @brief MSRP Proxy-Authenticate header. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#include "tinymsrp/headers/tmsrp_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> + +tmsrp_header_Authorization_t* tmsrp_header_Authorization_create() +{ + return tsk_object_new(tmsrp_header_Authorization_def_t); +} + +int tmsrp_header_Authorization_tostring(const tmsrp_header_t* header, tsk_buffer_t* output) +{ + if(header) + { + const tmsrp_header_Authorization_t *Authorization = (const tmsrp_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; +} + +tmsrp_header_Authorization_t *tmsrp_header_Authorization_parse(const char *data, tsk_size_t size) +{ + tmsrp_header_Authorization_t *hdr_msrp = 0; + thttp_header_Authorization_t* hdr_http; + + if((hdr_http = thttp_header_Authorization_parse(data, size))) + { + hdr_msrp = tmsrp_header_Authorization_create(); + + hdr_msrp->scheme = tsk_strdup(hdr_http->scheme); + hdr_msrp->username = tsk_strdup(hdr_http->username); + hdr_msrp->realm = tsk_strdup(hdr_http->realm); + hdr_msrp->nonce = tsk_strdup(hdr_http->nonce); + hdr_msrp->uri = tsk_strdup(hdr_http->uri); + hdr_msrp->response = tsk_strdup(hdr_http->response); + hdr_msrp->algorithm = tsk_strdup(hdr_http->algorithm); + hdr_msrp->cnonce = tsk_strdup(hdr_http->cnonce); + hdr_msrp->opaque = tsk_strdup(hdr_http->opaque); + hdr_msrp->qop = tsk_strdup(hdr_http->qop); + hdr_msrp->nc = tsk_strdup(hdr_http->nc); + + hdr_msrp->params = tsk_object_ref(THTTP_HEADER(hdr_http)->params); + + TSK_OBJECT_SAFE_FREE(hdr_http); + } + + return hdr_msrp; +} + + + + + +//======================================================== +// Authorization header object definition +// + +static tsk_object_t* tmsrp_header_Authorization_ctor(tsk_object_t *self, va_list * app) +{ + tmsrp_header_Authorization_t *Authorization = self; + if(Authorization){ + TMSRP_HEADER(Authorization)->type = tmsrp_htype_Authorization; + TMSRP_HEADER(Authorization)->tostring = tmsrp_header_Authorization_tostring; + } + else{ + TSK_DEBUG_ERROR("Failed to create new Authorization header."); + } + return self; +} + +static tsk_object_t* tmsrp_header_Authorization_dtor(tsk_object_t *self) +{ + tmsrp_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(Authorization->params); + } + else{ + TSK_DEBUG_ERROR("Null Authorization header."); + } + + return self; +} + +static const tsk_object_def_t tmsrp_header_Authorization_def_s = +{ + sizeof(tmsrp_header_Authorization_t), + tmsrp_header_Authorization_ctor, + tmsrp_header_Authorization_dtor, + tsk_null +}; +const tsk_object_def_t *tmsrp_header_Authorization_def_t = &tmsrp_header_Authorization_def_s; diff --git a/tinyMSRP/src/headers/tmsrp_header_Byte-Range.c b/tinyMSRP/src/headers/tmsrp_header_Byte-Range.c new file mode 100644 index 0000000..301b576 --- /dev/null +++ b/tinyMSRP/src/headers/tmsrp_header_Byte-Range.c @@ -0,0 +1,384 @@ + +/* #line 1 "./ragel/tmsrp_parser_header_Byte-Range.rl" */ +/* +* Copyright (C) 2009-2015 Mamadou DIOP. +* +* 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 tmsrp_header_Byte_Range.c + * @brief MSRP 'Byte-Range' header. + */ +#include "tinymsrp/headers/tmsrp_header_Byte-Range.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_string.h" + +#include <string.h> + +/*********************************** +* Ragel state machine. +*/ + +/* #line 76 "./ragel/tmsrp_parser_header_Byte-Range.rl" */ + + +tmsrp_header_Byte_Range_t* tmsrp_header_Byte_Range_create(int64_t start, int64_t end, int64_t total) +{ + return tsk_object_new(TMSRP_HEADER_BYTE_RANGE_VA_ARGS(start, end, total)); +} + +tmsrp_header_Byte_Range_t* tmsrp_header_Byte_Range_create_null() +{ + return tmsrp_header_Byte_Range_create(1, -1, -1); +} + +int tmsrp_header_Byte_Range_tostring(const tmsrp_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tmsrp_header_Byte_Range_t *Byte_Range = (const tmsrp_header_Byte_Range_t *)header; + tsk_istr_t start, end, total; + + if(Byte_Range->start>=0){ + tsk_itoa(Byte_Range->start, &start); + } + if(Byte_Range->end>=0){ + tsk_itoa(Byte_Range->end, &end); + } + if(Byte_Range->total>=0){ + tsk_itoa(Byte_Range->total, &total); + } + + return tsk_buffer_append_2(output, "%s-%s/%s", + Byte_Range->start>=0 ? start : "*", + Byte_Range->end>=0 ? end : "*", + Byte_Range->total>=0 ? total : "*" + ); + } + + return -1; +} + +tmsrp_header_Byte_Range_t *tmsrp_header_Byte_Range_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tmsrp_header_Byte_Range_t *hdr_Byte_Range = tmsrp_header_Byte_Range_create_null(); + + const char *tag_start = tsk_null; + + TSK_RAGEL_DISABLE_WARNINGS_BEGIN() + +/* #line 90 "./src/headers/tmsrp_header_Byte-Range.c" */ +static const char _tmsrp_machine_parser_header_Byte_Range_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3 +}; + +static const char _tmsrp_machine_parser_header_Byte_Range_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 9, 11, + 13, 15, 17, 19, 20, 21, 23, 26, + 29, 30, 33, 34, 37, 38, 38 +}; + +static const char _tmsrp_machine_parser_header_Byte_Range_trans_keys[] = { + 66, 98, 89, 121, 84, 116, 69, 101, + 45, 82, 114, 65, 97, 78, 110, 71, + 103, 69, 101, 58, 32, 48, 57, 45, + 48, 57, 42, 48, 57, 47, 42, 48, + 57, 10, 47, 48, 57, 13, 13, 48, + 57, 0 +}; + +static const char _tmsrp_machine_parser_header_Byte_Range_single_lengths[] = { + 0, 2, 2, 2, 2, 1, 2, 2, + 2, 2, 2, 1, 1, 0, 1, 1, + 1, 1, 1, 1, 1, 0, 1 +}; + +static const char _tmsrp_machine_parser_header_Byte_Range_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 1, 1, + 0, 1, 0, 1, 0, 0, 1 +}; + +static const char _tmsrp_machine_parser_header_Byte_Range_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 14, 17, + 20, 23, 26, 29, 31, 33, 35, 38, + 41, 43, 46, 48, 51, 53, 54 +}; + +static const char _tmsrp_machine_parser_header_Byte_Range_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, 11, 1, 12, + 1, 13, 1, 14, 15, 1, 16, 17, + 1, 18, 1, 19, 20, 1, 21, 1, + 18, 22, 1, 23, 1, 1, 23, 24, + 1, 0 +}; + +static const char _tmsrp_machine_parser_header_Byte_Range_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 14, + 16, 19, 17, 20, 22, 21, 19, 18, + 22 +}; + +static const char _tmsrp_machine_parser_header_Byte_Range_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 3, 0, + 1, 1, 5, 1, 1, 0, 0, 7, + 0 +}; + +static const char _tmsrp_machine_parser_header_Byte_Range_eof_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7, 0, 7 +}; + +static const int tmsrp_machine_parser_header_Byte_Range_start = 1; +static const int tmsrp_machine_parser_header_Byte_Range_first_final = 20; +static const int tmsrp_machine_parser_header_Byte_Range_error = 0; + +static const int tmsrp_machine_parser_header_Byte_Range_en_main = 1; + + +/* #line 126 "./ragel/tmsrp_parser_header_Byte-Range.rl" */ + (void)(eof); + (void)(tmsrp_machine_parser_header_Byte_Range_first_final); + (void)(tmsrp_machine_parser_header_Byte_Range_error); + (void)(tmsrp_machine_parser_header_Byte_Range_en_main); + +/* #line 173 "./src/headers/tmsrp_header_Byte-Range.c" */ + { + cs = tmsrp_machine_parser_header_Byte_Range_start; + } + +/* #line 131 "./ragel/tmsrp_parser_header_Byte-Range.rl" */ + +/* #line 180 "./src/headers/tmsrp_header_Byte-Range.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 = _tmsrp_machine_parser_header_Byte_Range_trans_keys + _tmsrp_machine_parser_header_Byte_Range_key_offsets[cs]; + _trans = _tmsrp_machine_parser_header_Byte_Range_index_offsets[cs]; + + _klen = _tmsrp_machine_parser_header_Byte_Range_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 = _tmsrp_machine_parser_header_Byte_Range_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 = _tmsrp_machine_parser_header_Byte_Range_indicies[_trans]; + cs = _tmsrp_machine_parser_header_Byte_Range_trans_targs[_trans]; + + if ( _tmsrp_machine_parser_header_Byte_Range_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tmsrp_machine_parser_header_Byte_Range_actions + _tmsrp_machine_parser_header_Byte_Range_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 41 "./ragel/tmsrp_parser_header_Byte-Range.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 45 "./ragel/tmsrp_parser_header_Byte-Range.rl" */ + { + TSK_PARSER_SET_INTEGER_EX(hdr_Byte_Range->start, int64_t, atoi64); + } + break; + case 2: +/* #line 49 "./ragel/tmsrp_parser_header_Byte-Range.rl" */ + { + if(tag_start && *tag_start == '*'){ + hdr_Byte_Range->end = -1; + } + else{ + TSK_PARSER_SET_INTEGER_EX(hdr_Byte_Range->end, int64_t, atoi64); + } + } + break; + case 3: +/* #line 58 "./ragel/tmsrp_parser_header_Byte-Range.rl" */ + { + if(tag_start && *tag_start == '*'){ + hdr_Byte_Range->total = -1; + } + else{ + TSK_PARSER_SET_INTEGER_EX(hdr_Byte_Range->total, int64_t, atoi64); + } + } + break; +/* #line 288 "./src/headers/tmsrp_header_Byte-Range.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + if ( p == eof ) + { + const char *__acts = _tmsrp_machine_parser_header_Byte_Range_actions + _tmsrp_machine_parser_header_Byte_Range_eof_actions[cs]; + unsigned int __nacts = (unsigned int) *__acts++; + while ( __nacts-- > 0 ) { + switch ( *__acts++ ) { + case 3: +/* #line 58 "./ragel/tmsrp_parser_header_Byte-Range.rl" */ + { + if(tag_start && *tag_start == '*'){ + hdr_Byte_Range->total = -1; + } + else{ + TSK_PARSER_SET_INTEGER_EX(hdr_Byte_Range->total, int64_t, atoi64); + } + } + break; +/* #line 315 "./src/headers/tmsrp_header_Byte-Range.c" */ + } + } + } + + _out: {} + } + +/* #line 132 "./ragel/tmsrp_parser_header_Byte-Range.rl" */ + TSK_RAGEL_DISABLE_WARNINGS_END() + + if( cs < +/* #line 327 "./src/headers/tmsrp_header_Byte-Range.c" */ +20 +/* #line 134 "./ragel/tmsrp_parser_header_Byte-Range.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Byte-Range' header."); + TSK_OBJECT_SAFE_FREE(hdr_Byte_Range); + } + + return hdr_Byte_Range; +} + + + + + + + +//======================================================== +// Byte_Range header object definition +// + +static tsk_object_t* tmsrp_header_Byte_Range_ctor(tsk_object_t *self, va_list * app) +{ + tmsrp_header_Byte_Range_t *Byte_Range = self; + if(Byte_Range){ + TMSRP_HEADER(Byte_Range)->type = tmsrp_htype_Byte_Range; + TMSRP_HEADER(Byte_Range)->tostring = tmsrp_header_Byte_Range_tostring; + + Byte_Range->start = va_arg(*app, int64_t); + Byte_Range->end = va_arg(*app, int64_t); + Byte_Range->total = va_arg(*app, int64_t); + } + else{ + TSK_DEBUG_ERROR("Failed to create new Byte-Range header."); + } + return self; +} + +static tsk_object_t* tmsrp_header_Byte_Range_dtor(tsk_object_t *self) +{ + tmsrp_header_Byte_Range_t *Byte_Range = self; + if(Byte_Range){ + } + else{ + TSK_DEBUG_ERROR("Null Byte-Range header."); + } + + return self; +} + +static const tsk_object_def_t tmsrp_header_Byte_Range_def_s = +{ + sizeof(tmsrp_header_Byte_Range_t), + tmsrp_header_Byte_Range_ctor, + tmsrp_header_Byte_Range_dtor, + tsk_null +}; + +const tsk_object_def_t *tmsrp_header_Byte_Range_def_t = &tmsrp_header_Byte_Range_def_s; diff --git a/tinyMSRP/src/headers/tmsrp_header_Content-Type.c b/tinyMSRP/src/headers/tmsrp_header_Content-Type.c new file mode 100644 index 0000000..7ec0dd2 --- /dev/null +++ b/tinyMSRP/src/headers/tmsrp_header_Content-Type.c @@ -0,0 +1,454 @@ + +/* #line 1 "./ragel/tmsrp_parser_header_Content-Type.rl" */ +/* +* Copyright (C) 2009-2015 Mamadou DIOP. +* +* 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 tmsrp_header_Content_Type.c + * @brief MSRP Content-Type header. + */ +#include "tinymsrp/headers/tmsrp_header_Content-Type.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_string.h" + +#include <string.h> + +/**@defgroup tmsrp_header_Content_Type_group MSRP Content_Type header. +*/ + +/*********************************** +* Ragel state machine. +*/ + +/* #line 68 "./ragel/tmsrp_parser_header_Content-Type.rl" */ + + + +tmsrp_header_Content_Type_t* tmsrp_header_Content_Type_create(const char* type) +{ + return tsk_object_new(TMSRP_HEADER_CONTENT_TYPE_VA_ARGS(type)); +} + +tmsrp_header_Content_Type_t* tmsrp_header_Content_Type_create_null() +{ + return tmsrp_header_Content_Type_create(tsk_null); +} + +int tmsrp_header_Content_Type_tostring(const tmsrp_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tmsrp_header_Content_Type_t *Content_Type = (const tmsrp_header_Content_Type_t *)header; + const tsk_list_item_t *item; + + if(Content_Type->value){ + tsk_buffer_append(output, Content_Type->value, strlen(Content_Type->value)); + } + // Params + tsk_list_foreach(item, Content_Type->params){ + tsk_buffer_append(output, ";", 1); + tsk_params_tostring(Content_Type->params, ';', output); + } + } + + return -1; +} + +tmsrp_header_Content_Type_t *tmsrp_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; + tmsrp_header_Content_Type_t *hdr_ctype = tmsrp_header_Content_Type_create_null(); + + const char *tag_start = tsk_null; + + TSK_RAGEL_DISABLE_WARNINGS_BEGIN() + +/* #line 87 "./src/headers/tmsrp_header_Content-Type.c" */ +static const char _tmsrp_machine_parser_header_Content_Type_actions[] = { + 0, 1, 0, 1, 1, 1, 2 +}; + +static const short _tmsrp_machine_parser_header_Content_Type_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 12, + 14, 15, 17, 19, 21, 23, 26, 43, + 44, 46, 62, 78, 82, 83, 85, 88, + 105, 106, 108, 124, 128, 129, 131, 134, + 150, 151, 153, 168, 173, 174, 176, 180, + 196, 197, 199, 214, 215, 221, 227, 233, + 239, 257, 275, 292 +}; + +static const char _tmsrp_machine_parser_header_Content_Type_trans_keys[] = { + 67, 99, 79, 111, 78, 110, 84, 116, + 69, 101, 78, 110, 84, 116, 45, 84, + 116, 89, 121, 80, 112, 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, 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, 59, + 10, 9, 32, 9, 32, 59, 9, 13, + 32, 33, 37, 93, 95, 126, 36, 43, + 45, 58, 65, 91, 97, 122, 10, 9, + 32, 9, 32, 33, 37, 93, 95, 126, + 36, 43, 45, 58, 65, 91, 97, 122, + 9, 13, 32, 59, 61, 10, 9, 32, + 9, 32, 59, 61, 9, 13, 32, 33, + 37, 93, 95, 126, 36, 43, 45, 58, + 65, 91, 97, 122, 10, 9, 32, 9, + 32, 33, 37, 93, 95, 126, 36, 43, + 45, 58, 65, 91, 97, 122, 10, 48, + 57, 65, 70, 97, 102, 48, 57, 65, + 70, 97, 102, 48, 57, 65, 70, 97, + 102, 48, 57, 65, 70, 97, 102, 9, + 13, 32, 33, 37, 39, 59, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 9, 13, 32, 33, 37, 59, 61, + 93, 95, 126, 36, 43, 45, 58, 65, + 91, 97, 122, 9, 13, 32, 33, 37, + 59, 93, 95, 126, 36, 43, 45, 58, + 65, 91, 97, 122, 0 +}; + +static const char _tmsrp_machine_parser_header_Content_Type_single_lengths[] = { + 0, 2, 2, 2, 2, 2, 2, 2, + 1, 2, 2, 2, 2, 3, 7, 1, + 2, 6, 8, 4, 1, 2, 3, 7, + 1, 2, 6, 4, 1, 2, 3, 8, + 1, 2, 7, 5, 1, 2, 4, 8, + 1, 2, 7, 1, 0, 0, 0, 0, + 8, 10, 9, 0 +}; + +static const char _tmsrp_machine_parser_header_Content_Type_range_lengths[] = { + 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, 0, 0, 0, 0, 4, + 0, 0, 4, 0, 0, 0, 0, 4, + 0, 0, 4, 0, 3, 3, 3, 3, + 5, 4, 4, 0 +}; + +static const short _tmsrp_machine_parser_header_Content_Type_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 15, 18, + 21, 23, 26, 29, 32, 35, 39, 52, + 54, 57, 69, 82, 87, 89, 92, 96, + 109, 111, 114, 126, 131, 133, 136, 140, + 153, 155, 158, 170, 176, 178, 181, 186, + 199, 201, 204, 216, 218, 222, 226, 230, + 234, 248, 263, 277 +}; + +static const char _tmsrp_machine_parser_header_Content_Type_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 5, 5, 1, 6, + 6, 1, 7, 7, 1, 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, 18, + 20, 20, 20, 21, 20, 20, 20, 20, + 20, 1, 18, 19, 18, 21, 1, 22, + 1, 23, 23, 1, 23, 23, 21, 1, + 21, 24, 21, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 1, 26, 1, 27, + 27, 1, 27, 27, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 1, 28, 29, + 28, 30, 1, 31, 1, 32, 32, 1, + 32, 32, 30, 1, 30, 33, 30, 34, + 35, 34, 34, 34, 34, 34, 34, 34, + 1, 36, 1, 37, 37, 1, 37, 37, + 34, 35, 34, 34, 34, 34, 34, 34, + 34, 1, 38, 39, 38, 30, 40, 1, + 41, 1, 42, 42, 1, 42, 42, 30, + 40, 1, 40, 43, 40, 44, 45, 44, + 44, 44, 44, 44, 44, 44, 1, 46, + 1, 47, 47, 1, 47, 47, 44, 45, + 44, 44, 44, 44, 44, 44, 44, 1, + 48, 1, 49, 49, 49, 1, 44, 44, + 44, 1, 50, 50, 50, 1, 51, 51, + 51, 1, 52, 53, 52, 25, 25, 25, + 54, 25, 25, 25, 25, 25, 25, 1, + 55, 56, 55, 51, 57, 58, 40, 51, + 51, 51, 51, 51, 51, 51, 1, 59, + 56, 59, 44, 45, 58, 44, 44, 44, + 44, 44, 44, 44, 1, 1, 0 +}; + +static const char _tmsrp_machine_parser_header_Content_Type_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 18, + 16, 17, 19, 20, 18, 23, 21, 22, + 24, 48, 25, 26, 27, 28, 31, 29, + 30, 32, 49, 46, 33, 34, 35, 36, + 39, 37, 38, 40, 50, 44, 41, 42, + 51, 45, 47, 49, 27, 43, 31, 35, + 43, 46, 31, 27 +}; + +static const char _tmsrp_machine_parser_header_Content_Type_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 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, 1, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 3, 3, 5, + 5, 0, 5, 5 +}; + +static const char _tmsrp_machine_parser_header_Content_Type_eof_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, + 3, 5, 5, 0 +}; + +static const int tmsrp_machine_parser_header_Content_Type_start = 1; +static const int tmsrp_machine_parser_header_Content_Type_first_final = 48; +static const int tmsrp_machine_parser_header_Content_Type_error = 0; + +static const int tmsrp_machine_parser_header_Content_Type_en_main = 1; + + +/* #line 112 "./ragel/tmsrp_parser_header_Content-Type.rl" */ + (void)(eof); + (void)(tmsrp_machine_parser_header_Content_Type_first_final); + (void)(tmsrp_machine_parser_header_Content_Type_error); + (void)(tmsrp_machine_parser_header_Content_Type_en_main); + +/* #line 255 "./src/headers/tmsrp_header_Content-Type.c" */ + { + cs = tmsrp_machine_parser_header_Content_Type_start; + } + +/* #line 117 "./ragel/tmsrp_parser_header_Content-Type.rl" */ + +/* #line 262 "./src/headers/tmsrp_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 = _tmsrp_machine_parser_header_Content_Type_trans_keys + _tmsrp_machine_parser_header_Content_Type_key_offsets[cs]; + _trans = _tmsrp_machine_parser_header_Content_Type_index_offsets[cs]; + + _klen = _tmsrp_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 = _tmsrp_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 = _tmsrp_machine_parser_header_Content_Type_indicies[_trans]; + cs = _tmsrp_machine_parser_header_Content_Type_trans_targs[_trans]; + + if ( _tmsrp_machine_parser_header_Content_Type_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tmsrp_machine_parser_header_Content_Type_actions + _tmsrp_machine_parser_header_Content_Type_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 44 "./ragel/tmsrp_parser_header_Content-Type.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 48 "./ragel/tmsrp_parser_header_Content-Type.rl" */ + { + TSK_PARSER_SET_STRING(hdr_ctype->value); + } + break; + case 2: +/* #line 52 "./ragel/tmsrp_parser_header_Content-Type.rl" */ + { + TSK_PARSER_ADD_PARAM(hdr_ctype->params); + } + break; +/* #line 354 "./src/headers/tmsrp_header_Content-Type.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + if ( p == eof ) + { + const char *__acts = _tmsrp_machine_parser_header_Content_Type_actions + _tmsrp_machine_parser_header_Content_Type_eof_actions[cs]; + unsigned int __nacts = (unsigned int) *__acts++; + while ( __nacts-- > 0 ) { + switch ( *__acts++ ) { + case 1: +/* #line 48 "./ragel/tmsrp_parser_header_Content-Type.rl" */ + { + TSK_PARSER_SET_STRING(hdr_ctype->value); + } + break; + case 2: +/* #line 52 "./ragel/tmsrp_parser_header_Content-Type.rl" */ + { + TSK_PARSER_ADD_PARAM(hdr_ctype->params); + } + break; +/* #line 382 "./src/headers/tmsrp_header_Content-Type.c" */ + } + } + } + + _out: {} + } + +/* #line 118 "./ragel/tmsrp_parser_header_Content-Type.rl" */ + TSK_RAGEL_DISABLE_WARNINGS_END() + + if( cs < +/* #line 394 "./src/headers/tmsrp_header_Content-Type.c" */ +48 +/* #line 120 "./ragel/tmsrp_parser_header_Content-Type.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Content-Type' header."); + TSK_OBJECT_SAFE_FREE(hdr_ctype); + } + + return hdr_ctype; +} + + + + + + + +//======================================================== +// Content_Type header object definition +// + +/**@ingroup tmsrp_header_Content_Type_group +*/ +static tsk_object_t* tmsrp_header_Content_Type_ctor(tsk_object_t *self, va_list * app) +{ + tmsrp_header_Content_Type_t *Content_Type = self; + if(Content_Type){ + TMSRP_HEADER(Content_Type)->type = tmsrp_htype_Content_Type; + TMSRP_HEADER(Content_Type)->tostring = tmsrp_header_Content_Type_tostring; + + Content_Type->value = tsk_strdup( va_arg(*app, const char*) ); + } + else{ + TSK_DEBUG_ERROR("Failed to create new Content_Type header."); + } + return self; +} + +/**@ingroup tmsrp_header_Content_Type_group +*/ +static tsk_object_t* tmsrp_header_Content_Type_dtor(tsk_object_t *self) +{ + tmsrp_header_Content_Type_t *Content_Type = self; + if(Content_Type){ + TSK_FREE(Content_Type->value); + TSK_OBJECT_SAFE_FREE(Content_Type->params); + } + else{ + TSK_DEBUG_ERROR("Null Content-Type header."); + } + + return self; +} + +static const tsk_object_def_t tmsrp_header_Content_Type_def_s = +{ + sizeof(tmsrp_header_Content_Type_t), + tmsrp_header_Content_Type_ctor, + tmsrp_header_Content_Type_dtor, + tsk_null +}; +const tsk_object_def_t *tmsrp_header_Content_Type_def_t = &tmsrp_header_Content_Type_def_s;
\ No newline at end of file diff --git a/tinyMSRP/src/headers/tmsrp_header_Dummy.c b/tinyMSRP/src/headers/tmsrp_header_Dummy.c new file mode 100644 index 0000000..09cfbe2 --- /dev/null +++ b/tinyMSRP/src/headers/tmsrp_header_Dummy.c @@ -0,0 +1,341 @@ + +/* #line 1 "./ragel/tmsrp_parser_header_Dummy.rl" */ +/* +* Copyright (C) 2009-2015 Mamadou DIOP. +* +* 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 tmsrp_header_Dummy.c + * @brief MSRP Dummy header. + */ +#include "tinymsrp/headers/tmsrp_header_Dummy.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_string.h" + +#include <string.h> + +/*********************************** +* Ragel state machine. +*/ + +/* #line 59 "./ragel/tmsrp_parser_header_Dummy.rl" */ + + + +tmsrp_header_Dummy_t* tmsrp_header_Dummy_create(const char* name, const char* value) +{ + return tsk_object_new(TMSRP_HEADER_DUMMY_VA_ARGS(name, value)); +} + +tmsrp_header_Dummy_t* tmsrp_header_Dummy_create_null() +{ + return tmsrp_header_Dummy_create(tsk_null, tsk_null); +} + +int tmsrp_header_Dummy_tostring(const tmsrp_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tmsrp_header_Dummy_t *Dummy = (const tmsrp_header_Dummy_t *)header; + if(Dummy->value){ + return tsk_buffer_append(output, Dummy->value, strlen(Dummy->value)); + } + return 0; + } + + return -1; +} + +tmsrp_header_Dummy_t *tmsrp_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; + tmsrp_header_Dummy_t *hdr_Dummy = tmsrp_header_Dummy_create_null(); + + const char *tag_start = tsk_null; + + TSK_RAGEL_DISABLE_WARNINGS_BEGIN() + +/* #line 78 "./src/headers/tmsrp_header_Dummy.c" */ +static const char _tmsrp_machine_parser_header_Dummy_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 2, + 0, 2 +}; + +static const char _tmsrp_machine_parser_header_Dummy_key_offsets[] = { + 0, 0, 14, 30, 32, 33, 40, 46 +}; + +static const char _tmsrp_machine_parser_header_Dummy_trans_keys[] = { + 33, 37, 39, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 32, 33, + 37, 39, 58, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 32, 58, + 10, 13, 32, 127, 0, 8, 10, 31, + 13, 127, 0, 8, 10, 31, 0 +}; + +static const char _tmsrp_machine_parser_header_Dummy_single_lengths[] = { + 0, 4, 6, 2, 1, 3, 2, 0 +}; + +static const char _tmsrp_machine_parser_header_Dummy_range_lengths[] = { + 0, 5, 5, 0, 0, 2, 2, 0 +}; + +static const char _tmsrp_machine_parser_header_Dummy_index_offsets[] = { + 0, 0, 10, 22, 25, 27, 33, 38 +}; + +static const char _tmsrp_machine_parser_header_Dummy_indicies[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 2, 3, 3, 3, 4, 3, + 3, 3, 3, 3, 3, 1, 5, 6, + 1, 7, 1, 9, 6, 1, 1, 1, + 8, 11, 1, 1, 1, 10, 1, 0 +}; + +static const char _tmsrp_machine_parser_header_Dummy_trans_targs[] = { + 2, 0, 3, 2, 5, 3, 5, 7, + 6, 4, 6, 4 +}; + +static const char _tmsrp_machine_parser_header_Dummy_trans_actions[] = { + 1, 0, 3, 0, 3, 0, 0, 0, + 1, 7, 0, 5 +}; + +static const char _tmsrp_machine_parser_header_Dummy_eof_actions[] = { + 0, 0, 0, 0, 0, 7, 5, 0 +}; + +static const int tmsrp_machine_parser_header_Dummy_start = 1; +static const int tmsrp_machine_parser_header_Dummy_first_final = 5; +static const int tmsrp_machine_parser_header_Dummy_error = 0; + +static const int tmsrp_machine_parser_header_Dummy_en_main = 1; + + +/* #line 97 "./ragel/tmsrp_parser_header_Dummy.rl" */ + (void)(eof); + (void)(tmsrp_machine_parser_header_Dummy_first_final); + (void)(tmsrp_machine_parser_header_Dummy_error); + (void)(tmsrp_machine_parser_header_Dummy_en_main); + +/* #line 144 "./src/headers/tmsrp_header_Dummy.c" */ + { + cs = tmsrp_machine_parser_header_Dummy_start; + } + +/* #line 102 "./ragel/tmsrp_parser_header_Dummy.rl" */ + +/* #line 151 "./src/headers/tmsrp_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 = _tmsrp_machine_parser_header_Dummy_trans_keys + _tmsrp_machine_parser_header_Dummy_key_offsets[cs]; + _trans = _tmsrp_machine_parser_header_Dummy_index_offsets[cs]; + + _klen = _tmsrp_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 = _tmsrp_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 = _tmsrp_machine_parser_header_Dummy_indicies[_trans]; + cs = _tmsrp_machine_parser_header_Dummy_trans_targs[_trans]; + + if ( _tmsrp_machine_parser_header_Dummy_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tmsrp_machine_parser_header_Dummy_actions + _tmsrp_machine_parser_header_Dummy_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 41 "./ragel/tmsrp_parser_header_Dummy.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 45 "./ragel/tmsrp_parser_header_Dummy.rl" */ + { + TSK_PARSER_SET_STRING(hdr_Dummy->name); + } + break; + case 2: +/* #line 49 "./ragel/tmsrp_parser_header_Dummy.rl" */ + { + TSK_PARSER_SET_STRING(hdr_Dummy->value); + } + break; +/* #line 243 "./src/headers/tmsrp_header_Dummy.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + if ( p == eof ) + { + const char *__acts = _tmsrp_machine_parser_header_Dummy_actions + _tmsrp_machine_parser_header_Dummy_eof_actions[cs]; + unsigned int __nacts = (unsigned int) *__acts++; + while ( __nacts-- > 0 ) { + switch ( *__acts++ ) { + case 0: +/* #line 41 "./ragel/tmsrp_parser_header_Dummy.rl" */ + { + tag_start = p; + } + break; + case 2: +/* #line 49 "./ragel/tmsrp_parser_header_Dummy.rl" */ + { + TSK_PARSER_SET_STRING(hdr_Dummy->value); + } + break; +/* #line 271 "./src/headers/tmsrp_header_Dummy.c" */ + } + } + } + + _out: {} + } + +/* #line 103 "./ragel/tmsrp_parser_header_Dummy.rl" */ + TSK_RAGEL_DISABLE_WARNINGS_END() + + if( cs < +/* #line 283 "./src/headers/tmsrp_header_Dummy.c" */ +5 +/* #line 105 "./ragel/tmsrp_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* tmsrp_header_Dummy_ctor(tsk_object_t *self, va_list * app) +{ + tmsrp_header_Dummy_t *Dummy = self; + if(Dummy){ + TMSRP_HEADER(Dummy)->type = tmsrp_htype_Dummy; + TMSRP_HEADER(Dummy)->tostring = tmsrp_header_Dummy_tostring; + + 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* tmsrp_header_Dummy_dtor(tsk_object_t *self) +{ + tmsrp_header_Dummy_t *Dummy = self; + if(Dummy){ + TSK_FREE(Dummy->name); + TSK_FREE(Dummy->value); + } + else{ + TSK_DEBUG_ERROR("Null Dummy header."); + } + + return self; +} + +static const tsk_object_def_t tmsrp_header_Dummy_def_s = +{ + sizeof(tmsrp_header_Dummy_t), + tmsrp_header_Dummy_ctor, + tmsrp_header_Dummy_dtor, + tsk_null +}; + +const tsk_object_def_t *tmsrp_header_Dummy_def_t = &tmsrp_header_Dummy_def_s; diff --git a/tinyMSRP/src/headers/tmsrp_header_Expires.c b/tinyMSRP/src/headers/tmsrp_header_Expires.c new file mode 100644 index 0000000..7d5c299 --- /dev/null +++ b/tinyMSRP/src/headers/tmsrp_header_Expires.c @@ -0,0 +1,327 @@ + +/* #line 1 "./ragel/tmsrp_parser_header_Expires.rl" */ +/* +* Copyright (C) 2009-2015 Mamadou DIOP. +* +* 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 tmsrp_header_Expires.c + * @brief MSRP 'Expires' header. + */ +#include "tinymsrp/headers/tmsrp_header_Expires.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_string.h" + +#include <string.h> + +/*********************************** +* Ragel state machine. +*/ + +/* #line 55 "./ragel/tmsrp_parser_header_Expires.rl" */ + + + +tmsrp_header_Expires_t* tmsrp_header_Expires_create(int64_t value) +{ + return tsk_object_new(TMSRP_HEADER_EXPIRES_VA_ARGS(value)); +} + +tmsrp_header_Expires_t* tmsrp_header_Expires_create_null() +{ + return tmsrp_header_Expires_create(-1); +} + +int tmsrp_header_Expires_tostring(const tmsrp_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tmsrp_header_Expires_t *Expires = (const tmsrp_header_Expires_t *)header; + if(Expires->value>=0){ + return tsk_buffer_append_2(output, "%lld", Expires->value); + } + return 0; + } + + return -1; +} + +tmsrp_header_Expires_t *tmsrp_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; + tmsrp_header_Expires_t *hdr_Expires = tmsrp_header_Expires_create_null(); + + const char *tag_start = tsk_null; + + TSK_RAGEL_DISABLE_WARNINGS_BEGIN() + +/* #line 78 "./src/headers/tmsrp_header_Expires.c" */ +static const char _tmsrp_machine_parser_header_Expires_actions[] = { + 0, 1, 0, 1, 1 +}; + +static const char _tmsrp_machine_parser_header_Expires_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 12, + 14, 15, 16, 18, 19, 22 +}; + +static const char _tmsrp_machine_parser_header_Expires_trans_keys[] = { + 69, 101, 88, 120, 80, 112, 73, 105, + 82, 114, 69, 101, 83, 115, 58, 32, + 48, 57, 10, 13, 48, 57, 0 +}; + +static const char _tmsrp_machine_parser_header_Expires_single_lengths[] = { + 0, 2, 2, 2, 2, 2, 2, 2, + 1, 1, 0, 1, 1, 0 +}; + +static const char _tmsrp_machine_parser_header_Expires_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 1, 0 +}; + +static const char _tmsrp_machine_parser_header_Expires_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 15, 18, + 21, 23, 25, 27, 29, 32 +}; + +static const char _tmsrp_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, 8, 1, 9, + 1, 10, 1, 11, 1, 12, 13, 1, + 1, 0 +}; + +static const char _tmsrp_machine_parser_header_Expires_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 12, 13, 11, 12 +}; + +static const char _tmsrp_machine_parser_header_Expires_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 3, 0 +}; + +static const char _tmsrp_machine_parser_header_Expires_eof_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0 +}; + +static const int tmsrp_machine_parser_header_Expires_start = 1; +static const int tmsrp_machine_parser_header_Expires_first_final = 12; +static const int tmsrp_machine_parser_header_Expires_error = 0; + +static const int tmsrp_machine_parser_header_Expires_en_main = 1; + + +/* #line 93 "./ragel/tmsrp_parser_header_Expires.rl" */ + (void)(eof); + (void)(tmsrp_machine_parser_header_Expires_first_final); + (void)(tmsrp_machine_parser_header_Expires_error); + (void)(tmsrp_machine_parser_header_Expires_en_main); + +/* #line 145 "./src/headers/tmsrp_header_Expires.c" */ + { + cs = tmsrp_machine_parser_header_Expires_start; + } + +/* #line 98 "./ragel/tmsrp_parser_header_Expires.rl" */ + +/* #line 152 "./src/headers/tmsrp_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 = _tmsrp_machine_parser_header_Expires_trans_keys + _tmsrp_machine_parser_header_Expires_key_offsets[cs]; + _trans = _tmsrp_machine_parser_header_Expires_index_offsets[cs]; + + _klen = _tmsrp_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 = _tmsrp_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 = _tmsrp_machine_parser_header_Expires_indicies[_trans]; + cs = _tmsrp_machine_parser_header_Expires_trans_targs[_trans]; + + if ( _tmsrp_machine_parser_header_Expires_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tmsrp_machine_parser_header_Expires_actions + _tmsrp_machine_parser_header_Expires_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 41 "./ragel/tmsrp_parser_header_Expires.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 45 "./ragel/tmsrp_parser_header_Expires.rl" */ + { + TSK_PARSER_SET_INTEGER_EX(hdr_Expires->value, int64_t, atoi64) + } + break; +/* #line 238 "./src/headers/tmsrp_header_Expires.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + if ( p == eof ) + { + const char *__acts = _tmsrp_machine_parser_header_Expires_actions + _tmsrp_machine_parser_header_Expires_eof_actions[cs]; + unsigned int __nacts = (unsigned int) *__acts++; + while ( __nacts-- > 0 ) { + switch ( *__acts++ ) { + case 1: +/* #line 45 "./ragel/tmsrp_parser_header_Expires.rl" */ + { + TSK_PARSER_SET_INTEGER_EX(hdr_Expires->value, int64_t, atoi64) + } + break; +/* #line 260 "./src/headers/tmsrp_header_Expires.c" */ + } + } + } + + _out: {} + } + +/* #line 99 "./ragel/tmsrp_parser_header_Expires.rl" */ + TSK_RAGEL_DISABLE_WARNINGS_END() + + if( cs < +/* #line 272 "./src/headers/tmsrp_header_Expires.c" */ +12 +/* #line 101 "./ragel/tmsrp_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* tmsrp_header_Expires_ctor(tsk_object_t *self, va_list * app) +{ + tmsrp_header_Expires_t *Expires = self; + if(Expires){ + TMSRP_HEADER(Expires)->type = tmsrp_htype_Message_ID; + TMSRP_HEADER(Expires)->tostring = tmsrp_header_Expires_tostring; + + Expires->value = va_arg(*app, int64_t); + } + else{ + TSK_DEBUG_ERROR("Failed to create new Expires header."); + } + return self; +} + +static tsk_object_t* tmsrp_header_Expires_dtor(tsk_object_t *self) +{ + tmsrp_header_Expires_t *Expires = self; + if(Expires){ + } + else{ + TSK_DEBUG_ERROR("Null Expires header."); + } + + return self; +} + +static const tsk_object_def_t tmsrp_header_Expires_def_s = +{ + sizeof(tmsrp_header_Expires_t), + tmsrp_header_Expires_ctor, + tmsrp_header_Expires_dtor, + tsk_null +}; + +const tsk_object_def_t *tmsrp_header_Expires_def_t = &tmsrp_header_Expires_def_s; diff --git a/tinyMSRP/src/headers/tmsrp_header_Failure-Report.c b/tinyMSRP/src/headers/tmsrp_header_Failure-Report.c new file mode 100644 index 0000000..3f45636 --- /dev/null +++ b/tinyMSRP/src/headers/tmsrp_header_Failure-Report.c @@ -0,0 +1,369 @@ + +/* #line 1 "./ragel/tmsrp_parser_header_Failure-Report.rl" */ +/* +* Copyright (C) 2009-2015 Mamadou DIOP. +* +* 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 tmsrp_header_Failure_Report.c + * @brief MSRP 'Failure-Report' header. + */ +#include "tinymsrp/headers/tmsrp_header_Failure-Report.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_string.h" + +#include <string.h> + +/*********************************** +* Ragel state machine. +*/ + +/* #line 59 "./ragel/tmsrp_parser_header_Failure-Report.rl" */ + + + +tmsrp_header_Failure_Report_t* tmsrp_header_Failure_Report_create(tmsrp_freport_type_t freport_type) +{ + return tsk_object_new(TMSRP_HEADER_FAILURE_REPORT_VA_ARGS(freport_type)); +} + +tmsrp_header_Failure_Report_t* tmsrp_header_Failure_Report_create_null() +{ + return tmsrp_header_Failure_Report_create(freport_yes); +} + +int tmsrp_header_Failure_Report_tostring(const tmsrp_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tmsrp_header_Failure_Report_t *Failure_Report = (const tmsrp_header_Failure_Report_t *)header; + const char* value = (Failure_Report->type == freport_yes) ? "yes" : (Failure_Report->type == freport_no ? "no" : "partial"); + return tsk_buffer_append(output, value, strlen(value)); + } + + return -1; +} + +tmsrp_header_Failure_Report_t *tmsrp_header_Failure_Report_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tmsrp_header_Failure_Report_t *hdr_Failure_Report = tmsrp_header_Failure_Report_create_null(); + + TSK_RAGEL_DISABLE_WARNINGS_BEGIN() + +/* #line 74 "./src/headers/tmsrp_header_Failure-Report.c" */ +static const char _tmsrp_machine_parser_header_Failure_Report_actions[] = { + 0, 1, 0, 1, 1, 1, 2 +}; + +static const char _tmsrp_machine_parser_header_Failure_Report_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 12, + 14, 15, 17, 19, 21, 23, 25, 27, + 28, 29, 35, 37, 38, 40, 42, 44, + 46, 48, 50, 52, 54, 55, 55, 56 +}; + +static const char _tmsrp_machine_parser_header_Failure_Report_trans_keys[] = { + 70, 102, 65, 97, 73, 105, 76, 108, + 85, 117, 82, 114, 69, 101, 45, 82, + 114, 69, 101, 80, 112, 79, 111, 82, + 114, 84, 116, 58, 32, 78, 80, 89, + 110, 112, 121, 79, 111, 10, 65, 97, + 82, 114, 84, 116, 73, 105, 65, 97, + 76, 108, 69, 101, 83, 115, 13, 13, + 13, 0 +}; + +static const char _tmsrp_machine_parser_header_Failure_Report_single_lengths[] = { + 0, 2, 2, 2, 2, 2, 2, 2, + 1, 2, 2, 2, 2, 2, 2, 1, + 1, 6, 2, 1, 2, 2, 2, 2, + 2, 2, 2, 2, 1, 0, 1, 1 +}; + +static const char _tmsrp_machine_parser_header_Failure_Report_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, 0 +}; + +static const char _tmsrp_machine_parser_header_Failure_Report_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 15, 18, + 21, 23, 26, 29, 32, 35, 38, 41, + 43, 45, 52, 55, 57, 60, 63, 66, + 69, 72, 75, 78, 81, 83, 84, 86 +}; + +static const char _tmsrp_machine_parser_header_Failure_Report_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 5, 5, 1, 6, + 6, 1, 7, 7, 1, 8, 1, 9, + 9, 1, 10, 10, 1, 11, 11, 1, + 12, 12, 1, 13, 13, 1, 14, 14, + 1, 15, 1, 16, 1, 17, 18, 19, + 17, 18, 19, 1, 20, 20, 1, 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, 30, 1, 1, 31, 1, 32, 1, + 0 +}; + +static const char _tmsrp_machine_parser_header_Failure_Report_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 20, 26, 28, 29, 21, 22, + 23, 24, 25, 30, 27, 31, 19, 19, + 19 +}; + +static const char _tmsrp_machine_parser_header_Failure_Report_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, 3, 5, + 1 +}; + +static const char _tmsrp_machine_parser_header_Failure_Report_eof_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, 3, 0, 5, 1 +}; + +static const int tmsrp_machine_parser_header_Failure_Report_start = 1; +static const int tmsrp_machine_parser_header_Failure_Report_first_final = 28; +static const int tmsrp_machine_parser_header_Failure_Report_error = 0; + +static const int tmsrp_machine_parser_header_Failure_Report_en_main = 1; + + +/* #line 93 "./ragel/tmsrp_parser_header_Failure-Report.rl" */ + (void)(eof); + (void)(tmsrp_machine_parser_header_Failure_Report_first_final); + (void)(tmsrp_machine_parser_header_Failure_Report_error); + (void)(tmsrp_machine_parser_header_Failure_Report_en_main); + +/* #line 169 "./src/headers/tmsrp_header_Failure-Report.c" */ + { + cs = tmsrp_machine_parser_header_Failure_Report_start; + } + +/* #line 98 "./ragel/tmsrp_parser_header_Failure-Report.rl" */ + +/* #line 176 "./src/headers/tmsrp_header_Failure-Report.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 = _tmsrp_machine_parser_header_Failure_Report_trans_keys + _tmsrp_machine_parser_header_Failure_Report_key_offsets[cs]; + _trans = _tmsrp_machine_parser_header_Failure_Report_index_offsets[cs]; + + _klen = _tmsrp_machine_parser_header_Failure_Report_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 = _tmsrp_machine_parser_header_Failure_Report_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 = _tmsrp_machine_parser_header_Failure_Report_indicies[_trans]; + cs = _tmsrp_machine_parser_header_Failure_Report_trans_targs[_trans]; + + if ( _tmsrp_machine_parser_header_Failure_Report_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tmsrp_machine_parser_header_Failure_Report_actions + _tmsrp_machine_parser_header_Failure_Report_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 41 "./ragel/tmsrp_parser_header_Failure-Report.rl" */ + { + hdr_Failure_Report->type = freport_yes; + } + break; + case 1: +/* #line 45 "./ragel/tmsrp_parser_header_Failure-Report.rl" */ + { + hdr_Failure_Report->type = freport_no; + } + break; + case 2: +/* #line 49 "./ragel/tmsrp_parser_header_Failure-Report.rl" */ + { + hdr_Failure_Report->type = freport_partial; + } + break; +/* #line 268 "./src/headers/tmsrp_header_Failure-Report.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + if ( p == eof ) + { + const char *__acts = _tmsrp_machine_parser_header_Failure_Report_actions + _tmsrp_machine_parser_header_Failure_Report_eof_actions[cs]; + unsigned int __nacts = (unsigned int) *__acts++; + while ( __nacts-- > 0 ) { + switch ( *__acts++ ) { + case 0: +/* #line 41 "./ragel/tmsrp_parser_header_Failure-Report.rl" */ + { + hdr_Failure_Report->type = freport_yes; + } + break; + case 1: +/* #line 45 "./ragel/tmsrp_parser_header_Failure-Report.rl" */ + { + hdr_Failure_Report->type = freport_no; + } + break; + case 2: +/* #line 49 "./ragel/tmsrp_parser_header_Failure-Report.rl" */ + { + hdr_Failure_Report->type = freport_partial; + } + break; +/* #line 302 "./src/headers/tmsrp_header_Failure-Report.c" */ + } + } + } + + _out: {} + } + +/* #line 99 "./ragel/tmsrp_parser_header_Failure-Report.rl" */ + TSK_RAGEL_DISABLE_WARNINGS_END() + + if( cs < +/* #line 314 "./src/headers/tmsrp_header_Failure-Report.c" */ +28 +/* #line 101 "./ragel/tmsrp_parser_header_Failure-Report.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Failure-Report' header."); + TSK_OBJECT_SAFE_FREE(hdr_Failure_Report); + } + + return hdr_Failure_Report; +} + + + + + + + +//======================================================== +// Failure_Report header object definition +// + +static tsk_object_t* tmsrp_header_Failure_Report_ctor(tsk_object_t *self, va_list * app) +{ + tmsrp_header_Failure_Report_t *Failure_Report = self; + if(Failure_Report){ + TMSRP_HEADER(Failure_Report)->type = tmsrp_htype_Failure_Report; + TMSRP_HEADER(Failure_Report)->tostring = tmsrp_header_Failure_Report_tostring; + + Failure_Report->type = va_arg(*app, tmsrp_freport_type_t); + } + else{ + TSK_DEBUG_ERROR("Failed to create new Failure-Report header."); + } + return self; +} + +static tsk_object_t* tmsrp_header_Failure_Report_dtor(tsk_object_t *self) +{ + tmsrp_header_Failure_Report_t *Failure_Report = self; + if(Failure_Report){ + } + else{ + TSK_DEBUG_ERROR("Null Failure-Report header."); + } + + return self; +} + +static const tsk_object_def_t tmsrp_header_Failure_Report_def_s = +{ + sizeof(tmsrp_header_Failure_Report_t), + tmsrp_header_Failure_Report_ctor, + tmsrp_header_Failure_Report_dtor, + tsk_null +}; + +const tsk_object_def_t *tmsrp_header_Failure_Report_def_t = &tmsrp_header_Failure_Report_def_s; diff --git a/tinyMSRP/src/headers/tmsrp_header_From-Path.c b/tinyMSRP/src/headers/tmsrp_header_From-Path.c new file mode 100644 index 0000000..660b33f --- /dev/null +++ b/tinyMSRP/src/headers/tmsrp_header_From-Path.c @@ -0,0 +1,390 @@ + +/* #line 1 "./ragel/tmsrp_parser_header_From-Path.rl" */ +/* +* Copyright (C) 2009-2015 Mamadou DIOP. +* +* 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 tmsrp_header_From_Path.c + * @brief MSRP "From-Path" header. + */ +#include "tinymsrp/headers/tmsrp_header_From-Path.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_string.h" + +#include <string.h> + +/*********************************** +* Ragel state machine. +*/ + +/* #line 69 "./ragel/tmsrp_parser_header_From-Path.rl" */ + + + +tmsrp_header_From_Path_t* tmsrp_header_From_Path_create(const tmsrp_uri_t* uri) +{ + return tsk_object_new(TMSRP_HEADER_FROM_PATH_VA_ARGS(uri)); +} + +tmsrp_header_From_Path_t* tmsrp_header_From_Path_create_null() +{ + return tmsrp_header_From_Path_create(tsk_null); +} + +int tmsrp_header_From_Path_tostring(const tmsrp_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tmsrp_header_From_Path_t *From_Path = (const tmsrp_header_From_Path_t *)header; + const tsk_list_item_t *item; + + if(From_Path->uri){ + tmsrp_uri_serialize(From_Path->uri, output); + } + tsk_list_foreach(item, From_Path->otherURIs){ + tsk_buffer_append(output, " ", 1); + tmsrp_uri_serialize(TMSRP_URI(item->data), output); + } + } + + return -1; +} + +tmsrp_header_From_Path_t *tmsrp_header_From_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; + tmsrp_header_From_Path_t *header = tmsrp_header_From_Path_create_null(); + + const char *tag_start = tsk_null; + + TSK_RAGEL_DISABLE_WARNINGS_BEGIN() + +/* #line 83 "./src/headers/tmsrp_header_From-Path.c" */ +static const char _tmsrp_machine_parser_header_From_Path_actions[] = { + 0, 1, 0, 1, 1, 2, 0, 1 + +}; + +static const char _tmsrp_machine_parser_header_From_Path_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 9, 11, + 13, 15, 17, 18, 19, 20, 22, 24 +}; + +static const char _tmsrp_machine_parser_header_From_Path_trans_keys[] = { + 70, 102, 82, 114, 79, 111, 77, 109, + 45, 80, 112, 65, 97, 84, 116, 72, + 104, 58, 32, 10, 13, 32, 13, 32, + 0 +}; + +static const char _tmsrp_machine_parser_header_From_Path_single_lengths[] = { + 0, 2, 2, 2, 2, 1, 2, 2, + 2, 2, 1, 1, 1, 2, 2, 0 +}; + +static const char _tmsrp_machine_parser_header_From_Path_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static const char _tmsrp_machine_parser_header_From_Path_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 14, 17, + 20, 23, 26, 28, 30, 32, 35, 38 +}; + +static const char _tmsrp_machine_parser_header_From_Path_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, 1, 11, 1, 12, 1, + 14, 15, 13, 17, 18, 16, 1, 0 +}; + +static const char _tmsrp_machine_parser_header_From_Path_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 13, 15, 14, 12, 13, + 14, 12, 13 +}; + +static const char _tmsrp_machine_parser_header_From_Path_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 5, 5, + 0, 3, 3 +}; + +static const char _tmsrp_machine_parser_header_From_Path_eof_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 5, 3, 0 +}; + +static const int tmsrp_machine_parser_header_From_Path_start = 1; +static const int tmsrp_machine_parser_header_From_Path_first_final = 13; +static const int tmsrp_machine_parser_header_From_Path_error = 0; + +static const int tmsrp_machine_parser_header_From_Path_en_main = 1; + + +/* #line 112 "./ragel/tmsrp_parser_header_From-Path.rl" */ + (void)(eof); + (void)(tmsrp_machine_parser_header_From_Path_first_final); + (void)(tmsrp_machine_parser_header_From_Path_error); + (void)(tmsrp_machine_parser_header_From_Path_en_main); + +/* #line 154 "./src/headers/tmsrp_header_From-Path.c" */ + { + cs = tmsrp_machine_parser_header_From_Path_start; + } + +/* #line 117 "./ragel/tmsrp_parser_header_From-Path.rl" */ + +/* #line 161 "./src/headers/tmsrp_header_From-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 = _tmsrp_machine_parser_header_From_Path_trans_keys + _tmsrp_machine_parser_header_From_Path_key_offsets[cs]; + _trans = _tmsrp_machine_parser_header_From_Path_index_offsets[cs]; + + _klen = _tmsrp_machine_parser_header_From_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 = _tmsrp_machine_parser_header_From_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 = _tmsrp_machine_parser_header_From_Path_indicies[_trans]; + cs = _tmsrp_machine_parser_header_From_Path_trans_targs[_trans]; + + if ( _tmsrp_machine_parser_header_From_Path_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tmsrp_machine_parser_header_From_Path_actions + _tmsrp_machine_parser_header_From_Path_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 41 "./ragel/tmsrp_parser_header_From-Path.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 45 "./ragel/tmsrp_parser_header_From-Path.rl" */ + { + int len = (int)(p - tag_start); + tmsrp_uri_t* uri; + if((uri = tmsrp_uri_parse(tag_start, (tsk_size_t)len))){ + if(!header->uri){ + header->uri = uri; + } + else{ + if(!header->otherURIs){ + header->otherURIs = tsk_list_create(); + } + tsk_list_push_back_data(header->otherURIs, ((void**) &uri)); + } + } + } + break; +/* #line 259 "./src/headers/tmsrp_header_From-Path.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + if ( p == eof ) + { + const char *__acts = _tmsrp_machine_parser_header_From_Path_actions + _tmsrp_machine_parser_header_From_Path_eof_actions[cs]; + unsigned int __nacts = (unsigned int) *__acts++; + while ( __nacts-- > 0 ) { + switch ( *__acts++ ) { + case 0: +/* #line 41 "./ragel/tmsrp_parser_header_From-Path.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 45 "./ragel/tmsrp_parser_header_From-Path.rl" */ + { + int len = (int)(p - tag_start); + tmsrp_uri_t* uri; + if((uri = tmsrp_uri_parse(tag_start, (tsk_size_t)len))){ + if(!header->uri){ + header->uri = uri; + } + else{ + if(!header->otherURIs){ + header->otherURIs = tsk_list_create(); + } + tsk_list_push_back_data(header->otherURIs, ((void**) &uri)); + } + } + } + break; +/* #line 299 "./src/headers/tmsrp_header_From-Path.c" */ + } + } + } + + _out: {} + } + +/* #line 118 "./ragel/tmsrp_parser_header_From-Path.rl" */ + TSK_RAGEL_DISABLE_WARNINGS_END() + + if( cs < +/* #line 311 "./src/headers/tmsrp_header_From-Path.c" */ +13 +/* #line 120 "./ragel/tmsrp_parser_header_From-Path.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'From-Path' header."); + TSK_OBJECT_SAFE_FREE(header); + } + + return header; +} + + +tmsrp_header_From_Path_t *tmsrp_header_From_Path_clone(const tmsrp_header_From_Path_t* From_Path) +{ + tmsrp_header_From_Path_t* clone = tsk_null; + + if(!From_Path){ + goto bail; + } + + clone = tmsrp_header_From_Path_create_null(); + clone->uri = tmsrp_uri_clone(From_Path->uri); + if(From_Path->otherURIs){ + tsk_list_item_t *item; + clone->otherURIs = tsk_list_create(); + + tsk_list_foreach(item, From_Path->otherURIs){ + tmsrp_uri_t *uri = tmsrp_uri_clone(TMSRP_URI(item->data)); + tsk_list_push_back_data(clone->otherURIs, (void**)&uri); + } + } + +bail: + return clone; +} + + + + +//======================================================== +// From_Path header object definition +// + +static tsk_object_t* tmsrp_header_From_Path_ctor(tsk_object_t *self, va_list * app) +{ + tmsrp_header_From_Path_t *From_Path = self; + if(From_Path){ + TMSRP_HEADER(From_Path)->type = tmsrp_htype_From_Path; + TMSRP_HEADER(From_Path)->tostring = tmsrp_header_From_Path_tostring; + + From_Path->uri = tsk_object_ref((void*)va_arg(*app, const tmsrp_uri_t*)); + } + else{ + TSK_DEBUG_ERROR("Failed to create new From-Path header."); + } + return self; +} + +static tsk_object_t* tmsrp_header_From_Path_dtor(tsk_object_t *self) +{ + tmsrp_header_From_Path_t *From_Path = self; + if(From_Path){ + TSK_OBJECT_SAFE_FREE(From_Path->uri); + TSK_OBJECT_SAFE_FREE(From_Path->otherURIs); + } + else{ + TSK_DEBUG_ERROR("Null From-Path header."); + } + + return self; +} + +static const tsk_object_def_t tmsrp_header_From_Path_def_s = +{ + sizeof(tmsrp_header_From_Path_t), + tmsrp_header_From_Path_ctor, + tmsrp_header_From_Path_dtor, + tsk_null +}; + +const tsk_object_def_t *tmsrp_header_From_Path_def_t = &tmsrp_header_From_Path_def_s; diff --git a/tinyMSRP/src/headers/tmsrp_header_Max-Expires.c b/tinyMSRP/src/headers/tmsrp_header_Max-Expires.c new file mode 100644 index 0000000..f23f26f --- /dev/null +++ b/tinyMSRP/src/headers/tmsrp_header_Max-Expires.c @@ -0,0 +1,336 @@ + +/* #line 1 "./ragel/tmsrp_parser_header_Max-Expires.rl" */ +/* +* Copyright (C) 2009-2015 Mamadou DIOP. +* +* 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 tmsrp_header_Max_Expires.c + * @brief MSRP 'Max-Expires' header. + */ +#include "tinymsrp/headers/tmsrp_header_Max-Expires.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_string.h" + +#include <string.h> + +/*********************************** +* Ragel state machine. +*/ + +/* #line 55 "./ragel/tmsrp_parser_header_Max-Expires.rl" */ + + + +tmsrp_header_Max_Expires_t* tmsrp_header_Max_Expires_create(int64_t value) +{ + return tsk_object_new(TMSRP_HEADER_MAX_EXPIRES_VA_ARGS(value)); +} + +tmsrp_header_Max_Expires_t* tmsrp_header_Max_Expires_create_null() +{ + return tmsrp_header_Max_Expires_create(-1); +} + +int tmsrp_header_Max_Expires_tostring(const tmsrp_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tmsrp_header_Max_Expires_t *Max_Expires = (const tmsrp_header_Max_Expires_t *)header; + if(Max_Expires->value>=0){ + return tsk_buffer_append_2(output, "%lld", Max_Expires->value); + } + return 0; + } + + return -1; +} + +tmsrp_header_Max_Expires_t *tmsrp_header_Max_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; + tmsrp_header_Max_Expires_t *hdr_Max_Expires = tmsrp_header_Max_Expires_create_null(); + + const char *tag_start = tsk_null; + + TSK_RAGEL_DISABLE_WARNINGS_BEGIN() + +/* #line 78 "./src/headers/tmsrp_header_Max-Expires.c" */ +static const char _tmsrp_machine_parser_header_Max_Expires_actions[] = { + 0, 1, 0, 1, 1 +}; + +static const char _tmsrp_machine_parser_header_Max_Expires_key_offsets[] = { + 0, 0, 2, 4, 6, 7, 9, 11, + 13, 15, 17, 19, 21, 22, 23, 25, + 26, 29 +}; + +static const char _tmsrp_machine_parser_header_Max_Expires_trans_keys[] = { + 77, 109, 65, 97, 88, 120, 45, 69, + 101, 88, 120, 80, 112, 73, 105, 82, + 114, 69, 101, 83, 115, 58, 32, 48, + 57, 10, 13, 48, 57, 0 +}; + +static const char _tmsrp_machine_parser_header_Max_Expires_single_lengths[] = { + 0, 2, 2, 2, 1, 2, 2, 2, + 2, 2, 2, 2, 1, 1, 0, 1, + 1, 0 +}; + +static const char _tmsrp_machine_parser_header_Max_Expires_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 0, + 1, 0 +}; + +static const char _tmsrp_machine_parser_header_Max_Expires_index_offsets[] = { + 0, 0, 3, 6, 9, 11, 14, 17, + 20, 23, 26, 29, 32, 34, 36, 38, + 40, 43 +}; + +static const char _tmsrp_machine_parser_header_Max_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, + 12, 1, 13, 1, 14, 1, 15, 1, + 16, 17, 1, 1, 0 +}; + +static const char _tmsrp_machine_parser_header_Max_Expires_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 16, 17, + 15, 16 +}; + +static const char _tmsrp_machine_parser_header_Max_Expires_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 0, + 3, 0 +}; + +static const char _tmsrp_machine_parser_header_Max_Expires_eof_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 3, 0 +}; + +static const int tmsrp_machine_parser_header_Max_Expires_start = 1; +static const int tmsrp_machine_parser_header_Max_Expires_first_final = 16; +static const int tmsrp_machine_parser_header_Max_Expires_error = 0; + +static const int tmsrp_machine_parser_header_Max_Expires_en_main = 1; + + +/* #line 93 "./ragel/tmsrp_parser_header_Max-Expires.rl" */ + (void)(eof); + (void)(tmsrp_machine_parser_header_Max_Expires_first_final); + (void)(tmsrp_machine_parser_header_Max_Expires_error); + (void)(tmsrp_machine_parser_header_Max_Expires_en_main); + +/* #line 154 "./src/headers/tmsrp_header_Max-Expires.c" */ + { + cs = tmsrp_machine_parser_header_Max_Expires_start; + } + +/* #line 98 "./ragel/tmsrp_parser_header_Max-Expires.rl" */ + +/* #line 161 "./src/headers/tmsrp_header_Max-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 = _tmsrp_machine_parser_header_Max_Expires_trans_keys + _tmsrp_machine_parser_header_Max_Expires_key_offsets[cs]; + _trans = _tmsrp_machine_parser_header_Max_Expires_index_offsets[cs]; + + _klen = _tmsrp_machine_parser_header_Max_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 = _tmsrp_machine_parser_header_Max_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 = _tmsrp_machine_parser_header_Max_Expires_indicies[_trans]; + cs = _tmsrp_machine_parser_header_Max_Expires_trans_targs[_trans]; + + if ( _tmsrp_machine_parser_header_Max_Expires_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tmsrp_machine_parser_header_Max_Expires_actions + _tmsrp_machine_parser_header_Max_Expires_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 41 "./ragel/tmsrp_parser_header_Max-Expires.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 45 "./ragel/tmsrp_parser_header_Max-Expires.rl" */ + { + TSK_PARSER_SET_INTEGER_EX(hdr_Max_Expires->value, int64_t, atoi64) + } + break; +/* #line 247 "./src/headers/tmsrp_header_Max-Expires.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + if ( p == eof ) + { + const char *__acts = _tmsrp_machine_parser_header_Max_Expires_actions + _tmsrp_machine_parser_header_Max_Expires_eof_actions[cs]; + unsigned int __nacts = (unsigned int) *__acts++; + while ( __nacts-- > 0 ) { + switch ( *__acts++ ) { + case 1: +/* #line 45 "./ragel/tmsrp_parser_header_Max-Expires.rl" */ + { + TSK_PARSER_SET_INTEGER_EX(hdr_Max_Expires->value, int64_t, atoi64) + } + break; +/* #line 269 "./src/headers/tmsrp_header_Max-Expires.c" */ + } + } + } + + _out: {} + } + +/* #line 99 "./ragel/tmsrp_parser_header_Max-Expires.rl" */ + TSK_RAGEL_DISABLE_WARNINGS_END() + + if( cs < +/* #line 281 "./src/headers/tmsrp_header_Max-Expires.c" */ +16 +/* #line 101 "./ragel/tmsrp_parser_header_Max-Expires.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Max-Expires' header."); + TSK_OBJECT_SAFE_FREE(hdr_Max_Expires); + } + + return hdr_Max_Expires; +} + + + + + + + +//======================================================== +// Max-Expires header object definition +// + +static tsk_object_t* tmsrp_header_Max_Expires_ctor(tsk_object_t *self, va_list * app) +{ + tmsrp_header_Max_Expires_t *Max_Expires = self; + if(Max_Expires){ + TMSRP_HEADER(Max_Expires)->type = tmsrp_htype_Max_Expires; + TMSRP_HEADER(Max_Expires)->tostring = tmsrp_header_Max_Expires_tostring; + + Max_Expires->value = va_arg(*app, int64_t); + } + else{ + TSK_DEBUG_ERROR("Failed to create new Max-Expires header."); + } + return self; +} + +static tsk_object_t* tmsrp_header_Max_Expires_dtor(tsk_object_t *self) +{ + tmsrp_header_Max_Expires_t *Max_Expires = self; + if(Max_Expires){ + } + else{ + TSK_DEBUG_ERROR("Null Max-Expires header."); + } + + return self; +} + +static const tsk_object_def_t tmsrp_header_Max_Expires_def_s = +{ + sizeof(tmsrp_header_Max_Expires_t), + tmsrp_header_Max_Expires_ctor, + tmsrp_header_Max_Expires_dtor, + tsk_null +}; + +const tsk_object_def_t *tmsrp_header_Max_Expires_def_t = &tmsrp_header_Max_Expires_def_s; diff --git a/tinyMSRP/src/headers/tmsrp_header_Message-ID.c b/tinyMSRP/src/headers/tmsrp_header_Message-ID.c new file mode 100644 index 0000000..8c1f946 --- /dev/null +++ b/tinyMSRP/src/headers/tmsrp_header_Message-ID.c @@ -0,0 +1,441 @@ + +/* #line 1 "./ragel/tmsrp_parser_header_Message-ID.rl" */ +/* +* Copyright (C) 2009-2015 Mamadou DIOP. +* +* 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 tmsrp_header_Message_Id.c + * @brief MSRP 'Message-Id' header. + * + */ +#include "tinymsrp/headers/tmsrp_header_Message-ID.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_string.h" + +#include <string.h> + +/*********************************** +* Ragel state machine. +*/ + +/* #line 56 "./ragel/tmsrp_parser_header_Message-ID.rl" */ + + + +tmsrp_header_Message_ID_t* tmsrp_header_Message_ID_create(const char* value) +{ + return tsk_object_new(TMSRP_HEADER_MESSAGE_ID_VA_ARGS(value)); +} + +tmsrp_header_Message_ID_t* tmsrp_header_Message_ID_create_null() +{ + return tmsrp_header_Message_ID_create(tsk_null); +} + + +int tmsrp_header_Message_ID_tostring(const tmsrp_header_t* header, tsk_buffer_t* output) +{ + if(header) + { + const tmsrp_header_Message_ID_t *Message_Id = (const tmsrp_header_Message_ID_t *)header; + if(Message_Id->value){ + return tsk_buffer_append(output, Message_Id->value, strlen(Message_Id->value)); + } + return 0; + } + + return -1; +} + +tmsrp_header_Message_ID_t *tmsrp_header_Message_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; + tmsrp_header_Message_ID_t *hdr_Message_Id = tmsrp_header_Message_ID_create_null(); + + const char *tag_start = tsk_null; + + TSK_RAGEL_DISABLE_WARNINGS_BEGIN() + +/* #line 81 "./src/headers/tmsrp_header_Message-ID.c" */ +static const char _tmsrp_machine_parser_header_Message_Id_actions[] = { + 0, 1, 0, 1, 1 +}; + +static const short _tmsrp_machine_parser_header_Message_Id_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 12, + 14, 15, 17, 19, 20, 21, 27, 38, + 49, 60, 61, 73, 73, 85, 97, 109, + 121, 133, 145, 157, 169, 181, 193, 205, + 217, 229, 241, 253, 265, 277, 289, 301, + 313, 325, 337, 349, 361, 373, 385, 397 +}; + +static const char _tmsrp_machine_parser_header_Message_Id_trans_keys[] = { + 77, 109, 69, 101, 83, 115, 83, 115, + 65, 97, 71, 103, 69, 101, 45, 73, + 105, 68, 100, 58, 32, 48, 57, 65, + 90, 97, 122, 37, 43, 61, 45, 46, + 48, 57, 65, 90, 97, 122, 37, 43, + 61, 45, 46, 48, 57, 65, 90, 97, + 122, 37, 43, 61, 45, 46, 48, 57, + 65, 90, 97, 122, 10, 13, 37, 43, + 61, 45, 46, 48, 57, 65, 90, 97, + 122, 13, 37, 43, 61, 45, 46, 48, + 57, 65, 90, 97, 122, 13, 37, 43, + 61, 45, 46, 48, 57, 65, 90, 97, + 122, 13, 37, 43, 61, 45, 46, 48, + 57, 65, 90, 97, 122, 13, 37, 43, + 61, 45, 46, 48, 57, 65, 90, 97, + 122, 13, 37, 43, 61, 45, 46, 48, + 57, 65, 90, 97, 122, 13, 37, 43, + 61, 45, 46, 48, 57, 65, 90, 97, + 122, 13, 37, 43, 61, 45, 46, 48, + 57, 65, 90, 97, 122, 13, 37, 43, + 61, 45, 46, 48, 57, 65, 90, 97, + 122, 13, 37, 43, 61, 45, 46, 48, + 57, 65, 90, 97, 122, 13, 37, 43, + 61, 45, 46, 48, 57, 65, 90, 97, + 122, 13, 37, 43, 61, 45, 46, 48, + 57, 65, 90, 97, 122, 13, 37, 43, + 61, 45, 46, 48, 57, 65, 90, 97, + 122, 13, 37, 43, 61, 45, 46, 48, + 57, 65, 90, 97, 122, 13, 37, 43, + 61, 45, 46, 48, 57, 65, 90, 97, + 122, 13, 37, 43, 61, 45, 46, 48, + 57, 65, 90, 97, 122, 13, 37, 43, + 61, 45, 46, 48, 57, 65, 90, 97, + 122, 13, 37, 43, 61, 45, 46, 48, + 57, 65, 90, 97, 122, 13, 37, 43, + 61, 45, 46, 48, 57, 65, 90, 97, + 122, 13, 37, 43, 61, 45, 46, 48, + 57, 65, 90, 97, 122, 13, 37, 43, + 61, 45, 46, 48, 57, 65, 90, 97, + 122, 13, 37, 43, 61, 45, 46, 48, + 57, 65, 90, 97, 122, 13, 37, 43, + 61, 45, 46, 48, 57, 65, 90, 97, + 122, 13, 37, 43, 61, 45, 46, 48, + 57, 65, 90, 97, 122, 13, 37, 43, + 61, 45, 46, 48, 57, 65, 90, 97, + 122, 13, 37, 43, 61, 45, 46, 48, + 57, 65, 90, 97, 122, 13, 37, 43, + 61, 45, 46, 48, 57, 65, 90, 97, + 122, 13, 37, 43, 61, 45, 46, 48, + 57, 65, 90, 97, 122, 13, 0 +}; + +static const char _tmsrp_machine_parser_header_Message_Id_single_lengths[] = { + 0, 2, 2, 2, 2, 2, 2, 2, + 1, 2, 2, 1, 1, 0, 3, 3, + 3, 1, 4, 0, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 1 +}; + +static const char _tmsrp_machine_parser_header_Message_Id_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 3, 4, 4, + 4, 0, 4, 0, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 0 +}; + +static const short _tmsrp_machine_parser_header_Message_Id_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 15, 18, + 21, 23, 26, 29, 31, 33, 37, 45, + 53, 61, 63, 72, 73, 82, 91, 100, + 109, 118, 127, 136, 145, 154, 163, 172, + 181, 190, 199, 208, 217, 226, 235, 244, + 253, 262, 271, 280, 289, 298, 307, 316 +}; + +static const char _tmsrp_machine_parser_header_Message_Id_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 5, 5, 1, 6, + 6, 1, 7, 7, 1, 8, 1, 9, + 9, 1, 10, 10, 1, 11, 1, 12, + 1, 13, 13, 13, 1, 14, 14, 14, + 14, 14, 14, 14, 1, 15, 15, 15, + 15, 15, 15, 15, 1, 16, 16, 16, + 16, 16, 16, 16, 1, 17, 1, 18, + 19, 19, 19, 19, 19, 19, 19, 1, + 1, 18, 20, 20, 20, 20, 20, 20, + 20, 1, 18, 21, 21, 21, 21, 21, + 21, 21, 1, 18, 22, 22, 22, 22, + 22, 22, 22, 1, 18, 23, 23, 23, + 23, 23, 23, 23, 1, 18, 24, 24, + 24, 24, 24, 24, 24, 1, 18, 25, + 25, 25, 25, 25, 25, 25, 1, 18, + 26, 26, 26, 26, 26, 26, 26, 1, + 18, 27, 27, 27, 27, 27, 27, 27, + 1, 18, 28, 28, 28, 28, 28, 28, + 28, 1, 18, 29, 29, 29, 29, 29, + 29, 29, 1, 18, 30, 30, 30, 30, + 30, 30, 30, 1, 18, 31, 31, 31, + 31, 31, 31, 31, 1, 18, 32, 32, + 32, 32, 32, 32, 32, 1, 18, 33, + 33, 33, 33, 33, 33, 33, 1, 18, + 34, 34, 34, 34, 34, 34, 34, 1, + 18, 35, 35, 35, 35, 35, 35, 35, + 1, 18, 36, 36, 36, 36, 36, 36, + 36, 1, 18, 37, 37, 37, 37, 37, + 37, 37, 1, 18, 38, 38, 38, 38, + 38, 38, 38, 1, 18, 39, 39, 39, + 39, 39, 39, 39, 1, 18, 40, 40, + 40, 40, 40, 40, 40, 1, 18, 41, + 41, 41, 41, 41, 41, 41, 1, 18, + 42, 42, 42, 42, 42, 42, 42, 1, + 18, 43, 43, 43, 43, 43, 43, 43, + 1, 18, 44, 44, 44, 44, 44, 44, + 44, 1, 18, 45, 45, 45, 45, 45, + 45, 45, 1, 18, 46, 46, 46, 46, + 46, 46, 46, 1, 18, 1, 0 +}; + +static const char _tmsrp_machine_parser_header_Message_Id_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 18, 19, 17, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47 +}; + +static const char _tmsrp_machine_parser_header_Message_Id_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 0, 0, 3, 0, 0, 0, 0, 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 _tmsrp_machine_parser_header_Message_Id_eof_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3 +}; + +static const int tmsrp_machine_parser_header_Message_Id_start = 1; +static const int tmsrp_machine_parser_header_Message_Id_first_final = 18; +static const int tmsrp_machine_parser_header_Message_Id_error = 0; + +static const int tmsrp_machine_parser_header_Message_Id_en_main = 1; + + +/* #line 96 "./ragel/tmsrp_parser_header_Message-ID.rl" */ + (void)(eof); + (void)(tmsrp_machine_parser_header_Message_Id_first_final); + (void)(tmsrp_machine_parser_header_Message_Id_error); + (void)(tmsrp_machine_parser_header_Message_Id_en_main); + +/* #line 258 "./src/headers/tmsrp_header_Message-ID.c" */ + { + cs = tmsrp_machine_parser_header_Message_Id_start; + } + +/* #line 101 "./ragel/tmsrp_parser_header_Message-ID.rl" */ + +/* #line 265 "./src/headers/tmsrp_header_Message-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 = _tmsrp_machine_parser_header_Message_Id_trans_keys + _tmsrp_machine_parser_header_Message_Id_key_offsets[cs]; + _trans = _tmsrp_machine_parser_header_Message_Id_index_offsets[cs]; + + _klen = _tmsrp_machine_parser_header_Message_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 = _tmsrp_machine_parser_header_Message_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 = _tmsrp_machine_parser_header_Message_Id_indicies[_trans]; + cs = _tmsrp_machine_parser_header_Message_Id_trans_targs[_trans]; + + if ( _tmsrp_machine_parser_header_Message_Id_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tmsrp_machine_parser_header_Message_Id_actions + _tmsrp_machine_parser_header_Message_Id_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 42 "./ragel/tmsrp_parser_header_Message-ID.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 46 "./ragel/tmsrp_parser_header_Message-ID.rl" */ + { + TSK_PARSER_SET_STRING(hdr_Message_Id->value); + } + break; +/* #line 351 "./src/headers/tmsrp_header_Message-ID.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + if ( p == eof ) + { + const char *__acts = _tmsrp_machine_parser_header_Message_Id_actions + _tmsrp_machine_parser_header_Message_Id_eof_actions[cs]; + unsigned int __nacts = (unsigned int) *__acts++; + while ( __nacts-- > 0 ) { + switch ( *__acts++ ) { + case 1: +/* #line 46 "./ragel/tmsrp_parser_header_Message-ID.rl" */ + { + TSK_PARSER_SET_STRING(hdr_Message_Id->value); + } + break; +/* #line 373 "./src/headers/tmsrp_header_Message-ID.c" */ + } + } + } + + _out: {} + } + +/* #line 102 "./ragel/tmsrp_parser_header_Message-ID.rl" */ + TSK_RAGEL_DISABLE_WARNINGS_END() + + if( cs < +/* #line 385 "./src/headers/tmsrp_header_Message-ID.c" */ +18 +/* #line 104 "./ragel/tmsrp_parser_header_Message-ID.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Message-Id' header."); + TSK_OBJECT_SAFE_FREE(hdr_Message_Id); + } + + return hdr_Message_Id; +} + + + + + + + +//======================================================== +// Message_Id header object definition +// + +static tsk_object_t* tmsrp_header_Message_ID_ctor(tsk_object_t *self, va_list * app) +{ + tmsrp_header_Message_ID_t *Message_Id = self; + if(Message_Id){ + TMSRP_HEADER(Message_Id)->type = tmsrp_htype_Message_ID; + TMSRP_HEADER(Message_Id)->tostring = tmsrp_header_Message_ID_tostring; + + Message_Id->value = tsk_strdup(va_arg(*app, const char*)); + } + else{ + TSK_DEBUG_ERROR("Failed to create new Message-Id header."); + } + return self; +} + +static tsk_object_t* tmsrp_header_Message_ID_dtor(tsk_object_t *self) +{ + tmsrp_header_Message_ID_t *Message_Id = self; + if(Message_Id){ + TSK_FREE(Message_Id->value); + } + else{ + TSK_DEBUG_ERROR("Null Message-Id header."); + } + + return self; +} + +static const tsk_object_def_t tmsrp_header_Message_ID_def_s = +{ + sizeof(tmsrp_header_Message_ID_t), + tmsrp_header_Message_ID_ctor, + tmsrp_header_Message_ID_dtor, + tsk_null +}; + +const tsk_object_def_t *tmsrp_header_Message_ID_def_t = &tmsrp_header_Message_ID_def_s; diff --git a/tinyMSRP/src/headers/tmsrp_header_Min-Expires.c b/tinyMSRP/src/headers/tmsrp_header_Min-Expires.c new file mode 100644 index 0000000..f45795d --- /dev/null +++ b/tinyMSRP/src/headers/tmsrp_header_Min-Expires.c @@ -0,0 +1,336 @@ + +/* #line 1 "./ragel/tmsrp_parser_header_Min-Expires.rl" */ +/* +* Copyright (C) 2009-2015 Mamadou DIOP. +* +* 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 tmsrp_header_Min_Expires.c + * @brief MSRP 'Min-Expires' header. + */ +#include "tinymsrp/headers/tmsrp_header_Min-Expires.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_string.h" + +#include <string.h> + +/*********************************** +* Ragel state machine. +*/ + +/* #line 55 "./ragel/tmsrp_parser_header_Min-Expires.rl" */ + + + +tmsrp_header_Min_Expires_t* tmsrp_header_Min_Expires_create(int64_t value) +{ + return tsk_object_new(TMSRP_HEADER_MIN_EXPIRES_VA_ARGS(value)); +} + +tmsrp_header_Min_Expires_t* tmsrp_header_Min_Expires_create_null() +{ + return tmsrp_header_Min_Expires_create(-1); +} + +int tmsrp_header_Min_Expires_tostring(const tmsrp_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tmsrp_header_Min_Expires_t *Min_Expires = (const tmsrp_header_Min_Expires_t *)header; + if(Min_Expires->value>=0){ + return tsk_buffer_append_2(output, "%lld", Min_Expires->value); + } + return 0; + } + + return -1; +} + +tmsrp_header_Min_Expires_t *tmsrp_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; + tmsrp_header_Min_Expires_t *hdr_Min_Expires = tmsrp_header_Min_Expires_create_null(); + + const char *tag_start = tsk_null; + + TSK_RAGEL_DISABLE_WARNINGS_BEGIN() + +/* #line 78 "./src/headers/tmsrp_header_Min-Expires.c" */ +static const char _tmsrp_machine_parser_header_Min_Expires_actions[] = { + 0, 1, 0, 1, 1 +}; + +static const char _tmsrp_machine_parser_header_Min_Expires_key_offsets[] = { + 0, 0, 2, 4, 6, 7, 9, 11, + 13, 15, 17, 19, 21, 22, 23, 25, + 26, 29 +}; + +static const char _tmsrp_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, 58, 32, 48, + 57, 10, 13, 48, 57, 0 +}; + +static const char _tmsrp_machine_parser_header_Min_Expires_single_lengths[] = { + 0, 2, 2, 2, 1, 2, 2, 2, + 2, 2, 2, 2, 1, 1, 0, 1, + 1, 0 +}; + +static const char _tmsrp_machine_parser_header_Min_Expires_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 0, + 1, 0 +}; + +static const char _tmsrp_machine_parser_header_Min_Expires_index_offsets[] = { + 0, 0, 3, 6, 9, 11, 14, 17, + 20, 23, 26, 29, 32, 34, 36, 38, + 40, 43 +}; + +static const char _tmsrp_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, + 12, 1, 13, 1, 14, 1, 15, 1, + 16, 17, 1, 1, 0 +}; + +static const char _tmsrp_machine_parser_header_Min_Expires_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 16, 17, + 15, 16 +}; + +static const char _tmsrp_machine_parser_header_Min_Expires_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 0, + 3, 0 +}; + +static const char _tmsrp_machine_parser_header_Min_Expires_eof_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 3, 0 +}; + +static const int tmsrp_machine_parser_header_Min_Expires_start = 1; +static const int tmsrp_machine_parser_header_Min_Expires_first_final = 16; +static const int tmsrp_machine_parser_header_Min_Expires_error = 0; + +static const int tmsrp_machine_parser_header_Min_Expires_en_main = 1; + + +/* #line 93 "./ragel/tmsrp_parser_header_Min-Expires.rl" */ + (void)(eof); + (void)(tmsrp_machine_parser_header_Min_Expires_first_final); + (void)(tmsrp_machine_parser_header_Min_Expires_error); + (void)(tmsrp_machine_parser_header_Min_Expires_en_main); + +/* #line 154 "./src/headers/tmsrp_header_Min-Expires.c" */ + { + cs = tmsrp_machine_parser_header_Min_Expires_start; + } + +/* #line 98 "./ragel/tmsrp_parser_header_Min-Expires.rl" */ + +/* #line 161 "./src/headers/tmsrp_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 = _tmsrp_machine_parser_header_Min_Expires_trans_keys + _tmsrp_machine_parser_header_Min_Expires_key_offsets[cs]; + _trans = _tmsrp_machine_parser_header_Min_Expires_index_offsets[cs]; + + _klen = _tmsrp_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 = _tmsrp_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 = _tmsrp_machine_parser_header_Min_Expires_indicies[_trans]; + cs = _tmsrp_machine_parser_header_Min_Expires_trans_targs[_trans]; + + if ( _tmsrp_machine_parser_header_Min_Expires_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tmsrp_machine_parser_header_Min_Expires_actions + _tmsrp_machine_parser_header_Min_Expires_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 41 "./ragel/tmsrp_parser_header_Min-Expires.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 45 "./ragel/tmsrp_parser_header_Min-Expires.rl" */ + { + TSK_PARSER_SET_INTEGER_EX(hdr_Min_Expires->value, int64_t, atoi64) + } + break; +/* #line 247 "./src/headers/tmsrp_header_Min-Expires.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + if ( p == eof ) + { + const char *__acts = _tmsrp_machine_parser_header_Min_Expires_actions + _tmsrp_machine_parser_header_Min_Expires_eof_actions[cs]; + unsigned int __nacts = (unsigned int) *__acts++; + while ( __nacts-- > 0 ) { + switch ( *__acts++ ) { + case 1: +/* #line 45 "./ragel/tmsrp_parser_header_Min-Expires.rl" */ + { + TSK_PARSER_SET_INTEGER_EX(hdr_Min_Expires->value, int64_t, atoi64) + } + break; +/* #line 269 "./src/headers/tmsrp_header_Min-Expires.c" */ + } + } + } + + _out: {} + } + +/* #line 99 "./ragel/tmsrp_parser_header_Min-Expires.rl" */ + TSK_RAGEL_DISABLE_WARNINGS_END() + + if( cs < +/* #line 281 "./src/headers/tmsrp_header_Min-Expires.c" */ +16 +/* #line 101 "./ragel/tmsrp_parser_header_Min-Expires.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Min-Expires' header."); + TSK_OBJECT_SAFE_FREE(hdr_Min_Expires); + } + + return hdr_Min_Expires; +} + + + + + + + +//======================================================== +// Min-Expires header object definition +// + +static tsk_object_t* tmsrp_header_Min_Expires_ctor(tsk_object_t *self, va_list * app) +{ + tmsrp_header_Min_Expires_t *Min_Expires = self; + if(Min_Expires){ + TMSRP_HEADER(Min_Expires)->type = tmsrp_htype_Min_Expires; + TMSRP_HEADER(Min_Expires)->tostring = tmsrp_header_Min_Expires_tostring; + + Min_Expires->value = va_arg(*app, int64_t); + } + else{ + TSK_DEBUG_ERROR("Failed to create new Min-Expires header."); + } + return self; +} + +static tsk_object_t* tmsrp_header_Min_Expires_dtor(tsk_object_t *self) +{ + tmsrp_header_Min_Expires_t *Min_Expires = self; + if(Min_Expires){ + } + else{ + TSK_DEBUG_ERROR("Null Min-Expires header."); + } + + return self; +} + +static const tsk_object_def_t tmsrp_header_Min_Expires_def_s = +{ + sizeof(tmsrp_header_Min_Expires_t), + tmsrp_header_Min_Expires_ctor, + tmsrp_header_Min_Expires_dtor, + tsk_null +}; + +const tsk_object_def_t *tmsrp_header_Min_Expires_def_t = &tmsrp_header_Min_Expires_def_s; diff --git a/tinyMSRP/src/headers/tmsrp_header_Status.c b/tinyMSRP/src/headers/tmsrp_header_Status.c new file mode 100644 index 0000000..dd1bafe --- /dev/null +++ b/tinyMSRP/src/headers/tmsrp_header_Status.c @@ -0,0 +1,377 @@ + +/* #line 1 "./ragel/tmsrp_parser_header_Status.rl" */ +/* +* Copyright (C) 2009-2015 Mamadou DIOP. +* +* 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 tmsrp_header_Status.c + * @brief MSRP 'Status' header. + */ +#include "tinymsrp/headers/tmsrp_header_Status.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_string.h" + +#include <string.h> + +/*********************************** +* Ragel state machine. +*/ + +/* #line 65 "./ragel/tmsrp_parser_header_Status.rl" */ + + + + +tmsrp_header_Status_t* tmsrp_header_Status_create(short _namespace, short code, const char* reason) +{ + return tsk_object_new(TMSRP_HEADER_STATUS_VA_ARGS(_namespace, code, reason)); +} + +tmsrp_header_Status_t* tmsrp_header_Status_create_null() +{ + return tmsrp_header_Status_create(0, 200, tsk_null); +} + + +int tmsrp_header_Status_tostring(const tmsrp_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tmsrp_header_Status_t *Status = (const tmsrp_header_Status_t *)header; + + // Status: 000 200 OK + return tsk_buffer_append_2(output, "%.3hi %.3hi%s%s", + Status->_namespace, + Status->code, + Status->reason ? " " : "", + Status->reason ? Status->reason : "" + ); + } + + return -1; +} + +tmsrp_header_Status_t *tmsrp_header_Status_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tmsrp_header_Status_t *hdr_Status = tmsrp_header_Status_create_null(); + + const char *tag_start = tsk_null; + + TSK_RAGEL_DISABLE_WARNINGS_BEGIN() + +/* #line 84 "./src/headers/tmsrp_header_Status.c" */ +static const char _tmsrp_machine_parser_header_Status_actions[] = { + 0, 1, 0, 1, 1, 1, 2, 1, + 3, 2, 0, 3 +}; + +static const char _tmsrp_machine_parser_header_Status_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 12, + 13, 14, 16, 18, 20, 21, 23, 25, + 27, 28, 30, 30, 36 +}; + +static const char _tmsrp_machine_parser_header_Status_trans_keys[] = { + 83, 115, 84, 116, 65, 97, 84, 116, + 85, 117, 83, 115, 58, 32, 48, 57, + 48, 57, 48, 57, 32, 48, 57, 48, + 57, 48, 57, 10, 13, 32, 13, 127, + 0, 8, 10, 31, 13, 127, 0, 8, + 10, 31, 0 +}; + +static const char _tmsrp_machine_parser_header_Status_single_lengths[] = { + 0, 2, 2, 2, 2, 2, 2, 1, + 1, 0, 0, 0, 1, 0, 0, 0, + 1, 2, 0, 2, 2 +}; + +static const char _tmsrp_machine_parser_header_Status_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 1, 0, 1, 1, 1, + 0, 0, 0, 2, 2 +}; + +static const char _tmsrp_machine_parser_header_Status_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 15, 18, + 20, 22, 24, 26, 28, 30, 32, 34, + 36, 38, 41, 42, 47 +}; + +static const char _tmsrp_machine_parser_header_Status_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 5, 5, 1, 6, + 6, 1, 7, 1, 8, 1, 9, 1, + 10, 1, 11, 1, 12, 1, 13, 1, + 14, 1, 15, 1, 16, 1, 17, 18, + 1, 1, 20, 1, 1, 1, 19, 22, + 1, 1, 1, 21, 0 +}; + +static const char _tmsrp_machine_parser_header_Status_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 17, + 18, 16, 19, 20, 16, 20, 16 +}; + +static const char _tmsrp_machine_parser_header_Status_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 3, 1, 0, 0, + 0, 5, 5, 1, 9, 0, 7 +}; + +static const char _tmsrp_machine_parser_header_Status_eof_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 0, 9, 7 +}; + +static const int tmsrp_machine_parser_header_Status_start = 1; +static const int tmsrp_machine_parser_header_Status_first_final = 17; +static const int tmsrp_machine_parser_header_Status_error = 0; + +static const int tmsrp_machine_parser_header_Status_en_main = 1; + + +/* #line 109 "./ragel/tmsrp_parser_header_Status.rl" */ + (void)(eof); + (void)(tmsrp_machine_parser_header_Status_first_final); + (void)(tmsrp_machine_parser_header_Status_error); + (void)(tmsrp_machine_parser_header_Status_en_main); + +/* #line 164 "./src/headers/tmsrp_header_Status.c" */ + { + cs = tmsrp_machine_parser_header_Status_start; + } + +/* #line 114 "./ragel/tmsrp_parser_header_Status.rl" */ + +/* #line 171 "./src/headers/tmsrp_header_Status.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 = _tmsrp_machine_parser_header_Status_trans_keys + _tmsrp_machine_parser_header_Status_key_offsets[cs]; + _trans = _tmsrp_machine_parser_header_Status_index_offsets[cs]; + + _klen = _tmsrp_machine_parser_header_Status_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 = _tmsrp_machine_parser_header_Status_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 = _tmsrp_machine_parser_header_Status_indicies[_trans]; + cs = _tmsrp_machine_parser_header_Status_trans_targs[_trans]; + + if ( _tmsrp_machine_parser_header_Status_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tmsrp_machine_parser_header_Status_actions + _tmsrp_machine_parser_header_Status_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 41 "./ragel/tmsrp_parser_header_Status.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 45 "./ragel/tmsrp_parser_header_Status.rl" */ + { + TSK_PARSER_SET_INT(hdr_Status->_namespace); + } + break; + case 2: +/* #line 49 "./ragel/tmsrp_parser_header_Status.rl" */ + { + TSK_PARSER_SET_INT(hdr_Status->code); + } + break; + case 3: +/* #line 53 "./ragel/tmsrp_parser_header_Status.rl" */ + { + TSK_PARSER_SET_STRING(hdr_Status->reason); + } + break; +/* #line 269 "./src/headers/tmsrp_header_Status.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + if ( p == eof ) + { + const char *__acts = _tmsrp_machine_parser_header_Status_actions + _tmsrp_machine_parser_header_Status_eof_actions[cs]; + unsigned int __nacts = (unsigned int) *__acts++; + while ( __nacts-- > 0 ) { + switch ( *__acts++ ) { + case 0: +/* #line 41 "./ragel/tmsrp_parser_header_Status.rl" */ + { + tag_start = p; + } + break; + case 2: +/* #line 49 "./ragel/tmsrp_parser_header_Status.rl" */ + { + TSK_PARSER_SET_INT(hdr_Status->code); + } + break; + case 3: +/* #line 53 "./ragel/tmsrp_parser_header_Status.rl" */ + { + TSK_PARSER_SET_STRING(hdr_Status->reason); + } + break; +/* #line 303 "./src/headers/tmsrp_header_Status.c" */ + } + } + } + + _out: {} + } + +/* #line 115 "./ragel/tmsrp_parser_header_Status.rl" */ + TSK_RAGEL_DISABLE_WARNINGS_END() + + if( cs < +/* #line 315 "./src/headers/tmsrp_header_Status.c" */ +17 +/* #line 117 "./ragel/tmsrp_parser_header_Status.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Status' header."); + TSK_OBJECT_SAFE_FREE(hdr_Status); + } + + return hdr_Status; +} + + + + + + + +//======================================================== +// Status header object definition +// + +static tsk_object_t* tmsrp_header_Status_ctor(tsk_object_t *self, va_list * app) +{ + tmsrp_header_Status_t *Status = self; + if(Status){ + TMSRP_HEADER(Status)->type = tmsrp_htype_Status; + TMSRP_HEADER(Status)->tostring = tmsrp_header_Status_tostring; +#if defined(__GNUC__) + Status->_namespace = (short)va_arg(*app, int); + Status->code = (short)va_arg(*app, int); +#else + Status->_namespace = va_arg(*app, short); + Status->code = va_arg(*app, short); +#endif + Status->reason = tsk_strdup( va_arg(*app, const char*) ); + } + else{ + TSK_DEBUG_ERROR("Failed to create new Status header."); + } + return self; +} + +static tsk_object_t* tmsrp_header_Status_dtor(tsk_object_t *self) +{ + tmsrp_header_Status_t *Status = self; + if(Status){ + TSK_FREE(Status->reason); + } + else{ + TSK_DEBUG_ERROR("Null Status header."); + } + + return self; +} + +static const tsk_object_def_t tmsrp_header_Status_def_s = +{ + sizeof(tmsrp_header_Status_t), + tmsrp_header_Status_ctor, + tmsrp_header_Status_dtor, + tsk_null +}; + +const tsk_object_def_t *tmsrp_header_Status_def_t = &tmsrp_header_Status_def_s; diff --git a/tinyMSRP/src/headers/tmsrp_header_Success-Report.c b/tinyMSRP/src/headers/tmsrp_header_Success-Report.c new file mode 100644 index 0000000..bb19c9e --- /dev/null +++ b/tinyMSRP/src/headers/tmsrp_header_Success-Report.c @@ -0,0 +1,349 @@ + +/* #line 1 "./ragel/tmsrp_parser_header_Success-Report.rl" */ +/* +* Copyright (C) 2009-2015 Mamadou DIOP. +* +* 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 tmsrp_header_Success_Report.c + * @brief MSRP 'Success-Report' header. + */ +#include "tinymsrp/headers/tmsrp_header_Success-Report.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_string.h" + +#include <string.h> + +/*********************************** +* Ragel state machine. +*/ + +/* #line 55 "./ragel/tmsrp_parser_header_Success-Report.rl" */ + + +tmsrp_header_Success_Report_t* tmsrp_header_Success_Report_create(tsk_bool_t isSuccess) +{ + return tsk_object_new(TMSRP_HEADER_SUCCESS_REPORT_VA_ARGS(isSuccess)); +} + +tmsrp_header_Success_Report_t* tmsrp_header_Success_Report_create_null() +{ + return tmsrp_header_Success_Report_create(tsk_false); +} + +int tmsrp_header_Success_Report_tostring(const tmsrp_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tmsrp_header_Success_Report_t *Success_Report = (const tmsrp_header_Success_Report_t *)header; + const char* value = Success_Report->yes ? "yes" : "no"; + return tsk_buffer_append(output, value, strlen(value)); + } + + return -1; +} + +tmsrp_header_Success_Report_t *tmsrp_header_Success_Report_parse(const char *data, tsk_size_t size) +{ + int cs = 0; + const char *p = data; + const char *pe = p + size; + const char *eof = pe; + tmsrp_header_Success_Report_t *hdr_Success_Report = tmsrp_header_Success_Report_create_null(); + + TSK_RAGEL_DISABLE_WARNINGS_BEGIN() + +/* #line 73 "./src/headers/tmsrp_header_Success-Report.c" */ +static const char _tmsrp_machine_parser_header_Success_Report_actions[] = { + 0, 1, 0, 1, 1 +}; + +static const char _tmsrp_machine_parser_header_Success_Report_key_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 12, + 14, 15, 17, 19, 21, 23, 25, 27, + 28, 29, 33, 35, 36, 38, 40, 41, + 41 +}; + +static const char _tmsrp_machine_parser_header_Success_Report_trans_keys[] = { + 83, 115, 85, 117, 67, 99, 67, 99, + 69, 101, 83, 115, 83, 115, 45, 82, + 114, 69, 101, 80, 112, 79, 111, 82, + 114, 84, 116, 58, 32, 78, 89, 110, + 121, 79, 111, 10, 69, 101, 83, 115, + 13, 13, 0 +}; + +static const char _tmsrp_machine_parser_header_Success_Report_single_lengths[] = { + 0, 2, 2, 2, 2, 2, 2, 2, + 1, 2, 2, 2, 2, 2, 2, 1, + 1, 4, 2, 1, 2, 2, 1, 0, + 1 +}; + +static const char _tmsrp_machine_parser_header_Success_Report_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 +}; + +static const char _tmsrp_machine_parser_header_Success_Report_index_offsets[] = { + 0, 0, 3, 6, 9, 12, 15, 18, + 21, 23, 26, 29, 32, 35, 38, 41, + 43, 45, 50, 53, 55, 58, 61, 63, + 64 +}; + +static const char _tmsrp_machine_parser_header_Success_Report_indicies[] = { + 0, 0, 1, 2, 2, 1, 3, 3, + 1, 4, 4, 1, 5, 5, 1, 6, + 6, 1, 7, 7, 1, 8, 1, 9, + 9, 1, 10, 10, 1, 11, 11, 1, + 12, 12, 1, 13, 13, 1, 14, 14, + 1, 15, 1, 16, 1, 17, 18, 17, + 18, 1, 19, 19, 1, 20, 1, 21, + 21, 1, 22, 22, 1, 23, 1, 1, + 24, 1, 0 +}; + +static const char _tmsrp_machine_parser_header_Success_Report_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 20, 22, 23, 21, 24, 19, + 19 +}; + +static const char _tmsrp_machine_parser_header_Success_Report_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, 3, + 1 +}; + +static const char _tmsrp_machine_parser_header_Success_Report_eof_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 3, 0, + 1 +}; + +static const int tmsrp_machine_parser_header_Success_Report_start = 1; +static const int tmsrp_machine_parser_header_Success_Report_first_final = 22; +static const int tmsrp_machine_parser_header_Success_Report_error = 0; + +static const int tmsrp_machine_parser_header_Success_Report_en_main = 1; + + +/* #line 88 "./ragel/tmsrp_parser_header_Success-Report.rl" */ + (void)(eof); + (void)(tmsrp_machine_parser_header_Success_Report_first_final); + (void)(tmsrp_machine_parser_header_Success_Report_error); + (void)(tmsrp_machine_parser_header_Success_Report_en_main); + +/* #line 161 "./src/headers/tmsrp_header_Success-Report.c" */ + { + cs = tmsrp_machine_parser_header_Success_Report_start; + } + +/* #line 93 "./ragel/tmsrp_parser_header_Success-Report.rl" */ + +/* #line 168 "./src/headers/tmsrp_header_Success-Report.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 = _tmsrp_machine_parser_header_Success_Report_trans_keys + _tmsrp_machine_parser_header_Success_Report_key_offsets[cs]; + _trans = _tmsrp_machine_parser_header_Success_Report_index_offsets[cs]; + + _klen = _tmsrp_machine_parser_header_Success_Report_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 = _tmsrp_machine_parser_header_Success_Report_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 = _tmsrp_machine_parser_header_Success_Report_indicies[_trans]; + cs = _tmsrp_machine_parser_header_Success_Report_trans_targs[_trans]; + + if ( _tmsrp_machine_parser_header_Success_Report_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tmsrp_machine_parser_header_Success_Report_actions + _tmsrp_machine_parser_header_Success_Report_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 41 "./ragel/tmsrp_parser_header_Success-Report.rl" */ + { + hdr_Success_Report->yes = 1; + } + break; + case 1: +/* #line 45 "./ragel/tmsrp_parser_header_Success-Report.rl" */ + { + hdr_Success_Report->yes = 0; + } + break; +/* #line 254 "./src/headers/tmsrp_header_Success-Report.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + if ( p == eof ) + { + const char *__acts = _tmsrp_machine_parser_header_Success_Report_actions + _tmsrp_machine_parser_header_Success_Report_eof_actions[cs]; + unsigned int __nacts = (unsigned int) *__acts++; + while ( __nacts-- > 0 ) { + switch ( *__acts++ ) { + case 0: +/* #line 41 "./ragel/tmsrp_parser_header_Success-Report.rl" */ + { + hdr_Success_Report->yes = 1; + } + break; + case 1: +/* #line 45 "./ragel/tmsrp_parser_header_Success-Report.rl" */ + { + hdr_Success_Report->yes = 0; + } + break; +/* #line 282 "./src/headers/tmsrp_header_Success-Report.c" */ + } + } + } + + _out: {} + } + +/* #line 94 "./ragel/tmsrp_parser_header_Success-Report.rl" */ + TSK_RAGEL_DISABLE_WARNINGS_END() + + if( cs < +/* #line 294 "./src/headers/tmsrp_header_Success-Report.c" */ +22 +/* #line 96 "./ragel/tmsrp_parser_header_Success-Report.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Success-Report' header."); + TSK_OBJECT_SAFE_FREE(hdr_Success_Report); + } + + return hdr_Success_Report; +} + + + + + + + +//======================================================== +// Success_Report header object definition +// + +static tsk_object_t* tmsrp_header_Success_Report_ctor(tsk_object_t *self, va_list * app) +{ + tmsrp_header_Success_Report_t *Success_Report = self; + if(Success_Report){ + TMSRP_HEADER(Success_Report)->type = tmsrp_htype_Success_Report; + TMSRP_HEADER(Success_Report)->tostring = tmsrp_header_Success_Report_tostring; + + Success_Report->yes = va_arg(*app, tsk_bool_t) ? 1 : 0; + } + else{ + TSK_DEBUG_ERROR("Failed to create new Success-Report header."); + } + return self; +} + +static tsk_object_t* tmsrp_header_Success_Report_dtor(tsk_object_t *self) +{ + tmsrp_header_Success_Report_t *Success_Report = self; + if(Success_Report){ + } + else{ + TSK_DEBUG_ERROR("Null Success-Report header."); + } + + return self; +} + +static const tsk_object_def_t tmsrp_header_Success_Report_def_s = +{ + sizeof(tmsrp_header_Success_Report_t), + tmsrp_header_Success_Report_ctor, + tmsrp_header_Success_Report_dtor, + tsk_null +}; + +const tsk_object_def_t *tmsrp_header_Success_Report_def_t = &tmsrp_header_Success_Report_def_s; diff --git a/tinyMSRP/src/headers/tmsrp_header_To-Path.c b/tinyMSRP/src/headers/tmsrp_header_To-Path.c new file mode 100644 index 0000000..3346311 --- /dev/null +++ b/tinyMSRP/src/headers/tmsrp_header_To-Path.c @@ -0,0 +1,383 @@ + +/* #line 1 "./ragel/tmsrp_parser_header_To-Path.rl" */ +/* +* Copyright (C) 2009-2015 Mamadou DIOP. +* +* 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 tmsrp_header_To_Path.c + * @brief MSRP "To-Path" header. + */ +#include "tinymsrp/headers/tmsrp_header_To-Path.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_string.h" + +#include <string.h> + +/*********************************** +* Ragel state machine. +*/ + +/* #line 69 "./ragel/tmsrp_parser_header_To-Path.rl" */ + + +tmsrp_header_To_Path_t* tmsrp_header_To_Path_create(const tmsrp_uri_t* uri) +{ + return tsk_object_new(TMSRP_HEADER_TO_PATH_VA_ARGS(uri)); +} + +tmsrp_header_To_Path_t* tmsrp_header_To_Path_create_null() +{ + return tmsrp_header_To_Path_create(tsk_null); +} + +int tmsrp_header_To_Path_tostring(const tmsrp_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tmsrp_header_To_Path_t *To_Path = (const tmsrp_header_To_Path_t *)header; + const tsk_list_item_t *item; + + if(To_Path->uri){ + tmsrp_uri_serialize(To_Path->uri, output); + } + tsk_list_foreach(item, To_Path->otherURIs){ + tsk_buffer_append(output, " ", 1); + tmsrp_uri_serialize(TMSRP_URI(item->data), output); + } + } + + return -1; +} + +tmsrp_header_To_Path_t *tmsrp_header_To_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; + tmsrp_header_To_Path_t *header = tmsrp_header_To_Path_create_null(); + + const char *tag_start = tsk_null; + + TSK_RAGEL_DISABLE_WARNINGS_BEGIN() + +/* #line 82 "./src/headers/tmsrp_header_To-Path.c" */ +static const char _tmsrp_machine_parser_header_To_Path_actions[] = { + 0, 1, 0, 1, 1, 2, 0, 1 + +}; + +static const char _tmsrp_machine_parser_header_To_Path_key_offsets[] = { + 0, 0, 2, 4, 5, 7, 9, 11, + 13, 14, 15, 16, 18, 20 +}; + +static const char _tmsrp_machine_parser_header_To_Path_trans_keys[] = { + 84, 116, 79, 111, 45, 80, 112, 65, + 97, 84, 116, 72, 104, 58, 32, 10, + 13, 32, 13, 32, 0 +}; + +static const char _tmsrp_machine_parser_header_To_Path_single_lengths[] = { + 0, 2, 2, 1, 2, 2, 2, 2, + 1, 1, 1, 2, 2, 0 +}; + +static const char _tmsrp_machine_parser_header_To_Path_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0 +}; + +static const char _tmsrp_machine_parser_header_To_Path_index_offsets[] = { + 0, 0, 3, 6, 8, 11, 14, 17, + 20, 22, 24, 26, 29, 32 +}; + +static const char _tmsrp_machine_parser_header_To_Path_trans_targs[] = { + 2, 2, 0, 3, 3, 0, 4, 0, + 5, 5, 0, 6, 6, 0, 7, 7, + 0, 8, 8, 0, 9, 0, 11, 0, + 13, 0, 10, 11, 12, 10, 11, 12, + 0, 0 +}; + +static const char _tmsrp_machine_parser_header_To_Path_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, 5, 5, 1, 3, 3, 0, + 0, 0 +}; + +static const char _tmsrp_machine_parser_header_To_Path_eof_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 5, 3, 0 +}; + +static const int tmsrp_machine_parser_header_To_Path_start = 1; +static const int tmsrp_machine_parser_header_To_Path_first_final = 11; +static const int tmsrp_machine_parser_header_To_Path_error = 0; + +static const int tmsrp_machine_parser_header_To_Path_en_main = 1; + + +/* #line 111 "./ragel/tmsrp_parser_header_To-Path.rl" */ + (void)(eof); + (void)(tmsrp_machine_parser_header_To_Path_first_final); + (void)(tmsrp_machine_parser_header_To_Path_error); + (void)(tmsrp_machine_parser_header_To_Path_en_main); + +/* #line 148 "./src/headers/tmsrp_header_To-Path.c" */ + { + cs = tmsrp_machine_parser_header_To_Path_start; + } + +/* #line 116 "./ragel/tmsrp_parser_header_To-Path.rl" */ + +/* #line 155 "./src/headers/tmsrp_header_To-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 = _tmsrp_machine_parser_header_To_Path_trans_keys + _tmsrp_machine_parser_header_To_Path_key_offsets[cs]; + _trans = _tmsrp_machine_parser_header_To_Path_index_offsets[cs]; + + _klen = _tmsrp_machine_parser_header_To_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 = _tmsrp_machine_parser_header_To_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: + cs = _tmsrp_machine_parser_header_To_Path_trans_targs[_trans]; + + if ( _tmsrp_machine_parser_header_To_Path_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tmsrp_machine_parser_header_To_Path_actions + _tmsrp_machine_parser_header_To_Path_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 41 "./ragel/tmsrp_parser_header_To-Path.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 45 "./ragel/tmsrp_parser_header_To-Path.rl" */ + { + int len = (int)(p - tag_start); + tmsrp_uri_t* uri; + if((uri = tmsrp_uri_parse(tag_start, (tsk_size_t)len))){ + if(!header->uri){ + header->uri = uri; + } + else{ + if(!header->otherURIs){ + header->otherURIs = tsk_list_create(); + } + tsk_list_push_back_data(header->otherURIs, ((void**) &uri)); + } + } + } + break; +/* #line 252 "./src/headers/tmsrp_header_To-Path.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + if ( p == eof ) + { + const char *__acts = _tmsrp_machine_parser_header_To_Path_actions + _tmsrp_machine_parser_header_To_Path_eof_actions[cs]; + unsigned int __nacts = (unsigned int) *__acts++; + while ( __nacts-- > 0 ) { + switch ( *__acts++ ) { + case 0: +/* #line 41 "./ragel/tmsrp_parser_header_To-Path.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 45 "./ragel/tmsrp_parser_header_To-Path.rl" */ + { + int len = (int)(p - tag_start); + tmsrp_uri_t* uri; + if((uri = tmsrp_uri_parse(tag_start, (tsk_size_t)len))){ + if(!header->uri){ + header->uri = uri; + } + else{ + if(!header->otherURIs){ + header->otherURIs = tsk_list_create(); + } + tsk_list_push_back_data(header->otherURIs, ((void**) &uri)); + } + } + } + break; +/* #line 292 "./src/headers/tmsrp_header_To-Path.c" */ + } + } + } + + _out: {} + } + +/* #line 117 "./ragel/tmsrp_parser_header_To-Path.rl" */ + TSK_RAGEL_DISABLE_WARNINGS_END() + + if( cs < +/* #line 304 "./src/headers/tmsrp_header_To-Path.c" */ +11 +/* #line 119 "./ragel/tmsrp_parser_header_To-Path.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'To-Path' header."); + TSK_OBJECT_SAFE_FREE(header); + } + + return header; +} + +tmsrp_header_To_Path_t *tmsrp_header_To_Path_clone(const tmsrp_header_To_Path_t* To_Path) +{ + tmsrp_header_To_Path_t* clone = tsk_null; + + if(!To_Path){ + goto bail; + } + + clone = tmsrp_header_To_Path_create_null(); + clone->uri = tmsrp_uri_clone(To_Path->uri); + if(To_Path->otherURIs){ + tsk_list_item_t *item; + clone->otherURIs = tsk_list_create(); + + tsk_list_foreach(item, To_Path->otherURIs){ + tmsrp_uri_t *uri = tmsrp_uri_clone(TMSRP_URI(item->data)); + tsk_list_push_back_data(clone->otherURIs, (void**)&uri); + } + } + +bail: + return clone; +} + + + + + +//======================================================== +// To_Path header object definition +// + +static tsk_object_t* tmsrp_header_To_Path_ctor(tsk_object_t *self, va_list * app) +{ + tmsrp_header_To_Path_t *To_Path = self; + if(To_Path){ + TMSRP_HEADER(To_Path)->type = tmsrp_htype_To_Path; + TMSRP_HEADER(To_Path)->tostring = tmsrp_header_To_Path_tostring; + + To_Path->uri = tsk_object_ref((void*)va_arg(*app, const tmsrp_uri_t*)); + } + else{ + TSK_DEBUG_ERROR("Failed to create new To-Path header."); + } + return self; +} + +static tsk_object_t* tmsrp_header_To_Path_dtor(tsk_object_t *self) +{ + tmsrp_header_To_Path_t *To_Path = self; + if(To_Path){ + TSK_OBJECT_SAFE_FREE(To_Path->uri); + TSK_OBJECT_SAFE_FREE(To_Path->otherURIs); + } + else{ + TSK_DEBUG_ERROR("Null To-Path header."); + } + + return self; +} + +static const tsk_object_def_t tmsrp_header_To_Path_def_s = +{ + sizeof(tmsrp_header_To_Path_t), + tmsrp_header_To_Path_ctor, + tmsrp_header_To_Path_dtor, + tsk_null +}; + +const tsk_object_def_t *tmsrp_header_To_Path_def_t = &tmsrp_header_To_Path_def_s; diff --git a/tinyMSRP/src/headers/tmsrp_header_Use-Path.c b/tinyMSRP/src/headers/tmsrp_header_Use-Path.c new file mode 100644 index 0000000..8415867 --- /dev/null +++ b/tinyMSRP/src/headers/tmsrp_header_Use-Path.c @@ -0,0 +1,367 @@ + +/* #line 1 "./ragel/tmsrp_parser_header_Use-Path.rl" */ +/* +* Copyright (C) 2009-2015 Mamadou DIOP. +* +* 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 tmsrp_header_Use_Path.c + * @brief MSRP "Use-Path" header. + */ +#include "tinymsrp/headers/tmsrp_header_Use-Path.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_string.h" + +#include <string.h> + +/*********************************** +* Ragel state machine. +*/ + +/* #line 69 "./ragel/tmsrp_parser_header_Use-Path.rl" */ + + + + +tmsrp_header_Use_Path_t* tmsrp_header_Use_Path_create(const tmsrp_uri_t* uri) +{ + return tsk_object_new(TMSRP_HEADER_USE_PATH_VA_ARGS(uri)); +} + +tmsrp_header_Use_Path_t* tmsrp_header_Use_Path_create_null() +{ + return tmsrp_header_Use_Path_create(tsk_null); +} + +int tmsrp_header_Use_Path_tostring(const tmsrp_header_t* header, tsk_buffer_t* output) +{ + if(header){ + const tmsrp_header_Use_Path_t *Use_Path = (const tmsrp_header_Use_Path_t *)header; + const tsk_list_item_t *item; + + if(Use_Path->uri){ + tmsrp_uri_serialize(Use_Path->uri, output); + } + tsk_list_foreach(item, Use_Path->otherURIs){ + tsk_buffer_append(output, " ", 1); + tmsrp_uri_serialize(TMSRP_URI(item->data), output); + } + } + + return -1; +} + +tmsrp_header_Use_Path_t *tmsrp_header_Use_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; + tmsrp_header_Use_Path_t *header = tmsrp_header_Use_Path_create_null(); + + const char *tag_start = tsk_null; + + TSK_RAGEL_DISABLE_WARNINGS_BEGIN() + +/* #line 84 "./src/headers/tmsrp_header_Use-Path.c" */ +static const char _tmsrp_machine_parser_header_Use_Path_actions[] = { + 0, 1, 0, 1, 1, 2, 0, 1 + +}; + +static const char _tmsrp_machine_parser_header_Use_Path_key_offsets[] = { + 0, 0, 2, 4, 6, 7, 9, 11, + 13, 15, 16, 17, 18, 20, 22 +}; + +static const char _tmsrp_machine_parser_header_Use_Path_trans_keys[] = { + 85, 117, 83, 115, 69, 101, 45, 80, + 112, 65, 97, 84, 116, 72, 104, 58, + 32, 10, 13, 32, 13, 32, 0 +}; + +static const char _tmsrp_machine_parser_header_Use_Path_single_lengths[] = { + 0, 2, 2, 2, 1, 2, 2, 2, + 2, 1, 1, 1, 2, 2, 0 +}; + +static const char _tmsrp_machine_parser_header_Use_Path_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 +}; + +static const char _tmsrp_machine_parser_header_Use_Path_index_offsets[] = { + 0, 0, 3, 6, 9, 11, 14, 17, + 20, 23, 25, 27, 29, 32, 35 +}; + +static const char _tmsrp_machine_parser_header_Use_Path_trans_targs[] = { + 2, 2, 0, 3, 3, 0, 4, 4, + 0, 5, 0, 6, 6, 0, 7, 7, + 0, 8, 8, 0, 9, 9, 0, 10, + 0, 12, 0, 14, 0, 11, 12, 13, + 11, 12, 13, 0, 0 +}; + +static const char _tmsrp_machine_parser_header_Use_Path_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, 5, 5, 1, + 3, 3, 0, 0, 0 +}; + +static const char _tmsrp_machine_parser_header_Use_Path_eof_actions[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 5, 3, 0 +}; + +static const int tmsrp_machine_parser_header_Use_Path_start = 1; +static const int tmsrp_machine_parser_header_Use_Path_first_final = 12; +static const int tmsrp_machine_parser_header_Use_Path_error = 0; + +static const int tmsrp_machine_parser_header_Use_Path_en_main = 1; + + +/* #line 113 "./ragel/tmsrp_parser_header_Use-Path.rl" */ + (void)(eof); + (void)(tmsrp_machine_parser_header_Use_Path_first_final); + (void)(tmsrp_machine_parser_header_Use_Path_error); + (void)(tmsrp_machine_parser_header_Use_Path_en_main); + +/* #line 150 "./src/headers/tmsrp_header_Use-Path.c" */ + { + cs = tmsrp_machine_parser_header_Use_Path_start; + } + +/* #line 118 "./ragel/tmsrp_parser_header_Use-Path.rl" */ + +/* #line 157 "./src/headers/tmsrp_header_Use-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 = _tmsrp_machine_parser_header_Use_Path_trans_keys + _tmsrp_machine_parser_header_Use_Path_key_offsets[cs]; + _trans = _tmsrp_machine_parser_header_Use_Path_index_offsets[cs]; + + _klen = _tmsrp_machine_parser_header_Use_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 = _tmsrp_machine_parser_header_Use_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: + cs = _tmsrp_machine_parser_header_Use_Path_trans_targs[_trans]; + + if ( _tmsrp_machine_parser_header_Use_Path_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tmsrp_machine_parser_header_Use_Path_actions + _tmsrp_machine_parser_header_Use_Path_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 41 "./ragel/tmsrp_parser_header_Use-Path.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 45 "./ragel/tmsrp_parser_header_Use-Path.rl" */ + { + int len = (int)(p - tag_start); + tmsrp_uri_t* uri; + if((uri = tmsrp_uri_parse(tag_start, (tsk_size_t)len))){ + if(!header->uri){ + header->uri = uri; + } + else{ + if(!header->otherURIs){ + header->otherURIs = tsk_list_create(); + } + tsk_list_push_back_data(header->otherURIs, ((void**) &uri)); + } + } + } + break; +/* #line 254 "./src/headers/tmsrp_header_Use-Path.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + if ( p == eof ) + { + const char *__acts = _tmsrp_machine_parser_header_Use_Path_actions + _tmsrp_machine_parser_header_Use_Path_eof_actions[cs]; + unsigned int __nacts = (unsigned int) *__acts++; + while ( __nacts-- > 0 ) { + switch ( *__acts++ ) { + case 0: +/* #line 41 "./ragel/tmsrp_parser_header_Use-Path.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 45 "./ragel/tmsrp_parser_header_Use-Path.rl" */ + { + int len = (int)(p - tag_start); + tmsrp_uri_t* uri; + if((uri = tmsrp_uri_parse(tag_start, (tsk_size_t)len))){ + if(!header->uri){ + header->uri = uri; + } + else{ + if(!header->otherURIs){ + header->otherURIs = tsk_list_create(); + } + tsk_list_push_back_data(header->otherURIs, ((void**) &uri)); + } + } + } + break; +/* #line 294 "./src/headers/tmsrp_header_Use-Path.c" */ + } + } + } + + _out: {} + } + +/* #line 119 "./ragel/tmsrp_parser_header_Use-Path.rl" */ + TSK_RAGEL_DISABLE_WARNINGS_END() + + if( cs < +/* #line 306 "./src/headers/tmsrp_header_Use-Path.c" */ +12 +/* #line 121 "./ragel/tmsrp_parser_header_Use-Path.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse 'Use-Path' header."); + TSK_OBJECT_SAFE_FREE(header); + } + + return header; +} + + + + + + + +//======================================================== +// Use_Path header object definition +// + +static tsk_object_t* tmsrp_header_Use_Path_ctor(tsk_object_t *self, va_list * app) +{ + tmsrp_header_Use_Path_t *Use_Path = self; + if(Use_Path){ + const tmsrp_uri_t* uri = va_arg(*app, const tmsrp_uri_t*); + + TMSRP_HEADER(Use_Path)->type = tmsrp_htype_Use_Path; + TMSRP_HEADER(Use_Path)->tostring = tmsrp_header_Use_Path_tostring; + + if(uri){ + Use_Path->uri = tsk_object_ref((void*)uri); + } + } + else{ + TSK_DEBUG_ERROR("Failed to create new Use-Path header."); + } + return self; +} + +static tsk_object_t* tmsrp_header_Use_Path_dtor(tsk_object_t *self) +{ + tmsrp_header_Use_Path_t *Use_Path = self; + if(Use_Path){ + TSK_OBJECT_SAFE_FREE(Use_Path->uri); + TSK_OBJECT_SAFE_FREE(Use_Path->otherURIs); + } + else{ + TSK_DEBUG_ERROR("Null Use-Path header."); + } + + return self; +} + +static const tsk_object_def_t tmsrp_header_Use_Path_def_s = +{ + sizeof(tmsrp_header_Use_Path_t), + tmsrp_header_Use_Path_ctor, + tmsrp_header_Use_Path_dtor, + tsk_null +}; + +const tsk_object_def_t *tmsrp_header_Use_Path_def_t = &tmsrp_header_Use_Path_def_s; diff --git a/tinyMSRP/src/headers/tmsrp_header_WWW-Authenticate.c b/tinyMSRP/src/headers/tmsrp_header_WWW-Authenticate.c new file mode 100644 index 0000000..90ec0f7 --- /dev/null +++ b/tinyMSRP/src/headers/tmsrp_header_WWW-Authenticate.c @@ -0,0 +1,163 @@ + +/* #line 1 "tmsrp_parser_header_WWW_Authenticate.rl" */ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tmsrp_header_WWW_Authenticate.c + * @brief MSRP WWW-Authenticate header. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#include "tinymsrp/headers/tmsrp_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> + +tmsrp_header_WWW_Authenticate_t* thttp_header_WWW_Authenticate_create() +{ + return tsk_object_new(tmsrp_header_WWW_Authenticate_def_t); +} + +int tmsrp_header_WWW_Authenticate_tostring(const tmsrp_header_t* header, tsk_buffer_t* output) +{ + if(header) + { + const tmsrp_header_WWW_Authenticate_t *WWW_Authenticate = (const tmsrp_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; +} + +tmsrp_header_WWW_Authenticate_t *tmsrp_header_WWW_Authenticate_parse(const char *data, tsk_size_t size) +{ + tmsrp_header_WWW_Authenticate_t *msrp_hdr = 0; + thttp_header_WWW_Authenticate_t* http_hdr; + + if((http_hdr = thttp_header_WWW_Authenticate_parse(data, size))) + { + msrp_hdr = thttp_header_WWW_Authenticate_create(); + + msrp_hdr->scheme = tsk_strdup(http_hdr->scheme); + msrp_hdr->realm = tsk_strdup(http_hdr->realm); + msrp_hdr->domain = tsk_strdup(http_hdr->domain); + msrp_hdr->nonce = tsk_strdup(http_hdr->nonce); + msrp_hdr->opaque = tsk_strdup(http_hdr->opaque); + msrp_hdr->algorithm = tsk_strdup(http_hdr->algorithm); + msrp_hdr->qop = tsk_strdup(http_hdr->qop); + msrp_hdr->stale = http_hdr->stale; + + msrp_hdr->params = tsk_object_ref(THTTP_HEADER(http_hdr)->params); + + TSK_OBJECT_SAFE_FREE(http_hdr); + } + + return msrp_hdr; +} + + + + + + + +//======================================================== +// WWW_Authenticate header object definition +// + +static tsk_object_t* tmsrp_header_WWW_Authenticate_ctor(tsk_object_t *self, va_list * app) +{ + tmsrp_header_WWW_Authenticate_t *WWW_Authenticate = self; + if(WWW_Authenticate){ + TMSRP_HEADER(WWW_Authenticate)->type = tmsrp_htype_WWW_Authenticate; + TMSRP_HEADER(WWW_Authenticate)->tostring = tmsrp_header_WWW_Authenticate_tostring; + } + else{ + TSK_DEBUG_ERROR("Failed to create new WWW_Authenticate header."); + } + return self; +} + +static tsk_object_t* tmsrp_header_WWW_Authenticate_dtor(tsk_object_t *self) +{ + tmsrp_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(WWW_Authenticate->params); + } + else{ + TSK_DEBUG_ERROR("Null WWW-Authenticate header."); + } + + return self; +} + +static const tsk_object_def_t tmsrp_header_WWW_Authenticate_def_s = +{ + sizeof(tmsrp_header_WWW_Authenticate_t), + tmsrp_header_WWW_Authenticate_ctor, + tmsrp_header_WWW_Authenticate_dtor, + tsk_null +}; +const tsk_object_def_t *tmsrp_header_WWW_Authenticate_def_t = &tmsrp_header_WWW_Authenticate_def_s; diff --git a/tinyMSRP/src/parsers/tmsrp_parser_message.c b/tinyMSRP/src/parsers/tmsrp_parser_message.c new file mode 100644 index 0000000..f11344b --- /dev/null +++ b/tinyMSRP/src/parsers/tmsrp_parser_message.c @@ -0,0 +1,3810 @@ + +/* #line 1 "./ragel/tmsrp_parser_message.rl" */ +/* +* Copyright (C) 2009-2015 Mamadou DIOP. +* +* 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 tmsrp_machine_message.rl + * @brief Ragel file. + */ +#include "tinymsrp/parsers/tmsrp_parser_message.h" + +#include "tinymsrp/headers/tmsrp_header_Dummy.h" +#include "tinymsrp/headers/tmsrp_header_Expires.h" +#include "tinymsrp/headers/tmsrp_header_Max-Expires.h" +#include "tinymsrp/headers/tmsrp_header_Min-Expires.h" +#include "tinymsrp/headers/tmsrp_header_Use-Path.h" +#include "tinymsrp/headers/tmsrp_header_WWW-Authenticate.h" + +#include "tsk_string.h" +#include "tsk_memory.h" +#include "tsk_debug.h" + +static tsk_bool_t parse_payload(tmsrp_message_t* msrp_msg, const char* tag_start, const char** p, const char* pe, tsk_bool_t* payload_parsed); +static void set_payload(tmsrp_message_t* msrp_msg, const void* ptr, tsk_size_t len); + +#define TMSRP_MSG_PARSER_ADD_HEADER(name) \ + if((header = (tmsrp_header_t*)tmsrp_header_##name##_parse(tag_start, (p - tag_start)))){ \ + tmsrp_message_add_header(msrp_msg, header); \ + header = tsk_object_unref(header); \ + } + +/* #line 262 "./ragel/tmsrp_parser_message.rl" */ + + +TSK_RAGEL_DISABLE_WARNINGS_BEGIN() +/* Ragel data */ + +/* #line 54 "./src/parsers/tmsrp_parser_message.c" */ +static const char _tmsrp_machine_message_actions[] = { + 0, 1, 0, 1, 1, 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, 14, 1, + 15, 1, 16, 1, 17, 1, 18, 1, + 19, 1, 20, 1, 22, 1, 24, 1, + 25, 1, 26, 2, 0, 18, 2, 0, + 20, 2, 0, 21, 2, 1, 0, 2, + 1, 26, 2, 2, 0, 2, 2, 26, + 2, 3, 0, 2, 3, 26, 2, 4, + 0, 2, 4, 26, 2, 5, 0, 2, + 5, 26, 2, 6, 0, 2, 6, 26, + 2, 7, 0, 2, 7, 26, 2, 8, + 0, 2, 8, 26, 2, 9, 0, 2, + 9, 26, 2, 10, 0, 2, 10, 26, + 2, 11, 0, 2, 11, 26, 2, 12, + 0, 2, 12, 26, 2, 13, 0, 2, + 13, 26, 2, 14, 0, 2, 14, 26, + 2, 15, 0, 2, 15, 26, 2, 16, + 0, 2, 16, 26, 2, 23, 0, 3, + 0, 21, 22 +}; + +static const short _tmsrp_machine_message_cond_offsets[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 1, + 1, 1, 1, 2, 3, 4, 5, 6, + 7, 8, 11, 19, 27, 35, 45, 46, + 47, 57, 67, 77, 87, 97, 107, 117, + 127, 137, 147, 157, 167, 177, 187, 197, + 207, 217, 227, 237, 247, 257, 267, 277, + 287, 297, 307, 317, 320, 324, 335, 346, + 357, 368, 379, 390, 401, 412, 423, 434, + 445, 456, 467, 478, 489, 500, 511, 522, + 533, 544, 555, 566, 577, 588, 599, 610, + 621, 621, 621, 621, 621, 622, 622, 622, + 622, 622, 622, 622, 622, 622, 622, 622, + 622, 622, 622, 622, 622, 622, 622, 622, + 622, 622, 622, 622, 623, 623, 623, 623, + 623, 623, 623, 623, 623, 623, 623, 623, + 623, 623, 624, 624, 624, 624, 624, 624, + 624, 624, 624, 624, 624, 624, 624, 624, + 624, 624, 625, 625, 625, 625, 625, 625, + 625, 625, 625, 625, 625, 626, 626, 626, + 626, 626, 626, 626, 626, 626, 626, 626, + 626, 626, 626, 626, 626, 626, 626, 627, + 627, 627, 627, 627, 627, 627, 627, 627, + 627, 627, 627, 627, 627, 627, 628, 628, + 628, 628, 628, 628, 628, 628, 628, 628, + 629, 629, 629, 629, 629, 629, 629, 629, + 629, 629, 629, 630, 630, 630, 630, 630, + 630, 630, 630, 630, 630, 630, 630, 631, + 631, 631, 631, 631, 631, 631, 631, 631, + 631, 631, 631, 631, 631, 631, 631, 631, + 631, 631, 631, 632, 632, 632, 632, 632, + 632, 632, 632, 632, 632, 632, 632, 632, + 632, 632, 632, 632, 633, 633, 633, 633, + 633, 633, 633, 633, 633, 633, 633, 633, + 633, 634, 634, 634, 634, 634, 634, 634, + 634, 634, 634, 634, 634, 634, 634, 635, + 635, 635, 635, 635, 635, 635, 635, 635, + 635, 635, 635, 636, 636, 636, 636, 636, + 636, 636, 636, 636, 636, 636, 636, 636, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637, 637, 637, + 637, 637, 637, 637, 637, 637 +}; + +static const char _tmsrp_machine_message_cond_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 0, 0, 1, 1, 1, 1, 1, 1, + 1, 3, 8, 8, 8, 10, 1, 1, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 3, 4, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, + 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, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, 0, 0, + 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, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, 0, 0, + 0, 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, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 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 _tmsrp_machine_message_cond_keys[] = { + 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, + 48, 57, 65, 90, 97, 122, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 13, 13, 10, 10, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 35, 35, 36, 36, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 35, 35, 36, 36, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 35, 35, 36, 36, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 35, 35, 36, 36, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 35, 35, 36, 36, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 35, 35, 36, 36, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 35, 35, 36, 36, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 35, 35, 36, 36, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 35, 35, 36, 36, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 35, 35, 36, 36, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 35, 35, 36, 36, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 35, 35, 36, 36, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 35, 35, 36, 36, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 35, 35, 36, 36, 43, 43, + 13, 13, 35, 35, 36, 36, 43, 43, + 13, 13, 35, 35, 36, 36, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 13, 13, + 35, 35, 36, 36, 37, 37, 43, 43, + 45, 45, 46, 46, 48, 57, 61, 61, + 65, 90, 97, 122, 13, 13, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 13, 13, 35, 35, 36, 36, + 37, 37, 43, 43, 45, 45, 46, 46, + 48, 57, 61, 61, 65, 90, 97, 122, + 13, 13, 35, 35, 36, 36, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 13, 13, + 35, 35, 36, 36, 37, 37, 43, 43, + 45, 45, 46, 46, 48, 57, 61, 61, + 65, 90, 97, 122, 13, 13, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 13, 13, 35, 35, 36, 36, + 37, 37, 43, 43, 45, 45, 46, 46, + 48, 57, 61, 61, 65, 90, 97, 122, + 13, 13, 35, 35, 36, 36, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 13, 13, + 35, 35, 36, 36, 37, 37, 43, 43, + 45, 45, 46, 46, 48, 57, 61, 61, + 65, 90, 97, 122, 13, 13, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 13, 13, 35, 35, 36, 36, + 37, 37, 43, 43, 45, 45, 46, 46, + 48, 57, 61, 61, 65, 90, 97, 122, + 13, 13, 35, 35, 36, 36, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 13, 13, + 35, 35, 36, 36, 37, 37, 43, 43, + 45, 45, 46, 46, 48, 57, 61, 61, + 65, 90, 97, 122, 13, 13, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 13, 13, 35, 35, 36, 36, + 37, 37, 43, 43, 45, 45, 46, 46, + 48, 57, 61, 61, 65, 90, 97, 122, + 13, 13, 35, 35, 36, 36, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 13, 13, + 35, 35, 36, 36, 37, 37, 43, 43, + 45, 45, 46, 46, 48, 57, 61, 61, + 65, 90, 97, 122, 13, 13, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 13, 13, 35, 35, 36, 36, + 37, 37, 43, 43, 45, 45, 46, 46, + 48, 57, 61, 61, 65, 90, 97, 122, + 13, 13, 35, 35, 36, 36, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 13, 13, + 35, 35, 36, 36, 37, 37, 43, 43, + 45, 45, 46, 46, 48, 57, 61, 61, + 65, 90, 97, 122, 13, 13, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 13, 13, 35, 35, 36, 36, + 37, 37, 43, 43, 45, 45, 46, 46, + 48, 57, 61, 61, 65, 90, 97, 122, + 13, 13, 35, 35, 36, 36, 37, 37, + 43, 43, 45, 45, 46, 46, 48, 57, + 61, 61, 65, 90, 97, 122, 13, 13, + 35, 35, 36, 36, 37, 37, 43, 43, + 45, 45, 46, 46, 48, 57, 61, 61, + 65, 90, 97, 122, 13, 13, 35, 35, + 36, 36, 37, 37, 43, 43, 45, 45, + 46, 46, 48, 57, 61, 61, 65, 90, + 97, 122, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 0 +}; + +static const char _tmsrp_machine_message_cond_spaces[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 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 _tmsrp_machine_message_key_offsets[] = { + 0, 0, 1, 2, 3, 4, 5, 11, + 22, 33, 44, 56, 61, 62, 98, 99, + 100, 101, 103, 110, 111, 112, 113, 114, + 115, 116, 122, 133, 144, 155, 168, 169, + 170, 183, 196, 209, 222, 235, 248, 261, + 274, 287, 300, 313, 326, 339, 352, 365, + 378, 391, 404, 417, 430, 443, 456, 469, + 482, 495, 508, 521, 524, 528, 542, 556, + 570, 584, 598, 612, 626, 640, 654, 668, + 682, 696, 710, 724, 738, 752, 766, 780, + 794, 808, 822, 836, 850, 864, 878, 892, + 906, 921, 922, 928, 929, 965, 982, 999, + 1016, 1035, 1052, 1069, 1086, 1103, 1120, 1137, + 1154, 1171, 1188, 1203, 1220, 1237, 1254, 1271, + 1286, 1287, 1288, 1289, 1325, 1342, 1359, 1376, + 1391, 1408, 1425, 1442, 1459, 1476, 1491, 1492, + 1493, 1494, 1530, 1547, 1564, 1581, 1598, 1615, + 1632, 1647, 1664, 1681, 1698, 1715, 1730, 1731, + 1732, 1733, 1769, 1786, 1803, 1820, 1837, 1854, + 1871, 1886, 1887, 1888, 1889, 1925, 1944, 1961, + 1978, 1995, 2012, 2029, 2044, 2061, 2078, 2095, + 2112, 2129, 2146, 2161, 2162, 2163, 2164, 2200, + 2221, 2238, 2253, 2270, 2287, 2304, 2321, 2338, + 2355, 2372, 2387, 2388, 2389, 2390, 2426, 2445, + 2462, 2479, 2496, 2513, 2528, 2529, 2530, 2531, + 2567, 2584, 2599, 2616, 2633, 2650, 2667, 2682, + 2683, 2684, 2685, 2721, 2738, 2755, 2770, 2787, + 2804, 2821, 2838, 2853, 2854, 2855, 2856, 2892, + 2909, 2926, 2941, 2958, 2975, 2992, 3009, 3026, + 3043, 3060, 3077, 3094, 3111, 3128, 3145, 3160, + 3161, 3162, 3163, 3199, 3216, 3233, 3250, 3267, + 3284, 3299, 3316, 3333, 3350, 3367, 3384, 3401, + 3416, 3417, 3418, 3419, 3455, 3472, 3489, 3506, + 3523, 3540, 3555, 3572, 3589, 3604, 3605, 3606, + 3607, 3643, 3660, 3675, 3692, 3709, 3726, 3743, + 3760, 3777, 3794, 3809, 3810, 3811, 3812, 3848, + 3865, 3882, 3897, 3914, 3931, 3948, 3965, 3980, + 3981, 3982, 3983, 4019, 4036, 4053, 4070, 4087, + 4104, 4121, 4138, 4155, 4170, 4171, 4172, 4173, + 4209, 4211, 4213, 4215, 4216, 4250, 4265, 4266, + 4272, 4273, 4307, 4322, 4337, 4352, 4367, 4382, + 4397, 4414, 4432, 4450, 4468, 4488, 4489, 4490, + 4510, 4530, 4550, 4570, 4590, 4610, 4630, 4650, + 4670, 4690, 4710, 4730, 4750, 4770, 4790, 4810, + 4830, 4850, 4870, 4890, 4910, 4930, 4950, 4970, + 4990, 5010, 5030, 5047, 5063, 5081, 5084, 5105, + 5118, 5122, 5143, 5156, 5170, 5191, 5204, 5218, + 5239, 5252, 5266, 5287, 5300, 5314, 5335, 5348, + 5362, 5383, 5396, 5410, 5431, 5444, 5458, 5479, + 5492, 5506, 5527, 5540, 5554, 5575, 5588, 5602, + 5623, 5636, 5650, 5671, 5684, 5698, 5719, 5732, + 5746, 5767, 5780, 5794, 5815, 5828, 5842, 5863, + 5876, 5890, 5911, 5924, 5938, 5959, 5972, 5986, + 6007, 6020, 6034, 6055, 6068, 6082, 6103, 6116, + 6130, 6151, 6164, 6178, 6199, 6212, 6226, 6247, + 6260, 6274, 6295, 6308, 6322, 6343, 6356, 6370, + 6383, 6397, 6408, 6419, 6436, 6453, 6470, 6489, + 6506, 6523, 6540, 6557, 6574, 6591, 6608, 6625, + 6642, 6657, 6674, 6691, 6708, 6725, 6740, 6741, + 6742, 6743, 6777, 6794, 6811, 6828, 6843, 6860, + 6877, 6894, 6911, 6928, 6943, 6944, 6945, 6946, + 6980, 6997, 7014, 7031, 7048, 7065, 7082, 7097, + 7114, 7131, 7148, 7165, 7180, 7181, 7182, 7183, + 7217, 7234, 7251, 7268, 7285, 7302, 7319, 7334, + 7335, 7336, 7337, 7371, 7390, 7407, 7424, 7441, + 7458, 7475, 7490, 7507, 7524, 7541, 7558, 7575, + 7592, 7607, 7608, 7609, 7610, 7644, 7665, 7682, + 7697, 7714, 7731, 7748, 7765, 7782, 7799, 7816, + 7831, 7832, 7833, 7834, 7868, 7887, 7904, 7921, + 7938, 7955, 7970, 7971, 7972, 7973, 8007, 8024, + 8039, 8056, 8073, 8090, 8107, 8122, 8123, 8124, + 8125, 8159, 8176, 8193, 8208, 8225, 8242, 8259, + 8276, 8291, 8292, 8293, 8294, 8328, 8345, 8362, + 8377, 8394, 8411, 8428, 8445, 8462, 8479, 8496, + 8513, 8530, 8547, 8564, 8581, 8596, 8597, 8598, + 8599, 8633, 8650, 8667, 8684, 8701, 8718, 8733, + 8750, 8767, 8784, 8801, 8818, 8835, 8850, 8851, + 8852, 8853, 8887, 8904, 8921, 8938, 8955, 8972, + 8987, 9004, 9021, 9036, 9037, 9038, 9039, 9073, + 9090, 9105, 9122, 9139, 9156, 9173, 9190, 9207, + 9224, 9239, 9240, 9241, 9242, 9276, 9293, 9310, + 9325, 9342, 9359, 9376, 9393, 9408, 9409, 9410, + 9411, 9445, 9462, 9479, 9496, 9513, 9530, 9547, + 9564, 9581, 9596, 9597, 9598, 9599, 9633, 9639, + 9645, 9648, 9660, 9672, 9684, 9696, 9708, 9720, + 9732, 9744, 9756, 9768, 9780, 9792, 9804, 9816, + 9828, 9840, 9852, 9864, 9876, 9888, 9900, 9912, + 9924, 9936, 9948, 9960, 9972, 9973 +}; + +static const short _tmsrp_machine_message_trans_keys[] = { + 77, 83, 82, 80, 32, 48, 57, 65, + 90, 97, 122, 37, 43, 61, 45, 46, + 48, 57, 65, 90, 97, 122, 37, 43, + 61, 45, 46, 48, 57, 65, 90, 97, + 122, 37, 43, 61, 45, 46, 48, 57, + 65, 90, 97, 122, 32, 37, 43, 61, + 45, 46, 48, 57, 65, 90, 97, 122, + 13, 48, 57, 65, 90, 10, 13, 33, + 37, 39, 46, 65, 66, 67, 69, 70, + 77, 83, 84, 85, 87, 97, 98, 99, + 101, 102, 109, 115, 116, 117, 119, 126, + 301, 557, 42, 43, 48, 57, 68, 90, + 95, 122, 10, 13, 13, 10, 13, 13, + 301, 557, -128, 44, 46, 127, 557, 557, + 557, 557, 557, 557, 560, 569, 577, 602, + 609, 634, 549, 555, 573, 557, 558, 560, + 569, 577, 602, 609, 634, 549, 555, 573, + 557, 558, 560, 569, 577, 602, 609, 634, + 549, 555, 573, 557, 558, 560, 569, 577, + 602, 609, 634, 549, 555, 573, 547, 548, + 557, 558, 560, 569, 577, 602, 609, 634, + 525, 522, 549, 555, 573, 547, 548, 557, + 558, 560, 569, 577, 602, 609, 634, 549, + 555, 573, 547, 548, 557, 558, 560, 569, + 577, 602, 609, 634, 549, 555, 573, 547, + 548, 557, 558, 560, 569, 577, 602, 609, + 634, 549, 555, 573, 547, 548, 557, 558, + 560, 569, 577, 602, 609, 634, 549, 555, + 573, 547, 548, 557, 558, 560, 569, 577, + 602, 609, 634, 549, 555, 573, 547, 548, + 557, 558, 560, 569, 577, 602, 609, 634, + 549, 555, 573, 547, 548, 557, 558, 560, + 569, 577, 602, 609, 634, 549, 555, 573, + 547, 548, 557, 558, 560, 569, 577, 602, + 609, 634, 549, 555, 573, 547, 548, 557, + 558, 560, 569, 577, 602, 609, 634, 549, + 555, 573, 547, 548, 557, 558, 560, 569, + 577, 602, 609, 634, 549, 555, 573, 547, + 548, 557, 558, 560, 569, 577, 602, 609, + 634, 549, 555, 573, 547, 548, 557, 558, + 560, 569, 577, 602, 609, 634, 549, 555, + 573, 547, 548, 557, 558, 560, 569, 577, + 602, 609, 634, 549, 555, 573, 547, 548, + 557, 558, 560, 569, 577, 602, 609, 634, + 549, 555, 573, 547, 548, 557, 558, 560, + 569, 577, 602, 609, 634, 549, 555, 573, + 547, 548, 557, 558, 560, 569, 577, 602, + 609, 634, 549, 555, 573, 547, 548, 557, + 558, 560, 569, 577, 602, 609, 634, 549, + 555, 573, 547, 548, 557, 558, 560, 569, + 577, 602, 609, 634, 549, 555, 573, 547, + 548, 557, 558, 560, 569, 577, 602, 609, + 634, 549, 555, 573, 547, 548, 557, 558, + 560, 569, 577, 602, 609, 634, 549, 555, + 573, 547, 548, 557, 558, 560, 569, 577, + 602, 609, 634, 549, 555, 573, 547, 548, + 557, 558, 560, 569, 577, 602, 609, 634, + 549, 555, 573, 547, 548, 557, 558, 560, + 569, 577, 602, 609, 634, 549, 555, 573, + 547, 548, 557, 558, 560, 569, 577, 602, + 609, 634, 549, 555, 573, 547, 548, 557, + 558, 560, 569, 577, 602, 609, 634, 549, + 555, 573, 547, 548, 557, 558, 560, 569, + 577, 602, 609, 634, 549, 555, 573, 547, + 548, 557, 558, 560, 569, 577, 602, 609, + 634, 555, 547, 548, 525, 555, 547, 548, + 525, 549, 555, 573, 547, 548, 557, 558, + 560, 569, 577, 602, 609, 634, 525, 549, + 555, 573, 547, 548, 557, 558, 560, 569, + 577, 602, 609, 634, 525, 549, 555, 573, + 547, 548, 557, 558, 560, 569, 577, 602, + 609, 634, 525, 549, 555, 573, 547, 548, + 557, 558, 560, 569, 577, 602, 609, 634, + 525, 549, 555, 573, 547, 548, 557, 558, + 560, 569, 577, 602, 609, 634, 525, 549, + 555, 573, 547, 548, 557, 558, 560, 569, + 577, 602, 609, 634, 525, 549, 555, 573, + 547, 548, 557, 558, 560, 569, 577, 602, + 609, 634, 525, 549, 555, 573, 547, 548, + 557, 558, 560, 569, 577, 602, 609, 634, + 525, 549, 555, 573, 547, 548, 557, 558, + 560, 569, 577, 602, 609, 634, 525, 549, + 555, 573, 547, 548, 557, 558, 560, 569, + 577, 602, 609, 634, 525, 549, 555, 573, + 547, 548, 557, 558, 560, 569, 577, 602, + 609, 634, 525, 549, 555, 573, 547, 548, + 557, 558, 560, 569, 577, 602, 609, 634, + 525, 549, 555, 573, 547, 548, 557, 558, + 560, 569, 577, 602, 609, 634, 525, 549, + 555, 573, 547, 548, 557, 558, 560, 569, + 577, 602, 609, 634, 525, 549, 555, 573, + 547, 548, 557, 558, 560, 569, 577, 602, + 609, 634, 525, 549, 555, 573, 547, 548, + 557, 558, 560, 569, 577, 602, 609, 634, + 525, 549, 555, 573, 547, 548, 557, 558, + 560, 569, 577, 602, 609, 634, 525, 549, + 555, 573, 547, 548, 557, 558, 560, 569, + 577, 602, 609, 634, 525, 549, 555, 573, + 547, 548, 557, 558, 560, 569, 577, 602, + 609, 634, 525, 549, 555, 573, 547, 548, + 557, 558, 560, 569, 577, 602, 609, 634, + 525, 549, 555, 573, 547, 548, 557, 558, + 560, 569, 577, 602, 609, 634, 525, 549, + 555, 573, 547, 548, 557, 558, 560, 569, + 577, 602, 609, 634, 525, 549, 555, 573, + 547, 548, 557, 558, 560, 569, 577, 602, + 609, 634, 525, 549, 555, 573, 547, 548, + 557, 558, 560, 569, 577, 602, 609, 634, + 525, 549, 555, 573, 547, 548, 557, 558, + 560, 569, 577, 602, 609, 634, 525, 549, + 555, 573, 547, 548, 557, 558, 560, 569, + 577, 602, 609, 634, 525, 549, 555, 573, + 547, 548, 557, 558, 560, 569, 577, 602, + 609, 634, 33, 37, 39, 58, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 32, 13, 127, 0, 8, 10, 31, + 10, 13, 33, 37, 39, 46, 65, 66, + 67, 69, 70, 77, 83, 84, 85, 87, + 97, 98, 99, 101, 102, 109, 115, 116, + 117, 119, 126, 301, 557, 42, 43, 48, + 57, 68, 90, 95, 122, 33, 37, 39, + 58, 85, 117, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 84, 116, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 72, 104, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 69, 79, 101, 111, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 78, + 110, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 84, 116, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 73, 105, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 67, 99, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 65, 97, 126, 42, 43, + 45, 46, 48, 57, 66, 90, 95, 122, + 33, 37, 39, 58, 84, 116, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 73, 105, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 79, 111, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 78, + 110, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 45, + 46, 58, 126, 42, 43, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 73, + 105, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 78, 110, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 70, 102, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 79, 111, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 32, 13, + 10, 13, 33, 37, 39, 46, 65, 66, + 67, 69, 70, 77, 83, 84, 85, 87, + 97, 98, 99, 101, 102, 109, 115, 116, + 117, 119, 126, 301, 557, 42, 43, 48, + 57, 68, 90, 95, 122, 33, 37, 39, + 58, 89, 121, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 84, 116, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 69, 101, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 45, 46, 58, 126, 42, + 43, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 82, 114, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 65, 97, 126, 42, + 43, 45, 46, 48, 57, 66, 90, 95, + 122, 33, 37, 39, 58, 78, 110, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 71, 103, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 69, + 101, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 32, 13, 10, 13, 33, + 37, 39, 46, 65, 66, 67, 69, 70, + 77, 83, 84, 85, 87, 97, 98, 99, + 101, 102, 109, 115, 116, 117, 119, 126, + 301, 557, 42, 43, 48, 57, 68, 90, + 95, 122, 33, 37, 39, 58, 79, 111, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 78, + 110, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 84, 116, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 69, 101, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 78, 110, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 84, 116, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 45, 46, 58, 126, 42, + 43, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 84, 116, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 89, 121, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 80, 112, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 69, 101, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 32, 13, 10, 13, 33, 37, + 39, 46, 65, 66, 67, 69, 70, 77, + 83, 84, 85, 87, 97, 98, 99, 101, + 102, 109, 115, 116, 117, 119, 126, 301, + 557, 42, 43, 48, 57, 68, 90, 95, + 122, 33, 37, 39, 58, 88, 120, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 80, 112, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 73, + 105, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 82, 114, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 69, 101, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 83, 115, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 32, 13, + 10, 13, 33, 37, 39, 46, 65, 66, + 67, 69, 70, 77, 83, 84, 85, 87, + 97, 98, 99, 101, 102, 109, 115, 116, + 117, 119, 126, 301, 557, 42, 43, 48, + 57, 68, 90, 95, 122, 33, 37, 39, + 58, 65, 82, 97, 114, 126, 42, 43, + 45, 46, 48, 57, 66, 90, 95, 122, + 33, 37, 39, 58, 73, 105, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 76, 108, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 85, 117, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 82, + 114, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 69, 101, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 45, 46, 58, 126, 42, 43, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 82, 114, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 69, 101, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 80, 112, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 79, 111, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 82, 114, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 84, 116, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 32, 13, 10, 13, 33, 37, 39, + 46, 65, 66, 67, 69, 70, 77, 83, + 84, 85, 87, 97, 98, 99, 101, 102, + 109, 115, 116, 117, 119, 126, 301, 557, + 42, 43, 48, 57, 68, 90, 95, 122, + 33, 37, 39, 58, 65, 69, 73, 97, + 101, 105, 126, 42, 43, 45, 46, 48, + 57, 66, 90, 95, 122, 33, 37, 39, + 58, 88, 120, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 45, 46, 58, 126, 42, 43, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 69, 101, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 88, 120, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 80, 112, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 73, 105, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 82, 114, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 69, 101, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 83, + 115, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 32, 13, 10, 13, 33, + 37, 39, 46, 65, 66, 67, 69, 70, + 77, 83, 84, 85, 87, 97, 98, 99, + 101, 102, 109, 115, 116, 117, 119, 126, + 301, 557, 42, 43, 48, 57, 68, 90, + 95, 122, 33, 37, 39, 58, 84, 85, + 116, 117, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 65, 97, 126, 42, 43, 45, 46, + 48, 57, 66, 90, 95, 122, 33, 37, + 39, 58, 84, 116, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 85, 117, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 83, 115, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 32, 13, 10, 13, 33, 37, 39, 46, + 65, 66, 67, 69, 70, 77, 83, 84, + 85, 87, 97, 98, 99, 101, 102, 109, + 115, 116, 117, 119, 126, 301, 557, 42, + 43, 48, 57, 68, 90, 95, 122, 33, + 37, 39, 58, 79, 111, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 45, 46, 58, 126, 42, + 43, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 80, 112, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 65, 97, 126, 42, + 43, 45, 46, 48, 57, 66, 90, 95, + 122, 33, 37, 39, 58, 84, 116, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 72, 104, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 32, 13, 10, 13, 33, 37, + 39, 46, 65, 66, 67, 69, 70, 77, + 83, 84, 85, 87, 97, 98, 99, 101, + 102, 109, 115, 116, 117, 119, 126, 301, + 557, 42, 43, 48, 57, 68, 90, 95, + 122, 33, 37, 39, 58, 83, 115, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 69, 101, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 45, 46, + 58, 126, 42, 43, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 80, 112, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 65, + 97, 126, 42, 43, 45, 46, 48, 57, + 66, 90, 95, 122, 33, 37, 39, 58, + 84, 116, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 72, 104, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 32, 13, 10, + 13, 33, 37, 39, 46, 65, 66, 67, + 69, 70, 77, 83, 84, 85, 87, 97, + 98, 99, 101, 102, 109, 115, 116, 117, + 119, 126, 301, 557, 42, 43, 48, 57, + 68, 90, 95, 122, 33, 37, 39, 58, + 87, 119, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 87, 119, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 45, 46, 58, 126, 42, 43, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 65, 97, 126, 42, 43, 45, 46, + 48, 57, 66, 90, 95, 122, 33, 37, + 39, 58, 85, 117, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 84, 116, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 72, 104, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 69, 101, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 78, 110, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 84, + 116, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 73, 105, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 67, 99, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 65, 97, 126, 42, 43, 45, + 46, 48, 57, 66, 90, 95, 122, 33, + 37, 39, 58, 84, 116, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 69, 101, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 32, 13, 10, 13, 33, 37, 39, 46, + 65, 66, 67, 69, 70, 77, 83, 84, + 85, 87, 97, 98, 99, 101, 102, 109, + 115, 116, 117, 119, 126, 301, 557, 42, + 43, 48, 57, 68, 90, 95, 122, 33, + 37, 39, 58, 67, 99, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 67, 99, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 69, 101, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 83, 115, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 83, + 115, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 45, + 46, 58, 126, 42, 43, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 82, + 114, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 69, 101, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 80, 112, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 79, 111, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 82, 114, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 84, 116, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 32, 13, 10, 13, 33, 37, 39, 46, + 65, 66, 67, 69, 70, 77, 83, 84, + 85, 87, 97, 98, 99, 101, 102, 109, + 115, 116, 117, 119, 126, 301, 557, 42, + 43, 48, 57, 68, 90, 95, 122, 33, + 37, 39, 58, 83, 115, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 83, 115, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 65, 97, 126, + 42, 43, 45, 46, 48, 57, 66, 90, + 95, 122, 33, 37, 39, 58, 71, 103, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 69, + 101, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 45, + 46, 58, 126, 42, 43, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 73, + 105, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 68, 100, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 32, 13, 10, 13, + 33, 37, 39, 46, 65, 66, 67, 69, + 70, 77, 83, 84, 85, 87, 97, 98, + 99, 101, 102, 109, 115, 116, 117, 119, + 126, 301, 557, 42, 43, 48, 57, 68, + 90, 95, 122, 33, 37, 39, 58, 78, + 110, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 45, + 46, 58, 126, 42, 43, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 69, + 101, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 88, 120, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 80, 112, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 73, 105, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 82, 114, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 69, 101, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 83, 115, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 32, 13, 10, 13, 33, 37, 39, + 46, 65, 66, 67, 69, 70, 77, 83, + 84, 85, 87, 97, 98, 99, 101, 102, + 109, 115, 116, 117, 119, 126, 301, 557, + 42, 43, 48, 57, 68, 90, 95, 122, + 33, 37, 39, 58, 79, 111, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 77, 109, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 45, 46, 58, + 126, 42, 43, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 80, 112, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 65, 97, + 126, 42, 43, 45, 46, 48, 57, 66, + 90, 95, 122, 33, 37, 39, 58, 84, + 116, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 72, 104, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 32, 13, 10, 13, + 33, 37, 39, 46, 65, 66, 67, 69, + 70, 77, 83, 84, 85, 87, 97, 98, + 99, 101, 102, 109, 115, 116, 117, 119, + 126, 301, 557, 42, 43, 48, 57, 68, + 90, 95, 122, 33, 37, 39, 58, 82, + 114, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 73, 105, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 90, 122, 126, 42, 43, 45, 46, + 48, 57, 65, 89, 95, 121, 33, 37, + 39, 58, 65, 97, 126, 42, 43, 45, + 46, 48, 57, 66, 90, 95, 122, 33, + 37, 39, 58, 84, 116, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 73, 105, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 79, 111, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 78, 110, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 32, 13, 10, 13, 33, 37, + 39, 46, 65, 66, 67, 69, 70, 77, + 83, 84, 85, 87, 97, 98, 99, 101, + 102, 109, 115, 116, 117, 119, 126, 301, + 557, 42, 43, 48, 57, 68, 90, 95, + 122, 48, 57, 48, 57, 13, 32, 10, + 33, 37, 39, 45, 46, 65, 66, 67, + 69, 70, 77, 83, 84, 85, 87, 97, + 98, 99, 101, 102, 109, 115, 116, 117, + 119, 126, 42, 43, 48, 57, 68, 90, + 95, 122, 33, 37, 39, 58, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 32, 13, 127, 0, 8, 10, 31, + 10, 33, 37, 39, 45, 46, 65, 66, + 67, 69, 70, 77, 83, 84, 85, 87, + 97, 98, 99, 101, 102, 109, 115, 116, + 117, 119, 126, 42, 43, 48, 57, 68, + 90, 95, 122, 33, 37, 39, 45, 46, + 58, 126, 42, 43, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 45, 46, 58, + 126, 42, 43, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 45, 46, 58, 126, + 42, 43, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 45, 46, 58, 126, 42, + 43, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 45, 46, 58, 126, 42, 43, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 45, 46, 58, 126, 42, 43, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 33, 37, + 39, 42, 43, 58, 61, 126, 45, 46, + 48, 57, 65, 90, 95, 96, 97, 122, + 33, 37, 39, 42, 43, 58, 61, 126, + 45, 46, 48, 57, 65, 90, 95, 96, + 97, 122, 33, 37, 39, 42, 43, 58, + 61, 126, 45, 46, 48, 57, 65, 90, + 95, 96, 97, 122, 33, 37, 39, 42, + 43, 58, 61, 126, 35, 36, 45, 46, + 48, 57, 65, 90, 95, 96, 97, 122, + 13, 10, 33, 37, 39, 42, 43, 58, + 61, 126, 35, 36, 45, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 33, 37, + 39, 42, 43, 58, 61, 126, 35, 36, + 45, 46, 48, 57, 65, 90, 95, 96, + 97, 122, 33, 37, 39, 42, 43, 58, + 61, 126, 35, 36, 45, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 33, 37, + 39, 42, 43, 58, 61, 126, 35, 36, + 45, 46, 48, 57, 65, 90, 95, 96, + 97, 122, 33, 37, 39, 42, 43, 58, + 61, 126, 35, 36, 45, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 33, 37, + 39, 42, 43, 58, 61, 126, 35, 36, + 45, 46, 48, 57, 65, 90, 95, 96, + 97, 122, 33, 37, 39, 42, 43, 58, + 61, 126, 35, 36, 45, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 33, 37, + 39, 42, 43, 58, 61, 126, 35, 36, + 45, 46, 48, 57, 65, 90, 95, 96, + 97, 122, 33, 37, 39, 42, 43, 58, + 61, 126, 35, 36, 45, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 33, 37, + 39, 42, 43, 58, 61, 126, 35, 36, + 45, 46, 48, 57, 65, 90, 95, 96, + 97, 122, 33, 37, 39, 42, 43, 58, + 61, 126, 35, 36, 45, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 33, 37, + 39, 42, 43, 58, 61, 126, 35, 36, + 45, 46, 48, 57, 65, 90, 95, 96, + 97, 122, 33, 37, 39, 42, 43, 58, + 61, 126, 35, 36, 45, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 33, 37, + 39, 42, 43, 58, 61, 126, 35, 36, + 45, 46, 48, 57, 65, 90, 95, 96, + 97, 122, 33, 37, 39, 42, 43, 58, + 61, 126, 35, 36, 45, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 33, 37, + 39, 42, 43, 58, 61, 126, 35, 36, + 45, 46, 48, 57, 65, 90, 95, 96, + 97, 122, 33, 37, 39, 42, 43, 58, + 61, 126, 35, 36, 45, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 33, 37, + 39, 42, 43, 58, 61, 126, 35, 36, + 45, 46, 48, 57, 65, 90, 95, 96, + 97, 122, 33, 37, 39, 42, 43, 58, + 61, 126, 35, 36, 45, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 33, 37, + 39, 42, 43, 58, 61, 126, 35, 36, + 45, 46, 48, 57, 65, 90, 95, 96, + 97, 122, 33, 37, 39, 42, 43, 58, + 61, 126, 35, 36, 45, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 33, 37, + 39, 42, 43, 58, 61, 126, 35, 36, + 45, 46, 48, 57, 65, 90, 95, 96, + 97, 122, 33, 37, 39, 42, 43, 58, + 61, 126, 35, 36, 45, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 33, 37, + 39, 42, 43, 58, 61, 126, 35, 36, + 45, 46, 48, 57, 65, 90, 95, 96, + 97, 122, 33, 37, 39, 42, 43, 58, + 61, 126, 35, 36, 45, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 33, 37, + 39, 42, 43, 58, 61, 126, 35, 36, + 45, 46, 48, 57, 65, 90, 95, 96, + 97, 122, 33, 37, 39, 42, 43, 58, + 61, 126, 35, 36, 45, 46, 48, 57, + 65, 90, 95, 96, 97, 122, 33, 37, + 39, 42, 43, 58, 126, 35, 36, 45, + 46, 48, 57, 65, 90, 95, 122, 13, + 33, 37, 39, 58, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 13, + 33, 37, 39, 42, 43, 58, 126, 35, + 36, 45, 46, 48, 57, 65, 90, 95, + 122, 43, 35, 36, 13, 33, 37, 39, + 42, 43, 58, 61, 126, 35, 36, 45, + 46, 48, 57, 65, 90, 95, 96, 97, + 122, 37, 43, 61, 35, 36, 45, 46, + 48, 57, 65, 90, 97, 122, 13, 43, + 35, 36, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 13, 33, 37, 39, 42, 43, + 58, 61, 126, 35, 36, 45, 46, 48, + 57, 65, 90, 95, 96, 97, 122, 37, + 43, 61, 35, 36, 45, 46, 48, 57, + 65, 90, 97, 122, 13, 37, 43, 61, + 35, 36, 45, 46, 48, 57, 65, 90, + 97, 122, 37, 43, 61, 35, 36, 45, + 46, 48, 57, 65, 90, 97, 122, 13, + 37, 43, 61, 35, 36, 45, 46, 48, + 57, 65, 90, 97, 122, 37, 43, 61, + 45, 46, 48, 57, 65, 90, 97, 122, + 37, 43, 61, 45, 46, 48, 57, 65, + 90, 97, 122, 33, 37, 39, 58, 85, + 117, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 84, 116, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 72, 104, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 69, 79, 101, 111, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 78, 110, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 84, 116, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 73, + 105, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 67, 99, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 65, 97, 126, 42, 43, 45, 46, + 48, 57, 66, 90, 95, 122, 33, 37, + 39, 58, 84, 116, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 73, 105, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 79, 111, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 78, 110, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 45, 46, 58, + 126, 42, 43, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 73, 105, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 78, 110, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 70, + 102, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 79, 111, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 32, 13, 10, 33, + 37, 39, 45, 46, 65, 66, 67, 69, + 70, 77, 83, 84, 85, 87, 97, 98, + 99, 101, 102, 109, 115, 116, 117, 119, + 126, 42, 43, 48, 57, 68, 90, 95, + 122, 33, 37, 39, 58, 89, 121, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 84, 116, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 69, + 101, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 45, + 46, 58, 126, 42, 43, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 82, + 114, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 65, 97, 126, 42, 43, 45, 46, 48, + 57, 66, 90, 95, 122, 33, 37, 39, + 58, 78, 110, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 71, 103, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 69, 101, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 32, + 13, 10, 33, 37, 39, 45, 46, 65, + 66, 67, 69, 70, 77, 83, 84, 85, + 87, 97, 98, 99, 101, 102, 109, 115, + 116, 117, 119, 126, 42, 43, 48, 57, + 68, 90, 95, 122, 33, 37, 39, 58, + 79, 111, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 78, 110, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 84, 116, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 69, 101, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 78, 110, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 84, 116, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 45, 46, 58, + 126, 42, 43, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 84, 116, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 89, 121, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 80, + 112, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 69, 101, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 32, 13, 10, 33, + 37, 39, 45, 46, 65, 66, 67, 69, + 70, 77, 83, 84, 85, 87, 97, 98, + 99, 101, 102, 109, 115, 116, 117, 119, + 126, 42, 43, 48, 57, 68, 90, 95, + 122, 33, 37, 39, 58, 88, 120, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 80, 112, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 73, + 105, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 82, 114, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 69, 101, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 83, 115, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 32, 13, + 10, 33, 37, 39, 45, 46, 65, 66, + 67, 69, 70, 77, 83, 84, 85, 87, + 97, 98, 99, 101, 102, 109, 115, 116, + 117, 119, 126, 42, 43, 48, 57, 68, + 90, 95, 122, 33, 37, 39, 58, 65, + 82, 97, 114, 126, 42, 43, 45, 46, + 48, 57, 66, 90, 95, 122, 33, 37, + 39, 58, 73, 105, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 76, 108, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 85, 117, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 82, 114, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 69, 101, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 45, 46, + 58, 126, 42, 43, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 82, 114, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 69, + 101, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 80, 112, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 79, 111, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 82, 114, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 84, 116, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 32, + 13, 10, 33, 37, 39, 45, 46, 65, + 66, 67, 69, 70, 77, 83, 84, 85, + 87, 97, 98, 99, 101, 102, 109, 115, + 116, 117, 119, 126, 42, 43, 48, 57, + 68, 90, 95, 122, 33, 37, 39, 58, + 65, 69, 73, 97, 101, 105, 126, 42, + 43, 45, 46, 48, 57, 66, 90, 95, + 122, 33, 37, 39, 58, 88, 120, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 45, 46, 58, + 126, 42, 43, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 69, 101, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 88, 120, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 80, + 112, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 73, 105, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 82, 114, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 69, 101, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 83, 115, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 32, + 13, 10, 33, 37, 39, 45, 46, 65, + 66, 67, 69, 70, 77, 83, 84, 85, + 87, 97, 98, 99, 101, 102, 109, 115, + 116, 117, 119, 126, 42, 43, 48, 57, + 68, 90, 95, 122, 33, 37, 39, 58, + 84, 85, 116, 117, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 65, 97, 126, 42, 43, + 45, 46, 48, 57, 66, 90, 95, 122, + 33, 37, 39, 58, 84, 116, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 85, 117, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 83, 115, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 32, 13, 10, 33, 37, 39, + 45, 46, 65, 66, 67, 69, 70, 77, + 83, 84, 85, 87, 97, 98, 99, 101, + 102, 109, 115, 116, 117, 119, 126, 42, + 43, 48, 57, 68, 90, 95, 122, 33, + 37, 39, 58, 79, 111, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 45, 46, 58, 126, 42, + 43, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 80, 112, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 65, 97, 126, 42, + 43, 45, 46, 48, 57, 66, 90, 95, + 122, 33, 37, 39, 58, 84, 116, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 72, 104, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 32, 13, 10, 33, 37, 39, + 45, 46, 65, 66, 67, 69, 70, 77, + 83, 84, 85, 87, 97, 98, 99, 101, + 102, 109, 115, 116, 117, 119, 126, 42, + 43, 48, 57, 68, 90, 95, 122, 33, + 37, 39, 58, 83, 115, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 69, 101, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 45, 46, 58, 126, + 42, 43, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 80, 112, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 65, 97, 126, + 42, 43, 45, 46, 48, 57, 66, 90, + 95, 122, 33, 37, 39, 58, 84, 116, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 72, + 104, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 32, 13, 10, 33, 37, + 39, 45, 46, 65, 66, 67, 69, 70, + 77, 83, 84, 85, 87, 97, 98, 99, + 101, 102, 109, 115, 116, 117, 119, 126, + 42, 43, 48, 57, 68, 90, 95, 122, + 33, 37, 39, 58, 87, 119, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 87, 119, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 45, 46, 58, + 126, 42, 43, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 65, 97, 126, + 42, 43, 45, 46, 48, 57, 66, 90, + 95, 122, 33, 37, 39, 58, 85, 117, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 84, + 116, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 72, 104, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 69, 101, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 78, 110, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 84, 116, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 73, 105, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 67, 99, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 65, 97, + 126, 42, 43, 45, 46, 48, 57, 66, + 90, 95, 122, 33, 37, 39, 58, 84, + 116, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 69, 101, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 32, 13, 10, 33, + 37, 39, 45, 46, 65, 66, 67, 69, + 70, 77, 83, 84, 85, 87, 97, 98, + 99, 101, 102, 109, 115, 116, 117, 119, + 126, 42, 43, 48, 57, 68, 90, 95, + 122, 33, 37, 39, 58, 67, 99, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 67, 99, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 69, + 101, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 83, 115, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 83, 115, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 45, 46, 58, 126, 42, 43, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 82, 114, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 69, 101, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 80, 112, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 79, 111, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 82, 114, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 84, 116, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 32, 13, 10, 33, 37, 39, + 45, 46, 65, 66, 67, 69, 70, 77, + 83, 84, 85, 87, 97, 98, 99, 101, + 102, 109, 115, 116, 117, 119, 126, 42, + 43, 48, 57, 68, 90, 95, 122, 33, + 37, 39, 58, 83, 115, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 83, 115, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 65, 97, 126, + 42, 43, 45, 46, 48, 57, 66, 90, + 95, 122, 33, 37, 39, 58, 71, 103, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 69, + 101, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 45, + 46, 58, 126, 42, 43, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 73, + 105, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 68, 100, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 32, 13, 10, 33, + 37, 39, 45, 46, 65, 66, 67, 69, + 70, 77, 83, 84, 85, 87, 97, 98, + 99, 101, 102, 109, 115, 116, 117, 119, + 126, 42, 43, 48, 57, 68, 90, 95, + 122, 33, 37, 39, 58, 78, 110, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 45, 46, 58, + 126, 42, 43, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 69, 101, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 88, 120, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 80, + 112, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 73, 105, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 82, 114, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 69, 101, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 83, 115, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 32, + 13, 10, 33, 37, 39, 45, 46, 65, + 66, 67, 69, 70, 77, 83, 84, 85, + 87, 97, 98, 99, 101, 102, 109, 115, + 116, 117, 119, 126, 42, 43, 48, 57, + 68, 90, 95, 122, 33, 37, 39, 58, + 79, 111, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 77, 109, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 45, 46, 58, 126, 42, 43, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 80, 112, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 65, 97, 126, 42, 43, 45, + 46, 48, 57, 66, 90, 95, 122, 33, + 37, 39, 58, 84, 116, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 33, 37, 39, 58, 72, 104, 126, 42, + 43, 45, 46, 48, 57, 65, 90, 95, + 122, 33, 37, 39, 58, 126, 42, 43, + 45, 46, 48, 57, 65, 90, 95, 122, + 32, 13, 10, 33, 37, 39, 45, 46, + 65, 66, 67, 69, 70, 77, 83, 84, + 85, 87, 97, 98, 99, 101, 102, 109, + 115, 116, 117, 119, 126, 42, 43, 48, + 57, 68, 90, 95, 122, 33, 37, 39, + 58, 82, 114, 126, 42, 43, 45, 46, + 48, 57, 65, 90, 95, 122, 33, 37, + 39, 58, 73, 105, 126, 42, 43, 45, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 58, 90, 122, 126, 42, 43, + 45, 46, 48, 57, 65, 89, 95, 121, + 33, 37, 39, 58, 65, 97, 126, 42, + 43, 45, 46, 48, 57, 66, 90, 95, + 122, 33, 37, 39, 58, 84, 116, 126, + 42, 43, 45, 46, 48, 57, 65, 90, + 95, 122, 33, 37, 39, 58, 73, 105, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 39, 58, 79, + 111, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 58, + 78, 110, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 58, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 32, 13, 10, 33, + 37, 39, 45, 46, 65, 66, 67, 69, + 70, 77, 83, 84, 85, 87, 97, 98, + 99, 101, 102, 109, 115, 116, 117, 119, + 126, 42, 43, 48, 57, 68, 90, 95, + 122, 13, 127, 0, 8, 10, 31, 13, + 127, 0, 8, 10, 31, 13, 65, 90, + 32, 37, 43, 61, 45, 46, 48, 57, + 65, 90, 97, 122, 32, 37, 43, 61, + 45, 46, 48, 57, 65, 90, 97, 122, + 32, 37, 43, 61, 45, 46, 48, 57, + 65, 90, 97, 122, 32, 37, 43, 61, + 45, 46, 48, 57, 65, 90, 97, 122, + 32, 37, 43, 61, 45, 46, 48, 57, + 65, 90, 97, 122, 32, 37, 43, 61, + 45, 46, 48, 57, 65, 90, 97, 122, + 32, 37, 43, 61, 45, 46, 48, 57, + 65, 90, 97, 122, 32, 37, 43, 61, + 45, 46, 48, 57, 65, 90, 97, 122, + 32, 37, 43, 61, 45, 46, 48, 57, + 65, 90, 97, 122, 32, 37, 43, 61, + 45, 46, 48, 57, 65, 90, 97, 122, + 32, 37, 43, 61, 45, 46, 48, 57, + 65, 90, 97, 122, 32, 37, 43, 61, + 45, 46, 48, 57, 65, 90, 97, 122, + 32, 37, 43, 61, 45, 46, 48, 57, + 65, 90, 97, 122, 32, 37, 43, 61, + 45, 46, 48, 57, 65, 90, 97, 122, + 32, 37, 43, 61, 45, 46, 48, 57, + 65, 90, 97, 122, 32, 37, 43, 61, + 45, 46, 48, 57, 65, 90, 97, 122, + 32, 37, 43, 61, 45, 46, 48, 57, + 65, 90, 97, 122, 32, 37, 43, 61, + 45, 46, 48, 57, 65, 90, 97, 122, + 32, 37, 43, 61, 45, 46, 48, 57, + 65, 90, 97, 122, 32, 37, 43, 61, + 45, 46, 48, 57, 65, 90, 97, 122, + 32, 37, 43, 61, 45, 46, 48, 57, + 65, 90, 97, 122, 32, 37, 43, 61, + 45, 46, 48, 57, 65, 90, 97, 122, + 32, 37, 43, 61, 45, 46, 48, 57, + 65, 90, 97, 122, 32, 37, 43, 61, + 45, 46, 48, 57, 65, 90, 97, 122, + 32, 37, 43, 61, 45, 46, 48, 57, + 65, 90, 97, 122, 32, 37, 43, 61, + 45, 46, 48, 57, 65, 90, 97, 122, + 32, 37, 43, 61, 45, 46, 48, 57, + 65, 90, 97, 122, 32, 0 +}; + +static const char _tmsrp_machine_message_single_lengths[] = { + 0, 1, 1, 1, 1, 1, 0, 3, + 3, 3, 4, 1, 1, 28, 1, 1, + 1, 2, 3, 1, 1, 1, 1, 1, + 1, 0, 3, 3, 3, 3, 1, 1, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 1, 2, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 5, 1, 2, 1, 28, 7, 7, 7, + 9, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 5, + 1, 1, 1, 28, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 5, 1, 1, + 1, 28, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 5, 1, 1, + 1, 28, 7, 7, 7, 7, 7, 7, + 5, 1, 1, 1, 28, 9, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 5, 1, 1, 1, 28, 11, + 7, 7, 7, 7, 7, 7, 7, 7, + 7, 5, 1, 1, 1, 28, 9, 7, + 7, 7, 7, 5, 1, 1, 1, 28, + 7, 7, 7, 7, 7, 7, 5, 1, + 1, 1, 28, 7, 7, 7, 7, 7, + 7, 7, 5, 1, 1, 1, 28, 7, + 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 5, 1, + 1, 1, 28, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 5, + 1, 1, 1, 28, 7, 7, 7, 7, + 7, 7, 7, 7, 5, 1, 1, 1, + 28, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 5, 1, 1, 1, 28, 7, + 7, 7, 7, 7, 7, 7, 5, 1, + 1, 1, 28, 7, 7, 7, 7, 7, + 7, 7, 7, 5, 1, 1, 1, 28, + 0, 0, 2, 1, 26, 5, 1, 2, + 1, 26, 7, 7, 7, 7, 7, 7, + 5, 8, 8, 8, 8, 1, 1, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 7, 6, 8, 1, 9, 3, + 2, 9, 3, 4, 9, 3, 4, 9, + 3, 4, 9, 3, 4, 9, 3, 4, + 9, 3, 4, 9, 3, 4, 9, 3, + 4, 9, 3, 4, 9, 3, 4, 9, + 3, 4, 9, 3, 4, 9, 3, 4, + 9, 3, 4, 9, 3, 4, 9, 3, + 4, 9, 3, 4, 9, 3, 4, 9, + 3, 4, 9, 3, 4, 9, 3, 4, + 9, 3, 4, 9, 3, 4, 9, 3, + 4, 9, 3, 4, 9, 3, 4, 3, + 4, 3, 3, 7, 7, 7, 9, 7, + 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 5, 1, 1, + 1, 26, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 5, 1, 1, 1, 26, + 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 5, 1, 1, 1, 26, + 7, 7, 7, 7, 7, 7, 5, 1, + 1, 1, 26, 9, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, + 5, 1, 1, 1, 26, 11, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 5, + 1, 1, 1, 26, 9, 7, 7, 7, + 7, 5, 1, 1, 1, 26, 7, 7, + 7, 7, 7, 7, 5, 1, 1, 1, + 26, 7, 7, 7, 7, 7, 7, 7, + 5, 1, 1, 1, 26, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 5, 1, 1, 1, + 26, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 5, 1, 1, + 1, 26, 7, 7, 7, 7, 7, 7, + 7, 7, 5, 1, 1, 1, 26, 7, + 7, 7, 7, 7, 7, 7, 7, 7, + 5, 1, 1, 1, 26, 7, 7, 7, + 7, 7, 7, 7, 5, 1, 1, 1, + 26, 7, 7, 7, 7, 7, 7, 7, + 7, 5, 1, 1, 1, 26, 2, 2, + 1, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 1, 0 +}; + +static const char _tmsrp_machine_message_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 3, 4, + 4, 4, 4, 2, 0, 4, 0, 0, + 0, 0, 2, 0, 0, 0, 0, 0, + 0, 3, 4, 4, 4, 5, 0, 0, + 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 1, 1, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, + 5, 0, 2, 0, 4, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 4, 5, 5, 5, 5, 5, + 0, 0, 0, 4, 5, 5, 5, 4, + 5, 5, 5, 5, 5, 5, 0, 0, + 0, 4, 5, 5, 5, 5, 5, 5, + 4, 5, 5, 5, 5, 5, 0, 0, + 0, 4, 5, 5, 5, 5, 5, 5, + 5, 0, 0, 0, 4, 5, 5, 5, + 5, 5, 5, 4, 5, 5, 5, 5, + 5, 5, 5, 0, 0, 0, 4, 5, + 5, 4, 5, 5, 5, 5, 5, 5, + 5, 5, 0, 0, 0, 4, 5, 5, + 5, 5, 5, 5, 0, 0, 0, 4, + 5, 4, 5, 5, 5, 5, 5, 0, + 0, 0, 4, 5, 5, 4, 5, 5, + 5, 5, 5, 0, 0, 0, 4, 5, + 5, 4, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 0, + 0, 0, 4, 5, 5, 5, 5, 5, + 4, 5, 5, 5, 5, 5, 5, 5, + 0, 0, 0, 4, 5, 5, 5, 5, + 5, 4, 5, 5, 5, 0, 0, 0, + 4, 5, 4, 5, 5, 5, 5, 5, + 5, 5, 5, 0, 0, 0, 4, 5, + 5, 4, 5, 5, 5, 5, 5, 0, + 0, 0, 4, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 0, 0, 0, 4, + 1, 1, 0, 0, 4, 5, 0, 2, + 0, 4, 4, 4, 4, 4, 4, 4, + 6, 5, 5, 5, 6, 0, 0, 6, + 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 5, 5, 5, 1, 6, 5, + 1, 6, 5, 5, 6, 5, 5, 6, + 5, 5, 6, 5, 5, 6, 5, 5, + 6, 5, 5, 6, 5, 5, 6, 5, + 5, 6, 5, 5, 6, 5, 5, 6, + 5, 5, 6, 5, 5, 6, 5, 5, + 6, 5, 5, 6, 5, 5, 6, 5, + 5, 6, 5, 5, 6, 5, 5, 6, + 5, 5, 6, 5, 5, 6, 5, 5, + 6, 5, 5, 6, 5, 5, 6, 5, + 5, 6, 5, 5, 6, 5, 5, 5, + 5, 4, 4, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, + 4, 5, 5, 5, 5, 5, 0, 0, + 0, 4, 5, 5, 5, 4, 5, 5, + 5, 5, 5, 5, 0, 0, 0, 4, + 5, 5, 5, 5, 5, 5, 4, 5, + 5, 5, 5, 5, 0, 0, 0, 4, + 5, 5, 5, 5, 5, 5, 5, 0, + 0, 0, 4, 5, 5, 5, 5, 5, + 5, 4, 5, 5, 5, 5, 5, 5, + 5, 0, 0, 0, 4, 5, 5, 4, + 5, 5, 5, 5, 5, 5, 5, 5, + 0, 0, 0, 4, 5, 5, 5, 5, + 5, 5, 0, 0, 0, 4, 5, 4, + 5, 5, 5, 5, 5, 0, 0, 0, + 4, 5, 5, 4, 5, 5, 5, 5, + 5, 0, 0, 0, 4, 5, 5, 4, + 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 0, 0, 0, + 4, 5, 5, 5, 5, 5, 4, 5, + 5, 5, 5, 5, 5, 5, 0, 0, + 0, 4, 5, 5, 5, 5, 5, 4, + 5, 5, 5, 0, 0, 0, 4, 5, + 4, 5, 5, 5, 5, 5, 5, 5, + 5, 0, 0, 0, 4, 5, 5, 4, + 5, 5, 5, 5, 5, 0, 0, 0, + 4, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 0, 0, 0, 4, 2, 2, + 1, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 0, 0 +}; + +static const short _tmsrp_machine_message_index_offsets[] = { + 0, 0, 2, 4, 6, 8, 10, 14, + 22, 30, 38, 47, 51, 53, 86, 88, + 90, 92, 95, 101, 103, 105, 107, 109, + 111, 113, 117, 125, 133, 141, 150, 152, + 154, 163, 172, 181, 190, 199, 208, 217, + 226, 235, 244, 253, 262, 271, 280, 289, + 298, 307, 316, 325, 334, 343, 352, 361, + 370, 379, 388, 397, 400, 404, 414, 424, + 434, 444, 454, 464, 474, 484, 494, 504, + 514, 524, 534, 544, 554, 564, 574, 584, + 594, 604, 614, 624, 634, 644, 654, 664, + 674, 685, 687, 692, 694, 727, 740, 753, + 766, 781, 794, 807, 820, 833, 846, 859, + 872, 885, 898, 910, 923, 936, 949, 962, + 973, 975, 977, 979, 1012, 1025, 1038, 1051, + 1063, 1076, 1089, 1102, 1115, 1128, 1139, 1141, + 1143, 1145, 1178, 1191, 1204, 1217, 1230, 1243, + 1256, 1268, 1281, 1294, 1307, 1320, 1331, 1333, + 1335, 1337, 1370, 1383, 1396, 1409, 1422, 1435, + 1448, 1459, 1461, 1463, 1465, 1498, 1513, 1526, + 1539, 1552, 1565, 1578, 1590, 1603, 1616, 1629, + 1642, 1655, 1668, 1679, 1681, 1683, 1685, 1718, + 1735, 1748, 1760, 1773, 1786, 1799, 1812, 1825, + 1838, 1851, 1862, 1864, 1866, 1868, 1901, 1916, + 1929, 1942, 1955, 1968, 1979, 1981, 1983, 1985, + 2018, 2031, 2043, 2056, 2069, 2082, 2095, 2106, + 2108, 2110, 2112, 2145, 2158, 2171, 2183, 2196, + 2209, 2222, 2235, 2246, 2248, 2250, 2252, 2285, + 2298, 2311, 2323, 2336, 2349, 2362, 2375, 2388, + 2401, 2414, 2427, 2440, 2453, 2466, 2479, 2490, + 2492, 2494, 2496, 2529, 2542, 2555, 2568, 2581, + 2594, 2606, 2619, 2632, 2645, 2658, 2671, 2684, + 2695, 2697, 2699, 2701, 2734, 2747, 2760, 2773, + 2786, 2799, 2811, 2824, 2837, 2848, 2850, 2852, + 2854, 2887, 2900, 2912, 2925, 2938, 2951, 2964, + 2977, 2990, 3003, 3014, 3016, 3018, 3020, 3053, + 3066, 3079, 3091, 3104, 3117, 3130, 3143, 3154, + 3156, 3158, 3160, 3193, 3206, 3219, 3232, 3245, + 3258, 3271, 3284, 3297, 3308, 3310, 3312, 3314, + 3347, 3349, 3351, 3354, 3356, 3387, 3398, 3400, + 3405, 3407, 3438, 3450, 3462, 3474, 3486, 3498, + 3510, 3522, 3536, 3550, 3564, 3579, 3581, 3583, + 3598, 3613, 3628, 3643, 3658, 3673, 3688, 3703, + 3718, 3733, 3748, 3763, 3778, 3793, 3808, 3823, + 3838, 3853, 3868, 3883, 3898, 3913, 3928, 3943, + 3958, 3973, 3988, 4001, 4013, 4027, 4030, 4046, + 4055, 4059, 4075, 4084, 4094, 4110, 4119, 4129, + 4145, 4154, 4164, 4180, 4189, 4199, 4215, 4224, + 4234, 4250, 4259, 4269, 4285, 4294, 4304, 4320, + 4329, 4339, 4355, 4364, 4374, 4390, 4399, 4409, + 4425, 4434, 4444, 4460, 4469, 4479, 4495, 4504, + 4514, 4530, 4539, 4549, 4565, 4574, 4584, 4600, + 4609, 4619, 4635, 4644, 4654, 4670, 4679, 4689, + 4705, 4714, 4724, 4740, 4749, 4759, 4775, 4784, + 4794, 4810, 4819, 4829, 4845, 4854, 4864, 4880, + 4889, 4899, 4915, 4924, 4934, 4950, 4959, 4969, + 4978, 4988, 4996, 5004, 5017, 5030, 5043, 5058, + 5071, 5084, 5097, 5110, 5123, 5136, 5149, 5162, + 5175, 5187, 5200, 5213, 5226, 5239, 5250, 5252, + 5254, 5256, 5287, 5300, 5313, 5326, 5338, 5351, + 5364, 5377, 5390, 5403, 5414, 5416, 5418, 5420, + 5451, 5464, 5477, 5490, 5503, 5516, 5529, 5541, + 5554, 5567, 5580, 5593, 5604, 5606, 5608, 5610, + 5641, 5654, 5667, 5680, 5693, 5706, 5719, 5730, + 5732, 5734, 5736, 5767, 5782, 5795, 5808, 5821, + 5834, 5847, 5859, 5872, 5885, 5898, 5911, 5924, + 5937, 5948, 5950, 5952, 5954, 5985, 6002, 6015, + 6027, 6040, 6053, 6066, 6079, 6092, 6105, 6118, + 6129, 6131, 6133, 6135, 6166, 6181, 6194, 6207, + 6220, 6233, 6244, 6246, 6248, 6250, 6281, 6294, + 6306, 6319, 6332, 6345, 6358, 6369, 6371, 6373, + 6375, 6406, 6419, 6432, 6444, 6457, 6470, 6483, + 6496, 6507, 6509, 6511, 6513, 6544, 6557, 6570, + 6582, 6595, 6608, 6621, 6634, 6647, 6660, 6673, + 6686, 6699, 6712, 6725, 6738, 6749, 6751, 6753, + 6755, 6786, 6799, 6812, 6825, 6838, 6851, 6863, + 6876, 6889, 6902, 6915, 6928, 6941, 6952, 6954, + 6956, 6958, 6989, 7002, 7015, 7028, 7041, 7054, + 7066, 7079, 7092, 7103, 7105, 7107, 7109, 7140, + 7153, 7165, 7178, 7191, 7204, 7217, 7230, 7243, + 7256, 7267, 7269, 7271, 7273, 7304, 7317, 7330, + 7342, 7355, 7368, 7381, 7394, 7405, 7407, 7409, + 7411, 7442, 7455, 7468, 7481, 7494, 7507, 7520, + 7533, 7546, 7557, 7559, 7561, 7563, 7594, 7599, + 7604, 7607, 7616, 7625, 7634, 7643, 7652, 7661, + 7670, 7679, 7688, 7697, 7706, 7715, 7724, 7733, + 7742, 7751, 7760, 7769, 7778, 7787, 7796, 7805, + 7814, 7823, 7832, 7841, 7850, 7852 +}; + +static const short _tmsrp_machine_message_indicies[] = { + 0, 1, 2, 1, 3, 1, 4, 1, + 5, 1, 6, 6, 6, 1, 7, 7, + 7, 7, 7, 7, 7, 1, 8, 8, + 8, 8, 8, 8, 8, 1, 9, 9, + 9, 9, 9, 9, 9, 1, 10, 11, + 11, 11, 11, 11, 11, 11, 1, 12, + 13, 14, 1, 15, 1, 16, 17, 17, + 17, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 17, 17, + 17, 17, 17, 17, 17, 1, 28, 1, + 30, 29, 32, 31, 33, 32, 31, 32, + 31, 34, 31, 31, 1, 35, 1, 36, + 1, 37, 1, 38, 1, 39, 1, 40, + 1, 41, 41, 41, 1, 42, 42, 42, + 42, 42, 42, 42, 1, 43, 43, 43, + 43, 43, 43, 43, 1, 44, 44, 44, + 44, 44, 44, 44, 1, 46, 47, 46, + 45, 46, 46, 46, 46, 1, 48, 1, + 49, 1, 50, 51, 50, 45, 50, 50, + 50, 50, 1, 52, 53, 52, 45, 52, + 52, 52, 52, 1, 54, 55, 54, 45, + 54, 54, 54, 54, 1, 56, 57, 56, + 45, 56, 56, 56, 56, 1, 58, 59, + 58, 45, 58, 58, 58, 58, 1, 60, + 61, 60, 45, 60, 60, 60, 60, 1, + 62, 63, 62, 45, 62, 62, 62, 62, + 1, 64, 65, 64, 45, 64, 64, 64, + 64, 1, 66, 67, 66, 45, 66, 66, + 66, 66, 1, 68, 69, 68, 45, 68, + 68, 68, 68, 1, 70, 71, 70, 45, + 70, 70, 70, 70, 1, 72, 73, 72, + 45, 72, 72, 72, 72, 1, 74, 75, + 74, 45, 74, 74, 74, 74, 1, 76, + 77, 76, 45, 76, 76, 76, 76, 1, + 78, 79, 78, 45, 78, 78, 78, 78, + 1, 80, 81, 80, 45, 80, 80, 80, + 80, 1, 82, 83, 82, 45, 82, 82, + 82, 82, 1, 84, 85, 84, 45, 84, + 84, 84, 84, 1, 86, 87, 86, 45, + 86, 86, 86, 86, 1, 88, 89, 88, + 45, 88, 88, 88, 88, 1, 90, 91, + 90, 45, 90, 90, 90, 90, 1, 92, + 93, 92, 45, 92, 92, 92, 92, 1, + 94, 95, 94, 45, 94, 94, 94, 94, + 1, 96, 97, 96, 45, 96, 96, 96, + 96, 1, 98, 99, 98, 45, 98, 98, + 98, 98, 1, 100, 101, 100, 45, 100, + 100, 100, 100, 1, 102, 103, 102, 45, + 102, 102, 102, 102, 1, 45, 45, 1, + 48, 45, 45, 1, 48, 102, 103, 102, + 45, 102, 102, 102, 102, 1, 48, 100, + 101, 100, 45, 100, 100, 100, 100, 1, + 48, 98, 99, 98, 45, 98, 98, 98, + 98, 1, 48, 96, 97, 96, 45, 96, + 96, 96, 96, 1, 48, 94, 95, 94, + 45, 94, 94, 94, 94, 1, 48, 92, + 93, 92, 45, 92, 92, 92, 92, 1, + 48, 90, 91, 90, 45, 90, 90, 90, + 90, 1, 48, 88, 89, 88, 45, 88, + 88, 88, 88, 1, 48, 86, 87, 86, + 45, 86, 86, 86, 86, 1, 48, 84, + 85, 84, 45, 84, 84, 84, 84, 1, + 48, 82, 83, 82, 45, 82, 82, 82, + 82, 1, 48, 80, 81, 80, 45, 80, + 80, 80, 80, 1, 48, 78, 79, 78, + 45, 78, 78, 78, 78, 1, 48, 76, + 77, 76, 45, 76, 76, 76, 76, 1, + 48, 74, 75, 74, 45, 74, 74, 74, + 74, 1, 48, 72, 73, 72, 45, 72, + 72, 72, 72, 1, 48, 70, 71, 70, + 45, 70, 70, 70, 70, 1, 48, 68, + 69, 68, 45, 68, 68, 68, 68, 1, + 48, 66, 67, 66, 45, 66, 66, 66, + 66, 1, 48, 64, 65, 64, 45, 64, + 64, 64, 64, 1, 48, 62, 63, 62, + 45, 62, 62, 62, 62, 1, 48, 60, + 61, 60, 45, 60, 60, 60, 60, 1, + 48, 58, 59, 58, 45, 58, 58, 58, + 58, 1, 48, 56, 57, 56, 45, 56, + 56, 56, 56, 1, 48, 54, 55, 54, + 45, 54, 54, 54, 54, 1, 48, 52, + 53, 52, 45, 52, 52, 52, 52, 1, + 48, 50, 51, 50, 45, 50, 50, 50, + 50, 1, 104, 104, 104, 105, 104, 104, + 104, 104, 104, 104, 1, 106, 1, 107, + 1, 1, 1, 106, 108, 1, 109, 110, + 110, 110, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 110, + 110, 121, 110, 110, 110, 110, 1, 104, + 104, 104, 105, 122, 122, 104, 104, 104, + 104, 104, 104, 1, 104, 104, 104, 105, + 123, 123, 104, 104, 104, 104, 104, 104, + 1, 104, 104, 104, 105, 124, 124, 104, + 104, 104, 104, 104, 104, 1, 104, 104, + 104, 105, 125, 126, 125, 126, 104, 104, + 104, 104, 104, 104, 1, 104, 104, 104, + 105, 127, 127, 104, 104, 104, 104, 104, + 104, 1, 104, 104, 104, 105, 128, 128, + 104, 104, 104, 104, 104, 104, 1, 104, + 104, 104, 105, 129, 129, 104, 104, 104, + 104, 104, 104, 1, 104, 104, 104, 105, + 130, 130, 104, 104, 104, 104, 104, 104, + 1, 104, 104, 104, 105, 131, 131, 104, + 104, 104, 104, 104, 104, 1, 104, 104, + 104, 105, 132, 132, 104, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 105, 133, + 133, 104, 104, 104, 104, 104, 104, 1, + 104, 104, 104, 105, 134, 134, 104, 104, + 104, 104, 104, 104, 1, 104, 104, 104, + 105, 135, 135, 104, 104, 104, 104, 104, + 104, 1, 104, 104, 104, 136, 104, 105, + 104, 104, 104, 104, 104, 1, 104, 104, + 104, 105, 137, 137, 104, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 105, 138, + 138, 104, 104, 104, 104, 104, 104, 1, + 104, 104, 104, 105, 139, 139, 104, 104, + 104, 104, 104, 104, 1, 104, 104, 104, + 105, 140, 140, 104, 104, 104, 104, 104, + 104, 1, 104, 104, 104, 141, 104, 104, + 104, 104, 104, 104, 1, 142, 1, 143, + 142, 144, 1, 145, 146, 146, 146, 146, + 147, 148, 149, 150, 151, 152, 153, 154, + 155, 156, 147, 148, 149, 150, 151, 152, + 153, 154, 155, 156, 146, 146, 157, 146, + 146, 146, 146, 1, 104, 104, 104, 105, + 158, 158, 104, 104, 104, 104, 104, 104, + 1, 104, 104, 104, 105, 159, 159, 104, + 104, 104, 104, 104, 104, 1, 104, 104, + 104, 105, 160, 160, 104, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 161, 104, + 105, 104, 104, 104, 104, 104, 1, 104, + 104, 104, 105, 162, 162, 104, 104, 104, + 104, 104, 104, 1, 104, 104, 104, 105, + 163, 163, 104, 104, 104, 104, 104, 104, + 1, 104, 104, 104, 105, 164, 164, 104, + 104, 104, 104, 104, 104, 1, 104, 104, + 104, 105, 165, 165, 104, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 105, 166, + 166, 104, 104, 104, 104, 104, 104, 1, + 104, 104, 104, 167, 104, 104, 104, 104, + 104, 104, 1, 168, 1, 169, 168, 170, + 1, 171, 172, 172, 172, 172, 173, 174, + 175, 176, 177, 178, 179, 180, 181, 182, + 173, 174, 175, 176, 177, 178, 179, 180, + 181, 182, 172, 172, 183, 172, 172, 172, + 172, 1, 104, 104, 104, 105, 184, 184, + 104, 104, 104, 104, 104, 104, 1, 104, + 104, 104, 105, 185, 185, 104, 104, 104, + 104, 104, 104, 1, 104, 104, 104, 105, + 186, 186, 104, 104, 104, 104, 104, 104, + 1, 104, 104, 104, 105, 187, 187, 104, + 104, 104, 104, 104, 104, 1, 104, 104, + 104, 105, 188, 188, 104, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 105, 189, + 189, 104, 104, 104, 104, 104, 104, 1, + 104, 104, 104, 190, 104, 105, 104, 104, + 104, 104, 104, 1, 104, 104, 104, 105, + 191, 191, 104, 104, 104, 104, 104, 104, + 1, 104, 104, 104, 105, 192, 192, 104, + 104, 104, 104, 104, 104, 1, 104, 104, + 104, 105, 193, 193, 104, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 105, 194, + 194, 104, 104, 104, 104, 104, 104, 1, + 104, 104, 104, 195, 104, 104, 104, 104, + 104, 104, 1, 196, 1, 197, 196, 198, + 1, 199, 200, 200, 200, 200, 201, 202, + 203, 204, 205, 206, 207, 208, 209, 210, + 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 200, 200, 211, 200, 200, 200, + 200, 1, 104, 104, 104, 105, 212, 212, + 104, 104, 104, 104, 104, 104, 1, 104, + 104, 104, 105, 213, 213, 104, 104, 104, + 104, 104, 104, 1, 104, 104, 104, 105, + 214, 214, 104, 104, 104, 104, 104, 104, + 1, 104, 104, 104, 105, 215, 215, 104, + 104, 104, 104, 104, 104, 1, 104, 104, + 104, 105, 216, 216, 104, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 105, 217, + 217, 104, 104, 104, 104, 104, 104, 1, + 104, 104, 104, 218, 104, 104, 104, 104, + 104, 104, 1, 219, 1, 220, 219, 221, + 1, 222, 223, 223, 223, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 233, + 224, 225, 226, 227, 228, 229, 230, 231, + 232, 233, 223, 223, 234, 223, 223, 223, + 223, 1, 104, 104, 104, 105, 235, 236, + 235, 236, 104, 104, 104, 104, 104, 104, + 1, 104, 104, 104, 105, 237, 237, 104, + 104, 104, 104, 104, 104, 1, 104, 104, + 104, 105, 238, 238, 104, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 105, 239, + 239, 104, 104, 104, 104, 104, 104, 1, + 104, 104, 104, 105, 240, 240, 104, 104, + 104, 104, 104, 104, 1, 104, 104, 104, + 105, 241, 241, 104, 104, 104, 104, 104, + 104, 1, 104, 104, 104, 242, 104, 105, + 104, 104, 104, 104, 104, 1, 104, 104, + 104, 105, 243, 243, 104, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 105, 244, + 244, 104, 104, 104, 104, 104, 104, 1, + 104, 104, 104, 105, 245, 245, 104, 104, + 104, 104, 104, 104, 1, 104, 104, 104, + 105, 246, 246, 104, 104, 104, 104, 104, + 104, 1, 104, 104, 104, 105, 247, 247, + 104, 104, 104, 104, 104, 104, 1, 104, + 104, 104, 105, 248, 248, 104, 104, 104, + 104, 104, 104, 1, 104, 104, 104, 249, + 104, 104, 104, 104, 104, 104, 1, 250, + 1, 251, 250, 252, 1, 253, 254, 254, + 254, 254, 255, 256, 257, 258, 259, 260, + 261, 262, 263, 264, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 254, 254, + 265, 254, 254, 254, 254, 1, 104, 104, + 104, 105, 266, 267, 268, 266, 267, 268, + 104, 104, 104, 104, 104, 104, 1, 104, + 104, 104, 105, 269, 269, 104, 104, 104, + 104, 104, 104, 1, 104, 104, 104, 270, + 104, 105, 104, 104, 104, 104, 104, 1, + 104, 104, 104, 105, 271, 271, 104, 104, + 104, 104, 104, 104, 1, 104, 104, 104, + 105, 272, 272, 104, 104, 104, 104, 104, + 104, 1, 104, 104, 104, 105, 273, 273, + 104, 104, 104, 104, 104, 104, 1, 104, + 104, 104, 105, 274, 274, 104, 104, 104, + 104, 104, 104, 1, 104, 104, 104, 105, + 275, 275, 104, 104, 104, 104, 104, 104, + 1, 104, 104, 104, 105, 276, 276, 104, + 104, 104, 104, 104, 104, 1, 104, 104, + 104, 105, 277, 277, 104, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 278, 104, + 104, 104, 104, 104, 104, 1, 279, 1, + 280, 279, 281, 1, 282, 283, 283, 283, + 283, 284, 285, 286, 287, 288, 289, 290, + 291, 292, 293, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 283, 283, 294, + 283, 283, 283, 283, 1, 104, 104, 104, + 105, 295, 296, 295, 296, 104, 104, 104, + 104, 104, 104, 1, 104, 104, 104, 105, + 297, 297, 104, 104, 104, 104, 104, 104, + 1, 104, 104, 104, 105, 298, 298, 104, + 104, 104, 104, 104, 104, 1, 104, 104, + 104, 105, 299, 299, 104, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 105, 300, + 300, 104, 104, 104, 104, 104, 104, 1, + 104, 104, 104, 301, 104, 104, 104, 104, + 104, 104, 1, 302, 1, 303, 302, 304, + 1, 305, 306, 306, 306, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, + 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 306, 306, 317, 306, 306, 306, + 306, 1, 104, 104, 104, 105, 318, 318, + 104, 104, 104, 104, 104, 104, 1, 104, + 104, 104, 319, 104, 105, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 105, 320, + 320, 104, 104, 104, 104, 104, 104, 1, + 104, 104, 104, 105, 321, 321, 104, 104, + 104, 104, 104, 104, 1, 104, 104, 104, + 105, 322, 322, 104, 104, 104, 104, 104, + 104, 1, 104, 104, 104, 105, 323, 323, + 104, 104, 104, 104, 104, 104, 1, 104, + 104, 104, 324, 104, 104, 104, 104, 104, + 104, 1, 325, 1, 326, 325, 327, 1, + 328, 329, 329, 329, 329, 330, 331, 332, + 333, 334, 335, 336, 337, 338, 339, 330, + 331, 332, 333, 334, 335, 336, 337, 338, + 339, 329, 329, 340, 329, 329, 329, 329, + 1, 104, 104, 104, 105, 341, 341, 104, + 104, 104, 104, 104, 104, 1, 104, 104, + 104, 105, 342, 342, 104, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 343, 104, + 105, 104, 104, 104, 104, 104, 1, 104, + 104, 104, 105, 344, 344, 104, 104, 104, + 104, 104, 104, 1, 104, 104, 104, 105, + 345, 345, 104, 104, 104, 104, 104, 104, + 1, 104, 104, 104, 105, 346, 346, 104, + 104, 104, 104, 104, 104, 1, 104, 104, + 104, 105, 347, 347, 104, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 348, 104, + 104, 104, 104, 104, 104, 1, 349, 1, + 350, 349, 351, 1, 352, 353, 353, 353, + 353, 354, 355, 356, 357, 358, 359, 360, + 361, 362, 363, 354, 355, 356, 357, 358, + 359, 360, 361, 362, 363, 353, 353, 364, + 353, 353, 353, 353, 1, 104, 104, 104, + 105, 365, 365, 104, 104, 104, 104, 104, + 104, 1, 104, 104, 104, 105, 366, 366, + 104, 104, 104, 104, 104, 104, 1, 104, + 104, 104, 367, 104, 105, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 105, 368, + 368, 104, 104, 104, 104, 104, 104, 1, + 104, 104, 104, 105, 369, 369, 104, 104, + 104, 104, 104, 104, 1, 104, 104, 104, + 105, 370, 370, 104, 104, 104, 104, 104, + 104, 1, 104, 104, 104, 105, 371, 371, + 104, 104, 104, 104, 104, 104, 1, 104, + 104, 104, 105, 372, 372, 104, 104, 104, + 104, 104, 104, 1, 104, 104, 104, 105, + 373, 373, 104, 104, 104, 104, 104, 104, + 1, 104, 104, 104, 105, 374, 374, 104, + 104, 104, 104, 104, 104, 1, 104, 104, + 104, 105, 375, 375, 104, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 105, 376, + 376, 104, 104, 104, 104, 104, 104, 1, + 104, 104, 104, 105, 377, 377, 104, 104, + 104, 104, 104, 104, 1, 104, 104, 104, + 105, 378, 378, 104, 104, 104, 104, 104, + 104, 1, 104, 104, 104, 105, 379, 379, + 104, 104, 104, 104, 104, 104, 1, 104, + 104, 104, 380, 104, 104, 104, 104, 104, + 104, 1, 381, 1, 382, 381, 383, 1, + 384, 385, 385, 385, 385, 386, 387, 388, + 389, 390, 391, 392, 393, 394, 395, 386, + 387, 388, 389, 390, 391, 392, 393, 394, + 395, 385, 385, 396, 385, 385, 385, 385, + 1, 104, 104, 104, 105, 397, 397, 104, + 104, 104, 104, 104, 104, 1, 104, 104, + 104, 105, 398, 398, 104, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 105, 399, + 399, 104, 104, 104, 104, 104, 104, 1, + 104, 104, 104, 105, 400, 400, 104, 104, + 104, 104, 104, 104, 1, 104, 104, 104, + 105, 401, 401, 104, 104, 104, 104, 104, + 104, 1, 104, 104, 104, 402, 104, 105, + 104, 104, 104, 104, 104, 1, 104, 104, + 104, 105, 403, 403, 104, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 105, 404, + 404, 104, 104, 104, 104, 104, 104, 1, + 104, 104, 104, 105, 405, 405, 104, 104, + 104, 104, 104, 104, 1, 104, 104, 104, + 105, 406, 406, 104, 104, 104, 104, 104, + 104, 1, 104, 104, 104, 105, 407, 407, + 104, 104, 104, 104, 104, 104, 1, 104, + 104, 104, 105, 408, 408, 104, 104, 104, + 104, 104, 104, 1, 104, 104, 104, 409, + 104, 104, 104, 104, 104, 104, 1, 410, + 1, 411, 410, 412, 1, 413, 414, 414, + 414, 414, 415, 416, 417, 418, 419, 420, + 421, 422, 423, 424, 415, 416, 417, 418, + 419, 420, 421, 422, 423, 424, 414, 414, + 425, 414, 414, 414, 414, 1, 104, 104, + 104, 105, 426, 426, 104, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 105, 427, + 427, 104, 104, 104, 104, 104, 104, 1, + 104, 104, 104, 105, 428, 428, 104, 104, + 104, 104, 104, 104, 1, 104, 104, 104, + 105, 429, 429, 104, 104, 104, 104, 104, + 104, 1, 104, 104, 104, 105, 430, 430, + 104, 104, 104, 104, 104, 104, 1, 104, + 104, 104, 431, 104, 105, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 105, 432, + 432, 104, 104, 104, 104, 104, 104, 1, + 104, 104, 104, 105, 433, 433, 104, 104, + 104, 104, 104, 104, 1, 104, 104, 104, + 434, 104, 104, 104, 104, 104, 104, 1, + 435, 1, 436, 435, 437, 1, 438, 439, + 439, 439, 439, 440, 441, 442, 443, 444, + 445, 446, 447, 448, 449, 440, 441, 442, + 443, 444, 445, 446, 447, 448, 449, 439, + 439, 450, 439, 439, 439, 439, 1, 104, + 104, 104, 105, 451, 451, 104, 104, 104, + 104, 104, 104, 1, 104, 104, 104, 452, + 104, 105, 104, 104, 104, 104, 104, 1, + 104, 104, 104, 105, 453, 453, 104, 104, + 104, 104, 104, 104, 1, 104, 104, 104, + 105, 454, 454, 104, 104, 104, 104, 104, + 104, 1, 104, 104, 104, 105, 455, 455, + 104, 104, 104, 104, 104, 104, 1, 104, + 104, 104, 105, 456, 456, 104, 104, 104, + 104, 104, 104, 1, 104, 104, 104, 105, + 457, 457, 104, 104, 104, 104, 104, 104, + 1, 104, 104, 104, 105, 458, 458, 104, + 104, 104, 104, 104, 104, 1, 104, 104, + 104, 105, 459, 459, 104, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 460, 104, + 104, 104, 104, 104, 104, 1, 461, 1, + 462, 461, 463, 1, 464, 465, 465, 465, + 465, 466, 467, 468, 469, 470, 471, 472, + 473, 474, 475, 466, 467, 468, 469, 470, + 471, 472, 473, 474, 475, 465, 465, 476, + 465, 465, 465, 465, 1, 104, 104, 104, + 105, 477, 477, 104, 104, 104, 104, 104, + 104, 1, 104, 104, 104, 105, 478, 478, + 104, 104, 104, 104, 104, 104, 1, 104, + 104, 104, 479, 104, 105, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 105, 480, + 480, 104, 104, 104, 104, 104, 104, 1, + 104, 104, 104, 105, 481, 481, 104, 104, + 104, 104, 104, 104, 1, 104, 104, 104, + 105, 482, 482, 104, 104, 104, 104, 104, + 104, 1, 104, 104, 104, 105, 483, 483, + 104, 104, 104, 104, 104, 104, 1, 104, + 104, 104, 484, 104, 104, 104, 104, 104, + 104, 1, 485, 1, 486, 485, 487, 1, + 488, 489, 489, 489, 489, 490, 491, 492, + 493, 494, 495, 496, 497, 498, 499, 490, + 491, 492, 493, 494, 495, 496, 497, 498, + 499, 489, 489, 500, 489, 489, 489, 489, + 1, 104, 104, 104, 105, 501, 501, 104, + 104, 104, 104, 104, 104, 1, 104, 104, + 104, 105, 502, 502, 104, 104, 104, 104, + 104, 104, 1, 104, 104, 104, 105, 503, + 503, 104, 104, 104, 104, 104, 104, 1, + 104, 104, 104, 105, 504, 504, 104, 104, + 104, 104, 104, 104, 1, 104, 104, 104, + 105, 505, 505, 104, 104, 104, 104, 104, + 104, 1, 104, 104, 104, 105, 506, 506, + 104, 104, 104, 104, 104, 104, 1, 104, + 104, 104, 105, 507, 507, 104, 104, 104, + 104, 104, 104, 1, 104, 104, 104, 105, + 508, 508, 104, 104, 104, 104, 104, 104, + 1, 104, 104, 104, 509, 104, 104, 104, + 104, 104, 104, 1, 510, 1, 511, 510, + 512, 1, 513, 514, 514, 514, 514, 515, + 516, 517, 518, 519, 520, 521, 522, 523, + 524, 515, 516, 517, 518, 519, 520, 521, + 522, 523, 524, 514, 514, 525, 514, 514, + 514, 514, 1, 526, 1, 527, 1, 528, + 529, 1, 530, 1, 531, 531, 531, 532, + 531, 533, 534, 535, 536, 537, 538, 539, + 540, 541, 542, 533, 534, 535, 536, 537, + 538, 539, 540, 541, 542, 531, 531, 531, + 531, 531, 1, 543, 543, 543, 544, 543, + 543, 543, 543, 543, 543, 1, 545, 1, + 546, 1, 1, 1, 545, 547, 1, 548, + 548, 548, 549, 548, 550, 551, 552, 553, + 554, 555, 556, 557, 558, 559, 550, 551, + 552, 553, 554, 555, 556, 557, 558, 559, + 548, 548, 548, 548, 548, 1, 543, 543, + 543, 560, 543, 544, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 561, 543, 544, + 543, 543, 543, 543, 543, 1, 543, 543, + 543, 562, 543, 544, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 563, 543, 544, + 543, 543, 543, 543, 543, 1, 543, 543, + 543, 564, 543, 544, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 565, 543, 544, + 543, 543, 543, 543, 543, 1, 543, 543, + 543, 544, 543, 543, 543, 566, 566, 543, + 566, 1, 543, 567, 543, 543, 567, 544, + 568, 543, 567, 567, 567, 543, 567, 1, + 543, 569, 543, 543, 569, 544, 570, 543, + 569, 569, 569, 543, 569, 1, 543, 571, + 543, 543, 571, 544, 572, 543, 571, 571, + 571, 543, 571, 1, 543, 574, 543, 543, + 575, 544, 576, 543, 573, 574, 574, 574, + 543, 574, 1, 577, 1, 49, 1, 543, + 578, 543, 543, 579, 544, 580, 543, 573, + 578, 578, 578, 543, 578, 1, 543, 581, + 543, 543, 582, 544, 583, 543, 573, 581, + 581, 581, 543, 581, 1, 543, 584, 543, + 543, 585, 544, 586, 543, 573, 584, 584, + 584, 543, 584, 1, 543, 587, 543, 543, + 588, 544, 589, 543, 573, 587, 587, 587, + 543, 587, 1, 543, 590, 543, 543, 591, + 544, 592, 543, 573, 590, 590, 590, 543, + 590, 1, 543, 593, 543, 543, 594, 544, + 595, 543, 573, 593, 593, 593, 543, 593, + 1, 543, 596, 543, 543, 597, 544, 598, + 543, 573, 596, 596, 596, 543, 596, 1, + 543, 599, 543, 543, 600, 544, 601, 543, + 573, 599, 599, 599, 543, 599, 1, 543, + 602, 543, 543, 603, 544, 604, 543, 573, + 602, 602, 602, 543, 602, 1, 543, 605, + 543, 543, 606, 544, 607, 543, 573, 605, + 605, 605, 543, 605, 1, 543, 608, 543, + 543, 609, 544, 610, 543, 573, 608, 608, + 608, 543, 608, 1, 543, 611, 543, 543, + 612, 544, 613, 543, 573, 611, 611, 611, + 543, 611, 1, 543, 614, 543, 543, 615, + 544, 616, 543, 573, 614, 614, 614, 543, + 614, 1, 543, 617, 543, 543, 618, 544, + 619, 543, 573, 617, 617, 617, 543, 617, + 1, 543, 620, 543, 543, 621, 544, 622, + 543, 573, 620, 620, 620, 543, 620, 1, + 543, 623, 543, 543, 624, 544, 625, 543, + 573, 623, 623, 623, 543, 623, 1, 543, + 626, 543, 543, 627, 544, 628, 543, 573, + 626, 626, 626, 543, 626, 1, 543, 629, + 543, 543, 630, 544, 631, 543, 573, 629, + 629, 629, 543, 629, 1, 543, 632, 543, + 543, 633, 544, 634, 543, 573, 632, 632, + 632, 543, 632, 1, 543, 635, 543, 543, + 636, 544, 637, 543, 573, 635, 635, 635, + 543, 635, 1, 543, 638, 543, 543, 639, + 544, 640, 543, 573, 638, 638, 638, 543, + 638, 1, 543, 641, 543, 543, 642, 544, + 643, 543, 573, 641, 641, 641, 543, 641, + 1, 543, 644, 543, 543, 645, 544, 646, + 543, 573, 644, 644, 644, 543, 644, 1, + 543, 647, 543, 543, 648, 544, 649, 543, + 573, 647, 647, 647, 543, 647, 1, 543, + 650, 543, 543, 651, 544, 652, 543, 573, + 650, 650, 650, 543, 650, 1, 543, 653, + 543, 543, 654, 544, 655, 543, 573, 653, + 653, 653, 543, 653, 1, 543, 656, 543, + 543, 657, 544, 658, 543, 573, 656, 656, + 656, 543, 656, 1, 543, 543, 543, 543, + 659, 544, 543, 573, 543, 543, 543, 543, + 1, 577, 543, 543, 543, 544, 543, 543, + 543, 543, 543, 543, 1, 577, 543, 543, + 543, 543, 659, 544, 543, 573, 543, 543, + 543, 543, 1, 573, 573, 1, 577, 543, + 656, 543, 543, 657, 544, 658, 543, 573, + 656, 656, 656, 543, 656, 1, 658, 660, + 658, 573, 658, 658, 658, 658, 1, 577, + 573, 573, 1, 577, 543, 653, 543, 543, + 654, 544, 655, 543, 573, 653, 653, 653, + 543, 653, 1, 655, 661, 655, 573, 655, + 655, 655, 655, 1, 577, 658, 660, 658, + 573, 658, 658, 658, 658, 1, 577, 543, + 650, 543, 543, 651, 544, 652, 543, 573, + 650, 650, 650, 543, 650, 1, 652, 662, + 652, 573, 652, 652, 652, 652, 1, 577, + 655, 661, 655, 573, 655, 655, 655, 655, + 1, 577, 543, 647, 543, 543, 648, 544, + 649, 543, 573, 647, 647, 647, 543, 647, + 1, 649, 663, 649, 573, 649, 649, 649, + 649, 1, 577, 652, 662, 652, 573, 652, + 652, 652, 652, 1, 577, 543, 644, 543, + 543, 645, 544, 646, 543, 573, 644, 644, + 644, 543, 644, 1, 646, 664, 646, 573, + 646, 646, 646, 646, 1, 577, 649, 663, + 649, 573, 649, 649, 649, 649, 1, 577, + 543, 641, 543, 543, 642, 544, 643, 543, + 573, 641, 641, 641, 543, 641, 1, 643, + 665, 643, 573, 643, 643, 643, 643, 1, + 577, 646, 664, 646, 573, 646, 646, 646, + 646, 1, 577, 543, 638, 543, 543, 639, + 544, 640, 543, 573, 638, 638, 638, 543, + 638, 1, 640, 666, 640, 573, 640, 640, + 640, 640, 1, 577, 643, 665, 643, 573, + 643, 643, 643, 643, 1, 577, 543, 635, + 543, 543, 636, 544, 637, 543, 573, 635, + 635, 635, 543, 635, 1, 637, 667, 637, + 573, 637, 637, 637, 637, 1, 577, 640, + 666, 640, 573, 640, 640, 640, 640, 1, + 577, 543, 632, 543, 543, 633, 544, 634, + 543, 573, 632, 632, 632, 543, 632, 1, + 634, 668, 634, 573, 634, 634, 634, 634, + 1, 577, 637, 667, 637, 573, 637, 637, + 637, 637, 1, 577, 543, 629, 543, 543, + 630, 544, 631, 543, 573, 629, 629, 629, + 543, 629, 1, 631, 669, 631, 573, 631, + 631, 631, 631, 1, 577, 634, 668, 634, + 573, 634, 634, 634, 634, 1, 577, 543, + 626, 543, 543, 627, 544, 628, 543, 573, + 626, 626, 626, 543, 626, 1, 628, 670, + 628, 573, 628, 628, 628, 628, 1, 577, + 631, 669, 631, 573, 631, 631, 631, 631, + 1, 577, 543, 623, 543, 543, 624, 544, + 625, 543, 573, 623, 623, 623, 543, 623, + 1, 625, 671, 625, 573, 625, 625, 625, + 625, 1, 577, 628, 670, 628, 573, 628, + 628, 628, 628, 1, 577, 543, 620, 543, + 543, 621, 544, 622, 543, 573, 620, 620, + 620, 543, 620, 1, 622, 672, 622, 573, + 622, 622, 622, 622, 1, 577, 625, 671, + 625, 573, 625, 625, 625, 625, 1, 577, + 543, 617, 543, 543, 618, 544, 619, 543, + 573, 617, 617, 617, 543, 617, 1, 619, + 673, 619, 573, 619, 619, 619, 619, 1, + 577, 622, 672, 622, 573, 622, 622, 622, + 622, 1, 577, 543, 614, 543, 543, 615, + 544, 616, 543, 573, 614, 614, 614, 543, + 614, 1, 616, 674, 616, 573, 616, 616, + 616, 616, 1, 577, 619, 673, 619, 573, + 619, 619, 619, 619, 1, 577, 543, 611, + 543, 543, 612, 544, 613, 543, 573, 611, + 611, 611, 543, 611, 1, 613, 675, 613, + 573, 613, 613, 613, 613, 1, 577, 616, + 674, 616, 573, 616, 616, 616, 616, 1, + 577, 543, 608, 543, 543, 609, 544, 610, + 543, 573, 608, 608, 608, 543, 608, 1, + 610, 676, 610, 573, 610, 610, 610, 610, + 1, 577, 613, 675, 613, 573, 613, 613, + 613, 613, 1, 577, 543, 605, 543, 543, + 606, 544, 607, 543, 573, 605, 605, 605, + 543, 605, 1, 607, 677, 607, 573, 607, + 607, 607, 607, 1, 577, 610, 676, 610, + 573, 610, 610, 610, 610, 1, 577, 543, + 602, 543, 543, 603, 544, 604, 543, 573, + 602, 602, 602, 543, 602, 1, 604, 678, + 604, 573, 604, 604, 604, 604, 1, 577, + 607, 677, 607, 573, 607, 607, 607, 607, + 1, 577, 543, 599, 543, 543, 600, 544, + 601, 543, 573, 599, 599, 599, 543, 599, + 1, 601, 679, 601, 573, 601, 601, 601, + 601, 1, 577, 604, 678, 604, 573, 604, + 604, 604, 604, 1, 577, 543, 596, 543, + 543, 597, 544, 598, 543, 573, 596, 596, + 596, 543, 596, 1, 598, 680, 598, 573, + 598, 598, 598, 598, 1, 577, 601, 679, + 601, 573, 601, 601, 601, 601, 1, 577, + 543, 593, 543, 543, 594, 544, 595, 543, + 573, 593, 593, 593, 543, 593, 1, 595, + 681, 595, 573, 595, 595, 595, 595, 1, + 577, 598, 680, 598, 573, 598, 598, 598, + 598, 1, 577, 543, 590, 543, 543, 591, + 544, 592, 543, 573, 590, 590, 590, 543, + 590, 1, 592, 682, 592, 573, 592, 592, + 592, 592, 1, 577, 595, 681, 595, 573, + 595, 595, 595, 595, 1, 577, 543, 587, + 543, 543, 588, 544, 589, 543, 573, 587, + 587, 587, 543, 587, 1, 589, 683, 589, + 573, 589, 589, 589, 589, 1, 577, 592, + 682, 592, 573, 592, 592, 592, 592, 1, + 577, 543, 584, 543, 543, 585, 544, 586, + 543, 573, 584, 584, 584, 543, 584, 1, + 586, 684, 586, 573, 586, 586, 586, 586, + 1, 577, 589, 683, 589, 573, 589, 589, + 589, 589, 1, 577, 543, 581, 543, 543, + 582, 544, 583, 543, 573, 581, 581, 581, + 543, 581, 1, 583, 685, 583, 573, 583, + 583, 583, 583, 1, 577, 586, 684, 586, + 573, 586, 586, 586, 586, 1, 577, 543, + 578, 543, 543, 579, 544, 580, 543, 573, + 578, 578, 578, 543, 578, 1, 580, 686, + 580, 573, 580, 580, 580, 580, 1, 577, + 583, 685, 583, 573, 583, 583, 583, 583, + 1, 576, 687, 576, 573, 576, 576, 576, + 576, 1, 577, 580, 686, 580, 573, 580, + 580, 580, 580, 1, 572, 572, 572, 572, + 572, 572, 572, 1, 570, 570, 570, 570, + 570, 570, 570, 1, 543, 543, 543, 544, + 688, 688, 543, 543, 543, 543, 543, 543, + 1, 543, 543, 543, 544, 689, 689, 543, + 543, 543, 543, 543, 543, 1, 543, 543, + 543, 544, 690, 690, 543, 543, 543, 543, + 543, 543, 1, 543, 543, 543, 544, 691, + 692, 691, 692, 543, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 544, 693, 693, + 543, 543, 543, 543, 543, 543, 1, 543, + 543, 543, 544, 694, 694, 543, 543, 543, + 543, 543, 543, 1, 543, 543, 543, 544, + 695, 695, 543, 543, 543, 543, 543, 543, + 1, 543, 543, 543, 544, 696, 696, 543, + 543, 543, 543, 543, 543, 1, 543, 543, + 543, 544, 697, 697, 543, 543, 543, 543, + 543, 543, 1, 543, 543, 543, 544, 698, + 698, 543, 543, 543, 543, 543, 543, 1, + 543, 543, 543, 544, 699, 699, 543, 543, + 543, 543, 543, 543, 1, 543, 543, 543, + 544, 700, 700, 543, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 544, 701, 701, + 543, 543, 543, 543, 543, 543, 1, 543, + 543, 543, 702, 543, 544, 543, 543, 543, + 543, 543, 1, 543, 543, 543, 544, 703, + 703, 543, 543, 543, 543, 543, 543, 1, + 543, 543, 543, 544, 704, 704, 543, 543, + 543, 543, 543, 543, 1, 543, 543, 543, + 544, 705, 705, 543, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 544, 706, 706, + 543, 543, 543, 543, 543, 543, 1, 543, + 543, 543, 707, 543, 543, 543, 543, 543, + 543, 1, 708, 1, 709, 708, 710, 1, + 711, 711, 711, 712, 711, 713, 714, 715, + 716, 717, 718, 719, 720, 721, 722, 713, + 714, 715, 716, 717, 718, 719, 720, 721, + 722, 711, 711, 711, 711, 711, 1, 543, + 543, 543, 544, 723, 723, 543, 543, 543, + 543, 543, 543, 1, 543, 543, 543, 544, + 724, 724, 543, 543, 543, 543, 543, 543, + 1, 543, 543, 543, 544, 725, 725, 543, + 543, 543, 543, 543, 543, 1, 543, 543, + 543, 726, 543, 544, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 544, 727, 727, + 543, 543, 543, 543, 543, 543, 1, 543, + 543, 543, 544, 728, 728, 543, 543, 543, + 543, 543, 543, 1, 543, 543, 543, 544, + 729, 729, 543, 543, 543, 543, 543, 543, + 1, 543, 543, 543, 544, 730, 730, 543, + 543, 543, 543, 543, 543, 1, 543, 543, + 543, 544, 731, 731, 543, 543, 543, 543, + 543, 543, 1, 543, 543, 543, 732, 543, + 543, 543, 543, 543, 543, 1, 733, 1, + 734, 733, 735, 1, 736, 736, 736, 737, + 736, 738, 739, 740, 741, 742, 743, 744, + 745, 746, 747, 738, 739, 740, 741, 742, + 743, 744, 745, 746, 747, 736, 736, 736, + 736, 736, 1, 543, 543, 543, 544, 748, + 748, 543, 543, 543, 543, 543, 543, 1, + 543, 543, 543, 544, 749, 749, 543, 543, + 543, 543, 543, 543, 1, 543, 543, 543, + 544, 750, 750, 543, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 544, 751, 751, + 543, 543, 543, 543, 543, 543, 1, 543, + 543, 543, 544, 752, 752, 543, 543, 543, + 543, 543, 543, 1, 543, 543, 543, 544, + 753, 753, 543, 543, 543, 543, 543, 543, + 1, 543, 543, 543, 754, 543, 544, 543, + 543, 543, 543, 543, 1, 543, 543, 543, + 544, 755, 755, 543, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 544, 756, 756, + 543, 543, 543, 543, 543, 543, 1, 543, + 543, 543, 544, 757, 757, 543, 543, 543, + 543, 543, 543, 1, 543, 543, 543, 544, + 758, 758, 543, 543, 543, 543, 543, 543, + 1, 543, 543, 543, 759, 543, 543, 543, + 543, 543, 543, 1, 760, 1, 761, 760, + 762, 1, 763, 763, 763, 764, 763, 765, + 766, 767, 768, 769, 770, 771, 772, 773, + 774, 765, 766, 767, 768, 769, 770, 771, + 772, 773, 774, 763, 763, 763, 763, 763, + 1, 543, 543, 543, 544, 775, 775, 543, + 543, 543, 543, 543, 543, 1, 543, 543, + 543, 544, 776, 776, 543, 543, 543, 543, + 543, 543, 1, 543, 543, 543, 544, 777, + 777, 543, 543, 543, 543, 543, 543, 1, + 543, 543, 543, 544, 778, 778, 543, 543, + 543, 543, 543, 543, 1, 543, 543, 543, + 544, 779, 779, 543, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 544, 780, 780, + 543, 543, 543, 543, 543, 543, 1, 543, + 543, 543, 781, 543, 543, 543, 543, 543, + 543, 1, 782, 1, 783, 782, 784, 1, + 785, 785, 785, 786, 785, 787, 788, 789, + 790, 791, 792, 793, 794, 795, 796, 787, + 788, 789, 790, 791, 792, 793, 794, 795, + 796, 785, 785, 785, 785, 785, 1, 543, + 543, 543, 544, 797, 798, 797, 798, 543, + 543, 543, 543, 543, 543, 1, 543, 543, + 543, 544, 799, 799, 543, 543, 543, 543, + 543, 543, 1, 543, 543, 543, 544, 800, + 800, 543, 543, 543, 543, 543, 543, 1, + 543, 543, 543, 544, 801, 801, 543, 543, + 543, 543, 543, 543, 1, 543, 543, 543, + 544, 802, 802, 543, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 544, 803, 803, + 543, 543, 543, 543, 543, 543, 1, 543, + 543, 543, 804, 543, 544, 543, 543, 543, + 543, 543, 1, 543, 543, 543, 544, 805, + 805, 543, 543, 543, 543, 543, 543, 1, + 543, 543, 543, 544, 806, 806, 543, 543, + 543, 543, 543, 543, 1, 543, 543, 543, + 544, 807, 807, 543, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 544, 808, 808, + 543, 543, 543, 543, 543, 543, 1, 543, + 543, 543, 544, 809, 809, 543, 543, 543, + 543, 543, 543, 1, 543, 543, 543, 544, + 810, 810, 543, 543, 543, 543, 543, 543, + 1, 543, 543, 543, 811, 543, 543, 543, + 543, 543, 543, 1, 812, 1, 813, 812, + 814, 1, 815, 815, 815, 816, 815, 817, + 818, 819, 820, 821, 822, 823, 824, 825, + 826, 817, 818, 819, 820, 821, 822, 823, + 824, 825, 826, 815, 815, 815, 815, 815, + 1, 543, 543, 543, 544, 827, 828, 829, + 827, 828, 829, 543, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 544, 830, 830, + 543, 543, 543, 543, 543, 543, 1, 543, + 543, 543, 831, 543, 544, 543, 543, 543, + 543, 543, 1, 543, 543, 543, 544, 832, + 832, 543, 543, 543, 543, 543, 543, 1, + 543, 543, 543, 544, 833, 833, 543, 543, + 543, 543, 543, 543, 1, 543, 543, 543, + 544, 834, 834, 543, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 544, 835, 835, + 543, 543, 543, 543, 543, 543, 1, 543, + 543, 543, 544, 836, 836, 543, 543, 543, + 543, 543, 543, 1, 543, 543, 543, 544, + 837, 837, 543, 543, 543, 543, 543, 543, + 1, 543, 543, 543, 544, 838, 838, 543, + 543, 543, 543, 543, 543, 1, 543, 543, + 543, 839, 543, 543, 543, 543, 543, 543, + 1, 840, 1, 841, 840, 842, 1, 843, + 843, 843, 844, 843, 845, 846, 847, 848, + 849, 850, 851, 852, 853, 854, 845, 846, + 847, 848, 849, 850, 851, 852, 853, 854, + 843, 843, 843, 843, 843, 1, 543, 543, + 543, 544, 855, 856, 855, 856, 543, 543, + 543, 543, 543, 543, 1, 543, 543, 543, + 544, 857, 857, 543, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 544, 858, 858, + 543, 543, 543, 543, 543, 543, 1, 543, + 543, 543, 544, 859, 859, 543, 543, 543, + 543, 543, 543, 1, 543, 543, 543, 544, + 860, 860, 543, 543, 543, 543, 543, 543, + 1, 543, 543, 543, 861, 543, 543, 543, + 543, 543, 543, 1, 862, 1, 863, 862, + 864, 1, 865, 865, 865, 866, 865, 867, + 868, 869, 870, 871, 872, 873, 874, 875, + 876, 867, 868, 869, 870, 871, 872, 873, + 874, 875, 876, 865, 865, 865, 865, 865, + 1, 543, 543, 543, 544, 877, 877, 543, + 543, 543, 543, 543, 543, 1, 543, 543, + 543, 878, 543, 544, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 544, 879, 879, + 543, 543, 543, 543, 543, 543, 1, 543, + 543, 543, 544, 880, 880, 543, 543, 543, + 543, 543, 543, 1, 543, 543, 543, 544, + 881, 881, 543, 543, 543, 543, 543, 543, + 1, 543, 543, 543, 544, 882, 882, 543, + 543, 543, 543, 543, 543, 1, 543, 543, + 543, 883, 543, 543, 543, 543, 543, 543, + 1, 884, 1, 885, 884, 886, 1, 887, + 887, 887, 888, 887, 889, 890, 891, 892, + 893, 894, 895, 896, 897, 898, 889, 890, + 891, 892, 893, 894, 895, 896, 897, 898, + 887, 887, 887, 887, 887, 1, 543, 543, + 543, 544, 899, 899, 543, 543, 543, 543, + 543, 543, 1, 543, 543, 543, 544, 900, + 900, 543, 543, 543, 543, 543, 543, 1, + 543, 543, 543, 901, 543, 544, 543, 543, + 543, 543, 543, 1, 543, 543, 543, 544, + 902, 902, 543, 543, 543, 543, 543, 543, + 1, 543, 543, 543, 544, 903, 903, 543, + 543, 543, 543, 543, 543, 1, 543, 543, + 543, 544, 904, 904, 543, 543, 543, 543, + 543, 543, 1, 543, 543, 543, 544, 905, + 905, 543, 543, 543, 543, 543, 543, 1, + 543, 543, 543, 906, 543, 543, 543, 543, + 543, 543, 1, 907, 1, 908, 907, 909, + 1, 910, 910, 910, 911, 910, 912, 913, + 914, 915, 916, 917, 918, 919, 920, 921, + 912, 913, 914, 915, 916, 917, 918, 919, + 920, 921, 910, 910, 910, 910, 910, 1, + 543, 543, 543, 544, 922, 922, 543, 543, + 543, 543, 543, 543, 1, 543, 543, 543, + 544, 923, 923, 543, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 924, 543, 544, + 543, 543, 543, 543, 543, 1, 543, 543, + 543, 544, 925, 925, 543, 543, 543, 543, + 543, 543, 1, 543, 543, 543, 544, 926, + 926, 543, 543, 543, 543, 543, 543, 1, + 543, 543, 543, 544, 927, 927, 543, 543, + 543, 543, 543, 543, 1, 543, 543, 543, + 544, 928, 928, 543, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 544, 929, 929, + 543, 543, 543, 543, 543, 543, 1, 543, + 543, 543, 544, 930, 930, 543, 543, 543, + 543, 543, 543, 1, 543, 543, 543, 544, + 931, 931, 543, 543, 543, 543, 543, 543, + 1, 543, 543, 543, 544, 932, 932, 543, + 543, 543, 543, 543, 543, 1, 543, 543, + 543, 544, 933, 933, 543, 543, 543, 543, + 543, 543, 1, 543, 543, 543, 544, 934, + 934, 543, 543, 543, 543, 543, 543, 1, + 543, 543, 543, 544, 935, 935, 543, 543, + 543, 543, 543, 543, 1, 543, 543, 543, + 544, 936, 936, 543, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 937, 543, 543, + 543, 543, 543, 543, 1, 938, 1, 939, + 938, 940, 1, 941, 941, 941, 942, 941, + 943, 944, 945, 946, 947, 948, 949, 950, + 951, 952, 943, 944, 945, 946, 947, 948, + 949, 950, 951, 952, 941, 941, 941, 941, + 941, 1, 543, 543, 543, 544, 953, 953, + 543, 543, 543, 543, 543, 543, 1, 543, + 543, 543, 544, 954, 954, 543, 543, 543, + 543, 543, 543, 1, 543, 543, 543, 544, + 955, 955, 543, 543, 543, 543, 543, 543, + 1, 543, 543, 543, 544, 956, 956, 543, + 543, 543, 543, 543, 543, 1, 543, 543, + 543, 544, 957, 957, 543, 543, 543, 543, + 543, 543, 1, 543, 543, 543, 958, 543, + 544, 543, 543, 543, 543, 543, 1, 543, + 543, 543, 544, 959, 959, 543, 543, 543, + 543, 543, 543, 1, 543, 543, 543, 544, + 960, 960, 543, 543, 543, 543, 543, 543, + 1, 543, 543, 543, 544, 961, 961, 543, + 543, 543, 543, 543, 543, 1, 543, 543, + 543, 544, 962, 962, 543, 543, 543, 543, + 543, 543, 1, 543, 543, 543, 544, 963, + 963, 543, 543, 543, 543, 543, 543, 1, + 543, 543, 543, 544, 964, 964, 543, 543, + 543, 543, 543, 543, 1, 543, 543, 543, + 965, 543, 543, 543, 543, 543, 543, 1, + 966, 1, 967, 966, 968, 1, 969, 969, + 969, 970, 969, 971, 972, 973, 974, 975, + 976, 977, 978, 979, 980, 971, 972, 973, + 974, 975, 976, 977, 978, 979, 980, 969, + 969, 969, 969, 969, 1, 543, 543, 543, + 544, 981, 981, 543, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 544, 982, 982, + 543, 543, 543, 543, 543, 543, 1, 543, + 543, 543, 544, 983, 983, 543, 543, 543, + 543, 543, 543, 1, 543, 543, 543, 544, + 984, 984, 543, 543, 543, 543, 543, 543, + 1, 543, 543, 543, 544, 985, 985, 543, + 543, 543, 543, 543, 543, 1, 543, 543, + 543, 986, 543, 544, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 544, 987, 987, + 543, 543, 543, 543, 543, 543, 1, 543, + 543, 543, 544, 988, 988, 543, 543, 543, + 543, 543, 543, 1, 543, 543, 543, 989, + 543, 543, 543, 543, 543, 543, 1, 990, + 1, 991, 990, 992, 1, 993, 993, 993, + 994, 993, 995, 996, 997, 998, 999, 1000, + 1001, 1002, 1003, 1004, 995, 996, 997, 998, + 999, 1000, 1001, 1002, 1003, 1004, 993, 993, + 993, 993, 993, 1, 543, 543, 543, 544, + 1005, 1005, 543, 543, 543, 543, 543, 543, + 1, 543, 543, 543, 1006, 543, 544, 543, + 543, 543, 543, 543, 1, 543, 543, 543, + 544, 1007, 1007, 543, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 544, 1008, 1008, + 543, 543, 543, 543, 543, 543, 1, 543, + 543, 543, 544, 1009, 1009, 543, 543, 543, + 543, 543, 543, 1, 543, 543, 543, 544, + 1010, 1010, 543, 543, 543, 543, 543, 543, + 1, 543, 543, 543, 544, 1011, 1011, 543, + 543, 543, 543, 543, 543, 1, 543, 543, + 543, 544, 1012, 1012, 543, 543, 543, 543, + 543, 543, 1, 543, 543, 543, 544, 1013, + 1013, 543, 543, 543, 543, 543, 543, 1, + 543, 543, 543, 1014, 543, 543, 543, 543, + 543, 543, 1, 1015, 1, 1016, 1015, 1017, + 1, 1018, 1018, 1018, 1019, 1018, 1020, 1021, + 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, + 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, + 1028, 1029, 1018, 1018, 1018, 1018, 1018, 1, + 543, 543, 543, 544, 1030, 1030, 543, 543, + 543, 543, 543, 543, 1, 543, 543, 543, + 544, 1031, 1031, 543, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 1032, 543, 544, + 543, 543, 543, 543, 543, 1, 543, 543, + 543, 544, 1033, 1033, 543, 543, 543, 543, + 543, 543, 1, 543, 543, 543, 544, 1034, + 1034, 543, 543, 543, 543, 543, 543, 1, + 543, 543, 543, 544, 1035, 1035, 543, 543, + 543, 543, 543, 543, 1, 543, 543, 543, + 544, 1036, 1036, 543, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 1037, 543, 543, + 543, 543, 543, 543, 1, 1038, 1, 1039, + 1038, 1040, 1, 1041, 1041, 1041, 1042, 1041, + 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, + 1051, 1052, 1043, 1044, 1045, 1046, 1047, 1048, + 1049, 1050, 1051, 1052, 1041, 1041, 1041, 1041, + 1041, 1, 543, 543, 543, 544, 1053, 1053, + 543, 543, 543, 543, 543, 543, 1, 543, + 543, 543, 544, 1054, 1054, 543, 543, 543, + 543, 543, 543, 1, 543, 543, 543, 544, + 1055, 1055, 543, 543, 543, 543, 543, 543, + 1, 543, 543, 543, 544, 1056, 1056, 543, + 543, 543, 543, 543, 543, 1, 543, 543, + 543, 544, 1057, 1057, 543, 543, 543, 543, + 543, 543, 1, 543, 543, 543, 544, 1058, + 1058, 543, 543, 543, 543, 543, 543, 1, + 543, 543, 543, 544, 1059, 1059, 543, 543, + 543, 543, 543, 543, 1, 543, 543, 543, + 544, 1060, 1060, 543, 543, 543, 543, 543, + 543, 1, 543, 543, 543, 1061, 543, 543, + 543, 543, 543, 543, 1, 1062, 1, 1063, + 1062, 1064, 1, 1065, 1065, 1065, 1066, 1065, + 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, + 1075, 1076, 1067, 1068, 1069, 1070, 1071, 1072, + 1073, 1074, 1075, 1076, 1065, 1065, 1065, 1065, + 1065, 1, 1078, 1, 1, 1, 1077, 1080, + 1, 1, 1, 1079, 1081, 1082, 1, 10, + 1083, 1083, 1083, 1083, 1083, 1083, 1083, 1, + 10, 1084, 1084, 1084, 1084, 1084, 1084, 1084, + 1, 10, 1085, 1085, 1085, 1085, 1085, 1085, + 1085, 1, 10, 1086, 1086, 1086, 1086, 1086, + 1086, 1086, 1, 10, 1087, 1087, 1087, 1087, + 1087, 1087, 1087, 1, 10, 1088, 1088, 1088, + 1088, 1088, 1088, 1088, 1, 10, 1089, 1089, + 1089, 1089, 1089, 1089, 1089, 1, 10, 1090, + 1090, 1090, 1090, 1090, 1090, 1090, 1, 10, + 1091, 1091, 1091, 1091, 1091, 1091, 1091, 1, + 10, 1092, 1092, 1092, 1092, 1092, 1092, 1092, + 1, 10, 1093, 1093, 1093, 1093, 1093, 1093, + 1093, 1, 10, 1094, 1094, 1094, 1094, 1094, + 1094, 1094, 1, 10, 1095, 1095, 1095, 1095, + 1095, 1095, 1095, 1, 10, 1096, 1096, 1096, + 1096, 1096, 1096, 1096, 1, 10, 1097, 1097, + 1097, 1097, 1097, 1097, 1097, 1, 10, 1098, + 1098, 1098, 1098, 1098, 1098, 1098, 1, 10, + 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1, + 10, 1100, 1100, 1100, 1100, 1100, 1100, 1100, + 1, 10, 1101, 1101, 1101, 1101, 1101, 1101, + 1101, 1, 10, 1102, 1102, 1102, 1102, 1102, + 1102, 1102, 1, 10, 1103, 1103, 1103, 1103, + 1103, 1103, 1103, 1, 10, 1104, 1104, 1104, + 1104, 1104, 1104, 1104, 1, 10, 1105, 1105, + 1105, 1105, 1105, 1105, 1105, 1, 10, 1106, + 1106, 1106, 1106, 1106, 1106, 1106, 1, 10, + 1107, 1107, 1107, 1107, 1107, 1107, 1107, 1, + 10, 1108, 1108, 1108, 1108, 1108, 1108, 1108, + 1, 10, 1109, 1109, 1109, 1109, 1109, 1109, + 1109, 1, 10, 1, 1110, 0 +}; + +static const short _tmsrp_machine_message_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 673, 12, 312, 672, 13, + 14, 88, 93, 116, 130, 146, 157, 175, + 190, 200, 211, 223, 15, 16, 17, 16, + 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 32, 87, + 31, 701, 33, 86, 34, 85, 35, 84, + 36, 83, 37, 82, 38, 81, 39, 80, + 40, 79, 41, 78, 42, 77, 43, 76, + 44, 75, 45, 74, 46, 73, 47, 72, + 48, 71, 49, 70, 50, 69, 51, 68, + 52, 67, 53, 66, 54, 65, 55, 64, + 56, 63, 57, 62, 58, 61, 59, 60, + 88, 89, 90, 91, 92, 14, 88, 93, + 116, 130, 146, 157, 175, 190, 200, 211, + 223, 19, 94, 95, 96, 97, 299, 98, + 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, + 115, 14, 88, 93, 116, 130, 146, 157, + 175, 190, 200, 211, 223, 19, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 14, 88, 93, 116, 130, + 146, 157, 175, 190, 200, 211, 223, 19, + 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 14, + 88, 93, 116, 130, 146, 157, 175, 190, + 200, 211, 223, 19, 147, 148, 149, 150, + 151, 152, 153, 154, 155, 156, 14, 88, + 93, 116, 130, 146, 157, 175, 190, 200, + 211, 223, 19, 158, 287, 159, 160, 161, + 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 14, 88, 93, + 116, 130, 146, 157, 175, 190, 200, 211, + 223, 19, 176, 260, 273, 177, 178, 179, + 180, 181, 182, 183, 184, 185, 186, 187, + 188, 189, 14, 88, 93, 116, 130, 146, + 157, 175, 190, 200, 211, 223, 19, 191, + 243, 192, 193, 194, 195, 196, 197, 198, + 199, 14, 88, 93, 116, 130, 146, 157, + 175, 190, 200, 211, 223, 19, 201, 202, + 203, 204, 205, 206, 207, 208, 209, 210, + 14, 88, 93, 116, 130, 146, 157, 175, + 190, 200, 211, 223, 19, 212, 213, 214, + 215, 216, 217, 218, 219, 220, 221, 222, + 14, 88, 93, 116, 130, 146, 157, 175, + 190, 200, 211, 223, 19, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, + 235, 236, 237, 238, 239, 240, 241, 242, + 14, 88, 93, 116, 130, 146, 157, 175, + 190, 200, 211, 223, 19, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, + 255, 256, 257, 258, 259, 14, 88, 93, + 116, 130, 146, 157, 175, 190, 200, 211, + 223, 19, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 14, 88, + 93, 116, 130, 146, 157, 175, 190, 200, + 211, 223, 19, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, + 14, 88, 93, 116, 130, 146, 157, 175, + 190, 200, 211, 223, 19, 288, 289, 290, + 291, 292, 293, 294, 295, 296, 297, 298, + 14, 88, 93, 116, 130, 146, 157, 175, + 190, 200, 211, 223, 19, 300, 301, 302, + 303, 304, 305, 306, 307, 308, 309, 310, + 311, 14, 88, 93, 116, 130, 146, 157, + 175, 190, 200, 211, 223, 19, 313, 314, + 315, 670, 316, 317, 322, 451, 474, 488, + 504, 515, 533, 548, 558, 569, 581, 317, + 318, 319, 320, 321, 317, 322, 451, 474, + 488, 504, 515, 533, 548, 558, 569, 581, + 323, 324, 325, 326, 327, 328, 329, 330, + 450, 331, 449, 332, 447, 333, 335, 444, + 445, 334, 336, 441, 442, 337, 438, 439, + 338, 435, 436, 339, 432, 433, 340, 429, + 430, 341, 426, 427, 342, 423, 424, 343, + 420, 421, 344, 417, 418, 345, 414, 415, + 346, 411, 412, 347, 408, 409, 348, 405, + 406, 349, 402, 403, 350, 399, 400, 351, + 396, 397, 352, 393, 394, 353, 390, 391, + 354, 387, 388, 355, 384, 385, 356, 381, + 382, 357, 378, 379, 358, 375, 376, 359, + 372, 373, 360, 369, 370, 361, 366, 367, + 362, 364, 365, 363, 368, 371, 374, 377, + 380, 383, 386, 389, 392, 395, 398, 401, + 404, 407, 410, 413, 416, 419, 422, 425, + 428, 431, 434, 437, 440, 443, 446, 448, + 452, 453, 454, 455, 657, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, + 467, 468, 469, 470, 471, 472, 473, 317, + 322, 451, 474, 488, 504, 515, 533, 548, + 558, 569, 581, 475, 476, 477, 478, 479, + 480, 481, 482, 483, 484, 485, 486, 487, + 317, 322, 451, 474, 488, 504, 515, 533, + 548, 558, 569, 581, 489, 490, 491, 492, + 493, 494, 495, 496, 497, 498, 499, 500, + 501, 502, 503, 317, 322, 451, 474, 488, + 504, 515, 533, 548, 558, 569, 581, 505, + 506, 507, 508, 509, 510, 511, 512, 513, + 514, 317, 322, 451, 474, 488, 504, 515, + 533, 548, 558, 569, 581, 516, 645, 517, + 518, 519, 520, 521, 522, 523, 524, 525, + 526, 527, 528, 529, 530, 531, 532, 317, + 322, 451, 474, 488, 504, 515, 533, 548, + 558, 569, 581, 534, 618, 631, 535, 536, + 537, 538, 539, 540, 541, 542, 543, 544, + 545, 546, 547, 317, 322, 451, 474, 488, + 504, 515, 533, 548, 558, 569, 581, 549, + 601, 550, 551, 552, 553, 554, 555, 556, + 557, 317, 322, 451, 474, 488, 504, 515, + 533, 548, 558, 569, 581, 559, 560, 561, + 562, 563, 564, 565, 566, 567, 568, 317, + 322, 451, 474, 488, 504, 515, 533, 548, + 558, 569, 581, 570, 571, 572, 573, 574, + 575, 576, 577, 578, 579, 580, 317, 322, + 451, 474, 488, 504, 515, 533, 548, 558, + 569, 581, 582, 583, 584, 585, 586, 587, + 588, 589, 590, 591, 592, 593, 594, 595, + 596, 597, 598, 599, 600, 317, 322, 451, + 474, 488, 504, 515, 533, 548, 558, 569, + 581, 602, 603, 604, 605, 606, 607, 608, + 609, 610, 611, 612, 613, 614, 615, 616, + 617, 317, 322, 451, 474, 488, 504, 515, + 533, 548, 558, 569, 581, 619, 620, 621, + 622, 623, 624, 625, 626, 627, 628, 629, + 630, 317, 322, 451, 474, 488, 504, 515, + 533, 548, 558, 569, 581, 632, 633, 634, + 635, 636, 637, 638, 639, 640, 641, 642, + 643, 644, 317, 322, 451, 474, 488, 504, + 515, 533, 548, 558, 569, 581, 646, 647, + 648, 649, 650, 651, 652, 653, 654, 655, + 656, 317, 322, 451, 474, 488, 504, 515, + 533, 548, 558, 569, 581, 658, 659, 660, + 661, 662, 663, 664, 665, 666, 667, 668, + 669, 317, 322, 451, 474, 488, 504, 515, + 533, 548, 558, 569, 581, 671, 315, 671, + 315, 12, 672, 674, 675, 676, 677, 678, + 679, 680, 681, 682, 683, 684, 685, 686, + 687, 688, 689, 690, 691, 692, 693, 694, + 695, 696, 697, 698, 699, 700, 701 +}; + +static const unsigned char _tmsrp_machine_message_trans_actions[] = { + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 0, 35, 0, 51, 1, 1, 0, + 0, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 0, 57, 159, 0, + 43, 0, 49, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 156, 0, 156, + 45, 47, 0, 156, 0, 156, 0, 156, + 0, 156, 0, 156, 0, 156, 0, 156, + 0, 156, 0, 156, 0, 156, 0, 156, + 0, 156, 0, 156, 0, 156, 0, 156, + 0, 156, 0, 156, 0, 156, 0, 156, + 0, 156, 0, 156, 0, 156, 0, 156, + 0, 156, 0, 156, 0, 156, 0, 156, + 0, 0, 0, 0, 0, 33, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, + 150, 153, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 3, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 63, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 75, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 9, + 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 81, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 11, 84, + 84, 84, 84, 84, 84, 84, 84, 84, + 84, 84, 87, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 13, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, + 90, 93, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 17, 102, 102, 102, 102, 102, + 102, 102, 102, 102, 102, 102, 105, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 23, 120, 120, 120, 120, 120, 120, + 120, 120, 120, 120, 120, 123, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 27, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 135, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 29, 138, 138, 138, 138, 138, 138, 138, + 138, 138, 138, 138, 141, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 31, 144, 144, 144, 144, 144, 144, 144, + 144, 144, 144, 144, 147, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 25, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, + 126, 129, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 19, 108, + 108, 108, 108, 108, 108, 108, 108, 108, + 108, 108, 111, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 21, 114, 114, 114, 114, 114, 114, 114, + 114, 114, 114, 114, 117, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 15, 96, 96, 96, 96, 96, 96, 96, + 96, 96, 96, 96, 99, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 5, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 69, 0, 0, + 39, 39, 0, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 0, + 0, 0, 0, 0, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, + 0, 0, 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 156, 0, 156, + 0, 45, 0, 156, 0, 0, 156, 0, + 0, 156, 0, 0, 156, 0, 0, 156, + 0, 0, 156, 0, 0, 156, 0, 0, + 156, 0, 0, 156, 0, 0, 156, 0, + 0, 156, 0, 0, 156, 0, 0, 156, + 0, 0, 156, 0, 0, 156, 0, 0, + 156, 0, 0, 156, 0, 0, 156, 0, + 0, 156, 0, 0, 156, 0, 0, 156, + 0, 0, 156, 0, 0, 156, 0, 0, + 156, 0, 0, 156, 0, 0, 156, 0, + 0, 156, 0, 156, 156, 156, 156, 156, + 156, 156, 156, 156, 156, 156, 156, 156, + 156, 156, 156, 156, 156, 156, 156, 156, + 156, 156, 156, 156, 156, 156, 156, 156, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 60, + 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 78, 78, 78, 78, 78, + 78, 78, 78, 78, 78, 78, 78, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 84, 84, 84, 84, 84, 84, 84, + 84, 84, 84, 84, 84, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 90, + 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 102, 102, 102, 102, 102, + 102, 102, 102, 102, 102, 102, 102, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 120, 120, 120, 120, 120, 120, 120, + 120, 120, 120, 120, 120, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 132, + 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 138, 138, + 138, 138, 138, 138, 138, 138, 138, 138, + 138, 138, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, + 144, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 108, 108, 108, 108, 108, 108, 108, + 108, 108, 108, 108, 108, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 114, 114, 114, 114, 114, 114, + 114, 114, 114, 114, 114, 114, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 96, 96, 96, 96, 96, 96, 96, + 96, 96, 96, 96, 96, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 1, 54, 0, + 41, 37, 0, 0, 0, 0, 0, 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 tmsrp_machine_message_start = 1; +static const int tmsrp_machine_message_first_final = 701; +static const int tmsrp_machine_message_error = 0; + +static const int tmsrp_machine_message_en_main = 1; + + +/* #line 267 "./ragel/tmsrp_parser_message.rl" */ +TSK_RAGEL_DISABLE_WARNINGS_END() + +tmsrp_message_t* tmsrp_message_parse(const void *input, tsk_size_t size) +{ + tsk_size_t msg_size; + return tmsrp_message_parse_2(input, size, &msg_size); +} + +tmsrp_message_t* tmsrp_message_parse_2(const void *input, tsk_size_t size, tsk_size_t* msg_size) +{ + tmsrp_message_t* msrp_msg = tsk_null; + const char* tag_start = tsk_null; + tmsrp_header_t* header = tsk_null; + tsk_bool_t into_endline = tsk_false; + tsk_bool_t payload_parsed = tsk_false; + + /* Ragel variables */ + int cs = 0; + const char* p = input; + const char* pe = p + size; + const char* eof = tsk_null; + + (void)(eof); + (void)(tmsrp_machine_message_first_final); + (void)(tmsrp_machine_message_error); + (void)(tmsrp_machine_message_en_main); + + *msg_size = 0; + + if(!input || !size){ + //TSK_DEBUG_ERROR("Null or empty buffer."); // --> very common case(stream): do not bother us... + goto bail; + } + + if(!(msrp_msg = tmsrp_message_create_null())){ + goto bail; + } + + TSK_RAGEL_DISABLE_WARNINGS_BEGIN() + /* Ragel init */ + +/* #line 3439 "./src/parsers/tmsrp_parser_message.c" */ + { + cs = tmsrp_machine_message_start; + } + +/* #line 308 "./ragel/tmsrp_parser_message.rl" */ + + /* Ragel execute */ + +/* #line 3448 "./src/parsers/tmsrp_parser_message.c" */ + { + int _klen; + unsigned int _trans; + short _widec; + const char *_acts; + unsigned int _nacts; + const short *_keys; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; +_resume: + _widec = (*p); + _klen = _tmsrp_machine_message_cond_lengths[cs]; + _keys = _tmsrp_machine_message_cond_keys + (_tmsrp_machine_message_cond_offsets[cs]*2); + if ( _klen > 0 ) { + const short *_lower = _keys; + const short *_mid; + const short *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( _widec < _mid[0] ) + _upper = _mid - 2; + else if ( _widec > _mid[1] ) + _lower = _mid + 2; + else { + switch ( _tmsrp_machine_message_cond_spaces[_tmsrp_machine_message_cond_offsets[cs] + ((_mid - _keys)>>1)] ) { + case 0: { + _widec = (short)(128 + ((*p) - -128)); + if ( +/* #line 192 "./ragel/tmsrp_parser_message.rl" */ + + ( into_endline || (((pe-p) >7/*seven hyphens*/) && (msrp_msg->tid) && tsk_strniequals(msrp_msg->tid, (p+7), tsk_strlen(msrp_msg->tid))) ) + ) _widec += 256; + break; + } + } + break; + } + } + } + + _keys = _tmsrp_machine_message_trans_keys + _tmsrp_machine_message_key_offsets[cs]; + _trans = _tmsrp_machine_message_index_offsets[cs]; + + _klen = _tmsrp_machine_message_single_lengths[cs]; + if ( _klen > 0 ) { + const short *_lower = _keys; + const short *_mid; + const short *_upper = _keys + _klen - 1; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + ((_upper-_lower) >> 1); + if ( _widec < *_mid ) + _upper = _mid - 1; + else if ( _widec > *_mid ) + _lower = _mid + 1; + else { + _trans += (_mid - _keys); + goto _match; + } + } + _keys += _klen; + _trans += _klen; + } + + _klen = _tmsrp_machine_message_range_lengths[cs]; + if ( _klen > 0 ) { + const short *_lower = _keys; + const short *_mid; + const short *_upper = _keys + (_klen<<1) - 2; + while (1) { + if ( _upper < _lower ) + break; + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( _widec < _mid[0] ) + _upper = _mid - 2; + else if ( _widec > _mid[1] ) + _lower = _mid + 2; + else { + _trans += ((_mid - _keys)>>1); + goto _match; + } + } + _trans += _klen; + } + +_match: + _trans = _tmsrp_machine_message_indicies[_trans]; + cs = _tmsrp_machine_message_trans_targs[_trans]; + + if ( _tmsrp_machine_message_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tmsrp_machine_message_actions + _tmsrp_machine_message_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 52 "./ragel/tmsrp_parser_message.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 59 "./ragel/tmsrp_parser_message.rl" */ + { + //FIXME: TMSRP_MSG_PARSER_ADD_HEADER(Authentication_Info); + TSK_DEBUG_WARN("Authentication_Info Not implemented"); + } + break; + case 2: +/* #line 64 "./ragel/tmsrp_parser_message.rl" */ + { + //FIXME: TMSRP_MSG_PARSER_ADD_HEADER(Authorization); + TSK_DEBUG_WARN("Authorization Not implemented"); + } + break; + case 3: +/* #line 69 "./ragel/tmsrp_parser_message.rl" */ + { + TMSRP_MSG_PARSER_ADD_HEADER(Byte_Range); + } + break; + case 4: +/* #line 73 "./ragel/tmsrp_parser_message.rl" */ + { + TMSRP_MSG_PARSER_ADD_HEADER(Content_Type); + } + break; + case 5: +/* #line 77 "./ragel/tmsrp_parser_message.rl" */ + { + TMSRP_MSG_PARSER_ADD_HEADER(Expires); + } + break; + case 6: +/* #line 81 "./ragel/tmsrp_parser_message.rl" */ + { + TMSRP_MSG_PARSER_ADD_HEADER(Failure_Report); + } + break; + case 7: +/* #line 85 "./ragel/tmsrp_parser_message.rl" */ + { + TMSRP_MSG_PARSER_ADD_HEADER(From_Path); + } + break; + case 8: +/* #line 89 "./ragel/tmsrp_parser_message.rl" */ + { + TMSRP_MSG_PARSER_ADD_HEADER(Max_Expires); + } + break; + case 9: +/* #line 93 "./ragel/tmsrp_parser_message.rl" */ + { + TMSRP_MSG_PARSER_ADD_HEADER(Message_ID); + } + break; + case 10: +/* #line 97 "./ragel/tmsrp_parser_message.rl" */ + { + TMSRP_MSG_PARSER_ADD_HEADER(Min_Expires); + } + break; + case 11: +/* #line 101 "./ragel/tmsrp_parser_message.rl" */ + { + TMSRP_MSG_PARSER_ADD_HEADER(Status); + } + break; + case 12: +/* #line 105 "./ragel/tmsrp_parser_message.rl" */ + { + TMSRP_MSG_PARSER_ADD_HEADER(Success_Report); + } + break; + case 13: +/* #line 109 "./ragel/tmsrp_parser_message.rl" */ + { + TMSRP_MSG_PARSER_ADD_HEADER(To_Path); + } + break; + case 14: +/* #line 113 "./ragel/tmsrp_parser_message.rl" */ + { + TMSRP_MSG_PARSER_ADD_HEADER(Use_Path); + } + break; + case 15: +/* #line 117 "./ragel/tmsrp_parser_message.rl" */ + { + TMSRP_MSG_PARSER_ADD_HEADER(WWW_Authenticate); + } + break; + case 16: +/* #line 121 "./ragel/tmsrp_parser_message.rl" */ + { + TMSRP_MSG_PARSER_ADD_HEADER(Dummy); + } + break; + case 17: +/* #line 125 "./ragel/tmsrp_parser_message.rl" */ + { + TSK_PARSER_SET_STRING(msrp_msg->tid); + } + break; + case 18: +/* #line 129 "./ragel/tmsrp_parser_message.rl" */ + { + if(msrp_msg->type == tmsrp_unknown){ + msrp_msg->type = tmsrp_request; + TSK_PARSER_SET_STRING(msrp_msg->line.request.method); + msrp_msg->line.request.type = tmsrp_request_get_type(msrp_msg->line.request.method); + } + else{ + //cs = %%{ write first_final; }%%; + cs = tmsrp_machine_message_error; + TSK_DEBUG_ERROR("Message type already defined."); + } + } + break; + case 19: +/* #line 143 "./ragel/tmsrp_parser_message.rl" */ + { + if(msrp_msg->type == tmsrp_unknown){ + msrp_msg->type = tmsrp_response; + TSK_PARSER_SET_INT(msrp_msg->line.response.status); + } + else{ + //cs = %%{ write first_final; }%%; + cs = tmsrp_machine_message_error; + TSK_DEBUG_ERROR("Message type already defined."); + } + } + break; + case 20: +/* #line 154 "./ragel/tmsrp_parser_message.rl" */ + { + TSK_PARSER_SET_STRING(msrp_msg->line.response.comment); + } + break; + case 21: +/* #line 159 "./ragel/tmsrp_parser_message.rl" */ + { + parse_payload(msrp_msg, tag_start, &p, pe, &payload_parsed); // will update "p" + } + break; + case 22: +/* #line 163 "./ragel/tmsrp_parser_message.rl" */ + { + // if the msrp message contain a valid content-type, then gob it otherwise continue until we reach the endline + int len; + if(parse_payload(msrp_msg, tag_start, &p, pe, &payload_parsed)){ // will update "p" + // (This space left deliberately blank) + } + else if((len = (int)(p - tag_start))>0){ + set_payload(msrp_msg, tag_start, (tsk_size_t)len); + } + } + break; + case 23: +/* #line 174 "./ragel/tmsrp_parser_message.rl" */ + { + TSK_PARSER_SET_STRING(msrp_msg->end_line.tid); + } + break; + case 24: +/* #line 178 "./ragel/tmsrp_parser_message.rl" */ + { + if(tag_start){ + msrp_msg->end_line.cflag = *tag_start; + } + else msrp_msg->end_line.cflag = '#'; + } + break; + case 25: +/* #line 185 "./ragel/tmsrp_parser_message.rl" */ + { + *msg_size = (p - (const char*)input) + 1; + } + break; + case 26: +/* #line 189 "./ragel/tmsrp_parser_message.rl" */ + { + into_endline = tsk_true; + } + break; +/* #line 3747 "./src/parsers/tmsrp_parser_message.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + +/* #line 311 "./ragel/tmsrp_parser_message.rl" */ + TSK_RAGEL_DISABLE_WARNINGS_END() + + /* Check result */ + if( cs < +/* #line 3765 "./src/parsers/tmsrp_parser_message.c" */ +701 +/* #line 314 "./ragel/tmsrp_parser_message.rl" */ + ){ + //TSK_DEBUG_ERROR("Failed to parse MSRP message."); --> very common case(stream): do not bother us... + TSK_OBJECT_SAFE_FREE(msrp_msg); + goto bail; + } + +bail: + return msrp_msg; +} + +static tsk_bool_t parse_payload(tmsrp_message_t* msrp_msg, const char* tag_start, const char** p, const char* pe, tsk_bool_t* payload_parsed) +{ + int64_t payload_len, endline_len; + tsk_bool_t can_parse_payload; + + if(*payload_parsed){ + TSK_DEBUG_INFO("payload already parsed"); + return tsk_true; + } + + if(pe && p && *p && msrp_msg && (can_parse_payload = TMSRP_HEADER_BYTE_RANGE_IS_VALID(msrp_msg->ByteRange))){ + payload_len = (msrp_msg->ByteRange->end - msrp_msg->ByteRange->start) + 1; + endline_len = 2/*CRLF*/ + 7/*hyphens*/ + tsk_strlen(msrp_msg->tid) + 2/*CRLF*/; + can_parse_payload = (pe - tag_start) > (payload_len + endline_len); + if(can_parse_payload){ + set_payload(msrp_msg, tag_start, (tsk_size_t)payload_len); + *p = ((tag_start + payload_len) - 1); + *payload_parsed = tsk_true; + return tsk_true; + } + } + return tsk_false; +} + +static void set_payload(tmsrp_message_t* msrp_msg, const void* ptr, tsk_size_t len) +{ + if(msrp_msg->Content){ + tsk_buffer_cleanup(msrp_msg->Content); + tsk_buffer_append(msrp_msg->Content, ptr, len); + } + else{ + msrp_msg->Content = tsk_buffer_create(ptr, len); + } +}
\ No newline at end of file diff --git a/tinyMSRP/src/parsers/tmsrp_parser_uri.c b/tinyMSRP/src/parsers/tmsrp_parser_uri.c new file mode 100644 index 0000000..e46339b --- /dev/null +++ b/tinyMSRP/src/parsers/tmsrp_parser_uri.c @@ -0,0 +1,637 @@ + +/* #line 1 "./ragel/tmsrp_parser_uri.rl" */ +/* +* Copyright (C) 2009-2015 Mamadou DIOP. +* +* 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 tmsrp_header_Dummy.c + * @brief MSRP Dummy header. + */ +#include "tinymsrp/parsers/tmsrp_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_string.h" + +#include <string.h> + +/*********************************** +* Ragel state machine. +*/ + +/* #line 106 "./ragel/tmsrp_parser_uri.rl" */ + + +tmsrp_uri_t *tmsrp_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; + tmsrp_uri_t *uri = tmsrp_uri_create_null(); + + const char *tag_start = tsk_null; + + TSK_RAGEL_DISABLE_WARNINGS_BEGIN() + +/* #line 54 "./src/parsers/tmsrp_parser_uri.c" */ +static const char _tmsrp_machine_parser_uri_actions[] = { + 0, 1, 0, 1, 4, 1, 5, 1, + 6, 1, 7, 1, 8, 1, 9, 1, + 10, 2, 0, 1, 2, 0, 2, 2, + 0, 3, 2, 0, 5, 2, 0, 9 + +}; + +static const short _tmsrp_machine_parser_uri_key_offsets[] = { + 0, 0, 1, 2, 3, 4, 6, 7, + 8, 25, 39, 45, 51, 58, 61, 63, + 66, 68, 71, 73, 78, 90, 103, 117, + 131, 136, 139, 141, 145, 148, 149, 152, + 153, 156, 157, 168, 175, 184, 192, 199, + 205, 212, 220, 228, 236, 238, 245, 254, + 256, 259, 261, 264, 266, 269, 272, 273, + 276, 277, 280, 281, 290, 299, 307, 315, + 323, 331, 333, 339, 348, 357, 366, 368, + 371, 374, 375, 376, 393, 409, 426, 442, + 459, 475, 492, 509, 524, 540, 557, 577, + 597, 614, 629, 646, 661, 678, 693, 712, + 729, 746, 764, 781, 797, 798, 805, 812, + 828, 843, 859, 875, 895, 917, 939, 959, + 980 +}; + +static const char _tmsrp_machine_parser_uri_trans_keys[] = { + 109, 115, 114, 112, 58, 115, 47, 47, + 33, 37, 61, 64, 91, 95, 126, 36, + 46, 48, 57, 58, 59, 65, 90, 97, + 122, 33, 37, 61, 64, 95, 126, 36, + 46, 48, 59, 65, 90, 97, 122, 48, + 57, 65, 70, 97, 102, 48, 57, 65, + 70, 97, 102, 91, 48, 57, 65, 90, + 97, 122, 46, 48, 57, 48, 57, 46, + 48, 57, 48, 57, 46, 48, 57, 48, + 57, 47, 58, 59, 48, 57, 33, 61, + 95, 126, 39, 43, 45, 57, 65, 90, + 97, 122, 33, 59, 61, 95, 126, 39, + 43, 45, 57, 65, 90, 97, 122, 33, + 37, 39, 126, 42, 43, 45, 46, 48, + 57, 65, 90, 95, 122, 33, 37, 39, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 47, 58, 59, 48, 57, + 47, 58, 59, 48, 57, 47, 59, 48, + 57, 46, 48, 57, 46, 46, 48, 57, + 46, 46, 48, 57, 46, 45, 46, 47, + 58, 59, 48, 57, 65, 90, 97, 122, + 45, 48, 57, 65, 90, 97, 122, 47, + 58, 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, 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, 46, 61, 64, 95, 126, 36, + 45, 48, 57, 58, 59, 65, 90, 97, + 122, 33, 37, 61, 64, 95, 126, 36, + 46, 48, 57, 58, 59, 65, 90, 97, + 122, 33, 37, 46, 61, 64, 95, 126, + 36, 45, 48, 57, 58, 59, 65, 90, + 97, 122, 33, 37, 61, 64, 95, 126, + 36, 46, 48, 57, 58, 59, 65, 90, + 97, 122, 33, 37, 46, 61, 64, 95, + 126, 36, 45, 48, 57, 58, 59, 65, + 90, 97, 122, 33, 37, 61, 64, 95, + 126, 36, 46, 48, 57, 58, 59, 65, + 90, 97, 122, 33, 37, 47, 58, 59, + 61, 64, 95, 126, 36, 46, 48, 57, + 65, 90, 97, 122, 33, 37, 47, 58, + 59, 61, 64, 95, 126, 36, 46, 48, + 57, 65, 90, 97, 122, 33, 37, 47, + 58, 59, 61, 64, 95, 126, 36, 57, + 65, 90, 97, 122, 33, 37, 61, 64, + 95, 126, 36, 46, 48, 57, 58, 59, + 65, 90, 97, 122, 33, 37, 47, 58, + 59, 61, 64, 95, 126, 36, 46, 48, + 57, 65, 90, 97, 122, 33, 37, 39, + 44, 61, 64, 96, 126, 36, 41, 42, + 46, 48, 57, 58, 59, 65, 90, 95, + 122, 33, 37, 39, 44, 61, 64, 96, + 126, 36, 41, 42, 46, 48, 57, 58, + 59, 65, 90, 95, 122, 33, 37, 46, + 61, 64, 95, 126, 36, 45, 48, 57, + 58, 59, 65, 90, 97, 122, 33, 37, + 46, 61, 64, 95, 126, 36, 45, 48, + 59, 65, 90, 97, 122, 33, 37, 46, + 61, 64, 95, 126, 36, 45, 48, 57, + 58, 59, 65, 90, 97, 122, 33, 37, + 46, 61, 64, 95, 126, 36, 45, 48, + 59, 65, 90, 97, 122, 33, 37, 46, + 61, 64, 95, 126, 36, 45, 48, 57, + 58, 59, 65, 90, 97, 122, 33, 37, + 46, 61, 64, 95, 126, 36, 45, 48, + 59, 65, 90, 97, 122, 33, 37, 45, + 46, 47, 58, 59, 61, 64, 95, 126, + 36, 44, 48, 57, 65, 90, 97, 122, + 33, 37, 45, 61, 64, 95, 126, 36, + 46, 48, 57, 58, 59, 65, 90, 97, + 122, 33, 37, 47, 58, 59, 61, 64, + 95, 126, 36, 46, 48, 57, 65, 90, + 97, 122, 33, 37, 45, 46, 61, 64, + 95, 126, 36, 44, 48, 57, 58, 59, + 65, 90, 97, 122, 33, 37, 45, 61, + 64, 95, 126, 36, 46, 48, 57, 58, + 59, 65, 90, 97, 122, 33, 37, 61, + 64, 95, 126, 36, 46, 48, 57, 58, + 59, 65, 90, 97, 122, 58, 59, 48, + 57, 65, 90, 97, 122, 59, 48, 57, + 65, 90, 97, 122, 33, 37, 39, 59, + 61, 126, 42, 43, 45, 46, 48, 57, + 65, 90, 95, 122, 33, 37, 39, 59, + 126, 42, 43, 45, 46, 48, 57, 65, + 90, 95, 122, 33, 37, 58, 59, 61, + 64, 95, 126, 36, 46, 48, 57, 65, + 90, 97, 122, 33, 37, 58, 59, 61, + 64, 95, 126, 36, 46, 48, 57, 65, + 90, 97, 122, 33, 37, 39, 44, 58, + 59, 61, 64, 96, 126, 36, 41, 42, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 59, 61, 126, 42, 43, 45, + 46, 48, 57, 65, 70, 71, 90, 95, + 96, 97, 102, 103, 122, 33, 37, 39, + 59, 61, 126, 42, 43, 45, 46, 48, + 57, 65, 70, 71, 90, 95, 96, 97, + 102, 103, 122, 33, 37, 39, 44, 58, + 59, 61, 64, 96, 126, 36, 41, 42, + 46, 48, 57, 65, 90, 95, 122, 33, + 37, 39, 59, 126, 42, 43, 45, 46, + 48, 57, 65, 70, 71, 90, 95, 96, + 97, 102, 103, 122, 33, 37, 39, 59, + 126, 42, 43, 45, 46, 48, 57, 65, + 70, 71, 90, 95, 96, 97, 102, 103, + 122, 0 +}; + +static const char _tmsrp_machine_parser_uri_single_lengths[] = { + 0, 1, 1, 1, 1, 2, 1, 1, + 7, 6, 0, 0, 1, 1, 0, 1, + 0, 1, 0, 3, 4, 5, 4, 4, + 3, 3, 0, 2, 1, 1, 1, 1, + 1, 1, 5, 1, 3, 2, 1, 0, + 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, 6, 7, 6, 7, + 6, 9, 9, 9, 6, 9, 8, 8, + 7, 7, 7, 7, 7, 7, 11, 7, + 9, 8, 7, 6, 1, 1, 1, 6, + 5, 8, 8, 10, 6, 6, 10, 5, + 5 +}; + +static const char _tmsrp_machine_parser_uri_range_lengths[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 5, 4, 3, 3, 3, 1, 1, 1, + 1, 1, 1, 1, 4, 4, 5, 5, + 1, 0, 1, 1, 1, 0, 1, 0, + 1, 0, 3, 3, 3, 3, 3, 3, + 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, 4, 4, 3, 5, 4, 6, 6, + 5, 4, 5, 4, 5, 4, 4, 5, + 4, 5, 5, 5, 0, 3, 3, 5, + 5, 4, 4, 5, 8, 8, 5, 8, + 8 +}; + +static const short _tmsrp_machine_parser_uri_index_offsets[] = { + 0, 0, 2, 4, 6, 8, 11, 13, + 15, 28, 39, 43, 47, 52, 55, 57, + 60, 62, 65, 67, 72, 81, 91, 101, + 111, 116, 120, 122, 126, 129, 131, 134, + 136, 139, 141, 150, 155, 162, 168, 173, + 177, 182, 188, 194, 200, 203, 208, 215, + 217, 220, 222, 225, 227, 230, 233, 235, + 238, 240, 243, 245, 252, 259, 265, 271, + 277, 283, 286, 290, 297, 304, 311, 313, + 316, 319, 321, 323, 336, 348, 361, 373, + 386, 398, 412, 426, 439, 451, 465, 480, + 495, 508, 520, 533, 545, 558, 570, 586, + 599, 613, 627, 640, 652, 654, 659, 664, + 676, 687, 700, 713, 729, 744, 759, 775, + 789 +}; + +static const unsigned char _tmsrp_machine_parser_uri_indicies[] = { + 0, 1, 2, 1, 3, 1, 4, 1, + 5, 6, 1, 7, 1, 8, 1, 9, + 10, 9, 12, 14, 9, 9, 9, 11, + 9, 13, 13, 1, 15, 16, 15, 17, + 15, 15, 15, 15, 15, 15, 1, 18, + 18, 18, 1, 15, 15, 15, 1, 14, + 19, 20, 20, 1, 21, 22, 1, 23, + 1, 24, 25, 1, 26, 1, 27, 28, + 1, 29, 1, 30, 32, 33, 31, 1, + 34, 34, 34, 34, 34, 34, 34, 34, + 1, 35, 36, 35, 35, 35, 35, 35, + 35, 35, 1, 37, 37, 37, 37, 37, + 37, 37, 37, 37, 1, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 1, 30, + 32, 33, 39, 1, 30, 32, 33, 1, + 40, 1, 41, 43, 42, 1, 27, 44, + 1, 27, 1, 24, 45, 1, 24, 1, + 21, 46, 1, 21, 1, 47, 48, 30, + 32, 33, 49, 49, 49, 1, 47, 49, + 49, 49, 1, 30, 32, 33, 50, 49, + 49, 1, 51, 52, 50, 50, 50, 1, + 51, 50, 50, 50, 1, 50, 49, 49, + 1, 54, 53, 53, 53, 1, 56, 39, + 55, 55, 55, 1, 56, 39, 57, 57, + 57, 1, 56, 39, 58, 58, 58, 1, + 56, 39, 1, 60, 59, 53, 53, 1, + 61, 56, 39, 62, 55, 55, 1, 63, + 1, 64, 65, 1, 66, 1, 67, 68, + 1, 69, 1, 39, 70, 1, 39, 71, + 1, 39, 1, 67, 72, 1, 67, 1, + 64, 73, 1, 64, 1, 61, 56, 39, + 74, 57, 57, 1, 61, 56, 39, 58, + 58, 58, 1, 76, 39, 75, 75, 75, + 1, 78, 39, 77, 77, 77, 1, 78, + 39, 79, 79, 79, 1, 78, 39, 80, + 80, 80, 1, 78, 39, 1, 81, 75, + 75, 1, 61, 78, 39, 82, 77, 77, + 1, 61, 78, 39, 83, 79, 79, 1, + 61, 78, 39, 80, 80, 80, 1, 84, + 1, 61, 85, 1, 61, 86, 1, 61, + 1, 60, 1, 15, 16, 87, 15, 17, + 15, 15, 15, 88, 15, 15, 15, 1, + 15, 16, 15, 17, 15, 15, 15, 89, + 15, 15, 15, 1, 15, 16, 90, 15, + 17, 15, 15, 15, 91, 15, 15, 15, + 1, 15, 16, 15, 17, 15, 15, 15, + 92, 15, 15, 15, 1, 15, 16, 93, + 15, 17, 15, 15, 15, 94, 15, 15, + 15, 1, 15, 16, 15, 17, 15, 15, + 15, 95, 15, 15, 15, 1, 15, 16, + 30, 97, 98, 15, 17, 15, 15, 15, + 96, 15, 15, 1, 15, 16, 30, 97, + 98, 15, 17, 15, 15, 15, 99, 15, + 15, 1, 15, 16, 30, 97, 98, 15, + 17, 15, 15, 15, 15, 15, 1, 15, + 16, 15, 17, 15, 15, 15, 100, 15, + 15, 15, 1, 15, 16, 41, 15, 102, + 15, 17, 15, 15, 15, 101, 15, 15, + 1, 103, 104, 103, 15, 15, 17, 37, + 103, 15, 103, 103, 15, 103, 103, 1, + 105, 106, 105, 15, 15, 17, 38, 105, + 15, 105, 105, 15, 105, 105, 1, 15, + 16, 93, 15, 17, 15, 15, 15, 107, + 15, 15, 15, 1, 15, 16, 93, 15, + 17, 15, 15, 15, 15, 15, 15, 1, + 15, 16, 90, 15, 17, 15, 15, 15, + 108, 15, 15, 15, 1, 15, 16, 90, + 15, 17, 15, 15, 15, 15, 15, 15, + 1, 15, 16, 87, 15, 17, 15, 15, + 15, 109, 15, 15, 15, 1, 15, 16, + 87, 15, 17, 15, 15, 15, 15, 15, + 15, 1, 15, 16, 110, 111, 30, 97, + 98, 15, 17, 15, 15, 15, 112, 112, + 112, 1, 15, 16, 110, 15, 17, 15, + 15, 15, 112, 15, 112, 112, 1, 15, + 16, 30, 97, 98, 15, 17, 15, 15, + 15, 113, 112, 112, 1, 15, 16, 114, + 115, 15, 17, 15, 15, 15, 113, 15, + 113, 113, 1, 15, 16, 114, 15, 17, + 15, 15, 15, 113, 15, 113, 113, 1, + 15, 16, 15, 17, 15, 15, 15, 113, + 15, 112, 112, 1, 5, 1, 117, 116, + 116, 116, 1, 119, 118, 118, 118, 1, + 120, 120, 120, 121, 122, 120, 120, 120, + 120, 120, 120, 1, 38, 38, 38, 121, + 38, 38, 38, 38, 38, 38, 1, 15, + 16, 15, 124, 15, 17, 15, 15, 15, + 123, 123, 123, 1, 15, 16, 15, 126, + 15, 17, 15, 15, 15, 125, 125, 125, + 1, 127, 128, 127, 15, 15, 129, 130, + 17, 120, 127, 15, 127, 127, 127, 127, + 1, 120, 120, 120, 121, 122, 120, 120, + 120, 131, 131, 120, 120, 131, 120, 1, + 120, 120, 120, 121, 122, 120, 120, 120, + 127, 127, 120, 120, 127, 120, 1, 105, + 106, 105, 15, 15, 129, 15, 17, 38, + 105, 15, 105, 105, 105, 105, 1, 38, + 38, 38, 121, 38, 38, 38, 132, 132, + 38, 38, 132, 38, 1, 38, 38, 38, + 121, 38, 38, 38, 105, 105, 38, 38, + 105, 38, 1, 0 +}; + +static const char _tmsrp_machine_parser_uri_trans_targs[] = { + 2, 0, 3, 4, 5, 6, 100, 7, + 8, 9, 10, 75, 12, 94, 40, 9, + 10, 12, 11, 13, 34, 14, 32, 15, + 16, 30, 17, 18, 28, 19, 20, 24, + 26, 101, 21, 21, 101, 103, 104, 25, + 27, 20, 27, 101, 29, 31, 33, 35, + 36, 34, 37, 38, 39, 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, 76, + 92, 77, 78, 90, 79, 80, 88, 81, + 82, 84, 105, 83, 85, 85, 105, 107, + 108, 110, 111, 89, 91, 93, 95, 96, + 94, 97, 98, 99, 102, 22, 102, 22, + 103, 22, 23, 106, 86, 106, 86, 107, + 108, 86, 87, 109, 112 +}; + +static const char _tmsrp_machine_parser_uri_trans_actions[] = { + 1, 0, 0, 0, 0, 3, 0, 0, + 0, 1, 1, 17, 26, 23, 20, 0, + 0, 5, 0, 17, 23, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 7, 0, + 7, 7, 1, 0, 11, 1, 0, 0, + 1, 9, 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, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 7, 7, 0, 1, 0, 9, 1, + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 29, 0, 13, + 0, 15, 0, 1, 29, 0, 13, 0, + 0, 15, 0, 0, 0 +}; + +static const char _tmsrp_machine_parser_uri_eof_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, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 29, 13, 15, + 15, 29, 13, 15, 15, 15, 15, 15, + 15 +}; + +static const int tmsrp_machine_parser_uri_start = 1; +static const int tmsrp_machine_parser_uri_first_final = 101; +static const int tmsrp_machine_parser_uri_error = 0; + +static const int tmsrp_machine_parser_uri_en_main = 1; + + +/* #line 120 "./ragel/tmsrp_parser_uri.rl" */ + (void)(eof); + (void)(tmsrp_machine_parser_uri_first_final); + (void)(tmsrp_machine_parser_uri_error); + (void)(tmsrp_machine_parser_uri_en_main); + +/* #line 439 "./src/parsers/tmsrp_parser_uri.c" */ + { + cs = tmsrp_machine_parser_uri_start; + } + +/* #line 125 "./ragel/tmsrp_parser_uri.rl" */ + +/* #line 446 "./src/parsers/tmsrp_parser_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 = _tmsrp_machine_parser_uri_trans_keys + _tmsrp_machine_parser_uri_key_offsets[cs]; + _trans = _tmsrp_machine_parser_uri_index_offsets[cs]; + + _klen = _tmsrp_machine_parser_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 = _tmsrp_machine_parser_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 = _tmsrp_machine_parser_uri_indicies[_trans]; + cs = _tmsrp_machine_parser_uri_trans_targs[_trans]; + + if ( _tmsrp_machine_parser_uri_trans_actions[_trans] == 0 ) + goto _again; + + _acts = _tmsrp_machine_parser_uri_actions + _tmsrp_machine_parser_uri_trans_actions[_trans]; + _nacts = (unsigned int) *_acts++; + while ( _nacts-- > 0 ) + { + switch ( *_acts++ ) + { + case 0: +/* #line 41 "./ragel/tmsrp_parser_uri.rl" */ + { + tag_start = p; + } + break; + case 1: +/* #line 46 "./ragel/tmsrp_parser_uri.rl" */ + { uri->authority.host_type = tmsrp_host_ipv4; } + break; + case 2: +/* #line 47 "./ragel/tmsrp_parser_uri.rl" */ + { uri->authority.host_type = tmsrp_host_ipv6; } + break; + case 3: +/* #line 48 "./ragel/tmsrp_parser_uri.rl" */ + { uri->authority.host_type = tmsrp_host_hostname; } + break; + case 4: +/* #line 50 "./ragel/tmsrp_parser_uri.rl" */ + { + TSK_PARSER_SET_STRING(uri->scheme); + } + break; + case 5: +/* #line 54 "./ragel/tmsrp_parser_uri.rl" */ + { + TSK_PARSER_SET_STRING(uri->authority.userinfo); + } + break; + case 6: +/* #line 58 "./ragel/tmsrp_parser_uri.rl" */ + { + TSK_PARSER_SET_STRING(uri->authority.host); + if(uri->authority.host_type == tmsrp_host_ipv6){ + tsk_strunquote_2(&uri->authority.host, '[', ']'); + } + } + break; + case 7: +/* #line 65 "./ragel/tmsrp_parser_uri.rl" */ + { + TSK_PARSER_SET_INT(uri->authority.port); + } + break; + case 8: +/* #line 69 "./ragel/tmsrp_parser_uri.rl" */ + { + TSK_PARSER_SET_STRING(uri->session_id); + } + break; + case 9: +/* #line 73 "./ragel/tmsrp_parser_uri.rl" */ + { + TSK_PARSER_SET_STRING(uri->transport); + } + break; + case 10: +/* #line 77 "./ragel/tmsrp_parser_uri.rl" */ + { + TSK_PARSER_ADD_PARAM(uri->params); + } + break; +/* #line 583 "./src/parsers/tmsrp_parser_uri.c" */ + } + } + +_again: + if ( cs == 0 ) + goto _out; + if ( ++p != pe ) + goto _resume; + _test_eof: {} + if ( p == eof ) + { + const char *__acts = _tmsrp_machine_parser_uri_actions + _tmsrp_machine_parser_uri_eof_actions[cs]; + unsigned int __nacts = (unsigned int) *__acts++; + while ( __nacts-- > 0 ) { + switch ( *__acts++ ) { + case 0: +/* #line 41 "./ragel/tmsrp_parser_uri.rl" */ + { + tag_start = p; + } + break; + case 9: +/* #line 73 "./ragel/tmsrp_parser_uri.rl" */ + { + TSK_PARSER_SET_STRING(uri->transport); + } + break; + case 10: +/* #line 77 "./ragel/tmsrp_parser_uri.rl" */ + { + TSK_PARSER_ADD_PARAM(uri->params); + } + break; +/* #line 617 "./src/parsers/tmsrp_parser_uri.c" */ + } + } + } + + _out: {} + } + +/* #line 126 "./ragel/tmsrp_parser_uri.rl" */ + TSK_RAGEL_DISABLE_WARNINGS_END() + + if( cs < +/* #line 629 "./src/parsers/tmsrp_parser_uri.c" */ +101 +/* #line 128 "./ragel/tmsrp_parser_uri.rl" */ + ){ + TSK_DEBUG_ERROR("Failed to parse MSRP/MSRPS header."); + TSK_OBJECT_SAFE_FREE(uri); + } + + return uri; +}
\ No newline at end of file diff --git a/tinyMSRP/src/session/tmsrp_config.c b/tinyMSRP/src/session/tmsrp_config.c new file mode 100644 index 0000000..4394bf0 --- /dev/null +++ b/tinyMSRP/src/session/tmsrp_config.c @@ -0,0 +1,82 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tmsrp_media.c + * @brief MSRP Session config. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#include "tinymsrp/session/tmsrp_config.h" + +#include "tsk_memory.h" + + +TINYMSRP_API tmsrp_config_t* tmsrp_config_create() +{ + return tsk_object_new(tmsrp_config_def_t); +} + + + + + + + + + + + + +//================================================================================================= +// MSRP Session config object definition +// +static void* tmsrp_config_ctor(tsk_object_t * self, va_list * app) +{ + tmsrp_config_t *config = self; + if(config){ + config->Failure_Report = tsk_true; + } + return self; +} + +static void* tmsrp_config_dtor(tsk_object_t * self) +{ + tmsrp_config_t *config = self; + if(config){ + TSK_OBJECT_SAFE_FREE(config->From_Path); + TSK_OBJECT_SAFE_FREE(config->To_Path); + } + + return self; +} + +static const tsk_object_def_t tmsrp_config_def_s = +{ + sizeof(tmsrp_config_t), + tmsrp_config_ctor, + tmsrp_config_dtor, + tsk_null, +}; +const tsk_object_def_t *tmsrp_config_def_t = &tmsrp_config_def_s; + diff --git a/tinyMSRP/src/session/tmsrp_data.c b/tinyMSRP/src/session/tmsrp_data.c new file mode 100644 index 0000000..e8c750e --- /dev/null +++ b/tinyMSRP/src/session/tmsrp_data.c @@ -0,0 +1,284 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tmsrp_data.c + * @brief MSRP input/output data. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#include "tinymsrp/session/tmsrp_data.h" + +#include "tinymsrp/session/tmsrp_config.h" + +#include "tinymsrp/parsers/tmsrp_parser_message.h" + +#include "tsk_string.h" +#include "tsk_memory.h" +#include "tsk_debug.h" + +#include <stdio.h> /* fopen, fclose ... */ + +#define TMSRP_DATA_IN_MAX_BUFFER 0xFFFFFF + +tmsrp_data_in_t* tmsrp_data_in_create() +{ + return tsk_object_new(tmsrp_data_in_def_t); +} + +tmsrp_data_out_t* _tmsrp_data_out_create(const void* pdata, tsk_size_t size, tsk_bool_t isfilepath) +{ + return tsk_object_new(tmsrp_data_out_def_t, pdata, size, isfilepath); +} + +tmsrp_data_out_t* tmsrp_data_out_create(const void* pdata, tsk_size_t size) +{ + return _tmsrp_data_out_create(pdata, size, tsk_false); +} + +tmsrp_data_out_t* tmsrp_data_out_file_create(const char* filepath) +{ + return _tmsrp_data_out_create(filepath, tsk_strlen(filepath), tsk_true); +} + + +/* =========================== Common ============================= */ +static int tmsrp_data_deinit(tmsrp_data_t* self) +{ + if(!self){ + TSK_DEBUG_ERROR("Invalid parameter"); + return -1; + } + + TSK_FREE(self->id); + TSK_FREE(self->ctype); + TSK_FREE(self->wctype); + + return 0; +} + + + + + + + +/* =========================== Incoming ============================= */ + +int tmsrp_data_in_put(tmsrp_data_in_t* self, const void* pdata, tsk_size_t size) +{ + int ret = -1; + + if(!self || !self->buffer || !pdata || !size){ + TSK_DEBUG_ERROR("Invalid parameter"); + return ret; + } + + if((ret = tsk_buffer_append(self->buffer, pdata, size))){ + TSK_DEBUG_ERROR("Failed to append data"); + tsk_buffer_cleanup(self->buffer); + return ret; + } + else{ + if(TSK_BUFFER_SIZE(self->buffer) > TMSRP_DATA_IN_MAX_BUFFER){ + tsk_buffer_cleanup(self->buffer); + TSK_DEBUG_ERROR("Too many bytes are waiting."); + return -3; + } + } + + return ret; +} + +tmsrp_message_t* tmsrp_data_in_get(tmsrp_data_in_t* self) +{ + tmsrp_message_t* ret; + tsk_size_t msg_size; + + if(!self || !self->buffer || !TSK_BUFFER_DATA(self->buffer) || !TSK_BUFFER_SIZE(self->buffer)){ + //...this is not an error + return tsk_null; + } + + if((ret = tmsrp_message_parse_2(self->buffer->data, self->buffer->size, &msg_size))){ + tsk_buffer_remove(self->buffer, 0, msg_size); + return ret; + } + + return tsk_null; +} + + +/* =========================== Outgoing ============================= */ + +tsk_buffer_t* tmsrp_data_out_get(tmsrp_data_out_t* self) +{ + tsk_buffer_t* ret = tsk_null; + tsk_size_t toread; + + if(!self){ + return tsk_null; + } + + if(!(toread = self->size > TMSRP_MAX_CHUNK_SIZE ? TMSRP_MAX_CHUNK_SIZE : self->size)){ + return tsk_null; + } + + if(self->message){ + ret = tsk_buffer_create(TSK_BUFFER_DATA(self->message), toread); + tsk_buffer_remove(self->message, 0, toread); + self->size = self->message->size; + } + else if(self->file){ + // Buffer hack + tsk_size_t read; + ret = tsk_buffer_create_null(); + ret->data = tsk_calloc(toread, sizeof(uint8_t)); + ret->size = toread; + if((read = (tsk_size_t)fread(ret->data, sizeof(uint8_t), toread, self->file)) == toread){ + self->size -= toread; + } + else{ + TSK_OBJECT_SAFE_FREE(ret); + } + } + + + return ret; +} + + + + + + + + +//================================================================================================= +// MSRP incoming data object definition +// +static void* tmsrp_data_in_ctor(tsk_object_t * self, va_list * app) +{ + tmsrp_data_in_t *data_in = self; + if(data_in){ + data_in->buffer = tsk_buffer_create_null(); + } + return self; +} + +static void* tmsrp_data_in_dtor(tsk_object_t * self) +{ + tmsrp_data_in_t *data_in = self; + if(data_in){ + tmsrp_data_deinit(TMSRP_DATA(data_in)); + TSK_OBJECT_SAFE_FREE(data_in->buffer); + } + + return self; +} + +static const tsk_object_def_t tmsrp_data_in_def_s = +{ + sizeof(tmsrp_data_in_t), + tmsrp_data_in_ctor, + tmsrp_data_in_dtor, + tsk_null, +}; +const tsk_object_def_t *tmsrp_data_in_def_t = &tmsrp_data_in_def_s; + +//================================================================================================= +// MSRP outgoing data object definition +// +static void* tmsrp_data_out_ctor(tsk_object_t * self, va_list * app) +{ + tmsrp_data_out_t *data_out = self; + if(data_out){ + tsk_istr_t id; + const void* pdata = va_arg(*app, const void*); + tsk_size_t size = va_arg(*app, tsk_size_t); + tsk_bool_t isfilepath = va_arg(*app, tsk_bool_t); + + if(isfilepath){ + if((data_out->file = fopen((const char*)pdata, "rb"))){ + int ret; + if((ret = fseek(data_out->file, 0L, SEEK_END))){ + TSK_DEBUG_ERROR("fseek for file:[%s] failed with error code %d.", (const char*)pdata, ret); + TMSRP_DATA(data_out)->isOK = tsk_false; + } + else{ + data_out->size = ftell(data_out->file); + if((ret = fseek(data_out->file, 0L, SEEK_SET))){ + TSK_DEBUG_ERROR("fseek for file:[%s] failed with error code %d.", (const char*)pdata, ret); + TMSRP_DATA(data_out)->isOK = tsk_false; + } + else{ + TMSRP_DATA(data_out)->isOK = tsk_true; + } + } + } + else{ + TSK_DEBUG_ERROR("Failed to open(rb) this file:[%s]", (const char*)pdata); + TMSRP_DATA(data_out)->isOK = tsk_false; + } + } + else{ + if((data_out->message = tsk_buffer_create(pdata, size))){ + TMSRP_DATA(data_out)->isOK = (data_out->message->size == size); + data_out->size = data_out->message->size; + } + } + + // content type + TMSRP_DATA(data_out)->ctype = tsk_strdup("application/octet-stream"); + TMSRP_DATA(data_out)->wctype = tsk_strdup("text/plain"); + // random id + tsk_strrandom(&id); + TMSRP_DATA(data_out)->id = tsk_strdup(id); + } + return self; +} + +static void* tmsrp_data_out_dtor(tsk_object_t * self) +{ + tmsrp_data_out_t *data_out = self; + if(data_out){ + tmsrp_data_deinit(TMSRP_DATA(data_out)); + TSK_OBJECT_SAFE_FREE(data_out->message); + + if(data_out->file){ + fclose(data_out->file); + data_out->file = tsk_null; + } + } + + return self; +} + +static const tsk_object_def_t tmsrp_data_out_def_s = +{ + sizeof(tmsrp_data_out_t), + tmsrp_data_out_ctor, + tmsrp_data_out_dtor, + tsk_null, +}; +const tsk_object_def_t *tmsrp_data_out_def_t = &tmsrp_data_out_def_s; diff --git a/tinyMSRP/src/session/tmsrp_receiver.c b/tinyMSRP/src/session/tmsrp_receiver.c new file mode 100644 index 0000000..3ec1333 --- /dev/null +++ b/tinyMSRP/src/session/tmsrp_receiver.c @@ -0,0 +1,203 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tmsrp_receiver.c + * @brief MSRP receiver. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#include "tinymsrp/session/tmsrp_receiver.h" + +#include "tmsrp.h" + +#include "tnet_utils.h" + +#include "tsk_memory.h" +#include "tsk_string.h" +#include "tsk_debug.h" + +static void _tmsrp_receiver_alert_user(tmsrp_receiver_t* self, tsk_bool_t outgoing, tmsrp_message_t* message) +{ + if(self->callback.func){ + tmsrp_event_t* _event = tmsrp_event_create(self->callback.data, outgoing, tmsrp_event_type_message, message); + self->callback.func(_event); + TSK_OBJECT_SAFE_FREE(_event); + } +} + +tmsrp_receiver_t* tmsrp_receiver_create(tmsrp_config_t* config, tnet_fd_t fd) +{ + return tsk_object_new(tmsrp_receiver_def_t, config, fd); +} + +int tmsrp_receiver_set_fd(tmsrp_receiver_t* self, tnet_fd_t fd) +{ + if(!self){ + TSK_DEBUG_ERROR("Invalid parameter"); + return -1; + } + self->fd = fd; + return 0; +} + +int tmsrp_receiver_start(tmsrp_receiver_t* self, const void* callback_data, tmsrp_event_cb_f func) +{ + if(!self){ + TSK_DEBUG_ERROR("Invalid parameter"); + return -1; + } + + self->callback.data = callback_data; + self->callback.func = func; + + return 0; +} + +int tmsrp_receiver_stop(tmsrp_receiver_t* self) +{ + return 0; +} + +int tmsrp_receiver_recv(tmsrp_receiver_t* self, const void* data, tsk_size_t size) +{ + tmsrp_message_t* message; + + if(!self || !data || !size){ + TSK_DEBUG_ERROR("Invalid parameter"); + return -1; + } + + // put the data + tmsrp_data_in_put(self->data_in, data, size); + // get msrp messages + while((message = tmsrp_data_in_get(self->data_in))){ + + /* alert that we have received a message (Request or Response) */ + _tmsrp_receiver_alert_user(self, tsk_false, message); + + // + // REQUEST + // + if(TMSRP_MESSAGE_IS_REQUEST(message)){ + /* ============= SEND =============== */ + if(TMSRP_REQUEST_IS_SEND(message)){ + tmsrp_response_t* r2xx; + tmsrp_request_t* REPORT; + + // send 200 OK + if((r2xx = tmsrp_create_response(message, 200, "OK"))){ + if(tmsrp_message_serialize(r2xx, self->buffer) == 0 && self->buffer->data){ + tnet_sockfd_send(self->fd, self->buffer->data, self->buffer->size, 0); + } + + tsk_buffer_cleanup(self->buffer); + TSK_OBJECT_SAFE_FREE(r2xx); + } + // send REPORT + if(tmsrp_isReportRequired(message, tsk_false)){ + if((REPORT = tmsrp_create_report(message, 200, "OK"))){ + if(tmsrp_message_serialize(REPORT, self->buffer) == 0 && self->buffer->data){ + tnet_sockfd_send(self->fd, self->buffer->data, self->buffer->size, 0); + } + tsk_buffer_cleanup(self->buffer); + TSK_OBJECT_SAFE_FREE(REPORT); + } + } + } + /* ============= REPORT =============== */ + if(TMSRP_REQUEST_IS_REPORT(message)){ + tmsrp_response_t* r2xx; + + // send 200 OK + if((r2xx = tmsrp_create_response(message, 200, "Report received"))){ + if(tmsrp_message_serialize(r2xx, self->buffer) == 0 && self->buffer->data){ + tnet_sockfd_send(self->fd, self->buffer->data, self->buffer->size, 0); + } + + tsk_buffer_cleanup(self->buffer); + TSK_OBJECT_SAFE_FREE(r2xx); + } + } + + /* ============= AUTH =============== */ + /* ============= METHOD =============== */ + } + // + // RESPONSE + // + else{ + //short code = TMSRP_RESPONSE_CODE(message); + //TSK_DEBUG_INFO("code=%u, tid=%s, phrase=%s", code, message->tid, TMSRP_RESPONSE_PHRASE(message)); + } + + + // alert user layer + + TSK_OBJECT_SAFE_FREE(message); + } + + return 0; +} + + +//================================================================================================= +// MSRP receiver object definition +// +static void* tmsrp_receiver_ctor(tsk_object_t * self, va_list *app) +{ + tmsrp_receiver_t *receiver = self; + if(receiver){ + receiver->config = tsk_object_ref(va_arg(*app, tmsrp_config_t*)); + receiver->fd = va_arg(*app, tnet_fd_t); + + receiver->data_in = tmsrp_data_in_create(); + receiver->buffer = tsk_buffer_create_null(); + } + return self; +} + +static void* tmsrp_receiver_dtor(tsk_object_t * self) +{ + tmsrp_receiver_t *receiver = self; + if(receiver){ + /* Stop */ + tmsrp_receiver_stop(receiver); + + TSK_OBJECT_SAFE_FREE(receiver->config); + TSK_OBJECT_SAFE_FREE(receiver->data_in); + TSK_OBJECT_SAFE_FREE(receiver->buffer); + // the FD is owned by the transport ...do not close it + } + return self; +} + +static const tsk_object_def_t tmsrp_receiver_def_s = +{ + sizeof(tmsrp_receiver_t), + tmsrp_receiver_ctor, + tmsrp_receiver_dtor, + tsk_null, +}; +const tsk_object_def_t *tmsrp_receiver_def_t = &tmsrp_receiver_def_s; + diff --git a/tinyMSRP/src/session/tmsrp_sender.c b/tinyMSRP/src/session/tmsrp_sender.c new file mode 100644 index 0000000..5fdf86f --- /dev/null +++ b/tinyMSRP/src/session/tmsrp_sender.c @@ -0,0 +1,286 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tmsrp_sender.c + * @brief MSRP sender. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#include "tinymsrp/session/tmsrp_sender.h" + +#include "tnet_utils.h" + +#include "tsk_thread.h" +#include "tsk_memory.h" +#include "tsk_string.h" +#include "tsk_time.h" +#include "tsk_debug.h" + + +static void* TSK_STDCALL run(void* self); + + +tmsrp_sender_t* tmsrp_sender_create(tmsrp_config_t* config, tnet_fd_t fd) +{ + return (tmsrp_sender_t*)tsk_object_new(tmsrp_sender_def_t, config, fd); +} + +int tmsrp_sender_set_fd(tmsrp_sender_t* self, tnet_fd_t fd) +{ + if(!self){ + TSK_DEBUG_ERROR("Invalid parameter"); + return -1; + } + self->fd = fd; + return 0; +} + +int tmsrp_sender_start(tmsrp_sender_t* self) +{ + int ret = -1; + + if(!self){ + TSK_DEBUG_ERROR("Invalid parameter"); + goto bail; + } + + TSK_RUNNABLE(self)->run = run; + if((ret = tsk_runnable_start(TSK_RUNNABLE(self), tmsrp_data_out_def_t))){ + goto bail; + } + +bail: + return ret; +} + +int tsmrp_sender_send_data(tmsrp_sender_t* self, const void* pdata, tsk_size_t size, const char* ctype, const char* wctype) +{ + tmsrp_data_out_t* data_out; + + if(!self){ + TSK_DEBUG_ERROR("Invalid parameter"); + return -1; + } + + if((data_out = tmsrp_data_out_create(pdata, size))){ + if(ctype){ + tsk_strupdate(&TMSRP_DATA(data_out)->ctype, ctype); + } + if(wctype){ + tsk_strupdate(&TMSRP_DATA(data_out)->wctype, wctype); + } + TSK_RUNNABLE_ENQUEUE_OBJECT(self, data_out); + return 0; + } + return -2; +} + +int tsmrp_sender_send_file(tmsrp_sender_t* self, const char* filepath) +{ + tmsrp_data_out_t* data_out; + + if(!self || !filepath){ + TSK_DEBUG_ERROR("Invalid parameter"); + return -1; + } + + if((data_out = tmsrp_data_out_file_create(filepath))){ + if(TMSRP_DATA(data_out)->isOK){ + TSK_RUNNABLE_ENQUEUE_OBJECT(self, data_out); + return 0; + } + else{ + TSK_OBJECT_SAFE_FREE(data_out); + return -3; + } + } + return -2; +} + +int tmsrp_sender_stop(tmsrp_sender_t* self) +{ + int ret = -1; + + if(!self){ + TSK_DEBUG_ERROR("Invalid parameter"); + goto bail; + } + + if((ret = tsk_runnable_stop(TSK_RUNNABLE(self)))){ + goto bail; + } + +bail: + return ret; +} + + + + +static void* TSK_STDCALL run(void* self) +{ + tsk_list_item_t *curr; + tmsrp_sender_t *sender = (tmsrp_sender_t*)self; + tmsrp_data_out_t *data_out; + tsk_buffer_t* chunck, *message = tsk_buffer_create_null(); + tsk_size_t start; + tsk_size_t end; + tsk_size_t total; + tsk_istr_t tid; + int64_t __now = (int64_t)tsk_time_now(); + tsk_bool_t error = tsk_false; + + TSK_DEBUG_INFO("MSRP SENDER::run -- START"); + + TSK_RUNNABLE_RUN_BEGIN(sender); + + if((curr = TSK_RUNNABLE_POP_FIRST(sender))){ + if(!(data_out = (tmsrp_data_out_t*)curr->data)){ + continue; + } + + error = tsk_false; + start = 1; + total = data_out->size; + + while(TSK_RUNNABLE(self)->running && !error && (chunck = tmsrp_data_out_get(data_out))){ + tmsrp_request_t* SEND; + // set end + end = (start + chunck->size) - 1; + // compute new transaction id + tsk_itoa(++__now, &tid); + // create SEND request + SEND = tmsrp_request_create(tid, "SEND"); + // T-Path and From-Path (because of otherURIs) + SEND->To = tsk_object_ref(sender->config->To_Path); + SEND->From = tsk_object_ref(sender->config->From_Path); + // add other headers + tmsrp_message_add_headers(SEND, + TMSRP_HEADER_MESSAGE_ID_VA_ARGS(TMSRP_DATA(data_out)->id), + // TMSRP_HEADER_BYTE_RANGE_VA_ARGS(start, end, total), => See below + TMSRP_HEADER_FAILURE_REPORT_VA_ARGS(sender->config->Failure_Report ? freport_yes : freport_no), + TMSRP_HEADER_SUCCESS_REPORT_VA_ARGS(sender->config->Success_Report), + + tsk_null); + // add data + if(start == 1 && chunck->size && tsk_striequals(TMSRP_DATA(data_out)->ctype, "message/CPIM")){ + tsk_buffer_t* content_cpim = tsk_buffer_create_null(); + if(content_cpim){ + tsk_buffer_append_2(content_cpim, "Subject: %s\r\n\r\nContent-Type: %s\r\n\r\n", + "test", TMSRP_DATA(data_out)->wctype); + end += content_cpim->size; + total += content_cpim->size; + tsk_buffer_append(content_cpim, chunck->data, chunck->size); + tmsrp_message_add_content(SEND, TMSRP_DATA(data_out)->ctype, content_cpim->data, content_cpim->size); + TSK_OBJECT_SAFE_FREE(content_cpim); + } + else{ + TSK_DEBUG_ERROR("Failed to allocate new buffer"); + } + } + else{ + tmsrp_message_add_content(SEND, TMSRP_DATA(data_out)->ctype, chunck->data, chunck->size); + } + // add byte range here not before: think about message/cpim + tmsrp_message_add_headers(SEND, + TMSRP_HEADER_BYTE_RANGE_VA_ARGS(start, end, total), + + tsk_null); + + + // set continuation flag + SEND->end_line.cflag = (end == total) ? '$' : '+'; + // serialize and send + if(!(tmsrp_message_serialize(SEND, message))){ + if(tnet_sockfd_send(sender->fd, message->data, message->size, 0) == 0){ + error = tsk_true; + // abort + } + } + tsk_buffer_cleanup(message); + + // set start + start = (end + 1); + // cleanup + TSK_OBJECT_SAFE_FREE(chunck); + TSK_OBJECT_SAFE_FREE(SEND); + + /* wait */ + if(sender->chunck_duration){ + tsk_thread_sleep(sender->chunck_duration); + } + } + + + tsk_object_unref(curr); + } + + TSK_RUNNABLE_RUN_END(self); + + TSK_OBJECT_SAFE_FREE(message); + + TSK_DEBUG_INFO("MSRP SENDER::run -- STOP"); + + return 0; +} + + + +//================================================================================================= +// MSRP sender object definition +// +static void* tmsrp_sender_ctor(tsk_object_t * self, va_list *app) +{ + tmsrp_sender_t *sender = (tmsrp_sender_t*)self; + if(sender){ + sender->config = (tmsrp_config_t*)tsk_object_ref(va_arg(*app, tmsrp_config_t*)); + sender->fd = va_arg(*app, tnet_fd_t); + + sender->outgoingList = tsk_list_create(); + } + return self; +} + +static void* tmsrp_sender_dtor(tsk_object_t * self) +{ + tmsrp_sender_t *sender = self; + if(sender){ + /* Stop */ + tmsrp_sender_stop(sender); + + TSK_OBJECT_SAFE_FREE(sender->config); + TSK_OBJECT_SAFE_FREE(sender->outgoingList); + // the FD is owned by the transport ...do not close it + } + return self; +} + +static const tsk_object_def_t tmsrp_sender_def_s = +{ + sizeof(tmsrp_sender_t), + tmsrp_sender_ctor, + tmsrp_sender_dtor, + tsk_null, +}; +const tsk_object_def_t *tmsrp_sender_def_t = &tmsrp_sender_def_s; diff --git a/tinyMSRP/src/tmsrp.c b/tinyMSRP/src/tmsrp.c new file mode 100644 index 0000000..913b96e --- /dev/null +++ b/tinyMSRP/src/tmsrp.c @@ -0,0 +1,163 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tmsrp.c + * @brief MSRP API. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#include "tmsrp.h" + +#include "tsk_time.h" +#include "tsk_string.h" + +#define TMSR_DEFAULT_NAMESPACE 0 // "000" + +tmsrp_request_t* tmsrp_create_bodiless(const tmsrp_uri_t* To, const tmsrp_uri_t* From) +{ + /* RFC 4975 - 7.1. Constructing Requests + Requests with no bodies are useful when a client wishes to send + "traffic", but does not wish to send content to be rendered to the + peer user. For example, the active endpoint sends a SEND request + immediately upon establishing a connection. If it has nothing to + say at the moment, it can send a request with no body. Bodiless + requests may also be used in certain applications to keep Network + Address Translation (NAT) bindings alive, etc. + + Bodiless requests are distinct from requests with empty bodies. A + request with an empty body will have a Content-Type header field + value and will generally be rendered to the recipient according to + the rules for that type. + */ + tmsrp_request_t* BODILESS = tsk_null; + tsk_istr_t tid; + tsk_istr_t mid; + + tsk_strrandom(&tid); + tsk_strrandom(&mid); + + if(!(BODILESS = tmsrp_request_create(tid, "SEND"))){ + goto bail; + } + // To-Path + // From-Path + // Message-ID + tmsrp_message_add_headers(BODILESS, + TMSRP_HEADER_TO_PATH_VA_ARGS(To), + TMSRP_HEADER_FROM_PATH_VA_ARGS(From), + TMSRP_HEADER_MESSAGE_ID_VA_ARGS(mid), + + tsk_null); + +bail: + return BODILESS; +} + +tmsrp_response_t* tmsrp_create_response(const tmsrp_request_t* request, short status, const char* comment) +{ + tmsrp_response_t* response = tsk_null; + + if(!request){ + goto bail; + } + /* MSRP response will have the same tid ==> nothing to do */ + if(!(response = tmsrp_response_create(request->tid, status, comment))){ + goto bail; + } + /* reverse To-Path and From-Path */ + response->To = (tmsrp_header_To_Path_t*)tmsrp_header_From_Path_clone(request->From); + TMSRP_HEADER(response->To)->type = tmsrp_htype_To_Path; /* as it's a clone we shall change type */ + response->From = (tmsrp_header_From_Path_t*)tmsrp_header_To_Path_clone(request->To); + TMSRP_HEADER(response->From)->type = tmsrp_htype_From_Path; /* as it's a clone we shall change type */ + /* Byte-Range */ + response->ByteRange = tsk_object_ref((void*)request->ByteRange); + +bail: + return response; +} + +tmsrp_request_t* tmsrp_create_report(const tmsrp_request_t* SEND, short status, const char* reason) +{ + /* RFC 4975 - 7.1.2. Sending REPORT Requests + + * REPORT requests are similar to SEND requests, except that report + * requests MUST NOT include Success-Report or Failure-Report header + * fields, and MUST contain a Status header field. REPORT requests MUST + * contain the Message-ID header field from the original SEND request. + */ + tmsrp_request_t* REPORT = tsk_null; + tsk_istr_t tid; + + /* If an MSRP element receives a REPORT for a Message-ID it does not + recognize, it SHOULD silently ignore the REPORT. + */ + if(!SEND || !SEND->MessageID){ + goto bail; + } + + /* Generate new tid (Report has it's own tid) */ + tsk_strrandom(&tid); + + /* MSRP response will have the same tid ==> nothing to do */ + if(!(REPORT = tmsrp_request_create(tid, "REPORT"))){ + goto bail; + } + + /* reverse To-Path and From-Path */ + REPORT->To = (tmsrp_header_To_Path_t*)tmsrp_header_From_Path_clone(SEND->From); + TMSRP_HEADER(REPORT->To)->type = tmsrp_htype_To_Path; /* as it's a clone we shall change type */ + REPORT->From = (tmsrp_header_From_Path_t*)tmsrp_header_To_Path_clone(SEND->To); + TMSRP_HEADER(REPORT->From)->type = tmsrp_htype_From_Path; /* as it's a clone we shall change type */ + /* Byte-Range */ + REPORT->ByteRange = tsk_object_ref((void*)SEND->ByteRange); + + /* Message ID */ + /* Status */ + tmsrp_message_add_headers(REPORT, + TMSRP_HEADER_MESSAGE_ID_VA_ARGS(SEND->MessageID->value), + TMSRP_HEADER_STATUS_VA_ARGS(TMSR_DEFAULT_NAMESPACE, status, reason), + + tsk_null); +bail: + return REPORT; +} + +tsk_bool_t tmsrp_isReportRequired(const tmsrp_request_t* request, tsk_bool_t failed) +{ + if(!request){ + return tsk_false; + } + + /* Success Report. */ + if(request->SuccessReport && request->SuccessReport->yes){ + return tsk_true; + } + + /* Failure Report */ + if(!request->FailureReport || (request->FailureReport && request->FailureReport->type != freport_no)){ + return failed; + } + + return tsk_false; +} diff --git a/tinyMSRP/src/tmsrp_event.c b/tinyMSRP/src/tmsrp_event.c new file mode 100644 index 0000000..1d4a930 --- /dev/null +++ b/tinyMSRP/src/tmsrp_event.c @@ -0,0 +1,89 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tmsrp_event.c + * @brief MSRP/MSRPS Event. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#include "tinymsrp/tmsrp_event.h" + +#include "tsk_debug.h" + +tmsrp_event_t* tmsrp_event_create(const void* callback_data, tsk_bool_t outgoing, tmsrp_event_type_t type, tmsrp_message_t* message) +{ + tmsrp_event_t* _event; + if((_event = tsk_object_new(tmsrp_event_def_t))){ + _event->callback_data = callback_data; + _event->outgoing = outgoing; + _event->type = type; + _event->message = tsk_object_ref(message); + } + else{ + TSK_DEBUG_ERROR("Faile to create new MSRP event"); + } + + return _event; +} + +//======================================================== +// MSRP Event definition +// + +/**@ingroup tmsrp_event_group +*/ +static tsk_object_t* tmsrp_event_ctor(tsk_object_t *self, va_list * app) +{ + tmsrp_event_t *_event = self; + if(_event){ + } + else{ + TSK_DEBUG_ERROR("Failed to create new MSRP Event"); + } + return self; +} + +/**@ingroup tmsrp_event_group +*/ +static tsk_object_t* tmsrp_event_dtor(tsk_object_t *self) +{ + tmsrp_event_t *_event = self; + if(_event){ + TSK_OBJECT_SAFE_FREE(_event->message); + } + else{ + TSK_DEBUG_ERROR("Null MSRP Event"); + } + + return self; +} + +static const tsk_object_def_t tmsrp_event_def_s = +{ + sizeof(tmsrp_event_t), + tmsrp_event_ctor, + tmsrp_event_dtor, + tsk_null +}; +const tsk_object_def_t *tmsrp_event_def_t = &tmsrp_event_def_s; diff --git a/tinyMSRP/src/tmsrp_message.c b/tinyMSRP/src/tmsrp_message.c new file mode 100644 index 0000000..ecefe60 --- /dev/null +++ b/tinyMSRP/src/tmsrp_message.c @@ -0,0 +1,465 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tmsrp_message.c + * @brief MSRP message. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ + +#include "tinymsrp/tmsrp_message.h" + +#include "tsk_string.h" +#include "tsk_memory.h" +#include "tsk_debug.h" + +/*== Predicate function to find tmsrp_header_t object by type. */ +static int pred_find_header_by_type(const tsk_list_item_t *item, const void *tmsrp_htype) +{ + if(item && item->data){ + tmsrp_header_t *header = item->data; + tmsrp_header_type_t htype = *((tmsrp_header_type_t*)tmsrp_htype); + return (header->type - htype); + } + return -1; +} + +/*== Predicate function to find tmsrp_header_t object by name. */ +static int pred_find_header_by_name(const tsk_list_item_t *item, const void *name) +{ + if(item && item->data && name){ + tmsrp_header_t *header = item->data; + return tsk_stricmp(tmsrp_header_get_nameex(header), (const char*)name); + } + return -1; +} + + +tmsrp_message_t* tmsrp_message_create(tmsrp_message_type_t type, const char* tid, const char* method, short status, const char* comment) +{ + tmsrp_message_t* message; + if((message = tsk_object_new(tmsrp_message_def_t))){ + message->type = type; + message->tid = tsk_strdup(tid); + if(message->type == tmsrp_response){ + message->line.response.status = status; + message->line.response.comment = tsk_strdup(comment); + } + else{ + message->line.request.method = tsk_strdup(method); + message->line.request.type = tmsrp_request_get_type(method); + } + + message->headers = tsk_list_create(); + + message->end_line.tid = tsk_strdup(message->tid); + message->end_line.cflag = '$'; + } + return message; +} + +tmsrp_message_t* tmsrp_request_create(const char* tid, const char* method) +{ + return tmsrp_message_create(tmsrp_request, tid, method, 0, tsk_null); +} + +tmsrp_message_t* tmsrp_response_create(const char* tid, short status, const char* comment) +{ + return tmsrp_message_create(tmsrp_response, tid, tsk_null, status, comment); +} + +tmsrp_message_t* tmsrp_message_create_null() +{ + return tmsrp_message_create(tmsrp_unknown, tsk_null, tsk_null, 0, tsk_null); +} + + +int tmsrp_message_add_header(tmsrp_message_t *self, const tmsrp_header_t *hdr) +{ + #define ADD_HEADER(type, field) \ + case tmsrp_htype_##type: \ + { \ + if(!self->field) \ + { \ + self->field = (tmsrp_header_##type##_t*)header; \ + return 0; \ + } \ + break; \ + } + + if(self && hdr) + { + tmsrp_header_t *header = tsk_object_ref((void*)hdr); + + switch(header->type) + { + ADD_HEADER(To_Path, To); + ADD_HEADER(From_Path, From); + ADD_HEADER(Message_ID, MessageID); + ADD_HEADER(Byte_Range, ByteRange); + ADD_HEADER(Failure_Report, FailureReport); + ADD_HEADER(Success_Report, SuccessReport); + ADD_HEADER(Status, Status); + ADD_HEADER(Content_Type, ContentType); + + default: break; + } + + tsk_list_push_back_data(self->headers, (void**)&header); + + return 0; + } + return -1; +} + +int tmsrp_message_add_headers(tmsrp_message_t *self, ...) +{ + const tsk_object_def_t* objdef; + tmsrp_header_t *header; + va_list ap; + + if(!self){ + TSK_DEBUG_ERROR("Invalid parameter"); + return -1; + } + + va_start(ap, self); + while((objdef = va_arg(ap, const tsk_object_def_t*))){ + if((header = tsk_object_new_2(objdef, &ap))){ + tmsrp_message_add_header(self, header); + TSK_OBJECT_SAFE_FREE(header); + } + } + va_end(ap); + + return 0; +} + +tmsrp_request_type_t tmsrp_request_get_type(const char* method) +{ + if(method){ + if(tsk_strequals(method, "SEND")){ + return tmsrp_SEND; + } + else if(tsk_strequals(method, "REPORT")){ + return tmsrp_REPORT; + } + else if(tsk_strequals(method, "AUTH")){ + return tmsrp_AUTH; + } + } + return tmsrp_NONE; +} + +const tmsrp_header_t *tmsrp_message_get_headerAt(const tmsrp_message_t *self, tmsrp_header_type_t type, tsk_size_t index) +{ + tsk_size_t pos = 0; + tsk_list_item_t *item; + const tmsrp_header_t* hdr = 0; + + if(self) + { + switch(type) + { + case tmsrp_htype_To_Path: + if(index == 0){ + hdr = (const tmsrp_header_t*)self->To; + goto bail; + }else pos++; break; + case tmsrp_htype_From_Path: + if(index == 0){ + hdr = (const tmsrp_header_t*)self->From; + goto bail; + }else pos++; break; + case tmsrp_htype_Message_ID: + if(index == 0){ + hdr = (const tmsrp_header_t*)self->MessageID; + goto bail; break; + }else pos++; + case tmsrp_htype_Byte_Range: + if(index == 0){ + hdr = (const tmsrp_header_t*)self->ByteRange; + goto bail; + }else pos++; break; + case tmsrp_htype_Failure_Report: + if(index == 0){ + hdr = (const tmsrp_header_t*)self->FailureReport; + goto bail; + }else pos++; break; + case tmsrp_htype_Success_Report: + if(index == 0){ + hdr = (const tmsrp_header_t*)self->SuccessReport; + goto bail; + }else pos++; break; + case tmsrp_htype_Status: + if(index == 0){ + hdr = (const tmsrp_header_t*)self->Status; + goto bail; + }else pos++; break; + case tmsrp_htype_Content_Type: + if(index == 0){ + hdr = (const tmsrp_header_t*)self->ContentType; + goto bail; + }else pos++; break; + default: + break; + } + + tsk_list_foreach(item, self->headers){ + if(!pred_find_header_by_type(item, &type)){ + if(pos++ >= index){ + hdr = item->data; + break; + } + } + } + } + +bail: + return hdr; +} + +const tmsrp_header_t *tmsrp_message_get_header(const tmsrp_message_t *self, tmsrp_header_type_t type) +{ + return tmsrp_message_get_headerAt(self, type, 0); +} + +const tmsrp_header_t *tmsrp_message_get_headerByName(const tmsrp_message_t *self, const char* name) +{ + if(self && self->headers){ + const tsk_list_item_t* item; + if((item = tsk_list_find_item_by_pred(self->headers, pred_find_header_by_name, name))){ + return item->data; + } + } + return tsk_null; +} + +int tmsrp_message_add_content(tmsrp_message_t *self, const char* content_type, const void* content, tsk_size_t size) +{ + if(self) + { + if(content_type){ + TSK_OBJECT_SAFE_FREE(self->ContentType); + } + TSK_OBJECT_SAFE_FREE(self->Content); + + if(content_type){ + TMSRP_MESSAGE_ADD_HEADER(self, TMSRP_HEADER_CONTENT_TYPE_VA_ARGS(content_type)); + } + self->Content = tsk_buffer_create(content, size); + + return 0; + } + return -1; +} + +int tmsrp_message_serialize(const tmsrp_message_t *self, tsk_buffer_t *output) +{ + if(!self || !output){ + return -1; + } + + if(TMSRP_MESSAGE_IS_REQUEST(self)){ + /* pMSRP SP transact-id SP method CRLF */ + tsk_buffer_append_2(output, "MSRP %s %s\r\n", self->tid, self->line.request.method); + } + else{ + /* pMSRP SP transact-id SP status-code [SP comment] CRLF */ + tsk_buffer_append_2(output, "MSRP %s %3hi%s%s\r\n", + self->tid, + self->line.response.status, + self->line.response.comment ? " " : "", + self->line.response.comment ? self->line.response.comment : "" + ); + } + + /* To-Path */ + if(self->To){ + tmsrp_header_serialize(TMSRP_HEADER(self->To), output); + } + /* From-Path */ + if(self->From){ + tmsrp_header_serialize(TMSRP_HEADER(self->From), output); + } + /* Message-Id */ + if(self->MessageID){ + tmsrp_header_serialize(TMSRP_HEADER(self->MessageID), output); + } + /* Byte-Range */ + if(self->ByteRange){ + tmsrp_header_serialize(TMSRP_HEADER(self->ByteRange), output); + } + /* Failure-Report */ + if(self->FailureReport){ + tmsrp_header_serialize(TMSRP_HEADER(self->FailureReport), output); + } + /* Success-Report */ + if(self->SuccessReport){ + tmsrp_header_serialize(TMSRP_HEADER(self->SuccessReport), output); + } + /* Status */ + if(self->Status){ + tmsrp_header_serialize(TMSRP_HEADER(self->Status), output); + } + + /* All other headers (Other-Mime-headers) + - Should be empty if no content is added (see below) but ... + */ + { + tsk_list_item_t *item; + tsk_list_foreach(item, self->headers){ + tmsrp_header_t *hdr = item->data; + tmsrp_header_serialize(hdr, output); + } + } + + /* RFC 4975 - 7.1. Constructing Requests + A request with no body MUST NOT include a Content-Type or any other + MIME-specific header fields. A request without a body MUST contain + an end-line after the final header field. No extra CRLF will be + present between the header section and the end-line. + */ + /* CONTENT */ + if(TMSRP_MESSAGE_HAS_CONTENT(self)){ + /* Content-Type */ + if(self->ContentType){ + tmsrp_header_serialize(TMSRP_HEADER(self->ContentType), output); + } + tsk_buffer_append(output, "\r\n", 2); + tsk_buffer_append(output, TSK_BUFFER_TO_STRING(self->Content), TSK_BUFFER_SIZE(self->Content)); + tsk_buffer_append(output, "\r\n", 2); + } + + /* END LINE */ + tsk_buffer_append_2(output, "-------%s%c\r\n", self->end_line.tid, self->end_line.cflag); + + return 0; +} + + +char* tmsrp_message_tostring(const tmsrp_message_t *self) +{ + tsk_buffer_t* output; + char* ret = tsk_null; + + if((output = tsk_buffer_create_null())){ + if(!tmsrp_message_serialize(self, output)){ + ret = tsk_strndup(output->data, output->size); + } + TSK_OBJECT_SAFE_FREE(output); + } + return ret; +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + +//================================================================================================= +// MSRP object definition +// +static void* tmsrp_message_ctor(tsk_object_t * self, va_list * app) +{ + tmsrp_message_t *message = self; + if(message){ + } + return self; +} + +static void* tmsrp_message_dtor(tsk_object_t * self) +{ + tmsrp_message_t *message = self; + if(message){ + TSK_FREE(message->tid); + + // request + if(TMSRP_MESSAGE_IS_REQUEST(message)){ + TSK_FREE(message->line.request.method); + } + // response + if(TMSRP_MESSAGE_IS_RESPONSE(message)){ + TSK_FREE(message->line.response.comment); + } + + // Very common headers + TSK_OBJECT_SAFE_FREE(message->To); + TSK_OBJECT_SAFE_FREE(message->From); + + TSK_OBJECT_SAFE_FREE(message->MessageID); + + TSK_OBJECT_SAFE_FREE(message->ByteRange); + TSK_OBJECT_SAFE_FREE(message->FailureReport); + TSK_OBJECT_SAFE_FREE(message->SuccessReport); + TSK_OBJECT_SAFE_FREE(message->Status); + + // all other headers + TSK_OBJECT_SAFE_FREE(message->headers); + + // content + TSK_OBJECT_SAFE_FREE(message->ContentType); + TSK_OBJECT_SAFE_FREE(message->Content); + + // end-line + TSK_FREE(message->end_line.tid); + } + return self; +} + +static int tmsrp_message_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2) +{ + return -1; +} + +static const tsk_object_def_t tmsrp_message_def_s = +{ + sizeof(tmsrp_message_t), + tmsrp_message_ctor, + tmsrp_message_dtor, + tmsrp_message_cmp, +}; +const tsk_object_def_t *tmsrp_message_def_t = &tmsrp_message_def_s; diff --git a/tinyMSRP/src/tmsrp_uri.c b/tinyMSRP/src/tmsrp_uri.c new file mode 100644 index 0000000..273616d --- /dev/null +++ b/tinyMSRP/src/tmsrp_uri.c @@ -0,0 +1,198 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tmsrp_uri.c + * @brief MSRP/MSRPS URI. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#include "tinymsrp/tmsrp_uri.h" + +#include "tinymsrp/parsers/tmsrp_parser_uri.h" + +#include "tsk_debug.h" +#include "tsk_memory.h" +#include "tsk_string.h" +#include "tsk_params.h" +#include "tsk_url.h" + +#include <string.h> + +/**@defgroup tmsrp_uri_group MSRP/MSRPS/TEL URI +*/ + + +/** Creates new msrp/msrps/tel uri. +* @param scheme "msrp" or "msrps". +* @param host Either domain name or IPv4/IPv6 address. +* @param host_type @ref tmsrp_host_type_t. +* @param port The port. +* @param session_id The session identifier. +* @param transport The associated transport (e.g. @a "tcp"). +* @retval @ref tmsrp_uri_t object. +*/ +tmsrp_uri_t* tmsrp_uri_create(const char*scheme, const char* host, tmsrp_host_type_t host_type, int32_t port, const char* session_id, const char*transport) +{ + return tsk_object_new(tmsrp_uri_def_t, scheme, host, host_type, port, session_id, transport); +} + +tmsrp_uri_t* tmsrp_uri_create_null() +{ + return tmsrp_uri_create(tsk_null, tsk_null, tmsrp_host_unknown, -1, tsk_null, tsk_null); +} + +int tmsrp_uri_serialize(const tmsrp_uri_t *uri, tsk_buffer_t *output) +{ + tsk_istr_t port; + if(!uri || !output){ + return -1; + } + + if(uri->authority.port >= 0){ + tsk_itoa(uri->authority.port, &port); + } + + /* msrp://atlanta.example.com:7654/jshA7weztas;tcp + * msrp-scheme "://" authority ["/" session-id] ";" transport *( ";" URI-parameter) + * authority = [ userinfo "@" ] host [ ":" port ] + */ + tsk_buffer_append_2(output, "%s://%s%s%s%s%s%s%s%s%s;%s", + + // scheme + uri->scheme, + + // authority + uri->authority.userinfo ? uri->authority.userinfo : "", + uri->authority.userinfo ? "@" : "", + uri->authority.host_type == tmsrp_host_ipv6 ? "[" : "", + uri->authority.host, + uri->authority.host_type == tmsrp_host_ipv6 ? "]" : "", + uri->authority.port >= 0 ? ":" : "", + uri->authority.port >= 0 ? port : "", + + // session-id + uri->session_id ? "/" : "", + uri->session_id ? uri->session_id : "", + + // transport + uri->transport + ); + + /* Params */ + if(!TSK_LIST_IS_EMPTY(uri->params)){ + tsk_buffer_append(output, ";", 1); + tsk_params_tostring(uri->params, ';', output); + } + + return 0; +} + +char* tmsrp_uri_tostring(const tmsrp_uri_t *uri) +{ + tsk_buffer_t *output = tsk_buffer_create_null(); + char* ret = 0; + + if(!tmsrp_uri_serialize(uri, output)){ + ret = tsk_strndup((const char*)output->data, output->size); + } + else{ + TSK_DEBUG_ERROR("Failed to serialize URI."); + } + + TSK_OBJECT_SAFE_FREE(output); + return ret; +} + +tmsrp_uri_t *tmsrp_uri_clone(const tmsrp_uri_t *uri) +{ + tmsrp_uri_t *newuri = 0; + tsk_buffer_t *output = tsk_buffer_create_null(); + tmsrp_uri_serialize(uri, output); + newuri = tmsrp_uri_parse(output->data, output->size); + TSK_OBJECT_SAFE_FREE(output); + + return newuri; +} + + + + + + + + +//======================================================== +// MSRP/MSRPS/TEL URI object definition +// +static tsk_object_t* tmsrp_uri_ctor(tsk_object_t *self, va_list * app) +{ + tmsrp_uri_t *uri = self; + if(uri){ + uri->scheme = tsk_strdup( va_arg(*app, const char*) ); + + // authority + uri->authority.host = tsk_strdup( va_arg(*app, const char*) ); + uri->authority.host_type = va_arg(*app, tmsrp_host_type_t); + uri->authority.port = va_arg(*app, int32_t); + + uri->session_id = tsk_strdup( va_arg(*app, const char*) ); + uri->transport = tsk_strdup( va_arg(*app, const char*) ); + + uri->params = tsk_list_create(); /* Empty list. */ + } + else{ + TSK_DEBUG_ERROR("Failed to create new MSRP/MSRPS."); + } + return self; +} + +static tsk_object_t* tmsrp_uri_dtor(tsk_object_t *self) +{ + tmsrp_uri_t *uri = self; + if(uri){ + TSK_FREE(uri->scheme); + // authority + TSK_FREE(uri->authority.userinfo); + TSK_FREE(uri->authority.host); + // + TSK_FREE(uri->session_id); + TSK_FREE(uri->transport); + + TSK_OBJECT_SAFE_FREE(uri->params); + } + else{ + TSK_DEBUG_ERROR("Null MSRP/MSRPS URI."); + } + + return self; +} + +static const tsk_object_def_t tmsrp_uri_def_s = +{ + sizeof(tmsrp_uri_t), + tmsrp_uri_ctor, + tmsrp_uri_dtor, + tsk_null +}; +const tsk_object_def_t *tmsrp_uri_def_t = &tmsrp_uri_def_s; |