[go: up one dir, main page]

CN100512271C - Distributed device reorienting system and method in terminal network environment - Google Patents

Distributed device reorienting system and method in terminal network environment Download PDF

Info

Publication number
CN100512271C
CN100512271C CNB200410073676XA CN200410073676A CN100512271C CN 100512271 C CN100512271 C CN 100512271C CN B200410073676X A CNB200410073676X A CN B200410073676XA CN 200410073676 A CN200410073676 A CN 200410073676A CN 100512271 C CN100512271 C CN 100512271C
Authority
CN
China
Prior art keywords
terminal
service agent
module
agent module
equipment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CNB200410073676XA
Other languages
Chinese (zh)
Other versions
CN1744591A (en
Inventor
叶剑
朱珍民
李锦涛
史红周
郭俊波
顾晓光
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BEIJING AUMIWALKER TECHNOLOGY CO LTD
Original Assignee
Institute of Computing Technology of CAS
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Institute of Computing Technology of CAS filed Critical Institute of Computing Technology of CAS
Priority to CNB200410073676XA priority Critical patent/CN100512271C/en
Publication of CN1744591A publication Critical patent/CN1744591A/en
Application granted granted Critical
Publication of CN100512271C publication Critical patent/CN100512271C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Computer And Data Communications (AREA)

Abstract

本发明提供一种终端网络环境中的分布式设备重定向系统,包括虚拟驱动模块、服务代理模块和终端代理模块,通过应用→虚拟驱动模块→服务代理模块→终端代理模块→终端设备驱动→终端设备的通道,将应用对设备的访问逻辑反映到终端设备上,并按照原通道的逆返回。在这一通信过程中,虚拟驱动往往并不关心操作的细节,只是将设备访问逻辑通过网络传递至终端设备并原路返回。采用上述通信描述过程可以屏蔽不同设备访问细节的差异,具有很强的通用性;同时通过提供特定接口,对某些特殊需要的设备操作提供支持,具有较强的可扩展性。

Figure 200410073676

The present invention provides a distributed device redirection system in a terminal network environment, including a virtual driver module, a service agent module and a terminal agent module, through application→virtual driver module→service agent module→terminal agent module→terminal device driver→terminal The channel of the device reflects the access logic of the application to the device to the terminal device, and returns according to the inverse of the original channel. In this communication process, the virtual driver often does not care about the details of the operation, but only transmits the device access logic to the terminal device through the network and returns the same way. Using the above-mentioned communication description process can shield the differences in access details of different devices, which has strong versatility; at the same time, by providing specific interfaces, it can provide support for some special-needed device operations, which has strong scalability.

Figure 200410073676

Description

一种终端网络环境中的分布式设备重定向系统及其方法 Distributed device redirection system and method thereof in terminal network environment

技术领域 technical field

本发明涉及图形终端应用协议中的终端设备远程访问技术,更具体地说,本发明涉及一种终端网络环境中的分布式设备重定向方法。The invention relates to a terminal device remote access technology in a graphics terminal application protocol, and more specifically, the invention relates to a distributed device redirection method in a terminal network environment.

背景技术 Background technique

随着网络基础设施和互联网络的迅速发展,分布在网络中的终端设备的使用日益普及。使用网络终端访问网络上的各种应用已经成为人们获取信息和各种网络服务的重要方式。许多网络终端应用不仅涉及用户接口操作,同时需要操作多种设备。With the rapid development of network infrastructure and Internet, the use of terminal equipment distributed in the network is becoming more and more popular. Using a network terminal to access various applications on the network has become an important way for people to obtain information and various network services. Many network terminal applications not only involve user interface operations, but also need to operate multiple devices at the same time.

在图形终端应用中,应用逻辑在应用服务器上实现,终端通过网络执行服务器上的应用程序。应用程序访问的目标是服务器上的设备,而终端用户往往希望应用能够与终端本地的设备实现交互。例如用户终端登陆到服务器,并打开mp3播放器播放音频。用户的目的显然是希望音频内容能够在终端声卡设备而不是服务器的声卡上回放。应用服务器对多个用户所在终端的设备访问是一个复杂而又关键的问题。In the graphic terminal application, the application logic is implemented on the application server, and the terminal executes the application program on the server through the network. The target of application program access is the device on the server, and end users often hope that the application can interact with the local device on the terminal. For example, the user terminal logs in to the server and opens an mp3 player to play audio. The user's purpose is obviously to hope that the audio content can be played back on the terminal sound card instead of the server's sound card. The application server's device access to multiple user terminals is a complex and critical issue.

在桌面环境中应用对设备的访问主要包括如下过程:设备的打开、初始化、读写操作和关闭。在这一过程中,驱动程序首先要完成在操作系统上的注册,同时提供文件操作接口,在接口中定义设备操作函数,以满足并对应于上述设备操作和控制。应用程序运行在用户空间,设备驱动运行在内核空间。应用对设备的访问就是在用户空间与内核空间的频繁数据流动中完成。在终端网络环境中,用户对应用的操作通过应用服务器和终端间的信息交互实现,用户的操作目标是终端本地的设备。虽然图形用户接口在终端本地显示,但应用逻辑发生在服务器上,默认的应用对服务器设备的访问就无法满足终端用户的需求。因此为了满足多个终端用户的设备资源访问需求,需要将应用对服务器设备的访问通过网络转化为对终端本地设备的访问。对设备的访问要满足用户透明性,用户对服务器上应用访问的用户接口在本地显示,同时通过应用访问本地设备,实现设备重定向功能。此外,这种访问机制需要满足对应用的透明性。应用的默认实现是对服务器设备的访问,需要将这种访问逻辑反映到终端本地设备上。In the desktop environment, the application's access to the device mainly includes the following processes: device opening, initialization, read and write operations, and closing. In this process, the driver must first complete the registration on the operating system, and at the same time provide a file operation interface, and define device operation functions in the interface to meet and correspond to the above-mentioned device operation and control. Applications run in user space, and device drivers run in kernel space. The application's access to the device is completed in the frequent data flow between the user space and the kernel space. In the terminal network environment, the user's operation on the application is realized through the information interaction between the application server and the terminal, and the user's operation target is the terminal's local device. Although the graphical user interface is displayed locally on the terminal, the application logic occurs on the server, and the default application's access to the server device cannot meet the needs of the end user. Therefore, in order to meet the device resource access requirements of multiple end users, it is necessary to convert the application's access to the server device into an access to the terminal local device through the network. The access to the device must satisfy user transparency. The user interface of the user's access to the application on the server is displayed locally, and at the same time, the local device is accessed through the application to realize the device redirection function. In addition, this access mechanism needs to be transparent to the application. The default implementation of the application is to access the server device, and this access logic needs to be reflected on the terminal local device.

发明内容 Contents of the invention

本发明的目的在于为网络终端环境中终端应用对设备的访问提供一种可行的、具有高扩展性和通用性的设备重定向方法。The purpose of the present invention is to provide a feasible device redirection method with high expansibility and versatility for terminal applications to access devices in a network terminal environment.

本发明的一个目的是满足网络终端环境多用户要求,应用的设备访问逻辑应当重定向到启动应用的用户所在终端的设备上。An object of the present invention is to meet the multi-user requirements of the network terminal environment, and the device access logic of the application should be redirected to the terminal device of the user who starts the application.

本发明的另一目的是设备重定向方法应具有通用性,满足设备访问的通用接口需求,即满足通用性要求。Another object of the present invention is that the device redirection method should be universal and meet the general interface requirements for device access, that is, meet the universality requirements.

本发明的另一个目的是可以对特定设备所独具的访问逻辑提供特殊的支持,支持同类设备的多个子设备支持,即满足扩展性要求。Another object of the present invention is to provide special support for the unique access logic of a specific device, and support multiple sub-devices of the same type of device, that is, to meet the scalability requirement.

本发明的另一个目的是设备重定向方法需要服务器端通用设备虚拟驱动的支持,虚拟驱动与服务器本地标准设备驱动满足兼容性要求。Another object of the present invention is that the device redirection method requires the support of the server-side universal device virtual driver, and the virtual driver and the server's local standard device driver meet compatibility requirements.

为了实现上述发明目的,本发明提供一种终端网络环境中的分布式设备重定向系统,包括虚拟驱动模块、服务代理模块和终端代理模块,通过从应用依次经过虚拟驱动模块、服务代理模块、终端代理模块、终端设备驱动到终端设备的通道,将应用对设备的访问逻辑反映到终端设备上,并按照所述的通道逆返回,其中:In order to achieve the purpose of the above invention, the present invention provides a distributed device redirection system in a terminal network environment, including a virtual driver module, a service agent module and a terminal agent module, through the virtual driver module, service agent module, terminal The proxy module, the channel from the terminal device driver to the terminal device, reflects the access logic of the application to the device on the terminal device, and returns it in reverse according to the channel, wherein:

虚拟驱动模块,支持注册/注销、监听端口和设备文件操作接口,基于重定向协议,实现与服务代理模块间的数据通信;The virtual driver module supports registration/logout, listening port and device file operation interface, and realizes data communication with the service agent module based on the redirection protocol;

服务代理模块,用于实现多用户登陆支持,监视登陆用户情况,判断启动应用的用户;实现服务代理模块与虚拟驱动模块以及服务代理模块与终端代理模块间的通信接口和协议描述;The service proxy module is used to realize multi-user login support, monitor the status of logged-in users, and determine the user who starts the application; realize the communication interface and protocol description between the service proxy module and the virtual driver module, and the service proxy module and the terminal proxy module;

终端代理模块,发送用户登陆请求,实现与服务代理模块间的通信接口和协议描述,解析设备访问逻辑继而操作终端本地设备。The terminal agent module sends the user login request, realizes the communication interface and protocol description with the service agent module, analyzes the device access logic and then operates the terminal local device.

为了实现上述发明目的,本发明提供一种终端网络环境中的分布式设备重定向方法,包括以下步骤:In order to achieve the purpose of the above invention, the present invention provides a distributed device redirection method in a terminal network environment, including the following steps:

加载虚拟驱动;Load the virtual driver;

启动服务代理,建立与虚拟驱动的连接;Start the service agent and establish a connection with the virtual driver;

用户远程登陆;User remote login;

用户在终端应用环境中启动应用;The user starts the application in the terminal application environment;

应用访问设备;application access device;

设备访问逻辑通过虚拟驱动传给服务代理;The device access logic is passed to the service agent through the virtual driver;

设备访问逻辑通过服务代理传给终端代理;The device access logic is passed to the terminal agent through the service agent;

终端代理解析访问逻辑,并实现本地设备访问;The terminal proxy parses the access logic and implements local device access;

由上可知,本发明在服务器上实现的是轻量虚拟驱动。与标准驱动相比,两者的设备文件的注册/注销和操作接口一致,但实际的设备操作却未执行,而是将应用的操作逻辑通过网络传输至终端,并将反馈返回至服务器上的应用。在这一通信过程中,虚拟驱动往往并不关心操作的细节,只是将设备访问逻辑通过网络传递至终端设备并原路返回。采用上述通信描述过程可以屏蔽不同设备访问细节的差异,具有很强的通用性;同时通过提供特定接口,对某些特殊需要的设备操作提供支持,具有较强的可扩展性。It can be seen from the above that what the present invention implements on the server is a lightweight virtual driver. Compared with the standard driver, the registration/deregistration and operation interface of the device files of the two are consistent, but the actual device operation is not executed, but the operation logic of the application is transmitted to the terminal through the network, and the feedback is returned to the server on the server. application. In this communication process, the virtual driver often does not care about the details of the operation, but only transmits the device access logic to the terminal device through the network and returns the same way. Using the above-mentioned communication description process can shield the differences in access details of different devices, which has strong versatility; at the same time, by providing specific interfaces, it can provide support for some special-needed device operations, which has strong scalability.

附图说明 Description of drawings

图1是本发明的设备重定向系统结构示意图;Fig. 1 is a schematic structural diagram of the device redirection system of the present invention;

图2是本发明应用进程标识pid与用户会话标识sid关系建立流程图;Fig. 2 is a flow chart of establishing the relationship between the application process identification pid and the user session identification sid of the present invention;

图3是本发明的方法流程图;Fig. 3 is a method flowchart of the present invention;

图4是本发明的虚拟驱动的流程图;Fig. 4 is the flowchart of the virtual drive of the present invention;

图5是本发明协议交互的示意图。Fig. 5 is a schematic diagram of protocol interaction in the present invention.

具体实施方式 Detailed ways

下面参照附图详细说明本发明的技术方案。The technical solution of the present invention will be described in detail below with reference to the accompanying drawings.

如图1所示,为了实现上述发明目的,本发明提供一种图形终端环境中的分布式设备重定向系统,主要包括虚拟驱动模块、服务代理模块和终端代理模块,通过“应用→虚拟驱动模块→服务代理模块→终端代理模块→终端设备驱动→终端设备”的通道,将应用对设备的访问逻辑反映到终端设备上,并按照原通道的逆返回,实现设备重定向,满足多用户终端网络环境中的设备支持需要。As shown in Figure 1, in order to achieve the purpose of the above invention, the present invention provides a distributed device redirection system in a graphic terminal environment, which mainly includes a virtual driver module, a service agent module and a terminal agent module, through "application→virtual driver module →Service proxy module→Terminal proxy module→Terminal device driver→Terminal device" channel, which reflects the access logic of the application to the device on the terminal device, and returns according to the reverse of the original channel, realizes device redirection, and satisfies the needs of multi-user terminal networks The device support needs in the environment.

更具体地说,设备重定向系统包括虚拟驱动模块,支持注册/注销、监听端口和设备文件操作接口,基于重定向协议,实现与服务代理模块间的数据通信。其中,虚拟驱动模块又包括:More specifically, the device redirection system includes a virtual driver module, which supports registration/logout, listening port and device file operation interface, and realizes data communication with the service agent module based on the redirection protocol. Among them, the virtual driver module includes:

注册接口单元,注册的主次设备号与系统标准设备的设备号一致,根据实际的设备需要,注册多个次设备,满足扩展性要求。注册接口提供内核空间多线程支持,在新线程中提供端口监听功能。Register the interface unit, and the registered primary and secondary device numbers are consistent with the device numbers of the system standard equipment. According to the actual equipment needs, register multiple secondary devices to meet the scalability requirements. The registration interface provides multi-thread support in kernel space, and provides port monitoring function in the new thread.

端口监听单元,建立虚拟驱动到服务代理的重定向通道,完成通信端口的建立和监听。虚拟驱动接收服务代理发来的登陆会话标识sid,并记录sid与通信端口间的对应关系。The port monitoring unit establishes a redirection channel from the virtual driver to the service agent, and completes the establishment and monitoring of the communication port. The virtual driver receives the login session identifier sid sent by the service agent, and records the correspondence between the sid and the communication port.

设备文件操作接口单元,按照设备打开、设备I/O控制、设备读写和设备关闭的过程支持标准设备访问接口。接口定义符合标准驱动设计原则,满足与标准设备的兼容性要求。The device file operation interface unit supports standard device access interfaces according to the process of device opening, device I/O control, device reading and writing, and device closing. The interface definition conforms to the standard-driven design principles and meets the compatibility requirements with standard equipment.

设备打开接口单元,与服务代理完成应用进程标识pid和会话标识sid的转换,根据结果判定启动应用的用户会话。将打开逻辑描述发送给服务代理,并接受来自服务代理的反馈。The device opens the interface unit, completes the conversion of the application process identifier pid and the session identifier sid with the service agent, and determines the user session that starts the application according to the result. Send the opening logic description to the service agent and receive feedback from the service agent.

设备I/O控制接口单元,将I/O控制逻辑描述发送给服务代理,并接受来自服务代理的反馈。The device I/O control interface unit sends the I/O control logic description to the service agent and receives feedback from the service agent.

设备读接口单元,将读逻辑描述发送给服务代理,并接受来自服务代理的反馈,反馈中包含读设备获取的设备信息。The device read interface unit sends the read logic description to the service agent, and receives feedback from the service agent, the feedback includes the device information acquired by the read device.

设备写接口单元,将写逻辑描述发送给服务代理,描述包含向设备写的数据,并接受服务代理的反馈。The device write interface unit sends the write logic description to the service agent, the description includes the data written to the device, and receives the feedback from the service agent.

设备关闭接口单元,将关闭逻辑描述发送给服务代理,并接受来自服务代理的反馈。The device shuts down the interface unit, sends the shutdown logic description to the service agent, and receives feedback from the service agent.

设备重定向系统还包括服务代理模块,用于实现多用户登陆支持,监视登陆用户情况,判断启动应用的用户;实现服务代理模块与虚拟驱动模块以及服务代理模块与终端代理模块间的通信接口和协议描述。其中,服务代理模块包括:The device redirection system also includes a service agent module, which is used to realize multi-user login support, monitor the status of logged-in users, and determine the user who starts the application; realize the communication interface between the service agent module and the virtual driver module, and the service agent module and the terminal agent module. protocol description. Among them, the service proxy module includes:

多线程管理单元,监听并管理多个终端用户登陆的会话环境。共享内存单元,记录用户会话标识。The multi-thread management unit monitors and manages the session environment of multiple terminal users logging in. A shared memory unit that records user session IDs.

“服务代理模块—虚拟驱动模块”通信接口单元,交互用户会话标识和应用进程标识,构建服务代理模块与虚拟驱动模块间的设备重定向通道,透明地实现两者间设备访问逻辑的传输。The "service agent module-virtual driver module" communication interface unit interacts with user session identifiers and application process identifiers, builds a device redirection channel between the service agent module and the virtual driver module, and transparently realizes the transmission of device access logic between the two.

“服务代理模块—终端代理模块”通信接口单元,构建服务代理模块与终端代理模块间的设备重定向通道,透明地实现两者间设备访问逻辑的传输。The "service agent module-terminal agent module" communication interface unit builds a device redirection channel between the service agent module and the terminal agent module, and transparently realizes the transmission of device access logic between the two.

设备重定向系统还包括终端代理模块,发送用户登陆请求,实现与服务代理模块间的通信接口和协议描述,解析设备访问逻辑继而操作终端本地设备。其中,终端代理模块包括:The device redirection system also includes a terminal agent module, which sends user login requests, realizes the communication interface and protocol description with the service agent module, analyzes the device access logic, and then operates the terminal local device. Among them, the terminal agent module includes:

“终端代理模块—服务代理模块”通信接口单元,发送登陆请求,构建终端代理模块与服务代理模块间的设备重定向通道。The "terminal proxy module-service proxy module" communication interface unit sends a login request and builds a device redirection channel between the terminal proxy module and the service proxy module.

访问逻辑解析单元,分析出不同的访问逻辑描述。The access logic analysis unit analyzes different access logic descriptions.

设备访问单元,根据解析结果访问终端本地设备,完成终端用户启动的应用程序执行的设备打开、I/O控制、设备读写和关闭操作,并将设备访问的反馈回传服务代理。The device access unit accesses the local device of the terminal according to the analysis result, completes the device opening, I/O control, device read and write and close operations performed by the application program initiated by the end user, and returns the device access feedback to the service agent.

下面结合附图,首先对本发明的实施方式作功能描述,然后结合音频设备重定向的开发实例,详细描述设备重定向的信息交互过程。In the following, the function description of the embodiment of the present invention will be described first with reference to the accompanying drawings, and then the information interaction process of device redirection will be described in detail in combination with a development example of audio device redirection.

虚拟驱动模块的设计与实现:Design and implementation of virtual drive module:

在图形终端应用中,应用服务器上的虚拟驱动通过内核或者模块方式运行,并监听来自终端服务代理的请求。用户如果未运行音频应用,则虚拟驱动和终端服务代理间的通信状态不变;如果用户运行服务器上的音频应用,则访问逻辑按照应用的描述执行。In the graphic terminal application, the virtual driver on the application server runs through the kernel or module mode, and monitors the request from the terminal service agent. If the user does not run the audio application, the communication status between the virtual driver and the terminal service agent remains unchanged; if the user runs the audio application on the server, the access logic is executed according to the description of the application.

虚拟驱动的注册/注销的实现遵循标准驱动设计,接口为init_module()和cleanup_module(),注册的主次设备号与系统标准设备的设备号一致,通过devfs_register_dev()和devfs_mk_dir()函数完成,满足服务器端设备描述一致性要求。The implementation of registration/deregistration of the virtual driver follows the standard driver design. The interface is init_module() and cleanup_module(). The registered primary and secondary device numbers are consistent with the device numbers of the system standard devices. It is completed through the devfs_register_dev() and devfs_mk_dir() functions, satisfying Server-side device description conformance requirements.

本发明的虚拟驱动通过kernel_thread(),启动监听线程,监听与服务代理之间的通信端口。监听过程如图所示。监听线程等待来自服务代理的连接请求,以便获取登陆或注销的会话信息。服务代理的请求格式为“会话描述+会话标识”。登陆和注销会话分别由“CN”和“DS”表示。虚拟驱动获取会话标识sid,对登陆会话将sid与通信端口间的对应关系记录到系统列表中,以备后用;对注销会话,将其和对应通信端口信息从列表中删除。The virtual driver of the present invention starts the monitoring thread through kernel_thread(), and monitors the communication port with the service agent. The monitoring process is shown in the figure. The listening thread waits for a connection request from the service agent in order to obtain session information for login or logout. The request format of the service proxy is "session description + session ID". Login and logout sessions are denoted by "CN" and "DS", respectively. The virtual driver obtains the session identifier sid, and records the corresponding relationship between the sid and the communication port in the system list for the login session for later use; for the logout session, deletes it and the corresponding communication port information from the list.

应用对设备的操作按照设备打开、设备I/O控制、设备读写和设备关闭的顺序进行。应用对设备的操作在驱动中通过设备文件操作接口file_operations结构定义实现。虚拟驱动主要通过“应用→虚拟驱动→服务代理→终端代理→终端设备驱动→终端设备”的通道,将应用对设备的访问逻辑反映到终端设备上,并按照原通道的逆返回。值得注意的是,每种访问逻辑都包含操作码和操作数,分别描述操作命令和操作对象。上述通信过程具有透明性,这种透明性一直保持在上述通信过程的始终,中间的虚拟驱动和各个代理并不关心命令的细节。分析工作在终端代理的最后进行。终端代理解析操作码和操作数,并根据结果通过标准的调用接口完成真正设备的I/O控制操作。The operation of the application on the device is performed in the order of device opening, device I/O control, device reading and writing, and device closing. The operation of the application on the device is implemented in the driver through the definition of the device file operation interface file_operations structure. The virtual driver mainly reflects the access logic of the application to the device on the terminal device through the channel of "application→virtual driver→service agent→terminal agent→terminal device driver→terminal device", and returns according to the reverse of the original channel. It is worth noting that each type of access logic contains opcodes and operands, which describe the operation command and operation object respectively. The above-mentioned communication process is transparent, and this transparency is always maintained throughout the above-mentioned communication process, and the intermediate virtual driver and each agent do not care about the details of the command. Analysis is performed at the end of the terminal agent. The terminal agent parses the operation code and operand, and completes the I/O control operation of the real device through the standard call interface according to the result.

本发明通过虚拟驱动在内核中注册的打开设备接口,获取音频应用的进程标识pid,通过虚拟驱动与终端服务代理间的数据通信,将pid传至服务代理,并在代理上获得音频应用的启动用户会话标识sid,并返回驱动。合法的sid返回表明音频应用由合法终端登陆用户执行,查找sid与通信端口关系对照列表,获得与相应会话的通信端口,此时建立了用户和应用间的对应关系,服务于之后的不同会话进程数据的分离。过程如图2所示。同时,向应用返回正常打开信息。The invention obtains the process identifier pid of the audio application through the virtual driver registered in the kernel to open the device interface, and transmits the pid to the service agent through the data communication between the virtual driver and the terminal service agent, and obtains the start of the audio application on the agent The user session identifies sid and returns the driver. A legal sid return indicates that the audio application is executed by a legitimate terminal login user. Search the comparison list between the sid and the communication port to obtain the communication port with the corresponding session. At this time, the corresponding relationship between the user and the application is established to serve different session processes in the future. Separation of data. The process is shown in Figure 2. At the same time, normal open information is returned to the application.

应用在打开设备之后,需要通过设备I/O控制接口ioctl操作,对设备的I/O属性进行设置、获取和修改。I/O控制是设备驱动程序中较为复杂的操作,接口定义包含命令字(操作码)和参数(操作数)。本发明中应用在进行设备I/O控制操作时,虚拟驱动只是从系统调用接口得到应用程序使用的控制命令字并进行分析,针对操作码通过宏定义_IOC_DIR()获得操作类型是NONE、OUT、IN或者INOUT型命令,分别对应不带参数,设置参数,读取参数,协商参数四种类型,然后分别调用相应的处理过程,利用协议交互部分完成其功能,将应用对设备的I/O控制重定向到终端设备上。After the application opens the device, it needs to operate through the device I/O control interface ioctl to set, obtain and modify the I/O properties of the device. I/O control is a relatively complex operation in the device driver, and the interface definition includes command words (opcodes) and parameters (operands). In the present invention, when the device I/O control operation is applied, the virtual driver only obtains the control command word used by the application program from the system call interface and analyzes it. The operation type obtained by macro definition _IOC_DIR() for the operation code is NONE, OUT , IN or INOUT type commands, respectively corresponding to four types without parameters, setting parameters, reading parameters, and negotiating parameters, and then calling the corresponding processing procedures respectively, using the protocol interaction part to complete its functions, and applying the I/O to the device O controls redirection to the end device.

在设备操作中,读写操作是发生最为频繁的操作,一般都处于应用程序的循环逻辑中。读写操作具有两个显著特点:一是操作数部分庞大,往往传递的是缓冲区指针;二是读写的状态需要返回,影响返回状态的因素较多。本发明在设计读写操作的通信协议时,操作数据缓冲区部分往往采用不定长方式,并配以长度字节描述实际缓冲区的大小。返回状态完全依赖于对终端设备实际操作的反馈。In device operations, read and write operations are the most frequently occurring operations, and are generally in the loop logic of the application program. Read and write operations have two notable features: one is that the operand part is huge, and the buffer pointer is often passed; the other is that the read and write status needs to be returned, and there are many factors that affect the returned status. When the present invention designs the communication protocol of read and write operations, the buffer part of the operation data often adopts an indefinite length mode, and a length byte is used to describe the size of the actual buffer. The return status is entirely dependent on the feedback of the actual operation of the end device.

本发明的关闭设备操作通过虚拟驱动模块与服务代理模块间定义的重定向协议,透明地传递给服务代理。The device closing operation of the present invention is transparently transmitted to the service agent through the redirection protocol defined between the virtual driver module and the service agent module.

服务代理模块的设计和实现:Design and implementation of the service proxy module:

本发明中,服务代理模块主要包括信息发送和接收接口。信息发送接口实现从虚拟驱动接收各种请求,并重新打包成服务——终端代理间的协议格式(主要是字节序不同),将请求转发到客户端代理;信息接收接口从客户端代理接收各种应答,并重新打包成服务代理与虚拟驱动间的协议格式(主要是字节序不同),发往虚拟驱动。In the present invention, the service agent module mainly includes information sending and receiving interfaces. The information sending interface realizes receiving various requests from the virtual driver, and repackages them into services—the protocol format between terminal agents (mainly different byte order), and forwards the requests to the client agent; the information receiving interface receives from the client agent Various responses are repackaged into the protocol format (mainly different byte order) between the service agent and the virtual driver, and sent to the virtual driver.

终端代理模块的设计和实现Design and Implementation of Terminal Agent Module

本发明中,客户端代理部分提供相应于服务代理模块收发的协议交互部分。此外,需要根据服务代理通知的访问逻辑描述,设计实现对本地设备的访问。对本地设备的访问采用标准的设备操作接口,操作结果的反馈需要返回给终端服务代理。In the present invention, the proxy part of the client side provides the protocol interaction part corresponding to the sending and receiving of the service proxy module. In addition, it is necessary to design and realize the access to the local device according to the access logic description notified by the service agent. The access to the local device adopts the standard device operation interface, and the feedback of the operation result needs to be returned to the terminal service agent.

4、通信协议的设计和实现,即重定向协议的设计和实现:4. Design and implementation of communication protocol, that is, design and implementation of redirection protocol:

包括三部分:设备发现、设备描述和设备访问。It includes three parts: device discovery, device description and device access.

设备发现主要实现对终端现有设备的发现、通知和反馈。某些设备在终端加电之初就已经存在并生效,比如键盘/鼠标、三卡(显卡、网卡和声卡)等。这些设备在用户登陆终端服务时就会通知服务代理并在服务端记录;而有些设备支持即插即用功能,USB设备就是如此。诸如此类的设备可能在用户登陆之前或之后与终端连接并通知终端服务。无论上述哪种情况,协议均需要向终端服务描述设备发现消息,并将终端服务的反馈描述返回至终端代理。Device discovery mainly realizes the discovery, notification and feedback of the existing devices of the terminal. Some devices already exist and take effect when the terminal is powered on, such as keyboard/mouse, three cards (graphics card, network card and sound card) and so on. These devices will notify the service agent and record on the server side when the user logs in to the terminal service; and some devices support plug and play functions, as is the case with USB devices. A device such as this may connect to the terminal and notify Terminal Services before or after the user logs on. In either case, the protocol needs to describe the device discovery message to the terminal service, and return the feedback description of the terminal service to the terminal agent.

设备描述,设备一旦被发现,就需要终端能够向服务端提供设备的具体描述信息。描述信息至少应当包括设备类型、设备描述符、设备能力描述。Device description. Once a device is discovered, the terminal needs to be able to provide specific description information of the device to the server. The description information should at least include device type, device descriptor, and device capability description.

终端设备大致分为两类:字符设备和块设备。字符设备的输入/输出以字节为单位,而块设备的输入/输出以记录块或“扇区”为单位。通过数十年的发展,块设备和字符设备之间的界限已经模糊了,但还是沿用着这样的划分。Terminal devices are roughly divided into two categories: character devices and block devices. I/O for character devices is measured in bytes, while I/O for block devices is measured in blocks of records, or "sectors". Through decades of development, the line between block devices and character devices has blurred, but this division is still used.

设备描述符主要是用于区分终端上的具体设备,可以直接采用终端设备描述符,比如音频设备可用dsp、mixer等,磁盘设备可用hda、sda等;也可以采用主次设备号描述,主次设备号的分配按照终端操作系统的设备的主次设备号描述,比如音频设备的dsp和mixer的主次设备号分别为14/3和14/0等。The device descriptor is mainly used to distinguish specific devices on the terminal, and the terminal device descriptor can be used directly, such as dsp, mixer, etc. for audio devices, hda, sda, etc. for disk devices; it can also be described by primary and secondary device numbers, primary and secondary The allocation of device numbers is described according to the major and minor device numbers of the terminal operating system. For example, the major and minor device numbers of the dsp and mixer of the audio device are 14/3 and 14/0 respectively.

设备能力描述是设备相关辅助信息,依赖于具体的设备,描述设备的当前I/O能力、使用状态等。设备能力描述也是服务于今后终端设备自适应能力支持的需要。The device capability description is the auxiliary information related to the device, which depends on the specific device and describes the current I/O capability and usage status of the device. The device capability description is also to serve the needs of terminal device adaptive capability support in the future.

设备访问,在发明申请中主要介绍的是这部分的实现,描述设备的打开、I/O控制、读写和关闭逻辑。Device access, the implementation of this part is mainly introduced in the invention application, describing the opening, I/O control, reading and writing and closing logic of the device.

本发明中,代理模块间的通信协议包括服务到终端的请求和终端到服务的响应两部分。分别描述如下:In the present invention, the communication protocol between the agent modules includes two parts: service-to-terminal request and terminal-to-service response. They are described as follows:

1)请求数据包格式如表1所示:1) The request packet format is shown in Table 1:

