summaryrefslogtreecommitdiffstats
path: root/tinySIP/src/api
diff options
context:
space:
mode:
Diffstat (limited to 'tinySIP/src/api')
-rwxr-xr-xtinySIP/src/api/tsip_api_common.c108
-rwxr-xr-xtinySIP/src/api/tsip_api_info.c111
-rwxr-xr-xtinySIP/src/api/tsip_api_invite.c489
-rwxr-xr-xtinySIP/src/api/tsip_api_message.c111
-rwxr-xr-xtinySIP/src/api/tsip_api_options.c109
-rwxr-xr-xtinySIP/src/api/tsip_api_publish.c157
-rwxr-xr-xtinySIP/src/api/tsip_api_register.c131
-rwxr-xr-xtinySIP/src/api/tsip_api_subscribe.c157
8 files changed, 683 insertions, 690 deletions
diff --git a/tinySIP/src/api/tsip_api_common.c b/tinySIP/src/api/tsip_api_common.c
index 4261fd5..a325385 100755
--- a/tinySIP/src/api/tsip_api_common.c
+++ b/tinySIP/src/api/tsip_api_common.c
@@ -2,19 +2,19 @@
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
-*
+*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
-*
+*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
@@ -39,96 +39,96 @@ extern tsip_action_t* _tsip_action_create(tsip_action_type_t type, va_list* app)
/* Local functions */
int _tsip_api_common_any(const tsip_ssession_handle_t *ss, tsip_action_type_t type, va_list* app);
-/* internal function used to execute any user action
+/* internal function used to execute any user action
* can only handle session with dialogs */
int _tsip_api_common_any(const tsip_ssession_handle_t *ss, tsip_action_type_t type, va_list* app)
{
- int ret = -1;
- tsip_action_t* action;
- const tsip_ssession_t* _ss;
-
- /* Checks for validity */
- 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;
- }
-
- /* execute action */
- if((action = _tsip_action_create(type, app))){
- ret = tsip_ssession_handle(_ss, action);
- TSK_OBJECT_SAFE_FREE(action);
- }
- return ret;
+ int ret = -1;
+ tsip_action_t* action;
+ const tsip_ssession_t* _ss;
+
+ /* Checks for validity */
+ 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;
+ }
+
+ /* execute action */
+ if((action = _tsip_action_create(type, app))) {
+ ret = tsip_ssession_handle(_ss, action);
+ TSK_OBJECT_SAFE_FREE(action);
+ }
+ return ret;
}
/**@ingroup tsip_action_group
* Rejects an incoming request.
* @param ss The SIP Session managing the dialog on which the request has been received.
-* @param ... Any TSIP_ACTION_SET_*() macros. e.g. @ref TSIP_ACTION_SET_HEADER().
+* @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.
*/
int tsip_api_common_reject(const tsip_ssession_handle_t *ss, ...)
{
- int ret = -1;
- va_list ap;
+ int ret = -1;
+ va_list ap;
- va_start(ap, ss);
- if((ret = _tsip_api_common_any(ss, tsip_atype_reject, &ap))){
- TSK_DEBUG_ERROR("Reject() failed.");
- }
- va_end(ap);
+ va_start(ap, ss);
+ if((ret = _tsip_api_common_any(ss, tsip_atype_reject, &ap))) {
+ TSK_DEBUG_ERROR("Reject() failed.");
+ }
+ va_end(ap);
- return ret;
+ return ret;
}
/**@ingroup tsip_action_group
* Hangs up a session.
* @param ss The SIP Session to hang-up. Will send an unREGISTER or unSUBSCRIBE or unPUBLISH or
-* BYE etc depending on the type of the SIP dialog managed by the session.
-* @param ... Any TSIP_ACTION_SET_*() macros. e.g. @ref TSIP_ACTION_SET_HEADER().
+* BYE etc depending on the type of the SIP dialog managed by the session.
+* @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.
*/
int tsip_api_common_hangup(const tsip_ssession_handle_t *ss, ...)
{
- int ret = -1;
- va_list ap;
+ int ret = -1;
+ va_list ap;
- va_start(ap, ss);
- if((ret = _tsip_api_common_any(ss, tsip_atype_hangup, &ap))){
- TSK_DEBUG_ERROR("Hang-up() failed.");
- }
- va_end(ap);
+ va_start(ap, ss);
+ if((ret = _tsip_api_common_any(ss, tsip_atype_hangup, &ap))) {
+ TSK_DEBUG_ERROR("Hang-up() failed.");
+ }
+ va_end(ap);
- return ret;
+ return ret;
}
/**@ingroup tsip_action_group
* Accepts an incoming request.
* @param ss The SIP Session managing the dialog on which the request has been received.
-* @param ... Any TSIP_ACTION_SET_*() macros. e.g. @ref TSIP_ACTION_SET_HEADER().
+* @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.
*/
int tsip_api_common_accept(const tsip_ssession_handle_t *ss, ...)
{
- int ret = -1;
- va_list ap;
+ int ret = -1;
+ va_list ap;
- va_start(ap, ss);
- if((ret = _tsip_api_common_any(ss, tsip_atype_accept, &ap))){
- TSK_DEBUG_ERROR("Accept() failed.");
- }
- va_end(ap);
+ va_start(ap, ss);
+ if((ret = _tsip_api_common_any(ss, tsip_atype_accept, &ap))) {
+ TSK_DEBUG_ERROR("Accept() failed.");
+ }
+ va_end(ap);
- return ret;
+ return ret;
}
diff --git a/tinySIP/src/api/tsip_api_info.c b/tinySIP/src/api/tsip_api_info.c
index ec20b8b..37265da 100755
--- a/tinySIP/src/api/tsip_api_info.c
+++ b/tinySIP/src/api/tsip_api_info.c
@@ -2,19 +2,19 @@
* Copyright (C) 2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango(dot)org>
-*
+*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
-*
+*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
@@ -43,47 +43,47 @@ extern tsip_action_t* _tsip_action_create(tsip_action_type_t type, va_list* app)
int tsip_info_event_signal(tsip_info_event_type_t type, tsip_ssession_handle_t* ss, short status_code, const char *phrase, const tsip_message_t* sipmessage)
{
- tsip_info_event_t* sipevent = TSIP_INFO_EVENT_CREATE(type);
- tsip_event_init(TSIP_EVENT(sipevent), ss, status_code, phrase, sipmessage, tsip_event_info);
+ tsip_info_event_t* sipevent = TSIP_INFO_EVENT_CREATE(type);
+ tsip_event_init(TSIP_EVENT(sipevent), ss, status_code, phrase, sipmessage, tsip_event_info);
- TSK_RUNNABLE_ENQUEUE_OBJECT(TSK_RUNNABLE(TSIP_SSESSION(ss)->stack), sipevent);
+ TSK_RUNNABLE_ENQUEUE_OBJECT(TSK_RUNNABLE(TSIP_SSESSION(ss)->stack), sipevent);
- return 0;
+ return 0;
}
int tsip_api_info_send_info(const tsip_ssession_handle_t *ss, ...)
{
- const tsip_ssession_t* _ss;
- va_list ap;
- tsip_action_t* action;
- tsip_dialog_t* dialog;
- int ret = -1;
-
- 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;
- }
-
- /* action */
- va_start(ap, ss);
- if((action = _tsip_action_create(tsip_atype_info_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_INFO, ss);
- }
- ret = tsip_dialog_fsm_act(dialog, action->type, tsk_null, action);
-
- tsk_object_unref(dialog);
- TSK_OBJECT_SAFE_FREE(action);
- }
- va_end(ap);
-
- return ret;
+ const tsip_ssession_t* _ss;
+ va_list ap;
+ tsip_action_t* action;
+ tsip_dialog_t* dialog;
+ int ret = -1;
+
+ 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;
+ }
+
+ /* action */
+ va_start(ap, ss);
+ if((action = _tsip_action_create(tsip_atype_info_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_INFO, ss);
+ }
+ ret = tsip_dialog_fsm_act(dialog, action->type, tsk_null, action);
+
+ tsk_object_unref(dialog);
+ TSK_OBJECT_SAFE_FREE(action);
+ }
+ va_end(ap);
+
+ return ret;
}
@@ -103,32 +103,31 @@ int tsip_api_info_send_info(const tsip_ssession_handle_t *ss, ...)
//
static tsk_object_t* tsip_info_event_ctor(tsk_object_t * self, va_list * app)
{
- tsip_info_event_t *sipevent = self;
- if(sipevent){
- sipevent->type = va_arg(*app, tsip_info_event_type_t);
- }
- return self;
+ tsip_info_event_t *sipevent = self;
+ if(sipevent) {
+ sipevent->type = va_arg(*app, tsip_info_event_type_t);
+ }
+ return self;
}
static tsk_object_t* tsip_info_event_dtor(tsk_object_t * self)
-{
- tsip_info_event_t *sipevent = self;
- if(sipevent){
- tsip_event_deinit(TSIP_EVENT(sipevent));
- }
- return self;
+{
+ tsip_info_event_t *sipevent = self;
+ if(sipevent) {
+ tsip_event_deinit(TSIP_EVENT(sipevent));
+ }
+ return self;
}
static int tsip_info_event_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
- return -1;
+ return -1;
}
-static const tsk_object_def_t tsip_info_event_def_s =
-{
- sizeof(tsip_info_event_t),
- tsip_info_event_ctor,
- tsip_info_event_dtor,
- tsip_info_event_cmp,
+static const tsk_object_def_t tsip_info_event_def_s = {
+ sizeof(tsip_info_event_t),
+ tsip_info_event_ctor,
+ tsip_info_event_dtor,
+ tsip_info_event_cmp,
};
const tsk_object_def_t *tsip_info_event_def_t = &tsip_info_event_def_s;
diff --git a/tinySIP/src/api/tsip_api_invite.c b/tinySIP/src/api/tsip_api_invite.c
index 530eb67..9cdaa9f 100755
--- a/tinySIP/src/api/tsip_api_invite.c
+++ b/tinySIP/src/api/tsip_api_invite.c
@@ -2,19 +2,19 @@
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
-*
+*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
-*
+*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
@@ -45,274 +45,274 @@ extern int _tsip_api_common_any(const tsip_ssession_handle_t *ss, tsip_action_ty
int tsip_invite_event_signal(tsip_invite_event_type_t type, tsip_ssession_handle_t* ss, short status_code, const char *phrase, const tsip_message_t* sipmessage)
{
- tsip_invite_event_t* sipevent = TSIP_INVITE_EVENT_CREATE(type);
- tsip_event_init(TSIP_EVENT(sipevent), ss, status_code, phrase, sipmessage, tsip_event_invite);
+ tsip_invite_event_t* sipevent = TSIP_INVITE_EVENT_CREATE(type);
+ tsip_event_init(TSIP_EVENT(sipevent), ss, status_code, phrase, sipmessage, tsip_event_invite);
- TSK_RUNNABLE_ENQUEUE_OBJECT(TSK_RUNNABLE(TSIP_SSESSION(ss)->stack), sipevent);
+ TSK_RUNNABLE_ENQUEUE_OBJECT(TSK_RUNNABLE(TSIP_SSESSION(ss)->stack), sipevent);
- return 0;
+ return 0;
}
int tsip_api_invite_send_invite(const tsip_ssession_handle_t *ss, tmedia_type_t type, ...)
{
- const tsip_ssession_t* _ss;
- va_list ap;
- tsip_action_t* action;
- tsip_dialog_t* dialog;
- int ret = -1;
-
- 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;
- }
-
- va_start(ap, type);
- if((action = _tsip_action_create(tsip_atype_invite, &ap))){
- tsk_bool_t new_dialog = tsk_false;
- /* Media type */
- action->media.type = type;
-
- if(!(dialog = tsip_dialog_layer_find_by_ss(_ss->stack->layer_dialog, ss))){
- dialog = tsip_dialog_layer_new(_ss->stack->layer_dialog, tsip_dialog_INVITE, ss);
- new_dialog = tsk_true;
- }
- if(!(ret = tsip_dialog_fsm_act(dialog, action->type, tsk_null, action))){
- if(new_dialog){ // otherwise we are trying to refresh the media type and the type will be updated if 200 OK
- TSIP_SSESSION(_ss)->media.type = type; // Update Session Media Type
- }
- }
-
- tsk_object_unref(dialog);
- TSK_OBJECT_SAFE_FREE(action);
- }
- va_end(ap);
-
- return ret;
+ const tsip_ssession_t* _ss;
+ va_list ap;
+ tsip_action_t* action;
+ tsip_dialog_t* dialog;
+ int ret = -1;
+
+ 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;
+ }
+
+ va_start(ap, type);
+ if((action = _tsip_action_create(tsip_atype_invite, &ap))) {
+ tsk_bool_t new_dialog = tsk_false;
+ /* Media type */
+ action->media.type = type;
+
+ if(!(dialog = tsip_dialog_layer_find_by_ss(_ss->stack->layer_dialog, ss))) {
+ dialog = tsip_dialog_layer_new(_ss->stack->layer_dialog, tsip_dialog_INVITE, ss);
+ new_dialog = tsk_true;
+ }
+ if(!(ret = tsip_dialog_fsm_act(dialog, action->type, tsk_null, action))) {
+ if(new_dialog) { // otherwise we are trying to refresh the media type and the type will be updated if 200 OK
+ TSIP_SSESSION(_ss)->media.type = type; // Update Session Media Type
+ }
+ }
+
+ tsk_object_unref(dialog);
+ TSK_OBJECT_SAFE_FREE(action);
+ }
+ va_end(ap);
+
+ return ret;
}
int tsip_api_invite_send_info(const tsip_ssession_handle_t *ss, ...)
{
- int ret = -1;
- tsip_action_t* action;
- const tsip_ssession_t* _ss;
- va_list ap;
-
- /* Checks for validity */
- 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;
- }
-
- va_start(ap, ss);
- /* execute action */
- if((action = _tsip_action_create(tsip_atype_info_send, &ap))){
- /* Perform action */
- ret = tsip_ssession_handle(_ss, action);
- TSK_OBJECT_SAFE_FREE(action);
- }
- va_end(ap);
-
- return ret;
+ int ret = -1;
+ tsip_action_t* action;
+ const tsip_ssession_t* _ss;
+ va_list ap;
+
+ /* Checks for validity */
+ 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;
+ }
+
+ va_start(ap, ss);
+ /* execute action */
+ if((action = _tsip_action_create(tsip_atype_info_send, &ap))) {
+ /* Perform action */
+ ret = tsip_ssession_handle(_ss, action);
+ TSK_OBJECT_SAFE_FREE(action);
+ }
+ va_end(ap);
+
+ return ret;
}
int tsip_api_invite_send_hold(const tsip_ssession_handle_t *ss, tmedia_type_t type, ...)
{
- int ret = -1;
- tsip_action_t* action;
- const tsip_ssession_t* _ss;
- va_list ap;
-
- /* Checks for validity */
- 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;
- }
-
- va_start(ap, type);
- /* execute action */
- if((action = _tsip_action_create(tsip_atype_hold, &ap))){
- /* Media type */
- action->media.type = type;
- /* Perform action */
- ret = tsip_ssession_handle(_ss, action);
- TSK_OBJECT_SAFE_FREE(action);
- }
- va_end(ap);
-
- return ret;
+ int ret = -1;
+ tsip_action_t* action;
+ const tsip_ssession_t* _ss;
+ va_list ap;
+
+ /* Checks for validity */
+ 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;
+ }
+
+ va_start(ap, type);
+ /* execute action */
+ if((action = _tsip_action_create(tsip_atype_hold, &ap))) {
+ /* Media type */
+ action->media.type = type;
+ /* Perform action */
+ ret = tsip_ssession_handle(_ss, action);
+ TSK_OBJECT_SAFE_FREE(action);
+ }
+ va_end(ap);
+
+ return ret;
}
int tsip_api_invite_send_resume(const tsip_ssession_handle_t *ss, tmedia_type_t type, ...)
{
- int ret = -1;
- tsip_action_t* action;
- const tsip_ssession_t* _ss;
- va_list ap;
-
- /* Checks for validity */
- 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;
- }
-
- va_start(ap, type);
- /* execute action */
- if((action = _tsip_action_create(tsip_atype_resume, &ap))){
- /* Media type */
- action->media.type = type;
- /* Perform action */
- ret = tsip_ssession_handle(_ss, action);
- TSK_OBJECT_SAFE_FREE(action);
- }
- va_end(ap);
-
- return ret;
+ int ret = -1;
+ tsip_action_t* action;
+ const tsip_ssession_t* _ss;
+ va_list ap;
+
+ /* Checks for validity */
+ 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;
+ }
+
+ va_start(ap, type);
+ /* execute action */
+ if((action = _tsip_action_create(tsip_atype_resume, &ap))) {
+ /* Media type */
+ action->media.type = type;
+ /* Perform action */
+ ret = tsip_ssession_handle(_ss, action);
+ TSK_OBJECT_SAFE_FREE(action);
+ }
+ va_end(ap);
+
+ return ret;
}
int tsip_api_invite_send_large_message(const tsip_ssession_handle_t *ss, ...)
{
- int ret = -1;
- va_list ap;
-
- va_start(ap, ss);
- if((ret = _tsip_api_common_any(ss, tsip_atype_lmessage, &ap))){
- TSK_DEBUG_ERROR("Failed to send MSRP message");
- }
- va_end(ap);
-
- return ret;
+ int ret = -1;
+ va_list ap;
+
+ va_start(ap, ss);
+ if((ret = _tsip_api_common_any(ss, tsip_atype_lmessage, &ap))) {
+ TSK_DEBUG_ERROR("Failed to send MSRP message");
+ }
+ va_end(ap);
+
+ return ret;
}
int tsip_api_invite_send_ect(const tsip_ssession_handle_t *ss, const char* toUri, ...)
{
- int ret = -1;
- tsip_action_t* action;
- const tsip_ssession_t* _ss;
- va_list ap;
-
- /* Checks for validity */
- if(!(_ss = ss) || !_ss->stack || !toUri){
- 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;
- }
-
- va_start(ap, toUri);
- /* execute action */
- if((action = _tsip_action_create(tsip_atype_ect, &ap))){
- /* Refer-To */
- action->ect.to = tsk_strdup(toUri);
- /* Perform action */
- ret = tsip_ssession_handle(_ss, action);
- TSK_OBJECT_SAFE_FREE(action);
- }
- va_end(ap);
-
- return ret;
+ int ret = -1;
+ tsip_action_t* action;
+ const tsip_ssession_t* _ss;
+ va_list ap;
+
+ /* Checks for validity */
+ if(!(_ss = ss) || !_ss->stack || !toUri) {
+ 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;
+ }
+
+ va_start(ap, toUri);
+ /* execute action */
+ if((action = _tsip_action_create(tsip_atype_ect, &ap))) {
+ /* Refer-To */
+ action->ect.to = tsk_strdup(toUri);
+ /* Perform action */
+ ret = tsip_ssession_handle(_ss, action);
+ TSK_OBJECT_SAFE_FREE(action);
+ }
+ va_end(ap);
+
+ return ret;
}
int tsip_api_invite_send_ect_accept(const tsip_ssession_handle_t *ss, ...)
{
- int ret = -1;
- va_list ap;
-
- va_start(ap, ss);
- if((ret = _tsip_api_common_any(ss, tsip_atype_ect_accept, &ap))){
- TSK_DEBUG_ERROR("Failed to accept incoming ECT");
- }
- va_end(ap);
-
- return ret;
+ int ret = -1;
+ va_list ap;
+
+ va_start(ap, ss);
+ if((ret = _tsip_api_common_any(ss, tsip_atype_ect_accept, &ap))) {
+ TSK_DEBUG_ERROR("Failed to accept incoming ECT");
+ }
+ va_end(ap);
+
+ return ret;
}
int tsip_api_invite_send_ect_reject(const tsip_ssession_handle_t *ss, ...)
{
- int ret = -1;
- va_list ap;
-
- va_start(ap, ss);
- if((ret = _tsip_api_common_any(ss, tsip_atype_ect_reject, &ap))){
- TSK_DEBUG_ERROR("Failed to reject incoming ECT");
- }
- va_end(ap);
-
- return ret;
+ int ret = -1;
+ va_list ap;
+
+ va_start(ap, ss);
+ if((ret = _tsip_api_common_any(ss, tsip_atype_ect_reject, &ap))) {
+ TSK_DEBUG_ERROR("Failed to reject incoming ECT");
+ }
+ va_end(ap);
+
+ return ret;
}
int tsip_api_invite_send_dtmf(const tsip_ssession_handle_t *ss, int event, ...)
{
- int ret = -1;
- tsip_action_t* action;
- const tsip_ssession_t* _ss;
- va_list ap;
-
- /* Checks for validity */
- if(!(_ss = ss) || !_ss->stack || (event <0 || event>15)){
- 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;
- }
-
- va_start(ap, event);
- /* execute action */
- if((action = _tsip_action_create(tsip_atype_dtmf_send, &ap))){
- /* Event */
- action->dtmf.event = event;
- /* Perform action */
- ret = tsip_ssession_handle(_ss, action);
- TSK_OBJECT_SAFE_FREE(action);
- }
- va_end(ap);
-
- return ret;
+ int ret = -1;
+ tsip_action_t* action;
+ const tsip_ssession_t* _ss;
+ va_list ap;
+
+ /* Checks for validity */
+ if(!(_ss = ss) || !_ss->stack || (event <0 || event>15)) {
+ 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;
+ }
+
+ va_start(ap, event);
+ /* execute action */
+ if((action = _tsip_action_create(tsip_atype_dtmf_send, &ap))) {
+ /* Event */
+ action->dtmf.event = event;
+ /* Perform action */
+ ret = tsip_ssession_handle(_ss, action);
+ TSK_OBJECT_SAFE_FREE(action);
+ }
+ va_end(ap);
+
+ return ret;
}
int tsip_api_invite_send_bye(const tsip_ssession_handle_t *ss, ...)
{
- int ret = -1;
- va_list ap;
+ int ret = -1;
+ va_list ap;
- va_start(ap, ss);
- if((ret = _tsip_api_common_any(ss, tsip_atype_bye, &ap))){
- TSK_DEBUG_ERROR("Bye() failed.");
- }
- va_end(ap);
+ va_start(ap, ss);
+ if((ret = _tsip_api_common_any(ss, tsip_atype_bye, &ap))) {
+ TSK_DEBUG_ERROR("Bye() failed.");
+ }
+ va_end(ap);
- return ret;
+ return ret;
}
@@ -332,32 +332,31 @@ int tsip_api_invite_send_bye(const tsip_ssession_handle_t *ss, ...)
//
static tsk_object_t* tsip_invite_event_ctor(tsk_object_t * self, va_list * app)
{
- tsip_invite_event_t *sipevent = self;
- if(sipevent){
- sipevent->type = va_arg(*app, tsip_invite_event_type_t);
- }
- return self;
+ tsip_invite_event_t *sipevent = self;
+ if(sipevent) {
+ sipevent->type = va_arg(*app, tsip_invite_event_type_t);
+ }
+ return self;
}
static tsk_object_t* tsip_invite_event_dtor(tsk_object_t * self)
-{
- tsip_invite_event_t *sipevent = self;
- if(sipevent){
- tsip_event_deinit(TSIP_EVENT(sipevent));
- }
- return self;
+{
+ tsip_invite_event_t *sipevent = self;
+ if(sipevent) {
+ tsip_event_deinit(TSIP_EVENT(sipevent));
+ }
+ return self;
}
static int tsip_invite_event_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
- return -1;
+ return -1;
}
-static const tsk_object_def_t tsip_invite_event_def_s =
-{
- sizeof(tsip_invite_event_t),
- tsip_invite_event_ctor,
- tsip_invite_event_dtor,
- tsip_invite_event_cmp,
+static const tsk_object_def_t tsip_invite_event_def_s = {
+ sizeof(tsip_invite_event_t),
+ tsip_invite_event_ctor,
+ tsip_invite_event_dtor,
+ tsip_invite_event_cmp,
};
const tsk_object_def_t *tsip_invite_event_def_t = &tsip_invite_event_def_s;
diff --git a/tinySIP/src/api/tsip_api_message.c b/tinySIP/src/api/tsip_api_message.c
index 232e9c6..1c65e50 100755
--- a/tinySIP/src/api/tsip_api_message.c
+++ b/tinySIP/src/api/tsip_api_message.c
@@ -2,19 +2,19 @@
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
-*
+*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
-*
+*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
@@ -43,47 +43,47 @@ extern tsip_action_t* _tsip_action_create(tsip_action_type_t type, va_list* app)
int tsip_message_event_signal(tsip_message_event_type_t type, tsip_ssession_handle_t* ss, short status_code, const char *phrase, const tsip_message_t* sipmessage)
{
- tsip_message_event_t* sipevent = TSIP_MESSAGE_EVENT_CREATE(type);
- tsip_event_init(TSIP_EVENT(sipevent), ss, status_code, phrase, sipmessage, tsip_event_message);
+ tsip_message_event_t* sipevent = TSIP_MESSAGE_EVENT_CREATE(type);
+ tsip_event_init(TSIP_EVENT(sipevent), ss, status_code, phrase, sipmessage, tsip_event_message);
- TSK_RUNNABLE_ENQUEUE_OBJECT(TSK_RUNNABLE(TSIP_SSESSION(ss)->stack), sipevent);
+ TSK_RUNNABLE_ENQUEUE_OBJECT(TSK_RUNNABLE(TSIP_SSESSION(ss)->stack), sipevent);
- return 0;
+ return 0;
}
int tsip_api_message_send_message(const tsip_ssession_handle_t *ss, ...)
{
- const tsip_ssession_t* _ss;
- va_list ap;
- tsip_action_t* action;
- tsip_dialog_t* dialog;
- int ret = -1;
-
- 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;
- }
-
- /* action */
- va_start(ap, ss);
- 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);
- }
- ret = tsip_dialog_fsm_act(dialog, action->type, tsk_null, action);
-
- tsk_object_unref(dialog);
- TSK_OBJECT_SAFE_FREE(action);
- }
- va_end(ap);
-
- return ret;
+ const tsip_ssession_t* _ss;
+ va_list ap;
+ tsip_action_t* action;
+ tsip_dialog_t* dialog;
+ int ret = -1;
+
+ 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;
+ }
+
+ /* action */
+ va_start(ap, ss);
+ 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);
+ }
+ ret = tsip_dialog_fsm_act(dialog, action->type, tsk_null, action);
+
+ tsk_object_unref(dialog);
+ TSK_OBJECT_SAFE_FREE(action);
+ }
+ va_end(ap);
+
+ return ret;
}
@@ -103,32 +103,31 @@ int tsip_api_message_send_message(const tsip_ssession_handle_t *ss, ...)
//
static tsk_object_t* tsip_message_event_ctor(tsk_object_t * self, va_list * app)
{
- tsip_message_event_t *sipevent = self;
- if(sipevent){
- sipevent->type = va_arg(*app, tsip_message_event_type_t);
- }
- return self;
+ tsip_message_event_t *sipevent = self;
+ if(sipevent) {
+ sipevent->type = va_arg(*app, tsip_message_event_type_t);
+ }
+ return self;
}
static tsk_object_t* tsip_message_event_dtor(tsk_object_t * self)
-{
- tsip_message_event_t *sipevent = self;
- if(sipevent){
- tsip_event_deinit(TSIP_EVENT(sipevent));
- }
- return self;
+{
+ tsip_message_event_t *sipevent = self;
+ if(sipevent) {
+ tsip_event_deinit(TSIP_EVENT(sipevent));
+ }
+ return self;
}
static int tsip_message_event_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
- return -1;
+ return -1;
}
-static const tsk_object_def_t tsip_message_event_def_s =
-{
- sizeof(tsip_message_event_t),
- tsip_message_event_ctor,
- tsip_message_event_dtor,
- tsip_message_event_cmp,
+static const tsk_object_def_t tsip_message_event_def_s = {
+ sizeof(tsip_message_event_t),
+ tsip_message_event_ctor,
+ tsip_message_event_dtor,
+ tsip_message_event_cmp,
};
const tsk_object_def_t *tsip_message_event_def_t = &tsip_message_event_def_s;
diff --git a/tinySIP/src/api/tsip_api_options.c b/tinySIP/src/api/tsip_api_options.c
index df87a4d..029f763 100755
--- a/tinySIP/src/api/tsip_api_options.c
+++ b/tinySIP/src/api/tsip_api_options.c
@@ -2,19 +2,19 @@
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
-*
+*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
-*
+*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
@@ -43,46 +43,46 @@ extern tsip_action_t* _tsip_action_create(tsip_action_type_t type, va_list* app)
int tsip_options_event_signal(tsip_options_event_type_t type, tsip_ssession_handle_t* ss, short status_code, const char *phrase, const tsip_message_t* sipmessage)
{
- tsip_options_event_t* sipevent = TSIP_OPTIONS_EVENT_CREATE(type);
- tsip_event_init(TSIP_EVENT(sipevent), ss, status_code, phrase, sipmessage, tsip_event_options);
+ tsip_options_event_t* sipevent = TSIP_OPTIONS_EVENT_CREATE(type);
+ tsip_event_init(TSIP_EVENT(sipevent), ss, status_code, phrase, sipmessage, tsip_event_options);
- TSK_RUNNABLE_ENQUEUE_OBJECT(TSK_RUNNABLE(TSIP_SSESSION(ss)->stack), sipevent);
+ TSK_RUNNABLE_ENQUEUE_OBJECT(TSK_RUNNABLE(TSIP_SSESSION(ss)->stack), sipevent);
- return 0;
+ return 0;
}
int tsip_api_options_send_options(const tsip_ssession_handle_t *ss, ...)
{
- const tsip_ssession_t* _ss;
- va_list ap;
- tsip_action_t* action;
- tsip_dialog_t* dialog;
- int ret = -1;
-
- 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;
- }
-
- va_start(ap, ss);
- 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);
- }
- ret = tsip_dialog_fsm_act(dialog, action->type, tsk_null, action);
-
- tsk_object_unref(dialog);
- TSK_OBJECT_SAFE_FREE(action);
- }
- va_end(ap);
-
- return ret;
+ const tsip_ssession_t* _ss;
+ va_list ap;
+ tsip_action_t* action;
+ tsip_dialog_t* dialog;
+ int ret = -1;
+
+ 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;
+ }
+
+ va_start(ap, ss);
+ 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);
+ }
+ ret = tsip_dialog_fsm_act(dialog, action->type, tsk_null, action);
+
+ tsk_object_unref(dialog);
+ TSK_OBJECT_SAFE_FREE(action);
+ }
+ va_end(ap);
+
+ return ret;
}
@@ -102,32 +102,31 @@ int tsip_api_options_send_options(const tsip_ssession_handle_t *ss, ...)
//
static tsk_object_t* tsip_options_event_ctor(tsk_object_t * self, va_list * app)
{
- tsip_options_event_t *sipevent = self;
- if(sipevent){
- sipevent->type = va_arg(*app, tsip_options_event_type_t);
- }
- return self;
+ tsip_options_event_t *sipevent = self;
+ if(sipevent) {
+ sipevent->type = va_arg(*app, tsip_options_event_type_t);
+ }
+ return self;
}
static tsk_object_t* tsip_options_event_dtor(tsk_object_t * self)
-{
- tsip_options_event_t *sipevent = self;
- if(sipevent){
- tsip_event_deinit(TSIP_EVENT(sipevent));
- }
- return self;
+{
+ tsip_options_event_t *sipevent = self;
+ if(sipevent) {
+ tsip_event_deinit(TSIP_EVENT(sipevent));
+ }
+ return self;
}
static int tsip_options_event_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
- return -1;
+ return -1;
}
-static const tsk_object_def_t tsip_options_event_def_s =
-{
- sizeof(tsip_options_event_t),
- tsip_options_event_ctor,
- tsip_options_event_dtor,
- tsip_options_event_cmp,
+static const tsk_object_def_t tsip_options_event_def_s = {
+ sizeof(tsip_options_event_t),
+ tsip_options_event_ctor,
+ tsip_options_event_dtor,
+ tsip_options_event_cmp,
};
const tsk_object_def_t *tsip_options_event_def_t = &tsip_options_event_def_s;
diff --git a/tinySIP/src/api/tsip_api_publish.c b/tinySIP/src/api/tsip_api_publish.c
index 916ed6f..86fd60f 100755
--- a/tinySIP/src/api/tsip_api_publish.c
+++ b/tinySIP/src/api/tsip_api_publish.c
@@ -2,19 +2,19 @@
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
-*
+*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
-*
+*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
@@ -43,74 +43,74 @@ extern tsip_action_t* _tsip_action_create(tsip_action_type_t type, va_list* app)
int tsip_publish_event_signal(tsip_publish_event_type_t type, tsip_ssession_handle_t* ss, short status_code, const char *phrase, const tsip_message_t* sipmessage)
{
- tsip_publish_event_t* sipevent = TSIP_PUBLISH_EVENT_CREATE(type);
- tsip_event_init(TSIP_EVENT(sipevent), ss, status_code, phrase, sipmessage, tsip_event_publish);
+ tsip_publish_event_t* sipevent = TSIP_PUBLISH_EVENT_CREATE(type);
+ tsip_event_init(TSIP_EVENT(sipevent), ss, status_code, phrase, sipmessage, tsip_event_publish);
- TSK_RUNNABLE_ENQUEUE_OBJECT(TSK_RUNNABLE(TSIP_SSESSION(ss)->stack), sipevent);
+ TSK_RUNNABLE_ENQUEUE_OBJECT(TSK_RUNNABLE(TSIP_SSESSION(ss)->stack), sipevent);
- return 0;
+ return 0;
}
int tsip_api_publish_send_publish(const tsip_ssession_handle_t *ss, ...)
{
- const tsip_ssession_t* _ss;
- va_list ap;
- tsip_action_t* action;
- tsip_dialog_t* dialog;
- int ret = -1;
-
- 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;
- }
-
- va_start(ap, ss);
- 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);
- }
- ret = tsip_dialog_fsm_act(dialog, action->type, tsk_null, action);
-
- tsk_object_unref(dialog);
- TSK_OBJECT_SAFE_FREE(action);
- }
- va_end(ap);
-
- return ret;
+ const tsip_ssession_t* _ss;
+ va_list ap;
+ tsip_action_t* action;
+ tsip_dialog_t* dialog;
+ int ret = -1;
+
+ 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;
+ }
+
+ va_start(ap, ss);
+ 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);
+ }
+ ret = tsip_dialog_fsm_act(dialog, action->type, tsk_null, action);
+
+ tsk_object_unref(dialog);
+ TSK_OBJECT_SAFE_FREE(action);
+ }
+ va_end(ap);
+
+ return ret;
}
int tsip_api_publish_send_unpublish(const tsip_ssession_handle_t *ss, ...)
{
- const tsip_ssession_t* _ss;
- va_list ap;
- tsip_action_t* action;
- int ret = -1;
-
- if(!(_ss = ss) || !_ss->stack){
- TSK_DEBUG_ERROR("Invalid parameter.");
- return ret;
- }
-
- /* Checks if the stack is running */
- if(!TSK_RUNNABLE(_ss->stack)->running){
- TSK_DEBUG_ERROR("Stack not running.");
- return -2;
- }
-
- va_start(ap, ss);
- if((action = _tsip_action_create(tsip_atype_unpublish, &ap))){
- ret = tsip_ssession_handle(ss, action);
- TSK_OBJECT_SAFE_FREE(action);
- }
- va_end(ap);
-
- return 0;
+ const tsip_ssession_t* _ss;
+ va_list ap;
+ tsip_action_t* action;
+ int ret = -1;
+
+ if(!(_ss = ss) || !_ss->stack) {
+ TSK_DEBUG_ERROR("Invalid parameter.");
+ return ret;
+ }
+
+ /* Checks if the stack is running */
+ if(!TSK_RUNNABLE(_ss->stack)->running) {
+ TSK_DEBUG_ERROR("Stack not running.");
+ return -2;
+ }
+
+ va_start(ap, ss);
+ if((action = _tsip_action_create(tsip_atype_unpublish, &ap))) {
+ ret = tsip_ssession_handle(ss, action);
+ TSK_OBJECT_SAFE_FREE(action);
+ }
+ va_end(ap);
+
+ return 0;
}
@@ -128,32 +128,31 @@ int tsip_api_publish_send_unpublish(const tsip_ssession_handle_t *ss, ...)
//
static tsk_object_t* tsip_publish_event_ctor(tsk_object_t * self, va_list * app)
{
- tsip_publish_event_t *sipevent = self;
- if(sipevent){
- sipevent->type = va_arg(*app, tsip_publish_event_type_t);
- }
- return self;
+ tsip_publish_event_t *sipevent = self;
+ if(sipevent) {
+ sipevent->type = va_arg(*app, tsip_publish_event_type_t);
+ }
+ return self;
}
static tsk_object_t* tsip_publish_event_dtor(tsk_object_t * self)
-{
- tsip_publish_event_t *sipevent = self;
- if(sipevent){
- tsip_event_deinit(TSIP_EVENT(sipevent));
- }
- return self;
+{
+ tsip_publish_event_t *sipevent = self;
+ if(sipevent) {
+ tsip_event_deinit(TSIP_EVENT(sipevent));
+ }
+ return self;
}
static int tsip_publish_event_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
- return -1;
+ return -1;
}
-static const tsk_object_def_t tsip_publish_event_def_s =
-{
- sizeof(tsip_publish_event_t),
- tsip_publish_event_ctor,
- tsip_publish_event_dtor,
- tsip_publish_event_cmp,
+static const tsk_object_def_t tsip_publish_event_def_s = {
+ sizeof(tsip_publish_event_t),
+ tsip_publish_event_ctor,
+ tsip_publish_event_dtor,
+ tsip_publish_event_cmp,
};
const tsk_object_def_t *tsip_publish_event_def_t = &tsip_publish_event_def_s;
diff --git a/tinySIP/src/api/tsip_api_register.c b/tinySIP/src/api/tsip_api_register.c
index 4d61632..5b5c579 100755
--- a/tinySIP/src/api/tsip_api_register.c
+++ b/tinySIP/src/api/tsip_api_register.c
@@ -2,19 +2,19 @@
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
-*
+*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
-*
+*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
@@ -47,78 +47,78 @@ extern int _tsip_api_common_any(const tsip_ssession_handle_t *ss, tsip_action_ty
/* internal function used to signal evant from REGISTER dialog to user app */
int tsip_register_event_signal(tsip_register_event_type_t type, tsip_ssession_t* ss, short status_code, const char *phrase, const tsip_message_t* sipmessage)
{
- tsip_register_event_t* sipevent = TSIP_REGISTER_EVENT_CREATE(type);
- tsip_event_init(TSIP_EVENT(sipevent), ss, status_code, phrase, sipmessage, tsip_event_register);
+ tsip_register_event_t* sipevent = TSIP_REGISTER_EVENT_CREATE(type);
+ tsip_event_init(TSIP_EVENT(sipevent), ss, status_code, phrase, sipmessage, tsip_event_register);
- TSK_RUNNABLE_ENQUEUE_OBJECT(TSK_RUNNABLE(ss->stack), sipevent);
+ TSK_RUNNABLE_ENQUEUE_OBJECT(TSK_RUNNABLE(ss->stack), sipevent);
- return 0;
+ 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().
+* @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_api_register_send_unregister
*/
int tsip_api_register_send_register(const tsip_ssession_handle_t *ss, ...)
{
- const tsip_ssession_t* _ss;
- va_list ap;
- tsip_action_t* action;
- tsip_dialog_t* dialog;
- int ret = -1;
-
- 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;
- }
-
- /* performs action */
- va_start(ap, ss);
- 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);
- }
- ret = tsip_dialog_fsm_act(dialog, action->type, tsk_null, action);
-
- TSK_OBJECT_SAFE_FREE(dialog);
- TSK_OBJECT_SAFE_FREE(action);
- }
- va_end(ap);
-
- return ret;
+ const tsip_ssession_t* _ss;
+ va_list ap;
+ tsip_action_t* action;
+ tsip_dialog_t* dialog;
+ int ret = -1;
+
+ 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;
+ }
+
+ /* performs action */
+ va_start(ap, ss);
+ 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);
+ }
+ ret = tsip_dialog_fsm_act(dialog, action->type, tsk_null, action);
+
+ TSK_OBJECT_SAFE_FREE(dialog);
+ TSK_OBJECT_SAFE_FREE(action);
+ }
+ va_end(ap);
+
+ 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().
+* @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_api_register_send_register
*/
int tsip_api_register_send_unregister(const tsip_ssession_handle_t *ss, ...)
{
- int ret = -1;
- va_list ap;
+ int ret = -1;
+ va_list ap;
- va_start(ap, ss);
- if((ret = _tsip_api_common_any(ss, tsip_atype_unregister, &ap))){
- TSK_DEBUG_ERROR("unREGISTER() failed.");
- }
- va_end(ap);
+ va_start(ap, ss);
+ if((ret = _tsip_api_common_any(ss, tsip_atype_unregister, &ap))) {
+ TSK_DEBUG_ERROR("unREGISTER() failed.");
+ }
+ va_end(ap);
- return ret;
+ return ret;
}
@@ -135,32 +135,31 @@ int tsip_api_register_send_unregister(const tsip_ssession_handle_t *ss, ...)
//
static tsk_object_t* tsip_register_event_ctor(tsk_object_t * self, va_list * app)
{
- tsip_register_event_t *sipevent = self;
- if(sipevent){
- sipevent->type = va_arg(*app, tsip_register_event_type_t);
- }
- return self;
+ tsip_register_event_t *sipevent = self;
+ if(sipevent) {
+ sipevent->type = va_arg(*app, tsip_register_event_type_t);
+ }
+ return self;
}
static tsk_object_t* tsip_register_event_dtor(tsk_object_t * self)
-{
- tsip_register_event_t *sipevent = self;
- if(sipevent){
- tsip_event_deinit(TSIP_EVENT(sipevent));
- }
- return self;
+{
+ tsip_register_event_t *sipevent = self;
+ if(sipevent) {
+ tsip_event_deinit(TSIP_EVENT(sipevent));
+ }
+ return self;
}
static int tsip_register_event_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
- return -1;
+ return -1;
}
-static const tsk_object_def_t tsip_register_event_def_s =
-{
- sizeof(tsip_register_event_t),
- tsip_register_event_ctor,
- tsip_register_event_dtor,
- tsip_register_event_cmp,
+static const tsk_object_def_t tsip_register_event_def_s = {
+ sizeof(tsip_register_event_t),
+ tsip_register_event_ctor,
+ tsip_register_event_dtor,
+ tsip_register_event_cmp,
};
const tsk_object_def_t *tsip_register_event_def_t = &tsip_register_event_def_s;
diff --git a/tinySIP/src/api/tsip_api_subscribe.c b/tinySIP/src/api/tsip_api_subscribe.c
index 867b258..c0f8c43 100755
--- a/tinySIP/src/api/tsip_api_subscribe.c
+++ b/tinySIP/src/api/tsip_api_subscribe.c
@@ -2,19 +2,19 @@
* Copyright (C) 2010-2011 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
-*
+*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
-*
+*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*
@@ -44,74 +44,74 @@ extern tsip_action_t* _tsip_action_create(tsip_action_type_t type, va_list* app)
int tsip_subscribe_event_signal(tsip_subscribe_event_type_t type, tsip_ssession_t* ss, short status_code, const char *phrase, const tsip_message_t* sipmessage)
{
- tsip_subscribe_event_t* sipevent = TSIP_SUBSCRIBE_EVENT_CREATE(type);
- tsip_event_init(TSIP_EVENT(sipevent), ss, status_code, phrase, sipmessage, tsip_event_subscribe);
+ tsip_subscribe_event_t* sipevent = TSIP_SUBSCRIBE_EVENT_CREATE(type);
+ tsip_event_init(TSIP_EVENT(sipevent), ss, status_code, phrase, sipmessage, tsip_event_subscribe);
- TSK_RUNNABLE_ENQUEUE_OBJECT(TSK_RUNNABLE(TSIP_SSESSION(ss)->stack), sipevent);
+ TSK_RUNNABLE_ENQUEUE_OBJECT(TSK_RUNNABLE(TSIP_SSESSION(ss)->stack), sipevent);
- return 0;
+ return 0;
}
int tsip_api_subscribe_send_subscribe(const tsip_ssession_handle_t *ss, ...)
{
- const tsip_ssession_t* _ss;
- va_list ap;
- tsip_action_t* action;
- tsip_dialog_t* dialog;
- int ret = -1;
-
- 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;
- }
-
- va_start(ap, ss);
- 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);
- }
- ret = tsip_dialog_fsm_act(dialog, action->type, tsk_null, action);
-
- tsk_object_unref(dialog);
- TSK_OBJECT_SAFE_FREE(action);
- }
- va_end(ap);
-
- return ret;
+ const tsip_ssession_t* _ss;
+ va_list ap;
+ tsip_action_t* action;
+ tsip_dialog_t* dialog;
+ int ret = -1;
+
+ 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;
+ }
+
+ va_start(ap, ss);
+ 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);
+ }
+ ret = tsip_dialog_fsm_act(dialog, action->type, tsk_null, action);
+
+ tsk_object_unref(dialog);
+ TSK_OBJECT_SAFE_FREE(action);
+ }
+ va_end(ap);
+
+ return ret;
}
int tsip_api_subscribe_send_unsubscribe(const tsip_ssession_handle_t *ss, ...)
{
- const tsip_ssession_t* _ss;
- va_list ap;
- tsip_action_t* action;
- int ret = -1;
-
- if(!(_ss = ss) || !_ss->stack){
- TSK_DEBUG_ERROR("Invalid parameter.");
- return ret;
- }
-
- /* Checks if the stack is running */
- if(!TSK_RUNNABLE(_ss->stack)->running){
- TSK_DEBUG_ERROR("Stack not running.");
- return -2;
- }
-
- va_start(ap, ss);
- if((action = _tsip_action_create(tsip_atype_unsubscribe, &ap))){
- ret = tsip_ssession_handle(ss, action);
- TSK_OBJECT_SAFE_FREE(action);
- }
- va_end(ap);
-
- return 0;
+ const tsip_ssession_t* _ss;
+ va_list ap;
+ tsip_action_t* action;
+ int ret = -1;
+
+ if(!(_ss = ss) || !_ss->stack) {
+ TSK_DEBUG_ERROR("Invalid parameter.");
+ return ret;
+ }
+
+ /* Checks if the stack is running */
+ if(!TSK_RUNNABLE(_ss->stack)->running) {
+ TSK_DEBUG_ERROR("Stack not running.");
+ return -2;
+ }
+
+ va_start(ap, ss);
+ if((action = _tsip_action_create(tsip_atype_unsubscribe, &ap))) {
+ ret = tsip_ssession_handle(ss, action);
+ TSK_OBJECT_SAFE_FREE(action);
+ }
+ va_end(ap);
+
+ return 0;
}
@@ -129,32 +129,31 @@ int tsip_api_subscribe_send_unsubscribe(const tsip_ssession_handle_t *ss, ...)
//
static tsk_object_t* tsip_subscribe_event_ctor(tsk_object_t * self, va_list * app)
{
- tsip_subscribe_event_t *sipevent = self;
- if(sipevent){
- sipevent->type = va_arg(*app, tsip_subscribe_event_type_t);
- }
- return self;
+ tsip_subscribe_event_t *sipevent = self;
+ if(sipevent) {
+ sipevent->type = va_arg(*app, tsip_subscribe_event_type_t);
+ }
+ return self;
}
static tsk_object_t* tsip_subscribe_event_dtor(tsk_object_t * self)
-{
- tsip_subscribe_event_t *sipevent = self;
- if(sipevent){
- tsip_event_deinit(TSIP_EVENT(sipevent));
- }
- return self;
+{
+ tsip_subscribe_event_t *sipevent = self;
+ if(sipevent) {
+ tsip_event_deinit(TSIP_EVENT(sipevent));
+ }
+ return self;
}
static int tsip_subscribe_event_cmp(const tsk_object_t *obj1, const tsk_object_t *obj2)
{
- return -1;
+ return -1;
}
-static const tsk_object_def_t tsip_subscribe_event_def_s =
-{
- sizeof(tsip_subscribe_event_t),
- tsip_subscribe_event_ctor,
- tsip_subscribe_event_dtor,
- tsip_subscribe_event_cmp,
+static const tsk_object_def_t tsip_subscribe_event_def_s = {
+ sizeof(tsip_subscribe_event_t),
+ tsip_subscribe_event_ctor,
+ tsip_subscribe_event_dtor,
+ tsip_subscribe_event_cmp,
};
const tsk_object_def_t *tsip_subscribe_event_def_t = &tsip_subscribe_event_def_s;
OpenPOWER on IntegriCloud