Leaked source code of windows server 2003
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.

118 lines
3.1 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. net\ipxintf\ipxintf.c
  5. Abstract:
  6. Interface routines that simulate asynchronous network interface
  7. (to be implemented later) through WinSock IPX protocol stack
  8. External interfaces
  9. Author:
  10. Vadim Eydelman
  11. Revision History:
  12. --*/
  13. #include <nt.h>
  14. #include <ntrtl.h>
  15. #include <nturtl.h>
  16. #include <windef.h>
  17. #include <winbase.h>
  18. #include <windows.h>
  19. #include <winsock2.h>
  20. #include <wsipx.h>
  21. #include <wsnwlink.h>
  22. #include <stdio.h>
  23. #include <tchar.h>
  24. #include "utils.h"
  25. #include "rtutils.h"
  26. #include "ipxrtprt.h"
  27. #include "rtm.h"
  28. #include "adapter.h"
  29. #include "ipxconst.h"
  30. #include "ipxrtdef.h"
  31. #include <ipxfltdf.h> // [pmay] Defines ioctls sent to the filter driver.
  32. #include "NicTable.h" // [pmay] Defines mechanism for mapping virtual adps to phys ones.
  33. #include "packon.h"
  34. typedef USHORT IPX_SOCKET_NUM, *PIPX_SOCKET_NUM;
  35. typedef UCHAR IPX_NET_NUM[4], *PIPX_NET_NUM;
  36. typedef UCHAR IPX_NODE_NUM[6], *PIPX_NODE_NUM;
  37. typedef struct _IPX_ADDRESS_BLOCK {
  38. IPX_NET_NUM net;
  39. IPX_NODE_NUM node;
  40. IPX_SOCKET_NUM socket;
  41. } IPX_ADDRESS_BLOCK, *PIPX_ADDRESS_BLOCK;
  42. // Header of IPX packet
  43. typedef struct _IPX_HEADER {
  44. USHORT checksum;
  45. USHORT length;
  46. UCHAR transportctl;
  47. UCHAR pkttype;
  48. IPX_ADDRESS_BLOCK dst;
  49. IPX_ADDRESS_BLOCK src;
  50. } IPX_HEADER, *PIPX_HEADER;
  51. #include "packoff.h"
  52. // IPX Net Number copy macro
  53. #define IPX_NETNUM_CPY(dst,src) *((UNALIGNED ULONG *)(dst)) = *((UNALIGNED ULONG *)(src))
  54. // IPX Net Number comparison
  55. #define IPX_NETNUM_CMP(net1,net2) memcmp(net1,net2,sizeof(IPX_NET_NUM))
  56. // IPX Node Number copy macro
  57. #define IPX_NODENUM_CPY(dst,src) memcpy(dst,src,sizeof(IPX_NODE_NUM))
  58. // IPX Node Number comparison
  59. #define IPX_NODENUM_CMP(node1,node2) memcmp(node1,node2,sizeof(IPX_NODE_NUM))
  60. // IPX set boradcast node number
  61. #define IPX_SET_BCAST_NODE(node) memset (node,0xFF,sizeof (IPX_NODE_NUM))
  62. #define IsListEntry(link) (!IsListEmpty(link))
  63. #define InitializeListEntry(link) InitializeListHead(link)
  64. // Size of buffer used to pass additional endpoing info in NtCreateFile call
  65. // to the driver
  66. #define IPX_ENDPOINT_SPEC_BUFFER_SIZE (\
  67. sizeof (FILE_FULL_EA_INFORMATION)-1 \
  68. + ROUTER_INTERFACE_LENGTH+1 \
  69. + sizeof (TRANSPORT_ADDRESS)-1 \
  70. + sizeof (TDI_ADDRESS_IPX))
  71. // Adapter configuration change message
  72. typedef struct _ADAPTER_MSG {
  73. LIST_ENTRY link; // Link in message queue
  74. IPX_NIC_INFO info; // Info supplied by stack
  75. } ADAPTER_MSG, *PADAPTER_MSG;
  76. // Client's configuration port context
  77. typedef struct _CONFIG_PORT {
  78. LIST_ENTRY link; // Link in port list
  79. HANDLE event; // Client's notification event
  80. LIST_ENTRY msgqueue; // unread message queue
  81. } CONFIG_PORT, *PCONFIG_PORT;
  82. #include "ipxfwd.h"
  83. #include "fwif.h"
  84. #include "pingsvc.h"
  85. #define DBG_FLT_LOG_ERRORS 0x00010000
  86. #if DBG && defined(WATCHER_DIALOG)
  87. // Stuff for UI dialog that simmulates adapter status changes
  88. #include <commctrl.h>
  89. #include "Icons.h"
  90. #include "Dialog.h"
  91. #endif //DBG && defined(WATCHER_DIALOG)
  92. #pragma hdrstop