Changeset 1739 for pjproject/trunk
- Timestamp:
- Jan 24, 2008 3:29:50 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c
r1735 r1739 215 215 "error while using pfkey" /* err_status_pfkey_err = 24 */ 216 216 }; 217 return liberr[err]; 217 if (err >= 0 && err < PJ_ARRAY_SIZE(liberr)) { 218 return liberr[err]; 219 } else { 220 static char msg[32]; 221 pj_ansi_snprintf(msg, sizeof(msg), "Unknown libsrtp error %d", err); 222 return msg; 223 } 218 224 #else 219 return NULL; 225 static char msg[32]; 226 pj_ansi_snprintf(msg, sizeof(msg), "libsrtp error %d", err); 227 return msg; 220 228 #endif 221 229 } … … 229 237 err = srtp_init(); 230 238 if (err != err_status_ok) { 231 PJ_LOG(4, (THIS_FILE, "Failed to init libsrtp.")); 239 PJ_LOG(4, (THIS_FILE, "Failed to initialize libsrtp: %s", 240 get_libsrtp_errstr(err))); 232 241 return PJMEDIA_ERRNO_FROM_LIBSRTP(err); 233 242 } … … 381 390 382 391 if (srtp->session_inited) { 383 PJ_LOG(4, (THIS_FILE, "SRTP could not be re-init'd before deinit'd")); 392 PJ_LOG(4, (srtp->pool->obj_name, 393 "Error: unable to start (not initialized)")); 384 394 return PJ_EINVALIDOP; 385 395 } … … 484 494 srtp->session_inited = PJ_TRUE; 485 495 486 PJ_LOG(5, ( THIS_FILE, "TX: %s key=%s", srtp->tx_policy.name.ptr,487 octet_string_hex_string(tx->key.ptr, tx->key.slen)));496 PJ_LOG(5, (srtp->pool->obj_name, "TX: %s key=%s", srtp->tx_policy.name.ptr, 497 octet_string_hex_string(tx->key.ptr, tx->key.slen))); 488 498 if (srtp->tx_policy.flags) { 489 PJ_LOG(5, (THIS_FILE,"TX: disable%s%s", (cr_tx_idx?"":" enc"),490 491 } 492 493 PJ_LOG(5, ( THIS_FILE, "RX: %s key=%s", srtp->rx_policy.name.ptr,494 octet_string_hex_string(rx->key.ptr, rx->key.slen)));499 PJ_LOG(5,(srtp->pool->obj_name,"TX: disable%s%s", (cr_tx_idx?"":" enc"), 500 (au_tx_idx?"":" auth"))); 501 } 502 503 PJ_LOG(5, (srtp->pool->obj_name, "RX: %s key=%s", srtp->rx_policy.name.ptr, 504 octet_string_hex_string(rx->key.ptr, rx->key.slen))); 495 505 if (srtp->rx_policy.flags) { 496 PJ_LOG(5, (THIS_FILE,"RX: disable%s%s", (cr_rx_idx?"":" enc"),497 506 PJ_LOG(5,(srtp->pool->obj_name,"RX: disable%s%s", (cr_rx_idx?"":" enc"), 507 (au_rx_idx?"":" auth"))); 498 508 } 499 509 … … 514 524 err = srtp_dealloc(p_srtp->srtp_rx_ctx); 515 525 if (err != err_status_ok) { 516 PJ_LOG(4, (THIS_FILE, "Failed to dealloc RX SRTP context")); 526 PJ_LOG(4, (p_srtp->pool->obj_name, 527 "Failed to dealloc RX SRTP context: %s", 528 get_libsrtp_errstr(err))); 517 529 } 518 530 err = srtp_dealloc(p_srtp->srtp_tx_ctx); 519 531 if (err != err_status_ok) { 520 PJ_LOG(4, (THIS_FILE, "Failed to dealloc TX SRTP context")); 532 PJ_LOG(4, (p_srtp->pool->obj_name, 533 "Failed to dealloc TX SRTP context: %s", 534 get_libsrtp_errstr(err))); 521 535 } 522 536 … … 714 728 srtp->rtp_cb(srtp->user_data, srtp->rx_buffer, len); 715 729 } else { 716 PJ_LOG(5, (THIS_FILE, "Failed to unprotect SRTP size=%d, err=%d", 717 size, err)); 730 PJ_LOG(5,(srtp->pool->obj_name, 731 "Failed to unprotect SRTP, pkt size=%d, err=%s", 732 size, get_libsrtp_errstr(err))); 718 733 } 719 734 … … 747 762 srtp->rtcp_cb(srtp->user_data, srtp->rx_buffer, len); 748 763 } else { 749 PJ_LOG(5, (THIS_FILE, "Failed to unprotect SRTCP size=%d, err=%d", 750 size, err)); 764 PJ_LOG(5,(srtp->pool->obj_name, 765 "Failed to unprotect SRTCP, pkt size=%d, err=%s", 766 size, get_libsrtp_errstr(err))); 751 767 } 752 768 … … 793 809 crypto_suites[cs_idx].cipher_key_len); 794 810 if (err != err_status_ok) { 795 PJ_LOG(5,(THIS_FILE, "Failed generating random key")); 811 PJ_LOG(5,(THIS_FILE, "Failed generating random key: %s", 812 get_libsrtp_errstr(err))); 796 813 return PJMEDIA_ERRNO_FROM_LIBSRTP(err); 797 814 } … … 1244 1261 status = pjmedia_transport_media_stop(srtp->real_tp); 1245 1262 if (status != PJ_SUCCESS) 1246 PJ_LOG(4, (THIS_FILE, "SRTP failed stop underlying media transport.")); 1263 PJ_LOG(4, (srtp->pool->obj_name, 1264 "SRTP failed stop underlying media transport.")); 1247 1265 1248 1266 return pjmedia_transport_srtp_stop(tp);
Note: See TracChangeset
for help on using the changeset viewer.