表1  虚拟驱动到终端的数据包格式Table 1 Data packet format from virtual driver to terminal

  长度 操作代码 参数字段表 2字节 1字节 可变长度 length operation code parameter field table 2 bytes 1 byte variable length

其中各字段定义如下:The fields are defined as follows:

长度字段:整个数据包的长度。Length field: the length of the entire packet.

Figure C200410073676D00111
Figure C200410073676D00111

operations结构中操作的定义中并没有poll项。poll操作用于系统中的select调用,专门用于处理高速CPU和低速的外设操作之间的矛盾。Select系统调用的实质是将系统中单一进程的睡眠等待变成多目标的睡眠等待,提高整个系统的运行效率。如果终端服务进程调用了select系统调用,实际等待的应该是从远程终端上返回的操作,取决于两个因素:终端上的读等待过程和终端将所读结果经过网络传送到虚拟驱动。因此poll的调用实际应该对应于为虚拟驱动程序和终端之间提供数据传输的socket调用。因此在表2中并不需要规定将poll操作传送到终端的操作代码,对于poll操作只需要直接调用相应的socket的poll过程即可。There is no poll item in the definition of the operation in the operations structure. The poll operation is used for select calls in the system, and is specially used to deal with the contradiction between high-speed CPU and low-speed peripheral operations. The essence of the Select system call is to change the sleep waiting of a single process in the system into a multi-object sleep waiting to improve the operating efficiency of the entire system. If the terminal service process calls the select system call, what is actually waiting should be the operation returned from the remote terminal, which depends on two factors: the read waiting process on the terminal and the terminal transmitting the read result to the virtual driver through the network. Therefore, the poll call should actually correspond to the socket call that provides data transmission between the virtual driver and the terminal. Therefore, in Table 2, there is no need to specify the operation code for transmitting the poll operation to the terminal, and it is only necessary to directly call the poll process of the corresponding socket for the poll operation.

