1
/*** This Programs/Libraries are (C)opyright by Sebastian Krahmer.
2
*** You may use it under the terms of the GPL. You should have
3
*** already received the file COPYING that shows you your rights.
4
*** Please look at COPYING for further license-details.
6
*** THERE IS ABSOLUTELY NO WARRANTY. SO YOU USE IT AT YOUR OWN RISK.
7
*** IT WAS WRITTEN IN THE HOPE THAT IT WILL BE USEFULL. I AM NOT RESPONSIBLE
8
*** FOR ANY DAMAGE YOU MAYBE GET DUE TO USING MY PROGRAMS.
14
#include "usi-structs.h"
21
/*! \class ICMP icmp.h
22
* \brief the ICMP-class
24
/*! \example icmp_sniff.cc
27
class ICMP : public IP {
29
struct icmphdr icmphdr;
34
/*! Expects destination i network byte order
40
/*! Copy-Construktor */
43
/*! Assign-operator */
44
ICMP &operator=(const ICMP &);
46
/*! Assign-operator */
47
ICMP &operator=(const IP &);
49
/*! send an ICMP-packet containing 'payload' which
50
* is 'paylen' bytes long
52
virtual int sendpack(void*, size_t);
54
/*! send a ICMP-packet with string 'payload' as payload.
56
virtual int sendpack(char*);
58
/*! send standard UNIX-like payload
60
virtual int send_ping_payload();
62
/*! send the ICMP timestamp request payload
64
virtual int send_timestamp_payload();
66
virtual int send_addrmask_payload();
68
/*! handle packets, that are NOT actually for the
71
virtual int sniffpack(void*, size_t);
73
/*! Initialize a device ("eth0" for example) for packet-
74
* capturing. It MUST be called before sniffpack() is launched.
75
* Set 'promisc' to 1 if you want the device running in promiscous mode.
76
* Fetch at most 'snaplen' bytes per call.
78
virtual int init_device(char *, int, size_t);
80
/*! Set the type-field in the actuall ICMP-packet.
82
int set_type(u_int8_t);
86
int set_code(u_int8_t);
88
/*! Set id field in the actuall ICMP-packet
90
int set_icmpId(u_int16_t);
92
/*! Set the sequecenumber of the actuall ICMP-packet.
94
int set_seq(u_int16_t);
96
int set_gateway(u_int32_t);
98
int set_mtu(u_int16_t);
100
/*! Get the type-field from the actuall ICMP-packet.
108
/*! Get the id field from actuall ICMP-packet.
110
u_int16_t get_icmpId();
112
/*! Get the sequence-number of actuall ICMP-packet
118
u_int32_t get_gateway();