From 37d50305d6371883ec5678f914bf8a156e0822cc Mon Sep 17 00:00:00 2001 From: bossiel Date: Fri, 28 May 2010 10:20:25 +0000 Subject: [PATCH] - Apply patch send by Laurent Etiemble - Make removeSocket thread-safe - General bug-fix --- trunk/tinyDEMO/common.c | 2 +- trunk/tinyDEMO/options.c | 3 +- trunk/tinyHTTP/include/thttp.h | 20 ++--- .../tinyHTTP/include/tinyhttp/thttp_action.h | 28 +++--- .../tinyHTTP/include/tinyhttp/thttp_message.h | 12 +-- trunk/tinyHTTP/include/tinyhttp/thttp_url.h | 16 ++-- trunk/tinyHTTP/src/parsers/thttp_parser_url.c | 14 +-- trunk/tinyHTTP/src/thttp.c | 12 +-- trunk/tinyHTTP/src/thttp_action.c | 10 +-- trunk/tinyHTTP/src/thttp_dialog.c | 12 +-- trunk/tinyHTTP/src/thttp_session.c | 6 +- trunk/tinyHTTP/src/thttp_url.c | 2 +- trunk/tinyNET/src/tnet_transport_poll.c | 7 +- trunk/tinyNET/src/tnet_transport_win32.c | 8 +- trunk/tinySIP/include/tinysip/tsip_action.h | 28 +++--- trunk/tinySIP/include/tinysip/tsip_message.h | 12 +-- trunk/tinySIP/include/tsip.h | 88 +++++++++---------- trunk/tinySIP/src/api/tsip_api_common.c | 26 +++--- trunk/tinySIP/src/api/tsip_api_message.c | 2 +- trunk/tinySIP/src/api/tsip_api_options.c | 2 +- trunk/tinySIP/src/api/tsip_api_publish.c | 4 +- trunk/tinySIP/src/api/tsip_api_register.c | 50 +++++------ trunk/tinySIP/src/api/tsip_api_subscribe.c | 4 +- trunk/tinySIP/src/dialogs/tsip_dialog.c | 6 +- .../tinySIP/src/dialogs/tsip_dialog_message.c | 10 +-- .../tinySIP/src/dialogs/tsip_dialog_options.c | 10 +-- .../src/dialogs/tsip_dialog_publish.client.c | 8 +- .../src/dialogs/tsip_dialog_register.client.c | 8 +- .../dialogs/tsip_dialog_subscribe.client.c | 8 +- .../src/transactions/tsip_transac_ict.c | 2 +- .../src/transactions/tsip_transac_ist.c | 2 +- .../src/transactions/tsip_transac_layer.c | 2 +- .../src/transactions/tsip_transac_nict.c | 2 +- .../src/transactions/tsip_transac_nist.c | 2 +- trunk/tinySIP/src/tsip.c | 52 +++++------ trunk/tinySIP/src/tsip_action.c | 4 +- trunk/tinySIP/src/tsip_ssession.c | 2 +- trunk/tinyXCAP/include/txcap.h | 4 +- trunk/tinyXCAP/src/txcap.c | 4 +- trunk/tinyXCAP/src/txcap_action.c | 2 +- 40 files changed, 249 insertions(+), 247 deletions(-) diff --git a/trunk/tinyDEMO/common.c b/trunk/tinyDEMO/common.c index 8ba90f48..e7631f41 100644 --- a/trunk/tinyDEMO/common.c +++ b/trunk/tinyDEMO/common.c @@ -714,7 +714,7 @@ tsip_action_handle_t* action_get_config(const opts_L_t* opts) } /* create new action */ - if(!action_config && !(action_config = tsip_action_create(atype_config, + if(!action_config && !(action_config = tsip_action_create(tsip_atype_config, TSIP_ACTION_SET_NULL()))) break; switch(opt->type){ diff --git a/trunk/tinyDEMO/options.c b/trunk/tinyDEMO/options.c index cdd7a99b..c82eb0a9 100644 --- a/trunk/tinyDEMO/options.c +++ b/trunk/tinyDEMO/options.c @@ -95,10 +95,9 @@ int options_hack_aor(const tsip_response_t* resp) if(resp && resp->firstVia){ if(resp->firstVia->rport <=0){ char* received_port_ext; - const tsk_param_t* param; /* Ericsson SDS ==> Via: SIP/2.0/TCP 192.168.0.12:49744;rport;branch=z9hG4bK1273100904048;received_port_ext=49744;received=192.168.0.12 */ - if((received_port_ext = tsip_header_get_param_value(resp->firstVia, "received_port_ext"))){ + if((received_port_ext = tsip_header_get_param_value((const tsip_header_t*)resp->firstVia, "received_port_ext"))){ rport = (int32_t)atoi(received_port_ext); TSK_FREE(received_port_ext); } diff --git a/trunk/tinyHTTP/include/thttp.h b/trunk/tinyHTTP/include/thttp.h index 9f66b6b9..92877062 100644 --- a/trunk/tinyHTTP/include/thttp.h +++ b/trunk/tinyHTTP/include/thttp.h @@ -85,22 +85,22 @@ THTTP_BEGIN_DECLS typedef enum thttp_stack_param_type_e { - pname_null = tsk_null, -#define THTTP_STACK_SET_NULL() pname_null + thttp_pname_null = tsk_null, +#define THTTP_STACK_SET_NULL() thttp_pname_null /* Network */ - pname_local_ip, - pname_local_port, -#define THTTP_STACK_SET_LOCAL_IP(IP_STR) pname_local_ip, (const char*)IP_STR -#define THTTP_STACK_SET_LOCAL_PORT(PORT_INT) pname_local_port, (int)PORT_INT + thttp_pname_local_ip, + thttp_pname_local_port, +#define THTTP_STACK_SET_LOCAL_IP(IP_STR) thttp_pname_local_ip, (const char*)IP_STR +#define THTTP_STACK_SET_LOCAL_PORT(PORT_INT) thttp_pname_local_port, (int)PORT_INT /* TLS */ - pname_tls_certs, -#define THTTP_STACK_SET_TLS_CERTS(CA_FILE_STR, PUB_FILE_STR, PRIV_FILE_STR) pname_tls_certs, (const char*)CA_FILE_STR, (const char*)PUB_FILE_STR, (const char*)PRIV_FILE_STR + thttp_pname_tls_certs, +#define THTTP_STACK_SET_TLS_CERTS(CA_FILE_STR, PUB_FILE_STR, PRIV_FILE_STR) thttp_pname_tls_certs, (const char*)CA_FILE_STR, (const char*)PUB_FILE_STR, (const char*)PRIV_FILE_STR /* User Data */ - pname_userdata, -#define THTTP_STACK_SET_USERDATA(USERDATA_PTR) pname_userdata, (const void*)USERDATA_PTR + thttp_pname_userdata, +#define THTTP_STACK_SET_USERDATA(USERDATA_PTR) thttp_pname_userdata, (const void*)USERDATA_PTR } thttp_stack_param_type_t; diff --git a/trunk/tinyHTTP/include/tinyhttp/thttp_action.h b/trunk/tinyHTTP/include/tinyhttp/thttp_action.h index 67504709..f3926d90 100644 --- a/trunk/tinyHTTP/include/tinyhttp/thttp_action.h +++ b/trunk/tinyHTTP/include/tinyhttp/thttp_action.h @@ -60,26 +60,26 @@ thttp_action_option_t; typedef enum thttp_action_type_e { /* Outgoing GET, PUT, HEAD, DELETE, .... */ - atype_o_request, + thttp_atype_o_request, /* Incoming message */ - atype_i_message, + thttp_atype_i_message, /* common */ - atype_closed, - atype_error, - atype_close, - atype_cancel, + thttp_thttp_atype_closed, + thttp_atype_error, + thttp_atype_close, + thttp_atype_cancel, } thttp_action_type_t; typedef enum thttp_action_param_type_e { - aptype_null = tsk_null, + thttp_aptype_null = tsk_null, - aptype_option, - aptype_header, - aptype_payload, + thttp_aptype_option, + thttp_aptype_header, + thttp_aptype_payload, } thttp_action_param_type_t; @@ -133,10 +133,10 @@ thttp_action_PUT(session, "http://www.doubango.org" * @def THTTP_ACTION_SET_NULL * Ends action parameters. Must always be the last one. */ -#define THTTP_ACTION_SET_OPTION(ID_ENUM, VALUE_STR) aptype_option, (thttp_action_option_t)ID_ENUM, (const char*)VALUE_STR -#define THTTP_ACTION_SET_HEADER(NAME_STR, VALUE_STR) aptype_header, (const char*)NAME_STR, (const char*)VALUE_STR -#define THTTP_ACTION_SET_PAYLOAD(PAY_PTR, PAY_SIZE) aptype_payload, (const void*)PAY_PTR, (tsk_size_t)PAY_SIZE -#define THTTP_ACTION_SET_NULL() aptype_null +#define THTTP_ACTION_SET_OPTION(ID_ENUM, VALUE_STR) thttp_aptype_option, (thttp_action_option_t)ID_ENUM, (const char*)VALUE_STR +#define THTTP_ACTION_SET_HEADER(NAME_STR, VALUE_STR) thttp_aptype_header, (const char*)NAME_STR, (const char*)VALUE_STR +#define THTTP_ACTION_SET_PAYLOAD(PAY_PTR, PAY_SIZE) thttp_aptype_payload, (const void*)PAY_PTR, (tsk_size_t)PAY_SIZE +#define THTTP_ACTION_SET_NULL() thttp_aptype_null typedef struct thttp_action_s { diff --git a/trunk/tinyHTTP/include/tinyhttp/thttp_message.h b/trunk/tinyHTTP/include/tinyhttp/thttp_message.h index 3e0a0398..90778e92 100644 --- a/trunk/tinyHTTP/include/tinyhttp/thttp_message.h +++ b/trunk/tinyHTTP/include/tinyhttp/thttp_message.h @@ -221,7 +221,7 @@ TINYHTTP_API int thttp_message_add_headers(thttp_message_t *self, const thttp_he TINYHTTP_API int thttp_message_add_content(thttp_message_t *self, const char* content_type, const void* content, tsk_size_t size); TINYHTTP_API int thttp_message_append_content(thttp_message_t *self, const void* content, tsk_size_t size); -#if !defined(_MSC_VER) || defined(__GNUC__) +#if defined(__SYMBIAN32__) && 0 static void THTTP_MESSAGE_ADD_HEADER(thttp_message_t *self, ...) { va_list ap; @@ -237,11 +237,11 @@ static void THTTP_MESSAGE_ADD_HEADER(thttp_message_t *self, ...) tsk_object_unref(header); } #else -#define THTTP_MESSAGE_ADD_HEADER(self, objdef, ...) \ - { \ - thttp_header_t *header = tsk_object_new(objdef, __VA_ARGS__); \ - thttp_message_add_header(self, header); \ - tsk_object_unref(header); \ +#define THTTP_MESSAGE_ADD_HEADER(self, objdef, ...) \ + { \ + thttp_header_t *header = (thttp_header_t *)tsk_object_new(objdef, ##__VA_ARGS__); \ + thttp_message_add_header(self, header); \ + tsk_object_unref(header); \ } #endif diff --git a/trunk/tinyHTTP/include/tinyhttp/thttp_url.h b/trunk/tinyHTTP/include/tinyhttp/thttp_url.h index fa458d18..950662f5 100644 --- a/trunk/tinyHTTP/include/tinyhttp/thttp_url.h +++ b/trunk/tinyHTTP/include/tinyhttp/thttp_url.h @@ -38,24 +38,24 @@ THTTP_BEGIN_DECLS -#define THTTP_URL_IS_SECURE(url) ((url && url->type==url_https) ? 1 : 0) +#define THTTP_URL_IS_SECURE(url) ((url && url->type==thttp_url_https) ? 1 : 0) /** Url type. */ typedef enum thttp_url_type_e { - url_unknown, - url_http, - url_https, + thttp_url_unknown, + thttp_url_http, + thttp_url_https, } thttp_url_type_t; typedef enum thttp_host_type_e { - host_unknown, - host_hostname, - host_ipv4, - host_ipv6 + thttp_host_unknown, + thttp_host_hostname, + thttp_host_ipv4, + thttp_host_ipv6 } thttp_host_type_t; diff --git a/trunk/tinyHTTP/src/parsers/thttp_parser_url.c b/trunk/tinyHTTP/src/parsers/thttp_parser_url.c index 4cbf14c4..08ea3c14 100644 --- a/trunk/tinyHTTP/src/parsers/thttp_parser_url.c +++ b/trunk/tinyHTTP/src/parsers/thttp_parser_url.c @@ -66,7 +66,7 @@ thttp_url_t *thttp_url_parse(const char *urlstring, tsk_size_t length) const char *ts = 0, *te = 0; int act =0; - thttp_url_t *url = thttp_url_create(url_unknown); + thttp_url_t *url = thttp_url_create(thttp_url_unknown); const char *tag_start = 0; @@ -364,23 +364,23 @@ _match: break; case 1: /* #line 50 "./ragel/thttp_parser_url.rl" */ - { url->scheme = tsk_strdup("http"), url->type = url_http; } + { url->scheme = tsk_strdup("http"), url->type = thttp_url_http; } break; case 2: /* #line 51 "./ragel/thttp_parser_url.rl" */ - { url->scheme = tsk_strdup("https"), url->type = url_https; } + { url->scheme = tsk_strdup("https"), url->type = thttp_url_https; } break; case 3: /* #line 54 "./ragel/thttp_parser_url.rl" */ - { url->host_type = url->host_type = host_ipv4; } + { url->host_type = url->host_type = thttp_host_ipv4; } break; case 4: /* #line 55 "./ragel/thttp_parser_url.rl" */ - { url->host_type = url->host_type = host_ipv6; } + { url->host_type = url->host_type = thttp_host_ipv6; } break; case 5: /* #line 56 "./ragel/thttp_parser_url.rl" */ - { url->host_type = url->host_type = host_hostname; } + { url->host_type = url->host_type = thttp_host_hostname; } break; case 6: /* #line 58 "./ragel/thttp_parser_url.rl" */ @@ -472,7 +472,7 @@ _again: TSK_OBJECT_SAFE_FREE(url); } else if(!have_port){ - if(url->type == url_https){ + if(url->type == thttp_url_https){ url->port = 443; } else{ diff --git a/trunk/tinyHTTP/src/thttp.c b/trunk/tinyHTTP/src/thttp.c index 26a94f2b..33228f66 100644 --- a/trunk/tinyHTTP/src/thttp.c +++ b/trunk/tinyHTTP/src/thttp.c @@ -372,7 +372,7 @@ static int thttp_transport_layer_stream_cb(const tnet_transport_event_t* e) /* Alert the operation (FSM) */ if(message){ if(have_all_content){ /* only if we have all data */ - ret = thttp_dialog_fsm_act(dialog, atype_i_message, message, tsk_null); + ret = thttp_dialog_fsm_act(dialog, thttp_atype_i_message, message, tsk_null); } } @@ -392,19 +392,19 @@ int __thttp_stack_set(thttp_stack_t *self, va_list* app) { thttp_stack_param_type_t curr; - while((curr = va_arg(*app, thttp_stack_param_type_t)) != pname_null) + while((curr = va_arg(*app, thttp_stack_param_type_t)) != thttp_pname_null) { switch(curr) { // // Network // - case pname_local_ip: + case thttp_pname_local_ip: { /* STR */ tsk_strupdate(&self->local_ip, va_arg(*app, const char*)); break; } - case pname_local_port: + case thttp_pname_local_port: { /* INT */ self->local_port = va_arg(*app, int); break; @@ -413,7 +413,7 @@ int __thttp_stack_set(thttp_stack_t *self, va_list* app) // // TLS // - case pname_tls_certs: + case thttp_pname_tls_certs: { /* A_FILE_STR, PUB_FILE_STR, PRIV_FILE_STR */ tsk_strupdate(&self->tls.ca, va_arg(*app, const char*)); tsk_strupdate(&self->tls.pbk, va_arg(*app, const char*)); @@ -424,7 +424,7 @@ int __thttp_stack_set(thttp_stack_t *self, va_list* app) // // Userdata // - case pname_userdata: + case thttp_pname_userdata: { /* (const void*)USERDATA_PTR */ self->userdata = va_arg(*app, const void*); break; diff --git a/trunk/tinyHTTP/src/thttp_action.c b/trunk/tinyHTTP/src/thttp_action.c index 6ad3f548..a06c2e91 100644 --- a/trunk/tinyHTTP/src/thttp_action.c +++ b/trunk/tinyHTTP/src/thttp_action.c @@ -77,7 +77,7 @@ int thttp_action_perform(thttp_session_handle_t *session, const char* urlstring, } va_start(ap, method); - if((action = thttp_action_create(atype_o_request, urlstring, method, &ap))){ + if((action = thttp_action_create(thttp_atype_o_request, urlstring, method, &ap))){ if((dialog = thttp_dialog_new(sess))){ ret = thttp_dialog_fsm_act(dialog, action->type, tsk_null, action); @@ -119,9 +119,9 @@ static tsk_object_t* thttp_action_ctor(tsk_object_t * self, va_list * app) goto bail; } - while((curr = va_arg(*app_2, thttp_action_param_type_t)) != aptype_null){ + while((curr = va_arg(*app_2, thttp_action_param_type_t)) != thttp_aptype_null){ switch(curr){ - case aptype_option: + case thttp_aptype_option: { /* (thttp_action_option_t)ID_ENUM, (const char*)VALUE_STR */ thttp_action_option_t id = va_arg(*app_2, thttp_action_option_t); const char* value = va_arg(*app_2, const char *); @@ -129,7 +129,7 @@ static tsk_object_t* thttp_action_ctor(tsk_object_t * self, va_list * app) break; } - case aptype_header: + case thttp_aptype_header: { /* (const char*)NAME_STR, (const char*)VALUE_STR */ const char* name = va_arg(*app_2, const char *); const char* value = va_arg(*app_2, const char *); @@ -137,7 +137,7 @@ static tsk_object_t* thttp_action_ctor(tsk_object_t * self, va_list * app) break; } - case aptype_payload: + case thttp_aptype_payload: { /* (const void*)PAY_PTR, (tsk_size_t)PAY_SIZE */ const void* payload = va_arg(*app_2, const void *); tsk_size_t size = va_arg(*app_2, tsk_size_t); diff --git a/trunk/tinyHTTP/src/thttp_dialog.c b/trunk/tinyHTTP/src/thttp_dialog.c index 5d655c73..bed4a046 100644 --- a/trunk/tinyHTTP/src/thttp_dialog.c +++ b/trunk/tinyHTTP/src/thttp_dialog.c @@ -75,11 +75,11 @@ tsk_bool_t _fsm_cond_i_1xx(thttp_dialog_t* self, thttp_message_t* message) /* ======================== actions ======================== */ typedef enum _fsm_action_e { - _fsm_action_request = atype_o_request, - _fsm_action_close = atype_close, - _fsm_action_message = atype_i_message, - _fsm_action_closed = atype_closed, - _fsm_action_error = atype_error, // Transport error and not HTTP message error (e.g. 409) + _fsm_action_request = thttp_atype_o_request, + _fsm_action_close = thttp_atype_close, + _fsm_action_message = thttp_atype_i_message, + _fsm_action_closed = thttp_thttp_atype_closed, + _fsm_action_error = thttp_atype_error, // Transport error and not HTTP message error (e.g. 409) /* _fsm_action_any_other = 0xFF */ } @@ -338,7 +338,7 @@ int thttp_dialog_send_request(thttp_dialog_t *self) goto bail; } else{ - if(request->line.request.url->type == url_https){ + if(request->line.request.url->type == thttp_url_https){ TNET_SOCKET_TYPE_SET_TLS(type); } else{ diff --git a/trunk/tinyHTTP/src/thttp_session.c b/trunk/tinyHTTP/src/thttp_session.c index 7a2792fe..fbe55317 100644 --- a/trunk/tinyHTTP/src/thttp_session.c +++ b/trunk/tinyHTTP/src/thttp_session.c @@ -374,7 +374,7 @@ again: } switch(atype){ - case atype_closed: + case thttp_thttp_atype_closed: self->fd = TNET_INVALID_FD; break; default: @@ -389,13 +389,13 @@ again: /** Signals to all dialogs that the connection have been closed. */ int thttp_session_signal_closed(thttp_session_t *self) { - return thttp_session_signal(self, atype_closed); + return thttp_session_signal(self, thttp_thttp_atype_closed); } /** Signals to all dialogss that we got an error */ int thttp_session_signal_error(thttp_session_t *self) { - return thttp_session_signal(self, atype_error); + return thttp_session_signal(self, thttp_atype_error); } /** Retrieves a session by fd */ diff --git a/trunk/tinyHTTP/src/thttp_url.c b/trunk/tinyHTTP/src/thttp_url.c index 5f111b95..7c271943 100644 --- a/trunk/tinyHTTP/src/thttp_url.c +++ b/trunk/tinyHTTP/src/thttp_url.c @@ -133,7 +133,7 @@ static tsk_object_t* thttp_url_ctor(tsk_object_t *self, va_list * app) thttp_url_t *url = self; if(url){ url->type = va_arg(*app, thttp_url_type_t); - if(url->type == url_https){ + if(url->type == thttp_url_https){ url->port = 443; } else{ diff --git a/trunk/tinyNET/src/tnet_transport_poll.c b/trunk/tinyNET/src/tnet_transport_poll.c index b90fe691..1202d693 100644 --- a/trunk/tinyNET/src/tnet_transport_poll.c +++ b/trunk/tinyNET/src/tnet_transport_poll.c @@ -315,8 +315,9 @@ int removeSocket(int index, transport_context_t *context) { int i; + tsk_safeobj_lock(context); + if(index < (int)context->count){ - tsk_safeobj_lock(context); /* Close the socket if we are the owner. */ if(context->sockets[index]->owner){ @@ -336,9 +337,9 @@ int removeSocket(int index, transport_context_t *context) context->sockets[context->count-1] = 0; context->count--; - - tsk_safeobj_unlock(context); } + + tsk_safeobj_unlock(context); return 0; } diff --git a/trunk/tinyNET/src/tnet_transport_win32.c b/trunk/tinyNET/src/tnet_transport_win32.c index 1f38a6e2..3799e6ec 100644 --- a/trunk/tinyNET/src/tnet_transport_win32.c +++ b/trunk/tinyNET/src/tnet_transport_win32.c @@ -360,9 +360,10 @@ static int removeSocket(int index, transport_context_t *context) { tsk_size_t i; + tsk_safeobj_lock(context); + if(index < (int)context->count) { - tsk_safeobj_lock(context); /* Close the socket if we are the owner. */ if(context->sockets[index]->owner){ @@ -388,9 +389,10 @@ static int removeSocket(int index, transport_context_t *context) context->events[context->count-1] = 0; context->count--; - - tsk_safeobj_unlock(context); } + + tsk_safeobj_unlock(context); + return 0; } diff --git a/trunk/tinySIP/include/tinysip/tsip_action.h b/trunk/tinySIP/include/tinysip/tsip_action.h index c385f644..031abc70 100644 --- a/trunk/tinySIP/include/tinysip/tsip_action.h +++ b/trunk/tinySIP/include/tinysip/tsip_action.h @@ -46,41 +46,41 @@ typedef uint64_t tsip_action_id_t; typedef enum tsip_action_type_e { //! Used as configuration action - atype_config, + tsip_atype_config, /* === REGISTER == */ - atype_register, /**< Sends SIP REGISTER request */ + tsip_atype_register, /**< Sends SIP REGISTER request */ //! Unregister by sending SIP REGISTER request with expires value equals to zero -#define atype_unregister atype_hangup +#define tsip_atype_unregister tsip_atype_hangup /* === SUBSCRIBE === */ - atype_subscribe, /**< Sends SIP SUBSCRIBE request */ + tsip_atype_subscribe, /**< Sends SIP SUBSCRIBE request */ //! Unsubsribe by sending SIP SUBSCRIBE request with expires value equals to zero -#define atype_unsubscribe atype_hangup +#define tsip_atype_unsubscribe tsip_atype_hangup /* === MESSAGE === */ - atype_message_send, /**< Sends SIP MESSAGE request */ + tsip_atype_message_send, /**< Sends SIP MESSAGE request */ /* === PUBLISH === */ - atype_publish, /**< Sends SIP PUBLISH request */ + tsip_atype_publish, /**< Sends SIP PUBLISH request */ //! Unpublish by sending SIP PUBLISH request with expires value equals to zero -#define atype_unpublish atype_hangup +#define tsip_atype_unpublish tsip_atype_hangup /* === OPTIONS === */ - atype_options_send, /**< Sends SIP OPTIONS request */ + tsip_atype_options_send, /**< Sends SIP OPTIONS request */ /* === common === */ //! Accept incoming call (INVITE) or message (SIP MESSAGE) - atype_accept, + tsip_atype_accept, //! Reject incoming call (INVITE) or message (SIP MESSAGE) - atype_reject, + tsip_atype_reject, //! Cancel an outgoing request - atype_cancel, + tsip_atype_cancel, //! Hangup any SIP dialog (BYE, unREGISTER, unSUBSCRIBE ...). If the dialog is in early state, then it will be canceled. - atype_hangup, + tsip_atype_hangup, //! Shutdown a SIP dialog. Should only be called by the stack. - atype_shutdown, + tsip_atype_shutdown, } tsip_action_type_t; diff --git a/trunk/tinySIP/include/tinysip/tsip_message.h b/trunk/tinySIP/include/tinysip/tsip_message.h index f26339a4..f7ab7325 100644 --- a/trunk/tinySIP/include/tinysip/tsip_message.h +++ b/trunk/tinySIP/include/tinysip/tsip_message.h @@ -236,7 +236,7 @@ TINYSIP_API int tsip_message_add_header(tsip_message_t *self, const tsip_header_ 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(_MSC_VER) || defined(__GNUC__) +#if defined(__SYMBIAN32__) && 0 static void TSIP_MESSAGE_ADD_HEADER(tsip_message_t *self, ...) { va_list ap; @@ -252,11 +252,11 @@ static void TSIP_MESSAGE_ADD_HEADER(tsip_message_t *self, ...) tsk_object_unref(header); } #else -#define TSIP_MESSAGE_ADD_HEADER(self, objdef, ...) \ - { \ - tsip_header_t *header = tsk_object_new(objdef, __VA_ARGS__); \ - tsip_message_add_header(self, header); \ - tsk_object_unref(header); \ +#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 diff --git a/trunk/tinySIP/include/tsip.h b/trunk/tinySIP/include/tsip.h index ebfb0dbd..6e93fbdc 100644 --- a/trunk/tinySIP/include/tsip.h +++ b/trunk/tinySIP/include/tsip.h @@ -58,40 +58,40 @@ typedef uint8_t operator_id_t[16]; typedef enum tsip_stack_param_type_e { - pname_null = tsk_null, + tsip_pname_null = tsk_null, /* === Identity === */ - pname_display_name, - pname_impu, - pname_preferred_id, - pname_impi, - pname_password, + tsip_pname_display_name, + tsip_pname_impu, + tsip_pname_preferred_id, + tsip_pname_impi, + tsip_pname_password, /* === Network === */ - pname_realm, - pname_local_ip, - pname_local_port, - pname_aor, - pname_discovery_naptr, - pname_discovery_dhcp, - pname_proxy_cscf, + 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, pnale_dnsserver, /* === Security === */ - pname_early_ims, - pname_secagree_ipsec, - pname_secagree_tls, - pname_amf, - pname_operator_id, - pname_tls_certs, - pname_ipsec_params, + 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 === */ - pname_header, + tsip_pname_header, /* === User Data === */ - pname_userdata + tsip_pname_userdata } tsip_stack_param_type_t; @@ -100,7 +100,7 @@ tsip_stack_param_type_t; * @def TSIP_STACK_SET_NULL * Ends the stack parameters. Mandatory and should be the last one. */ -#define TSIP_STACK_SET_NULL() pname_null +#define TSIP_STACK_SET_NULL() tsip_pname_null /* === Identity === */ /**@ingroup tsip_stack_group @@ -153,11 +153,11 @@ tsip_stack_param_type_t; * TSIP_STACK_SET_NULL()); * @endcode */ -#define TSIP_STACK_SET_DISPLAY_NAME(NAME_STR) pname_display_name, (const char*)NAME_STR -#define TSIP_STACK_SET_IMPU(URI_STR) pname_impu, (const char*)URI_STR -#define TSIP_STACK_SET_PREFERRED_IDENTITY(URI_STR) pname_preferred_id, (const char*)URI_STR -#define TSIP_STACK_SET_IMPI(IMPI_STR) pname_impi, (const char*)IMPI_STR -#define TSIP_STACK_SET_PASSWORD(PASSORD_STR) pname_password, (const char*)PASSORD_STR +#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 /* === Network === */ /**@ingroup tsip_stack_group @@ -264,13 +264,13 @@ int ret = tsip_stack_set(stack, TSIP_STACK_SET_NULL()); * @endcode */ -#define TSIP_STACK_SET_REALM(URI_STR) pname_realm, (const char*)URI_STR -#define TSIP_STACK_SET_LOCAL_IP(IP_STR) pname_local_ip, (const char*)IP_STR -#define TSIP_STACK_SET_LOCAL_PORT(PORT_UINT) pname_local_port, (unsigned)PORT_UINT -#define TSIP_STACK_SET_AOR(IP_STR, PORT_UINT) pname_aor, (const char*)IP_STR, (unsigned)PORT_UINT -#define TSIP_STACK_SET_DISCOVERY_NAPTR(ENABLED_BOOL) pname_discovery_naptr, (tsk_bool_t)ENABLED_BOOL -#define TSIP_STACK_SET_DISCOVERY_DHCP(ENABLED_BOOL) pname_discovery_dhcp, (tsk_bool_t)ENABLED_BOOL -#define TSIP_STACK_SET_PROXY_CSCF(FQDN_STR, PORT_UINT, TRANSPORT_STR, IP_VERSION_STR) pname_proxy_cscf, (const char*)FQDN_STR, (unsigned)PORT_UINT, (const char*)TRANSPORT_STR, (const char*)IP_VERSION_STR +#define TSIP_STACK_SET_REALM(URI_STR) tsip_pname_realm, (const char*)URI_STR +#define TSIP_STACK_SET_LOCAL_IP(IP_STR) tsip_pname_local_ip, (const char*)IP_STR +#define TSIP_STACK_SET_LOCAL_PORT(PORT_UINT) tsip_pname_local_port, (unsigned)PORT_UINT +#define TSIP_STACK_SET_AOR(IP_STR, PORT_UINT) tsip_pname_aor, (const char*)IP_STR, (unsigned)PORT_UINT +#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) pnale_dnsserver, (const char*)IP_STR /* === Security === */ @@ -363,13 +363,13 @@ int ret = tsip_stack_set(stack, * * @sa @ref TSIP_STACK_SET_IPSEC_PARAMS() */ -#define TSIP_STACK_SET_EARLY_IMS(ENABLED_BOOL) pname_early_ims, (tsk_bool_t)ENABLED_BOOL -#define TSIP_STACK_SET_SECAGREE_IPSEC(ENABLED_BOOL) pname_scagree_ipsec, (tsk_bool_t)ENABLED_BOOL -#define TSIP_STACK_SET_SECAGREE_TLS(ENABLED_BOOL) pname_scagree_tls, (tsk_bool_t)ENABLED_BOOL -#define TSIP_STACK_SET_IMS_AKA_AMF(AMF_UINT16) pname_amf, (uint16_t)AMF_UINT16 -#define TSIP_STACK_SET_IMS_AKA_OPERATOR_ID(OPID_HEX_STR) pname_operator_id, (const char*)OPID_HEX_STR -#define TSIP_STACK_SET_IPSEC_PARAMS(ALG_STR, EALG_STR, MODE_STR, PROTOCOL_STR) 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) pname_tls_certs, (const char*)CA_FILE_STR, (const char*)PUB_FILE_STR, (const char*)PRIV_FILE_STR +#define TSIP_STACK_SET_EARLY_IMS(ENABLED_BOOL) tsip_pname_early_ims, (tsk_bool_t)ENABLED_BOOL +#define TSIP_STACK_SET_SECAGREE_IPSEC(ENABLED_BOOL) tsip_pname_scagree_ipsec, (tsk_bool_t)ENABLED_BOOL +#define TSIP_STACK_SET_SECAGREE_TLS(ENABLED_BOOL) tsip_pname_scagree_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_pname_tls_certs, (const char*)CA_FILE_STR, (const char*)PUB_FILE_STR, (const char*)PRIV_FILE_STR /* === Headers === */ @@ -401,7 +401,7 @@ int ret = tsip_stack_set(stack, * * @sa @ref TSIP_STACK_SET_HEADER() */ -#define TSIP_STACK_SET_HEADER(NAME_STR, VALUE_STR) pname_header, (const char*)NAME_STR, (const char*)VALUE_STR +#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)) /* === User Data === */ @@ -416,7 +416,7 @@ int ret = tsip_stack_set(stack, * TSIP_STACK_SET_NULL()); * @endcode */ -#define TSIP_STACK_SET_USERDATA(DATA_PTR) pname_userdata, (const void*)DATA_PTR +#define TSIP_STACK_SET_USERDATA(DATA_PTR) tsip_pname_userdata, (const void*)DATA_PTR diff --git a/trunk/tinySIP/src/api/tsip_api_common.c b/trunk/tinySIP/src/api/tsip_api_common.c index 4b804392..251a495d 100644 --- a/trunk/tinySIP/src/api/tsip_api_common.c +++ b/trunk/tinySIP/src/api/tsip_api_common.c @@ -48,21 +48,21 @@ int _tsip_action_ANY(const tsip_ssession_handle_t *ss, tsip_action_type_t type, const tsip_ssession_t* _ss; /* Checks for validity */ - if(!(_ss = ss) || !_ss->stack){ - TSK_DEBUG_ERROR("Invalid parameter."); - return ret; + if(!(_ss = ss) || !_ss->stack){ + TSK_DEBUG_ERROR("Invalid parameter."); + return ret; } - /* Checks if the stack has been started */ - if(!TSK_RUNNABLE(_ss->stack)->started){ - TSK_DEBUG_ERROR("Stack not started."); - return -2; + /* Checks if the stack has been started */ + if(!TSK_RUNNABLE(_ss->stack)->started){ + TSK_DEBUG_ERROR("Stack not started."); + return -2; } /* execute action */ - if((action = _tsip_action_create(type, app))){ - ret = tsip_ssession_handle(_ss, action); - TSK_OBJECT_SAFE_FREE(action); + if((action = _tsip_action_create(type, app))){ + ret = tsip_ssession_handle(_ss, action); + TSK_OBJECT_SAFE_FREE(action); } return ret; } @@ -80,7 +80,7 @@ int tsip_action_REJECT(const tsip_ssession_handle_t *ss, ...) va_list ap; va_start(ap, ss); - if((ret = _tsip_action_ANY(ss, atype_reject, &ap))){ + if((ret = _tsip_action_ANY(ss, tsip_atype_reject, &ap))){ TSK_DEBUG_ERROR("Reject() failed."); } va_end(ap); @@ -102,7 +102,7 @@ int tsip_action_HANGUP(const tsip_ssession_handle_t *ss, ...) va_list ap; va_start(ap, ss); - if((ret = _tsip_action_ANY(ss, atype_hangup, &ap))){ + if((ret = _tsip_action_ANY(ss, tsip_atype_hangup, &ap))){ TSK_DEBUG_ERROR("Hang-up() failed."); } va_end(ap); @@ -123,7 +123,7 @@ int tsip_action_ACCEPT(const tsip_ssession_handle_t *ss, ...) va_list ap; va_start(ap, ss); - if((ret = _tsip_action_ANY(ss, atype_accept, &ap))){ + if((ret = _tsip_action_ANY(ss, tsip_atype_accept, &ap))){ TSK_DEBUG_ERROR("Accept() failed."); } va_end(ap); diff --git a/trunk/tinySIP/src/api/tsip_api_message.c b/trunk/tinySIP/src/api/tsip_api_message.c index 80517d0b..87239513 100644 --- a/trunk/tinySIP/src/api/tsip_api_message.c +++ b/trunk/tinySIP/src/api/tsip_api_message.c @@ -72,7 +72,7 @@ int tsip_action_MESSAGE(const tsip_ssession_handle_t *ss, ...) /* action */ va_start(ap, ss); - if((action = _tsip_action_create(atype_message_send, &ap))){ + if((action = _tsip_action_create(tsip_atype_message_send, &ap))){ if(!(dialog = tsip_dialog_layer_find_by_ss(_ss->stack->layer_dialog, ss))){ dialog = tsip_dialog_layer_new(_ss->stack->layer_dialog, tsip_dialog_MESSAGE, ss); } diff --git a/trunk/tinySIP/src/api/tsip_api_options.c b/trunk/tinySIP/src/api/tsip_api_options.c index de84ca60..6ced0245 100644 --- a/trunk/tinySIP/src/api/tsip_api_options.c +++ b/trunk/tinySIP/src/api/tsip_api_options.c @@ -71,7 +71,7 @@ int tsip_action_OPTIONS(const tsip_ssession_handle_t *ss, ...) } va_start(ap, ss); - if((action = _tsip_action_create(atype_options_send, &ap))){ + if((action = _tsip_action_create(tsip_atype_options_send, &ap))){ if(!(dialog = tsip_dialog_layer_find_by_ss(_ss->stack->layer_dialog, ss))){ dialog = tsip_dialog_layer_new(_ss->stack->layer_dialog, tsip_dialog_OPTIONS, ss); } diff --git a/trunk/tinySIP/src/api/tsip_api_publish.c b/trunk/tinySIP/src/api/tsip_api_publish.c index d7f17d07..c9ef6782 100644 --- a/trunk/tinySIP/src/api/tsip_api_publish.c +++ b/trunk/tinySIP/src/api/tsip_api_publish.c @@ -71,7 +71,7 @@ int tsip_action_PUBLISH(const tsip_ssession_handle_t *ss, ...) } va_start(ap, ss); - if((action = _tsip_action_create(atype_publish, &ap))){ + if((action = _tsip_action_create(tsip_atype_publish, &ap))){ if(!(dialog = tsip_dialog_layer_find_by_ss(_ss->stack->layer_dialog, ss))){ dialog = tsip_dialog_layer_new(_ss->stack->layer_dialog, tsip_dialog_PUBLISH, ss); } @@ -104,7 +104,7 @@ int tsip_action_UNPUBLISH(const tsip_ssession_handle_t *ss, ...) } va_start(ap, ss); - if((action = _tsip_action_create(atype_unpublish, &ap))){ + if((action = _tsip_action_create(tsip_atype_unpublish, &ap))){ ret = tsip_ssession_handle(ss, action); TSK_OBJECT_SAFE_FREE(action); } diff --git a/trunk/tinySIP/src/api/tsip_api_register.c b/trunk/tinySIP/src/api/tsip_api_register.c index 968e7904..fde438d8 100644 --- a/trunk/tinySIP/src/api/tsip_api_register.c +++ b/trunk/tinySIP/src/api/tsip_api_register.c @@ -55,14 +55,14 @@ int tsip_register_event_signal(tsip_register_event_type_t type, tsip_ssession_t* return 0; } -/**@ingroup tsip_action_group -* Sends SIP REGISTER request. If the session is already established, the same dialog will -* be used (refresh). -* @param ss The SIP Session managing the REGISTER dialog. -* @param ... Any TSIP_ACTION_SET_*() macros. e.g. @ref TSIP_ACTION_SET_HEADER(). -* MUST always ends with @ref TSIP_ACTION_SET_NULL(). -* @retval Zero if succeed and non-zero error code otherwise. -* @sa @ref tsip_action_UNREGISTER +/**@ingroup tsip_action_group +* Sends SIP REGISTER request. If the session is already established, the same dialog will +* be used (refresh). +* @param ss The SIP Session managing the REGISTER dialog. +* @param ... Any TSIP_ACTION_SET_*() macros. e.g. @ref TSIP_ACTION_SET_HEADER(). +* MUST always ends with @ref TSIP_ACTION_SET_NULL(). +* @retval Zero if succeed and non-zero error code otherwise. +* @sa @ref tsip_action_UNREGISTER */ int tsip_action_REGISTER(const tsip_ssession_handle_t *ss, ...) { @@ -85,7 +85,7 @@ int tsip_action_REGISTER(const tsip_ssession_handle_t *ss, ...) /* performs action */ va_start(ap, ss); - if((action = _tsip_action_create(atype_register, &ap))){ + if((action = _tsip_action_create(tsip_atype_register, &ap))){ if(!(dialog = tsip_dialog_layer_find_by_ss(_ss->stack->layer_dialog, _ss))){ dialog = tsip_dialog_layer_new(_ss->stack->layer_dialog, tsip_dialog_REGISTER, _ss); } @@ -99,25 +99,25 @@ int tsip_action_REGISTER(const tsip_ssession_handle_t *ss, ...) return ret; } -/**@ingroup tsip_action_group -* Sends SIP unREGISTER request (expires=0). The session should be already established. -* @param ss The SIP Session managing the REGISTER dialog. -* @param ... Any TSIP_ACTION_SET_*() macros. e.g. @ref TSIP_ACTION_SET_HEADER(). -* MUST always ends with @ref TSIP_ACTION_SET_NULL(). -* @retval Zero if succeed and non-zero error code otherwise. -* @sa @ref tsip_action_REGISTER +/**@ingroup tsip_action_group +* Sends SIP unREGISTER request (expires=0). The session should be already established. +* @param ss The SIP Session managing the REGISTER dialog. +* @param ... Any TSIP_ACTION_SET_*() macros. e.g. @ref TSIP_ACTION_SET_HEADER(). +* MUST always ends with @ref TSIP_ACTION_SET_NULL(). +* @retval Zero if succeed and non-zero error code otherwise. +* @sa @ref tsip_action_REGISTER */ int tsip_action_UNREGISTER(const tsip_ssession_handle_t *ss, ...) { - int ret = -1; - va_list ap; - - va_start(ap, ss); - if((ret = _tsip_action_ANY(ss, atype_unregister, &ap))){ - TSK_DEBUG_ERROR("unREGISTER() failed."); - } - va_end(ap); - + int ret = -1; + va_list ap; + + va_start(ap, ss); + if((ret = _tsip_action_ANY(ss, tsip_atype_unregister, &ap))){ + TSK_DEBUG_ERROR("unREGISTER() failed."); + } + va_end(ap); + return ret; } diff --git a/trunk/tinySIP/src/api/tsip_api_subscribe.c b/trunk/tinySIP/src/api/tsip_api_subscribe.c index c701a6d3..da680bf2 100644 --- a/trunk/tinySIP/src/api/tsip_api_subscribe.c +++ b/trunk/tinySIP/src/api/tsip_api_subscribe.c @@ -72,7 +72,7 @@ int tsip_action_SUBSCRIBE(const tsip_ssession_handle_t *ss, ...) } va_start(ap, ss); - if((action = _tsip_action_create(atype_subscribe, &ap))){ + if((action = _tsip_action_create(tsip_atype_subscribe, &ap))){ if(!(dialog = tsip_dialog_layer_find_by_ss(_ss->stack->layer_dialog, ss))){ dialog = tsip_dialog_layer_new(_ss->stack->layer_dialog, tsip_dialog_SUBSCRIBE, ss); } @@ -105,7 +105,7 @@ int tsip_action_UNSUBSCRIBE(const tsip_ssession_handle_t *ss, ...) } va_start(ap, ss); - if((action = _tsip_action_create(atype_unsubscribe, &ap))){ + if((action = _tsip_action_create(tsip_atype_unsubscribe, &ap))){ ret = tsip_ssession_handle(ss, action); TSK_OBJECT_SAFE_FREE(action); } diff --git a/trunk/tinySIP/src/dialogs/tsip_dialog.c b/trunk/tinySIP/src/dialogs/tsip_dialog.c index 79d9ada7..d6e0b9db 100644 --- a/trunk/tinySIP/src/dialogs/tsip_dialog.c +++ b/trunk/tinySIP/src/dialogs/tsip_dialog.c @@ -935,10 +935,10 @@ int tsip_dialog_hangup(tsip_dialog_t *self, const tsip_action_t* action) { if(self){ if(self->state == tsip_initial){ - return tsip_dialog_fsm_act(self, atype_cancel, tsk_null, action); + return tsip_dialog_fsm_act(self, tsip_atype_cancel, tsk_null, action); } else{ - return tsip_dialog_fsm_act(self, atype_hangup, tsk_null, action); + return tsip_dialog_fsm_act(self, tsip_atype_hangup, tsk_null, action); } } return -1; @@ -947,7 +947,7 @@ 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) { if(self){ - return tsip_dialog_fsm_act(self, atype_shutdown, tsk_null, action); + return tsip_dialog_fsm_act(self, tsip_atype_shutdown, tsk_null, action); } return -1; } diff --git a/trunk/tinySIP/src/dialogs/tsip_dialog_message.c b/trunk/tinySIP/src/dialogs/tsip_dialog_message.c index d91bd2db..29b9746f 100644 --- a/trunk/tinySIP/src/dialogs/tsip_dialog_message.c +++ b/trunk/tinySIP/src/dialogs/tsip_dialog_message.c @@ -67,11 +67,11 @@ int tsip_dialog_message_Any_2_Terminated_X_Error(va_list *app); /* ======================== actions ======================== */ typedef enum _fsm_action_e { - _fsm_action_sendMESSAGE = atype_message_send, - _fsm_action_accept = atype_accept, - _fsm_action_reject = atype_reject, - _fsm_action_cancel = atype_cancel, - _fsm_action_shutdown = atype_shutdown, + _fsm_action_sendMESSAGE = tsip_atype_message_send, + _fsm_action_accept = tsip_atype_accept, + _fsm_action_reject = tsip_atype_reject, + _fsm_action_cancel = tsip_atype_cancel, + _fsm_action_shutdown = tsip_atype_shutdown, _fsm_action_receiveMESSAGE = 0xFF, _fsm_action_1xx, diff --git a/trunk/tinySIP/src/dialogs/tsip_dialog_options.c b/trunk/tinySIP/src/dialogs/tsip_dialog_options.c index 791968e8..5107a0d5 100644 --- a/trunk/tinySIP/src/dialogs/tsip_dialog_options.c +++ b/trunk/tinySIP/src/dialogs/tsip_dialog_options.c @@ -68,11 +68,11 @@ int tsip_dialog_options_Any_2_Terminated_X_Error(va_list *app); /* ======================== actions ======================== */ typedef enum _fsm_action_e { - _fsm_action_sendOPTIONS = atype_options_send, - _fsm_action_accept = atype_accept, - _fsm_action_reject = atype_reject, - _fsm_action_cancel = atype_cancel, - _fsm_action_shutdown = atype_shutdown, + _fsm_action_sendOPTIONS = tsip_atype_options_send, + _fsm_action_accept = tsip_atype_accept, + _fsm_action_reject = tsip_atype_reject, + _fsm_action_cancel = tsip_atype_cancel, + _fsm_action_shutdown = tsip_atype_shutdown, _fsm_action_receiveOPTIONS = 0xFF, _fsm_action_1xx, diff --git a/trunk/tinySIP/src/dialogs/tsip_dialog_publish.client.c b/trunk/tinySIP/src/dialogs/tsip_dialog_publish.client.c index 3c777ec5..6b6a477b 100644 --- a/trunk/tinySIP/src/dialogs/tsip_dialog_publish.client.c +++ b/trunk/tinySIP/src/dialogs/tsip_dialog_publish.client.c @@ -80,10 +80,10 @@ int _fsm_cond_publishing(tsip_dialog_publish_t* dialog, tsip_message_t* message) /* ======================== actions ======================== */ typedef enum _fsm_action_e { - _fsm_action_publish = atype_publish, - _fsm_action_cancel = atype_cancel, - _fsm_action_hangup = atype_unpublish, - _fsm_action_shutdown = atype_shutdown, + _fsm_action_publish = tsip_atype_publish, + _fsm_action_cancel = tsip_atype_cancel, + _fsm_action_hangup = tsip_atype_unpublish, + _fsm_action_shutdown = tsip_atype_shutdown, _fsm_action_1xx = 0xFF, _fsm_action_2xx, diff --git a/trunk/tinySIP/src/dialogs/tsip_dialog_register.client.c b/trunk/tinySIP/src/dialogs/tsip_dialog_register.client.c index 4930ea97..0b99f892 100644 --- a/trunk/tinySIP/src/dialogs/tsip_dialog_register.client.c +++ b/trunk/tinySIP/src/dialogs/tsip_dialog_register.client.c @@ -86,10 +86,10 @@ int _fsm_cond_registering(tsip_dialog_register_t* dialog, tsip_message_t* messag /* ======================== actions ======================== */ typedef enum _fsm_action_e { - _fsm_action_register = atype_register, - _fsm_action_cancel = atype_cancel, - _fsm_action_hangup = atype_hangup, - _fsm_action_shutdown = atype_shutdown, + _fsm_action_register = tsip_atype_register, + _fsm_action_cancel = tsip_atype_cancel, + _fsm_action_hangup = tsip_atype_hangup, + _fsm_action_shutdown = tsip_atype_shutdown, _fsm_action_1xx = 0xFF, _fsm_action_2xx, diff --git a/trunk/tinySIP/src/dialogs/tsip_dialog_subscribe.client.c b/trunk/tinySIP/src/dialogs/tsip_dialog_subscribe.client.c index 6c91439e..1067c8bc 100644 --- a/trunk/tinySIP/src/dialogs/tsip_dialog_subscribe.client.c +++ b/trunk/tinySIP/src/dialogs/tsip_dialog_subscribe.client.c @@ -102,10 +102,10 @@ tsk_bool_t _fsm_cond_notify_not_terminated(tsip_dialog_subscribe_t* dialog, tsip /* ======================== actions ======================== */ typedef enum _fsm_action_e { - _fsm_action_subscribe = atype_subscribe, - _fsm_action_hangup = atype_hangup, - _fsm_action_cancel = atype_cancel, - _fsm_action_shutdown = atype_shutdown, + _fsm_action_subscribe = tsip_atype_subscribe, + _fsm_action_hangup = tsip_atype_hangup, + _fsm_action_cancel = tsip_atype_cancel, + _fsm_action_shutdown = tsip_atype_shutdown, _fsm_action_1xx = 0xFF, _fsm_action_2xx, diff --git a/trunk/tinySIP/src/transactions/tsip_transac_ict.c b/trunk/tinySIP/src/transactions/tsip_transac_ict.c index 9d762334..9c65b728 100644 --- a/trunk/tinySIP/src/transactions/tsip_transac_ict.c +++ b/trunk/tinySIP/src/transactions/tsip_transac_ict.c @@ -113,7 +113,7 @@ int tsip_transac_ict_Any_2_Terminated_X_cancel(va_list *app); /* doubango-specif /* ======================== actions ======================== */ typedef enum _fsm_action_e { - _fsm_action_cancel = atype_cancel, + _fsm_action_cancel = tsip_atype_cancel, _fsm_action_send = 0xFF, _fsm_action_timerA, diff --git a/trunk/tinySIP/src/transactions/tsip_transac_ist.c b/trunk/tinySIP/src/transactions/tsip_transac_ist.c index 676db4c0..d17d512a 100644 --- a/trunk/tinySIP/src/transactions/tsip_transac_ist.c +++ b/trunk/tinySIP/src/transactions/tsip_transac_ist.c @@ -120,7 +120,7 @@ int tsip_transac_ist_Any_2_Terminated_X_cancel(va_list *app); /* doubango-specif /* ======================== actions ======================== */ typedef enum _fsm_action_e { - _fsm_action_cancel = atype_cancel, + _fsm_action_cancel = tsip_atype_cancel, _fsm_action_recv_INVITE = 0xFF, _fsm_action_recv_ACK, diff --git a/trunk/tinySIP/src/transactions/tsip_transac_layer.c b/trunk/tinySIP/src/transactions/tsip_transac_layer.c index d2c3708f..9ecd5fde 100644 --- a/trunk/tinySIP/src/transactions/tsip_transac_layer.c +++ b/trunk/tinySIP/src/transactions/tsip_transac_layer.c @@ -122,7 +122,7 @@ int tsip_transac_layer_cancel_by_dialog(tsip_transac_layer_t *self, const struct again: tsk_list_foreach(item, self->transactions){ if(tsk_object_cmp(dialog, TSIP_TRANSAC(item->data)->dialog) == 0){ - if((ret = tsip_transac_fsm_act(TSIP_TRANSAC(item->data), atype_cancel, tsk_null))){ /* will call tsip_transac_layer_remove() if succeed */ + if((ret = tsip_transac_fsm_act(TSIP_TRANSAC(item->data), tsip_atype_cancel, tsk_null))){ /* will call tsip_transac_layer_remove() if succeed */ /* break; */ } else{ diff --git a/trunk/tinySIP/src/transactions/tsip_transac_nict.c b/trunk/tinySIP/src/transactions/tsip_transac_nict.c index 7aed9b3a..62694ac0 100644 --- a/trunk/tinySIP/src/transactions/tsip_transac_nict.c +++ b/trunk/tinySIP/src/transactions/tsip_transac_nict.c @@ -105,7 +105,7 @@ int tsip_transac_nict_Any_2_Terminated_X_cancel(va_list *app); /* doubango-speci /* ======================== actions ======================== */ typedef enum _fsm_action_e { - _fsm_action_cancel = atype_cancel, + _fsm_action_cancel = tsip_atype_cancel, _fsm_action_send = 0xFF, _fsm_action_timerE, diff --git a/trunk/tinySIP/src/transactions/tsip_transac_nist.c b/trunk/tinySIP/src/transactions/tsip_transac_nist.c index e3b5b5aa..b64eca06 100644 --- a/trunk/tinySIP/src/transactions/tsip_transac_nist.c +++ b/trunk/tinySIP/src/transactions/tsip_transac_nist.c @@ -106,7 +106,7 @@ int tsip_transac_nist_Any_2_Terminated_X_cancel(va_list *app); /* doubango-speci /* ======================== actions ======================== */ typedef enum _fsm_action_e { - _fsm_action_cancel = atype_cancel, + _fsm_action_cancel = tsip_atype_cancel, _fsm_action_request = 0xFF, _fsm_action_send_1xx, diff --git a/trunk/tinySIP/src/tsip.c b/trunk/tinySIP/src/tsip.c index 859d7028..76059b1f 100644 --- a/trunk/tinySIP/src/tsip.c +++ b/trunk/tinySIP/src/tsip.c @@ -66,24 +66,24 @@ int __tsip_stack_set(tsip_stack_t *self, va_list* app) { tsip_stack_param_type_t curr; - while((curr = va_arg(*app, tsip_stack_param_type_t)) != pname_null){ + while((curr = va_arg(*app, tsip_stack_param_type_t)) != tsip_pname_null){ switch(curr){ /* === Identity === */ - case pname_display_name: + case tsip_pname_display_name: { /* (const char*)NAME_STR */ const char* NAME_STR = va_arg(*app, const char*); tsk_strupdate(&self->identity.display_name, NAME_STR); break; } - case pname_impu: - case pname_preferred_id: + case tsip_pname_impu: + case tsip_pname_preferred_id: { /* (const char*)URI_STR */ const char* URI_STR = va_arg(*app, const char*); if(!tsk_strnullORempty(URI_STR)){ tsip_uri_t *uri = tsip_uri_parse(URI_STR, tsk_strlen(URI_STR)); if(uri){ - if(curr == pname_impu){ + if(curr == tsip_pname_impu){ TSK_OBJECT_SAFE_FREE(self->identity.impu); self->identity.impu = uri; } @@ -94,18 +94,18 @@ int __tsip_stack_set(tsip_stack_t *self, va_list* app) } else{ TSK_DEBUG_ERROR("'%s' is an invalid SIP/TEL URI", URI_STR); - if(curr == pname_impu){ + if(curr == tsip_pname_impu){ return -1; /* IMPU is mandatory but P-Preferred-Identity isn't. */ } } } - else if(curr == pname_impu){ + else if(curr == tsip_pname_impu){ TSK_DEBUG_ERROR("IMPU (IMS Public Identity) is mandatory."); return -1; } break; } - case pname_impi: + case tsip_pname_impi: { /* (const char*)IMPI_STR */ const char* IMPI_STR = va_arg(*app, const char*); if(tsk_strnullORempty(IMPI_STR)){ @@ -115,7 +115,7 @@ int __tsip_stack_set(tsip_stack_t *self, va_list* app) tsk_strupdate(&self->identity.impi, IMPI_STR); break; } - case pname_password: + case tsip_pname_password: { /* (const char*)PASSORD_STR */ const char* PASSORD_STR = va_arg(*app, const char*); tsk_strupdate(&self->identity.password, PASSORD_STR); @@ -125,7 +125,7 @@ int __tsip_stack_set(tsip_stack_t *self, va_list* app) /* === Network === */ - case pname_realm: + case tsip_pname_realm: { /* (const char*)URI_STR */ const char* URI_STR = va_arg(*app, const char*); tsip_uri_t *uri; @@ -143,18 +143,18 @@ int __tsip_stack_set(tsip_stack_t *self, va_list* app) } break; } - case pname_local_ip: + case tsip_pname_local_ip: { /* (const char*)IP_STR */ const char* IP_STR = va_arg(*app, const char*); tsk_strupdate(&self->network.local_ip, IP_STR); break; } - case pname_local_port: + case tsip_pname_local_port: { /* (unsigned)PORT_UINT */ self->network.local_port = (tnet_port_t)va_arg(*app, unsigned); break; } - case pname_aor: + case tsip_pname_aor: { /* (const char*)IP_STR, (unsigned)PORT_UINT */ const char* IP_STR = va_arg(*app, const char*); tnet_port_t PORT_UINT = (tnet_port_t)va_arg(*app, unsigned); @@ -167,17 +167,17 @@ int __tsip_stack_set(tsip_stack_t *self, va_list* app) break; } - case pname_discovery_naptr: + case tsip_pname_discovery_naptr: { /* (tsk_bool_t)ENABLED_BOOL */ self->network.discovery_naptr = va_arg(*app, tsk_bool_t); break; } - case pname_discovery_dhcp: + case tsip_pname_discovery_dhcp: { /* (tsk_bool_t)ENABLED_BOOL */ self->network.discovery_dhcp = va_arg(*app, tsk_bool_t); break; } - case pname_proxy_cscf: + case tsip_pname_proxy_cscf: { /* (const char*)FQDN_STR, (unsigned)PORT_UINT, (const char*)TRANSPORT_STR, (const char*)IP_VERSION_STR */ const char* FQDN_STR = va_arg(*app, const char*); tnet_port_t PORT_UINT = va_arg(*app, unsigned); @@ -232,33 +232,33 @@ int __tsip_stack_set(tsip_stack_t *self, va_list* app) /* === Security === */ - case pname_early_ims: + case tsip_pname_early_ims: { /* (tsk_bool_t)ENABLED_BOOL */ self->security.earlyIMS = va_arg(*app, tsk_bool_t); break; } - case pname_secagree_ipsec: + case tsip_pname_secagree_ipsec: { /* (tsk_bool_t)ENABLED_BOOL */ if((self->security.enable_secagree_ipsec = va_arg(*app, tsk_bool_t))){ tsk_strupdate(&self->security.secagree_mech, "ipsec-3gpp"); } break; } - case pname_secagree_tls: + case tsip_pname_secagree_tls: { /* (tsk_bool_t)ENABLED_BOOL */ if((self->security.enable_secagree_tls = va_arg(*app, tsk_bool_t))){ tsk_strupdate(&self->security.secagree_mech, "tls"); } break; } - case pname_amf: + case tsip_pname_amf: { /* (uint16_t)AMF_UINT16 */ unsigned amf = va_arg(*app, unsigned); self->security.amf[0] = (amf >> 8); self->security.amf[1] = (amf & 0xFF); break; } - case pname_operator_id: + case tsip_pname_operator_id: { /* (const char*)OPID_HEX_STR */ const char* hexstr = va_arg(*app, const char*); tsk_size_t len = tsk_strlen(hexstr); @@ -284,7 +284,7 @@ int __tsip_stack_set(tsip_stack_t *self, va_list* app) } break; } - case pname_ipsec_params: + case tsip_pname_ipsec_params: { /* (const char*)ALG_STR, (const char*)EALG_STR, (const char*)MODE_STR, (const char*)PROTOCOL_STR*/ tsk_strupdate(&self->security.ipsec.alg, va_arg(*app, const char*)); tsk_strupdate(&self->security.ipsec.ealg, va_arg(*app, const char*)); @@ -292,7 +292,7 @@ int __tsip_stack_set(tsip_stack_t *self, va_list* app) tsk_strupdate(&self->security.ipsec.protocol, va_arg(*app, const char*)); break; } - case pname_tls_certs: + case tsip_pname_tls_certs: { /* (const char*)CA_FILE_STR, (const char*)PUB_FILE_STR, (const char*)PRIV_FILE_STR */ tsk_strupdate(&self->security.tls.ca, va_arg(*app, const char*)); tsk_strupdate(&self->security.tls.pbk, va_arg(*app, const char*)); @@ -302,7 +302,7 @@ int __tsip_stack_set(tsip_stack_t *self, va_list* app) /* === Dummy Headers === */ - case pname_header: + case tsip_pname_header: { /* (const char*)NAME_STR, (const char*)VALUE_STR */ const char* NAME_STR = va_arg(*app, const char*); const char* VALUE_STR = va_arg(*app, const char*); @@ -316,7 +316,7 @@ int __tsip_stack_set(tsip_stack_t *self, va_list* app) } /* === User Data === */ - case pname_userdata: + case tsip_pname_userdata: { /* (const void*)DATA_PTR */ self->userdata = va_arg(*app, const void*); break; @@ -702,7 +702,7 @@ tsip_uri_t* tsip_stack_get_pcscf_uri(const tsip_stack_t *stack, tsk_bool_t lr) transport->protocol); if(uristring){ if((uri = tsip_uri_parse(uristring, tsk_strlen(uristring)))){ - //uri->host_type = ipv6 ? host_ipv6 : host_ipv4; + //uri->host_type = ipv6 ? thttp_host_ipv6 : thttp_host_ipv4; } TSK_FREE(uristring); } diff --git a/trunk/tinySIP/src/tsip_action.c b/trunk/tinySIP/src/tsip_action.c index dbc46fa4..19302ec8 100644 --- a/trunk/tinySIP/src/tsip_action.c +++ b/trunk/tinySIP/src/tsip_action.c @@ -46,7 +46,7 @@ int _tsip_action_set(tsip_action_handle_t* self, va_list* app); * * @code tsip_action_handle_t* handle; -handle = tsip_action_create(atype_config, +handle = tsip_action_create(tsip_atype_config, TSIP_ACTION_SET_HEADER("User-Agent", "IM-client/OMA1.0 doubango/v1.0.0"), TSIP_ACTION_SET_HEADER("Supported", "precondition"), TSIP_ACTION_SET_PAYLOAD("my payload", strlen("my payload")), @@ -133,7 +133,7 @@ int _tsip_action_set(tsip_action_handle_t* self, va_list* app) case aptype_config: { /* (const tsip_action_handle_t*)ACTION_CONFIG_HANDLE */ const tsip_action_t* handle = va_arg(*app, const tsip_action_handle_t *); - if(handle && handle->type == atype_config){ + if(handle && handle->type == tsip_atype_config){ if(!TSK_LIST_IS_EMPTY(handle->headers)){ /* Copy headers */ tsk_list_pushback_list(action->headers, handle->headers); } diff --git a/trunk/tinySIP/src/tsip_ssession.c b/trunk/tinySIP/src/tsip_ssession.c index 9abe3652..12aa0e3b 100644 --- a/trunk/tinySIP/src/tsip_ssession.c +++ b/trunk/tinySIP/src/tsip_ssession.c @@ -370,7 +370,7 @@ int tsip_ssession_handle(const tsip_ssession_t *self, const struct tsip_action_s if((dialog = tsip_dialog_layer_find_by_ss(self->stack->layer_dialog, self))){ switch(action->type){ - case atype_hangup: + case tsip_atype_hangup: { /* hang-up is an special case (==> hangup/cancel/nothing) */ ret = tsip_dialog_hangup(dialog, action); break; diff --git a/trunk/tinyXCAP/include/txcap.h b/trunk/tinyXCAP/include/txcap.h index fef1762e..2546fe9c 100644 --- a/trunk/tinyXCAP/include/txcap.h +++ b/trunk/tinyXCAP/include/txcap.h @@ -63,7 +63,7 @@ typedef enum txcap_stack_param_type_e xcapp_option, xcapp_header, - xcapp_context, + xcapp_userdata, xcapp_auid, } txcap_stack_param_type_t; @@ -168,7 +168,7 @@ int ret = txcap_stack_set(stack, #define TXCAP_STACK_SET_PASSWORD(PASSWORD_STR) TXCAP_STACK_SET_OPTION(TXCAP_STACK_OPTION_PASSWORD, PASSWORD_STR) #define TXCAP_STACK_SET_XUI(XUI_STR) TXCAP_STACK_SET_OPTION(TXCAP_STACK_OPTION_XUI, XUI_STR) #define TXCAP_STACK_SET_HEADER(NAME_STR, VALUE_STR) xcapp_header, (const char*)NAME_STR, (const char*)VALUE_STR -#define TXCAP_STACK_SET_CONTEXT(CTX_PTR) xcapp_context, (const void*)CTX_PTR +#define TXCAP_STACK_SET_USERDATA(CTX_PTR) xcapp_userdata, (const void*)CTX_PTR #define TXCAP_STACK_SET_AUID(ID_STR, MIME_TYPE_STR, NS_STR, DOC_NAME_STR, IS_GLOBAL_BOOL) xcapp_auid, (const char*)ID_STR, (const char*)MIME_TYPE_STR, (const char*)NS_STR, (const char*)DOC_NAME_STR, (tsk_bool_t)IS_GLOBAL_BOOL #define TXCAP_STACK_SET_NULL() xcapp_null diff --git a/trunk/tinyXCAP/src/txcap.c b/trunk/tinyXCAP/src/txcap.c index 5730750a..da0e866a 100644 --- a/trunk/tinyXCAP/src/txcap.c +++ b/trunk/tinyXCAP/src/txcap.c @@ -782,10 +782,10 @@ int __txcap_stack_set(txcap_stack_t* self, va_list *app) break; } - case xcapp_context: + case xcapp_userdata: { /* (const void*)CTX_PTR */ const void* CTX_PTR = va_arg(*app, const void*); - ((thttp_session_t*)self->http_session)->context = CTX_PTR; + ((thttp_session_t*)self->http_session)->userdata = CTX_PTR; break; } diff --git a/trunk/tinyXCAP/src/txcap_action.c b/trunk/tinyXCAP/src/txcap_action.c index 6a8b7366..4efc80fa 100644 --- a/trunk/tinyXCAP/src/txcap_action.c +++ b/trunk/tinyXCAP/src/txcap_action.c @@ -161,7 +161,7 @@ done: } /* HTTP action */ - if((action = thttp_action_create(atype_o_request, urlstring, method, tsk_null))){ + if((action = thttp_action_create(thttp_atype_o_request, urlstring, method, tsk_null))){ const tsk_list_item_t* item; if((dialog = thttp_dialog_new(xcap_stack->http_session))){ /* copy options */