参数字段:规定相应操作代码的参数格式,具体格式如表3所示。其中参数类型规定此参数中数据的格式,如16位整数、32位整数、字节流等。只有当参数数据类型为字节流时,参数结构中才有参数长度字段。随后的参数值字段为实际的参数值。Parameter field: specifies the parameter format of the corresponding operation code, and the specific format is shown in Table 3. The parameter type specifies the format of the data in this parameter, such as 16-bit integer, 32-bit integer, byte stream, etc. Only when the parameter data type is a byte stream, there is a parameter length field in the parameter structure. The subsequent parameter value field is the actual parameter value.

表3  参数格式Table 3 parameter format

  参数类型 参数长度 参数值 1字节 2字节 可变长度 Parameter Type parameter length parameter value 1 byte 2 bytes variable length

2)响应数据包格式如表4所示:2) The response packet format is shown in Table 4:

表4  终端设备操作响应Table 4 Terminal device operation response

  成功标记 长度 参数字段表 1字节 2字节 可变长度 success mark length parameter field table 1 byte 2 bytes variable length

其中各字段的意义如下:The meaning of each field is as follows:

成功标记:表示由应用发起的访问请求在终端实际设备上的执行结果,值为1表示执行成功,否则表示在执行过程中出错。Success flag: Indicates the execution result of the access request initiated by the application on the actual device of the terminal. A value of 1 means that the execution is successful, otherwise it means that an error occurred during the execution.

