1 #include "unp.h" 2 #include <netinet/in_systm.h> 3 #include <netinet/ip.h> 4 #include <netinet/ip_icmp.h> 5 6 #define BUFSIZE 1500 7 8 /* globals */ 9 char recvbuf[BUFSIZE]; 10 char sendbuf[BUFSIZE]; 11 12 int datalen; /* #bytes of data, following ICMP header */ 13 char *host; 14 int nsent; /* add 1 for each sendto() */ 15 pid_t pid; /* our PID */ 16 int sockfd; 17 int verbose; 18 19 /* function prototypes */ 20 void proc_v4(char *, ssize_t, struct timeval *); 21 void proc_v6(char *, ssize_t, struct timeval *); 22 void send_v4(void); 23 void send_v6(void); 24 void readloop(void); 25 void sig_alrm(int); 26 void tv_sub(struct timeval *, struct timeval *); 27 28 struct proto { 29 void (*fproc)(char *, ssize_t, struct timeval *); 30 void (*fsend)(void); 31 struct sockaddr *sasend; /* sockaddr{} for send, from getaddrinfo */ 32 struct sockaddr *sarecv; /* sockaddr{} for receiving */ 33 socklen_t salen; /* length of sockaddr{}s */ 34 int icmpproto; /* IPPROTO_xxx value for ICMP */ 35 } *pr; 36 37 #ifdef IPV6 38 39 #include "ip6.h" /* should be <netinet/ip6.h> */ 40 #include "icmp6.h" /* should be <netinet/icmp6.h> */ 41 42 #endif 43