ongrep

A cleaned up fork of ngrep for OpenBSD
git clone git://git.sgregoratto.me/ongrep
Log | Files | Refs | README | LICENSE

commit 7207d5f28a8025df25fbae6dea5d52e8313ed01d
parent 96e05404db2b81b7e9c0f9977b5c2d7db44cc2b1
Author: Jordan Ritter <jpr5@darkridge.com>
Date:   Wed, 16 Feb 2005 06:01:26 +0000

add IGMP packet type for win32 support nettypes.h

Diffstat:
Mwin32/support/nettypes.h | 128+++++++++++++++++++++++++++++++++++++++++--------------------------------------
1 file changed, 67 insertions(+), 61 deletions(-)

diff --git a/win32/support/nettypes.h b/win32/support/nettypes.h @@ -1,13 +1,13 @@ -/* +/* * $Id$ * * Because Windows standard headers are woefully inadequate for (real) - * network application development, and because I'm basically lazy, I + * network application development, and because I'm basically lazy, I * created this header as a container for the types ngrep needs. - * + * * The orginal ngrep port to Windows was completed by - * Mike Davis <mike@eEye.com>. Unfortunately, I wasn't able to + * Mike Davis <mike@eEye.com>. Unfortunately, I wasn't able to * figure out how he did the headers, so I had to redo a lot on my own. * Please pardon the hack. */ @@ -17,49 +17,49 @@ typedef unsigned short u_int16_t; typedef unsigned long u_int32_t; -#define IP_RF 0x8000 /* reserved fragment flag */ -#define IP_DF 0x4000 /* dont fragment flag */ -#define IP_MF 0x2000 /* more fragments flag */ -#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ +#define IP_RF 0x8000 /* reserved fragment flag */ +#define IP_DF 0x4000 /* dont fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ +#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ struct ip { - u_int8_t ip_hl:4; /* header length */ - u_int8_t ip_v:4; /* version */ - u_int8_t ip_tos; /* type of service */ - u_int16_t ip_len; /* total length */ - u_int16_t ip_id; /* identification */ - u_int16_t ip_off; /* fragment offset field */ - u_int8_t ip_ttl; /* time to live */ - u_int8_t ip_p; /* protocol */ - u_int16_t ip_sum; /* checksum */ - struct in_addr ip_src, ip_dst; /* source and dest address */ + u_int8_t ip_hl:4; /* header length */ + u_int8_t ip_v:4; /* version */ + u_int8_t ip_tos; /* type of service */ + u_int16_t ip_len; /* total length */ + u_int16_t ip_id; /* identification */ + u_int16_t ip_off; /* fragment offset field */ + u_int8_t ip_ttl; /* time to live */ + u_int8_t ip_p; /* protocol */ + u_int16_t ip_sum; /* checksum */ + struct in_addr ip_src, ip_dst; /* source and dest address */ }; -#define TH_FIN 0x01 -#define TH_SYN 0x02 -#define TH_RST 0x04 -#define TH_PUSH 0x08 -#define TH_ACK 0x10 -#define TH_URG 0x20 +#define TH_FIN 0x01 +#define TH_SYN 0x02 +#define TH_RST 0x04 +#define TH_PUSH 0x08 +#define TH_ACK 0x10 +#define TH_URG 0x20 -typedef u_int32_t tcp_seq; +typedef u_int32_t tcp_seq; struct tcphdr { - u_int16_t th_sport; /* source port */ - u_int16_t th_dport; /* destination port */ - tcp_seq th_seq; /* sequence number */ - tcp_seq th_ack; /* acknowledgement number */ - u_int8_t th_x2:4; /* (unused) */ - u_int8_t th_off:4; /* data offset */ + u_int16_t th_sport; /* source port */ + u_int16_t th_dport; /* destination port */ + tcp_seq th_seq; /* sequence number */ + tcp_seq th_ack; /* acknowledgement number */ + u_int8_t th_x2:4; /* (unused) */ + u_int8_t th_off:4; /* data offset */ u_int8_t th_flags; - u_int16_t th_win; /* window */ - u_int16_t th_sum; /* checksum */ - u_int16_t th_urp; /* urgent pointer */ + u_int16_t th_win; /* window */ + u_int16_t th_sum; /* checksum */ + u_int16_t th_urp; /* urgent pointer */ }; struct udphdr { - u_int16_t uh_sport; /* source port */ + u_int16_t uh_sport; /* source port */ u_int16_t uh_dport; /* destination port */ u_int16_t uh_ulen; /* udp length */ u_int16_t uh_sum; /* udp checksum */ @@ -67,28 +67,35 @@ struct udphdr { struct icmp { - u_int8_t icmp_type; - u_int8_t icmp_code; - u_int16_t icmp_cksum; - - union { - u_int8_t ih_pptr; - struct in_addr ih_gwaddr; - struct ih_idseq { - u_int16_t icd_id; - u_int16_t icd_seq; - } ih_idseq; - u_int32_t ih_void; - - struct ih_pmtu { - u_int16_t ipm_void; - u_int16_t ipm_nextmtu; - } ih_pmtu; - - struct ih_rtradv { - u_int8_t irt_num_addrs; - u_int8_t irt_wpa; - u_int16_t irt_lifetime; - } ih_rtradv; - } icmp_hun; -};- \ No newline at end of file + u_int8_t icmp_type; + u_int8_t icmp_code; + u_int16_t icmp_cksum; + + union { + u_int8_t ih_pptr; + struct in_addr ih_gwaddr; + struct ih_idseq { + u_int16_t icd_id; + u_int16_t icd_seq; + } ih_idseq; + u_int32_t ih_void; + + struct ih_pmtu { + u_int16_t ipm_void; + u_int16_t ipm_nextmtu; + } ih_pmtu; + + struct ih_rtradv { + u_int8_t irt_num_addrs; + u_int8_t irt_wpa; + u_int16_t irt_lifetime; + } ih_rtradv; + } icmp_hun; +}; + +struct igmp { + u_int8_t igmp_type; /* IGMP type */ + u_int8_t igmp_code; /* routing code */ + u_int16_t igmp_cksum; /* checksum */ + struct in_addr igmp_group; /* group address */ +};