长度字段:表示后面的数据的总长度。Length field: indicates the total length of the following data.

参数字段:具体格式如表所示。为此次操作的返回值或可选参数。Parameter field: the specific format is shown in the table. Return value or optional parameter for this operation.

如图3所示,本发明的重定向方法包括以下步骤:As shown in Figure 3, the redirection method of the present invention includes the following steps:

步骤100,加载虚拟驱动;Step 100, loading a virtual driver;

步骤110,启动服务代理,建立与虚拟驱动的连接;Step 110, start the service agent, and establish a connection with the virtual driver;

步骤120,用户远程登陆(此时,通过服务代理,在虚拟驱动中记录会话标识sid与通信端口间的关系);Step 120, the user logs in remotely (at this time, by the service agent, the relationship between the session identification sid and the communication port is recorded in the virtual driver);

步骤130,用户在终端应用环境中启动应用;Step 130, the user starts the application in the terminal application environment;

步骤140,应用向虚拟驱动发出设备访问请求,形成设备访问逻辑;Step 140, the application sends a device access request to the virtual driver to form device access logic;

步骤150,设备访问逻辑通过虚拟驱动传给服务代理;Step 150, the device access logic is transmitted to the service agent through the virtual driver;

步骤150,设备访问逻辑通过虚拟驱动传给服务代理;Step 150, the device access logic is transmitted to the service agent through the virtual driver;

