diff options
author | Mamadou DIOP <bossiel@yahoo.fr> | 2016-02-23 22:00:35 +0100 |
---|---|---|
committer | Mamadou DIOP <bossiel@yahoo.fr> | 2016-02-23 22:00:35 +0100 |
commit | 50dfb4359619563012997bc3ddafb7667741066c (patch) | |
tree | db234c1edc3240a653363b5735fc4077af4b8720 /tinySIP | |
parent | 94b2219209038e05dd26395f6fb700be4d1062c0 (diff) | |
download | doubango-50dfb4359619563012997bc3ddafb7667741066c.zip doubango-50dfb4359619563012997bc3ddafb7667741066c.tar.gz |
Add new QoS implementation
Code formatting
Diffstat (limited to 'tinySIP')
250 files changed, 48553 insertions, 48121 deletions
diff --git a/tinySIP/include/tinysip.h b/tinySIP/include/tinysip.h index bf666dc..c20ca41 100755 --- a/tinySIP/include/tinysip.h +++ b/tinySIP/include/tinysip.h @@ -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. * diff --git a/tinySIP/include/tinysip/api/tsip_api_common.h b/tinySIP/include/tinysip/api/tsip_api_common.h index 1f91f66..64bc885 100755 --- a/tinySIP/include/tinysip/api/tsip_api_common.h +++ b/tinySIP/include/tinysip/api/tsip_api_common.h @@ -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. * diff --git a/tinySIP/include/tinysip/api/tsip_api_info.h b/tinySIP/include/tinysip/api/tsip_api_info.h index 5c7f08e..edbacf8 100755 --- a/tinySIP/include/tinysip/api/tsip_api_info.h +++ b/tinySIP/include/tinysip/api/tsip_api_info.h @@ -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. * @@ -39,18 +39,16 @@ TSIP_BEGIN_DECLS #define TSIP_INFO_EVENT(self) ((tsip_info_event_t*)(self)) //@rinyWRAP -typedef enum tsip_info_event_type_e -{ - tsip_i_info, - tsip_ao_info, +typedef enum tsip_info_event_type_e { + tsip_i_info, + tsip_ao_info, } tsip_info_event_type_t; -typedef struct tsip_info_event_e -{ - TSIP_DECLARE_EVENT; +typedef struct tsip_info_event_e { + TSIP_DECLARE_EVENT; - tsip_info_event_type_t type; + tsip_info_event_type_t type; } tsip_info_event_t; diff --git a/tinySIP/include/tinysip/api/tsip_api_invite.h b/tinySIP/include/tinysip/api/tsip_api_invite.h index 7fa5b01..b71eb5f 100755 --- a/tinySIP/include/tinysip/api/tsip_api_invite.h +++ b/tinySIP/include/tinysip/api/tsip_api_invite.h @@ -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. * @@ -41,60 +41,58 @@ TSIP_BEGIN_DECLS #define TSIP_INVITE_EVENT(self) ((tsip_invite_event_t*)(self)) //@tinyWRAP -typedef enum tsip_invite_event_type_e -{ - // ============================ - // Sip Events - // - tsip_i_newcall, - - //! in-dialog requests/reponses - tsip_i_request, - tsip_ao_request, - - /* 3GPP TS 24.629: Explicit Call Transfer (ECT) */ - tsip_o_ect_trying, - tsip_o_ect_accepted, - tsip_o_ect_completed, - tsip_o_ect_failed, - tsip_o_ect_notify, - tsip_i_ect_requested, - tsip_i_ect_newcall, - tsip_i_ect_completed, - tsip_i_ect_failed, - tsip_i_ect_notify, - - // ============================ - // Media Events - // - - tsip_m_early_media, - tsip_m_updating, // Trying to update from Audio -> Video for example - tsip_m_updated, // succeed to update - - /* 3GPP TS 24.610: Communication Hold */ - tsip_m_local_hold_ok, - tsip_m_local_hold_nok, - tsip_m_local_resume_ok, - tsip_m_local_resume_nok, - tsip_m_remote_hold, - tsip_m_remote_resume, +typedef enum tsip_invite_event_type_e { + // ============================ + // Sip Events + // + tsip_i_newcall, + + //! in-dialog requests/reponses + tsip_i_request, + tsip_ao_request, + + /* 3GPP TS 24.629: Explicit Call Transfer (ECT) */ + tsip_o_ect_trying, + tsip_o_ect_accepted, + tsip_o_ect_completed, + tsip_o_ect_failed, + tsip_o_ect_notify, + tsip_i_ect_requested, + tsip_i_ect_newcall, + tsip_i_ect_completed, + tsip_i_ect_failed, + tsip_i_ect_notify, + + // ============================ + // Media Events + // + + tsip_m_early_media, + tsip_m_updating, // Trying to update from Audio -> Video for example + tsip_m_updated, // succeed to update + + /* 3GPP TS 24.610: Communication Hold */ + tsip_m_local_hold_ok, + tsip_m_local_hold_nok, + tsip_m_local_resume_ok, + tsip_m_local_resume_nok, + tsip_m_remote_hold, + tsip_m_remote_resume, } tsip_invite_event_type_t; -typedef struct tsip_invite_event_e -{ - TSIP_DECLARE_EVENT; +typedef struct tsip_invite_event_e { + TSIP_DECLARE_EVENT; - tsip_invite_event_type_t type; + tsip_invite_event_type_t type; - struct{ - unsigned toto:1; - } av; + struct { + unsigned toto:1; + } av; - /*struct{ - char* dir; - } msrp;*/ + /*struct{ + char* dir; + } msrp;*/ } tsip_invite_event_t; diff --git a/tinySIP/include/tinysip/api/tsip_api_message.h b/tinySIP/include/tinysip/api/tsip_api_message.h index e52c914..6ace613 100755 --- a/tinySIP/include/tinysip/api/tsip_api_message.h +++ b/tinySIP/include/tinysip/api/tsip_api_message.h @@ -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,18 +39,16 @@ TSIP_BEGIN_DECLS #define TSIP_MESSAGE_EVENT(self) ((tsip_message_event_t*)(self)) //@tinyWRAP -typedef enum tsip_message_event_type_e -{ - tsip_i_message, - tsip_ao_message, +typedef enum tsip_message_event_type_e { + tsip_i_message, + tsip_ao_message, } tsip_message_event_type_t; -typedef struct tsip_message_event_e -{ - TSIP_DECLARE_EVENT; +typedef struct tsip_message_event_e { + TSIP_DECLARE_EVENT; - tsip_message_event_type_t type; + tsip_message_event_type_t type; } tsip_message_event_t; diff --git a/tinySIP/include/tinysip/api/tsip_api_options.h b/tinySIP/include/tinysip/api/tsip_api_options.h index 1f62211..47ef00a 100755 --- a/tinySIP/include/tinysip/api/tsip_api_options.h +++ b/tinySIP/include/tinysip/api/tsip_api_options.h @@ -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,20 +39,18 @@ TSIP_BEGIN_DECLS #define TSIP_OPTIONS_EVENT(self) ((tsip_options_event_t*)(self)) //@tinyWRAP -typedef enum tsip_options_event_type_e -{ - tsip_i_options, - tsip_ao_options, +typedef enum tsip_options_event_type_e { + tsip_i_options, + tsip_ao_options, } tsip_options_event_type_t; /**< Event from SIP OPTIONS dialog */ -typedef struct tsip_options_event_e -{ - TSIP_DECLARE_EVENT; - - //! the type of the event - tsip_options_event_type_t type; +typedef struct tsip_options_event_e { + TSIP_DECLARE_EVENT; + + //! the type of the event + tsip_options_event_type_t type; } tsip_options_event_t; diff --git a/tinySIP/include/tinysip/api/tsip_api_publish.h b/tinySIP/include/tinysip/api/tsip_api_publish.h index c37f239..73449e9 100755 --- a/tinySIP/include/tinysip/api/tsip_api_publish.h +++ b/tinySIP/include/tinysip/api/tsip_api_publish.h @@ -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,21 +39,19 @@ TSIP_BEGIN_DECLS #define TSIP_PUBLISH_EVENT(self) ((tsip_publish_event_t*)(self)) //@tinyWRAP -typedef enum tsip_publish_event_type_e -{ - tsip_i_publish, - tsip_ao_publish, - - tsip_i_unpublish, - tsip_ao_unpublish +typedef enum tsip_publish_event_type_e { + tsip_i_publish, + tsip_ao_publish, + + tsip_i_unpublish, + tsip_ao_unpublish } tsip_publish_event_type_t; -typedef struct tsip_publish_event_e -{ - TSIP_DECLARE_EVENT; +typedef struct tsip_publish_event_e { + TSIP_DECLARE_EVENT; - tsip_publish_event_type_t type; + tsip_publish_event_type_t type; } tsip_publish_event_t; diff --git a/tinySIP/include/tinysip/api/tsip_api_register.h b/tinySIP/include/tinysip/api/tsip_api_register.h index d116006..73d51b4 100755 --- a/tinySIP/include/tinysip/api/tsip_api_register.h +++ b/tinySIP/include/tinysip/api/tsip_api_register.h @@ -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,23 +39,21 @@ TSIP_BEGIN_DECLS #define TSIP_REGISTER_EVENT(self) ((tsip_register_event_t*)(self)) //@tinyWRAP -typedef enum tsip_register_event_type_e -{ - tsip_i_newreg, +typedef enum tsip_register_event_type_e { + tsip_i_newreg, - tsip_i_register, // refresh - tsip_ao_register, + tsip_i_register, // refresh + tsip_ao_register, - tsip_i_unregister, - tsip_ao_unregister, + tsip_i_unregister, + tsip_ao_unregister, } tsip_register_event_type_t; -typedef struct tsip_register_event_e -{ - TSIP_DECLARE_EVENT; +typedef struct tsip_register_event_e { + TSIP_DECLARE_EVENT; - tsip_register_event_type_t type; + tsip_register_event_type_t type; } tsip_register_event_t; diff --git a/tinySIP/include/tinysip/api/tsip_api_subscribe.h b/tinySIP/include/tinysip/api/tsip_api_subscribe.h index da7f8c9..a7b1b21 100755 --- a/tinySIP/include/tinysip/api/tsip_api_subscribe.h +++ b/tinySIP/include/tinysip/api/tsip_api_subscribe.h @@ -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,24 +39,22 @@ TSIP_BEGIN_DECLS #define TSIP_SUBSCRIBE_EVENT(self) ((tsip_subscribe_event_t*)(self)) //@tinyWRAP -typedef enum tsip_subscribe_event_type_e -{ - tsip_i_subscribe, - tsip_ao_subscribe, - - tsip_i_unsubscribe, - tsip_ao_unsubscribe, - - tsip_i_notify, - tsip_ao_notify +typedef enum tsip_subscribe_event_type_e { + tsip_i_subscribe, + tsip_ao_subscribe, + + tsip_i_unsubscribe, + tsip_ao_unsubscribe, + + tsip_i_notify, + tsip_ao_notify } tsip_subscribe_event_type_t; -typedef struct tsip_subscribe_event_e -{ - TSIP_DECLARE_EVENT; +typedef struct tsip_subscribe_event_e { + TSIP_DECLARE_EVENT; - tsip_subscribe_event_type_t type; + tsip_subscribe_event_type_t type; } tsip_subscribe_event_t; diff --git a/tinySIP/include/tinysip/authentication/tsip_challenge.h b/tinySIP/include/tinysip/authentication/tsip_challenge.h index 38f7690..7de2659 100755 --- a/tinySIP/include/tinysip/authentication/tsip_challenge.h +++ b/tinySIP/include/tinysip/authentication/tsip_challenge.h @@ -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. * @@ -48,29 +48,28 @@ TSIP_BEGIN_DECLS -typedef struct tsip_challenge_s -{ - TSK_DECLARE_OBJECT; +typedef struct tsip_challenge_s { + TSK_DECLARE_OBJECT; - const tsip_stack_handle_t *stack; + const tsip_stack_handle_t *stack; - tsk_bool_t isproxy; + tsk_bool_t isproxy; - char* username; - char* scheme; - char* realm; - char* nonce; - char* opaque; - char* algorithm; - const char* qop; + char* username; + char* scheme; + char* realm; + char* nonce; + char* opaque; + char* algorithm; + const char* qop; - char* ha1_hexstr; + char* ha1_hexstr; - AKA_CK_T ck; - AKA_IK_T ik; + AKA_CK_T ck; + AKA_IK_T ik; - tsk_md5string_t cnonce; - unsigned nc; + tsk_md5string_t cnonce; + unsigned nc; } tsip_challenge_t; diff --git a/tinySIP/include/tinysip/authentication/tsip_milenage.h b/tinySIP/include/tinysip/authentication/tsip_milenage.h index dbf72de..6f4aea7 100755 --- a/tinySIP/include/tinysip/authentication/tsip_milenage.h +++ b/tinySIP/include/tinysip/authentication/tsip_milenage.h @@ -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. * @@ -42,7 +42,7 @@ * * This has been coded for clarity, not necessarily for efficiency. * - * The functions f2, f3, f4 and f5 share the same inputs and have + * The functions f2, f3, f4 and f5 share the same inputs and have * been coded together as a single function. f1, f1* and f5* are * all coded separately. * @@ -59,7 +59,7 @@ #include "tinysip_config.h" /**@def AKA_AK_SIZE - * a 48-bit anonymity key that is the output of either of the functions f5 and f5*. + * a 48-bit anonymity key that is the output of either of the functions f5 and f5*. * Defined in 3GPP TS 35.206 subclause 2.3. */ @@ -97,7 +97,7 @@ typedef uint8_t AKA_IK_T[AKA_IK_SIZE + 1]; typedef uint8_t AKA_K_T[AKA_K_SIZE + 1]; /**@def AKA_MAC_A_SIZE - * a 64-bit network authentication code that is the output of the function f1. + * a 64-bit network authentication code that is the output of the function f1. * Defined in 3GPP TS 35.206 subclause 2.3. */ #define AKA_MAC_A_SIZE 8 @@ -137,7 +137,7 @@ typedef uint8_t AKA_RAND_T[AKA_RAND_SIZE + 1]; */ #define AKA_RES_SIZE 8 typedef uint8_t AKA_RES_T[AKA_RES_SIZE + 1]; - + /**@def AKA_SQN_SIZE * a 48-bit sequence number that is an input to either of the functions f1 and f1*. (For f1* this input is more precisely called SQNMS.) * Defined in 3GPP TS 35.206 subclause 2.3. @@ -175,7 +175,7 @@ void f1 ( uint8_t k[16], uint8_t rand[16], uint8_t sqn[6], uint8_t amf[2], uint8_t mac_a[8] ); void f2345 ( uint8_t k[16], uint8_t rand[16], uint8_t res[8], uint8_t ck[16], uint8_t ik[16], uint8_t ak[6] ); -void f1star( uint8_t k[16], uint8_t rand[16], uint8_t sqn[6], uint8_t amf[2], +void f1star( uint8_t k[16], uint8_t rand[16], uint8_t sqn[6], uint8_t amf[2], uint8_t mac_s[8] ); void f5star( uint8_t k[16], uint8_t rand[16], uint8_t ak[6] ); diff --git a/tinySIP/include/tinysip/authentication/tsip_rijndael.h b/tinySIP/include/tinysip/authentication/tsip_rijndael.h index 18efe3a..acf6b6d 100755 --- a/tinySIP/include/tinysip/authentication/tsip_rijndael.h +++ b/tinySIP/include/tinysip/authentication/tsip_rijndael.h @@ -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. * diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog.h b/tinySIP/include/tinysip/dialogs/tsip_dialog.h index e6280b9..e9e8c0c 100755 --- a/tinySIP/include/tinysip/dialogs/tsip_dialog.h +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog.h @@ -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. * @@ -61,7 +61,7 @@ TSIP_BEGIN_DECLS // TX MUST be in seconds #define TSIP_DIALOG_TIMER_SCHEDULE(name, TX) \ - self->timer##TX.id = tsk_timer_mgr_global_schedule(self->timer##TX.timeout, TSK_TIMER_CALLBACK_F(tsip_dialog_##name##_timer_callback), self) + self->timer##TX.id = tsk_timer_mgr_global_schedule(self->timer##TX.timeout, TSK_TIMER_CALLBACK_F(tsip_dialog_##name##_timer_callback), self) #define TSIP_DIALOG_SIGNAL(self, code, phrase) \ tsip_event_signal(tsip_event_dialog, TSIP_DIALOG(self)->ss, code, phrase) @@ -79,38 +79,35 @@ TSIP_BEGIN_DECLS typedef uint64_t tsip_dialog_id_t; -typedef enum tsip_dialog_state_e -{ - tsip_initial, - tsip_early, - tsip_established, - tsip_terminated +typedef enum tsip_dialog_state_e { + tsip_initial, + tsip_early, + tsip_established, + tsip_terminated } tsip_dialog_state_t; -typedef enum tsip_dialog_type_e -{ - tsip_dialog_unknown, - tsip_dialog_INVITE, - tsip_dialog_MESSAGE, - tsip_dialog_INFO, - tsip_dialog_OPTIONS, - tsip_dialog_PUBLISH, - tsip_dialog_REGISTER, - tsip_dialog_SUBSCRIBE, +typedef enum tsip_dialog_type_e { + tsip_dialog_unknown, + tsip_dialog_INVITE, + tsip_dialog_MESSAGE, + tsip_dialog_INFO, + tsip_dialog_OPTIONS, + tsip_dialog_PUBLISH, + tsip_dialog_REGISTER, + tsip_dialog_SUBSCRIBE, } tsip_dialog_type_t; -typedef enum tsip_dialog_event_type_e -{ - tsip_dialog_i_msg, - tsip_dialog_o_msg, - tsip_dialog_transac_ok, - tsip_dialog_canceled, - tsip_dialog_terminated, - tsip_dialog_timedout, - tsip_dialog_error, - tsip_dialog_transport_error, +typedef enum tsip_dialog_event_type_e { + tsip_dialog_i_msg, + tsip_dialog_o_msg, + tsip_dialog_transac_ok, + tsip_dialog_canceled, + tsip_dialog_terminated, + tsip_dialog_timedout, + tsip_dialog_error, + tsip_dialog_transport_error, } tsip_dialog_event_type_t; @@ -119,53 +116,52 @@ typedef int (*tsip_dialog_event_callback_f)(const void *arg, tsip_dialog_event_t /*================================ */ -typedef struct tsip_dialog_s -{ - TSK_DECLARE_OBJECT; - - tsip_dialog_type_t type; - tsip_dialog_id_t id; - - tsk_fsm_t* fsm; - - tsip_ssession_t* ss; - tsip_action_t* curr_action; - - tsip_dialog_state_t state; - - tsk_bool_t initialized; - tsk_bool_t running; - - tnet_fd_t connected_fd; - - struct{ - char* phrase; - short code; - tsip_message_t* message; - } last_error; - - char* tag_local; - tsip_uri_t* uri_local; - char* tag_remote; - tsip_uri_t* uri_remote; - - tsip_uri_t* uri_remote_target; - struct sockaddr_storage remote_addr; // Only valid for Dgram - - uint32_t cseq_value; - char* cseq_method; - - int64_t expires; /* in milliseconds */ - - char* callid; - - tsip_header_Record_Routes_L_t *record_routes; - - tsip_challenges_L_t *challenges; - - tsip_dialog_event_callback_f callback; - - TSK_DECLARE_SAFEOBJ; +typedef struct tsip_dialog_s { + TSK_DECLARE_OBJECT; + + tsip_dialog_type_t type; + tsip_dialog_id_t id; + + tsk_fsm_t* fsm; + + tsip_ssession_t* ss; + tsip_action_t* curr_action; + + tsip_dialog_state_t state; + + tsk_bool_t initialized; + tsk_bool_t running; + + tnet_fd_t connected_fd; + + struct { + char* phrase; + short code; + tsip_message_t* message; + } last_error; + + char* tag_local; + tsip_uri_t* uri_local; + char* tag_remote; + tsip_uri_t* uri_remote; + + tsip_uri_t* uri_remote_target; + struct sockaddr_storage remote_addr; // Only valid for Dgram + + uint32_t cseq_value; + char* cseq_method; + + int64_t expires; /* in milliseconds */ + + char* callid; + + tsip_header_Record_Routes_L_t *record_routes; + + tsip_challenges_L_t *challenges; + + tsip_dialog_event_callback_f callback; + + TSK_DECLARE_SAFEOBJ; } tsip_dialog_t; diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog_info.h b/tinySIP/include/tinysip/dialogs/tsip_dialog_info.h index 94fe6ad..1c54442 100755 --- a/tinySIP/include/tinysip/dialogs/tsip_dialog_info.h +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog_info.h @@ -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. * @@ -40,11 +40,10 @@ struct tsip_message_s; #define TSIP_DIALOG_INFO(self) ((tsip_dialog_info_t*)(self)) -typedef struct tsip_dialog_info -{ - TSIP_DECLARE_DIALOG; - /**< Last incoming message. */ - struct tsip_message_s* last_iMessage; +typedef struct tsip_dialog_info { + TSIP_DECLARE_DIALOG; + /**< Last incoming message. */ + struct tsip_message_s* last_iMessage; } tsip_dialog_info_t; diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog_invite.common.h b/tinySIP/include/tinysip/dialogs/tsip_dialog_invite.common.h index 1496ca7..15494ad 100755 --- a/tinySIP/include/tinysip/dialogs/tsip_dialog_invite.common.h +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog_invite.common.h @@ -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. * @@ -40,75 +40,73 @@ #define TSIP_DIALOG_INVITE_ICE_CONNCHECK_TIMEOUT 16000 /* ======================== actions ======================== */ -typedef enum _fsm_action_e -{ - _fsm_action_accept = tsip_atype_accept, - _fsm_action_reject = tsip_atype_hangup, - _fsm_action_dtmf_send = tsip_atype_dtmf_send, - _fsm_action_msrp_send_msg = tsip_atype_lmessage, - _fsm_action_oINVITE = tsip_atype_invite, - _fsm_action_oCANCEL = tsip_atype_cancel, - _fsm_action_oHold = tsip_atype_hold, - _fsm_action_oResume = tsip_atype_resume, - _fsm_action_oECT = tsip_atype_ect, - _fsm_action_iECT_ACCEPT = tsip_atype_ect_accept, - _fsm_action_iECT_REJECT = tsip_atype_ect_reject, - _fsm_action_iECT_lNOTIFY = tsip_atype_ect_lnotify, - _fsm_action_oINFO = tsip_atype_info_send, - _fsm_action_oBYE = tsip_atype_hangup, - _fsm_action_oShutdown = tsip_atype_shutdown, - _fsm_action_transporterror = tsip_atype_transport_error, - - _fsm_action_iINVITE = 0xFF, - _fsm_action_oUPDATE, - _fsm_action_iUPDATE, - _fsm_action_iCANCEL, - _fsm_action_iPRACK, - _fsm_action_oPRACK, - _fsm_action_iACK, - _fsm_action_oACK, - _fsm_action_iOPTIONS, - _fsm_action_oOPTIONS, - _fsm_action_iBYE, - _fsm_action_iREFER, - _fsm_action_iINFO, - _fsm_action_iNOTIFY, - - _fsm_action_timer100rel, - _fsm_action_timerRefresh, - _fsm_action_timerRSVP, - - _fsm_action_i1xx, - _fsm_action_i2xx, - _fsm_action_i300_to_i699, - _fsm_action_i401_i407, - _fsm_action_i422, - - _fsm_action_shutdown_timedout, /* Any -> Terminated */ - _fsm_action_error, +typedef enum _fsm_action_e { + _fsm_action_accept = tsip_atype_accept, + _fsm_action_reject = tsip_atype_hangup, + _fsm_action_dtmf_send = tsip_atype_dtmf_send, + _fsm_action_msrp_send_msg = tsip_atype_lmessage, + _fsm_action_oINVITE = tsip_atype_invite, + _fsm_action_oCANCEL = tsip_atype_cancel, + _fsm_action_oHold = tsip_atype_hold, + _fsm_action_oResume = tsip_atype_resume, + _fsm_action_oECT = tsip_atype_ect, + _fsm_action_iECT_ACCEPT = tsip_atype_ect_accept, + _fsm_action_iECT_REJECT = tsip_atype_ect_reject, + _fsm_action_iECT_lNOTIFY = tsip_atype_ect_lnotify, + _fsm_action_oINFO = tsip_atype_info_send, + _fsm_action_oBYE = tsip_atype_hangup, + _fsm_action_oShutdown = tsip_atype_shutdown, + _fsm_action_transporterror = tsip_atype_transport_error, + + _fsm_action_iINVITE = 0xFF, + _fsm_action_oUPDATE, + _fsm_action_iUPDATE, + _fsm_action_iCANCEL, + _fsm_action_iPRACK, + _fsm_action_oPRACK, + _fsm_action_iACK, + _fsm_action_oACK, + _fsm_action_iOPTIONS, + _fsm_action_oOPTIONS, + _fsm_action_iBYE, + _fsm_action_iREFER, + _fsm_action_iINFO, + _fsm_action_iNOTIFY, + + _fsm_action_timer100rel, + _fsm_action_timerRefresh, + _fsm_action_timerRSVP, + + _fsm_action_i1xx, + _fsm_action_i2xx, + _fsm_action_i300_to_i699, + _fsm_action_i401_i407, + _fsm_action_i422, + + _fsm_action_shutdown_timedout, /* Any -> Terminated */ + _fsm_action_error, } _fsm_action_t; /* ======================== states ======================== */ -typedef enum _fsm_state_e -{ - _fsm_state_Started, - _fsm_state_Outgoing, - _fsm_state_Incoming, - _fsm_state_Trying, - _fsm_state_Ringing, - _fsm_state_Cancelling, - _fsm_state_InProgress, - - _fsm_state_Holding, - _fsm_state_Resuming, - - _fsm_state_oECTing, - _fsm_state_iECTing, - _fsm_state_iECTreq, - - _fsm_state_Connected, - _fsm_state_Terminated +typedef enum _fsm_state_e { + _fsm_state_Started, + _fsm_state_Outgoing, + _fsm_state_Incoming, + _fsm_state_Trying, + _fsm_state_Ringing, + _fsm_state_Cancelling, + _fsm_state_InProgress, + + _fsm_state_Holding, + _fsm_state_Resuming, + + _fsm_state_oECTing, + _fsm_state_iECTing, + _fsm_state_iECTreq, + + _fsm_state_Connected, + _fsm_state_Terminated } _fsm_state_t; diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog_invite.h b/tinySIP/include/tinysip/dialogs/tsip_dialog_invite.h index b3bbfea..0a90e4d 100755 --- a/tinySIP/include/tinysip/dialogs/tsip_dialog_invite.h +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog_invite.h @@ -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. * @@ -40,80 +40,79 @@ TSIP_BEGIN_DECLS #define TSIP_DIALOG_INVITE(self) ((tsip_dialog_invite_t*)(self)) -typedef struct tsip_dialog_invite -{ - TSIP_DECLARE_DIALOG; - - tsk_bool_t support_update; /**< Indicates whether the remote party support UPDATE */ - tsk_bool_t is_client; - tsk_bool_t is_transf; - tsk_bool_t refersub; - tsk_bool_t use_rtcp; - tsk_bool_t use_rtcpmux; +typedef struct tsip_dialog_invite { + TSIP_DECLARE_DIALOG; + + tsk_bool_t support_update; /**< Indicates whether the remote party support UPDATE */ + tsk_bool_t is_client; + tsk_bool_t is_transf; + tsk_bool_t refersub; + tsk_bool_t use_rtcp; + tsk_bool_t use_rtcpmux; tsk_bool_t is_initial_iack_pending; // we're waiting for the initial incoming ACK (for the 200 OK) to ensure the session tsk_bool_t is_cancelling; // whether we're cancelling the outgoing INVITE - uint32_t rseq; - uint32_t cseq_out_media_update; // CSeq for the last media update request (INVITE or UPDATE). - uint64_t last_out_fastupdate_time; - - tsip_timer_t timershutdown; - tsip_timer_t timer100rel; - - tsip_response_t* last_o1xxrel; - tsip_request_t* last_iInvite; - tsip_request_t* last_oInvite; - tsip_request_t* last_iRefer; - tmedia_session_mgr_t* msession_mgr; /**< Media session Manager */ - - struct tsip_ssession_s* ss_transf; - - /* ICE */ - struct{ - tmedia_type_t media_type; - tsk_bool_t is_jingle; - tsk_bool_t start_smgr; - struct tnet_ice_ctx_s *ctx_audio; - struct tnet_ice_ctx_s *ctx_video; - tsk_fsm_action_id last_action_id; - tsip_action_t* last_action; - tsip_message_t* last_message; - int32_t last_sdp_ro_ver; - } ice; - - /* Session Timers */ - struct{ - tsip_timer_t timer; - char* refresher; - uint64_t minse; - tsk_bool_t is_refresher; - } stimers; - /* QoS (Preconditions) */ - struct{ - tsip_timer_t timer; - enum tmedia_qos_stype_e type; - enum tmedia_qos_strength_e strength; - } qos; - /* Hold/Resume */ - struct{ - unsigned remote:1; - unsigned local:1; - } hold; - - struct{ - unsigned _100rel:1; - unsigned precondition:1; - unsigned timer:1; - unsigned norefersub:1; - unsigned ice:1; - } supported; - - struct{ - unsigned _100rel:1; - unsigned precondition:1; - unsigned timer:1; - unsigned norefersub; - unsigned ice:1; - } required; + uint32_t rseq; + uint32_t cseq_out_media_update; // CSeq for the last media update request (INVITE or UPDATE). + uint64_t last_out_fastupdate_time; + + tsip_timer_t timershutdown; + tsip_timer_t timer100rel; + + tsip_response_t* last_o1xxrel; + tsip_request_t* last_iInvite; + tsip_request_t* last_oInvite; + tsip_request_t* last_iRefer; + tmedia_session_mgr_t* msession_mgr; /**< Media session Manager */ + + struct tsip_ssession_s* ss_transf; + + /* ICE */ + struct { + tmedia_type_t media_type; + tsk_bool_t is_jingle; + tsk_bool_t start_smgr; + struct tnet_ice_ctx_s *ctx_audio; + struct tnet_ice_ctx_s *ctx_video; + tsk_fsm_action_id last_action_id; + tsip_action_t* last_action; + tsip_message_t* last_message; + int32_t last_sdp_ro_ver; + } ice; + + /* Session Timers */ + struct { + tsip_timer_t timer; + char* refresher; + uint64_t minse; + tsk_bool_t is_refresher; + } stimers; + /* QoS (Preconditions) */ + struct { + tsip_timer_t timer; + enum tmedia_qos_stype_e type; + enum tmedia_qos_strength_e strength; + } qos; + /* Hold/Resume */ + struct { + unsigned remote:1; + unsigned local:1; + } hold; + + struct { + unsigned _100rel:1; + unsigned precondition:1; + unsigned timer:1; + unsigned norefersub:1; + unsigned ice:1; + } supported; + + struct { + unsigned _100rel:1; + unsigned precondition:1; + unsigned timer:1; + unsigned norefersub; + unsigned ice:1; + } required; } tsip_dialog_invite_t; diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog_layer.h b/tinySIP/include/tinysip/dialogs/tsip_dialog_layer.h index 3539361..0a73a3b 100755 --- a/tinySIP/include/tinysip/dialogs/tsip_dialog_layer.h +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog_layer.h @@ -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. * @@ -41,21 +41,20 @@ TSIP_BEGIN_DECLS -typedef struct tsip_dialog_layer_s -{ - TSK_DECLARE_OBJECT; +typedef struct tsip_dialog_layer_s { + TSK_DECLARE_OBJECT; - const tsip_stack_t *stack; + const tsip_stack_t *stack; - tsip_dialogs_L_t *dialogs; + tsip_dialogs_L_t *dialogs; - struct{ - tsk_bool_t inprogress; - tsk_bool_t phase2; /* whether unregistering? */ - tsk_condwait_handle_t* condwait; - } shutdown; + struct { + tsk_bool_t inprogress; + tsk_bool_t phase2; /* whether unregistering? */ + tsk_condwait_handle_t* condwait; + } shutdown; - TSK_DECLARE_SAFEOBJ; + TSK_DECLARE_SAFEOBJ; } tsip_dialog_layer_t; diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog_message.h b/tinySIP/include/tinysip/dialogs/tsip_dialog_message.h index 904af54..77bc5cb 100755 --- a/tinySIP/include/tinysip/dialogs/tsip_dialog_message.h +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog_message.h @@ -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. * @@ -40,11 +40,10 @@ struct tsip_message_s; #define TSIP_DIALOG_MESSAGE(self) ((tsip_dialog_message_t*)(self)) -typedef struct tsip_dialog_message -{ - TSIP_DECLARE_DIALOG; - /**< Last incoming or outgoing message. */ - struct tsip_message_s* request; +typedef struct tsip_dialog_message { + TSIP_DECLARE_DIALOG; + /**< Last incoming or outgoing message. */ + struct tsip_message_s* request; } tsip_dialog_message_t; diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog_options.h b/tinySIP/include/tinysip/dialogs/tsip_dialog_options.h index e092a32..db8837c 100755 --- a/tinySIP/include/tinysip/dialogs/tsip_dialog_options.h +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog_options.h @@ -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. * @@ -37,11 +37,10 @@ TSIP_BEGIN_DECLS #define TSIP_DIALOG_OPTIONS(self) ((tsip_dialog_options_t*)(self)) -typedef struct tsip_dialog_options -{ - TSIP_DECLARE_DIALOG; - /**< Last incoming message. */ - struct tsip_message_s* last_iMessage; +typedef struct tsip_dialog_options { + TSIP_DECLARE_DIALOG; + /**< Last incoming message. */ + struct tsip_message_s* last_iMessage; } tsip_dialog_options_t; diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog_publish.h b/tinySIP/include/tinysip/dialogs/tsip_dialog_publish.h index b4ef37b..6919508 100755 --- a/tinySIP/include/tinysip/dialogs/tsip_dialog_publish.h +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog_publish.h @@ -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. * @@ -37,15 +37,14 @@ TSIP_BEGIN_DECLS #define TSIP_DIALOG_PUBLISH(self) ((tsip_dialog_publish_t*)(self)) -typedef struct tsip_dialog_publish -{ - TSIP_DECLARE_DIALOG; - - tsip_timer_t timerrefresh; - tsip_timer_t timershutdown; +typedef struct tsip_dialog_publish { + TSIP_DECLARE_DIALOG; + + tsip_timer_t timerrefresh; + tsip_timer_t timershutdown; - tsk_bool_t unpublishing; - char* etag; + tsk_bool_t unpublishing; + char* etag; } tsip_dialog_publish_t; diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog_register.common.h b/tinySIP/include/tinysip/dialogs/tsip_dialog_register.common.h index 94e4897..e99df2b 100755 --- a/tinySIP/include/tinysip/dialogs/tsip_dialog_register.common.h +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog_register.common.h @@ -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 publishd 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. * @@ -31,37 +31,35 @@ /* ======================== actions ======================== */ -typedef enum _fsm_action_e -{ - _fsm_action_accept = tsip_atype_accept, - _fsm_action_reject = tsip_atype_hangup, - _fsm_action_hangup = tsip_atype_hangup, - _fsm_action_oREGISTER = tsip_atype_register, - _fsm_action_cancel = tsip_atype_cancel, - _fsm_action_shutdown = tsip_atype_shutdown, - _fsm_action_transporterror = tsip_atype_transport_error, +typedef enum _fsm_action_e { + _fsm_action_accept = tsip_atype_accept, + _fsm_action_reject = tsip_atype_hangup, + _fsm_action_hangup = tsip_atype_hangup, + _fsm_action_oREGISTER = tsip_atype_register, + _fsm_action_cancel = tsip_atype_cancel, + _fsm_action_shutdown = tsip_atype_shutdown, + _fsm_action_transporterror = tsip_atype_transport_error, - _fsm_action_1xx = 0xFF, - _fsm_action_2xx, - _fsm_action_401_407_421_494, - _fsm_action_423, - _fsm_action_300_to_699, + _fsm_action_1xx = 0xFF, + _fsm_action_2xx, + _fsm_action_401_407_421_494, + _fsm_action_423, + _fsm_action_300_to_699, - _fsm_action_iREGISTER, + _fsm_action_iREGISTER, - _fsm_action_shutdown_timedout, /* Any -> Terminated */ - _fsm_action_error, + _fsm_action_shutdown_timedout, /* Any -> Terminated */ + _fsm_action_error, } _fsm_action_t; /* ======================== states ======================== */ -typedef enum _fsm_state_e -{ - _fsm_state_Started, - _fsm_state_InProgress, // Outgoing (Client) - _fsm_state_Incoming, // Incoming (Server) - _fsm_state_Connected, - _fsm_state_Terminated +typedef enum _fsm_state_e { + _fsm_state_Started, + _fsm_state_InProgress, // Outgoing (Client) + _fsm_state_Incoming, // Incoming (Server) + _fsm_state_Connected, + _fsm_state_Terminated } _fsm_state_t; diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog_register.h b/tinySIP/include/tinysip/dialogs/tsip_dialog_register.h index d2acf1a..bfb72ed 100755 --- a/tinySIP/include/tinysip/dialogs/tsip_dialog_register.h +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog_register.h @@ -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. * @@ -38,17 +38,16 @@ TSIP_BEGIN_DECLS #define TSIP_DIALOG_REGISTER(self) ((tsip_dialog_register_t*)(self)) /**< SIP REGISTER dialog */ -typedef struct tsip_dialog_register -{ - TSIP_DECLARE_DIALOG; +typedef struct tsip_dialog_register { + TSIP_DECLARE_DIALOG; - tsip_timer_t timerrefresh; - tsip_timer_t timershutdown; + tsip_timer_t timerrefresh; + tsip_timer_t timershutdown; - tsip_request_t* last_iRegister; + tsip_request_t* last_iRegister; - tsk_bool_t unregistering; - tsk_bool_t is_server; + tsk_bool_t unregistering; + tsk_bool_t is_server; } tsip_dialog_register_t; diff --git a/tinySIP/include/tinysip/dialogs/tsip_dialog_subscribe.h b/tinySIP/include/tinysip/dialogs/tsip_dialog_subscribe.h index c7db35b..4e66b33 100755 --- a/tinySIP/include/tinysip/dialogs/tsip_dialog_subscribe.h +++ b/tinySIP/include/tinysip/dialogs/tsip_dialog_subscribe.h @@ -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. * @@ -37,14 +37,13 @@ TSIP_BEGIN_DECLS #define TSIP_DIALOG_SUBSCRIBE(self) ((tsip_dialog_subscribe_t*)(self)) -typedef struct tsip_dialog_subscribe -{ - TSIP_DECLARE_DIALOG; - - tsip_timer_t timerrefresh; - tsip_timer_t timershutdown; +typedef struct tsip_dialog_subscribe { + TSIP_DECLARE_DIALOG; + + tsip_timer_t timerrefresh; + tsip_timer_t timershutdown; - tsk_bool_t unsubscribing; + tsk_bool_t unsubscribing; } tsip_dialog_subscribe_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header.h b/tinySIP/include/tinysip/headers/tsip_header.h index b611140..9237cf7 100755 --- a/tinySIP/include/tinysip/headers/tsip_header.h +++ b/tinySIP/include/tinysip/headers/tsip_header.h @@ -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. * @@ -59,113 +59,111 @@ typedef char* (*tsip_header_get_special_param_value_f)(const struct tsip_header_ * * @brief List of all supported headers. **/ -typedef enum tsip_header_type_e -{ - tsip_htype_Accept, - tsip_htype_Accept_Contact, - tsip_htype_Accept_Encoding, - tsip_htype_Accept_Language, - tsip_htype_Accept_Resource_Priority, - tsip_htype_Alert_Info, - tsip_htype_Allow, - tsip_htype_Allow_Events, - tsip_htype_Authentication_Info, - tsip_htype_Authorization, - tsip_htype_Call_ID, - tsip_htype_Call_Info, - tsip_htype_Contact, - tsip_htype_Content_Disposition, - tsip_htype_Content_Encoding, - tsip_htype_Content_Language, - tsip_htype_Content_Length, - tsip_htype_Content_Type, - tsip_htype_CSeq, - tsip_htype_Date, - tsip_htype_Dummy, - tsip_htype_Error_Info, - tsip_htype_Event, - tsip_htype_Expires, - tsip_htype_From, - tsip_htype_History_Info, - tsip_htype_Identity, - tsip_htype_Identity_Info, - tsip_htype_In_Reply_To, - tsip_htype_Join, - tsip_htype_Max_Forwards, - tsip_htype_MIME_Version, - tsip_htype_Min_Expires, - tsip_htype_Min_SE, - tsip_htype_Organization, - tsip_htype_Path, - tsip_htype_Priority, - tsip_htype_Privacy, - tsip_htype_Proxy_Authenticate, - tsip_htype_Proxy_Authorization, - tsip_htype_Proxy_Require, - tsip_htype_RAck, - tsip_htype_Reason, - tsip_htype_Record_Route, - tsip_htype_Refer_Sub, - tsip_htype_Refer_To, - tsip_htype_Referred_By, - tsip_htype_Reject_Contact, - tsip_htype_Replaces, - tsip_htype_Reply_To, - tsip_htype_Request_Disposition, - tsip_htype_Require, - tsip_htype_Resource_Priority, - tsip_htype_Retry_After, - tsip_htype_Route, - tsip_htype_RSeq, - tsip_htype_Security_Client, - tsip_htype_Security_Server, - tsip_htype_Security_Verify, - tsip_htype_Server, - tsip_htype_Service_Route, - tsip_htype_Session_Expires, - tsip_htype_SIP_ETag, - tsip_htype_SIP_If_Match, - tsip_htype_Subject, - tsip_htype_Subscription_State, - tsip_htype_Supported, - tsip_htype_Target_Dialog, - tsip_htype_Timestamp, - tsip_htype_To, - tsip_htype_Unsupported, - tsip_htype_User_Agent, - tsip_htype_Via, - tsip_htype_Warning, - tsip_htype_WWW_Authenticate, - tsip_htype_P_Access_Network_Info, - tsip_htype_P_Answer_State, - tsip_htype_P_Asserted_Identity, - tsip_htype_P_Associated_URI, - tsip_htype_P_Called_Party_ID, - tsip_htype_P_Charging_Function_Addresses, - tsip_htype_P_Charging_Vector, - tsip_htype_P_DCS_Billing_Info, - tsip_htype_P_DCS_LAES, - tsip_htype_P_DCS_OSPS, - tsip_htype_P_DCS_Redirect, - tsip_htype_P_DCS_Trace_Party_ID, - tsip_htype_P_Early_Media, - tsip_htype_P_Media_Authorization, - tsip_htype_P_Preferred_Identity, - tsip_htype_P_Profile_Key, - tsip_htype_P_User_Database, - tsip_htype_P_Visited_Network_ID +typedef enum tsip_header_type_e { + tsip_htype_Accept, + tsip_htype_Accept_Contact, + tsip_htype_Accept_Encoding, + tsip_htype_Accept_Language, + tsip_htype_Accept_Resource_Priority, + tsip_htype_Alert_Info, + tsip_htype_Allow, + tsip_htype_Allow_Events, + tsip_htype_Authentication_Info, + tsip_htype_Authorization, + tsip_htype_Call_ID, + tsip_htype_Call_Info, + tsip_htype_Contact, + tsip_htype_Content_Disposition, + tsip_htype_Content_Encoding, + tsip_htype_Content_Language, + tsip_htype_Content_Length, + tsip_htype_Content_Type, + tsip_htype_CSeq, + tsip_htype_Date, + tsip_htype_Dummy, + tsip_htype_Error_Info, + tsip_htype_Event, + tsip_htype_Expires, + tsip_htype_From, + tsip_htype_History_Info, + tsip_htype_Identity, + tsip_htype_Identity_Info, + tsip_htype_In_Reply_To, + tsip_htype_Join, + tsip_htype_Max_Forwards, + tsip_htype_MIME_Version, + tsip_htype_Min_Expires, + tsip_htype_Min_SE, + tsip_htype_Organization, + tsip_htype_Path, + tsip_htype_Priority, + tsip_htype_Privacy, + tsip_htype_Proxy_Authenticate, + tsip_htype_Proxy_Authorization, + tsip_htype_Proxy_Require, + tsip_htype_RAck, + tsip_htype_Reason, + tsip_htype_Record_Route, + tsip_htype_Refer_Sub, + tsip_htype_Refer_To, + tsip_htype_Referred_By, + tsip_htype_Reject_Contact, + tsip_htype_Replaces, + tsip_htype_Reply_To, + tsip_htype_Request_Disposition, + tsip_htype_Require, + tsip_htype_Resource_Priority, + tsip_htype_Retry_After, + tsip_htype_Route, + tsip_htype_RSeq, + tsip_htype_Security_Client, + tsip_htype_Security_Server, + tsip_htype_Security_Verify, + tsip_htype_Server, + tsip_htype_Service_Route, + tsip_htype_Session_Expires, + tsip_htype_SIP_ETag, + tsip_htype_SIP_If_Match, + tsip_htype_Subject, + tsip_htype_Subscription_State, + tsip_htype_Supported, + tsip_htype_Target_Dialog, + tsip_htype_Timestamp, + tsip_htype_To, + tsip_htype_Unsupported, + tsip_htype_User_Agent, + tsip_htype_Via, + tsip_htype_Warning, + tsip_htype_WWW_Authenticate, + tsip_htype_P_Access_Network_Info, + tsip_htype_P_Answer_State, + tsip_htype_P_Asserted_Identity, + tsip_htype_P_Associated_URI, + tsip_htype_P_Called_Party_ID, + tsip_htype_P_Charging_Function_Addresses, + tsip_htype_P_Charging_Vector, + tsip_htype_P_DCS_Billing_Info, + tsip_htype_P_DCS_LAES, + tsip_htype_P_DCS_OSPS, + tsip_htype_P_DCS_Redirect, + tsip_htype_P_DCS_Trace_Party_ID, + tsip_htype_P_Early_Media, + tsip_htype_P_Media_Authorization, + tsip_htype_P_Preferred_Identity, + tsip_htype_P_Profile_Key, + tsip_htype_P_User_Database, + tsip_htype_P_Visited_Network_ID } tsip_header_type_t; /*================================ */ -typedef struct tsip_header_s -{ - TSK_DECLARE_OBJECT; - tsip_header_type_t type; - tsip_header_value_serialize_f serialize; - tsip_header_get_special_param_value_f get_special_param_value; - tsk_params_L_t *params; +typedef struct tsip_header_s { + TSK_DECLARE_OBJECT; + tsip_header_type_t type; + tsip_header_value_serialize_f serialize; + tsip_header_get_special_param_value_f get_special_param_value; + tsk_params_L_t *params; } tsip_header_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Accept_Contact.h b/tinySIP/include/tinysip/headers/tsip_header_Accept_Contact.h index 19aaa1b..f053afe 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Accept_Contact.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Accept_Contact.h @@ -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. * @@ -42,11 +42,10 @@ TSIP_BEGIN_DECLS /// @date 12/3/2009 /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Accept_Contact_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Accept_Contact_s { + TSIP_DECLARE_HEADER; } tsip_header_Accept_Contact_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Accept_Encoding.h b/tinySIP/include/tinysip/headers/tsip_header_Accept_Encoding.h index efff6cd..937718a 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Accept_Encoding.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Accept_Encoding.h @@ -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. * @@ -42,11 +42,10 @@ TSIP_BEGIN_DECLS /// @date 12/3/2009 /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Accept_Encoding_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Accept_Encoding_s { + TSIP_DECLARE_HEADER; } tsip_header_Accept_Encoding_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Accept_Language.h b/tinySIP/include/tinysip/headers/tsip_header_Accept_Language.h index fcb631b..db8843f 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Accept_Language.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Accept_Language.h @@ -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. * @@ -42,11 +42,10 @@ TSIP_BEGIN_DECLS /// @date 12/3/2009 /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Accept_Language_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Accept_Language_s { + TSIP_DECLARE_HEADER; } tsip_header_Accept_Language_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Accept_Resource_Priority.h b/tinySIP/include/tinysip/headers/tsip_header_Accept_Resource_Priority.h index 09143a5..d1464b8 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Accept_Resource_Priority.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Accept_Resource_Priority.h @@ -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. * @@ -42,11 +42,10 @@ TSIP_BEGIN_DECLS /// @date 12/3/2009 /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Accept_Resource_Priority_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Accept_Resource_Priority_s { + TSIP_DECLARE_HEADER; } tsip_header_Accept_Resource_Priority_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Alert_Info.h b/tinySIP/include/tinysip/headers/tsip_header_Alert_Info.h index 77a26be..dca2613 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Alert_Info.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Alert_Info.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Alert-Info' as per RFC 3261 subclause . /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Alert_Info_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Alert_Info_s { + TSIP_DECLARE_HEADER; } tsip_header_Alert_Info_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Allow.h b/tinySIP/include/tinysip/headers/tsip_header_Allow.h index a43b9ba..f6a0832 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Allow.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Allow.h @@ -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,13 +43,12 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Allow'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Allow_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Allow_s { + TSIP_DECLARE_HEADER; - tsk_strings_L_t *methods; + tsk_strings_L_t *methods; } tsip_header_Allow_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Allow_Events.h b/tinySIP/include/tinysip/headers/tsip_header_Allow_Events.h index d97b6b3..6f7c942 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Allow_Events.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Allow_Events.h @@ -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. * @@ -41,13 +41,12 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Allow-Events'. /// /// @par ABNF : Allow-Events = ( "Allow-Events" / "u" ) HCOLON event-type *(COMMA event-type) -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Allow_Events_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Allow_Events_s { + TSIP_DECLARE_HEADER; - tsk_strings_L_t *events; + tsk_strings_L_t *events; } tsip_header_Allow_Events_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Authentication_Info.h b/tinySIP/include/tinysip/headers/tsip_header_Authentication_Info.h index 0736dbc..02a7e08 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Authentication_Info.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Authentication_Info.h @@ -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. * @@ -41,11 +41,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Authentication-Info'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Authentication_Info_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Authentication_Info_s { + TSIP_DECLARE_HEADER; } tsip_header_Authentication_Info_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Authorization.h b/tinySIP/include/tinysip/headers/tsip_header_Authorization.h index 910fdc5..ad71883 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Authorization.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Authorization.h @@ -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. * @@ -55,32 +55,31 @@ TSIP_BEGIN_DECLS /// dresponse = "response" EQUAL request-digest /// request-digest = LDQUOT 32LHEX RDQUOT /// auth-request-uri = not-defined -/// +/// /// auth-param = auth-param-name EQUAL ( token / quoted-string ) /// auth-param-name = token -/// +/// /// other-response = auth-scheme LWS auth-param *(COMMA auth-param) /// auth-scheme = token /// auts = "auts" EQUAL auts-param /// auts-param = LDQUOT auts-value RDQUOT /// auts-value = [base64 encoding of AUTS] -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Authorization_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Authorization_s { + TSIP_DECLARE_HEADER; - char* scheme; - char* username; - char* realm; - char* nonce; - char* uri; - char* response; - char* algorithm; - char* cnonce; - char* opaque; - char* qop; - char* nc; + char* scheme; + char* username; + char* realm; + char* nonce; + char* uri; + char* response; + char* algorithm; + char* cnonce; + char* opaque; + char* qop; + char* nc; } tsip_header_Authorization_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_CSeq.h b/tinySIP/include/tinysip/headers/tsip_header_CSeq.h index 98cd864..a225823 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_CSeq.h +++ b/tinySIP/include/tinysip/headers/tsip_header_CSeq.h @@ -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,15 +47,14 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'CSeq'. /// /// @par ABNF: CSeq = "CSeq" HCOLON 1*DIGIT LWS Method -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_CSeq_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_CSeq_s { + TSIP_DECLARE_HEADER; - char *method; - uint32_t seq; - tsip_request_type_t type; + char *method; + uint32_t seq; + tsip_request_type_t type; } tsip_header_CSeq_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Call_ID.h b/tinySIP/include/tinysip/headers/tsip_header_Call_ID.h index 41a7f73..a0830b3 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Call_ID.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Call_ID.h @@ -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,14 +44,13 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Call-ID'. /// /// @par ABNF: Call-ID / i -/// callid = word [ "@" word ] +/// callid = word [ "@" word ] /// Call-ID = ( "Call-ID" / "i" ) HCOLON callid -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Call_ID_s -{ - TSIP_DECLARE_HEADER; - char *value; +typedef struct tsip_header_Call_ID_s { + TSIP_DECLARE_HEADER; + char *value; } tsip_header_Call_ID_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Call_Info.h b/tinySIP/include/tinysip/headers/tsip_header_Call_Info.h index 72f0d1a..d15a00d 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Call_Info.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Call_Info.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Call-Info'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Call_Info_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Call_Info_s { + TSIP_DECLARE_HEADER; } tsip_header_Call_Info_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Contact.h b/tinySIP/include/tinysip/headers/tsip_header_Contact.h index 7fb200e..1d1900b 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Contact.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Contact.h @@ -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. * @@ -65,15 +65,14 @@ TSIP_BEGIN_DECLS /// c-p-instance = "+sip.instance" EQUAL LDQUOT "<" instance-val ">" RDQUOT /// instance-val = *uric /// contact-extension = generic-param -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Contact_s -{ - TSIP_DECLARE_HEADER; - - char *display_name; - tsip_uri_t *uri; - int64_t expires; +typedef struct tsip_header_Contact_s { + TSIP_DECLARE_HEADER; + + char *display_name; + tsip_uri_t *uri; + int64_t expires; } tsip_header_Contact_t; typedef tsk_list_t tsip_header_Contacts_L_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Content_Disposition.h b/tinySIP/include/tinysip/headers/tsip_header_Content_Disposition.h index 3ec3cef..6395c4b 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Content_Disposition.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Content_Disposition.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Content-Disposition'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Content_Disposition_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Content_Disposition_s { + TSIP_DECLARE_HEADER; } tsip_header_Content_Disposition_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Content_Encoding.h b/tinySIP/include/tinysip/headers/tsip_header_Content_Encoding.h index 995abbb..d76828d 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Content_Encoding.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Content_Encoding.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Content-Encoding'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Content_Encoding_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Content_Encoding_s { + TSIP_DECLARE_HEADER; } tsip_header_Content_Encoding_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Content_Language.h b/tinySIP/include/tinysip/headers/tsip_header_Content_Language.h index 86899b1..85c3c66 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Content_Language.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Content_Language.h @@ -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. * @@ -38,11 +38,10 @@ /// @brief SIP header 'Content-Language'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Content_Language_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Content_Language_s { + TSIP_DECLARE_HEADER; } tsip_header_Content_Language_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Content_Length.h b/tinySIP/include/tinysip/headers/tsip_header_Content_Length.h index 7f2ec61..9c4dca5 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Content_Length.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Content_Length.h @@ -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,13 +43,12 @@ TSIP_BEGIN_DECLS /// /// @par ABNF: Content-Length / l /// Content-Length = ( "Content-Length" / "l" ) HCOLON 1*DIGIT -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Content_Length_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Content_Length_s { + TSIP_DECLARE_HEADER; - uint32_t length; + uint32_t length; } tsip_header_Content_Length_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Content_Type.h b/tinySIP/include/tinysip/headers/tsip_header_Content_Type.h index 48c32b6..2557e08 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Content_Type.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Content_Type.h @@ -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. * @@ -55,13 +55,12 @@ TSIP_BEGIN_DECLS /// m-parameter = m-attribute EQUAL m-value /// m-attribute = token /// m-value = token / quoted-string -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Content_Type_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Content_Type_s { + TSIP_DECLARE_HEADER; - char* type; + char* type; } tsip_header_Content_Type_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Date.h b/tinySIP/include/tinysip/headers/tsip_header_Date.h index f16ee7a..a4a3063 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Date.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Date.h @@ -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. * @@ -48,21 +48,20 @@ TSIP_BEGIN_DECLS /// time = 2DIGIT ":" 2DIGIT ":" 2DIGIT /// wkday = "Mon" / "Tue" / "Wed" / "Thu" / "Fri" / "Sat" / "Sun" /// month = "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" / "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec" -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Date_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Date_s { + TSIP_DECLARE_HEADER; - char *wkday; - char *month; - int8_t day; - int16_t year; - struct{ - int8_t h; - int8_t m; - int8_t s; - } time; + char *wkday; + char *month; + int8_t day; + int16_t year; + struct { + int8_t h; + int8_t m; + int8_t s; + } time; } tsip_header_Date_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Dummy.h b/tinySIP/include/tinysip/headers/tsip_header_Dummy.h index f1c5bb1..d54ba13 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Dummy.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Dummy.h @@ -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. * @@ -42,14 +42,13 @@ TSIP_BEGIN_DECLS /// @brief SIP Dummy header. /// /// @par ABNF : token SP* HCOLON SP*<: any* -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Dummy_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Dummy_s { + TSIP_DECLARE_HEADER; - char *name; - char *value; + char *name; + char *value; } tsip_header_Dummy_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Error_Info.h b/tinySIP/include/tinysip/headers/tsip_header_Error_Info.h index 53dc98f..55cd9ff 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Error_Info.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Error_Info.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Error-Info'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Error_Info_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Error_Info_s { + TSIP_DECLARE_HEADER; } tsip_header_Error_Info_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Event.h b/tinySIP/include/tinysip/headers/tsip_header_Event.h index 35eb8ea..97e6158 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Event.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Event.h @@ -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. * @@ -50,13 +50,12 @@ TSIP_BEGIN_DECLS /// event-param = generic-param / ( "id" EQUAL token ) / call-ident / from-tag / to-tag / with-sessd /// call-ident = "call-id" EQUAL ( token / DQUOTE callid DQUOTE ) /// with-sessd = "include-session-description" -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Event_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Event_s { + TSIP_DECLARE_HEADER; - char *package; + char *package; } tsip_header_Event_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Expires.h b/tinySIP/include/tinysip/headers/tsip_header_Expires.h index 2242b9f..ee9491d 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Expires.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Expires.h @@ -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,13 +45,12 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Expires'. /// /// @par ABNF: Expires = "Expires" HCOLON delta-seconds -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Expires_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Expires_s { + TSIP_DECLARE_HEADER; - int64_t delta_seconds; + int64_t delta_seconds; } tsip_header_Expires_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_From.h b/tinySIP/include/tinysip/headers/tsip_header_From.h index a799efd..8144fcb 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_From.h +++ b/tinySIP/include/tinysip/headers/tsip_header_From.h @@ -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. * @@ -46,15 +46,14 @@ TSIP_BEGIN_DECLS /// from-spec = ( name-addr / addr-spec ) *( SEMI from-param ) /// from-param = tag-param / generic-param /// tag-param = "tag" EQUAL token -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_From_s -{ - TSIP_DECLARE_HEADER; - - char *display_name; - tsip_uri_t *uri; - char *tag; +typedef struct tsip_header_From_s { + TSIP_DECLARE_HEADER; + + char *display_name; + tsip_uri_t *uri; + char *tag; } tsip_header_From_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_History_Info.h b/tinySIP/include/tinysip/headers/tsip_header_History_Info.h index 6638f14..c900310 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_History_Info.h +++ b/tinySIP/include/tinysip/headers/tsip_header_History_Info.h @@ -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. * @@ -42,11 +42,10 @@ TSIP_BEGIN_DECLS /// @date 12/3/2009 /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_History_Info_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_History_Info_s { + TSIP_DECLARE_HEADER; } tsip_header_History_Info_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Identity.h b/tinySIP/include/tinysip/headers/tsip_header_Identity.h index 8382d39..6ecdf45 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Identity.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Identity.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Identity' . /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Identity_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Identity_s { + TSIP_DECLARE_HEADER; } tsip_header_Identity_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Identity_Info.h b/tinySIP/include/tinysip/headers/tsip_header_Identity_Info.h index 1aa790b..fb57ad4 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Identity_Info.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Identity_Info.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Identity-Info'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Identity_Info_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Identity_Info_s { + TSIP_DECLARE_HEADER; } tsip_header_Identity_Info_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_In_Reply_To.h b/tinySIP/include/tinysip/headers/tsip_header_In_Reply_To.h index 90477c6..b405d30 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_In_Reply_To.h +++ b/tinySIP/include/tinysip/headers/tsip_header_In_Reply_To.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'In-Reply-To'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_In_Reply_To_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_In_Reply_To_s { + TSIP_DECLARE_HEADER; } tsip_header_In_Reply_To_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Join.h b/tinySIP/include/tinysip/headers/tsip_header_Join.h index ef4c042..25361f1 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Join.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Join.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Join'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Join_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Join_s { + TSIP_DECLARE_HEADER; } tsip_header_Join_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_MIME_Version.h b/tinySIP/include/tinysip/headers/tsip_header_MIME_Version.h index 439f98c..a756165 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_MIME_Version.h +++ b/tinySIP/include/tinysip/headers/tsip_header_MIME_Version.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'MIME-Version'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_MIME_Version_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_MIME_Version_s { + TSIP_DECLARE_HEADER; } tsip_header_MIME_Version_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Max_Forwards.h b/tinySIP/include/tinysip/headers/tsip_header_Max_Forwards.h index 17d9856..606e4b4 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Max_Forwards.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Max_Forwards.h @@ -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. * @@ -46,13 +46,12 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Max-Forwards'. /// /// @par ABNF: Max-Forwards = "Max-Forwards" HCOLON 1*DIGIT -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Max_Forwards_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Max_Forwards_s { + TSIP_DECLARE_HEADER; - int32_t value; + int32_t value; } tsip_header_Max_Forwards_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Min_Expires.h b/tinySIP/include/tinysip/headers/tsip_header_Min_Expires.h index 042a190..4f60359 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Min_Expires.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Min_Expires.h @@ -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,13 +45,12 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Min-Expires' as per RFC 3261. /// /// @par ABNF: Min-Expires = "Min-Expires" HCOLON delta-seconds -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Min_Expires_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Min_Expires_s { + TSIP_DECLARE_HEADER; - int32_t value; + int32_t value; } tsip_header_Min_Expires_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Min_SE.h b/tinySIP/include/tinysip/headers/tsip_header_Min_SE.h index de05338..ee5a48e 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Min_SE.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Min_SE.h @@ -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,14 +44,13 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Min-SE'. /// /// @par ABNF : Min-SE = "Min-SE" HCOLON delta-seconds *(SEMI generic-param) -/// -/// +/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Min_SE_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Min_SE_s { + TSIP_DECLARE_HEADER; - int64_t delta_seconds; + int64_t delta_seconds; } tsip_header_Min_SE_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Organization.h b/tinySIP/include/tinysip/headers/tsip_header_Organization.h index 8351afb..96f58b8 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Organization.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Organization.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Organization'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Organization_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Organization_s { + TSIP_DECLARE_HEADER; } tsip_header_Organization_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Access_Network_Info.h b/tinySIP/include/tinysip/headers/tsip_header_P_Access_Network_Info.h index 9508424..09fa888 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_P_Access_Network_Info.h +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Access_Network_Info.h @@ -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. * @@ -48,13 +48,12 @@ TSIP_BEGIN_DECLS /// extension-access-info = gen-value /// cgi-3gpp = "cgi-3gpp" EQUAL (token / quoted-string) /// utran-cell-id-3gpp = "utran-cell-id-3gpp" EQUAL (token / quoted-string) -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_P_Access_Network_Info_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_P_Access_Network_Info_s { + TSIP_DECLARE_HEADER; - char *value; + char *value; } tsip_header_P_Access_Network_Info_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Answer_State.h b/tinySIP/include/tinysip/headers/tsip_header_P_Answer_State.h index e378ef7..78fdbc0 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_P_Answer_State.h +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Answer_State.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'P-Answer-State'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_P_Answer_State_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_P_Answer_State_s { + TSIP_DECLARE_HEADER; } tsip_header_P_Answer_State_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Asserted_Identity.h b/tinySIP/include/tinysip/headers/tsip_header_P_Asserted_Identity.h index 3e2118a..33f2daf 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_P_Asserted_Identity.h +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Asserted_Identity.h @@ -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,14 +45,13 @@ TSIP_BEGIN_DECLS /// @par ABNF: P-Asserted-Identity = PAssertedID /// PAssertedID = "P-Asserted-Identity" HCOLON PAssertedID-value *(COMMA PAssertedID-value) /// PAssertedID-value = name-addr / addr-spec -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_P_Asserted_Identity_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_P_Asserted_Identity_s { + TSIP_DECLARE_HEADER; - char *display_name; - tsip_uri_t *uri; + char *display_name; + tsip_uri_t *uri; } tsip_header_P_Asserted_Identity_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Associated_URI.h b/tinySIP/include/tinysip/headers/tsip_header_P_Associated_URI.h index 8c28f41..0e63ef8 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_P_Associated_URI.h +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Associated_URI.h @@ -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. * @@ -46,14 +46,13 @@ TSIP_BEGIN_DECLS /// @par ABNF: P-Associated-URI = "P-Associated-URI" HCOLON p-aso-uri-spec *(COMMA p-aso-uri-spec) /// p-aso-uri-spec = name-addr *( SEMI ai-param ) /// ai-param = generic-param -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_P_Associated_URI_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_P_Associated_URI_s { + TSIP_DECLARE_HEADER; - char *display_name; - tsip_uri_t *uri; + char *display_name; + tsip_uri_t *uri; } tsip_header_P_Associated_URI_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Called_Party_ID.h b/tinySIP/include/tinysip/headers/tsip_header_P_Called_Party_ID.h index 324b61a..a4485f3 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_P_Called_Party_ID.h +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Called_Party_ID.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'P-Called-Party-ID'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_P_Called_Party_ID_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_P_Called_Party_ID_s { + TSIP_DECLARE_HEADER; } tsip_header_P_Called_Party_ID_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Charging_Function_Addresses.h b/tinySIP/include/tinysip/headers/tsip_header_P_Charging_Function_Addresses.h index 82e5e71..e5319c8 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_P_Charging_Function_Addresses.h +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Charging_Function_Addresses.h @@ -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,13 +44,12 @@ TSIP_BEGIN_DECLS /// charge-addr-params = ccf / ecf / generic-param /// ccf = "ccf" EQUAL gen-value /// ecf = "ecf" EQUAL gen-value -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_P_Charging_Function_Addresses_s -{ - TSIP_DECLARE_HEADER; - char* ccf; - char* ecf; +typedef struct tsip_header_P_Charging_Function_Addresses_s { + TSIP_DECLARE_HEADER; + char* ccf; + char* ecf; } tsip_header_P_Charging_Function_Addresses_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Charging_Vector.h b/tinySIP/include/tinysip/headers/tsip_header_P_Charging_Vector.h index 45ba24d..cdb69f4 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_P_Charging_Vector.h +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Charging_Vector.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'P-Charging-Vector'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_P_Charging_Vector_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_P_Charging_Vector_s { + TSIP_DECLARE_HEADER; } tsip_header_P_Charging_Vector_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_DCS_Billing_Info.h b/tinySIP/include/tinysip/headers/tsip_header_P_DCS_Billing_Info.h index ca518b9..b195833 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_P_DCS_Billing_Info.h +++ b/tinySIP/include/tinysip/headers/tsip_header_P_DCS_Billing_Info.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'P-DCS-Billing-Info'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_P_DCS_Billing_Info_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_P_DCS_Billing_Info_s { + TSIP_DECLARE_HEADER; } tsip_header_P_DCS_Billing_Info_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_DCS_LAES.h b/tinySIP/include/tinysip/headers/tsip_header_P_DCS_LAES.h index ed2ce31..37bfd21 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_P_DCS_LAES.h +++ b/tinySIP/include/tinysip/headers/tsip_header_P_DCS_LAES.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'P-DCS-_LAES'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_P_DCS_LAES_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_P_DCS_LAES_s { + TSIP_DECLARE_HEADER; } tsip_header_P_DCS_LAES_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_DCS_OSPS.h b/tinySIP/include/tinysip/headers/tsip_header_P_DCS_OSPS.h index 1d98390..11f7e42 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_P_DCS_OSPS.h +++ b/tinySIP/include/tinysip/headers/tsip_header_P_DCS_OSPS.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'P-DCS-OSPS'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_P_DCS_OSPS_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_P_DCS_OSPS_s { + TSIP_DECLARE_HEADER; } tsip_header_P_DCS_OSPS_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_DCS_Redirect.h b/tinySIP/include/tinysip/headers/tsip_header_P_DCS_Redirect.h index 103e396..4873bfb 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_P_DCS_Redirect.h +++ b/tinySIP/include/tinysip/headers/tsip_header_P_DCS_Redirect.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'P-DCS-Redirect'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_P_DCS_Redirect_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_P_DCS_Redirect_s { + TSIP_DECLARE_HEADER; } tsip_header_P_DCS_Redirect_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_DCS_Trace_Party_ID.h b/tinySIP/include/tinysip/headers/tsip_header_P_DCS_Trace_Party_ID.h index 3a11086..226b527 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_P_DCS_Trace_Party_ID.h +++ b/tinySIP/include/tinysip/headers/tsip_header_P_DCS_Trace_Party_ID.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'P-DCS-Trace-Party-ID'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_P_DCS_Trace_Party_ID_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_P_DCS_Trace_Party_ID_s { + TSIP_DECLARE_HEADER; } tsip_header_P_DCS_Trace_Party_ID_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Early_Media.h b/tinySIP/include/tinysip/headers/tsip_header_P_Early_Media.h index 54890f0..71e05d9 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_P_Early_Media.h +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Early_Media.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'P-Early-Media'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_P_Early_Media_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_P_Early_Media_s { + TSIP_DECLARE_HEADER; } tsip_header_P_Early_Media_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Media_Authorization.h b/tinySIP/include/tinysip/headers/tsip_header_P_Media_Authorization.h index c161c34..5024a3a 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_P_Media_Authorization.h +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Media_Authorization.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'P-Media-Authorization'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_P_Media_Authorization_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_P_Media_Authorization_s { + TSIP_DECLARE_HEADER; } tsip_header_P_Media_Authorization_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Preferred_Identity.h b/tinySIP/include/tinysip/headers/tsip_header_P_Preferred_Identity.h index 9272932..e89d60e 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_P_Preferred_Identity.h +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Preferred_Identity.h @@ -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,14 +45,13 @@ TSIP_BEGIN_DECLS /// /// @par ABNF: PPreferredID = "P-Preferred-Identity" HCOLON PPreferredID-value *(COMMA PPreferredID-value) /// PPreferredID-value = name-addr / addr-spec -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_P_Preferred_Identity_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_P_Preferred_Identity_s { + TSIP_DECLARE_HEADER; - tsip_uri_t *uri; - char *display_name; + tsip_uri_t *uri; + char *display_name; } tsip_header_P_Preferred_Identity_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Profile_Key.h b/tinySIP/include/tinysip/headers/tsip_header_P_Profile_Key.h index 0f33a2a..e024afe 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_P_Profile_Key.h +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Profile_Key.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'P-Profile-Key'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_P_Profile_Key_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_P_Profile_Key_s { + TSIP_DECLARE_HEADER; } tsip_header_P_Profile_Key_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_User_Database.h b/tinySIP/include/tinysip/headers/tsip_header_P_User_Database.h index 75915b5..c6154ad 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_P_User_Database.h +++ b/tinySIP/include/tinysip/headers/tsip_header_P_User_Database.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'P-User-Database'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_P_User_Database_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_P_User_Database_s { + TSIP_DECLARE_HEADER; } tsip_header_P_User_Database_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_P_Visited_Network_ID.h b/tinySIP/include/tinysip/headers/tsip_header_P_Visited_Network_ID.h index 121783f..6144da0 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_P_Visited_Network_ID.h +++ b/tinySIP/include/tinysip/headers/tsip_header_P_Visited_Network_ID.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'P-Visited-Network-ID'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_P_Visited_Network_ID_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_P_Visited_Network_ID_s { + TSIP_DECLARE_HEADER; } tsip_header_P_Visited_Network_ID_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Path.h b/tinySIP/include/tinysip/headers/tsip_header_Path.h index d0fa6ed..f943b2a 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Path.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Path.h @@ -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. * @@ -46,14 +46,13 @@ TSIP_BEGIN_DECLS /// /// @par ABNF : Path = "Path" HCOLON path-value *(COMMA path-value) /// path-value = name-addr *( SEMI rr-param ) -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Path_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Path_s { + TSIP_DECLARE_HEADER; - char *display_name; - tsip_uri_t *uri; + char *display_name; + tsip_uri_t *uri; } tsip_header_Path_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Priority.h b/tinySIP/include/tinysip/headers/tsip_header_Priority.h index eb1cbbf..bbcf2d9 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Priority.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Priority.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Priority'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Priority_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Priority_s { + TSIP_DECLARE_HEADER; } tsip_header_Priority_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Privacy.h b/tinySIP/include/tinysip/headers/tsip_header_Privacy.h index 421e18f..a054cbd 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Privacy.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Privacy.h @@ -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,13 +43,12 @@ TSIP_BEGIN_DECLS /// @par ABNF: Privacy = Privacy-hdr /// Privacy-hdr = "Privacy" HCOLON priv-value *(";" priv-value) /// priv-value = "header" / "session" / "user" / "none" / "critical" / "id" / "history" / token -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Privacy_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Privacy_s { + TSIP_DECLARE_HEADER; - tsk_strings_L_t *values; + tsk_strings_L_t *values; } tsip_header_Privacy_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Proxy_Authenticate.h b/tinySIP/include/tinysip/headers/tsip_header_Proxy_Authenticate.h index 01c4681..be82015 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Proxy_Authenticate.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Proxy_Authenticate.h @@ -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. * @@ -51,20 +51,19 @@ TSIP_BEGIN_DECLS /// stale = "stale" EQUAL ( "true" / "false" ) /// qop-options = "qop" EQUAL LDQUOT qop-value *("," qop-value) RDQUOT /// qop-value = "auth" / "auth-int" / token -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Proxy_Authenticate_s -{ - TSIP_DECLARE_HEADER; - - char* scheme; - char* realm; - char* domain; - char* nonce; - char* opaque; - tsk_bool_t stale; - char* algorithm; - char* qop; +typedef struct tsip_header_Proxy_Authenticate_s { + TSIP_DECLARE_HEADER; + + char* scheme; + char* realm; + char* domain; + char* nonce; + char* opaque; + tsk_bool_t stale; + char* algorithm; + char* qop; } tsip_header_Proxy_Authenticate_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Proxy_Authorization.h b/tinySIP/include/tinysip/headers/tsip_header_Proxy_Authorization.h index 6eb7136..5ed9366 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Proxy_Authorization.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Proxy_Authorization.h @@ -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. * @@ -55,32 +55,31 @@ TSIP_BEGIN_DECLS /// dresponse = "response" EQUAL request-digest /// request-digest = LDQUOT 32LHEX RDQUOT /// auth-request-uri = not-defined -/// +/// /// auth-param = auth-param-name EQUAL ( token / quoted-string ) /// auth-param-name = token -/// +/// /// other-response = auth-scheme LWS auth-param *(COMMA auth-param) /// auth-scheme = token /// auts = "auts" EQUAL auts-param /// auts-param = LDQUOT auts-value RDQUOT /// auts-value = [base64 encoding of AUTS] -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Proxy_Authorization_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Proxy_Authorization_s { + TSIP_DECLARE_HEADER; - char* scheme; - char* username; - char* realm; - char* nonce; - char* uri; - char* response; - char* algorithm; - char* cnonce; - char* opaque; - char* qop; - char* nc; + char* scheme; + char* username; + char* realm; + char* nonce; + char* uri; + char* response; + char* algorithm; + char* cnonce; + char* opaque; + char* qop; + char* nc; } tsip_header_Proxy_Authorization_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Proxy_Require.h b/tinySIP/include/tinysip/headers/tsip_header_Proxy_Require.h index 63f74e4..96cafe8 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Proxy_Require.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Proxy_Require.h @@ -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,13 +43,12 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Proxy-Proxy_Require'. /// /// @par ABNF: Proxy_Require = "Proxy_Require" HCOLON option-tag *(COMMA option-tag) -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Proxy_Require_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Proxy_Require_s { + TSIP_DECLARE_HEADER; - tsk_strings_L_t *options; + tsk_strings_L_t *options; } tsip_header_Proxy_Require_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_RAck.h b/tinySIP/include/tinysip/headers/tsip_header_RAck.h index 6a2bc13..55605e0 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_RAck.h +++ b/tinySIP/include/tinysip/headers/tsip_header_RAck.h @@ -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. * @@ -42,15 +42,14 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'RAck' as per RFC 3262. /// /// @par ABNF : "RAck" HCOLON response-num LWS CSeq-num LWS Method -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_RAck_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_RAck_s { + TSIP_DECLARE_HEADER; - uint32_t seq; - uint32_t cseq; - char* method; + uint32_t seq; + uint32_t cseq; + char* method; } tsip_header_RAck_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_RSeq.h b/tinySIP/include/tinysip/headers/tsip_header_RSeq.h index 1b87ddd..6310dca 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_RSeq.h +++ b/tinySIP/include/tinysip/headers/tsip_header_RSeq.h @@ -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,12 +45,11 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'RSeq' as per RFC 3262. /// /// @par ABNF: "RSeq" HCOLON response-num -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_RSeq_s -{ - TSIP_DECLARE_HEADER; - uint32_t seq; +typedef struct tsip_header_RSeq_s { + TSIP_DECLARE_HEADER; + uint32_t seq; } tsip_header_RSeq_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Reason.h b/tinySIP/include/tinysip/headers/tsip_header_Reason.h index eb13b51..ba19369 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Reason.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Reason.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Reason'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Reason_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Reason_s { + TSIP_DECLARE_HEADER; } tsip_header_Reason_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Record_Route.h b/tinySIP/include/tinysip/headers/tsip_header_Record_Route.h index 7e8e187..1eeada6 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Record_Route.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Record_Route.h @@ -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,14 +47,13 @@ TSIP_BEGIN_DECLS /// @par ABNF : Record-Route = "Record-Route" HCOLON rec-route *(COMMA rec-route) /// rec-route = name-addr *( SEMI rr-param ) /// rr-param = generic-param -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Record_Route_s -{ - TSIP_DECLARE_HEADER; - - char* display_name; - tsip_uri_t *uri; +typedef struct tsip_header_Record_Route_s { + TSIP_DECLARE_HEADER; + + char* display_name; + tsip_uri_t *uri; } tsip_header_Record_Route_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Refer_Sub.h b/tinySIP/include/tinysip/headers/tsip_header_Refer_Sub.h index d436430..81db755 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Refer_Sub.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Refer_Sub.h @@ -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,13 +44,12 @@ TSIP_BEGIN_DECLS /// @par ABNF : Refer-Sub = "Refer-Sub" HCOLON refer-sub-value *(SEMI exten) /// refer-sub-value = "true" / "false" /// exten = generic-param -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Refer_Sub_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Refer_Sub_s { + TSIP_DECLARE_HEADER; - tsk_bool_t sub; + tsk_bool_t sub; } tsip_header_Refer_Sub_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Refer_To.h b/tinySIP/include/tinysip/headers/tsip_header_Refer_To.h index f68ecd9..240a38b 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Refer_To.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Refer_To.h @@ -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,14 +45,13 @@ TSIP_BEGIN_DECLS /// /// @par ABNF: Refer-To = ( "Refer-To" / "r" ) HCOLON ( name-addr / addr-spec ) *(SEMI refer-param) /// refer-param = generic-param / feature-param -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Refer_To_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Refer_To_s { + TSIP_DECLARE_HEADER; - char *display_name; - tsip_uri_t *uri; + char *display_name; + tsip_uri_t *uri; } tsip_header_Refer_To_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Referred_By.h b/tinySIP/include/tinysip/headers/tsip_header_Referred_By.h index 5870512..55c6e18 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Referred_By.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Referred_By.h @@ -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,16 +44,15 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Referred-By'. /// /// @par ABNF: Referred-By = ( "Referred-By" / "b" ) HCOLON referrer-uri *( SEMI (referredby-id-param / generic-param) ) -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Referred_By_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Referred_By_s { + TSIP_DECLARE_HEADER; - char *display_name; - tsip_uri_t *uri; + char *display_name; + tsip_uri_t *uri; - char* cid; + char* cid; } tsip_header_Referred_By_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Reject_Contact.h b/tinySIP/include/tinysip/headers/tsip_header_Reject_Contact.h index 01bcf4f..4dbec22 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Reject_Contact.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Reject_Contact.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Reject-Contact'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Reject_Contact_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Reject_Contact_s { + TSIP_DECLARE_HEADER; } tsip_header_Reject_Contact_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Replaces.h b/tinySIP/include/tinysip/headers/tsip_header_Replaces.h index 5889dd0..5c9a1cd 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Replaces.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Replaces.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Replaces'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Replaces_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Replaces_s { + TSIP_DECLARE_HEADER; } tsip_header_Replaces_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Reply_To.h b/tinySIP/include/tinysip/headers/tsip_header_Reply_To.h index e5b97f1..3bb1601 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Reply_To.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Reply_To.h @@ -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,11 +39,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Reply_To'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Reply_To_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Reply_To_s { + TSIP_DECLARE_HEADER; } tsip_header_Reply_To_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Request_Disposition.h b/tinySIP/include/tinysip/headers/tsip_header_Request_Disposition.h index 50d8615..ceb48e6 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Request_Disposition.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Request_Disposition.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Request-Disposition'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Request_Disposition_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Request_Disposition_s { + TSIP_DECLARE_HEADER; } tsip_header_Request_Disposition_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Require.h b/tinySIP/include/tinysip/headers/tsip_header_Require.h index 01de563..8c1768e 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Require.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Require.h @@ -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,13 +43,12 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Require'. /// /// @par ABNF: Require = "Require" HCOLON option-tag *(COMMA option-tag) -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Require_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Require_s { + TSIP_DECLARE_HEADER; - tsk_strings_L_t *options; + tsk_strings_L_t *options; } tsip_header_Require_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Resource_Priority.h b/tinySIP/include/tinysip/headers/tsip_header_Resource_Priority.h index 24e83df..305466a 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Resource_Priority.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Resource_Priority.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Resource-Priority'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Resource_Priority_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Resource_Priority_s { + TSIP_DECLARE_HEADER; } tsip_header_Resource_Priority_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Retry_After.h b/tinySIP/include/tinysip/headers/tsip_header_Retry_After.h index 4761b5c..92b2266 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Retry_After.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Retry_After.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Retry-After'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Retry_After_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Retry_After_s { + TSIP_DECLARE_HEADER; } tsip_header_Retry_After_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Route.h b/tinySIP/include/tinysip/headers/tsip_header_Route.h index 28e3c80..3e3e246 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Route.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Route.h @@ -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. * @@ -46,14 +46,13 @@ TSIP_BEGIN_DECLS /// /// @par ABNF : Route = "Route" HCOLON route-param *(COMMA route-param) /// route-param = name-addr *( SEMI rr-param ) -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Route_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Route_s { + TSIP_DECLARE_HEADER; - char *display_name; - tsip_uri_t *uri; + char *display_name; + tsip_uri_t *uri; } tsip_header_Route_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_SIP_ETag.h b/tinySIP/include/tinysip/headers/tsip_header_SIP_ETag.h index cf6ba6f..feee266 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_SIP_ETag.h +++ b/tinySIP/include/tinysip/headers/tsip_header_SIP_ETag.h @@ -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. * @@ -42,14 +42,13 @@ TSIP_BEGIN_DECLS * @struct tsip_header_SIP_ETag_s * * SIP header 'SIP-ETag' as per RFC 3903. - * @par ABNF + * @par ABNF * SIP-ETag = "SIP-ETag" HCOLON entity-tag - * entity-tag = token + * entity-tag = token **/ -typedef struct tsip_header_SIP_ETag_s -{ - TSIP_DECLARE_HEADER; - char *value; +typedef struct tsip_header_SIP_ETag_s { + TSIP_DECLARE_HEADER; + char *value; } tsip_header_SIP_ETag_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_SIP_If_Match.h b/tinySIP/include/tinysip/headers/tsip_header_SIP_If_Match.h index f918df4..25aee82 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_SIP_If_Match.h +++ b/tinySIP/include/tinysip/headers/tsip_header_SIP_If_Match.h @@ -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,14 +43,13 @@ TSIP_BEGIN_DECLS * @struct tsip_header_SIP_If_Match_s * * SIP header 'SIP-If-Match' as per RFC 3903. - * @par ABNF + * @par ABNF * SIP-If-Match = "SIP-If-Match" HCOLON entity-tag - * entity-tag = token + * entity-tag = token **/ -typedef struct tsip_header_SIP_If_Match_s -{ - TSIP_DECLARE_HEADER; - char *value; +typedef struct tsip_header_SIP_If_Match_s { + TSIP_DECLARE_HEADER; + char *value; } tsip_header_SIP_If_Match_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Security_Client.h b/tinySIP/include/tinysip/headers/tsip_header_Security_Client.h index d453832..431901a 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Security_Client.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Security_Client.h @@ -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. * @@ -66,33 +66,32 @@ TSIP_BEGIN_DECLS /// port1 = "port1" EQUAL port /// port2 = "port2" EQUAL port /// port = 1*DIGIT -/// -/// +/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Security_Client_s -{ - TSIP_DECLARE_HEADER; - - //! sec-mechanism (e.g. "digest" / "tls" / "ipsec-3gpp") - char* mech; - //! algorithm (e.g. "hmac-md5-96" / "hmac-sha-1-96") - char* alg; - //! protocol (e.g. "ah" / "esp") - char* prot; - //! mode (e.g. "trans" / "tun") - char* mod; - //! encrypt-algorithm (e.g. "des-ede3-cbc" / "null") - char* ealg; - //! client port - tnet_port_t port_c; - //! server port - tnet_port_t port_s; - //! client spi - uint32_t spi_c; - //! server spi - uint32_t spi_s; - //! preference - double q; +typedef struct tsip_header_Security_Client_s { + TSIP_DECLARE_HEADER; + + //! sec-mechanism (e.g. "digest" / "tls" / "ipsec-3gpp") + char* mech; + //! algorithm (e.g. "hmac-md5-96" / "hmac-sha-1-96") + char* alg; + //! protocol (e.g. "ah" / "esp") + char* prot; + //! mode (e.g. "trans" / "tun") + char* mod; + //! encrypt-algorithm (e.g. "des-ede3-cbc" / "null") + char* ealg; + //! client port + tnet_port_t port_c; + //! server port + tnet_port_t port_s; + //! client spi + uint32_t spi_c; + //! server spi + uint32_t spi_s; + //! preference + double q; } tsip_header_Security_Client_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Security_Server.h b/tinySIP/include/tinysip/headers/tsip_header_Security_Server.h index eb66c43..8cd87ec 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Security_Server.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Security_Server.h @@ -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. * @@ -66,33 +66,32 @@ TSIP_BEGIN_DECLS /// port1 = "port1" EQUAL port /// port2 = "port2" EQUAL port /// port = 1*DIGIT -/// -/// +/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Security_Server_s -{ - TSIP_DECLARE_HEADER; - - //! sec-mechanism (e.g. "digest" / "tls" / "ipsec-3gpp") - char* mech; - //! algorithm (e.g. "hmac-md5-96" / "hmac-sha-1-96") - char* alg; - //! protocol (e.g. "ah" / "esp") - char* prot; - //! mode (e.g. "trans" / "tun") - char* mod; - //! encrypt-algorithm (e.g. "des-ede3-cbc" / "null") - char* ealg; - //! client port - tnet_port_t port_c; - //! server port - tnet_port_t port_s; - //! client spi - uint32_t spi_c; - //! server spi - uint32_t spi_s; - //! preference - double q; +typedef struct tsip_header_Security_Server_s { + TSIP_DECLARE_HEADER; + + //! sec-mechanism (e.g. "digest" / "tls" / "ipsec-3gpp") + char* mech; + //! algorithm (e.g. "hmac-md5-96" / "hmac-sha-1-96") + char* alg; + //! protocol (e.g. "ah" / "esp") + char* prot; + //! mode (e.g. "trans" / "tun") + char* mod; + //! encrypt-algorithm (e.g. "des-ede3-cbc" / "null") + char* ealg; + //! client port + tnet_port_t port_c; + //! server port + tnet_port_t port_s; + //! client spi + uint32_t spi_c; + //! server spi + uint32_t spi_s; + //! preference + double q; } tsip_header_Security_Server_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Security_Verify.h b/tinySIP/include/tinysip/headers/tsip_header_Security_Verify.h index a9e59aa..98cd971 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Security_Verify.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Security_Verify.h @@ -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. * @@ -65,33 +65,32 @@ TSIP_BEGIN_DECLS /// port1 = "port1" EQUAL port /// port2 = "port2" EQUAL port /// port = 1*DIGIT -/// -/// +/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Security_Verify_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Security_Verify_s { + TSIP_DECLARE_HEADER; - //! sec-mechanism (e.g. "digest" / "tls" / "ipsec-3gpp") - char* mech; - //! algorithm (e.g. "hmac-md5-96" / "hmac-sha-1-96") - char* alg; - //! protocol (e.g. "ah" / "esp") - char* prot; - //! mode (e.g. "trans" / "tun") - char* mod; - //! encrypt-algorithm (e.g. "des-ede3-cbc" / "null") - char* ealg; - //! client port - tnet_port_t port_c; - //! server port - tnet_port_t port_s; - //! client spi - uint32_t spi_c; - //! server spi - uint32_t spi_s; - //! preference - double q; + //! sec-mechanism (e.g. "digest" / "tls" / "ipsec-3gpp") + char* mech; + //! algorithm (e.g. "hmac-md5-96" / "hmac-sha-1-96") + char* alg; + //! protocol (e.g. "ah" / "esp") + char* prot; + //! mode (e.g. "trans" / "tun") + char* mod; + //! encrypt-algorithm (e.g. "des-ede3-cbc" / "null") + char* ealg; + //! client port + tnet_port_t port_c; + //! server port + tnet_port_t port_s; + //! client spi + uint32_t spi_c; + //! server spi + uint32_t spi_s; + //! preference + double q; } tsip_header_Security_Verify_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Server.h b/tinySIP/include/tinysip/headers/tsip_header_Server.h index 1bdb3e5..5c3f3b9 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Server.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Server.h @@ -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,12 +47,11 @@ TSIP_BEGIN_DECLS /// server-val = product / comment /// product = token [SLASH product-version] /// product-version = token -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Server_s -{ - TSIP_DECLARE_HEADER; - char* value; +typedef struct tsip_header_Server_s { + TSIP_DECLARE_HEADER; + char* value; } tsip_header_Server_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Service_Route.h b/tinySIP/include/tinysip/headers/tsip_header_Service_Route.h index 307d644..328a9fd 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Service_Route.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Service_Route.h @@ -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,14 +45,13 @@ TSIP_BEGIN_DECLS /// /// @par ABNF: Service-Route = "Service-Route" HCOLON sr-value *(COMMA sr-value) /// sr-value = name-addr *( SEMI rr-param ) -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Service_Route_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Service_Route_s { + TSIP_DECLARE_HEADER; - char *display_name; - tsip_uri_t *uri; + char *display_name; + tsip_uri_t *uri; } tsip_header_Service_Route_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Session_Expires.h b/tinySIP/include/tinysip/headers/tsip_header_Session_Expires.h index 386d652..4b71d9b 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Session_Expires.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Session_Expires.h @@ -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,15 +45,14 @@ TSIP_BEGIN_DECLS /// /// @par ABNF: Session-Expires = ( "Session-Expires" / "x" ) HCOLON delta-seconds *( SEMI (se-params ) /// se-params = refresher-param / generic-param -/// refresher-param = "refresher" EQUAL ("uas" / "uac") -/// +/// refresher-param = "refresher" EQUAL ("uas" / "uac") +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Session_Expires_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Session_Expires_s { + TSIP_DECLARE_HEADER; - int64_t delta_seconds; - tsk_bool_t refresher_uas; + int64_t delta_seconds; + tsk_bool_t refresher_uas; } tsip_header_Session_Expires_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Subject.h b/tinySIP/include/tinysip/headers/tsip_header_Subject.h index 69cbfec..ea195fa 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Subject.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Subject.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Subject'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Subject_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Subject_s { + TSIP_DECLARE_HEADER; } tsip_header_Subject_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Subscription_State.h b/tinySIP/include/tinysip/headers/tsip_header_Subscription_State.h index 5e4f90c..716a98c 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Subscription_State.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Subscription_State.h @@ -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. * @@ -46,16 +46,15 @@ TSIP_BEGIN_DECLS /// subexp-params = ("reason" EQUAL event-reason-value) / ("expires" EQUAL delta-seconds) / ("retry-after" EQUAL delta-seconds) / generic-param /// event-reason-value = "deactivated" / "probation" / "rejected" / "timeout" / "giveup" / "noresource" / event-reason-extension /// event-reason-extension = token -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Subscription_State_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Subscription_State_s { + TSIP_DECLARE_HEADER; - char* state; - char* reason; - int32_t expires; - int32_t retry_after; + char* state; + char* reason; + int32_t expires; + int32_t retry_after; } tsip_header_Subscription_State_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Supported.h b/tinySIP/include/tinysip/headers/tsip_header_Supported.h index 6b0ecd4..c1d8c4f 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Supported.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Supported.h @@ -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,13 +44,12 @@ TSIP_BEGIN_DECLS /// /// @par ABNF: Supported / k /// Supported = ( "Supported" / "k" ) HCOLON [option-tag *(COMMA option-tag)] -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Supported_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Supported_s { + TSIP_DECLARE_HEADER; - tsk_strings_L_t *options; + tsk_strings_L_t *options; } tsip_header_Supported_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Target_Dialog.h b/tinySIP/include/tinysip/headers/tsip_header_Target_Dialog.h index 185fdf9..d4c77b6 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Target_Dialog.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Target_Dialog.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Target-Dialog'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Target_Dialog_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Target_Dialog_s { + TSIP_DECLARE_HEADER; } tsip_header_Target_Dialog_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Timestamp.h b/tinySIP/include/tinysip/headers/tsip_header_Timestamp.h index 6492824..3b61b85 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Timestamp.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Timestamp.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Timestamp'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Timestamp_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Timestamp_s { + TSIP_DECLARE_HEADER; } tsip_header_Timestamp_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_To.h b/tinySIP/include/tinysip/headers/tsip_header_To.h index 92970f1..09a68ce 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_To.h +++ b/tinySIP/include/tinysip/headers/tsip_header_To.h @@ -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,15 +45,14 @@ TSIP_BEGIN_DECLS /// /// @par ABNF: To = To = ( "To" / "t" ) HCOLON ( name-addr / addr-spec ) *( SEMI to-param ) /// to-param = tag-param / generic-param -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_To_s -{ - TSIP_DECLARE_HEADER; - - char *display_name; - tsip_uri_t *uri; - char *tag; +typedef struct tsip_header_To_s { + TSIP_DECLARE_HEADER; + + char *display_name; + tsip_uri_t *uri; + char *tag; } tsip_header_To_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Unsupported.h b/tinySIP/include/tinysip/headers/tsip_header_Unsupported.h index d58f8d4..57740e9 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Unsupported.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Unsupported.h @@ -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. * @@ -40,11 +40,10 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Unsupported'. /// /// @par ABNF -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Unsupported_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Unsupported_s { + TSIP_DECLARE_HEADER; } tsip_header_Unsupported_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_User_Agent.h b/tinySIP/include/tinysip/headers/tsip_header_User_Agent.h index a69c454..e8eaece 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_User_Agent.h +++ b/tinySIP/include/tinysip/headers/tsip_header_User_Agent.h @@ -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,12 +43,11 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'User-Agent'. /// /// @par ABNF : User-Agent = "User-Agent" HCOLON server-val *(LWS server-val) -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_User_Agent_s -{ - TSIP_DECLARE_HEADER; - char *value; +typedef struct tsip_header_User_Agent_s { + TSIP_DECLARE_HEADER; + char *value; } tsip_header_User_Agent_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Via.h b/tinySIP/include/tinysip/headers/tsip_header_Via.h index dca22a7..5bd76d8 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Via.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Via.h @@ -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. * @@ -72,23 +72,22 @@ TSIP_BEGIN_DECLS /// @author Mamadou /// @date 12/5/2009 //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Via_s -{ - TSIP_DECLARE_HEADER; - - char *branch; - char *host; - uint16_t port; - char *comp; - char *sigcomp_id; - char *received; - char *maddr; - char *proto_name; - char *proto_version; - char *transport; - - int32_t rport; - int32_t ttl; +typedef struct tsip_header_Via_s { + TSIP_DECLARE_HEADER; + + char *branch; + char *host; + uint16_t port; + char *comp; + char *sigcomp_id; + char *received; + char *maddr; + char *proto_name; + char *proto_version; + char *transport; + + int32_t rport; + int32_t ttl; } tsip_header_Via_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_WWW_Authenticate.h b/tinySIP/include/tinysip/headers/tsip_header_WWW_Authenticate.h index 5de99d9..0381b2d 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_WWW_Authenticate.h +++ b/tinySIP/include/tinysip/headers/tsip_header_WWW_Authenticate.h @@ -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. * @@ -52,20 +52,19 @@ TSIP_BEGIN_DECLS /// stale = "stale" EQUAL ( "true" / "false" ) /// qop-options = "qop" EQUAL LDQUOT qop-value *("," qop-value) RDQUOT /// qop-value = "auth" / "auth-int" / token -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_WWW_Authenticate_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_WWW_Authenticate_s { + TSIP_DECLARE_HEADER; - char* scheme; - char* realm; - char* domain; - char* nonce; - char* opaque; - tsk_bool_t stale; - char* algorithm; - char* qop; + char* scheme; + char* realm; + char* domain; + char* nonce; + char* opaque; + tsk_bool_t stale; + char* algorithm; + char* qop; } tsip_header_WWW_Authenticate_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_Warning.h b/tinySIP/include/tinysip/headers/tsip_header_Warning.h index 6c16112..8c143ef 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_Warning.h +++ b/tinySIP/include/tinysip/headers/tsip_header_Warning.h @@ -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. * @@ -46,15 +46,14 @@ TSIP_BEGIN_DECLS /// warn-agent = hostport / pseudonym /// warn-text = quoted-string /// pseudonym = token -/// +/// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Warning_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Warning_s { + TSIP_DECLARE_HEADER; - int32_t code; - char* agent; - char* text; + int32_t code; + char* agent; + char* text; } tsip_header_Warning_t; diff --git a/tinySIP/include/tinysip/headers/tsip_header_accept.h b/tinySIP/include/tinysip/headers/tsip_header_accept.h index 1742051..012b345 100755 --- a/tinySIP/include/tinysip/headers/tsip_header_accept.h +++ b/tinySIP/include/tinysip/headers/tsip_header_accept.h @@ -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. * @@ -41,13 +41,12 @@ TSIP_BEGIN_DECLS /// @brief SIP header 'Accept' as per RFC 3261 subclause 20.1. /// /// @par ABNF = Accept = "Accept" HCOLON [ accept-range *(COMMA accept-range) ] ; example: ; -/// Accept: application/dialog-info+xml +/// Accept: application/dialog-info+xml /// accept-range = media-range *(SEMI accept-param) -/// media-range = ( "*'/*" / ( m-type SLASH "*" ) / ( m-type SLASH m-subtype ) ) *( SEMI m-parameter ) +/// media-range = ( "*'/*" / ( m-type SLASH "*" ) / ( m-type SLASH m-subtype ) ) *( SEMI m-parameter ) //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_header_Accept_s -{ - TSIP_DECLARE_HEADER; +typedef struct tsip_header_Accept_s { + TSIP_DECLARE_HEADER; } tsip_header_Accept_t; diff --git a/tinySIP/include/tinysip/headers/tsip_headers.h b/tinySIP/include/tinysip/headers/tsip_headers.h index b520cc4..2b60546 100755 --- a/tinySIP/include/tinysip/headers/tsip_headers.h +++ b/tinySIP/include/tinysip/headers/tsip_headers.h @@ -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,7 +47,7 @@ #include "tinysip/headers/tsip_header_Min_Expires.h" #include "tinysip/headers/tsip_header_Min_SE.h" #include "tinysip/headers/tsip_header_Path.h" -#include "tinysip/headers/tsip_header_P_Access_Network_Info.h" +#include "tinysip/headers/tsip_header_P_Access_Network_Info.h" #include "tinysip/headers/tsip_header_P_Asserted_Identity.h" #include "tinysip/headers/tsip_header_P_Associated_URI.h" #include "tinysip/headers/tsip_header_P_Charging_Function_Addresses.h" diff --git a/tinySIP/include/tinysip/parsers/tsip_parser_header.h b/tinySIP/include/tinysip/parsers/tsip_parser_header.h index da673a4..1fb082b 100755 --- a/tinySIP/include/tinysip/parsers/tsip_parser_header.h +++ b/tinySIP/include/tinysip/parsers/tsip_parser_header.h @@ -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. * diff --git a/tinySIP/include/tinysip/parsers/tsip_parser_message.h b/tinySIP/include/tinysip/parsers/tsip_parser_message.h index bf1091d..eabaa91 100755 --- a/tinySIP/include/tinysip/parsers/tsip_parser_message.h +++ b/tinySIP/include/tinysip/parsers/tsip_parser_message.h @@ -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. * diff --git a/tinySIP/include/tinysip/parsers/tsip_parser_uri.h b/tinySIP/include/tinysip/parsers/tsip_parser_uri.h index 84537f5..39b4b39 100755 --- a/tinySIP/include/tinysip/parsers/tsip_parser_uri.h +++ b/tinySIP/include/tinysip/parsers/tsip_parser_uri.h @@ -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. * diff --git a/tinySIP/include/tinysip/sigcomp/tsip_sigcomp.h b/tinySIP/include/tinysip/sigcomp/tsip_sigcomp.h index 6ccb461..d20b480 100755 --- a/tinySIP/include/tinysip/sigcomp/tsip_sigcomp.h +++ b/tinySIP/include/tinysip/sigcomp/tsip_sigcomp.h @@ -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. * diff --git a/tinySIP/include/tinysip/transactions/tsip_transac.h b/tinySIP/include/tinysip/transactions/tsip_transac.h index 3a896a0..772788d 100755 --- a/tinySIP/include/tinysip/transactions/tsip_transac.h +++ b/tinySIP/include/tinysip/transactions/tsip_transac.h @@ -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. * @@ -67,15 +67,14 @@ TSIP_BEGIN_DECLS #define TRANSAC_TIMER_CANCEL(TX) \ tsk_timer_mgr_global_cancel(self->timer##TX.id) -typedef enum tsip_transac_event_type_e -{ - tsip_transac_incoming_msg, - tsip_transac_outgoing_msg, - tsip_transac_canceled, - tsip_transac_terminated, - tsip_transac_timedout, - tsip_transac_error, - tsip_transac_transport_error +typedef enum tsip_transac_event_type_e { + tsip_transac_incoming_msg, + tsip_transac_outgoing_msg, + tsip_transac_canceled, + tsip_transac_terminated, + tsip_transac_timedout, + tsip_transac_error, + tsip_transac_transport_error } tsip_transac_event_type_t; @@ -93,66 +92,62 @@ tsip_transac_event_t; typedef int (*tsip_transac_event_callback_f)(const void *arg, tsip_transac_event_type_t type, const tsip_message_t *msg); #define TSIP_TRANSAC_EVENT_CALLBACK_F(callback) ((tsip_transac_event_callback_f)(callback)) -typedef enum tsip_transac_type_e -{ - tsip_transac_type_ict, /**< Invite Client Transaction. */ - tsip_transac_type_ist, /**< Invite Server Transaction. */ - tsip_transac_type_nict, /**< Non-Invite Client Transaction. */ - tsip_transac_type_nist, /**< Non-Invite Server Transaction. */ +typedef enum tsip_transac_type_e { + tsip_transac_type_ict, /**< Invite Client Transaction. */ + tsip_transac_type_ist, /**< Invite Server Transaction. */ + tsip_transac_type_nict, /**< Non-Invite Client Transaction. */ + tsip_transac_type_nist, /**< Non-Invite Server Transaction. */ } tsip_transac_type_t; -typedef enum tsip_transac_dst_type_e -{ - tsip_transac_dst_type_dialog, - tsip_transac_dst_type_net +typedef enum tsip_transac_dst_type_e { + tsip_transac_dst_type_dialog, + tsip_transac_dst_type_net } tsip_transac_dst_type_t; -typedef struct tsip_transac_dst_s -{ - TSK_DECLARE_OBJECT; +typedef struct tsip_transac_dst_s { + TSK_DECLARE_OBJECT; - tsip_transac_dst_type_t type; - struct tsip_stack_s* stack; + tsip_transac_dst_type_t type; + struct tsip_stack_s* stack; - union{ - struct{ - tsip_dialog_t *dlg; - }dialog; + union { + struct { + tsip_dialog_t *dlg; + } dialog; - //struct{ - //}net; - }; + //struct{ + //}net; + }; } tsip_transac_dst_t; #define TSIP_TRANSAC_DST(self) ((tsip_transac_dst_t*)(self)) #define TSIP_DECLARE_TRANSAC_DST tsip_transac_dst_t __transac__ -typedef struct tsip_transac_s -{ - TSK_DECLARE_OBJECT; - - tsip_transac_type_t type; - - struct tsip_transac_dst_s* dst; - tsk_fsm_t *fsm; - - tsk_bool_t reliable; - tsk_bool_t running; - tsk_bool_t initialized; - - char *branch; - - int32_t cseq_value; - char* cseq_method; - - char* callid; - - tsip_transac_event_callback_f callback; +typedef struct tsip_transac_s { + TSK_DECLARE_OBJECT; + + tsip_transac_type_t type; + + struct tsip_transac_dst_s* dst; + tsk_fsm_t *fsm; + + tsk_bool_t reliable; + tsk_bool_t running; + tsk_bool_t initialized; + + char *branch; + + int32_t cseq_value; + char* cseq_method; + + char* callid; + + tsip_transac_event_callback_f callback; } tsip_transac_t; diff --git a/tinySIP/include/tinysip/transactions/tsip_transac_ict.h b/tinySIP/include/tinysip/transactions/tsip_transac_ict.h index a34a413..f8cfb1d 100755 --- a/tinySIP/include/tinysip/transactions/tsip_transac_ict.h +++ b/tinySIP/include/tinysip/transactions/tsip_transac_ict.h @@ -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,16 +39,15 @@ TSIP_BEGIN_DECLS #define TSIP_TRANSAC_ICT(self) ((tsip_transac_ict_t*)(self)) -typedef struct tsip_transac_ict -{ - TSIP_DECLARE_TRANSAC; - - tsip_request_t* request; +typedef struct tsip_transac_ict { + TSIP_DECLARE_TRANSAC; + + tsip_request_t* request; - tsip_timer_t timerA; - tsip_timer_t timerB; - tsip_timer_t timerD; - tsip_timer_t timerM; + tsip_timer_t timerA; + tsip_timer_t timerB; + tsip_timer_t timerD; + tsip_timer_t timerM; } tsip_transac_ict_t; diff --git a/tinySIP/include/tinysip/transactions/tsip_transac_ist.h b/tinySIP/include/tinysip/transactions/tsip_transac_ist.h index 82abdbe..6acd08f 100755 --- a/tinySIP/include/tinysip/transactions/tsip_transac_ist.h +++ b/tinySIP/include/tinysip/transactions/tsip_transac_ist.h @@ -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. * @@ -38,18 +38,17 @@ TSIP_BEGIN_DECLS #define TSIP_TRANSAC_IST(self) ((tsip_transac_ist_t*)(self)) -typedef struct tsip_transac_ist -{ - TSIP_DECLARE_TRANSAC; +typedef struct tsip_transac_ist { + TSIP_DECLARE_TRANSAC; - tsip_response_t* lastResponse; - tsk_bool_t acked; + tsip_response_t* lastResponse; + tsk_bool_t acked; - tsip_timer_t timerH; - tsip_timer_t timerI; - tsip_timer_t timerG; - tsip_timer_t timerL; - tsip_timer_t timerX; + tsip_timer_t timerH; + tsip_timer_t timerI; + tsip_timer_t timerG; + tsip_timer_t timerL; + tsip_timer_t timerX; } tsip_transac_ist_t; diff --git a/tinySIP/include/tinysip/transactions/tsip_transac_layer.h b/tinySIP/include/tinysip/transactions/tsip_transac_layer.h index acc532c..b24bb84 100755 --- a/tinySIP/include/tinysip/transactions/tsip_transac_layer.h +++ b/tinySIP/include/tinysip/transactions/tsip_transac_layer.h @@ -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. * @@ -40,15 +40,14 @@ TSIP_BEGIN_DECLS -typedef struct tsip_transac_layer_s -{ - TSK_DECLARE_OBJECT; +typedef struct tsip_transac_layer_s { + TSK_DECLARE_OBJECT; - const struct tsip_stack_s *stack; + const struct tsip_stack_s *stack; - tsip_transacs_L_t *transactions; + tsip_transacs_L_t *transactions; - TSK_DECLARE_SAFEOBJ; + TSK_DECLARE_SAFEOBJ; } tsip_transac_layer_t; diff --git a/tinySIP/include/tinysip/transactions/tsip_transac_nict.h b/tinySIP/include/tinysip/transactions/tsip_transac_nict.h index 4052bd0..2734393 100755 --- a/tinySIP/include/tinysip/transactions/tsip_transac_nict.h +++ b/tinySIP/include/tinysip/transactions/tsip_transac_nict.h @@ -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,14 +39,13 @@ TSIP_BEGIN_DECLS #define TSIP_TRANSAC_NICT(self) ((tsip_transac_nict_t*)(self)) -typedef struct tsip_transac_nict -{ - TSIP_DECLARE_TRANSAC; +typedef struct tsip_transac_nict { + TSIP_DECLARE_TRANSAC; - tsip_request_t* request; - tsip_timer_t timerE; - tsip_timer_t timerF; - tsip_timer_t timerK; + tsip_request_t* request; + tsip_timer_t timerE; + tsip_timer_t timerF; + tsip_timer_t timerK; } tsip_transac_nict_t; diff --git a/tinySIP/include/tinysip/transactions/tsip_transac_nist.h b/tinySIP/include/tinysip/transactions/tsip_transac_nist.h index f2234a1..8b4479e 100755 --- a/tinySIP/include/tinysip/transactions/tsip_transac_nist.h +++ b/tinySIP/include/tinysip/transactions/tsip_transac_nist.h @@ -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,12 +39,11 @@ TSIP_BEGIN_DECLS #define TSIP_TRANSAC_NIST(self) ((tsip_transac_nist_t*)(self)) -typedef struct tsip_transac_nist -{ - TSIP_DECLARE_TRANSAC; +typedef struct tsip_transac_nist { + TSIP_DECLARE_TRANSAC; - tsip_response_t* lastResponse; - tsip_timer_t timerJ; + tsip_response_t* lastResponse; + tsip_timer_t timerJ; } tsip_transac_nist_t; diff --git a/tinySIP/include/tinysip/transports/tsip_transport.h b/tinySIP/include/tinysip/transports/tsip_transport.h index 44ffd16..d354ece 100755 --- a/tinySIP/include/tinysip/transports/tsip_transport.h +++ b/tinySIP/include/tinysip/transports/tsip_transport.h @@ -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. * @@ -46,83 +46,80 @@ TSIP_BEGIN_DECLS #define TSIP_TRANSPORT(self) ((tsip_transport_t*)(self)) enum { - TSIP_TRANSPORT_IDX_UDP, - TSIP_TRANSPORT_IDX_DTLS, - TSIP_TRANSPORT_IDX_TCP, - TSIP_TRANSPORT_IDX_TLS, - TSIP_TRANSPORT_IDX_WS, - TSIP_TRANSPORT_IDX_WSS, - - TSIP_TRANSPORT_IDX_MAX + TSIP_TRANSPORT_IDX_UDP, + TSIP_TRANSPORT_IDX_DTLS, + TSIP_TRANSPORT_IDX_TCP, + TSIP_TRANSPORT_IDX_TLS, + TSIP_TRANSPORT_IDX_WS, + TSIP_TRANSPORT_IDX_WSS, + + TSIP_TRANSPORT_IDX_MAX }; -typedef struct tsip_transport_idx_xs -{ - int idx; - const char* name; - enum tnet_socket_type_e type; -} +typedef struct tsip_transport_idx_xs { + int idx; + const char* name; + enum tnet_socket_type_e type; +} tsip_transport_idx_xt; const tsip_transport_idx_xt* tsip_transport_get_by_name(const char* name); int tsip_transport_get_idx_by_name(const char* name); enum tnet_socket_type_e tsip_transport_get_type_by_name(const char* name); -typedef struct tsip_transport_stream_peer_s -{ - TSK_DECLARE_OBJECT; - - tnet_fd_t local_fd; // not owner: do not close - enum tnet_socket_type_e type; - tsk_bool_t connected; - uint64_t time_latest_activity; // in milliseconds - uint64_t time_added; // in milliseconds - tsk_bool_t got_valid_sip_msg; // whether we got at least one valid SIP message on this peer - - tsk_buffer_t *rcv_buff_stream; - tsk_buffer_t *snd_buff_stream; - - // list of dialogs managed by this peer - tsk_strings_L_t *dialogs_cids; - - // temp buffers used to send/recv websocket data before (un)masking - struct{ - void* rcv_buffer; - uint64_t rcv_buffer_size; - void* snd_buffer; - uint64_t snd_buffer_size; - tsk_bool_t handshaking_done; - } ws; - - tnet_ip_t remote_ip; - tnet_port_t remote_port; +typedef struct tsip_transport_stream_peer_s { + TSK_DECLARE_OBJECT; + + tnet_fd_t local_fd; // not owner: do not close + enum tnet_socket_type_e type; + tsk_bool_t connected; + uint64_t time_latest_activity; // in milliseconds + uint64_t time_added; // in milliseconds + tsk_bool_t got_valid_sip_msg; // whether we got at least one valid SIP message on this peer + + tsk_buffer_t *rcv_buff_stream; + tsk_buffer_t *snd_buff_stream; + + // list of dialogs managed by this peer + tsk_strings_L_t *dialogs_cids; + + // temp buffers used to send/recv websocket data before (un)masking + struct { + void* rcv_buffer; + uint64_t rcv_buffer_size; + void* snd_buffer; + uint64_t snd_buffer_size; + tsk_bool_t handshaking_done; + } ws; + + tnet_ip_t remote_ip; + tnet_port_t remote_port; } tsip_transport_stream_peer_t; TINYSIP_GEXTERN const tsk_object_def_t *tsip_transport_stream_peer_def_t; typedef tsk_list_t tsip_transport_stream_peers_L_t; -typedef struct tsip_transport_s -{ - TSK_DECLARE_OBJECT; +typedef struct tsip_transport_s { + TSK_DECLARE_OBJECT; - tsk_bool_t initialized; + tsk_bool_t initialized; - int32_t idx; + int32_t idx; - const struct tsip_stack_s *stack; + const struct tsip_stack_s *stack; - tnet_socket_type_t type; - struct sockaddr_storage pcscf_addr; - tnet_fd_t connectedFD; - tnet_transport_handle_t *net_transport; + tnet_socket_type_t type; + struct sockaddr_storage pcscf_addr; + tnet_fd_t connectedFD; + tnet_transport_handle_t *net_transport; - const char *scheme; - const char *protocol; - const char *via_protocol; - const char *service; /**< NAPTR service name */ + const char *scheme; + const char *protocol; + const char *via_protocol; + const char *service; /**< NAPTR service name */ - tsip_transport_stream_peers_L_t* stream_peers; - int32_t stream_peers_count; + tsip_transport_stream_peers_L_t* stream_peers; + int32_t stream_peers_count; } tsip_transport_t; diff --git a/tinySIP/include/tinysip/transports/tsip_transport_ipsec.h b/tinySIP/include/tinysip/transports/tsip_transport_ipsec.h index d67c3ad..38382d5 100755 --- a/tinySIP/include/tinysip/transports/tsip_transport_ipsec.h +++ b/tinySIP/include/tinysip/transports/tsip_transport_ipsec.h @@ -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. * @@ -42,31 +42,29 @@ TSIP_BEGIN_DECLS #define TSIP_TRANSPORT_IPSEC(self) ((tsip_transport_ipsec_t*)(self)) -typedef struct tsip_ipsec_association_s -{ - TSK_DECLARE_OBJECT; +typedef struct tsip_ipsec_association_s { + TSK_DECLARE_OBJECT; - const tsip_transport_t* transport; + const tsip_transport_t* transport; - tipsec_ctx_t* ctx; - - tnet_socket_t *socket_uc; - tnet_socket_t *socket_us; + tipsec_ctx_t* ctx; - tnet_ip_t ip_remote; - tnet_ip_t ip_local; - tnet_port_t port_local; + tnet_socket_t *socket_uc; + tnet_socket_t *socket_us; + + tnet_ip_t ip_remote; + tnet_ip_t ip_local; + tnet_port_t port_local; } tsip_ipsec_association_t; -typedef struct tsip_transport_ipsec_s -{ - TSIP_DECLARE_TRANSPORT; - - tsip_header_Security_Verifies_L_t* secVerifies; +typedef struct tsip_transport_ipsec_s { + TSIP_DECLARE_TRANSPORT; + + tsip_header_Security_Verifies_L_t* secVerifies; - tsip_ipsec_association_t* asso_active; - tsip_ipsec_association_t* asso_temporary; + tsip_ipsec_association_t* asso_active; + tsip_ipsec_association_t* asso_temporary; } tsip_transport_ipsec_t; diff --git a/tinySIP/include/tinysip/transports/tsip_transport_layer.h b/tinySIP/include/tinysip/transports/tsip_transport_layer.h index 35c4380..2b07c28 100755 --- a/tinySIP/include/tinysip/transports/tsip_transport_layer.h +++ b/tinySIP/include/tinysip/transports/tsip_transport_layer.h @@ -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. * @@ -38,14 +38,13 @@ TSIP_BEGIN_DECLS -typedef struct tsip_transport_layer_s -{ - TSK_DECLARE_OBJECT; +typedef struct tsip_transport_layer_s { + TSK_DECLARE_OBJECT; - const tsip_stack_t *stack; + const tsip_stack_t *stack; - tsk_bool_t running; - tsip_transports_L_t *transports; + tsk_bool_t running; + tsip_transports_L_t *transports; } tsip_transport_layer_t; diff --git a/tinySIP/include/tinysip/transports/tsip_transport_tls.h b/tinySIP/include/tinysip/transports/tsip_transport_tls.h index 106a562..89b057b 100755 --- a/tinySIP/include/tinysip/transports/tsip_transport_tls.h +++ b/tinySIP/include/tinysip/transports/tsip_transport_tls.h @@ -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. * diff --git a/tinySIP/include/tinysip/tsip_action.h b/tinySIP/include/tinysip/tsip_action.h index 868421a..15f30a1 100755 --- a/tinySIP/include/tinysip/tsip_action.h +++ b/tinySIP/include/tinysip/tsip_action.h @@ -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. * @@ -41,80 +41,78 @@ TSIP_BEGIN_DECLS -typedef uint64_t tsip_action_id_t; +typedef uint64_t tsip_action_id_t; #define TSIP_ACTION_INVALID_ID 0 #define TSIP_ACTION_INVALID_HANDLE tsk_null /** List of all supported actions */ -typedef enum tsip_action_type_e -{ - //! Used as configuration action - tsip_atype_config, - tsip_atype_dtmf_send, - - /* === REGISTER == */ - tsip_atype_register, /**< Sends SIP REGISTER request */ - //! Unregister by sending SIP REGISTER request with expires value equals to zero +typedef enum tsip_action_type_e { + //! Used as configuration action + tsip_atype_config, + tsip_atype_dtmf_send, + + /* === REGISTER == */ + tsip_atype_register, /**< Sends SIP REGISTER request */ + //! Unregister by sending SIP REGISTER request with expires value equals to zero #define tsip_atype_unregister tsip_atype_hangup - - /* === SUBSCRIBE === */ - tsip_atype_subscribe, /**< Sends SIP SUBSCRIBE request */ - //! Unsubsribe by sending SIP SUBSCRIBE request with expires value equals to zero + + /* === SUBSCRIBE === */ + tsip_atype_subscribe, /**< Sends SIP SUBSCRIBE request */ + //! Unsubsribe by sending SIP SUBSCRIBE request with expires value equals to zero #define tsip_atype_unsubscribe tsip_atype_hangup - /* === MESSAGE === */ - tsip_atype_message_send, /**< Sends SIP MESSAGE request */ + /* === MESSAGE === */ + tsip_atype_message_send, /**< Sends SIP MESSAGE request */ - /* === INFO === */ - tsip_atype_info_send, /**< Sends SIP INFO request */ + /* === INFO === */ + tsip_atype_info_send, /**< Sends SIP INFO request */ - /* === PUBLISH === */ - tsip_atype_publish, /**< Sends SIP PUBLISH request */ - //! Unpublish by sending SIP PUBLISH request with expires value equals to zero + /* === PUBLISH === */ + tsip_atype_publish, /**< Sends SIP PUBLISH request */ + //! Unpublish by sending SIP PUBLISH request with expires value equals to zero #define tsip_atype_unpublish tsip_atype_hangup - - /* === OPTIONS === */ - tsip_atype_options_send, /**< Sends SIP OPTIONS request */ - - /* === INVITE === */ - tsip_atype_invite, /**< Sends SIP INVITE/reINVITE request */ - tsip_atype_hold, /**< Puts the session on hold state */ - tsip_atype_resume, /**< Resumes a previously held session */ - tsip_atype_ect, /**< Transfer the call */ - tsip_atype_ect_accept, /**< Accept call transfer request */ - tsip_atype_ect_reject, /**< Reject call transfer request */ - tsip_atype_ect_lnotify, /**< Intra-Dialog notify. Never called by the end-user */ - tsip_atype_lmessage, /**< Large message (MSRP). The session must be connected */ + + /* === OPTIONS === */ + tsip_atype_options_send, /**< Sends SIP OPTIONS request */ + + /* === INVITE === */ + tsip_atype_invite, /**< Sends SIP INVITE/reINVITE request */ + tsip_atype_hold, /**< Puts the session on hold state */ + tsip_atype_resume, /**< Resumes a previously held session */ + tsip_atype_ect, /**< Transfer the call */ + tsip_atype_ect_accept, /**< Accept call transfer request */ + tsip_atype_ect_reject, /**< Reject call transfer request */ + tsip_atype_ect_lnotify, /**< Intra-Dialog notify. Never called by the end-user */ + tsip_atype_lmessage, /**< Large message (MSRP). The session must be connected */ #define tsip_atype_bye tsip_atype_hangup - /* === common === */ - //! Accept incoming call (INVITE) or message (SIP MESSAGE) - tsip_atype_accept, - //! Reject incoming call (INVITE) or message (SIP MESSAGE) + /* === common === */ + //! Accept incoming call (INVITE) or message (SIP MESSAGE) + tsip_atype_accept, + //! Reject incoming call (INVITE) or message (SIP MESSAGE) #define tsip_atype_reject tsip_atype_hangup - //! Cancel an outgoing request - tsip_atype_cancel, - //! Hangup any SIP dialog (BYE, unREGISTER, unSUBSCRIBE ...). If the dialog is in early state, then it will be canceled. - tsip_atype_hangup, - //! Shutdown a SIP dialog. Should only be called by the stack. - tsip_atype_shutdown, - //! Signal transport error. Should only be called by the stack. - tsip_atype_transport_error, + //! Cancel an outgoing request + tsip_atype_cancel, + //! Hangup any SIP dialog (BYE, unREGISTER, unSUBSCRIBE ...). If the dialog is in early state, then it will be canceled. + tsip_atype_hangup, + //! Shutdown a SIP dialog. Should only be called by the stack. + tsip_atype_shutdown, + //! Signal transport error. Should only be called by the stack. + tsip_atype_transport_error, } tsip_action_type_t; /* internal enum used to pass parameters from the application layer to the stack */ -typedef enum tsip_action_param_type_e -{ - aptype_null = 0, - - aptype_header, - aptype_config, - aptype_payload, - aptype_resp_line, - aptype_media_type, - aptype_media, +typedef enum tsip_action_param_type_e { + aptype_null = 0, + + aptype_header, + aptype_config, + aptype_payload, + aptype_resp_line, + aptype_media_type, + aptype_media, } tsip_action_param_type_t; @@ -127,32 +125,31 @@ tsip_action_param_type_t; #define TSIP_ACTION_SET_NULL() aptype_null /* private action object. public api should use tsip_action_handle_t. */ -typedef struct tsip_action_s -{ - TSK_DECLARE_OBJECT; - - tsip_action_type_t type; - tsk_params_L_t *headers; - tsk_buffer_t* payload; - - struct{ - short code; - char* phrase; - } line_resp; - - struct{ - tmedia_type_t type; - tmedia_params_L_t *params; - } media; - - struct{ - int volume; // useless (manager will always use "10") - int event; - } dtmf; - - struct{ - char* to; - } ect; +typedef struct tsip_action_s { + TSK_DECLARE_OBJECT; + + tsip_action_type_t type; + tsk_params_L_t *headers; + tsk_buffer_t* payload; + + struct { + short code; + char* phrase; + } line_resp; + + struct { + tmedia_type_t type; + tmedia_params_L_t *params; + } media; + + struct { + int volume; // useless (manager will always use "10") + int event; + } dtmf; + + struct { + char* to; + } ect; } tsip_action_t; diff --git a/tinySIP/include/tinysip/tsip_event.h b/tinySIP/include/tinysip/tsip_event.h index 91e8f4e..1cb347e 100755 --- a/tinySIP/include/tinysip/tsip_event.h +++ b/tinySIP/include/tinysip/tsip_event.h @@ -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. * @@ -38,18 +38,17 @@ TSIP_BEGIN_DECLS #define TSIP_EVENT(self) ((tsip_event_t*)(self)) -typedef enum tsip_event_type_e -{ - tsip_event_invite, - tsip_event_message, - tsip_event_info, - tsip_event_options, - tsip_event_publish, - tsip_event_register, - tsip_event_subscribe, - - tsip_event_dialog, - tsip_event_stack, +typedef enum tsip_event_type_e { + tsip_event_invite, + tsip_event_message, + tsip_event_info, + tsip_event_options, + tsip_event_publish, + tsip_event_register, + tsip_event_subscribe, + + tsip_event_dialog, + tsip_event_stack, } tsip_event_type_t; @@ -81,20 +80,19 @@ tsip_event_type_t; #define tsip_event_code_stack_disconnected 956 -typedef struct tsip_event_s -{ - TSK_DECLARE_OBJECT; +typedef struct tsip_event_s { + TSK_DECLARE_OBJECT; - tsip_ssession_handle_t* ss; + tsip_ssession_handle_t* ss; - short code; - char *phrase; + short code; + char *phrase; - tsip_event_type_t type; - struct tsip_message_s *sipmessage; + tsip_event_type_t type; + struct tsip_message_s *sipmessage; - //! copy of stack user data (needed by sessionless events) - const void* userdata; + //! copy of stack user data (needed by sessionless events) + const void* userdata; } tsip_event_t; #define TSIP_DECLARE_EVENT tsip_event_t __sipevent__ diff --git a/tinySIP/include/tinysip/tsip_message.h b/tinySIP/include/tinysip/tsip_message.h index d0442ea..16ad164 100755 --- a/tinySIP/include/tinysip/tsip_message.h +++ b/tinySIP/include/tinysip/tsip_message.h @@ -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. * @@ -57,8 +57,8 @@ TSIP_BEGIN_DECLS ///** // * @struct tsip_request_line_t // * -// * @brief Defines SIP request header line. -// * ABNF: Request-Line = Method SP Request-URI SP SIP-Version CRLF +// * @brief Defines SIP request header line. +// * ABNF: Request-Line = Method SP Request-URI SP SIP-Version CRLF // * Ref: RFC 3261 subclause 7.1. // * @sa tsip_status_line_t. // * @@ -77,9 +77,9 @@ TSIP_BEGIN_DECLS ///** // * @struct tsip_status_line_t // * -// * @brief Defines SIP response status line. -// * ABNF: Status-Line = SIP-Version SP Status-Code SP Reason-Phrase CRLF -// * Ref: RFC 3261 subclause 7.2. +// * @brief Defines SIP response status line. +// * ABNF: Status-Line = SIP-Version SP Status-Code SP Reason-Phrase CRLF +// * Ref: RFC 3261 subclause 7.2. // * @sa tsip_request_line_t. // * // * @author Mamadou @@ -96,60 +96,59 @@ TSIP_BEGIN_DECLS * @struct tsip_message_t * * @brief Represents a SIP message. A SIP message is either a request from a client to a server, - * or a response from a server to a client. See RFC 3261 suc-bclause 7. + * or a response from a server to a client. See RFC 3261 suc-bclause 7. * You must call @ref tsip_message_create to create a sip message and TSK_OBJECT_SAFE_FREE to free the message. * * @author Mamadou * @date 12/2/2009 **/ -typedef struct tsip_message_s -{ - TSK_DECLARE_OBJECT; - - char *sip_version; /**< The SIP version. Only 'SIP/2.0' is supported. */ - tsip_message_type_t type; /**< The type of this SIP message. */ - - /* Request Line */ - union{ - struct{ - char *method; /**< SIP method name. e.g REGISTER, ACK or INVITE.*/ - tsip_uri_t *uri; /**< The Request-URI is a SIP or SIPS URI as described in Section 19.1 or a general URI (RFC 2396 [5]). It indicates +typedef struct tsip_message_s { + TSK_DECLARE_OBJECT; + + char *sip_version; /**< The SIP version. Only 'SIP/2.0' is supported. */ + tsip_message_type_t type; /**< The type of this SIP message. */ + + /* Request Line */ + union { + struct { + char *method; /**< SIP method name. e.g REGISTER, ACK or INVITE.*/ + tsip_uri_t *uri; /**< The Request-URI is a SIP or SIPS URI as described in Section 19.1 or a general URI (RFC 2396 [5]). It indicates the user or service to which this request is being addressed. The Request-URI MUST NOT contain unescaped spaces or control characters and MUST NOT be enclosed in "<>". */ - tsip_request_type_t request_type; - } request; - struct{ - short status_code; /**< 3-digit integer result code that indicates the outcome of an attempt to understand and satisfy a request. */ - char *reason_phrase; /**< Textual description related to the status code. */ - } response; - } line; - - - /*== MOST COMMON HEADERS. */ - tsip_header_Via_t *firstVia; /**< First Via header. */ - tsip_header_From_t *From; - tsip_header_To_t *To; - tsip_header_Contact_t *Contact; - tsip_header_Call_ID_t *Call_ID; - tsip_header_CSeq_t *CSeq; - tsip_header_Expires_t *Expires; - - tsip_header_Content_Type_t *Content_Type; - tsip_header_Content_Length_t *Content_Length; - tsk_buffer_t *Content; - - /*== OTHER HEADERS*/ - tsip_headers_L_t *headers; - - /*== to hack the message */ - char* sigcomp_id; - tnet_fd_t local_fd; - struct sockaddr_storage remote_addr; // Only valid for Dgram - tsk_bool_t update; - enum tnet_socket_type_e src_net_type; - enum tnet_socket_type_e dst_net_type; - char* dst_address; - tnet_port_t dst_port; + tsip_request_type_t request_type; + } request; + struct { + short status_code; /**< 3-digit integer result code that indicates the outcome of an attempt to understand and satisfy a request. */ + char *reason_phrase; /**< Textual description related to the status code. */ + } response; + } line; + + + /*== MOST COMMON HEADERS. */ + tsip_header_Via_t *firstVia; /**< First Via header. */ + tsip_header_From_t *From; + tsip_header_To_t *To; + tsip_header_Contact_t *Contact; + tsip_header_Call_ID_t *Call_ID; + tsip_header_CSeq_t *CSeq; + tsip_header_Expires_t *Expires; + + tsip_header_Content_Type_t *Content_Type; + tsip_header_Content_Length_t *Content_Length; + tsk_buffer_t *Content; + + /*== OTHER HEADERS*/ + tsip_headers_L_t *headers; + + /*== to hack the message */ + char* sigcomp_id; + tnet_fd_t local_fd; + struct sockaddr_storage remote_addr; // Only valid for Dgram + tsk_bool_t update; + enum tnet_socket_type_e src_net_type; + enum tnet_socket_type_e dst_net_type; + char* dst_address; + tnet_port_t dst_port; } tsip_message_t; @@ -163,19 +162,19 @@ TINYSIP_API int tsip_message_add_content(tsip_message_t *self, const char* conte #if defined(__SYMBIAN32__) && 0 static void TSIP_MESSAGE_ADD_HEADER(tsip_message_t *self, ...) - { - va_list ap; - tsip_header_t *header; - const tsk_object_def_t *objdef; - - va_start(ap, self); - objdef = va_arg(ap, const tsk_object_def_t*); - header = (tsip_header_t *)tsk_object_new_2(objdef, &ap); - va_end(ap); - - tsip_message_add_header(self, header); - tsk_object_unref(header); - } +{ + va_list ap; + tsip_header_t *header; + const tsk_object_def_t *objdef; + + va_start(ap, self); + objdef = va_arg(ap, const tsk_object_def_t*); + header = (tsip_header_t *)tsk_object_new_2(objdef, &ap); + va_end(ap); + + tsip_message_add_header(self, header); + tsk_object_unref(header); +} #else #define TSIP_MESSAGE_ADD_HEADER(self, objdef, ...) \ { \ diff --git a/tinySIP/include/tinysip/tsip_message_common.h b/tinySIP/include/tinysip/tsip_message_common.h index c04131c..b5a64bd 100755 --- a/tinySIP/include/tinysip/tsip_message_common.h +++ b/tinySIP/include/tinysip/tsip_message_common.h @@ -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. * @@ -103,35 +103,33 @@ TSIP_BEGIN_DECLS #define TSIP_RESPONSE_IS_23456(self) (TSIP_MESSAGE_IS_RESPONSE((self)) && 200<= TSIP_RESPONSE_CODE((self)) && TSIP_RESPONSE_CODE((self)) <= 699) #define TSIP_RESPONSE_IS_3456(self) (TSIP_MESSAGE_IS_RESPONSE((self)) && 300<= TSIP_RESPONSE_CODE((self)) && TSIP_RESPONSE_CODE((self)) <= 699) -/** Defines the message type (Request or Response). +/** Defines the message type (Request or Response). **/ -typedef enum tsip_message_type_e -{ - tsip_unknown, - tsip_request, - tsip_response +typedef enum tsip_message_type_e { + tsip_unknown, + tsip_request, + tsip_response } tsip_message_type_t; // SWIG -typedef enum tsip_request_type_e -{ - tsip_NONE = 0, - - tsip_ACK, - tsip_BYE, - tsip_CANCEL, - tsip_INVITE, - tsip_OPTIONS, - tsip_REGISTER, - tsip_SUBSCRIBE, - tsip_NOTIFY, - tsip_REFER, - tsip_INFO, - tsip_UPDATE, - tsip_MESSAGE, - tsip_PUBLISH, - tsip_PRACK +typedef enum tsip_request_type_e { + tsip_NONE = 0, + + tsip_ACK, + tsip_BYE, + tsip_CANCEL, + tsip_INVITE, + tsip_OPTIONS, + tsip_REGISTER, + tsip_SUBSCRIBE, + tsip_NOTIFY, + tsip_REFER, + tsip_INFO, + tsip_UPDATE, + tsip_MESSAGE, + tsip_PUBLISH, + tsip_PRACK } tsip_request_type_t; diff --git a/tinySIP/include/tinysip/tsip_ssession.h b/tinySIP/include/tinysip/tsip_ssession.h index 9049a96..b144363 100755 --- a/tinySIP/include/tinysip/tsip_ssession.h +++ b/tinySIP/include/tinysip/tsip_ssession.h @@ -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. * @@ -46,7 +46,7 @@ TSIP_BEGIN_DECLS struct tsip_message_s; struct tsip_action_s; -typedef uint64_t tsip_ssession_id_t; +typedef uint64_t tsip_ssession_id_t; #define TSIP_SSESSION_INVALID_ID 0 #define TSIP_SSESSION_INVALID_HANDLE tsk_null @@ -59,26 +59,25 @@ typedef uint64_t tsip_ssession_id_t; #define TSIP_SSESSION(self) ((tsip_ssession_t*)(self)) -typedef enum tsip_ssession_param_type_e -{ - sstype_null = 0, - - sstype_header, - sstype_caps, - sstype_userdata, - sstype_to_str, - sstype_from_str, - sstype_to_obj, - sstype_from_obj, - sstype_nocontact, - sstype_expires, - sstype_silent_hangup, - sstype_sigcomp_id, - sstype_auth_ha1, - sstype_auth_impi, - sstype_parent_id, - sstype_ws_src, - sstype_media +typedef enum tsip_ssession_param_type_e { + sstype_null = 0, + + sstype_header, + sstype_caps, + sstype_userdata, + sstype_to_str, + sstype_from_str, + sstype_to_obj, + sstype_from_obj, + sstype_nocontact, + sstype_expires, + sstype_silent_hangup, + sstype_sigcomp_id, + sstype_auth_ha1, + sstype_auth_impi, + sstype_parent_id, + sstype_ws_src, + sstype_media } tsip_ssession_param_type_t; @@ -105,42 +104,41 @@ tsip_ssession_param_type_t; #define TSIP_SSESSION_SET_MEDIA(...) sstype_media, ##__VA_ARGS__ #define TSIP_SSESSION_SET_NULL() sstype_null -typedef enum tsip_msession_param_type_e -{ - mstype_null = 0, +typedef enum tsip_msession_param_type_e { + mstype_null = 0, - mstype_set_profile, - mstype_set_srtp_mode, - mstype_set_avpf_mode, + mstype_set_profile, + mstype_set_srtp_mode, + mstype_set_avpf_mode, - mstype_set_100rel, - mstype_set_rtcp, - mstype_set_rtcpmux, - mstype_set_ice, - mstype_set_ice_stun, - mstype_set_ice_turn, - mstype_set_stun_server, - mstype_set_stun_cred, + mstype_set_100rel, + mstype_set_rtcp, + mstype_set_rtcpmux, + mstype_set_ice, + mstype_set_ice_stun, + mstype_set_ice_turn, + mstype_set_stun_server, + mstype_set_stun_cred, - mstype_set_video_fps, - mstype_set_video_bw_up, - mstype_set_video_bw_down, - mstype_set_video_prefsize, + mstype_set_video_fps, + mstype_set_video_bw_up, + mstype_set_video_bw_down, + mstype_set_video_prefsize, - mstype_set_qos, - mstype_unset_qos, + mstype_set_qos, + mstype_unset_qos, - mstype_set_timers, - mstype_unset_timers, + mstype_set_timers, + mstype_unset_timers, - mstype_set_codecs, + mstype_set_codecs, - mstype_set_bypass_encoding, - mstype_set_bypass_decoding, + mstype_set_bypass_encoding, + mstype_set_bypass_decoding, - mstype_set_rtp_ssrc, + mstype_set_rtp_ssrc, - mstype_set_msrp_cb + mstype_set_msrp_cb } tsip_msession_param_type_t; @@ -175,100 +173,99 @@ tsip_msession_param_type_t; #define TSIP_MSESSION_SET_NULL() mstype_null -typedef struct tsip_ssession_s -{ - TSK_DECLARE_OBJECT; - - tsip_ssession_id_t id; - tsip_ssession_id_t id_parent; //for call transfer - unsigned owner:1; - - const struct tsip_stack_s* stack; - const void* userdata; - - //======= - // SIP - //======= - tsk_params_L_t *caps; - tsk_params_L_t *headers; - - unsigned no_contact:1; - struct tsip_uri_s* from; - struct tsip_uri_s* to; - int64_t expires; - tsk_bool_t silent_hangup; - char* sigcomp_id; - char* auth_ha1; - char* auth_impi; - - //======= - // WebSocket - //======= - struct{ - // used when the stack is running in webrtc2sip mode to store the 'origin' (a.k.a 'src') - struct{ - char* host; - tsk_istr_t port; - char* proto; - } src; - } ws; - - //======= - // Media - //======= - struct{ - tmedia_type_t type; - tmedia_profile_t profile; - tmedia_srtp_mode_t srtp_mode; - tmedia_mode_t avpf_mode; - tmedia_codec_id_t codecs; - tsk_bool_t bypass_encoding; - tsk_bool_t bypass_decoding; - - /* Video */ - int32_t video_fps; - int32_t video_bw_up; - int32_t video_bw_down; - tmedia_pref_video_size_t video_pref_size; - - /* RTP*/ - struct{ - struct{ - uint32_t audio; - uint32_t video; - }ssrc; - } rtp; - - /* Session timers */ - struct{ - char* refresher; - unsigned timeout; - } timers; - /* QoS */ - struct{ - tmedia_qos_stype_t type; - tmedia_qos_strength_t strength; - } qos; - /* MSRP */ - struct{ - tmedia_session_msrp_cb_f callback; - } msrp; - /* STUN */ - struct{ - char* username; - char* password; - char* hostname; - uint16_t port; - } stun; - - /* Features */ - unsigned enable_100rel:1; - unsigned enable_ice:1; - unsigned enable_icestun:1; - unsigned enable_iceturn:1; - unsigned enable_rtcp:1; - unsigned enable_rtcpmux:1; - } media; +typedef struct tsip_ssession_s { + TSK_DECLARE_OBJECT; + + tsip_ssession_id_t id; + tsip_ssession_id_t id_parent; //for call transfer + unsigned owner:1; + + const struct tsip_stack_s* stack; + const void* userdata; + + //======= + // SIP + //======= + tsk_params_L_t *caps; + tsk_params_L_t *headers; + + unsigned no_contact:1; + struct tsip_uri_s* from; + struct tsip_uri_s* to; + int64_t expires; + tsk_bool_t silent_hangup; + char* sigcomp_id; + char* auth_ha1; + char* auth_impi; + + //======= + // WebSocket + //======= + struct { + // used when the stack is running in webrtc2sip mode to store the 'origin' (a.k.a 'src') + struct { + char* host; + tsk_istr_t port; + char* proto; + } src; + } ws; + + //======= + // Media + //======= + struct { + tmedia_type_t type; + tmedia_profile_t profile; + tmedia_srtp_mode_t srtp_mode; + tmedia_mode_t avpf_mode; + tmedia_codec_id_t codecs; + tsk_bool_t bypass_encoding; + tsk_bool_t bypass_decoding; + + /* Video */ + int32_t video_fps; + int32_t video_bw_up; + int32_t video_bw_down; + tmedia_pref_video_size_t video_pref_size; + + /* RTP*/ + struct { + struct { + uint32_t audio; + uint32_t video; + } ssrc; + } rtp; + + /* Session timers */ + struct { + char* refresher; + unsigned timeout; + } timers; + /* QoS */ + struct { + tmedia_qos_stype_t type; + tmedia_qos_strength_t strength; + } qos; + /* MSRP */ + struct { + tmedia_session_msrp_cb_f callback; + } msrp; + /* STUN */ + struct { + char* username; + char* password; + char* hostname; + uint16_t port; + } stun; + + /* Features */ + unsigned enable_100rel:1; + unsigned enable_ice:1; + unsigned enable_icestun:1; + unsigned enable_iceturn:1; + unsigned enable_rtcp:1; + unsigned enable_rtcpmux:1; + } media; } tsip_ssession_t; diff --git a/tinySIP/include/tinysip/tsip_timers.h b/tinySIP/include/tinysip/tsip_timers.h index 52fddc5..5d63b07 100755 --- a/tinySIP/include/tinysip/tsip_timers.h +++ b/tinySIP/include/tinysip/tsip_timers.h @@ -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. * @@ -55,31 +55,29 @@ TSIP_BEGIN_DECLS //extern const char *timerL; //extern const char *timerM; -typedef struct tsip_timer_s -{ - tsk_timer_id_t id; - uint64_t timeout; +typedef struct tsip_timer_s { + tsk_timer_id_t id; + uint64_t timeout; } tsip_timer_t; -typedef struct tsip_timers_s -{ - uint32_t T1; - uint32_t T2; - uint32_t T4; - uint32_t A; - uint32_t B; - uint32_t C; - uint32_t D; - uint32_t E; - uint32_t F; - uint32_t G; - uint32_t H; - uint32_t I; - uint32_t J; - uint32_t K; - uint32_t L; - uint32_t M; +typedef struct tsip_timers_s { + uint32_t T1; + uint32_t T2; + uint32_t T4; + uint32_t A; + uint32_t B; + uint32_t C; + uint32_t D; + uint32_t E; + uint32_t F; + uint32_t G; + uint32_t H; + uint32_t I; + uint32_t J; + uint32_t K; + uint32_t L; + uint32_t M; } tsip_timers_t; diff --git a/tinySIP/include/tinysip/tsip_uri.h b/tinySIP/include/tinysip/tsip_uri.h index b0daf6b..f30414d 100755 --- a/tinySIP/include/tinysip/tsip_uri.h +++ b/tinySIP/include/tinysip/tsip_uri.h @@ -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. * @@ -40,21 +40,19 @@ TSIP_BEGIN_DECLS #define TSIP_URI_IS_SECURE(uri) ((uri && uri->type==uri_sips) ? tsk_true : tsk_false) -typedef enum tsip_uri_type_e -{ - uri_unknown, - uri_sip, - uri_sips, - uri_tel +typedef enum tsip_uri_type_e { + uri_unknown, + uri_sip, + uri_sips, + uri_tel } tsip_uri_type_t; -typedef enum tsip_host_type_e -{ - host_unknown, - host_hostname, - host_ipv4, - host_ipv6 +typedef enum tsip_host_type_e { + host_unknown, + host_hostname, + host_ipv4, + host_ipv6 } tsip_host_type_t; @@ -63,20 +61,19 @@ tsip_host_type_t; /// @brief SIP/SIPS/TEL URI. /// //////////////////////////////////////////////////////////////////////////////////////////////////// -typedef struct tsip_uri_s -{ - TSK_DECLARE_OBJECT; - - tsip_uri_type_t type; - char *scheme; - char *host; /**< Host name. Hostname or IPv4address or IPv6address. */ - tsip_host_type_t host_type; /**< IPv4 or IPv6 or domain name. */ - uint16_t port; - char *user_name; - char *password; - char *display_name; - - tsk_params_L_t *params; /**< list of @ref tsk_param_t elements containing all parameters. */ +typedef struct tsip_uri_s { + TSK_DECLARE_OBJECT; + + tsip_uri_type_t type; + char *scheme; + char *host; /**< Host name. Hostname or IPv4address or IPv6address. */ + tsip_host_type_t host_type; /**< IPv4 or IPv6 or domain name. */ + uint16_t port; + char *user_name; + char *password; + char *display_name; + + tsk_params_L_t *params; /**< list of @ref tsk_param_t elements containing all parameters. */ } tsip_uri_t; diff --git a/tinySIP/include/tinysip_config.h b/tinySIP/include/tinysip_config.h index 2f95cde..0c23c45 100755 --- a/tinySIP/include/tinysip_config.h +++ b/tinySIP/include/tinysip_config.h @@ -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. * @@ -61,7 +61,7 @@ # define TSIP_BEGIN_DECLS extern "C" { # define TSIP_END_DECLS } #else -# define TSIP_BEGIN_DECLS +# define TSIP_BEGIN_DECLS # define TSIP_END_DECLS #endif @@ -90,7 +90,7 @@ #endif #if HAVE_CONFIG_H - #include <config.h> +#include <config.h> #endif #endif // TINYSIP_CONFIG_H diff --git a/tinySIP/include/tsip.h b/tinySIP/include/tsip.h index 0a1d79b..30eb50a 100755 --- a/tinySIP/include/tsip.h +++ b/tinySIP/include/tsip.h @@ -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. * @@ -58,65 +58,63 @@ typedef uint8_t amf_t[2]; typedef uint8_t operator_id_t[16]; // @tinyWRAP -typedef enum tsip_stack_mode_e -{ - tsip_stack_mode_ua, - tsip_stack_mode_p2p, - tsip_stack_mode_webrtc2sip, - tsip_stack_mode_mcu +typedef enum tsip_stack_mode_e { + tsip_stack_mode_ua, + tsip_stack_mode_p2p, + tsip_stack_mode_webrtc2sip, + tsip_stack_mode_mcu } tsip_stack_mode_t; #define TSIP_STACK_MODE_IS_SERVER(stack) ((stack)->network.mode == tsip_stack_mode_webrtc2sip || (stack)->network.mode == tsip_stack_mode_mcu) #define TSIP_STACK_MODE_IS_CLIENT(stack) (!TSIP_STACK_MODE_IS_SERVER((stack))) -typedef enum tsip_stack_param_type_e -{ - tsip_pname_null = 0, - - /* === Identity === */ - tsip_pname_display_name, - tsip_pname_impu, - tsip_pname_preferred_id, - tsip_pname_impi, - tsip_pname_password, - - /* === SigComp === */ - tsip_pname_sigcomp, - tsip_pname_sigcomp_add_compartment, - tsip_pname_sigcomp_remove_compartment, - - /* === Network === */ - 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, - tsip_pname_dnsserver, - tsip_pname_max_fds, - tsip_pname_mode, - - - /* === Security === */ - 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 === */ - tsip_pname_header, - - /* Nat Traversal */ - tsip_pname_stun_enabled, - tsip_pname_stun_server, - tsip_pname_stun_cred, - - /* === User Data === */ - tsip_pname_userdata, +typedef enum tsip_stack_param_type_e { + tsip_pname_null = 0, + + /* === Identity === */ + tsip_pname_display_name, + tsip_pname_impu, + tsip_pname_preferred_id, + tsip_pname_impi, + tsip_pname_password, + + /* === SigComp === */ + tsip_pname_sigcomp, + tsip_pname_sigcomp_add_compartment, + tsip_pname_sigcomp_remove_compartment, + + /* === Network === */ + 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, + tsip_pname_dnsserver, + tsip_pname_max_fds, + tsip_pname_mode, + + + /* === Security === */ + 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 === */ + tsip_pname_header, + + /* Nat Traversal */ + tsip_pname_stun_enabled, + tsip_pname_stun_server, + tsip_pname_stun_cred, + + /* === User Data === */ + tsip_pname_userdata, } tsip_stack_param_type_t; @@ -132,7 +130,7 @@ tsip_stack_param_type_t; * Sets the user's display name. Used in SIP 'From' and 'To' headers. * @param NAME_STR The user's display name. * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_DISPLAY_NAME("john doe"), * TSIP_STACK_SET_NULL()); * @endcode @@ -142,7 +140,7 @@ tsip_stack_param_type_t; * Sets the user's IMPU (IMS Public Identity). * @param URI_STR A valid SIP/SIPS/tel URI string. * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_IMPU("sip:johndoe@open-ims.test"), * TSIP_STACK_SET_NULL()); * @endcode @@ -152,7 +150,7 @@ tsip_stack_param_type_t; * Sets the user's Preferred Identity. Used to populate the P-Preferred-Identity header. * @param URI_STR A valid SIP/SIPS/tel URI string. * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_PREFERRED_IDENTITY("sip:johndoe@open-ims.test"), * TSIP_STACK_SET_NULL()); * @endcode @@ -162,7 +160,7 @@ tsip_stack_param_type_t; * Sets the user's IMPI (IMS Private Identity). * @param IMPI_STR Any string. * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_IMPI("johndoe@open-ims.test"), * TSIP_STACK_SET_NULL()); * @endcode @@ -172,7 +170,7 @@ tsip_stack_param_type_t; * Sets the user's password. * @param PASSORD_STR Any string. * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_PASSWORD("mysecret"), * TSIP_STACK_SET_NULL()); * @endcode @@ -195,7 +193,7 @@ tsip_stack_param_type_t; * @param CPB_UINT Cycles Per Bit. Default value is 64. * @param PRES_DICT_BOOL Indicates whether to enable Presence dictionary (RFC 5112) or not. Default value is @a tsk_false. * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_SIGCOMP(8192, 8192, 64, tsk_true), * TSIP_STACK_SET_NULL()); * @endcode @@ -209,7 +207,7 @@ tsip_stack_param_type_t; * @sa @ref TSIP_STACK_UNSET_SIGCOMP_COMPARTMENT() * * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_NEW_SIGCOMP_COMPARTMENT("urn:uuid:0C67446E-F1A1-11D9-94D3-000A95A0E128"), * TSIP_STACK_SET_NULL()); * @endcode @@ -223,7 +221,7 @@ tsip_stack_param_type_t; * @sa @ref TSIP_STACK_SET_SIGCOMP_NEW_COMPARTMENT() * * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_UNSET_SIGCOMP_COMPARTMENT("urn:uuid:0C67446E-F1A1-11D9-94D3-000A95A0E128"), * TSIP_STACK_SET_NULL()); * @endcode @@ -238,7 +236,7 @@ tsip_stack_param_type_t; * Sets the domain name. * @param URI_STR A valid SIP/SIPS URI string. * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_REALM("sip:open-ims.test"), * TSIP_STACK_SET_NULL()); * @endcode @@ -248,7 +246,7 @@ tsip_stack_param_type_t; * Sets the user's local IP address. * @param IP_STR IPv4/IPv6 IP address or FQDN. * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_LOCAL_IP("fe80::"), * TSIP_STACK_SET_NULL()); * @endcode @@ -260,7 +258,7 @@ tsip_stack_param_type_t; * Sets the user's local Port to bind to. * @param PORT_UINT Port number. Should be between 0x0400 and 0xFFFF. * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_LOCAL_PORT(5060), * TSIP_STACK_SET_NULL()); * @endcode @@ -275,7 +273,7 @@ tsip_stack_param_type_t; * @param PORT_UINT Port number. Should be between 0x0400 and 0xFFFF. * Will be ignored if equals to zero. * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_AOR("fe80::", 1234), * TSIP_STACK_SET_NULL()); * @endcode @@ -289,7 +287,7 @@ tsip_stack_param_type_t; * is missing, then this option will be enabled by default. * @param ENABLED_BOOL @a tsk_true (1) or @a tsk_false (0). * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_DISCOVERY_NAPTR(tsk_true), * TSIP_STACK_SET_NULL()); * @endcode @@ -302,7 +300,7 @@ tsip_stack_param_type_t; * to use will depend on the Proxy-CSCF address type. * @param ENABLED_BOOL @a tsk_true (1) or @a tsk_false (0). * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_DISCOVERY_DHCP(tsk_false), * TSIP_STACK_SET_NULL()); * @endcode @@ -311,14 +309,14 @@ tsip_stack_param_type_t; */ /**@ingroup tsip_stack_group * @def TSIP_STACK_SET_PROXY_CSCF -* Configures the Proxy-CSCF. +* Configures the Proxy-CSCF. * @param FQDN_STR The IP address (v4/v6) or FQDN of the Proxy-CSCF. * @param PORT_UINT The port. * @param TRANSPORT_STR The transport type. Should be: @a "udp" or @a "tcp" or @a "tls" or @a "sctp". Default is @a "udp". -* @param IP_VERSION_STR The IP version to use. Should be: @a "ipv4" or @a "ipv6" or @a "ipv46". This parameter is useful when +* @param IP_VERSION_STR The IP version to use. Should be: @a "ipv4" or @a "ipv6" or @a "ipv46". This parameter is useful when * @a FQDN_STR parameter is a domain name. default is @a "ipv4". * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_PROXY_CSCF("pcscf-doubango.org", 4060, "tcp", "ipv6"), * TSIP_STACK_SET_NULL()); * @endcode @@ -331,7 +329,7 @@ tsip_stack_param_type_t; * @param IP_STR The IP address or FQDN of the DNS server to add. * @code // Add two new DNS servers (IPv6 and IPv4) -int ret = tsip_stack_set(stack, +int ret = tsip_stack_set(stack, TSIP_STACK_SET_DNS_SERVER("192.16.16.9"), TSIP_STACK_SET_DNS_SERVER("fe::"), TSIP_STACK_SET_NULL()); @@ -341,7 +339,7 @@ int ret = tsip_stack_set(stack, * @def TSIP_STACK_SET_MODE_SERVER * Configure the stack to be used as server. Cannot be changed later. * @code -int ret = tsip_stack_set(stack, +int ret = tsip_stack_set(stack, TSIP_STACK_SET_MODE_SERVER(), TSIP_STACK_SET_NULL()); * @endcode @@ -363,20 +361,20 @@ int ret = tsip_stack_set(stack, /* === Security === */ /**@ingroup tsip_stack_group * @def TSIP_STACK_SET_EARLY_IMS -* Whether to enable 3GPP Early-IMS Security as per 3GPP TS 33.978. +* Whether to enable 3GPP Early-IMS Security as per 3GPP TS 33.978. * @param ENABLED_BOOL @a tsk_true (1) or @a tsk_false (0). * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_EARLY_IMS(tsk_false), * TSIP_STACK_SET_NULL()); * @endcode */ /**@ingroup tsip_stack_group * @def TSIP_STACK_SET_SECAGREE_IPSEC -* Whether to enable IPSec security agreement as per IETF RFC 3329. +* Whether to enable IPSec security agreement as per IETF RFC 3329. * @param ENABLED_BOOL @a tsk_true (1) or @a tsk_false (0). * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_SECAGREE_IPSEC(tsk_true), * TSIP_STACK_SET_NULL()); * @endcode @@ -385,10 +383,10 @@ int ret = tsip_stack_set(stack, */ /**@ingroup tsip_stack_group * @def TSIP_STACK_SET_SECAGREE_TLS -* Whether to enable TLS security agreement as per IETF RFC 3329. +* Whether to enable TLS security agreement as per IETF RFC 3329. * @param ENABLED_BOOL @a tsk_true (1) or @a tsk_false (0). * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_SECAGREE_TLS(tsk_true), * TSIP_STACK_SET_NULL()); * @endcode @@ -400,7 +398,7 @@ int ret = tsip_stack_set(stack, * Sets AMF (Authentication Management Field) value to use for IMS-AKA authentication. * @param AMF_UINT16 16-bit value. * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_IMS_AKA_AMF(0x3FB6), * TSIP_STACK_SET_NULL()); * @endcode @@ -413,7 +411,7 @@ int ret = tsip_stack_set(stack, * @param OPID_HEX_STR 128-bit value as hex-string. If the length of the value supplied by the user is less than 128 bits, * then it will be padded with zeros. * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_IMS_AKA_OPERATOR_ID("0x5FABC9"), // Will be padded with zeros * TSIP_STACK_SET_NULL()); * @endcode @@ -428,7 +426,7 @@ int ret = tsip_stack_set(stack, * @param MODE_STR Mode. Should be: @a "tun" or @a "trans". Default is @a "trans". * @param PROTOCOL_STR Protocol. Should be @a "ah" or @a "esp" or @a "ah/esp". Default is @a "esp". * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_SECAGREE_IPSEC(tsk_true), TSIP_STACK_SET_IPSEC_PARAMS("hmac-md5-96", "des-ede3-cbc", "trans", "esp"), * TSIP_STACK_SET_NULL()); @@ -443,7 +441,7 @@ int ret = tsip_stack_set(stack, * @param PUB_FILE_STR Public cert. file. * @param PRIV_FILE_STR Private cert. file. * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_TLS_CERTS("C:\\tls\\ca.pki-crt.pem", "C:\\tls\\pub-crt.pem", "C:\\tls\\priv-key.pem"), * TSIP_STACK_SET_NULL()); * @endcode @@ -467,7 +465,7 @@ int ret = tsip_stack_set(stack, * @param NAME_STR The name of the header to add or update. * @param VALUE_STR The value of the header to add or update. * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_HEADER("User-Agent", "IM-client/OMA1.0 doubango/v1.0.0"), * TSIP_STACK_SET_HEADER("Allow", "INVITE, ACK, CANCEL, BYE, MESSAGE, OPTIONS, NOTIFY, PRACK, UPDATE, REFER"), * TSIP_STACK_SET_NULL()); @@ -480,7 +478,7 @@ int ret = tsip_stack_set(stack, * Removes a stack-level header. * @param NAME_STR The name of the header to remove. * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_UNSET_HEADER("User-Agent"), * TSIP_STACK_UNSET_HEADER("Allow"), * TSIP_STACK_UNSET_HEADER("My_Header"), @@ -499,7 +497,7 @@ int ret = tsip_stack_set(stack, * @param IP_STR The IPv4/IPv6 address for FQDN of the STUN2/TURN address. * @param PORT_UINT The server port (default is 3478 for both TCP and UDP, and 5349 for TLS) * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_STUN_SERVER("numb.viagenie.ca", 3478), * TSIP_STACK_SET_NULL()); * @endcode @@ -512,7 +510,7 @@ int ret = tsip_stack_set(stack, * @param USR_STR The login. * @param PASSORD_STR The password * @code -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_STUN_CRED("bob@open-ims.test", "mysecret"), * TSIP_STACK_SET_NULL()); * @endcode @@ -530,7 +528,7 @@ int ret = tsip_stack_set(stack, * @param DATA_PTR Pointer to the user data. * @code * const void* context; -* int ret = tsip_stack_set(stack, +* int ret = tsip_stack_set(stack, * TSIP_STACK_SET_USERDATA(context), * TSIP_STACK_SET_NULL()); * @endcode @@ -541,131 +539,130 @@ int ret = tsip_stack_set(stack, /* 3GPP IMS/LTE stack (for internal use). only tsip_stack_handle_t should be visible. */ -typedef struct tsip_stack_s -{ - TSK_DECLARE_RUNNABLE; - TSK_DECLARE_SAFEOBJ; - - tsk_timer_manager_handle_t* timer_mgr_global; - tsk_bool_t started; - tsip_stack_callback_f callback; - - /* === Identity === */ - struct{ - char* display_name; - tsip_uri_t *impu; - tsip_uri_t *preferred; - char *impi; - char *password; - } identity; - - /* === SigComp === */ - struct{ - tsip_sigcomp_handle_t* handle; - - unsigned dms; - unsigned sms; - unsigned cpb; - tsk_bool_t sip_dict; - tsk_bool_t pres_dict; - } sigcomp; - - /* === Network === */ - struct{ - tsip_stack_mode_t mode; - - char *local_ip[TSIP_TRANSPORT_IDX_MAX]; - tnet_port_t local_port[TSIP_TRANSPORT_IDX_MAX]; +typedef struct tsip_stack_s { + TSK_DECLARE_RUNNABLE; + TSK_DECLARE_SAFEOBJ; + + tsk_timer_manager_handle_t* timer_mgr_global; + tsk_bool_t started; + tsip_stack_callback_f callback; + + /* === Identity === */ + struct { + char* display_name; + tsip_uri_t *impu; + tsip_uri_t *preferred; + char *impi; + char *password; + } identity; + + /* === SigComp === */ + struct { + tsip_sigcomp_handle_t* handle; + + unsigned dms; + unsigned sms; + unsigned cpb; + tsk_bool_t sip_dict; + tsk_bool_t pres_dict; + } sigcomp; + + /* === Network === */ + struct { + tsip_stack_mode_t mode; + + char *local_ip[TSIP_TRANSPORT_IDX_MAX]; + tnet_port_t local_port[TSIP_TRANSPORT_IDX_MAX]; tsk_bool_t local_ip_is_set_by_user[TSIP_TRANSPORT_IDX_MAX]; // whether the address (ip and port) is set by the user or retrieved - char *proxy_cscf[TSIP_TRANSPORT_IDX_MAX]; - tnet_port_t proxy_cscf_port[TSIP_TRANSPORT_IDX_MAX]; - tnet_socket_type_t proxy_cscf_type[TSIP_TRANSPORT_IDX_MAX]; - tnet_socket_type_t transport_types[TSIP_TRANSPORT_IDX_MAX]; - int32_t transport_idx_default; - - tsip_uri_t *realm; - - //! IP adddress and port to use as AOR (user-defined) - struct{ - char* ip[TSIP_TRANSPORT_IDX_MAX]; - tnet_port_t port[TSIP_TRANSPORT_IDX_MAX]; - } aor; - - tsk_bool_t discovery_naptr; - tsk_bool_t discovery_dhcp; - - tsk_size_t max_fds; - } network; - - /* === Security === */ - struct{ - char* secagree_mech; - tsk_bool_t earlyIMS; - operator_id_t operator_id; - amf_t amf; - - /* IPSec */ - struct{ - char* alg; - char* ealg; - char* mode; - char* protocol; - } ipsec; - tsk_bool_t enable_secagree_ipsec; - - /* TLS */ - struct { - char* ca; - char* pbk; - char* pvk; - tsk_bool_t verify; - }tls; - tsk_bool_t enable_secagree_tls; - } security; - - - - - - - - - tsip_uris_L_t* paths; - tsip_uris_L_t* service_routes; - tsip_uris_L_t* associated_uris; - - /* DNS context */ - tnet_dns_ctx_t *dns_ctx; - - /* NAT Traversal context */ - struct { - // STUN - struct{ - char* ip; - tnet_port_t port; - char* login; - char* pwd; - tsk_bool_t enabled; - } stun; - struct tnet_nat_ctx_s* ctx; - } natt; - - /* DHCP context */ - - /* QoS */ - - /* Internals. */ - //tsk_timer_manager_handle_t* timer_mgr; - tsip_timers_t timers; - tsip_ssessions_L_t *ssessions; - tsk_params_L_t *headers; - const void* userdata; - - /* Layers */ - struct tsip_dialog_layer_s *layer_dialog; - struct tsip_transac_layer_s *layer_transac; - struct tsip_transport_layer_s *layer_transport; + char *proxy_cscf[TSIP_TRANSPORT_IDX_MAX]; + tnet_port_t proxy_cscf_port[TSIP_TRANSPORT_IDX_MAX]; + tnet_socket_type_t proxy_cscf_type[TSIP_TRANSPORT_IDX_MAX]; + tnet_socket_type_t transport_types[TSIP_TRANSPORT_IDX_MAX]; + int32_t transport_idx_default; + + tsip_uri_t *realm; + + //! IP adddress and port to use as AOR (user-defined) + struct { + char* ip[TSIP_TRANSPORT_IDX_MAX]; + tnet_port_t port[TSIP_TRANSPORT_IDX_MAX]; + } aor; + + tsk_bool_t discovery_naptr; + tsk_bool_t discovery_dhcp; + + tsk_size_t max_fds; + } network; + + /* === Security === */ + struct { + char* secagree_mech; + tsk_bool_t earlyIMS; + operator_id_t operator_id; + amf_t amf; + + /* IPSec */ + struct { + char* alg; + char* ealg; + char* mode; + char* protocol; + } ipsec; + tsk_bool_t enable_secagree_ipsec; + + /* TLS */ + struct { + char* ca; + char* pbk; + char* pvk; + tsk_bool_t verify; + } tls; + tsk_bool_t enable_secagree_tls; + } security; + + + + + + + + + tsip_uris_L_t* paths; + tsip_uris_L_t* service_routes; + tsip_uris_L_t* associated_uris; + + /* DNS context */ + tnet_dns_ctx_t *dns_ctx; + + /* NAT Traversal context */ + struct { + // STUN + struct { + char* ip; + tnet_port_t port; + char* login; + char* pwd; + tsk_bool_t enabled; + } stun; + struct tnet_nat_ctx_s* ctx; + } natt; + + /* DHCP context */ + + /* QoS */ + + /* Internals. */ + //tsk_timer_manager_handle_t* timer_mgr; + tsip_timers_t timers; + tsip_ssessions_L_t *ssessions; + tsk_params_L_t *headers; + const void* userdata; + + /* Layers */ + struct tsip_dialog_layer_s *layer_dialog; + struct tsip_transac_layer_s *layer_transac; + struct tsip_transport_layer_s *layer_transport; } tsip_stack_t; 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; diff --git a/tinySIP/src/authentication/tsip_challenge.c b/tinySIP/src/authentication/tsip_challenge.c index bfe39ee..023c4bf 100755 --- a/tinySIP/src/authentication/tsip_challenge.c +++ b/tinySIP/src/authentication/tsip_challenge.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. * @@ -52,33 +52,32 @@ /** Creates new challenge object. */ tsip_challenge_t* tsip_challenge_create(tsip_stack_t* stack, tsk_bool_t isproxy, const char* scheme, const char* realm, const char* nonce, const char* opaque, const char* algorithm, const char* qop) { - return tsk_object_new(tsip_challenge_def_t, stack, isproxy,scheme, realm, nonce, opaque, algorithm, qop); + return tsk_object_new(tsip_challenge_def_t, stack, isproxy,scheme, realm, nonce, opaque, algorithm, qop); } /** Creates new challenge object (with default values). */ tsip_challenge_t* tsip_challenge_create_null(tsip_stack_t* stack) { - return tsip_challenge_create(stack, tsk_false, tsk_null, tsk_null, tsk_null, tsk_null, tsk_null, tsk_null); + return tsip_challenge_create(stack, tsk_false, tsk_null, tsk_null, tsk_null, tsk_null, tsk_null, tsk_null); } int tsip_challenge_reset_cnonce(tsip_challenge_t *self) { - if(self){ - if(self->qop) /* client nonce is only used if qop=auth, auth-int or both */ - { + if(self) { + if(self->qop) { /* client nonce is only used if qop=auth, auth-int or both */ #if 0 - memcpy(self->cnonce, "ecb1d3f6931803ce7ae68099cb946594", 32); + memcpy(self->cnonce, "ecb1d3f6931803ce7ae68099cb946594", 32); #else - tsk_istr_t istr; - - tsk_strrandom(&istr); - tsk_md5compute(istr, tsk_strlen(istr), &self->cnonce); + tsk_istr_t istr; + + tsk_strrandom(&istr); + tsk_md5compute(istr, tsk_strlen(istr), &self->cnonce); #endif - self->nc = 1; - } - } - return -1; + self->nc = 1; + } + } + return -1; } //3GPP TS 35.205/6/7/8/9 and RFC 3310 @@ -87,132 +86,132 @@ int tsip_challenge_get_akares(tsip_challenge_t *self, char const *password, char #define SQN_XOR_AK() (AUTN + 0) #define SERVER_DATA() (nonce + AKA_RAND_SIZE + AKA_AUTN_SIZE) - // § ==> XOR - // || ==> append - - AKA_RES_T akares; - - int ret = -1; - tsk_size_t n; - char *nonce = tsk_null; - - AKA_XXX_DECLARE(RAND); - AKA_XXX_DECLARE(AK); - AKA_XXX_DECLARE(AMF); - AKA_XXX_DECLARE(CK); - AKA_XXX_DECLARE(IK); - AKA_XXX_DECLARE(K); - AKA_XXX_DECLARE(SQN); - AKA_XXX_DECLARE(MAC_A); - AKA_XXX_DECLARE(AUTN); - - AKA_XXX_BZERO(RAND); - AKA_XXX_BZERO(AK); - AKA_XXX_BZERO(AMF); - AKA_XXX_BZERO(CK); - AKA_XXX_BZERO(IK); - AKA_XXX_BZERO(K); - AKA_XXX_BZERO(SQN); - AKA_XXX_BZERO(MAC_A); - AKA_XXX_BZERO(AUTN); - - /* RFC 3310 subclause 3.2: nonce = base64(RAND || AUTN || SERV_DATA) */ - n = tsk_base64_decode((const uint8_t*)self->nonce, tsk_strlen(self->nonce), &nonce); - if(n > TSK_MD5_STRING_SIZE){ - TSK_DEBUG_ERROR("The IMS CORE returned an invalid nonce."); - goto bail; - } - if(n < AKA_RAND_SIZE + AKA_AUTN_SIZE){ - TSK_DEBUG_ERROR("The nonce returned by the IMS CORE is too short to contain both [RAND] and [AUTHN]"); - goto bail; - } - else{ - /* Get RAND and AUTN */ - memcpy(RAND, nonce, AKA_RAND_SIZE); - memcpy(AUTN, (nonce + AKA_RAND_SIZE), AKA_AUTN_SIZE); - } - - /* Secret key */ - memcpy(K, password, (tsk_strlen(password) > AKA_K_SIZE ? AKA_K_SIZE : tsk_strlen(password))); - - /* 3GPP TS 35.205: AUTN = SQN[§AK] || AMF || MAC-A */ - memcpy(AMF, (AUTN + AKA_SQN_SIZE), AKA_AMF_SIZE); - memcpy(MAC_A, (AUTN + AKA_SQN_SIZE + AKA_AMF_SIZE), AKA_MAC_A_SIZE); - - /* compute OP */ - ComputeOP(TSIP_CHALLENGE_STACK(self)->security.operator_id); - - /* Checks that we hold the same AMF */ - for(n=0; n<AKA_AMF_SIZE; n++){ - if(AMF[n] != TSIP_CHALLENGE_STACK(self)->security.amf[n]){ - TSK_DEBUG_ERROR("IMS-AKA error: AMF <> XAMF"); - goto bail; - } - } - - /* Calculate CK, IK and AK */ - f2345(K, RAND, akares, CK, IK, AK); - - /* Calculate SQN from SQN_XOR_AK */ - for(n=0; n<AKA_SQN_SIZE; n++){ - SQN[n] = (uint8_t) (SQN_XOR_AK()[n] ^ AK[n]); - } - - /* Calculate XMAC_A */ - { - AKA_MAC_A_T XMAC_A; - memset(XMAC_A, '\0', sizeof(XMAC_A)); - - f1(K, RAND, SQN, AMF, XMAC_A); - if(!tsk_strnequals(MAC_A, XMAC_A, AKA_MAC_A_SIZE)){ - TSK_DEBUG_ERROR("IMS-AKA error: XMAC_A [%s] <> MAC_A[%s]", XMAC_A, MAC_A); - goto bail; - } - } - - /* RFC 4169 subclause 3 - The HTTP Digest password is derived from base64 encoded PRF(RES || IK||CK, "http-digest-akav2-password") - or - PRF(XRES||IK||CK, "http-digest-akav2-password") instead of (RES) or (XRES) respectively. - Where PRF ==> HMAC_MD5 function. - */ - if(TSIP_CHALLENGE_IS_AKAv2(self)){ - uint8_t res_ik_ck[AKA_RES_SIZE + AKA_IK_SIZE + AKA_CK_SIZE]; - tsk_md5digest_t md5_digest; - - memcpy(res_ik_ck, akares, AKA_RES_SIZE); - memcpy((res_ik_ck + AKA_RES_SIZE), IK, AKA_IK_SIZE); - memcpy((res_ik_ck + AKA_RES_SIZE + AKA_IK_SIZE), CK, AKA_CK_SIZE); - - if((ret = hmac_md5digest_compute((const uint8_t*)"http-digest-akav2-password", 26, (const char*)res_ik_ck, sizeof(res_ik_ck), md5_digest))){/* PRF(RES||IK||CK, ...) */ - TSK_DEBUG_ERROR("hmac_md5digest_compute() failed. AKAv2 response will be invalid."); - - ret = -3; - goto bail; - } - else{/* b64(PRF(...)) */ - if(!tsk_base64_encode(md5_digest, sizeof(md5_digest), result)){ - TSK_DEBUG_ERROR("tsk_base64_encode() failed. AKAv2 response will be invalid."); - - ret = -4; - goto bail; - } - } - } - else{ - *result = tsk_calloc(1, AKA_RES_SIZE + 1); - memcpy(*result, akares, AKA_RES_SIZE); - - ret = 0; - } - - /* Copy CK and IK */ - memcpy(self->ck, CK, AKA_CK_SIZE); - memcpy(self->ik, IK, AKA_IK_SIZE); + // § ==> XOR + // || ==> append + + AKA_RES_T akares; + + int ret = -1; + tsk_size_t n; + char *nonce = tsk_null; + + AKA_XXX_DECLARE(RAND); + AKA_XXX_DECLARE(AK); + AKA_XXX_DECLARE(AMF); + AKA_XXX_DECLARE(CK); + AKA_XXX_DECLARE(IK); + AKA_XXX_DECLARE(K); + AKA_XXX_DECLARE(SQN); + AKA_XXX_DECLARE(MAC_A); + AKA_XXX_DECLARE(AUTN); + + AKA_XXX_BZERO(RAND); + AKA_XXX_BZERO(AK); + AKA_XXX_BZERO(AMF); + AKA_XXX_BZERO(CK); + AKA_XXX_BZERO(IK); + AKA_XXX_BZERO(K); + AKA_XXX_BZERO(SQN); + AKA_XXX_BZERO(MAC_A); + AKA_XXX_BZERO(AUTN); + + /* RFC 3310 subclause 3.2: nonce = base64(RAND || AUTN || SERV_DATA) */ + n = tsk_base64_decode((const uint8_t*)self->nonce, tsk_strlen(self->nonce), &nonce); + if(n > TSK_MD5_STRING_SIZE) { + TSK_DEBUG_ERROR("The IMS CORE returned an invalid nonce."); + goto bail; + } + if(n < AKA_RAND_SIZE + AKA_AUTN_SIZE) { + TSK_DEBUG_ERROR("The nonce returned by the IMS CORE is too short to contain both [RAND] and [AUTHN]"); + goto bail; + } + else { + /* Get RAND and AUTN */ + memcpy(RAND, nonce, AKA_RAND_SIZE); + memcpy(AUTN, (nonce + AKA_RAND_SIZE), AKA_AUTN_SIZE); + } + + /* Secret key */ + memcpy(K, password, (tsk_strlen(password) > AKA_K_SIZE ? AKA_K_SIZE : tsk_strlen(password))); + + /* 3GPP TS 35.205: AUTN = SQN[§AK] || AMF || MAC-A */ + memcpy(AMF, (AUTN + AKA_SQN_SIZE), AKA_AMF_SIZE); + memcpy(MAC_A, (AUTN + AKA_SQN_SIZE + AKA_AMF_SIZE), AKA_MAC_A_SIZE); + + /* compute OP */ + ComputeOP(TSIP_CHALLENGE_STACK(self)->security.operator_id); + + /* Checks that we hold the same AMF */ + for(n=0; n<AKA_AMF_SIZE; n++) { + if(AMF[n] != TSIP_CHALLENGE_STACK(self)->security.amf[n]) { + TSK_DEBUG_ERROR("IMS-AKA error: AMF <> XAMF"); + goto bail; + } + } + + /* Calculate CK, IK and AK */ + f2345(K, RAND, akares, CK, IK, AK); + + /* Calculate SQN from SQN_XOR_AK */ + for(n=0; n<AKA_SQN_SIZE; n++) { + SQN[n] = (uint8_t) (SQN_XOR_AK()[n] ^ AK[n]); + } + + /* Calculate XMAC_A */ + { + AKA_MAC_A_T XMAC_A; + memset(XMAC_A, '\0', sizeof(XMAC_A)); + + f1(K, RAND, SQN, AMF, XMAC_A); + if(!tsk_strnequals(MAC_A, XMAC_A, AKA_MAC_A_SIZE)) { + TSK_DEBUG_ERROR("IMS-AKA error: XMAC_A [%s] <> MAC_A[%s]", XMAC_A, MAC_A); + goto bail; + } + } + + /* RFC 4169 subclause 3 + The HTTP Digest password is derived from base64 encoded PRF(RES || IK||CK, "http-digest-akav2-password") + or + PRF(XRES||IK||CK, "http-digest-akav2-password") instead of (RES) or (XRES) respectively. + Where PRF ==> HMAC_MD5 function. + */ + if(TSIP_CHALLENGE_IS_AKAv2(self)) { + uint8_t res_ik_ck[AKA_RES_SIZE + AKA_IK_SIZE + AKA_CK_SIZE]; + tsk_md5digest_t md5_digest; + + memcpy(res_ik_ck, akares, AKA_RES_SIZE); + memcpy((res_ik_ck + AKA_RES_SIZE), IK, AKA_IK_SIZE); + memcpy((res_ik_ck + AKA_RES_SIZE + AKA_IK_SIZE), CK, AKA_CK_SIZE); + + if((ret = hmac_md5digest_compute((const uint8_t*)"http-digest-akav2-password", 26, (const char*)res_ik_ck, sizeof(res_ik_ck), md5_digest))) { /* PRF(RES||IK||CK, ...) */ + TSK_DEBUG_ERROR("hmac_md5digest_compute() failed. AKAv2 response will be invalid."); + + ret = -3; + goto bail; + } + else { /* b64(PRF(...)) */ + if(!tsk_base64_encode(md5_digest, sizeof(md5_digest), result)) { + TSK_DEBUG_ERROR("tsk_base64_encode() failed. AKAv2 response will be invalid."); + + ret = -4; + goto bail; + } + } + } + else { + *result = tsk_calloc(1, AKA_RES_SIZE + 1); + memcpy(*result, akares, AKA_RES_SIZE); + + ret = 0; + } + + /* Copy CK and IK */ + memcpy(self->ck, CK, AKA_CK_SIZE); + memcpy(self->ik, IK, AKA_IK_SIZE); bail: - TSK_FREE(nonce); - return ret; + TSK_FREE(nonce); + return ret; #undef SQN_XOR_AK #undef SERVER_DATA @@ -220,124 +219,124 @@ bail: int tsip_challenge_get_response(tsip_challenge_t *self, const char* method, const char* uristring, const tsk_buffer_t* entity_body, tsk_md5string_t* response) { - if(TSIP_CHALLENGE_IS_DIGEST(self) && self->stack){ - tsk_md5string_t ha1, ha2; - nonce_count_t nc; - - /* === - Calculate HA1 = MD5(A1) = M5(username:realm:secret) - In case of AKAv1-MD5 and AKAv2-MD5 the secret must be computed as per RFC 3310 + 3GPP TS 206/7/8/9. - The resulting AKA RES parameter is treated as a "password"/"secret" when calculating the response directive of RFC 2617. - */ - if(TSIP_CHALLENGE_IS_AKAv1(self) || TSIP_CHALLENGE_IS_AKAv2(self)){ - char* akaresult = tsk_null; - tsip_challenge_get_akares(self, TSIP_CHALLENGE_STACK(self)->identity.password, &akaresult); - if(thttp_auth_digest_HA1(TSIP_CHALLENGE_USERNAME(self), self->realm, akaresult, &ha1)){ - // return -1; - } - TSK_FREE(akaresult); - } - else{ - if(!tsk_strnullORempty(self->ha1_hexstr)){ - // use HA1 provide be the user (e.g. webrtc2sip server will need this to authenticate INVITEs when acting as b2bua) - memset(ha1, 0, sizeof(tsk_md5string_t)); - memcpy(ha1, self->ha1_hexstr, (TSK_MD5_DIGEST_SIZE << 1)); - } - else{ - thttp_auth_digest_HA1(TSIP_CHALLENGE_USERNAME(self), self->realm, TSIP_CHALLENGE_STACK(self)->identity.password, &ha1); - } - } - - /* === - HA2 - */ - thttp_auth_digest_HA2(method, - uristring, - entity_body, - self->qop, - &ha2); - - /* RESPONSE */ - if(self->nc){ - THTTP_NCOUNT_2_STRING(self->nc, nc); - } - thttp_auth_digest_response((const tsk_md5string_t *)&ha1, - self->nonce, - nc, - self->cnonce, - self->qop, - (const tsk_md5string_t *)&ha2, - response); - - if(self->qop){ - self->nc++; - } - - return 0; - } - return -1; + if(TSIP_CHALLENGE_IS_DIGEST(self) && self->stack) { + tsk_md5string_t ha1, ha2; + nonce_count_t nc; + + /* === + Calculate HA1 = MD5(A1) = M5(username:realm:secret) + In case of AKAv1-MD5 and AKAv2-MD5 the secret must be computed as per RFC 3310 + 3GPP TS 206/7/8/9. + The resulting AKA RES parameter is treated as a "password"/"secret" when calculating the response directive of RFC 2617. + */ + if(TSIP_CHALLENGE_IS_AKAv1(self) || TSIP_CHALLENGE_IS_AKAv2(self)) { + char* akaresult = tsk_null; + tsip_challenge_get_akares(self, TSIP_CHALLENGE_STACK(self)->identity.password, &akaresult); + if(thttp_auth_digest_HA1(TSIP_CHALLENGE_USERNAME(self), self->realm, akaresult, &ha1)) { + // return -1; + } + TSK_FREE(akaresult); + } + else { + if(!tsk_strnullORempty(self->ha1_hexstr)) { + // use HA1 provide be the user (e.g. webrtc2sip server will need this to authenticate INVITEs when acting as b2bua) + memset(ha1, 0, sizeof(tsk_md5string_t)); + memcpy(ha1, self->ha1_hexstr, (TSK_MD5_DIGEST_SIZE << 1)); + } + else { + thttp_auth_digest_HA1(TSIP_CHALLENGE_USERNAME(self), self->realm, TSIP_CHALLENGE_STACK(self)->identity.password, &ha1); + } + } + + /* === + HA2 + */ + thttp_auth_digest_HA2(method, + uristring, + entity_body, + self->qop, + &ha2); + + /* RESPONSE */ + if(self->nc) { + THTTP_NCOUNT_2_STRING(self->nc, nc); + } + thttp_auth_digest_response((const tsk_md5string_t *)&ha1, + self->nonce, + nc, + self->cnonce, + self->qop, + (const tsk_md5string_t *)&ha2, + response); + + if(self->qop) { + self->nc++; + } + + return 0; + } + return -1; } int tsip_challenge_update(tsip_challenge_t *self, const char* scheme, const char* realm, const char* nonce, const char* opaque, const char* algorithm, const char* qop) { - if(self){ - int noncechanged = !tsk_striequals(self->nonce, nonce); - - tsk_strupdate(&self->scheme, scheme); - tsk_strupdate(&self->realm, realm); - tsk_strupdate(&self->nonce, nonce); - tsk_strupdate(&self->opaque, opaque); - tsk_strupdate(&self->algorithm, algorithm); - if(qop){ - self->qop = tsk_strcontains(qop, tsk_strlen(qop), "auth-int") ? "auth-int" : - (tsk_strcontains(qop, tsk_strlen(qop), "auth") ? "auth" : tsk_null); - } - - if(noncechanged && self->qop){ - tsip_challenge_reset_cnonce(self); - } - return 0; - } - return -1; + if(self) { + int noncechanged = !tsk_striequals(self->nonce, nonce); + + tsk_strupdate(&self->scheme, scheme); + tsk_strupdate(&self->realm, realm); + tsk_strupdate(&self->nonce, nonce); + tsk_strupdate(&self->opaque, opaque); + tsk_strupdate(&self->algorithm, algorithm); + if(qop) { + self->qop = tsk_strcontains(qop, tsk_strlen(qop), "auth-int") ? "auth-int" : + (tsk_strcontains(qop, tsk_strlen(qop), "auth") ? "auth" : tsk_null); + } + + if(noncechanged && self->qop) { + tsip_challenge_reset_cnonce(self); + } + return 0; + } + return -1; } int tsip_challenge_set_cred(tsip_challenge_t *self, const char* username, const char* ha1_hexstr) { - if(!self || tsk_strlen(ha1_hexstr) != (TSK_MD5_DIGEST_SIZE << 1)){ - TSK_DEBUG_ERROR("Invalid parameter"); - return -1; - } - tsk_strupdate(&self->username, username); - tsk_strupdate(&self->ha1_hexstr, ha1_hexstr); - return 0; + if(!self || tsk_strlen(ha1_hexstr) != (TSK_MD5_DIGEST_SIZE << 1)) { + TSK_DEBUG_ERROR("Invalid parameter"); + return -1; + } + tsk_strupdate(&self->username, username); + tsk_strupdate(&self->ha1_hexstr, ha1_hexstr); + return 0; } tsip_header_t *tsip_challenge_create_header_authorization(tsip_challenge_t *self, const tsip_request_t *request) { - tsk_md5string_t response; - nonce_count_t nc; - char *uristring = tsk_null; - tsip_header_t *header = tsk_null; - - if(!self || !self->stack || !request){ - goto bail; - } - - if(!(uristring = tsip_uri_tostring(request->line.request.uri, tsk_true, tsk_false))){ - TSK_DEBUG_ERROR("Failed to parse URI: %s", uristring); - goto bail; - } - - /* We compute the nc here because @ref tsip_challenge_get_response function will increment it's value. */ - if(self->nc){ - THTTP_NCOUNT_2_STRING(self->nc, nc); - } - - /* entity_body ==> request-content */ - if(tsip_challenge_get_response(self, request->line.request.method, uristring, request->Content, &response)){ - goto bail; - } - + tsk_md5string_t response; + nonce_count_t nc; + char *uristring = tsk_null; + tsip_header_t *header = tsk_null; + + if(!self || !self->stack || !request) { + goto bail; + } + + if(!(uristring = tsip_uri_tostring(request->line.request.uri, tsk_true, tsk_false))) { + TSK_DEBUG_ERROR("Failed to parse URI: %s", uristring); + goto bail; + } + + /* We compute the nc here because @ref tsip_challenge_get_response function will increment it's value. */ + if(self->nc) { + THTTP_NCOUNT_2_STRING(self->nc, nc); + } + + /* entity_body ==> request-content */ + if(tsip_challenge_get_response(self, request->line.request.method, uristring, request->Content, &response)) { + goto bail; + } + #define TSIP_AUTH_COPY_VALUES(hdr) \ hdr->username = tsk_strdup(TSIP_CHALLENGE_USERNAME(self)); \ @@ -351,40 +350,40 @@ tsip_header_t *tsip_challenge_create_header_authorization(tsip_challenge_t *self hdr->uri = tsk_strdup(uristring); \ hdr->nc = self->nc? tsk_strdup(nc) : 0; \ hdr->response = tsk_strdup(response); \ - - if(self->isproxy){ - tsip_header_Proxy_Authorization_t *proxy_auth = tsip_header_Proxy_Authorization_create(); - TSIP_AUTH_COPY_VALUES(proxy_auth); - header = TSIP_HEADER(proxy_auth); - } - else{ - tsip_header_Authorization_t *auth = tsip_header_Authorization_create(); - TSIP_AUTH_COPY_VALUES(auth); - header = TSIP_HEADER(auth); - } + + if(self->isproxy) { + tsip_header_Proxy_Authorization_t *proxy_auth = tsip_header_Proxy_Authorization_create(); + TSIP_AUTH_COPY_VALUES(proxy_auth); + header = TSIP_HEADER(proxy_auth); + } + else { + tsip_header_Authorization_t *auth = tsip_header_Authorization_create(); + TSIP_AUTH_COPY_VALUES(auth); + header = TSIP_HEADER(auth); + } bail: - TSK_FREE(uristring); + TSK_FREE(uristring); - return header; + return header; #undef TSIP_AUTH_COPY_VALUES } tsip_header_t *tsip_challenge_create_empty_header_authorization(const char* username, const char* realm, const char* uristring) { - tsip_header_Authorization_t *header = tsip_header_Authorization_create(); - - if(header){ - header->scheme = tsk_strdup("Digest"); - header->username = tsk_strdup(username); - header->realm = tsk_strdup(realm); - header->nonce = tsk_strdup(""); - header->response = tsk_strdup(""); - header->uri = tsk_strdup(uristring); - } - - return TSIP_HEADER(header); + tsip_header_Authorization_t *header = tsip_header_Authorization_create(); + + if(header) { + header->scheme = tsk_strdup("Digest"); + header->username = tsk_strdup(username); + header->realm = tsk_strdup(realm); + header->nonce = tsk_strdup(""); + header->response = tsk_strdup(""); + header->uri = tsk_strdup(uristring); + } + + return TSIP_HEADER(header); } @@ -419,59 +418,60 @@ tsip_header_t *tsip_challenge_create_empty_header_authorization(const char* user */ static tsk_object_t* tsip_challenge_ctor(tsk_object_t *self, va_list * app) { - tsip_challenge_t *challenge = self; - if(challenge){ - const char* qop; - - challenge->stack = va_arg(*app, const tsip_stack_handle_t *); - challenge->isproxy = va_arg(*app, tsk_bool_t); - challenge->username = tsk_strdup(((const struct tsip_stack_s*)challenge->stack)->identity.impi); - challenge->scheme = tsk_strdup(va_arg(*app, const char*)); - challenge->realm = tsk_strdup(va_arg(*app, const char*)); - challenge->nonce = tsk_strdup(va_arg(*app, const char*)); - challenge->opaque = tsk_strdup(va_arg(*app, const char*)); - challenge->algorithm = tsk_strdup(va_arg(*app, const char*)); - qop = va_arg(*app, const char*); - if(qop){ - challenge->qop = tsk_strcontains(qop, tsk_strlen(qop), "auth-int") ? "auth-int" : - (tsk_strcontains(qop, tsk_strlen(qop), "auth") ? "auth" : tsk_null); - } - - if(challenge->qop){ - tsip_challenge_reset_cnonce(challenge); - } - } - else TSK_DEBUG_ERROR("Failed to create new sip challenge object."); - - return self; + tsip_challenge_t *challenge = self; + if(challenge) { + const char* qop; + + challenge->stack = va_arg(*app, const tsip_stack_handle_t *); + challenge->isproxy = va_arg(*app, tsk_bool_t); + challenge->username = tsk_strdup(((const struct tsip_stack_s*)challenge->stack)->identity.impi); + challenge->scheme = tsk_strdup(va_arg(*app, const char*)); + challenge->realm = tsk_strdup(va_arg(*app, const char*)); + challenge->nonce = tsk_strdup(va_arg(*app, const char*)); + challenge->opaque = tsk_strdup(va_arg(*app, const char*)); + challenge->algorithm = tsk_strdup(va_arg(*app, const char*)); + qop = va_arg(*app, const char*); + if(qop) { + challenge->qop = tsk_strcontains(qop, tsk_strlen(qop), "auth-int") ? "auth-int" : + (tsk_strcontains(qop, tsk_strlen(qop), "auth") ? "auth" : tsk_null); + } + + if(challenge->qop) { + tsip_challenge_reset_cnonce(challenge); + } + } + else { + TSK_DEBUG_ERROR("Failed to create new sip challenge object."); + } + + return self; } /**@ingroup tsip_challenge_group */ static tsk_object_t* tsip_challenge_dtor(tsk_object_t *self) { - tsip_challenge_t *challenge = self; - if(challenge){ - TSK_FREE(challenge->username); - TSK_FREE(challenge->scheme); - TSK_FREE(challenge->realm); - TSK_FREE(challenge->nonce); - TSK_FREE(challenge->opaque); - TSK_FREE(challenge->algorithm); - TSK_FREE(challenge->ha1_hexstr); - } - else{ - TSK_DEBUG_ERROR("Null SIP challenge object."); - } - - return self; + tsip_challenge_t *challenge = self; + if(challenge) { + TSK_FREE(challenge->username); + TSK_FREE(challenge->scheme); + TSK_FREE(challenge->realm); + TSK_FREE(challenge->nonce); + TSK_FREE(challenge->opaque); + TSK_FREE(challenge->algorithm); + TSK_FREE(challenge->ha1_hexstr); + } + else { + TSK_DEBUG_ERROR("Null SIP challenge object."); + } + + return self; } -static const tsk_object_def_t tsip_challenge_def_s = -{ - sizeof(tsip_challenge_t), - tsip_challenge_ctor, - tsip_challenge_dtor, - tsk_null +static const tsk_object_def_t tsip_challenge_def_s = { + sizeof(tsip_challenge_t), + tsip_challenge_ctor, + tsip_challenge_dtor, + tsk_null }; const tsk_object_def_t *tsip_challenge_def_t = &tsip_challenge_def_s; diff --git a/tinySIP/src/authentication/tsip_milenage.c b/tinySIP/src/authentication/tsip_milenage.c index 3fd19e2..0c95e4a 100755 --- a/tinySIP/src/authentication/tsip_milenage.c +++ b/tinySIP/src/authentication/tsip_milenage.c @@ -2,19 +2,19 @@ * Partial 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. * @@ -42,7 +42,7 @@ * * This has been coded for clarity, not necessarily for efficiency. * -* The functions f2, f3, f4 and f5 share the same inputs and have +* The functions f2, f3, f4 and f5 share the same inputs and have * been coded together as a single function. f1, f1* and f5* are * all coded separately. * @@ -60,7 +60,8 @@ // 0xff, 0x14, 0xc1, 0xf4, 0x5f, 0x88, 0x73, 0x7d}; /*------- Insert your value of OP here -------*/ uint8_t OP[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; /*------------------------------------------------------------------- * Algorithm f1 @@ -72,58 +73,58 @@ uint8_t OP[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, * *-----------------------------------------------------------------*/ -void f1 ( uint8_t k[16], uint8_t rand[16], uint8_t sqn[6], uint8_t amf[2], - uint8_t mac_a[8] ) +void f1 ( uint8_t k[16], uint8_t rand[16], uint8_t sqn[6], uint8_t amf[2], + uint8_t mac_a[8] ) { - uint8_t op_c[16]; - uint8_t temp[16]; - uint8_t in1[16]; - uint8_t out1[16]; - uint8_t rijndaelInput[16]; - uint8_t i; + uint8_t op_c[16]; + uint8_t temp[16]; + uint8_t in1[16]; + uint8_t out1[16]; + uint8_t rijndaelInput[16]; + uint8_t i; - RijndaelKeySchedule( k ); + RijndaelKeySchedule( k ); - ComputeOPc( op_c ); + ComputeOPc( op_c ); - for (i=0; i<16; i++){ - rijndaelInput[i] = rand[i] ^ op_c[i]; - } - RijndaelEncrypt( rijndaelInput, temp ); + for (i=0; i<16; i++) { + rijndaelInput[i] = rand[i] ^ op_c[i]; + } + RijndaelEncrypt( rijndaelInput, temp ); - for (i=0; i<6; i++){ - in1[i] = sqn[i]; - in1[i+8] = sqn[i]; - } + for (i=0; i<6; i++) { + in1[i] = sqn[i]; + in1[i+8] = sqn[i]; + } - for (i=0; i<2; i++){ - in1[i+6] = amf[i]; - in1[i+14] = amf[i]; - } + for (i=0; i<2; i++) { + in1[i+6] = amf[i]; + in1[i+14] = amf[i]; + } - /* XOR op_c and in1, rotate by r1=64, and XOR * - * on the constant c1 (which is all zeroes) */ + /* XOR op_c and in1, rotate by r1=64, and XOR * + * on the constant c1 (which is all zeroes) */ - for (i=0; i<16; i++){ - rijndaelInput[(i+8) % 16] = in1[i] ^ op_c[i]; - } + for (i=0; i<16; i++) { + rijndaelInput[(i+8) % 16] = in1[i] ^ op_c[i]; + } - /* XOR on the value temp computed before */ + /* XOR on the value temp computed before */ - for (i=0; i<16; i++){ - rijndaelInput[i] ^= temp[i]; - } + for (i=0; i<16; i++) { + rijndaelInput[i] ^= temp[i]; + } - RijndaelEncrypt( rijndaelInput, out1 ); - for (i=0; i<16; i++){ - out1[i] ^= op_c[i]; - } + RijndaelEncrypt( rijndaelInput, out1 ); + for (i=0; i<16; i++) { + out1[i] ^= op_c[i]; + } - for (i=0; i<8; i++){ - mac_a[i] = out1[i]; - } + for (i=0; i<8; i++) { + mac_a[i] = out1[i]; + } - return; + return; } /* end of function f1 */ @@ -138,81 +139,81 @@ void f1 ( uint8_t k[16], uint8_t rand[16], uint8_t sqn[6], uint8_t amf[2], *-----------------------------------------------------------------*/ void f2345 ( uint8_t k[16], uint8_t rand[16], - uint8_t res[8], uint8_t ck[16], uint8_t ik[16], uint8_t ak[6] ) + uint8_t res[8], uint8_t ck[16], uint8_t ik[16], uint8_t ak[6] ) { - uint8_t op_c[16]; - uint8_t temp[16]; - uint8_t out[16]; - uint8_t rijndaelInput[16]; - uint8_t i; - - RijndaelKeySchedule( k ); - - ComputeOPc( op_c ); - - for (i=0; i<16; i++){ - rijndaelInput[i] = rand[i] ^ op_c[i]; - } - RijndaelEncrypt( rijndaelInput, temp ); - - /* To obtain output block OUT2: XOR OPc and TEMP, * - * rotate by r2=0, and XOR on the constant c2 (which * - * is all zeroes except that the last bit is 1). */ - - for (i=0; i<16; i++){ - rijndaelInput[i] = temp[i] ^ op_c[i]; - } - rijndaelInput[15] ^= 1; - - RijndaelEncrypt( rijndaelInput, out ); - for (i=0; i<16; i++){ - out[i] ^= op_c[i]; - } - - for (i=0; i<8; i++){ - res[i] = out[i+8]; - } - for (i=0; i<6; i++){ - ak[i] = out[i]; - } - - /* To obtain output block OUT3: XOR OPc and TEMP, * - * rotate by r3=32, and XOR on the constant c3 (which * - * is all zeroes except that the next to last bit is 1). */ - - for (i=0; i<16; i++){ - rijndaelInput[(i+12) % 16] = temp[i] ^ op_c[i]; - } - rijndaelInput[15] ^= 2; - - RijndaelEncrypt( rijndaelInput, out ); - for (i=0; i<16; i++){ - out[i] ^= op_c[i]; - } - - for (i=0; i<16; i++){ - ck[i] = out[i]; - } - - /* To obtain output block OUT4: XOR OPc and TEMP, * - * rotate by r4=64, and XOR on the constant c4 (which * - * is all zeroes except that the 2nd from last bit is 1). */ - - for (i=0; i<16; i++){ - rijndaelInput[(i+8) % 16] = temp[i] ^ op_c[i]; - } - rijndaelInput[15] ^= 4; - - RijndaelEncrypt( rijndaelInput, out ); - for (i=0; i<16; i++){ - out[i] ^= op_c[i]; - } - - for (i=0; i<16; i++){ - ik[i] = out[i]; - } - - return; + uint8_t op_c[16]; + uint8_t temp[16]; + uint8_t out[16]; + uint8_t rijndaelInput[16]; + uint8_t i; + + RijndaelKeySchedule( k ); + + ComputeOPc( op_c ); + + for (i=0; i<16; i++) { + rijndaelInput[i] = rand[i] ^ op_c[i]; + } + RijndaelEncrypt( rijndaelInput, temp ); + + /* To obtain output block OUT2: XOR OPc and TEMP, * + * rotate by r2=0, and XOR on the constant c2 (which * + * is all zeroes except that the last bit is 1). */ + + for (i=0; i<16; i++) { + rijndaelInput[i] = temp[i] ^ op_c[i]; + } + rijndaelInput[15] ^= 1; + + RijndaelEncrypt( rijndaelInput, out ); + for (i=0; i<16; i++) { + out[i] ^= op_c[i]; + } + + for (i=0; i<8; i++) { + res[i] = out[i+8]; + } + for (i=0; i<6; i++) { + ak[i] = out[i]; + } + + /* To obtain output block OUT3: XOR OPc and TEMP, * + * rotate by r3=32, and XOR on the constant c3 (which * + * is all zeroes except that the next to last bit is 1). */ + + for (i=0; i<16; i++) { + rijndaelInput[(i+12) % 16] = temp[i] ^ op_c[i]; + } + rijndaelInput[15] ^= 2; + + RijndaelEncrypt( rijndaelInput, out ); + for (i=0; i<16; i++) { + out[i] ^= op_c[i]; + } + + for (i=0; i<16; i++) { + ck[i] = out[i]; + } + + /* To obtain output block OUT4: XOR OPc and TEMP, * + * rotate by r4=64, and XOR on the constant c4 (which * + * is all zeroes except that the 2nd from last bit is 1). */ + + for (i=0; i<16; i++) { + rijndaelInput[(i+8) % 16] = temp[i] ^ op_c[i]; + } + rijndaelInput[15] ^= 4; + + RijndaelEncrypt( rijndaelInput, out ); + for (i=0; i<16; i++) { + out[i] ^= op_c[i]; + } + + for (i=0; i<16; i++) { + ik[i] = out[i]; + } + + return; } /* end of function f2345 */ @@ -226,57 +227,57 @@ void f2345 ( uint8_t k[16], uint8_t rand[16], * *-----------------------------------------------------------------*/ -void f1star( uint8_t k[16], uint8_t rand[16], uint8_t sqn[6], uint8_t amf[2], - uint8_t mac_s[8] ) +void f1star( uint8_t k[16], uint8_t rand[16], uint8_t sqn[6], uint8_t amf[2], + uint8_t mac_s[8] ) { - uint8_t op_c[16]; - uint8_t temp[16]; - uint8_t in1[16]; - uint8_t out1[16]; - uint8_t rijndaelInput[16]; - uint8_t i; - - RijndaelKeySchedule( k ); - - ComputeOPc( op_c ); - - for (i=0; i<16; i++){ - rijndaelInput[i] = rand[i] ^ op_c[i]; - } - RijndaelEncrypt( rijndaelInput, temp ); - - for (i=0; i<6; i++){ - in1[i] = sqn[i]; - in1[i+8] = sqn[i]; - } - for (i=0; i<2; i++){ - in1[i+6] = amf[i]; - in1[i+14] = amf[i]; - } - - /* XOR op_c and in1, rotate by r1=64, and XOR * - * on the constant c1 (which is all zeroes) */ - - for (i=0; i<16; i++){ - rijndaelInput[(i+8) % 16] = in1[i] ^ op_c[i]; - } - - /* XOR on the value temp computed before */ - - for (i=0; i<16; i++){ - rijndaelInput[i] ^= temp[i]; - } - - RijndaelEncrypt( rijndaelInput, out1 ); - for (i=0; i<16; i++){ - out1[i] ^= op_c[i]; - } - - for (i=0; i<8; i++){ - mac_s[i] = out1[i+8]; - } - - return; + uint8_t op_c[16]; + uint8_t temp[16]; + uint8_t in1[16]; + uint8_t out1[16]; + uint8_t rijndaelInput[16]; + uint8_t i; + + RijndaelKeySchedule( k ); + + ComputeOPc( op_c ); + + for (i=0; i<16; i++) { + rijndaelInput[i] = rand[i] ^ op_c[i]; + } + RijndaelEncrypt( rijndaelInput, temp ); + + for (i=0; i<6; i++) { + in1[i] = sqn[i]; + in1[i+8] = sqn[i]; + } + for (i=0; i<2; i++) { + in1[i+6] = amf[i]; + in1[i+14] = amf[i]; + } + + /* XOR op_c and in1, rotate by r1=64, and XOR * + * on the constant c1 (which is all zeroes) */ + + for (i=0; i<16; i++) { + rijndaelInput[(i+8) % 16] = in1[i] ^ op_c[i]; + } + + /* XOR on the value temp computed before */ + + for (i=0; i<16; i++) { + rijndaelInput[i] ^= temp[i]; + } + + RijndaelEncrypt( rijndaelInput, out1 ); + for (i=0; i<16; i++) { + out1[i] ^= op_c[i]; + } + + for (i=0; i<8; i++) { + mac_s[i] = out1[i+8]; + } + + return; } /* end of function f1star */ @@ -290,38 +291,42 @@ void f1star( uint8_t k[16], uint8_t rand[16], uint8_t sqn[6], uint8_t amf[2], *-----------------------------------------------------------------*/ void f5star( uint8_t k[16], uint8_t rand[16], - uint8_t ak[6] ) + uint8_t ak[6] ) { - uint8_t op_c[16]; - uint8_t temp[16]; - uint8_t out[16]; - uint8_t rijndaelInput[16]; - uint8_t i; + uint8_t op_c[16]; + uint8_t temp[16]; + uint8_t out[16]; + uint8_t rijndaelInput[16]; + uint8_t i; - RijndaelKeySchedule( k ); + RijndaelKeySchedule( k ); - ComputeOPc( op_c ); + ComputeOPc( op_c ); - for (i=0; i<16; i++) - rijndaelInput[i] = rand[i] ^ op_c[i]; - RijndaelEncrypt( rijndaelInput, temp ); + for (i=0; i<16; i++) { + rijndaelInput[i] = rand[i] ^ op_c[i]; + } + RijndaelEncrypt( rijndaelInput, temp ); - /* To obtain output block OUT5: XOR OPc and TEMP, * - * rotate by r5=96, and XOR on the constant c5 (which * - * is all zeroes except that the 3rd from last bit is 1). */ + /* To obtain output block OUT5: XOR OPc and TEMP, * + * rotate by r5=96, and XOR on the constant c5 (which * + * is all zeroes except that the 3rd from last bit is 1). */ - for (i=0; i<16; i++) - rijndaelInput[(i+4) % 16] = temp[i] ^ op_c[i]; - rijndaelInput[15] ^= 8; + for (i=0; i<16; i++) { + rijndaelInput[(i+4) % 16] = temp[i] ^ op_c[i]; + } + rijndaelInput[15] ^= 8; - RijndaelEncrypt( rijndaelInput, out ); - for (i=0; i<16; i++) - out[i] ^= op_c[i]; + RijndaelEncrypt( rijndaelInput, out ); + for (i=0; i<16; i++) { + out[i] ^= op_c[i]; + } - for (i=0; i<6; i++) - ak[i] = out[i]; + for (i=0; i<6; i++) { + ak[i] = out[i]; + } - return; + return; } /* end of function f5star */ @@ -332,19 +337,20 @@ already been performed. void ComputeOPc( uint8_t op_c[16] ) { - uint8_t i; + uint8_t i; - RijndaelEncrypt( OP, op_c ); - for (i=0; i<16; i++){ - op_c[i] ^= OP[i]; - } + RijndaelEncrypt( OP, op_c ); + for (i=0; i<16; i++) { + op_c[i] ^= OP[i]; + } - return; + return; } /* end of function ComputeOPc */ -void ComputeOP( uint8_t op[16] ){ - int i; - for(i=0;i<16;i++){ - OP[i]=op[i]; - } +void ComputeOP( uint8_t op[16] ) +{ + int i; + for(i=0; i<16; i++) { + OP[i]=op[i]; + } } diff --git a/tinySIP/src/authentication/tsip_rijndael.c b/tinySIP/src/authentication/tsip_rijndael.c index ddcd89f..c0cddff 100755 --- a/tinySIP/src/authentication/tsip_rijndael.c +++ b/tinySIP/src/authentication/tsip_rijndael.c @@ -2,19 +2,19 @@ * Partial 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. * @@ -79,316 +79,316 @@ #elif defined(__GNUC__) && !defined(__APPLE__) # define __INLINE __inline #else -# define __INLINE +# define __INLINE #endif -__INLINE uint32_t byte_swap(uint32_t x){ +__INLINE uint32_t byte_swap(uint32_t x) +{ return rot1(x) & 0x00ff00ff | rot3(x) & 0xff00ff00; } -__INLINE uint32_t u32_in(const uint8_t x[]){ - if(tnet_is_BE()){ - return byte_swap(*(uint32_t*)x); - } - else{ - return (*(uint32_t*)(x)); - } +__INLINE uint32_t u32_in(const uint8_t x[]) +{ + if(tnet_is_BE()) { + return byte_swap(*(uint32_t*)x); + } + else { + return (*(uint32_t*)(x)); + } } -__INLINE void u32_out(uint8_t x[], const uint32_t v){ - if(tnet_is_BE()){ - *(uint32_t*)x = byte_swap(v); - } - else{ - (*(uint32_t*)(x) = v); - } +__INLINE void u32_out(uint8_t x[], const uint32_t v) +{ + if(tnet_is_BE()) { + *(uint32_t*)x = byte_swap(v); + } + else { + (*(uint32_t*)(x) = v); + } } /*--------------- The lookup tables ----------------------------*/ -static uint32_t rnd_con[10] = -{ - 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36 +static uint32_t rnd_con[10] = { + 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36 }; -static uint32_t ft_tab[4][256] = -{ - { - 0xA56363C6,0x847C7CF8,0x997777EE,0x8D7B7BF6,0x0DF2F2FF,0xBD6B6BD6,0xB16F6FDE,0x54C5C591, - 0x50303060,0x03010102,0xA96767CE,0x7D2B2B56,0x19FEFEE7,0x62D7D7B5,0xE6ABAB4D,0x9A7676EC, - 0x45CACA8F,0x9D82821F,0x40C9C989,0x877D7DFA,0x15FAFAEF,0xEB5959B2,0xC947478E,0x0BF0F0FB, - 0xECADAD41,0x67D4D4B3,0xFDA2A25F,0xEAAFAF45,0xBF9C9C23,0xF7A4A453,0x967272E4,0x5BC0C09B, - 0xC2B7B775,0x1CFDFDE1,0xAE93933D,0x6A26264C,0x5A36366C,0x413F3F7E,0x02F7F7F5,0x4FCCCC83, - 0x5C343468,0xF4A5A551,0x34E5E5D1,0x08F1F1F9,0x937171E2,0x73D8D8AB,0x53313162,0x3F15152A, - 0x0C040408,0x52C7C795,0x65232346,0x5EC3C39D,0x28181830,0xA1969637,0x0F05050A,0xB59A9A2F, - 0x0907070E,0x36121224,0x9B80801B,0x3DE2E2DF,0x26EBEBCD,0x6927274E,0xCDB2B27F,0x9F7575EA, - 0x1B090912,0x9E83831D,0x742C2C58,0x2E1A1A34,0x2D1B1B36,0xB26E6EDC,0xEE5A5AB4,0xFBA0A05B, - 0xF65252A4,0x4D3B3B76,0x61D6D6B7,0xCEB3B37D,0x7B292952,0x3EE3E3DD,0x712F2F5E,0x97848413, - 0xF55353A6,0x68D1D1B9,0000000000,0x2CEDEDC1,0x60202040,0x1FFCFCE3,0xC8B1B179,0xED5B5BB6, - 0xBE6A6AD4,0x46CBCB8D,0xD9BEBE67,0x4B393972,0xDE4A4A94,0xD44C4C98,0xE85858B0,0x4ACFCF85, - 0x6BD0D0BB,0x2AEFEFC5,0xE5AAAA4F,0x16FBFBED,0xC5434386,0xD74D4D9A,0x55333366,0x94858511, - 0xCF45458A,0x10F9F9E9,0x06020204,0x817F7FFE,0xF05050A0,0x443C3C78,0xBA9F9F25,0xE3A8A84B, - 0xF35151A2,0xFEA3A35D,0xC0404080,0x8A8F8F05,0xAD92923F,0xBC9D9D21,0x48383870,0x04F5F5F1, - 0xDFBCBC63,0xC1B6B677,0x75DADAAF,0x63212142,0x30101020,0x1AFFFFE5,0x0EF3F3FD,0x6DD2D2BF, - 0x4CCDCD81,0x140C0C18,0x35131326,0x2FECECC3,0xE15F5FBE,0xA2979735,0xCC444488,0x3917172E, - 0x57C4C493,0xF2A7A755,0x827E7EFC,0x473D3D7A,0xAC6464C8,0xE75D5DBA,0x2B191932,0x957373E6, - 0xA06060C0,0x98818119,0xD14F4F9E,0x7FDCDCA3,0x66222244,0x7E2A2A54,0xAB90903B,0x8388880B, - 0xCA46468C,0x29EEEEC7,0xD3B8B86B,0x3C141428,0x79DEDEA7,0xE25E5EBC,0x1D0B0B16,0x76DBDBAD, - 0x3BE0E0DB,0x56323264,0x4E3A3A74,0x1E0A0A14,0xDB494992,0x0A06060C,0x6C242448,0xE45C5CB8, - 0x5DC2C29F,0x6ED3D3BD,0xEFACAC43,0xA66262C4,0xA8919139,0xA4959531,0x37E4E4D3,0x8B7979F2, - 0x32E7E7D5,0x43C8C88B,0x5937376E,0xB76D6DDA,0x8C8D8D01,0x64D5D5B1,0xD24E4E9C,0xE0A9A949, - 0xB46C6CD8,0xFA5656AC,0x07F4F4F3,0x25EAEACF,0xAF6565CA,0x8E7A7AF4,0xE9AEAE47,0x18080810, - 0xD5BABA6F,0x887878F0,0x6F25254A,0x722E2E5C,0x241C1C38,0xF1A6A657,0xC7B4B473,0x51C6C697, - 0x23E8E8CB,0x7CDDDDA1,0x9C7474E8,0x211F1F3E,0xDD4B4B96,0xDCBDBD61,0x868B8B0D,0x858A8A0F, - 0x907070E0,0x423E3E7C,0xC4B5B571,0xAA6666CC,0xD8484890,0x05030306,0x01F6F6F7,0x120E0E1C, - 0xA36161C2,0x5F35356A,0xF95757AE,0xD0B9B969,0x91868617,0x58C1C199,0x271D1D3A,0xB99E9E27, - 0x38E1E1D9,0x13F8F8EB,0xB398982B,0x33111122,0xBB6969D2,0x70D9D9A9,0x898E8E07,0xA7949433, - 0xB69B9B2D,0x221E1E3C,0x92878715,0x20E9E9C9,0x49CECE87,0xFF5555AA,0x78282850,0x7ADFDFA5, - 0x8F8C8C03,0xF8A1A159,0x80898909,0x170D0D1A,0xDABFBF65,0x31E6E6D7,0xC6424284,0xB86868D0, - 0xC3414182,0xB0999929,0x772D2D5A,0x110F0F1E,0xCBB0B07B,0xFC5454A8,0xD6BBBB6D,0x3A16162C - }, - { - 0x6363C6A5,0x7C7CF884,0x7777EE99,0x7B7BF68D,0xF2F2FF0D,0x6B6BD6BD,0x6F6FDEB1,0xC5C59154, - 0x30306050,0x01010203,0x6767CEA9,0x2B2B567D,0xFEFEE719,0xD7D7B562,0xABAB4DE6,0x7676EC9A, - 0xCACA8F45,0x82821F9D,0xC9C98940,0x7D7DFA87,0xFAFAEF15,0x5959B2EB,0x47478EC9,0xF0F0FB0B, - 0xADAD41EC,0xD4D4B367,0xA2A25FFD,0xAFAF45EA,0x9C9C23BF,0xA4A453F7,0x7272E496,0xC0C09B5B, - 0xB7B775C2,0xFDFDE11C,0x93933DAE,0x26264C6A,0x36366C5A,0x3F3F7E41,0xF7F7F502,0xCCCC834F, - 0x3434685C,0xA5A551F4,0xE5E5D134,0xF1F1F908,0x7171E293,0xD8D8AB73,0x31316253,0x15152A3F, - 0x0404080C,0xC7C79552,0x23234665,0xC3C39D5E,0x18183028,0x969637A1,0x05050A0F,0x9A9A2FB5, - 0x07070E09,0x12122436,0x80801B9B,0xE2E2DF3D,0xEBEBCD26,0x27274E69,0xB2B27FCD,0x7575EA9F, - 0x0909121B,0x83831D9E,0x2C2C5874,0x1A1A342E,0x1B1B362D,0x6E6EDCB2,0x5A5AB4EE,0xA0A05BFB, - 0x5252A4F6,0x3B3B764D,0xD6D6B761,0xB3B37DCE,0x2929527B,0xE3E3DD3E,0x2F2F5E71,0x84841397, - 0x5353A6F5,0xD1D1B968,0000000000,0xEDEDC12C,0x20204060,0xFCFCE31F,0xB1B179C8,0x5B5BB6ED, - 0x6A6AD4BE,0xCBCB8D46,0xBEBE67D9,0x3939724B,0x4A4A94DE,0x4C4C98D4,0x5858B0E8,0xCFCF854A, - 0xD0D0BB6B,0xEFEFC52A,0xAAAA4FE5,0xFBFBED16,0x434386C5,0x4D4D9AD7,0x33336655,0x85851194, - 0x45458ACF,0xF9F9E910,0x02020406,0x7F7FFE81,0x5050A0F0,0x3C3C7844,0x9F9F25BA,0xA8A84BE3, - 0x5151A2F3,0xA3A35DFE,0x404080C0,0x8F8F058A,0x92923FAD,0x9D9D21BC,0x38387048,0xF5F5F104, - 0xBCBC63DF,0xB6B677C1,0xDADAAF75,0x21214263,0x10102030,0xFFFFE51A,0xF3F3FD0E,0xD2D2BF6D, - 0xCDCD814C,0x0C0C1814,0x13132635,0xECECC32F,0x5F5FBEE1,0x979735A2,0x444488CC,0x17172E39, - 0xC4C49357,0xA7A755F2,0x7E7EFC82,0x3D3D7A47,0x6464C8AC,0x5D5DBAE7,0x1919322B,0x7373E695, - 0x6060C0A0,0x81811998,0x4F4F9ED1,0xDCDCA37F,0x22224466,0x2A2A547E,0x90903BAB,0x88880B83, - 0x46468CCA,0xEEEEC729,0xB8B86BD3,0x1414283C,0xDEDEA779,0x5E5EBCE2,0x0B0B161D,0xDBDBAD76, - 0xE0E0DB3B,0x32326456,0x3A3A744E,0x0A0A141E,0x494992DB,0x06060C0A,0x2424486C,0x5C5CB8E4, - 0xC2C29F5D,0xD3D3BD6E,0xACAC43EF,0x6262C4A6,0x919139A8,0x959531A4,0xE4E4D337,0x7979F28B, - 0xE7E7D532,0xC8C88B43,0x37376E59,0x6D6DDAB7,0x8D8D018C,0xD5D5B164,0x4E4E9CD2,0xA9A949E0, - 0x6C6CD8B4,0x5656ACFA,0xF4F4F307,0xEAEACF25,0x6565CAAF,0x7A7AF48E,0xAEAE47E9,0x08081018, - 0xBABA6FD5,0x7878F088,0x25254A6F,0x2E2E5C72,0x1C1C3824,0xA6A657F1,0xB4B473C7,0xC6C69751, - 0xE8E8CB23,0xDDDDA17C,0x7474E89C,0x1F1F3E21,0x4B4B96DD,0xBDBD61DC,0x8B8B0D86,0x8A8A0F85, - 0x7070E090,0x3E3E7C42,0xB5B571C4,0x6666CCAA,0x484890D8,0x03030605,0xF6F6F701,0x0E0E1C12, - 0x6161C2A3,0x35356A5F,0x5757AEF9,0xB9B969D0,0x86861791,0xC1C19958,0x1D1D3A27,0x9E9E27B9, - 0xE1E1D938,0xF8F8EB13,0x98982BB3,0x11112233,0x6969D2BB,0xD9D9A970,0x8E8E0789,0x949433A7, - 0x9B9B2DB6,0x1E1E3C22,0x87871592,0xE9E9C920,0xCECE8749,0x5555AAFF,0x28285078,0xDFDFA57A, - 0x8C8C038F,0xA1A159F8,0x89890980,0x0D0D1A17,0xBFBF65DA,0xE6E6D731,0x424284C6,0x6868D0B8, - 0x414182C3,0x999929B0,0x2D2D5A77,0x0F0F1E11,0xB0B07BCB,0x5454A8FC,0xBBBB6DD6,0x16162C3A - }, - { - 0x63C6A563,0x7CF8847C,0x77EE9977,0x7BF68D7B,0xF2FF0DF2,0x6BD6BD6B,0x6FDEB16F,0xC59154C5, - 0x30605030,0x01020301,0x67CEA967,0x2B567D2B,0xFEE719FE,0xD7B562D7,0xAB4DE6AB,0x76EC9A76, - 0xCA8F45CA,0x821F9D82,0xC98940C9,0x7DFA877D,0xFAEF15FA,0x59B2EB59,0x478EC947,0xF0FB0BF0, - 0xAD41ECAD,0xD4B367D4,0xA25FFDA2,0xAF45EAAF,0x9C23BF9C,0xA453F7A4,0x72E49672,0xC09B5BC0, - 0xB775C2B7,0xFDE11CFD,0x933DAE93,0x264C6A26,0x366C5A36,0x3F7E413F,0xF7F502F7,0xCC834FCC, - 0x34685C34,0xA551F4A5,0xE5D134E5,0xF1F908F1,0x71E29371,0xD8AB73D8,0x31625331,0x152A3F15, - 0x04080C04,0xC79552C7,0x23466523,0xC39D5EC3,0x18302818,0x9637A196,0x050A0F05,0x9A2FB59A, - 0x070E0907,0x12243612,0x801B9B80,0xE2DF3DE2,0xEBCD26EB,0x274E6927,0xB27FCDB2,0x75EA9F75, - 0x09121B09,0x831D9E83,0x2C58742C,0x1A342E1A,0x1B362D1B,0x6EDCB26E,0x5AB4EE5A,0xA05BFBA0, - 0x52A4F652,0x3B764D3B,0xD6B761D6,0xB37DCEB3,0x29527B29,0xE3DD3EE3,0x2F5E712F,0x84139784, - 0x53A6F553,0xD1B968D1,0000000000,0xEDC12CED,0x20406020,0xFCE31FFC,0xB179C8B1,0x5BB6ED5B, - 0x6AD4BE6A,0xCB8D46CB,0xBE67D9BE,0x39724B39,0x4A94DE4A,0x4C98D44C,0x58B0E858,0xCF854ACF, - 0xD0BB6BD0,0xEFC52AEF,0xAA4FE5AA,0xFBED16FB,0x4386C543,0x4D9AD74D,0x33665533,0x85119485, - 0x458ACF45,0xF9E910F9,0x02040602,0x7FFE817F,0x50A0F050,0x3C78443C,0x9F25BA9F,0xA84BE3A8, - 0x51A2F351,0xA35DFEA3,0x4080C040,0x8F058A8F,0x923FAD92,0x9D21BC9D,0x38704838,0xF5F104F5, - 0xBC63DFBC,0xB677C1B6,0xDAAF75DA,0x21426321,0x10203010,0xFFE51AFF,0xF3FD0EF3,0xD2BF6DD2, - 0xCD814CCD,0x0C18140C,0x13263513,0xECC32FEC,0x5FBEE15F,0x9735A297,0x4488CC44,0x172E3917, - 0xC49357C4,0xA755F2A7,0x7EFC827E,0x3D7A473D,0x64C8AC64,0x5DBAE75D,0x19322B19,0x73E69573, - 0x60C0A060,0x81199881,0x4F9ED14F,0xDCA37FDC,0x22446622,0x2A547E2A,0x903BAB90,0x880B8388, - 0x468CCA46,0xEEC729EE,0xB86BD3B8,0x14283C14,0xDEA779DE,0x5EBCE25E,0x0B161D0B,0xDBAD76DB, - 0xE0DB3BE0,0x32645632,0x3A744E3A,0x0A141E0A,0x4992DB49,0x060C0A06,0x24486C24,0x5CB8E45C, - 0xC29F5DC2,0xD3BD6ED3,0xAC43EFAC,0x62C4A662,0x9139A891,0x9531A495,0xE4D337E4,0x79F28B79, - 0xE7D532E7,0xC88B43C8,0x376E5937,0x6DDAB76D,0x8D018C8D,0xD5B164D5,0x4E9CD24E,0xA949E0A9, - 0x6CD8B46C,0x56ACFA56,0xF4F307F4,0xEACF25EA,0x65CAAF65,0x7AF48E7A,0xAE47E9AE,0x08101808, - 0xBA6FD5BA,0x78F08878,0x254A6F25,0x2E5C722E,0x1C38241C,0xA657F1A6,0xB473C7B4,0xC69751C6, - 0xE8CB23E8,0xDDA17CDD,0x74E89C74,0x1F3E211F,0x4B96DD4B,0xBD61DCBD,0x8B0D868B,0x8A0F858A, - 0x70E09070,0x3E7C423E,0xB571C4B5,0x66CCAA66,0x4890D848,0x03060503,0xF6F701F6,0x0E1C120E, - 0x61C2A361,0x356A5F35,0x57AEF957,0xB969D0B9,0x86179186,0xC19958C1,0x1D3A271D,0x9E27B99E, - 0xE1D938E1,0xF8EB13F8,0x982BB398,0x11223311,0x69D2BB69,0xD9A970D9,0x8E07898E,0x9433A794, - 0x9B2DB69B,0x1E3C221E,0x87159287,0xE9C920E9,0xCE8749CE,0x55AAFF55,0x28507828,0xDFA57ADF, - 0x8C038F8C,0xA159F8A1,0x89098089,0x0D1A170D,0xBF65DABF,0xE6D731E6,0x4284C642,0x68D0B868, - 0x4182C341,0x9929B099,0x2D5A772D,0x0F1E110F,0xB07BCBB0,0x54A8FC54,0xBB6DD6BB,0x162C3A16 - }, - { - 0xC6A56363,0xF8847C7C,0xEE997777,0xF68D7B7B,0xFF0DF2F2,0xD6BD6B6B,0xDEB16F6F,0x9154C5C5, - 0x60503030,0x02030101,0xCEA96767,0x567D2B2B,0xE719FEFE,0xB562D7D7,0x4DE6ABAB,0xEC9A7676, - 0x8F45CACA,0x1F9D8282,0x8940C9C9,0xFA877D7D,0xEF15FAFA,0xB2EB5959,0x8EC94747,0xFB0BF0F0, - 0x41ECADAD,0xB367D4D4,0x5FFDA2A2,0x45EAAFAF,0x23BF9C9C,0x53F7A4A4,0xE4967272,0x9B5BC0C0, - 0x75C2B7B7,0xE11CFDFD,0x3DAE9393,0x4C6A2626,0x6C5A3636,0x7E413F3F,0xF502F7F7,0x834FCCCC, - 0x685C3434,0x51F4A5A5,0xD134E5E5,0xF908F1F1,0xE2937171,0xAB73D8D8,0x62533131,0x2A3F1515, - 0x080C0404,0x9552C7C7,0x46652323,0x9D5EC3C3,0x30281818,0x37A19696,0x0A0F0505,0x2FB59A9A, - 0x0E090707,0x24361212,0x1B9B8080,0xDF3DE2E2,0xCD26EBEB,0x4E692727,0x7FCDB2B2,0xEA9F7575, - 0x121B0909,0x1D9E8383,0x58742C2C,0x342E1A1A,0x362D1B1B,0xDCB26E6E,0xB4EE5A5A,0x5BFBA0A0, - 0xA4F65252,0x764D3B3B,0xB761D6D6,0x7DCEB3B3,0x527B2929,0xDD3EE3E3,0x5E712F2F,0x13978484, - 0xA6F55353,0xB968D1D1,0000000000,0xC12CEDED,0x40602020,0xE31FFCFC,0x79C8B1B1,0xB6ED5B5B, - 0xD4BE6A6A,0x8D46CBCB,0x67D9BEBE,0x724B3939,0x94DE4A4A,0x98D44C4C,0xB0E85858,0x854ACFCF, - 0xBB6BD0D0,0xC52AEFEF,0x4FE5AAAA,0xED16FBFB,0x86C54343,0x9AD74D4D,0x66553333,0x11948585, - 0x8ACF4545,0xE910F9F9,0x04060202,0xFE817F7F,0xA0F05050,0x78443C3C,0x25BA9F9F,0x4BE3A8A8, - 0xA2F35151,0x5DFEA3A3,0x80C04040,0x058A8F8F,0x3FAD9292,0x21BC9D9D,0x70483838,0xF104F5F5, - 0x63DFBCBC,0x77C1B6B6,0xAF75DADA,0x42632121,0x20301010,0xE51AFFFF,0xFD0EF3F3,0xBF6DD2D2, - 0x814CCDCD,0x18140C0C,0x26351313,0xC32FECEC,0xBEE15F5F,0x35A29797,0x88CC4444,0x2E391717, - 0x9357C4C4,0x55F2A7A7,0xFC827E7E,0x7A473D3D,0xC8AC6464,0xBAE75D5D,0x322B1919,0xE6957373, - 0xC0A06060,0x19988181,0x9ED14F4F,0xA37FDCDC,0x44662222,0x547E2A2A,0x3BAB9090,0x0B838888, - 0x8CCA4646,0xC729EEEE,0x6BD3B8B8,0x283C1414,0xA779DEDE,0xBCE25E5E,0x161D0B0B,0xAD76DBDB, - 0xDB3BE0E0,0x64563232,0x744E3A3A,0x141E0A0A,0x92DB4949,0x0C0A0606,0x486C2424,0xB8E45C5C, - 0x9F5DC2C2,0xBD6ED3D3,0x43EFACAC,0xC4A66262,0x39A89191,0x31A49595,0xD337E4E4,0xF28B7979, - 0xD532E7E7,0x8B43C8C8,0x6E593737,0xDAB76D6D,0x018C8D8D,0xB164D5D5,0x9CD24E4E,0x49E0A9A9, - 0xD8B46C6C,0xACFA5656,0xF307F4F4,0xCF25EAEA,0xCAAF6565,0xF48E7A7A,0x47E9AEAE,0x10180808, - 0x6FD5BABA,0xF0887878,0x4A6F2525,0x5C722E2E,0x38241C1C,0x57F1A6A6,0x73C7B4B4,0x9751C6C6, - 0xCB23E8E8,0xA17CDDDD,0xE89C7474,0x3E211F1F,0x96DD4B4B,0x61DCBDBD,0x0D868B8B,0x0F858A8A, - 0xE0907070,0x7C423E3E,0x71C4B5B5,0xCCAA6666,0x90D84848,0x06050303,0xF701F6F6,0x1C120E0E, - 0xC2A36161,0x6A5F3535,0xAEF95757,0x69D0B9B9,0x17918686,0x9958C1C1,0x3A271D1D,0x27B99E9E, - 0xD938E1E1,0xEB13F8F8,0x2BB39898,0x22331111,0xD2BB6969,0xA970D9D9,0x07898E8E,0x33A79494, - 0x2DB69B9B,0x3C221E1E,0x15928787,0xC920E9E9,0x8749CECE,0xAAFF5555,0x50782828,0xA57ADFDF, - 0x038F8C8C,0x59F8A1A1,0x09808989,0x1A170D0D,0x65DABFBF,0xD731E6E6,0x84C64242,0xD0B86868, - 0x82C34141,0x29B09999,0x5A772D2D,0x1E110F0F,0x7BCBB0B0,0xA8FC5454,0x6DD6BBBB,0x2C3A1616 - } +static uint32_t ft_tab[4][256] = { + { + 0xA56363C6,0x847C7CF8,0x997777EE,0x8D7B7BF6,0x0DF2F2FF,0xBD6B6BD6,0xB16F6FDE,0x54C5C591, + 0x50303060,0x03010102,0xA96767CE,0x7D2B2B56,0x19FEFEE7,0x62D7D7B5,0xE6ABAB4D,0x9A7676EC, + 0x45CACA8F,0x9D82821F,0x40C9C989,0x877D7DFA,0x15FAFAEF,0xEB5959B2,0xC947478E,0x0BF0F0FB, + 0xECADAD41,0x67D4D4B3,0xFDA2A25F,0xEAAFAF45,0xBF9C9C23,0xF7A4A453,0x967272E4,0x5BC0C09B, + 0xC2B7B775,0x1CFDFDE1,0xAE93933D,0x6A26264C,0x5A36366C,0x413F3F7E,0x02F7F7F5,0x4FCCCC83, + 0x5C343468,0xF4A5A551,0x34E5E5D1,0x08F1F1F9,0x937171E2,0x73D8D8AB,0x53313162,0x3F15152A, + 0x0C040408,0x52C7C795,0x65232346,0x5EC3C39D,0x28181830,0xA1969637,0x0F05050A,0xB59A9A2F, + 0x0907070E,0x36121224,0x9B80801B,0x3DE2E2DF,0x26EBEBCD,0x6927274E,0xCDB2B27F,0x9F7575EA, + 0x1B090912,0x9E83831D,0x742C2C58,0x2E1A1A34,0x2D1B1B36,0xB26E6EDC,0xEE5A5AB4,0xFBA0A05B, + 0xF65252A4,0x4D3B3B76,0x61D6D6B7,0xCEB3B37D,0x7B292952,0x3EE3E3DD,0x712F2F5E,0x97848413, + 0xF55353A6,0x68D1D1B9,0000000000,0x2CEDEDC1,0x60202040,0x1FFCFCE3,0xC8B1B179,0xED5B5BB6, + 0xBE6A6AD4,0x46CBCB8D,0xD9BEBE67,0x4B393972,0xDE4A4A94,0xD44C4C98,0xE85858B0,0x4ACFCF85, + 0x6BD0D0BB,0x2AEFEFC5,0xE5AAAA4F,0x16FBFBED,0xC5434386,0xD74D4D9A,0x55333366,0x94858511, + 0xCF45458A,0x10F9F9E9,0x06020204,0x817F7FFE,0xF05050A0,0x443C3C78,0xBA9F9F25,0xE3A8A84B, + 0xF35151A2,0xFEA3A35D,0xC0404080,0x8A8F8F05,0xAD92923F,0xBC9D9D21,0x48383870,0x04F5F5F1, + 0xDFBCBC63,0xC1B6B677,0x75DADAAF,0x63212142,0x30101020,0x1AFFFFE5,0x0EF3F3FD,0x6DD2D2BF, + 0x4CCDCD81,0x140C0C18,0x35131326,0x2FECECC3,0xE15F5FBE,0xA2979735,0xCC444488,0x3917172E, + 0x57C4C493,0xF2A7A755,0x827E7EFC,0x473D3D7A,0xAC6464C8,0xE75D5DBA,0x2B191932,0x957373E6, + 0xA06060C0,0x98818119,0xD14F4F9E,0x7FDCDCA3,0x66222244,0x7E2A2A54,0xAB90903B,0x8388880B, + 0xCA46468C,0x29EEEEC7,0xD3B8B86B,0x3C141428,0x79DEDEA7,0xE25E5EBC,0x1D0B0B16,0x76DBDBAD, + 0x3BE0E0DB,0x56323264,0x4E3A3A74,0x1E0A0A14,0xDB494992,0x0A06060C,0x6C242448,0xE45C5CB8, + 0x5DC2C29F,0x6ED3D3BD,0xEFACAC43,0xA66262C4,0xA8919139,0xA4959531,0x37E4E4D3,0x8B7979F2, + 0x32E7E7D5,0x43C8C88B,0x5937376E,0xB76D6DDA,0x8C8D8D01,0x64D5D5B1,0xD24E4E9C,0xE0A9A949, + 0xB46C6CD8,0xFA5656AC,0x07F4F4F3,0x25EAEACF,0xAF6565CA,0x8E7A7AF4,0xE9AEAE47,0x18080810, + 0xD5BABA6F,0x887878F0,0x6F25254A,0x722E2E5C,0x241C1C38,0xF1A6A657,0xC7B4B473,0x51C6C697, + 0x23E8E8CB,0x7CDDDDA1,0x9C7474E8,0x211F1F3E,0xDD4B4B96,0xDCBDBD61,0x868B8B0D,0x858A8A0F, + 0x907070E0,0x423E3E7C,0xC4B5B571,0xAA6666CC,0xD8484890,0x05030306,0x01F6F6F7,0x120E0E1C, + 0xA36161C2,0x5F35356A,0xF95757AE,0xD0B9B969,0x91868617,0x58C1C199,0x271D1D3A,0xB99E9E27, + 0x38E1E1D9,0x13F8F8EB,0xB398982B,0x33111122,0xBB6969D2,0x70D9D9A9,0x898E8E07,0xA7949433, + 0xB69B9B2D,0x221E1E3C,0x92878715,0x20E9E9C9,0x49CECE87,0xFF5555AA,0x78282850,0x7ADFDFA5, + 0x8F8C8C03,0xF8A1A159,0x80898909,0x170D0D1A,0xDABFBF65,0x31E6E6D7,0xC6424284,0xB86868D0, + 0xC3414182,0xB0999929,0x772D2D5A,0x110F0F1E,0xCBB0B07B,0xFC5454A8,0xD6BBBB6D,0x3A16162C + }, + { + 0x6363C6A5,0x7C7CF884,0x7777EE99,0x7B7BF68D,0xF2F2FF0D,0x6B6BD6BD,0x6F6FDEB1,0xC5C59154, + 0x30306050,0x01010203,0x6767CEA9,0x2B2B567D,0xFEFEE719,0xD7D7B562,0xABAB4DE6,0x7676EC9A, + 0xCACA8F45,0x82821F9D,0xC9C98940,0x7D7DFA87,0xFAFAEF15,0x5959B2EB,0x47478EC9,0xF0F0FB0B, + 0xADAD41EC,0xD4D4B367,0xA2A25FFD,0xAFAF45EA,0x9C9C23BF,0xA4A453F7,0x7272E496,0xC0C09B5B, + 0xB7B775C2,0xFDFDE11C,0x93933DAE,0x26264C6A,0x36366C5A,0x3F3F7E41,0xF7F7F502,0xCCCC834F, + 0x3434685C,0xA5A551F4,0xE5E5D134,0xF1F1F908,0x7171E293,0xD8D8AB73,0x31316253,0x15152A3F, + 0x0404080C,0xC7C79552,0x23234665,0xC3C39D5E,0x18183028,0x969637A1,0x05050A0F,0x9A9A2FB5, + 0x07070E09,0x12122436,0x80801B9B,0xE2E2DF3D,0xEBEBCD26,0x27274E69,0xB2B27FCD,0x7575EA9F, + 0x0909121B,0x83831D9E,0x2C2C5874,0x1A1A342E,0x1B1B362D,0x6E6EDCB2,0x5A5AB4EE,0xA0A05BFB, + 0x5252A4F6,0x3B3B764D,0xD6D6B761,0xB3B37DCE,0x2929527B,0xE3E3DD3E,0x2F2F5E71,0x84841397, + 0x5353A6F5,0xD1D1B968,0000000000,0xEDEDC12C,0x20204060,0xFCFCE31F,0xB1B179C8,0x5B5BB6ED, + 0x6A6AD4BE,0xCBCB8D46,0xBEBE67D9,0x3939724B,0x4A4A94DE,0x4C4C98D4,0x5858B0E8,0xCFCF854A, + 0xD0D0BB6B,0xEFEFC52A,0xAAAA4FE5,0xFBFBED16,0x434386C5,0x4D4D9AD7,0x33336655,0x85851194, + 0x45458ACF,0xF9F9E910,0x02020406,0x7F7FFE81,0x5050A0F0,0x3C3C7844,0x9F9F25BA,0xA8A84BE3, + 0x5151A2F3,0xA3A35DFE,0x404080C0,0x8F8F058A,0x92923FAD,0x9D9D21BC,0x38387048,0xF5F5F104, + 0xBCBC63DF,0xB6B677C1,0xDADAAF75,0x21214263,0x10102030,0xFFFFE51A,0xF3F3FD0E,0xD2D2BF6D, + 0xCDCD814C,0x0C0C1814,0x13132635,0xECECC32F,0x5F5FBEE1,0x979735A2,0x444488CC,0x17172E39, + 0xC4C49357,0xA7A755F2,0x7E7EFC82,0x3D3D7A47,0x6464C8AC,0x5D5DBAE7,0x1919322B,0x7373E695, + 0x6060C0A0,0x81811998,0x4F4F9ED1,0xDCDCA37F,0x22224466,0x2A2A547E,0x90903BAB,0x88880B83, + 0x46468CCA,0xEEEEC729,0xB8B86BD3,0x1414283C,0xDEDEA779,0x5E5EBCE2,0x0B0B161D,0xDBDBAD76, + 0xE0E0DB3B,0x32326456,0x3A3A744E,0x0A0A141E,0x494992DB,0x06060C0A,0x2424486C,0x5C5CB8E4, + 0xC2C29F5D,0xD3D3BD6E,0xACAC43EF,0x6262C4A6,0x919139A8,0x959531A4,0xE4E4D337,0x7979F28B, + 0xE7E7D532,0xC8C88B43,0x37376E59,0x6D6DDAB7,0x8D8D018C,0xD5D5B164,0x4E4E9CD2,0xA9A949E0, + 0x6C6CD8B4,0x5656ACFA,0xF4F4F307,0xEAEACF25,0x6565CAAF,0x7A7AF48E,0xAEAE47E9,0x08081018, + 0xBABA6FD5,0x7878F088,0x25254A6F,0x2E2E5C72,0x1C1C3824,0xA6A657F1,0xB4B473C7,0xC6C69751, + 0xE8E8CB23,0xDDDDA17C,0x7474E89C,0x1F1F3E21,0x4B4B96DD,0xBDBD61DC,0x8B8B0D86,0x8A8A0F85, + 0x7070E090,0x3E3E7C42,0xB5B571C4,0x6666CCAA,0x484890D8,0x03030605,0xF6F6F701,0x0E0E1C12, + 0x6161C2A3,0x35356A5F,0x5757AEF9,0xB9B969D0,0x86861791,0xC1C19958,0x1D1D3A27,0x9E9E27B9, + 0xE1E1D938,0xF8F8EB13,0x98982BB3,0x11112233,0x6969D2BB,0xD9D9A970,0x8E8E0789,0x949433A7, + 0x9B9B2DB6,0x1E1E3C22,0x87871592,0xE9E9C920,0xCECE8749,0x5555AAFF,0x28285078,0xDFDFA57A, + 0x8C8C038F,0xA1A159F8,0x89890980,0x0D0D1A17,0xBFBF65DA,0xE6E6D731,0x424284C6,0x6868D0B8, + 0x414182C3,0x999929B0,0x2D2D5A77,0x0F0F1E11,0xB0B07BCB,0x5454A8FC,0xBBBB6DD6,0x16162C3A + }, + { + 0x63C6A563,0x7CF8847C,0x77EE9977,0x7BF68D7B,0xF2FF0DF2,0x6BD6BD6B,0x6FDEB16F,0xC59154C5, + 0x30605030,0x01020301,0x67CEA967,0x2B567D2B,0xFEE719FE,0xD7B562D7,0xAB4DE6AB,0x76EC9A76, + 0xCA8F45CA,0x821F9D82,0xC98940C9,0x7DFA877D,0xFAEF15FA,0x59B2EB59,0x478EC947,0xF0FB0BF0, + 0xAD41ECAD,0xD4B367D4,0xA25FFDA2,0xAF45EAAF,0x9C23BF9C,0xA453F7A4,0x72E49672,0xC09B5BC0, + 0xB775C2B7,0xFDE11CFD,0x933DAE93,0x264C6A26,0x366C5A36,0x3F7E413F,0xF7F502F7,0xCC834FCC, + 0x34685C34,0xA551F4A5,0xE5D134E5,0xF1F908F1,0x71E29371,0xD8AB73D8,0x31625331,0x152A3F15, + 0x04080C04,0xC79552C7,0x23466523,0xC39D5EC3,0x18302818,0x9637A196,0x050A0F05,0x9A2FB59A, + 0x070E0907,0x12243612,0x801B9B80,0xE2DF3DE2,0xEBCD26EB,0x274E6927,0xB27FCDB2,0x75EA9F75, + 0x09121B09,0x831D9E83,0x2C58742C,0x1A342E1A,0x1B362D1B,0x6EDCB26E,0x5AB4EE5A,0xA05BFBA0, + 0x52A4F652,0x3B764D3B,0xD6B761D6,0xB37DCEB3,0x29527B29,0xE3DD3EE3,0x2F5E712F,0x84139784, + 0x53A6F553,0xD1B968D1,0000000000,0xEDC12CED,0x20406020,0xFCE31FFC,0xB179C8B1,0x5BB6ED5B, + 0x6AD4BE6A,0xCB8D46CB,0xBE67D9BE,0x39724B39,0x4A94DE4A,0x4C98D44C,0x58B0E858,0xCF854ACF, + 0xD0BB6BD0,0xEFC52AEF,0xAA4FE5AA,0xFBED16FB,0x4386C543,0x4D9AD74D,0x33665533,0x85119485, + 0x458ACF45,0xF9E910F9,0x02040602,0x7FFE817F,0x50A0F050,0x3C78443C,0x9F25BA9F,0xA84BE3A8, + 0x51A2F351,0xA35DFEA3,0x4080C040,0x8F058A8F,0x923FAD92,0x9D21BC9D,0x38704838,0xF5F104F5, + 0xBC63DFBC,0xB677C1B6,0xDAAF75DA,0x21426321,0x10203010,0xFFE51AFF,0xF3FD0EF3,0xD2BF6DD2, + 0xCD814CCD,0x0C18140C,0x13263513,0xECC32FEC,0x5FBEE15F,0x9735A297,0x4488CC44,0x172E3917, + 0xC49357C4,0xA755F2A7,0x7EFC827E,0x3D7A473D,0x64C8AC64,0x5DBAE75D,0x19322B19,0x73E69573, + 0x60C0A060,0x81199881,0x4F9ED14F,0xDCA37FDC,0x22446622,0x2A547E2A,0x903BAB90,0x880B8388, + 0x468CCA46,0xEEC729EE,0xB86BD3B8,0x14283C14,0xDEA779DE,0x5EBCE25E,0x0B161D0B,0xDBAD76DB, + 0xE0DB3BE0,0x32645632,0x3A744E3A,0x0A141E0A,0x4992DB49,0x060C0A06,0x24486C24,0x5CB8E45C, + 0xC29F5DC2,0xD3BD6ED3,0xAC43EFAC,0x62C4A662,0x9139A891,0x9531A495,0xE4D337E4,0x79F28B79, + 0xE7D532E7,0xC88B43C8,0x376E5937,0x6DDAB76D,0x8D018C8D,0xD5B164D5,0x4E9CD24E,0xA949E0A9, + 0x6CD8B46C,0x56ACFA56,0xF4F307F4,0xEACF25EA,0x65CAAF65,0x7AF48E7A,0xAE47E9AE,0x08101808, + 0xBA6FD5BA,0x78F08878,0x254A6F25,0x2E5C722E,0x1C38241C,0xA657F1A6,0xB473C7B4,0xC69751C6, + 0xE8CB23E8,0xDDA17CDD,0x74E89C74,0x1F3E211F,0x4B96DD4B,0xBD61DCBD,0x8B0D868B,0x8A0F858A, + 0x70E09070,0x3E7C423E,0xB571C4B5,0x66CCAA66,0x4890D848,0x03060503,0xF6F701F6,0x0E1C120E, + 0x61C2A361,0x356A5F35,0x57AEF957,0xB969D0B9,0x86179186,0xC19958C1,0x1D3A271D,0x9E27B99E, + 0xE1D938E1,0xF8EB13F8,0x982BB398,0x11223311,0x69D2BB69,0xD9A970D9,0x8E07898E,0x9433A794, + 0x9B2DB69B,0x1E3C221E,0x87159287,0xE9C920E9,0xCE8749CE,0x55AAFF55,0x28507828,0xDFA57ADF, + 0x8C038F8C,0xA159F8A1,0x89098089,0x0D1A170D,0xBF65DABF,0xE6D731E6,0x4284C642,0x68D0B868, + 0x4182C341,0x9929B099,0x2D5A772D,0x0F1E110F,0xB07BCBB0,0x54A8FC54,0xBB6DD6BB,0x162C3A16 + }, + { + 0xC6A56363,0xF8847C7C,0xEE997777,0xF68D7B7B,0xFF0DF2F2,0xD6BD6B6B,0xDEB16F6F,0x9154C5C5, + 0x60503030,0x02030101,0xCEA96767,0x567D2B2B,0xE719FEFE,0xB562D7D7,0x4DE6ABAB,0xEC9A7676, + 0x8F45CACA,0x1F9D8282,0x8940C9C9,0xFA877D7D,0xEF15FAFA,0xB2EB5959,0x8EC94747,0xFB0BF0F0, + 0x41ECADAD,0xB367D4D4,0x5FFDA2A2,0x45EAAFAF,0x23BF9C9C,0x53F7A4A4,0xE4967272,0x9B5BC0C0, + 0x75C2B7B7,0xE11CFDFD,0x3DAE9393,0x4C6A2626,0x6C5A3636,0x7E413F3F,0xF502F7F7,0x834FCCCC, + 0x685C3434,0x51F4A5A5,0xD134E5E5,0xF908F1F1,0xE2937171,0xAB73D8D8,0x62533131,0x2A3F1515, + 0x080C0404,0x9552C7C7,0x46652323,0x9D5EC3C3,0x30281818,0x37A19696,0x0A0F0505,0x2FB59A9A, + 0x0E090707,0x24361212,0x1B9B8080,0xDF3DE2E2,0xCD26EBEB,0x4E692727,0x7FCDB2B2,0xEA9F7575, + 0x121B0909,0x1D9E8383,0x58742C2C,0x342E1A1A,0x362D1B1B,0xDCB26E6E,0xB4EE5A5A,0x5BFBA0A0, + 0xA4F65252,0x764D3B3B,0xB761D6D6,0x7DCEB3B3,0x527B2929,0xDD3EE3E3,0x5E712F2F,0x13978484, + 0xA6F55353,0xB968D1D1,0000000000,0xC12CEDED,0x40602020,0xE31FFCFC,0x79C8B1B1,0xB6ED5B5B, + 0xD4BE6A6A,0x8D46CBCB,0x67D9BEBE,0x724B3939,0x94DE4A4A,0x98D44C4C,0xB0E85858,0x854ACFCF, + 0xBB6BD0D0,0xC52AEFEF,0x4FE5AAAA,0xED16FBFB,0x86C54343,0x9AD74D4D,0x66553333,0x11948585, + 0x8ACF4545,0xE910F9F9,0x04060202,0xFE817F7F,0xA0F05050,0x78443C3C,0x25BA9F9F,0x4BE3A8A8, + 0xA2F35151,0x5DFEA3A3,0x80C04040,0x058A8F8F,0x3FAD9292,0x21BC9D9D,0x70483838,0xF104F5F5, + 0x63DFBCBC,0x77C1B6B6,0xAF75DADA,0x42632121,0x20301010,0xE51AFFFF,0xFD0EF3F3,0xBF6DD2D2, + 0x814CCDCD,0x18140C0C,0x26351313,0xC32FECEC,0xBEE15F5F,0x35A29797,0x88CC4444,0x2E391717, + 0x9357C4C4,0x55F2A7A7,0xFC827E7E,0x7A473D3D,0xC8AC6464,0xBAE75D5D,0x322B1919,0xE6957373, + 0xC0A06060,0x19988181,0x9ED14F4F,0xA37FDCDC,0x44662222,0x547E2A2A,0x3BAB9090,0x0B838888, + 0x8CCA4646,0xC729EEEE,0x6BD3B8B8,0x283C1414,0xA779DEDE,0xBCE25E5E,0x161D0B0B,0xAD76DBDB, + 0xDB3BE0E0,0x64563232,0x744E3A3A,0x141E0A0A,0x92DB4949,0x0C0A0606,0x486C2424,0xB8E45C5C, + 0x9F5DC2C2,0xBD6ED3D3,0x43EFACAC,0xC4A66262,0x39A89191,0x31A49595,0xD337E4E4,0xF28B7979, + 0xD532E7E7,0x8B43C8C8,0x6E593737,0xDAB76D6D,0x018C8D8D,0xB164D5D5,0x9CD24E4E,0x49E0A9A9, + 0xD8B46C6C,0xACFA5656,0xF307F4F4,0xCF25EAEA,0xCAAF6565,0xF48E7A7A,0x47E9AEAE,0x10180808, + 0x6FD5BABA,0xF0887878,0x4A6F2525,0x5C722E2E,0x38241C1C,0x57F1A6A6,0x73C7B4B4,0x9751C6C6, + 0xCB23E8E8,0xA17CDDDD,0xE89C7474,0x3E211F1F,0x96DD4B4B,0x61DCBDBD,0x0D868B8B,0x0F858A8A, + 0xE0907070,0x7C423E3E,0x71C4B5B5,0xCCAA6666,0x90D84848,0x06050303,0xF701F6F6,0x1C120E0E, + 0xC2A36161,0x6A5F3535,0xAEF95757,0x69D0B9B9,0x17918686,0x9958C1C1,0x3A271D1D,0x27B99E9E, + 0xD938E1E1,0xEB13F8F8,0x2BB39898,0x22331111,0xD2BB6969,0xA970D9D9,0x07898E8E,0x33A79494, + 0x2DB69B9B,0x3C221E1E,0x15928787,0xC920E9E9,0x8749CECE,0xAAFF5555,0x50782828,0xA57ADFDF, + 0x038F8C8C,0x59F8A1A1,0x09808989,0x1A170D0D,0x65DABFBF,0xD731E6E6,0x84C64242,0xD0B86868, + 0x82C34141,0x29B09999,0x5A772D2D,0x1E110F0F,0x7BCBB0B0,0xA8FC5454,0x6DD6BBBB,0x2C3A1616 + } }; -static uint32_t fl_tab[4][256] = -{ - { - 0x00000063,0x0000007C,0x00000077,0x0000007B,0x000000F2,0x0000006B,0x0000006F,0x000000C5, - 0x00000030,0x00000001,0x00000067,0x0000002B,0x000000FE,0x000000D7,0x000000AB,0x00000076, - 0x000000CA,0x00000082,0x000000C9,0x0000007D,0x000000FA,0x00000059,0x00000047,0x000000F0, - 0x000000AD,0x000000D4,0x000000A2,0x000000AF,0x0000009C,0x000000A4,0x00000072,0x000000C0, - 0x000000B7,0x000000FD,0x00000093,0x00000026,0x00000036,0x0000003F,0x000000F7,0x000000CC, - 0x00000034,0x000000A5,0x000000E5,0x000000F1,0x00000071,0x000000D8,0x00000031,0x00000015, - 0x00000004,0x000000C7,0x00000023,0x000000C3,0x00000018,0x00000096,0x00000005,0x0000009A, - 0x00000007,0x00000012,0x00000080,0x000000E2,0x000000EB,0x00000027,0x000000B2,0x00000075, - 0x00000009,0x00000083,0x0000002C,0x0000001A,0x0000001B,0x0000006E,0x0000005A,0x000000A0, - 0x00000052,0x0000003B,0x000000D6,0x000000B3,0x00000029,0x000000E3,0x0000002F,0x00000084, - 0x00000053,0x000000D1,0x00000000,0x000000ED,0x00000020,0x000000FC,0x000000B1,0x0000005B, - 0x0000006A,0x000000CB,0x000000BE,0x00000039,0x0000004A,0x0000004C,0x00000058,0x000000CF, - 0x000000D0,0x000000EF,0x000000AA,0x000000FB,0x00000043,0x0000004D,0x00000033,0x00000085, - 0x00000045,0x000000F9,0x00000002,0x0000007F,0x00000050,0x0000003C,0x0000009F,0x000000A8, - 0x00000051,0x000000A3,0x00000040,0x0000008F,0x00000092,0x0000009D,0x00000038,0x000000F5, - 0x000000BC,0x000000B6,0x000000DA,0x00000021,0x00000010,0x000000FF,0x000000F3,0x000000D2, - 0x000000CD,0x0000000C,0x00000013,0x000000EC,0x0000005F,0x00000097,0x00000044,0x00000017, - 0x000000C4,0x000000A7,0x0000007E,0x0000003D,0x00000064,0x0000005D,0x00000019,0x00000073, - 0x00000060,0x00000081,0x0000004F,0x000000DC,0x00000022,0x0000002A,0x00000090,0x00000088, - 0x00000046,0x000000EE,0x000000B8,0x00000014,0x000000DE,0x0000005E,0x0000000B,0x000000DB, - 0x000000E0,0x00000032,0x0000003A,0x0000000A,0x00000049,0x00000006,0x00000024,0x0000005C, - 0x000000C2,0x000000D3,0x000000AC,0x00000062,0x00000091,0x00000095,0x000000E4,0x00000079, - 0x000000E7,0x000000C8,0x00000037,0x0000006D,0x0000008D,0x000000D5,0x0000004E,0x000000A9, - 0x0000006C,0x00000056,0x000000F4,0x000000EA,0x00000065,0x0000007A,0x000000AE,0x00000008, - 0x000000BA,0x00000078,0x00000025,0x0000002E,0x0000001C,0x000000A6,0x000000B4,0x000000C6, - 0x000000E8,0x000000DD,0x00000074,0x0000001F,0x0000004B,0x000000BD,0x0000008B,0x0000008A, - 0x00000070,0x0000003E,0x000000B5,0x00000066,0x00000048,0x00000003,0x000000F6,0x0000000E, - 0x00000061,0x00000035,0x00000057,0x000000B9,0x00000086,0x000000C1,0x0000001D,0x0000009E, - 0x000000E1,0x000000F8,0x00000098,0x00000011,0x00000069,0x000000D9,0x0000008E,0x00000094, - 0x0000009B,0x0000001E,0x00000087,0x000000E9,0x000000CE,0x00000055,0x00000028,0x000000DF, - 0x0000008C,0x000000A1,0x00000089,0x0000000D,0x000000BF,0x000000E6,0x00000042,0x00000068, - 0x00000041,0x00000099,0x0000002D,0x0000000F,0x000000B0,0x00000054,0x000000BB,0x00000016 - }, - { - 0x00006300,0x00007C00,0x00007700,0x00007B00,0x0000F200,0x00006B00,0x00006F00,0x0000C500, - 0x00003000,0x00000100,0x00006700,0x00002B00,0x0000FE00,0x0000D700,0x0000AB00,0x00007600, - 0x0000CA00,0x00008200,0x0000C900,0x00007D00,0x0000FA00,0x00005900,0x00004700,0x0000F000, - 0x0000AD00,0x0000D400,0x0000A200,0x0000AF00,0x00009C00,0x0000A400,0x00007200,0x0000C000, - 0x0000B700,0x0000FD00,0x00009300,0x00002600,0x00003600,0x00003F00,0x0000F700,0x0000CC00, - 0x00003400,0x0000A500,0x0000E500,0x0000F100,0x00007100,0x0000D800,0x00003100,0x00001500, - 0x00000400,0x0000C700,0x00002300,0x0000C300,0x00001800,0x00009600,0x00000500,0x00009A00, - 0x00000700,0x00001200,0x00008000,0x0000E200,0x0000EB00,0x00002700,0x0000B200,0x00007500, - 0x00000900,0x00008300,0x00002C00,0x00001A00,0x00001B00,0x00006E00,0x00005A00,0x0000A000, - 0x00005200,0x00003B00,0x0000D600,0x0000B300,0x00002900,0x0000E300,0x00002F00,0x00008400, - 0x00005300,0x0000D100,0000000000,0x0000ED00,0x00002000,0x0000FC00,0x0000B100,0x00005B00, - 0x00006A00,0x0000CB00,0x0000BE00,0x00003900,0x00004A00,0x00004C00,0x00005800,0x0000CF00, - 0x0000D000,0x0000EF00,0x0000AA00,0x0000FB00,0x00004300,0x00004D00,0x00003300,0x00008500, - 0x00004500,0x0000F900,0x00000200,0x00007F00,0x00005000,0x00003C00,0x00009F00,0x0000A800, - 0x00005100,0x0000A300,0x00004000,0x00008F00,0x00009200,0x00009D00,0x00003800,0x0000F500, - 0x0000BC00,0x0000B600,0x0000DA00,0x00002100,0x00001000,0x0000FF00,0x0000F300,0x0000D200, - 0x0000CD00,0x00000C00,0x00001300,0x0000EC00,0x00005F00,0x00009700,0x00004400,0x00001700, - 0x0000C400,0x0000A700,0x00007E00,0x00003D00,0x00006400,0x00005D00,0x00001900,0x00007300, - 0x00006000,0x00008100,0x00004F00,0x0000DC00,0x00002200,0x00002A00,0x00009000,0x00008800, - 0x00004600,0x0000EE00,0x0000B800,0x00001400,0x0000DE00,0x00005E00,0x00000B00,0x0000DB00, - 0x0000E000,0x00003200,0x00003A00,0x00000A00,0x00004900,0x00000600,0x00002400,0x00005C00, - 0x0000C200,0x0000D300,0x0000AC00,0x00006200,0x00009100,0x00009500,0x0000E400,0x00007900, - 0x0000E700,0x0000C800,0x00003700,0x00006D00,0x00008D00,0x0000D500,0x00004E00,0x0000A900, - 0x00006C00,0x00005600,0x0000F400,0x0000EA00,0x00006500,0x00007A00,0x0000AE00,0x00000800, - 0x0000BA00,0x00007800,0x00002500,0x00002E00,0x00001C00,0x0000A600,0x0000B400,0x0000C600, - 0x0000E800,0x0000DD00,0x00007400,0x00001F00,0x00004B00,0x0000BD00,0x00008B00,0x00008A00, - 0x00007000,0x00003E00,0x0000B500,0x00006600,0x00004800,0x00000300,0x0000F600,0x00000E00, - 0x00006100,0x00003500,0x00005700,0x0000B900,0x00008600,0x0000C100,0x00001D00,0x00009E00, - 0x0000E100,0x0000F800,0x00009800,0x00001100,0x00006900,0x0000D900,0x00008E00,0x00009400, - 0x00009B00,0x00001E00,0x00008700,0x0000E900,0x0000CE00,0x00005500,0x00002800,0x0000DF00, - 0x00008C00,0x0000A100,0x00008900,0x00000D00,0x0000BF00,0x0000E600,0x00004200,0x00006800, - 0x00004100,0x00009900,0x00002D00,0x00000F00,0x0000B000,0x00005400,0x0000BB00,0x00001600 - }, - { - 0x00630000,0x007C0000,0x00770000,0x007B0000,0x00F20000,0x006B0000,0x006F0000,0x00C50000, - 0x00300000,0x00010000,0x00670000,0x002B0000,0x00FE0000,0x00D70000,0x00AB0000,0x00760000, - 0x00CA0000,0x00820000,0x00C90000,0x007D0000,0x00FA0000,0x00590000,0x00470000,0x00F00000, - 0x00AD0000,0x00D40000,0x00A20000,0x00AF0000,0x009C0000,0x00A40000,0x00720000,0x00C00000, - 0x00B70000,0x00FD0000,0x00930000,0x00260000,0x00360000,0x003F0000,0x00F70000,0x00CC0000, - 0x00340000,0x00A50000,0x00E50000,0x00F10000,0x00710000,0x00D80000,0x00310000,0x00150000, - 0x00040000,0x00C70000,0x00230000,0x00C30000,0x00180000,0x00960000,0x00050000,0x009A0000, - 0x00070000,0x00120000,0x00800000,0x00E20000,0x00EB0000,0x00270000,0x00B20000,0x00750000, - 0x00090000,0x00830000,0x002C0000,0x001A0000,0x001B0000,0x006E0000,0x005A0000,0x00A00000, - 0x00520000,0x003B0000,0x00D60000,0x00B30000,0x00290000,0x00E30000,0x002F0000,0x00840000, - 0x00530000,0x00D10000,0000000000,0x00ED0000,0x00200000,0x00FC0000,0x00B10000,0x005B0000, - 0x006A0000,0x00CB0000,0x00BE0000,0x00390000,0x004A0000,0x004C0000,0x00580000,0x00CF0000, - 0x00D00000,0x00EF0000,0x00AA0000,0x00FB0000,0x00430000,0x004D0000,0x00330000,0x00850000, - 0x00450000,0x00F90000,0x00020000,0x007F0000,0x00500000,0x003C0000,0x009F0000,0x00A80000, - 0x00510000,0x00A30000,0x00400000,0x008F0000,0x00920000,0x009D0000,0x00380000,0x00F50000, - 0x00BC0000,0x00B60000,0x00DA0000,0x00210000,0x00100000,0x00FF0000,0x00F30000,0x00D20000, - 0x00CD0000,0x000C0000,0x00130000,0x00EC0000,0x005F0000,0x00970000,0x00440000,0x00170000, - 0x00C40000,0x00A70000,0x007E0000,0x003D0000,0x00640000,0x005D0000,0x00190000,0x00730000, - 0x00600000,0x00810000,0x004F0000,0x00DC0000,0x00220000,0x002A0000,0x00900000,0x00880000, - 0x00460000,0x00EE0000,0x00B80000,0x00140000,0x00DE0000,0x005E0000,0x000B0000,0x00DB0000, - 0x00E00000,0x00320000,0x003A0000,0x000A0000,0x00490000,0x00060000,0x00240000,0x005C0000, - 0x00C20000,0x00D30000,0x00AC0000,0x00620000,0x00910000,0x00950000,0x00E40000,0x00790000, - 0x00E70000,0x00C80000,0x00370000,0x006D0000,0x008D0000,0x00D50000,0x004E0000,0x00A90000, - 0x006C0000,0x00560000,0x00F40000,0x00EA0000,0x00650000,0x007A0000,0x00AE0000,0x00080000, - 0x00BA0000,0x00780000,0x00250000,0x002E0000,0x001C0000,0x00A60000,0x00B40000,0x00C60000, - 0x00E80000,0x00DD0000,0x00740000,0x001F0000,0x004B0000,0x00BD0000,0x008B0000,0x008A0000, - 0x00700000,0x003E0000,0x00B50000,0x00660000,0x00480000,0x00030000,0x00F60000,0x000E0000, - 0x00610000,0x00350000,0x00570000,0x00B90000,0x00860000,0x00C10000,0x001D0000,0x009E0000, - 0x00E10000,0x00F80000,0x00980000,0x00110000,0x00690000,0x00D90000,0x008E0000,0x00940000, - 0x009B0000,0x001E0000,0x00870000,0x00E90000,0x00CE0000,0x00550000,0x00280000,0x00DF0000, - 0x008C0000,0x00A10000,0x00890000,0x000D0000,0x00BF0000,0x00E60000,0x00420000,0x00680000, - 0x00410000,0x00990000,0x002D0000,0x000F0000,0x00B00000,0x00540000,0x00BB0000,0x00160000 - }, - { - 0x63000000,0x7C000000,0x77000000,0x7B000000,0xF2000000,0x6B000000,0x6F000000,0xC5000000, - 0x30000000,0x01000000,0x67000000,0x2B000000,0xFE000000,0xD7000000,0xAB000000,0x76000000, - 0xCA000000,0x82000000,0xC9000000,0x7D000000,0xFA000000,0x59000000,0x47000000,0xF0000000, - 0xAD000000,0xD4000000,0xA2000000,0xAF000000,0x9C000000,0xA4000000,0x72000000,0xC0000000, - 0xB7000000,0xFD000000,0x93000000,0x26000000,0x36000000,0x3F000000,0xF7000000,0xCC000000, - 0x34000000,0xA5000000,0xE5000000,0xF1000000,0x71000000,0xD8000000,0x31000000,0x15000000, - 0x04000000,0xC7000000,0x23000000,0xC3000000,0x18000000,0x96000000,0x05000000,0x9A000000, - 0x07000000,0x12000000,0x80000000,0xE2000000,0xEB000000,0x27000000,0xB2000000,0x75000000, - 0x09000000,0x83000000,0x2C000000,0x1A000000,0x1B000000,0x6E000000,0x5A000000,0xA0000000, - 0x52000000,0x3B000000,0xD6000000,0xB3000000,0x29000000,0xE3000000,0x2F000000,0x84000000, - 0x53000000,0xD1000000,0000000000,0xED000000,0x20000000,0xFC000000,0xB1000000,0x5B000000, - 0x6A000000,0xCB000000,0xBE000000,0x39000000,0x4A000000,0x4C000000,0x58000000,0xCF000000, - 0xD0000000,0xEF000000,0xAA000000,0xFB000000,0x43000000,0x4D000000,0x33000000,0x85000000, - 0x45000000,0xF9000000,0x02000000,0x7F000000,0x50000000,0x3C000000,0x9F000000,0xA8000000, - 0x51000000,0xA3000000,0x40000000,0x8F000000,0x92000000,0x9D000000,0x38000000,0xF5000000, - 0xBC000000,0xB6000000,0xDA000000,0x21000000,0x10000000,0xFF000000,0xF3000000,0xD2000000, - 0xCD000000,0x0C000000,0x13000000,0xEC000000,0x5F000000,0x97000000,0x44000000,0x17000000, - 0xC4000000,0xA7000000,0x7E000000,0x3D000000,0x64000000,0x5D000000,0x19000000,0x73000000, - 0x60000000,0x81000000,0x4F000000,0xDC000000,0x22000000,0x2A000000,0x90000000,0x88000000, - 0x46000000,0xEE000000,0xB8000000,0x14000000,0xDE000000,0x5E000000,0x0B000000,0xDB000000, - 0xE0000000,0x32000000,0x3A000000,0x0A000000,0x49000000,0x06000000,0x24000000,0x5C000000, - 0xC2000000,0xD3000000,0xAC000000,0x62000000,0x91000000,0x95000000,0xE4000000,0x79000000, - 0xE7000000,0xC8000000,0x37000000,0x6D000000,0x8D000000,0xD5000000,0x4E000000,0xA9000000, - 0x6C000000,0x56000000,0xF4000000,0xEA000000,0x65000000,0x7A000000,0xAE000000,0x08000000, - 0xBA000000,0x78000000,0x25000000,0x2E000000,0x1C000000,0xA6000000,0xB4000000,0xC6000000, - 0xE8000000,0xDD000000,0x74000000,0x1F000000,0x4B000000,0xBD000000,0x8B000000,0x8A000000, - 0x70000000,0x3E000000,0xB5000000,0x66000000,0x48000000,0x03000000,0xF6000000,0x0E000000, - 0x61000000,0x35000000,0x57000000,0xB9000000,0x86000000,0xC1000000,0x1D000000,0x9E000000, - 0xE1000000,0xF8000000,0x98000000,0x11000000,0x69000000,0xD9000000,0x8E000000,0x94000000, - 0x9B000000,0x1E000000,0x87000000,0xE9000000,0xCE000000,0x55000000,0x28000000,0xDF000000, - 0x8C000000,0xA1000000,0x89000000,0x0D000000,0xBF000000,0xE6000000,0x42000000,0x68000000, - 0x41000000,0x99000000,0x2D000000,0x0F000000,0xB0000000,0x54000000,0xBB000000,0x16000000 - } +static uint32_t fl_tab[4][256] = { + { + 0x00000063,0x0000007C,0x00000077,0x0000007B,0x000000F2,0x0000006B,0x0000006F,0x000000C5, + 0x00000030,0x00000001,0x00000067,0x0000002B,0x000000FE,0x000000D7,0x000000AB,0x00000076, + 0x000000CA,0x00000082,0x000000C9,0x0000007D,0x000000FA,0x00000059,0x00000047,0x000000F0, + 0x000000AD,0x000000D4,0x000000A2,0x000000AF,0x0000009C,0x000000A4,0x00000072,0x000000C0, + 0x000000B7,0x000000FD,0x00000093,0x00000026,0x00000036,0x0000003F,0x000000F7,0x000000CC, + 0x00000034,0x000000A5,0x000000E5,0x000000F1,0x00000071,0x000000D8,0x00000031,0x00000015, + 0x00000004,0x000000C7,0x00000023,0x000000C3,0x00000018,0x00000096,0x00000005,0x0000009A, + 0x00000007,0x00000012,0x00000080,0x000000E2,0x000000EB,0x00000027,0x000000B2,0x00000075, + 0x00000009,0x00000083,0x0000002C,0x0000001A,0x0000001B,0x0000006E,0x0000005A,0x000000A0, + 0x00000052,0x0000003B,0x000000D6,0x000000B3,0x00000029,0x000000E3,0x0000002F,0x00000084, + 0x00000053,0x000000D1,0x00000000,0x000000ED,0x00000020,0x000000FC,0x000000B1,0x0000005B, + 0x0000006A,0x000000CB,0x000000BE,0x00000039,0x0000004A,0x0000004C,0x00000058,0x000000CF, + 0x000000D0,0x000000EF,0x000000AA,0x000000FB,0x00000043,0x0000004D,0x00000033,0x00000085, + 0x00000045,0x000000F9,0x00000002,0x0000007F,0x00000050,0x0000003C,0x0000009F,0x000000A8, + 0x00000051,0x000000A3,0x00000040,0x0000008F,0x00000092,0x0000009D,0x00000038,0x000000F5, + 0x000000BC,0x000000B6,0x000000DA,0x00000021,0x00000010,0x000000FF,0x000000F3,0x000000D2, + 0x000000CD,0x0000000C,0x00000013,0x000000EC,0x0000005F,0x00000097,0x00000044,0x00000017, + 0x000000C4,0x000000A7,0x0000007E,0x0000003D,0x00000064,0x0000005D,0x00000019,0x00000073, + 0x00000060,0x00000081,0x0000004F,0x000000DC,0x00000022,0x0000002A,0x00000090,0x00000088, + 0x00000046,0x000000EE,0x000000B8,0x00000014,0x000000DE,0x0000005E,0x0000000B,0x000000DB, + 0x000000E0,0x00000032,0x0000003A,0x0000000A,0x00000049,0x00000006,0x00000024,0x0000005C, + 0x000000C2,0x000000D3,0x000000AC,0x00000062,0x00000091,0x00000095,0x000000E4,0x00000079, + 0x000000E7,0x000000C8,0x00000037,0x0000006D,0x0000008D,0x000000D5,0x0000004E,0x000000A9, + 0x0000006C,0x00000056,0x000000F4,0x000000EA,0x00000065,0x0000007A,0x000000AE,0x00000008, + 0x000000BA,0x00000078,0x00000025,0x0000002E,0x0000001C,0x000000A6,0x000000B4,0x000000C6, + 0x000000E8,0x000000DD,0x00000074,0x0000001F,0x0000004B,0x000000BD,0x0000008B,0x0000008A, + 0x00000070,0x0000003E,0x000000B5,0x00000066,0x00000048,0x00000003,0x000000F6,0x0000000E, + 0x00000061,0x00000035,0x00000057,0x000000B9,0x00000086,0x000000C1,0x0000001D,0x0000009E, + 0x000000E1,0x000000F8,0x00000098,0x00000011,0x00000069,0x000000D9,0x0000008E,0x00000094, + 0x0000009B,0x0000001E,0x00000087,0x000000E9,0x000000CE,0x00000055,0x00000028,0x000000DF, + 0x0000008C,0x000000A1,0x00000089,0x0000000D,0x000000BF,0x000000E6,0x00000042,0x00000068, + 0x00000041,0x00000099,0x0000002D,0x0000000F,0x000000B0,0x00000054,0x000000BB,0x00000016 + }, + { + 0x00006300,0x00007C00,0x00007700,0x00007B00,0x0000F200,0x00006B00,0x00006F00,0x0000C500, + 0x00003000,0x00000100,0x00006700,0x00002B00,0x0000FE00,0x0000D700,0x0000AB00,0x00007600, + 0x0000CA00,0x00008200,0x0000C900,0x00007D00,0x0000FA00,0x00005900,0x00004700,0x0000F000, + 0x0000AD00,0x0000D400,0x0000A200,0x0000AF00,0x00009C00,0x0000A400,0x00007200,0x0000C000, + 0x0000B700,0x0000FD00,0x00009300,0x00002600,0x00003600,0x00003F00,0x0000F700,0x0000CC00, + 0x00003400,0x0000A500,0x0000E500,0x0000F100,0x00007100,0x0000D800,0x00003100,0x00001500, + 0x00000400,0x0000C700,0x00002300,0x0000C300,0x00001800,0x00009600,0x00000500,0x00009A00, + 0x00000700,0x00001200,0x00008000,0x0000E200,0x0000EB00,0x00002700,0x0000B200,0x00007500, + 0x00000900,0x00008300,0x00002C00,0x00001A00,0x00001B00,0x00006E00,0x00005A00,0x0000A000, + 0x00005200,0x00003B00,0x0000D600,0x0000B300,0x00002900,0x0000E300,0x00002F00,0x00008400, + 0x00005300,0x0000D100,0000000000,0x0000ED00,0x00002000,0x0000FC00,0x0000B100,0x00005B00, + 0x00006A00,0x0000CB00,0x0000BE00,0x00003900,0x00004A00,0x00004C00,0x00005800,0x0000CF00, + 0x0000D000,0x0000EF00,0x0000AA00,0x0000FB00,0x00004300,0x00004D00,0x00003300,0x00008500, + 0x00004500,0x0000F900,0x00000200,0x00007F00,0x00005000,0x00003C00,0x00009F00,0x0000A800, + 0x00005100,0x0000A300,0x00004000,0x00008F00,0x00009200,0x00009D00,0x00003800,0x0000F500, + 0x0000BC00,0x0000B600,0x0000DA00,0x00002100,0x00001000,0x0000FF00,0x0000F300,0x0000D200, + 0x0000CD00,0x00000C00,0x00001300,0x0000EC00,0x00005F00,0x00009700,0x00004400,0x00001700, + 0x0000C400,0x0000A700,0x00007E00,0x00003D00,0x00006400,0x00005D00,0x00001900,0x00007300, + 0x00006000,0x00008100,0x00004F00,0x0000DC00,0x00002200,0x00002A00,0x00009000,0x00008800, + 0x00004600,0x0000EE00,0x0000B800,0x00001400,0x0000DE00,0x00005E00,0x00000B00,0x0000DB00, + 0x0000E000,0x00003200,0x00003A00,0x00000A00,0x00004900,0x00000600,0x00002400,0x00005C00, + 0x0000C200,0x0000D300,0x0000AC00,0x00006200,0x00009100,0x00009500,0x0000E400,0x00007900, + 0x0000E700,0x0000C800,0x00003700,0x00006D00,0x00008D00,0x0000D500,0x00004E00,0x0000A900, + 0x00006C00,0x00005600,0x0000F400,0x0000EA00,0x00006500,0x00007A00,0x0000AE00,0x00000800, + 0x0000BA00,0x00007800,0x00002500,0x00002E00,0x00001C00,0x0000A600,0x0000B400,0x0000C600, + 0x0000E800,0x0000DD00,0x00007400,0x00001F00,0x00004B00,0x0000BD00,0x00008B00,0x00008A00, + 0x00007000,0x00003E00,0x0000B500,0x00006600,0x00004800,0x00000300,0x0000F600,0x00000E00, + 0x00006100,0x00003500,0x00005700,0x0000B900,0x00008600,0x0000C100,0x00001D00,0x00009E00, + 0x0000E100,0x0000F800,0x00009800,0x00001100,0x00006900,0x0000D900,0x00008E00,0x00009400, + 0x00009B00,0x00001E00,0x00008700,0x0000E900,0x0000CE00,0x00005500,0x00002800,0x0000DF00, + 0x00008C00,0x0000A100,0x00008900,0x00000D00,0x0000BF00,0x0000E600,0x00004200,0x00006800, + 0x00004100,0x00009900,0x00002D00,0x00000F00,0x0000B000,0x00005400,0x0000BB00,0x00001600 + }, + { + 0x00630000,0x007C0000,0x00770000,0x007B0000,0x00F20000,0x006B0000,0x006F0000,0x00C50000, + 0x00300000,0x00010000,0x00670000,0x002B0000,0x00FE0000,0x00D70000,0x00AB0000,0x00760000, + 0x00CA0000,0x00820000,0x00C90000,0x007D0000,0x00FA0000,0x00590000,0x00470000,0x00F00000, + 0x00AD0000,0x00D40000,0x00A20000,0x00AF0000,0x009C0000,0x00A40000,0x00720000,0x00C00000, + 0x00B70000,0x00FD0000,0x00930000,0x00260000,0x00360000,0x003F0000,0x00F70000,0x00CC0000, + 0x00340000,0x00A50000,0x00E50000,0x00F10000,0x00710000,0x00D80000,0x00310000,0x00150000, + 0x00040000,0x00C70000,0x00230000,0x00C30000,0x00180000,0x00960000,0x00050000,0x009A0000, + 0x00070000,0x00120000,0x00800000,0x00E20000,0x00EB0000,0x00270000,0x00B20000,0x00750000, + 0x00090000,0x00830000,0x002C0000,0x001A0000,0x001B0000,0x006E0000,0x005A0000,0x00A00000, + 0x00520000,0x003B0000,0x00D60000,0x00B30000,0x00290000,0x00E30000,0x002F0000,0x00840000, + 0x00530000,0x00D10000,0000000000,0x00ED0000,0x00200000,0x00FC0000,0x00B10000,0x005B0000, + 0x006A0000,0x00CB0000,0x00BE0000,0x00390000,0x004A0000,0x004C0000,0x00580000,0x00CF0000, + 0x00D00000,0x00EF0000,0x00AA0000,0x00FB0000,0x00430000,0x004D0000,0x00330000,0x00850000, + 0x00450000,0x00F90000,0x00020000,0x007F0000,0x00500000,0x003C0000,0x009F0000,0x00A80000, + 0x00510000,0x00A30000,0x00400000,0x008F0000,0x00920000,0x009D0000,0x00380000,0x00F50000, + 0x00BC0000,0x00B60000,0x00DA0000,0x00210000,0x00100000,0x00FF0000,0x00F30000,0x00D20000, + 0x00CD0000,0x000C0000,0x00130000,0x00EC0000,0x005F0000,0x00970000,0x00440000,0x00170000, + 0x00C40000,0x00A70000,0x007E0000,0x003D0000,0x00640000,0x005D0000,0x00190000,0x00730000, + 0x00600000,0x00810000,0x004F0000,0x00DC0000,0x00220000,0x002A0000,0x00900000,0x00880000, + 0x00460000,0x00EE0000,0x00B80000,0x00140000,0x00DE0000,0x005E0000,0x000B0000,0x00DB0000, + 0x00E00000,0x00320000,0x003A0000,0x000A0000,0x00490000,0x00060000,0x00240000,0x005C0000, + 0x00C20000,0x00D30000,0x00AC0000,0x00620000,0x00910000,0x00950000,0x00E40000,0x00790000, + 0x00E70000,0x00C80000,0x00370000,0x006D0000,0x008D0000,0x00D50000,0x004E0000,0x00A90000, + 0x006C0000,0x00560000,0x00F40000,0x00EA0000,0x00650000,0x007A0000,0x00AE0000,0x00080000, + 0x00BA0000,0x00780000,0x00250000,0x002E0000,0x001C0000,0x00A60000,0x00B40000,0x00C60000, + 0x00E80000,0x00DD0000,0x00740000,0x001F0000,0x004B0000,0x00BD0000,0x008B0000,0x008A0000, + 0x00700000,0x003E0000,0x00B50000,0x00660000,0x00480000,0x00030000,0x00F60000,0x000E0000, + 0x00610000,0x00350000,0x00570000,0x00B90000,0x00860000,0x00C10000,0x001D0000,0x009E0000, + 0x00E10000,0x00F80000,0x00980000,0x00110000,0x00690000,0x00D90000,0x008E0000,0x00940000, + 0x009B0000,0x001E0000,0x00870000,0x00E90000,0x00CE0000,0x00550000,0x00280000,0x00DF0000, + 0x008C0000,0x00A10000,0x00890000,0x000D0000,0x00BF0000,0x00E60000,0x00420000,0x00680000, + 0x00410000,0x00990000,0x002D0000,0x000F0000,0x00B00000,0x00540000,0x00BB0000,0x00160000 + }, + { + 0x63000000,0x7C000000,0x77000000,0x7B000000,0xF2000000,0x6B000000,0x6F000000,0xC5000000, + 0x30000000,0x01000000,0x67000000,0x2B000000,0xFE000000,0xD7000000,0xAB000000,0x76000000, + 0xCA000000,0x82000000,0xC9000000,0x7D000000,0xFA000000,0x59000000,0x47000000,0xF0000000, + 0xAD000000,0xD4000000,0xA2000000,0xAF000000,0x9C000000,0xA4000000,0x72000000,0xC0000000, + 0xB7000000,0xFD000000,0x93000000,0x26000000,0x36000000,0x3F000000,0xF7000000,0xCC000000, + 0x34000000,0xA5000000,0xE5000000,0xF1000000,0x71000000,0xD8000000,0x31000000,0x15000000, + 0x04000000,0xC7000000,0x23000000,0xC3000000,0x18000000,0x96000000,0x05000000,0x9A000000, + 0x07000000,0x12000000,0x80000000,0xE2000000,0xEB000000,0x27000000,0xB2000000,0x75000000, + 0x09000000,0x83000000,0x2C000000,0x1A000000,0x1B000000,0x6E000000,0x5A000000,0xA0000000, + 0x52000000,0x3B000000,0xD6000000,0xB3000000,0x29000000,0xE3000000,0x2F000000,0x84000000, + 0x53000000,0xD1000000,0000000000,0xED000000,0x20000000,0xFC000000,0xB1000000,0x5B000000, + 0x6A000000,0xCB000000,0xBE000000,0x39000000,0x4A000000,0x4C000000,0x58000000,0xCF000000, + 0xD0000000,0xEF000000,0xAA000000,0xFB000000,0x43000000,0x4D000000,0x33000000,0x85000000, + 0x45000000,0xF9000000,0x02000000,0x7F000000,0x50000000,0x3C000000,0x9F000000,0xA8000000, + 0x51000000,0xA3000000,0x40000000,0x8F000000,0x92000000,0x9D000000,0x38000000,0xF5000000, + 0xBC000000,0xB6000000,0xDA000000,0x21000000,0x10000000,0xFF000000,0xF3000000,0xD2000000, + 0xCD000000,0x0C000000,0x13000000,0xEC000000,0x5F000000,0x97000000,0x44000000,0x17000000, + 0xC4000000,0xA7000000,0x7E000000,0x3D000000,0x64000000,0x5D000000,0x19000000,0x73000000, + 0x60000000,0x81000000,0x4F000000,0xDC000000,0x22000000,0x2A000000,0x90000000,0x88000000, + 0x46000000,0xEE000000,0xB8000000,0x14000000,0xDE000000,0x5E000000,0x0B000000,0xDB000000, + 0xE0000000,0x32000000,0x3A000000,0x0A000000,0x49000000,0x06000000,0x24000000,0x5C000000, + 0xC2000000,0xD3000000,0xAC000000,0x62000000,0x91000000,0x95000000,0xE4000000,0x79000000, + 0xE7000000,0xC8000000,0x37000000,0x6D000000,0x8D000000,0xD5000000,0x4E000000,0xA9000000, + 0x6C000000,0x56000000,0xF4000000,0xEA000000,0x65000000,0x7A000000,0xAE000000,0x08000000, + 0xBA000000,0x78000000,0x25000000,0x2E000000,0x1C000000,0xA6000000,0xB4000000,0xC6000000, + 0xE8000000,0xDD000000,0x74000000,0x1F000000,0x4B000000,0xBD000000,0x8B000000,0x8A000000, + 0x70000000,0x3E000000,0xB5000000,0x66000000,0x48000000,0x03000000,0xF6000000,0x0E000000, + 0x61000000,0x35000000,0x57000000,0xB9000000,0x86000000,0xC1000000,0x1D000000,0x9E000000, + 0xE1000000,0xF8000000,0x98000000,0x11000000,0x69000000,0xD9000000,0x8E000000,0x94000000, + 0x9B000000,0x1E000000,0x87000000,0xE9000000,0xCE000000,0x55000000,0x28000000,0xDF000000, + 0x8C000000,0xA1000000,0x89000000,0x0D000000,0xBF000000,0xE6000000,0x42000000,0x68000000, + 0x41000000,0x99000000,0x2D000000,0x0F000000,0xB0000000,0x54000000,0xBB000000,0x16000000 + } }; /*----------------- The workspace ------------------------------*/ @@ -432,16 +432,15 @@ void RijndaelKeySchedule(uint8_t key[16]) { uint32_t t; uint32_t *ek=Ekey, /* pointer to the expanded key */ - *rc=rnd_con; /* pointer to the round constant */ + *rc=rnd_con; /* pointer to the round constant */ Ekey[0] = u32_in(key ); Ekey[1] = u32_in(key + 4); Ekey[2] = u32_in(key + 8); Ekey[3] = u32_in(key + 12); - while(ek < Ekey + 40) - { - t = rot3(ek[3]); + while(ek < Ekey + 40) { + t = rot3(ek[3]); ek[4] = ek[0] ^ ls_box(t) ^ *rc++; ek[5] = ek[1] ^ ek[4]; ek[6] = ek[2] ^ ek[5]; @@ -463,18 +462,18 @@ void RijndaelEncrypt(uint8_t in[16], uint8_t out[16]) b0[2] = u32_in(in + 8) ^ *kp++; b0[3] = u32_in(in + 12) ^ *kp++; - f_round(b1, b0, kp); + f_round(b1, b0, kp); f_round(b0, b1, kp); - f_round(b1, b0, kp); + f_round(b1, b0, kp); f_round(b0, b1, kp); - f_round(b1, b0, kp); + f_round(b1, b0, kp); f_round(b0, b1, kp); - f_round(b1, b0, kp); + f_round(b1, b0, kp); f_round(b0, b1, kp); - f_round(b1, b0, kp); + f_round(b1, b0, kp); - u32_out(out, lf_rnd(b1, 0) ^ kp[0]); + u32_out(out, lf_rnd(b1, 0) ^ kp[0]); u32_out(out + 4, lf_rnd(b1, 1) ^ kp[1]); - u32_out(out + 8, lf_rnd(b1, 2) ^ kp[2]); + u32_out(out + 8, lf_rnd(b1, 2) ^ kp[2]); u32_out(out + 12, lf_rnd(b1, 3) ^ kp[3]); } diff --git a/tinySIP/src/dialogs/tsip_dialog.c b/tinySIP/src/dialogs/tsip_dialog.c index 13dcdf4..3f23f0e 100755 --- a/tinySIP/src/dialogs/tsip_dialog.c +++ b/tinySIP/src/dialogs/tsip_dialog.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. * @@ -87,363 +87,361 @@ extern tsip_uri_t* tsip_stack_get_contacturi(const tsip_stack_t *self, const cha tsip_request_t *tsip_dialog_request_new(const tsip_dialog_t *self, const char* method) { - tsip_request_t *request = tsk_null; - tsip_uri_t *to_uri, *from_uri, *request_uri; - const char *call_id; - int copy_routes_start = -1; /* NONE */ - const tsk_list_item_t* item; - - /* - RFC 3261 - 12.2.1.1 Generating the Request - - The Call-ID of the request MUST be set to the Call-ID of the dialog. - */ - call_id = self->callid; - - /* - RFC 3261 - 12.2.1.1 Generating the Request - - Requests within a dialog MUST contain strictly monotonically - increasing and contiguous CSeq sequence numbers (increasing-by-one) - in each direction (excepting ACK and CANCEL of course, whose numbers - equal the requests being acknowledged or cancelled). Therefore, if - the local sequence number is not empty, the value of the local - sequence number MUST be incremented by one, and this value MUST be - placed into the CSeq header field. - */ - /*if(!tsk_striequals(method, "ACK") && !tsk_striequals(method, "CANCEL")) - { - TSIP_DIALOG(self)->cseq_value +=1; - } - ===> See send method (cseq will be incremented before sending the request) - */ - - - /* - RFC 3261 - 12.2.1.1 Generating the Request - - The URI in the To field of the request MUST be set to the remote URI - from the dialog state. The tag in the To header field of the request - MUST be set to the remote tag of the dialog ID. The From URI of the - request MUST be set to the local URI from the dialog state. The tag - in the From header field of the request MUST be set to the local tag - of the dialog ID. If the value of the remote or local tags is null, - the tag parameter MUST be omitted from the To or From header fields, - respectively. - */ - to_uri = tsk_object_ref((void*)self->uri_remote); - from_uri = tsk_object_ref((void*)self->uri_local); - - - /* - RFC 3261 - 12.2.1.1 Generating the Request - - If the route set is empty, the UAC MUST place the remote target URI - into the Request-URI. The UAC MUST NOT add a Route header field to - the request. - */ - if(TSK_LIST_IS_EMPTY(self->record_routes)){ - request_uri = tsk_object_ref((void*)self->uri_remote_target); - } - - /* - RFC 3261 - 12.2.1.1 Generating the Request - - If the route set is not empty, and the first URI in the route set - contains the lr parameter (see Section 19.1.1), the UAC MUST place - the remote target URI into the Request-URI and MUST include a Route - header field containing the route set values in order, including all - parameters. - - If the route set is not empty, and its first URI does not contain the - lr parameter, the UAC MUST place the first URI from the route set - into the Request-URI, stripping any parameters that are not allowed - in a Request-URI. The UAC MUST add a Route header field containing - the remainder of the route set values in order, including all - parameters. The UAC MUST then place the remote target URI into the - Route header field as the last value. - - For example, if the remote target is sip:user@remoteua and the route - set contains: - - <sip:proxy1>,<sip:proxy2>,<sip:proxy3;lr>,<sip:proxy4> - */ - else{ - const tsip_uri_t *first_route = ((tsip_header_Record_Route_t*)TSK_LIST_FIRST_DATA(self->record_routes))->uri; - if(tsk_params_have_param(first_route->params, "lr")){ - request_uri = tsk_object_ref(self->uri_remote_target); - copy_routes_start = 0; /* Copy all */ - } - else{ - request_uri = tsk_object_ref((void*)first_route); - copy_routes_start = 1; /* Copy starting at index 1. */ - } - } - - /*===================================================================== - */ - request = tsip_request_new(method, request_uri, from_uri, to_uri, call_id, self->cseq_value); - request->To->tag = tsk_strdup(self->tag_remote); - request->From->tag = tsk_strdup(self->tag_local); - request->update = tsk_true; /* Now signal that the message should be updated by the transport layer (Contact, SigComp, IPSec, ...) */ - - - /* - RFC 3261 - 12.2.1.1 Generating the Request - - A UAC SHOULD include a Contact header field in any target refresh - requests within a dialog, and unless there is a need to change it, - the URI SHOULD be the same as used in previous requests within the - dialog. If the "secure" flag is true, that URI MUST be a SIPS URI. - As discussed in Section 12.2.2, a Contact header field in a target - refresh request updates the remote target URI. This allows a UA to - provide a new contact address, should its address change during the - duration of the dialog. - */ - switch(request->line.request.request_type){ - case tsip_MESSAGE: - case tsip_PUBLISH: - case tsip_BYE: - { - if(request->line.request.request_type == tsip_PUBLISH) { - TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_EXPIRES_VA_ARGS(TSK_TIME_MS_2_S(self->expires))); - } - /* add caps in Accept-Contact headers */ - tsk_list_foreach(item, self->ss->caps) { - const tsk_param_t* param = TSK_PARAM(item->data); - char* value = tsk_null; - tsk_sprintf(&value, "*;%s%s%s", - param->name, - param->value ? "=" : "", - param->value ? param->value : ""); - if(value) { - TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_DUMMY_VA_ARGS("Accept-Contact", value)); - TSK_FREE(value); - } - } - break; - } - - default: - { - char* contact = tsk_null; - tsip_header_Contacts_L_t *hdr_contacts; - - if(request->line.request.request_type == tsip_OPTIONS || - request->line.request.request_type == tsip_PUBLISH || - request->line.request.request_type == tsip_REGISTER){ - /**** with expires */ - tsk_sprintf(&contact, "m: <%s:%s@%s:%d>;expires=%d\r\n", - "sip", - from_uri->user_name, - "127.0.0.1", - 5060, - - TSK_TIME_MS_2_S(self->expires)); - } - else{ - /**** without expires */ - if(request->line.request.request_type == tsip_SUBSCRIBE){ - /* RFC 3265 - 3.1.1. Subscription Duration - An "expires" parameter on the "Contact" header has no semantics for SUBSCRIBE and is explicitly - not equivalent to an "Expires" header in a SUBSCRIBE request or response. - */ - TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_EXPIRES_VA_ARGS(TSK_TIME_MS_2_S(self->expires))); - } - tsk_sprintf(&contact, "m: <%s:%s@%s:%d%s%s%s%s%s%s%s%s%s>\r\n", - "sip", - from_uri->user_name, - "127.0.0.1", - 5060, - - self->ss->ws.src.host ? ";" : "", - self->ss->ws.src.host ? "ws-src-ip=" : "", - self->ss->ws.src.host ? self->ss->ws.src.host : "", - self->ss->ws.src.port[0] ? ";" : "", - self->ss->ws.src.port[0] ? "ws-src-port=" : "", - self->ss->ws.src.port[0] ? self->ss->ws.src.port : "", - self->ss->ws.src.proto ? ";" : "", - self->ss->ws.src.proto ? "ws-src-proto=" : "", - self->ss->ws.src.proto ? self->ss->ws.src.proto : "" - ); - } - hdr_contacts = tsip_header_Contact_parse(contact, tsk_strlen(contact)); - if(!TSK_LIST_IS_EMPTY(hdr_contacts)){ - request->Contact = tsk_object_ref(hdr_contacts->head->data); - } - TSK_OBJECT_SAFE_FREE(hdr_contacts); - TSK_FREE(contact); - - /* Add capabilities as per RFC 3840 */ - if(request->Contact) { - tsk_list_foreach(item, self->ss->caps){ - tsk_params_add_param(&TSIP_HEADER(request->Contact)->params, TSK_PARAM(item->data)->name, TSK_PARAM(item->data)->value); - } - } - - break; - } - } - - /* Update authorizations */ - if(self->state == tsip_initial && TSK_LIST_IS_EMPTY(self->challenges)){ - /* 3GPP TS 33.978 6.2.3.1 Procedures at the UE - On sending a REGISTER request in order to indicate support for early IMS security procedures, the UE shall not - include an Authorization header field and not include header fields or header field values as required by RFC3329. - */ - if(TSIP_REQUEST_IS_REGISTER(request) && !TSIP_DIALOG_GET_STACK(self)->security.earlyIMS){ - /* 3GPP TS 24.229 - 5.1.1.2.2 Initial registration using IMS AKA - On sending a REGISTER request, the UE shall populate the header fields as follows: - a) an Authorization header field, with: - - the "username" header field parameter, set to the value of the private user identity; - - the "realm" header field parameter, set to the domain name of the home network; - - the "uri" header field parameter, set to the SIP URI of the domain name of the home network; - - the "nonce" header field parameter, set to an empty value; and - - the "response" header field parameter, set to an empty value; - */ - const char* realm = TSIP_DIALOG_GET_STACK(self)->network.realm ? TSIP_DIALOG_GET_STACK(self)->network.realm->host : "(null)"; - char* request_uri = tsip_uri_tostring(request->line.request.uri, tsk_false, tsk_false); - tsip_header_t* auth_hdr = tsip_challenge_create_empty_header_authorization(TSIP_DIALOG_GET_STACK(self)->identity.impi, realm, request_uri); - tsip_message_add_header(request, auth_hdr); - tsk_object_unref(auth_hdr), auth_hdr = tsk_null; - TSK_FREE(request_uri); - } - } - else if(!TSK_LIST_IS_EMPTY(self->challenges)){ - tsip_challenge_t *challenge; - tsip_header_t* auth_hdr; - tsk_list_foreach(item, self->challenges){ - challenge = item->data; - auth_hdr = tsip_challenge_create_header_authorization(challenge, request); - if(auth_hdr){ - tsip_message_add_header(request, auth_hdr); - tsk_object_unref(auth_hdr), auth_hdr = tsk_null; - } - } - } - - /* Update CSeq */ - /* RFC 3261 - 13.2.2.4 2xx Responses - Generating ACK: The sequence number of the CSeq header field MUST be - the same as the INVITE being acknowledged, but the CSeq method MUST - be ACK. The ACK MUST contain the same credentials as the INVITE. If - the 2xx contains an offer (based on the rules above), the ACK MUST - carry an answer in its body. - ==> CSeq number will be added/updated by the caller of this function, - credentials were added above. - */ - if(!TSIP_REQUEST_IS_ACK(request) && !TSIP_REQUEST_IS_CANCEL(request)){ - request->CSeq->seq = ++(TSIP_DIALOG(self)->cseq_value); - } - - /* Route generation - * ==> http://betelco.blogspot.com/2008/11/proxy-and-service-route-discovery-in.html - * The dialog Routes have been copied above. - - 3GPP TS 24.229 - 5.1.2A.1 UE-originating case - - The UE shall build a proper preloaded Route header field value for all new dialogs and standalone transactions. The UE - shall build a list of Route header field values made out of the following, in this order: - a) the P-CSCF URI containing the IP address or the FQDN learnt through the P-CSCF discovery procedures; and - b) the P-CSCF port based on the security mechanism in use: - - - if IMS AKA or SIP digest with TLS is in use as a security mechanism, the protected server port learnt during - the registration procedure; - - if SIP digest without TLS, NASS-IMS bundled authentciation or GPRS-IMS-Bundled authentication is in - use as a security mechanism, the unprotected server port used during the registration procedure; - c) and the values received in the Service-Route header field saved from the 200 (OK) response to the last - registration or re-registration of the public user identity with associated contact address. - */ - if(!TSIP_REQUEST_IS_REGISTER(request)) - { // According to the above link ==> Initial/Re/De registration do not have routes. - if(copy_routes_start != -1) - { /* The dialog already have routes ==> copy them. */ - if(self->state == tsip_early || self->state == tsip_established){ - int32_t index = -1; - tsk_list_foreach(item, self->record_routes){ - tsip_header_Record_Route_t *record_Route = ((tsip_header_Record_Route_t*)item->data); - const tsip_uri_t* uri = record_Route->uri; - tsip_header_Route_t *route = tsk_null; - if(++index < copy_routes_start || !uri){ - continue; - } - - if((route = tsip_header_Route_create(uri))){ - // copy parameters: see http://code.google.com/p/imsdroid/issues/detail?id=52 - if(!TSK_LIST_IS_EMPTY(TSIP_HEADER_PARAMS(record_Route))){ - if(!TSIP_HEADER_PARAMS(route)){ - TSIP_HEADER_PARAMS(route) = tsk_list_create(); - } - tsk_list_pushback_list(TSIP_HEADER_PARAMS(route), TSIP_HEADER_PARAMS(record_Route)); - } - - tsip_message_add_header(request, TSIP_HEADER(route)); - TSK_OBJECT_SAFE_FREE(route); - } - } - } - } - else - { /* No routes associated to this dialog. */ - if(self->state == tsip_initial || self->state == tsip_early){ - /* GPP TS 24.229 section 5.1.2A [Generic procedures applicable to all methods excluding the REGISTER method]: - The UE shall build a proper preloaded Route header field value for all new dialogs and standalone transactions. The UE - shall build a list of Route header field values made out of the following, in this order: - a) the P-CSCF URI containing the IP address or the FQDN learnt through the P-CSCF discovery procedures; and - b) the P-CSCF port based on the security mechanism in use: - - if IMS AKA or SIP digest with TLS is in use as a security mechanism, the protected server port learnt during - the registration procedure; - - if SIP digest without TLS, NASS-IMS bundled authentciation or GPRS-IMS-Bundled authentication is in - use as a security mechanism, the unprotected server port used during the registration procedure; - c) and the values received in the Service-Route header field saved from the 200 (OK) response to the last - registration or re-registration of the public user identity with associated contact address. - */ + tsip_request_t *request = tsk_null; + tsip_uri_t *to_uri, *from_uri, *request_uri; + const char *call_id; + int copy_routes_start = -1; /* NONE */ + const tsk_list_item_t* item; + + /* + RFC 3261 - 12.2.1.1 Generating the Request + + The Call-ID of the request MUST be set to the Call-ID of the dialog. + */ + call_id = self->callid; + + /* + RFC 3261 - 12.2.1.1 Generating the Request + + Requests within a dialog MUST contain strictly monotonically + increasing and contiguous CSeq sequence numbers (increasing-by-one) + in each direction (excepting ACK and CANCEL of course, whose numbers + equal the requests being acknowledged or cancelled). Therefore, if + the local sequence number is not empty, the value of the local + sequence number MUST be incremented by one, and this value MUST be + placed into the CSeq header field. + */ + /*if(!tsk_striequals(method, "ACK") && !tsk_striequals(method, "CANCEL")) + { + TSIP_DIALOG(self)->cseq_value +=1; + } + ===> See send method (cseq will be incremented before sending the request) + */ + + + /* + RFC 3261 - 12.2.1.1 Generating the Request + + The URI in the To field of the request MUST be set to the remote URI + from the dialog state. The tag in the To header field of the request + MUST be set to the remote tag of the dialog ID. The From URI of the + request MUST be set to the local URI from the dialog state. The tag + in the From header field of the request MUST be set to the local tag + of the dialog ID. If the value of the remote or local tags is null, + the tag parameter MUST be omitted from the To or From header fields, + respectively. + */ + to_uri = tsk_object_ref((void*)self->uri_remote); + from_uri = tsk_object_ref((void*)self->uri_local); + + + /* + RFC 3261 - 12.2.1.1 Generating the Request + + If the route set is empty, the UAC MUST place the remote target URI + into the Request-URI. The UAC MUST NOT add a Route header field to + the request. + */ + if(TSK_LIST_IS_EMPTY(self->record_routes)) { + request_uri = tsk_object_ref((void*)self->uri_remote_target); + } + + /* + RFC 3261 - 12.2.1.1 Generating the Request + + If the route set is not empty, and the first URI in the route set + contains the lr parameter (see Section 19.1.1), the UAC MUST place + the remote target URI into the Request-URI and MUST include a Route + header field containing the route set values in order, including all + parameters. + + If the route set is not empty, and its first URI does not contain the + lr parameter, the UAC MUST place the first URI from the route set + into the Request-URI, stripping any parameters that are not allowed + in a Request-URI. The UAC MUST add a Route header field containing + the remainder of the route set values in order, including all + parameters. The UAC MUST then place the remote target URI into the + Route header field as the last value. + + For example, if the remote target is sip:user@remoteua and the route + set contains: + + <sip:proxy1>,<sip:proxy2>,<sip:proxy3;lr>,<sip:proxy4> + */ + else { + const tsip_uri_t *first_route = ((tsip_header_Record_Route_t*)TSK_LIST_FIRST_DATA(self->record_routes))->uri; + if(tsk_params_have_param(first_route->params, "lr")) { + request_uri = tsk_object_ref(self->uri_remote_target); + copy_routes_start = 0; /* Copy all */ + } + else { + request_uri = tsk_object_ref((void*)first_route); + copy_routes_start = 1; /* Copy starting at index 1. */ + } + } + + /*===================================================================== + */ + request = tsip_request_new(method, request_uri, from_uri, to_uri, call_id, self->cseq_value); + request->To->tag = tsk_strdup(self->tag_remote); + request->From->tag = tsk_strdup(self->tag_local); + request->update = tsk_true; /* Now signal that the message should be updated by the transport layer (Contact, SigComp, IPSec, ...) */ + + + /* + RFC 3261 - 12.2.1.1 Generating the Request + + A UAC SHOULD include a Contact header field in any target refresh + requests within a dialog, and unless there is a need to change it, + the URI SHOULD be the same as used in previous requests within the + dialog. If the "secure" flag is true, that URI MUST be a SIPS URI. + As discussed in Section 12.2.2, a Contact header field in a target + refresh request updates the remote target URI. This allows a UA to + provide a new contact address, should its address change during the + duration of the dialog. + */ + switch(request->line.request.request_type) { + case tsip_MESSAGE: + case tsip_PUBLISH: + case tsip_BYE: { + if(request->line.request.request_type == tsip_PUBLISH) { + TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_EXPIRES_VA_ARGS(TSK_TIME_MS_2_S(self->expires))); + } + /* add caps in Accept-Contact headers */ + tsk_list_foreach(item, self->ss->caps) { + const tsk_param_t* param = TSK_PARAM(item->data); + char* value = tsk_null; + tsk_sprintf(&value, "*;%s%s%s", + param->name, + param->value ? "=" : "", + param->value ? param->value : ""); + if(value) { + TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_DUMMY_VA_ARGS("Accept-Contact", value)); + TSK_FREE(value); + } + } + break; + } + + default: { + char* contact = tsk_null; + tsip_header_Contacts_L_t *hdr_contacts; + + if(request->line.request.request_type == tsip_OPTIONS || + request->line.request.request_type == tsip_PUBLISH || + request->line.request.request_type == tsip_REGISTER) { + /**** with expires */ + tsk_sprintf(&contact, "m: <%s:%s@%s:%d>;expires=%d\r\n", + "sip", + from_uri->user_name, + "127.0.0.1", + 5060, + + TSK_TIME_MS_2_S(self->expires)); + } + else { + /**** without expires */ + if(request->line.request.request_type == tsip_SUBSCRIBE) { + /* RFC 3265 - 3.1.1. Subscription Duration + An "expires" parameter on the "Contact" header has no semantics for SUBSCRIBE and is explicitly + not equivalent to an "Expires" header in a SUBSCRIBE request or response. + */ + TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_EXPIRES_VA_ARGS(TSK_TIME_MS_2_S(self->expires))); + } + tsk_sprintf(&contact, "m: <%s:%s@%s:%d%s%s%s%s%s%s%s%s%s>\r\n", + "sip", + from_uri->user_name, + "127.0.0.1", + 5060, + + self->ss->ws.src.host ? ";" : "", + self->ss->ws.src.host ? "ws-src-ip=" : "", + self->ss->ws.src.host ? self->ss->ws.src.host : "", + self->ss->ws.src.port[0] ? ";" : "", + self->ss->ws.src.port[0] ? "ws-src-port=" : "", + self->ss->ws.src.port[0] ? self->ss->ws.src.port : "", + self->ss->ws.src.proto ? ";" : "", + self->ss->ws.src.proto ? "ws-src-proto=" : "", + self->ss->ws.src.proto ? self->ss->ws.src.proto : "" + ); + } + hdr_contacts = tsip_header_Contact_parse(contact, tsk_strlen(contact)); + if(!TSK_LIST_IS_EMPTY(hdr_contacts)) { + request->Contact = tsk_object_ref(hdr_contacts->head->data); + } + TSK_OBJECT_SAFE_FREE(hdr_contacts); + TSK_FREE(contact); + + /* Add capabilities as per RFC 3840 */ + if(request->Contact) { + tsk_list_foreach(item, self->ss->caps) { + tsk_params_add_param(&TSIP_HEADER(request->Contact)->params, TSK_PARAM(item->data)->name, TSK_PARAM(item->data)->value); + } + } + + break; + } + } + + /* Update authorizations */ + if(self->state == tsip_initial && TSK_LIST_IS_EMPTY(self->challenges)) { + /* 3GPP TS 33.978 6.2.3.1 Procedures at the UE + On sending a REGISTER request in order to indicate support for early IMS security procedures, the UE shall not + include an Authorization header field and not include header fields or header field values as required by RFC3329. + */ + if(TSIP_REQUEST_IS_REGISTER(request) && !TSIP_DIALOG_GET_STACK(self)->security.earlyIMS) { + /* 3GPP TS 24.229 - 5.1.1.2.2 Initial registration using IMS AKA + On sending a REGISTER request, the UE shall populate the header fields as follows: + a) an Authorization header field, with: + - the "username" header field parameter, set to the value of the private user identity; + - the "realm" header field parameter, set to the domain name of the home network; + - the "uri" header field parameter, set to the SIP URI of the domain name of the home network; + - the "nonce" header field parameter, set to an empty value; and + - the "response" header field parameter, set to an empty value; + */ + const char* realm = TSIP_DIALOG_GET_STACK(self)->network.realm ? TSIP_DIALOG_GET_STACK(self)->network.realm->host : "(null)"; + char* request_uri = tsip_uri_tostring(request->line.request.uri, tsk_false, tsk_false); + tsip_header_t* auth_hdr = tsip_challenge_create_empty_header_authorization(TSIP_DIALOG_GET_STACK(self)->identity.impi, realm, request_uri); + tsip_message_add_header(request, auth_hdr); + tsk_object_unref(auth_hdr), auth_hdr = tsk_null; + TSK_FREE(request_uri); + } + } + else if(!TSK_LIST_IS_EMPTY(self->challenges)) { + tsip_challenge_t *challenge; + tsip_header_t* auth_hdr; + tsk_list_foreach(item, self->challenges) { + challenge = item->data; + auth_hdr = tsip_challenge_create_header_authorization(challenge, request); + if(auth_hdr) { + tsip_message_add_header(request, auth_hdr); + tsk_object_unref(auth_hdr), auth_hdr = tsk_null; + } + } + } + + /* Update CSeq */ + /* RFC 3261 - 13.2.2.4 2xx Responses + Generating ACK: The sequence number of the CSeq header field MUST be + the same as the INVITE being acknowledged, but the CSeq method MUST + be ACK. The ACK MUST contain the same credentials as the INVITE. If + the 2xx contains an offer (based on the rules above), the ACK MUST + carry an answer in its body. + ==> CSeq number will be added/updated by the caller of this function, + credentials were added above. + */ + if(!TSIP_REQUEST_IS_ACK(request) && !TSIP_REQUEST_IS_CANCEL(request)) { + request->CSeq->seq = ++(TSIP_DIALOG(self)->cseq_value); + } + + /* Route generation + * ==> http://betelco.blogspot.com/2008/11/proxy-and-service-route-discovery-in.html + * The dialog Routes have been copied above. + + 3GPP TS 24.229 - 5.1.2A.1 UE-originating case + + The UE shall build a proper preloaded Route header field value for all new dialogs and standalone transactions. The UE + shall build a list of Route header field values made out of the following, in this order: + a) the P-CSCF URI containing the IP address or the FQDN learnt through the P-CSCF discovery procedures; and + b) the P-CSCF port based on the security mechanism in use: + + - if IMS AKA or SIP digest with TLS is in use as a security mechanism, the protected server port learnt during + the registration procedure; + - if SIP digest without TLS, NASS-IMS bundled authentciation or GPRS-IMS-Bundled authentication is in + use as a security mechanism, the unprotected server port used during the registration procedure; + c) and the values received in the Service-Route header field saved from the 200 (OK) response to the last + registration or re-registration of the public user identity with associated contact address. + */ + if(!TSIP_REQUEST_IS_REGISTER(request)) { + // According to the above link ==> Initial/Re/De registration do not have routes. + if(copy_routes_start != -1) { + /* The dialog already have routes ==> copy them. */ + if(self->state == tsip_early || self->state == tsip_established) { + int32_t index = -1; + tsk_list_foreach(item, self->record_routes) { + tsip_header_Record_Route_t *record_Route = ((tsip_header_Record_Route_t*)item->data); + const tsip_uri_t* uri = record_Route->uri; + tsip_header_Route_t *route = tsk_null; + if(++index < copy_routes_start || !uri) { + continue; + } + + if((route = tsip_header_Route_create(uri))) { + // copy parameters: see http://code.google.com/p/imsdroid/issues/detail?id=52 + if(!TSK_LIST_IS_EMPTY(TSIP_HEADER_PARAMS(record_Route))) { + if(!TSIP_HEADER_PARAMS(route)) { + TSIP_HEADER_PARAMS(route) = tsk_list_create(); + } + tsk_list_pushback_list(TSIP_HEADER_PARAMS(route), TSIP_HEADER_PARAMS(record_Route)); + } + + tsip_message_add_header(request, TSIP_HEADER(route)); + TSK_OBJECT_SAFE_FREE(route); + } + } + } + } + else { + /* No routes associated to this dialog. */ + if(self->state == tsip_initial || self->state == tsip_early) { + /* GPP TS 24.229 section 5.1.2A [Generic procedures applicable to all methods excluding the REGISTER method]: + The UE shall build a proper preloaded Route header field value for all new dialogs and standalone transactions. The UE + shall build a list of Route header field values made out of the following, in this order: + a) the P-CSCF URI containing the IP address or the FQDN learnt through the P-CSCF discovery procedures; and + b) the P-CSCF port based on the security mechanism in use: + - if IMS AKA or SIP digest with TLS is in use as a security mechanism, the protected server port learnt during + the registration procedure; + - if SIP digest without TLS, NASS-IMS bundled authentciation or GPRS-IMS-Bundled authentication is in + use as a security mechanism, the unprotected server port used during the registration procedure; + c) and the values received in the Service-Route header field saved from the 200 (OK) response to the last + registration or re-registration of the public user identity with associated contact address. + */ #if _DEBUG && defined(SDS_HACK)/* FIXME: remove this */ - /* Ericsson SDS hack (INVITE with Proxy-CSCF as First route fail) */ + /* Ericsson SDS hack (INVITE with Proxy-CSCF as First route fail) */ #elif 0 - tsip_uri_t *uri = tsip_stack_get_pcscf_uri(TSIP_DIALOG_GET_STACK(self), tsk_true); - // Proxy-CSCF as first route - if(uri){ - TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_ROUTE_VA_ARGS(uri)); - TSK_OBJECT_SAFE_FREE(uri); - } + tsip_uri_t *uri = tsip_stack_get_pcscf_uri(TSIP_DIALOG_GET_STACK(self), tsk_true); + // Proxy-CSCF as first route + if(uri) { + TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_ROUTE_VA_ARGS(uri)); + TSK_OBJECT_SAFE_FREE(uri); + } #endif - // Service routes - tsk_list_foreach(item, TSIP_DIALOG_GET_STACK(self)->service_routes){ - TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_ROUTE_VA_ARGS(item->data)); - } - } - } - } - - /* Add headers associated to the session */ - tsip_dialog_add_session_headers(self, request); - - /* Add headers associated to the dialog's stack */ - TSIP_DIALOG_ADD_HEADERS(self->ss->stack->headers); - - /* Add common headers */ - tsip_dialog_add_common_headers(self, request); - - /* SigComp */ - if(self->ss->sigcomp_id){ - /* should be added in this field instead of 'Contact' or 'Via' headers - * it's up to the transport layer to copy it to these headers */ - request->sigcomp_id = tsk_strdup(self->ss->sigcomp_id); - } - - /* Remote Address: Used if "Server mode" otherwise Proxy-CSCF will be used */ - request->remote_addr = self->remote_addr; - /* Connected FD */ - if(request->local_fd <= 0) { - request->local_fd = self->connected_fd; - } - - TSK_OBJECT_SAFE_FREE(request_uri); - TSK_OBJECT_SAFE_FREE(from_uri); - TSK_OBJECT_SAFE_FREE(to_uri); - - return request; + // Service routes + tsk_list_foreach(item, TSIP_DIALOG_GET_STACK(self)->service_routes) { + TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_ROUTE_VA_ARGS(item->data)); + } + } + } + } + + /* Add headers associated to the session */ + tsip_dialog_add_session_headers(self, request); + + /* Add headers associated to the dialog's stack */ + TSIP_DIALOG_ADD_HEADERS(self->ss->stack->headers); + + /* Add common headers */ + tsip_dialog_add_common_headers(self, request); + + /* SigComp */ + if(self->ss->sigcomp_id) { + /* should be added in this field instead of 'Contact' or 'Via' headers + * it's up to the transport layer to copy it to these headers */ + request->sigcomp_id = tsk_strdup(self->ss->sigcomp_id); + } + + /* Remote Address: Used if "Server mode" otherwise Proxy-CSCF will be used */ + request->remote_addr = self->remote_addr; + /* Connected FD */ + if(request->local_fd <= 0) { + request->local_fd = self->connected_fd; + } + + TSK_OBJECT_SAFE_FREE(request_uri); + TSK_OBJECT_SAFE_FREE(from_uri); + TSK_OBJECT_SAFE_FREE(to_uri); + + return request; } @@ -452,156 +450,155 @@ tsip_request_t *tsip_dialog_request_new(const tsip_dialog_t *self, const char* m * @param self The parent dialog. All callback events will be notified to this dialog. * @param request The request to send. * - * @return Zero if succeed and no-zero error code otherwise. + * @return Zero if succeed and no-zero error code otherwise. **/ int tsip_dialog_request_send(const tsip_dialog_t *self, tsip_request_t* request) { - int ret = -1; - - if(self && TSIP_DIALOG_GET_STACK(self)){ - const tsip_transac_layer_t *layer = TSIP_DIALOG_GET_STACK(self)->layer_transac; - if(layer){ - /* Create new transaction. The new transaction will be added to the transaction layer. - The transaction has all information to create the right transaction type (NICT or ICT). - As this is an outgoing request ==> It shall be a client transaction (NICT or ICT). - For server transactions creation see @ref tsip_dialog_response_send. - */ - static const tsk_bool_t isCT = tsk_true; - tsip_transac_t* transac; - tsip_transac_dst_t* dst; - - - if(TSIP_STACK_MODE_IS_CLIENT(TSIP_DIALOG_GET_STACK(self))){ - const tsip_transport_t* transport = tsip_transport_layer_find_by_idx(TSIP_DIALOG_GET_STACK(self)->layer_transport, TSIP_DIALOG_GET_STACK(self)->network.transport_idx_default); - if(!transport){ - TSK_DEBUG_ERROR("Failed to find a valid default transport [%d]", TSIP_DIALOG_GET_STACK(self)->network.transport_idx_default); - } - else{ - request->dst_net_type = transport->type; - } - } - dst = tsip_transac_dst_dialog_create(TSIP_DIALOG(self)); - transac = tsip_transac_layer_new( - layer, - isCT, - request, - dst - ); - TSK_OBJECT_SAFE_FREE(dst); - - /* Set the transaction's dialog. All events comming from the transaction (timeouts, errors ...) will be signaled to this dialog */ - if(transac){ - switch(transac->type) - { - case tsip_transac_type_ict: - case tsip_transac_type_nict: - { - /* Start the newly create IC/NIC transaction */ - ret = tsip_transac_start(transac, request); - break; - } - default: break; - } - TSK_OBJECT_SAFE_FREE(transac); - } - } - } - return ret; + int ret = -1; + + if(self && TSIP_DIALOG_GET_STACK(self)) { + const tsip_transac_layer_t *layer = TSIP_DIALOG_GET_STACK(self)->layer_transac; + if(layer) { + /* Create new transaction. The new transaction will be added to the transaction layer. + The transaction has all information to create the right transaction type (NICT or ICT). + As this is an outgoing request ==> It shall be a client transaction (NICT or ICT). + For server transactions creation see @ref tsip_dialog_response_send. + */ + static const tsk_bool_t isCT = tsk_true; + tsip_transac_t* transac; + tsip_transac_dst_t* dst; + + + if(TSIP_STACK_MODE_IS_CLIENT(TSIP_DIALOG_GET_STACK(self))) { + const tsip_transport_t* transport = tsip_transport_layer_find_by_idx(TSIP_DIALOG_GET_STACK(self)->layer_transport, TSIP_DIALOG_GET_STACK(self)->network.transport_idx_default); + if(!transport) { + TSK_DEBUG_ERROR("Failed to find a valid default transport [%d]", TSIP_DIALOG_GET_STACK(self)->network.transport_idx_default); + } + else { + request->dst_net_type = transport->type; + } + } + dst = tsip_transac_dst_dialog_create(TSIP_DIALOG(self)); + transac = tsip_transac_layer_new( + layer, + isCT, + request, + dst + ); + TSK_OBJECT_SAFE_FREE(dst); + + /* Set the transaction's dialog. All events comming from the transaction (timeouts, errors ...) will be signaled to this dialog */ + if(transac) { + switch(transac->type) { + case tsip_transac_type_ict: + case tsip_transac_type_nict: { + /* Start the newly create IC/NIC transaction */ + ret = tsip_transac_start(transac, request); + break; + } + default: + break; + } + TSK_OBJECT_SAFE_FREE(transac); + } + } + } + return ret; } tsip_response_t *tsip_dialog_response_new(tsip_dialog_t *self, short status, const char* phrase, const tsip_request_t* request) { - /* Reponse is created as per RFC 3261 subclause 8.2.6 and (headers+tags) are copied - * as per subclause 8.2.6.2. - */ - tsip_response_t* response; - if((response = tsip_response_new(status, phrase, request))){ - switch(request->line.request.request_type){ - case tsip_MESSAGE: - case tsip_PUBLISH: - break; - default: - /* Is there a To tag? */ - if(response->To && !response->To->tag){ - response->To->tag = tsk_strdup(self->tag_local); - } - /* Contact Header (for 101-299 reponses) */ - if(self->uri_local && TSIP_RESPONSE_CODE(response) >= 101 && TSIP_RESPONSE_CODE(response) <= 299){ - char* contact = tsk_null; - tsip_header_Contacts_L_t *hdr_contacts; - - tsk_sprintf(&contact, "m: <%s:%s@%s:%d>\r\n", "sip", self->uri_local->user_name, "127.0.0.1", 5060); - hdr_contacts = tsip_header_Contact_parse(contact, tsk_strlen(contact)); - if(!TSK_LIST_IS_EMPTY(hdr_contacts)){ - response->Contact = tsk_object_ref(hdr_contacts->head->data); - response->update = tsk_true; /* Now signal that the message should be updated by the transport layer (Contact header) */ - } - TSK_OBJECT_SAFE_FREE(hdr_contacts); - TSK_FREE(contact); - } - break; - } - - /* SigComp */ - if(self->ss->sigcomp_id){ - /* should be added in this field instead of 'Contact' or 'Via' headers - * it's up to the transport layer to copy it to these headers */ - response->sigcomp_id = tsk_strdup(self->ss->sigcomp_id); - } - /* Connected FD */ - if(response->local_fd <= 0) { - response->local_fd = self->connected_fd; - } - /* Remote Addr: used to send requests if "Server Mode" otherwise Proxy-CSCF address will be used */ - self->remote_addr = request->remote_addr; - } - return response; + /* Reponse is created as per RFC 3261 subclause 8.2.6 and (headers+tags) are copied + * as per subclause 8.2.6.2. + */ + tsip_response_t* response; + if((response = tsip_response_new(status, phrase, request))) { + switch(request->line.request.request_type) { + case tsip_MESSAGE: + case tsip_PUBLISH: + break; + default: + /* Is there a To tag? */ + if(response->To && !response->To->tag) { + response->To->tag = tsk_strdup(self->tag_local); + } + /* Contact Header (for 101-299 reponses) */ + if(self->uri_local && TSIP_RESPONSE_CODE(response) >= 101 && TSIP_RESPONSE_CODE(response) <= 299) { + char* contact = tsk_null; + tsip_header_Contacts_L_t *hdr_contacts; + + tsk_sprintf(&contact, "m: <%s:%s@%s:%d>\r\n", "sip", self->uri_local->user_name, "127.0.0.1", 5060); + hdr_contacts = tsip_header_Contact_parse(contact, tsk_strlen(contact)); + if(!TSK_LIST_IS_EMPTY(hdr_contacts)) { + response->Contact = tsk_object_ref(hdr_contacts->head->data); + response->update = tsk_true; /* Now signal that the message should be updated by the transport layer (Contact header) */ + } + TSK_OBJECT_SAFE_FREE(hdr_contacts); + TSK_FREE(contact); + } + break; + } + + /* SigComp */ + if(self->ss->sigcomp_id) { + /* should be added in this field instead of 'Contact' or 'Via' headers + * it's up to the transport layer to copy it to these headers */ + response->sigcomp_id = tsk_strdup(self->ss->sigcomp_id); + } + /* Connected FD */ + if(response->local_fd <= 0) { + response->local_fd = self->connected_fd; + } + /* Remote Addr: used to send requests if "Server Mode" otherwise Proxy-CSCF address will be used */ + self->remote_addr = request->remote_addr; + } + return response; } int tsip_dialog_response_send(const tsip_dialog_t *self, tsip_response_t* response) { - int ret = -1; - - if(self && TSIP_DIALOG_GET_STACK(self)){ - const tsip_transac_layer_t *layer = TSIP_DIALOG_GET_STACK(self)->layer_transac; - if(layer){ - /* As this is a response ...then use the associate server transaction */ - tsip_transac_t *transac = tsip_transac_layer_find_server(layer, response); - if(transac){ - ret = transac->callback(transac, tsip_transac_outgoing_msg, response); - tsk_object_unref(transac); - } - else{ - TSK_DEBUG_ERROR("Failed to find associated server transaction."); - // Send "408 Request Timeout" (should be done by the transaction layer)? - } - } - } - else{ - TSK_DEBUG_ERROR("Invalid parameter"); - } - return ret; + int ret = -1; + + if(self && TSIP_DIALOG_GET_STACK(self)) { + const tsip_transac_layer_t *layer = TSIP_DIALOG_GET_STACK(self)->layer_transac; + if(layer) { + /* As this is a response ...then use the associate server transaction */ + tsip_transac_t *transac = tsip_transac_layer_find_server(layer, response); + if(transac) { + ret = transac->callback(transac, tsip_transac_outgoing_msg, response); + tsk_object_unref(transac); + } + else { + TSK_DEBUG_ERROR("Failed to find associated server transaction."); + // Send "408 Request Timeout" (should be done by the transaction layer)? + } + } + } + else { + TSK_DEBUG_ERROR("Invalid parameter"); + } + return ret; } int tsip_dialog_apply_action(tsip_message_t* message, const tsip_action_t* action) { - const tsk_list_item_t* item; - - if(!message || !action){ - TSK_DEBUG_ERROR("Invalid parameter"); - return -1; - } - - /* SIP headers */ - tsk_list_foreach(item, action->headers){ - TSIP_MESSAGE_ADD_HEADER(message, TSIP_HEADER_DUMMY_VA_ARGS(TSK_PARAM(item->data)->name, TSK_PARAM(item->data)->value)); - } - /* Payload */ - if(action->payload){ - tsip_message_add_content(message, tsk_null, TSK_BUFFER_DATA(action->payload), TSK_BUFFER_SIZE(action->payload)); - } - - return 0; + const tsk_list_item_t* item; + + if(!message || !action) { + TSK_DEBUG_ERROR("Invalid parameter"); + return -1; + } + + /* SIP headers */ + tsk_list_foreach(item, action->headers) { + TSIP_MESSAGE_ADD_HEADER(message, TSIP_HEADER_DUMMY_VA_ARGS(TSK_PARAM(item->data)->name, TSK_PARAM(item->data)->value)); + } + /* Payload */ + if(action->payload) { + tsip_message_add_content(message, tsk_null, TSK_BUFFER_DATA(action->payload), TSK_BUFFER_SIZE(action->payload)); + } + + return 0; } /** @@ -612,72 +609,69 @@ int tsip_dialog_apply_action(tsip_message_t* message, const tsip_action_t* actio * @param [in,out] self The calling dialog. * @param [in,out] response The SIP/IMS response containing the new delay (expires, subscription-state ...). * - * @return Zero if succeed and no-zero error code otherwise. + * @return Zero if succeed and no-zero error code otherwise. **/ int64_t tsip_dialog_get_newdelay(tsip_dialog_t *self, const tsip_message_t* message) { - int64_t expires = self->expires; - int64_t newdelay = expires; /* default value */ - const tsip_header_t* hdr; - tsk_size_t i; - - /*== NOTIFY with subscription-state header with expires parameter. - */ - if(TSIP_REQUEST_IS_NOTIFY(message)){ - const tsip_header_Subscription_State_t *hdr_state; - if((hdr_state = (const tsip_header_Subscription_State_t*)tsip_message_get_header(message, tsip_htype_Subscription_State))){ - if(hdr_state->expires >0){ - expires = TSK_TIME_S_2_MS(hdr_state->expires); - goto compute; - } - } - } - - /*== Expires header. - */ - if((hdr = tsip_message_get_header(message, tsip_htype_Expires))){ - expires = TSK_TIME_S_2_MS(((const tsip_header_Expires_t*)hdr)->delta_seconds); - goto compute; - } - - /*== Contact header. - */ - for(i=0; (hdr = tsip_message_get_headerAt(message, tsip_htype_Contact, i)); i++){ - const tsip_header_Contact_t* contact = (const tsip_header_Contact_t*)hdr; - if(contact && contact->uri) - { - const char* transport = tsk_params_get_param_value(contact->uri->params, "transport"); - tsip_uri_t* contactUri = tsip_stack_get_contacturi(TSIP_DIALOG_GET_STACK(self), transport ? transport : "udp"); - if(contactUri) - { - if(tsk_strequals(contact->uri->user_name, contactUri->user_name) - && tsk_strequals(contact->uri->host, contactUri->host) - && contact->uri->port == contactUri->port) - { - if(contact->expires>=0){ /* No expires parameter ==> -1*/ - expires = TSK_TIME_S_2_MS(contact->expires); - - TSK_OBJECT_SAFE_FREE(contactUri); - goto compute; - } - } - TSK_OBJECT_SAFE_FREE(contactUri); - } - } - } - - /* - * 3GPP TS 24.229 - - * - * The UE shall reregister the public user identity either 600 seconds before the expiration time if the initial - * registration was for greater than 1200 seconds, or when half of the time has expired if the initial registration - * was for 1200 seconds or less. - */ + int64_t expires = self->expires; + int64_t newdelay = expires; /* default value */ + const tsip_header_t* hdr; + tsk_size_t i; + + /*== NOTIFY with subscription-state header with expires parameter. + */ + if(TSIP_REQUEST_IS_NOTIFY(message)) { + const tsip_header_Subscription_State_t *hdr_state; + if((hdr_state = (const tsip_header_Subscription_State_t*)tsip_message_get_header(message, tsip_htype_Subscription_State))) { + if(hdr_state->expires >0) { + expires = TSK_TIME_S_2_MS(hdr_state->expires); + goto compute; + } + } + } + + /*== Expires header. + */ + if((hdr = tsip_message_get_header(message, tsip_htype_Expires))) { + expires = TSK_TIME_S_2_MS(((const tsip_header_Expires_t*)hdr)->delta_seconds); + goto compute; + } + + /*== Contact header. + */ + for(i=0; (hdr = tsip_message_get_headerAt(message, tsip_htype_Contact, i)); i++) { + const tsip_header_Contact_t* contact = (const tsip_header_Contact_t*)hdr; + if(contact && contact->uri) { + const char* transport = tsk_params_get_param_value(contact->uri->params, "transport"); + tsip_uri_t* contactUri = tsip_stack_get_contacturi(TSIP_DIALOG_GET_STACK(self), transport ? transport : "udp"); + if(contactUri) { + if(tsk_strequals(contact->uri->user_name, contactUri->user_name) + && tsk_strequals(contact->uri->host, contactUri->host) + && contact->uri->port == contactUri->port) { + if(contact->expires>=0) { /* No expires parameter ==> -1*/ + expires = TSK_TIME_S_2_MS(contact->expires); + + TSK_OBJECT_SAFE_FREE(contactUri); + goto compute; + } + } + TSK_OBJECT_SAFE_FREE(contactUri); + } + } + } + + /* + * 3GPP TS 24.229 - + * + * The UE shall reregister the public user identity either 600 seconds before the expiration time if the initial + * registration was for greater than 1200 seconds, or when half of the time has expired if the initial registration + * was for 1200 seconds or less. + */ compute: - expires = TSK_TIME_MS_2_S(expires); - newdelay = (expires > 1200) ? (expires - 600) : (expires/2); + expires = TSK_TIME_MS_2_S(expires); + newdelay = (expires > 1200) ? (expires - 600) : (expires/2); - return TSK_TIME_S_2_MS(newdelay); + return TSK_TIME_S_2_MS(newdelay); } /** @@ -690,488 +684,482 @@ compute: * - ... * * @param [in,out] self The calling dialog. - * @param [in,out] response The SIP/IMS response from which to get the new information. + * @param [in,out] response The SIP/IMS response from which to get the new information. * - * @return Zero if succeed and no-zero error code otherwise. + * @return Zero if succeed and no-zero error code otherwise. **/ int tsip_dialog_update(tsip_dialog_t *self, const tsip_response_t* response) { - if(self && TSIP_MESSAGE_IS_RESPONSE(response) && response->To){ - short code = TSIP_RESPONSE_CODE(response); - const char *tag = response->To->tag; - - /* - * 1xx (!100) or 2xx - */ - /* - * 401 or 407 or 421 or 494 - */ - if(code == 401 || code == 407 || code == 421 || code == 494) - { - tsk_bool_t acceptNewVector; - - /* 3GPP IMS - Each authentication vector is used only once. - * ==> Re-registration/De-registration ==> Allow 401/407 challenge. - */ - acceptNewVector = (TSIP_RESPONSE_IS_TO_REGISTER(response) && self->state == tsip_established); - return tsip_dialog_update_challenges(self, response, acceptNewVector); - } - else if(100 < code && code < 300) - { - tsip_dialog_state_t state = self->state; - - /* 1xx */ - if(code <= 199){ - if(tsk_strnullORempty(response->To->tag)){ - TSK_DEBUG_WARN("Invalid tag parameter"); - return 0; - } - state = tsip_early; - } - /* 2xx */ - else{ - state = tsip_established; - } - - /* Remote target */ - { - /* RFC 3261 12.2.1.2 Processing the Responses - When a UAC receives a 2xx response to a target refresh request, it - MUST replace the dialog's remote target URI with the URI from the - Contact header field in that response, if present. - - FIXME: Because PRACK/UPDATE sent before the session is established MUST have - the rigth target URI to be delivered to the UAS ==> Do not not check that we are connected - */ - if(!TSIP_RESPONSE_IS_TO_REGISTER(response) && response->Contact && response->Contact->uri){ - TSK_OBJECT_SAFE_FREE(self->uri_remote_target); - self->uri_remote_target = tsip_uri_clone(response->Contact->uri, tsk_true, tsk_false); - } - } - - /* Route sets */ - { - tsk_size_t index; - const tsip_header_Record_Route_t *recordRoute; - tsip_header_Record_Route_t *route; - - TSK_OBJECT_SAFE_FREE(self->record_routes); - - for(index = 0; (recordRoute = (const tsip_header_Record_Route_t *)tsip_message_get_headerAt(response, tsip_htype_Record_Route, index)); index++){ - if(!self->record_routes){ - self->record_routes = tsk_list_create(); - } - if((route = tsk_object_ref((void*)recordRoute))){ - tsk_list_push_front_data(self->record_routes, (void**)&route); /* Copy reversed. */ - } - } - } - - - /* cseq + tags + ... */ - if(self->state == tsip_established && tsk_striequals(self->tag_remote, tag)){ - return 0; - } - else{ - if(!TSIP_RESPONSE_IS_TO_REGISTER(response) && !TSIP_RESPONSE_IS_TO_PUBLISH(response)){ /* REGISTER and PUBLISH don't establish dialog */ - tsk_strupdate(&self->tag_remote, tag); - } + if(self && TSIP_MESSAGE_IS_RESPONSE(response) && response->To) { + short code = TSIP_RESPONSE_CODE(response); + const char *tag = response->To->tag; + + /* + * 1xx (!100) or 2xx + */ + /* + * 401 or 407 or 421 or 494 + */ + if(code == 401 || code == 407 || code == 421 || code == 494) { + tsk_bool_t acceptNewVector; + + /* 3GPP IMS - Each authentication vector is used only once. + * ==> Re-registration/De-registration ==> Allow 401/407 challenge. + */ + acceptNewVector = (TSIP_RESPONSE_IS_TO_REGISTER(response) && self->state == tsip_established); + return tsip_dialog_update_challenges(self, response, acceptNewVector); + } + else if(100 < code && code < 300) { + tsip_dialog_state_t state = self->state; + + /* 1xx */ + if(code <= 199) { + if(tsk_strnullORempty(response->To->tag)) { + TSK_DEBUG_WARN("Invalid tag parameter"); + return 0; + } + state = tsip_early; + } + /* 2xx */ + else { + state = tsip_established; + } + + /* Remote target */ + { + /* RFC 3261 12.2.1.2 Processing the Responses + When a UAC receives a 2xx response to a target refresh request, it + MUST replace the dialog's remote target URI with the URI from the + Contact header field in that response, if present. + + FIXME: Because PRACK/UPDATE sent before the session is established MUST have + the rigth target URI to be delivered to the UAS ==> Do not not check that we are connected + */ + if(!TSIP_RESPONSE_IS_TO_REGISTER(response) && response->Contact && response->Contact->uri) { + TSK_OBJECT_SAFE_FREE(self->uri_remote_target); + self->uri_remote_target = tsip_uri_clone(response->Contact->uri, tsk_true, tsk_false); + } + } + + /* Route sets */ + { + tsk_size_t index; + const tsip_header_Record_Route_t *recordRoute; + tsip_header_Record_Route_t *route; + + TSK_OBJECT_SAFE_FREE(self->record_routes); + + for(index = 0; (recordRoute = (const tsip_header_Record_Route_t *)tsip_message_get_headerAt(response, tsip_htype_Record_Route, index)); index++) { + if(!self->record_routes) { + self->record_routes = tsk_list_create(); + } + if((route = tsk_object_ref((void*)recordRoute))) { + tsk_list_push_front_data(self->record_routes, (void**)&route); /* Copy reversed. */ + } + } + } + + + /* cseq + tags + ... */ + if(self->state == tsip_established && tsk_striequals(self->tag_remote, tag)) { + return 0; + } + else { + if(!TSIP_RESPONSE_IS_TO_REGISTER(response) && !TSIP_RESPONSE_IS_TO_PUBLISH(response)) { /* REGISTER and PUBLISH don't establish dialog */ + tsk_strupdate(&self->tag_remote, tag); + } #if 0 // PRACK and BYE will have same CSeq value ==> Let CSeq value to be incremented by "tsip_dialog_request_new()" - self->cseq_value = response->CSeq ? response->CSeq->seq : self->cseq_value; + self->cseq_value = response->CSeq ? response->CSeq->seq : self->cseq_value; #endif - } + } - self->state = state; - return 0; - } - } - return 0; + self->state = state; + return 0; + } + } + return 0; } int tsip_dialog_update_2(tsip_dialog_t *self, const tsip_request_t* invite) { - if(!self || !invite){ - TSK_DEBUG_ERROR("Invalid parameter"); - return -1; - } - - /* Remote target */ - if(invite->Contact && invite->Contact->uri){ - TSK_OBJECT_SAFE_FREE(self->uri_remote_target); - self->uri_remote_target = tsip_uri_clone(invite->Contact->uri, tsk_true, tsk_false); - } - - /* cseq + tags + remote-uri */ - tsk_strupdate(&self->tag_remote, invite->From?invite->From->tag:"doubango"); - /* self->cseq_value = invite->CSeq ? invite->CSeq->seq : self->cseq_value; */ - if(invite->From && invite->From->uri){ - TSK_OBJECT_SAFE_FREE(self->uri_remote); - self->uri_remote = tsk_object_ref(invite->From->uri); - } - - /* Route sets */ - { - tsk_size_t index; - const tsip_header_Record_Route_t *recordRoute; - tsip_header_Record_Route_t* route; - - TSK_OBJECT_SAFE_FREE(self->record_routes); - - for(index = 0; (recordRoute = (const tsip_header_Record_Route_t *)tsip_message_get_headerAt(invite, tsip_htype_Record_Route, index)); index++){ - if(!self->record_routes){ - self->record_routes = tsk_list_create(); - } - if((route = tsk_object_ref((void*)recordRoute))){ - tsk_list_push_back_data(self->record_routes, (void**)&route); /* Copy non-reversed. */ - } - } - } - - self->state = tsip_established; - - return 0; + if(!self || !invite) { + TSK_DEBUG_ERROR("Invalid parameter"); + return -1; + } + + /* Remote target */ + if(invite->Contact && invite->Contact->uri) { + TSK_OBJECT_SAFE_FREE(self->uri_remote_target); + self->uri_remote_target = tsip_uri_clone(invite->Contact->uri, tsk_true, tsk_false); + } + + /* cseq + tags + remote-uri */ + tsk_strupdate(&self->tag_remote, invite->From?invite->From->tag:"doubango"); + /* self->cseq_value = invite->CSeq ? invite->CSeq->seq : self->cseq_value; */ + if(invite->From && invite->From->uri) { + TSK_OBJECT_SAFE_FREE(self->uri_remote); + self->uri_remote = tsk_object_ref(invite->From->uri); + } + + /* Route sets */ + { + tsk_size_t index; + const tsip_header_Record_Route_t *recordRoute; + tsip_header_Record_Route_t* route; + + TSK_OBJECT_SAFE_FREE(self->record_routes); + + for(index = 0; (recordRoute = (const tsip_header_Record_Route_t *)tsip_message_get_headerAt(invite, tsip_htype_Record_Route, index)); index++) { + if(!self->record_routes) { + self->record_routes = tsk_list_create(); + } + if((route = tsk_object_ref((void*)recordRoute))) { + tsk_list_push_back_data(self->record_routes, (void**)&route); /* Copy non-reversed. */ + } + } + } + + self->state = tsip_established; + + return 0; } int tsip_dialog_getCKIK(tsip_dialog_t *self, AKA_CK_T *ck, AKA_IK_T *ik) { - tsk_list_item_t *item; - tsip_challenge_t *challenge; - - if(!self){ - return -1; - } - - tsk_list_foreach(item, self->challenges) - { - if((challenge = item->data)){ - memcpy(*ck, challenge->ck, AKA_CK_SIZE); - memcpy(*ik, challenge->ik, AKA_IK_SIZE); - return 0; - } - } - TSK_DEBUG_ERROR("No challenge found. Fail to set IK and CK."); - return -2; + tsk_list_item_t *item; + tsip_challenge_t *challenge; + + if(!self) { + return -1; + } + + tsk_list_foreach(item, self->challenges) { + if((challenge = item->data)) { + memcpy(*ck, challenge->ck, AKA_CK_SIZE); + memcpy(*ik, challenge->ik, AKA_IK_SIZE); + return 0; + } + } + TSK_DEBUG_ERROR("No challenge found. Fail to set IK and CK."); + return -2; } int tsip_dialog_update_challenges(tsip_dialog_t *self, const tsip_response_t* response, int acceptNewVector) { - int ret = -1; - tsk_size_t i; - - tsk_list_item_t *item; - - tsip_challenge_t *challenge; - - const tsip_header_WWW_Authenticate_t *WWW_Authenticate; - const tsip_header_Proxy_Authenticate_t *Proxy_Authenticate; - - /* RFC 2617 - HTTP Digest Session - - * (A) The client response to a WWW-Authenticate challenge for a protection - space starts an authentication session with that protection space. - The authentication session lasts until the client receives another - WWW-Authenticate challenge from any server in the protection space. - - (B) The server may return a 401 response with a new nonce value, causing the client - to retry the request; by specifying stale=TRUE with this response, - the server tells the client to retry with the new nonce, but without - prompting for a new username and password. - */ - /* RFC 2617 - 1.2 Access Authentication Framework - The realm directive (case-insensitive) is required for all authentication schemes that issue a challenge. - */ - - /* FIXME: As we perform the same task ==> Use only one loop. - */ - - for(i =0; (WWW_Authenticate = (const tsip_header_WWW_Authenticate_t*)tsip_message_get_headerAt(response, tsip_htype_WWW_Authenticate, i)); i++){ - tsk_bool_t isnew = tsk_true; - - tsk_list_foreach(item, self->challenges){ - challenge = item->data; - if(challenge->isproxy) continue; - - if(tsk_striequals(challenge->realm, WWW_Authenticate->realm) && (WWW_Authenticate->stale || acceptNewVector)){ - /*== (B) ==*/ - if((ret = tsip_challenge_update(challenge, - WWW_Authenticate->scheme, - WWW_Authenticate->realm, - WWW_Authenticate->nonce, - WWW_Authenticate->opaque, - WWW_Authenticate->algorithm, - WWW_Authenticate->qop))) - { - return ret; - } - else{ - isnew = tsk_false; - continue; - } - } - else{ - TSK_DEBUG_ERROR("Failed to handle new challenge"); - return -1; - } - } - - if(isnew){ - if((challenge = tsip_challenge_create(TSIP_DIALOG_GET_STACK(self), - tsk_false, - WWW_Authenticate->scheme, - WWW_Authenticate->realm, - WWW_Authenticate->nonce, - WWW_Authenticate->opaque, - WWW_Authenticate->algorithm, - WWW_Authenticate->qop))) - { - if(TSIP_DIALOG_GET_SS(self)->auth_ha1 && TSIP_DIALOG_GET_SS(self)->auth_impi){ - tsip_challenge_set_cred(challenge, TSIP_DIALOG_GET_SS(self)->auth_impi, TSIP_DIALOG_GET_SS(self)->auth_ha1); - } - tsk_list_push_back_data(self->challenges, (void**)&challenge); - } - else{ - TSK_DEBUG_ERROR("Failed to handle new challenge"); - return -1; - } - } - } - - for(i=0; (Proxy_Authenticate = (const tsip_header_Proxy_Authenticate_t*)tsip_message_get_headerAt(response, tsip_htype_Proxy_Authenticate, i)); i++){ - tsk_bool_t isnew = tsk_true; - - tsk_list_foreach(item, self->challenges){ - challenge = item->data; - if(!challenge->isproxy){ - continue; - } - - if(tsk_striequals(challenge->realm, Proxy_Authenticate->realm) && (Proxy_Authenticate->stale || acceptNewVector)){ - /*== (B) ==*/ - if((ret = tsip_challenge_update(challenge, - Proxy_Authenticate->scheme, - Proxy_Authenticate->realm, - Proxy_Authenticate->nonce, - Proxy_Authenticate->opaque, - Proxy_Authenticate->algorithm, - Proxy_Authenticate->qop))) - { - return ret; - } - else{ - isnew = tsk_false; - continue; - } - } - else{ - TSK_DEBUG_ERROR("Failed to handle new challenge"); - return -1; - } - } - - if(isnew){ - if((challenge = tsip_challenge_create(TSIP_DIALOG_GET_STACK(self), - tsk_true, - Proxy_Authenticate->scheme, - Proxy_Authenticate->realm, - Proxy_Authenticate->nonce, - Proxy_Authenticate->opaque, - Proxy_Authenticate->algorithm, - Proxy_Authenticate->qop))) - { - if(TSIP_DIALOG_GET_SS(self)->auth_ha1 && TSIP_DIALOG_GET_SS(self)->auth_impi){ - tsip_challenge_set_cred(challenge, TSIP_DIALOG_GET_SS(self)->auth_impi, TSIP_DIALOG_GET_SS(self)->auth_ha1); - } - tsk_list_push_back_data(self->challenges, (void**)&challenge); - } - else{ - TSK_DEBUG_ERROR("Failed to handle new challenge"); - return -1; - } - } - } - return 0; + int ret = -1; + tsk_size_t i; + + tsk_list_item_t *item; + + tsip_challenge_t *challenge; + + const tsip_header_WWW_Authenticate_t *WWW_Authenticate; + const tsip_header_Proxy_Authenticate_t *Proxy_Authenticate; + + /* RFC 2617 - HTTP Digest Session + + * (A) The client response to a WWW-Authenticate challenge for a protection + space starts an authentication session with that protection space. + The authentication session lasts until the client receives another + WWW-Authenticate challenge from any server in the protection space. + + (B) The server may return a 401 response with a new nonce value, causing the client + to retry the request; by specifying stale=TRUE with this response, + the server tells the client to retry with the new nonce, but without + prompting for a new username and password. + */ + /* RFC 2617 - 1.2 Access Authentication Framework + The realm directive (case-insensitive) is required for all authentication schemes that issue a challenge. + */ + + /* FIXME: As we perform the same task ==> Use only one loop. + */ + + for(i =0; (WWW_Authenticate = (const tsip_header_WWW_Authenticate_t*)tsip_message_get_headerAt(response, tsip_htype_WWW_Authenticate, i)); i++) { + tsk_bool_t isnew = tsk_true; + + tsk_list_foreach(item, self->challenges) { + challenge = item->data; + if(challenge->isproxy) { + continue; + } + + if(tsk_striequals(challenge->realm, WWW_Authenticate->realm) && (WWW_Authenticate->stale || acceptNewVector)) { + /*== (B) ==*/ + if((ret = tsip_challenge_update(challenge, + WWW_Authenticate->scheme, + WWW_Authenticate->realm, + WWW_Authenticate->nonce, + WWW_Authenticate->opaque, + WWW_Authenticate->algorithm, + WWW_Authenticate->qop))) { + return ret; + } + else { + isnew = tsk_false; + continue; + } + } + else { + TSK_DEBUG_ERROR("Failed to handle new challenge"); + return -1; + } + } + + if(isnew) { + if((challenge = tsip_challenge_create(TSIP_DIALOG_GET_STACK(self), + tsk_false, + WWW_Authenticate->scheme, + WWW_Authenticate->realm, + WWW_Authenticate->nonce, + WWW_Authenticate->opaque, + WWW_Authenticate->algorithm, + WWW_Authenticate->qop))) { + if(TSIP_DIALOG_GET_SS(self)->auth_ha1 && TSIP_DIALOG_GET_SS(self)->auth_impi) { + tsip_challenge_set_cred(challenge, TSIP_DIALOG_GET_SS(self)->auth_impi, TSIP_DIALOG_GET_SS(self)->auth_ha1); + } + tsk_list_push_back_data(self->challenges, (void**)&challenge); + } + else { + TSK_DEBUG_ERROR("Failed to handle new challenge"); + return -1; + } + } + } + + for(i=0; (Proxy_Authenticate = (const tsip_header_Proxy_Authenticate_t*)tsip_message_get_headerAt(response, tsip_htype_Proxy_Authenticate, i)); i++) { + tsk_bool_t isnew = tsk_true; + + tsk_list_foreach(item, self->challenges) { + challenge = item->data; + if(!challenge->isproxy) { + continue; + } + + if(tsk_striequals(challenge->realm, Proxy_Authenticate->realm) && (Proxy_Authenticate->stale || acceptNewVector)) { + /*== (B) ==*/ + if((ret = tsip_challenge_update(challenge, + Proxy_Authenticate->scheme, + Proxy_Authenticate->realm, + Proxy_Authenticate->nonce, + Proxy_Authenticate->opaque, + Proxy_Authenticate->algorithm, + Proxy_Authenticate->qop))) { + return ret; + } + else { + isnew = tsk_false; + continue; + } + } + else { + TSK_DEBUG_ERROR("Failed to handle new challenge"); + return -1; + } + } + + if(isnew) { + if((challenge = tsip_challenge_create(TSIP_DIALOG_GET_STACK(self), + tsk_true, + Proxy_Authenticate->scheme, + Proxy_Authenticate->realm, + Proxy_Authenticate->nonce, + Proxy_Authenticate->opaque, + Proxy_Authenticate->algorithm, + Proxy_Authenticate->qop))) { + if(TSIP_DIALOG_GET_SS(self)->auth_ha1 && TSIP_DIALOG_GET_SS(self)->auth_impi) { + tsip_challenge_set_cred(challenge, TSIP_DIALOG_GET_SS(self)->auth_impi, TSIP_DIALOG_GET_SS(self)->auth_ha1); + } + tsk_list_push_back_data(self->challenges, (void**)&challenge); + } + else { + TSK_DEBUG_ERROR("Failed to handle new challenge"); + return -1; + } + } + } + return 0; } int tsip_dialog_add_session_headers(const tsip_dialog_t *self, tsip_request_t* request) { - if(!self || !request){ - TSK_DEBUG_ERROR("Invalid parameter"); - return -1; - } + if(!self || !request) { + TSK_DEBUG_ERROR("Invalid parameter"); + return -1; + } - TSIP_DIALOG_ADD_HEADERS(self->ss->headers); - return 0; + TSIP_DIALOG_ADD_HEADERS(self->ss->headers); + return 0; } int tsip_dialog_add_common_headers(const tsip_dialog_t *self, tsip_request_t* request) { - tsk_bool_t earlyIMS = tsk_false; - const tsip_uri_t* preferred_identity = tsk_null; - const char* netinfo = tsk_null; - - if(!self || !request){ - TSK_DEBUG_ERROR("Invalid parameter"); - return -1; - } - - earlyIMS = TSIP_DIALOG_GET_STACK(self)->security.earlyIMS; - preferred_identity = TSIP_DIALOG_GET_STACK(self)->identity.preferred; - - // - // P-Preferred-Identity - // - if(preferred_identity && TSIP_STACK_MODE_IS_CLIENT(TSIP_DIALOG_GET_STACK(self))){ - /* 3GPP TS 33.978 6.2.3.1 Procedures at the UE - The UE shall use the temporary public user identity (IMSI-derived IMPU, cf. section 6.1.2) only in registration - messages (i.e. initial registration, re-registration or de-registration), but not in any other type of SIP requests. - */ - switch(request->line.request.request_type){ - case tsip_BYE: - case tsip_INVITE: - case tsip_OPTIONS: - case tsip_SUBSCRIBE: - case tsip_NOTIFY: - case tsip_REFER: - case tsip_MESSAGE: - case tsip_PUBLISH: - case tsip_REGISTER: - { - if(!earlyIMS || (earlyIMS && TSIP_REQUEST_IS_REGISTER(request))){ - TSIP_MESSAGE_ADD_HEADER(request, - TSIP_HEADER_P_PREFERRED_IDENTITY_VA_ARGS(preferred_identity) - ); - } - break; - } - default:break; - } - } - - // - // P-Access-Network-Info - // - if(netinfo) - { - switch(request->line.request.request_type){ - case tsip_BYE: - case tsip_INVITE: - case tsip_OPTIONS: - case tsip_REGISTER: - case tsip_SUBSCRIBE: - case tsip_NOTIFY: - case tsip_PRACK: - case tsip_INFO: - case tsip_UPDATE: - case tsip_REFER: - case tsip_MESSAGE: - case tsip_PUBLISH: - { - TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_P_ACCESS_NETWORK_INFO_VA_ARGS(netinfo)); - break; - } - default: break; - } - } - - return 0; + tsk_bool_t earlyIMS = tsk_false; + const tsip_uri_t* preferred_identity = tsk_null; + const char* netinfo = tsk_null; + + if(!self || !request) { + TSK_DEBUG_ERROR("Invalid parameter"); + return -1; + } + + earlyIMS = TSIP_DIALOG_GET_STACK(self)->security.earlyIMS; + preferred_identity = TSIP_DIALOG_GET_STACK(self)->identity.preferred; + + // + // P-Preferred-Identity + // + if(preferred_identity && TSIP_STACK_MODE_IS_CLIENT(TSIP_DIALOG_GET_STACK(self))) { + /* 3GPP TS 33.978 6.2.3.1 Procedures at the UE + The UE shall use the temporary public user identity (IMSI-derived IMPU, cf. section 6.1.2) only in registration + messages (i.e. initial registration, re-registration or de-registration), but not in any other type of SIP requests. + */ + switch(request->line.request.request_type) { + case tsip_BYE: + case tsip_INVITE: + case tsip_OPTIONS: + case tsip_SUBSCRIBE: + case tsip_NOTIFY: + case tsip_REFER: + case tsip_MESSAGE: + case tsip_PUBLISH: + case tsip_REGISTER: { + if(!earlyIMS || (earlyIMS && TSIP_REQUEST_IS_REGISTER(request))) { + TSIP_MESSAGE_ADD_HEADER(request, + TSIP_HEADER_P_PREFERRED_IDENTITY_VA_ARGS(preferred_identity) + ); + } + break; + } + default: + break; + } + } + + // + // P-Access-Network-Info + // + if(netinfo) { + switch(request->line.request.request_type) { + case tsip_BYE: + case tsip_INVITE: + case tsip_OPTIONS: + case tsip_REGISTER: + case tsip_SUBSCRIBE: + case tsip_NOTIFY: + case tsip_PRACK: + case tsip_INFO: + case tsip_UPDATE: + case tsip_REFER: + case tsip_MESSAGE: + case tsip_PUBLISH: { + TSIP_MESSAGE_ADD_HEADER(request, TSIP_HEADER_P_ACCESS_NETWORK_INFO_VA_ARGS(netinfo)); + break; + } + default: + break; + } + } + + return 0; } int tsip_dialog_init(tsip_dialog_t *self, tsip_dialog_type_t type, const char* call_id, tsip_ssession_t* ss, tsk_fsm_state_id curr, tsk_fsm_state_id term) { - static tsip_dialog_id_t unique_id = 0; - if(self){ - if(self->initialized){ - TSK_DEBUG_WARN("Dialog already initialized."); - return -2; - } - - self->state = tsip_initial; - self->type = type; - self->id = ++unique_id; - self->connected_fd = TNET_INVALID_FD; - if(!self->record_routes){ - self->record_routes = tsk_list_create(); - } - if(!self->challenges){ - self->challenges = tsk_list_create(); - } - - /* Sets some defalt values */ - self->expires = TSIP_SSESSION_EXPIRES_DEFAULT; - - if(call_id){ - /* "server-side" session */ - tsk_strupdate(&self->callid, call_id); - } - else{ - tsk_uuidstring_t uuid; /* Call-id is a random UUID */ - tsip_header_Call_ID_random(&uuid); - tsk_strupdate(&self->callid, uuid); - } - - /* ref SIP session */ - self->ss = tsk_object_ref(ss); - - /* Local tag */{ - tsk_istr_t tag; - tsk_strrandom(&tag); - tsk_strupdate(&self->tag_local, tag); - } - - /* CSeq */ - self->cseq_value = (rand() + 1); - - /* FSM */ - self->fsm = tsk_fsm_create(curr, term); - - /*=== SIP Session ===*/ - if(self->ss != TSIP_SSESSION_INVALID_HANDLE){ - - /* Expires */ - self->expires = ss->expires; - - /* From */ - self->uri_local = tsk_object_ref(call_id/* "server-side" */ ? ss->to : ss->from); - - /* To */ - if(ss->to){ - self->uri_remote = tsk_object_ref(ss->to); - self->uri_remote_target = tsk_object_ref(ss->to); /* Request-URI. */ - } - else{ - self->uri_remote = tsk_object_ref(ss->from); - self->uri_remote_target = tsk_object_ref((void*)TSIP_DIALOG_GET_STACK(self)->network.realm); - } - } - else{ - TSK_DEBUG_ERROR("Invalid SIP Session id."); - } - - tsk_safeobj_init(self); - - self->initialized = tsk_true; - return 0; - } - return -1; + static tsip_dialog_id_t unique_id = 0; + if(self) { + if(self->initialized) { + TSK_DEBUG_WARN("Dialog already initialized."); + return -2; + } + + self->state = tsip_initial; + self->type = type; + self->id = ++unique_id; + self->connected_fd = TNET_INVALID_FD; + if(!self->record_routes) { + self->record_routes = tsk_list_create(); + } + if(!self->challenges) { + self->challenges = tsk_list_create(); + } + + /* Sets some defalt values */ + self->expires = TSIP_SSESSION_EXPIRES_DEFAULT; + + if(call_id) { + /* "server-side" session */ + tsk_strupdate(&self->callid, call_id); + } + else { + tsk_uuidstring_t uuid; /* Call-id is a random UUID */ + tsip_header_Call_ID_random(&uuid); + tsk_strupdate(&self->callid, uuid); + } + + /* ref SIP session */ + self->ss = tsk_object_ref(ss); + + /* Local tag */{ + tsk_istr_t tag; + tsk_strrandom(&tag); + tsk_strupdate(&self->tag_local, tag); + } + + /* CSeq */ + self->cseq_value = (rand() + 1); + + /* FSM */ + self->fsm = tsk_fsm_create(curr, term); + + /*=== SIP Session ===*/ + if(self->ss != TSIP_SSESSION_INVALID_HANDLE) { + + /* Expires */ + self->expires = ss->expires; + + /* From */ + self->uri_local = tsk_object_ref(call_id/* "server-side" */ ? ss->to : ss->from); + + /* To */ + if(ss->to) { + self->uri_remote = tsk_object_ref(ss->to); + self->uri_remote_target = tsk_object_ref(ss->to); /* Request-URI. */ + } + else { + self->uri_remote = tsk_object_ref(ss->from); + self->uri_remote_target = tsk_object_ref((void*)TSIP_DIALOG_GET_STACK(self)->network.realm); + } + } + else { + TSK_DEBUG_ERROR("Invalid SIP Session id."); + } + + tsk_safeobj_init(self); + + self->initialized = tsk_true; + return 0; + } + return -1; } int tsip_dialog_fsm_act(tsip_dialog_t* self, tsk_fsm_action_id action_id, const tsip_message_t* message, const tsip_action_handle_t* action) { - int ret; - tsip_dialog_t* copy; - if(!self || !self->fsm){ - TSK_DEBUG_ERROR("Invalid parameter."); - return -1; - } - - tsk_safeobj_lock(self); - copy = tsk_object_ref(self); /* keep a copy because tsk_fsm_act() could destroy the dialog */ - ret = tsip_dialog_set_curr_action(copy, action); - ret = tsk_fsm_act(copy->fsm, action_id, copy, message, copy, message, action); - tsk_safeobj_unlock(copy); - tsk_object_unref(copy); - - return ret; + int ret; + tsip_dialog_t* copy; + if(!self || !self->fsm) { + TSK_DEBUG_ERROR("Invalid parameter."); + return -1; + } + + tsk_safeobj_lock(self); + copy = tsk_object_ref(self); /* keep a copy because tsk_fsm_act() could destroy the dialog */ + ret = tsip_dialog_set_curr_action(copy, action); + ret = tsk_fsm_act(copy->fsm, action_id, copy, message, copy, message, action); + tsk_safeobj_unlock(copy); + tsk_object_unref(copy); + + return ret; } /* @@ -1179,176 +1167,175 @@ This function is used to know if we need to keep the same action handle after re */ tsk_bool_t tsip_dialog_keep_action(const tsip_dialog_t* self, const tsip_response_t *response) { - if(self && response){ - const short code = TSIP_RESPONSE_CODE(response); - return - TSIP_RESPONSE_IS_1XX(response) || - (code == 401 || code == 407 || code == 421 || code == 494) || - (code == 422 || code == 423); - } - return tsk_false; + if(self && response) { + const short code = TSIP_RESPONSE_CODE(response); + return + TSIP_RESPONSE_IS_1XX(response) || + (code == 401 || code == 407 || code == 421 || code == 494) || + (code == 422 || code == 423); + } + return tsk_false; } int tsip_dialog_set_connected_fd(tsip_dialog_t* self, tnet_fd_t fd) { - if(!self){ - TSK_DEBUG_ERROR("Invalid parameter"); - return -1; - } - self->connected_fd = fd; - return 0; + if(!self) { + TSK_DEBUG_ERROR("Invalid parameter"); + return -1; + } + self->connected_fd = fd; + return 0; } int tsip_dialog_set_curr_action(tsip_dialog_t* self, const tsip_action_t* action) { - tsip_action_t* new_action; - if(!self){ - TSK_DEBUG_ERROR("Invalid parameter."); - return -1; - } - - new_action = tsk_object_ref((void*)action); - TSK_OBJECT_SAFE_FREE(self->curr_action); - self->curr_action = new_action; - return 0; + tsip_action_t* new_action; + if(!self) { + TSK_DEBUG_ERROR("Invalid parameter."); + return -1; + } + + new_action = tsk_object_ref((void*)action); + TSK_OBJECT_SAFE_FREE(self->curr_action); + self->curr_action = new_action; + return 0; } int tsip_dialog_set_lasterror_2(tsip_dialog_t* self, const char* phrase, short code, const tsip_message_t *message) { - if(!self || tsk_strnullORempty(phrase)){ - TSK_DEBUG_ERROR("Invalid parameter."); - return -1; - } - - tsk_strupdate(&self->last_error.phrase, phrase); - self->last_error.code = code; - TSK_OBJECT_SAFE_FREE(self->last_error.message); - if(message){ - self->last_error.message = (tsip_message_t*)tsk_object_ref((void*)message); - } - return 0; + if(!self || tsk_strnullORempty(phrase)) { + TSK_DEBUG_ERROR("Invalid parameter."); + return -1; + } + + tsk_strupdate(&self->last_error.phrase, phrase); + self->last_error.code = code; + TSK_OBJECT_SAFE_FREE(self->last_error.message); + if(message) { + self->last_error.message = (tsip_message_t*)tsk_object_ref((void*)message); + } + return 0; } int tsip_dialog_set_lasterror(tsip_dialog_t* self, const char* phrase, short code) { - return tsip_dialog_set_lasterror_2(self, phrase, code, tsk_null); + return tsip_dialog_set_lasterror_2(self, phrase, code, tsk_null); } int tsip_dialog_get_lasterror(const tsip_dialog_t* self, short *code, const char** phrase, const tsip_message_t **message) { - if(!self){ - TSK_DEBUG_ERROR("Invalid parameter."); - return -1; - } - - if(code){ - *code = self->last_error.code; - } - if(phrase){ - *phrase = self->last_error.phrase; - } - - if(message){ - *message = self->last_error.message; - } - - return 0; + if(!self) { + TSK_DEBUG_ERROR("Invalid parameter."); + return -1; + } + + if(code) { + *code = self->last_error.code; + } + if(phrase) { + *phrase = self->last_error.phrase; + } + + if(message) { + *message = self->last_error.message; + } + + return 0; } int tsip_dialog_hangup(tsip_dialog_t *self, const tsip_action_t* action) { - if(self){ - // CANCEL should only be sent for INVITE dialog - if(self->type != tsip_dialog_INVITE || self->state == tsip_established){ - return tsip_dialog_fsm_act(self, tsip_atype_hangup, tsk_null, action); - } - else{ - return tsip_dialog_fsm_act(self, tsip_atype_cancel, tsk_null, action); - } - } - TSK_DEBUG_ERROR("Invalid parameter"); - return -1; + if(self) { + // CANCEL should only be sent for INVITE dialog + if(self->type != tsip_dialog_INVITE || self->state == tsip_established) { + return tsip_dialog_fsm_act(self, tsip_atype_hangup, tsk_null, action); + } + else { + return tsip_dialog_fsm_act(self, tsip_atype_cancel, tsk_null, action); + } + } + TSK_DEBUG_ERROR("Invalid parameter"); + return -1; } int tsip_dialog_shutdown(tsip_dialog_t *self, const tsip_action_t* action) { - if(self){ - return tsip_dialog_fsm_act(self, tsip_atype_shutdown, tsk_null, action); - } - TSK_DEBUG_ERROR("Invalid parameter"); - return -1; + if(self) { + return tsip_dialog_fsm_act(self, tsip_atype_shutdown, tsk_null, action); + } + TSK_DEBUG_ERROR("Invalid parameter"); + return -1; } int tsip_dialog_signal_transport_error(tsip_dialog_t *self) { - if(self){ - return tsip_dialog_fsm_act(self, tsip_atype_transport_error, tsk_null, tsk_null); - } - TSK_DEBUG_ERROR("Invalid parameter"); - return -1; + if(self) { + return tsip_dialog_fsm_act(self, tsip_atype_transport_error, tsk_null, tsk_null); + } + TSK_DEBUG_ERROR("Invalid parameter"); + return -1; } int tsip_dialog_remove(const tsip_dialog_t* self) { - return tsip_dialog_layer_remove(TSIP_DIALOG_GET_STACK(self)->layer_dialog, TSIP_DIALOG(self)); + return tsip_dialog_layer_remove(TSIP_DIALOG_GET_STACK(self)->layer_dialog, TSIP_DIALOG(self)); } int tsip_dialog_cmp(const tsip_dialog_t *d1, const tsip_dialog_t *d2) { - if(d1 && d2){ - if( - tsk_strequals(d1->callid, d2->callid) - && (tsk_strequals(d1->tag_local, d2->tag_local)) - && (tsk_strequals(d1->tag_remote, d2->tag_remote)) - ) - { - return 0; - } - } - return -1; + if(d1 && d2) { + if( + tsk_strequals(d1->callid, d2->callid) + && (tsk_strequals(d1->tag_local, d2->tag_local)) + && (tsk_strequals(d1->tag_remote, d2->tag_remote)) + ) { + return 0; + } + } + return -1; } int tsip_dialog_deinit(tsip_dialog_t *self) { - if(self){ - if(!self->initialized){ - TSK_DEBUG_WARN("Dialog not initialized."); - return -2; - } - - /* Cancel all transactions associated to this dialog (do it here before the dialog becomes unsafe) */ - tsip_transac_layer_cancel_by_dialog(TSIP_DIALOG_GET_STACK(self)->layer_transac, self); - - /* Remove the dialog from the Stream peers */ - tsip_dialog_layer_remove_callid_from_stream_peers(TSIP_DIALOG_GET_STACK(self)->layer_dialog, self->callid); - - TSK_OBJECT_SAFE_FREE(self->ss); - TSK_OBJECT_SAFE_FREE(self->curr_action); - - TSK_OBJECT_SAFE_FREE(self->uri_local); - TSK_FREE(self->tag_local); - TSK_OBJECT_SAFE_FREE(self->uri_remote); - TSK_FREE(self->tag_remote); - - TSK_OBJECT_SAFE_FREE(self->uri_remote_target); - - TSK_FREE(self->cseq_method); - TSK_FREE(self->callid); - - TSK_FREE(self->last_error.phrase); - TSK_OBJECT_SAFE_FREE(self->last_error.message); - - TSK_OBJECT_SAFE_FREE(self->record_routes); - TSK_OBJECT_SAFE_FREE(self->challenges); - - TSK_OBJECT_SAFE_FREE(self->fsm); - - tsk_safeobj_deinit(self); - - self->initialized = 0; - - return 0; - } - return -1; + if(self) { + if(!self->initialized) { + TSK_DEBUG_WARN("Dialog not initialized."); + return -2; + } + + /* Cancel all transactions associated to this dialog (do it here before the dialog becomes unsafe) */ + tsip_transac_layer_cancel_by_dialog(TSIP_DIALOG_GET_STACK(self)->layer_transac, self); + + /* Remove the dialog from the Stream peers */ + tsip_dialog_layer_remove_callid_from_stream_peers(TSIP_DIALOG_GET_STACK(self)->layer_dialog, self->callid); + + TSK_OBJECT_SAFE_FREE(self->ss); + TSK_OBJECT_SAFE_FREE(self->curr_action); + + TSK_OBJECT_SAFE_FREE(self->uri_local); + TSK_FREE(self->tag_local); + TSK_OBJECT_SAFE_FREE(self->uri_remote); + TSK_FREE(self->tag_remote); + + TSK_OBJECT_SAFE_FREE(self->uri_remote_target); + + TSK_FREE(self->cseq_method); + TSK_FREE(self->callid); + + TSK_FREE(self->last_error.phrase); + TSK_OBJECT_SAFE_FREE(self->last_error.message); + + TSK_OBJECT_SAFE_FREE(self->record_routes); + TSK_OBJECT_SAFE_FREE(self->challenges); + + TSK_OBJECT_SAFE_FREE(self->fsm); + + tsk_safeobj_deinit(self); + + self->initialized = 0; + + return 0; + } + return -1; } diff --git a/tinySIP/src/dialogs/tsip_dialog_info.c b/tinySIP/src/dialogs/tsip_dialog_info.c index 0ff2536..aa8bc6d 100755 --- a/tinySIP/src/dialogs/tsip_dialog_info.c +++ b/tinySIP/src/dialogs/tsip_dialog_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. * @@ -65,156 +65,149 @@ static int tsip_dialog_info_Any_2_Terminated_X_Error(va_list *app); /* ======================== conds ======================== */ /* ======================== actions ======================== */ -typedef enum _fsm_action_e -{ - _fsm_action_sendINFO = tsip_atype_info_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_transporterror = tsip_atype_transport_error, - - _fsm_action_receiveINFO = 0xFF, - _fsm_action_1xx, - _fsm_action_2xx, - _fsm_action_401_407_421_494, - _fsm_action_300_to_699, - _fsm_action_error, +typedef enum _fsm_action_e { + _fsm_action_sendINFO = tsip_atype_info_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_transporterror = tsip_atype_transport_error, + + _fsm_action_receiveINFO = 0xFF, + _fsm_action_1xx, + _fsm_action_2xx, + _fsm_action_401_407_421_494, + _fsm_action_300_to_699, + _fsm_action_error, } _fsm_action_t; /* ======================== states ======================== */ -typedef enum _fsm_state_e -{ - _fsm_state_Started, - _fsm_state_Sending, - _fsm_state_Receiving, - _fsm_state_Terminated +typedef enum _fsm_state_e { + _fsm_state_Started, + _fsm_state_Sending, + _fsm_state_Receiving, + _fsm_state_Terminated } _fsm_state_t; static int tsip_dialog_info_event_callback(const tsip_dialog_info_t *self, tsip_dialog_event_type_t type, const tsip_message_t *msg) { - int ret = -1; - - switch(type) - { - case tsip_dialog_i_msg: - { - if(msg) - { - if(TSIP_MESSAGE_IS_RESPONSE(msg)) - { - if(TSIP_RESPONSE_IS_1XX(msg)){ - ret = tsip_dialog_fsm_act(TSIP_DIALOG(self), _fsm_action_1xx, msg, tsk_null); - } - else if(TSIP_RESPONSE_IS_2XX(msg)){ - ret = tsip_dialog_fsm_act(TSIP_DIALOG(self), _fsm_action_2xx, msg, tsk_null); - } - else if(TSIP_RESPONSE_CODE(msg) == 401 || TSIP_RESPONSE_CODE(msg) == 407 || TSIP_RESPONSE_CODE(msg) == 421 || TSIP_RESPONSE_CODE(msg) == 494){ - ret = tsip_dialog_fsm_act(TSIP_DIALOG(self), _fsm_action_401_407_421_494, msg, tsk_null); - } - else if(TSIP_RESPONSE_IS_3456(msg)){ - ret = tsip_dialog_fsm_act(TSIP_DIALOG(self), _fsm_action_300_to_699, msg, tsk_null); - } - else{ /* Should never happen */ - ret = tsip_dialog_fsm_act(TSIP_DIALOG(self), _fsm_action_error, msg, tsk_null); - } - } - else if (TSIP_REQUEST_IS_INFO(msg)){ /* have been checked by dialog layer...but */ - // REQUEST ==> Incoming INFO - ret = tsip_dialog_fsm_act(TSIP_DIALOG(self), _fsm_action_receiveINFO, msg, tsk_null); - } - } - break; - } - - case tsip_dialog_canceled: - { - ret = tsip_dialog_fsm_act(TSIP_DIALOG(self), _fsm_action_cancel, msg, tsk_null); - break; - } - - case tsip_dialog_terminated: - case tsip_dialog_timedout: - case tsip_dialog_error: - case tsip_dialog_transport_error: - { - ret = tsip_dialog_fsm_act(TSIP_DIALOG(self), _fsm_action_transporterror, msg, tsk_null); - break; - } - - default: break; - } - - return ret; + int ret = -1; + + switch(type) { + case tsip_dialog_i_msg: { + if(msg) { + if(TSIP_MESSAGE_IS_RESPONSE(msg)) { + if(TSIP_RESPONSE_IS_1XX(msg)) { + ret = tsip_dialog_fsm_act(TSIP_DIALOG(self), _fsm_action_1xx, msg, tsk_null); + } + else if(TSIP_RESPONSE_IS_2XX(msg)) { + ret = tsip_dialog_fsm_act(TSIP_DIALOG(self), _fsm_action_2xx, msg, tsk_null); + } + else if(TSIP_RESPONSE_CODE(msg) == 401 || TSIP_RESPONSE_CODE(msg) == 407 || TSIP_RESPONSE_CODE(msg) == 421 || TSIP_RESPONSE_CODE(msg) == 494) { + ret = tsip_dialog_fsm_act(TSIP_DIALOG(self), _fsm_action_401_407_421_494, msg, tsk_null); + } + else if(TSIP_RESPONSE_IS_3456(msg)) { + ret = tsip_dialog_fsm_act(TSIP_DIALOG(self), _fsm_action_300_to_699, msg, tsk_null); + } + else { /* Should never happen */ + ret = tsip_dialog_fsm_act(TSIP_DIALOG(self), _fsm_action_error, msg, tsk_null); + } + } + else if (TSIP_REQUEST_IS_INFO(msg)) { /* have been checked by dialog layer...but */ + // REQUEST ==> Incoming INFO + ret = tsip_dialog_fsm_act(TSIP_DIALOG(self), _fsm_action_receiveINFO, msg, tsk_null); + } + } + break; + } + + case tsip_dialog_canceled: { + ret = tsip_dialog_fsm_act(TSIP_DIALOG(self), _fsm_action_cancel, msg, tsk_null); + break; + } + + case tsip_dialog_terminated: + case tsip_dialog_timedout: + case tsip_dialog_error: + case tsip_dialog_transport_error: { + ret = tsip_dialog_fsm_act(TSIP_DIALOG(self), _fsm_action_transporterror, msg, tsk_null); + break; + } + + default: + break; + } + + return ret; } tsip_dialog_info_t* tsip_dialog_info_create(const tsip_ssession_handle_t* ss) { - return tsk_object_new(tsip_dialog_info_def_t, ss); + return tsk_object_new(tsip_dialog_info_def_t, ss); } int tsip_dialog_info_init(tsip_dialog_info_t *self) { - //const tsk_param_t* param; - - /* Initialize the state machine. */ - tsk_fsm_set(TSIP_DIALOG_GET_FSM(self), - - /*======================= - * === Started === - */ - // Started -> (send) -> Sending - TSK_FSM_ADD_ALWAYS(_fsm_state_Started, _fsm_action_sendINFO, _fsm_state_Sending, tsip_dialog_info_Started_2_Sending_X_sendINFO, "tsip_dialog_info_Started_2_Sending_X_sendINFO"), - // Started -> (receive) -> Receiving - TSK_FSM_ADD_ALWAYS(_fsm_state_Started, _fsm_action_receiveINFO, _fsm_state_Receiving, tsip_dialog_info_Started_2_Receiving_X_recvINFO, "tsip_dialog_info_Started_2_Receiving_X_recvINFO"), - // Started -> (Any) -> Started - TSK_FSM_ADD_ALWAYS_NOTHING(_fsm_state_Started, "tsip_dialog_info_Started_2_Started_X_any"), - - - /*======================= - * === Sending === - */ - // Sending -> (1xx) -> Sending - TSK_FSM_ADD_ALWAYS(_fsm_state_Sending, _fsm_action_1xx, _fsm_state_Sending, tsip_dialog_info_Sending_2_Sending_X_1xx, "tsip_dialog_info_Sending_2_Sending_X_1xx"), - // Sending -> (2xx) -> Terminated - TSK_FSM_ADD_ALWAYS(_fsm_state_Sending, _fsm_action_2xx, _fsm_state_Terminated, tsip_dialog_info_Sending_2_Terminated_X_2xx, "tsip_dialog_info_Sending_2_Terminated_X_2xx"), - // Sending -> (401/407/421/494) -> Sending - TSK_FSM_ADD_ALWAYS(_fsm_state_Sending, _fsm_action_401_407_421_494, _fsm_state_Sending, tsip_dialog_info_Sending_2_Sending_X_401_407_421_494, "tsip_dialog_info_Sending_2_Sending_X_401_407_421_494"), - // Sending -> (300_to_699) -> Terminated - TSK_FSM_ADD_ALWAYS(_fsm_state_Sending, _fsm_action_300_to_699, _fsm_state_Terminated, tsip_dialog_info_Sending_2_Terminated_X_300_to_699, "tsip_dialog_info_Sending_2_Terminated_X_300_to_699"), - // Sending -> (cancel) -> Terminated - TSK_FSM_ADD_ALWAYS(_fsm_state_Sending, _fsm_action_cancel, _fsm_state_Terminated, tsip_dialog_info_Sending_2_Terminated_X_cancel, "tsip_dialog_info_Sending_2_Terminated_X_cancel"), - // Sending -> (shutdown) -> Terminated - TSK_FSM_ADD_ALWAYS(_fsm_state_Sending, _fsm_action_shutdown, _fsm_state_Terminated, tsk_null, "tsip_dialog_info_Sending_2_Terminated_X_shutdown"), - // Sending -> (Any) -> Sending - TSK_FSM_ADD_ALWAYS_NOTHING(_fsm_state_Sending, "tsip_dialog_info_Sending_2_Sending_X_any"), - - /*======================= - * === Receiving === - */ - // Receiving -> (accept) -> Terminated - TSK_FSM_ADD_ALWAYS(_fsm_state_Receiving, _fsm_action_accept, _fsm_state_Terminated, tsip_dialog_info_Receiving_2_Terminated_X_accept, "tsip_dialog_info_Receiving_2_Terminated_X_accept"), - // Receiving -> (rejected) -> Terminated - TSK_FSM_ADD_ALWAYS(_fsm_state_Receiving, _fsm_action_reject, _fsm_state_Terminated, tsip_dialog_info_Receiving_2_Terminated_X_reject, "tsip_dialog_info_Receiving_2_Terminated_X_reject"), - // Receiving -> (Any) -> Receiving - TSK_FSM_ADD_ALWAYS_NOTHING(_fsm_state_Receiving, "tsip_dialog_info_Receiving_2_Receiving_X_any"), - - /*======================= - * === Any === - */ - // Any -> (transport error) -> Terminated - TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_transporterror, _fsm_state_Terminated, tsip_dialog_info_Any_2_Terminated_X_transportError, "tsip_dialog_info_Any_2_Terminated_X_transportError"), - // Any -> (transport error) -> Terminated - TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_error, _fsm_state_Terminated, tsip_dialog_info_Any_2_Terminated_X_Error, "tsip_dialog_info_Any_2_Terminated_X_Error"), - - TSK_FSM_ADD_NULL()); - - TSIP_DIALOG(self)->callback = TSIP_DIALOG_EVENT_CALLBACK_F(tsip_dialog_info_event_callback); - - return 0; + //const tsk_param_t* param; + + /* Initialize the state machine. */ + tsk_fsm_set(TSIP_DIALOG_GET_FSM(self), + + /*======================= + * === Started === + */ + // Started -> (send) -> Sending + TSK_FSM_ADD_ALWAYS(_fsm_state_Started, _fsm_action_sendINFO, _fsm_state_Sending, tsip_dialog_info_Started_2_Sending_X_sendINFO, "tsip_dialog_info_Started_2_Sending_X_sendINFO"), + // Started -> (receive) -> Receiving + TSK_FSM_ADD_ALWAYS(_fsm_state_Started, _fsm_action_receiveINFO, _fsm_state_Receiving, tsip_dialog_info_Started_2_Receiving_X_recvINFO, "tsip_dialog_info_Started_2_Receiving_X_recvINFO"), + // Started -> (Any) -> Started + TSK_FSM_ADD_ALWAYS_NOTHING(_fsm_state_Started, "tsip_dialog_info_Started_2_Started_X_any"), + + + /*======================= + * === Sending === + */ + // Sending -> (1xx) -> Sending + TSK_FSM_ADD_ALWAYS(_fsm_state_Sending, _fsm_action_1xx, _fsm_state_Sending, tsip_dialog_info_Sending_2_Sending_X_1xx, "tsip_dialog_info_Sending_2_Sending_X_1xx"), + // Sending -> (2xx) -> Terminated + TSK_FSM_ADD_ALWAYS(_fsm_state_Sending, _fsm_action_2xx, _fsm_state_Terminated, tsip_dialog_info_Sending_2_Terminated_X_2xx, "tsip_dialog_info_Sending_2_Terminated_X_2xx"), + // Sending -> (401/407/421/494) -> Sending + TSK_FSM_ADD_ALWAYS(_fsm_state_Sending, _fsm_action_401_407_421_494, _fsm_state_Sending, tsip_dialog_info_Sending_2_Sending_X_401_407_421_494, "tsip_dialog_info_Sending_2_Sending_X_401_407_421_494"), + // Sending -> (300_to_699) -> Terminated + TSK_FSM_ADD_ALWAYS(_fsm_state_Sending, _fsm_action_300_to_699, _fsm_state_Terminated, tsip_dialog_info_Sending_2_Terminated_X_300_to_699, "tsip_dialog_info_Sending_2_Terminated_X_300_to_699"), + // Sending -> (cancel) -> Terminated + TSK_FSM_ADD_ALWAYS(_fsm_state_Sending, _fsm_action_cancel, _fsm_state_Terminated, tsip_dialog_info_Sending_2_Terminated_X_cancel, "tsip_dialog_info_Sending_2_Terminated_X_cancel"), + // Sending -> (shutdown) -> Terminated + TSK_FSM_ADD_ALWAYS(_fsm_state_Sending, _fsm_action_shutdown, _fsm_state_Terminated, tsk_null, "tsip_dialog_info_Sending_2_Terminated_X_shutdown"), + // Sending -> (Any) -> Sending + TSK_FSM_ADD_ALWAYS_NOTHING(_fsm_state_Sending, "tsip_dialog_info_Sending_2_Sending_X_any"), + + /*======================= + * === Receiving === + */ + // Receiving -> (accept) -> Terminated + TSK_FSM_ADD_ALWAYS(_fsm_state_Receiving, _fsm_action_accept, _fsm_state_Terminated, tsip_dialog_info_Receiving_2_Terminated_X_accept, "tsip_dialog_info_Receiving_2_Terminated_X_accept"), + // Receiving -> (rejected) -> Terminated + TSK_FSM_ADD_ALWAYS(_fsm_state_Receiving, _fsm_action_reject, _fsm_state_Terminated, tsip_dialog_info_Receiving_2_Terminated_X_reject, "tsip_dialog_info_Receiving_2_Terminated_X_reject"), + // Receiving -> (Any) -> Receiving + TSK_FSM_ADD_ALWAYS_NOTHING(_fsm_state_Receiving, "tsip_dialog_info_Receiving_2_Receiving_X_any"), + + /*======================= + * === Any === + */ + // Any -> (transport error) -> Terminated + TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_transporterror, _fsm_state_Terminated, tsip_dialog_info_Any_2_Terminated_X_transportError, "tsip_dialog_info_Any_2_Terminated_X_transportError"), + // Any -> (transport error) -> Terminated + TSK_FSM_ADD_ALWAYS(tsk_fsm_state_any, _fsm_action_error, _fsm_state_Terminated, tsip_dialog_info_Any_2_Terminated_X_Error, "tsip_dialog_info_Any_2_Terminated_X_Error"), + + TSK_FSM_ADD_NULL()); + + TSIP_DIALOG(self)->callback = TSIP_DIALOG_EVENT_CALLBACK_F(tsip_dialog_info_event_callback); + + return 0; } @@ -227,219 +220,219 @@ int tsip_dialog_info_init(tsip_dialog_info_t *self) */ int tsip_dialog_info_Started_2_Sending_X_sendINFO(va_list *app) { - tsip_dialog_info_t *self; - const tsip_action_t* action; + tsip_dialog_info_t *self; + const tsip_action_t* action; - self = va_arg(*app, tsip_dialog_info_t *); - va_arg(*app, tsip_message_t *); - action = va_arg(*app, const tsip_action_t *); + self = va_arg(*app, tsip_dialog_info_t *); + va_arg(*app, tsip_message_t *); + action = va_arg(*app, const tsip_action_t *); - TSIP_DIALOG(self)->running = tsk_true; + TSIP_DIALOG(self)->running = tsk_true; - return send_INFO(self); + return send_INFO(self); } /* Started -> (recvINFO) -> Receiving */ int tsip_dialog_info_Started_2_Receiving_X_recvINFO(va_list *app) { - tsip_dialog_info_t *self = va_arg(*app, tsip_dialog_info_t *); - const tsip_request_t *request = va_arg(*app, const tsip_request_t *); - - /* Alert the user. */ - TSIP_DIALOG_INFO_SIGNAL(self, tsip_i_info, - tsip_event_code_dialog_request_incoming, "Incoming Request.", request); - - /* Update last incoming INFO */ - TSK_OBJECT_SAFE_FREE(self->last_iMessage); - self->last_iMessage = tsk_object_ref((void*)request); - - return 0; + tsip_dialog_info_t *self = va_arg(*app, tsip_dialog_info_t *); + const tsip_request_t *request = va_arg(*app, const tsip_request_t *); + + /* Alert the user. */ + TSIP_DIALOG_INFO_SIGNAL(self, tsip_i_info, + tsip_event_code_dialog_request_incoming, "Incoming Request.", request); + + /* Update last incoming INFO */ + TSK_OBJECT_SAFE_FREE(self->last_iMessage); + self->last_iMessage = tsk_object_ref((void*)request); + + return 0; } /* Sending -> (1xx) -> Sending */ int tsip_dialog_info_Sending_2_Sending_X_1xx(va_list *app) { - /*tsip_dialog_info_t *self = va_arg(*app, tsip_dialog_info_t *);*/ - /*const tsip_response_t *response = va_arg(*app, const tsip_response_t *);*/ + /*tsip_dialog_info_t *self = va_arg(*app, tsip_dialog_info_t *);*/ + /*const tsip_response_t *response = va_arg(*app, const tsip_response_t *);*/ - return 0; + return 0; } /* Sending -> (2xx) -> Sending */ int tsip_dialog_info_Sending_2_Terminated_X_2xx(va_list *app) { - tsip_dialog_info_t *self = va_arg(*app, tsip_dialog_info_t *); - const tsip_response_t *response = va_arg(*app, const tsip_response_t *); + tsip_dialog_info_t *self = va_arg(*app, tsip_dialog_info_t *); + const tsip_response_t *response = va_arg(*app, const tsip_response_t *); - /* Alert the user. */ - TSIP_DIALOG_INFO_SIGNAL(self, tsip_ao_info, - TSIP_RESPONSE_CODE(response), TSIP_RESPONSE_PHRASE(response), response); + /* Alert the user. */ + TSIP_DIALOG_INFO_SIGNAL(self, tsip_ao_info, + TSIP_RESPONSE_CODE(response), TSIP_RESPONSE_PHRASE(response), response); - /* Reset curr action */ - tsip_dialog_set_curr_action(TSIP_DIALOG(self), tsk_null); + /* Reset curr action */ + tsip_dialog_set_curr_action(TSIP_DIALOG(self), tsk_null); - return 0; + return 0; } /* Sending -> (401/407/421/494) -> Sending */ int tsip_dialog_info_Sending_2_Sending_X_401_407_421_494(va_list *app) { - tsip_dialog_info_t *self = va_arg(*app, tsip_dialog_info_t *); - const tsip_response_t *response = va_arg(*app, const tsip_response_t *); - int ret; - - if((ret = tsip_dialog_update(TSIP_DIALOG(self), response))){ - // Alert the user - TSIP_DIALOG_INFO_SIGNAL(self, tsip_ao_info, - TSIP_RESPONSE_CODE(response), TSIP_RESPONSE_PHRASE(response), response); - - return ret; - } - - return send_INFO(self); + tsip_dialog_info_t *self = va_arg(*app, tsip_dialog_info_t *); + const tsip_response_t *response = va_arg(*app, const tsip_response_t *); + int ret; + + if((ret = tsip_dialog_update(TSIP_DIALOG(self), response))) { + // Alert the user + TSIP_DIALOG_INFO_SIGNAL(self, tsip_ao_info, + TSIP_RESPONSE_CODE(response), TSIP_RESPONSE_PHRASE(response), response); + + return ret; + } + + return send_INFO(self); } /* Sending -> (300 to 699) -> Terminated */ int tsip_dialog_info_Sending_2_Terminated_X_300_to_699(va_list *app) { - tsip_dialog_info_t *self = va_arg(*app, tsip_dialog_info_t *); - const tsip_response_t *response = va_arg(*app, const tsip_response_t *); + tsip_dialog_info_t *self = va_arg(*app, tsip_dialog_info_t *); + const tsip_response_t *response = va_arg(*app, const tsip_response_t *); - /* set last error (or info) */ - tsip_dialog_set_lasterror(TSIP_DIALOG(self), TSIP_RESPONSE_PHRASE(response), TSIP_RESPONSE_CODE(response)); + /* set last error (or info) */ + tsip_dialog_set_lasterror(TSIP_DIALOG(self), TSIP_RESPONSE_PHRASE(response), TSIP_RESPONSE_CODE(response)); - /* Alert the user. */ - TSIP_DIALOG_INFO_SIGNAL(self, tsip_ao_info, - TSIP_RESPONSE_CODE(response), TSIP_RESPONSE_PHRASE(response), response); + /* Alert the user. */ + TSIP_DIALOG_INFO_SIGNAL(self, tsip_ao_info, + TSIP_RESPONSE_CODE(response), TSIP_RESPONSE_PHRASE(response), response); - return 0; + return 0; } /* Sending -> (cancel) -> Terminated */ int tsip_dialog_info_Sending_2_Terminated_X_cancel(va_list *app) { - tsip_dialog_info_t *self = va_arg(*app, tsip_dialog_info_t *); - /* const tsip_message_t *message = va_arg(*app, const tsip_message_t *); */ + tsip_dialog_info_t *self = va_arg(*app, tsip_dialog_info_t *); + /* const tsip_message_t *message = va_arg(*app, const tsip_message_t *); */ - /* RFC 3261 - 9.1 Client Behavior - A CANCEL request SHOULD NOT be sent to cancel a request other than INVITE. - */ + /* RFC 3261 - 9.1 Client Behavior + A CANCEL request SHOULD NOT be sent to cancel a request other than INVITE. + */ - /* Cancel all transactions associated to this dialog (will also be done when the dialog is destroyed (worth nothing)) */ - tsip_transac_layer_cancel_by_dialog(TSIP_DIALOG_GET_STACK(self)->layer_transac, TSIP_DIALOG(self)); + /* Cancel all transactions associated to this dialog (will also be done when the dialog is destroyed (worth nothing)) */ + tsip_transac_layer_cancel_by_dialog(TSIP_DIALOG_GET_STACK(self)->layer_transac, TSIP_DIALOG(self)); - /* Alert the user */ - TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_request_cancelled, "INFO cancelled"); + /* Alert the user */ + TSIP_DIALOG_SIGNAL(self, tsip_event_code_dialog_request_cancelled, "INFO cancelled"); - return 0; + return 0; } /* Receiving -> (accept) -> Terminated */ int tsip_dialog_info_Receiving_2_Terminated_X_accept(va_list *app) { - tsip_dialog_info_t *self; - const tsip_action_t* action; - - self = va_arg(*app, tsip_dialog_info_t *); - va_arg(*app, tsip_message_t *); - action = va_arg(*app, const tsip_action_t *); - - if(!self->last_iMessage){ - TSK_DEBUG_ERROR("There is non INFO to accept()"); - /* Not an error ...but do not update current action */ - } - else{ - tsip_response_t *response; - int ret; - - /* curr_action is only used for outgoing requests */ - /* tsip_dialog_set_curr_action(TSIP_DIALOG(self), action); */ - - /* send 200 OK */ - if((response = tsip_dialog_response_new(TSIP_DIALOG(self), 200, "OK", self->last_iMessage))){ - tsip_dialog_apply_action(response, action); /* apply action params to "this" response */ - if((ret = tsip_dialog_response_send(TSIP_DIALOG(self), response))){ - TSK_DEBUG_ERROR("Failed to send SIP response."); - TSK_OBJECT_SAFE_FREE(response); - return ret; - } - TSK_OBJECT_SAFE_FREE(response); - } - else{ - TSK_DEBUG_ERROR("Failed to create SIP response."); - return -1; - } - } - - return 0; + tsip_dialog_info_t *self; + const tsip_action_t* action; + + self = va_arg(*app, tsip_dialog_info_t *); + va_arg(*app, tsip_message_t *); + action = va_arg(*app, const tsip_action_t *); + + if(!self->last_iMessage) { + TSK_DEBUG_ERROR("There is non INFO to accept()"); + /* Not an error ...but do not update current action */ + } + else { + tsip_response_t *response; + int ret; + + /* curr_action is only used for outgoing requests */ + /* tsip_dialog_set_curr_action(TSIP_DIALOG(self), action); */ + + /* send 200 OK */ + if((response = tsip_dialog_response_new(TSIP_DIALOG(self), 200, "OK", self->last_iMessage))) { + tsip_dialog_apply_action(response, action); /* apply action params to "this" response */ + if((ret = tsip_dialog_response_send(TSIP_DIALOG(self), response))) { + TSK_DEBUG_ERROR("Failed to send SIP response."); + TSK_OBJECT_SAFE_FREE(response); + return ret; + } + TSK_OBJECT_SAFE_FREE(response); + } + else { + TSK_DEBUG_ERROR("Failed to create SIP response."); + return -1; + } + } + + return 0; } /* Receiving -> (reject) -> Terminated */ int tsip_dialog_info_Receiving_2_Terminated_X_reject(va_list *app) { - tsip_dialog_info_t *self; - const tsip_action_t* action; - - self = va_arg(*app, tsip_dialog_info_t *); - va_arg(*app, tsip_message_t *); - action = va_arg(*app, const tsip_action_t *); - - if(!self->last_iMessage){ |