diff options
author | Mamadou DIOP <bossiel@yahoo.fr> | 2015-08-17 01:56:35 +0200 |
---|---|---|
committer | Mamadou DIOP <bossiel@yahoo.fr> | 2015-08-17 01:56:35 +0200 |
commit | 631fffee8a28b1bec5ed1f1d26a20e0135967f99 (patch) | |
tree | 74afe3bf3efe15aa82bcd0272b2b0f4d48c2d837 /tinyMSRP/include | |
parent | 7908865936604036e6f200f1b5e069f8752f3a3a (diff) | |
download | doubango-631fffee8a28b1bec5ed1f1d26a20e0135967f99.zip doubango-631fffee8a28b1bec5ed1f1d26a20e0135967f99.tar.gz |
-
Diffstat (limited to 'tinyMSRP/include')
30 files changed, 2152 insertions, 0 deletions
diff --git a/tinyMSRP/include/tinymsrp.h b/tinyMSRP/include/tinymsrp.h new file mode 100644 index 0000000..5c707d0 --- /dev/null +++ b/tinyMSRP/include/tinymsrp.h @@ -0,0 +1,69 @@ +/* +* Copyright (C) 2010-2011 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 tinymsrp.h + * @brief tinyMSRP API. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYMEDIA_TINYMSRP_H +#define TINYMEDIA_TINYMSRP_H + +/* === tinyNET (tinyNET/src) === */ +#include "tnet.h" + +/* === tinySAK (tinySAK/src)=== */ +#include "tsk.h" + +#include "tmsrp.h" + +#include "tinymsrp/tmsrp_message.h" +#include "tinymsrp/tmsrp_event.h" +#include "tinymsrp/tmsrp_uri.h" + +#include "tinymsrp/headers/tmsrp_header_Dummy.h" +#include "tinymsrp/headers/tmsrp_header_Authentication-Info.h" +#include "tinymsrp/headers/tmsrp_header_Authorization.h" +#include "tinymsrp/headers/tmsrp_header_Byte-Range.h" +#include "tinymsrp/headers/tmsrp_header_Expires.h" +#include "tinymsrp/headers/tmsrp_header_Failure-Report.h" +#include "tinymsrp/headers/tmsrp_header_From-Path.h" +#include "tinymsrp/headers/tmsrp_header_Max-Expires.h" +#include "tinymsrp/headers/tmsrp_header_Message-ID.h" +#include "tinymsrp/headers/tmsrp_header_Min-Expires.h" +#include "tinymsrp/headers/tmsrp_header_Status.h" +#include "tinymsrp/headers/tmsrp_header_Success-Report.h" +#include "tinymsrp/headers/tmsrp_header_To-Path.h" +#include "tinymsrp/headers/tmsrp_header_Use-Path.h" +#include "tinymsrp/headers/tmsrp_header_WWW-Authenticate.h" + +#include "tinymsrp/parsers/tmsrp_parser_message.h" +#include "tinymsrp/parsers/tmsrp_parser_uri.h" + +#include "tinymsrp/session/tmsrp_config.h" +#include "tinymsrp/session/tmsrp_data.h" +#include "tinymsrp/session/tmsrp_receiver.h" +#include "tinymsrp/session/tmsrp_sender.h" + +#endif /* TINYMEDIA_TINYMSRP_H */ diff --git a/tinyMSRP/include/tinymsrp/headers/tmsrp_header.h b/tinyMSRP/include/tinymsrp/headers/tmsrp_header.h new file mode 100644 index 0000000..ad574a4 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/headers/tmsrp_header.h @@ -0,0 +1,95 @@ +/* +* 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.h + * @brief Defines a MSRP header/line (<type>=<value>). + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYMSRP_HEADER_H +#define TINYMSRP_HEADER_H + +#include "tinymsrp_config.h" + +#include "tsk_ragel_state.h" +#include "tsk_list.h" + +TMSRP_BEGIN_DECLS + +struct tmsrp_header_s; + +#define TMSRP_HEADER(self) ((tmsrp_header_t*)(self)) +#define TMSRP_HEADER_VALUE_TOSTRING_F(self) ((tmsrp_header_value_tostring_f)(self)) + +typedef int (*tmsrp_header_value_tostring_f)(const struct tmsrp_header_s* header, tsk_buffer_t* output); + +/** + * @enum tmsrp_header_type_e + * + * @brief List of all supported headers. +**/ +typedef enum tmsrp_header_type_e +{ + tmsrp_htype_Authentication_Info, + tmsrp_htype_Authorization, + tmsrp_htype_Byte_Range, + tmsrp_htype_Content_Type, + tmsrp_htype_Dummy, + tmsrp_htype_Expires, + tmsrp_htype_Failure_Report, + tmsrp_htype_From_Path, + tmsrp_htype_Max_Expires, + tmsrp_htype_Message_ID, + tmsrp_htype_Min_Expires, + tmsrp_htype_Status, + tmsrp_htype_Success_Report, + tmsrp_htype_To_Path, + tmsrp_htype_Use_Path, + tmsrp_htype_WWW_Authenticate +} +tmsrp_header_type_t; + +/*================================ +*/ +typedef struct tmsrp_header_s +{ + TSK_DECLARE_OBJECT; + tmsrp_header_type_t type; + tmsrp_header_value_tostring_f tostring; +} +tmsrp_header_t; + +#define TMSRP_DECLARE_HEADER tmsrp_header_t __header__ +typedef tsk_list_t tmsrp_headers_L_t; /**< List of @ref tmsrp_header_t elements. */ +/* +================================*/ + +TINYMSRP_API const char* tmsrp_header_get_name(tmsrp_header_type_t type); +TINYMSRP_API const char* tmsrp_header_get_nameex(const tmsrp_header_t *self); +TINYMSRP_API int tmsrp_header_serialize(const tmsrp_header_t *self, tsk_buffer_t *output); +TINYMSRP_API char* tmsrp_header_tostring(const tmsrp_header_t *self); + +TMSRP_END_DECLS + +#endif /* TINYMSRP_HEADER_H */ diff --git a/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Authentication-Info.h b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Authentication-Info.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Authentication-Info.h diff --git a/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Authorization.h b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Authorization.h new file mode 100644 index 0000000..f671129 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Authorization.h @@ -0,0 +1,97 @@ +/* +* 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.h + * @brief MSRP header 'Authorization'. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef _TMSRP_HEADER_AUTHORIZATION_H_ +#define _TMSRP_HEADER_AUTHORIZATION_H_ + +#include "tinymsrp_config.h" +#include "tinymsrp/headers/tmsrp_header.h" + +TMSRP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// @struct +/// +/// @brief MSRP header 'Authorization' as per RFC 3261 subclause . +/// +/// @par ABNF = Authorization = "Authorization" HCOLON credentials +/// credentials = ("Digest" LWS digest-response) / other-response +/// digest-response = dig-resp *(COMMA dig-resp) +/// dig-resp = username / realm / nonce / digest-uri / dresponse / algorithm / cnonce / opaque / message-qop / nonce-count / auth-param / auts +/// username = "username" EQUAL username-value +/// username-value = quoted-string +/// digest-uri = "uri" EQUAL LDQUOT digest-uri-value RDQUOT +/// digest-uri-value = auth-request-uri ; equal to request-uri as specified by HTTP/1.1 +/// message-qop = "qop" EQUAL qop-value +/// cnonce = "cnonce" EQUAL cnonce-value +/// cnonce-value = nonce-value +/// nonce-count = "nc" EQUAL nc-value +/// nc-value = 8LHEX +/// dresponse = "response" EQUAL request-digest +/// request-digest = LDQUOT 32LHEX RDQUOT +/// auth-request-uri = not-defined +/// +/// auth-param = auth-param-name EQUAL ( token / quoted-string ) +/// auth-param-name = token +/// +/// other-response = auth-scheme LWS auth-param *(COMMA auth-param) +/// auth-scheme = token +/// auts = "auts" EQUAL auts-param +/// auts-param = LDQUOT auts-value RDQUOT +/// auts-value = <base64 encoding of AUTS> +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tmsrp_header_Authorization_s +{ + TMSRP_DECLARE_HEADER; + + char* scheme; + char* username; + char* realm; + char* nonce; + char* uri; + char* response; + char* algorithm; + char* cnonce; + char* opaque; + char* qop; + char* nc; + + tsk_params_L_t *params; +} +tmsrp_header_Authorization_t; + +tmsrp_header_Authorization_t *tmsrp_header_Authorization_parse(const char *data, tsk_size_t size); + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_header_Authorization_def_t; + +TMSRP_END_DECLS + +#endif /* _TMSRP_HEADER_AUTHORIZATION_H_ */ + diff --git a/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Byte-Range.h b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Byte-Range.h new file mode 100644 index 0000000..f3db0e2 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Byte-Range.h @@ -0,0 +1,75 @@ +/* +* 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.h + * @brief MSRP 'Byte-Range' header. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef _TMSRP_HEADER_BYTE_RANGE_H_ +#define _TMSRP_HEADER_BYTE_RANGE_H_ + +#include "tinymsrp_config.h" +#include "tinymsrp/headers/tmsrp_header.h" + +TMSRP_BEGIN_DECLS + +#define TMSRP_HEADER_BYTE_RANGE_VA_ARGS(start, end, total) tmsrp_header_Byte_Range_def_t, (int64_t)start, (int64_t)end, (int64_t)total + +#define TMSRP_HEADER_BYTE_RANGE_IS_VALID(self) ((self) && (self)->start > 0 && (self)->end > 0 && (self)->end > (self)->start) + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// @struct +/// +/// @brief MSRP 'Byte-Range' header. +/// +/// @par ABNF : Byte-Range = "Byte-Range:" SP range-start "-" range-end "/" total +/// range-start = 1*DIGIT +/// range-end = 1*DIGIT / "*" +/// total = 1*DIGIT / "*" +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tmsrp_header_Byte_Range_s +{ + TMSRP_DECLARE_HEADER; + + int64_t start; + int64_t end; + int64_t total; +} +tmsrp_header_Byte_Range_t; + +typedef tsk_list_t tmsrp_headers_Byte_Range_L_t; + +TINYMSRP_API tmsrp_header_Byte_Range_t* tmsrp_header_Byte_Range_create(int64_t start, int64_t end, int64_t total); +TINYMSRP_API tmsrp_header_Byte_Range_t* tmsrp_header_Byte_Range_create_null(); + +TINYMSRP_API tmsrp_header_Byte_Range_t *tmsrp_header_Byte_Range_parse(const char *data, tsk_size_t size); + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_header_Byte_Range_def_t; + +TMSRP_END_DECLS + +#endif /* _TMSRP_HEADER_BYTE_RANGE_H_ */ + diff --git a/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Content-Type.h b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Content-Type.h new file mode 100644 index 0000000..465bb80 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Content-Type.h @@ -0,0 +1,77 @@ +/* +* 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.h + * @brief MSRP header 'Content-Type'. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef _TMSRP_HEADER_CONTENT_TYPE_H_ +#define _TMSRP_HEADER_CONTENT_TYPE_H_ + +#include "tinymsrp_config.h" +#include "tinymsrp/headers/tmsrp_header.h" + +TMSRP_BEGIN_DECLS + +#define TMSRP_HEADER_CONTENT_TYPE_VA_ARGS(type) tmsrp_header_Content_Type_def_t, (const char*)type + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// @struct +/// +/// @brief MSRP header 'Content-Type'. +/// @author Mamadou +/// @date 12/3/2009 +/// +/// @par ABNF= Content-Type = "Content-Type:" SP media-type +/// media-type = type "/" subtype *( ";" gen-param ) +/// type = token +/// subtype = token +/// gen-param = pname [ "=" pval ] +/// pname = token +/// pval = token / quoted-string +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tmsrp_header_Content_Type_s +{ + TMSRP_DECLARE_HEADER; + + char* value; + tsk_params_L_t *params; +} +tmsrp_header_Content_Type_t; + + +TINYMSRP_API tmsrp_header_Content_Type_t* tmsrp_header_Content_Type_create(const char* type); +TINYMSRP_API tmsrp_header_Content_Type_t* tmsrp_header_Content_Type_create_null(); + +TINYMSRP_API tmsrp_header_Content_Type_t *tmsrp_header_Content_Type_parse(const char *data, tsk_size_t size); + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_header_Content_Type_def_t; + + +TMSRP_END_DECLS + +#endif /* _TMSRP_HEADER_CONTENT_TYPE_H_ */ + diff --git a/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Dummy.h b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Dummy.h new file mode 100644 index 0000000..6c01856 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Dummy.h @@ -0,0 +1,70 @@ +/* +* 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.h + * @brief MSRP dummy header. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef _TMSRP_HEADER_DUMMY_H_ +#define _TMSRP_HEADER_DUMMY_H_ + +#include "tinymsrp_config.h" +#include "tinymsrp/headers/tmsrp_header.h" + +TMSRP_BEGIN_DECLS + +#define TMSRP_HEADER_DUMMY_VA_ARGS(name, value) tmsrp_header_Dummy_def_t, (const char*)name, (const char*)value + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// @struct +/// +/// @brief MSRP Dummy header. +/// +/// @par ABNF : hname ":" SP hval CRLF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tmsrp_header_Dummy_s +{ + TMSRP_DECLARE_HEADER; + + char *name; + char *value; +} +tmsrp_header_Dummy_t; + +typedef tsk_list_t tmsrp_headers_Dummy_L_t; + + +TINYMSRP_API tmsrp_header_Dummy_t* tmsrp_header_Dummy_create(const char* name, const char* value); +TINYMSRP_API tmsrp_header_Dummy_t* tmsrp_header_Dummy_create_null(); + +TINYMSRP_API tmsrp_header_Dummy_t *tmsrp_header_Dummy_parse(const char *data, tsk_size_t size); + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_header_Dummy_def_t; + +TMSRP_END_DECLS + +#endif /* _TMSRP_HEADER_DUMMY_H_ */ + diff --git a/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Expires.h b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Expires.h new file mode 100644 index 0000000..de715d7 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Expires.h @@ -0,0 +1,68 @@ +/* +* 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.h + * @brief MSRP 'Expires' header. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef _TMSRP_HEADER_EXPIRES_H_ +#define _TMSRP_HEADER_EXPIRES_H_ + +#include "tinymsrp_config.h" +#include "tinymsrp/headers/tmsrp_header.h" + +TMSRP_BEGIN_DECLS + +#define TMSRP_HEADER_EXPIRES_VA_ARGS(value) tmsrp_header_Expires_def_t, (int64_t)value + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// @struct +/// +/// @brief MSRP 'Expires' header. +/// +/// @par ABNF : Expires = "Expires:" SP 1*DIGIT +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tmsrp_header_Expires_s +{ + TMSRP_DECLARE_HEADER; + + int64_t value; +} +tmsrp_header_Expires_t; + +typedef tsk_list_t tmsrp_headers_Expires_L_t; + +TINYMSRP_API tmsrp_header_Expires_t* tmsrp_header_Expires_create(int64_t value); +TINYMSRP_API tmsrp_header_Expires_t* tmsrp_header_Expires_create_null(); + +TINYMSRP_API tmsrp_header_Expires_t *tmsrp_header_Expires_parse(const char *data, tsk_size_t size); + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_header_Expires_def_t; + +TMSRP_END_DECLS + +#endif /* _TMSRP_HEADER_EXPIRES_H_ */ + diff --git a/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Failure-Report.h b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Failure-Report.h new file mode 100644 index 0000000..04360e8 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Failure-Report.h @@ -0,0 +1,78 @@ +/* +* 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.h + * @brief MSRP 'Failure-Report' header. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef _TMSRP_HEADER_FAILURE_REPORT_H_ +#define _TMSRP_HEADER_FAILURE_REPORT_H_ + +#include "tinymsrp_config.h" +#include "tinymsrp/headers/tmsrp_header.h" + +TMSRP_BEGIN_DECLS + +#define TMSRP_HEADER_FAILURE_REPORT_VA_ARGS(freport_type) tmsrp_header_Failure_Report_def_t, (tmsrp_freport_type_t)freport_type + +/** Failure report type; +*/ +typedef enum tmsrp_freport_type_e +{ + freport_yes, + freport_no, + freport_partial +} +tmsrp_freport_type_t; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// @struct +/// +/// @brief MSRP 'Failure-Report' header. +/// +/// @par ABNF : "Failure-Report:" ( "yes" / "no" / "partial" ) +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tmsrp_header_Failure_Report_s +{ + TMSRP_DECLARE_HEADER; + tmsrp_freport_type_t type; +} +tmsrp_header_Failure_Report_t; + +typedef tsk_list_t tmsrp_headers_Failure_Report_L_t; + + +TINYMSRP_API tmsrp_header_Failure_Report_t* tmsrp_header_Failure_Report_create(tmsrp_freport_type_t freport_type); +TINYMSRP_API tmsrp_header_Failure_Report_t* tmsrp_header_Failure_Report_create_null(); + +TINYMSRP_API tmsrp_header_Failure_Report_t *tmsrp_header_Failure_Report_parse(const char *data, tsk_size_t size); + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_header_Failure_Report_def_t; + +TMSRP_END_DECLS + +#endif /* _TMSRP_HEADER_FAILURE_REPORT_H_ */ + diff --git a/tinyMSRP/include/tinymsrp/headers/tmsrp_header_From-Path.h b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_From-Path.h new file mode 100644 index 0000000..cc994aa --- /dev/null +++ b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_From-Path.h @@ -0,0 +1,73 @@ +/* +* 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.h + * @brief MSRP 'From-Path' header. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef _TMSRP_HEADER_FROM_PATH_H_ +#define _TMSRP_HEADER_FROM_PATH_H_ + +#include "tinymsrp_config.h" +#include "tinymsrp/headers/tmsrp_header.h" + +#include "tinymsrp/parsers/tmsrp_parser_uri.h" + +TMSRP_BEGIN_DECLS + +#define TMSRP_HEADER_FROM_PATH_VA_ARGS(uri) tmsrp_header_From_Path_def_t, (const tmsrp_uri_t*)uri + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// @struct +/// +/// @brief MSRP 'From-Path' header. +/// +/// @par ABNF : "To-Path:" SP MSRP-URI *( SP MSRP-URI ) +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tmsrp_header_From_Path_s +{ + TMSRP_DECLARE_HEADER; + + tmsrp_uri_t *uri; + tmsrp_uris_L_t *otherURIs; +} +tmsrp_header_From_Path_t; + +typedef tsk_list_t tmsrp_headers_From_Path_L_t; + + +TINYMSRP_API tmsrp_header_From_Path_t* tmsrp_header_From_Path_create(const tmsrp_uri_t* uri); +TINYMSRP_API tmsrp_header_From_Path_t* tmsrp_header_From_Path_create_null(); + +TINYMSRP_API tmsrp_header_From_Path_t *tmsrp_header_From_Path_parse(const char *data, tsk_size_t size); +TINYMSRP_API tmsrp_header_From_Path_t *tmsrp_header_From_Path_clone(const tmsrp_header_From_Path_t* From_Path); + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_header_From_Path_def_t; + +TMSRP_END_DECLS + +#endif /* _TMSRP_HEADER_FROM_PATH_H_ */ + diff --git a/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Max-Expires.h b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Max-Expires.h new file mode 100644 index 0000000..07c0adf --- /dev/null +++ b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Max-Expires.h @@ -0,0 +1,69 @@ +/* +* 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.h + * @brief MSRP 'Max-Expires' header. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef _TMSRP_HEADER_MAX_EXPIRES_H_ +#define _TMSRP_HEADER_MAX_EXPIRES_H_ + +#include "tinymsrp_config.h" +#include "tinymsrp/headers/tmsrp_header.h" + +TMSRP_BEGIN_DECLS + +#define TMSRP_HEADER_MAX_EXPIRES_VA_ARGS(value) tmsrp_header_Max_Expires_def_t, (int64_t)value + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// @struct +/// +/// @brief MSRP 'Max-Expires' header. +/// +/// @par ABNF : Max-Expires = "Max-Expires:" SP 1*DIGIT +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tmsrp_header_Max_Expires_s +{ + TMSRP_DECLARE_HEADER; + + int64_t value; +} +tmsrp_header_Max_Expires_t; + +typedef tsk_list_t tmsrp_headers_Max_Expires_L_t; + + +TINYMSRP_API tmsrp_header_Max_Expires_t* tmsrp_header_Max_Expires_create(int64_t value); +TINYMSRP_API tmsrp_header_Max_Expires_t* tmsrp_header_Max_Expires_create_null(); + +TINYMSRP_API tmsrp_header_Max_Expires_t *tmsrp_header_Max_Expires_parse(const char *data, tsk_size_t size); + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_header_Max_Expires_def_t; + +TMSRP_END_DECLS + +#endif /* _TMSRP_HEADER_MAX_EXPIRES_H_ */ + diff --git a/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Message-ID.h b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Message-ID.h new file mode 100644 index 0000000..4862d58 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Message-ID.h @@ -0,0 +1,70 @@ +/* +* 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.h + * @brief MSRP 'Message-Id' header. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef _TMSRP_HEADER_MESSAGE_ID_H_ +#define _TMSRP_HEADER_MESSAGE_ID_H_ + +#include "tinymsrp_config.h" +#include "tinymsrp/headers/tmsrp_header.h" + +TMSRP_BEGIN_DECLS + +#define TMSRP_HEADER_MESSAGE_ID_VA_ARGS(value) tmsrp_header_Message_ID_def_t, (const char*)value + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// @struct +/// +/// @brief MSRP 'Message-Id' header. +/// +/// @par ABNF : Message-ID = "Message-ID:" SP ident +/// ident = ALPHANUM 3*31ident-char +/// ident-char = ALPHANUM / "." / "-" / "+" / "%" / "=" +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tmsrp_header_Message_ID_s +{ + TMSRP_DECLARE_HEADER; + + char *value; +} +tmsrp_header_Message_ID_t; + +typedef tsk_list_t tmsrp_headers_Message_Id_L_t; + +TINYMSRP_API tmsrp_header_Message_ID_t* tmsrp_header_Message_ID_create(const char* value); +TINYMSRP_API tmsrp_header_Message_ID_t* tmsrp_header_Message_ID_create_null(); + +TINYMSRP_API tmsrp_header_Message_ID_t *tmsrp_header_Message_ID_parse(const char *data, tsk_size_t size); + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_header_Message_ID_def_t; + +TMSRP_END_DECLS + +#endif /* _TMSRP_HEADER_MESSAGE_ID_H_ */ + diff --git a/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Min-Expires.h b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Min-Expires.h new file mode 100644 index 0000000..7607d71 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Min-Expires.h @@ -0,0 +1,69 @@ +/* +* 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.h + * @brief MSRP 'Min-Expires' header. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef _TMSRP_HEADER_MIN_EXPIRES_H_ +#define _TMSRP_HEADER_MIN_EXPIRES_H_ + +#include "tinymsrp_config.h" +#include "tinymsrp/headers/tmsrp_header.h" + +TMSRP_BEGIN_DECLS + +#define TMSRP_HEADER_MIN_EXPIRES_VA_ARGS(value) tmsrp_header_Min_Expires_def_t, (int64_t)value + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// @struct +/// +/// @brief MSRP 'Min-Expires' header. +/// +/// @par ABNF : Min-Expires = "Min-Expires:" SP 1*DIGIT +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tmsrp_header_Min_Expires_s +{ + TMSRP_DECLARE_HEADER; + + int64_t value; +} +tmsrp_header_Min_Expires_t; + +typedef tsk_list_t tmsrp_headers_Min_Expires_L_t; + + +TINYMSRP_API tmsrp_header_Min_Expires_t* tmsrp_header_Min_Expires_create(int64_t value); +TINYMSRP_API tmsrp_header_Min_Expires_t* tmsrp_header_Min_Expires_create_null(); + +TINYMSRP_API tmsrp_header_Min_Expires_t *tmsrp_header_Min_Expires_parse(const char *data, tsk_size_t size); + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_header_Min_Expires_def_t; + +TMSRP_END_DECLS + +#endif /* _TMSRP_HEADER_MIN_EXPIRES_H_ */ + diff --git a/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Status.h b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Status.h new file mode 100644 index 0000000..f571a69 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Status.h @@ -0,0 +1,72 @@ +/* +* 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.h + * @brief MSRP 'Status' header. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef _TMSRP_HEADER_STATUS_H_ +#define _TMSRP_HEADER_STATUS_H_ + +#include "tinymsrp_config.h" +#include "tinymsrp/headers/tmsrp_header.h" + +TMSRP_BEGIN_DECLS + +#define TMSRP_HEADER_STATUS_VA_ARGS(namespace, code, reason) tmsrp_header_Status_def_t, (short)namespace, (short)code, (const char*)reason + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// @struct +/// +/// @brief MSRP 'Status' header. +/// +/// @par ABNF : Status = "Status:" SP namespace SP status-code [SP text-reason] +/// namespace = 3(DIGIT) ; "000" for all codes defined in RFC 4975 +/// text-reason = utf8text +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tmsrp_header_Status_s +{ + TMSRP_DECLARE_HEADER; + + short _namespace; + short code; + char* reason; +} +tmsrp_header_Status_t; + +typedef tsk_list_t tmsrp_headers_Status_L_t; + +TINYMSRP_API tmsrp_header_Status_t* tmsrp_header_Status_create(short _namespace, short code, const char* reason); +TINYMSRP_API tmsrp_header_Status_t* tmsrp_header_Status_create_null(); + +TINYMSRP_API tmsrp_header_Status_t *tmsrp_header_Status_parse(const char *data, tsk_size_t size); + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_header_Status_def_t; + +TMSRP_END_DECLS + +#endif /* _TMSRP_HEADER_STATUS_H_ */ + diff --git a/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Success-Report.h b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Success-Report.h new file mode 100644 index 0000000..4b79372 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Success-Report.h @@ -0,0 +1,68 @@ +/* +* 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.h + * @brief MSRP 'Success-Report' header. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef _TMSRP_HEADER_SUCCESS_REPORT_H_ +#define _TMSRP_HEADER_SUCCESS_REPORT_H_ + +#include "tinymsrp_config.h" +#include "tinymsrp/headers/tmsrp_header.h" + +TMSRP_BEGIN_DECLS + +#define TMSRP_HEADER_SUCCESS_REPORT_VA_ARGS(isSuccess) tmsrp_header_Success_Report_def_t, (tsk_bool_t)isSuccess + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// @struct +/// +/// @brief MSRP 'Success-Report' header. +/// +/// @par ABNF : "Success-Report:" ( "yes" / "no" ) +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tmsrp_header_Success_Report_s +{ + TMSRP_DECLARE_HEADER; + unsigned yes:1; +} +tmsrp_header_Success_Report_t; + +typedef tsk_list_t tmsrp_headers_Success_Report_L_t; + + +TINYMSRP_API tmsrp_header_Success_Report_t* tmsrp_header_Success_Report_create(tsk_bool_t isSuccess); +TINYMSRP_API tmsrp_header_Success_Report_t* tmsrp_header_Success_Report_create_null(); + +TINYMSRP_API tmsrp_header_Success_Report_t *tmsrp_header_Success_Report_parse(const char *data, tsk_size_t size); + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_header_Success_Report_def_t; + +TMSRP_END_DECLS + +#endif /* _TMSRP_HEADER_SUCCESS_REPORT_H_ */ + diff --git a/tinyMSRP/include/tinymsrp/headers/tmsrp_header_To-Path.h b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_To-Path.h new file mode 100644 index 0000000..59e0c56 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_To-Path.h @@ -0,0 +1,72 @@ +/* +* 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.h + * @brief MSRP 'To-Path' header. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef _TMSRP_HEADER_TO_PATH_H_ +#define _TMSRP_HEADER_TO_PATH_H_ + +#include "tinymsrp_config.h" +#include "tinymsrp/headers/tmsrp_header.h" + +#include "tinymsrp/parsers/tmsrp_parser_uri.h" + +TMSRP_BEGIN_DECLS + +#define TMSRP_HEADER_TO_PATH_VA_ARGS(uri) tmsrp_header_To_Path_def_t, (const tmsrp_uri_t*)uri + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// @struct +/// +/// @brief MSRP 'To-Path' header. +/// +/// @par ABNF : "To-Path:" SP MSRP-URI *( SP MSRP-URI ) +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tmsrp_header_To_Path_s +{ + TMSRP_DECLARE_HEADER; + + tmsrp_uri_t *uri; + tmsrp_uris_L_t *otherURIs; +} +tmsrp_header_To_Path_t; + +typedef tsk_list_t tmsrp_headers_To_Path_L_t; + +TINYMSRP_API tmsrp_header_To_Path_t* tmsrp_header_To_Path_create(const tmsrp_uri_t* uri); +TINYMSRP_API tmsrp_header_To_Path_t* tmsrp_header_To_Path_create_null(); + +TINYMSRP_API tmsrp_header_To_Path_t *tmsrp_header_To_Path_parse(const char *data, tsk_size_t size); +TINYMSRP_API tmsrp_header_To_Path_t *tmsrp_header_To_Path_clone(const tmsrp_header_To_Path_t* ); + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_header_To_Path_def_t; + +TMSRP_END_DECLS + +#endif /* _TMSRP_HEADER_TO_PATH_H_ */ + diff --git a/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Use-Path.h b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Use-Path.h new file mode 100644 index 0000000..b819724 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_Use-Path.h @@ -0,0 +1,71 @@ +/* +* 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.h + * @brief MSRP 'Use-Path' header. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef _TMSRP_HEADER_USE_PATH_H_ +#define _TMSRP_HEADER_USE_PATH_H_ + +#include "tinymsrp_config.h" +#include "tinymsrp/headers/tmsrp_header.h" + +#include "tinymsrp/parsers/tmsrp_parser_uri.h" + +TMSRP_BEGIN_DECLS + +#define TMSRP_HEADER_USE_PATH_VA_ARGS(uri) tmsrp_header_Use_Path_def_t, (const tmsrp_uri_t*)uri + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// @struct +/// +/// @brief MSRP 'Use-Path' header. +/// +/// @par ABNF : "Use-Path:" SP MSRP-URI *( SP MSRP-URI ) +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tmsrp_header_Use_Path_s +{ + TMSRP_DECLARE_HEADER; + + tmsrp_uri_t *uri; + tmsrp_uris_L_t *otherURIs; +} +tmsrp_header_Use_Path_t; + +typedef tsk_list_t tmsrp_headers_Use_Path_L_t; + +TINYMSRP_API tmsrp_header_Use_Path_t* tmsrp_header_Use_Path_create(const tmsrp_uri_t* uri); +TINYMSRP_API tmsrp_header_Use_Path_t* tmsrp_header_Use_Path_create_null(); + +TINYMSRP_API tmsrp_header_Use_Path_t *tmsrp_header_Use_Path_parse(const char *data, tsk_size_t size); + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_header_Use_Path_def_t; + +TMSRP_END_DECLS + +#endif /* _TMSRP_HEADER_USE_PATH_H_ */ + diff --git a/tinyMSRP/include/tinymsrp/headers/tmsrp_header_WWW-Authenticate.h b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_WWW-Authenticate.h new file mode 100644 index 0000000..d620928 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/headers/tmsrp_header_WWW-Authenticate.h @@ -0,0 +1,82 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tmsrp_header_WWW_Authenticate.h + * @brief MSRP header 'WWW-Authenticate'. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef _TMSRP_HEADER_WWW_Authenticate_H_ +#define _TMSRP_HEADER_WWW_Authenticate_H_ + +#include "tinymsrp_config.h" +#include "tinymsrp/headers/tmsrp_header.h" + +TMSRP_BEGIN_DECLS + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// @struct +/// +/// @brief MSRP header 'WWW-Authenticate'. +/// +/// @par ABNF = WWW-Authenticate = "WWW-Authenticate" HCOLON challenge +/// challenge = ("Digest" LWS digest-cln *(COMMA digest-cln)) / other-challenge +/// other-challenge = auth-scheme / auth-param *(COMMA auth-param) +/// digest-cln = realm / domain / nonce / opaque / stale / algorithm / qop-options / auth-param +/// realm = "realm" EQUAL realm-value +/// realm-value = quoted-string +/// domain = "domain" EQUAL LDQUOT URI *( 1*SP URI ) RDQUOT +/// URI = absoluteURI / abs-path +/// opaque = "opaque" EQUAL quoted-string +/// stale = "stale" EQUAL ( "true" / "false" ) +/// qop-options = "qop" EQUAL LDQUOT qop-value *("," qop-value) RDQUOT +/// qop-value = "auth" / "auth-int" / token +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tmsrp_header_WWW_Authenticate_s +{ + TMSRP_DECLARE_HEADER; + + char* scheme; + char* realm; + char* domain; + char* nonce; + char* opaque; + unsigned stale:1; + char* algorithm; + char* qop; + + tsk_params_L_t* params; +} +tmsrp_header_WWW_Authenticate_t; + +tmsrp_header_WWW_Authenticate_t *tmsrp_header_WWW_Authenticate_parse(const char *data, tsk_size_t size); + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_header_WWW_Authenticate_def_t; + +TMSRP_END_DECLS + +#endif /* _TMSRP_HEADER_WWW_Authenticate_H_ */ + diff --git a/tinyMSRP/include/tinymsrp/parsers/tmsrp_parser_header.h b/tinyMSRP/include/tinymsrp/parsers/tmsrp_parser_header.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/parsers/tmsrp_parser_header.h diff --git a/tinyMSRP/include/tinymsrp/parsers/tmsrp_parser_message.h b/tinyMSRP/include/tinymsrp/parsers/tmsrp_parser_message.h new file mode 100644 index 0000000..c6ef41d --- /dev/null +++ b/tinyMSRP/include/tinymsrp/parsers/tmsrp_parser_message.h @@ -0,0 +1,45 @@ +/* +* 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_parser_message.h + * @brief MSRP message parser. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYMSRP_PARSER_MESSAGE_H +#define TINYMSRP_PARSER_MESSAGE_H + +#include "tinymsrp_config.h" +#include "tinymsrp/tmsrp_message.h" +#include "tsk_ragel_state.h" + +TMSRP_BEGIN_DECLS + +TINYMSRP_API tmsrp_message_t* tmsrp_message_parse_2(const void *input, tsk_size_t size, tsk_size_t* msg_size); +TINYMSRP_API tmsrp_message_t* tmsrp_message_parse(const void *input, tsk_size_t size); + +TMSRP_END_DECLS + +#endif /* TINYMSRP_PARSER_MESSAGE_H */ + diff --git a/tinyMSRP/include/tinymsrp/parsers/tmsrp_parser_uri.h b/tinyMSRP/include/tinymsrp/parsers/tmsrp_parser_uri.h new file mode 100644 index 0000000..f0cfdf2 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/parsers/tmsrp_parser_uri.h @@ -0,0 +1,45 @@ +/* +* 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_parser_uri.h + * @brief MSRP/MSRPS URI parser. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYMSRP_PARSER_URI_H +#define TINYMSRP_PARSER_URI_H + +#include "tinymsrp_config.h" +#include "tinymsrp/tmsrp_uri.h" + +#include "tsk_ragel_state.h" + +TMSRP_BEGIN_DECLS + +TINYMSRP_API tmsrp_uri_t *tmsrp_uri_parse(const char *data, tsk_size_t size); + +TMSRP_END_DECLS + +#endif /* TINYMSRP_PARSER_URI_H */ + diff --git a/tinyMSRP/include/tinymsrp/session/tmsrp_config.h b/tinyMSRP/include/tinymsrp/session/tmsrp_config.h new file mode 100644 index 0000000..48472b2 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/session/tmsrp_config.h @@ -0,0 +1,65 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tmsrp_media.h + * @brief MSRP Session config. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYMSRP_CONFIG_H +#define TINYMSRP_CONFIG_H + +#include "tinymsrp_config.h" + +#include "tinymsrp/headers/tmsrp_header_From-Path.h" +#include "tinymsrp/headers/tmsrp_header_To-Path.h" + +#include "tsk_object.h" + +TMSRP_BEGIN_DECLS + +#ifndef TMSRP_MAX_CHUNK_SIZE +# define TMSRP_MAX_CHUNK_SIZE 2048 +#endif + +typedef struct tmsrp_config_s +{ + TSK_DECLARE_OBJECT; + + tmsrp_header_To_Path_t* To_Path; + tmsrp_header_From_Path_t* From_Path; + + tsk_bool_t Failure_Report; + tsk_bool_t Success_Report; + tsk_bool_t OMA_Final_Report; +} +tmsrp_config_t; + +TINYMSRP_API tmsrp_config_t* tmsrp_config_create(); + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_config_def_t; + +TMSRP_END_DECLS + +#endif /* TINYMSRP_CONFIG_H */ diff --git a/tinyMSRP/include/tinymsrp/session/tmsrp_data.h b/tinyMSRP/include/tinymsrp/session/tmsrp_data.h new file mode 100644 index 0000000..c24cdd8 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/session/tmsrp_data.h @@ -0,0 +1,93 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tmsrp_data.h + * @brief MSRP input/output data. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYMSRP_DATA_H +#define TINYMSRP_DATA_H + +#include "tinymsrp_config.h" + +#include "tinymsrp/tmsrp_message.h" + +#include "tsk_buffer.h" + +TMSRP_BEGIN_DECLS + +#define TMSRP_DATA(self) ((tmsrp_data_t*)(self)) +#define TMSRP_DATA_IS_OUTGOING(self) (TMSRP_DATA(self)->outgoing) + + +typedef struct tmsrp_data_s +{ + TSK_DECLARE_OBJECT; + + tsk_bool_t outgoing; + tsk_bool_t isOK; + + char* id; + char* ctype; + char* wctype; +} +tmsrp_data_t; + +#define TMSRP_DECLARE_DATA tmsrp_data_t data +typedef tsk_list_t tmsrp_datas_L_t; + +typedef struct tmsrp_data_in_s +{ + TMSRP_DECLARE_DATA; + + tsk_buffer_t* buffer; +} +tmsrp_data_in_t; + +int tmsrp_data_in_put(tmsrp_data_in_t* self, const void* pdata, tsk_size_t size); +tmsrp_message_t* tmsrp_data_in_get(tmsrp_data_in_t* self); + +typedef struct tmsrp_data_out_s +{ + TMSRP_DECLARE_DATA; + + FILE* file; + tsk_buffer_t* message; + tsk_size_t size; // File/message size +} +tmsrp_data_out_t; + +tmsrp_data_in_t* tmsrp_data_in_create(); +tmsrp_data_out_t* tmsrp_data_out_create(const void* pdata, tsk_size_t size); +tmsrp_data_out_t* tmsrp_data_out_file_create(const char* filepath); + +tsk_buffer_t* tmsrp_data_out_get(tmsrp_data_out_t* self); + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_data_in_def_t; +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_data_out_def_t; + +TMSRP_END_DECLS + +#endif /* TINYMSRP_DATA_H */ diff --git a/tinyMSRP/include/tinymsrp/session/tmsrp_receiver.h b/tinyMSRP/include/tinymsrp/session/tmsrp_receiver.h new file mode 100644 index 0000000..932ab8b --- /dev/null +++ b/tinyMSRP/include/tinymsrp/session/tmsrp_receiver.h @@ -0,0 +1,71 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tmsrp_receiver.h + * @brief MSRP receiver. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYMSRP_RECEIVER_H +#define TINYMSRP_RECEIVER_H + +#include "tinymsrp_config.h" + +#include "tinymsrp/session/tmsrp_data.h" +#include "tinymsrp/session/tmsrp_config.h" + +#include "tinymsrp/tmsrp_event.h" + +#include "tnet_types.h" +#include "tnet_transport.h" + +TMSRP_BEGIN_DECLS + +typedef struct tmsrp_receiver_s +{ + TSK_DECLARE_OBJECT; + + tmsrp_data_in_t* data_in; + tmsrp_config_t* config; + tnet_fd_t fd; + tsk_buffer_t* buffer; + + struct { + tmsrp_event_cb_f func; + const void* data; + } callback; +} +tmsrp_receiver_t; + +TINYMSRP_API tmsrp_receiver_t* tmsrp_receiver_create(tmsrp_config_t* config, tnet_fd_t fd); +TINYMSRP_API int tmsrp_receiver_set_fd(tmsrp_receiver_t* self, tnet_fd_t fd); +TINYMSRP_API int tmsrp_receiver_recv(tmsrp_receiver_t* self, const void* data, tsk_size_t size); +TINYMSRP_API int tmsrp_receiver_start(tmsrp_receiver_t* self, const void* callback_data, tmsrp_event_cb_f func); +TINYMSRP_API int tmsrp_receiver_stop(tmsrp_receiver_t* self); + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_receiver_def_t; + +TMSRP_END_DECLS + +#endif /* TINYMSRP_RECEIVER_H */ diff --git a/tinyMSRP/include/tinymsrp/session/tmsrp_sender.h b/tinyMSRP/include/tinymsrp/session/tmsrp_sender.h new file mode 100644 index 0000000..f0a814f --- /dev/null +++ b/tinyMSRP/include/tinymsrp/session/tmsrp_sender.h @@ -0,0 +1,67 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tmsrp_sender.h + * @brief MSRP sender. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYMSRP_SENDER_H +#define TINYMSRP_SENDER_H + +#include "tinymsrp_config.h" + +#include "tinymsrp/session/tmsrp_data.h" +#include "tinymsrp/session/tmsrp_config.h" + +#include "tnet_types.h" + +#include "tsk_runnable.h" + +TMSRP_BEGIN_DECLS + +typedef struct tmsrp_sender_s +{ + TSK_DECLARE_RUNNABLE; + + tmsrp_datas_L_t* outgoingList; + tmsrp_config_t* config; + tnet_fd_t fd; + uint64_t chunck_duration; +} +tmsrp_sender_t; + +TINYMSRP_API tmsrp_sender_t* tmsrp_sender_create(tmsrp_config_t* config, tnet_fd_t fd); + +TINYMSRP_API int tmsrp_sender_set_fd(tmsrp_sender_t* self, tnet_fd_t fd); +TINYMSRP_API int tmsrp_sender_start(tmsrp_sender_t* self); +TINYMSRP_API int tsmrp_sender_send_data(tmsrp_sender_t* self, const void* data, tsk_size_t size, const char* ctype, const char* wctype); +TINYMSRP_API int tsmrp_sender_send_file(tmsrp_sender_t* self, const char* filepath); +TINYMSRP_API int tmsrp_sender_stop(tmsrp_sender_t* self); + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_sender_def_t; + +TMSRP_END_DECLS + +#endif /* TINYMSRP_SENDER_H */ diff --git a/tinyMSRP/include/tinymsrp/tmsrp_event.h b/tinyMSRP/include/tinymsrp/tmsrp_event.h new file mode 100644 index 0000000..6629a66 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/tmsrp_event.h @@ -0,0 +1,72 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tmsrp_event.h + * @brief MSRP/MSRPS Event. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYMSRP_EVENT_H +#define TINYMSRP_EVENT_H + +#include "tinymsrp_config.h" + +#include "tinymsrp/tmsrp_message.h" + +#include "tsk_params.h" +#include "tsk_buffer.h" + +TMSRP_BEGIN_DECLS + +typedef enum tmsrp_event_type_e +{ + tmsrp_event_type_none, + tmsrp_event_type_connected, + tmsrp_event_type_disconnected, + tmsrp_event_type_message, +} +tmsrp_event_type_t; + +typedef struct tmsrp_event_s +{ + TSK_DECLARE_OBJECT; + + const void* callback_data; + unsigned outgoing:1; + + + tmsrp_event_type_t type; + tmsrp_message_t* message; +} +tmsrp_event_t; + +typedef int (*tmsrp_event_cb_f)(tmsrp_event_t* _event); + +TINYMSRP_API tmsrp_event_t* tmsrp_event_create(const void* callback_data, tsk_bool_t outgoing, tmsrp_event_type_t type, tmsrp_message_t* message); + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_event_def_t; + +TMSRP_END_DECLS + +#endif /* TINYMSRP_EVENT_H */ diff --git a/tinyMSRP/include/tinymsrp/tmsrp_message.h b/tinyMSRP/include/tinymsrp/tmsrp_message.h new file mode 100644 index 0000000..a419d45 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/tmsrp_message.h @@ -0,0 +1,193 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tmsrp_message.h + * @brief MSRP message. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYMSRP_MESSAGE_H +#define TINYMSRP_MESSAGE_H + +#include "tinymsrp_config.h" + +#include "tinymsrp/headers/tmsrp_header.h" + +#include "tinymsrp/headers/tmsrp_header_Byte-Range.h" +#include "tinymsrp/headers/tmsrp_header_Content-Type.h" +#include "tinymsrp/headers/tmsrp_header_Failure-Report.h" +#include "tinymsrp/headers/tmsrp_header_From-Path.h" +#include "tinymsrp/headers/tmsrp_header_Message-ID.h" +#include "tinymsrp/headers/tmsrp_header_Status.h" +#include "tinymsrp/headers/tmsrp_header_Success-Report.h" +#include "tinymsrp/headers/tmsrp_header_To-Path.h" + +TMSRP_BEGIN_DECLS + +#define TMSRP_MESSAGE_IS_REQUEST(self) ((self) ? (self)->type == tmsrp_request : tsk_false) +#define TMSRP_MESSAGE_IS_RESPONSE(self) ((self) ? (self)->type == tmsrp_response : tsk_false) + +#define TMSRP_MESSAGE(self) ((tmsrp_message_t*)(self)) +#define TMSRP_MESSAGE_AS_RESPONSE(self) ((tmsrp_response_t*)(self)) +#define TMSRP_MESSAGE_AS_REQUEST(self) ((tmsrp_request_t*)(self)) + + +#define TMSRP_RESPONSE_CODE(self) (TMSRP_MESSAGE_IS_RESPONSE((self)) ? (self)->line.response.status : 0) +#define TMSRP_RESPONSE_PHRASE(self) (TMSRP_MESSAGE_IS_RESPONSE((self)) ? (self)->line.response.comment : tsk_null) + +#define TMSRP_REQUEST_METHOD(self) (TMSRP_MESSAGE_IS_REQUEST((self)) ? (self)->line.request.method : tsk_null) +#define TMSRP_REQUEST_IS_SEND(self) (TMSRP_MESSAGE_IS_REQUEST(self) && (self)->line.request.type == tmsrp_SEND) +#define TMSRP_REQUEST_IS_REPORT(self) (TMSRP_MESSAGE_IS_REQUEST(self) && (self)->line.request.type == tmsrp_REPORT) +#define TMSRP_REQUEST_IS_AUTH(self) (TMSRP_MESSAGE_IS_REQUEST(self) && (self)->line.request.type == tmsrp_AUTH) + +#define TMSRP_MESSAGE_HAS_CONTENT(message) ((message) && (message)->Content && (message)->Content->data) +#define TMSRP_MESSAGE_CONTENT(message) (TMSRP_MESSAGE_HAS_CONTENT(message) ? (message)->Content->data : 0) + +#define TMSRP_RESPONSE_IS(self, code) (TMSRP_RESPONSE_CODE((self)) == code) +#define TMSRP_RESPONSE_IS_NXX(self, N) (TMSRP_MESSAGE_IS_RESPONSE((self)) && N##00<= TMSRP_RESPONSE_CODE((self)) && TMSRP_RESPONSE_CODE((self)) <= N##99) +#define TMSRP_RESPONSE_IS_1XX(self) TMSRP_RESPONSE_IS_NXX(self, 1) +#define TMSRP_RESPONSE_IS_2XX(self) TMSRP_RESPONSE_IS_NXX(self, 2) +#define TMSRP_RESPONSE_IS_3XX(self) TMSRP_RESPONSE_IS_NXX(self, 3) +#define TMSRP_RESPONSE_IS_4XX(self) TMSRP_RESPONSE_IS_NXX(self, 4) +#define TMSRP_RESPONSE_IS_5XX(self) TMSRP_RESPONSE_IS_NXX(self, 5) +#define TMSRP_RESPONSE_IS_6XX(self) TMSRP_RESPONSE_IS_NXX(self, 6) +#define TMSRP_RESPONSE_IS_23456(self) (TMSRP_MESSAGE_IS_RESPONSE((self)) && 200<= TMSRP_RESPONSE_CODE((self)) && TMSRP_RESPONSE_CODE((self)) <= 699) + +/** Defines the message type (Request or Response). +**/ +typedef enum tmsrp_message_type_e +{ + tmsrp_unknown, + tmsrp_request, + tmsrp_response +} +tmsrp_message_type_t; + +typedef enum tmsrp_request_type_e +{ + tmsrp_NONE = 0, + + tmsrp_SEND, + tmsrp_REPORT, + tmsrp_AUTH + //... +} +tmsrp_request_type_t; + +typedef struct tmsrp_message_s +{ + TSK_DECLARE_OBJECT; + + tmsrp_message_type_t type; + char* tid; + union{ + struct{ + char* method; + tmsrp_request_type_t type; + } request; + + struct{ + short status; + char* comment; + } response; + } line; + + // Very common headers + tmsrp_header_To_Path_t* To; + tmsrp_header_From_Path_t* From; + + tmsrp_header_Message_ID_t* MessageID; + + tmsrp_header_Byte_Range_t* ByteRange; + tmsrp_header_Failure_Report_t* FailureReport; + tmsrp_header_Success_Report_t* SuccessReport; + tmsrp_header_Status_t* Status; + + //! List of @ref tmsrp_header_t elements. + tmsrp_headers_L_t* headers; + + // Content + tmsrp_header_Content_Type_t* ContentType; + tsk_buffer_t *Content; + + // End line + struct{ + char* tid; + char cflag; + }end_line; +} +tmsrp_message_t; + +typedef tmsrp_message_t tmsrp_request_t; /**< MSRP request message. */ +typedef tmsrp_message_t tmsrp_response_t; /**< MSRP response message. */ + + +TINYMSRP_API tmsrp_message_t* tmsrp_message_create(tmsrp_message_type_t type, const char* tid, const char* method, short status, const char* comment); +TINYMSRP_API tmsrp_message_t* tmsrp_request_create(const char* tid, const char* method); +TINYMSRP_API tmsrp_message_t* tmsrp_response_create(const char* tid, short status, const char* comment); +TINYMSRP_API tmsrp_message_t* tmsrp_message_create_null(); + +TINYMSRP_API int tmsrp_message_add_header(tmsrp_message_t *self, const tmsrp_header_t *hdr); +TINYMSRP_API int tmsrp_message_add_headers(tmsrp_message_t *self, ...); + +#if 0 +static void TMSRP_MESSAGE_ADD_HEADER(tmsrp_message_t *self, ...) + { + va_list ap; + tmsrp_header_t *header; + const tsk_object_def_t *objdef; + + va_start(ap, self); + objdef = va_arg(ap, const tsk_object_def_t*); + header = tsk_object_new_2(objdef, &ap); + va_end(ap); + + tmsrp_message_add_header(self, header); + tsk_object_unref(header); + } +#else +#define TMSRP_MESSAGE_ADD_HEADER(self, objdef, ...) \ + { \ + tmsrp_header_t *header = (tmsrp_header_t *)tsk_object_new(objdef, ##__VA_ARGS__); \ + tmsrp_message_add_header(self, header); \ + tsk_object_unref(header); \ + } +#endif + +TINYMSRP_API tmsrp_request_type_t tmsrp_request_get_type(const char* method); +TINYMSRP_API const tmsrp_header_t *tmsrp_message_get_headerAt(const tmsrp_message_t *self, tmsrp_header_type_t type, tsk_size_t index); +TINYMSRP_API const tmsrp_header_t *tmsrp_message_get_header(const tmsrp_message_t *self, tmsrp_header_type_t type); +TINYMSRP_API const tmsrp_header_t *tmsrp_message_get_headerByName(const tmsrp_message_t *self, const char* name); + +TINYMSRP_API int tmsrp_message_add_content(tmsrp_message_t *self, const char* content_type, const void* content, tsk_size_t size); + +TINYMSRP_API int tmsrp_message_serialize(const tmsrp_message_t *self, tsk_buffer_t *output); +TINYMSRP_API char* tmsrp_message_tostring(const tmsrp_message_t *self); + + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_message_def_t; + +TMSRP_END_DECLS + +#endif /* TINYMSRP_MESSAGE_H */ diff --git a/tinyMSRP/include/tinymsrp/tmsrp_uri.h b/tinyMSRP/include/tinymsrp/tmsrp_uri.h new file mode 100644 index 0000000..61ae352 --- /dev/null +++ b/tinyMSRP/include/tinymsrp/tmsrp_uri.h @@ -0,0 +1,92 @@ +/* +* Copyright (C) 2009 Mamadou Diop. +* +* Contact: Mamadou Diop <diopmamadou(at)doubango.org> +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tmsrp_uri.h + * @brief MSRP/MSRPS URI. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYMSRP_URI_H +#define TINYMSRP_URI_H + +#include "tinymsrp_config.h" + +#include "tsk_params.h" +#include "tsk_buffer.h" + +TMSRP_BEGIN_DECLS + +#define TMSRP_URI_IS_SECURE(uri) ((uri) && (tsk_striequals(uri->scheme, "msrps") ? 1 : 0)) +#define TMSRP_URI(self) ((tmsrp_uri_t*)(self)) + +/** The type of the authority host. +*/ +typedef enum tmsrp_host_type_e +{ + tmsrp_host_unknown, + tmsrp_host_hostname, + tmsrp_host_ipv4, + tmsrp_host_ipv6 +} +tmsrp_host_type_t; + +/** + * @struct tmsrp_uri_s + * + * @brief MSRP/MSRPS/TEL URI. +**/ +typedef struct tmsrp_uri_s +{ + TSK_DECLARE_OBJECT; + + char *scheme; + struct{ + char* userinfo; + tmsrp_host_type_t host_type; /**< IPv4 or IPv6 or domain name. */ + char* host; + int32_t port; + }authority; + char* session_id; + char* transport; + + tsk_params_L_t *params; /**< list of @ref tsk_param_t elements containing all parameters. */ +} +tmsrp_uri_t; + +typedef tsk_list_t tmsrp_uris_L_t; + + +TINYMSRP_API tmsrp_uri_t* tmsrp_uri_create(const char*scheme, const char* host, tmsrp_host_type_t host_type, int32_t port, const char* session_id, const char*transport); +TINYMSRP_API tmsrp_uri_t* tmsrp_uri_create_null(); + +TINYMSRP_API int tmsrp_uri_serialize(const tmsrp_uri_t *uri, tsk_buffer_t *output); +TINYMSRP_API char* tmsrp_uri_tostring(const tmsrp_uri_t *uri); +TINYMSRP_API tmsrp_uri_t *tmsrp_uri_clone(const tmsrp_uri_t *uri); + +TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_uri_def_t; + +TMSRP_END_DECLS + +#endif /* TINYMSRP_URI_H */ + diff --git a/tinyMSRP/include/tinymsrp_config.h b/tinyMSRP/include/tinymsrp_config.h new file mode 100644 index 0000000..f722993 --- /dev/null +++ b/tinyMSRP/include/tinymsrp_config.h @@ -0,0 +1,88 @@ +/* +* 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 tinyMSRP_config.h + * @brief Global configuration file. + * + * This file incude all your preferences or configuration. All specific configuration + * must be defined in this file. You must include this file in all your header files. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ + +#ifndef _TINYMSRP_H_ +#define _TINYMSRP_H_ + +#ifdef __SYMBIAN32__ +#undef _WIN32 /* Because of WINSCW */ +#endif + +// Windows (XP/Vista/7/CE and Windows Mobile) macro definition. +#if defined(WIN32)|| defined(_WIN32) || defined(_WIN32_WCE) +# define TMSRP_UNDER_WINDOWS 1 +# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP || WINAPI_FAMILY == WINAPI_FAMILY_APP) +# define TMSRP_UNDER_WINDOWS_RT 1 +# endif +#endif + +/* Used on Windows and Symbian systems to export/import public functions and global variables. +*/ +#if !defined(__GNUC__) && defined(TINYMSRP_EXPORTS) +# define TINYMSRP_API __declspec(dllexport) +# define TINYMSRP_GEXTERN extern __declspec(dllexport) +#elif !defined(__GNUC__) && !defined(TINYMSRP_IMPORTS_IGNORE) +# define TINYMSRP_API __declspec(dllimport) +# define TINYMSRP_GEXTERN __declspec(dllimport) +#else +# define TINYMSRP_API +# define TINYMSRP_GEXTERN extern +#endif + +/* Guards against C++ name mangling +*/ +#ifdef __cplusplus +# define TMSRP_BEGIN_DECLS extern "C" { +# define TMSRP_END_DECLS } +#else +# define TMSRP_BEGIN_DECLS +# define TMSRP_END_DECLS +#endif + +/* Disable some well-known warnings +*/ +#ifdef _MSC_VER +# define _CRT_SECURE_NO_WARNINGS +# pragma warning( disable : 4996 ) +#endif + +#include <stdint.h> +#include <stddef.h> + + +#if HAVE_CONFIG_H + #include <config.h> +#endif + +#endif /* _TINYMSRP_H_ */ + diff --git a/tinyMSRP/include/tmsrp.h b/tinyMSRP/include/tmsrp.h new file mode 100644 index 0000000..c7fac6a --- /dev/null +++ b/tinyMSRP/include/tmsrp.h @@ -0,0 +1,46 @@ +/* +* 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.h + * @brief MSRP API. + * + * @author Mamadou Diop <diopmamadou(at)doubango.org> + * + + */ +#ifndef TINYMSRP_TMSRP_H +#define TINYMSRP_TMSRP_H + +#include "tinymsrp_config.h" + +#include "tinymsrp/tmsrp_message.h" + +TMSRP_BEGIN_DECLS + +TINYMSRP_API tmsrp_request_t* tmsrp_create_bodiless(const tmsrp_uri_t* To, const tmsrp_uri_t* From); +TINYMSRP_API tmsrp_response_t* tmsrp_create_response(const tmsrp_request_t* request, short status, const char* comment); +TINYMSRP_API tmsrp_request_t* tmsrp_create_report(const tmsrp_request_t* SEND, short status, const char* reason); +TINYMSRP_API tsk_bool_t tmsrp_isReportRequired(const tmsrp_request_t* request, tsk_bool_t failed); + +TMSRP_END_DECLS + +#endif /* TINYMSRP_TMSRP_H */ |