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.

109 lines
2.7 KiB

  1. //=============================================================================
  2. // Copyright (c) 1998 Microsoft Corporation
  3. // File Name: packet.h
  4. // Abstract:
  5. //
  6. // Author: K.S.Lokesh (lokeshs@) 1-1-98
  7. //=============================================================================
  8. //-----------------------------------------------------------------------------
  9. // ASYNC_SOCKET_DATA structure is used to pass / receive back data from an
  10. // asynchronous wait recv from call
  11. //-----------------------------------------------------------------------------
  12. typedef struct _ASYNC_SOCKET_DATA {
  13. OVERLAPPED Overlapped;
  14. WSABUF WsaBuf;
  15. SOCKADDR_IN SrcAddress;
  16. DWORD FromLen;
  17. DWORD NumBytesReceived;
  18. DWORD Flags;
  19. DWORD Status;
  20. PIF_TABLE_ENTRY pite; //pite is valid as long as recvFrom is pending
  21. } ASYNC_SOCKET_DATA, *PASYNC_SOCKET_DATA;
  22. #define PACKET_BUFFER_SIZE 4000
  23. #pragma pack(1)
  24. //-----------------------------------------------------------------------------
  25. // DVMRP_HEADER
  26. //-----------------------------------------------------------------------------
  27. typedef struct _DVMRP_HEADER {
  28. UCHAR Vertype;
  29. UCHAR Code;
  30. USHORT Xsum;
  31. USHORT Reserved;
  32. UCHAR MinorVersion;
  33. UCHAR MajorVersion;
  34. } DVMRP_HEADER, *PDVMRP_HEADER;
  35. #define MIN_PACKET_SIZE sizeof(DVMRP_HEADER)
  36. #define IPVERSION 4
  37. //-----------------------------------------------------------------------------
  38. // IP_HEADER
  39. //-----------------------------------------------------------------------------
  40. typedef struct _IP_HEADER {
  41. UCHAR Hl; // Version and length.
  42. UCHAR Tos; // Type of service.
  43. USHORT Len; // Total length of datagram.
  44. USHORT Id; // Identification.
  45. USHORT Offset; // Flags and fragment offset.
  46. UCHAR Ttl; // Time to live.
  47. UCHAR Protocol; // Protocol.
  48. USHORT Xsum; // Header checksum.
  49. struct in_addr Src; // Source address.
  50. struct in_addr Dstn; // Destination address.
  51. } IP_HEADER, *PIP_HEADER;
  52. #pragma pack()
  53. //
  54. // prototypes
  55. //
  56. DWORD
  57. JoinMulticastGroup (
  58. SOCKET Sock,
  59. DWORD Group,
  60. DWORD IfIndex,
  61. IPADDR IpAddr
  62. );
  63. DWORD
  64. PostAsyncRead(
  65. PIF_TABLE_ENTRY pite
  66. );
  67. DWORD
  68. McastSetTtl(
  69. SOCKET sock,
  70. UCHAR ttl
  71. );
  72. VOID
  73. ProcessAsyncReceivePacket(
  74. DWORD ErrorCode,
  75. DWORD NumBytesRecv,
  76. LPOVERLAPPED pOverlapped
  77. );