summaryrefslogtreecommitdiff
path: root/pjsip-apps
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2010-02-25 11:58:19 +0000
committerNanang Izzuddin <nanang@teluu.com>2010-02-25 11:58:19 +0000
commitcd0277b8c369c89206409d767d47600d3ed38786 (patch)
tree4ea90a5de7fb5a5842fff3685ac600c93246050b /pjsip-apps
parentc80dd76f236e41c653a6e6e95c9fa44c586c6a34 (diff)
More ticket #1032:
- Updated transport state notification callback to return void. - Updated transport state enum to only contain connected and disconnected, no more bitmask value. - Added direction field to SIP transport. - Removed remote hostname hash from transport key. - Updated cert info dump to return -1 when buffer is insufficient. - Added new error code PJSIP_TLS_ECERTVERIF. - Updated get_cert_name() in ssl_sock_symbian.c to use heap buffer instead of stack. - Minors, e.g: added prefix PJ in cipher types, docs. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3110 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip-apps')
-rw-r--r--pjsip-apps/src/pjsua/pjsua_app.c56
-rw-r--r--pjsip-apps/src/symbian_ua/ua.cpp48
2 files changed, 51 insertions, 53 deletions
diff --git a/pjsip-apps/src/pjsua/pjsua_app.c b/pjsip-apps/src/pjsua/pjsua_app.c
index d3cb8c82..083453a2 100644
--- a/pjsip-apps/src/pjsua/pjsua_app.c
+++ b/pjsip-apps/src/pjsua/pjsua_app.c
@@ -2790,8 +2790,9 @@ static void on_mwi_info(pjsua_acc_id acc_id, pjsua_mwi_info *mwi_info)
/*
* Transport status notification
*/
-static pj_bool_t on_transport_state(pjsip_transport *tp, pj_uint32_t state,
- const pjsip_transport_state_info *info)
+static void on_transport_state(pjsip_transport *tp,
+ pjsip_transport_state state,
+ const pjsip_transport_state_info *info)
{
char host_port[128];
@@ -2800,38 +2801,37 @@ static pj_bool_t on_transport_state(pjsip_transport *tp, pj_uint32_t state,
tp->remote_name.host.ptr,
tp->remote_name.port);
- if (state & PJSIP_TP_STATE_CONNECTED) {
- PJ_LOG(3,(THIS_FILE, "SIP transport %s is connected to %s",
- tp->type_name, host_port));
- }
- else if (state & PJSIP_TP_STATE_ACCEPTED) {
- PJ_LOG(3,(THIS_FILE, "SIP transport %s accepted %s",
- tp->type_name, host_port));
- }
- else if (state & PJSIP_TP_STATE_DISCONNECTED) {
- char buf[100];
+ switch (state) {
+ case PJSIP_TP_STATE_CONNECTED:
+ {
+ PJ_LOG(3,(THIS_FILE, "SIP transport %s is connected to %s",
+ tp->type_name, host_port));
+ }
+ break;
- snprintf(buf, sizeof(buf), "SIP transport %s is disconnected from %s",
- tp->type_name, host_port);
- pjsua_perror(THIS_FILE, buf, info->status);
- }
- else if (state & PJSIP_TP_STATE_REJECTED) {
- char buf[100];
+ case PJSIP_TP_STATE_DISCONNECTED:
+ {
+ char buf[100];
- snprintf(buf, sizeof(buf), "SIP transport %s rejected %s",
- tp->type_name, host_port);
- pjsua_perror(THIS_FILE, buf, info->status);
+ snprintf(buf, sizeof(buf), "SIP transport %s is disconnected from %s",
+ tp->type_name, host_port);
+ pjsua_perror(THIS_FILE, buf, info->status);
+ }
+ break;
+
+ default:
+ break;
}
#if defined(PJSIP_HAS_TLS_TRANSPORT) && PJSIP_HAS_TLS_TRANSPORT!=0
if (!pj_ansi_stricmp(tp->type_name, "tls") && info->ext_info &&
(state == PJSIP_TP_STATE_CONNECTED ||
- (state & PJSIP_TP_STATE_TLS_VERIF_ERROR)))
+ ((pjsip_tls_state_info*)info->ext_info)->
+ ssl_sock_info->verify_status != PJ_SUCCESS))
{
pjsip_tls_state_info *tls_info = (pjsip_tls_state_info*)info->ext_info;
- pj_ssl_sock_info *ssl_sock_info = (pj_ssl_sock_info*)
- tls_info->ssl_sock_info;
+ pj_ssl_sock_info *ssl_sock_info = tls_info->ssl_sock_info;
char buf[2048];
const char *verif_msgs[32];
unsigned verif_msg_cnt;
@@ -2843,8 +2843,8 @@ static pj_bool_t on_transport_state(pjsip_transport *tp, pj_uint32_t state,
/* Dump server TLS certificate verification result */
verif_msg_cnt = PJ_ARRAY_SIZE(verif_msgs);
- pj_ssl_cert_verify_error_st(ssl_sock_info->verify_status,
- verif_msgs, &verif_msg_cnt);
+ pj_ssl_cert_get_verify_status_strings(ssl_sock_info->verify_status,
+ verif_msgs, &verif_msg_cnt);
PJ_LOG(3,(THIS_FILE, "TLS cert verification result of %s : %s",
host_port,
(verif_msg_cnt == 1? verif_msgs[0]:"")));
@@ -2854,7 +2854,7 @@ static pj_bool_t on_transport_state(pjsip_transport *tp, pj_uint32_t state,
PJ_LOG(3,(THIS_FILE, "- %s", verif_msgs[i]));
}
- if (state & PJSIP_TP_STATE_TLS_VERIF_ERROR &&
+ if (ssl_sock_info->verify_status &&
!app_config.udp_cfg.tls_setting.verify_server)
{
PJ_LOG(3,(THIS_FILE, "PJSUA is configured to ignore TLS cert "
@@ -2863,7 +2863,7 @@ static pj_bool_t on_transport_state(pjsip_transport *tp, pj_uint32_t state,
}
#endif
- return PJ_TRUE;
+
}
/*
diff --git a/pjsip-apps/src/symbian_ua/ua.cpp b/pjsip-apps/src/symbian_ua/ua.cpp
index 620e75a7..fb4b3c92 100644
--- a/pjsip-apps/src/symbian_ua/ua.cpp
+++ b/pjsip-apps/src/symbian_ua/ua.cpp
@@ -273,8 +273,9 @@ static void on_call_replaced(pjsua_call_id old_call_id,
/*
* Transport status notification
*/
-static pj_bool_t on_transport_state(pjsip_transport *tp, pj_uint32_t state,
- const pjsip_transport_state_info *info)
+static void on_transport_state(pjsip_transport *tp,
+ pjsip_transport_state state,
+ const pjsip_transport_state_info *info)
{
char host_port[128];
@@ -283,34 +284,32 @@ static pj_bool_t on_transport_state(pjsip_transport *tp, pj_uint32_t state,
tp->remote_name.host.ptr,
tp->remote_name.port);
- if (state & PJSIP_TP_STATE_CONNECTED) {
- PJ_LOG(3,(THIS_FILE, "SIP transport %s is connected to %s",
- tp->type_name, host_port));
- }
- else if (state & PJSIP_TP_STATE_ACCEPTED) {
- PJ_LOG(3,(THIS_FILE, "SIP transport %s accepted %s",
- tp->type_name, host_port));
- }
- else if (state & PJSIP_TP_STATE_DISCONNECTED) {
- char buf[100];
-
- snprintf(buf, sizeof(buf), "SIP transport %s is disconnected from %s",
- tp->type_name, host_port);
- pjsua_perror(THIS_FILE, buf, info->status);
- }
- else if (state & PJSIP_TP_STATE_REJECTED) {
- char buf[100];
+ switch (state) {
+ case PJSIP_TP_STATE_CONNECTED:
+ {
+ PJ_LOG(3,(THIS_FILE, "SIP transport %s is connected to %s",
+ tp->type_name, host_port));
+ }
+ break;
+
+ case PJSIP_TP_STATE_DISCONNECTED:
+ {
+ char buf[100];
- snprintf(buf, sizeof(buf), "SIP transport %s rejected %s",
- tp->type_name, host_port);
- pjsua_perror(THIS_FILE, buf, info->status);
+ snprintf(buf, sizeof(buf), "SIP transport %s is disconnected from %s",
+ tp->type_name, host_port);
+ pjsua_perror(THIS_FILE, buf, info->status);
+ }
+ break;
+
+ default:
+ break;
}
#if defined(PJSIP_HAS_TLS_TRANSPORT) && PJSIP_HAS_TLS_TRANSPORT!=0
if (!pj_ansi_stricmp(tp->type_name, "tls") && info->ext_info &&
- (state == PJSIP_TP_STATE_CONNECTED ||
- (state & PJSIP_TP_STATE_TLS_VERIF_ERROR)))
+ state == PJSIP_TP_STATE_CONNECTED)
{
pjsip_tls_state_info *tls_info = (pjsip_tls_state_info*)info->ext_info;
pj_ssl_sock_info *ssl_sock_info = (pj_ssl_sock_info*)
@@ -324,7 +323,6 @@ static pj_bool_t on_transport_state(pjsip_transport *tp, pj_uint32_t state,
}
#endif
- return PJ_TRUE;
}