Application of VxD technology: Tom Lynn Published: 2001/02/08
Thesis:
This paper first introduces the method of implementing the V5 protocol test through the PC, which deserves the issue of ISA bus data on the Win95 platform, focusing on VXD technology.
text:
VXD technology application
1 PC V5 protocol test method 1.1 Preface The development trend of modern telecommunications network is network concentration, efficient, optimization. With the popularity of Internet, the access capacity of communication service network is severely tested. The development of broadband communication services and multimedia business is unobuperated. To achieve the digitization, broadband and intelligence of the access network, you must solve the problem of transmitting bottlenecks in the current telecommunications network. The existing access network using analog transmission is the main transmission medium, which is difficult to adapt to the access network upgrade and provide new business requirements. Therefore, the V5 access network will become a sign of modern access network. The important feature of the modern access network is that it should be open, standard V5 interfaces, and V5 interfaces are unparalleled in providing integrated business and new business, V5 access. The network disqualification remote module is the inevitable development. Due to the protection of the equipment supplier's ability, the open lack of regulatory guarantees of the V5.x interface; and the interoperability, compatibility and completeness of different manufacturers are poor. Therefore, the V5 interface protocol test has become a very concern. In the ideal case, the equipment produced by different manufacturers shall be able to communicate normally under the network environment, but the actual situation is not the case, due to the different understandings of the design, and the various manufacturers have different technical policies. Some of its products are either deviated from standards or a standard subset. In this way, the local switch (LE) and access network (AN) device produced by different equipment manufacturers have problems in interconnect (such as the system startup process is inconsistent, etc.). The equipment will also affect the quality of service due to the defects of the protocol or defects in the protocol or defect (e.g., a large number of calls to occur frequent chains or a large number of calls, etc.). When the device interconnects problems, it is urgent to measure the consistency of the equipment to identify the roots of the problem. At present, as the V5 interface is in my country's commercial development, various devices swarmed, so that the agreement problem that solves the interconnection of communication devices will become a non-negligible factor in promoting V5 interface applications, V5 protocol analyzer for these issues Finding positioning and analysis solve is critical. Our own V5 protocol tester has convenient use, low cost, easy upgrade, and VXD technology is the key technologies. 1.2 V5 Protocol Tester Principle V5 Protocol Tester (hereinafter referred to as V5TS) consists of two parts: ISA bus standard hardware card and protocol processing software. The 3 C vicin (TS16, TS15, and TS31) in a 2048kbit / s data link can be processed for each board, and one block or two board cards can be selected according to the test; protocol processing software as a run platform in Windows 95/98 . The hardware card and its protocol handling software make up a complete test system that can be used as a V5 protocol test device or monitoring device on the LE side or an AN side. The test principle of V5Ts is shown in Figure 1-1. Method A and B are the protocol simulation method, and the mode C is the protocol monitoring method. In the way A, the V5TS analog AN side tests the V5 function on the LE side; in the manner B, the V5TS analog LE side tests the V5 function on the AN side; in the mode C, V5TS is operated as a monitoring device, which can listen to Le and AN Information frames passing between. Figure 1-1 The basis of the test is the "Access Network V5.2 Interface Live Test Specification" issued by the original post and power department, with a total of 84 test terms, shown in Table 1-1. Table 1-1 Access network V5 .2 Interface Field Test Specification 1.3 Tester Hardware Principles The structure of the ISA bus card is shown in Figure 1-2.
Figure 1-2 V5TS Hardware Interface Where E1 Controller uses BROOKTREE's BT8510 to complete the physical layer function and TS16 LAPD operation; HSCX (Advanced Serial Communication Controller) selected Siemens's SAB82525, completed TS15 and TS31 LAPD operation; μP uses DS80C320 of Dallas Semiconductor, DPRAM (Dual Port Random Memory) uses IDT71342 for data communication between μP (microprocessor) and MP (main processor); I / O Port for Transfer control signals between μP and MP. The DPRAM and I / O Port are related to this article. 1.4 Tester Software Frame Tester Software Section divided into two major modules: μP modules and MP modules depending on the different processors. The μP module uses assembly language as a program development language, mainly completing hardware initialization work and message transceiver work; MP module is divided into four submodules: · Master module; · System management module; · Protocol processing module; • Data transmission module. Since we use the operating platform for the Windows95 platform, VXD programs must be called in the MP data transceiver module to complete data exchange with the ISA card. 2 VXD Technical Introduction 2.1 VXD Concept Intel Processors have 4 privileges from 386, namely 0 to level 3. The top level is highest, and the 3th level is the lowest. These four levels of image can be seen as four concentric circles. For performance, Win95 uses only 0 and 3, and the general program is running 3, and the 0-level program can use all the resources of the processor and ability. VXD (Virtual Device Driver) is a class of programs used to extend Windows operating system feature. It is linked into the core layer of the Windows operating system in the form of a DLL (RING 0). VXD mainly solves a series of issues that cannot be processed by Ring 3. 2.2 Processing in the high-level application Windows 95 Implement the Device Input Output Control (IOCTL) interface via the DeviceIoControl function, which can send a command and pass the corresponding data to the specified VXD. You can use the CreateFile function to open this VXD, send a command to this VXD with DeviceIoControl, and finally turn this VXD with the CloseHandle function. The following outlines the above three functions: 1) HANDLE CreateFile (LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile); function call will return successfully open a specified file handle.
Parameters LPFileName refers to a pointer to a string, which contains object names that need to be generated or opened, including files, disk devices, directories, etc. We use VXD files here; dwdesiredAccess is the mode of access object, read , Write, read and write or device query, etc .; DWSHAREMODE is an object's shared mode, if the parameter is zero object is not shared; LPSecurityAttributes is a pointer to the security attribute structure, which determines whether the returned handle can be inherited; dwcreationDisPosition It is pointed out that the various operations when the file exists or does not exist, if the value crete_always represents a new file, if the file already covers the original file and clears the original attribute; dwflagsandattributes indicate file properties and flags, such as file_attribute_hidden representative files The attribute is hidden; HTEMPLATEFILE is a handle, which points to the template file of the first read attribute, and this parameter in Windows 95 must be NULL. 2) BOOL DeviceIoControl (HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped); success function call returns a nonzero value. The parameter HDEvice is the handle of the device to perform, obtained by calling createfile; dwioControlCode points out the control code of the operation; Lpinbuffer is a pointer to a buffer, the buffer is the data to be operated; ninbuffers is the size of the LPinbuffer buffer The unit is byte; LPOUTBUFFER is also a pointer to a buffer, and the buffer is an output data; NoutBuffersize is the size of the LPoutBuffer buffer, the unit is byte; LPByTesReturned points to a variable to receive data stored in LPoutBuffer The size, the unit is also byte; lpoverlapped is a pointer to the Overlapped structure. 3) BOOL CloseHandle (Handle Hobject); Returns a non-zero value if the function call is successful. Parameter HOBJECT is a handle that opens an object. You can open a static or dynamically loadable VXD when you call the CREATEFILE function. If this VXD exists and supports the device IOCTL interface, createfile will return a device handle that can be used as a parameter when the DeviceIocontrol function is called. Otherwise createfile will fail and set the last error value to Error_Not_supported or Error_File_not_Found. Error value can be invigured to get GetLastError. When you open VXD, you must specify its name: //vxdname in the following form, where vxdname can be the name of the registration book item that specifies the module name, file name, or flag of a VX.
We specify the extension .vxd, the function will find this file in the standard search path (typically under Windows), such as: Handle Hdevice; HDevice = CreateFile (".// Testv5.vxd", 0, 0, NULL, 0, file_flag_delete_on_ close, null); the same VXD can open any time, CreateFile will provide a unique handle of this VXD each time, but the memory is not loaded into two VXDs. In order to ensure that the system can clear it from memory while turning off the last example of VXD, specifying the file_flag_delete_on_close value when turning on the dynamic loadable VXD. You can send a command to the VXD with DeviceIocontrol. At this point, you should specify the previously opened device handle, control code, and input output parameters. The device handle marks VXD to send commands, and the control code specifies an operation to do with this VXD. The input and output parameters of DeviceIoControl include the size or address of the buffer to which the data is passed to the VXD or receive data from the VXD. Whether to use these parameters depends on how the specified VXD handles control code. Once the user ends a VXD, you can use the CloseHandle function to turn off the device handle related to it. The next example will turn off a handle: CloseHandle (HDevice). Closing VXD does not need to delete it from memory, and CloseHandle will clear this VXD from memory when there is no valid handle associated with this VXD in the system. 2.3 Processing VXD in the VXD program can support the device IOCTL interface by handling the W32_DEviceIOControl message during the control process of VXD. When the application calls the createFile function, the system sends a W32_Deviceiocontrol message to the specified VXD to determine if this VXD can support the device IOCTL interface. For dynamically loaded VXD, the system will send Sys_Dynamic_init control messages to it when this VXD is opened for the first time. When the application calls DeviceIocontrol, the system will call the control process of the VXD identified by the given device handle. At this time, the EAX register contains a W32_Deviceiocontrol message, and the ESI register contains an address of a DiocParams structure. This structure contains all parameters specified in the DeviceIoControl function in the deviceiocontrol function. VXD should detect DWIOControlCode members of the DiocParams structure to determine the operations to be performed, and the LPVINBUFFER member contains VXD to complete some of the support data required for this operation. After processing the control code, the VXD should return it to the application's information to copy to the buffer referred to in the LPVOutBuffer member. If VXD successfully processes the control code, you should clear the EAX register before returning. Otherwise, EAX should be set to a non-zero value. 3. Design of the VXD program in the VXD program 3.1 Write tools for VXD Programs We use Microsoft's VC and Vireo Software's vtoolsd for Win95 as a program development language, Numege's Softice95 as a debugging tool. The VToolsD development package provides full-line C class library support for VXD programming, where the most important is the Quick VXD program, which provides many options to quickly generate a VXD code frame, which is extremely similar to Class Wizard in VC . In a Quick VXD visual programming environment, Quick VXD creates a VXD project file based on the various options of the programmer. This file includes: C / C header file, C / C code file, C / C engineering file. The header file contains the class declaration, and the VXD control message processing function declaration, the Windows Ring3 API calls VXD call entry declaration, etc. In the code file, QuickVxd Premier has become a class that must continue programming to expand its intrinsic function. Member function.