summaryrefslogtreecommitdiffstats
path: root/tinyMSRP/src/headers
diff options
context:
space:
mode:
Diffstat (limited to 'tinyMSRP/src/headers')
-rw-r--r--tinyMSRP/src/headers/tmsrp_header.c112
-rw-r--r--tinyMSRP/src/headers/tmsrp_header_Authentication-Info.c2
-rw-r--r--tinyMSRP/src/headers/tmsrp_header_Authorization.c181
-rw-r--r--tinyMSRP/src/headers/tmsrp_header_Byte-Range.c384
-rw-r--r--tinyMSRP/src/headers/tmsrp_header_Content-Type.c454
-rw-r--r--tinyMSRP/src/headers/tmsrp_header_Dummy.c341
-rw-r--r--tinyMSRP/src/headers/tmsrp_header_Expires.c327
-rw-r--r--tinyMSRP/src/headers/tmsrp_header_Failure-Report.c369
-rw-r--r--tinyMSRP/src/headers/tmsrp_header_From-Path.c390
-rw-r--r--tinyMSRP/src/headers/tmsrp_header_Max-Expires.c336
-rw-r--r--tinyMSRP/src/headers/tmsrp_header_Message-ID.c440
-rw-r--r--tinyMSRP/src/headers/tmsrp_header_Min-Expires.c336
-rw-r--r--tinyMSRP/src/headers/tmsrp_header_Status.c377
-rw-r--r--tinyMSRP/src/headers/tmsrp_header_Success-Report.c349
-rw-r--r--tinyMSRP/src/headers/tmsrp_header_To-Path.c383
-rw-r--r--tinyMSRP/src/headers/tmsrp_header_Use-Path.c367
-rw-r--r--tinyMSRP/src/headers/tmsrp_header_WWW-Authenticate.c163
17 files changed, 5311 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..7985703
--- /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>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#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..fc892c9
--- /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..8af0ba1
--- /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>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#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..55430f3
--- /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 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_Byte_Range.c
+ * @brief MSRP 'Byte-Range' header.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#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 82 "./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;
+
+
+/* #line 95 "./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 131 "./ragel/tmsrp_parser_header_Byte-Range.rl" */
+
+/* #line 174 "./src/headers/tmsrp_header_Byte-Range.c" */
+ {
+ cs = tmsrp_machine_parser_header_Byte_Range_start;
+ }
+
+/* #line 132 "./ragel/tmsrp_parser_header_Byte-Range.rl" */
+
+/* #line 181 "./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 47 "./ragel/tmsrp_parser_header_Byte-Range.rl" */
+ {
+ tag_start = p;
+ }
+ break;
+ case 1:
+/* #line 51 "./ragel/tmsrp_parser_header_Byte-Range.rl" */
+ {
+ TSK_PARSER_SET_INTEGER_EX(hdr_Byte_Range->start, int64_t, atoi64);
+ }
+ break;
+ case 2:
+/* #line 55 "./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 64 "./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 289 "./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 64 "./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 316 "./src/headers/tmsrp_header_Byte-Range.c" */
+ }
+ }
+ }
+
+ _out: {}
+ }
+
+/* #line 133 "./ragel/tmsrp_parser_header_Byte-Range.rl" */
+
+ 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..56d0b9b
--- /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 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_Content_Type.c
+ * @brief MSRP Content-Type header.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#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 74 "./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;
+
+
+/* #line 92 "./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 117 "./ragel/tmsrp_parser_header_Content-Type.rl" */
+
+/* #line 256 "./src/headers/tmsrp_header_Content-Type.c" */
+ {
+ cs = tmsrp_machine_parser_header_Content_Type_start;
+ }
+
+/* #line 118 "./ragel/tmsrp_parser_header_Content-Type.rl" */
+
+/* #line 263 "./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 50 "./ragel/tmsrp_parser_header_Content-Type.rl" */
+ {
+ tag_start = p;
+ }
+ break;
+ case 1:
+/* #line 54 "./ragel/tmsrp_parser_header_Content-Type.rl" */
+ {
+ TSK_PARSER_SET_STRING(hdr_ctype->value);
+ }
+ break;
+ case 2:
+/* #line 58 "./ragel/tmsrp_parser_header_Content-Type.rl" */
+ {
+ TSK_PARSER_ADD_PARAM(hdr_ctype->params);
+ }
+ break;
+/* #line 355 "./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 54 "./ragel/tmsrp_parser_header_Content-Type.rl" */
+ {
+ TSK_PARSER_SET_STRING(hdr_ctype->value);
+ }
+ break;
+ case 2:
+/* #line 58 "./ragel/tmsrp_parser_header_Content-Type.rl" */
+ {
+ TSK_PARSER_ADD_PARAM(hdr_ctype->params);
+ }
+ break;
+/* #line 383 "./src/headers/tmsrp_header_Content-Type.c" */
+ }
+ }
+ }
+
+ _out: {}
+ }
+
+/* #line 119 "./ragel/tmsrp_parser_header_Content-Type.rl" */
+
+ 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..cfcc20f
--- /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 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_Dummy.c
+ * @brief MSRP Dummy header.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#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 65 "./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;
+
+
+/* #line 83 "./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 102 "./ragel/tmsrp_parser_header_Dummy.rl" */
+
+/* #line 145 "./src/headers/tmsrp_header_Dummy.c" */
+ {
+ cs = tmsrp_machine_parser_header_Dummy_start;
+ }
+
+/* #line 103 "./ragel/tmsrp_parser_header_Dummy.rl" */
+
+/* #line 152 "./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 47 "./ragel/tmsrp_parser_header_Dummy.rl" */
+ {
+ tag_start = p;
+ }
+ break;
+ case 1:
+/* #line 51 "./ragel/tmsrp_parser_header_Dummy.rl" */
+ {
+ TSK_PARSER_SET_STRING(hdr_Dummy->name);
+ }
+ break;
+ case 2:
+/* #line 55 "./ragel/tmsrp_parser_header_Dummy.rl" */
+ {
+ TSK_PARSER_SET_STRING(hdr_Dummy->value);
+ }
+ break;
+/* #line 244 "./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 47 "./ragel/tmsrp_parser_header_Dummy.rl" */
+ {
+ tag_start = p;
+ }
+ break;
+ case 2:
+/* #line 55 "./ragel/tmsrp_parser_header_Dummy.rl" */
+ {
+ TSK_PARSER_SET_STRING(hdr_Dummy->value);
+ }
+ break;
+/* #line 272 "./src/headers/tmsrp_header_Dummy.c" */
+ }
+ }
+ }
+
+ _out: {}
+ }
+
+/* #line 104 "./ragel/tmsrp_parser_header_Dummy.rl" */
+
+ 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..c3e065b
--- /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 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_Expires.c
+ * @brief MSRP 'Expires' header.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#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 61 "./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;
+
+
+/* #line 83 "./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 98 "./ragel/tmsrp_parser_header_Expires.rl" */
+
+/* #line 146 "./src/headers/tmsrp_header_Expires.c" */
+ {
+ cs = tmsrp_machine_parser_header_Expires_start;
+ }
+
+/* #line 99 "./ragel/tmsrp_parser_header_Expires.rl" */
+
+/* #line 153 "./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 47 "./ragel/tmsrp_parser_header_Expires.rl" */
+ {
+ tag_start = p;
+ }
+ break;
+ case 1:
+/* #line 51 "./ragel/tmsrp_parser_header_Expires.rl" */
+ {
+ TSK_PARSER_SET_INTEGER_EX(hdr_Expires->value, int64_t, atoi64)
+ }
+ break;
+/* #line 239 "./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 51 "./ragel/tmsrp_parser_header_Expires.rl" */
+ {
+ TSK_PARSER_SET_INTEGER_EX(hdr_Expires->value, int64_t, atoi64)
+ }
+ break;
+/* #line 261 "./src/headers/tmsrp_header_Expires.c" */
+ }
+ }
+ }
+
+ _out: {}
+ }
+
+/* #line 100 "./ragel/tmsrp_parser_header_Expires.rl" */
+
+ 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..079c922
--- /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 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_Failure_Report.c
+ * @brief MSRP 'Failure-Report' header.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#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 65 "./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();
+
+
+/* #line 79 "./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 98 "./ragel/tmsrp_parser_header_Failure-Report.rl" */
+
+/* #line 170 "./src/headers/tmsrp_header_Failure-Report.c" */
+ {
+ cs = tmsrp_machine_parser_header_Failure_Report_start;
+ }
+
+/* #line 99 "./ragel/tmsrp_parser_header_Failure-Report.rl" */
+
+/* #line 177 "./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 47 "./ragel/tmsrp_parser_header_Failure-Report.rl" */
+ {
+ hdr_Failure_Report->type = freport_yes;
+ }
+ break;
+ case 1:
+/* #line 51 "./ragel/tmsrp_parser_header_Failure-Report.rl" */
+ {
+ hdr_Failure_Report->type = freport_no;
+ }
+ break;
+ case 2:
+/* #line 55 "./ragel/tmsrp_parser_header_Failure-Report.rl" */
+ {
+ hdr_Failure_Report->type = freport_partial;
+ }
+ break;
+/* #line 269 "./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 47 "./ragel/tmsrp_parser_header_Failure-Report.rl" */
+ {
+ hdr_Failure_Report->type = freport_yes;
+ }
+ break;
+ case 1:
+/* #line 51 "./ragel/tmsrp_parser_header_Failure-Report.rl" */
+ {
+ hdr_Failure_Report->type = freport_no;
+ }
+ break;
+ case 2:
+/* #line 55 "./ragel/tmsrp_parser_header_Failure-Report.rl" */
+ {
+ hdr_Failure_Report->type = freport_partial;
+ }
+ break;
+/* #line 303 "./src/headers/tmsrp_header_Failure-Report.c" */
+ }
+ }
+ }
+
+ _out: {}
+ }
+
+/* #line 100 "./ragel/tmsrp_parser_header_Failure-Report.rl" */
+
+ 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..7a62b5d
--- /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 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_From_Path.c
+ * @brief MSRP "From-Path" header.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#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 75 "./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;
+
+
+/* #line 88 "./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 117 "./ragel/tmsrp_parser_header_From-Path.rl" */
+
+/* #line 155 "./src/headers/tmsrp_header_From-Path.c" */
+ {
+ cs = tmsrp_machine_parser_header_From_Path_start;
+ }
+
+/* #line 118 "./ragel/tmsrp_parser_header_From-Path.rl" */
+
+/* #line 162 "./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 47 "./ragel/tmsrp_parser_header_From-Path.rl" */
+ {
+ tag_start = p;
+ }
+ break;
+ case 1:
+/* #line 51 "./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 260 "./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 47 "./ragel/tmsrp_parser_header_From-Path.rl" */
+ {
+ tag_start = p;
+ }
+ break;
+ case 1:
+/* #line 51 "./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 300 "./src/headers/tmsrp_header_From-Path.c" */
+ }
+ }
+ }
+
+ _out: {}
+ }
+
+/* #line 119 "./ragel/tmsrp_parser_header_From-Path.rl" */
+
+ 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..e3d163d
--- /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 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_Max_Expires.c
+ * @brief MSRP 'Max-Expires' header.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#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 61 "./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;
+
+
+/* #line 83 "./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 98 "./ragel/tmsrp_parser_header_Max-Expires.rl" */
+
+/* #line 155 "./src/headers/tmsrp_header_Max-Expires.c" */
+ {
+ cs = tmsrp_machine_parser_header_Max_Expires_start;
+ }
+
+/* #line 99 "./ragel/tmsrp_parser_header_Max-Expires.rl" */
+
+/* #line 162 "./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 47 "./ragel/tmsrp_parser_header_Max-Expires.rl" */
+ {
+ tag_start = p;
+ }
+ break;
+ case 1:
+/* #line 51 "./ragel/tmsrp_parser_header_Max-Expires.rl" */
+ {
+ TSK_PARSER_SET_INTEGER_EX(hdr_Max_Expires->value, int64_t, atoi64)
+ }
+ break;
+/* #line 248 "./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 51 "./ragel/tmsrp_parser_header_Max-Expires.rl" */
+ {
+ TSK_PARSER_SET_INTEGER_EX(hdr_Max_Expires->value, int64_t, atoi64)
+ }
+ break;
+/* #line 270 "./src/headers/tmsrp_header_Max-Expires.c" */
+ }
+ }
+ }
+
+ _out: {}
+ }
+
+/* #line 100 "./ragel/tmsrp_parser_header_Max-Expires.rl" */
+
+ 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..fc4d042
--- /dev/null
+++ b/tinyMSRP/src/headers/tmsrp_header_Message-ID.c
@@ -0,0 +1,440 @@
+
+/* #line 1 "./ragel/tmsrp_parser_header_Message-ID.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_Message_Id.c
+ * @brief MSRP 'Message-Id' header.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#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 61 "./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;
+
+
+/* #line 85 "./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 100 "./ragel/tmsrp_parser_header_Message-ID.rl" */
+
+/* #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 47 "./ragel/tmsrp_parser_header_Message-ID.rl" */
+ {
+ tag_start = p;
+ }
+ break;
+ case 1:
+/* #line 51 "./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 51 "./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" */
+
+ if( cs <
+/* #line 384 "./src/headers/tmsrp_header_Message-ID.c" */
+18
+/* #line 103 "./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..ff05310
--- /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 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_Min_Expires.c
+ * @brief MSRP 'Min-Expires' header.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#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 61 "./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;
+
+
+/* #line 83 "./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 98 "./ragel/tmsrp_parser_header_Min-Expires.rl" */
+
+/* #line 155 "./src/headers/tmsrp_header_Min-Expires.c" */
+ {
+ cs = tmsrp_machine_parser_header_Min_Expires_start;
+ }
+
+/* #line 99 "./ragel/tmsrp_parser_header_Min-Expires.rl" */
+
+/* #line 162 "./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 47 "./ragel/tmsrp_parser_header_Min-Expires.rl" */
+ {
+ tag_start = p;
+ }
+ break;
+ case 1:
+/* #line 51 "./ragel/tmsrp_parser_header_Min-Expires.rl" */
+ {
+ TSK_PARSER_SET_INTEGER_EX(hdr_Min_Expires->value, int64_t, atoi64)
+ }
+ break;
+/* #line 248 "./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 51 "./ragel/tmsrp_parser_header_Min-Expires.rl" */
+ {
+ TSK_PARSER_SET_INTEGER_EX(hdr_Min_Expires->value, int64_t, atoi64)
+ }
+ break;
+/* #line 270 "./src/headers/tmsrp_header_Min-Expires.c" */
+ }
+ }
+ }
+
+ _out: {}
+ }
+
+/* #line 100 "./ragel/tmsrp_parser_header_Min-Expires.rl" */
+
+ 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..f0b8688
--- /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 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_Status.c
+ * @brief MSRP 'Status' header.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#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 71 "./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;
+
+
+/* #line 89 "./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 114 "./ragel/tmsrp_parser_header_Status.rl" */
+
+/* #line 165 "./src/headers/tmsrp_header_Status.c" */
+ {
+ cs = tmsrp_machine_parser_header_Status_start;
+ }
+
+/* #line 115 "./ragel/tmsrp_parser_header_Status.rl" */
+
+/* #line 172 "./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 47 "./ragel/tmsrp_parser_header_Status.rl" */
+ {
+ tag_start = p;
+ }
+ break;
+ case 1:
+/* #line 51 "./ragel/tmsrp_parser_header_Status.rl" */
+ {
+ TSK_PARSER_SET_INT(hdr_Status->_namespace);
+ }
+ break;
+ case 2:
+/* #line 55 "./ragel/tmsrp_parser_header_Status.rl" */
+ {
+ TSK_PARSER_SET_INT(hdr_Status->code);
+ }
+ break;
+ case 3:
+/* #line 59 "./ragel/tmsrp_parser_header_Status.rl" */
+ {
+ TSK_PARSER_SET_STRING(hdr_Status->reason);
+ }
+ break;
+/* #line 270 "./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 47 "./ragel/tmsrp_parser_header_Status.rl" */
+ {
+ tag_start = p;
+ }
+ break;
+ case 2:
+/* #line 55 "./ragel/tmsrp_parser_header_Status.rl" */
+ {
+ TSK_PARSER_SET_INT(hdr_Status->code);
+ }
+ break;
+ case 3:
+/* #line 59 "./ragel/tmsrp_parser_header_Status.rl" */
+ {
+ TSK_PARSER_SET_STRING(hdr_Status->reason);
+ }
+ break;
+/* #line 304 "./src/headers/tmsrp_header_Status.c" */
+ }
+ }
+ }
+
+ _out: {}
+ }
+
+/* #line 116 "./ragel/tmsrp_parser_header_Status.rl" */
+
+ 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..7117672
--- /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 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_Success_Report.c
+ * @brief MSRP 'Success-Report' header.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#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 61 "./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();
+
+
+/* #line 78 "./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 93 "./ragel/tmsrp_parser_header_Success-Report.rl" */
+
+/* #line 162 "./src/headers/tmsrp_header_Success-Report.c" */
+ {
+ cs = tmsrp_machine_parser_header_Success_Report_start;
+ }
+
+/* #line 94 "./ragel/tmsrp_parser_header_Success-Report.rl" */
+
+/* #line 169 "./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 47 "./ragel/tmsrp_parser_header_Success-Report.rl" */
+ {
+ hdr_Success_Report->yes = 1;
+ }
+ break;
+ case 1:
+/* #line 51 "./ragel/tmsrp_parser_header_Success-Report.rl" */
+ {
+ hdr_Success_Report->yes = 0;
+ }
+ break;
+/* #line 255 "./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 47 "./ragel/tmsrp_parser_header_Success-Report.rl" */
+ {
+ hdr_Success_Report->yes = 1;
+ }
+ break;
+ case 1:
+/* #line 51 "./ragel/tmsrp_parser_header_Success-Report.rl" */
+ {
+ hdr_Success_Report->yes = 0;
+ }
+ break;
+/* #line 283 "./src/headers/tmsrp_header_Success-Report.c" */
+ }
+ }
+ }
+
+ _out: {}
+ }
+
+/* #line 95 "./ragel/tmsrp_parser_header_Success-Report.rl" */
+
+ 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..d48574f
--- /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 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_To_Path.c
+ * @brief MSRP "To-Path" header.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#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 75 "./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;
+
+
+/* #line 87 "./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 116 "./ragel/tmsrp_parser_header_To-Path.rl" */
+
+/* #line 149 "./src/headers/tmsrp_header_To-Path.c" */
+ {
+ cs = tmsrp_machine_parser_header_To_Path_start;
+ }
+
+/* #line 117 "./ragel/tmsrp_parser_header_To-Path.rl" */
+
+/* #line 156 "./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 47 "./ragel/tmsrp_parser_header_To-Path.rl" */
+ {
+ tag_start = p;
+ }
+ break;
+ case 1:
+/* #line 51 "./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 253 "./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 47 "./ragel/tmsrp_parser_header_To-Path.rl" */
+ {
+ tag_start = p;
+ }
+ break;
+ case 1:
+/* #line 51 "./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 293 "./src/headers/tmsrp_header_To-Path.c" */
+ }
+ }
+ }
+
+ _out: {}
+ }
+
+/* #line 118 "./ragel/tmsrp_parser_header_To-Path.rl" */
+
+ 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..a5afcd3
--- /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 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_Use_Path.c
+ * @brief MSRP "Use-Path" header.
+ *
+ * @author Mamadou Diop <diopmamadou(at)doubango.org>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#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 75 "./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;
+
+
+/* #line 89 "./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 118 "./ragel/tmsrp_parser_header_Use-Path.rl" */
+
+/* #line 151 "./src/headers/tmsrp_header_Use-Path.c" */
+ {
+ cs = tmsrp_machine_parser_header_Use_Path_start;
+ }
+
+/* #line 119 "./ragel/tmsrp_parser_header_Use-Path.rl" */
+
+/* #line 158 "./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 47 "./ragel/tmsrp_parser_header_Use-Path.rl" */
+ {
+ tag_start = p;
+ }
+ break;
+ case 1:
+/* #line 51 "./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 255 "./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 47 "./ragel/tmsrp_parser_header_Use-Path.rl" */
+ {
+ tag_start = p;
+ }
+ break;
+ case 1:
+/* #line 51 "./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 295 "./src/headers/tmsrp_header_Use-Path.c" */
+ }
+ }
+ }
+
+ _out: {}
+ }
+
+/* #line 120 "./ragel/tmsrp_parser_header_Use-Path.rl" */
+
+ 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..78fd4b4
--- /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>
+ *
+ * @date Created: Sat Nov 8 16:54:58 2009 mdiop
+ */
+#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;
OpenPOWER on IntegriCloud