Updated code
This commit is contained in:
parent
a2befb9dd0
commit
528760f924
@ -28,7 +28,7 @@
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* @(#)$Id: tcpdump.c,v 1.1 2006/06/17 22:41:18 adamdunkels Exp $
|
||||
* @(#)$Id: tcpdump.c,v 1.2 2006/10/09 11:53:56 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
#include "contiki-net.h"
|
||||
@ -127,11 +127,11 @@ struct udpip_hdr {
|
||||
u16_t udpchksum;
|
||||
};
|
||||
|
||||
#define ETHBUF ((struct eth_hdr *)&uip_buf[0])
|
||||
#define IPBUF ((struct ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#define UDPBUF ((struct udpip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#define ICMPBUF ((struct icmpip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#define TCPBUF ((struct tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#define ETHBUF ((struct eth_hdr *)&packet[0])
|
||||
#define IPBUF ((struct ip_hdr *)&packet[0])
|
||||
#define UDPBUF ((struct udpip_hdr *)&packet[0])
|
||||
#define ICMPBUF ((struct icmpip_hdr *)&packet[0])
|
||||
#define TCPBUF ((struct tcpip_hdr *)&packet[0])
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
@ -195,7 +195,8 @@ s(char *str, char *ptr)
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
tcpdump_print(char *buf, u16_t buflen)
|
||||
tcpdump_format(u8_t *packet, u16_t packetlen,
|
||||
char *buf, u16_t buflen)
|
||||
{
|
||||
char flags[8];
|
||||
if(IPBUF->proto == UIP_PROTO_ICMP) {
|
||||
@ -280,6 +281,8 @@ tcpdump_print(char *buf, u16_t buflen)
|
||||
IPBUF->destipaddr[2], IPBUF->destipaddr[3],
|
||||
htons(TCPBUF->destport),
|
||||
flags); */
|
||||
} else {
|
||||
strcpy(buf, "Unrecognized protocol");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -28,13 +28,14 @@
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* @(#)$Id: tcpdump.h,v 1.1 2006/06/17 22:41:18 adamdunkels Exp $
|
||||
* @(#)$Id: tcpdump.h,v 1.2 2006/10/09 11:53:56 adamdunkels Exp $
|
||||
*/
|
||||
#ifndef __TCPDUMP_H__
|
||||
#define __TCPDUMP_H__
|
||||
|
||||
#include "uip.h"
|
||||
|
||||
int tcpdump_print(char *buf, u16_t buflen);
|
||||
int tcpdump_format(u8_t *packet, u16_t *len,
|
||||
char *printbuf, u16_t printbuflen);
|
||||
|
||||
#endif /* __TCPDUMP_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user