diff options
Diffstat (limited to 'src/vpn/gnunet-vpn-pretty-print.c')
-rw-r--r-- | src/vpn/gnunet-vpn-pretty-print.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/src/vpn/gnunet-vpn-pretty-print.c b/src/vpn/gnunet-vpn-pretty-print.c index 90bbe7bea..d7edf0a11 100644 --- a/src/vpn/gnunet-vpn-pretty-print.c +++ b/src/vpn/gnunet-vpn-pretty-print.c | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <ctype.h> | 4 | #include <ctype.h> |
5 | #include <arpa/inet.h> | 5 | #include <arpa/inet.h> |
6 | 6 | ||
7 | #include "packet.h" | 7 | #include "gnunet-vpn-packet.h" |
8 | 8 | ||
9 | static char* pretty = /*{{{*/ | 9 | static char* pretty = /*{{{*/ |
10 | /* 0 1 2 3 4 5 6 | 10 | /* 0 1 2 3 4 5 6 |
@@ -92,7 +92,7 @@ void pp_hexdump(unsigned char* data, char* dest, int max) {{{ | |||
92 | }}} | 92 | }}} |
93 | 93 | ||
94 | void pp_write_header(char* dest, struct ip6_pkt* pkt) {{{ | 94 | void pp_write_header(char* dest, struct ip6_pkt* pkt) {{{ |
95 | switch (pkt->hdr.nxthdr) { | 95 | switch (pkt->ip6_hdr.nxthdr) { |
96 | case 0x3a: | 96 | case 0x3a: |
97 | memcpy(dest, "ICMPv6)", 7); | 97 | memcpy(dest, "ICMPv6)", 7); |
98 | break; | 98 | break; |
@@ -114,32 +114,32 @@ void pkt_printf(struct ip6_pkt* pkt) {{{ | |||
114 | 114 | ||
115 | memcpy(buf, pretty, strlen(pretty)+1); | 115 | memcpy(buf, pretty, strlen(pretty)+1); |
116 | 116 | ||
117 | pp_ip6adr(pkt->hdr.sadr, buf+16); | 117 | pp_ip6adr(pkt->ip6_hdr.sadr, buf+16); |
118 | pp_ip6adr(pkt->hdr.dadr, buf+76); | 118 | pp_ip6adr(pkt->ip6_hdr.dadr, buf+76); |
119 | 119 | ||
120 | int flow = (ntohl(pkt->hdr.flowlbl)); | 120 | int flow = (ntohl(pkt->ip6_hdr.flowlbl)); |
121 | sprintf(tmp, "%03x", flow); | 121 | sprintf(tmp, "%03x", flow); |
122 | memcpy(buf+138, tmp, 3); | 122 | memcpy(buf+138, tmp, 3); |
123 | sprintf(tmp, "%-8d", flow); | 123 | sprintf(tmp, "%-8d", flow); |
124 | memcpy(buf+143, tmp, 8); | 124 | memcpy(buf+143, tmp, 8); |
125 | 125 | ||
126 | int length = ntohs(pkt->hdr.paylgth); | 126 | int length = ntohs(pkt->ip6_hdr.paylgth); |
127 | sprintf(tmp, "%02x", length); | 127 | sprintf(tmp, "%02x", length); |
128 | memcpy(buf+198, tmp, 2); | 128 | memcpy(buf+198, tmp, 2); |
129 | sprintf(tmp, "%-3d", length); | 129 | sprintf(tmp, "%-3d", length); |
130 | memcpy(buf+203, tmp, 3); | 130 | memcpy(buf+203, tmp, 3); |
131 | 131 | ||
132 | sprintf(tmp, "%02x", pkt->hdr.nxthdr); | 132 | sprintf(tmp, "%02x", pkt->ip6_hdr.nxthdr); |
133 | memcpy(buf+258, tmp, 2); | 133 | memcpy(buf+258, tmp, 2); |
134 | pp_write_header(buf+263, pkt); | 134 | pp_write_header(buf+263, pkt); |
135 | 135 | ||
136 | sprintf(tmp, "%02x", pkt->hdr.hoplmt); | 136 | sprintf(tmp, "%02x", pkt->ip6_hdr.hoplmt); |
137 | memcpy(buf+318, tmp, 2); | 137 | memcpy(buf+318, tmp, 2); |
138 | sprintf(tmp, "%-3d", pkt->hdr.hoplmt); | 138 | sprintf(tmp, "%-3d", pkt->ip6_hdr.hoplmt); |
139 | memcpy(buf+323, tmp, 3); | 139 | memcpy(buf+323, tmp, 3); |
140 | 140 | ||
141 | int size = payload(&pkt->hdr); | 141 | int size = ntohs(pkt->ip6_hdr.paylgth); |
142 | int i; | 142 | int i; |
143 | for(i = 0; i < 8; i++) { | 143 | for(i = 0; i < 8; i++) { |
144 | if (16*i > size) break; | 144 | if (16*i > size) break; |
145 | pp_hexdump(pkt->data + (16*i), buf + 420 + (i*70), size - 16*i); | 145 | pp_hexdump(pkt->data + (16*i), buf + 420 + (i*70), size - 16*i); |
@@ -150,31 +150,31 @@ void pkt_printf(struct ip6_pkt* pkt) {{{ | |||
150 | }}} | 150 | }}} |
151 | 151 | ||
152 | void pkt_printf_ip6tcp(struct ip6_tcp* pkt) {{{ | 152 | void pkt_printf_ip6tcp(struct ip6_tcp* pkt) {{{ |
153 | printf("spt: %u\n", ntohs(pkt->data.spt)); | 153 | printf("spt: %u\n", ntohs(pkt->tcp_hdr.spt)); |
154 | printf("dpt: %u\n", ntohs(pkt->data.dpt)); | 154 | printf("dpt: %u\n", ntohs(pkt->tcp_hdr.dpt)); |
155 | printf("seq: %u\n", ntohs(pkt->data.seq)); | 155 | printf("seq: %u\n", ntohs(pkt->tcp_hdr.seq)); |
156 | printf("ack: %u\n", ntohs(pkt->data.ack)); | 156 | printf("ack: %u\n", ntohs(pkt->tcp_hdr.ack)); |
157 | printf("off: %u\n", ntohs(pkt->data.off)); | 157 | printf("off: %u\n", ntohs(pkt->tcp_hdr.off)); |
158 | printf("wsz: %u\n", ntohs(pkt->data.wsz)); | 158 | printf("wsz: %u\n", ntohs(pkt->tcp_hdr.wsz)); |
159 | printf("crc: 0x%x\n", ntohs(pkt->data.crc)); | 159 | printf("crc: 0x%x\n", ntohs(pkt->tcp_hdr.crc)); |
160 | printf("urg: %u\n", ntohs(pkt->data.urg)); | 160 | printf("urg: %u\n", ntohs(pkt->tcp_hdr.urg)); |
161 | printf("flags: %c%c%c%c%c%c%c%c\n", | 161 | printf("flags: %c%c%c%c%c%c%c%c\n", |
162 | pkt->data.flg & 0x80 ? 'C' : '.', | 162 | pkt->tcp_hdr.flg & 0x80 ? 'C' : '.', |
163 | pkt->data.flg & 0x40 ? 'E' : '.', | 163 | pkt->tcp_hdr.flg & 0x40 ? 'E' : '.', |
164 | pkt->data.flg & 0x20 ? 'U' : '.', | 164 | pkt->tcp_hdr.flg & 0x20 ? 'U' : '.', |
165 | pkt->data.flg & 0x10 ? 'A' : '.', | 165 | pkt->tcp_hdr.flg & 0x10 ? 'A' : '.', |
166 | pkt->data.flg & 0x08 ? 'P' : '.', | 166 | pkt->tcp_hdr.flg & 0x08 ? 'P' : '.', |
167 | pkt->data.flg & 0x04 ? 'R' : '.', | 167 | pkt->tcp_hdr.flg & 0x04 ? 'R' : '.', |
168 | pkt->data.flg & 0x02 ? 'S' : '.', | 168 | pkt->tcp_hdr.flg & 0x02 ? 'S' : '.', |
169 | pkt->data.flg & 0x01 ? 'F' : '.' | 169 | pkt->tcp_hdr.flg & 0x01 ? 'F' : '.' |
170 | ); | 170 | ); |
171 | }}} | 171 | }}} |
172 | 172 | ||
173 | void pkt_printf_ip6udp(struct ip6_udp* pkt) {{{ | 173 | void pkt_printf_ip6udp(struct ip6_udp* pkt) {{{ |
174 | printf("spt: %u\n", ntohs(pkt->data.spt)); | 174 | printf("spt: %u\n", ntohs(pkt->udp_hdr.spt)); |
175 | printf("dpt: %u\n", ntohs(pkt->data.dpt)); | 175 | printf("dpt: %u\n", ntohs(pkt->udp_hdr.dpt)); |
176 | printf("len: %u\n", ntohs(pkt->data.len)); | 176 | printf("len: %u\n", ntohs(pkt->udp_hdr.len)); |
177 | printf("crc: 0x%x\n", ntohs(pkt->data.crc)); | 177 | printf("crc: 0x%x\n", ntohs(pkt->udp_hdr.crc)); |
178 | }}} | 178 | }}} |
179 | 179 | ||
180 | static char* dns_types(unsigned short type) {{{ | 180 | static char* dns_types(unsigned short type) {{{ |