Commit 9c9d7e28 authored by Simon Morlat's avatar Simon Morlat

add missing files

parent a2c1eea5
/*
belle-sip - SIP (RFC3261) library.
Copyright (C) 2010 Belledonne Communications SARL
This program 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.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BELLE_SIP_TYPES_H
#define BELLE_SIP_TYPES_H
#include "belle-sip/defs.h"
#include "belle-sip/object.h"
#include "belle-sip/dict.h"
/**
* This enum declares all object types used in belle-sip (see belle_sip_object_t)
**/
BELLE_SIP_DECLARE_TYPES_BEGIN(belle_sip,1)
BELLE_SIP_TYPE_ID(belle_sip_stack_t),
BELLE_SIP_TYPE_ID(belle_sip_hop_t),
BELLE_SIP_TYPE_ID(belle_sip_object_pool_t),
BELLE_SIP_TYPE_ID(belle_sip_listening_point_t),
BELLE_SIP_TYPE_ID(belle_sip_datagram_listening_point_t),
BELLE_SIP_TYPE_ID(belle_sip_udp_listening_point_t),
BELLE_SIP_TYPE_ID(belle_sip_stream_listening_point_t),
BELLE_SIP_TYPE_ID(belle_sip_tls_listening_point_t),
BELLE_SIP_TYPE_ID(belle_sip_tunnel_listening_point_t),
BELLE_SIP_TYPE_ID(belle_sip_channel_t),
BELLE_SIP_TYPE_ID(belle_sip_udp_channel_t),
BELLE_SIP_TYPE_ID(belle_sip_stream_channel_t),
BELLE_SIP_TYPE_ID(belle_sip_tls_channel_t),
BELLE_SIP_TYPE_ID(belle_sip_tunnel_channel_t),
BELLE_SIP_TYPE_ID(belle_sip_provider_t),
BELLE_SIP_TYPE_ID(belle_sip_main_loop_t),
BELLE_SIP_TYPE_ID(belle_sip_source_t),
BELLE_SIP_TYPE_ID(belle_sip_resolver_context_t),
BELLE_SIP_TYPE_ID(belle_sip_transaction_t),
BELLE_SIP_TYPE_ID(belle_sip_server_transaction_t),
BELLE_SIP_TYPE_ID(belle_sip_client_transaction_t),
BELLE_SIP_TYPE_ID(belle_sip_ict_t),
BELLE_SIP_TYPE_ID(belle_sip_nict_t),
BELLE_SIP_TYPE_ID(belle_sip_ist_t),
BELLE_SIP_TYPE_ID(belle_sip_nist_t),
BELLE_SIP_TYPE_ID(belle_sip_dialog_t),
BELLE_SIP_TYPE_ID(belle_sip_header_address_t),
BELLE_SIP_TYPE_ID(belle_sip_header_contact_t),
BELLE_SIP_TYPE_ID(belle_sip_header_from_t),
BELLE_SIP_TYPE_ID(belle_sip_header_to_t),
BELLE_SIP_TYPE_ID(belle_sip_header_via_t),
BELLE_SIP_TYPE_ID(belle_sip_uri_t),
BELLE_SIP_TYPE_ID(belle_sip_message_t),
BELLE_SIP_TYPE_ID(belle_sip_request_t),
BELLE_SIP_TYPE_ID(belle_sip_response_t),
BELLE_SIP_TYPE_ID(belle_sip_object_t),
BELLE_SIP_TYPE_ID(belle_sip_parameters_t),
BELLE_SIP_TYPE_ID(belle_sip_header_call_id_t),
BELLE_SIP_TYPE_ID(belle_sip_header_cseq_t),
BELLE_SIP_TYPE_ID(belle_sip_header_content_type_t),
BELLE_SIP_TYPE_ID(belle_sip_header_route_t),
BELLE_SIP_TYPE_ID(belle_sip_header_record_route_t),
BELLE_SIP_TYPE_ID(belle_sip_header_user_agent_t),
BELLE_SIP_TYPE_ID(belle_sip_header_content_length_t),
BELLE_SIP_TYPE_ID(belle_sip_header_t),
BELLE_SIP_TYPE_ID(belle_sip_header_extension_t),
BELLE_SIP_TYPE_ID(belle_sip_header_authorization_t),
BELLE_SIP_TYPE_ID(belle_sip_header_proxy_authorization_t),
BELLE_SIP_TYPE_ID(belle_sip_header_www_authenticate_t),
BELLE_SIP_TYPE_ID(belle_sip_header_proxy_authenticate_t),
BELLE_SIP_TYPE_ID(belle_sip_header_max_forwards_t),
BELLE_SIP_TYPE_ID(belle_sip_header_expires_t),
BELLE_SIP_TYPE_ID(belle_sip_header_allow_t),
BELLE_SIP_TYPE_ID(belle_sdp_attribute_t),
BELLE_SIP_TYPE_ID(belle_sdp_bandwidth_t),
BELLE_SIP_TYPE_ID(belle_sdp_connection_t),
BELLE_SIP_TYPE_ID(belle_sdp_email_t),
BELLE_SIP_TYPE_ID(belle_sdp_info_t),
BELLE_SIP_TYPE_ID(belle_sdp_key_t),
BELLE_SIP_TYPE_ID(belle_sdp_media_t),
BELLE_SIP_TYPE_ID(belle_sdp_media_description_t),
BELLE_SIP_TYPE_ID(belle_sdp_origin_t),
BELLE_SIP_TYPE_ID(belle_sdp_phone_t),
BELLE_SIP_TYPE_ID(belle_sdp_repeate_time_t),
BELLE_SIP_TYPE_ID(belle_sdp_session_description_t),
BELLE_SIP_TYPE_ID(belle_sdp_session_name_t),
BELLE_SIP_TYPE_ID(belle_sdp_time_t),
BELLE_SIP_TYPE_ID(belle_sdp_time_description_t),
BELLE_SIP_TYPE_ID(belle_sdp_uri_t),
BELLE_SIP_TYPE_ID(belle_sdp_version_t),
BELLE_SIP_TYPE_ID(belle_sdp_base_description_t),
BELLE_SIP_TYPE_ID(belle_sdp_mime_parameter_t),
BELLE_SIP_TYPE_ID(belle_sip_callbacks_t),
BELLE_SIP_TYPE_ID(belle_sip_refresher_t),
BELLE_SIP_TYPE_ID(belle_sip_header_subscription_state_t),
BELLE_SIP_TYPE_ID(belle_sip_header_service_route_t),
BELLE_SIP_TYPE_ID(belle_sip_header_refer_to_t),
BELLE_SIP_TYPE_ID(belle_sip_header_referred_by_t),
BELLE_SIP_TYPE_ID(belle_sip_header_replaces_t),
BELLE_SIP_TYPE_ID(belle_sip_header_date_t),
BELLE_SIP_TYPE_ID(belle_sip_header_p_preferred_identity_t),
BELLE_SIP_TYPE_ID(belle_sip_header_privacy_t),
BELLE_SIP_TYPE_ID(belle_sip_certificates_chain_t),
BELLE_SIP_TYPE_ID(belle_sip_signing_key_t),
BELLE_SIP_TYPE_ID(belle_sip_dns_srv_t),
BELLE_SIP_TYPE_ID(belle_sip_simple_resolver_context_t),
BELLE_SIP_TYPE_ID(belle_sip_combined_resolver_context_t),
BELLE_SIP_TYPE_ID(belle_sip_dict_t),
BELLE_SIP_TYPE_ID(belle_sip_dual_resolver_context_t),
BELLE_SIP_TYPE_ID(belle_http_provider_t),
BELLE_SIP_TYPE_ID(belle_http_request_t),
BELLE_SIP_TYPE_ID(belle_http_response_t),
BELLE_SIP_TYPE_ID(belle_http_channel_context_t),
BELLE_SIP_TYPE_ID(belle_generic_uri_t),
BELLE_SIP_TYPE_ID(belle_http_callbacks_t)
BELLE_SIP_DECLARE_TYPES_END
enum belle_sip_interface_ids{
belle_sip_interface_id_first=1,
BELLE_SIP_INTERFACE_ID(belle_sip_channel_listener_t),
BELLE_SIP_INTERFACE_ID(belle_sip_listener_t),
BELLE_SIP_INTERFACE_ID(belle_http_request_listener_t)
};
/*these types are declared here because they are widely used in many headers included after*/
typedef struct belle_sip_listening_point belle_sip_listening_point_t;
typedef struct belle_sip_tls_listening_point belle_sip_tls_listening_point_t;
typedef struct belle_sip_stack belle_sip_stack_t;
typedef struct belle_sip_provider belle_sip_provider_t;
typedef struct belle_http_provider belle_http_provider_t;
typedef struct belle_sip_dialog belle_sip_dialog_t;
typedef struct belle_sip_transaction belle_sip_transaction_t;
typedef struct belle_sip_server_transaction belle_sip_server_transaction_t;
typedef struct belle_sip_client_transaction belle_sip_client_transaction_t;
typedef struct _belle_sip_message belle_sip_message_t;
typedef struct _belle_sip_request belle_sip_request_t;
typedef struct _belle_sip_response belle_sip_response_t;
typedef struct belle_http_request belle_http_request_t;
typedef struct belle_http_response belle_http_response_t;
typedef struct belle_sip_hop belle_sip_hop_t;
typedef struct _belle_generic_uri belle_generic_uri_t;
typedef struct _belle_sip_uri belle_sip_uri_t;
typedef struct _belle_sip_parameters belle_sip_parameters_t;
typedef struct belle_sip_param_pair belle_sip_param_pair_t;
typedef struct _belle_sip_header belle_sip_header_t;
#endif
......@@ -14,6 +14,7 @@ lib_LTLIBRARIES=libbellesip.la
libbellesip_la_SOURCES= \
clock_gettime.c clock_gettime.h \
port.c port.h \
parserutils.h \
belle_sip_uri_impl.c \
belle_sip_headers_impl.c \
belle_sip_utils.c belle_sip_internal.h \
......
/*
belle-sip - SIP (RFC3261) library.
Copyright (C) 2013 Belledonne Communications SARL
This program 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.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "belle_sip_internal.h"
typedef struct belle_http_callbacks belle_http_callbacks_t;
struct belle_http_callbacks{
belle_sip_object_t base;
belle_http_request_listener_callbacks_t cbs;
void *user_ctx;
};
static void process_response_event(belle_http_request_listener_t *l, const belle_http_response_event_t *event){
belle_http_callbacks_t *obj=(belle_http_callbacks_t*)l;
if (obj->cbs.process_response_event)
obj->cbs.process_response_event(obj->user_ctx,event);
}
static void process_io_error(belle_http_request_listener_t *l, const belle_sip_io_error_event_t *event){
belle_http_callbacks_t *obj=(belle_http_callbacks_t*)l;
if (obj->cbs.process_io_error)
obj->cbs.process_io_error(obj->user_ctx,event);
}
static void process_timeout(belle_http_request_listener_t *l, const belle_sip_timeout_event_t *event){
belle_http_callbacks_t *obj=(belle_http_callbacks_t*)l;
if (obj->cbs.process_timeout)
obj->cbs.process_timeout(obj->user_ctx,event);
}
static void process_auth_requested(belle_http_request_listener_t *l, belle_sip_auth_event_t *event){
belle_http_callbacks_t *obj=(belle_http_callbacks_t*)l;
if (obj->cbs.process_auth_requested)
obj->cbs.process_auth_requested(obj->user_ctx,event);
}
BELLE_SIP_DECLARE_VPTR(belle_http_callbacks_t);
BELLE_SIP_IMPLEMENT_INTERFACE_BEGIN(belle_http_callbacks_t,belle_http_request_listener_t)
process_response_event,
process_io_error,
process_timeout,
process_auth_requested
BELLE_SIP_IMPLEMENT_INTERFACE_END
BELLE_SIP_DECLARE_IMPLEMENTED_INTERFACES_1(belle_http_callbacks_t,belle_http_request_listener_t);
static void belle_http_callbacks_destroy(belle_http_callbacks_t *obj){
if (obj->cbs.listener_destroyed)
obj->cbs.listener_destroyed(obj->user_ctx);
}
BELLE_SIP_INSTANCIATE_VPTR(belle_http_callbacks_t,belle_sip_object_t,belle_http_callbacks_destroy,NULL,NULL,FALSE);
belle_http_request_listener_t *belle_http_request_listener_create_from_callbacks(const belle_http_request_listener_callbacks_t *callbacks, void *user_ctx){
belle_http_callbacks_t *obj=belle_sip_object_new(belle_http_callbacks_t);
memcpy(&obj->cbs,callbacks,sizeof(belle_http_request_listener_callbacks_t));
obj->user_ctx=user_ctx;
return BELLE_HTTP_REQUEST_LISTENER(obj);
}
......@@ -160,8 +160,15 @@ belle_http_provider_t *belle_http_provider_new(belle_sip_stack_t *s, const char
static void split_request_url(belle_http_request_t *req){
belle_generic_uri_t *uri=belle_http_request_get_uri(req);
belle_generic_uri_t *new_uri=belle_generic_uri_new();
char *host_value;
belle_generic_uri_set_path(new_uri,belle_generic_uri_get_path(uri));
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),belle_sip_header_create("Host",belle_generic_uri_get_host(uri)));
if (belle_generic_uri_get_port(uri)>0)
host_value=belle_sip_strdup_printf("%s:%i",belle_generic_uri_get_host(uri),belle_generic_uri_get_port(uri));
else
host_value=belle_sip_strdup(belle_generic_uri_get_host(uri));
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),belle_sip_header_create("Host",host_value));
belle_sip_free(host_value);
belle_http_request_set_uri(req,new_uri);
}
......
/*
belle-sip - SIP (RFC3261) library.
Copyright (C) 2010 Belledonne Communications SARL
This program 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.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef belle_sip_parserutils_h
#define belle_sip_parserutils_h
#include "port.h"
#define IS_TOKEN(token) \
(INPUT->toStringTT(INPUT,LT(1),LT(strlen(#token)))->chars ?\
strcasecmp(#token,(const char*)(INPUT->toStringTT(INPUT,LT(1),LT(strlen(#token)))->chars)) == 0:0)
#define IS_HEADER_NAMED(name,compressed_name) (IS_TOKEN(compressed_name) || IS_TOKEN(name))
#define STRCASECMP_HEADER_NAMED(name,compressed_name,value) \
(strcasecmp(compressed_name,(const char*)value) == 0 || strcasecmp(name,(const char*)value) == 0 )
BELLESIP_INTERNAL_EXPORT belle_sip_header_t* belle_sip_header_get_next(const belle_sip_header_t* headers);
BELLESIP_INTERNAL_EXPORT char* belle_sip_to_unescaped_string(const char* buff);
belle_sip_param_pair_t* belle_sip_param_pair_new(const char* name,const char* value);
char* _belle_sip_str_dup_and_unquote_string(const char* quoted_string);
#endif
/*
belle-sip - SIP (RFC3261) library.
Copyright (C) 2010 Belledonne Communications SARL
This program 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.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include "CUnit/Basic.h"
#include "belle-sip/belle-sip.h"
#include "belle_sip_internal.h"
#include "belle_sip_tester.h"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment