ChangeLog: Added the bugfix with `operating_mode'.
[collectd.git] / src / libping / linux.h
1 #define ICMP_ECHOREPLY          0 
2 #define ICMP_ECHO               8
3 #define ICMP_MINLEN             8
4
5 struct ip {
6 #if (BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN)
7         u_char  ip_hl:4,                /* header length */
8                 ip_v:4;                 /* version */
9 #else
10         u_char  ip_v:4,                 /* version */
11                 ip_hl:4;                /* header length */
12 #endif
13         u_char  ip_tos;                 /* type of service */
14         short   ip_len;                 /* total length */
15         u_short ip_id;                  /* identification */
16         short   ip_off;                 /* fragment offset field */
17 #define IP_DF 0x4000                    /* dont fragment flag */
18 #define IP_MF 0x2000                    /* more fragments flag */
19         u_char  ip_ttl;                 /* time to live */
20         u_char  ip_p;                   /* protocol */
21         u_short ip_sum;                 /* checksum */
22         struct  in_addr ip_src,ip_dst;  /* source and dest address */
23 };
24
25 #define n_short u_short                 /* normally defined in in_systm.h */
26 #define n_long  u_int                   /* redefine for 64-bit machines */
27 #define n_time  u_int                   /* redefine for 64-bit machines */
28
29 struct icmp {
30         u_char  icmp_type;              /* type of message, see below */
31         u_char  icmp_code;              /* type sub code */
32         u_short icmp_cksum;             /* ones complement cksum of struct */
33         union {
34                 u_char ih_pptr;                 /* ICMP_PARAMPROB */
35                 struct in_addr ih_gwaddr;       /* ICMP_REDIRECT */
36                 struct ih_idseq {
37                         n_short icd_id;
38                         n_short icd_seq;
39                 } ih_idseq;
40                 int ih_void;
41         } icmp_hun;
42 #define icmp_pptr       icmp_hun.ih_pptr
43 #define icmp_gwaddr     icmp_hun.ih_gwaddr
44 #define icmp_id         icmp_hun.ih_idseq.icd_id
45 #define icmp_seq        icmp_hun.ih_idseq.icd_seq
46 #define icmp_void       icmp_hun.ih_void
47         union {
48                 struct id_ts {
49                         n_time its_otime;
50                         n_time its_rtime;
51                         n_time its_ttime;
52                 } id_ts;
53                 struct id_ip  {
54                         struct ip idi_ip;
55                         /* options and then 64 bits of data */
56                 } id_ip;
57                 n_long  id_mask;
58                 char    id_data[1];
59         } icmp_dun;
60 #define icmp_otime      icmp_dun.id_ts.its_otime
61 #define icmp_rtime      icmp_dun.id_ts.its_rtime
62 #define icmp_ttime      icmp_dun.id_ts.its_ttime
63 #define icmp_ip         icmp_dun.id_ip.idi_ip
64 #define icmp_mask       icmp_dun.id_mask
65 #define icmp_data       icmp_dun.id_data
66 };