Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.1 KiB

  1. // wire.h
  2. //
  3. // Structures used for sending packets over the wire
  4. //
  5. #define ICMP_ECHO 8
  6. #define ICMP_ECHOREPLY 0
  7. #define ICMP_MIN 8 // minimum 8 byte icmp packet (just header)
  8. /* The IP header */
  9. typedef struct iphdr {
  10. unsigned int h_len:4; // length of the header
  11. unsigned int version:4; // Version of IP
  12. unsigned char tos; // Type of service
  13. unsigned short total_len; // total length of the packet
  14. unsigned short ident; // unique identifier
  15. unsigned short frag_and_flags; // flags
  16. unsigned char ttl;
  17. unsigned char proto; // protocol (TCP, UDP etc)
  18. unsigned short checksum; // IP checksum
  19. unsigned int sourceIP;
  20. unsigned int destIP;
  21. }IpHeader;
  22. //
  23. // ICMP header
  24. //
  25. typedef struct _ihdr {
  26. BYTE i_type;
  27. BYTE i_code; /* type sub code */
  28. USHORT i_cksum;
  29. USHORT i_id;
  30. USHORT i_seq;
  31. /* This is not the std header, but we reserve space for time */
  32. ULONG timestamp;
  33. }IcmpHeader;
  34. #define STATUS_FAILED 0xFFFF
  35. #define DEF_PACKET_SIZE 32
  36. #define MAX_PACKET 1024
  37. #define xmalloc(s) HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,(s))
  38. #define xfree(p) HeapFree (GetProcessHeap(),0,(p))