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
网络协议栈收发包 个人公众号:linux进击之路 ​网络协议栈即OSI通信模型在linux内核的描述,又叫网络子系统。网络协议栈是实现客户端和服务端通信的基础。本文内容基于2.6.9版本,主要从报文收发的流程上一步步讲解应用层套接字发送的数据是如何发送给对端,以及如何从套接字上读取到数据的。 我们淡化OSI模型中的物理层以及应用层的处理流程,主要展开说明数据链路层到传输层的逻辑,如下图所示。 一、数据链路层接收处理报文 数据通过物理链路传输到网卡时,会存到网卡的内存空间内(每个网卡在内核中都对应一个网络设备. 阅读详情

相关推荐

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

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

cxw312864660的博客 4878

Windows TCP/IP客户端模式,网络吞吐优化

CTCP则属于客户端主动的,可以提高客户端向服务器的重传效能,提高客户端上行带宽大小,提高上行带宽大小也就意味着,可以显著的提速,我们知道服务器向客户端发数据,那么能发多快跟客户端上行有很大的直接关系,如果你只有1ME上行,给你一个1GE带宽,你能拉到100ME都算是很强了(但大家都知道,纯属扯淡,不可能的。CUBIC这种是基于丢包控制协议,LINUX内核默认也采用这样的TCP/IP协议控制算法,好了,不在过多累赘,对于这些不同协议栈非常感兴趣,可以自行去检索响应的技术人员资料。......

liulilittle的博客 3056

SNN目标识别MNIST

总体来说这篇论文提出的方法用了多种更精密的细节,如LIF膜电位公式,三种STDP方法,但我觉得还可以有很大的改进,比如输入层全连接到兴奋层,兴奋层通过抑制层实现的侧向抑制,抑制层不参与学习等等。尤其是兴奋层通过抑制层实现侧向抑制这里,当神经元兴奋时,通过抑制层再倒回兴奋层,所抑制的已经经过一了一段时间的延迟。如有错误,请不吝赐教。

m0_74982304的博客 1266

windows高级开发网络编程的秘密(详细罗列)

网络结构的标准模型是OSI模型,由国际互联网标准化组织定义的网络分层型。虽然目前没有完全按照这种模型实现的网络协议栈。什么是协议栈?一个网络上运行的网络规则。通过协议栈的不同可以划分为不同层。

qq_51065805的博客 371

华三R4900 G5服务器实战:用PMC P460-B4阵列卡配置RAID1+RAID6,并搞定CentOS 7.9安装(含热备盘设置)

本文详细解析了在华三R4900 G5服务器上使用PMC P460-B4阵列卡配置RAID1+RAID6混合阵列的全过程,包括热备盘设置和CentOS 7.9系统安装。通过实战步骤和性能优化建议,帮助企业IT人员高效部署高可用存储方案,特别适合需要数据冗余和系统稳定性的企业级应用场景。

weixin_29248653的博客 361

STM32 HAL库定时器中断实现步进电机S型加减速控制与脉冲精准计数

本文详细介绍了如何使用STM32 HAL库定时器中断实现步进电机的S型加减速控制与脉冲精准计数。通过CubeMX配置定时器、计算PSC和ARR值,并结合S型曲线算法,实现平滑启停和精准定位。文章还提供了脉冲计数方案和常见问题排查技巧,帮助开发者优化步进电机控制性能。

weixin_29189363的博客 375

网络协议栈:数据通信的核心奥秘

网络协议栈是实现网络通信的分层技术,包含应用层、传输层、网络层、链路层和物理层。应用层处理软件服务(如HTTP),传输层确保数据传输(TCP/UDP),网络层负责寻址路由(IP),链路层管理本地网络连接(MAC),物理层转换电信号。数据流动时,每层添加包头信息,接收方逐层解析。协议栈影响性能和安全,可通过Wireshark等工具调试。新技术如QUIC和IPv6正推动协议栈发展。

本博客聚焦游戏开发技巧、创业实战心得及大学热门课程干货。这里既有技术深度,也有思维广度,无论你是开发者、创业者还是高校学子,都能在这里找到适合自己的成长之路! 619

开发者体验度量:构建DevEx评估体系的方法论与工具

在深入讨论度量方法前,我们需要明确什么是开发者体验(DevEx)。许多人将其简化为"开发工具好不好用",这是一个危险的误解。开发者体验是指开发者在完成工作过程中的整体感受和效率,它由三大核心维度组成:工具与基础设施:开发、测试、部署工具链的效能流程与协作:工作流程的顺畅度和团队协作的效率文化与成长:支持实验、学习和专业发展的环境这三个维度相互作用,共同决定了开发者能否高效且愉悦地完成工作。开发者体验不是一个目的地,而是一段持续的旅程。

2401_88760782的博客 1436

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

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

weixin_35823048的博客 5151

ITIL 4 Foundation 自学通关笔记1

ITIL 4 Foundation 自学通关笔记

m0_58817196的博客 962

配置xen上VM混杂模式,使其能捕获物理网络流量

本文目的:配置VM和xen相应的物理网卡(pif)和虚拟网卡(vi

LeoDuo的专栏 3723

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

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

weixin_39713335的博客 518

YOLOv8/v9轻量化优化:剪枝30%+蒸馏提精,模型体积缩至4MB还能跑Jetson

剪枝:用敏感度分析找到“可牺牲的30%”,不碰核心特征;蒸馏:借大模型的“经验”补回精度,甚至反超原始小模型;量化:针对边缘设备特性优化量化策略,把体积和延迟压到最低。如果你的项目卡在边缘部署(速度慢/体积大),按“剪枝→蒸馏→量化”三步走,90%能在Jetson上跑通30FPS+的实时检测。需要轻量化模型文件(v8s/v9s剪枝蒸馏后权重)、剪枝工具和Jetson部署脚本的,评论区扣“轻量化”,直接发你可运行版本~

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 674

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

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

weixin_39712611的博客 6391

Weka学习笔记01:初探Weka世界

下载、安装和启动Weka、Weka数据格式

howard2005的专栏 1480

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

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

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

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

weixin_42353805的博客 1万+

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

hercules配置TCPIP(os390 2.10 DEMOPKG)

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

Sy9876的专栏 1028

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

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

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

好好学习-天天 1599

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的博客 3611

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

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

Step_By_XXX的博客 9890

.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的博客 1624

关于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的专栏 1433
上一篇: 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、付费专栏及课程。

余额充值
⌂ 换网址