WIN和TCPIP栈的一些资料

移植 lwip,在 windows 内核构建一个 TCPIP 协议栈 移植 lwip,在 windows 内核构建一个 TCPIP 协议栈 亲,当你点开看这篇文章,就说明你知道我想要干什么事情,或者说,你知道在 Windows 的内核种绕开它的网络协议,再独立构建一个网络协议栈的意义。如果你要问我有 windows 系统的网络协议栈不用,移植 lwip 有什么意义,那么你可以关闭链接走人了,因为这篇文章不适合你,它不是讲 lwip 移植原理的。 经常关注我的博客的朋... 阅读详情

Microsoft® Windows® Vista™ Beta 1 and Windows Server™ "Longhorn" Beta 1 include a new implementation of the TCP/IP protocol suite known as the Next Generation TCP/IP stack. The TCP/IP protocol stack provided with Windows XP and Windows Server 2003 was originally designed in the early 1990s and was modified and enhanced over time to meet the needs of home and enterprise users. The Next Generation TCP/IP stack in Windows Vista and Windows Server "Longhorn" is a complete redesign of TCP/IP functionality for both Internet Protocol version 4 (IPv4) and Internet Protocol version 6 (IPv6) that meets the connectivity and performance needs of today's varied networking environments and technologies.

On This Page
Features of the Next Generation TCP/IP StackFeatures of the Next Generation TCP/IP Stack
Architecture of the Next Generation TCP/IP StackArchitecture of the Next Generation TCP/IP Stack
For More InformationFor More Information

Features of the Next Generation TCP/IP Stack

The following are the new features of the Next Generation TCP/IP stack:

•

Dual IP layer architecture for IPv6

The implementation of IPv6 in Windows XP and Windows Server 2003 is a dual stack architecture. For IPv6 support, you have to install a separate protocol through the Network Connections folder. The separate IPv6 protocol stack had its own Transport layer that included Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) and its own Framing layer. Changes to protocols in either the Transport or Framing layers had to be done to two Windows drivers; Tcpip.sys for the IPv4 protocol stack and Tcpip6.sys for the IPv6 protocol stack.

The Next Generation TCP/IP stack supports the dual IP layer architecture in which the IPv4 and IPv6 implementations share common Transport and Framing layers. The Next Generation TCP/IP stack has both IPv4 and IPv6 enabled by default. There is no need to install a separate component to obtain IPv6 support.

•

Easier kernel mode network programming

The Next Generation TCP/IP stack supports Winsock Kernel (WSK), a new kernel-mode programming interface that is designed to eventually replace the Transport Driver Interface (TDI) in Windows XP and Windows Server 2003. Windows Vista and Windows Server "Longhorn" also support TDI.

•

Routing compartments

To prevent unwanted forwarding of traffic between interfaces for virtual private network (VPN), Terminal Server, and multi-user logon configurations, the Next Generation TCP/IP stack supports routing compartments. A routing compartment is the combination of a set of interfaces with a login session that has its own IP routing tables. A computer can have multiple routing compartments that are isolated from each other. Each interface can only belong to a single compartment. For example, when a user initiates a VPN connection across the Internet with the current TCP/IP stack, the user's computer has partial connectivity to both the Internet and a private intranet by manipulating entries in the IPv4 routing table. In some situations, it is possible for traffic from the Internet to be forwarded across the VPN connection to the private intranet. Routing compartments in the Next Generation TCP/IP stack isolate the Internet connectivity from the private intranet connectivity with separate IP routing tables.

•

Support for a strong host model

When a unicast packet arrives at a host, IP must determine whether the packet is locally destined (its destination matches an address that is assigned to an interface of the host). IP implementations that follow a weak host model accept any locally destined packet, regardless of the interface on which the packet was received. IP implementations that follow the strong host model only accept locally destined packets if the destination address in the packet matches an address assigned to the interface on which the packet was received. The current IPv4 implementation in Windows XP and Windows Server 2003 uses the weak host model. The Next Generation TCP/IP stack supports the strong host model for both IPv4 and IPv6 and is configured to use it by default. You can configure the Next Generation TCP/IP stack to use a weak host model. The weak host model provides better network connectivity. However, it also makes hosts susceptible to multihome-based network attacks.

•

New security and packet filtering APIs

The interfaces in the current TCP/IP stack for TCP/IP security (filtering for local host traffic), the firewall hook, the filter hook, and the storage of packet filter information has been replaced with a new framework known as the Windows Filtering Platform (WFP). WFP provides filtering capability at all layers of the TCP/IP protocol stack. WFP is more secure, integrated in the stack, and much easier for independent software vendors (ISVs) to build drivers, services, and applications that must filter, analyze, or modify TCP/IP traffic. For more information about WFP, see Windows Filtering Platform.

•

New mechanisms for protocol stack offload

The Next Generation TCP/IP stack can offload the processing of TCP and other types of traffic to Network Driver Interface Specification (NDIS) miniport drivers and network interface adapters. Offloading TCP and other protocol processing can improve performance for high-bandwidth networks or high-volume servers.

•

New support for scaling on multi-processor computers

The architecture of NDIS 5.1 and earlier versions limits receive protocol processing to a single processor. This limitation can inhibit scaling to large volumes of network traffic on a multi-processor computer. Receive-side scaling (RSS) resolves this issue by allowing the network load from a network adapter to be balanced across multiple processors. For more information, see Scalable Networking with RSS.

