Commit 68942842 authored by Simon Morlat's avatar Simon Morlat

remove calls to internal function while a more convenient macro should be used instead.

parent 863dd52d
...@@ -240,15 +240,19 @@ BELLESIP_EXPORT char* belle_sip_object_to_string(void* obj); ...@@ -240,15 +240,19 @@ BELLESIP_EXPORT char* belle_sip_object_to_string(void* obj);
**/ **/
BELLESIP_EXPORT belle_sip_error_code belle_sip_object_marshal(belle_sip_object_t* obj, char* buff, size_t buff_size, size_t *offset); BELLESIP_EXPORT belle_sip_error_code belle_sip_object_marshal(belle_sip_object_t* obj, char* buff, size_t buff_size, size_t *offset);
BELLESIP_EXPORT int belle_sip_object_is_instance_of(belle_sip_object_t * obj,belle_sip_type_id_t id); /* use BELLE_SIP_OBJECT_IS_INSTANCE_OF macro(), this function is for use by the macro only*/
BELLESIP_EXPORT int _belle_sip_object_is_instance_of(belle_sip_object_t * obj,belle_sip_type_id_t id);
BELLE_SIP_END_DECLS BELLE_SIP_END_DECLS
#define BELLE_SIP_CAST(obj,_type) ((_type*)belle_sip_object_cast((belle_sip_object_t *)(obj), _type##_id, #_type, __FILE__, __LINE__)) #define BELLE_SIP_CAST(obj,_type) ((_type*)belle_sip_object_cast((belle_sip_object_t *)(obj), _type##_id, #_type, __FILE__, __LINE__))
#define BELLE_SIP_OBJECT(obj) BELLE_SIP_CAST(obj,belle_sip_object_t) #define BELLE_SIP_OBJECT(obj) BELLE_SIP_CAST(obj,belle_sip_object_t)
#define BELLE_SIP_IS_INSTANCE_OF(obj,_type) belle_sip_object_is_instance_of((belle_sip_object_t*)obj,_type##_id) #define BELLE_SIP_OBJECT_IS_INSTANCE_OF(obj,_type) _belle_sip_object_is_instance_of((belle_sip_object_t*)obj,_type##_id)
#define BELLE_SIP_OBJECT_IS_INSTANCE_OF(obj,_type) BELLE_SIP_IS_INSTANCE_OF(obj,_type)
/*deprecated*/
#define BELLE_SIP_IS_INSTANCE_OF(obj,_type) BELLE_SIP_OBJECT_IS_INSTANCE_OF(obj,_type)
#define belle_sip_object_describe_type(type) \ #define belle_sip_object_describe_type(type) \
belle_sip_object_describe_type_from_name(#type) belle_sip_object_describe_type_from_name(#type)
......
...@@ -32,7 +32,7 @@ static int has_type(belle_sip_object_t *obj, belle_sip_type_id_t id){ ...@@ -32,7 +32,7 @@ static int has_type(belle_sip_object_t *obj, belle_sip_type_id_t id){
return FALSE; return FALSE;
} }
int belle_sip_object_is_instance_of(belle_sip_object_t * obj,belle_sip_type_id_t id) { int _belle_sip_object_is_instance_of(belle_sip_object_t * obj,belle_sip_type_id_t id) {
return has_type(obj,id); return has_type(obj,id);
} }
......
...@@ -773,7 +773,7 @@ If an initial SUBSCRIBE is sent on a pre-existing dialog, a matching ...@@ -773,7 +773,7 @@ If an initial SUBSCRIBE is sent on a pre-existing dialog, a matching
int belle_sip_dialog_is_authorized_transaction(const belle_sip_dialog_t *dialog,const char* method) { int belle_sip_dialog_is_authorized_transaction(const belle_sip_dialog_t *dialog,const char* method) {
if (belle_sip_dialog_request_pending(dialog) && strcasecmp(method,"BYE")!=0 ){ if (belle_sip_dialog_request_pending(dialog) && strcasecmp(method,"BYE")!=0 ){
const char* last_transaction_request = belle_sip_request_get_method(belle_sip_transaction_get_request(dialog->last_transaction)); const char* last_transaction_request = belle_sip_request_get_method(belle_sip_transaction_get_request(dialog->last_transaction));
return last_transaction_request && belle_sip_object_is_instance_of(BELLE_SIP_OBJECT(dialog->last_transaction),belle_sip_client_transaction_t_id) return last_transaction_request && BELLE_SIP_OBJECT_IS_INSTANCE_OF(dialog->last_transaction,belle_sip_client_transaction_t)
&& ((strcasecmp(last_transaction_request,"SUBSCRIBE")==0 && strcasecmp(method,"NOTIFY")==0) && ((strcasecmp(last_transaction_request,"SUBSCRIBE")==0 && strcasecmp(method,"NOTIFY")==0)
|| (strcasecmp(last_transaction_request,"INVITE")==0 && strcasecmp(method,"PRACK")==0)); || (strcasecmp(last_transaction_request,"INVITE")==0 && strcasecmp(method,"PRACK")==0));
} else { } else {
......
...@@ -732,7 +732,7 @@ static message_header_list_t mandatory_headers[] = { ...@@ -732,7 +732,7 @@ static message_header_list_t mandatory_headers[] = {
} }
*/ */
static int belle_sip_check_message_headers(const belle_sip_message_t* message) { static int belle_sip_check_message_headers(const belle_sip_message_t* message) {
if (belle_sip_object_is_instance_of(BELLE_SIP_OBJECT(message),belle_sip_request_t_id)) { if (BELLE_SIP_OBJECT_IS_INSTANCE_OF(message,belle_sip_request_t)) {
int i; int i;
const char * method = belle_sip_request_get_method(BELLE_SIP_REQUEST(message)); const char * method = belle_sip_request_get_method(BELLE_SIP_REQUEST(message));
for (i=0;mandatory_headers[i].method!=NULL;i++) { for (i=0;mandatory_headers[i].method!=NULL;i++) {
......
...@@ -687,7 +687,7 @@ static void authorization_context_fill_from_auth(authorization_context_t* auth_c ...@@ -687,7 +687,7 @@ static void authorization_context_fill_from_auth(authorization_context_t* auth_c
authorization_context_set_qop(auth_context,belle_sip_header_www_authenticate_get_qop_first(authenticate)); authorization_context_set_qop(auth_context,belle_sip_header_www_authenticate_get_qop_first(authenticate));
authorization_context_set_scheme(auth_context,belle_sip_header_www_authenticate_get_scheme(authenticate)); authorization_context_set_scheme(auth_context,belle_sip_header_www_authenticate_get_scheme(authenticate));
authorization_context_set_opaque(auth_context,belle_sip_header_www_authenticate_get_opaque(authenticate)); authorization_context_set_opaque(auth_context,belle_sip_header_www_authenticate_get_opaque(authenticate));
if (belle_sip_object_is_instance_of(BELLE_SIP_OBJECT(authenticate),BELLE_SIP_TYPE_ID(belle_sip_header_proxy_authenticate_t))) { if (BELLE_SIP_OBJECT_IS_INSTANCE_OF(authenticate,belle_sip_header_proxy_authenticate_t)) {
auth_context->is_proxy=1; auth_context->is_proxy=1;
} }
} }
......
...@@ -380,7 +380,7 @@ void channel_parser_tester_recovery_from_error () { ...@@ -380,7 +380,7 @@ void channel_parser_tester_recovery_from_error () {
CU_ASSERT_PTR_NOT_NULL(channel->incoming_messages); CU_ASSERT_PTR_NOT_NULL(channel->incoming_messages);
CU_ASSERT_PTR_NOT_NULL(channel->incoming_messages->data); CU_ASSERT_PTR_NOT_NULL(channel->incoming_messages->data);
message=BELLE_SIP_MESSAGE(channel->incoming_messages->data); message=BELLE_SIP_MESSAGE(channel->incoming_messages->data);
CU_ASSERT_TRUE(belle_sip_object_is_instance_of(BELLE_SIP_OBJECT(message),belle_sip_request_t_id)); CU_ASSERT_TRUE(BELLE_SIP_OBJECT_IS_INSTANCE_OF(message,belle_sip_request_t));
request = BELLE_SIP_REQUEST(message); request = BELLE_SIP_REQUEST(message);
CU_ASSERT_STRING_EQUAL(belle_sip_request_get_method(request),"REGISTER"); CU_ASSERT_STRING_EQUAL(belle_sip_request_get_method(request),"REGISTER");
CU_ASSERT_PTR_NOT_NULL(belle_sip_message_get_header(message,"Expires")); CU_ASSERT_PTR_NOT_NULL(belle_sip_message_get_header(message,"Expires"));
...@@ -428,7 +428,7 @@ void channel_parser_malformed_start () { ...@@ -428,7 +428,7 @@ void channel_parser_malformed_start () {
CU_ASSERT_PTR_NOT_NULL(channel->incoming_messages); CU_ASSERT_PTR_NOT_NULL(channel->incoming_messages);
CU_ASSERT_PTR_NOT_NULL(channel->incoming_messages->data); CU_ASSERT_PTR_NOT_NULL(channel->incoming_messages->data);
message=BELLE_SIP_MESSAGE(channel->incoming_messages->data); message=BELLE_SIP_MESSAGE(channel->incoming_messages->data);
CU_ASSERT_TRUE(belle_sip_object_is_instance_of(BELLE_SIP_OBJECT(message),belle_sip_request_t_id)); CU_ASSERT_TRUE(BELLE_SIP_OBJECT_IS_INSTANCE_OF(message,belle_sip_request_t));
request = BELLE_SIP_REQUEST(message); request = BELLE_SIP_REQUEST(message);
CU_ASSERT_STRING_EQUAL(belle_sip_request_get_method(request),"REGISTER"); CU_ASSERT_STRING_EQUAL(belle_sip_request_get_method(request),"REGISTER");
CU_ASSERT_PTR_NOT_NULL(belle_sip_message_get_header(message,"Expires")); CU_ASSERT_PTR_NOT_NULL(belle_sip_message_get_header(message,"Expires"));
......
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