Commit 6d35bf49c88a20b6d68f10266219973ba0cff09c
1 parent
fe8416ea
Exists in
master
and in
5 other branches
Ajustes no trace de rede
Showing
1 changed file
with
31 additions
and
27 deletions
Show diff stats
src/lib3270/telnet.c
@@ -2711,31 +2711,6 @@ opt(unsigned char c) | @@ -2711,31 +2711,6 @@ opt(unsigned char c) | ||
2711 | void trace_netdata(H3270 *hSession, char direction, unsigned const char *buf, int len) | 2711 | void trace_netdata(H3270 *hSession, char direction, unsigned const char *buf, int len) |
2712 | { | 2712 | { |
2713 | 2713 | ||
2714 | - // IS DS trace ON? | ||
2715 | - if (lib3270_get_toggle(hSession,LIB3270_TOGGLE_DS_TRACE)) | ||
2716 | - { | ||
2717 | - int offset; | ||
2718 | - struct timeval ts; | ||
2719 | - double tdiff; | ||
2720 | - | ||
2721 | - (void) gettimeofday(&ts, (struct timezone *)NULL); | ||
2722 | - if (IN_3270) | ||
2723 | - { | ||
2724 | - tdiff = ((1.0e6 * (double)(ts.tv_sec - hSession->ds_ts.tv_sec)) + | ||
2725 | - (double)(ts.tv_usec - hSession->ds_ts.tv_usec)) / 1.0e6; | ||
2726 | - trace_dsn(hSession,"%c +%gs\n", direction, tdiff); | ||
2727 | - } | ||
2728 | - | ||
2729 | - hSession->ds_ts = ts; | ||
2730 | - for (offset = 0; offset < len; offset++) | ||
2731 | - { | ||
2732 | - if (!(offset % LINEDUMP_MAX)) | ||
2733 | - trace_dsn(hSession,"%s%c 0x%-3x ",(offset ? "\n" : ""), direction, offset); | ||
2734 | - trace_dsn(hSession,"%02x", buf[offset]); | ||
2735 | - } | ||
2736 | - trace_dsn(hSession,"\n"); | ||
2737 | - } | ||
2738 | - | ||
2739 | if (lib3270_get_toggle(hSession,LIB3270_TOGGLE_NETWORK_TRACE)) | 2714 | if (lib3270_get_toggle(hSession,LIB3270_TOGGLE_NETWORK_TRACE)) |
2740 | { | 2715 | { |
2741 | char l1[82]; | 2716 | char l1[82]; |
@@ -2745,6 +2720,12 @@ void trace_netdata(H3270 *hSession, char direction, unsigned const char *buf, in | @@ -2745,6 +2720,12 @@ void trace_netdata(H3270 *hSession, char direction, unsigned const char *buf, in | ||
2745 | int offset; | 2720 | int offset; |
2746 | int col = 0; | 2721 | int col = 0; |
2747 | 2722 | ||
2723 | + time_t ltime; | ||
2724 | + | ||
2725 | + time(<ime); | ||
2726 | + strftime(l1, 81, "%x %X", localtime(<ime)); | ||
2727 | + lib3270_write_nettrace(hSession,"%c %s %s data len=%d\n\n",direction,l1,direction == '>' ? "outbound" : "inbound", len); | ||
2728 | + | ||
2748 | for (offset = 0; offset < len; offset++) | 2729 | for (offset = 0; offset < len; offset++) |
2749 | { | 2730 | { |
2750 | unsigned char text[4]; | 2731 | unsigned char text[4]; |
@@ -2759,7 +2740,7 @@ void trace_netdata(H3270 *hSession, char direction, unsigned const char *buf, in | @@ -2759,7 +2740,7 @@ void trace_netdata(H3270 *hSession, char direction, unsigned const char *buf, in | ||
2759 | if(++col >= 80) | 2740 | if(++col >= 80) |
2760 | { | 2741 | { |
2761 | l1[col] = l2[col] = l3[col] = 0; | 2742 | l1[col] = l2[col] = l3[col] = 0; |
2762 | - lib3270_write_nettrace(hSession,"%c\t%s\n\t%s\n\t%s\n",direction,l1,l2,l3); | 2743 | + lib3270_write_nettrace(hSession,"\t%s\n\t%s\n\t%s\n\n",l1,l2,l3); |
2763 | col = 0; | 2744 | col = 0; |
2764 | } | 2745 | } |
2765 | } | 2746 | } |
@@ -2767,9 +2748,32 @@ void trace_netdata(H3270 *hSession, char direction, unsigned const char *buf, in | @@ -2767,9 +2748,32 @@ void trace_netdata(H3270 *hSession, char direction, unsigned const char *buf, in | ||
2767 | if(col) | 2748 | if(col) |
2768 | { | 2749 | { |
2769 | l1[col] = l2[col] = l3[col] = 0; | 2750 | l1[col] = l2[col] = l3[col] = 0; |
2770 | - lib3270_write_nettrace(hSession,"%c\t%s\n\t%s\n\t%s\n",direction,l1,l2,l3); | 2751 | + lib3270_write_nettrace(hSession,"\t%s\n\t%s\n\t%s\n\n",l1,l2,l3); |
2752 | + } | ||
2753 | + | ||
2754 | + } | ||
2755 | + else if (lib3270_get_toggle(hSession,LIB3270_TOGGLE_DS_TRACE)) | ||
2756 | + { | ||
2757 | + int offset; | ||
2758 | + struct timeval ts; | ||
2759 | + double tdiff; | ||
2760 | + | ||
2761 | + (void) gettimeofday(&ts, (struct timezone *)NULL); | ||
2762 | + if (IN_3270) | ||
2763 | + { | ||
2764 | + tdiff = ((1.0e6 * (double)(ts.tv_sec - hSession->ds_ts.tv_sec)) + | ||
2765 | + (double)(ts.tv_usec - hSession->ds_ts.tv_usec)) / 1.0e6; | ||
2766 | + trace_dsn(hSession,"%c +%gs\n", direction, tdiff); | ||
2771 | } | 2767 | } |
2772 | 2768 | ||
2769 | + hSession->ds_ts = ts; | ||
2770 | + for (offset = 0; offset < len; offset++) | ||
2771 | + { | ||
2772 | + if (!(offset % LINEDUMP_MAX)) | ||
2773 | + trace_dsn(hSession,"%s%c 0x%-3x ",(offset ? "\n" : ""), direction, offset); | ||
2774 | + trace_dsn(hSession,"%02x", buf[offset]); | ||
2775 | + } | ||
2776 | + trace_dsn(hSession,"\n"); | ||
2773 | } | 2777 | } |
2774 | 2778 | ||
2775 | } | 2779 | } |