步骤160,设备访问逻辑通过服务代理传给终端代理;Step 160, the device access logic is transmitted to the terminal agent through the service agent;

步骤170,终端代理解析访问逻辑,并实现本地设备访问;Step 170, the terminal proxy parses the access logic and implements local device access;

设备访问的反馈由上述路线返回;The feedback of device access is returned by the above route;

如图4所示,虚拟驱动的实现流程包括以下步骤:As shown in Figure 4, the implementation process of the virtual drive includes the following steps:

步骤200,应用系统调用;Step 200, application system call;

步骤210,判断系统调用的种类,如果系统调用为open调用,则执行下一步,如果系统调用为ioctl调用,则执行步骤230,如果为其它调用,则执行步骤240;其中,系统调用包括open调用,release调用,read调用,write调用,ioctl调用,poll调用。Step 210, judge the type of system call, if the system call is an open call, then perform the next step, if the system call is an ioctl call, then perform step 230, if it is other calls, then perform step 240; wherein, the system call includes an open call , release call, read call, write call, ioctl call, poll call.

步骤220,获取与相应会话通信的端口信息,执行步骤240;Step 220, obtain port information communicating with the corresponding session, and execute step 240;

步骤230,判断ioctl类型,并作相应处理,执行步骤240;Step 230, judge the type of ioctl, and perform corresponding processing, and execute step 240;

步骤240,协议交互;Step 240, protocol interaction;

步骤250,调用返回。Step 250, the call returns.

在步骤240中,如图5所示,1—3为访问逻辑映射,4—6为访问反馈。In step 240, as shown in FIG. 5, 1-3 is the access logic mapping, and 4-6 is the access feedback.

在图形终端环境中,多媒体应用是一个重要的应用。为了满足对有声应用的支持,在终端网络中更好地支持音频设备,是本发明所研究的设备重定向的重点。In the graphic terminal environment, multimedia application is an important application. In order to satisfy the support for audio applications, better support for audio devices in the terminal network is the focus of the device redirection studied in the present invention.

结合上述发明实施过程描述,以音频设备重定向为实施实例,描述本发明所述设备重定向的具体实施过程。随着声音设备硬件的发展和应用的丰富,音频应用需要声卡能够支持MIDI设备、混音器设备等。其中,混音器设备/dev/mixer作为音量调节工具,在多数音频应用中得到广泛应用。本发明具有较好的扩展性,可以支持多种设备描述。混音器的实现原理与传统音频设备完全相同,下面主要介绍针对传统音频设备/dev/dsp的实施实例。In combination with the description of the implementation process of the above invention, the specific implementation process of the device redirection in the present invention is described by taking audio device redirection as an implementation example. With the development of sound device hardware and the enrichment of applications, audio applications require sound cards to support MIDI devices, mixer devices, and the like. Among them, the mixer device /dev/mixer is widely used as a volume adjustment tool in most audio applications. The invention has good expansibility and can support various device descriptions. The implementation principle of the mixer is exactly the same as that of the traditional audio equipment, and the following mainly introduces the implementation examples for the traditional audio equipment /dev/dsp.

