Changeset 169 for pjproject/trunk/pjsip/src/pjsip/sip_ua_layer.c
- Timestamp:
- Feb 9, 2006 2:01:40 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip/sip_ua_layer.c
r160 r169 721 721 722 722 723 #if PJ_LOG_MAX_LEVEL >= 3 724 static void print_dialog( const char *title, 725 pjsip_dialog *dlg, char *buf, pj_size_t size) 726 { 727 int len; 728 char userinfo[128]; 729 730 len = pjsip_hdr_print_on(dlg->remote.info, userinfo, sizeof(userinfo)); 731 if (len < 1) 732 pj_native_strcpy(userinfo, "<--uri too long-->"); 733 else 734 userinfo[len] = '\0'; 735 736 len = pj_snprintf(buf, size, "%s[%s] %s", 737 title, 738 (dlg->state==PJSIP_DIALOG_STATE_NULL ? " - " : 739 "est"), 740 userinfo); 741 if (len < 1 || len >= (int)size) { 742 pj_native_strcpy(buf, "<--uri too long-->"); 743 } else 744 buf[len] = '\0'; 745 } 746 #endif 747 748 /* 749 * Dump user agent contents (e.g. all dialogs). 750 */ 751 PJ_DEF(void) pjsip_ua_dump(void) 752 { 753 #if PJ_LOG_MAX_LEVEL >= 3 754 pj_hash_iterator_t itbuf, *it; 755 char dlginfo[128]; 756 757 pj_mutex_lock(mod_ua.mutex); 758 759 PJ_LOG(3, (THIS_FILE, "Number of dialog sets: %u", pj_hash_count(mod_ua.dlg_table))); 760 PJ_LOG(3, (THIS_FILE, "Dumping dialog sets:")); 761 762 it = pj_hash_first(mod_ua.dlg_table, &itbuf); 763 for (; it != NULL; it = pj_hash_next(mod_ua.dlg_table, it)) { 764 struct dlg_set *dlg_set; 765 pjsip_dialog *dlg; 766 const char *title; 767 768 dlg_set = pj_hash_this(mod_ua.dlg_table, it); 769 if (!dlg_set || pj_list_empty(&dlg_set->dlg_list)) continue; 770 771 /* First dialog in dialog set. */ 772 dlg = dlg_set->dlg_list.next; 773 if (dlg->role == PJSIP_ROLE_UAC) 774 title = " [out] "; 775 else 776 title = " [in] "; 777 778 print_dialog(title, dlg, dlginfo, sizeof(dlginfo)); 779 PJ_LOG(3,(THIS_FILE, "%s", dlginfo)); 780 781 /* Next dialog in dialog set (forked) */ 782 dlg = dlg->next; 783 while (dlg != (pjsip_dialog*) &dlg_set->dlg_list) { 784 print_dialog(" [forked] ", dlg, dlginfo, sizeof(dlginfo)); 785 dlg = dlg->next; 786 } 787 } 788 789 pj_mutex_unlock(mod_ua.mutex); 790 #endif 791 } 792
Note: See TracChangeset
for help on using the changeset viewer.