ping.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "unp.h"
  2. #include <netinet/in_systm.h>
  3. #include <netinet/ip.h>
  4. #include <netinet/ip_icmp.h>
  5. #define BUFSIZE 1500
  6. /* globals */
  7. char sendbuf[BUFSIZE];
  8. int datalen; /* # bytes of data following ICMP header */
  9. char *host;
  10. int nsent; /* add 1 for each sendto() */
  11. pid_t pid; /* our PID */
  12. int sockfd;
  13. int verbose;
  14. /* function prototypes */
  15. void init_v6(void);
  16. void proc_v4(char *, ssize_t, struct msghdr *, struct timeval *);
  17. void proc_v6(char *, ssize_t, struct msghdr *, struct timeval *);
  18. void send_v4(void);
  19. void send_v6(void);
  20. void readloop(void);
  21. void sig_alrm(int);
  22. void tv_sub(struct timeval *, struct timeval *);
  23. struct proto {
  24. void (*fproc)(char *, ssize_t, struct msghdr *, struct timeval *);
  25. void (*fsend)(void);
  26. void (*finit)(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. } *pr;
  32. #ifdef IPV6
  33. #include <netinet/ip6.h>
  34. #include <netinet/icmp6.h>
  35. #endif