1)用户登陆和注册1) User login and registration

虚拟驱动首先以模块方式加载到内核中,在内核的注册过程如上所述。注册完毕启动端口监听线程,监听来自服务代理的信息(此时服务代理尚未启动)。启动服务代理,监听来自终端代理的信息。终端代理发起用户登陆请求,建立与服务代理的连接。对每一个新登陆的用户,服务代理分配用户会话标识sid,启动线程维护与用户的连接和数据通信。在线程中将用户的sid通过请求信息传递给虚拟驱动。虚拟驱动接收到服务代理传来的sid,记录sid与通信端口的关系信息,完成用户登陆和注册过程。The virtual driver is first loaded into the kernel as a module, and the registration process in the kernel is as described above. After the registration is complete, the port monitoring thread is started, and the information from the service agent is monitored (the service agent has not been started at this time). Start the service agent and listen for messages from the terminal agent. The terminal agent initiates a user login request and establishes a connection with the service agent. For each newly logged-in user, the service agent assigns the user session identifier sid, and starts a thread to maintain connection and data communication with the user. Pass the user's sid to the virtual driver through the request information in the thread. The virtual driver receives the sid from the service agent, records the relationship information between the sid and the communication port, and completes the user login and registration process.

2)应用启动过程2) Application startup process

终端用户通过图形接口启动服务上的音频应用程序。音频应用首先通过open命令,操作音频设备文件描述符/dev/dsp,进行音频设备的打开操作,这一操作信息通过内核传递给虚拟驱动的设备文件打开接口dev_open。在此接口中,按照上述过程,将获取到的应用进程标识pid传递给服务代理。服务代理得到pid,通过访问/proc文件系统,获取会话标识sid,并回传给虚拟驱动。虚拟驱动通过记录的sid和通信端口间的关系,获得与音频应用进程对应的会话通信的通信端口。End users start audio applications on the service through a graphical interface. The audio application first operates the audio device file descriptor /dev/dsp through the open command to open the audio device, and this operation information is passed to the device file opening interface dev_open of the virtual driver through the kernel. In this interface, according to the above process, the obtained application process identifier pid is passed to the service agent. The service agent obtains the pid, obtains the session identifier sid by accessing the /proc file system, and sends it back to the virtual driver. The virtual driver obtains the communication port of the session communication corresponding to the audio application process through the relationship between the recorded sid and the communication port.

3)应用对声卡的访问3) Application access to the sound card

声卡的I/O控制比较丰富,可以设置和获取许多有关声卡设备属性的信息,以缓冲区信息为例,声卡可以设置和获取缓冲区的大小,这分别对应于上述OUT和IN型命令。应用中对声卡缓冲区设置的接口定义为:The I/O control of the sound card is relatively rich, and a lot of information about the properties of the sound card device can be set and obtained. Taking the buffer information as an example, the sound card can set and obtain the size of the buffer, which correspond to the above OUT and IN commands respectively. The interface definition of sound card buffer settings in the application is:

ioctl(int audio_fd,int cmd,char*blocksize)ioctl(int audio_fd, int cmd, char*blocksize)

其中,audio_fd为声卡设备文件号,cmd为命令字,在此为SNDCTL_DSP_GETBLKSIZE,表示此命令需要获取缓冲区大小,blocksize为返回的缓冲区大小。此命令映射到虚拟驱动,虚拟驱动中的操作接口为Among them, audio_fd is the file number of the sound card device, cmd is the command word, here it is SNDCTL_DSP_GETBLKSIZE, indicating that the command needs to obtain the buffer size, and blocksize is the returned buffer size. This command is mapped to the virtual driver, and the operation interface in the virtual driver is

dev_ioctl(struct inode*inode,struct file*file,unsigned int cmd,unsigned long arg)dev_ioctl(struct inode*inode, struct file*file, unsigned int cmd, unsigned long arg)

其中cmd对应命令字,arg对应参数。虚拟驱动需要通过_IOC_DIR(cmd)解析命令字的类型,根据类型将命令字和参数的组合透明地传给服务代理。Among them, cmd corresponds to the command word, and arg corresponds to the parameter. The virtual driver needs to parse the type of the command word through _IOC_DIR (cmd), and transparently pass the combination of the command word and parameters to the service agent according to the type.

设置缓冲区大小及其他的I/O控制与上述过程是一样的。Setting buffer sizes and other I/O controls is the same as above.

对声卡设备的主要操作是读写声卡。应用对声卡的读写对应于音频录音和回放功能。下面以音频应用写缓冲区的接口为例介绍。音频应用写缓冲区的接口为:The main operation on the sound card device is to read and write the sound card. The application's reading and writing to the sound card corresponds to the audio recording and playback functions. The following is an example of an audio application write buffer interface. The audio application write buffer interface is:

write(int audio_fd,const void*buffer,size_t count)write(int audio_fd, const void*buffer, size_t count)

其中audio_fd为声卡设备文件号,buffer为存储音频数据的缓冲区指针,count以字节为单位表示缓冲区大小。此命令映射到虚拟驱动,虚拟驱动中的操作接口为Among them, audio_fd is the file number of the sound card device, buffer is the buffer pointer for storing audio data, and count represents the size of the buffer in bytes. This command is mapped to the virtual driver, and the operation interface in the virtual driver is

dev_write(struct file*file,const char*buffer,size_t count,loff_t*ppos)dev_write(struct file*file, const char*buffer, size_t count, loff_t*ppos)

其中buffer为接收用户空间音频数据的缓冲区的指针,count为缓冲区大小。音频应用对声卡的写逻辑反映到虚拟驱动,既而透明地传递给服务代理。Among them, buffer is a pointer to the buffer receiving user-space audio data, and count is the size of the buffer. The writing logic of the audio application to the sound card is reflected to the virtual driver, and then transparently passed to the service agent.

音频应用的读逻辑与写逻辑映射过程类似,但数据流方向相反。The read logic for audio applications is similar to the write logic mapping process, but the data flow direction is reversed.

4)声卡的关闭4) Turn off the sound card

音频应用的设备关闭通过虚拟驱动传递给服务代理。The device close of the audio application is passed to the service agent through the virtual driver.

5)虚拟设备驱动的注销5) Logout of the virtual device driver

虚拟驱动一旦加载后,一般不会从内核中注销。为了满足与标准设备驱动的一致性,虚拟驱动提供设备注销接口,通过devfs_unregister_chrdev()和devfs_unregister()实现。Once a virtual driver is loaded, it is generally not unregistered from the kernel. In order to meet the consistency with the standard device driver, the virtual driver provides a device unregister interface, which is implemented through devfs_unregister_chrdev() and devfs_unregister().

上述介绍的是本发明的核心——虚拟设备驱动的实施实例。服务代理、终端代理与虚拟设备驱动共同构成了设备重定向的通信通道,实施的关键是通信协议的定义。下面以音频应用发生最频繁的音频数据写为例,介绍服务和终端代理间的通信协议。What has been introduced above is the implementation example of the core of the present invention—virtual device driver. Service agent, terminal agent and virtual device driver together constitute the communication channel for device redirection, and the key to implementation is the definition of communication protocol. The following takes audio data writing, which occurs most frequently in audio applications, as an example to introduce the communication protocol between the service and the terminal agent.

服务代理接收到虚拟驱动的写操作命令后,按照代理间定义的设备重定向协议,组织数据包,发送给终端代理。例如如果每次写操作所写声音数据大小为4096字节,则构建数据包如下所示:After receiving the write operation command of the virtual driver, the service agent organizes the data packets according to the device redirection protocol defined between the agents and sends them to the terminal agent. For example, if the size of the sound data written in each write operation is 4096 bytes, the construction data package is as follows:

  长度 操作代码 参数类型 参数长度 参数值 4100 3 B 4096 音频数据 length operation code Parameter Type parameter length parameter value 4100 3 B 4096 audio data

