From 631fffee8a28b1bec5ed1f1d26a20e0135967f99 Mon Sep 17 00:00:00 2001 From: Mamadou DIOP Date: Mon, 17 Aug 2015 01:56:35 +0200 Subject: - --- tinySIP/include/tinysip.h | 68 ++ tinySIP/include/tinysip/api/tsip_api_common.h | 52 ++ tinySIP/include/tinysip/api/tsip_api_info.h | 65 ++ tinySIP/include/tinysip/api/tsip_api_invite.h | 131 ++++ tinySIP/include/tinysip/api/tsip_api_message.h | 69 ++ tinySIP/include/tinysip/api/tsip_api_options.h | 71 +++ tinySIP/include/tinysip/api/tsip_api_publish.h | 74 +++ tinySIP/include/tinysip/api/tsip_api_register.h | 76 +++ tinySIP/include/tinysip/api/tsip_api_subscribe.h | 77 +++ .../tinysip/authentication/tsip_challenge.h | 92 +++ .../include/tinysip/authentication/tsip_milenage.h | 189 ++++++ .../include/tinysip/authentication/tsip_rijndael.h | 71 +++ tinySIP/include/tinysip/dialogs/tsip_dialog.h | 208 +++++++ tinySIP/include/tinysip/dialogs/tsip_dialog_info.h | 57 ++ .../tinysip/dialogs/tsip_dialog_invite.common.h | 122 ++++ .../include/tinysip/dialogs/tsip_dialog_invite.h | 128 ++++ .../include/tinysip/dialogs/tsip_dialog_layer.h | 88 +++ .../include/tinysip/dialogs/tsip_dialog_message.h | 57 ++ .../include/tinysip/dialogs/tsip_dialog_options.h | 54 ++ .../include/tinysip/dialogs/tsip_dialog_publish.h | 60 ++ .../tinysip/dialogs/tsip_dialog_register.common.h | 75 +++ .../include/tinysip/dialogs/tsip_dialog_register.h | 62 ++ .../tinysip/dialogs/tsip_dialog_subscribe.h | 57 ++ tinySIP/include/tinysip/headers/tsip_header.h | 196 ++++++ .../tinysip/headers/tsip_header_Accept_Contact.h | 56 ++ .../tinysip/headers/tsip_header_Accept_Encoding.h | 56 ++ .../tinysip/headers/tsip_header_Accept_Language.h | 56 ++ .../headers/tsip_header_Accept_Resource_Priority.h | 56 ++ .../tinysip/headers/tsip_header_Alert_Info.h | 54 ++ .../include/tinysip/headers/tsip_header_Allow.h | 66 ++ .../tinysip/headers/tsip_header_Allow_Events.h | 63 ++ .../headers/tsip_header_Authentication_Info.h | 56 ++ .../tinysip/headers/tsip_header_Authorization.h | 96 +++ tinySIP/include/tinysip/headers/tsip_header_CSeq.h | 71 +++ .../include/tinysip/headers/tsip_header_Call_ID.h | 68 ++ .../tinysip/headers/tsip_header_Call_Info.h | 54 ++ .../include/tinysip/headers/tsip_header_Contact.h | 90 +++ .../headers/tsip_header_Content_Disposition.h | 54 ++ .../tinysip/headers/tsip_header_Content_Encoding.h | 54 ++ .../tinysip/headers/tsip_header_Content_Language.h | 49 ++ .../tinysip/headers/tsip_header_Content_Length.h | 66 ++ .../tinysip/headers/tsip_header_Content_Type.h | 79 +++ tinySIP/include/tinysip/headers/tsip_header_Date.h | 79 +++ .../include/tinysip/headers/tsip_header_Dummy.h | 66 ++ .../tinysip/headers/tsip_header_Error_Info.h | 54 ++ .../include/tinysip/headers/tsip_header_Event.h | 72 +++ .../include/tinysip/headers/tsip_header_Expires.h | 67 ++ tinySIP/include/tinysip/headers/tsip_header_From.h | 69 ++ .../tinysip/headers/tsip_header_History_Info.h | 56 ++ .../include/tinysip/headers/tsip_header_Identity.h | 54 ++ .../tinysip/headers/tsip_header_Identity_Info.h | 54 ++ .../tinysip/headers/tsip_header_In_Reply_To.h | 54 ++ tinySIP/include/tinysip/headers/tsip_header_Join.h | 54 ++ .../tinysip/headers/tsip_header_MIME_Version.h | 54 ++ .../tinysip/headers/tsip_header_Max_Forwards.h | 68 ++ .../tinysip/headers/tsip_header_Min_Expires.h | 68 ++ .../include/tinysip/headers/tsip_header_Min_SE.h | 67 ++ .../tinysip/headers/tsip_header_Organization.h | 54 ++ .../headers/tsip_header_P_Access_Network_Info.h | 71 +++ .../tinysip/headers/tsip_header_P_Answer_State.h | 53 ++ .../headers/tsip_header_P_Asserted_Identity.h | 70 +++ .../tinysip/headers/tsip_header_P_Associated_URI.h | 72 +++ .../headers/tsip_header_P_Called_Party_ID.h | 53 ++ .../tsip_header_P_Charging_Function_Addresses.h | 68 ++ .../headers/tsip_header_P_Charging_Vector.h | 54 ++ .../headers/tsip_header_P_DCS_Billing_Info.h | 54 ++ .../tinysip/headers/tsip_header_P_DCS_LAES.h | 54 ++ .../tinysip/headers/tsip_header_P_DCS_OSPS.h | 54 ++ .../tinysip/headers/tsip_header_P_DCS_Redirect.h | 54 ++ .../headers/tsip_header_P_DCS_Trace_Party_ID.h | 54 ++ .../tinysip/headers/tsip_header_P_Early_Media.h | 54 ++ .../headers/tsip_header_P_Media_Authorization.h | 54 ++ .../headers/tsip_header_P_Preferred_Identity.h | 69 ++ .../tinysip/headers/tsip_header_P_Profile_Key.h | 54 ++ .../tinysip/headers/tsip_header_P_User_Database.h | 54 ++ .../headers/tsip_header_P_Visited_Network_ID.h | 54 ++ tinySIP/include/tinysip/headers/tsip_header_Path.h | 72 +++ .../include/tinysip/headers/tsip_header_Priority.h | 54 ++ .../include/tinysip/headers/tsip_header_Privacy.h | 65 ++ .../headers/tsip_header_Proxy_Authenticate.h | 77 +++ .../headers/tsip_header_Proxy_Authorization.h | 96 +++ .../tinysip/headers/tsip_header_Proxy_Require.h | 66 ++ tinySIP/include/tinysip/headers/tsip_header_RAck.h | 68 ++ tinySIP/include/tinysip/headers/tsip_header_RSeq.h | 68 ++ .../include/tinysip/headers/tsip_header_Reason.h | 54 ++ .../tinysip/headers/tsip_header_Record_Route.h | 73 +++ .../tinysip/headers/tsip_header_Refer_Sub.h | 67 ++ .../include/tinysip/headers/tsip_header_Refer_To.h | 69 ++ .../tinysip/headers/tsip_header_Referred_By.h | 70 +++ .../tinysip/headers/tsip_header_Reject_Contact.h | 54 ++ .../include/tinysip/headers/tsip_header_Replaces.h | 54 ++ .../include/tinysip/headers/tsip_header_Reply_To.h | 53 ++ .../headers/tsip_header_Request_Disposition.h | 54 ++ .../include/tinysip/headers/tsip_header_Require.h | 66 ++ .../headers/tsip_header_Resource_Priority.h | 54 ++ .../tinysip/headers/tsip_header_Retry_After.h | 54 ++ .../include/tinysip/headers/tsip_header_Route.h | 72 +++ .../include/tinysip/headers/tsip_header_SIP_ETag.h | 66 ++ .../tinysip/headers/tsip_header_SIP_If_Match.h | 67 ++ .../tinysip/headers/tsip_header_Security_Client.h | 111 ++++ .../tinysip/headers/tsip_header_Security_Server.h | 111 ++++ .../tinysip/headers/tsip_header_Security_Verify.h | 110 ++++ .../include/tinysip/headers/tsip_header_Server.h | 69 ++ .../tinysip/headers/tsip_header_Service_Route.h | 71 +++ .../tinysip/headers/tsip_header_Session_Expires.h | 69 ++ .../include/tinysip/headers/tsip_header_Subject.h | 54 ++ .../headers/tsip_header_Subscription_State.h | 71 +++ .../tinysip/headers/tsip_header_Supported.h | 67 ++ .../tinysip/headers/tsip_header_Target_Dialog.h | 54 ++ .../tinysip/headers/tsip_header_Timestamp.h | 54 ++ tinySIP/include/tinysip/headers/tsip_header_To.h | 70 +++ .../tinysip/headers/tsip_header_Unsupported.h | 54 ++ .../tinysip/headers/tsip_header_User_Agent.h | 65 ++ tinySIP/include/tinysip/headers/tsip_header_Via.h | 107 ++++ .../tinysip/headers/tsip_header_WWW_Authenticate.h | 79 +++ .../include/tinysip/headers/tsip_header_Warning.h | 72 +++ .../include/tinysip/headers/tsip_header_accept.h | 57 ++ tinySIP/include/tinysip/headers/tsip_headers.h | 89 +++ .../include/tinysip/parsers/tsip_parser_header.h | 44 ++ .../include/tinysip/parsers/tsip_parser_message.h | 44 ++ tinySIP/include/tinysip/parsers/tsip_parser_uri.h | 45 ++ tinySIP/include/tinysip/sigcomp/tsip_sigcomp.h | 69 ++ .../include/tinysip/transactions/tsip_transac.h | 181 ++++++ .../tinysip/transactions/tsip_transac_ict.h | 63 ++ .../tinysip/transactions/tsip_transac_ist.h | 64 ++ .../tinysip/transactions/tsip_transac_layer.h | 72 +++ .../tinysip/transactions/tsip_transac_nict.h | 61 ++ .../tinysip/transactions/tsip_transac_nist.h | 59 ++ .../include/tinysip/transports/tsip_transport.h | 187 ++++++ .../tinysip/transports/tsip_transport_ipsec.h | 86 +++ .../tinysip/transports/tsip_transport_layer.h | 77 +++ .../tinysip/transports/tsip_transport_tls.h | 41 ++ tinySIP/include/tinysip/tsip_action.h | 171 +++++ tinySIP/include/tinysip/tsip_event.h | 113 ++++ tinySIP/include/tinysip/tsip_message.h | 216 +++++++ tinySIP/include/tinysip/tsip_message_common.h | 140 +++++ tinySIP/include/tinysip/tsip_ssession.h | 301 +++++++++ tinySIP/include/tinysip/tsip_timers.h | 123 ++++ tinySIP/include/tinysip/tsip_uri.h | 95 +++ tinySIP/include/tinysip_config.h | 96 +++ tinySIP/include/tsip.h | 692 +++++++++++++++++++++ 141 files changed, 11350 insertions(+) create mode 100644 tinySIP/include/tinysip.h create mode 100644 tinySIP/include/tinysip/api/tsip_api_common.h create mode 100644 tinySIP/include/tinysip/api/tsip_api_info.h create mode 100644 tinySIP/include/tinysip/api/tsip_api_invite.h create mode 100644 tinySIP/include/tinysip/api/tsip_api_message.h create mode 100644 tinySIP/include/tinysip/api/tsip_api_options.h create mode 100644 tinySIP/include/tinysip/api/tsip_api_publish.h create mode 100644 tinySIP/include/tinysip/api/tsip_api_register.h create mode 100644 tinySIP/include/tinysip/api/tsip_api_subscribe.h create mode 100644 tinySIP/include/tinysip/authentication/tsip_challenge.h create mode 100644 tinySIP/include/tinysip/authentication/tsip_milenage.h create mode 100644 tinySIP/include/tinysip/authentication/tsip_rijndael.h create mode 100644 tinySIP/include/tinysip/dialogs/tsip_dialog.h create mode 100644 tinySIP/include/tinysip/dialogs/tsip_dialog_info.h create mode 100644 tinySIP/include/tinysip/dialogs/tsip_dialog_invite.common.h create mode 100644 tinySIP/include/tinysip/dialogs/tsip_dialog_invite.h create mode 100644 tinySIP/include/tinysip/dialogs/tsip_dialog_layer.h create mode 100644 tinySIP/include/tinysip/dialogs/tsip_dialog_message.h create mode 100644 tinySIP/include/tinysip/dialogs/tsip_dialog_options.h create mode 100644 tinySIP/include/tinysip/dialogs/tsip_dialog_publish.h create mode 100644 tinySIP/include/tinysip/dialogs/tsip_dialog_register.common.h create mode 100644 tinySIP/include/tinysip/dialogs/tsip_dialog_register.h create mode 100644 tinySIP/include/tinysip/dialogs/tsip_dialog_subscribe.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Accept_Contact.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Accept_Encoding.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Accept_Language.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Accept_Resource_Priority.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Alert_Info.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Allow.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Allow_Events.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Authentication_Info.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Authorization.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_CSeq.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Call_ID.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Call_Info.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Contact.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Content_Disposition.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Content_Encoding.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Content_Language.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Content_Length.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Content_Type.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Date.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Dummy.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Error_Info.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Event.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Expires.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_From.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_History_Info.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Identity.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Identity_Info.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_In_Reply_To.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Join.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_MIME_Version.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Max_Forwards.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Min_Expires.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Min_SE.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Organization.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_P_Access_Network_Info.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_P_Answer_State.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_P_Asserted_Identity.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_P_Associated_URI.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_P_Called_Party_ID.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_P_Charging_Function_Addresses.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_P_Charging_Vector.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_P_DCS_Billing_Info.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_P_DCS_LAES.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_P_DCS_OSPS.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_P_DCS_Redirect.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_P_DCS_Trace_Party_ID.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_P_Early_Media.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_P_Media_Authorization.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_P_Preferred_Identity.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_P_Profile_Key.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_P_User_Database.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_P_Visited_Network_ID.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Path.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Priority.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Privacy.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Proxy_Authenticate.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Proxy_Authorization.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Proxy_Require.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_RAck.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_RSeq.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Reason.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Record_Route.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Refer_Sub.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Refer_To.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Referred_By.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Reject_Contact.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Replaces.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Reply_To.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Request_Disposition.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Require.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Resource_Priority.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Retry_After.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Route.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_SIP_ETag.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_SIP_If_Match.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Security_Client.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Security_Server.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Security_Verify.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Server.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Service_Route.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Session_Expires.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Subject.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Subscription_State.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Supported.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Target_Dialog.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Timestamp.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_To.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Unsupported.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_User_Agent.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Via.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_WWW_Authenticate.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_Warning.h create mode 100644 tinySIP/include/tinysip/headers/tsip_header_accept.h create mode 100644 tinySIP/include/tinysip/headers/tsip_headers.h create mode 100644 tinySIP/include/tinysip/parsers/tsip_parser_header.h create mode 100644 tinySIP/include/tinysip/parsers/tsip_parser_message.h create mode 100644 tinySIP/include/tinysip/parsers/tsip_parser_uri.h create mode 100644 tinySIP/include/tinysip/sigcomp/tsip_sigcomp.h create mode 100644 tinySIP/include/tinysip/transactions/tsip_transac.h create mode 100644 tinySIP/include/tinysip/transactions/tsip_transac_ict.h create mode 100644 tinySIP/include/tinysip/transactions/tsip_transac_ist.h create mode 100644 tinySIP/include/tinysip/transactions/tsip_transac_layer.h create mode 100644 tinySIP/include/tinysip/transactions/tsip_transac_nict.h create mode 100644 tinySIP/include/tinysip/transactions/tsip_transac_nist.h create mode 100644 tinySIP/include/tinysip/transports/tsip_transport.h create mode 100644 tinySIP/include/tinysip/transports/tsip_transport_ipsec.h create mode 100644 tinySIP/include/tinysip/transports/tsip_transport_layer.h create mode 100644 tinySIP/include/tinysip/transports/tsip_transport_tls.h create mode 100644 tinySIP/include/tinysip/tsip_action.h create mode 100644 tinySIP/include/tinysip/tsip_event.h create mode 100644 tinySIP/include/tinysip/tsip_message.h create mode 100644 tinySIP/include/tinysip/tsip_message_common.h create mode 100644 tinySIP/include/tinysip/tsip_ssession.h create mode 100644 tinySIP/include/tinysip/tsip_timers.h create mode 100644 tinySIP/include/tinysip/tsip_uri.h create mode 100644 tinySIP/include/tinysip_config.h create mode 100644 tinySIP/include/tsip.h (limited to 'tinySIP/include') diff --git a/tinySIP/include/tinysip.h b/tinySIP/include/tinysip.h new file mode 100644 index 0000000..bf666dc --- /dev/null +++ b/tinySIP/include/tinysip.h @@ -0,0 +1,68 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tinysip.h + * @brief SIP (RFC 3261) and 3GPP IMS/LTE (TS 24.229) API. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_TINYSIP_H +#define TINYSIP_TINYSIP_H + +/* === tinySAK === */ +#include "tsk.h" + +/* === tinyNET === */ +#include "tinynet.h" + +/* === tinyMEDIA === */ +#include "tinymedia.h" + +/* === tinySDP === */ +#include "tinysdp.h" + +/* === tinySIP === */ +#include "tsip.h" + +#include "tinysip/parsers/tsip_parser_uri.h" +#include "tinysip/parsers/tsip_parser_header.h" +#include "tinysip/parsers/tsip_parser_message.h" + +#include "tinysip/tsip_ssession.h" +#include "tinysip/tsip_action.h" + +#include "tinysip/tsip_message.h" + +#include "tinysip/headers/tsip_headers.h" + +#include "tinysip/api/tsip_api_common.h" +#include "tinysip/api/tsip_api_invite.h" +#include "tinysip/api/tsip_api_message.h" +#include "tinysip/api/tsip_api_info.h" +#include "tinysip/api/tsip_api_options.h" +#include "tinysip/api/tsip_api_publish.h" +#include "tinysip/api/tsip_api_register.h" +#include "tinysip/api/tsip_api_subscribe.h" + +#endif /* TINYSIP_TINYSIP_H */ diff --git a/tinySIP/include/tinysip/api/tsip_api_common.h b/tinySIP/include/tinysip/api/tsip_api_common.h new file mode 100644 index 0000000..1f91f66 --- /dev/null +++ b/tinySIP/include/tinysip/api/tsip_api_common.h @@ -0,0 +1,52 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_api_common.h + * @brief Public common functions. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_TSIP_COMMON_H +#define TINYSIP_TSIP_COMMON_H + +#include "tinysip_config.h" + +#include "tinysip/tsip_ssession.h" + +TSIP_BEGIN_DECLS + +TINYSIP_API int tsip_api_common_reject(const tsip_ssession_handle_t *ss, ...); +TINYSIP_API int tsip_api_common_hangup(const tsip_ssession_handle_t *ss, ...); +TINYSIP_API int tsip_api_common_accept(const tsip_ssession_handle_t *ss, ...); + + +#if 1 // Backward Compatibility +# define tsip_action_REJECT tsip_api_common_reject +# define tsip_action_HANGUP tsip_api_common_hangup +# define tsip_action_ACCEPT tsip_api_common_accept +#endif + +TSIP_END_DECLS + +#endif /* TINYSIP_TSIP_COMMON_H */ diff --git a/tinySIP/include/tinysip/api/tsip_api_info.h b/tinySIP/include/tinysip/api/tsip_api_info.h new file mode 100644 index 0000000..5c7f08e --- /dev/null +++ b/tinySIP/include/tinysip/api/tsip_api_info.h @@ -0,0 +1,65 @@ +/* Copyright (C) 2011 Doubango Telecom +* Copyright (C) 2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_api_info.h + * @brief Public info (INFO) functions. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_TSIP_INFO_H +#define TINYSIP_TSIP_INFO_H + +#include "tinysip_config.h" + +#include "tinysip/tsip_event.h" + +TSIP_BEGIN_DECLS + +#define TSIP_INFO_EVENT(self) ((tsip_info_event_t*)(self)) + +//@rinyWRAP +typedef enum tsip_info_event_type_e +{ + tsip_i_info, + tsip_ao_info, +} +tsip_info_event_type_t; + +typedef struct tsip_info_event_e +{ + TSIP_DECLARE_EVENT; + + tsip_info_event_type_t type; +} +tsip_info_event_t; + +int tsip_info_event_signal(tsip_info_event_type_t type, tsip_ssession_handle_t* ss, short status_code, const char *phrase, const struct tsip_message_s* sipmessage); + +TINYSIP_API int tsip_api_info_send_info(const tsip_ssession_handle_t *ss, ...); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_info_event_def_t; + +TSIP_END_DECLS + +#endif /* TINYSIP_TSIP_INFO_H */ diff --git a/tinySIP/include/tinysip/api/tsip_api_invite.h b/tinySIP/include/tinysip/api/tsip_api_invite.h new file mode 100644 index 0000000..7fa5b01 --- /dev/null +++ b/tinySIP/include/tinysip/api/tsip_api_invite.h @@ -0,0 +1,131 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_api_invite.h + * @brief Public messaging (INVITE) functions. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_TSIP_INVITE_H +#define TINYSIP_TSIP_INVITE_H + +#include "tinysip_config.h" + +#include "tinysip/tsip_event.h" + +#include "tinymedia/tmedia_common.h" + +TSIP_BEGIN_DECLS + +#define TSIP_INVITE_EVENT(self) ((tsip_invite_event_t*)(self)) + +//@tinyWRAP +typedef enum tsip_invite_event_type_e +{ + // ============================ + // Sip Events + // + tsip_i_newcall, + + //! in-dialog requests/reponses + tsip_i_request, + tsip_ao_request, + + /* 3GPP TS 24.629: Explicit Call Transfer (ECT) */ + tsip_o_ect_trying, + tsip_o_ect_accepted, + tsip_o_ect_completed, + tsip_o_ect_failed, + tsip_o_ect_notify, + tsip_i_ect_requested, + tsip_i_ect_newcall, + tsip_i_ect_completed, + tsip_i_ect_failed, + tsip_i_ect_notify, + + // ============================ + // Media Events + // + + tsip_m_early_media, + tsip_m_updating, // Trying to update from Audio -> Video for example + tsip_m_updated, // succeed to update + + /* 3GPP TS 24.610: Communication Hold */ + tsip_m_local_hold_ok, + tsip_m_local_hold_nok, + tsip_m_local_resume_ok, + tsip_m_local_resume_nok, + tsip_m_remote_hold, + tsip_m_remote_resume, +} +tsip_invite_event_type_t; + +typedef struct tsip_invite_event_e +{ + TSIP_DECLARE_EVENT; + + tsip_invite_event_type_t type; + + struct{ + unsigned toto:1; + } av; + + /*struct{ + char* dir; + } msrp;*/ +} +tsip_invite_event_t; + +int tsip_invite_event_signal(tsip_invite_event_type_t type, tsip_ssession_handle_t* ss, short status_code, const char *phrase, const struct tsip_message_s* sipmessage); + +TINYSIP_API int tsip_api_invite_send_invite(const tsip_ssession_handle_t *ss, tmedia_type_t type, ...); +TINYSIP_API int tsip_api_invite_send_info(const tsip_ssession_handle_t *ss, ...); +TINYSIP_API int tsip_api_invite_send_hold(const tsip_ssession_handle_t *ss, tmedia_type_t type, ...); +TINYSIP_API int tsip_api_invite_send_resume(const tsip_ssession_handle_t *ss, tmedia_type_t type, ...); +TINYSIP_API int tsip_api_invite_send_large_message(const tsip_ssession_handle_t *ss, ...); +TINYSIP_API int tsip_api_invite_send_ect(const tsip_ssession_handle_t *ss, const char* toUri, ...); +TINYSIP_API int tsip_api_invite_send_ect_accept(const tsip_ssession_handle_t *ss, ...); +TINYSIP_API int tsip_api_invite_send_ect_reject(const tsip_ssession_handle_t *ss, ...); +TINYSIP_API int tsip_api_invite_send_sos(const tsip_ssession_handle_t *ss, ...); +TINYSIP_API int tsip_api_invite_send_dtmf(const tsip_ssession_handle_t *ss, int event, ...); +TINYSIP_API int tsip_api_invite_send_bye(const tsip_ssession_handle_t *ss, ...); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_invite_event_def_t; + +#if 1 // Backward Compatibility +# define tsip_action_INVITE tsip_api_invite_send_invite +# define tsip_action_HOLD tsip_api_invite_send_hold +# define tsip_action_RESUME tsip_api_invite_send_resume +# define tsip_action_LARGE_MESSAGE tsip_api_invite_send_large_message +# define tsip_action_ECT tsip_api_invite_send_ect +# define tsip_action_SOS tsip_api_invite_send_sos +# define tsip_action_DTMF tsip_api_invite_send_dtmf +# define tsip_action_BYE tsip_api_invite_send_bye +#endif + + +TSIP_END_DECLS + +#endif /* TINYSIP_TSIP_INVITE_H */ diff --git a/tinySIP/include/tinysip/api/tsip_api_message.h b/tinySIP/include/tinysip/api/tsip_api_message.h new file mode 100644 index 0000000..e52c914 --- /dev/null +++ b/tinySIP/include/tinysip/api/tsip_api_message.h @@ -0,0 +1,69 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_api_message.h + * @brief Public messaging (MESSAGE) functions. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_TSIP_MESSAGE_H +#define TINYSIP_TSIP_MESSAGE_H + +#include "tinysip_config.h" + +#include "tinysip/tsip_event.h" + +TSIP_BEGIN_DECLS + +#define TSIP_MESSAGE_EVENT(self) ((tsip_message_event_t*)(self)) + +//@tinyWRAP +typedef enum tsip_message_event_type_e +{ + tsip_i_message, + tsip_ao_message, +} +tsip_message_event_type_t; + +typedef struct tsip_message_event_e +{ + TSIP_DECLARE_EVENT; + + tsip_message_event_type_t type; +} +tsip_message_event_t; + +int tsip_message_event_signal(tsip_message_event_type_t type, tsip_ssession_handle_t* ss, short status_code, const char *phrase, const struct tsip_message_s* sipmessage); + +TINYSIP_API int tsip_api_message_send_message(const tsip_ssession_handle_t *ss, ...); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_message_event_def_t; + +#if 1 // Backward Compatibility +# define tsip_action_MESSAGE tsip_api_message_send_message +#endif + +TSIP_END_DECLS + +#endif /* TINYSIP_TSIP_MESSAGE_H */ diff --git a/tinySIP/include/tinysip/api/tsip_api_options.h b/tinySIP/include/tinysip/api/tsip_api_options.h new file mode 100644 index 0000000..1f62211 --- /dev/null +++ b/tinySIP/include/tinysip/api/tsip_api_options.h @@ -0,0 +1,71 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_api_options.h + * @brief Public functions to handle OPTIONS. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_TSIP_OPTIONS_H +#define TINYSIP_TSIP_OPTIONS_H + +#include "tinysip_config.h" + +#include "tinysip/tsip_event.h" + +TSIP_BEGIN_DECLS + +#define TSIP_OPTIONS_EVENT(self) ((tsip_options_event_t*)(self)) + +//@tinyWRAP +typedef enum tsip_options_event_type_e +{ + tsip_i_options, + tsip_ao_options, +} +tsip_options_event_type_t; + +/**< Event from SIP OPTIONS dialog */ +typedef struct tsip_options_event_e +{ + TSIP_DECLARE_EVENT; + + //! the type of the event + tsip_options_event_type_t type; +} +tsip_options_event_t; + +int tsip_options_event_signal(tsip_options_event_type_t type, tsip_ssession_handle_t* ss, short status_code, const char *phrase, const struct tsip_message_s* sipmessage); + +TINYSIP_API int tsip_api_options_send_options(const tsip_ssession_handle_t *ss, ...); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_options_event_def_t; + +#if 1 // Backward Compatibility +# define tsip_action_OPTIONS tsip_api_options_send_options +#endif + +TSIP_END_DECLS + +#endif /* TINYSIP_TSIP_OPTIONS_H */ diff --git a/tinySIP/include/tinysip/api/tsip_api_publish.h b/tinySIP/include/tinysip/api/tsip_api_publish.h new file mode 100644 index 0000000..c37f239 --- /dev/null +++ b/tinySIP/include/tinysip/api/tsip_api_publish.h @@ -0,0 +1,74 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_api_publish.h + * @brief Public piblication (PUBLISH) functions. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_TSIP_PUBLISH_H +#define TINYSIP_TSIP_PUBLISH_H + +#include "tinysip_config.h" + +#include "tinysip/tsip_event.h" + +TSIP_BEGIN_DECLS + +#define TSIP_PUBLISH_EVENT(self) ((tsip_publish_event_t*)(self)) + +//@tinyWRAP +typedef enum tsip_publish_event_type_e +{ + tsip_i_publish, + tsip_ao_publish, + + tsip_i_unpublish, + tsip_ao_unpublish +} +tsip_publish_event_type_t; + +typedef struct tsip_publish_event_e +{ + TSIP_DECLARE_EVENT; + + tsip_publish_event_type_t type; +} +tsip_publish_event_t; + +int tsip_publish_event_signal(tsip_publish_event_type_t type, tsip_ssession_handle_t* ss, short status_code, const char *phrase, const struct tsip_message_s* sipmessage); + +TINYSIP_API int tsip_api_publish_send_publish(const tsip_ssession_handle_t *ss, ...); +TINYSIP_API int tsip_api_publish_send_unpublish(const tsip_ssession_handle_t *ss, ...); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_publish_event_def_t; + +#if 1 // Backward Compatibility +# define tsip_action_PUBLISH tsip_api_publish_send_publish +# define tsip_action_UNPUBLISH tsip_api_publish_send_unpublish +#endif + +TSIP_END_DECLS + +#endif /* TINYSIP_TSIP_PUBLISH_H */ diff --git a/tinySIP/include/tinysip/api/tsip_api_register.h b/tinySIP/include/tinysip/api/tsip_api_register.h new file mode 100644 index 0000000..d116006 --- /dev/null +++ b/tinySIP/include/tinysip/api/tsip_api_register.h @@ -0,0 +1,76 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_api_register.h + * @brief Public registration (REGISTER) functions. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_TSIP_REGISTER_H +#define TINYSIP_TSIP_REGISTER_H + +#include "tinysip_config.h" + +#include "tinysip/tsip_event.h" + +TSIP_BEGIN_DECLS + +#define TSIP_REGISTER_EVENT(self) ((tsip_register_event_t*)(self)) + +//@tinyWRAP +typedef enum tsip_register_event_type_e +{ + tsip_i_newreg, + + tsip_i_register, // refresh + tsip_ao_register, + + tsip_i_unregister, + tsip_ao_unregister, +} +tsip_register_event_type_t; + +typedef struct tsip_register_event_e +{ + TSIP_DECLARE_EVENT; + + tsip_register_event_type_t type; +} +tsip_register_event_t; + +int tsip_register_event_signal(tsip_register_event_type_t type, tsip_ssession_t* ss, short status_code, const char *phrase, const struct tsip_message_s* sipmessage); + +TINYSIP_API int tsip_api_register_send_register(const tsip_ssession_handle_t *ss, ...); +TINYSIP_API int tsip_api_register_send_unregister(const tsip_ssession_handle_t *ss, ...); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_register_event_def_t; + +#if 1 // Backward Compatibility +# define tsip_action_REGISTER tsip_api_register_send_register +# define tsip_action_UNREGISTER tsip_api_register_send_unregister +#endif + +TSIP_END_DECLS + +#endif /* TINYSIP_TSIP_REGISTER_H */ diff --git a/tinySIP/include/tinysip/api/tsip_api_subscribe.h b/tinySIP/include/tinysip/api/tsip_api_subscribe.h new file mode 100644 index 0000000..da7f8c9 --- /dev/null +++ b/tinySIP/include/tinysip/api/tsip_api_subscribe.h @@ -0,0 +1,77 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_api_subscribe.h + * @brief Public subscription (SUBSCRIBE) functions. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_TSIP_SUBSCRIBE_H +#define TINYSIP_TSIP_SUBSCRIBE_H + +#include "tinysip_config.h" + +#include "tinysip/tsip_event.h" + +TSIP_BEGIN_DECLS + +#define TSIP_SUBSCRIBE_EVENT(self) ((tsip_subscribe_event_t*)(self)) + +//@tinyWRAP +typedef enum tsip_subscribe_event_type_e +{ + tsip_i_subscribe, + tsip_ao_subscribe, + + tsip_i_unsubscribe, + tsip_ao_unsubscribe, + + tsip_i_notify, + tsip_ao_notify +} +tsip_subscribe_event_type_t; + +typedef struct tsip_subscribe_event_e +{ + TSIP_DECLARE_EVENT; + + tsip_subscribe_event_type_t type; +} +tsip_subscribe_event_t; + +int tsip_subscribe_event_signal(tsip_subscribe_event_type_t type, tsip_ssession_t* ss, short status_code, const char *phrase, const struct tsip_message_s* sipmessage); + +TINYSIP_API int tsip_api_subscribe_send_subscribe(const tsip_ssession_handle_t *ss, ...); +TINYSIP_API int tsip_api_subscribe_send_unsubscribe(const tsip_ssession_handle_t *ss, ...); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_subscribe_event_def_t; + +#if 1 // Backward Compatibility +# define tsip_action_SUBSCRIBE tsip_api_subscribe_send_subscribe +# define tsip_action_UNSUBSCRIBE tsip_api_subscribe_send_unsubscribe +#endif + +TSIP_END_DECLS + +#endif /* TINYSIP_TSIP_SUBSCRIBE_H */ diff --git a/tinySIP/include/tinysip/authentication/tsip_challenge.h b/tinySIP/include/tinysip/authentication/tsip_challenge.h new file mode 100644 index 0000000..38f7690 --- /dev/null +++ b/tinySIP/include/tinysip/authentication/tsip_challenge.h @@ -0,0 +1,92 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_challenge.h + * @brief SIP authentication challenge. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_AUTHENTICATION_CHALLENGE_H +#define TINYSIP_AUTHENTICATION_CHALLENGE_H + +#include "tinysip_config.h" + +#include "tsip.h" + +#include "tinysip/tsip_message.h" +#include "tinysip/headers/tsip_header.h" + +#include "tinysip/authentication/tsip_milenage.h" + +#include "tinyhttp/auth/thttp_auth.h" + +#include "tsk_object.h" +#include "tsk_list.h" +#include "tsk_md5.h" + +TSIP_BEGIN_DECLS + + +typedef struct tsip_challenge_s +{ + TSK_DECLARE_OBJECT; + + const tsip_stack_handle_t *stack; + + tsk_bool_t isproxy; + + char* username; + char* scheme; + char* realm; + char* nonce; + char* opaque; + char* algorithm; + const char* qop; + + char* ha1_hexstr; + + AKA_CK_T ck; + AKA_IK_T ik; + + tsk_md5string_t cnonce; + unsigned nc; +} +tsip_challenge_t; + +typedef tsk_list_t tsip_challenges_L_t; + +TINYSIP_API tsip_challenge_t* tsip_challenge_create(tsip_stack_t* stack, tsk_bool_t isproxy, const char* scheme, const char* realm, const char* nonce, const char* opaque, const char* algorithm, const char* qop); +tsip_challenge_t* tsip_challenge_create_null(tsip_stack_t* stack); + +int tsip_challenge_set_cred(tsip_challenge_t *self, const char* username, const char* ha1_hexstr); +int tsip_challenge_update(tsip_challenge_t *self, const char* scheme, const char* realm, const char* nonce, const char* opaque, const char* algorithm, const char* qop); +TINYSIP_API tsip_header_t *tsip_challenge_create_header_authorization(tsip_challenge_t *self, const tsip_request_t *request); +tsip_header_t *tsip_challenge_create_empty_header_authorization(const char* username, const char* realm, const char* uristring); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_challenge_def_t; + +TSIP_END_DECLS + +#endif /* TINYSIP_AUTHENTICATION_CHALLENGE_H */ + diff --git a/tinySIP/include/tinysip/authentication/tsip_milenage.h b/tinySIP/include/tinysip/authentication/tsip_milenage.h new file mode 100644 index 0000000..dbf72de --- /dev/null +++ b/tinySIP/include/tinysip/authentication/tsip_milenage.h @@ -0,0 +1,189 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_milenage.h + * @brief 3GPP authentication and key agreement functions f1, f1*, f2, f3, f4, f5 and f5*. + * + * @section DESCRIPTION + * + * @sa 3G Security + * 3GPP TS 35.205 + * 3GPP TS 35.206 + * 3GPP TS 35.207 + * 3GPP TS 35.208 + * 3GPP TS 35.909 + *------------------------------------------------------------------- + * Example algorithms f1, f1*, f2, f3, f4, f5, f5* + *------------------------------------------------------------------- + * + * A sample implementation of the example 3GPP authentication and + * key agreement functions f1, f1*, f2, f3, f4, f5 and f5*. This is + * a byte-oriented implementation of the functions, and of the block + * cipher kernel function Rijndael. + * + * This has been coded for clarity, not necessarily for efficiency. + * + * The functions f2, f3, f4 and f5 share the same inputs and have + * been coded together as a single function. f1, f1* and f5* are + * all coded separately. + * + *----------------------------------------------------------------- + * + * @author Mamadou Diop + * + + */ + +#ifndef TINYSIP_AUTHENTICATION_MILENAGE_H +#define TINYSIP_AUTHENTICATION_MILENAGE_H + +#include "tinysip_config.h" + +/**@def AKA_AK_SIZE + * a 48-bit anonymity key that is the output of either of the functions f5 and f5*. + * Defined in 3GPP TS 35.206 subclause 2.3. + */ + +TSIP_BEGIN_DECLS + +#define AKA_AK_SIZE 6 +typedef uint8_t AKA_AK_T[AKA_AK_SIZE + 1]; + +/**@def AKA_AMF_SIZE + * 16-bit authentication management field that is an input to the functions f1 and f1*. + * Defined in 3GPP TS 35.206 subclause 2.3. + */ +#define AKA_AMF_SIZE 2 +typedef uint8_t AKA_AMF_T[AKA_AMF_SIZE + 1]; + +/**@def AKA_CK_SIZE + * a 128-bit confidentiality key that is the output of the function f3. + * Defined in 3GPP TS 35.206 subclause 2.3. + */ +#define AKA_CK_SIZE 16 +typedef uint8_t AKA_CK_T[AKA_CK_SIZE + 1]; + +/**@def AKA_IK_SIZE + * a 128-bit integrity key that is the output of the function f4. + * Defined in 3GPP TS 35.206 subclause 2.3. + */ +#define AKA_IK_SIZE 16 +typedef uint8_t AKA_IK_T[AKA_IK_SIZE + 1]; + +/**@def AKA_K_SIZE + * a 128-bit subscriber key that is an input to the functions f1, f1*, f2, f3, f4, f5 and f5*. + * Defined in 3GPP TS 35.206 subclause 2.3. + */ +#define AKA_K_SIZE 16 +typedef uint8_t AKA_K_T[AKA_K_SIZE + 1]; + +/**@def AKA_MAC_A_SIZE + * a 64-bit network authentication code that is the output of the function f1. + * Defined in 3GPP TS 35.206 subclause 2.3. + */ +#define AKA_MAC_A_SIZE 8 +typedef uint8_t AKA_MAC_A_T[AKA_MAC_A_SIZE + 1]; + +/**@def AKA_MAC_S_SIZE + * a 64-bit network authentication code that is the output of the function f1*. + * Defined in 3GPP TS 35.206 subclause 2.3. + */ +#define AKA_MAC_S_SIZE 8 +typedef uint8_t AKA_MAC_S_T[AKA_MAC_S_SIZE + 1]; + +/**@def AKA_OP_SIZE + * a 128-bit Operator Variant Algorithm Configuration Field that is a component of the functions f1, f1*, f2, f3, f4, f5 and f5*. + * Defined in 3GPP TS 35.206 subclause 2.3. + */ +#define AKA_OP_SIZE 16 +typedef uint8_t AKA_OP_T[AKA_OP_SIZE + 1]; + +/**@def AKA_OPC_SIZE + * a 128-bit value derived from OP and K and used within the computation of the functions. + * Defined in 3GPP TS 35.206 subclause 2.3. + */ +#define AKA_OPC_SIZE 16 +typedef uint8_t AKA_OPC_T[AKA_OPC_SIZE + 1]; + +/**@def AKA_RAND_SIZE + * a 128-bit random challenge that is an input to the functions f1, f1*, f2, f3, f4, f5 and f5*. + * Defined in 3GPP TS 35.206 subclause 2.3. + */ +#define AKA_RAND_SIZE 16 +typedef uint8_t AKA_RAND_T[AKA_RAND_SIZE + 1]; + +/**@def AKA_RES_SIZE + * a 64-bit signed response that is the output of the function f2. + * Defined in 3GPP TS 35.206 subclause 2.3. + */ +#define AKA_RES_SIZE 8 +typedef uint8_t AKA_RES_T[AKA_RES_SIZE + 1]; + +/**@def AKA_SQN_SIZE + * a 48-bit sequence number that is an input to either of the functions f1 and f1*. (For f1* this input is more precisely called SQNMS.) + * Defined in 3GPP TS 35.206 subclause 2.3. + */ +#define AKA_SQN_SIZE 6 +typedef uint8_t AKA_SQN_T[AKA_SQN_SIZE + 1]; + +/**@def AKA_TEMP_SIZE + * a 128-bit value used within the computation of the functions. + * Defined in 3GPP TS 35.206 subclause 2.3. + */ +#define AKA_TEMP_SIZE 16 +typedef uint8_t AKA_TEMP_T[AKA_TEMP_SIZE + 1]; + +/**@def AKA_AUTS_SIZE +* Authentication Token. A 112 bit value generated by the client + upon experiencing an SQN synchronization failure. +* Defined in RFC 3310 subclause 3.4 +*/ +#define AKA_AUTS_SIZE 14 +typedef uint8_t AKA_AUTS_T[AKA_AUTS_SIZE + 1]; + +/**@def AKA_AUTN_SIZE +* Authentication Token. A 128 bit value generated by the AuC, which + together with the RAND parameter authenticates the server to the client. +* Defined in RFC 3310 subclause 3.4 +*/ +#define AKA_AUTN_SIZE 16 +typedef uint8_t AKA_AUTN_T[AKA_AUTN_SIZE + 1]; + +#define AKA_XXX_DECLARE(name) AKA_##name##_T name +#define AKA_XXX_BZERO(name) memset(name, '\0', AKA_##name##_SIZE + 1) + +void f1 ( uint8_t k[16], uint8_t rand[16], uint8_t sqn[6], uint8_t amf[2], + uint8_t mac_a[8] ); +void f2345 ( uint8_t k[16], uint8_t rand[16], + uint8_t res[8], uint8_t ck[16], uint8_t ik[16], uint8_t ak[6] ); +void f1star( uint8_t k[16], uint8_t rand[16], uint8_t sqn[6], uint8_t amf[2], + uint8_t mac_s[8] ); +void f5star( uint8_t k[16], uint8_t rand[16], + uint8_t ak[6] ); +void ComputeOPc( uint8_t op_c[16] ); +void ComputeOP( uint8_t op[16] ); + + +TSIP_END_DECLS + +#endif /* TINYSIP_AUTHENTICATION_MILENAGE_H */ + diff --git a/tinySIP/include/tinysip/authentication/tsip_rijndael.h b/tinySIP/include/tinysip/authentication/tsip_rijndael.h new file mode 100644 index 0000000..18efe3a --- /dev/null +++ b/tinySIP/include/tinysip/authentication/tsip_rijndael.h @@ -0,0 +1,71 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_rijndael.h + * @brief Rijndael Implementation. + * + + * @section DESCRIPTION + * + * @sa 3G Security + * 3GPP TS 35.205 + * 3GPP TS 35.206 + * 3GPP TS 35.207 + * 3GPP TS 35.208 + * 3GPP TS 35.909 + *------------------------------------------------------------------- + * Rijndael Implementation + *------------------------------------------------------------------- + * + * A sample 32-bit orientated implementation of Rijndael, the + * suggested kernel for the example 3GPP authentication and key + * agreement functions. + * + * This implementation draws on the description in section 5.2 of + * the AES proposal and also on the implementation by + * Dr B. R. Gladman 9th October 2000. + * It uses a number of large (4k) lookup tables to implement the + * algorithm in an efficient manner. + * + * Note: in this implementation the State is stored in four 32-bit + * words, one per column of the State, with the top byte of the + * column being the _least_ significant byte of the word. + * + *----------------------------------------------------------------- + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_AUTHENTICATION_RIJNDAEL_H +#define TINYSIP_AUTHENTICATION_RIJNDAEL_H + +#include "tinysip_config.h" + +TSIP_BEGIN_DECLS + +void RijndaelKeySchedule( uint8_t key[16] ); +void RijndaelEncrypt( uint8_t in[16], uint8_t out[16] ); + +TSIP_END_DECLS + +#endif /*TINYSIP_AUTHENTICATION_RIJNDAEL_H*/ diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog.h b/tinySIP/include/tinysip/dialogs/tsip_dialog.h new file mode 100644 index 0000000..e6280b9 --- /dev/null +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog.h @@ -0,0 +1,208 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_dialog.h + * @brief SIP dialog base class as per RFC 3261 subclause 17. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_DIALOG_H +#define TINYSIP_DIALOG_H + +#include "tinysip_config.h" + +#include "tsip.h" +#include "tinysip/tsip_uri.h" +#include "tinysip/tsip_timers.h" +#include "tinysip/tsip_message.h" +#include "tinysip/tsip_ssession.h" + +#include "tinysip/authentication/tsip_challenge.h" +#include "tinysip/tsip_action.h" + +#include "tinysip/headers/tsip_header_Record_Route.h" + +#include "tsk_safeobj.h" +#include "tsk_list.h" +#include "tsk_string.h" +#include "tsk_fsm.h" + +TSIP_BEGIN_DECLS + +#define TSIP_DIALOG(self) ((tsip_dialog_t*)(self)) +#define TSIP_DIALOG_GET_STATE(self) TSIP_DIALOG((self))->state +#define TSIP_DIALOG_GET_FSM(self) TSIP_DIALOG((self))->fsm +#define TSIP_DIALOG_GET_SS(self) TSIP_DIALOG((self))->ss +#define TSIP_DIALOG_GET_STACK(self) TSIP_STACK(TSIP_DIALOG_GET_SS((self))->stack) + +#define TSIP_DIALOG_TIMER_CANCEL(TX) \ + tsk_timer_mgr_global_cancel(self->timer##TX.id) + +// TX MUST be in seconds +#define TSIP_DIALOG_TIMER_SCHEDULE(name, TX) \ + self->timer##TX.id = tsk_timer_mgr_global_schedule(self->timer##TX.timeout, TSK_TIMER_CALLBACK_F(tsip_dialog_##name##_timer_callback), self) + +#define TSIP_DIALOG_SIGNAL(self, code, phrase) \ + tsip_event_signal(tsip_event_dialog, TSIP_DIALOG(self)->ss, code, phrase) + +#define TSIP_DIALOG_SIGNAL_2(self, code, phrase, message) \ + tsip_event_signal_2(tsip_event_dialog, TSIP_DIALOG(self)->ss, code, phrase, message) + +#if !defined(TSIP_DIALOG_SHUTDOWN_TIMEOUT) +# define TSIP_DIALOG_SHUTDOWN_TIMEOUT 2000 /* miliseconds. */ +#endif + +#if !defined(TSIP_DIALOG_INVALID_ID) +# define TSIP_DIALOG_INVALID_ID 0 +#endif + +typedef uint64_t tsip_dialog_id_t; + +typedef enum tsip_dialog_state_e +{ + tsip_initial, + tsip_early, + tsip_established, + tsip_terminated +} +tsip_dialog_state_t; + +typedef enum tsip_dialog_type_e +{ + tsip_dialog_unknown, + tsip_dialog_INVITE, + tsip_dialog_MESSAGE, + tsip_dialog_INFO, + tsip_dialog_OPTIONS, + tsip_dialog_PUBLISH, + tsip_dialog_REGISTER, + tsip_dialog_SUBSCRIBE, +} +tsip_dialog_type_t; + +typedef enum tsip_dialog_event_type_e +{ + tsip_dialog_i_msg, + tsip_dialog_o_msg, + tsip_dialog_transac_ok, + tsip_dialog_canceled, + tsip_dialog_terminated, + tsip_dialog_timedout, + tsip_dialog_error, + tsip_dialog_transport_error, +} +tsip_dialog_event_type_t; + +typedef int (*tsip_dialog_event_callback_f)(const void *arg, tsip_dialog_event_type_t type, const tsip_message_t *msg); +#define TSIP_DIALOG_EVENT_CALLBACK_F(callback) ((tsip_dialog_event_callback_f)(callback)) + +/*================================ +*/ +typedef struct tsip_dialog_s +{ + TSK_DECLARE_OBJECT; + + tsip_dialog_type_t type; + tsip_dialog_id_t id; + + tsk_fsm_t* fsm; + + tsip_ssession_t* ss; + tsip_action_t* curr_action; + + tsip_dialog_state_t state; + + tsk_bool_t initialized; + tsk_bool_t running; + + tnet_fd_t connected_fd; + + struct{ + char* phrase; + short code; + tsip_message_t* message; + } last_error; + + char* tag_local; + tsip_uri_t* uri_local; + char* tag_remote; + tsip_uri_t* uri_remote; + + tsip_uri_t* uri_remote_target; + struct sockaddr_storage remote_addr; // Only valid for Dgram + + uint32_t cseq_value; + char* cseq_method; + + int64_t expires; /* in milliseconds */ + + char* callid; + + tsip_header_Record_Routes_L_t *record_routes; + + tsip_challenges_L_t *challenges; + + tsip_dialog_event_callback_f callback; + + TSK_DECLARE_SAFEOBJ; +} +tsip_dialog_t; + +#define TSIP_DECLARE_DIALOG tsip_dialog_t __dialog__ + +typedef tsk_list_t tsip_dialogs_L_t; +/* +================================*/ + +tsip_request_t *tsip_dialog_request_new(const tsip_dialog_t *self, const char* method); +int tsip_dialog_request_send(const tsip_dialog_t *self, tsip_request_t* request); +tsip_response_t *tsip_dialog_response_new(tsip_dialog_t *self, short status, const char* phrase, const tsip_request_t* request); +int tsip_dialog_response_send(const tsip_dialog_t *self, tsip_response_t* response); +int tsip_dialog_apply_action(tsip_message_t* message, const tsip_action_t* action); + +int64_t tsip_dialog_get_newdelay(tsip_dialog_t *self, const tsip_message_t* message); +int tsip_dialog_update(tsip_dialog_t *self, const tsip_response_t* response); +int tsip_dialog_update_2(tsip_dialog_t *self, const tsip_request_t* invite); +int tsip_dialog_getCKIK(tsip_dialog_t *self, AKA_CK_T *ck, AKA_IK_T *ik); + +int tsip_dialog_init(tsip_dialog_t *self, tsip_dialog_type_t type, const char* call_id, tsip_ssession_t* ss, tsk_fsm_state_id curr, tsk_fsm_state_id term); +int tsip_dialog_fsm_act(tsip_dialog_t* self, tsk_fsm_action_id , const tsip_message_t* , const tsip_action_handle_t*); +#define tsip_dialog_fsm_act_2(self, action_id) tsip_dialog_fsm_act((self), (action_id), tsk_null, tsk_null) +tsk_bool_t tsip_dialog_keep_action(const tsip_dialog_t* self, const tsip_response_t *response); +int tsip_dialog_set_connected_fd(tsip_dialog_t* self, tnet_fd_t fd); +int tsip_dialog_set_curr_action(tsip_dialog_t* self, const tsip_action_t* action); +int tsip_dialog_set_lasterror(tsip_dialog_t* self, const char* phrase, short code); +int tsip_dialog_set_lasterror_2(tsip_dialog_t* self, const char* phrase, short code, const tsip_message_t *message); +int tsip_dialog_get_lasterror(const tsip_dialog_t* self, short *code, const char** phrase, const tsip_message_t **message); +int tsip_dialog_hangup(tsip_dialog_t *self, const tsip_action_t* action); +int tsip_dialog_shutdown(tsip_dialog_t *self, const tsip_action_t* action); +int tsip_dialog_signal_transport_error(tsip_dialog_t *self); +int tsip_dialog_remove(const tsip_dialog_t* self); +int tsip_dialog_cmp(const tsip_dialog_t *d1, const tsip_dialog_t *d2); +int tsip_dialog_deinit(tsip_dialog_t *self); + +TSIP_END_DECLS + +#endif /* TINYSIP_DIALOG_H */ + diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog_info.h b/tinySIP/include/tinysip/dialogs/tsip_dialog_info.h new file mode 100644 index 0000000..94fe6ad --- /dev/null +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog_info.h @@ -0,0 +1,57 @@ +/* Copyright (C) 2011 Doubango Telecom +* Copyright (C) 2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_dialog_info.h + * @brief SIP dialog INFO. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_DIALOG_INFO_H +#define TINYSIP_DIALOG_INFO_H + +#include "tinysip_config.h" +#include "tinysip/dialogs/tsip_dialog.h" + +TSIP_BEGIN_DECLS + +/* Forward declaration */ +struct tsip_message_s; + +#define TSIP_DIALOG_INFO(self) ((tsip_dialog_info_t*)(self)) + +typedef struct tsip_dialog_info +{ + TSIP_DECLARE_DIALOG; + /**< Last incoming message. */ + struct tsip_message_s* last_iMessage; +} +tsip_dialog_info_t; + +tsip_dialog_info_t* tsip_dialog_info_create(const tsip_ssession_handle_t* ss); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_dialog_info_def_t; + +TSIP_END_DECLS + +#endif /* TINYSIP_DIALOG_INFO_H */ diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog_invite.common.h b/tinySIP/include/tinysip/dialogs/tsip_dialog_invite.common.h new file mode 100644 index 0000000..1496ca7 --- /dev/null +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog_invite.common.h @@ -0,0 +1,122 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_dialog_invite.common.h + * @brief SIP dialog INVITE (common variables). + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_DIALOG_INVITE_COMMON_H +#define TINYSIP_DIALOG_INVITE_COMMON_H + +#include "tinysip/api/tsip_api_invite.h" + +#define DEBUG_STATE_MACHINE 1 +#define TSIP_DIALOG_INVITE_SIGNAL(self, type, code, phrase, message) \ + tsip_invite_event_signal(type, TSIP_DIALOG(self)->ss, code, phrase, message) +#define TSIP_DIALOG_INVITE_TIMER_SCHEDULE(TX) TSIP_DIALOG_TIMER_SCHEDULE(invite, TX) + +#define TSIP_DIALOG_INVITE_ICE_CONNCHECK_TIMEOUT 16000 + +/* ======================== actions ======================== */ +typedef enum _fsm_action_e +{ + _fsm_action_accept = tsip_atype_accept, + _fsm_action_reject = tsip_atype_hangup, + _fsm_action_dtmf_send = tsip_atype_dtmf_send, + _fsm_action_msrp_send_msg = tsip_atype_lmessage, + _fsm_action_oINVITE = tsip_atype_invite, + _fsm_action_oCANCEL = tsip_atype_cancel, + _fsm_action_oHold = tsip_atype_hold, + _fsm_action_oResume = tsip_atype_resume, + _fsm_action_oECT = tsip_atype_ect, + _fsm_action_iECT_ACCEPT = tsip_atype_ect_accept, + _fsm_action_iECT_REJECT = tsip_atype_ect_reject, + _fsm_action_iECT_lNOTIFY = tsip_atype_ect_lnotify, + _fsm_action_oINFO = tsip_atype_info_send, + _fsm_action_oBYE = tsip_atype_hangup, + _fsm_action_oShutdown = tsip_atype_shutdown, + _fsm_action_transporterror = tsip_atype_transport_error, + + _fsm_action_iINVITE = 0xFF, + _fsm_action_oUPDATE, + _fsm_action_iUPDATE, + _fsm_action_iCANCEL, + _fsm_action_iPRACK, + _fsm_action_oPRACK, + _fsm_action_iACK, + _fsm_action_oACK, + _fsm_action_iOPTIONS, + _fsm_action_oOPTIONS, + _fsm_action_iBYE, + _fsm_action_iREFER, + _fsm_action_iINFO, + _fsm_action_iNOTIFY, + + _fsm_action_timer100rel, + _fsm_action_timerRefresh, + _fsm_action_timerRSVP, + + _fsm_action_i1xx, + _fsm_action_i2xx, + _fsm_action_i300_to_i699, + _fsm_action_i401_i407, + _fsm_action_i422, + + _fsm_action_shutdown_timedout, /* Any -> Terminated */ + _fsm_action_error, +} +_fsm_action_t; + +/* ======================== states ======================== */ +typedef enum _fsm_state_e +{ + _fsm_state_Started, + _fsm_state_Outgoing, + _fsm_state_Incoming, + _fsm_state_Trying, + _fsm_state_Ringing, + _fsm_state_Cancelling, + _fsm_state_InProgress, + + _fsm_state_Holding, + _fsm_state_Resuming, + + _fsm_state_oECTing, + _fsm_state_iECTing, + _fsm_state_iECTreq, + + _fsm_state_Connected, + _fsm_state_Terminated +} +_fsm_state_t; + + +#define send_INVITE(self, force_sdp) send_INVITEorUPDATE(self, tsk_true, force_sdp) +#define send_UPDATE(self, force_sdp) send_INVITEorUPDATE(self, tsk_false, force_sdp) + +#else +#error "This file must only be included in a source(.c or .cxx)" + +#endif /* TINYSIP_DIALOG_INVITE_COMMON_H */ diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog_invite.h b/tinySIP/include/tinysip/dialogs/tsip_dialog_invite.h new file mode 100644 index 0000000..b3bbfea --- /dev/null +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog_invite.h @@ -0,0 +1,128 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_dialog_invite.h + * @brief SIP dialog INVITE. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_DIALOG_INVITE_H +#define TINYSIP_DIALOG_INVITE_H + +#include "tinysip_config.h" +#include "tinysip/dialogs/tsip_dialog.h" + +#include "tinymedia/tmedia_session.h" + + +TSIP_BEGIN_DECLS + +#define TSIP_DIALOG_INVITE(self) ((tsip_dialog_invite_t*)(self)) + +typedef struct tsip_dialog_invite +{ + TSIP_DECLARE_DIALOG; + + tsk_bool_t support_update; /**< Indicates whether the remote party support UPDATE */ + tsk_bool_t is_client; + tsk_bool_t is_transf; + tsk_bool_t refersub; + tsk_bool_t use_rtcp; + tsk_bool_t use_rtcpmux; + tsk_bool_t is_initial_iack_pending; // we're waiting for the initial incoming ACK (for the 200 OK) to ensure the session + tsk_bool_t is_cancelling; // whether we're cancelling the outgoing INVITE + uint32_t rseq; + uint32_t cseq_out_media_update; // CSeq for the last media update request (INVITE or UPDATE). + uint64_t last_out_fastupdate_time; + + tsip_timer_t timershutdown; + tsip_timer_t timer100rel; + + tsip_response_t* last_o1xxrel; + tsip_request_t* last_iInvite; + tsip_request_t* last_oInvite; + tsip_request_t* last_iRefer; + tmedia_session_mgr_t* msession_mgr; /**< Media session Manager */ + + struct tsip_ssession_s* ss_transf; + + /* ICE */ + struct{ + tmedia_type_t media_type; + tsk_bool_t is_jingle; + tsk_bool_t start_smgr; + struct tnet_ice_ctx_s *ctx_audio; + struct tnet_ice_ctx_s *ctx_video; + tsk_fsm_action_id last_action_id; + tsip_action_t* last_action; + tsip_message_t* last_message; + int32_t last_sdp_ro_ver; + } ice; + + /* Session Timers */ + struct{ + tsip_timer_t timer; + char* refresher; + uint64_t minse; + tsk_bool_t is_refresher; + } stimers; + /* QoS (Preconditions) */ + struct{ + tsip_timer_t timer; + enum tmedia_qos_stype_e type; + enum tmedia_qos_strength_e strength; + } qos; + /* Hold/Resume */ + struct{ + unsigned remote:1; + unsigned local:1; + } hold; + + struct{ + unsigned _100rel:1; + unsigned precondition:1; + unsigned timer:1; + unsigned norefersub:1; + unsigned ice:1; + } supported; + + struct{ + unsigned _100rel:1; + unsigned precondition:1; + unsigned timer:1; + unsigned norefersub; + unsigned ice:1; + } required; +} +tsip_dialog_invite_t; + +tsip_dialog_invite_t* tsip_dialog_invite_create(const tsip_ssession_handle_t* ss, const char* call_id); + +int tsip_dialog_invite_start(tsip_dialog_invite_t *self); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_dialog_invite_def_t; + +TSIP_END_DECLS + +#endif /* TINYSIP_DIALOG_INVITE_H */ diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog_layer.h b/tinySIP/include/tinysip/dialogs/tsip_dialog_layer.h new file mode 100644 index 0000000..3539361 --- /dev/null +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog_layer.h @@ -0,0 +1,88 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_dialog.h + * @brief SIP dialog layer. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_DIALOG_LAYER_H +#define TINYSIP_DIALOG_LAYER_H + +#include "tinysip_config.h" + +#include "tsip.h" +#include "tinysip/dialogs/tsip_dialog.h" + +#include "tsk_condwait.h" +#include "tsk_safeobj.h" +#include "tsk_list.h" + +TSIP_BEGIN_DECLS + +typedef struct tsip_dialog_layer_s +{ + TSK_DECLARE_OBJECT; + + const tsip_stack_t *stack; + + tsip_dialogs_L_t *dialogs; + + struct{ + tsk_bool_t inprogress; + tsk_bool_t phase2; /* whether unregistering? */ + tsk_condwait_handle_t* condwait; + } shutdown; + + TSK_DECLARE_SAFEOBJ; +} +tsip_dialog_layer_t; + +typedef tsk_list_t tsip_dialog_layers_L_t; + +tsip_dialog_layer_t* tsip_dialog_layer_create(tsip_stack_t* stack); + +TINYSIP_API tsip_dialog_t* tsip_dialog_layer_find_by_ss(tsip_dialog_layer_t *self, const tsip_ssession_handle_t *ss); +tsip_dialog_t* tsip_dialog_layer_find_by_ssid(tsip_dialog_layer_t *self, tsip_ssession_id_t ssid); +tsip_dialog_t* tsip_dialog_layer_find_by_callid(tsip_dialog_layer_t *self, const char* callid); +tsk_bool_t tsip_dialog_layer_have_dialog_with_callid(const tsip_dialog_layer_t *self, const char* callid); + +tsk_size_t tsip_dialog_layer_count_active_calls(tsip_dialog_layer_t *self); + + +TINYSIP_API int tsip_dialog_layer_shutdownAll(tsip_dialog_layer_t *self); +int tsip_dialog_layer_signal_stack_disconnected(tsip_dialog_layer_t *self); +int tsip_dialog_layer_signal_peer_disconnected(tsip_dialog_layer_t *self, const struct tsip_transport_stream_peer_s* peer); +int tsip_dialog_layer_remove_callid_from_stream_peers(tsip_dialog_layer_t *self, const char* callid); +tsip_dialog_t* tsip_dialog_layer_new(tsip_dialog_layer_t *self, tsip_dialog_type_t type, const tsip_ssession_t *ss); +int tsip_dialog_layer_remove(tsip_dialog_layer_t *self, const tsip_dialog_t *dialog); + +int tsip_dialog_layer_handle_incoming_msg(const tsip_dialog_layer_t *self, tsip_message_t* message); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_dialog_layer_def_t; + +TSIP_END_DECLS + +#endif /* TINYSIP_DIALOG_LAYER_H */ + diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog_message.h b/tinySIP/include/tinysip/dialogs/tsip_dialog_message.h new file mode 100644 index 0000000..904af54 --- /dev/null +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog_message.h @@ -0,0 +1,57 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_dialog_message.h + * @brief SIP dialog MESSAGE. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_DIALOG_MESSAGE_H +#define TINYSIP_DIALOG_MESSAGE_H + +#include "tinysip_config.h" +#include "tinysip/dialogs/tsip_dialog.h" + +TSIP_BEGIN_DECLS + +/* Forward declaration */ +struct tsip_message_s; + +#define TSIP_DIALOG_MESSAGE(self) ((tsip_dialog_message_t*)(self)) + +typedef struct tsip_dialog_message +{ + TSIP_DECLARE_DIALOG; + /**< Last incoming or outgoing message. */ + struct tsip_message_s* request; +} +tsip_dialog_message_t; + +tsip_dialog_message_t* tsip_dialog_message_create(const tsip_ssession_handle_t* ss); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_dialog_message_def_t; + +TSIP_END_DECLS + +#endif /* TINYSIP_DIALOG_MESSAGE_H */ diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog_options.h b/tinySIP/include/tinysip/dialogs/tsip_dialog_options.h new file mode 100644 index 0000000..e092a32 --- /dev/null +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog_options.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_dialog_options.h + * @brief SIP dialog OPTIONS as per RFC 3261 section 11. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_DIALOG_OPTIONS_H +#define TINYSIP_DIALOG_OPTIONS_H + +#include "tinysip_config.h" +#include "tinysip/dialogs/tsip_dialog.h" + +TSIP_BEGIN_DECLS + +#define TSIP_DIALOG_OPTIONS(self) ((tsip_dialog_options_t*)(self)) + +typedef struct tsip_dialog_options +{ + TSIP_DECLARE_DIALOG; + /**< Last incoming message. */ + struct tsip_message_s* last_iMessage; +} +tsip_dialog_options_t; + +tsip_dialog_options_t* tsip_dialog_options_create(const tsip_ssession_handle_t* ss); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_dialog_options_def_t; + +TSIP_END_DECLS + +#endif /* TINYSIP_DIALOG_OPTIONS_H */ diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog_publish.h b/tinySIP/include/tinysip/dialogs/tsip_dialog_publish.h new file mode 100644 index 0000000..b4ef37b --- /dev/null +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog_publish.h @@ -0,0 +1,60 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_dialog_publish.h + * @brief SIP dialog PUBLISH as per RFC 3903. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_DIALOG_PUBLISH_H +#define TINYSIP_DIALOG_PUBLISH_H + +#include "tinysip_config.h" +#include "tinysip/dialogs/tsip_dialog.h" + +TSIP_BEGIN_DECLS + +#define TSIP_DIALOG_PUBLISH(self) ((tsip_dialog_publish_t*)(self)) + +typedef struct tsip_dialog_publish +{ + TSIP_DECLARE_DIALOG; + + tsip_timer_t timerrefresh; + tsip_timer_t timershutdown; + + tsk_bool_t unpublishing; + char* etag; +} +tsip_dialog_publish_t; + +tsip_dialog_publish_t* tsip_dialog_publish_create(const tsip_ssession_handle_t* ss); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_dialog_publish_def_t; + + +TSIP_END_DECLS + + +#endif /* TINYSIP_DIALOG_PUBLISH_H */ diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog_register.common.h b/tinySIP/include/tinysip/dialogs/tsip_dialog_register.common.h new file mode 100644 index 0000000..94e4897 --- /dev/null +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog_register.common.h @@ -0,0 +1,75 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as publishd 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. +* +*/ +#ifndef TINYSIP_DIALOG_REGISTER_COMMON_H +#define TINYSIP_DIALOG_REGISTER_COMMON_H + +#include "tinysip/api/tsip_api_register.h" + +#define DEBUG_STATE_MACHINE 1 +#define TSIP_DIALOG_REGISTER_TIMER_SCHEDULE(TX) TSIP_DIALOG_TIMER_SCHEDULE(register, TX) +#define TSIP_DIALOG_REGISTER_SIGNAL(self, type, code, phrase, message) \ + tsip_register_event_signal(type, TSIP_DIALOG(self)->ss, code, phrase, message) + + +/* ======================== actions ======================== */ +typedef enum _fsm_action_e +{ + _fsm_action_accept = tsip_atype_accept, + _fsm_action_reject = tsip_atype_hangup, + _fsm_action_hangup = tsip_atype_hangup, + _fsm_action_oREGISTER = tsip_atype_register, + _fsm_action_cancel = tsip_atype_cancel, + _fsm_action_shutdown = tsip_atype_shutdown, + _fsm_action_transporterror = tsip_atype_transport_error, + + _fsm_action_1xx = 0xFF, + _fsm_action_2xx, + _fsm_action_401_407_421_494, + _fsm_action_423, + _fsm_action_300_to_699, + + _fsm_action_iREGISTER, + + _fsm_action_shutdown_timedout, /* Any -> Terminated */ + _fsm_action_error, +} +_fsm_action_t; + +/* ======================== states ======================== */ +typedef enum _fsm_state_e +{ + _fsm_state_Started, + _fsm_state_InProgress, // Outgoing (Client) + _fsm_state_Incoming, // Incoming (Server) + _fsm_state_Connected, + _fsm_state_Terminated +} +_fsm_state_t; + + +#define _fsm_cond_silent_shutdown _fsm_cond_silent_hangup +#define _fsm_cond_not_silent_shutdown _fsm_cond_not_silent_hangup + +#else +#error "This file must only be included in a source(.c or .cxx)" + +#endif /* TINYSIP_DIALOG_REGISTER_COMMON_H */ diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog_register.h b/tinySIP/include/tinysip/dialogs/tsip_dialog_register.h new file mode 100644 index 0000000..d2acf1a --- /dev/null +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog_register.h @@ -0,0 +1,62 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_dialog_register.h + * @brief SIP dialog REGISTER. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_DIALOG_REGISTER_H +#define TINYSIP_DIALOG_REGISTER_H + +#include "tinysip_config.h" +#include "tinysip/dialogs/tsip_dialog.h" + +TSIP_BEGIN_DECLS + +#define TSIP_DIALOG_REGISTER(self) ((tsip_dialog_register_t*)(self)) + +/**< SIP REGISTER dialog */ +typedef struct tsip_dialog_register +{ + TSIP_DECLARE_DIALOG; + + tsip_timer_t timerrefresh; + tsip_timer_t timershutdown; + + tsip_request_t* last_iRegister; + + tsk_bool_t unregistering; + tsk_bool_t is_server; +} +tsip_dialog_register_t; + +tsip_dialog_register_t* tsip_dialog_register_create(const tsip_ssession_handle_t* ss, const char* call_id); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_dialog_register_def_t; + +TSIP_END_DECLS + +#endif /* TINYSIP_DIALOG_REGISTER_H */ + diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog_subscribe.h b/tinySIP/include/tinysip/dialogs/tsip_dialog_subscribe.h new file mode 100644 index 0000000..c7db35b --- /dev/null +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog_subscribe.h @@ -0,0 +1,57 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_dialog_subscribe.h + * @brief SIP dialog SUBSCRIBE as per RFC 3265. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_DIALOG_SUBSCRIBE_H +#define TINYSIP_DIALOG_SUBSCRIBE_H + +#include "tinysip_config.h" +#include "tinysip/dialogs/tsip_dialog.h" + +TSIP_BEGIN_DECLS + +#define TSIP_DIALOG_SUBSCRIBE(self) ((tsip_dialog_subscribe_t*)(self)) + +typedef struct tsip_dialog_subscribe +{ + TSIP_DECLARE_DIALOG; + + tsip_timer_t timerrefresh; + tsip_timer_t timershutdown; + + tsk_bool_t unsubscribing; +} +tsip_dialog_subscribe_t; + +tsip_dialog_subscribe_t* tsip_dialog_subscribe_create(const tsip_ssession_handle_t* ss); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_dialog_subscribe_def_t; + +TSIP_END_DECLS + +#endif /* TINYSIP_DIALOG_SUBSCRIBE_H */ diff --git a/tinySIP/include/tinysip/headers/tsip_header.h b/tinySIP/include/tinysip/headers/tsip_header.h new file mode 100644 index 0000000..b611140 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header.h @@ -0,0 +1,196 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header.h + * @brief Defines a SIP header (field-name: field-value). + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_HEADER_H +#define TINYSIP_HEADER_H + +#include "tinysip_config.h" + +#include "tsk_ragel_state.h" + +#include "tsk_params.h" +#include "tsk_object.h" +#include "tsk_safeobj.h" +#include "tsk_memory.h" +#include "tsk_string.h" +#include "tsk_list.h" +#include "tsk_buffer.h" + +TSIP_BEGIN_DECLS + +struct tsip_header_s; + +#define TSIP_HEADER(self) ((tsip_header_t*)(self)) +#define TSIP_HEADER_PARAMS(self) (TSIP_HEADER(self)->params) +#define TSIP_HEADER_VALUE_SERIALIZE_F(self) ((tsip_header_value_serialize_f)(self)) +#define TSIP_HEADER_GET_PARAM_VALUE_F(self) ((tsip_header_get_param_value_f)(self)) + +typedef int (*tsip_header_value_serialize_f)(const struct tsip_header_s* header, tsk_buffer_t* output); +typedef char* (*tsip_header_get_special_param_value_f)(const struct tsip_header_s* header, const char* pname); + +/** + * @enum tsip_header_type_e + * + * @brief List of all supported headers. +**/ +typedef enum tsip_header_type_e +{ + tsip_htype_Accept, + tsip_htype_Accept_Contact, + tsip_htype_Accept_Encoding, + tsip_htype_Accept_Language, + tsip_htype_Accept_Resource_Priority, + tsip_htype_Alert_Info, + tsip_htype_Allow, + tsip_htype_Allow_Events, + tsip_htype_Authentication_Info, + tsip_htype_Authorization, + tsip_htype_Call_ID, + tsip_htype_Call_Info, + tsip_htype_Contact, + tsip_htype_Content_Disposition, + tsip_htype_Content_Encoding, + tsip_htype_Content_Language, + tsip_htype_Content_Length, + tsip_htype_Content_Type, + tsip_htype_CSeq, + tsip_htype_Date, + tsip_htype_Dummy, + tsip_htype_Error_Info, + tsip_htype_Event, + tsip_htype_Expires, + tsip_htype_From, + tsip_htype_History_Info, + tsip_htype_Identity, + tsip_htype_Identity_Info, + tsip_htype_In_Reply_To, + tsip_htype_Join, + tsip_htype_Max_Forwards, + tsip_htype_MIME_Version, + tsip_htype_Min_Expires, + tsip_htype_Min_SE, + tsip_htype_Organization, + tsip_htype_Path, + tsip_htype_Priority, + tsip_htype_Privacy, + tsip_htype_Proxy_Authenticate, + tsip_htype_Proxy_Authorization, + tsip_htype_Proxy_Require, + tsip_htype_RAck, + tsip_htype_Reason, + tsip_htype_Record_Route, + tsip_htype_Refer_Sub, + tsip_htype_Refer_To, + tsip_htype_Referred_By, + tsip_htype_Reject_Contact, + tsip_htype_Replaces, + tsip_htype_Reply_To, + tsip_htype_Request_Disposition, + tsip_htype_Require, + tsip_htype_Resource_Priority, + tsip_htype_Retry_After, + tsip_htype_Route, + tsip_htype_RSeq, + tsip_htype_Security_Client, + tsip_htype_Security_Server, + tsip_htype_Security_Verify, + tsip_htype_Server, + tsip_htype_Service_Route, + tsip_htype_Session_Expires, + tsip_htype_SIP_ETag, + tsip_htype_SIP_If_Match, + tsip_htype_Subject, + tsip_htype_Subscription_State, + tsip_htype_Supported, + tsip_htype_Target_Dialog, + tsip_htype_Timestamp, + tsip_htype_To, + tsip_htype_Unsupported, + tsip_htype_User_Agent, + tsip_htype_Via, + tsip_htype_Warning, + tsip_htype_WWW_Authenticate, + tsip_htype_P_Access_Network_Info, + tsip_htype_P_Answer_State, + tsip_htype_P_Asserted_Identity, + tsip_htype_P_Associated_URI, + tsip_htype_P_Called_Party_ID, + tsip_htype_P_Charging_Function_Addresses, + tsip_htype_P_Charging_Vector, + tsip_htype_P_DCS_Billing_Info, + tsip_htype_P_DCS_LAES, + tsip_htype_P_DCS_OSPS, + tsip_htype_P_DCS_Redirect, + tsip_htype_P_DCS_Trace_Party_ID, + tsip_htype_P_Early_Media, + tsip_htype_P_Media_Authorization, + tsip_htype_P_Preferred_Identity, + tsip_htype_P_Profile_Key, + tsip_htype_P_User_Database, + tsip_htype_P_Visited_Network_ID +} +tsip_header_type_t; + +/*================================ +*/ +typedef struct tsip_header_s +{ + TSK_DECLARE_OBJECT; + tsip_header_type_t type; + tsip_header_value_serialize_f serialize; + tsip_header_get_special_param_value_f get_special_param_value; + tsk_params_L_t *params; +} +tsip_header_t; + +#define TSIP_DECLARE_HEADER tsip_header_t __header__ +typedef tsk_list_t tsip_headers_L_t; /**< List of @ref tsip_header_t elements. */ +/* +================================*/ + +TINYSIP_API const char *tsip_header_get_name(tsip_header_type_t type); +TINYSIP_API const char *tsip_header_get_name_2(const tsip_header_t *self); +TINYSIP_API char tsip_header_get_param_separator(const tsip_header_t *self); +TINYSIP_API int tsip_header_serialize(const tsip_header_t *self, tsk_buffer_t *output); +TINYSIP_API char* tsip_header_tostring(const tsip_header_t *self); +TINYSIP_API int tsip_header_value_serialize(const tsip_header_t *self, tsk_buffer_t *output); +TINYSIP_API char* tsip_header_value_tostring(const tsip_header_t *self); +TINYSIP_API char* tsip_header_get_param_value(const tsip_header_t *self, const char* pname); + +#define TSIP_HEADER_HAVE_PARAM(self, name) ((self) && TSIP_HEADER((self))->params) ? tsk_params_have_param(TSIP_HEADER(self)->params, name) : tsk_false +#define TSIP_HEADER_ADD_PARAM(self, name, value) tsk_params_add_param((self) ? &TSIP_HEADER((self))->params : tsk_null, name, value) +#define TSIP_HEADER_REMOVE_PARAM(self, name) tsk_params_remove_param((self) ? TSIP_HEADER((self))->params : tsk_null, name) +#define TSIP_HEADER_GET_PARAM_BY_NAME(self, name) tsk_params_get_param_by_name((self) ? TSIP_HEADER((self))->params : tsk_null, name) +#define TSIP_HEADER_GET_PARAM_VALUE(self, name) tsk_params_get_param_value((self) ? TSIP_HEADER((self))->params : tsk_null, name) +#define TSIP_HEADER_GET_PARAM_VALUE_AS_INT(self, name) tsk_params_get_param_value_as_int((self) ? TSIP_HEADER((self))->params : tsk_null, name) + +TSIP_END_DECLS + +#endif /* TINYSIP_HEADERS_H */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Accept_Contact.h b/tinySIP/include/tinysip/headers/tsip_header_Accept_Contact.h new file mode 100644 index 0000000..19aaa1b --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Accept_Contact.h @@ -0,0 +1,56 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Accept_Contact.h + * @brief SIP header 'Accept-Contact'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_ACCEPT_CONTACT_H_ +#define _TSIP_HEADER_ACCEPT_CONTACT_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Accept-Contact' as per RFC 3261 subclause . +/// @author Mamadou +/// @date 12/3/2009 +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Accept_Contact_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Accept_Contact_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_ACCEPT_CONTACT_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Accept_Encoding.h b/tinySIP/include/tinysip/headers/tsip_header_Accept_Encoding.h new file mode 100644 index 0000000..efff6cd --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Accept_Encoding.h @@ -0,0 +1,56 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Accept_Encoding.h + * @brief SIP header 'Accept-Encoding'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_ACCEPT_ENCODING_H_ +#define _TSIP_HEADER_ACCEPT_ENCODING_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Accept-Encoding'. +/// @author Mamadou +/// @date 12/3/2009 +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Accept_Encoding_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Accept_Encoding_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_ACCEPT_ENCODING_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Accept_Language.h b/tinySIP/include/tinysip/headers/tsip_header_Accept_Language.h new file mode 100644 index 0000000..fcb631b --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Accept_Language.h @@ -0,0 +1,56 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Accept_Language.h + * @brief SIP header 'Accept-Language'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_ACCEPT_LANGUAGE_H_ +#define _TSIP_HEADER_ACCEPT_LANGUAGE_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Accept-Contact' . +/// @author Mamadou +/// @date 12/3/2009 +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Accept_Language_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Accept_Language_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_ACCEPT_LANGUAGE_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Accept_Resource_Priority.h b/tinySIP/include/tinysip/headers/tsip_header_Accept_Resource_Priority.h new file mode 100644 index 0000000..09143a5 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Accept_Resource_Priority.h @@ -0,0 +1,56 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Accept_Resource_Priority.h + * @brief SIP header 'Accept-Resource-Priority'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_ACCEPT_RESOURCE_PRIORITY_H_ +#define _TSIP_HEADER_ACCEPT_RESOURCE_PRIORITY_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Accept-Contact' . +/// @author Mamadou +/// @date 12/3/2009 +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Accept_Resource_Priority_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Accept_Resource_Priority_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_ACCEPT_RESOURCE_PRIORITY_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Alert_Info.h b/tinySIP/include/tinysip/headers/tsip_header_Alert_Info.h new file mode 100644 index 0000000..77a26be --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Alert_Info.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Alert_Info.h + * @brief SIP header 'Alert-Info'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_ALERT_INFO_H_ +#define _TSIP_HEADER_ALERT_INFO_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Alert-Info' as per RFC 3261 subclause . +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Alert_Info_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Alert_Info_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_ALERT_INFO_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Allow.h b/tinySIP/include/tinysip/headers/tsip_header_Allow.h new file mode 100644 index 0000000..a43b9ba --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Allow.h @@ -0,0 +1,66 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Allow.h + * @brief SIP header 'Allow'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_ALLOW_H_ +#define _TSIP_HEADER_ALLOW_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_ALLOW_DEFAULT "ACK, BYE, CANCEL, INVITE, MESSAGE, NOTIFY, OPTIONS, PRACK, REFER, UPDATE" +#define TSIP_HEADER_STR "Allow:" TSIP_HEADER_ALLOW_DEFAULT "\r\n" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Allow'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Allow_s +{ + TSIP_DECLARE_HEADER; + + tsk_strings_L_t *methods; +} +tsip_header_Allow_t; + +TINYSIP_API tsip_header_Allow_t* tsip_header_Allow_create(); + +TINYSIP_API tsip_header_Allow_t *tsip_header_Allow_parse(const char *data, tsk_size_t size); +TINYSIP_API tsk_bool_t tsip_header_Allow_allows(const tsip_header_Allow_t* self, const char* method); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Allow_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_ALLOW_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Allow_Events.h b/tinySIP/include/tinysip/headers/tsip_header_Allow_Events.h new file mode 100644 index 0000000..d97b6b3 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Allow_Events.h @@ -0,0 +1,63 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Allow_Events.h + * @brief SIP header 'Allow-Events'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_ALLOW_EVENTS_H_ +#define _TSIP_HEADER_ALLOW_EVENTS_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Allow-Events'. +/// +/// @par ABNF : Allow-Events = ( "Allow-Events" / "u" ) HCOLON event-type *(COMMA event-type) +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Allow_Events_s +{ + TSIP_DECLARE_HEADER; + + tsk_strings_L_t *events; +} +tsip_header_Allow_Events_t; + +TINYSIP_API tsip_header_Allow_Events_t* tsip_header_Allow_Events_create(); + +TINYSIP_API tsip_header_Allow_Events_t *tsip_header_Allow_Events_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Allow_Events_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_ALLOW_EVENTS_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Authentication_Info.h b/tinySIP/include/tinysip/headers/tsip_header_Authentication_Info.h new file mode 100644 index 0000000..0736dbc --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Authentication_Info.h @@ -0,0 +1,56 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Authentication_Info.h + * @brief SIP header 'Authentication-Info'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_AUTHENTICATION_INFO_H_ +#define _TSIP_HEADER_AUTHENTICATION_INFO_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Authentication-Info'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Authentication_Info_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Authentication_Info_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_AUTHENTICATION_INFO_H_ */ + + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Authorization.h b/tinySIP/include/tinysip/headers/tsip_header_Authorization.h new file mode 100644 index 0000000..910fdc5 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Authorization.h @@ -0,0 +1,96 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Authorization.h + * @brief SIP header 'Authorization'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_AUTHORIZATION_H_ +#define _TSIP_HEADER_AUTHORIZATION_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP 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 tsip_header_Authorization_s +{ + TSIP_DECLARE_HEADER; + + char* scheme; + char* username; + char* realm; + char* nonce; + char* uri; + char* response; + char* algorithm; + char* cnonce; + char* opaque; + char* qop; + char* nc; +} +tsip_header_Authorization_t; + +TINYSIP_API tsip_header_Authorization_t* tsip_header_Authorization_create(); + +TINYSIP_API tsip_header_Authorization_t *tsip_header_Authorization_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Authorization_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_AUTHORIZATION_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_CSeq.h b/tinySIP/include/tinysip/headers/tsip_header_CSeq.h new file mode 100644 index 0000000..98cd864 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_CSeq.h @@ -0,0 +1,71 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_CSeq.h + * @brief SIP header 'CSeq'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_CSEQ_H_ +#define _TSIP_HEADER_CSEQ_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +#include "tinysip/tsip_message_common.h" /* tsip_request_type_t */ + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_CSEQ_VA_ARGS(seq, method) tsip_header_CSeq_def_t, (int32_t) seq, (const char*)method + +#define TSIP_HEADER_CSEQ_NONE 0 +#define TSIP_HEADER_CSEQ_DEFAULT 1 + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'CSeq'. +/// +/// @par ABNF: CSeq = "CSeq" HCOLON 1*DIGIT LWS Method +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_CSeq_s +{ + TSIP_DECLARE_HEADER; + + char *method; + uint32_t seq; + tsip_request_type_t type; +} +tsip_header_CSeq_t; + +TINYSIP_API tsip_header_CSeq_t* tsip_header_CSeq_create(int32_t seq, const char*method); + +TINYSIP_API tsip_header_CSeq_t *tsip_header_CSeq_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_CSeq_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_CSEQ_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Call_ID.h b/tinySIP/include/tinysip/headers/tsip_header_Call_ID.h new file mode 100644 index 0000000..41a7f73 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Call_ID.h @@ -0,0 +1,68 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Call_ID.h + * @brief SIP header 'Call-ID'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_CALL_ID_H_ +#define _TSIP_HEADER_CALL_ID_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +#include "tsk_uuid.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_CALL_ID_VA_ARGS(call_id) tsip_header_Call_ID_def_t, (const char*)call_id + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Call-ID'. +/// +/// @par ABNF: Call-ID / i +/// callid = word [ "@" word ] +/// Call-ID = ( "Call-ID" / "i" ) HCOLON callid +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Call_ID_s +{ + TSIP_DECLARE_HEADER; + char *value; +} +tsip_header_Call_ID_t; + +TINYSIP_API tsip_header_Call_ID_t* tsip_header_Call_ID_create(const char* call_id); + +int tsip_header_Call_ID_random(tsk_uuidstring_t *result); +TINYSIP_API tsip_header_Call_ID_t *tsip_header_Call_ID_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Call_ID_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_CALL_ID_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Call_Info.h b/tinySIP/include/tinysip/headers/tsip_header_Call_Info.h new file mode 100644 index 0000000..72f0d1a --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Call_Info.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Call_Info.h + * @brief SIP header 'Call-Info'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_CALL_INFO_H_ +#define _TSIP_HEADER_CALL_INFO_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Call-Info'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Call_Info_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Call_Info_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_CALL_INFO_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Contact.h b/tinySIP/include/tinysip/headers/tsip_header_Contact.h new file mode 100644 index 0000000..7fb200e --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Contact.h @@ -0,0 +1,90 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Contact.h + * @brief SIP header 'Contact' as per RFC 3261 subclause 20.1. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_CONTACT_H_ +#define _TSIP_HEADER_CONTACT_H_ + +#include "tinysip_config.h" +#include "tinysip/tsip_uri.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Contact'. +/// +/// @par ABNF: Contact = ( "Contact" / "m" ) HCOLON ( STAR / (contact-param *(COMMA contact-param))) +/// contact-param = (name-addr / addr-spec) *( SEMI contact-params) +/// contact-params = c-p-q / c-p-expires / feature-param / temp-gruu / pub-gruu / c-p-instance / contact-extension +/// c-p-q = "q" EQUAL qvalue +/// c-p-expires = "expires" EQUAL delta-seconds +/// feature-param = enc-feature-tag [ EQUAL LDQUOT (tag-value-list / string-value) RDQUOT ] +/// enc-feature-tag = base-tags / other-tags +/// base-tags = "audio" / "automata" / "class" / "duplex" / "data" / "control" / "mobility" / "description" / "events" / "priority" / "methods" / "schemes" / "application" / "video" / "language" / "type" / "isfocus" / "actor" / "text" / "extensions" +/// other-tags = "+" ftag-name +/// ftag-name = ALPHA *( ALPHA / DIGIT / "!" / "'" / "." / "-" / "%" ) +/// tag-value-list = tag-value *("," tag-value) +/// tag-value = ["!"] (token-nobang / boolean / numeric) +/// token-nobang = 1*( alphanum / "-" / "." / "%" / "*" / "_" / "+" / "`" / "'" / "~" ) +/// boolean = "TRUE" / "FALSE" +/// numeric = "#" numeric-relation number +/// numeric-relation = ">=" / "<=" / "=" / (number ":") +/// number = [ "+" / "-" ] 1*DIGIT ["." 0*DIGIT] +/// string-value = "<" *(qdtext-no-abkt / quoted-pair ) ">" +/// qdtext-no-abkt = LWS / %x21 / %x23-3B / %x3D / %x3F-5B / %x5D-7E / UTF8-NONASCII +/// temp-gruu = "temp-gruu" EQUAL LDQUOT *( qdtext / quoted-pair ) RDQUOT +/// pub-gruu = "pub-gruu" EQUAL LDQUOT *( qdtext / quoted-pair ) RDQUOT +/// c-p-instance = "+sip.instance" EQUAL LDQUOT "<" instance-val ">" RDQUOT +/// instance-val = *uric +/// contact-extension = generic-param +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Contact_s +{ + TSIP_DECLARE_HEADER; + + char *display_name; + tsip_uri_t *uri; + int64_t expires; +} +tsip_header_Contact_t; +typedef tsk_list_t tsip_header_Contacts_L_t; + +TINYSIP_API tsip_header_Contact_t* tsip_header_Contact_create(); + +TINYSIP_API tsip_header_Contacts_L_t *tsip_header_Contact_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Contact_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_CONTACT_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Content_Disposition.h b/tinySIP/include/tinysip/headers/tsip_header_Content_Disposition.h new file mode 100644 index 0000000..3ec3cef --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Content_Disposition.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Content_Disposition.h + * @brief SIP header 'Content-Disposition'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_CONTENT_DISPOSITION_H_ +#define _TSIP_HEADER_CONTENT_DISPOSITION_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Content-Disposition'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Content_Disposition_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Content_Disposition_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_CONTENT_DISPOSITION_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Content_Encoding.h b/tinySIP/include/tinysip/headers/tsip_header_Content_Encoding.h new file mode 100644 index 0000000..995abbb --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Content_Encoding.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Content_Encoding.h + * @brief SIP header 'Content-Encoding' as per RFC 3261 subclause 20.1. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_CONTENT_ENCODING_H_ +#define _TSIP_HEADER_CONTENT_ENCODING_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Content-Encoding'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Content_Encoding_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Content_Encoding_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_CONTENT_ENCODING_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Content_Language.h b/tinySIP/include/tinysip/headers/tsip_header_Content_Language.h new file mode 100644 index 0000000..86899b1 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Content_Language.h @@ -0,0 +1,49 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Content_Language.h + * @brief SIP header 'Content-Language'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_CONTENT_LANGUAGE_H_ +#define _TSIP_HEADER_CONTENT_LANGUAGE_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Content-Language'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Content_Language_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Content_Language_t; + +#endif /* _TSIP_HEADER_CONTENT_LANGUAGE_H_ */ \ No newline at end of file diff --git a/tinySIP/include/tinysip/headers/tsip_header_Content_Length.h b/tinySIP/include/tinysip/headers/tsip_header_Content_Length.h new file mode 100644 index 0000000..7f2ec61 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Content_Length.h @@ -0,0 +1,66 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Content_Length.h + * @brief SIP header 'Content-Length'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_CONTENT_LENGTH_H_ +#define _TSIP_HEADER_CONTENT_LENGTH_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_CONTENT_LENGTH_VA_ARGS(length) tsip_header_Content_Length_def_t, (uint32_t)length + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Content-Length'. +/// +/// @par ABNF: Content-Length / l +/// Content-Length = ( "Content-Length" / "l" ) HCOLON 1*DIGIT +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Content_Length_s +{ + TSIP_DECLARE_HEADER; + + uint32_t length; +} +tsip_header_Content_Length_t; + +TINYSIP_API tsip_header_Content_Length_t* tsip_header_Content_Length_create(uint32_t length); +TINYSIP_API tsip_header_Content_Length_t* tsip_header_Content_Length_create_null(); + +TINYSIP_API tsip_header_Content_Length_t *tsip_header_Content_Length_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Content_Length_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_CONTENT_LENGTH_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Content_Type.h b/tinySIP/include/tinysip/headers/tsip_header_Content_Type.h new file mode 100644 index 0000000..48c32b6 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Content_Type.h @@ -0,0 +1,79 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Content_Type.h + * @brief SIP header 'Content-Type'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_CONTENT_TYPE_H_ +#define _TSIP_HEADER_CONTENT_TYPE_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_CONTENT_TYPE_VA_ARGS(type) tsip_header_Content_Type_def_t, (const char*)type + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Content-Type'. +/// +/// @par ABNF= Content-Type / c +/// Content-Type = ( "Content-Type" / "c" ) HCOLON media-type +/// media-type = m-type SLASH m-subtype *( SEMI m-parameter) +/// m-type = discrete-type / composite-type +/// discrete-type = "text" / "image" / "audio" / "video" / "application" / extension-token +/// composite-type = "message" / "multipart" / extension-token +/// extension-token = ietf-token / x-token +/// ietf-token = token +/// x-token = "x-" token +/// m-subtype = extension-token / iana-token +/// iana-token = token +/// m-parameter = m-attribute EQUAL m-value +/// m-attribute = token +/// m-value = token / quoted-string +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Content_Type_s +{ + TSIP_DECLARE_HEADER; + + char* type; +} +tsip_header_Content_Type_t; + +TINYSIP_API tsip_header_Content_Type_t* tsip_header_Content_Type_create(const char* type); +TINYSIP_API tsip_header_Content_Type_t* tsip_header_Content_Type_create_null(); + +TINYSIP_API tsip_header_Content_Type_t *tsip_header_Content_Type_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Content_Type_def_t; + + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_CONTENT_TYPE_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Date.h b/tinySIP/include/tinysip/headers/tsip_header_Date.h new file mode 100644 index 0000000..f16ee7a --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Date.h @@ -0,0 +1,79 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Date.h + * @brief SIP dummy header. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_DATE_H_ +#define _TSIP_HEADER_DATE_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_DATE_VA_ARGS(wkday, month, day, year, h, m, s) tsip_header_Date_def_t, (const char*)wkday, (const char*)month, (int8_t)day, (int16_t)year, (int8_t)h, (int8_t)m, (int8_t)s + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP Date header. +/// +/// @par ABNF : Date = "Date" HCOLON SIP-date +/// SIP-date = rfc1123-date +/// rfc1123-date = wkday "," SP date1 SP time SP "GMT" +/// date1 = 2DIGIT SP month SP 4DIGIT +/// time = 2DIGIT ":" 2DIGIT ":" 2DIGIT +/// wkday = "Mon" / "Tue" / "Wed" / "Thu" / "Fri" / "Sat" / "Sun" +/// month = "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" / "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec" +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Date_s +{ + TSIP_DECLARE_HEADER; + + char *wkday; + char *month; + int8_t day; + int16_t year; + struct{ + int8_t h; + int8_t m; + int8_t s; + } time; +} +tsip_header_Date_t; + +TINYSIP_API tsip_header_Date_t* tsip_header_Date_create(const char* wkday, const char* month, int8_t day, int16_t year, int8_t h, int8_t m, int8_t s); +TINYSIP_API tsip_header_Date_t* tsip_header_Date_create_null(); + +TINYSIP_API tsip_header_Date_t *tsip_header_Date_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Date_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_DATE_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Dummy.h b/tinySIP/include/tinysip/headers/tsip_header_Dummy.h new file mode 100644 index 0000000..f1c5bb1 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Dummy.h @@ -0,0 +1,66 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Dummy.h + * @brief SIP dummy header. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_DUMMY_H_ +#define _TSIP_HEADER_DUMMY_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_DUMMY_VA_ARGS(name, value) tsip_header_Dummy_def_t, (const char*)name, (const char*)value + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP Dummy header. +/// +/// @par ABNF : token SP* HCOLON SP*<: any* +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Dummy_s +{ + TSIP_DECLARE_HEADER; + + char *name; + char *value; +} +tsip_header_Dummy_t; + +TINYSIP_API tsip_header_Dummy_t* tsip_header_Dummy_create(const char* name, const char* value); +TINYSIP_API tsip_header_Dummy_t* tsip_header_Dummy_create_null(); + +TINYSIP_API tsip_header_Dummy_t *tsip_header_Dummy_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Dummy_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_DUMMY_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Error_Info.h b/tinySIP/include/tinysip/headers/tsip_header_Error_Info.h new file mode 100644 index 0000000..53dc98f --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Error_Info.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Error_Info.h + * @brief SIP header 'Error-Info'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_ERROR_INFO_H_ +#define _TSIP_HEADER_ERROR_INFO_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Error-Info'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Error_Info_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Error_Info_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_ERROR_INFO_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Event.h b/tinySIP/include/tinysip/headers/tsip_header_Event.h new file mode 100644 index 0000000..35eb8ea --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Event.h @@ -0,0 +1,72 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Event.h + * @brief SIP header 'Event/o'as per RFC 3265. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_EVENT_H_ +#define _TSIP_HEADER_EVENT_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_EVENT_VA_ARGS(package) tsip_header_Event_def_t, (const char*)package + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Event/o' . +/// +/// @par ABNF: Event / o +/// Event = ( "Event" / "o" ) HCOLON event-type *( SEMI event-param ) +/// event-type = event-package *( "." event-template ) +/// event-package = token-nodot +/// event-template = token-nodot +/// token-nodot = 1*( alphanum / "-" / "!" / "%" / "*" / "_" / "+" / "`" / "'" / "~" ) +/// event-param = generic-param / ( "id" EQUAL token ) / call-ident / from-tag / to-tag / with-sessd +/// call-ident = "call-id" EQUAL ( token / DQUOTE callid DQUOTE ) +/// with-sessd = "include-session-description" +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Event_s +{ + TSIP_DECLARE_HEADER; + + char *package; +} +tsip_header_Event_t; + +TINYSIP_API tsip_header_Event_t* tsip_header_Event_create(const char* package); + +TINYSIP_API tsip_header_Event_t *tsip_header_Event_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Event_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_EVENT_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Expires.h b/tinySIP/include/tinysip/headers/tsip_header_Expires.h new file mode 100644 index 0000000..2242b9f --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Expires.h @@ -0,0 +1,67 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Expires.h + * @brief SIP header 'Expires'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_EXPIRES_H_ +#define _TSIP_HEADER_EXPIRES_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_EXPIRES_VA_ARGS(delta_seconds) tsip_header_Expires_def_t, (int64_t)delta_seconds + +#define TSIP_HEADER_EXPIRES_NONE -1 +#define TSIP_HEADER_EXPIRES_DEFAULT 600000 + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Expires'. +/// +/// @par ABNF: Expires = "Expires" HCOLON delta-seconds +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Expires_s +{ + TSIP_DECLARE_HEADER; + + int64_t delta_seconds; +} +tsip_header_Expires_t; + +TINYSIP_API tsip_header_Expires_t* tsip_header_Expires_create(int64_t delta_seconds); + +TINYSIP_API tsip_header_Expires_t *tsip_header_Expires_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Expires_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_EXPIRES_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_From.h b/tinySIP/include/tinysip/headers/tsip_header_From.h new file mode 100644 index 0000000..a799efd --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_From.h @@ -0,0 +1,69 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_From.h + * @brief SIP header 'From'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_FROM_H_ +#define _TSIP_HEADER_FROM_H_ + +#include "tinysip_config.h" +#include "tinysip/tsip_uri.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_FROM_VA_ARGS(display_name, uri, tag) tsip_header_From_def_t, (const char*)display_name, (const tsip_uri_t*)uri, (const char*)tag + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'From' . +/// +/// @par ABNF: From = ( "From" / "f" ) HCOLON from-spec +/// from-spec = ( name-addr / addr-spec ) *( SEMI from-param ) +/// from-param = tag-param / generic-param +/// tag-param = "tag" EQUAL token +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_From_s +{ + TSIP_DECLARE_HEADER; + + char *display_name; + tsip_uri_t *uri; + char *tag; +} +tsip_header_From_t; + +TINYSIP_API tsip_header_From_t* tsip_header_From_create(const char* display_name, const tsip_uri_t* uri, const char* tag); + +TINYSIP_API tsip_header_From_t *tsip_header_From_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_From_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_FROM_H_ */ diff --git a/tinySIP/include/tinysip/headers/tsip_header_History_Info.h b/tinySIP/include/tinysip/headers/tsip_header_History_Info.h new file mode 100644 index 0000000..6638f14 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_History_Info.h @@ -0,0 +1,56 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_History_Info.h + * @brief SIP header 'History-Info'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_HISTORY_INFO_H_ +#define _TSIP_HEADER_HISTORY_INFO_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'History-Info' . +/// @author Mamadou +/// @date 12/3/2009 +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_History_Info_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_History_Info_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_HISTORY_INFO_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Identity.h b/tinySIP/include/tinysip/headers/tsip_header_Identity.h new file mode 100644 index 0000000..8382d39 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Identity.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Identity.h + * @brief SIP header 'Identity'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_IDENTITY_H_ +#define _TSIP_HEADER_IDENTITY_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Identity' . +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Identity_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Identity_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_IDENTITY_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Identity_Info.h b/tinySIP/include/tinysip/headers/tsip_header_Identity_Info.h new file mode 100644 index 0000000..1aa790b --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Identity_Info.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Identity_Info.h + * @brief SIP header 'Identity-Info'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_IDENTITY_INFO_H_ +#define _TSIP_HEADER_IDENTITY_INFO_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Identity-Info'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Identity_Info_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Identity_Info_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_IDENTITY_INFO_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_In_Reply_To.h b/tinySIP/include/tinysip/headers/tsip_header_In_Reply_To.h new file mode 100644 index 0000000..90477c6 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_In_Reply_To.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_In_Reply_To.h + * @brief SIP header 'In-Reply-To'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_IN_REPLY_TO_H_ +#define _TSIP_HEADER_IN_REPLY_TO_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'In-Reply-To'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_In_Reply_To_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_In_Reply_To_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_IN_REPLY_TO_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Join.h b/tinySIP/include/tinysip/headers/tsip_header_Join.h new file mode 100644 index 0000000..ef4c042 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Join.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Join.h + * @brief SIP header 'Join'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_JOIN_H_ +#define _TSIP_HEADER_JOIN_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Join'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Join_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Join_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_JOIN_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_MIME_Version.h b/tinySIP/include/tinysip/headers/tsip_header_MIME_Version.h new file mode 100644 index 0000000..439f98c --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_MIME_Version.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_MIME_Version.h + * @brief SIP header 'MIME-Version'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_MIME_VERSION_H_ +#define _TSIP_HEADER_MIME_VERSION_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'MIME-Version'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_MIME_Version_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_MIME_Version_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_MIME_VERSION_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Max_Forwards.h b/tinySIP/include/tinysip/headers/tsip_header_Max_Forwards.h new file mode 100644 index 0000000..17d9856 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Max_Forwards.h @@ -0,0 +1,68 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Max_Forwards.h + * @brief SIP header 'Max-Forwards'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_MAX_FORWARDS_H_ +#define _TSIP_HEADER_MAX_FORWARDS_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + + +#define TSIP_HEADER_MAX_FORWARDS_VA_ARGS(max) tsip_header_Max_Forwards_def_t, (int32_t) max + +#define TSIP_HEADER_MAX_FORWARDS_NONE -1 +#define TSIP_HEADER_MAX_FORWARDS_DEFAULT 70 + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Max-Forwards'. +/// +/// @par ABNF: Max-Forwards = "Max-Forwards" HCOLON 1*DIGIT +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Max_Forwards_s +{ + TSIP_DECLARE_HEADER; + + int32_t value; +} +tsip_header_Max_Forwards_t; + +TINYSIP_API tsip_header_Max_Forwards_t* tsip_header_Max_Forwards_create(int32_t max); + +TINYSIP_API tsip_header_Max_Forwards_t *tsip_header_Max_Forwards_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Max_Forwards_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_MAX_FORWARDS_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Min_Expires.h b/tinySIP/include/tinysip/headers/tsip_header_Min_Expires.h new file mode 100644 index 0000000..042a190 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Min_Expires.h @@ -0,0 +1,68 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Min_Expires.h + * @brief SIP header 'Min-Expires'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_MIN_EXPIRES_H_ +#define _TSIP_HEADER_MIN_EXPIRES_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_MIN_EXPIRES_VA_ARGS(value) tsip_header_Min_Expires_def_t, (int32_t) value + +#define TSIP_HEADER_MIN_EXPIRES_NONE -1 +#define TSIP_HEADER_MIN_EXPIRES_DEFAULT 30 + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Min-Expires' as per RFC 3261. +/// +/// @par ABNF: Min-Expires = "Min-Expires" HCOLON delta-seconds +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Min_Expires_s +{ + TSIP_DECLARE_HEADER; + + int32_t value; +} +tsip_header_Min_Expires_t; + +TINYSIP_API tsip_header_Min_Expires_t* tsip_header_Min_Expires_create(int32_t value); +TINYSIP_API tsip_header_Min_Expires_t* tsip_header_Min_Expires_create_null(); + +TINYSIP_API tsip_header_Min_Expires_t *tsip_header_Min_Expires_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Min_Expires_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_MIN_EXPIRES_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Min_SE.h b/tinySIP/include/tinysip/headers/tsip_header_Min_SE.h new file mode 100644 index 0000000..de05338 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Min_SE.h @@ -0,0 +1,67 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Min_SE.h + * @brief SIP header 'Min-SE'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_MIN_SE_H_ +#define _TSIP_HEADER_MIN_SE_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_MIN_SE_VA_ARGS(delta_seconds) tsip_header_Min_SE_def_t, (int64_t)delta_seconds + +#define TSIP_SESSION_EXPIRES_MIN_VALUE 90 + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Min-SE'. +/// +/// @par ABNF : Min-SE = "Min-SE" HCOLON delta-seconds *(SEMI generic-param) +/// +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Min_SE_s +{ + TSIP_DECLARE_HEADER; + + int64_t delta_seconds; +} +tsip_header_Min_SE_t; + +TINYSIP_API tsip_header_Min_SE_t* tsip_header_Min_SE_create(int64_t delta_seconds); + +TINYSIP_API tsip_header_Min_SE_t *tsip_header_Min_SE_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Min_SE_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_MIN_SE_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Organization.h b/tinySIP/include/tinysip/headers/tsip_header_Organization.h new file mode 100644 index 0000000..8351afb --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Organization.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Organization.h + * @brief SIP header 'Organization'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_ORGANIZATION_H_ +#define _TSIP_HEADER_ORGANIZATION_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Organization'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Organization_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Organization_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_ORGANIZATION_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Access_Network_Info.h b/tinySIP/include/tinysip/headers/tsip_header_P_Access_Network_Info.h new file mode 100644 index 0000000..9508424 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Access_Network_Info.h @@ -0,0 +1,71 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_P_Access_Network_Info.h + * @brief SIP header 'P-Access-Network-Info'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_P_ACCESS_NETWORK_INFO_H_ +#define _TSIP_HEADER_P_ACCESS_NETWORK_INFO_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_P_ACCESS_NETWORK_INFO_VA_ARGS(value) tsip_header_P_Access_Network_Info_def_t, (const char*)value + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'P-Access-Network-Info' as per RFC 3455. +/// +/// @par ABNF: P-Access-Network-Info = "P-Access-Network-Info" HCOLON access-net-spec +/// access-net-spec = access-type *( SEMI access-info ) +/// access-type = "IEEE-802.11a" / "IEEE-802.11b" / "3GPP-GERAN" / "3GPP-UTRAN-FDD" / "3GPP-UTRAN-TDD" / "3GPP-CDMA2000" / token +/// access-info = cgi-3gpp / utran-cell-id-3gpp / extension-access-info +/// extension-access-info = gen-value +/// cgi-3gpp = "cgi-3gpp" EQUAL (token / quoted-string) +/// utran-cell-id-3gpp = "utran-cell-id-3gpp" EQUAL (token / quoted-string) +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_P_Access_Network_Info_s +{ + TSIP_DECLARE_HEADER; + + char *value; +} +tsip_header_P_Access_Network_Info_t; + +TINYSIP_API tsip_header_P_Access_Network_Info_t* tsip_header_P_Access_Network_Info_create(const char* value); +TINYSIP_API tsip_header_P_Access_Network_Info_t* tsip_header_P_Access_Network_Info_create_null(); + +TINYSIP_API tsip_header_P_Access_Network_Info_t *tsip_header_P_Access_Network_Info_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_P_Access_Network_Info_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_P_ACCESS_NETWORK_INFO_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Answer_State.h b/tinySIP/include/tinysip/headers/tsip_header_P_Answer_State.h new file mode 100644 index 0000000..e378ef7 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Answer_State.h @@ -0,0 +1,53 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_P_Answer_State.h + * @brief SIP header 'P-Answer-State'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_P_ANSWER_STATE_H_ +#define _TSIP_HEADER_P_ANSWER_STATE_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'P-Answer-State'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_P_Answer_State_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_P_Answer_State_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_P_ANSWER_STATE_H_ */ diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Asserted_Identity.h b/tinySIP/include/tinysip/headers/tsip_header_P_Asserted_Identity.h new file mode 100644 index 0000000..3e2118a --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Asserted_Identity.h @@ -0,0 +1,70 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_P_Asserted_Identity.h + * @brief SIP header 'P-Asserted-Identity' as per RFC 3325. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_P_ASSERTED_IDENTITY_H_ +#define _TSIP_HEADER_P_ASSERTED_IDENTITY_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +#include "tinysip/tsip_uri.h" + +TSIP_BEGIN_DECLS + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'P-Asserted-Identity' as per RFC 3325. +/// +/// @par ABNF: P-Asserted-Identity = PAssertedID +/// PAssertedID = "P-Asserted-Identity" HCOLON PAssertedID-value *(COMMA PAssertedID-value) +/// PAssertedID-value = name-addr / addr-spec +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_P_Asserted_Identity_s +{ + TSIP_DECLARE_HEADER; + + char *display_name; + tsip_uri_t *uri; +} +tsip_header_P_Asserted_Identity_t; + +typedef tsk_list_t tsip_header_P_Asserted_Identities_L_t; + +TINYSIP_API tsip_header_P_Asserted_Identity_t* tsip_header_P_Asserted_Identity_create(); + +TINYSIP_API tsip_header_P_Asserted_Identities_L_t *tsip_header_P_Asserted_Identity_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_P_Asserted_Identity_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_P_ASSERTED_IDENTITY_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Associated_URI.h b/tinySIP/include/tinysip/headers/tsip_header_P_Associated_URI.h new file mode 100644 index 0000000..8c28f41 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Associated_URI.h @@ -0,0 +1,72 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_P_Associated_URI.h + * @brief SIP header 'P-Associated-URI'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_P_ASSOCIATED_URI_H_ +#define _TSIP_HEADER_P_ASSOCIATED_URI_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +#include "tinysip/tsip_uri.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_P_ASSOCIATED_URI_VA_ARGS(uri) tsip_header_P_Associated_URI_def_t, (const tsip_uri_t*)uri + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'P-Associated-URI' as per RFC 3455. +/// +/// @par ABNF: P-Associated-URI = "P-Associated-URI" HCOLON p-aso-uri-spec *(COMMA p-aso-uri-spec) +/// p-aso-uri-spec = name-addr *( SEMI ai-param ) +/// ai-param = generic-param +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_P_Associated_URI_s +{ + TSIP_DECLARE_HEADER; + + char *display_name; + tsip_uri_t *uri; +} +tsip_header_P_Associated_URI_t; + +typedef tsk_list_t tsip_header_P_Associated_URIs_L_t; + +TINYSIP_API tsip_header_P_Associated_URI_t* tsip_header_P_Associated_URI_create(const tsip_uri_t* uri); +TINYSIP_API tsip_header_P_Associated_URI_t* tsip_header_P_Associated_URI_create_null(); + +TINYSIP_API tsip_header_P_Associated_URIs_L_t *tsip_header_P_Associated_URI_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_P_Associated_URI_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_P_ASSOCIATED_URI_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Called_Party_ID.h b/tinySIP/include/tinysip/headers/tsip_header_P_Called_Party_ID.h new file mode 100644 index 0000000..324b61a --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Called_Party_ID.h @@ -0,0 +1,53 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_P_Called_Party_ID.h + * @brief SIP header 'P-Called-Party-ID'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_P_CALLED_PARTY_ID_H_ +#define _TSIP_HEADER_P_CALLED_PARTY_ID_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'P-Called-Party-ID'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_P_Called_Party_ID_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_P_Called_Party_ID_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_P_CALLED_PARTY_ID_H_ */ \ No newline at end of file diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Charging_Function_Addresses.h b/tinySIP/include/tinysip/headers/tsip_header_P_Charging_Function_Addresses.h new file mode 100644 index 0000000..82e5e71 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Charging_Function_Addresses.h @@ -0,0 +1,68 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_P_Charging_Function_Addresses.h + * @brief SIP header 'P-Charging-Function-Addresses'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_P_CHARGING_FUNCTION_ADDRESSES_H_ +#define _TSIP_HEADER_P_CHARGING_FUNCTION_ADDRESSES_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'P-Charging-Function-Addresses' as per RFC 3455. +/// +/// @par ABNF: P-Charging-Function-Addresses = P-Charging-Addr +/// P-Charging-Addr = "P-Charging-Function-Addresses" HCOLON charge-addr-params *( SEMI charge-addr-params ) +/// charge-addr-params = ccf / ecf / generic-param +/// ccf = "ccf" EQUAL gen-value +/// ecf = "ecf" EQUAL gen-value +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_P_Charging_Function_Addresses_s +{ + TSIP_DECLARE_HEADER; + char* ccf; + char* ecf; +} +tsip_header_P_Charging_Function_Addresses_t; + +typedef tsk_list_t tsip_header_P_Charging_Function_Addressess_L_t; + +TINYSIP_API tsip_header_P_Charging_Function_Addresses_t* tsip_header_P_Charging_Function_Addresses_create(); + +TINYSIP_API tsip_header_P_Charging_Function_Addressess_L_t *tsip_header_P_Charging_Function_Addresses_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_P_Charging_Function_Addresses_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_P_CHARGING_FUNCTION_ADDRESSES_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Charging_Vector.h b/tinySIP/include/tinysip/headers/tsip_header_P_Charging_Vector.h new file mode 100644 index 0000000..45ba24d --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Charging_Vector.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_P_Charging_Vector.h + * @brief SIP header 'P-Charging-Vector'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_P_CHARGING_VECTOR_H_ +#define _TSIP_HEADER_P_CHARGING_VECTOR_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'P-Charging-Vector'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_P_Charging_Vector_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_P_Charging_Vector_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_P_CHARGING_VECTOR_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_DCS_Billing_Info.h b/tinySIP/include/tinysip/headers/tsip_header_P_DCS_Billing_Info.h new file mode 100644 index 0000000..ca518b9 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_P_DCS_Billing_Info.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_P_DCS_Billing_Info.h + * @brief SIP header 'P-DCS-Billing-Info'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_P_DCS_BILLING_INFO_H_ +#define _TSIP_HEADER_P_DCS_BILLING_INFO_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'P-DCS-Billing-Info'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_P_DCS_Billing_Info_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_P_DCS_Billing_Info_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_P_DCS_BILLING_INFO_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_DCS_LAES.h b/tinySIP/include/tinysip/headers/tsip_header_P_DCS_LAES.h new file mode 100644 index 0000000..ed2ce31 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_P_DCS_LAES.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_P_DCS_LAES.h + * @brief SIP header 'P-DCS-LAES'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_P_DCS_LAES_H_ +#define _TSIP_HEADER_P_DCS_LAES_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'P-DCS-_LAES'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_P_DCS_LAES_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_P_DCS_LAES_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_P_DCS_LAES_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_DCS_OSPS.h b/tinySIP/include/tinysip/headers/tsip_header_P_DCS_OSPS.h new file mode 100644 index 0000000..1d98390 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_P_DCS_OSPS.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_P_DCS_OSPS.h + * @brief SIP header 'P-DCS-OSPS'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_P_DCS_OSPS_H_ +#define _TSIP_HEADER_P_DCS_OSPS_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'P-DCS-OSPS'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_P_DCS_OSPS_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_P_DCS_OSPS_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_P_DCS_OSPS_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_DCS_Redirect.h b/tinySIP/include/tinysip/headers/tsip_header_P_DCS_Redirect.h new file mode 100644 index 0000000..103e396 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_P_DCS_Redirect.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_P_DCS_Redirect.h + * @brief SIP header 'P-DCS-Redirect'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_P_DCS_REDIRECT_H_ +#define _TSIP_HEADER_P_DCS_REDIRECT_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'P-DCS-Redirect'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_P_DCS_Redirect_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_P_DCS_Redirect_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_P_DCS_REDIRECT_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_DCS_Trace_Party_ID.h b/tinySIP/include/tinysip/headers/tsip_header_P_DCS_Trace_Party_ID.h new file mode 100644 index 0000000..3a11086 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_P_DCS_Trace_Party_ID.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_P_DCS_Trace_Party_ID.h + * @brief SIP header 'P-DCS-Trace-Party-ID'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_P_DCS_TRACE_PARTY_ID_H_ +#define _TSIP_HEADER_P_DCS_TRACE_PARTY_ID_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'P-DCS-Trace-Party-ID'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_P_DCS_Trace_Party_ID_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_P_DCS_Trace_Party_ID_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_P_DCS_TRACE_PARTY_ID_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Early_Media.h b/tinySIP/include/tinysip/headers/tsip_header_P_Early_Media.h new file mode 100644 index 0000000..54890f0 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Early_Media.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_P_Early_Media.h + * @brief SIP header 'P-Early-Media'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_P_EARLY_MEDIA_H_ +#define _TSIP_HEADER_P_EARLY_MEDIA_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'P-Early-Media'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_P_Early_Media_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_P_Early_Media_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_P_EARLY_MEDIA_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Media_Authorization.h b/tinySIP/include/tinysip/headers/tsip_header_P_Media_Authorization.h new file mode 100644 index 0000000..c161c34 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Media_Authorization.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_P_Media_Authorization.h + * @brief SIP header 'P-Media-Authorization'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_P_MEDIA_AUTHORIZATION_H_ +#define _TSIP_HEADER_P_MEDIA_AUTHORIZATION_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'P-Media-Authorization'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_P_Media_Authorization_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_P_Media_Authorization_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_P_MEDIA_AUTHORIZATION_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Preferred_Identity.h b/tinySIP/include/tinysip/headers/tsip_header_P_Preferred_Identity.h new file mode 100644 index 0000000..9272932 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Preferred_Identity.h @@ -0,0 +1,69 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_P_Preferred_Identity.h + * @brief SIP header 'P-Preferred-Identity'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_P_PREFERRED_IDENTITY_H_ +#define _TSIP_HEADER_P_PREFERRED_IDENTITY_H_ + +#include "tinysip_config.h" + +#include "tinysip/tsip_uri.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_P_PREFERRED_IDENTITY_VA_ARGS(uri) tsip_header_P_Preferred_Identity_def_t, (const tsip_uri_t*)uri + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'P-Preferred-Identity' as per RFC 3325. +/// +/// @par ABNF: PPreferredID = "P-Preferred-Identity" HCOLON PPreferredID-value *(COMMA PPreferredID-value) +/// PPreferredID-value = name-addr / addr-spec +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_P_Preferred_Identity_s +{ + TSIP_DECLARE_HEADER; + + tsip_uri_t *uri; + char *display_name; +} +tsip_header_P_Preferred_Identity_t; + +TINYSIP_API tsip_header_P_Preferred_Identity_t* tsip_header_P_Preferred_Identity_create(const tsip_uri_t* uri); +TINYSIP_API tsip_header_P_Preferred_Identity_t* tsip_header_P_Preferred_Identity_create_null(); + +TINYSIP_API tsip_header_P_Preferred_Identity_t *tsip_header_P_Preferred_Identity_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_P_Preferred_Identity_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_P_PREFERRED_IDENTITY_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Profile_Key.h b/tinySIP/include/tinysip/headers/tsip_header_P_Profile_Key.h new file mode 100644 index 0000000..0f33a2a --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Profile_Key.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_P_Profile_Key.h + * @brief SIP header 'P-Profile-Key'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_P_PROFILE_KEY_H_ +#define _TSIP_HEADER_P_PROFILE_KEY_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'P-Profile-Key'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_P_Profile_Key_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_P_Profile_Key_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_P_PROFILE_KEY_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_User_Database.h b/tinySIP/include/tinysip/headers/tsip_header_P_User_Database.h new file mode 100644 index 0000000..75915b5 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_P_User_Database.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_P_User_Database.h + * @brief SIP header 'P-User-Database'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_P_USER_DATABASE_H_ +#define _TSIP_HEADER_P_USER_DATABASE_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'P-User-Database'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_P_User_Database_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_P_User_Database_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_P_USER_DATABASE_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Visited_Network_ID.h b/tinySIP/include/tinysip/headers/tsip_header_P_Visited_Network_ID.h new file mode 100644 index 0000000..121783f --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Visited_Network_ID.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_P_Visited_Network_ID.h + * @brief SIP header 'P-Visited-Network-ID'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_P_VISITED_NETWORK_ID_H_ +#define _TSIP_HEADER_P_VISITED_NETWORK_ID_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'P-Visited-Network-ID'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_P_Visited_Network_ID_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_P_Visited_Network_ID_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_P_VISITED_NETWORK_ID_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Path.h b/tinySIP/include/tinysip/headers/tsip_header_Path.h new file mode 100644 index 0000000..d0fa6ed --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Path.h @@ -0,0 +1,72 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Path.h + * @brief SIP header 'Path'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_PATH_H_ +#define _TSIP_HEADER_PATH_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +#include "tinysip/tsip_uri.h" + +TSIP_BEGIN_DECLS + + +#define TSIP_HEADER_PATH_VA_ARGS(uri) tsip_header_Path_def_t, (const tsip_uri_t*)uri + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Path' as per RFC 3327. +/// +/// @par ABNF : Path = "Path" HCOLON path-value *(COMMA path-value) +/// path-value = name-addr *( SEMI rr-param ) +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Path_s +{ + TSIP_DECLARE_HEADER; + + char *display_name; + tsip_uri_t *uri; +} +tsip_header_Path_t; + +typedef tsk_list_t tsip_header_Paths_L_t; + +TINYSIP_API tsip_header_Path_t* tsip_header_Path_create(const tsip_uri_t* uri); +TINYSIP_API tsip_header_Path_t* tsip_header_Path_create_null(); + +TINYSIP_API tsip_header_Paths_L_t *tsip_header_Path_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Path_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_PATH_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Priority.h b/tinySIP/include/tinysip/headers/tsip_header_Priority.h new file mode 100644 index 0000000..eb1cbbf --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Priority.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Priority.h + * @brief SIP header 'Priority'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_PRIORITY_H_ +#define _TSIP_HEADER_PRIORITY_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Priority'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Priority_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Priority_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_PRIORITY_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Privacy.h b/tinySIP/include/tinysip/headers/tsip_header_Privacy.h new file mode 100644 index 0000000..421e18f --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Privacy.h @@ -0,0 +1,65 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Privacy.h + * @brief SIP header 'Privacy'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_PRIVACY_H_ +#define _TSIP_HEADER_PRIVACY_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Privacy' as per RFC 3323. +/// +/// @par ABNF: Privacy = Privacy-hdr +/// Privacy-hdr = "Privacy" HCOLON priv-value *(";" priv-value) +/// priv-value = "header" / "session" / "user" / "none" / "critical" / "id" / "history" / token +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Privacy_s +{ + TSIP_DECLARE_HEADER; + + tsk_strings_L_t *values; +} +tsip_header_Privacy_t; + +TINYSIP_API tsip_header_Privacy_t* tsip_header_Privacy_create(); + +TINYSIP_API tsip_header_Privacy_t *tsip_header_Privacy_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Privacy_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_PRIVACY_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Proxy_Authenticate.h b/tinySIP/include/tinysip/headers/tsip_header_Proxy_Authenticate.h new file mode 100644 index 0000000..01c4681 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Proxy_Authenticate.h @@ -0,0 +1,77 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Proxy_Authenticate.h + * @brief SIP header 'Proxy-Authenticate'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_PROXY_AUTHENTICATE_H_ +#define _TSIP_HEADER_PROXY_AUTHENTICATE_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Proxy-Authenticate'. +/// +/// @par ABNF = Proxy-Authenticate = "Proxy-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 tsip_header_Proxy_Authenticate_s +{ + TSIP_DECLARE_HEADER; + + char* scheme; + char* realm; + char* domain; + char* nonce; + char* opaque; + tsk_bool_t stale; + char* algorithm; + char* qop; +} +tsip_header_Proxy_Authenticate_t; + +tsip_header_Proxy_Authenticate_t *tsip_header_Proxy_Authenticate_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Proxy_Authenticate_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_PROXY_AUTHENTICATE_H_ */ diff --git a/tinySIP/include/tinysip/headers/tsip_header_Proxy_Authorization.h b/tinySIP/include/tinysip/headers/tsip_header_Proxy_Authorization.h new file mode 100644 index 0000000..6eb7136 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Proxy_Authorization.h @@ -0,0 +1,96 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Proxy_Authorization.h + * @brief SIP header 'Proxy-Authorization'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_PROXY_AUTHORIZATION_H_ +#define _TSIP_HEADER_PROXY_AUTHORIZATION_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Proxy-Authorization'. +/// +/// @par ABNF = "Proxy-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 tsip_header_Proxy_Authorization_s +{ + TSIP_DECLARE_HEADER; + + char* scheme; + char* username; + char* realm; + char* nonce; + char* uri; + char* response; + char* algorithm; + char* cnonce; + char* opaque; + char* qop; + char* nc; +} +tsip_header_Proxy_Authorization_t; + +TINYSIP_API tsip_header_Proxy_Authorization_t* tsip_header_Proxy_Authorization_create(); + +TINYSIP_API tsip_header_Proxy_Authorization_t *tsip_header_Proxy_Authorization_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Proxy_Authorization_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_PROXY_AUTHORIZATION_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Proxy_Require.h b/tinySIP/include/tinysip/headers/tsip_header_Proxy_Require.h new file mode 100644 index 0000000..63f74e4 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Proxy_Require.h @@ -0,0 +1,66 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Proxy_Require.h + * @brief SIP header 'Proxy-Require'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_PROXY_REQUIRE_H_ +#define _TSIP_HEADER_PROXY_REQUIRE_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + + +#define TSIP_HEADER_PROXY_REQUIRE_VA_ARGS(option) tsip_header_Proxy_Require_def_t, (const char*)option + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Proxy-Proxy_Require'. +/// +/// @par ABNF: Proxy_Require = "Proxy_Require" HCOLON option-tag *(COMMA option-tag) +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Proxy_Require_s +{ + TSIP_DECLARE_HEADER; + + tsk_strings_L_t *options; +} +tsip_header_Proxy_Require_t; + +TINYSIP_API tsip_header_Proxy_Require_t* tsip_header_Proxy_Require_create(const char* option); +TINYSIP_API tsip_header_Proxy_Require_t* tsip_header_Proxy_Require_create_null(); + +TINYSIP_API tsip_header_Proxy_Require_t *tsip_header_Proxy_Require_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Proxy_Require_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_PROXY_REQUIRE_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_RAck.h b/tinySIP/include/tinysip/headers/tsip_header_RAck.h new file mode 100644 index 0000000..6a2bc13 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_RAck.h @@ -0,0 +1,68 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_RAck.h + * @brief SIP header 'RAck'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_RACK_H_ +#define _TSIP_HEADER_RACK_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_RACK_VA_ARGS(seq, cseq, method) tsip_header_RAck_def_t, (uint32_t)seq, (uint32_t)cseq, (const char*)method + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'RAck' as per RFC 3262. +/// +/// @par ABNF : "RAck" HCOLON response-num LWS CSeq-num LWS Method +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_RAck_s +{ + TSIP_DECLARE_HEADER; + + uint32_t seq; + uint32_t cseq; + char* method; +} +tsip_header_RAck_t; + + +TINYSIP_API tsip_header_RAck_t* tsip_header_RAck_create(uint32_t seq, uint32_t cseq, const char* method); +TINYSIP_API tsip_header_RAck_t* tsip_header_RAck_create_null(); + +TINYSIP_API tsip_header_RAck_t *tsip_header_RAck_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_RAck_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_RACK_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_RSeq.h b/tinySIP/include/tinysip/headers/tsip_header_RSeq.h new file mode 100644 index 0000000..1b87ddd --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_RSeq.h @@ -0,0 +1,68 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_RSeq.h + * @brief SIP header 'RSeq'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_RSEQ_H_ +#define _TSIP_HEADER_RSEQ_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_RSEQ_VA_ARGS(seq) tsip_header_RSeq_def_t, (int32_t) seq + +#define TSIP_HEADER_RSEQ_NONE 0 +#define TSIP_HEADER_RSEQ_DEFAULT 1 + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'RSeq' as per RFC 3262. +/// +/// @par ABNF: "RSeq" HCOLON response-num +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_RSeq_s +{ + TSIP_DECLARE_HEADER; + uint32_t seq; +} +tsip_header_RSeq_t; + + +TINYSIP_API tsip_header_RSeq_t* tsip_header_RSeq_create(uint32_t seq); +TINYSIP_API tsip_header_RSeq_t* tsip_header_RSeq_create_null(); + +TINYSIP_API tsip_header_RSeq_t *tsip_header_RSeq_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_RSeq_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_RSEQ_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Reason.h b/tinySIP/include/tinysip/headers/tsip_header_Reason.h new file mode 100644 index 0000000..eb13b51 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Reason.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Reason.h + * @brief SIP header 'Reason'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_REASON_H_ +#define _TSIP_HEADER_REASON_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Reason'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Reason_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Reason_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_REASON_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Record_Route.h b/tinySIP/include/tinysip/headers/tsip_header_Record_Route.h new file mode 100644 index 0000000..7e8e187 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Record_Route.h @@ -0,0 +1,73 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Record_Route.h + * @brief SIP header 'Record-Route'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_RECORD_ROUTE_H_ +#define _TSIP_HEADER_RECORD_ROUTE_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +#include "tinysip/tsip_uri.h" + +TSIP_BEGIN_DECLS + + +#define TSIP_HEADER_RECORD_ROUTE_VA_ARGS(uri) tsip_header_Record_Route_def_t, (const tsip_uri_t*)uri + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Record-Route'. +/// +/// @par ABNF : Record-Route = "Record-Route" HCOLON rec-route *(COMMA rec-route) +/// rec-route = name-addr *( SEMI rr-param ) +/// rr-param = generic-param +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Record_Route_s +{ + TSIP_DECLARE_HEADER; + + char* display_name; + tsip_uri_t *uri; +} +tsip_header_Record_Route_t; + +typedef tsk_list_t tsip_header_Record_Routes_L_t; + +TINYSIP_API tsip_header_Record_Route_t* tsip_header_Record_Route_create(const tsip_uri_t* uri); +TINYSIP_API tsip_header_Record_Route_t* tsip_header_Record_Route_create_null(); + +TINYSIP_API tsip_header_Record_Routes_L_t *tsip_header_Record_Route_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Record_Route_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_RECORD_ROUTE_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Refer_Sub.h b/tinySIP/include/tinysip/headers/tsip_header_Refer_Sub.h new file mode 100644 index 0000000..d436430 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Refer_Sub.h @@ -0,0 +1,67 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Refer_Sub.h + * @brief SIP header 'Refer-Sub' as per 4488. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_REFER_SUB_H_ +#define _TSIP_HEADER_REFER_SUB_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_REFER_SUB_VA_ARGS(sub) tsip_header_Refer_Sub_def_t, (tsk_bool_t)sub + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Refer-Sub'. +/// +/// @par ABNF : Refer-Sub = "Refer-Sub" HCOLON refer-sub-value *(SEMI exten) +/// refer-sub-value = "true" / "false" +/// exten = generic-param +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Refer_Sub_s +{ + TSIP_DECLARE_HEADER; + + tsk_bool_t sub; +} +tsip_header_Refer_Sub_t; + +TINYSIP_API tsip_header_Refer_Sub_t* tsip_header_Refer_Sub_create(tsk_bool_t sub); +TINYSIP_API tsip_header_Refer_Sub_t* tsip_header_Refer_Sub_create_null(); + +TINYSIP_API tsip_header_Refer_Sub_t *tsip_header_Refer_Sub_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Refer_Sub_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_REFER_SUB_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Refer_To.h b/tinySIP/include/tinysip/headers/tsip_header_Refer_To.h new file mode 100644 index 0000000..f68ecd9 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Refer_To.h @@ -0,0 +1,69 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Refer_To.h + * @brief SIP Refer-To header as per RFC 3515. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_REFER_TO_H_ +#define _TSIP_HEADER_REFER_TO_H_ + +#include "tinysip_config.h" + +#include "tinysip/tsip_uri.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_REFER_TO_VA_ARGS(uri) tsip_header_Refer_To_def_t, (const tsip_uri_t*)uri + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Refer-To' . +/// +/// @par ABNF: Refer-To = ( "Refer-To" / "r" ) HCOLON ( name-addr / addr-spec ) *(SEMI refer-param) +/// refer-param = generic-param / feature-param +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Refer_To_s +{ + TSIP_DECLARE_HEADER; + + char *display_name; + tsip_uri_t *uri; +} +tsip_header_Refer_To_t; + +TSIP_END_DECLS + +TINYSIP_API tsip_header_Refer_To_t* tsip_header_Refer_To_create(const tsip_uri_t* uri); +TINYSIP_API tsip_header_Refer_To_t* tsip_header_Refer_To_create_null(); + +TINYSIP_API tsip_header_Refer_To_t *tsip_header_Refer_To_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Refer_To_def_t; + +#endif /* _TSIP_HEADER_REFER_TO_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Referred_By.h b/tinySIP/include/tinysip/headers/tsip_header_Referred_By.h new file mode 100644 index 0000000..5870512 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Referred_By.h @@ -0,0 +1,70 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Referred_By.h + * @brief SIP Referred-By header as per RFC 3892. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_REFERRED_BY_H_ +#define _TSIP_HEADER_REFERRED_BY_H_ + +#include "tinysip_config.h" + +#include "tinysip/tsip_uri.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_REFERRED_BY_VA_ARGS(uri, cid) tsip_header_Referred_By_def_t, (const tsip_uri_t*)uri, (const char*)cid + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Referred-By'. +/// +/// @par ABNF: Referred-By = ( "Referred-By" / "b" ) HCOLON referrer-uri *( SEMI (referredby-id-param / generic-param) ) +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Referred_By_s +{ + TSIP_DECLARE_HEADER; + + char *display_name; + tsip_uri_t *uri; + + char* cid; +} +tsip_header_Referred_By_t; + +TINYSIP_API tsip_header_Referred_By_t* tsip_header_Referred_By_create(const tsip_uri_t* uri, const char* cid); +TINYSIP_API tsip_header_Referred_By_t* tsip_header_Referred_By_create_null(); + +TINYSIP_API tsip_header_Referred_By_t *tsip_header_Referred_By_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Referred_By_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_REFERRED_BY_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Reject_Contact.h b/tinySIP/include/tinysip/headers/tsip_header_Reject_Contact.h new file mode 100644 index 0000000..01bcf4f --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Reject_Contact.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Reject_Contact.h + * @brief SIP header 'Reject-Contact'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_REJECT_CONTACT_H_ +#define _TSIP_HEADER_REJECT_CONTACT_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Reject-Contact'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Reject_Contact_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Reject_Contact_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_REJECT_CONTACT_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Replaces.h b/tinySIP/include/tinysip/headers/tsip_header_Replaces.h new file mode 100644 index 0000000..5889dd0 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Replaces.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Replaces.h + * @brief SIP header 'Replaces'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_REPLACES_H_ +#define _TSIP_HEADER_REPLACES_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Replaces'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Replaces_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Replaces_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_REPLACES_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Reply_To.h b/tinySIP/include/tinysip/headers/tsip_header_Reply_To.h new file mode 100644 index 0000000..e5b97f1 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Reply_To.h @@ -0,0 +1,53 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Reply_To.h + * @brief SIP header 'Reply_To'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_REPLY_TO_H_ +#define _TSIP_HEADER_REPLY_TO_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// @brief SIP header 'Reply_To'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Reply_To_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Reply_To_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_REPLY_TO_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Request_Disposition.h b/tinySIP/include/tinysip/headers/tsip_header_Request_Disposition.h new file mode 100644 index 0000000..50d8615 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Request_Disposition.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Request_Disposition.h + * @brief SIP header 'Request-Disposition'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_REQUEST_DISPOSITION_H_ +#define _TSIP_HEADER_REQUEST_DISPOSITION_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Request-Disposition'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Request_Disposition_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Request_Disposition_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_REQUEST_DISPOSITION_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Require.h b/tinySIP/include/tinysip/headers/tsip_header_Require.h new file mode 100644 index 0000000..01de563 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Require.h @@ -0,0 +1,66 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Require.h + * @brief SIP header 'Require'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_REQUIRE_H_ +#define _TSIP_HEADER_REQUIRE_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + + +#define TSIP_HEADER_REQUIRE_VA_ARGS(option) tsip_header_Require_def_t, (const char*)option + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Require'. +/// +/// @par ABNF: Require = "Require" HCOLON option-tag *(COMMA option-tag) +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Require_s +{ + TSIP_DECLARE_HEADER; + + tsk_strings_L_t *options; +} +tsip_header_Require_t; + +TINYSIP_API tsip_header_Require_t* tsip_header_Require_create(const char* option); +TINYSIP_API tsip_header_Require_t* tsip_header_Require_create_null(); + +TINYSIP_API tsip_header_Require_t *tsip_header_Require_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Require_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_REQUIRE_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Resource_Priority.h b/tinySIP/include/tinysip/headers/tsip_header_Resource_Priority.h new file mode 100644 index 0000000..24e83df --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Resource_Priority.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Resource_Priority.h + * @brief SIP header 'Resource-Priority'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_RESOURCE_PRIORITY_H_ +#define _TSIP_HEADER_RESOURCE_PRIORITY_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Resource-Priority'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Resource_Priority_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Resource_Priority_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_RESOURCE_PRIORITY_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Retry_After.h b/tinySIP/include/tinysip/headers/tsip_header_Retry_After.h new file mode 100644 index 0000000..4761b5c --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Retry_After.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Retry_After.h + * @brief SIP header 'Retry-After'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_RETRY_AFTER_H_ +#define _TSIP_HEADER_RETRY_AFTER_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Retry-After'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Retry_After_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Retry_After_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_RETRY_AFTER_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Route.h b/tinySIP/include/tinysip/headers/tsip_header_Route.h new file mode 100644 index 0000000..28e3c80 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Route.h @@ -0,0 +1,72 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Route.h + * @brief SIP header 'Route'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_ROUTE_H_ +#define _TSIP_HEADER_ROUTE_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +#include "tinysip/tsip_uri.h" + +TSIP_BEGIN_DECLS + + +#define TSIP_HEADER_ROUTE_VA_ARGS(uri) tsip_header_Route_def_t, (const tsip_uri_t*)uri + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Route'. +/// +/// @par ABNF : Route = "Route" HCOLON route-param *(COMMA route-param) +/// route-param = name-addr *( SEMI rr-param ) +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Route_s +{ + TSIP_DECLARE_HEADER; + + char *display_name; + tsip_uri_t *uri; +} +tsip_header_Route_t; + +typedef tsk_list_t tsip_header_Routes_L_t; + +TINYSIP_API tsip_header_Route_t* tsip_header_Route_create(const tsip_uri_t* uri); +TINYSIP_API tsip_header_Route_t* tsip_header_Route_create_null(); + +TINYSIP_API tsip_header_Routes_L_t *tsip_header_Route_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Route_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_ROUTE_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_SIP_ETag.h b/tinySIP/include/tinysip/headers/tsip_header_SIP_ETag.h new file mode 100644 index 0000000..cf6ba6f --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_SIP_ETag.h @@ -0,0 +1,66 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_SIP_ETag.h + * @brief SIP header 'SIP-ETag'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_SIP_ETAG_H_ +#define _TSIP_HEADER_SIP_ETAG_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + + +#define TSIP_HEADER_SIP_ETAG_VA_ARGS(etag) tsip_header_SIP_ETag_def_t, (const char*)etag + +/** + * @struct tsip_header_SIP_ETag_s + * + * SIP header 'SIP-ETag' as per RFC 3903. + * @par ABNF + * SIP-ETag = "SIP-ETag" HCOLON entity-tag + * entity-tag = token +**/ +typedef struct tsip_header_SIP_ETag_s +{ + TSIP_DECLARE_HEADER; + char *value; +} +tsip_header_SIP_ETag_t; + +TINYSIP_API tsip_header_SIP_ETag_t* tsip_header_SIP_ETag_create(const char* etag); +TINYSIP_API tsip_header_SIP_ETag_t* tsip_header_SIP_ETag_create_null(); + +TINYSIP_API tsip_header_SIP_ETag_t *tsip_header_SIP_ETag_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_SIP_ETag_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_SIP_ETAG_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_SIP_If_Match.h b/tinySIP/include/tinysip/headers/tsip_header_SIP_If_Match.h new file mode 100644 index 0000000..f918df4 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_SIP_If_Match.h @@ -0,0 +1,67 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_SIP_If_Match.h + * @brief SIP header 'SIP-If-Match'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_SIP_IF_MATCH_H_ +#define _TSIP_HEADER_SIP_IF_MATCH_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + + +#define TSIP_HEADER_SIP_IF_MATCH_VA_ARGS(etag) tsip_header_SIP_If_Match_def_t, (const char*)etag + + +/** + * @struct tsip_header_SIP_If_Match_s + * + * SIP header 'SIP-If-Match' as per RFC 3903. + * @par ABNF + * SIP-If-Match = "SIP-If-Match" HCOLON entity-tag + * entity-tag = token +**/ +typedef struct tsip_header_SIP_If_Match_s +{ + TSIP_DECLARE_HEADER; + char *value; +} +tsip_header_SIP_If_Match_t; + +TINYSIP_API tsip_header_SIP_If_Match_t* tsip_header_SIP_If_Match_create(const char* etag); +TINYSIP_API tsip_header_SIP_If_Match_t* tsip_header_SIP_If_Match_create_null(); + +TINYSIP_API tsip_header_SIP_If_Match_t *tsip_header_SIP_If_Match_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_SIP_If_Match_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_SIP_IF_MATCH_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Security_Client.h b/tinySIP/include/tinysip/headers/tsip_header_Security_Client.h new file mode 100644 index 0000000..d453832 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Security_Client.h @@ -0,0 +1,111 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Security_Client.h + * @brief SIP header 'Security-Client' as per RFC 3329. + * + + */ +#ifndef _TSIP_HEADER_SECURITY_CLIENT_H_ +#define _TSIP_HEADER_SECURITY_CLIENT_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +#include "tnet_types.h" + +TSIP_BEGIN_DECLS + + +#define TSIP_HEADER_SECURITY_CLIENT_VA_ARGS(mech, alg, prot, mod, ealg, port_c, port_s, spi_c, spi_s) tsip_header_Security_Client_def_t, (const char*)mech, (const char*)alg, (const char*)prot, (const char*)mod, (const char*)ealg, (tnet_port_t)port_c, (tnet_port_t)port_s, (uint32_t)spi_c, (uint32_t)spi_s + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Security-Client' as per RFC 3329. +/// +/// @par ABNF : Security-Client = "Security-Client" HCOLON sec-mechanism *(COMMA sec-mechanism) +/// sec-mechanism = mechanism-name *( SEMI mech-parameters ) +/// mechanism-name = ( "digest" / "tls" / "ipsec-ike" / "ipsec-man" / token ) +/// mech-parameters = ( preference / digest-algorithm / digest-qop / digest-verify / mech-extension ) +/// preference = "q" EQUAL qvalue +/// digest-algorithm = "d-alg" EQUAL token +/// digest-qop = "d-qop" EQUAL token +/// digest-verify = "d-ver" EQUAL LDQUOT 32LHEX RDQUOT +/// mech-extension = generic-param +/// +/// mechanism-name = ( "ipsec-3gpp" ) +/// mech-parameters = ( algorithm / protocol /mode / +/// encrypt-algorithm / spi / +/// port1 / port2 ) +/// algorithm = "alg" EQUAL ( "hmac-md5-96" / +/// "hmac-sha-1-96" ) +/// protocol = "prot" EQUAL ( "ah" / "esp" ) +/// mode = "mod" EQUAL ( "trans" / "tun" ) +/// encrypt-algorithm = "ealg" EQUAL ( "des-ede3-cbc" / "null" ) +/// spi = "spi" EQUAL spivalue +/// spivalue = 10DIGIT; 0 to 4294967295 +/// port1 = "port1" EQUAL port +/// port2 = "port2" EQUAL port +/// port = 1*DIGIT +/// +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Security_Client_s +{ + TSIP_DECLARE_HEADER; + + //! sec-mechanism (e.g. "digest" / "tls" / "ipsec-3gpp") + char* mech; + //! algorithm (e.g. "hmac-md5-96" / "hmac-sha-1-96") + char* alg; + //! protocol (e.g. "ah" / "esp") + char* prot; + //! mode (e.g. "trans" / "tun") + char* mod; + //! encrypt-algorithm (e.g. "des-ede3-cbc" / "null") + char* ealg; + //! client port + tnet_port_t port_c; + //! server port + tnet_port_t port_s; + //! client spi + uint32_t spi_c; + //! server spi + uint32_t spi_s; + //! preference + double q; +} +tsip_header_Security_Client_t; + +typedef tsk_list_t tsip_header_Security_Clients_L_t; + +TINYSIP_API tsip_header_Security_Client_t* tsip_header_Security_Client_create(const char* mech, const char* alg, const char* prot, const char* mod, const char* ealg, tnet_port_t port_c, tnet_port_t port_s, uint32_t spi_c, uint32_t spi_s); +TINYSIP_API tsip_header_Security_Client_t* tsip_header_Security_Client_create_null(); + +TINYSIP_API tsip_header_Security_Clients_L_t *tsip_header_Security_Client_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Security_Client_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_SECURITY_CLIENT_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Security_Server.h b/tinySIP/include/tinysip/headers/tsip_header_Security_Server.h new file mode 100644 index 0000000..eb66c43 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Security_Server.h @@ -0,0 +1,111 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Security_Server.h + * @brief SIP header 'Security-Server' as per RFC 3329. + * + + */ +#ifndef _TSIP_HEADER_SECURITY_SERVER_H_ +#define _TSIP_HEADER_SECURITY_SERVER_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +#include "tnet_types.h" + +TSIP_BEGIN_DECLS + + +#define TSIP_HEADER_SECURITY_SERVER_VA_ARGS() tsip_header_Security_Server_def_t + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Security-Server' as per RFC 3329. +/// +/// @par ABNF : Security-Server = "Security-Server" HCOLON sec-mechanism *(COMMA sec-mechanism) +/// sec-mechanism = mechanism-name *( SEMI mech-parameters ) +/// mechanism-name = ( "digest" / "tls" / "ipsec-ike" / "ipsec-man" / token ) +/// mech-parameters = ( preference / digest-algorithm / digest-qop / digest-verify / mech-extension ) +/// preference = "q" EQUAL qvalue +/// digest-algorithm = "d-alg" EQUAL token +/// digest-qop = "d-qop" EQUAL token +/// digest-verify = "d-ver" EQUAL LDQUOT 32LHEX RDQUOT +/// mech-extension = generic-param +/// +/// mechanism-name = ( "ipsec-3gpp" ) +/// mech-parameters = ( algorithm / protocol /mode / +/// encrypt-algorithm / spi / +/// port1 / port2 ) +/// algorithm = "alg" EQUAL ( "hmac-md5-96" / +/// "hmac-sha-1-96" ) +/// protocol = "prot" EQUAL ( "ah" / "esp" ) +/// mode = "mod" EQUAL ( "trans" / "tun" ) +/// encrypt-algorithm = "ealg" EQUAL ( "des-ede3-cbc" / "null" ) +/// spi = "spi" EQUAL spivalue +/// spivalue = 10DIGIT; 0 to 4294967295 +/// port1 = "port1" EQUAL port +/// port2 = "port2" EQUAL port +/// port = 1*DIGIT +/// +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Security_Server_s +{ + TSIP_DECLARE_HEADER; + + //! sec-mechanism (e.g. "digest" / "tls" / "ipsec-3gpp") + char* mech; + //! algorithm (e.g. "hmac-md5-96" / "hmac-sha-1-96") + char* alg; + //! protocol (e.g. "ah" / "esp") + char* prot; + //! mode (e.g. "trans" / "tun") + char* mod; + //! encrypt-algorithm (e.g. "des-ede3-cbc" / "null") + char* ealg; + //! client port + tnet_port_t port_c; + //! server port + tnet_port_t port_s; + //! client spi + uint32_t spi_c; + //! server spi + uint32_t spi_s; + //! preference + double q; +} +tsip_header_Security_Server_t; + +typedef tsk_list_t tsip_header_Security_Servers_L_t; + +TINYSIP_API tsip_header_Security_Server_t* tsip_header_Security_Server_create(); +TINYSIP_API tsip_header_Security_Server_t* tsip_header_Security_Server_create_null(); + +TINYSIP_API tsip_header_Security_Servers_L_t *tsip_header_Security_Server_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Security_Server_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_SECURITY_SERVER_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Security_Verify.h b/tinySIP/include/tinysip/headers/tsip_header_Security_Verify.h new file mode 100644 index 0000000..a9e59aa --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Security_Verify.h @@ -0,0 +1,110 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Security_Verify.h + * @brief SIP header 'Security-Client' as per RFC 3329. + * + + */ +#ifndef _TSIP_HEADER_SECURITY_VERIFY_H_ +#define _TSIP_HEADER_SECURITY_VERIFY_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +#include "tnet_types.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_SECURITY_VERIFY_VA_ARGS() tsip_header_Security_Verify_def_t + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Security-Client' as per RFC 3329. +/// +/// @par ABNF : Security-Client = "Security-Client" HCOLON sec-mechanism *(COMMA sec-mechanism) +/// sec-mechanism = mechanism-name *( SEMI mech-parameters ) +/// mechanism-name = ( "digest" / "tls" / "ipsec-ike" / "ipsec-man" / token ) +/// mech-parameters = ( preference / digest-algorithm / digest-qop / digest-verify / mech-extension ) +/// preference = "q" EQUAL qvalue +/// digest-algorithm = "d-alg" EQUAL token +/// digest-qop = "d-qop" EQUAL token +/// digest-verify = "d-ver" EQUAL LDQUOT 32LHEX RDQUOT +/// mech-extension = generic-param +/// +/// mechanism-name = ( "ipsec-3gpp" ) +/// mech-parameters = ( algorithm / protocol /mode / +/// encrypt-algorithm / spi / +/// port1 / port2 ) +/// algorithm = "alg" EQUAL ( "hmac-md5-96" / +/// "hmac-sha-1-96" ) +/// protocol = "prot" EQUAL ( "ah" / "esp" ) +/// mode = "mod" EQUAL ( "trans" / "tun" ) +/// encrypt-algorithm = "ealg" EQUAL ( "des-ede3-cbc" / "null" ) +/// spi = "spi" EQUAL spivalue +/// spivalue = 10DIGIT; 0 to 4294967295 +/// port1 = "port1" EQUAL port +/// port2 = "port2" EQUAL port +/// port = 1*DIGIT +/// +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Security_Verify_s +{ + TSIP_DECLARE_HEADER; + + //! sec-mechanism (e.g. "digest" / "tls" / "ipsec-3gpp") + char* mech; + //! algorithm (e.g. "hmac-md5-96" / "hmac-sha-1-96") + char* alg; + //! protocol (e.g. "ah" / "esp") + char* prot; + //! mode (e.g. "trans" / "tun") + char* mod; + //! encrypt-algorithm (e.g. "des-ede3-cbc" / "null") + char* ealg; + //! client port + tnet_port_t port_c; + //! server port + tnet_port_t port_s; + //! client spi + uint32_t spi_c; + //! server spi + uint32_t spi_s; + //! preference + double q; +} +tsip_header_Security_Verify_t; + +typedef tsk_list_t tsip_header_Security_Verifies_L_t; + +TINYSIP_API tsip_header_Security_Verify_t* tsip_header_Security_Verify_create(); +TINYSIP_API tsip_header_Security_Verify_t* tsip_header_Security_Verify_create_null(); + +TINYSIP_API tsip_header_Security_Verifies_L_t *tsip_header_Security_Verify_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Security_Verify_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_SECURITY_VERIFY_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Server.h b/tinySIP/include/tinysip/headers/tsip_header_Server.h new file mode 100644 index 0000000..1bdb3e5 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Server.h @@ -0,0 +1,69 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Server.h + * @brief SIP header 'Server'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_SERVER_H_ +#define _TSIP_HEADER_SERVER_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + + +#define TSIP_HEADER_SERVER_VA_ARGS(server) tsip_header_Server_def_t, (const char*)server + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Server'. +/// +/// @par ABNF: Server = "Server" HCOLON server-val *(LWS server-val) +/// server-val = product / comment +/// product = token [SLASH product-version] +/// product-version = token +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Server_s +{ + TSIP_DECLARE_HEADER; + char* value; +} +tsip_header_Server_t; + +TINYSIP_API tsip_header_Server_t* tsip_header_server_create(const char* server); +TINYSIP_API tsip_header_Server_t* tsip_header_server_create_null(); + +TINYSIP_API tsip_header_Server_t *tsip_header_Server_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Server_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_SERVER_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Service_Route.h b/tinySIP/include/tinysip/headers/tsip_header_Service_Route.h new file mode 100644 index 0000000..307d644 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Service_Route.h @@ -0,0 +1,71 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Service_Route.h + * @brief SIP header 'Service-Route'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_SERVICE_ROUTE_H_ +#define _TSIP_HEADER_SERVICE_ROUTE_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +#include "tinysip/tsip_uri.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_SERVICE_ROUTE_VA_ARGS(uri) tsip_header_Service_Route_def_t, (const tsip_uri_t*)uri + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Service-Route' as per RFC 3608. +/// +/// @par ABNF: Service-Route = "Service-Route" HCOLON sr-value *(COMMA sr-value) +/// sr-value = name-addr *( SEMI rr-param ) +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Service_Route_s +{ + TSIP_DECLARE_HEADER; + + char *display_name; + tsip_uri_t *uri; +} +tsip_header_Service_Route_t; + +typedef tsk_list_t tsip_header_Service_Routes_L_t; + +TINYSIP_API tsip_header_Service_Route_t* tsip_header_Service_Route_create(const tsip_uri_t* uri); +TINYSIP_API tsip_header_Service_Route_t* tsip_header_Service_Route_create_null(); + +TINYSIP_API tsip_header_Service_Routes_L_t *tsip_header_Service_Route_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Service_Route_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_SERVICE_ROUTE_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Session_Expires.h b/tinySIP/include/tinysip/headers/tsip_header_Session_Expires.h new file mode 100644 index 0000000..386d652 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Session_Expires.h @@ -0,0 +1,69 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Session_Expires.h + * @brief SIP header 'Session-Expires'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_SESSION_EXPIRES_H_ +#define _TSIP_HEADER_SESSION_EXPIRES_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_SESSION_EXPIRES_VA_ARGS(delta_seconds, refresher_uas) tsip_header_Session_Expires_def_t, (int64_t)delta_seconds, (tsk_bool_t)refresher_uas + +#define TSIP_SESSION_EXPIRES_DEFAULT_VALUE 1800 + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Session-Expires'. +/// +/// @par ABNF: Session-Expires = ( "Session-Expires" / "x" ) HCOLON delta-seconds *( SEMI (se-params ) +/// se-params = refresher-param / generic-param +/// refresher-param = "refresher" EQUAL ("uas" / "uac") +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Session_Expires_s +{ + TSIP_DECLARE_HEADER; + + int64_t delta_seconds; + tsk_bool_t refresher_uas; +} +tsip_header_Session_Expires_t; + +TINYSIP_API tsip_header_Session_Expires_t* tsip_header_Session_Expires_create(int64_t delta_seconds, tsk_bool_t refresher_uas); + +TINYSIP_API tsip_header_Session_Expires_t *tsip_header_Session_Expires_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Session_Expires_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_SESSION_EXPIRES_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Subject.h b/tinySIP/include/tinysip/headers/tsip_header_Subject.h new file mode 100644 index 0000000..69cbfec --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Subject.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Subject.h + * @brief SIP header 'Subject'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_SUBJECT_H_ +#define _TSIP_HEADER_SUBJECT_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Subject'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Subject_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Subject_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_SUBJECT_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Subscription_State.h b/tinySIP/include/tinysip/headers/tsip_header_Subscription_State.h new file mode 100644 index 0000000..5e4f90c --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Subscription_State.h @@ -0,0 +1,71 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Subscription_State.h + * @brief SIP header 'Subscription-State'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_SUBSCRIPTION_STATE_H_ +#define _TSIP_HEADER_SUBSCRIPTION_STATE_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Subscription-State'. +/// +/// @par ABNF: Subscription-State = ( "Subscription-State" / "o" ) HCOLON substate-value *( SEMI subexp-params ) +/// substate-value = "active" / "pending" / "terminated" / extension-substate +/// extension-substate = token +/// subexp-params = ("reason" EQUAL event-reason-value) / ("expires" EQUAL delta-seconds) / ("retry-after" EQUAL delta-seconds) / generic-param +/// event-reason-value = "deactivated" / "probation" / "rejected" / "timeout" / "giveup" / "noresource" / event-reason-extension +/// event-reason-extension = token +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Subscription_State_s +{ + TSIP_DECLARE_HEADER; + + char* state; + char* reason; + int32_t expires; + int32_t retry_after; +} +tsip_header_Subscription_State_t; + +tsip_header_Subscription_State_t* tsip_header_Subscription_State_create(); + +tsip_header_Subscription_State_t *tsip_header_Subscription_State_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Subscription_State_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_SUBSCRIPTION_STATE_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Supported.h b/tinySIP/include/tinysip/headers/tsip_header_Supported.h new file mode 100644 index 0000000..6b0ecd4 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Supported.h @@ -0,0 +1,67 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Supported.h + * @brief SIP header 'Supported'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_SUPPORTED_H_ +#define _TSIP_HEADER_SUPPORTED_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + + +#define TSIP_HEADER_SUPPORTED_VA_ARGS(option) tsip_header_Supported_def_t, (const char*)option + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Supported'. +/// +/// @par ABNF: Supported / k +/// Supported = ( "Supported" / "k" ) HCOLON [option-tag *(COMMA option-tag)] +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Supported_s +{ + TSIP_DECLARE_HEADER; + + tsk_strings_L_t *options; +} +tsip_header_Supported_t; + +TINYSIP_API tsip_header_Supported_t* tsip_header_Supported_create(const char* option); +TINYSIP_API tsip_header_Supported_t* tsip_header_Supported_create_null(); + +TINYSIP_API tsip_header_Supported_t *tsip_header_Supported_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Supported_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_SUPPORTED_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Target_Dialog.h b/tinySIP/include/tinysip/headers/tsip_header_Target_Dialog.h new file mode 100644 index 0000000..185fdf9 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Target_Dialog.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Target_Dialog.h + * @brief SIP header 'Target-Dialog'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_TARGET_DIALOG_H_ +#define _TSIP_HEADER_TARGET_DIALOG_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Target-Dialog'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Target_Dialog_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Target_Dialog_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_TARGET_DIALOG_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Timestamp.h b/tinySIP/include/tinysip/headers/tsip_header_Timestamp.h new file mode 100644 index 0000000..6492824 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Timestamp.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Timestamp.h + * @brief SIP header 'Timestamp'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_TIMESTAMP_H_ +#define _TSIP_HEADER_TIMESTAMP_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Timestamp'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Timestamp_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Timestamp_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_TIMESTAMP_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_To.h b/tinySIP/include/tinysip/headers/tsip_header_To.h new file mode 100644 index 0000000..92970f1 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_To.h @@ -0,0 +1,70 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_To.h + * @brief SIP header 'To'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_TO_H_ +#define _TSIP_HEADER_TO_H_ + +#include "tinysip_config.h" +#include "tinysip/tsip_uri.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + + +#define TSIP_HEADER_TO_VA_ARGS(display_name, uri, tag) tsip_header_To_def_t, (const char*)display_name, (const tsip_uri_t*)uri, (const char*)tag + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'To' . +/// +/// @par ABNF: To = To = ( "To" / "t" ) HCOLON ( name-addr / addr-spec ) *( SEMI to-param ) +/// to-param = tag-param / generic-param +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_To_s +{ + TSIP_DECLARE_HEADER; + + char *display_name; + tsip_uri_t *uri; + char *tag; +} +tsip_header_To_t; + +TINYSIP_API tsip_header_To_t* tsip_header_To_create(const char* display_name, const tsip_uri_t* uri, const char* tag); +TINYSIP_API tsip_header_To_t* tsip_header_To_create_null(); + +TINYSIP_API tsip_header_To_t *tsip_header_To_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_To_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_TO_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Unsupported.h b/tinySIP/include/tinysip/headers/tsip_header_Unsupported.h new file mode 100644 index 0000000..d58f8d4 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Unsupported.h @@ -0,0 +1,54 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Unsupported.h + * @brief SIP header 'Unsupported'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_UNSUPPORTED_H_ +#define _TSIP_HEADER_UNSUPPORTED_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Unsupported'. +/// +/// @par ABNF +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Unsupported_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Unsupported_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_UNSUPPORTED_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_User_Agent.h b/tinySIP/include/tinysip/headers/tsip_header_User_Agent.h new file mode 100644 index 0000000..a69c454 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_User_Agent.h @@ -0,0 +1,65 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_User_Agent.h + * @brief SIP header 'User-Agent'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_USER_AGENT_H_ +#define _TSIP_HEADER_USER_AGENT_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +#define TSIP_HEADER_USER_AGENT_VA_ARGS(ua) tsip_header_User_Agent_def_t, (const char*)ua + +#define TSIP_HEADER_USER_AGENT_DEFAULT "IM-client/OMA1.0 doubango/v1.0.0" +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'User-Agent'. +/// +/// @par ABNF : User-Agent = "User-Agent" HCOLON server-val *(LWS server-val) +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_User_Agent_s +{ + TSIP_DECLARE_HEADER; + char *value; +} +tsip_header_User_Agent_t; + +TINYSIP_API tsip_header_User_Agent_t* tsip_header_User_Agent_create(const char* ua); +TINYSIP_API tsip_header_User_Agent_t* tsip_header_User_Agent_create_null(); + +TINYSIP_API tsip_header_User_Agent_t *tsip_header_User_Agent_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_User_Agent_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_USER_AGENT_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Via.h b/tinySIP/include/tinysip/headers/tsip_header_Via.h new file mode 100644 index 0000000..dca22a7 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Via.h @@ -0,0 +1,107 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Via.h + * @brief SIP Via/v header as per RFC 3261 subclause 20.42. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_HEADER_VIA_H +#define TINYSIP_HEADER_VIA_H + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +#include "tsk_object.h" + +TSIP_BEGIN_DECLS + + +#define TSIP_HEADER_VIA_VA_ARGS(proto_name, proto_version, transport, host, port) tsip_header_Via_def_t, (const char*)proto_name, (const char*)proto_version, (const char*)transport, (const char*)host, (uint16_t)port + + +#define TSIP_HEADER_VIA_HAS_RPORT(self) ((self)->rport!=0) +#define TSIP_HEADER_VIA_HAS_TTL(self) ((self)->ttl!=0) +#define TSIP_HEADER_VIA_UNRELIABLE_TRANS(self) (tsk_striequals("UDP", (self)->transport)) +#define TSIP_HEADER_VIA_RELIABLE_TRANS(self) !(TSIP_HEADER_VIA_UNRELIABLE_TRANS(self)) +#define TSIP_HEADER_VIA_PROTO_NAME_DEFAULT "SIP" +#define TSIP_HEADER_VIA_PROTO_VERSION_DEFAULT "2.0" + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP Via/v header as per RFC 3261 subclause 20.42. +/// ABNF: Via = ( "Via" / "v" ) HCOLON via-parm *(COMMA via-parm) +/// via-parm = sent-protocol LWS sent-by *( SEMI via-params ) +/// via-params = via-ttl / via-maddr / via-received / via-branch / via-compression / response-port / via-extension +/// via-ttl = "ttl" EQUAL ttl +/// via-maddr = "maddr" EQUAL host +/// via-received = "received" EQUAL (IPv4address / IPv6address) +/// via-branch = "branch" EQUAL token +/// via-compression = "comp" EQUAL ("sigcomp" / other-compression) +/// other-compression = token +/// response-port = "rport" [EQUAL 1*DIGIT] +/// via-extension = generic-param +/// sent-protocol = protocol-name SLASH protocol-version SLASH transport +/// protocol-name = "SIP" / token +/// protocol-version = token +/// transport = "UDP" / "TCP" / "TLS" / "SCTP" / "TLS-SCTP" / other-transport +/// sent-by = host [ COLON port ] +/// ttl = 1*3DIGIT +/// +/// @author Mamadou +/// @date 12/5/2009 +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Via_s +{ + TSIP_DECLARE_HEADER; + + char *branch; + char *host; + uint16_t port; + char *comp; + char *sigcomp_id; + char *received; + char *maddr; + char *proto_name; + char *proto_version; + char *transport; + + int32_t rport; + int32_t ttl; +} +tsip_header_Via_t; + +typedef tsk_list_t tsip_header_Vias_L_t; + +TINYSIP_API tsip_header_Via_t* tsip_header_Via_create(const char* proto_name, const char* proto_version, const char* transport, const char* host, uint16_t port); +TINYSIP_API tsip_header_Via_t* tsip_header_Via_create_null(); + +TINYSIP_API tsip_header_Vias_L_t *tsip_header_Via_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Via_def_t; + +TSIP_END_DECLS + +#endif /* TINYSIP_HEADER_VIA_H */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_WWW_Authenticate.h b/tinySIP/include/tinysip/headers/tsip_header_WWW_Authenticate.h new file mode 100644 index 0000000..5de99d9 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_WWW_Authenticate.h @@ -0,0 +1,79 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_WWW_Authenticate.h + * @brief SIP header 'WWW-Authenticate'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_WWW_AUTHENTICATE_H_ +#define _TSIP_HEADER_WWW_AUTHENTICATE_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP 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 tsip_header_WWW_Authenticate_s +{ + TSIP_DECLARE_HEADER; + + char* scheme; + char* realm; + char* domain; + char* nonce; + char* opaque; + tsk_bool_t stale; + char* algorithm; + char* qop; +} +tsip_header_WWW_Authenticate_t; + +tsip_header_WWW_Authenticate_t *tsip_header_WWW_Authenticate_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_WWW_Authenticate_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_WWW_AUTHENTICATE_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_Warning.h b/tinySIP/include/tinysip/headers/tsip_header_Warning.h new file mode 100644 index 0000000..6c16112 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_Warning.h @@ -0,0 +1,72 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_Warning.h + * @brief SIP header 'Warning. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_WARNING_H_ +#define _TSIP_HEADER_WARNING_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Warning'. +/// +/// @par ABNF: Warning = "Warning" HCOLON warning-value *(COMMA warning-value) +/// warning-value = warn-code SP warn-agent SP warn-text +/// warn-code = 3DIGIT +/// warn-agent = hostport / pseudonym +/// warn-text = quoted-string +/// pseudonym = token +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Warning_s +{ + TSIP_DECLARE_HEADER; + + int32_t code; + char* agent; + char* text; +} +tsip_header_Warning_t; + +typedef tsk_list_t tsip_header_Warnings_L_t; + +tsip_header_Warning_t* tsip_header_Warning_create(); + +tsip_header_Warnings_L_t *tsip_header_Warning_parse(const char *data, tsk_size_t size); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_header_Warning_def_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_WARNING_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_header_accept.h b/tinySIP/include/tinysip/headers/tsip_header_accept.h new file mode 100644 index 0000000..1742051 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_header_accept.h @@ -0,0 +1,57 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header_accept.h + * @brief SIP header 'Accept-Contact'. + * + * @author Mamadou Diop + * + + */ +#ifndef _TSIP_HEADER_ACCEPT_H_ +#define _TSIP_HEADER_ACCEPT_H_ + +#include "tinysip_config.h" +#include "tinysip/headers/tsip_header.h" + +TSIP_BEGIN_DECLS + +// The ' in the media-range field is used for doxygen (escape) and is not part of the abnf. +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP header 'Accept' as per RFC 3261 subclause 20.1. +/// +/// @par ABNF = Accept = "Accept" HCOLON [ accept-range *(COMMA accept-range) ] ; example: ; +/// Accept: application/dialog-info+xml +/// accept-range = media-range *(SEMI accept-param) +/// media-range = ( "*'/*" / ( m-type SLASH "*" ) / ( m-type SLASH m-subtype ) ) *( SEMI m-parameter ) +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_header_Accept_s +{ + TSIP_DECLARE_HEADER; +} +tsip_header_Accept_t; + +TSIP_END_DECLS + +#endif /* _TSIP_HEADER_ACCEPT_H_ */ + diff --git a/tinySIP/include/tinysip/headers/tsip_headers.h b/tinySIP/include/tinysip/headers/tsip_headers.h new file mode 100644 index 0000000..b520cc4 --- /dev/null +++ b/tinySIP/include/tinysip/headers/tsip_headers.h @@ -0,0 +1,89 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_header.h + * @brief List of all supported 3GPP/SIP headers. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_HEADERS_H +#define TINYSIP_HEADERS_H + +#include "tinysip_config.h" + +#include "tinysip/headers/tsip_header_Allow.h" +#include "tinysip/headers/tsip_header_Allow_Events.h" +#include "tinysip/headers/tsip_header_Authorization.h" +#include "tinysip/headers/tsip_header_Call_ID.h" +#include "tinysip/headers/tsip_header_Contact.h" +#include "tinysip/headers/tsip_header_CSeq.h" +#include "tinysip/headers/tsip_header_Date.h" +#include "tinysip/headers/tsip_header_Dummy.h" +#include "tinysip/headers/tsip_header_Event.h" +#include "tinysip/headers/tsip_header_Expires.h" +#include "tinysip/headers/tsip_header_From.h" +#include "tinysip/headers/tsip_header_Max_Forwards.h" +#include "tinysip/headers/tsip_header_Min_Expires.h" +#include "tinysip/headers/tsip_header_Min_SE.h" +#include "tinysip/headers/tsip_header_Path.h" +#include "tinysip/headers/tsip_header_P_Access_Network_Info.h" +#include "tinysip/headers/tsip_header_P_Asserted_Identity.h" +#include "tinysip/headers/tsip_header_P_Associated_URI.h" +#include "tinysip/headers/tsip_header_P_Charging_Function_Addresses.h" +#include "tinysip/headers/tsip_header_P_Preferred_Identity.h" +#include "tinysip/headers/tsip_header_Privacy.h" +#include "tinysip/headers/tsip_header_Proxy_Authenticate.h" +#include "tinysip/headers/tsip_header_Proxy_Authorization.h" +#include "tinysip/headers/tsip_header_Proxy_Require.h" +#include "tinysip/headers/tsip_header_RAck.h" +#include "tinysip/headers/tsip_header_Record_Route.h" +#include "tinysip/headers/tsip_header_Refer_Sub.h" +#include "tinysip/headers/tsip_header_Refer_To.h" +#include "tinysip/headers/tsip_header_Referred_By.h" +#include "tinysip/headers/tsip_header_Require.h" +#include "tinysip/headers/tsip_header_Route.h" +#include "tinysip/headers/tsip_header_RSeq.h" +#include "tinysip/headers/tsip_header_Security_Client.h" +#include "tinysip/headers/tsip_header_Security_Server.h" +#include "tinysip/headers/tsip_header_Security_Verify.h" +#include "tinysip/headers/tsip_header_Server.h" +#include "tinysip/headers/tsip_header_Session_Expires.h" +#include "tinysip/headers/tsip_header_Service_Route.h" +#include "tinysip/headers/tsip_header_SIP_ETag.h" +#include "tinysip/headers/tsip_header_SIP_If_Match.h" +#include "tinysip/headers/tsip_header_Subscription_State.h" +#include "tinysip/headers/tsip_header_Supported.h" +#include "tinysip/headers/tsip_header_To.h" +#include "tinysip/headers/tsip_header_User_Agent.h" +#include "tinysip/headers/tsip_header_Via.h" +#include "tinysip/headers/tsip_header_Warning.h" +#include "tinysip/headers/tsip_header_WWW_Authenticate.h" + +TSIP_BEGIN_DECLS + +TSIP_END_DECLS + + +#endif /* TINYSIP_HEADERS_H */ + diff --git a/tinySIP/include/tinysip/parsers/tsip_parser_header.h b/tinySIP/include/tinysip/parsers/tsip_parser_header.h new file mode 100644 index 0000000..da673a4 --- /dev/null +++ b/tinySIP/include/tinysip/parsers/tsip_parser_header.h @@ -0,0 +1,44 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_parser_header.h + * @brief SIP headers parser. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_PARSER_HEADERS_H +#define TINYSIP_PARSER_HEADERS_H + +#include "tinysip_config.h" +#include "tinysip/tsip_message.h" +#include "tsk_ragel_state.h" + +TSIP_BEGIN_DECLS + +tsk_bool_t tsip_header_parse(tsk_ragel_state_t *state, tsip_message_t *message); + +TSIP_END_DECLS + +#endif /* TINYSIP_PARSER_HEADERS_H */ + diff --git a/tinySIP/include/tinysip/parsers/tsip_parser_message.h b/tinySIP/include/tinysip/parsers/tsip_parser_message.h new file mode 100644 index 0000000..bf1091d --- /dev/null +++ b/tinySIP/include/tinysip/parsers/tsip_parser_message.h @@ -0,0 +1,44 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_parser_message.h + * @brief SIP message parser. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_PARSER_MESSAGE_H +#define TINYSIP_PARSER_MESSAGE_H + +#include "tinysip_config.h" +#include "tinysip/tsip_message.h" +#include "tsk_ragel_state.h" + +TSIP_BEGIN_DECLS + +TINYSIP_API tsk_bool_t tsip_message_parse(tsk_ragel_state_t *state, tsip_message_t **result, tsk_bool_t extract_content); + +TSIP_END_DECLS + +#endif /* TINYSIP_PARSER_MESSAGE_H */ + diff --git a/tinySIP/include/tinysip/parsers/tsip_parser_uri.h b/tinySIP/include/tinysip/parsers/tsip_parser_uri.h new file mode 100644 index 0000000..84537f5 --- /dev/null +++ b/tinySIP/include/tinysip/parsers/tsip_parser_uri.h @@ -0,0 +1,45 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_parser_uri.h + * @brief SIP/SIPS/TEL URI parser. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_PARSER_URI_H +#define TINYSIP_PARSER_URI_H + +#include "tinysip_config.h" +#include "tinysip/tsip_uri.h" + +#include "tsk_ragel_state.h" + +TSIP_BEGIN_DECLS + +TINYSIP_API tsip_uri_t *tsip_uri_parse(const char *data, tsk_size_t size); + +TSIP_END_DECLS + +#endif /* TINYSIP_PARSER_URI_H */ + diff --git a/tinySIP/include/tinysip/sigcomp/tsip_sigcomp.h b/tinySIP/include/tinysip/sigcomp/tsip_sigcomp.h new file mode 100644 index 0000000..6ccb461 --- /dev/null +++ b/tinySIP/include/tinysip/sigcomp/tsip_sigcomp.h @@ -0,0 +1,69 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_sigcomp.h + * @brief SigComp helper API. + * + * @author Mamadou Diop + * + + */ +#ifndef TSIP_SIGCOMP_H +#define TSIP_SIGCOMP_H + +#include "tinysip_config.h" + +#include "tsk_object.h" + +TSIP_BEGIN_DECLS + +#define TSIP_IS_SIGCOMP_DATA(data) ((data) && (*((uint8_t*)data) & 0xF8) == 0xF8) + +#define TSIP_SIGCOMP_DMS 8192 +#define TSIP_SIGCOMP_SMS 8192 +#define TSIP_SIGCOMP_CPB 64 +#define TSIP_SIGCOMP_PRES_DICT tsk_false +#define TSIP_SIGCOMP_SIP_DICT tsk_true +#define TSIP_SIGCOMP_MAX_BUFF_SIZE 0x2710 + +typedef void tsip_sigcomp_handle_t; + +tsip_sigcomp_handle_t* tsip_sigcomp_handler_create(uint8_t cpb, uint32_t dms, uint32_t sms); +int tsip_sigcomp_handler_set_dicts(tsip_sigcomp_handle_t* self, tsk_bool_t sip_n_sdp, tsk_bool_t pres); +int tsip_sigcomp_handler_add_compartment(tsip_sigcomp_handle_t* self, const char* comp_id); +int tsip_sigcomp_handler_remove_compartment(tsip_sigcomp_handle_t* self, const char* comp_id); +const char* tsip_sigcomp_handler_fixme_getcompid(const tsip_sigcomp_handle_t* self); +int tsip_sigcomp_close_all(tsip_sigcomp_handle_t* self); +tsk_size_t tsip_sigcomp_handler_compress(tsip_sigcomp_handle_t* self, const char* comp_id, tsk_bool_t is_stream, const void* in_data, tsk_size_t in_size, void* out_data, tsk_size_t out_maxsize); +tsk_size_t tsip_sigcomp_handler_uncompress(tsip_sigcomp_handle_t* self, const char* comp_id, tsk_bool_t is_stream, const void* in_data, tsk_size_t in_size, void* out_data, tsk_size_t out_maxsize, tsk_bool_t* is_nack); +tsk_size_t tsip_sigcomp_handler_uncompress_next(tsip_sigcomp_handle_t* self, const char* comp_id, void** nack_data, tsk_bool_t* is_nack); + + +#define tsip_sigcomp_handler_compressUDP(self, comp_id, in_data, in_size, out_data, out_maxsize) tsip_sigcomp_handler_compress(self, comp_id, tsk_false, in_data, in_size, out_data, out_maxsize) +#define tsip_sigcomp_handler_compressTCP(self, comp_id, in_data, in_size, out_data, out_maxsize) tsip_sigcomp_handler_compress(self, comp_id, tsk_true, in_data, in_size, out_data, out_maxsize) +#define tsip_sigcomp_handler_uncompressUDP(self, comp_id, in_data, in_size, out_data, out_maxsize, is_nack) tsip_sigcomp_handler_uncompress(self, comp_id, tsk_false, in_data, in_size, out_data, out_maxsize, is_nack) +#define tsip_sigcomp_handler_uncompressTCP(self, comp_id, in_data, in_size, out_data, out_maxsize, is_nack) tsip_sigcomp_handler_uncompress(self, comp_id, tsk_true, in_data, in_size, out_data, out_maxsize, is_nack) + +TSIP_END_DECLS + +#endif /* TSIP_SIGCOMP_H */ + diff --git a/tinySIP/include/tinysip/transactions/tsip_transac.h b/tinySIP/include/tinysip/transactions/tsip_transac.h new file mode 100644 index 0000000..3a896a0 --- /dev/null +++ b/tinySIP/include/tinysip/transactions/tsip_transac.h @@ -0,0 +1,181 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_transac.h + * @brief SIP transaction base class as per RFC 3261 subclause 17. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_TRANSAC_H +#define TINYSIP_TRANSAC_H + +#include "tinysip_config.h" + +#include "tsip.h" +#include "tinysip/tsip_timers.h" +#include "tinysip/tsip_message.h" + +#include "tinysip/dialogs/tsip_dialog.h" + +#include "tsk_safeobj.h" +#include "tsk_list.h" +#include "tsk_fsm.h" + +TSIP_BEGIN_DECLS + +#define TSIP_TRANSAC(self) ((tsip_transac_t*)(self)) +#define TSIP_TRANSAC_GET_TYPE(self) TSIP_TRANSAC((self))->type +#define TSIP_TRANSAC_GET_FSM(self) TSIP_TRANSAC((self))->fsm +#define TSIP_TRANSAC_GET_SESSION(self) ((struct tsip_ssession_s*)(TSIP_TRANSAC_GET_DIALOG((self)) ? TSIP_TRANSAC_GET_DIALOG((self))->ss : tsk_null)) +#define TSIP_TRANSAC_GET_DIALOG(self) ((struct tsip_dialog_s*)(TSIP_TRANSAC_GET_DST((self))->type == tsip_transac_dst_type_dialog ? TSIP_TRANSAC_GET_DST((self))->dialog.dlg : tsk_null)) +#define TSIP_TRANSAC_GET_DST(self) TSIP_TRANSAC((self))->dst +#define TSIP_TRANSAC_GET_STACK(self) TSIP_TRANSAC_GET_DST((self))->stack +#define TSIP_TRANSAC_GET_TIMER_MGR(self) TSIP_TRANSAC_GET_STACK((self))->timer_mgr + +#define TSIP_TRANSAC_IS_CLIENT(self) ((self) && ((self)->type == tsip_transac_type_ict || (self)->type == tsip_transac_type_nict)) +#define TSIP_TRANSAC_IS_SERVER(self) !TSIP_TRANSAC_IS_CLIENT((self)) + +#define TSIP_TRANSAC_MAGIC_COOKIE "z9hG4bK" + +#define TSIP_TRANSAC_SYNC_BEGIN(self) tsk_safeobj_lock(TSIP_TRANSAC(self)) +#define TSIP_TRANSAC_SYNC_END(self) tsk_safeobj_unlock(TSIP_TRANSAC(self)) + +#define TRANSAC_TIMER_SCHEDULE(name, TX) \ + self->timer##TX.id = tsk_timer_mgr_global_schedule(self->timer##TX.timeout, TSK_TIMER_CALLBACK_F(tsip_transac_##name##_timer_callback), self) + +#define TRANSAC_TIMER_CANCEL(TX) \ + tsk_timer_mgr_global_cancel(self->timer##TX.id) + +typedef enum tsip_transac_event_type_e +{ + tsip_transac_incoming_msg, + tsip_transac_outgoing_msg, + tsip_transac_canceled, + tsip_transac_terminated, + tsip_transac_timedout, + tsip_transac_error, + tsip_transac_transport_error +} +tsip_transac_event_type_t; + +/*typedef struct tsip_transac_event_s +{ + tsip_transac_event_type_t type; + const tsip_message_t *msg; +} +tsip_transac_event_t; + +#define TSIP_TRANSAC_EVENT_INIT(transac_event, type, msg) \ + transac_event.type = type; \ + transac_event.msg = msg;*/ + +typedef int (*tsip_transac_event_callback_f)(const void *arg, tsip_transac_event_type_t type, const tsip_message_t *msg); +#define TSIP_TRANSAC_EVENT_CALLBACK_F(callback) ((tsip_transac_event_callback_f)(callback)) + +typedef enum tsip_transac_type_e +{ + tsip_transac_type_ict, /**< Invite Client Transaction. */ + tsip_transac_type_ist, /**< Invite Server Transaction. */ + tsip_transac_type_nict, /**< Non-Invite Client Transaction. */ + tsip_transac_type_nist, /**< Non-Invite Server Transaction. */ +} +tsip_transac_type_t; + + + +typedef enum tsip_transac_dst_type_e +{ + tsip_transac_dst_type_dialog, + tsip_transac_dst_type_net +} +tsip_transac_dst_type_t; + +typedef struct tsip_transac_dst_s +{ + TSK_DECLARE_OBJECT; + + tsip_transac_dst_type_t type; + struct tsip_stack_s* stack; + + union{ + struct{ + tsip_dialog_t *dlg; + }dialog; + + //struct{ + //}net; + }; +} +tsip_transac_dst_t; +#define TSIP_TRANSAC_DST(self) ((tsip_transac_dst_t*)(self)) +#define TSIP_DECLARE_TRANSAC_DST tsip_transac_dst_t __transac__ + + +typedef struct tsip_transac_s +{ + TSK_DECLARE_OBJECT; + + tsip_transac_type_t type; + + struct tsip_transac_dst_s* dst; + tsk_fsm_t *fsm; + + tsk_bool_t reliable; + tsk_bool_t running; + tsk_bool_t initialized; + + char *branch; + + int32_t cseq_value; + char* cseq_method; + + char* callid; + + tsip_transac_event_callback_f callback; +} +tsip_transac_t; + +#define TSIP_DECLARE_TRANSAC tsip_transac_t __transac__ + +typedef tsk_list_t tsip_transacs_L_t; /**< List of @ref tsip_transac_t elements. */ +/* +================================*/ + +int tsip_transac_init(tsip_transac_t *self, tsip_transac_type_t type, int32_t cseq_value, const char* cseq_method, const char* callid, struct tsip_transac_dst_s* dst, tsk_fsm_state_id curr, tsk_fsm_state_id term); +int tsip_transac_deinit(tsip_transac_t *self); +int tsip_transac_start(tsip_transac_t *self, const tsip_request_t* request); +int tsip_transac_deliver(tsip_transac_t* self, tsip_dialog_event_type_t event_type, const tsip_message_t *msg); +int tsip_transac_send(tsip_transac_t *self, const char *branch, tsip_message_t *msg); +int tsip_transac_cmp(const tsip_transac_t *t1, const tsip_transac_t *t2); +int tsip_transac_remove(const tsip_transac_t* self); +int tsip_transac_fsm_act(tsip_transac_t* self, tsk_fsm_action_id , const tsip_message_t*); + + +struct tsip_transac_dst_s* tsip_transac_dst_dialog_create(tsip_dialog_t *dlg); +struct tsip_transac_dst_s* tsip_transac_dst_net_create(struct tsip_stack_s* stack); + +TSIP_END_DECLS + +#endif /* TINYSIP_TRANSAC_H */ + diff --git a/tinySIP/include/tinysip/transactions/tsip_transac_ict.h b/tinySIP/include/tinysip/transactions/tsip_transac_ict.h new file mode 100644 index 0000000..a34a413 --- /dev/null +++ b/tinySIP/include/tinysip/transactions/tsip_transac_ict.h @@ -0,0 +1,63 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_transac_ict.h + * @brief SIP INVITE Client Transaction as per RFC 3261 subclause 17.1.1. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_TRANSAC_ICT_H +#define TINYSIP_TRANSAC_ICT_H + +#include "tinysip_config.h" + +#include "tinysip/transactions/tsip_transac.h" +#include "tinysip/tsip_message.h" + +TSIP_BEGIN_DECLS + +#define TSIP_TRANSAC_ICT(self) ((tsip_transac_ict_t*)(self)) + +typedef struct tsip_transac_ict +{ + TSIP_DECLARE_TRANSAC; + + tsip_request_t* request; + + tsip_timer_t timerA; + tsip_timer_t timerB; + tsip_timer_t timerD; + tsip_timer_t timerM; +} +tsip_transac_ict_t; + +tsip_transac_ict_t* tsip_transac_ict_create(int32_t cseq_value, const char* callid, tsip_transac_dst_t* dst); +int tsip_transac_ict_start(tsip_transac_ict_t *self, const tsip_request_t* request); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_transac_ict_def_t; + +TSIP_END_DECLS + +#endif /* TINYSIP_TRANSAC_ICT_H */ + diff --git a/tinySIP/include/tinysip/transactions/tsip_transac_ist.h b/tinySIP/include/tinysip/transactions/tsip_transac_ist.h new file mode 100644 index 0000000..82abdbe --- /dev/null +++ b/tinySIP/include/tinysip/transactions/tsip_transac_ist.h @@ -0,0 +1,64 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_transac_ist.h + * @brief SIP INVITE Server Transaction as per RFC 3261 subclause 17.2.1. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_TRANSAC_IST_H +#define TINYSIP_TRANSAC_IST_H + +#include "tinysip_config.h" +#include "tinysip/transactions/tsip_transac.h" + +TSIP_BEGIN_DECLS + +#define TSIP_TRANSAC_IST(self) ((tsip_transac_ist_t*)(self)) + + +typedef struct tsip_transac_ist +{ + TSIP_DECLARE_TRANSAC; + + tsip_response_t* lastResponse; + tsk_bool_t acked; + + tsip_timer_t timerH; + tsip_timer_t timerI; + tsip_timer_t timerG; + tsip_timer_t timerL; + tsip_timer_t timerX; +} +tsip_transac_ist_t; + +tsip_transac_ist_t* tsip_transac_ist_create(int32_t cseq_value, const char* callid, tsip_transac_dst_t* dst); +int tsip_transac_ist_start(tsip_transac_ist_t *self, const tsip_request_t* request); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_transac_ist_def_t; + +TSIP_END_DECLS + +#endif /* TINYSIP_TRANSAC_IST_H */ + diff --git a/tinySIP/include/tinysip/transactions/tsip_transac_layer.h b/tinySIP/include/tinysip/transactions/tsip_transac_layer.h new file mode 100644 index 0000000..acc532c --- /dev/null +++ b/tinySIP/include/tinysip/transactions/tsip_transac_layer.h @@ -0,0 +1,72 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_transac.h + * @brief SIP transaction layer. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_TRANSAC_LAYER_H +#define TINYSIP_TRANSAC_LAYER_H + +#include "tinysip_config.h" + +#include "tsip.h" +#include "tinysip/transactions/tsip_transac.h" + +#include "tsk_safeobj.h" +#include "tsk_list.h" + +TSIP_BEGIN_DECLS + +typedef struct tsip_transac_layer_s +{ + TSK_DECLARE_OBJECT; + + const struct tsip_stack_s *stack; + + tsip_transacs_L_t *transactions; + + TSK_DECLARE_SAFEOBJ; +} +tsip_transac_layer_t; + +typedef tsk_list_t tsip_transac_layers_L_t; +TINYSIP_GEXTERN const tsk_object_def_t *tsip_transac_layer_def_t; + +tsip_transac_layer_t* tsip_transac_layer_create(tsip_stack_t* stack); + +tsip_transac_t* tsip_transac_layer_new(const tsip_transac_layer_t *self, tsk_bool_t isCT, const tsip_message_t* msg, tsip_transac_dst_t* dst); +int tsip_transac_layer_remove(tsip_transac_layer_t *self, const tsip_transac_t *transac); +int tsip_transac_layer_cancel_by_dialog(tsip_transac_layer_t *self, const struct tsip_dialog_s* dialog); + +tsip_transac_t* tsip_transac_layer_find_client(const tsip_transac_layer_t *self, const tsip_message_t* message); +tsip_transac_t* tsip_transac_layer_find_server(const tsip_transac_layer_t *self, const tsip_message_t* message); + +int tsip_transac_layer_handle_incoming_msg(const tsip_transac_layer_t *self, const tsip_message_t* message); + +TSIP_END_DECLS + +#endif /* TINYSIP_TRANSAC_LAYER_H */ + diff --git a/tinySIP/include/tinysip/transactions/tsip_transac_nict.h b/tinySIP/include/tinysip/transactions/tsip_transac_nict.h new file mode 100644 index 0000000..4052bd0 --- /dev/null +++ b/tinySIP/include/tinysip/transactions/tsip_transac_nict.h @@ -0,0 +1,61 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_transac_nict.h + * @brief SIP Non-INVITE Client Transaction as per RFC 3261 subcaluse 17.1.2. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_TRANSAC_NICT_H +#define TINYSIP_TRANSAC_NICT_H + +#include "tinysip_config.h" + +#include "tinysip/transactions/tsip_transac.h" +#include "tinysip/tsip_message.h" + +TSIP_BEGIN_DECLS + +#define TSIP_TRANSAC_NICT(self) ((tsip_transac_nict_t*)(self)) + +typedef struct tsip_transac_nict +{ + TSIP_DECLARE_TRANSAC; + + tsip_request_t* request; + tsip_timer_t timerE; + tsip_timer_t timerF; + tsip_timer_t timerK; +} +tsip_transac_nict_t; + +tsip_transac_nict_t* tsip_transac_nict_create(int32_t cseq_value, const char* cseq_method, const char* callid, tsip_transac_dst_t* dst); +int tsip_transac_nict_start(tsip_transac_nict_t *self, const tsip_request_t* request); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_transac_nict_def_t; + +TSIP_END_DECLS + +#endif /* TINYSIP_TRANSAC_NICT_H */ + diff --git a/tinySIP/include/tinysip/transactions/tsip_transac_nist.h b/tinySIP/include/tinysip/transactions/tsip_transac_nist.h new file mode 100644 index 0000000..f2234a1 --- /dev/null +++ b/tinySIP/include/tinysip/transactions/tsip_transac_nist.h @@ -0,0 +1,59 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_transac_nist.h + * @brief SIP Non-INVITE Server Transaction as per RFC 3261 subclause 17.2.2. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_TRANSAC_NIST_H +#define TINYSIP_TRANSAC_NIST_H + +#include "tinysip_config.h" + +#include "tinysip/transactions/tsip_transac.h" +#include "tinysip/tsip_message.h" + +TSIP_BEGIN_DECLS + +#define TSIP_TRANSAC_NIST(self) ((tsip_transac_nist_t*)(self)) + +typedef struct tsip_transac_nist +{ + TSIP_DECLARE_TRANSAC; + + tsip_response_t* lastResponse; + tsip_timer_t timerJ; +} +tsip_transac_nist_t; + +tsip_transac_nist_t* tsip_transac_nist_create(int32_t cseq_value, const char* cseq_method, const char* callid, tsip_transac_dst_t* dst); +int tsip_transac_nist_start(tsip_transac_nist_t *self, const tsip_request_t* request); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_transac_nist_def_t; + +TSIP_END_DECLS + +#endif /* TINYSIP_TRANSAC_NIST_H */ + diff --git a/tinySIP/include/tinysip/transports/tsip_transport.h b/tinySIP/include/tinysip/transports/tsip_transport.h new file mode 100644 index 0000000..44ffd16 --- /dev/null +++ b/tinySIP/include/tinysip/transports/tsip_transport.h @@ -0,0 +1,187 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_transport.h + * @brief SIP transport. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_TRANSPORT_H +#define TINYSIP_TRANSPORT_H + +#include "tinysip_config.h" + +#include "tinysip/tsip_message.h" + +#include "tnet_transport.h" + +#include "tsk_object.h" +#include "tsk_list.h" +#include "tsk_string.h" + + +TSIP_BEGIN_DECLS + +#define TSIP_TRANSPORT(self) ((tsip_transport_t*)(self)) + +enum { + TSIP_TRANSPORT_IDX_UDP, + TSIP_TRANSPORT_IDX_DTLS, + TSIP_TRANSPORT_IDX_TCP, + TSIP_TRANSPORT_IDX_TLS, + TSIP_TRANSPORT_IDX_WS, + TSIP_TRANSPORT_IDX_WSS, + + TSIP_TRANSPORT_IDX_MAX +}; + +typedef struct tsip_transport_idx_xs +{ + int idx; + const char* name; + enum tnet_socket_type_e type; +} +tsip_transport_idx_xt; + +const tsip_transport_idx_xt* tsip_transport_get_by_name(const char* name); +int tsip_transport_get_idx_by_name(const char* name); +enum tnet_socket_type_e tsip_transport_get_type_by_name(const char* name); + +typedef struct tsip_transport_stream_peer_s +{ + TSK_DECLARE_OBJECT; + + tnet_fd_t local_fd; // not owner: do not close + enum tnet_socket_type_e type; + tsk_bool_t connected; + uint64_t time_latest_activity; // in milliseconds + uint64_t time_added; // in milliseconds + tsk_bool_t got_valid_sip_msg; // whether we got at least one valid SIP message on this peer + + tsk_buffer_t *rcv_buff_stream; + tsk_buffer_t *snd_buff_stream; + + // list of dialogs managed by this peer + tsk_strings_L_t *dialogs_cids; + + // temp buffers used to send/recv websocket data before (un)masking + struct{ + void* rcv_buffer; + uint64_t rcv_buffer_size; + void* snd_buffer; + uint64_t snd_buffer_size; + tsk_bool_t handshaking_done; + } ws; + + tnet_ip_t remote_ip; + tnet_port_t remote_port; +} +tsip_transport_stream_peer_t; +TINYSIP_GEXTERN const tsk_object_def_t *tsip_transport_stream_peer_def_t; +typedef tsk_list_t tsip_transport_stream_peers_L_t; + +typedef struct tsip_transport_s +{ + TSK_DECLARE_OBJECT; + + tsk_bool_t initialized; + + int32_t idx; + + const struct tsip_stack_s *stack; + + tnet_socket_type_t type; + struct sockaddr_storage pcscf_addr; + tnet_fd_t connectedFD; + tnet_transport_handle_t *net_transport; + + const char *scheme; + const char *protocol; + const char *via_protocol; + const char *service; /**< NAPTR service name */ + + tsip_transport_stream_peers_L_t* stream_peers; + int32_t stream_peers_count; +} +tsip_transport_t; + +#define TSIP_DECLARE_TRANSPORT tsip_transport_t __transport__ +typedef tsk_list_t tsip_transports_L_t; /**< List of @ref tsip_transport_t elements. */ + +int tsip_transport_init(tsip_transport_t* self, tnet_socket_type_t type, const struct tsip_stack_s *stack, const char *host, tnet_port_t port, const char* description); +int tsip_transport_deinit(tsip_transport_t* self); + +int tsip_transport_tls_set_certs(tsip_transport_t *self, const char* ca, const char* pbk, const char* pvk); +tsk_size_t tsip_transport_send(const tsip_transport_t* self, const char *branch, tsip_message_t *msg, const char* destIP, int32_t destPort); +tsk_size_t tsip_transport_send_raw(const tsip_transport_t* self, const char* dst_host, tnet_port_t dst_port, const void* data, tsk_size_t size, const char* callid); +tsk_size_t tsip_transport_send_raw_ws(const tsip_transport_t* self, tnet_fd_t local_fd, const void* data, tsk_size_t size, const char* callid); +tsip_uri_t* tsip_transport_get_uri(const tsip_transport_t *self, int lr); + +int tsip_transport_add_stream_peer_2(tsip_transport_t *self, tnet_fd_t local_fd, enum tnet_socket_type_e type, tsk_bool_t connected, const char* remote_host, tnet_port_t remote_port); +#define tsip_transport_add_stream_peer(self, local_fd, type, connected) tsip_transport_add_stream_peer_2((self), (local_fd), (type), (connected), tsk_null, 0) +#define tsip_transport_stream_peers_lock(self) tsk_list_lock((self)->stream_peers) +#define tsip_transport_stream_peers_unlock(self) tsk_list_unlock((self)->stream_peers) +tsip_transport_stream_peer_t* tsip_transport_find_stream_peer_by_local_fd(tsip_transport_t *self, tnet_fd_t local_fd); +tsip_transport_stream_peer_t* tsip_transport_pop_stream_peer_by_local_fd(tsip_transport_t *self, tnet_fd_t local_fd); +tsip_transport_stream_peer_t* tsip_transport_find_stream_peer_by_remote_ip(tsip_transport_t *self, const char* remote_ip, tnet_port_t remote_port, enum tnet_socket_type_e type); +tsk_bool_t tsip_transport_have_stream_peer_with_remote_ip(tsip_transport_t *self, const char* remote_ip, tnet_port_t remote_port, enum tnet_socket_type_e type); +tsk_bool_t tsip_transport_have_stream_peer_with_local_fd(tsip_transport_t *self, tnet_fd_t local_fd); +int tsip_transport_remove_stream_peer_by_local_fd(tsip_transport_t *self, tnet_fd_t local_fd); +int tsip_transport_remove_callid_from_stream_peers(tsip_transport_t *self, const char* callid, tsk_bool_t* removed); +tsk_bool_t tsip_transport_stream_peer_have_callid(const tsip_transport_stream_peer_t* self, const char* callid); +int tsip_transport_stream_peer_add_callid(tsip_transport_stream_peer_t* self, const char* callid); +int tsip_transport_stream_peer_remove_callid(tsip_transport_stream_peer_t* self, const char* callid, tsk_bool_t *removed); +int tsip_transport_stream_peers_cleanup(tsip_transport_t *self); + +#define tsip_transport_tls_set_certs(transport, ca, pbk, pvk, verify) (transport ? tnet_transport_tls_set_certs(transport->net_transport, ca, pbk, pvk, verify) : -1) +#define tsip_transport_start(transport) (transport ? tnet_transport_start(transport->net_transport) : -1) +#define tsip_transport_isready(transport) (transport ? tnet_transport_isready(transport->net_transport) : -1) +#define tsip_transport_issecure(transport) (transport ? tnet_transport_issecure(transport->net_transport) : 0) +#define tsip_transport_isconnected(transport) (transport ? tnet_transport_isconnected(transport->net_transport, transport->connectedFD) : 0) +#define tsip_transport_get_description(transport) (transport ? tnet_transport_get_description(transport->net_transport) : 0) +#define tsip_transport_get_ip_n_port(transport, ip, port) (transport ? tnet_transport_get_ip_n_port(transport->net_transport, transport->connectedFD, ip, port) : -1) +#define tsip_transport_get_public_ip_n_port(transport, ip, port) (transport ? tnet_transport_get_public_ip_n_port(transport->net_transport, transport->connectedFD, ip, port) : -1) + +#define tsip_transport_connectto(transport, host, port, type) (transport ? (transport->connectedFD=tnet_transport_connectto(transport->net_transport, host, port, type)) : TNET_INVALID_FD) +#define tsip_transport_connectto_2(transport, host, port) (transport ? (transport->connectedFD=tnet_transport_connectto_2(transport->net_transport, host, port)) : TNET_INVALID_FD) + +#define tsip_transport_set_callback(transport, callback, callback_data) (transport ? tnet_transport_set_callback(transport->net_transport, callback, callback_data) : -1) + +#define tsip_transport_have_socket(transport, fd) (transport ? tnet_transport_have_socket(transport->net_transport, fd) : 0) +#define tsip_transport_add_socket(transport, fd, type, take_ownership, isClient) (transport ? tnet_transport_add_socket(transport->net_transport, fd, type, take_ownership, isClient, tsk_null) : -1) +#define tsip_transport_remove_socket(transport, fd) (transport ? tnet_transport_remove_socket(transport->net_transport, fd) : -1) + +//#define tsip_transport_get_socket_type(transport) (transport ? tnet_transport_get_socket_type(transport->net_transport) : tnet_socket_type_invalid) + +#define tsip_transport_shutdown(transport) (transport ? tnet_transport_shutdown(transport->net_transport) : -1) + +tsip_transport_t* tsip_transport_create(struct tsip_stack_s* stack, const char* host, tnet_port_t port, tnet_socket_type_t type, const char* description); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_transport_def_t; + +TSIP_END_DECLS + +#endif /* TINYSIP_TRANSPORT_H */ + + diff --git a/tinySIP/include/tinysip/transports/tsip_transport_ipsec.h b/tinySIP/include/tinysip/transports/tsip_transport_ipsec.h new file mode 100644 index 0000000..d67c3ad --- /dev/null +++ b/tinySIP/include/tinysip/transports/tsip_transport_ipsec.h @@ -0,0 +1,86 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_transport_ipsec.h + * @brief SIP/IPSec transport. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_TRANSPORT_IPSEC_H +#define TINYSIP_TRANSPORT_IPSEC_H + +#include "tinysip_config.h" + +#include "tinysip/transports/tsip_transport.h" + +#include "tinysip/headers/tsip_header_Security_Verify.h" + +#include "tipsec.h" + +TSIP_BEGIN_DECLS + +#define TSIP_TRANSPORT_IPSEC(self) ((tsip_transport_ipsec_t*)(self)) + +typedef struct tsip_ipsec_association_s +{ + TSK_DECLARE_OBJECT; + + const tsip_transport_t* transport; + + tipsec_ctx_t* ctx; + + tnet_socket_t *socket_uc; + tnet_socket_t *socket_us; + + tnet_ip_t ip_remote; + tnet_ip_t ip_local; + tnet_port_t port_local; +} +tsip_ipsec_association_t; + +typedef struct tsip_transport_ipsec_s +{ + TSIP_DECLARE_TRANSPORT; + + tsip_header_Security_Verifies_L_t* secVerifies; + + tsip_ipsec_association_t* asso_active; + tsip_ipsec_association_t* asso_temporary; +} +tsip_transport_ipsec_t; + +tsip_transport_ipsec_t* tsip_transport_ipsec_create(struct tsip_stack_s* stack, const char* host, tnet_port_t port, tnet_socket_type_t type, const char* description); + +int tsip_transport_ipsec_createTempSAs(tsip_transport_ipsec_t* self); +int tsip_transport_ipsec_ensureTempSAs(tsip_transport_ipsec_t* self, const tsip_response_t *r401_407, int64_t expires); +int tsip_transport_ipsec_startSAs(tsip_transport_ipsec_t* self, const tipsec_key_t* ik, const tipsec_key_t* ck); +int tsip_transport_ipsec_cleanupSAs(tsip_transport_ipsec_t* self); +tnet_fd_t tsip_transport_ipsec_getFD(tsip_transport_ipsec_t* self, int isRequest); +int tsip_transport_ipsec_updateMSG(tsip_transport_ipsec_t* self, tsip_message_t *msg); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_transport_ipsec_def_t; + +TSIP_END_DECLS + +#endif /* TINYSIP_TRANSPORT_IPSEC_H */ diff --git a/tinySIP/include/tinysip/transports/tsip_transport_layer.h b/tinySIP/include/tinysip/transports/tsip_transport_layer.h new file mode 100644 index 0000000..35c4380 --- /dev/null +++ b/tinySIP/include/tinysip/transports/tsip_transport_layer.h @@ -0,0 +1,77 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_transport_layer.h + * @brief SIP transport layer. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_TRANSPORT_LAYER_H +#define TINYSIP_TRANSPORT_LAYER_H + +#include "tinysip_config.h" + +#include "tinysip/transports/tsip_transport.h" +#include "tinysip/tsip_message.h" +#include "tsip.h" + +TSIP_BEGIN_DECLS + +typedef struct tsip_transport_layer_s +{ + TSK_DECLARE_OBJECT; + + const tsip_stack_t *stack; + + tsk_bool_t running; + tsip_transports_L_t *transports; +} +tsip_transport_layer_t; + +tsip_transport_layer_t* tsip_transport_layer_create(tsip_stack_t *stack); +const tsip_transport_t* tsip_transport_layer_find_by_type(const tsip_transport_layer_t* self, tnet_socket_type_t type); +const tsip_transport_t* tsip_transport_layer_find_by_idx(const tsip_transport_layer_t* self, int32_t idx); + +int tsip_transport_layer_add(tsip_transport_layer_t* self, const char* local_host, tnet_port_t local_port, tnet_socket_type_t type, const char* description); +int tsip_transport_layer_remove(tsip_transport_layer_t* self, const char* description); + +int tsip_transport_layer_send(const tsip_transport_layer_t* self, const char *branch, tsip_message_t *msg); + +int tsip_transport_createTempSAs(const tsip_transport_layer_t *self); +int tsip_transport_ensureTempSAs(const tsip_transport_layer_t *self, const tsip_response_t *r401_407, int64_t expires); +int tsip_transport_startSAs(const tsip_transport_layer_t* self, const void* ik, const void* ck); +int tsip_transport_cleanupSAs(const tsip_transport_layer_t *self); + +int tsip_transport_layer_remove_callid_from_stream_peers(tsip_transport_layer_t *self, const char* callid); +tsk_bool_t tsip_transport_layer_have_stream_peer_with_remote_ip(const tsip_transport_layer_t *self, const char* remote_ip, tnet_port_t remote_port); + +int tsip_transport_layer_start(tsip_transport_layer_t* self); +int tsip_transport_layer_shutdown(tsip_transport_layer_t* self); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_transport_layer_def_t; + +TSIP_END_DECLS + +#endif /* TINYSIP_TRANSPORT_LAYER_H */ + diff --git a/tinySIP/include/tinysip/transports/tsip_transport_tls.h b/tinySIP/include/tinysip/transports/tsip_transport_tls.h new file mode 100644 index 0000000..106a562 --- /dev/null +++ b/tinySIP/include/tinysip/transports/tsip_transport_tls.h @@ -0,0 +1,41 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_transport_tls.h + * @brief SIP/TLS transport. + * + * @author Mamadou Diop + * + */ +#ifndef TINYSIP_TRANSPORT_TLS_H +#define TINYSIP_TRANSPORT_TLS_H + +#include "tinysip_config.h" + +#include "tinysip/transports/tsip_transport.h" + +TSIP_BEGIN_DECLS + + +TSIP_END_DECLS + +#endif /* TINYSIP_TRANSPORT_TLS_H */ diff --git a/tinySIP/include/tinysip/tsip_action.h b/tinySIP/include/tinysip/tsip_action.h new file mode 100644 index 0000000..868421a --- /dev/null +++ b/tinySIP/include/tinysip/tsip_action.h @@ -0,0 +1,171 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_action.h + * @brief SIP action. + * + * @author Mamadou Diop + * + + */ +#ifndef TSIP_ACTION_H +#define TSIP_ACTION_H + +#include "tinysip_config.h" + +#include "tsk_buffer.h" +#include "tsk_options.h" +#include "tsk_params.h" + +#include "tinymedia/tmedia_common.h" +#include "tinymedia/tmedia_params.h" + +TSIP_BEGIN_DECLS + +typedef uint64_t tsip_action_id_t; +#define TSIP_ACTION_INVALID_ID 0 +#define TSIP_ACTION_INVALID_HANDLE tsk_null + +/** List of all supported actions */ +typedef enum tsip_action_type_e +{ + //! Used as configuration action + tsip_atype_config, + tsip_atype_dtmf_send, + + /* === REGISTER == */ + tsip_atype_register, /**< Sends SIP REGISTER request */ + //! Unregister by sending SIP REGISTER request with expires value equals to zero +#define tsip_atype_unregister tsip_atype_hangup + + /* === SUBSCRIBE === */ + tsip_atype_subscribe, /**< Sends SIP SUBSCRIBE request */ + //! Unsubsribe by sending SIP SUBSCRIBE request with expires value equals to zero +#define tsip_atype_unsubscribe tsip_atype_hangup + + /* === MESSAGE === */ + tsip_atype_message_send, /**< Sends SIP MESSAGE request */ + + /* === INFO === */ + tsip_atype_info_send, /**< Sends SIP INFO request */ + + /* === PUBLISH === */ + tsip_atype_publish, /**< Sends SIP PUBLISH request */ + //! Unpublish by sending SIP PUBLISH request with expires value equals to zero +#define tsip_atype_unpublish tsip_atype_hangup + + /* === OPTIONS === */ + tsip_atype_options_send, /**< Sends SIP OPTIONS request */ + + /* === INVITE === */ + tsip_atype_invite, /**< Sends SIP INVITE/reINVITE request */ + tsip_atype_hold, /**< Puts the session on hold state */ + tsip_atype_resume, /**< Resumes a previously held session */ + tsip_atype_ect, /**< Transfer the call */ + tsip_atype_ect_accept, /**< Accept call transfer request */ + tsip_atype_ect_reject, /**< Reject call transfer request */ + tsip_atype_ect_lnotify, /**< Intra-Dialog notify. Never called by the end-user */ + tsip_atype_lmessage, /**< Large message (MSRP). The session must be connected */ +#define tsip_atype_bye tsip_atype_hangup + + + /* === common === */ + //! Accept incoming call (INVITE) or message (SIP MESSAGE) + tsip_atype_accept, + //! Reject incoming call (INVITE) or message (SIP MESSAGE) +#define tsip_atype_reject tsip_atype_hangup + //! Cancel an outgoing request + tsip_atype_cancel, + //! Hangup any SIP dialog (BYE, unREGISTER, unSUBSCRIBE ...). If the dialog is in early state, then it will be canceled. + tsip_atype_hangup, + //! Shutdown a SIP dialog. Should only be called by the stack. + tsip_atype_shutdown, + //! Signal transport error. Should only be called by the stack. + tsip_atype_transport_error, +} +tsip_action_type_t; + +/* internal enum used to pass parameters from the application layer to the stack */ +typedef enum tsip_action_param_type_e +{ + aptype_null = 0, + + aptype_header, + aptype_config, + aptype_payload, + aptype_resp_line, + aptype_media_type, + aptype_media, +} +tsip_action_param_type_t; + +#define TSIP_ACTION_SET_HEADER(NAME_STR, VALUE_STR) aptype_header, (const char*)NAME_STR, (const char*)VALUE_STR +#define TSIP_ACTION_SET_PAYLOAD(PAY_PTR, PAY_SIZE) aptype_payload, (const void*)PAY_PTR, (tsk_size_t)PAY_SIZE +#define TSIP_ACTION_SET_RESP_LINE(CODE_INT, PHRASE_STR) aptype_resp_line, (int32_t)CODE_INT, (const char*)PHRASE_STR +#define TSIP_ACTION_SET_CONFIG(ACTION_CONFIG_HANDLE) aptype_config, (const tsip_action_handle_t*)ACTION_CONFIG_HANDLE +#define TSIP_ACTION_SET_MEDIA_TYPE(TYPE_ENUM) aptype_media_type, (enum tmedia_type_e)TYPE_ENUM +#define TSIP_ACTION_SET_MEDIA(...) aptype_media, ##__VA_ARGS__ +#define TSIP_ACTION_SET_NULL() aptype_null + +/* private action object. public api should use tsip_action_handle_t. */ +typedef struct tsip_action_s +{ + TSK_DECLARE_OBJECT; + + tsip_action_type_t type; + tsk_params_L_t *headers; + tsk_buffer_t* payload; + + struct{ + short code; + char* phrase; + } line_resp; + + struct{ + tmedia_type_t type; + tmedia_params_L_t *params; + } media; + + struct{ + int volume; // useless (manager will always use "10") + int event; + } dtmf; + + struct{ + char* to; + } ect; +} +tsip_action_t; + +/**< Handle to SIP action */ +typedef void tsip_action_handle_t; + +TINYSIP_API tsip_action_handle_t* tsip_action_create(tsip_action_type_t type, ...); +TINYSIP_API int tsip_action_set(tsip_action_handle_t* self, ...); + +typedef tsk_list_t tsip_actions_L_t; /**< List of @ref tsip_action_handle_t elements. */ +TINYSIP_GEXTERN const tsk_object_def_t *tsip_action_def_t; + +TSIP_END_DECLS + +#endif /* TSIP_ACTION_H */ + diff --git a/tinySIP/include/tinysip/tsip_event.h b/tinySIP/include/tinysip/tsip_event.h new file mode 100644 index 0000000..91e8f4e --- /dev/null +++ b/tinySIP/include/tinysip/tsip_event.h @@ -0,0 +1,113 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_event.h + * @brief SIP event. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_TSIP_EVENT_H +#define TINYSIP_TSIP_EVENT_H + +#include "tinysip_config.h" + +#include "tinysip/tsip_ssession.h" + +TSIP_BEGIN_DECLS + +#define TSIP_EVENT(self) ((tsip_event_t*)(self)) + +typedef enum tsip_event_type_e +{ + tsip_event_invite, + tsip_event_message, + tsip_event_info, + tsip_event_options, + tsip_event_publish, + tsip_event_register, + tsip_event_subscribe, + + tsip_event_dialog, + tsip_event_stack, +} +tsip_event_type_t; + +/* SIP codes associated to an internal event */ +// 100-699 are reserved codes + +// 7xx ==> errors @tinyWRAP +#define tsip_event_code_dialog_transport_error 702 +#define tsip_event_code_dialog_global_error 703 +#define tsip_event_code_dialog_message_error 704 + +// 8xx ==> success @tinyWRAP +#define tsip_event_code_dialog_request_incoming 800 +#define tsip_event_code_dialog_request_outgoing 802 +#define tsip_event_code_dialog_request_cancelled 803 +#define tsip_event_code_dialog_request_sent 804 + +// 9xx ==> Informational @tinyWRAP +#define tsip_event_code_dialog_connecting 900 +#define tsip_event_code_dialog_connected 901 +#define tsip_event_code_dialog_terminating 902 +#define tsip_event_code_dialog_terminated 903 +#define tsip_event_code_stack_starting 950 +#define tsip_event_code_stack_started 951 +#define tsip_event_code_stack_stopping 952 +#define tsip_event_code_stack_stopped 953 +#define tsip_event_code_stack_failed_to_start 954 +#define tsip_event_code_stack_failed_to_stop 955 +#define tsip_event_code_stack_disconnected 956 + + +typedef struct tsip_event_s +{ + TSK_DECLARE_OBJECT; + + tsip_ssession_handle_t* ss; + + short code; + char *phrase; + + tsip_event_type_t type; + struct tsip_message_s *sipmessage; + + //! copy of stack user data (needed by sessionless events) + const void* userdata; +} +tsip_event_t; +#define TSIP_DECLARE_EVENT tsip_event_t __sipevent__ + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_event_def_t; + +int tsip_event_init(tsip_event_t* self, tsip_ssession_t* ss, short code, const char *phrase, const struct tsip_message_s* sipmessage, tsip_event_type_t type); +int tsip_event_signal(tsip_event_type_t type, tsip_ssession_t* ss, short code, const char *phrase); +int tsip_event_signal_2(tsip_event_type_t type, tsip_ssession_t* ss, short code, const char *phrase, const struct tsip_message_s* sipmessage); +int tsip_event_deinit(tsip_event_t* self); + +typedef int (*tsip_stack_callback_f)(const tsip_event_t *sipevent); + +TSIP_END_DECLS + +#endif /* TINYSIP_TSIP_EVENT_H */ diff --git a/tinySIP/include/tinysip/tsip_message.h b/tinySIP/include/tinysip/tsip_message.h new file mode 100644 index 0000000..d0442ea --- /dev/null +++ b/tinySIP/include/tinysip/tsip_message.h @@ -0,0 +1,216 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_message.h + * @brief Represents a SIP message. A SIP message is either a request from a client to a server, or a + * response from a server to a client. See RFC 3261 suc-bclause 7. + * + * @author Mamadou Diop + * + + */ +#ifndef TSIP_MESSAGE_H +#define TSIP_MESSAGE_H + +#include "tinysip_config.h" + +#include "tinysip/tsip_message_common.h" + +#include "tinysip/headers/tsip_header_Call_ID.h" +#include "tinysip/headers/tsip_header_Contact.h" +#include "tinysip/headers/tsip_header_Content_Length.h" +#include "tinysip/headers/tsip_header_Content_Type.h" +#include "tinysip/headers/tsip_header_CSeq.h" +#include "tinysip/headers/tsip_header_Expires.h" +#include "tinysip/headers/tsip_header_From.h" +#include "tinysip/headers/tsip_header_P_Access_Network_Info.h" +#include "tinysip/headers/tsip_header_To.h" +#include "tinysip/headers/tsip_header_Via.h" + +#include "tnet_types.h" +#include "tnet_socket.h" + +#include "tsk_object.h" +#include "tsk_buffer.h" + +TSIP_BEGIN_DECLS + +///** +// * @struct tsip_request_line_t +// * +// * @brief Defines SIP request header line. +// * ABNF: Request-Line = Method SP Request-URI SP SIP-Version CRLF +// * Ref: RFC 3261 subclause 7.1. +// * @sa tsip_status_line_t. +// * +// * @author Mamadou +// * @date 12/3/2009 +//**/ +//typedef struct tsip_request_line_s +//{ +// char *method; /**< SIP method name. e.g REGISTER, ACK or INVITE.*/ +// tsip_uri_t *uri; /**< The Request-URI is a SIP or SIPS URI as described in Section 19.1 or a general URI (RFC 2396 [5]). It indicates +// the user or service to which this request is being addressed. The Request-URI MUST NOT contain unescaped spaces or control +// characters and MUST NOT be enclosed in "<>". */ +//} +//tsip_request_line_t; +// +///** +// * @struct tsip_status_line_t +// * +// * @brief Defines SIP response status line. +// * ABNF: Status-Line = SIP-Version SP Status-Code SP Reason-Phrase CRLF +// * Ref: RFC 3261 subclause 7.2. +// * @sa tsip_request_line_t. +// * +// * @author Mamadou +// * @date 12/3/2009 +//**/ +//typedef struct tsip_status_line_s +//{ +// short status_code; /**< 3-digit integer result code that indicates the outcome of an attempt to understand and satisfy a request. */ +// char *reason_phrase; /**< Textual description related to the status code. */ +//} +//tsip_status_line_t; + +/** + * @struct tsip_message_t + * + * @brief Represents a SIP message. A SIP message is either a request from a client to a server, + * or a response from a server to a client. See RFC 3261 suc-bclause 7. + * You must call @ref tsip_message_create to create a sip message and TSK_OBJECT_SAFE_FREE to free the message. + * + * @author Mamadou + * @date 12/2/2009 +**/ +typedef struct tsip_message_s +{ + TSK_DECLARE_OBJECT; + + char *sip_version; /**< The SIP version. Only 'SIP/2.0' is supported. */ + tsip_message_type_t type; /**< The type of this SIP message. */ + + /* Request Line */ + union{ + struct{ + char *method; /**< SIP method name. e.g REGISTER, ACK or INVITE.*/ + tsip_uri_t *uri; /**< The Request-URI is a SIP or SIPS URI as described in Section 19.1 or a general URI (RFC 2396 [5]). It indicates + the user or service to which this request is being addressed. The Request-URI MUST NOT contain unescaped spaces or control + characters and MUST NOT be enclosed in "<>". */ + tsip_request_type_t request_type; + } request; + struct{ + short status_code; /**< 3-digit integer result code that indicates the outcome of an attempt to understand and satisfy a request. */ + char *reason_phrase; /**< Textual description related to the status code. */ + } response; + } line; + + + /*== MOST COMMON HEADERS. */ + tsip_header_Via_t *firstVia; /**< First Via header. */ + tsip_header_From_t *From; + tsip_header_To_t *To; + tsip_header_Contact_t *Contact; + tsip_header_Call_ID_t *Call_ID; + tsip_header_CSeq_t *CSeq; + tsip_header_Expires_t *Expires; + + tsip_header_Content_Type_t *Content_Type; + tsip_header_Content_Length_t *Content_Length; + tsk_buffer_t *Content; + + /*== OTHER HEADERS*/ + tsip_headers_L_t *headers; + + /*== to hack the message */ + char* sigcomp_id; + tnet_fd_t local_fd; + struct sockaddr_storage remote_addr; // Only valid for Dgram + tsk_bool_t update; + enum tnet_socket_type_e src_net_type; + enum tnet_socket_type_e dst_net_type; + char* dst_address; + tnet_port_t dst_port; +} +tsip_message_t; + +typedef tsip_message_t tsip_request_t; /**< SIP request message. */ +typedef tsip_message_t tsip_response_t; /**< SIP response message. */ + + +TINYSIP_API int tsip_message_add_header(tsip_message_t *self, const tsip_header_t *hdr); +TINYSIP_API int tsip_message_add_headers(tsip_message_t *self, ...); +TINYSIP_API int tsip_message_add_content(tsip_message_t *self, const char* content_type, const void* content, tsk_size_t size); + +#if defined(__SYMBIAN32__) && 0 +static void TSIP_MESSAGE_ADD_HEADER(tsip_message_t *self, ...) + { + va_list ap; + tsip_header_t *header; + const tsk_object_def_t *objdef; + + va_start(ap, self); + objdef = va_arg(ap, const tsk_object_def_t*); + header = (tsip_header_t *)tsk_object_new_2(objdef, &ap); + va_end(ap); + + tsip_message_add_header(self, header); + tsk_object_unref(header); + } +#else +#define TSIP_MESSAGE_ADD_HEADER(self, objdef, ...) \ + { \ + tsip_header_t *header = (tsip_header_t *)tsk_object_new(objdef, ##__VA_ARGS__); \ + tsip_message_add_header(self, header); \ + tsk_object_unref(header); \ + } +#endif + +TINYSIP_API const tsip_header_t *tsip_message_get_headerAt(const tsip_message_t *self, tsip_header_type_t type, tsk_size_t index); +TINYSIP_API const tsip_header_t *tsip_message_get_headerLast(const tsip_message_t *self, tsip_header_type_t type); +TINYSIP_API const tsip_header_t *tsip_message_get_header(const tsip_message_t *self, tsip_header_type_t type); +TINYSIP_API tsk_bool_t tsip_message_allowed(const tsip_message_t *self, const char* method); +TINYSIP_API tsk_bool_t tsip_message_supported(const tsip_message_t *self, const char* option); +TINYSIP_API tsk_bool_t tsip_message_required(const tsip_message_t *self, const char* option); + + + +TINYSIP_API int64_t tsip_message_getExpires(const tsip_message_t *message); +TINYSIP_API uint32_t tsip_message_getContent_length(const tsip_message_t *message); +TINYSIP_API int32_t tsip_message_getCSeq(const tsip_message_t *message); + +TINYSIP_API int tsip_message_tostring(const tsip_message_t *self, tsk_buffer_t *output); + +TINYSIP_API tsip_request_type_t tsip_request_get_type(const char* method); +TINYSIP_API tsip_request_t *tsip_request_new(const char* method, const tsip_uri_t *request_uri, const tsip_uri_t *from, const tsip_uri_t *to, const char *call_id, int32_t cseq); +TINYSIP_API tsip_response_t *tsip_response_new(short status_code, const char* reason_phrase, const tsip_request_t *request); + +TINYSIP_API tsip_message_t* tsip_message_create(); +TINYSIP_API tsip_request_t* tsip_request_create(const char* method, const tsip_uri_t* uri); +TINYSIP_API tsip_response_t* tsip_response_create(const tsip_request_t* request, short status_code, const char* reason_phrase); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_message_def_t; + +TSIP_END_DECLS + +#endif /* TSIP_MESSAGE_H */ + diff --git a/tinySIP/include/tinysip/tsip_message_common.h b/tinySIP/include/tinysip/tsip_message_common.h new file mode 100644 index 0000000..c04131c --- /dev/null +++ b/tinySIP/include/tinysip/tsip_message_common.h @@ -0,0 +1,140 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_message_common.h + * @brief Common macros and enums for SIP messages. + * Mostly used to avoid circular #includes. + * + * @author Mamadou Diop + * + + */ +#ifndef TSIP_MESSAGE_COMMON_H +#define TSIP_MESSAGE_COMMON_H + +#include "tinysip_config.h" + +TSIP_BEGIN_DECLS + +#define TSIP_MESSAGE_VERSION_10 "SIP/1.0" +#define TSIP_MESSAGE_VERSION_20 "SIP/2.0" +#define TSIP_MESSAGE_VERSION_DEFAULT TSIP_MESSAGE_VERSION_20 + +#define TSIP_MESSAGE_IS_REQUEST(self) ((self) ? (self)->type == tsip_request : tsk_false) +#define TSIP_MESSAGE_IS_RESPONSE(self) ((self) ? (self)->type == tsip_response : tsk_false) + +#define TSIP_MESSAGE(self) ((tsip_message_t*)(self)) +#define TSIP_MESSAGE_AS_RESPONSE(self) (TSIP_MESSAGE_IS_RESPONSE((self)) ? (tsip_response_t*)(self) : tsk_null) +#define TSIP_MESSAGE_AS_REQUEST(self) (TSIP_MESSAGE_IS_REQUEST((self)) ? (tsip_request_t*)(self) : tsk_null) + + +#define TSIP_RESPONSE_CODE(self) (TSIP_MESSAGE_IS_RESPONSE((self)) ? (self)->line.response.status_code : 0) +#define TSIP_RESPONSE_PHRASE(self) (TSIP_MESSAGE_IS_RESPONSE((self)) ? (self)->line.response.reason_phrase : tsk_null) + +#define TSIP_REQUEST_METHOD(self) ((self)->line.request.method) +#define TSIP_REQUEST_URI(self) ((self)->line.request.uri) + +#define TSIP_MESSAGE_CSEQ_METHOD(self) ((self)->CSeq ? (self)->CSeq->method : tsk_null) +#define TSIP_MESSAGE_HAS_CONTENT(self) ((self) && (self)->Content && (self)->Content->data) +#define TSIP_MESSAGE_CONTENT_LENGTH(self) (uint32_t)(((self) && (self)->Content_Length) ? (self)->Content_Length->length : 0) +#define TSIP_MESSAGE_CONTENT_DATA(self) (TSIP_MESSAGE_HAS_CONTENT(self) ? (self)->Content->data : tsk_null) +#define TSIP_MESSAGE_CONTENT_DATA_LENGTH(self) (TSIP_MESSAGE_HAS_CONTENT(self) ? (self)->Content->size : 0) +#define TSIP_MESSAGE_CONTENT(self) (TSIP_MESSAGE_HAS_CONTENT(self) ? (self)->Content : tsk_null) +#define TSIP_MESSAGE_CONTENT_TYPE(self) (((self) && (self)->Content_Type) ? (self)->Content_Type->type : tsk_null) + +#define TSIP_REQUEST_IS_ACK(self) ((self) && TSIP_MESSAGE_IS_REQUEST((self)) &&((self)->line.request.request_type==tsip_ACK)) +#define TSIP_REQUEST_IS_BYE(self) ((self) && TSIP_MESSAGE_IS_REQUEST((self)) &&((self)->line.request.request_type==tsip_BYE)) +#define TSIP_REQUEST_IS_CANCEL(self) ((self) && TSIP_MESSAGE_IS_REQUEST((self)) &&((self)->line.request.request_type==tsip_CANCEL)) +#define TSIP_REQUEST_IS_INVITE(self) ((self) && TSIP_MESSAGE_IS_REQUEST((self)) &&((self)->line.request.request_type==tsip_INVITE)) +#define TSIP_REQUEST_IS_OPTIONS(self) ((self) && TSIP_MESSAGE_IS_REQUEST((self)) &&((self)->line.request.request_type==tsip_OPTIONS)) +#define TSIP_REQUEST_IS_REGISTER(self) ((self) && TSIP_MESSAGE_IS_REQUEST((self)) &&((self)->line.request.request_type==tsip_REGISTER)) +#define TSIP_REQUEST_IS_SUBSCRIBE(self) ((self) && TSIP_MESSAGE_IS_REQUEST((self)) &&((self)->line.request.request_type==tsip_SUBSCRIBE)) +#define TSIP_REQUEST_IS_NOTIFY(self) ((self) && TSIP_MESSAGE_IS_REQUEST((self)) &&((self)->line.request.request_type==tsip_NOTIFY)) +#define TSIP_REQUEST_IS_REFER(self) ((self) && TSIP_MESSAGE_IS_REQUEST((self)) &&((self)->line.request.request_type==tsip_REFER)) +#define TSIP_REQUEST_IS_INFO(self) ((self) && TSIP_MESSAGE_IS_REQUEST((self)) &&((self)->line.request.request_type==tsip_INFO)) +#define TSIP_REQUEST_IS_UPDATE(self) ((self) && TSIP_MESSAGE_IS_REQUEST((self)) &&((self)->line.request.request_type==tsip_UPDATE)) +#define TSIP_REQUEST_IS_MESSAGE(self) ((self) && TSIP_MESSAGE_IS_REQUEST((self)) &&((self)->line.request.request_type==tsip_MESSAGE)) +#define TSIP_REQUEST_IS_PUBLISH(self) ((self) && TSIP_MESSAGE_IS_REQUEST((self)) &&((self)->line.request.request_type==tsip_PUBLISH)) +#define TSIP_REQUEST_IS_PRACK(self) ((self) && TSIP_MESSAGE_IS_REQUEST((self)) &&((self)->line.request.request_type==tsip_PRACK)) + +#define TSIP_RESPONSE_IS_TO_ACK(self) ((self) && TSIP_MESSAGE_IS_RESPONSE((self)) && (self)->CSeq &&((self)->CSeq->type==tsip_ACK)) +#define TSIP_RESPONSE_IS_TO_BYE(self) ((self) && TSIP_MESSAGE_IS_RESPONSE((self)) && (self)->CSeq &&((self)->CSeq->type==tsip_BYE)) +#define TSIP_RESPONSE_IS_TO_CANCEL(self) ((self) && TSIP_MESSAGE_IS_RESPONSE((self)) && (self)->CSeq &&((self)->CSeq->type==tsip_CANCEL)) +#define TSIP_RESPONSE_IS_TO_INVITE(self) ((self) && TSIP_MESSAGE_IS_RESPONSE((self)) && (self)->CSeq &&((self)->CSeq->type==tsip_INVITE)) +#define TSIP_RESPONSE_IS_TO_OPTIONS(self) ((self) && TSIP_MESSAGE_IS_RESPONSE((self)) && (self)->CSeq &&((self)->CSeq->type==tsip_OPTIONS)) +#define TSIP_RESPONSE_IS_TO_REGISTER(self) ((self) && TSIP_MESSAGE_IS_RESPONSE((self)) && (self)->CSeq &&((self)->CSeq->type==tsip_REGISTER)) +#define TSIP_RESPONSE_IS_TO_SUBSCRIBE(self) ((self) && TSIP_MESSAGE_IS_RESPONSE((self)) && (self)->CSeq &&((self)->CSeq->type==tsip_SUBSCRIBE)) +#define TSIP_RESPONSE_IS_TO_NOTIFY(self) ((self) && TSIP_MESSAGE_IS_RESPONSE((self)) && (self)->CSeq &&((self)->CSeq->type==tsip_NOTIFY)) +#define TSIP_RESPONSE_IS_TO_REFER(self) ((self) && TSIP_MESSAGE_IS_RESPONSE((self)) && (self)->CSeq &&((self)->CSeq->type==tsip_REFER)) +#define TSIP_RESPONSE_IS_TO_INFO(self) ((self) && TSIP_MESSAGE_IS_RESPONSE((self)) && (self)->CSeq &&((self)->CSeq->type==tsip_INFO)) +#define TSIP_RESPONSE_IS_TO_UPDATE(self) ((self) && TSIP_MESSAGE_IS_RESPONSE((self)) && (self)->CSeq &&((self)->CSeq->type==tsip_UPDATE)) +#define TSIP_RESPONSE_IS_TO_MESSAGE(self) ((self) && TSIP_MESSAGE_IS_RESPONSE((self)) && (self)->CSeq &&((self)->CSeq->type==tsip_MESSAGE)) +#define TSIP_RESPONSE_IS_TO_PUBLISH(self) ((self) && TSIP_MESSAGE_IS_RESPONSE((self)) && (self)->CSeq &&((self)->CSeq->type==tsip_PUBLISH)) +#define TSIP_RESPONSE_IS_TO_PRACK(self) ((self) && TSIP_MESSAGE_IS_RESPONSE((self)) && (self)->CSeq &&((self)->CSeq->type==tsip_PRACK)) + + +#define TSIP_RESPONSE_IS(self, code) (TSIP_RESPONSE_CODE((self)) == code) +#define TSIP_RESPONSE_IS_NXX(self, N) (TSIP_MESSAGE_IS_RESPONSE((self)) && N##00<= TSIP_RESPONSE_CODE((self)) && TSIP_RESPONSE_CODE((self)) <= N##99) +#define TSIP_RESPONSE_IS_1XX(self) TSIP_RESPONSE_IS_NXX(self, 1) +#define TSIP_RESPONSE_IS_2XX(self) TSIP_RESPONSE_IS_NXX(self, 2) +#define TSIP_RESPONSE_IS_3XX(self) TSIP_RESPONSE_IS_NXX(self, 3) +#define TSIP_RESPONSE_IS_4XX(self) TSIP_RESPONSE_IS_NXX(self, 4) +#define TSIP_RESPONSE_IS_5XX(self) TSIP_RESPONSE_IS_NXX(self, 5) +#define TSIP_RESPONSE_IS_6XX(self) TSIP_RESPONSE_IS_NXX(self, 6) +#define TSIP_RESPONSE_IS_23456(self) (TSIP_MESSAGE_IS_RESPONSE((self)) && 200<= TSIP_RESPONSE_CODE((self)) && TSIP_RESPONSE_CODE((self)) <= 699) +#define TSIP_RESPONSE_IS_3456(self) (TSIP_MESSAGE_IS_RESPONSE((self)) && 300<= TSIP_RESPONSE_CODE((self)) && TSIP_RESPONSE_CODE((self)) <= 699) + +/** Defines the message type (Request or Response). +**/ +typedef enum tsip_message_type_e +{ + tsip_unknown, + tsip_request, + tsip_response +} +tsip_message_type_t; + +// SWIG +typedef enum tsip_request_type_e +{ + tsip_NONE = 0, + + tsip_ACK, + tsip_BYE, + tsip_CANCEL, + tsip_INVITE, + tsip_OPTIONS, + tsip_REGISTER, + tsip_SUBSCRIBE, + tsip_NOTIFY, + tsip_REFER, + tsip_INFO, + tsip_UPDATE, + tsip_MESSAGE, + tsip_PUBLISH, + tsip_PRACK +} +tsip_request_type_t; + +TSIP_END_DECLS + +#endif /* TSIP_MESSAGE_COMMON_H */ diff --git a/tinySIP/include/tinysip/tsip_ssession.h b/tinySIP/include/tinysip/tsip_ssession.h new file mode 100644 index 0000000..9049a96 --- /dev/null +++ b/tinySIP/include/tinysip/tsip_ssession.h @@ -0,0 +1,301 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_ssession.h + * @brief SIP ssession. + * + * @author Mamadou Diop + * + + */ +#ifndef TSIP_SSESSION_H +#define TSIP_SSESSION_H + +#include "tinysip_config.h" + +#include "tinymedia/tmedia_common.h" +#include "tinymedia/tmedia_session.h" + +#include "tsk_object.h" +#include "tsk_list.h" +#include "tsk_params.h" +#include "tsk_options.h" + +TSIP_BEGIN_DECLS + +// Forward declarations +struct tsip_message_s; +struct tsip_action_s; + +typedef uint64_t tsip_ssession_id_t; +#define TSIP_SSESSION_INVALID_ID 0 +#define TSIP_SSESSION_INVALID_HANDLE tsk_null + +#if defined(DEBUG) || defined(_DEBUG) +# define TSIP_SSESSION_EXPIRES_DEFAULT 3600000 /* miliseconds. */ +#else +# define TSIP_SSESSION_EXPIRES_DEFAULT 600000000 +#endif + + +#define TSIP_SSESSION(self) ((tsip_ssession_t*)(self)) + +typedef enum tsip_ssession_param_type_e +{ + sstype_null = 0, + + sstype_header, + sstype_caps, + sstype_userdata, + sstype_to_str, + sstype_from_str, + sstype_to_obj, + sstype_from_obj, + sstype_nocontact, + sstype_expires, + sstype_silent_hangup, + sstype_sigcomp_id, + sstype_auth_ha1, + sstype_auth_impi, + sstype_parent_id, + sstype_ws_src, + sstype_media +} +tsip_ssession_param_type_t; + +#define TSIP_SSESSION_SET_PARENT_ID(PARENT_ID_SSID) sstype_parent_id, ((tsip_ssession_id_t)PARENT_ID_SSID) +#define TSIP_SSESSION_SET_HEADER(NAME_STR, VALUE_STR) sstype_header, (const char*)NAME_STR, (const char*)VALUE_STR +#define TSIP_SSESSION_UNSET_HEADER(NAME_STR) TSIP_SSESSION_SET_HEADER(NAME_STR, (const char*)-1) +#define TSIP_SSESSION_SET_CAPS(NAME_STR, VALUE_STR) sstype_caps, (const char*)NAME_STR, (const char*)VALUE_STR /* RFC 3840 */ +#define TSIP_SSESSION_UNSET_CAPS(NAME_STR) TSIP_SSESSION_SET_CAPS(NAME_STR, (const char*)-1) +#define TSIP_SSESSION_SET_USERDATA(DATA_PTR) sstype_userdata, (const void*)DATA_PTR +#define TSIP_SSESSION_SET_TO_STR(URI_STR) sstype_to_str, (const char*)URI_STR +#define TSIP_SSESSION_SET_FROM_STR(URI_STR) sstype_from_str, (const char*)URI_STR +#define TSIP_SSESSION_SET_TO(URI_STR) TSIP_SSESSION_SET_TO_STR(URI_STR) +#define TSIP_SSESSION_SET_FROM(URI_STR) TSIP_SSESSION_SET_FROM_STR(URI_STR) +#define TSIP_SSESSION_SET_TO_OBJ(URI_OBJ) sstype_to_obj, (const tsip_uri_t*)URI_OBJ +#define TSIP_SSESSION_SET_FROM_OBJ(URI_OBJ) sstype_from_obj, (const tsip_uri_t*)URI_OBJ +#define TSIP_SSESSION_SET_NO_CONTACT(ENABLED_BOOL) sstype_nocontact, (tsk_bool_t)ENABLED_BOOL +#define TSIP_SSESSION_SET_EXPIRES(VALUE_UINT) sstype_expires, (unsigned)VALUE_UINT +#define TSIP_SSESSION_SET_SILENT_HANGUP(ENABLED_BOOL) sstype_silent_hangup, (tsk_bool_t)ENABLED_BOOL +#define TSIP_SSESSION_SET_SIGCOMP_COMPARTMENT(COMPARTMENT_ID_STR) sstype_sigcomp_id, (const char*)COMPARTMENT_ID_STR +#define TSIP_SSESSION_UNSET_SIGCOMP_COMPARTMENT() TSIP_SSESSION_SET_SIGCOMP_COMPARTMENT((const char*)-1) +#define TSIP_SSESSION_SET_AUTH_HA1(AUTH_HA1_STR) sstype_auth_ha1, (const char*)AUTH_HA1_STR +#define TSIP_SSESSION_SET_AUTH_IMPI(AUTH_IMPI_STR) sstype_auth_impi, (const char*)AUTH_IMPI_STR +#define TSIP_SSESSION_SET_WEBSOCKET_SRC(SRC_HOST_STR, SRC_PORT_INT, SRC_PROTO_STR) sstype_ws_src, (const char*)SRC_HOST_STR, (int32_t)SRC_PORT_INT, (const char*)SRC_PROTO_STR +#define TSIP_SSESSION_SET_MEDIA(...) sstype_media, ##__VA_ARGS__ +#define TSIP_SSESSION_SET_NULL() sstype_null + +typedef enum tsip_msession_param_type_e +{ + mstype_null = 0, + + mstype_set_profile, + mstype_set_srtp_mode, + mstype_set_avpf_mode, + + mstype_set_100rel, + mstype_set_rtcp, + mstype_set_rtcpmux, + mstype_set_ice, + mstype_set_ice_stun, + mstype_set_ice_turn, + mstype_set_stun_server, + mstype_set_stun_cred, + + mstype_set_video_fps, + mstype_set_video_bw_up, + mstype_set_video_bw_down, + mstype_set_video_prefsize, + + mstype_set_qos, + mstype_unset_qos, + + mstype_set_timers, + mstype_unset_timers, + + mstype_set_codecs, + + mstype_set_bypass_encoding, + mstype_set_bypass_decoding, + + mstype_set_rtp_ssrc, + + mstype_set_msrp_cb +} +tsip_msession_param_type_t; + +#define TSIP_MSESSION_SET_SRTP_MODE(SRTP_MODE_ENUM) mstype_set_srtp_mode, (tmedia_srtp_mode_t)SRTP_MODE_ENUM +#define TSIP_MSESSION_SET_AVPF_MODE(MEDIA_MODE_ENUM) mstype_set_avpf_mode, (tmedia_mode_t)MEDIA_MODE_ENUM +#define TSIP_MSESSION_SET_PROFILE(PROFILE_ENUM) mstype_set_srtp_mode, (tmedia_profile_t)PROFILE_ENUM +#define TSIP_MSESSION_SET_100rel(ENABLED_BOOL) mstype_set_100rel, (tsk_bool_t)ENABLED_BOOL +#define TSIP_MSESSION_SET_RTCP(ENABLED_BOOL) mstype_set_rtcp, (tsk_bool_t)ENABLED_BOOL +#define TSIP_MSESSION_SET_RTCPMUX(ENABLED_BOOL) mstype_set_rtcpmux, (tsk_bool_t)ENABLED_BOOL +#define TSIP_MSESSION_SET_ICE(ENABLED_BOOL) mstype_set_ice, (tsk_bool_t)ENABLED_BOOL +#define TSIP_MSESSION_SET_ICE_STUN(ENABLED_BOOL) mstype_set_ice_stun, (tsk_bool_t)ENABLED_BOOL +#define TSIP_MSESSION_SET_ICE_TURN(ENABLED_BOOL) mstype_set_ice_turn, (tsk_bool_t)ENABLED_BOOL +#define TSIP_MSESSION_SET_STUN_SERVER(HOSTNAME, PORT) mstype_set_stun_server, (const char*)HOSTNAME, (uint16_t)PORT +#define TSIP_MSESSION_SET_STUN_CRED(USERNAME, PASSWORD) mstype_set_stun_cred, (const char*)USERNAME, (const char*)PASSWORD +#define TSIP_MSESSION_SET_QOS(TYPE_ENUM, STRENGTH_ENUM) mstype_set_qos, (tmedia_qos_stype_t)TYPE_ENUM, (tmedia_qos_strength_t)STRENGTH_ENUM +#define TSIP_MSESSION_UNSET_QOS() mstype_unset_qos +#define TSIP_MSESSION_SET_VIDEO_FPS(FPS_INT) mstype_set_video_fps, (int32_t)FPS_INT +#define TSIP_MSESSION_SET_VIDEO_BW_UP(BW_INT) mstype_set_video_bw_up, (int32_t)(BW_INT) +#define TSIP_MSESSION_SET_VIDEO_BW_DOWN(BW_INT) mstype_set_video_bw_down, (int32_t)(BW_INT) +#define TSIP_MSESSION_SET_VIDEO_PREFSIZE(PREFSIZE_ENUM) mstype_set_video_prefsize, (int32_t)(PREFSIZE_ENUM) +#define TSIP_MSESSION_SET_TIMERS(TIMEOUT_UINT, REFRESHER_STR) mstype_set_timers, (unsigned)TIMEOUT_UINT, (const char*)REFRESHER_STR +#define TSIP_MSESSION_UNSET_TIMERS() mstype_unset_timers +#define TSIP_MSESSION_SET_CODECS(CODECS_INT) mstype_set_codecs, (signed)CODECS_INT +#define TSIP_MSESSION_SET_BYPASS_ENCODING(ENABLED_BOOL) mstype_set_bypass_encoding, (tsk_bool_t)ENABLED_BOOL +#define TSIP_MSESSION_UNSET_BYPASS_ENCODING() TSIP_MSESSION_SET_BYPASS_ENCODING(tsk_false) +#define TSIP_MSESSION_SET_BYPASS_DECODING(ENABLED_BOOL) mstype_set_bypass_decoding, (tsk_bool_t)ENABLED_BOOL +#define TSIP_MSESSION_SET_RTP_SSRC(MEDIA_ENUM, SSRC_UINT) mstype_set_rtp_ssrc, (tmedia_type_t)MEDIA_ENUM, (uint32_t)SSRC_UINT +#define TSIP_MSESSION_SET_RTP_SSRC_AUDIO(SSRC_UINT) TSIP_MSESSION_SET_RTP_SSRC(tmedia_audio, (SSRC_UINT)) +#define TSIP_MSESSION_SET_RTP_SSRC_VIDEO(SSRC_UINT) TSIP_MSESSION_SET_RTP_SSRC(tmedia_video, (SSRC_UINT)) +#define TSIP_MSESSION_UNSET_BYPASS_DECODING() TSIP_MSESSION_SET_BYPASS_DECODING(tsk_false) +#define TSIP_MSESSION_SET_MSRP_CB(TMEDIA_SESSION_MSRP_CB_F) mstype_set_msrp_cb, (tmedia_session_msrp_cb_f)TMEDIA_SESSION_MSRP_CB_F + +#define TSIP_MSESSION_SET_NULL() mstype_null + +typedef struct tsip_ssession_s +{ + TSK_DECLARE_OBJECT; + + tsip_ssession_id_t id; + tsip_ssession_id_t id_parent; //for call transfer + unsigned owner:1; + + const struct tsip_stack_s* stack; + const void* userdata; + + //======= + // SIP + //======= + tsk_params_L_t *caps; + tsk_params_L_t *headers; + + unsigned no_contact:1; + struct tsip_uri_s* from; + struct tsip_uri_s* to; + int64_t expires; + tsk_bool_t silent_hangup; + char* sigcomp_id; + char* auth_ha1; + char* auth_impi; + + //======= + // WebSocket + //======= + struct{ + // used when the stack is running in webrtc2sip mode to store the 'origin' (a.k.a 'src') + struct{ + char* host; + tsk_istr_t port; + char* proto; + } src; + } ws; + + //======= + // Media + //======= + struct{ + tmedia_type_t type; + tmedia_profile_t profile; + tmedia_srtp_mode_t srtp_mode; + tmedia_mode_t avpf_mode; + tmedia_codec_id_t codecs; + tsk_bool_t bypass_encoding; + tsk_bool_t bypass_decoding; + + /* Video */ + int32_t video_fps; + int32_t video_bw_up; + int32_t video_bw_down; + tmedia_pref_video_size_t video_pref_size; + + /* RTP*/ + struct{ + struct{ + uint32_t audio; + uint32_t video; + }ssrc; + } rtp; + + /* Session timers */ + struct{ + char* refresher; + unsigned timeout; + } timers; + /* QoS */ + struct{ + tmedia_qos_stype_t type; + tmedia_qos_strength_t strength; + } qos; + /* MSRP */ + struct{ + tmedia_session_msrp_cb_f callback; + } msrp; + /* STUN */ + struct{ + char* username; + char* password; + char* hostname; + uint16_t port; + } stun; + + /* Features */ + unsigned enable_100rel:1; + unsigned enable_ice:1; + unsigned enable_icestun:1; + unsigned enable_iceturn:1; + unsigned enable_rtcp:1; + unsigned enable_rtcpmux:1; + } media; +} +tsip_ssession_t; + +/** A pointer to a SIP Session */ +typedef void tsip_ssession_handle_t; +/** A pointer to a LTE/IMS stack */ +typedef void tsip_stack_handle_t; + +TINYSIP_API tsip_ssession_handle_t* tsip_ssession_create(tsip_stack_handle_t *stack, ...); +TINYSIP_API int tsip_ssession_set(tsip_ssession_handle_t *self, ...); +TINYSIP_API tsip_ssession_id_t tsip_ssession_get_id(const tsip_ssession_handle_t *self); +TINYSIP_API tsip_ssession_id_t tsip_ssession_get_id_parent(const tsip_ssession_handle_t *self); +TINYSIP_API int tsip_ssession_take_ownership(tsip_ssession_handle_t *self); +TINYSIP_API tsk_bool_t tsip_ssession_have_ownership(const tsip_ssession_handle_t *self); +TINYSIP_API int tsip_ssession_respond(const tsip_ssession_handle_t *self, short status, const char* phrase, const void* payload, tsk_size_t size, const struct tsip_message_s* request, ...); +TINYSIP_API const void* tsip_ssession_get_userdata(const tsip_ssession_handle_t *self); +TINYSIP_API tmedia_type_t tsip_ssession_get_mediatype(const tsip_ssession_handle_t *self); +TINYSIP_API tmedia_session_mgr_t* tsip_session_get_mediamgr(const tsip_ssession_handle_t *self); +TINYSIP_API const tsip_stack_handle_t* tsip_ssession_get_stack(const tsip_ssession_handle_t *self); +TINYSIP_API tmedia_codec_id_t tsip_ssession_get_codecs_neg(tsip_ssession_handle_t *self); + +int tsip_ssession_handle(const tsip_ssession_t *self, const struct tsip_action_s* action); + +typedef tsk_list_t tsip_ssessions_L_t; /**< List of @ref tsip_ssession_handle_t elements. */ +TINYSIP_GEXTERN const tsk_object_def_t *tsip_ssession_def_t; + +TSIP_END_DECLS + +#endif /* TSIP_SSESSION_H */ + diff --git a/tinySIP/include/tinysip/tsip_timers.h b/tinySIP/include/tinysip/tsip_timers.h new file mode 100644 index 0000000..52fddc5 --- /dev/null +++ b/tinySIP/include/tinysip/tsip_timers.h @@ -0,0 +1,123 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_timers.h + * @brief SIP timers. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_TIMERS_H +#define TINYSIP_TIMERS_H + +#include "tinysip_config.h" + +#include "tsk_timer.h" + +TSIP_BEGIN_DECLS + +#define TSIP_TIMER_GET(TX) tsip_timers_get##TX() + +//extern const char *timerT1; +//extern const char *timerT2; +//extern const char *timerT4; +//extern const char *timerA; +//extern const char *timerB; +//extern const char *timerC; +//extern const char *timerD; +//extern const char *timerE; +//extern const char *timerF; +//extern const char *timerG; +//extern const char *timerH; +//extern const char *timerI; +//extern const char *timerJ; +//extern const char *timerK; +//extern const char *timerL; +//extern const char *timerM; + +typedef struct tsip_timer_s +{ + tsk_timer_id_t id; + uint64_t timeout; +} +tsip_timer_t; + +typedef struct tsip_timers_s +{ + uint32_t T1; + uint32_t T2; + uint32_t T4; + uint32_t A; + uint32_t B; + uint32_t C; + uint32_t D; + uint32_t E; + uint32_t F; + uint32_t G; + uint32_t H; + uint32_t I; + uint32_t J; + uint32_t K; + uint32_t L; + uint32_t M; +} +tsip_timers_t; + +TINYSIP_API void tsip_timers_setT1(uint32_t t1); +TINYSIP_API void tsip_timers_setT2(uint32_t t2); +TINYSIP_API void tsip_timers_setT4(uint32_t t4); +TINYSIP_API void tsip_timers_setA(uint32_t a); +TINYSIP_API void tsip_timers_setB(uint32_t b); +TINYSIP_API void tsip_timers_setC(uint32_t c); +TINYSIP_API void tsip_timers_setD(uint32_t d); +TINYSIP_API void tsip_timers_setE(uint32_t e); +TINYSIP_API void tsip_timers_setF(uint32_t f); +TINYSIP_API void tsip_timers_setG(uint32_t g); +TINYSIP_API void tsip_timers_setH(uint32_t h); +TINYSIP_API void tsip_timers_setI(uint32_t i); +TINYSIP_API void tsip_timers_setJ(uint32_t j); +TINYSIP_API void tsip_timers_setK(uint32_t k); +TINYSIP_API void tsip_timers_setL(uint32_t l); +TINYSIP_API void tsip_timers_setM(uint32_t m); + +TINYSIP_API uint32_t tsip_timers_getT1(); +TINYSIP_API uint32_t tsip_timers_getT2(); +TINYSIP_API uint32_t tsip_timers_getT4(); +TINYSIP_API uint32_t tsip_timers_getA(); +TINYSIP_API uint32_t tsip_timers_getB(); +TINYSIP_API uint32_t tsip_timers_getC(); +TINYSIP_API uint32_t tsip_timers_getD(); +TINYSIP_API uint32_t tsip_timers_getE(); +TINYSIP_API uint32_t tsip_timers_getF(); +TINYSIP_API uint32_t tsip_timers_getG(); +TINYSIP_API uint32_t tsip_timers_getH(); +TINYSIP_API uint32_t tsip_timers_getI(); +TINYSIP_API uint32_t tsip_timers_getJ(); +TINYSIP_API uint32_t tsip_timers_getK(); +TINYSIP_API uint32_t tsip_timers_getL(); +TINYSIP_API uint32_t tsip_timers_getM(); + +TSIP_END_DECLS + +#endif /* TINYSIP_TIMERS_H */ + diff --git a/tinySIP/include/tinysip/tsip_uri.h b/tinySIP/include/tinysip/tsip_uri.h new file mode 100644 index 0000000..b0daf6b --- /dev/null +++ b/tinySIP/include/tinysip/tsip_uri.h @@ -0,0 +1,95 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip_uri.h + * @brief SIP/SIPS/TEL URI. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_URI_H +#define TINYSIP_URI_H + +#include "tinysip_config.h" + +#include "tsk_object.h" +#include "tsk_params.h" +#include "tsk_buffer.h" + +TSIP_BEGIN_DECLS + +#define TSIP_URI_IS_SECURE(uri) ((uri && uri->type==uri_sips) ? tsk_true : tsk_false) + +typedef enum tsip_uri_type_e +{ + uri_unknown, + uri_sip, + uri_sips, + uri_tel +} +tsip_uri_type_t; + +typedef enum tsip_host_type_e +{ + host_unknown, + host_hostname, + host_ipv4, + host_ipv6 +} +tsip_host_type_t; + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// +/// @brief SIP/SIPS/TEL URI. +/// +//////////////////////////////////////////////////////////////////////////////////////////////////// +typedef struct tsip_uri_s +{ + TSK_DECLARE_OBJECT; + + tsip_uri_type_t type; + char *scheme; + char *host; /**< Host name. Hostname or IPv4address or IPv6address. */ + tsip_host_type_t host_type; /**< IPv4 or IPv6 or domain name. */ + uint16_t port; + char *user_name; + char *password; + char *display_name; + + tsk_params_L_t *params; /**< list of @ref tsk_param_t elements containing all parameters. */ +} +tsip_uri_t; + +typedef tsk_list_t tsip_uris_L_t; + +TINYSIP_API tsip_uri_t* tsip_uri_create(tsip_uri_type_t type); +TINYSIP_API int tsip_uri_serialize(const tsip_uri_t *uri, tsk_bool_t with_params, tsk_bool_t quote, tsk_buffer_t *output); +TINYSIP_API char* tsip_uri_tostring(const tsip_uri_t *uri, tsk_bool_t with_params, tsk_bool_t quote); +TINYSIP_API tsip_uri_t *tsip_uri_clone(const tsip_uri_t *uri, tsk_bool_t with_params, tsk_bool_t quote); + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_uri_def_t; + +TSIP_END_DECLS + +#endif /* TINYSIP_URI_H */ + diff --git a/tinySIP/include/tinysip_config.h b/tinySIP/include/tinysip_config.h new file mode 100644 index 0000000..2f95cde --- /dev/null +++ b/tinySIP/include/tinysip_config.h @@ -0,0 +1,96 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +#ifndef TINYSIP_CONFIG_H +#define TINYSIP_CONFIG_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 TSIP_UNDER_WINDOWS 1 +#elif __APPLE__ +# define TSIP_UNDER_APPLE 1 +#endif + +// Windows (XP/Vista/7/CE and Windows Mobile) macro definition +#if defined(WIN32)|| defined(_WIN32) || defined(_WIN32_WCE) +# define TSIP_UNDER_WINDOWS 1 +# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP || WINAPI_FAMILY == WINAPI_FAMILY_APP) +# define TSIP_UNDER_WINDOWS_RT 1 +# endif +#elif __APPLE__ +# define TSIP_UNDER_APPLE 1 +#endif + +#if !defined(__GNUC__) && defined(TINYSIP_EXPORTS) +# define TINYSIP_API __declspec(dllexport) +# define TINYSIP_GEXTERN extern __declspec(dllexport) +#elif !defined(__GNUC__) && !defined(TINYSIP_IMPORTS_IGNORE) +# define TINYSIP_API __declspec(dllimport) +# define TINYSIP_GEXTERN __declspec(dllimport) +#else +# define TINYSIP_API +# define TINYSIP_GEXTERN extern +#endif + + +/* Guards against C++ name mangling */ +#ifdef __cplusplus +# define TSIP_BEGIN_DECLS extern "C" { +# define TSIP_END_DECLS } +#else +# define TSIP_BEGIN_DECLS +# define TSIP_END_DECLS +#endif + +/* Disable some well-known warnings */ +#ifdef _MSC_VER +# define _CRT_SECURE_NO_WARNINGS +#endif + +/* Detecting C99 compilers */ +#if (__STDC_VERSION__ == 199901L) && !defined(__C99__) +# define __C99__ +#endif + +/* Whether to use SIP Compact headers (RFC 3261 - 7.3.3 Compact Form) */ +#if !defined(TSIP_COMPACT_HEADERS) +# define TSIP_COMPACT_HEADERS 0 +#endif + +#include +#ifdef __SYMBIAN32__ +#include +#endif + +#if defined(__APPLE__) +# include +#endif + +#if HAVE_CONFIG_H + #include +#endif + +#endif // TINYSIP_CONFIG_H diff --git a/tinySIP/include/tsip.h b/tinySIP/include/tsip.h new file mode 100644 index 0000000..0a1d79b --- /dev/null +++ b/tinySIP/include/tsip.h @@ -0,0 +1,692 @@ +/* +* Copyright (C) 2010-2011 Mamadou Diop. +* +* Contact: Mamadou Diop +* +* This file is part of Open Source Doubango Framework. +* +* DOUBANGO is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* DOUBANGO is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with DOUBANGO. +* +*/ + +/**@file tsip.h + * @brief SIP (RFC 3261) and 3GPP IMS/LTE (TS 24.229) implementation. + * + * @author Mamadou Diop + * + + */ +#ifndef TINYSIP_TSIP_H +#define TINYSIP_TSIP_H + +#include "tinysip_config.h" + +#include "tinysip/tsip_ssession.h" +#include "tinysip/tsip_timers.h" +#include "tinysip/tsip_event.h" +#include "tinysip/transports/tsip_transport.h" + +#include "tinysip/tsip_uri.h" + +#include "tinysip/sigcomp/tsip_sigcomp.h" + +#include "tinynet.h" + +#include "tsk_runnable.h" + +TSIP_BEGIN_DECLS + +#define TSIP_IARI_GSMAIS "urn%3Aurn-7%3A3gpp-application.ims.iari.gsma-is" +#define TSIP_IARI_QUOTED_GSMAIS "\"" TSIP_IARI_GSMAIS "\"" +#define TSIP_ICSI_MMTEL_PSVOICE "urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel" +#define TSIP_ICSI_QUOTED_MMTEL_PSVOICE "\"" TSIP_ICSI_MMTEL_PSVOICE "\"" + +#define TSIP_STACK(self) ((tsip_stack_t*)(self)) + +typedef uint8_t amf_t[2]; +typedef uint8_t operator_id_t[16]; + +// @tinyWRAP +typedef enum tsip_stack_mode_e +{ + tsip_stack_mode_ua, + tsip_stack_mode_p2p, + tsip_stack_mode_webrtc2sip, + tsip_stack_mode_mcu +} +tsip_stack_mode_t; +#define TSIP_STACK_MODE_IS_SERVER(stack) ((stack)->network.mode == tsip_stack_mode_webrtc2sip || (stack)->network.mode == tsip_stack_mode_mcu) +#define TSIP_STACK_MODE_IS_CLIENT(stack) (!TSIP_STACK_MODE_IS_SERVER((stack))) + +typedef enum tsip_stack_param_type_e +{ + tsip_pname_null = 0, + + /* === Identity === */ + tsip_pname_display_name, + tsip_pname_impu, + tsip_pname_preferred_id, + tsip_pname_impi, + tsip_pname_password, + + /* === SigComp === */ + tsip_pname_sigcomp, + tsip_pname_sigcomp_add_compartment, + tsip_pname_sigcomp_remove_compartment, + + /* === Network === */ + tsip_pname_realm, + tsip_pname_local_ip, + tsip_pname_local_port, + tsip_pname_aor, + tsip_pname_discovery_naptr, + tsip_pname_discovery_dhcp, + tsip_pname_proxy_cscf, + tsip_pname_dnsserver, + tsip_pname_max_fds, + tsip_pname_mode, + + + /* === Security === */ + tsip_pname_early_ims, + tsip_pname_secagree_ipsec, + tsip_pname_secagree_tls, + tsip_pname_amf, + tsip_pname_operator_id, + tsip_pname_tls_certs, + tsip_pname_ipsec_params, + + /* === Dummy Headers === */ + tsip_pname_header, + + /* Nat Traversal */ + tsip_pname_stun_enabled, + tsip_pname_stun_server, + tsip_pname_stun_cred, + + /* === User Data === */ + tsip_pname_userdata, +} +tsip_stack_param_type_t; + +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_NULL +* Ends the stack parameters. Mandatory and should be the last one. +*/ +#define TSIP_STACK_SET_NULL() tsip_pname_null + +/* === Identity === */ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_DISPLAY_NAME +* Sets the user's display name. Used in SIP 'From' and 'To' headers. +* @param NAME_STR The user's display name. +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_DISPLAY_NAME("john doe"), +* TSIP_STACK_SET_NULL()); +* @endcode +*/ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_IMPU +* Sets the user's IMPU (IMS Public Identity). +* @param URI_STR A valid SIP/SIPS/tel URI string. +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_IMPU("sip:johndoe@open-ims.test"), +* TSIP_STACK_SET_NULL()); +* @endcode +*/ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_PREFERRED_IDENTITY +* Sets the user's Preferred Identity. Used to populate the P-Preferred-Identity header. +* @param URI_STR A valid SIP/SIPS/tel URI string. +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_PREFERRED_IDENTITY("sip:johndoe@open-ims.test"), +* TSIP_STACK_SET_NULL()); +* @endcode +*/ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_IMPI +* Sets the user's IMPI (IMS Private Identity). +* @param IMPI_STR Any string. +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_IMPI("johndoe@open-ims.test"), +* TSIP_STACK_SET_NULL()); +* @endcode +*/ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_PASSWORD +* Sets the user's password. +* @param PASSORD_STR Any string. +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_PASSWORD("mysecret"), +* TSIP_STACK_SET_NULL()); +* @endcode +*/ +#define TSIP_STACK_SET_DISPLAY_NAME(NAME_STR) tsip_pname_display_name, (const char*)NAME_STR +#define TSIP_STACK_SET_IMPU(URI_STR) tsip_pname_impu, (const char*)URI_STR +#define TSIP_STACK_SET_PREFERRED_IDENTITY(URI_STR) tsip_pname_preferred_id, (const char*)URI_STR +#define TSIP_STACK_SET_IMPI(IMPI_STR) tsip_pname_impi, (const char*)IMPI_STR +#define TSIP_STACK_SET_PASSWORD(PASSORD_STR) tsip_pname_password, (const char*)PASSORD_STR + + +/* === SigComp === */ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_SIGCOMP +* Sets the SigComp parameters. It's not mandatory to call this function in order to use SigComp. +* It should be called to change default parameters. As these parameters will be shared by all compartments, +* you should call this function before adding any compartment. +* @param DMS_UINT Decompression Memory Size. Default value is 8192. +* @param SMS_UINT State Memory Size. Default value is 8192. +* @param CPB_UINT Cycles Per Bit. Default value is 64. +* @param PRES_DICT_BOOL Indicates whether to enable Presence dictionary (RFC 5112) or not. Default value is @a tsk_false. +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_SIGCOMP(8192, 8192, 64, tsk_true), +* TSIP_STACK_SET_NULL()); +* @endcode +*/ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_SIGCOMP_NEW_COMPARTMENT +* Add New unique compartment identifier to the stack. This compartment will be closed (not removed) when the stack is stopped. +* A any time, you can remove this compartment by using @ref TSIP_STACK_UNSET_SIGCOMP_COMPARTMENT(). +* @param COMPARTMENT_ID_STR The id of the compartment to add. Should be unique. +* The identifier will be used to in the sip headers (as per RFC 5049) "AS IS".
+* @sa @ref TSIP_STACK_UNSET_SIGCOMP_COMPARTMENT() +* +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_NEW_SIGCOMP_COMPARTMENT("urn:uuid:0C67446E-F1A1-11D9-94D3-000A95A0E128"), +* TSIP_STACK_SET_NULL()); +* @endcode +*/ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_UNSET_SIGCOMP_COMPARTMENT +* Removes a SigComp compartment. This will close the compartment and release all its states. +* You should only close a compartment if there is no outgoing session using it. In all cases, all compartments +* will be closed when the stack is destroyed or stopped. +* @param COMPARTMENT_ID_STR The id of the compartment to close. +* @sa @ref TSIP_STACK_SET_SIGCOMP_NEW_COMPARTMENT() +* +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_UNSET_SIGCOMP_COMPARTMENT("urn:uuid:0C67446E-F1A1-11D9-94D3-000A95A0E128"), +* TSIP_STACK_SET_NULL()); +* @endcode +*/ +#define TSIP_STACK_SET_SIGCOMP(DMS_UINT, SMS_UINT, CPB_UINT, PRES_DICT_BOOL) tsip_pname_sigcomp, (unsigned)DMS_UINT, (unsigned)SMS_UINT, (unsigned)CPB_UINT, (tsk_bool_t)PRES_DICT_BOOL +#define TSIP_STACK_SET_SIGCOMP_NEW_COMPARTMENT(COMPARTMENT_ID_STR) tsip_pname_sigcomp_add_compartment, (const char*)COMPARTMENT_ID_STR +#define TSIP_STACK_UNSET_SIGCOMP_COMPARTMENT(COMPARTMENT_ID_STR) tsip_pname_sigcomp_remove_compartment, (const char*)COMPARTMENT_ID_STR + +/* === Network === */ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_REALM +* Sets the domain name. +* @param URI_STR A valid SIP/SIPS URI string. +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_REALM("sip:open-ims.test"), +* TSIP_STACK_SET_NULL()); +* @endcode +*/ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_LOCAL_IP +* Sets the user's local IP address. +* @param IP_STR IPv4/IPv6 IP address or FQDN. +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_LOCAL_IP("fe80::"), +* TSIP_STACK_SET_NULL()); +* @endcode +* +* @sa @ref TSIP_STACK_SET_LOCAL_PORT()
@ref TSIP_STACK_SET_AOR() +*/ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_LOCAL_PORT +* Sets the user's local Port to bind to. +* @param PORT_UINT Port number. Should be between 0x0400 and 0xFFFF. +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_LOCAL_PORT(5060), +* TSIP_STACK_SET_NULL()); +* @endcode +* +* @sa @ref TSIP_STACK_SET_LOCAL_IP()
@ref TSIP_STACK_SET_AOR() +*/ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_AOR +* Sets the SIP AOR to use for all outgoing requests. +* @param IP_STR The IP address. Should be numeric IP string. e.g. 192.168.0.16. +* Will be ignored if null or empty. +* @param PORT_UINT Port number. Should be between 0x0400 and 0xFFFF. +* Will be ignored if equals to zero. +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_AOR("fe80::", 1234), +* TSIP_STACK_SET_NULL()); +* @endcode +* +* @sa @ref TSIP_STACK_SET_LOCAL_IP()
@ref TSIP_STACK_SET_LOCAL_PORT() +*/ + +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_DISCOVERY_NAPTR +* Whether to use DNS NAPTR for Proxy-CSCF discovery. Default is false. However, if the Proxy-CSCF IP address +* is missing, then this option will be enabled by default. +* @param ENABLED_BOOL @a tsk_true (1) or @a tsk_false (0). +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_DISCOVERY_NAPTR(tsk_true), +* TSIP_STACK_SET_NULL()); +* @endcode +* +* @sa @ref TSIP_STACK_SET_DISCOVERY_DHCP() +*/ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_DISCOVERY_DHCP +* Whether to use DHCPv4/v6 for Proxy-CSCF discovery. Default is false. The IP version (v4/v6) of the DHCP protocol +* to use will depend on the Proxy-CSCF address type. +* @param ENABLED_BOOL @a tsk_true (1) or @a tsk_false (0). +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_DISCOVERY_DHCP(tsk_false), +* TSIP_STACK_SET_NULL()); +* @endcode +* +* @sa @ref TSIP_STACK_SET_DISCOVERY_NAPTR() +*/ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_PROXY_CSCF +* Configures the Proxy-CSCF. +* @param FQDN_STR The IP address (v4/v6) or FQDN of the Proxy-CSCF. +* @param PORT_UINT The port. +* @param TRANSPORT_STR The transport type. Should be: @a "udp" or @a "tcp" or @a "tls" or @a "sctp". Default is @a "udp". +* @param IP_VERSION_STR The IP version to use. Should be: @a "ipv4" or @a "ipv6" or @a "ipv46". This parameter is useful when +* @a FQDN_STR parameter is a domain name. default is @a "ipv4". +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_PROXY_CSCF("pcscf-doubango.org", 4060, "tcp", "ipv6"), +* TSIP_STACK_SET_NULL()); +* @endcode +* +* @sa @ref TSIP_STACK_SET_DISCOVERY_DHCP()
@ref TSIP_STACK_SET_DISCOVERY_NAPTR() +*/ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_DNS_SERVER +* Adds a DNS server. +* @param IP_STR The IP address or FQDN of the DNS server to add. +* @code + // Add two new DNS servers (IPv6 and IPv4) +int ret = tsip_stack_set(stack, + TSIP_STACK_SET_DNS_SERVER("192.16.16.9"), + TSIP_STACK_SET_DNS_SERVER("fe::"), + TSIP_STACK_SET_NULL()); +* @endcode +*/ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_MODE_SERVER +* Configure the stack to be used as server. Cannot be changed later. +* @code +int ret = tsip_stack_set(stack, + TSIP_STACK_SET_MODE_SERVER(), + TSIP_STACK_SET_NULL()); +* @endcode +*/ +#define TSIP_STACK_SET_REALM(URI_STR) tsip_pname_realm, (const char*)URI_STR +#define TSIP_STACK_SET_LOCAL_IP_2(TRANSPORT_STR, IP_STR) tsip_pname_local_ip, (const char*)TRANSPORT_STR, (const char*)IP_STR +#define TSIP_STACK_SET_LOCAL_PORT_2(TRANSPORT_STR, PORT_UINT) tsip_pname_local_port, (const char*)TRANSPORT_STR, (unsigned)PORT_UINT +#define TSIP_STACK_SET_LOCAL_IP(IP_STR) TSIP_STACK_SET_LOCAL_IP_2(tsk_null, IP_STR)// @deprecated +#define TSIP_STACK_SET_LOCAL_PORT(PORT_UINT) TSIP_STACK_SET_LOCAL_PORT_2(tsk_null, PORT_UINT)// @deprecated +#define TSIP_STACK_SET_AOR_2(TRANSPORT_STR, IP_STR, PORT_UINT) tsip_pname_aor, (const char*)TRANSPORT_STR, (const char*)IP_STR, (unsigned)PORT_UINT +#define TSIP_STACK_SET_AOR(IP_STR, PORT_UINT) TSIP_STACK_SET_AOR_2(tsk_null, IP_STR, PORT_UINT)// @deprecated +#define TSIP_STACK_SET_DISCOVERY_NAPTR(ENABLED_BOOL) tsip_pname_discovery_naptr, (tsk_bool_t)ENABLED_BOOL +#define TSIP_STACK_SET_DISCOVERY_DHCP(ENABLED_BOOL) tsip_pname_discovery_dhcp, (tsk_bool_t)ENABLED_BOOL +#define TSIP_STACK_SET_PROXY_CSCF(FQDN_STR, PORT_UINT, TRANSPORT_STR, IP_VERSION_STR) tsip_pname_proxy_cscf, (const char*)FQDN_STR, (unsigned)PORT_UINT, (const char*)TRANSPORT_STR, (const char*)IP_VERSION_STR +#define TSIP_STACK_SET_DNS_SERVER(IP_STR) tsip_pname_dnsserver, (const char*)IP_STR +#define TSIP_STACK_SET_MAX_FDS(MAX_FDS_UINT) tsip_pname_max_fds, (unsigned)MAX_FDS_UINT +#define TSIP_STACK_SET_MODE(MODE_ENUM) tsip_pname_mode, (tsip_stack_mode_t)MODE_ENUM + +/* === Security === */ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_EARLY_IMS +* Whether to enable 3GPP Early-IMS Security as per 3GPP TS 33.978. +* @param ENABLED_BOOL @a tsk_true (1) or @a tsk_false (0). +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_EARLY_IMS(tsk_false), +* TSIP_STACK_SET_NULL()); +* @endcode +*/ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_SECAGREE_IPSEC +* Whether to enable IPSec security agreement as per IETF RFC 3329. +* @param ENABLED_BOOL @a tsk_true (1) or @a tsk_false (0). +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_SECAGREE_IPSEC(tsk_true), +* TSIP_STACK_SET_NULL()); +* @endcode +* +* @sa @ref TSIP_STACK_SET_IPSEC_PARAMS() +*/ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_SECAGREE_TLS +* Whether to enable TLS security agreement as per IETF RFC 3329. +* @param ENABLED_BOOL @a tsk_true (1) or @a tsk_false (0). +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_SECAGREE_TLS(tsk_true), +* TSIP_STACK_SET_NULL()); +* @endcode +* +* @sa @ref TSIP_STACK_SET_IPSEC_PARAMS() +*/ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_IMS_AKA_AMF +* Sets AMF (Authentication Management Field) value to use for IMS-AKA authentication. +* @param AMF_UINT16 16-bit value. +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_IMS_AKA_AMF(0x3FB6), +* TSIP_STACK_SET_NULL()); +* @endcode +* +* @sa @ref TSIP_STACK_SET_IMS_AKA_OPERATOR_ID() +*/ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_IMS_AKA_OPERATOR_ID +* Sets the operator identifier value to use for IMS-AKA authentication. +* @param OPID_HEX_STR 128-bit value as hex-string. If the length of the value supplied by the user is less than 128 bits, +* then it will be padded with zeros. +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_IMS_AKA_OPERATOR_ID("0x5FABC9"), // Will be padded with zeros +* TSIP_STACK_SET_NULL()); +* @endcode +* +* @sa @ref TSIP_STACK_SET_IMS_AKA_AMF() +*/ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_IPSEC_PARAMS +* Sets the IPSec parameters. To enable IPSec security agreement you should use @ref TSIP_STACK_SET_SECAGREE_IPSEC(tsk_true). +* @param ALG_STR Algorithm. Should be: @a "hmac-sha-1-96" or @a "hmac-md5-96". Default is @a "hmac-md5-96". +* @param EALG_STR Encryption Algorithm. Should be: @a "des-ede3-cbc" or @a "aes" or @a "null". Default is @a "null". +* @param MODE_STR Mode. Should be: @a "tun" or @a "trans". Default is @a "trans". +* @param PROTOCOL_STR Protocol. Should be @a "ah" or @a "esp" or @a "ah/esp". Default is @a "esp". +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_SECAGREE_IPSEC(tsk_true), + TSIP_STACK_SET_IPSEC_PARAMS("hmac-md5-96", "des-ede3-cbc", "trans", "esp"), +* TSIP_STACK_SET_NULL()); +* @endcode +* +* @sa @ref TSIP_STACK_SET_TLS_CERTS() +*/ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_TLS_CERTS +* Sets TLS certificate files. To enable TLS security agreement you should use @ref TSIP_STACK_SET_SECAGREE_TLS(tsk_true). +* @param CA_FILE_STR CA file. +* @param PUB_FILE_STR Public cert. file. +* @param PRIV_FILE_STR Private cert. file. +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_TLS_CERTS("C:\\tls\\ca.pki-crt.pem", "C:\\tls\\pub-crt.pem", "C:\\tls\\priv-key.pem"), +* TSIP_STACK_SET_NULL()); +* @endcode +* +* @sa @ref TSIP_STACK_SET_IPSEC_PARAMS() +*/ +#define TSIP_STACK_SET_EARLY_IMS(ENABLED_BOOL) tsip_pname_early_ims, (tsk_bool_t)ENABLED_BOOL +#define TSIP_STACK_SET_SECAGREE_IPSEC_2(TRANSPORT_STR, ENABLED_BOOL) tsip_pname_secagree_ipsec, (const char*)TRANSPORT_STR, (tsk_bool_t)ENABLED_BOOL +#define TSIP_STACK_SET_SECAGREE_IPSEC(ENABLED_BOOL) TSIP_STACK_SET_SECAGREE_IPSEC_2(tsk_null, ENABLED_BOOL) // @deprecated +#define TSIP_STACK_SET_SECAGREE_TLS(ENABLED_BOOL) tsip_pname_secagree_tls, (tsk_bool_t)ENABLED_BOOL +#define TSIP_STACK_SET_IMS_AKA_AMF(AMF_UINT16) tsip_pname_amf, (uint16_t)AMF_UINT16 +#define TSIP_STACK_SET_IMS_AKA_OPERATOR_ID(OPID_HEX_STR) tsip_pname_operator_id, (const char*)OPID_HEX_STR +#define TSIP_STACK_SET_IPSEC_PARAMS(ALG_STR, EALG_STR, MODE_STR, PROTOCOL_STR) tsip_pname_ipsec_params, (const char*)ALG_STR, (const char*)EALG_STR, (const char*)MODE_STR, (const char*)PROTOCOL_STR +#define TSIP_STACK_SET_TLS_CERTS(CA_FILE_STR, PUB_FILE_STR, PRIV_FILE_STR) TSIP_STACK_SET_TLS_CERTS_2(CA_FILE_STR, PUB_FILE_STR, PRIV_FILE_STR, tsk_false) +#define TSIP_STACK_SET_TLS_CERTS_2(CA_FILE_STR, PUB_FILE_STR, PRIV_FILE_STR, VERIF_BOOL) tsip_pname_tls_certs, (const char*)CA_FILE_STR, (const char*)PUB_FILE_STR, (const char*)PRIV_FILE_STR, (tsk_bool_t)VERIF_BOOL + +/* === Headers === */ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_HEADER +* Adds or updates a stack-level header. +* @param NAME_STR The name of the header to add or update. +* @param VALUE_STR The value of the header to add or update. +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_HEADER("User-Agent", "IM-client/OMA1.0 doubango/v1.0.0"), +* TSIP_STACK_SET_HEADER("Allow", "INVITE, ACK, CANCEL, BYE, MESSAGE, OPTIONS, NOTIFY, PRACK, UPDATE, REFER"), +* TSIP_STACK_SET_NULL()); +* @endcode +* +* @sa @ref TSIP_STACK_UNSET_HEADER() +*/ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_HEADER +* Removes a stack-level header. +* @param NAME_STR The name of the header to remove. +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_UNSET_HEADER("User-Agent"), +* TSIP_STACK_UNSET_HEADER("Allow"), +* TSIP_STACK_UNSET_HEADER("My_Header"), +* TSIP_STACK_SET_NULL()); +* @endcode +* +* @sa @ref TSIP_STACK_SET_HEADER() +*/ +#define TSIP_STACK_SET_HEADER(NAME_STR, VALUE_STR) tsip_pname_header, (const char*)NAME_STR, (const char*)VALUE_STR +#define TSIP_STACK_UNSET_HEADER(NAME_STR) TSIP_STACK_SET_HEADER(NAME_STR, ((const char*)-1)) + +/* === NAT Traversal === */ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_STUN_SERVER +* Sets the IP address and port of the STUN2 server. Also used for TURN. +* @param IP_STR The IPv4/IPv6 address for FQDN of the STUN2/TURN address. +* @param PORT_UINT The server port (default is 3478 for both TCP and UDP, and 5349 for TLS) +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_STUN_SERVER("numb.viagenie.ca", 3478), +* TSIP_STACK_SET_NULL()); +* @endcode +* +* @sa @ref TSIP_STACK_SET_STUN_CRED() +*/ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_STUN_CRED +* Sets STUN/TURN credentials. +* @param USR_STR The login. +* @param PASSORD_STR The password +* @code +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_STUN_CRED("bob@open-ims.test", "mysecret"), +* TSIP_STACK_SET_NULL()); +* @endcode +* +* @sa @ref TSIP_STACK_SET_STUN_SERVER() +*/ +#define TSIP_STACK_SET_STUN_SERVER(IP_STR, PORT_UINT) tsip_pname_stun_server, (const char*)IP_STR, (unsigned)PORT_UINT +#define TSIP_STACK_SET_STUN_CRED(USR_STR, PASSORD_STR) tsip_pname_stun_cred, (const char*)USR_STR, (const char*)PASSORD_STR +#define TSIP_STACK_SET_STUN_ENABLED(ENABLED_BOOL) tsip_pname_stun_enabled, (tsk_bool_t)ENABLED_BOOL + +/* === User Data === */ +/**@ingroup tsip_stack_group +* @def TSIP_STACK_SET_USERDATA +* Sets opaque user's data returned in each callback. Could be used to store the context. +* @param DATA_PTR Pointer to the user data. +* @code +* const void* context; +* int ret = tsip_stack_set(stack, +* TSIP_STACK_SET_USERDATA(context), +* TSIP_STACK_SET_NULL()); +* @endcode +*/ +#define TSIP_STACK_SET_USERDATA(DATA_PTR) tsip_pname_userdata, (const void*)DATA_PTR + + + + +/* 3GPP IMS/LTE stack (for internal use). only tsip_stack_handle_t should be visible. */ +typedef struct tsip_stack_s +{ + TSK_DECLARE_RUNNABLE; + TSK_DECLARE_SAFEOBJ; + + tsk_timer_manager_handle_t* timer_mgr_global; + tsk_bool_t started; + tsip_stack_callback_f callback; + + /* === Identity === */ + struct{ + char* display_name; + tsip_uri_t *impu; + tsip_uri_t *preferred; + char *impi; + char *password; + } identity; + + /* === SigComp === */ + struct{ + tsip_sigcomp_handle_t* handle; + + unsigned dms; + unsigned sms; + unsigned cpb; + tsk_bool_t sip_dict; + tsk_bool_t pres_dict; + } sigcomp; + + /* === Network === */ + struct{ + tsip_stack_mode_t mode; + + char *local_ip[TSIP_TRANSPORT_IDX_MAX]; + tnet_port_t local_port[TSIP_TRANSPORT_IDX_MAX]; + tsk_bool_t local_ip_is_set_by_user[TSIP_TRANSPORT_IDX_MAX]; // whether the address (ip and port) is set by the user or retrieved + + char *proxy_cscf[TSIP_TRANSPORT_IDX_MAX]; + tnet_port_t proxy_cscf_port[TSIP_TRANSPORT_IDX_MAX]; + tnet_socket_type_t proxy_cscf_type[TSIP_TRANSPORT_IDX_MAX]; + tnet_socket_type_t transport_types[TSIP_TRANSPORT_IDX_MAX]; + int32_t transport_idx_default; + + tsip_uri_t *realm; + + //! IP adddress and port to use as AOR (user-defined) + struct{ + char* ip[TSIP_TRANSPORT_IDX_MAX]; + tnet_port_t port[TSIP_TRANSPORT_IDX_MAX]; + } aor; + + tsk_bool_t discovery_naptr; + tsk_bool_t discovery_dhcp; + + tsk_size_t max_fds; + } network; + + /* === Security === */ + struct{ + char* secagree_mech; + tsk_bool_t earlyIMS; + operator_id_t operator_id; + amf_t amf; + + /* IPSec */ + struct{ + char* alg; + char* ealg; + char* mode; + char* protocol; + } ipsec; + tsk_bool_t enable_secagree_ipsec; + + /* TLS */ + struct { + char* ca; + char* pbk; + char* pvk; + tsk_bool_t verify; + }tls; + tsk_bool_t enable_secagree_tls; + } security; + + + + + + + + + tsip_uris_L_t* paths; + tsip_uris_L_t* service_routes; + tsip_uris_L_t* associated_uris; + + /* DNS context */ + tnet_dns_ctx_t *dns_ctx; + + /* NAT Traversal context */ + struct { + // STUN + struct{ + char* ip; + tnet_port_t port; + char* login; + char* pwd; + tsk_bool_t enabled; + } stun; + struct tnet_nat_ctx_s* ctx; + } natt; + + /* DHCP context */ + + /* QoS */ + + /* Internals. */ + //tsk_timer_manager_handle_t* timer_mgr; + tsip_timers_t timers; + tsip_ssessions_L_t *ssessions; + tsk_params_L_t *headers; + const void* userdata; + + /* Layers */ + struct tsip_dialog_layer_s *layer_dialog; + struct tsip_transac_layer_s *layer_transac; + struct tsip_transport_layer_s *layer_transport; +} +tsip_stack_t; + + + + +TINYSIP_API tsip_stack_handle_t *tsip_stack_create(tsip_stack_callback_f callback, const char* realm_uri, const char* impi_uri, const char* impu_uri, ...); +TINYSIP_API int tsip_stack_start(tsip_stack_handle_t *self); +TINYSIP_API int tsip_stack_set(tsip_stack_handle_t *self, ...); +TINYSIP_API const void* tsip_stack_get_userdata(const tsip_stack_handle_t *self); +TINYSIP_API tnet_dns_ctx_t* tsip_stack_get_dnsctx(tsip_stack_handle_t *self); +TINYSIP_API tsip_uri_t* tsip_stack_get_preferred_id(tsip_stack_handle_t *self); +TINYSIP_API int tsip_stack_get_local_ip_n_port(const tsip_stack_handle_t *self, const char* protocol, tnet_port_t *port, tnet_ip_t *ip); +TINYSIP_API int tsip_stack_stop(tsip_stack_handle_t *self); + +#define TSIP_STACK_EVENT_RAISE(stack, status_code, reason_phrase, incoming, type) \ + TSK_RUNNABLE_ENQUEUE(TSK_RUNNABLE(stack), (const tsip_stack_handle_t*)stack, (short)status_code, (const char*)reason_phrase, (unsigned)incoming, (tsip_event_type_t)type); + + +TINYSIP_GEXTERN const tsk_object_def_t *tsip_stack_def_t; + +TSIP_END_DECLS + +#endif /* TINYSIP_TSIP_H */ -- cgit v1.1