•

New extensibility

The Next-Generation TCP/IP stack has an infrastructure to enable more modular components that can be dynamically inserted and removed.

•

Reconfigure without having to restart the computer

The Next-Generation TCP/IP stack uses a new method to store configuration settings that enables more dynamic control and does not require a computer restart after settings are changed.

•

Automatic configuration of stack settings based on different network environments

The Next-Generation TCP/IP stack automatically senses the network environment and adjusts key performance settings, such as the TCP receive window. Improved stack auto-tuning and configuration reduces the need for manual configuration of TCP/IP settings.

•

Supportability enhancements

There is extensive support for run-time diagnostics, including support for TCP Management Information Base (MIB)-II and better system event logging and tracing.

The following features are improvements in the Next Generation TCP/IP stack:

•

Better support for computers that roam between networks.

•

Better support for developers of multicast-enabled applications and networks.

•

TCP performance enhancements for high-speed networks, asymmetric satellite links, and wireless and other high loss networks.

•

Improved portability of the Next Generation TCP/IP stack to other Microsoft operating systems such as Windows CE, Xbox®, and Windows Embedded.

•

Improved resistance against all known TCP/IP-based denial of service and other types of network attacks.

Architecture of the Next Generation TCP/IP Stack

The following figure shows the architecture of the Next Generation TCP/IP stack.

Next Generation TCP/IP stack

The three principal APIs by which applications, services, or other system components access the Next Generation TCP/IP stack are the following:

•

WSK Used by WSK clients.

•

Windows Sockets Used by Windows Sockets-based applications and services. The Windows Sockets API operates through the Ancillary Function Driver (AFD) to perform Socket functions with TCP/IP.

•

TDI Used by NetBIOS over TCP/IP (NetBT) and other legacy TDI clients. TDX is a translation layer between TDI and the Next Generation TCP/IP stack.

The Next Generation TCP/IP stack exposes an Inspection API, which provides a consistent, general-purpose interface to perform deep inspection or data modification of packet contents. The Inspection API is part of WFP. The Next Generation TCP/IP stack provides access to the packet processing path at the Network and Transport layers.

The Next Generation TCP/IP stack sends and receives frames using NDIS.

The architecture of the Next Generation TCP/IP stack driver (Tcpip.sys) consists of the following layers:

•

Transport layer Contains the implementations of TCP and UDP, and a mechanism to send raw IP packets that do not need a TCP or UDP header.

•

Network layer Contains implementations of both IPv4 and IPv6 in a dual IP layer architecture.

•

Framing layer Contains modules that frame IPv4 or IPv6 packets. Modules exist for physical networking technologies such as IEEE 802.3 (Ethernet, IEEE 802.11), wide area networks (Point-to-Point Protocol [PPP]-based traffic), and IEEE 1394 interfaces. Modules also exist for logical interfaces such as the loopback interface, IPv4-based tunnels, and IPv6-based tunnels. IPv4-based tunnels are commonly used for IPv6 transition technologies.

For More Information

For more information about this topic, consult the following resources:

•

Microsoft Windows Vista Web page

•

Microsoft Windows Longhorn Server Beta 1 Web page

•

Microsoft Windows Server 2003 TCP/IP Implementation Details white paper

For any feedback regarding the content of this column, please write to Microsoft TechNet. Please be aware that this is not a support alias and a response is not guaranteed.

For a list and additional information on all The Cable Guy columns, click here.

 

Microsoft learned a lesson when the lack of native networking support in DOS and Windows 3.0 limited those OSs' acceptance in business environments and left the networking market open for Novell and UNIX vendors. Microsoft strove to ensure that the first release of Windows NT contained an array of networking options out of the box. NT's debut in 1993, with version 3.1, fulfilled NT's promise as an OS that is ready for peer-to-peer and client/server networking configurations. NT 3.1 included a variety of popular network programming APIs, networking protocols, and a network card driver model that facilitated third-party support for Microsoft networking hardware.

This month, I'll peel away the layers of NT's network architecture to show you how this architecture implements network programming APIs. I'll describe how the APIs interface with protocol drivers and implement NIC drivers. Along the way, I'll introduce you to some new networking features that Windows 2000 (Win2K—formerly NT 5.0) will include.

Network APIs In 1978, the International Standards Organization (ISO) introduced the Open Systems Interconnection (OSI) model to standardize defining network communications in layers. The OSI model consists of seven network layers, which Figure 1, page 52, illustrates. Higher layers represent higher levels of abstraction. The idea behind network layering is that lower layers transform requests coming from above to a lower level of abstraction, and higher layers transform requests coming from below to a higher level of abstraction. The highest level of abstraction occurs at the application layer, in which network programming APIs such as remote procedure call (RPC) and sockets fall. The lowest level of abstraction occurs at the physical layer, in which bits and bytes on wires or cables transmit between computers. The division of networking into layers promotes a model of standardized interfaces between layers, and flexible and replaceable layer implementation.

In general, OS designers don't divide the network I/O path into seven well-defined layers, as the OSI model promotes. For simplicity and performance, OS designers can designate one layer in an OS's network architecture to correspond to several OSI layers. Figure 1 shows how NT's network architecture maps to OSI layers. The highest of the three NT layers is the network API layer. A network API gives applications an interface to networking I/O. Application designers can define their own networking APIs, but relying on standard APIs is simpler. NT incorporates the following networking APIs: named pipes, mailslots, NetBIOS, Winsock, RPC, Network Dynamic Data Exchange (NetDDE), Server Message Block (SMB), Distributed Component Object Model (DCOM), and Message Queues.