其中长度字段为4100(1+1+2+4096),表示发送数据总长(不包括长度字段)为4100字节;操作码为3表明此操作为写操作;参数类型为”B”,表明后续数据为字节流;参数长度为4096,表明参数值字段长度为4096字节;参数值部分存放的是由音频应用来,并需要写到声卡中的音频数据。The length field is 4100 (1+1+2+4096), indicating that the total length of the sent data (excluding the length field) is 4100 bytes; the operation code is 3, indicating that this operation is a write operation; the parameter type is "B", indicating that the follow-up The data is a byte stream; the parameter length is 4096, indicating that the parameter value field length is 4096 bytes; the parameter value part is stored by the audio application and needs to be written to the audio data in the sound card.

由于声卡写操作只需反馈成功与否,因此,返回消息简单,仅描述是否成功即可。如果是声卡读或者I/O操作的IN型命令等,例如一次读4096字节数据,则返回消息如下所示:Since the sound card write operation only needs to feedback whether it is successful or not, the return message is simple and only describes whether it is successful or not. If it is an IN command for sound card reading or I/O operation, such as reading 4096 bytes of data at a time, the return message is as follows:

  成功标记 长度 参数类型 参数长度 参数值 1 4099 B 4096 音频数据 success mark length Parameter Type parameter length parameter value 1 4099 B 4096 audio data

其中成功标记字段为1,表示返回有效;长度字段为4099,表示后续数据总长为4099字节;参数类型字段为“B”,表明后面的数据为字节流;参数长度字段为4096,表明参数值长度为4096字节;参数值部分为音频数据。The success mark field is 1, indicating that the return is valid; the length field is 4099, indicating that the total length of subsequent data is 4099 bytes; the parameter type field is "B", indicating that the subsequent data is a byte stream; the parameter length field is 4096, indicating that the parameters The value length is 4096 bytes; the parameter value part is audio data.

本发明的设备重定向方法实现简单,通用性强。在服务器上实现的是轻量虚拟驱动。与标准驱动相比,两者的设备文件的注册/注销和操作接口一致,但实际的设备操作却未执行,而是将应用的操作逻辑通过网络传输至终端,并将反馈返回至服务器上的应用。在这一通信过程中,虚拟驱动往往并不关心操作的细节,只是将设备访问逻辑通过网络传递至终端设备并原路返回。采用上述通信描述过程可以屏蔽不同设备访问细节的差异,具有很强的通用性;同时通过提供特定接口,对某些特殊需要的设备操作提供支持,具有较强的可扩展性;上述方式的通信逻辑清晰,服务代理和终端代理之间的网络通信采用智能网络应用协议的子集,即设备重定向协议。The device redirection method of the present invention is simple to realize and has strong versatility. What is implemented on the server is a lightweight virtual driver. Compared with the standard driver, the registration/deregistration and operation interface of the device files of the two are consistent, but the actual device operation is not executed, but the operation logic of the application is transmitted to the terminal through the network, and the feedback is returned to the server on the server. application. In this communication process, the virtual driver often does not care about the details of the operation, but only transmits the device access logic to the terminal device through the network and returns the same way. Using the above-mentioned communication description process can shield the differences in access details of different devices, which has strong versatility; at the same time, by providing specific interfaces, it can provide support for some special-needed device operations, and has strong scalability; the above-mentioned communication method The logic is clear, and the network communication between the service agent and the terminal agent adopts a subset of the intelligent network application protocol, that is, the device redirection protocol.

最后应说明的是:以上实施例仅用以说明而非限制本发明的技术方案,尽管参照上述实施例对本发明进行了详细说明,本领域的普通技术人员应当理解:依然可以对本发明进行修改或者等同替换,而不脱离本发明的精神和范围的任何修改或局部替换,其均应涵盖在本发明的权利要求范围当中。Finally, it should be noted that: the above embodiments are only used to illustrate and not limit the technical solutions of the present invention, although the present invention has been described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: the present invention can still be modified or Any modification or partial replacement without departing from the spirit and scope of the present invention shall fall within the scope of the claims of the present invention.

Claims (9)

1, the distributed apparatus Redirectional system in a kind of terminal network environment, it is characterized in that, comprise virtual drive module, service agent module and terminal proxy module, by using the passage of process virtual drive module, service agent module, terminal proxy module, terminal equipment driving and terminal equipment successively, the access logic of using equipment is reflected on the terminal equipment, and return according to described passage is contrary, wherein:
Virtual drive module is supported registration/cancellation, listening port and device file operation-interface, based on redirected agreement, and the data communication between realization and service agent module;
Service agent module is used to realize that the multi-user lands support, monitors the login user situation, judges to start the user who uses; Realize communication interface and protocol description between service agent module and virtual drive module and service agent module and terminal proxy module;
The terminal proxy module sends the user and lands request, communication interface and protocol description between realization and service agent module, and the analyzing device access logic is the operating terminal local device then.
2, the system as claimed in claim 1, it is characterized in that, virtual drive module comprises the registration interface unit, the port monitoring unit, device file operation-interface unit, equipment is opened interface unit, equipment I/O control interface unit, equipment is read interface unit, and equipment is write interface unit and device shutdown interface unit, wherein:
The registration interface unit is used to register primary and secondary equipment, and the support of kernel spacing multithreading is provided, and the port monitor function is provided in new thread;
The port monitoring unit is used to set up the redirected passage of virtual drive module to service agent module;
Device file operation-interface unit, be used for according to equipment open, the process of the control of equipment I/O, equipment read-write and device shutdown supports the standard device access interface;
Equipment is opened interface unit, be used for finishing the conversion of application process sign pid and session identification sid with service agent module, judge the user conversation of start using according to the result, and will open logical description and send to service agent module, and accept feedback from service agent module;
Equipment I/O control interface unit is used for the description of I/O control logic is sent to service agent module, and accepts the feedback from service agent module;
Equipment is read interface unit, be used for sending to service agent module with reading logical description, and acceptance is from the feedback of service agent module;
Equipment is write interface unit, will write logical description and send to service agent module, describes to comprise the data of writing to equipment, and accepts the feedback of service agent module;
The device shutdown interface unit is used for sending to service agent module with closing logical description, and accepts the feedback from service agent module.
3, system as claimed in claim 2 is characterized in that, the primary and secondary device number of described registration interface unit (ONU) registration is consistent with the device number of system standard equipment.
4, the system as claimed in claim 1, it is characterized in that, described service agent module comprises multiple line distance management unit and shared drive unit, communications interface unit between described service agent module and the virtual drive module, and service agent module is to the communications interface unit between the terminal proxy module, wherein:
The multiple line distance management unit is used to monitor and manage the session-context that a plurality of terminal uses land;
The shared drive unit is used for the recording user session identification;
Communications interface unit between service agent module and the virtual drive module is used for interactive user session identification and application process sign, makes up the device redirection passage between service agent module and virtual drive module, realizes the transmission of device access logic between the two;
Service agent module is used to make up the device redirection passage between service agent module and terminal proxy module to the communications interface unit of terminal proxy module, realizes the transmission of device access logic between the two.
5, the system as claimed in claim 1 is characterized in that, described terminal proxy module comprises terminal proxy module-service agent module communications interface unit, access logic resolution unit and device access unit, wherein:
Terminal proxy module-service agent module communications interface unit is used for sending the request of landing, and makes up the device redirection passage between terminal proxy module and service agent module;
The access logic resolution unit is used to analyze different access logics and describes;
The device access unit is used for according to analysis result access terminal local device, and the equipment of finishing the execution of terminal use's application program started is opened, I/O controls, equipment is read and write and shutoff operation, and the feedback of device access is returned service agent module.
6, the system as claimed in claim 1 is characterized in that, redirected agreement comprises device discovery, device description and device access, and wherein: device discovery is used to realize discovery, notice and the feedback to the terminal existing equipment; Device descriptor mainly is the concrete equipment that is used on the distinguishing terminal; Device access is used to the opening of the equipment of describing, I/O control, reads and writes and close logic.
7, the distributed apparatus reorientation method in a kind of terminal network environment may further comprise the steps:
A) load virtual driving;
B) start the service broker, foundation is connected with virtual driving;
C) user's telnet;
D) user starts application in the terminal applies environment;
E) application is sent the device access request to virtual driving, the forming device access logic;
F) the device access logic is passed to the service broker by virtual driving;
G) the device access logic is passed to the terminal agency by the service broker;
H) terminal proxy resolution access logic, and realize the local device visit.
8, method as claimed in claim 7 is characterized in that, in the step c), and by the service broker, the relation in virtual driving between recording conversation sign sid and communication port.
9, method as claimed in claim 7 is characterized in that, virtual driving realizes may further comprise the steps:
A1). receive system call from application system;
B1). judge the kind of system call, call if system call is open, then carry out next step, call if system call is ioctl, then execution in step d1), if for other calls, execution in step e1 then);
C1). obtain the port information with corresponding session communication, execution in step e1);
D1). judge the ioctl type, and handle accordingly execution in step e1);
E1). protocol interaction;
F1). call and return.
CNB200410073676XA 2004-08-31 2004-08-31 Distributed device reorienting system and method in terminal network environment Expired - Fee Related CN100512271C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB200410073676XA CN100512271C (en) 2004-08-31 2004-08-31 Distributed device reorienting system and method in terminal network environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB200410073676XA CN100512271C (en) 2004-08-31 2004-08-31 Distributed device reorienting system and method in terminal network environment

