Commit fe4d2326 authored by Simon Morlat's avatar Simon Morlat
Browse files

Merge branch 'master' of git.linphone.org:belle-sip

Conflicts:
	include/belle-sip/headers.h
	tester/belle_sip_register_tester.c
parents 0b1f379f c6f5abef
......@@ -60,7 +60,7 @@
<folderInfo id="cdt.managedbuild.toolchain.gnu.macosx.base.557244179.959032290." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.macosx.base.1209613831" name="cdt.managedbuild.toolchain.gnu.macosx.base" superClass="cdt.managedbuild.toolchain.gnu.macosx.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.MachO64" id="cdt.managedbuild.target.gnu.platform.macosx.base.973927327" name="Debug Platform" osList="macosx" superClass="cdt.managedbuild.target.gnu.platform.macosx.base"/>
<builder arguments="CFLAGS=&quot;-g -Wall -Werror&quot; V=1" command="make" id="cdt.managedbuild.target.gnu.builder.macosx.base.190701400" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.macosx.base"/>
<builder arguments="CFLAGS=&quot;-g -Wall &quot; V=1" command="make" id="cdt.managedbuild.target.gnu.builder.macosx.base.190701400" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.macosx.base"/>
<tool id="cdt.managedbuild.tool.macosx.c.linker.macosx.base.419159753" name="MacOS X C Linker" superClass="cdt.managedbuild.tool.macosx.c.linker.macosx.base">
<inputType id="cdt.managedbuild.tool.macosx.c.linker.input.1079464415" superClass="cdt.managedbuild.tool.macosx.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
......@@ -194,7 +194,7 @@
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.macosx.base.557244179;cdt.managedbuild.toolchain.gnu.macosx.base.557244179.779699347;cdt.managedbuild.tool.gnu.c.compiler.macosx.base.1327025999;cdt.managedbuild.tool.gnu.c.compiler.input.1517483722">
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.macosx.base.557244179.959032290;cdt.managedbuild.toolchain.gnu.macosx.base.557244179.959032290.;cdt.managedbuild.tool.gnu.c.compiler.macosx.base.3940526;cdt.managedbuild.tool.gnu.c.compiler.input.2089521215">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
......@@ -237,7 +237,7 @@
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.macosx.base.557244179.959032290;cdt.managedbuild.toolchain.gnu.macosx.base.557244179.959032290.;cdt.managedbuild.tool.gnu.c.compiler.macosx.base.3940526;cdt.managedbuild.tool.gnu.c.compiler.input.2089521215">
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.macosx.base.557244179;cdt.managedbuild.toolchain.gnu.macosx.base.557244179.779699347;cdt.managedbuild.tool.gnu.c.compiler.macosx.base.1327025999;cdt.managedbuild.tool.gnu.c.compiler.input.1517483722">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
<buildOutputProvider>
......
......@@ -23,7 +23,7 @@
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
<value>CFLAGS=&quot;-g -Wall &quot; V=1</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
......@@ -59,7 +59,7 @@
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
<value>false</value>
</dictionary>
</arguments>
</buildCommand>
......
......@@ -38,20 +38,24 @@ belle_sip_header_proxy_authorization_t* belle_sip_auth_helper_create_proxy_autho
/**
* compute and set response value according to parameters
* HA1=MD5(username:realm:passwd)
* @return 0 if succeed
*/
int belle_sip_auth_helper_fill_authorization(belle_sip_header_authorization_t* authorization
,const char* method
,const char* username
,const char* password);
,const char* ha1);
/**
* compute and set response value according to parameters
* @return 0 if succeed
*/
int belle_sip_auth_helper_fill_proxy_authorization(belle_sip_header_proxy_authorization_t* proxy_authorization
,const char* method
,const char* username
,const char* password);
,const char* ha1);
/*
* compute HA1 (NULL terminated)
* HA1=MD5(userid:realm:passwd)
* return 0 in case of success
* */
int belle_sip_auth_helper_compute_ha1(const char* userid,const char* realm,const char* password, char ha1[33]);
#endif /* AUTHENTICATION_HELPER_H_ */
......@@ -28,6 +28,7 @@
typedef struct _belle_sdp_attribute belle_sdp_attribute_t;
belle_sdp_attribute_t* belle_sdp_attribute_new();
belle_sdp_attribute_t* belle_sdp_attribute_parse (const char* attribute);
belle_sdp_attribute_t* belle_sdp_attribute_create (const char* name,const char* value);
const char* belle_sdp_attribute_get_name(const belle_sdp_attribute_t* attribute);
const char* belle_sdp_attribute_get_value(const belle_sdp_attribute_t* attribute);
unsigned int belle_sdp_attribute_as_value(const belle_sdp_attribute_t* attribute);
......@@ -52,6 +53,7 @@ void belle_sdp_bandwidth_set_type(belle_sdp_bandwidth_t* attribute, const char*
**************************************************************************************/
typedef struct _belle_sdp_connection belle_sdp_connection_t;
belle_sdp_connection_t* belle_sdp_connection_new();
belle_sdp_connection_t* belle_sdp_connection_create(const char* net_type, const char* addr_type, const char* addr);
belle_sdp_connection_t* belle_sdp_connection_parse (const char* connection);
const char* belle_sdp_connection_get_address(const belle_sdp_connection_t* connection);
const char* belle_sdp_connection_get_address_type(const belle_sdp_connection_t* connection);
......@@ -100,6 +102,11 @@ void belle_sdp_info_set_value(belle_sdp_info_t* info, const char* value);
typedef struct _belle_sdp_media belle_sdp_media_t;
belle_sdp_media_t* belle_sdp_media_new();
belle_sdp_media_t* belle_sdp_media_parse (const char* media);
belle_sdp_media_t* belle_sdp_media_create(const char* media_type
,int media_port
,int port_count
,const char* protocol
,belle_sip_list_t* static_media_formats);
belle_sip_list_t* belle_sdp_media_get_media_formats(const belle_sdp_media_t* media);
int belle_sdp_media_get_media_port(const belle_sdp_media_t* media);
const char* belle_sdp_media_get_media_type(const belle_sdp_media_t* media);
......@@ -108,7 +115,7 @@ const char* belle_sdp_media_get_protocol(const belle_sdp_media_t* media);
void belle_sdp_media_set_media_formats(belle_sdp_media_t* media, belle_sip_list_t* mediaFormats);
void belle_sdp_media_set_media_port(belle_sdp_media_t* media, int port);
void belle_sdp_media_set_media_type(belle_sdp_media_t* media, const char* mediaType);
void belle_sdp_media_set_port_count(belle_sdp_media_t* media, int portCount);
void belle_sdp_media_set_port_count(belle_sdp_media_t* media, int port_count);
void belle_sdp_media_set_protocol(belle_sdp_media_t* media, const char* protocole);
#define BELLE_SDP_MEDIA(t) BELLE_SDP_CAST(t,belle_sdp_media_t);
......@@ -118,6 +125,7 @@ void belle_sdp_media_set_protocol(belle_sdp_media_t* media, const char* protocol
**************************************************************************************/
typedef struct _belle_sdp_mime_parameter belle_sdp_mime_parameter_t;
belle_sdp_mime_parameter_t* belle_sdp_mime_parameter_new();
belle_sdp_mime_parameter_t* belle_sdp_mime_parameter_create(const char* type, int media_format, int rate,int channel_count);
int belle_sdp_mime_parameter_get_rate(const belle_sdp_mime_parameter_t* mime_parameter);
void belle_sdp_mime_parameter_set_rate(belle_sdp_mime_parameter_t* mime_parameter,int rate);
int belle_sdp_mime_parameter_get_channel_count(const belle_sdp_mime_parameter_t* mime_parameter);
......@@ -141,6 +149,11 @@ void belle_sdp_mime_parameter_set_parameters(belle_sdp_mime_parameter_t* mime_pa
typedef struct _belle_sdp_media_description belle_sdp_media_description_t;
belle_sdp_media_description_t* belle_sdp_media_description_new();
belle_sdp_media_description_t* belle_sdp_media_description_parse (const char* media_description);
belle_sdp_media_description_t* belle_sdp_media_description_create(const char* media_type
,int media_port
,int port_count
,const char* protocol
,belle_sip_list_t* static_media_formats);
void belle_sdp_media_description_add_dynamic_payloads(belle_sdp_media_description_t* media_description, belle_sip_list_t* payloadNames, belle_sip_list_t* payloadValues);
const char* belle_sdp_media_description_get_attribute(const belle_sdp_media_description_t* media_description, const char* name);
belle_sip_list_t* belle_sdp_media_description_get_attributes(const belle_sdp_media_description_t* media_description);
......@@ -174,17 +187,23 @@ void belle_sdp_media_description_append_values_from_mime_parameter(belle_sdp_med
typedef struct _belle_sdp_origin belle_sdp_origin_t;
belle_sdp_origin_t* belle_sdp_origin_new();
belle_sdp_origin_t* belle_sdp_origin_parse (const char* origin);
belle_sdp_origin_t* belle_sdp_origin_create(const char* user_name
, unsigned int session_id
, unsigned int session_version
, const char* network_type
, const char* addr_type
, const char* address);
const char* belle_sdp_origin_get_address(const belle_sdp_origin_t* origin);
const char* belle_sdp_origin_get_address_type(const belle_sdp_origin_t* origin);
const char* belle_sdp_origin_get_network_type(const belle_sdp_origin_t* origin);
int belle_sdp_origin_get_session_id(const belle_sdp_origin_t* origin);
int belle_sdp_origin_get_session_version(const belle_sdp_origin_t* origin);
unsigned int belle_sdp_origin_get_session_id(const belle_sdp_origin_t* origin);
unsigned int belle_sdp_origin_get_session_version(const belle_sdp_origin_t* origin);
const char* belle_sdp_origin_get_username(const belle_sdp_origin_t* origin);
void belle_sdp_origin_set_address(belle_sdp_origin_t* origin, const char* address);
void belle_sdp_origin_set_address_type(belle_sdp_origin_t* origin, const char* address);
void belle_sdp_origin_set_network_type(belle_sdp_origin_t* origin, const char* network_type);
void belle_sdp_origin_set_session_id(belle_sdp_origin_t* origin, int session_id);
void belle_sdp_origin_set_session_version(belle_sdp_origin_t* origin, int version);
void belle_sdp_origin_set_session_id(belle_sdp_origin_t* origin, unsigned int session_id);
void belle_sdp_origin_set_session_version(belle_sdp_origin_t* origin, unsigned int version);
void belle_sdp_origin_set_username(belle_sdp_origin_t* origin, const char* username);
#define BELLE_SDP_ORIGIN(t) BELLE_SDP_CAST(t,belle_sdp_origin_t);
/***************************************************************************************
......@@ -213,7 +232,7 @@ void belle_sdp_repeate_time_set_value(belle_sdp_repeate_time_t* repeate_time, co
**************************************************************************************/
typedef struct _belle_sdp_session_name belle_sdp_session_name_t;
belle_sdp_session_name_t* belle_sdp_session_name_new();
/*belle_sdp_session_name_t* belle_sdp_session_name_parse (const char* session_name);*/
belle_sdp_session_name_t* belle_sdp_session_name_create (const char* name);
const char* belle_sdp_session_name_get_value(const belle_sdp_session_name_t* session_name);
void belle_sdp_session_name_set_value(belle_sdp_session_name_t* session_name, const char* value);
#define BELLE_SDP_SESSION_NAME(t) BELLE_SDP_CAST(t,belle_sdp_session_name_t);
......@@ -224,6 +243,7 @@ void belle_sdp_session_name_set_value(belle_sdp_session_name_t* session_name, co
typedef struct _belle_sdp_time belle_sdp_time_t;
belle_sdp_time_t* belle_sdp_time_new();
belle_sdp_time_t* belle_sdp_time_parse (const char* time);
int belle_sdp_time_get_start(const belle_sdp_time_t* time);
int belle_sdp_time_get_stop(const belle_sdp_time_t* time);
void belle_sdp_time_set_start(belle_sdp_time_t* time, int value);
......@@ -236,6 +256,8 @@ void belle_sdp_time_set_stop(belle_sdp_time_t* time, int value);
typedef struct _belle_sdp_time_description belle_sdp_time_description_t;
belle_sdp_time_description_t* belle_sdp_time_description_new();
belle_sdp_time_description_t* belle_sdp_time_description_parse (const char* time_description);
belle_sdp_time_description_t* belle_sdp_time_description_create (int start,int stop);
belle_sip_list_t* belle_sdp_time_description_get_repeate_times(const belle_sdp_time_description_t* time_description);
belle_sdp_time_t* belle_sdp_time_description_get_time(const belle_sdp_time_description_t* time_description);
void belle_sdp_time_description_set_repeate_times(belle_sdp_time_description_t* time_description, belle_sip_list_t* times);
......@@ -257,7 +279,7 @@ void belle_sdp_uri_set_value(belle_sdp_uri_t* uri, const char* value);
**************************************************************************************/
typedef struct _belle_sdp_version belle_sdp_version_t;
belle_sdp_version_t* belle_sdp_version_new();
/*belle_sdp_version_t* belle_sdp_version_parse (const char* version);*/
belle_sdp_version_t* belle_sdp_version_create(int version);
int belle_sdp_version_get_version(const belle_sdp_version_t* version);
void belle_sdp_version_set_version(belle_sdp_version_t* version, int value);
#define BELLE_SDP_VERSION(t) BELLE_SDP_CAST(t,belle_sdp_version_t);
......@@ -302,6 +324,7 @@ void belle_sdp_session_description_set_origin(belle_sdp_session_description_t* s
void belle_sdp_session_description_set_phones(belle_sdp_session_description_t* session_description, belle_sip_list_t* phones);
void belle_sdp_session_description_set_session_name(belle_sdp_session_description_t* session_description, belle_sdp_session_name_t* sessionName);
void belle_sdp_session_description_set_time_descriptions(belle_sdp_session_description_t* session_description, belle_sip_list_t* times);
void belle_sdp_session_description_set_time_description(belle_sdp_session_description_t* session_description, belle_sdp_time_description_t* time_desc);
void belle_sdp_session_description_set_uri(belle_sdp_session_description_t* session_description, belle_sdp_uri_t* uri);
void belle_sdp_session_description_set_version(belle_sdp_session_description_t* session_description, belle_sdp_version_t* v);
void belle_sdp_session_description_set_zone_adjustments(belle_sdp_session_description_t* session_description, belle_sdp_uri_t* zoneAdjustments);
......
......@@ -148,6 +148,7 @@ typedef struct _belle_sip_response belle_sip_response_t;
#include "belle-sip/sipstack.h"
#include "belle-sip/listeningpoint.h"
#include "belle-sip/provider.h"
#include "belle-sip/auth-helper.h"
#undef TRUE
......
......@@ -62,6 +62,7 @@ void belle_sip_header_address_set_displayname(belle_sip_header_address_t* addres
**************************************************************************************/
typedef struct _belle_sip_header belle_sip_header_t;
belle_sip_header_t* belle_sip_header_create (const char* name,const char* value);
const char* belle_sip_header_get_name (const belle_sip_header_t* obj);
void belle_sip_header_set_name (belle_sip_header_t* obj,const char* value);
int belle_sip_header_marshal(belle_sip_header_t* header, char* buff, unsigned int offset,unsigned int buff_size);
......@@ -78,6 +79,8 @@ typedef struct _belle_sip_header_allow belle_sip_header_allow_t;
belle_sip_header_allow_t* belle_sip_header_allow_new();
belle_sip_header_allow_t* belle_sip_header_allow_parse (const char* allow) ;
belle_sip_header_allow_t* belle_sip_header_allow_create (const char* methods) ;
const char* belle_sip_header_allow_get_method(const belle_sip_header_allow_t* allow);
void belle_sip_header_allow_set_method(belle_sip_header_allow_t* allow,const char* method);
#define BELLE_SIP_HEADER_ALLOW(t) BELLE_SIP_CAST(t,belle_sip_header_allow_t)
......@@ -92,6 +95,8 @@ belle_sip_header_contact_t* belle_sip_header_contact_new();
belle_sip_header_contact_t* belle_sip_header_contact_parse (const char* contact) ;
belle_sip_header_contact_t* belle_sip_header_contact_create (const belle_sip_header_address_t* contact) ;
/**
* Returns the value of the expires parameter or -1 if no expires parameter was specified or if the parameter value cannot be parsed as an int.
......@@ -122,11 +127,9 @@ belle_sip_header_contact_t* belle_sip_header_contact_parse (const char* contact)
*
*/
void belle_sip_header_contact_set_wildcard(belle_sip_header_contact_t* contact,unsigned int is_wildcard);
#define BELLE_SIP_HEADER_CONTACT(t) BELLE_SIP_CAST(t,belle_sip_header_contact_t)
#define BELLE_SIP_RANDOM_TAG ((const char*)-1)
#define BELLE_SIP_HEADER_CONTACT(t) BELLE_SIP_CAST(t,belle_sip_header_contact_t)
#define BELLE_SIP_CONTACT "Contact"
/******************************
* From header object inherent from header_address
*
......@@ -135,7 +138,9 @@ belle_sip_header_contact_t* belle_sip_header_contact_parse (const char* contact)
belle_sip_header_from_t* belle_sip_header_from_new();
belle_sip_header_from_t* belle_sip_header_from_create(const char *address, const char *tag);
belle_sip_header_from_t* belle_sip_header_from_create(const belle_sip_header_address_t* address, const char *tag);
belle_sip_header_from_t* belle_sip_header_from_create2(const char *address, const char *tag);
belle_sip_header_from_t* belle_sip_header_from_parse(const char* from) ;
......@@ -146,6 +151,7 @@ belle_sip_header_contact_t* belle_sip_header_contact_parse (const char* contact)
void belle_sip_header_from_set_random_tag(belle_sip_header_from_t *obj);
#define BELLE_SIP_HEADER_FROM(t) BELLE_SIP_CAST(t,belle_sip_header_from_t)
#define BELLE_SIP_FROM "From"
/******************************
* To header object inherent from header_address
*
......@@ -156,7 +162,9 @@ belle_sip_header_contact_t* belle_sip_header_contact_parse (const char* contact)
belle_sip_header_to_t* belle_sip_header_to_parse(const char* to) ;
belle_sip_header_to_t* belle_sip_header_to_create(const char *address, const char *tag);
belle_sip_header_to_t* belle_sip_header_to_create(const belle_sip_header_address_t *address, const char *tag);
belle_sip_header_to_t* belle_sip_header_to_create2(const char *address, const char *tag);
void belle_sip_header_to_set_tag(belle_sip_header_to_t* from, const char* tag);
......@@ -165,6 +173,7 @@ belle_sip_header_contact_t* belle_sip_header_contact_parse (const char* contact)
void belle_sip_header_to_set_random_tag(belle_sip_header_to_t *obj);
#define BELLE_SIP_HEADER_TO(t) BELLE_SIP_CAST(t,belle_sip_header_to_t)
#define BELLE_SIP_TO "To"
/******************************
* Via header object inherent from header_address
......@@ -197,6 +206,7 @@ int belle_sip_header_via_set_rport(belle_sip_header_via_t* via,int rport);
void belle_sip_header_via_set_transport(belle_sip_header_via_t* via,const char* transport);
int belle_sip_header_via_set_ttl(belle_sip_header_via_t* via, int ttl);
#define BELLE_SIP_HEADER_VIA(t) BELLE_SIP_CAST(t,belle_sip_header_via_t)
#define BELLE_SIP_VIA "Via"
/******************************
* Call id object inherent from object
......@@ -210,6 +220,7 @@ belle_sip_header_call_id_t* belle_sip_header_call_id_parse (const char* call_id)
const char* belle_sip_header_call_id_get_call_id(const belle_sip_header_call_id_t* call_id);
void belle_sip_header_call_id_set_call_id(belle_sip_header_call_id_t* via,const char* call_id);
#define BELLE_SIP_HEADER_CALL_ID(t) BELLE_SIP_CAST(t,belle_sip_header_call_id_t)
#define BELLE_SIP_CALL_ID "Call-ID"
/******************************
* cseq object inherent from object
*
......@@ -232,6 +243,8 @@ void belle_sip_header_cseq_set_seq_number(belle_sip_header_cseq_t* cseq,unsigned
typedef struct _belle_sip_header_content_type belle_sip_header_content_type_t;
belle_sip_header_content_type_t* belle_sip_header_content_type_new();
belle_sip_header_content_type_t* belle_sip_header_content_type_parse (const char* content_type) ;
belle_sip_header_content_type_t* belle_sip_header_content_type_create (const char* type,const char* sub_type) ;
belle_sip_header_content_type_t* belle_sip_header_content_type_parse (const char* content_type) ;
const char* belle_sip_header_content_type_get_type(const belle_sip_header_content_type_t* content_type);
......@@ -263,8 +276,10 @@ belle_sip_header_expires_t* belle_sip_header_expires_create(int expires);
belle_sip_header_route_t* belle_sip_header_route_new();
belle_sip_header_route_t* belle_sip_header_route_parse (const char* route) ;
belle_sip_header_route_t* belle_sip_header_route_create(const belle_sip_header_address_t* route);
#define BELLE_SIP_HEADER_ROUTE(t) BELLE_SIP_CAST(t,belle_sip_header_route_t)
#define BELLE_SIP_ROUTE "Route"
/******************************
* Record route header object inherent from header_address
*
......@@ -371,6 +386,7 @@ void belle_sip_header_www_authenticate_set_scheme(belle_sip_header_www_authentic
void belle_sip_header_www_authenticate_set_domain(belle_sip_header_www_authenticate_t* www_authenticate,const char* domain);
void belle_sip_header_www_authenticate_set_stale(belle_sip_header_www_authenticate_t* www_authenticate, unsigned int enable);
#define BELLE_SIP_HEADER_WWW_AUTHENTICATE(t) BELLE_SIP_CAST(t,belle_sip_header_www_authenticate_t)
#define BELLE_SIP_WWW_AUTHENTICATE "WWW-Authenticate"
/*******************************
* proxy_authenticate inherit from www_authenticate
......@@ -379,7 +395,7 @@ typedef struct _belle_sip_header_proxy_authenticate belle_sip_header_proxy_authe
belle_sip_header_proxy_authenticate_t* belle_sip_header_proxy_authenticate_new();
belle_sip_header_proxy_authenticate_t* belle_sip_header_proxy_authenticate_parse(const char* proxy_authenticate);
#define BELLE_SIP_HEADER_PROXY_AUTHENTICATE(t) BELLE_SIP_CAST(t,belle_sip_header_proxy_authenticate_t)
#define BELLE_SIP_PROXY_AUTHENTICATE "Proxy-Authenticate"
/******************************
*
......@@ -391,6 +407,7 @@ typedef struct _belle_sip_header_extension belle_sip_header_extension_t;
belle_sip_header_extension_t* belle_sip_header_extension_new();
belle_sip_header_extension_t* belle_sip_header_extension_parse (const char* extension) ;
belle_sip_header_extension_t* belle_sip_header_extension_create (const char* name,const char* value);
const char* belle_sip_header_extension_get_value(const belle_sip_header_extension_t* extension);
void belle_sip_header_extension_set_value(belle_sip_header_extension_t* extension,const char* value);
#define BELLE_SIP_HEADER_EXTENSION(t) BELLE_SIP_CAST(t,belle_sip_header_extension_t)
......
......@@ -82,6 +82,8 @@ void belle_sip_message_remove_header(belle_sip_message_t *msg, const char *heade
char *belle_sip_message_to_string(belle_sip_message_t *msg);
const char* belle_sip_message_get_body(belle_sip_message_t *msg);
void belle_sip_message_set_body(belle_sip_message_t *msg,char* body,unsigned int size);
/*message keep ownership of the null terminated body buffer
void belle_sip_message_assign_body(belle_sip_message_t *msg,char* body);*/
int belle_sip_response_get_status_code(const belle_sip_response_t *response);
void belle_sip_response_set_status_code(belle_sip_response_t *response,int status);
......
......@@ -29,21 +29,21 @@ typedef struct _belle_sip_parameters belle_sip_parameters_t;
belle_sip_parameters_t* belle_sip_parameters_new();
const char* belle_sip_parameters_get_parameter(belle_sip_parameters_t* obj,const char* name);
const char* belle_sip_parameters_get_parameter(const belle_sip_parameters_t* obj,const char* name);
/**
* returns 0 if not found
*/
unsigned int belle_sip_parameters_is_parameter(belle_sip_parameters_t* obj,const char* name);
unsigned int belle_sip_parameters_is_parameter(const belle_sip_parameters_t* obj,const char* name);
void belle_sip_parameters_set_parameter(belle_sip_parameters_t* obj,const char* name,const char* value);
const belle_sip_list_t * belle_sip_parameters_get_parameter_names(belle_sip_parameters_t* obj);
const belle_sip_list_t * belle_sip_parameters_get_parameter_names(const belle_sip_parameters_t* obj);
const belle_sip_list_t * belle_sip_parameters_get_parameters(belle_sip_parameters_t* obj);
const belle_sip_list_t * belle_sip_parameters_get_parameters(const belle_sip_parameters_t* obj);
void belle_sip_parameters_remove_parameter(belle_sip_parameters_t* obj,const char* name);
int belle_sip_parameters_marshal(belle_sip_parameters_t* obj, char* buff,unsigned int offset,unsigned int buff_size);
int belle_sip_parameters_marshal(const belle_sip_parameters_t* obj, char* buff,unsigned int offset,unsigned int buff_size);
#define BELLE_SIP_PARAMETERS(obj) BELLE_SIP_CAST(obj,belle_sip_parameters_t)
......
......@@ -167,9 +167,17 @@ typedef struct _belle_sip_uri belle_sip_uri_t;
*/
char* belle_sip_uri_to_string(belle_sip_uri_t* uri) ;
int belle_sip_uri_marshal(belle_sip_uri_t* uri, char* buff,unsigned int offset,unsigned int buff_size);
int belle_sip_uri_marshal(const belle_sip_uri_t* uri, char* buff,unsigned int offset,unsigned int buff_size);
#define BELLE_SIP_URI(obj) BELLE_SIP_CAST(obj,belle_sip_uri_t)
/**define URI equality as using comparison rules from RFC3261 section 19.1.4
* @param belle_sip_uri_t* uri_a
* @param belle_sip_uri_t* uri_a
* @return 0 if not matched.
*
* */
int belle_sip_uri_equals(const belle_sip_uri_t* uri_a,const belle_sip_uri_t* uri_b);
#endif /*BELLE_SIP_URI_H_*/
......@@ -141,6 +141,7 @@ typedef SOCKET belle_sip_fd_t;
typedef int belle_sip_fd_t;
#endif
const char* belle_sip_version_to_string();
BELLE_SIP_END_DECLS
#endif
......
......@@ -45,17 +45,46 @@ belle_sip_header_proxy_authorization_t* belle_sip_auth_helper_create_proxy_autho
belle_sip_auth_helper_clone_authorization(BELLE_SIP_HEADER_AUTHORIZATION(authorization),BELLE_SIP_HEADER_WWW_AUTHENTICATE(proxy_authentication));
return authorization;
}
int belle_sip_auth_helper_compute_ha1(const char* userid,const char* realm,const char* password, char ha1[33]) {
md5_byte_t out[16];
md5_state_t state;
int di;
if (!userid) {
belle_sip_error("belle_sip_fill_authorization_header, username not found ");
return -1;
}
if (!password) {
belle_sip_error("belle_sip_fill_authorization_header, password not found ");
return -1;
}
if (!realm) {
belle_sip_error("belle_sip_fill_authorization_header, password not found ");
return -1;
}
md5_init(&state);
md5_append(&state,(const md5_byte_t *)userid,strlen(userid));
md5_append(&state,(const md5_byte_t *)":",1);
md5_append(&state,(const md5_byte_t *)realm,strlen(realm));
md5_append(&state,(const md5_byte_t *)":",1);
md5_append(&state,(const md5_byte_t *)password,strlen(password));
md5_finish(&state,out);
for (di = 0; di < 16; ++di)
sprintf(ha1 + di * 2, "%02x", out[di]);
ha1[33]='\0';
return 0;
}
int belle_sip_auth_helper_fill_authorization(belle_sip_header_authorization_t* authorization
,const char* method
,const char* username
,const char* password) {
,const char* method
,const char* ha1) {
md5_byte_t out[16];
md5_state_t state;
char* uri;
char ha1[16*2 + 1];
char ha2[16*2 + 1];
char response[16*2 + 1];
response[33]=ha2[33]='\0';
int di;
if (belle_sip_header_authorization_get_scheme(authorization) != NULL &&
strcmp("Digest",belle_sip_header_authorization_get_scheme(authorization))!=0) {
......@@ -64,7 +93,7 @@ int belle_sip_auth_helper_fill_authorization(belle_sip_header_authorization_t* a
return -1;
}
if (belle_sip_header_authorization_get_qop(authorization)
&& strcmp("auth",belle_sip_header_authorization_get_qop(authorization))!=0) {
/*&& strcmp("auth",belle_sip_header_authorization_get_qop(authorization))!=0*/) {
belle_sip_error("belle_sip_fill_authorization_header, unsupported qop [%s], use auth instead"
,belle_sip_header_authorization_get_qop(authorization));
return -1;
......@@ -76,27 +105,7 @@ int belle_sip_auth_helper_fill_authorization(belle_sip_header_authorization_t* a
belle_sip_error("belle_sip_fill_authorization_header, method not found ");
return -1;
}
if (!username) {
belle_sip_error("belle_sip_fill_authorization_header, username not found ");
return -1;
}
if (!password) {
belle_sip_error("belle_sip_fill_authorization_header, password not found ");
return -1;
}
/*HA1=MD5(username:realm:passwd)*/
md5_init(&state);
md5_append(&state,(const md5_byte_t *)username,strlen(username));
md5_append(&state,(const md5_byte_t *)":",1);
md5_append(&state
,(const md5_byte_t *)belle_sip_header_authorization_get_realm(authorization)
,strlen(belle_sip_header_authorization_get_realm(authorization)));
md5_append(&state,(const md5_byte_t *)":",1);
md5_append(&state,(const md5_byte_t *)password,strlen(password));
md5_finish(&state,out);
for (di = 0; di < 16; ++di)
sprintf(ha1 + di * 2, "%02x", out[di]);
/*HA2=MD5(method:uri)*/
md5_init(&state);
......@@ -123,18 +132,14 @@ int belle_sip_auth_helper_fill_authorization(belle_sip_header_authorization_t* a
sprintf(response + di * 2, "%02x", out[di]);
belle_sip_header_authorization_set_response(authorization,(const char*)response);
belle_sip_header_authorization_set_qop(authorization,"auth");
return 0;
}
int belle_sip_auth_helper_fill_proxy_authorization(belle_sip_header_proxy_authorization_t* proxy_authorization
,const char* method
,const char* username
,const char* password) {
,const char* ha1) {
return belle_sip_auth_helper_fill_authorization(BELLE_SIP_HEADER_AUTHORIZATION(proxy_authorization)
,method
,username
,password);
,method, ha1);
}
......
......@@ -52,6 +52,12 @@ int belle_sdp_attribute_marshal(belle_sdp_attribute_t* attribute, char* buff,uns
return current_offset-offset;
}
BELLE_SDP_NEW(attribute,belle_sip_object)
belle_sdp_attribute_t* belle_sdp_attribute_create (const char* name,const char* value) {
belle_sdp_attribute_t* attribute = belle_sdp_attribute_new();
belle_sdp_attribute_set_name(attribute,name);
belle_sdp_attribute_set_value(attribute,value);
return attribute;
}
BELLE_SDP_PARSE(attribute)
GET_SET_STRING(belle_sdp_attribute,name);
GET_SET_STRING(belle_sdp_attribute,value);
......@@ -123,6 +129,13 @@ int belle_sdp_connection_marshal(belle_sdp_connection_t* connection, char* buff,
}
BELLE_SDP_NEW(connection,belle_sip_object)
BELLE_SDP_PARSE(connection)
belle_sdp_connection_t* belle_sdp_connection_create(const char* net_type, const char* addr_type, const char* addr) {
belle_sdp_connection_t* connection = belle_sdp_connection_new();
belle_sdp_connection_set_network_type(connection,net_type);
belle_sdp_connection_set_address_type(connection,addr_type);
belle_sdp_connection_set_address(connection,addr);
return connection;
}
GET_SET_STRING(belle_sdp_connection,network_type);
GET_SET_STRING(belle_sdp_connection,address_type);
GET_SET_STRING(belle_sdp_connection,address);
......@@ -241,6 +254,19 @@ int belle_sdp_media_marshal(belle_sdp_media_t* media, char* buff,unsigned int of
}
BELLE_SDP_NEW_WITH_CTR(media,belle_sip_object)
BELLE_SDP_PARSE(media)
belle_sdp_media_t* belle_sdp_media_create(const char* media_type
,int media_port
,int port_count
,const char* protocol
,belle_sip_list_t* static_media_formats) {
belle_sdp_media_t* media= belle_sdp_media_new();
belle_sdp_media_set_media_type(media,media_type);
belle_sdp_media_set_media_port(media,media_port);
belle_sdp_media_set_port_count(media,port_count);
belle_sdp_media_set_protocol(media,protocol);
if (static_media_formats) belle_sdp_media_set_media_formats(media,static_media_formats);
return media;
}
GET_SET_STRING(belle_sdp_media,media_type);
GET_SET_STRING(belle_sdp_media,protocol);
GET_SET_INT(belle_sdp_media,media_port,int)
......@@ -414,6 +440,15 @@ int belle_sdp_media_description_marshal(belle_sdp_media_description_t* media_des
return current_offset-offset;
}
BELLE_SDP_NEW(media_description,belle_sdp_base_description)
belle_sdp_media_description_t* belle_sdp_media_description_create(const char* media_type
,int media_port
,int port_count
,const char* protocol
,belle_sip_list_t* static_media_formats) {
belle_sdp_media_description_t* media_desc=belle_sdp_media_description_new();
belle_sdp_media_description_set_media(media_desc,belle_sdp_media_create(media_type,media_port,port_count,protocol,static_media_formats));
return media_desc;
}
BELLE_SDP_PARSE(media_description)
void belle_sdp_media_description_add_dynamic_payloads(belle_sdp_media_description_t* media_description, belle_sip_list_t* payloadNames, belle_sip_list_t* payloadValues) {
......@@ -661,8 +696,8 @@ struct _belle_sdp_origin {
const char* address_type;
const char* network_type;
const char* username;
int session_id;
int session_version;
unsigned int session_id;
unsigned int session_version;
};
......@@ -695,13 +730,28 @@ int belle_sdp_origin_marshal(belle_sdp_origin_t* origin, char* buff,unsigned int
return current_offset-offset;
}
BELLE_SDP_NEW(origin,belle_sip_object)
belle_sdp_origin_t* belle_sdp_origin_create(const char* user_name
, unsigned int session_id
, unsigned int session_version
, const char* network_type
, const char* addr_type
, const char* address) {
belle_sdp_origin_t* origin=belle_sdp_origin_new();
belle_sdp_origin_set_username(origin,user_name);
belle_sdp_origin_set_session_id(origin,session_id);
belle_sdp_origin_set_session_version(origin,session_version);
belle_sdp_origin_set_network_type(origin,network_type);
belle_sdp_origin_set_address_type(origin,addr_type);
belle_sdp_origin_set_address(origin,address);
return origin;
}
<