/* icmp.h */ /* EMACS_MODES: c !fill */ /* This file contains all the definitions for icmp and ggp packets. * It depends on the standard data type definitions from types.h, * and also on the internet packet header definitions in ip.h. */ struct idseq { /* echo/timestamp identifier */ unshort id_ident; /* identifier */ unshort id_seq; /* sequence no. */ }; struct tmstmp { /* timestamp */ long tm_orig; /* originate timestamp */ long tm_recv; /* receive timestamp */ long tm_trans; /* transmit timestamp */ }; struct th { /* tcp/ip hdr. for conn. id */ struct ip th_ip; /* ip hdr */ char th_data[8]; /* 64 bits of message */ }; struct icmp { /* an icmp data packet */ char ic_type; /* icmp message type */ char ic_code; /* message subtype */ unshort ic_sum; /* checksum */ union { char ic_off; /* parameter error offset */ struct in_name ic_gaddr; /* redirect gateway addr */ struct idseq ic_iseq; /* echo/timestamp id */ } ic_misc; union { struct th ic_hdr; /* tcp/ip header of orig. d'gram */ struct tmstmp ic_time; /* timestamp */ char ic_dum[1]; /* echo packet data */ } ic_data; }; struct ggredir { /* ggp redirect structure */ struct in_name gr_addr; /* redirect gateway addr */ struct th gr_hdr; /* tcp/ip hdr of orig. d'gram */ }; struct ggp { /* a ggp packet */ char gg_type; /* ggp type */ char gg_code; /* ggp subtype */ unshort gg_seq; /* ggp sequence no */ union { struct ggredir gg_redir; /* redirect packet data */ struct th gg_hdr; /* tcp/ip hdr of orig. d'gram */ char gg_dum[1]; /* echo data */ } gg_data; }; /* ICMP field definitions */ #define ICMPROTO 1 /* icmp ip protocol */ #define IC_ERPLY 0 /* echo reply type */ #define IC_DUR 3 /* destination unreachable type */ #define IC_DU_NUR 0 /* net unreachable subtype */ #define IC_DU_HUR 1 /* host unreachable subtype */ #define IC_DU_PRUR 2 /* protocol unreachable subtype */ #define IC_DU_POUR 3 /* port unreachable subtype */ #define IC_DU_FRAG 4 /* needed fragmentation */ #define IC_DU_SRC 5 /* source route failed */ #define IC_SRQ 4 /* source quench type */ #define IC_REDIR 5 /* redirect packet type */ #define IC_RD_NET 0 /* redirect packets for net */ #define IC_RD_HOST 1 /* redirect packets for host */ #define IC_RD_TSN 2 /* redirect packets for TOS & net */ #define IC_RC_TSH 3 /* redirect packets for TOS & host */ #define IC_ECHO 8 /* echo type */ #define IC_TIME 11 /* time exceeded type */ #define IC_TE_TTL 0 /* time to live exceeded */ #define IC_TE_FRAG 1 /* fragment reassembly time exceeded */ #define IC_PARAM 12 /* parameter problem type */ #define IC_TMSTMP 13 /* timestamp type */ #define IC_TMRPLY 14 /* timestamp reply type */ #define IC_IRQ 15 /* info request type */ #define IC_IRPLY 16 /* info reply type */ /* GGP field definitions */ #define GGPROTO 3 /* ggp protocol no. */ #define GG_ERPLY 0 /* echo reply packet */ #define GG_DUR 3 /* dest. unreachable */ #define GG_SRQ 4 /* source quench */ #define GG_REDIR 5 /* redirect */ #define GG_ECHO 8 /* echo packet */ /* Useful macros */ #define tvec_to_ut(tv) ((long)((((*(long *)(&tv[0])) % 86400L) * 1000L) \ + ((tv)[2] * (1000L / 60L)))) /* convert time to ms. UT */