Publications (2)

Publication Number Publication Date
CN1744591A CN1744591A (en) 2006-03-08
CN100512271C true CN100512271C (en) 2009-07-08

Family

ID=36139785

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB200410073676XA Expired - Fee Related CN100512271C (en) 2004-08-31 2004-08-31 Distributed device reorienting system and method in terminal network environment

Country Status (1)

Country Link
CN (1) CN100512271C (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102103778B (en) * 2011-02-23 2014-04-30 中兴通讯股份有限公司 Mobile payment system, mobile terminal and method for realizing mobile payment service
CN102857535B (en) * 2011-07-01 2015-09-09 云联(北京)信息技术有限公司 A kind of computer processing unit, computer gateway, interactive system
CN102508796B (en) * 2011-10-14 2014-10-22 深圳市京华科讯科技有限公司 Serial port redirection method and system
CN102508795B (en) * 2011-10-14 2014-10-22 深圳市京华科讯科技有限公司 Parallel port redirection method and system
CN102915317B (en) * 2012-03-08 2016-01-20 北京金山安全软件有限公司 sound control method and device
CN103473110A (en) * 2012-06-08 2013-12-25 腾讯科技(深圳)有限公司 Equipment control method, device and system
CN106027487B (en) * 2016-04-28 2019-07-23 广州广电运通金融电子股份有限公司 A kind of access management method and system of hardware device
CN107613020B (en) 2017-10-16 2020-04-24 北京东土科技股份有限公司 Equipment management method and device
CN109982121B (en) * 2019-03-28 2021-07-06 烽火通信科技股份有限公司 Set top box, cloud virtual system and equipment redirection method
CN111885170B (en) * 2020-07-23 2022-03-11 平安科技(深圳)有限公司 Processing method and system of Internet of things control system, cloud server and medium
CN112422681B (en) * 2020-11-18 2023-01-13 中盈优创资讯科技有限公司 Cross-platform distributed communication calling method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1201943A (en) * 1997-06-04 1998-12-16 国际商业机器公司 Host Information Access via Distributed Programming Objects
CN1210308A (en) * 1997-06-04 1999-03-10 国际商业机器公司 Applet redirection for controlled access to non-originating hosts
CN1266321A (en) * 1998-09-21 2000-09-13 阿尔卡塔尔公司 Intelligent card, relative terminal, communication system and access remote application method
WO2001022238A1 (en) * 1999-09-21 2001-03-29 Wyse Technology Displaying windowing application programs on a terminal
US20030139931A1 (en) * 2002-01-21 2003-07-24 Samsung Electronics Co., Ltd. Client device of thin client network system and method of controlling the same

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1201943A (en) * 1997-06-04 1998-12-16 国际商业机器公司 Host Information Access via Distributed Programming Objects
CN1210308A (en) * 1997-06-04 1999-03-10 国际商业机器公司 Applet redirection for controlled access to non-originating hosts
CN1266321A (en) * 1998-09-21 2000-09-13 阿尔卡塔尔公司 Intelligent card, relative terminal, communication system and access remote application method
WO2001022238A1 (en) * 1999-09-21 2001-03-29 Wyse Technology Displaying windowing application programs on a terminal
US20030139931A1 (en) * 2002-01-21 2003-07-24 Samsung Electronics Co., Ltd. Client device of thin client network system and method of controlling the same

Also Published As

Publication number Publication date
CN1744591A (en) 2006-03-08

Similar Documents

Publication Publication Date Title
RU2504829C2 (en) Systems and methods for managing multimedia operations in remote sessions
CN100454283C (en) Virtual universal serial bus equipment system and data transmission method thereof
CN101582926B (en) Method for realizing redirection of playing remote media and system
CN100512271C (en) Distributed device reorienting system and method in terminal network environment
CN102549968B (en) The apparatus and method that interface is connected between remote UI server with remote user interface client
EA006814B1 (en) System and method for use of multiple applications
KR20110027845A (en) Session technology message extension
WO2015188575A1 (en) Video data providing method, video playback method, device, and system
CN110413418A (en) Cache synchronization device and method, cache synchronization system, electronic equipment
EP3804244A1 (en) Systems and methods for transport layer processing of server message block protocol messages
CN108055304A (en) Remote data synchronization method, device, server, equipment and storage medium
CN117294805A (en) Video conference cloud recording method and device, electronic equipment and storage medium
US11868819B2 (en) System and method for constructing filter graph-based media processing pipelines in a browser
CN116095397A (en) Live broadcast method, device, electronic device, and storage medium
CN110781014A (en) Multi-process distribution method and system for recording data based on Android device
Lohse et al. Network-integrated multimedia middleware (NMM)
CN104869133B (en) A kind of method of data record, system and access server
CN116132434A (en) A method and system for sharing a notebook camera device to a cloud desktop
CN114595080A (en) Data processing method, apparatus, electronic device, and computer-readable storage medium
CN101707595B (en) System and method for realizing mixed media information file transmission management in digital home
CN101441661A (en) System and method for sharing file resource between multiple embedded systems
US20080126752A1 (en) Dual-processor communication
CN113641679B (en) A data transfer method, data transfer system, computer equipment and medium
CN112286700B (en) Remote information interaction method and device
CN100574308C (en) Remote-apparatus access method in a kind of multi-node intelligent network application service system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
ASS Succession or assignment of patent right

Owner name: BEIJING AUMIWALKER TECHNOLOGY CO., LTD.

Free format text: FORMER OWNER: INSTITUTE OF COMPUTING TECHNOLOGY, CHINESE ACADEMY OF SCIENCES

Effective date: 20121205

C41 Transfer of patent application or patent right or utility model
COR Change of bibliographic data

Free format text: CORRECT: ADDRESS; FROM: 100080 HAIDIAN, BEIJING TO: 100071 FENGTAI, BEIJING

TR01 Transfer of patent right

Effective date of registration: 20121205

Address after: 100071, B402, 10 Spark Road, Fengtai District Science City, Beijing

Patentee after: Beijing Aumiwalker Technology Co.,Ltd.

Address before: 100080 Haidian District, Zhongguancun Academy of Sciences, South Road, No. 6, No.

Patentee before: Institute of Computing Technology, Chinese Academy of Sciences

C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20090708

Termination date: 20130831