ping.h
上传用户:gnaf34
上传日期:2022-04-22
资源大小:1657k
文件大小:1k
源码类别:

IP电话/视频会议

开发平台:

Visual C++

  1. //
  2. // Ping.h
  3. //
  4. #pragma pack(1)
  5. #define ICMP_ECHOREPLY 0
  6. #define ICMP_ECHOREQ 8
  7. // IP Header -- RFC 791
  8. typedef struct tagIPHDR
  9. {
  10. u_char  VIHL; // Version and IHL
  11. u_char TOS; // Type Of Service
  12. short TotLen; // Total Length
  13. short ID; // Identification
  14. short FlagOff; // Flags and Fragment Offset
  15. u_char TTL; // Time To Live
  16. u_char Protocol; // Protocol
  17. u_short Checksum; // Checksum
  18. struct in_addr iaSrc; // Internet Address - Source
  19. struct in_addr iaDst; // Internet Address - Destination
  20. }IPHDR, *PIPHDR;
  21. // ICMP Header - RFC 792
  22. typedef struct tagICMPHDR
  23. {
  24. u_char Type; // Type
  25. u_char Code; // Code
  26. u_short Checksum; // Checksum
  27. u_short ID; // Identification
  28. u_short Seq; // Sequence
  29. char Data; // Data
  30. }ICMPHDR, *PICMPHDR;
  31. #define REQ_DATASIZE 32 // Echo Request Data size
  32. // ICMP Echo Request
  33. typedef struct tagECHOREQUEST
  34. {
  35. ICMPHDR icmpHdr;
  36. DWORD dwTime;
  37. char cData[REQ_DATASIZE];
  38. }ECHOREQUEST, *PECHOREQUEST;
  39. // ICMP Echo Reply
  40. typedef struct tagECHOREPLY
  41. {
  42. IPHDR ipHdr;
  43. ECHOREQUEST echoRequest;
  44. char    cFiller[256];
  45. }ECHOREPLY, *PECHOREPLY;
  46. #pragma pack()