]> The Tcpdump Group git mirrors - tcpdump/commitdiff
improve previous NDO conversions
authorDenis Ovsienko <[email protected]>
Thu, 3 Apr 2014 12:02:07 +0000 (16:02 +0400)
committerDenis Ovsienko <[email protected]>
Thu, 3 Apr 2014 13:41:02 +0000 (17:41 +0400)
interface.h
netdissect.h
openflow.h
print-ascii.c
print-eap.c
print-rip.c
smb.h
tcpdump.c

index 3d165ccfbb5c2f7fb9ea28fa4dccfa49bf7b96df..b05a9a168161c8eef475d096b1190577c730d415 100644 (file)
@@ -156,7 +156,6 @@ extern u_int16_t create_osi_cksum(const u_int8_t *, int, int);
 
 #include <pcap.h>
 
-extern void ascii_print(const u_char *, u_int);
 extern void default_print(const u_char *, u_int);
 extern char *q922_string(const u_char *);
 extern char *smb_errstr(int, int);
index 989b70f01eca294b4a1f0cc90199ff59948021a3..1c53dae85bc4344b0c7e4f00d7a56dcb39fe92a4 100644 (file)
@@ -363,6 +363,7 @@ extern int ethertype_print(netdissect_options *,u_short, const u_char *,
                             u_int, u_int);
 
 extern int print_unknown_data(netdissect_options *,const u_char *, const char *,int);
+extern void ascii_print(netdissect_options *, const u_char *, u_int);
 extern void hex_print_with_offset(netdissect_options *, const char *ident, const u_char *cp,
                                  u_int, u_int);
 extern void hex_print(netdissect_options *,const char *ident, const u_char *cp,u_int);
index fbd42ebd16660b1819028de30acb1873337b0290..d330f1ecf0a9b12cef74002fcb3395a1d397aaed 100644 (file)
@@ -27,6 +27,9 @@
 
 /* OpenFlow: protocol between controller and datapath. */
 
+/* for netdissect_options */
+#include "netdissect.h"
+
 #define OF_HEADER_LEN 8
 
 /*
index 2f05c3873d210423c7e61d6b6b4ea92a00e7543c..f83d401a801f05e85352823bb22f1fc89108549a 100644 (file)
@@ -36,6 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#define NETDISSECT_REWORKED
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -43,7 +44,6 @@
 #include <tcpdump-stdinc.h>
 #include <stdio.h>
 
-#include "netdissect.h"
 #include "interface.h"
 
 #define ASCII_LINELENGTH 300
                (HEXDUMP_HEXSTUFF_PER_SHORT * HEXDUMP_SHORTS_PER_LINE)
 
 void
-ascii_print(register const u_char *cp, register u_int length)
+ascii_print(netdissect_options *ndo,
+            register const u_char *cp, register u_int length)
 {
-       register int s;
+       register u_char s;
 
-       putchar('\n');
+       ND_PRINT((ndo, "\n"));
        while (length > 0) {
                s = *cp++;
                length--;
@@ -73,13 +74,13 @@ ascii_print(register const u_char *cp, register u_int length)
                         * In the middle of a line, just print a '.'.
                         */
                        if (length > 1 && *cp != '\n')
-                               putchar('.');
+                               ND_PRINT((ndo, "."));
                } else {
                        if (!ND_ISGRAPH(s) &&
                            (s != '\t' && s != ' ' && s != '\n'))
-                               putchar('.');
+                               ND_PRINT((ndo, "."));
                        else
-                               putchar(s);
+                               ND_PRINT((ndo, "%c", s));
                }
        }
 }
index 5c623dc58ae3f88881df882625f9e547cef9c888..de03b8e63ff8e2f7664b3cab1dad55eeefda75e6 100644 (file)
@@ -28,7 +28,6 @@
 
 #include <tcpdump-stdinc.h>
 
-#include "netdissect.h"
 #include "interface.h"
 #include "extract.h"
 
index 8399081ca35e42eaaf162ddbc305ffd4e7d1b720..4ef0a65a68eb010e935c4aa44a7d5a802591be98 100644 (file)
@@ -137,7 +137,7 @@ rip_entry_print_v2(netdissect_options *ndo,
                        u_int i = 0;
                        ND_PRINT((ndo, "\n\t  Simple Text Authentication data: "));
                        for (; i < RIP_AUTHLEN; p++, i++)
-                               putchar (ND_ISPRINT(*p) ? *p : '.');
+                               ND_PRINT((ndo, "%c", ND_ISPRINT(*p) ? *p : '.'));
                } else if (auth_type == 3) {
                        ND_PRINT((ndo, "\n\t  Auth header:"));
                        ND_PRINT((ndo, " Packet Len %u,", EXTRACT_16BITS((u_int8_t *)ni + 4)));
diff --git a/smb.h b/smb.h
index fbaa2f4161e381f564b6377c561a13fce1c3ec0e..88eaa06964227cd3667c4b8444fd72b14521c52f 100644 (file)
--- a/smb.h
+++ b/smb.h
@@ -6,6 +6,9 @@
  * or later
  */
 
+/* for netdissect_options */
+#include "netdissect.h"
+
 /* the complete */
 #define SMBmkdir      0x00   /* create directory */
 #define SMBrmdir      0x01   /* delete directory */
index be0318538d3da585ff3b80a7e2ebabce43d9f5f5..3d2ef4e9068fa5e0fb76caf1bf8b55e3c5f7f920 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -2060,7 +2060,7 @@ print_packet(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
                        /*
                         * Include the link-layer header.
                         */
-                       ascii_print(sp, h->caplen);
+                       ascii_print(ndo, sp, h->caplen);
                } else {
                        /*
                         * Don't include the link-layer header - and if
@@ -2068,7 +2068,7 @@ print_packet(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
                         * print nothing.
                         */
                        if (h->caplen > hdrlen)
-                               ascii_print(sp + hdrlen, h->caplen - hdrlen);
+                               ascii_print(ndo, sp + hdrlen, h->caplen - hdrlen);
                }
        }