Named pipes and mailslots are programming APIs that Microsoft originally developed for OS/2 LAN Manager, then ported to NT. Named pipes let programs on different computers establish a reliable 2-way communications link. A named pipe server calls the CreateNamedPipe function to define a pipe on the local computer, and a named pipe client opens a connection to the server's pipe by specifying the pipe's name to the CreateFile Win32 function. With the established connection, the client and server can use WriteFile and ReadFile, standard NT file I/O routines, to exchange data through the pipe connection. Named pipes are popular NT programming APIs, but applications that use pipes do not generally port to Windows 98 and Win95, because these OSs do not implement named pipe server APIs.

Mailslots give programs an unreliable, connectionless broadcast facility. Similarly to a named pipe server, a mailslot server defines a mail slot using the CreateMailSlot API. Mailslot clients can open the server's mail slot and send the server messages through the slot. The mailslot service is unreliable, because the server might not receive messages clients send. Mailslots also support message broadcast. In message broadcast, when two or more mailslot servers in a domain create a mail slot with the same name, those servers will receive the messages clients send to that mail slot name. What kind of application can make use of an unreliable broadcast mechanism? One example is a time-synchronization service, which might broadcast a source time across the domain every few seconds. Receiving the source-time message is not crucial for every computer on the network.

Until the 1990s, the NetBIOS programming API has been the most widely used programming API on personal computers. NetBIOS allows for both reliable-connection-oriented and unreliable, connectionless communication. NT supports NetBIOS for its legacy applications. Microsoft discourages application developers from using NetBIOS, because other APIs, such as named pipes and RPC, are much more flexible and portable.

Winsock is Microsoft's implementation of BSD Sockets, a programming API that became the standard by which UNIX systems communicated over the Internet during the 1980s and 1990s. Support for sockets on NT makes the task of porting UNIX networking applications to NT relatively straightforward. Winsock includes most of the functionality of BSD Sockets but also includes Microsoft-specific enhancements, which continue to evolve. Winsock has a mode it calls streams for reliable-connection-oriented communication, and a mode it calls datagrams for unreliable, connectionless communication.

RPC is a network programming standard that Sun Microsystems originally developed. The Open Software Foundation (now The Open Group) made RPC part of the distributed computing environment (DCE) distributed computing standard. An interesting aspect of NT's implementation of RPC is that RPC in NT uses other network programming APIs. Thus, RPC in NT is really a programming API layer that rides on top of named pipes, Winsock, NetBIOS, or Message Queues.

Programmers developing an RPC client/server application define functions that the server implements. The developer writes the client program as if the program can invoke the server functions directly. What happens under the hood, however, is that a client-side library takes the parameters the program passes to the server function and shapes the parameters into a message. This message transmits to the server, which has a library that unpacks the parameters from the message and passes them to the server function. When the server function finishes, any return parameters go through the same process as the server sends them back to the client. The fact that the parameter packing and unpacking (called marshalling and unmarshalling) and the message transmission are hidden from the application developer makes RPC an attractive API. The Microsoft Interface Definition Language (MIDL) Compiler automatically builds client and server libraries for a developer, based on the function definitions the developer provides.

The Dynamic Data Exchange (DDE) API lets Windows applications communicate with one another via special types of Windows messages. Windows has used DDE since Windows 2.x. Network DDE (NetDDE) lets Windows applications that communicate via DDE reside on different computers. DDE is not a general communications API because graphical Windows are the basis for DDE connections, but DDE is a convenient API whenever it is an option.

SMB communication is the basis for NT's file-sharing client and server, which are known as the Workstation and Server services, respectively. Recently, Microsoft enhanced the SMB API as the Common Internet File System (CIFS) API, in an effort to promote SMB as a network file-sharing standard that can compete directly with Sun Microsystems' Web Network File System (NFS). Use of the SMB API is usually transparent to applications, which access network files by specifying filenames relative to local drive letters that map to a server's share point on a remote file system. Thus, standard file-opening, -reading, and -writing APIs give the application access to the remote files. The Uniform Naming Convention (UNC) method lets applications directly identify the names of files relative to a remote computer's share points.

NT's next built-in network API, DCOM, is the API Microsoft has focused the most attention on in recent years. Microsoft's COM API lets applications consist of different components that are replaceable self-contained modules. A COM object exports an object-oriented interface to methods for manipulating the data within the object. Because COM objects present well-defined interfaces, developers can implement new objects to extend existing interfaces and dynamically update applications with the new support. DCOM lets an application's components reside on different computers, which means applications need not be concerned that one COM object might be on the local computer and another might be across the LAN. DCOM thus provides location transparency, which simplifies developing distributed applications. Similarly to RPC, DCOM is not a self-contained API but relies on RPC to carry out its work. COM+, the COM version that Win2K includes, makes it easier for developers to write COM-based applications by adding language-specific compiler and runtime support for COM objects.

