1 2 #define BUFSIZE 1500 3 4 /* globals */ 5 char recvbuf[BUFSIZE]; 6 char sendbuf[BUFSIZE]; 7 8 int datalen; /* #bytes of data, following ICMP header */ 9 int nsent; /* add 1 for each sendto() */ 10 pid_t pid; /* our PID */ 11 int sockfd; 12 int verbose; 13 char stopPing; 14 /* function prototypes */ 15 void proc_v4(char *, ssize_t, struct timeval *); 16 void proc_v6(char *, ssize_t, struct timeval *); 17 void send_v4(void); 18 void send_v6(void); 19 int readloop(void); 20 void sig_alrm(int); 21 void tv_sub(struct timeval *, struct timeval *); 22 char* sock_ntop_host(const struct sockaddr *sa, socklen_t salen); 23 unsigned short in_cksum(unsigned short *addr, int len); 24 struct proto { 25 void (*fproc)(char *, ssize_t, struct timeval *); 26 void (*fsend)(void); 27 struct sockaddr *sasend; /* sockaddr{} for send, from getaddrinfo */ 28 struct sockaddr *sarecv; /* sockaddr{} for receiving */ 29 socklen_t salen; /* length of sockaddr{}s */ 30 int icmpproto; /* IPPROTO_xxx value for ICMP */ 31 unsigned long n_send; 32 unsigned long n_recv; 33 } *pr; 34 35