Microsoft introduced its newest network API, Message Queues, in the NT 4.0 Option Pack. The Message Queues API is similar to RPC in that its basis is client/server message exchange. However, whereas RPC is a synchronous interface (i.e., a client must wait until a server finishes processing the client's request before performing other work), Message Queues are asynchronous. For example, a client can send many requests to a server, and the requests fall into a queue. The server processes the client's requests in order, as quickly as possible, and the client can perform other work in the meantime. Message Queues can also perform reliable transactions when used with Microsoft Transaction Server (MTS).

 

API Implementation Network APIs are interfaces that applications use to speak to one another through the network. A network API must rely on a transport protocol, which defines an application-independent (interface-independent) way for computers to identify one another and for data to transfer between computers. Transport protocols include TCP/IP, NetBEUI, and IPX/SPX.

Before an application can use a network API, the application must link with libraries that give the API to the application. For example, a Winsock-based program would link with many libraries, including ws_32.dll, wsock32.dll, mswsock32.dll, msafd.dll, and wshelp.dll. The application calls functions that the libraries define to create sockets, assign a network address to the sockets, and connect to sockets on other computers. The Winsock libraries don't perform all these functions alone, however, but rely on a device driver in kernel mode for the bulk of socket management. The Winsock kernel-mode driver is afd.sys (i.e., ancillary function driver—AFD).

Why does Winsock divide things up this way? Because as a kernel-mode device driver, afd.sys can call upon the services of the NT I/O manager to base sockets on NT's file objects. By using file objects as the core of a socket, Winsock can rely on many aspects of NT's I/O infrastructure, including interfaces and security mechanisms, to tightly integrate an API with NT. For example, applications can use NT's native ReadFile and WriteFile to read and write data through a socket. These APIs are the same ones NT uses for disk-based file I/O, and all the features of these APIs, including asynchronous operation, are automatically at the disposal of a Winsock-based application. To integrate itself with the I/O Manager, afd.sys implements as a form of NT file system driver.

The named pipe and mailslot APIs demonstrate other examples of the user-mode/kernel-mode division. Named pipe and mailslot applications link with the kernel32.dll library to access the APIs. Kernel32.dll implements the APIs with the aid of the npfs.sys and msfs.sys kernel-mode device drivers, which are file system drivers. You can see this connection in the names of the drivers: Named Pipe File System (NPFS) and Mailslot File System (MSFS). Thus, named pipe and mailslot endpoints are based on NT file objects and are accessible through standard file-related APIs. In fact, npfs.sys implements a namespace of pipes so a program can obtain a directory listing (using standard file-oriented directory operations) of the pipes a system defines.

The Workstation and Server services are obvious candidates for having kernel-mode file system drivers, and both services have such components. On the client side of a file share, an application accesses a network-located file via NT's file system APIs. The file objects that represent the network files implement with the aid of the rdr.sys (redirector—RDR) device driver, which is one step closer to a file system driver than are the other network API drivers I've discussed. Rdr.sys uses the NT cache manager to cache data associated with the files that the file-sharing client accesses. When an application accesses data that is not cached on the client, rdr.sys sends SMB commands to its counterpart (srv.sys) on the file server. Srv.sys looks less like a file system driver than a file system client. As do user-mode programs, srv.sys accesses files on the server via physical file system drivers such as FAT and NTFS. However, srv.sys uses special interfaces that the physical file system drivers provide exclusively for it, including APIs that let srv.sys maintain file data consistency across clients accessing the same file. Figure 2 illustrates the flow of a request from a Workstation service client to a Server service server.

Resource Name Resolution One aspect of network APIs is the way in which applications identify network resources such as named pipes or files on other computers. When a named pipe client wants to open a named pipe on a remote server, the client must be able to uniquely identify the pipe. NT has adopted the UNC for network resource naming. UNC specifies names in the form //servername/resourcesubresource. For example, a named pipe client might open a named pipe with the name //mark/pipe/mypipe on a server. For specifying network resources that reside on the local system, a period can replace the server name (e.g., //./pipe/mypipe).

When an application specifies a UNC name (rather than a standard file name, such as C:/temp/myfile) to one of NT's file system APIs, such as CreateFile, the I/O Manager passes the UNC name to a device driver named mup.sys (Multiple UNC Provider—MUP). A resource redirector, such as rdr.sys, registers with the I/O Manager as being able to locate resources on remote systems. Mup.sys takes UNC names from the I/O Manager and hands the names to registered redirectors for examination. A redirector looks at the names and determines whether it knows how to access the specified resource. If it does know how, the redirector notifies mup.sys and the I/O Manager so that the redirector will receive further I/O requests aimed at the resource. If no redirector claims a name, the original application receives an error code.

I've already mentioned the standard NT LAN Manager redirector, rdr.sys, which handles communications between clients and servers for file sharing. Rdr.sys also handles resource name lookup between computers on a Microsoft LAN Manager network. Thus, a named pipe client specifying //mark/pipe/mypipe would indirectly use mup.sys and rdr.sys to connect to the pipe on the Mark server.

When you open Network Neighborhood on the desktop or use NT Explorer to connect to a remote printer or file share, you rely on another kind of name resolution. Network providers registered under the HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/ Control/NetworkProvider/Order Registry key implement network namespace browsing. Each network provider has a library that is dynamically linked with a standard Microsoft library called mpr.dll (Multiple Provider Router—MPR). Mpr.dll loads each network provider library and queries each library to fill in Network Neighborhood with computers and the shared resources associated with the computers. Ntlanman.dll is the RDR provider; you'll find it specified under the RDR network provider Registry key HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/LanmanWorkstation/networkprovider. The RDR network provider DLL relies on the rdr.sys driver to carry out requests on behalf of mpr.dll. Therefore, the RDR network provider DLL has a private interface with the rdr.sys driver. Another network provider library that comes with NT is the Novell NetWare provider, which permits applications to access resources on NetWare computers.

Protocol Drivers Network API drivers must take API requests and translate them into low-level network protocol requests for transmission across the network. The API drivers rely on transport protocol drivers in kernel mode to do this work. Separating APIs from underlying protocols gives the networking architecture the flexibility of letting APIs use different protocols. The protocol drivers that NT includes with its baseline distribution are Data Link Control (DLC), NetBEUI, TCP/IP, and NWLink, although other protocols might be present as options, such as the AppleTalk protocol installed with Services For Macintosh on NT servers.

DLC is a relatively primitive protocol that some IBM mainframes, as well as some HP network printers, use. It is a "raw" protocol, in the sense that no network APIs can use the DLC protocol. Applications that want to use DLC must interface directly to the DLC transport protocol device driver.

IBM introduced NetBEUI in 1985, and Microsoft adopted NetBEUI as the default protocol for LAN Manager and the NetBIOS API. Microsoft has since enhanced NetBEUI, but the protocol is limited because it's not routable and performs poorly on WANs. NetBEUI (NetBIOS Extended User Interface) was so named because it was tightly integrated with the NetBIOS API, but the protocol Microsoft's NetBEUI protocol driver implements is NetBIOS Frame Format (NBF). The Internet's explosive growth and reliance on the TCP/IP protocol has made TCP/IP NT's preeminent protocol. The Defense Advanced Research Projects Agency (DARPA) developed TCP/IP in 1969 specifically as the foundation for the Internet; therefore, TCP/IP has WAN-friendly characteristics such as routability and good WAN performance.

NWLink consists of Novell's IPX and SPX protocols. NT includes NWLink for interoperability between NT and Novell NetWare servers.

So that network API drivers need not employ various interfaces for each transport protocol they might want to use, Microsoft established a standard interface called Transport Driver Interface (TDI). Transport protocols that adhere to the TDI standard export the TDI to their clients, which include network API drivers such as afd.sys and npfs.sys. A transport protocol implemented as an NT device driver is known as a TDI Server. Because TDI Servers are device drivers, they format requests they receive from clients as I/O request packets (IRPs).

 

Support functions in the tdi.sys library, along with definitions developers include in their drivers, make up TDI. This interface essentially provides a convention for the way network requests format into IRPs. In addition, TDI provides a means whereby a TDI client can register callbacks (i.e., functions that are directly invoked) with TDI Servers. For example, when a TDI Server receives data from across the network, it can invoke a registered-client-receive callback. This event-based callback feature of TDI eliminates some of the overhead associated with allocating and distributing IRPs, and clients can take advantage of the feature to achieve high performance.

As I hinted earlier, a network API might be able to use only certain protocols. For example, the Workstation and Server services do not know how to use TCP/IP. However, these services understand the NetBIOS interface, and NT provides a driver named netbt.sys that implements a TDI-compliant NetBIOS programming API on top of the TCP/IP driver. Thus, the Workstation and Server service can use either NetBEUI or NetBIOS over TCP/IP. Fortunately, all of NT's programming APIs can use either NetBEUI or TCP/IP directly or indirectly, achieving maximum flexibility on Windows networks.

NDIS Drivers When a protocol driver wants to read or write messages formatted in its protocols' format from or to the network, the driver must do so using a NIC, which Microsoft calls a network adapter card (NAC). Because expecting protocol drivers to understand the nuances of every NIC on the market (proprietary NICs number in the thousands) is not feasible, NIC vendors provide device drivers that can take network messages and transmit them via the vendors' proprietary hardware. In 1989, Microsoft and 3Com jointly developed the network driver interface specification (NDIS), which lets protocol drivers communicate with NIC drivers in a device-independent manner. NIC drivers that conform to NDIS are called NDIS drivers or NDIS Miniport drivers.

On NT, the ndis.sys library implements the NDIS boundary that exists between TDI Servers (typically) and NDIS drivers. As is tdi.sys, ndis.sys is a helper library that NDIS driver clients use to format IRPs they send to NDIS drivers. NDIS drivers interface with the library to receive requests and send back responses.

One of Microsoft's goals for its network architecture was to let NIC vendors easily develop NDIS drivers and take a driver code and move it between Windows 9x and NT. Thus, instead of merely providing the NDIS boundary helper routines, ndis.sys provides NDIS drivers an entire execution environment. NDIS drivers aren't genuine NT drivers because they can't function without the encapsulation ndis.sys gives them. This insulation layer wraps NDIS drivers so thoroughly that NDIS drivers do not accept and process IRPs. Rather, ndis.sys receives IRPs from TDI Servers and translates the IRPs into calls into the NDIS driver. NDIS drivers also do not have to worry about reentrancy, in which ndis.sys invokes an NDIS driver with a new request before the driver has finished servicing a previous request. Exemption from reentrancy means NDIS driver writers do not need to worry about complex synchronization, which is made even more tricky because of the parallel execution possible on a multiprocessor.

Although ndis.sys's serialization of NDIS drivers simplifies development, serialization can hamper multiprocessor scalability. Standard NDIS 4 drivers (the NT 4.0 version of ndis.sys) do not scale well for certain operations on multiprocessors. Microsoft gave developers a deserialized operation option in NDIS 5, which will ship with Win2K. NDIS 5 drivers can indicate to ndis.sys that they do not want to be serialized; ndis.sys will then forward requests to the driver as fast as it receives the IRPs that describe the requests. Responsibility for queuing and managing multiple simultaneous requests falls upon the NDIS driver, but deserialization confers the benefit of higher multiprocessor performance. Microsoft debuted deserialization in the version of ndis.sys that ships with NT 4.0 Service Pack 4 (SP4), although the company has not publicly revealed this fact.

The NDIS model also supports hybrid TDI-NDIS drivers, called NDIS Intermediate drivers. These drivers lie between TDI Servers and NDIS drivers. To an NDIS driver, an NDIS Intermediate driver looks like a TDI Server; to a TDI Server, an NDIS Intermediate driver looks like an NDIS driver. Microsoft publicly introduced NDIS Intermediate drivers in NT 4.0 as a way for developers to write packet capture drivers. NDIS Intermediate drivers can see all network traffic taking place on a system because the drivers lie between protocol drivers and network drivers. Developers base software that provides fault-tolerant and load-balancing options for NICs on NDIS Intermediate drivers.

NDIS 5.0 introduces a new type of NDIS driver—a connection-oriented NDIS driver. Support for connection-oriented network hardware (e.g., ATM switches) is therefore native in Win2K, which makes connection management an establishment standard in NT's network architecture. Connection-oriented NDIS drivers use many of the same APIs that standard NDIS drivers use; however, connection-oriented NDIS drivers send packets through hardware network connections, rather than placing them on the network medium.

The interfaces that ndis.sys provides for NDIS drivers to interface with NIC hardware are available via functions that translate directly to corresponding functions in NT's Hardware Abstraction Layer (HAL). The HAL is a hardware-dependent library that computer vendors can supply to interface NT with proprietary motherboards with a standard API set and exposed hardware model.

Figure 3 illustrates a complete network driver stack. In Figure 3, you can see how Winsock components fit with the TCP/IP protocol and an NDIS driver. (The figure does not show the I/O Manager and HAL).

Binding The final piece in the NT networking architecture puzzle is the way in which the components at the various layers—network API layer, TDI Server layer, NDIS driver layer—locate one another. The name of the process that connects the layers is binding. You've witnessed binding taking place if you've changed your network configuration by adding or removing a component with the Network applet.

When you install a networking component, you must supply an information (.inf) file for the component. This file includes directions NT must follow to install and configure the component, including binding dependencies or binding relationships. A developer can specify binding dependencies for a proprietary component so that the NT Service Control Manager will not only load the component in the correct order but will load the component only if other components the proprietary component depends on are present on the system. Binding relationships, which the bind engine determines with the aid of additional information in a component's .inf file, establish connections between components at the various layers. The connections specify which components a network component on one layer can use on the layer beneath it.

For example, the Workstation service (RDR) will automatically bind to the NBF (NetBEUI) and NetBIOS over TCP/IP (NetBT) protocols if both protocols are present on the system. The order of the binding, which you can examine on the Bindings tab on the Network properties page (as Screen 1 shows), determines the priority of the binding. When RDR receives a request to access a remote file, RDR submits the request to both protocol drivers simultaneously. When the response comes, RDR waits until it has also received responses from any higher-priority protocol drivers. Only then will RDR return the result to the caller. Thus, reordering bindings so that bindings of high priority are also the most performance-efficient (or applicable to most of the computers in your network) can be advantageous. You can also manually remove bindings with the binding editor.

The Bind value, in the Linkage subkey of a network component's Registry configuration key, stores binding information for that component. For example, if you examine HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/ Services/LanmanWorkstation/Linkage/Bind, you'll see the binding information for the Workstation service.

The Evolving Network NT's network architecture provides a flexible infrastructure for network APIs, network protocol drivers, and NIC drivers. NT architecture takes advantage of I/O layering to give NT networking support the extensibility to evolve as computer networking evolves. When new protocols appear, developers can write a TDI Server to implement the protocol on NT. Similarly, new APIs can interface to NT's existing protocol drivers. Even less-major enhancements, such as the addition of support for connection-oriented hardware in Win2K, demonstrate that the NT networking model is flexible enough to keep pace with changing networking demands. You can learn more about NT's networking internals in the Microsoft Windows NT Server 4.0 Resource Kit's Networking Guide and the Windows NT Device Driver Kit.


Screen 1 Screen 1
Figure 1 Figure 1
Figure 2 Figure 2
Figure 3 Figure 3
ESP8266学习二---SOCKET-TCP_CLIENT 上次学习了wifi热点信息扫描的东西。本次测试学习下tcp client的内容。 全部源码如下: /* BSD Socket API Example This example code is in the Public Domain (or CC0 licensed, at your option.) Unless required by applicable... 阅读详情

相关推荐

【4G通讯模组相关】 TCPIP连接本地电脑测试 、内网穿透

本文介绍4G模组在自己的电脑上进行联网自测。 1.先查询自己的IP地址,www.ip138.com处可以看到自己的IP地址。 2.开启windows相关服务。

cxw312864660的博客 4873

windows下重新安装TCP/IP协议栈

一、windows重装TCP/IP协议     前两天在windows下安装开发环境的时候,把系统的TCP/IP协议栈给搞跪了,导致系统无法ping localhost、无法在程序中创建socket等....于是对windows 7(64bit)下的TCP/IP协议栈进行了重装。尝试了很多方法,发现一个可以使用的: (1)删除注册表键值     开始——运行——regedit,找到 H...

weixin_34414196的博客 929

从零搭建ECG心电图仪:模拟前端电路设计与噪声对抗实战

在电子工程和生物医学信号处理领域,微弱信号的采集与放大是核心挑战。其基本原理在于利用高精度模拟电路,从强大的环境噪声中提取出有用的差分信号。这项技术的核心价值在于将理论上的传感器信号转化为稳定、可靠的可用数据,是连接物理世界与数字系统的关键桥梁。在医疗监护、工业传感和科学测量等场景中,高性能的模拟前端设计直接决定了整个系统的精度与可靠性。本文聚焦于生物电信号采集这一具体应用,深入探讨如何运用差分放大器、低通滤波器和陷波滤波器等经典模块,构建一个能够有效对抗工频干扰和接触噪声的实用电路,最终实现从人体体表清晰

weixin_30616969的博客 460

TCP/IP 在 Windows 下的实现

Windows 下是怎么实现 TCP/IP 协议族的,这篇文章以 UDP 的实现为例,对这个过程进行了简单的说明。

Henzox的专栏 7408

直流电机双闭环调速系统MATLAB仿真

Chopper-Fed DC Motor Drive This example shows a Chopper-Fed DC Motor Drive. Description The DC motor is fed by the DC source through a chopper which consists of GTO thyristor and free-wheeling diode ...

飞行动力的博客 2万+

Xilinx PCIe IP核示例工程仿真流程与关键任务解析

本文详细解析了Xilinx PCIe IP核示例工程的仿真流程与关键任务。通过搭建仿真环境、解读初始化日志,并深入剖析TSK_TX_MEMORY_WRITE_32等核心任务的TLP报文生成与交互过程,帮助开发者掌握PCIe IP核的仿真调试方法,为实际硬件设计提供可靠的验证基础。

weixin_28314575的博客 509

服务器系统tcpip.sys,win7系统tcpip.sys文件引起蓝屏的解决方法

‍‍蓝屏是常见的电脑故障,而导致出现蓝屏的原因有非常多。最近有win7 64位旗舰版用户在开机时会出现蓝屏,根据屏幕上的错误描述应该是tcpip.sys文件引起的蓝屏现象,这该怎么解决呢?tcpip.sys文件是一个系统和网络相关的文件,该文件出现如果问题会引起蓝屏,下面由小编给大家介绍win7系统tcpip.sys文件引起蓝屏的解决方法。解决方法:1、通常tcpip.sys文件异常导致的蓝屏的停...

weixin_35823048的博客 5150

Camera tuning flow相机调试流程

相机调试流程分为三大模块:ProcessRaw处理原始数据(黑电平校正、阴影校正),3A实现自动控制(曝光/对焦/白平衡),ISP进行图像精加工(伽马校正、锐化降噪、色彩处理)。三个阶段环环相扣,前阶段为后阶段提供基础,最终输出画质优良且风格化的图像。

weixin_64706696的博客 1230

win7共享连接数限制_Win7系统解决tcpip.sys蓝屏问题的方法是什么?

Win7系统出现tcpip.sys蓝屏如何解决?蓝屏是电脑比较容易出现的问题,但是出现蓝屏问题的原因是非常多的,需要知道导致什么应用出现蓝屏,才能够对症下药。那么出现tcpip.sys蓝屏问题应该如何解决呢?接下来就为大家分享win7系统tcpip.sys蓝屏解决方法。解决方法:1、通常tcpip.sys文件异常导致的蓝屏的停机码是D1。如果截图中没有提示tcpip.sys文件,那么可能还有其他的...

weixin_39713335的博客 518

详解一典型的反激式开关电源方案

如图,在某系统方案上看到下图所示的单端反激式开关电源方案。

alala120的博客 1万+

【网络与爬虫 61】移动端App爬虫终极指南:Android-iOS应用数据提取黑科技全解析

本文全面解析移动端App爬虫技术,涵盖Android和iOS两大平台的数据提取方法。从基础的网络抓包到高级的代码注入,从自动化测试框架到反调试技术绕过,为开发者提供移动端数据采集的完整解决方案和实战经验。

熵数实验室 3029

win10修复tcp驱动服务器,怎么解决tcpip.sys文件导致蓝屏|Win10的tcpip修复工具

由tcpip.sys文件引起的蓝屏错误,错误代码为:0x000000D1,表示硬件设备的驱动程序遇到了问题。引起错误的文件是tcpip.sys,那么应该是与网卡驱动有关。这篇文章是PE吧给大家带来的解决方法,希望对大家有帮助。方法/步骤:1、下载tcpip修复工具,由于是一个压缩文件,所以需要进行解压;3、tcpip修复工具分了32位和64位两个版本,大家可以根据自己的系统位数选择合适的版本使用;...

weixin_39712611的博客 6388

读懂 SAP S/4HANA 里的 SAP Fiori 架构:前端服务器、搜索链路、传统应用接入与内容组织全景解析

摘要:SAP Fiori架构并非简单的系统连接图,而是明确区分界面层与业务数据层的三层分工体系:用户交互层(浏览器与Fiori launchpad)、前端技术层(SAPUI5运行环境)和业务数据层(SAP S/4HANA后端)。这种分离实现了生命周期解耦,前端专注于统一体验治理,后端处理核心业务逻辑。值得注意的是,SAP Fiori front-end server本质仍是ABAP系统,负责UI技术组件运行。虽然SAP S/4HANA推荐嵌入式部署,但独立部署在多系统场景中仍有价值。典型Fiori应用通过O

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 180

win10修复tcp驱动服务器,高手亲自解决win10系统tcpip.sys蓝屏的详尽解决教程

我们不管是办公,还是娱乐,大部分用户都是用的是win10系统,如今有一位用户遇到了win10系统tcpip.sys蓝屏的问题,因为这个问题还是比较少见的,所以很多网友都不知道该如何解决,那么这个win10系统tcpip.sys蓝屏问题该如何才能处理呢?方法肯定是有的,可以一步步的采取下面这个流程:1、cpip .sys 程序是网络相关的驱动程序。2、议您尝试卸载网卡驱动重新安装或更新一下网卡驱动即...

weixin_42353805的博客 1万+

超临界二氧化碳发电技术深度解析

超临界二氧化碳发电技术正在突破传统热电转换的物理边界。作为新一代发

硬核科技 602

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

hercules配置TCPIP(os390 2.10 DEMOPKG)

os390会提供一系列TCPIP服务,如ftp,telnet,nfs,web等等。 如何从PC连接运行在hercules上的os390服务呢? hercules借助tuntap设备,在主机(即运行hercules的PC)与客户机(os390)间 建立一个点到点连接,是他们能够通信。

Sy9876的专栏 1028

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

vista/win7本地连接状态未知,依赖服务或组无法启动的六种解决方法

症状:VISTA/WIN7突然无法上网,网络和共享中心显示未知,依赖服务或组无法启动。 诊断和修复显示无法运行,因为"诊断策略服务"没有运行。打开服务控制器,很多服务都启动不了(没有禁用),是Network Location Awareness的问题,手动启动不了,显示windows不能在本地计算机,启动 Network Location Awareness有关更多信息,查阅系统事件日志等等。

好好学习-天天 1598

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

Win7网络修复,winsock/tcpip

1.win7自带网络诊断提示没有安装一个或多个协议,ip地址为169.254.x.x,dns地址为空 2.修复winsock时,提示系统找不到指定的文件。 解决办法: 1. netsh int ip reset 重置 TCP/IP协议2.在网络连接属性里面,tcp/ip协议(win7里面显示的internet协议版本4/6) 选中时卸载按钮是灰色的,但是我们可以覆盖安装,点击下方的安装,选择类型为...

weixin_33851177的博客 3591

WIN11无法访问SMB文件共享地址

解决WIN11无法访问SMB文件共享地址的问题

Step_By_XXX的博客 9889

.tcpip.sys文件破坏导致本地连接无法修复也无法上网

前两天有时开机蓝屏,提示tcpip.sys文件怎么怎么样,我就把c:\windows\system32\drivers下面的tcpip.sys文件删除,从安装光盘的I386文件夹下提取新的文件到这个文件夹下,谁知今天来了,开机后: 先是虚拟机的VMNET报错,然后我上Q,不行,打开OUTLOOK,不行,赶紧PING下服务器,不行,PING 127.1 提示不能连接TCP...

weixin_34380781的博客 700

dell服务器1950安装win7系统,DELLOPTIPLEX3040安装WIN7操作系统方法图文

好文网为大家准备了关于DELLOPTIPLEX3040安装WIN7操作系统方法图文的文章,好文网里面收集了五十多篇关于好DELLOPTIPLEX3040安装WIN7操作系统方法图文好文,希望可以帮助大家。更多关于DELLOPTIP好文网为大家准备了关于戴尔DELL服务器的WIN操作系统安装方法范文,好文网里面收集了五十多篇关于好戴尔DELL服务器的WIN操作系统安装方法好文,希望可以帮助大家。更多...

weixin_42365038的博客 1622

关于windows xp sp2/sp3 中tcpip.sys对于Raw socket的限制

WINDOWS XP SP2修改了TCPIP.SYS,增加了对于RAW SOCKET的发送和伪造源地的限制,详情如下 : 1) 不能通过raw socket发送TCP报文。做此尝试时会得到10004号错误。 2) 不能通过raw socket发送伪造源IP的UDP报文。 3) 不能通过raw socket发送IP碎片。做此尝试时会得到10004号错误。 不知微软在哪次对20

liujiayu2的专栏 1432

关于win10ipv6无法连接的问题

  首先从微软官网下载修复工具, 现在将源地址发出来:https://support.microsoft.com/en-us/kb/929852;   进入官网后,选择Re-enable IPv6 相关的工具,下载了Re-enable IPv6 on nontunnel interfaces and on IPv6 tunnel interfaces。 如下图最后这个:     下载...

chaoyue12312的博客 8398
上一篇: AVP主动防御之隐藏进程
下一篇: Obtaining KeServiceDescriptorTableShadow address
iiprogram
博客等级 码龄25年 1068粉丝 1515原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值