WO2021189898A1 - 数据的协议转化方法、系统、电子设备及存储介质 - Google Patents
数据的协议转化方法、系统、电子设备及存储介质 Download PDFInfo
- Publication number
- WO2021189898A1 WO2021189898A1 PCT/CN2020/131975 CN2020131975W WO2021189898A1 WO 2021189898 A1 WO2021189898 A1 WO 2021189898A1 CN 2020131975 W CN2020131975 W CN 2020131975W WO 2021189898 A1 WO2021189898 A1 WO 2021189898A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- protocol
- data
- interface
- routing system
- protocol conversion
- 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.)
- Ceased
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/08—Protocols for interworking; Protocol conversion
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/541—Interprogram communication via adapters, e.g. between incompatible applications
Definitions
- This application relates to the field of data processing, and in particular to a data protocol conversion method, system, electronic device, and computer-readable storage medium.
- protocol data conversion methods include feature keyword protocol conversion methods, bit-type fixed format conversion methods, etc.
- protocol conversion function can be completed, different protocol conversion methods exist separately and rely on different operating environments. , Resulting in cumbersome configuration steps for configuring each protocol conversion method, resulting in a waste of data.
- a data protocol conversion method provided by this application includes:
- protocol conversion instructions entered by the user initialize the protocol stack and routing system
- the original protocol data is encapsulated to obtain the protocol encapsulated data, and the protocol encapsulated data is returned to the user according to the protocol conversion instruction.
- This application also provides a data protocol conversion system, wherein the system includes a network layer, a system layer, and a driver layer, wherein:
- the network layer is used to initialize the protocol stack and routing system according to the protocol conversion instruction input by the user;
- the system layer is used to create interface data calling functions in the routing system when the protocol stack and the routing system are initialized successfully;
- the driver layer is configured to use the interface data to call functions and obtain interface protocol data from the interface circuit;
- the network layer is also used to unseal the interface protocol data to obtain the original protocol data, and encapsulate the protocol original data according to the preset protocol rules and the protocol stack to obtain the protocol encapsulated data, according to the protocol
- the conversion instruction returns the protocol encapsulated data to the user.
- the present application also provides an electronic device, which includes: at least one processor; and,
- a memory communicatively connected with the at least one processor; wherein,
- the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute the following data protocol conversion method:
- protocol conversion instructions entered by the user initialize the protocol stack and routing system
- the original protocol data is encapsulated to obtain the protocol encapsulated data, and the protocol encapsulated data is returned to the user according to the protocol conversion instruction.
- the present application also provides a computer-readable storage medium, including a storage data area and a storage program area, wherein the storage data area stores created data, and the storage program area stores a computer program; wherein, the computer program is The following data protocol conversion method is realized when the processor is executed:
- protocol conversion instructions entered by the user initialize the protocol stack and routing system
- the original protocol data is encapsulated to obtain the protocol encapsulated data, and the protocol encapsulated data is returned to the user according to the protocol conversion instruction.
- FIG. 1 is a data interaction diagram of a data protocol conversion method provided by an embodiment of this application
- FIG. 2 is a schematic flowchart of a data protocol conversion method provided by an embodiment of this application.
- FIG. 3 is a detailed flowchart of S2 in the data protocol conversion method provided by an embodiment of this application;
- FIG. 4 is a detailed flowchart of S3 in the method for protocol conversion of data provided by an embodiment of this application;
- Figure 5 is a schematic diagram of a data protocol conversion system provided by an embodiment of the application.
- FIG. 6 is a schematic diagram of the internal structure of an electronic device that implements a data protocol conversion method provided by an embodiment of the application;
- the execution subject of the data protocol conversion method provided in the embodiments of the present application includes, but is not limited to, at least one of the electronic devices that can be configured to execute the method provided in the embodiments of the present application, such as a server and a terminal.
- the protocol conversion method of the data can be executed by software or hardware installed in the terminal device or the server device, and the software can be a blockchain platform.
- the server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc.
- the embodiment of this application relates to a data protocol conversion system and method.
- the core of this embodiment is to use the constructed data protocol conversion system to obtain protocol data from the interface circuit and convert the protocol data into designated protocol data, thereby solving
- the equipment where the different interface circuits are located has different protocols, which leads to the problem of difficulty in interaction.
- Figure 1 shows the data interaction process between the data protocol conversion system, the interface circuit and the user, including in detail:
- the user sends a protocol conversion instruction to the data protocol conversion system
- the data protocol conversion system obtains interface protocol data from the pre-bound interface circuit according to the protocol conversion instruction
- the data protocol conversion system After the data protocol conversion system obtains the interface protocol data, it performs protocol conversion on the interface protocol data in the data protocol conversion system.
- the data protocol conversion system includes an application layer, a network layer, a system layer, and a driver layer. in:
- the application layer 001 is mainly used to realize the interaction function with the user, such as receiving the protocol conversion instruction input by the user, parsing the protocol conversion instruction, and obtaining one or more interface circuits corresponding to the protocol conversion instruction.
- the network layer 002 is mainly used to realize the function of the protocol stack. It is used to initialize the protocol stack and routing system according to the protocol conversion instructions, and unpack the interface protocol data to obtain the original protocol data. According to the preset protocol rules and the protocol stack, the protocol stack is encapsulated According to the original data of the protocol, the encapsulated data of the protocol is obtained.
- the protocol stack (English: Protocolstack), also known as protocol stack, refers to the conversion method of the sum of each layer protocol in the network.
- Each layer protocol includes upper layer protocol, bottom layer protocol, etc., wherein the upper layer protocol is the protocol that the application layer depends on interacting with the user, and the bottom layer protocol is the protocol that the driver layer interacts with the interface circuit.
- protocol stack described in this application can use the currently published TCP/IP protocol, OSI protocol stack, ZigBee protocol stack, etc., such as encapsulating the code and function library that the OSI protocol stack depends on in the network layer, and provide Initialize protocol stack interface, data protocol conversion interface, etc.
- the system layer 003 mainly implements the function of creating interface data calling functions in the routing system.
- the system layer includes operating systems such as the routing system for the transmission of protocol data, the user operation application layer, the driver layer and the interface circuit connection, etc.
- the operating system in the system layer can be used to construct the interface data calling function.
- the protocol stack runs on the routing system.
- the driver layer 004 mainly uses the interface data to call functions and obtains interface protocol data from the interface circuit.
- the driver layer mainly includes drivers.
- the driver and the interface data can be used to call functions to drive the interface circuit to send out interface protocol data.
- the drivers include RS232 drivers, ZigBee drivers, CAN drivers, and so on.
- one of the embodiments of the present application also provides a data protocol conversion method.
- the process of the data protocol conversion method includes:
- the protocol stack can use the currently published TCP/IP protocol, OSI protocol stack, ZigBee protocol stack, etc., such as encapsulating the code and function library that the OSI protocol stack depends on, and providing An automatic initialization protocol stack interface, when receiving a protocol conversion instruction input by the user, the initialization protocol stack interface is automatically triggered, and the code and function library that the protocol stack depends on are verified whether the encapsulation is successful or not.
- the protocol conversion instructions are generally sent by the user to the application layer, and the data protocol conversion system is generally bound to multiple interface circuits, so it needs to be based on the protocol conversion instructions sent by the user.
- the S1 To determine which interface circuits the user needs to carry out data protocol conversion. Therefore, in detail, before the S1, it includes:
- the command line parser of the system layer such as the CMD parser under Windows, is automatically invoked to convert and analyze the protocol pre-built by the developer.
- the script and the input protocol conversion instruction are sent to the command line parser, and the protocol conversion instruction is automatically parsed, thereby obtaining the interface information of one or more interface circuits.
- the S1 includes:
- Step A Initialize the routing system, and when the routing system fails to initialize, re-receive the protocol conversion instruction input by the user;
- the initialization of the routing system includes cleaning up the cache of the routing system, checking the garbage collection timer, checking the security of the IP layer protocol, and so on.
- the Timer timer of the System.Threading class in the C++ programming language can be called. After the call is successful, the system garbage can be automatically recovered by running the Timer timer.
- a key system such as Kerberos
- use the key system to generate a temporary encryption key temporarily encrypt the data packet transmitted by the routing system, and read the encrypted data packet. Modify and insert verification to determine whether the IP layer protocol has passed the verification.
- Step B When the routing system is successfully initialized, obtain one or more interface circuit protocols supported by the interface circuit, and initialize the protocol stack according to the interface circuit protocol.
- the initialization of the protocol stack according to the interface circuit protocol includes:
- the routing system is used to start the process of the initialization function corresponding to the interface circuit protocol; according to the process of the initialization function, the protocol stack is sequentially initialized.
- kernel_thread is called in the routing system to start the process of the initialization function, and the function named do_basic_setup is called by this process to initialize the entrance of the Internet packet switching protocol of the TCP/IP protocol stack.
- the interface data call function is generated in the network layer.
- the creation of an interface data calling function in the routing system includes:
- the original data call function is:
- Define-call(Data-communication-protocol): means the calling function of data call API, its function name is API-call, and data-communication-protocol needs to be assigned, so the interface circuit protocol is assigned to Telnet protocol Call the API for the data, and call the function for the original data.
- compiling the original data calling function includes: using a compiler to compile the original data calling function to obtain an assembly calling function, and calling an assembler to convert the assembly calling function into the interface data calling function.
- the compiler is a program that translates a high-level language into a low-level language.
- the high-level language is the above-mentioned C++ programming language.
- the low-level language includes assembly language that can be directly operated by the computer. It is guaranteed that the original data call function will not make mistakes in the future.
- Assembler is a program that translates assembly language into programming language.
- the embodiment of the present application parses the protocol conversion instruction input by the user to obtain one or more interface circuits corresponding to the protocol conversion instruction, and the protocol corresponding to each interface circuit is different, such as the first interface circuit Corresponding to protocol A, the second interface circuit corresponds to protocol B, etc. Therefore, it is necessary to construct an interface data calling function corresponding to each interface circuit according to the interface circuit protocol corresponding to the interface circuit.
- the S3 includes:
- the embodiment of the present application activates the driver in the driver layer of the data protocol conversion system, and uses the driver to obtain the interface protocol data from the interface circuit.
- the interface protocol data can be divided into device status interface protocol data, device control interface protocol data, device start-stop interface protocol data, device rule issuance interface protocol data, device update interface protocol data, according to different interface circuits. Device timing interface protocol data, etc.
- the interface protocol data described in the embodiments of the present application need to be decapsulated according to the data format.
- the interface protocol data includes MAC data, IP data, TCP data, source data, etc., where the source data includes the runtime information of the interface circuit.
- the decapsulation includes splitting the interface protocol data into MAC data, IP data, TCP data, source data, etc., and recording the source data as protocol original data.
- the interface protocol data struct _MAC_FRAME_HEADER is transmitted in the following order:
- typedefstruct _MAC_FRAME_HEADER ⁇ charm_cDstMacAddress;charm_cSrcMacAddress; //mac data shortm_cType; //IP protocol and data ⁇ _
- the MAC data and IP data can be parsed from struct _MAC_FRAME_HEADER, and so on, to obtain the original data of the protocol.
- the embodiment of the present application uses the operating system in the system layer to input the original data of the protocol into the network layer for encapsulation.
- the encapsulation methods are different, such as the protocol
- the original data is encapsulated in the head and tail of a set of protocols, and the original data of the protocol is encapsulated in the head and tail of a set of protocols, which is called a preset protocol rule.
- the obtained protocol encapsulated data is returned to the user.
- the embodiment of the application first initializes the protocol stack and the routing system according to the protocol conversion instructions, where the protocol stack includes the various layer protocols in the network and the conversion methods that each layer protocol depends on.
- the protocol stack and the protocol stack are initialized at the same time
- the interface protocol data is obtained from the interface circuit according to the interface data calling function, and the interface protocol data is converted according to the protocol stack. Because the protocol stack relies on the routing system, the routing system can support interface data calling functions, and obtain interface protocol data from the interface circuit.
- the data protocol conversion method, system and computer-readable storage medium proposed in this application are It can solve the problem of cumbersome configuration in data conversion, which causes data waste.
- FIG. 5 it is a schematic diagram of the modules of the data protocol conversion system of the present application.
- the data protocol conversion system 100 described in the embodiment of the present application may be installed in an electronic device.
- the data protocol conversion system may include a network layer 101, a system layer 102, and a driver layer 103.
- the module described in the present invention can also be called a unit, which refers to a series of computer program segments that can be executed by the processor of an electronic device and can complete fixed functions, and are stored in the memory of the electronic device.
- each module/unit is as follows:
- the network layer 101 is used to initialize the protocol stack and routing system according to the protocol conversion instructions input by the user.
- the protocol stack can use the currently published TCP/IP protocol, OSI protocol stack, ZigBee protocol stack, etc., such as encapsulating the code and function library that the OSI protocol stack depends on, and providing An automatic initialization protocol stack interface, when receiving a protocol conversion instruction input by the user, the initialization protocol stack interface is automatically triggered, and the code and function library that the protocol stack depends on are verified whether the encapsulation is successful or not.
- the data protocol conversion system further includes an application layer 104 for parsing the protocol conversion instruction to obtain interface information of one or more interface circuits corresponding to the protocol conversion instruction.
- Protocol conversion instructions are generally sent by the user to the application layer 104, and the data protocol conversion system generally binds multiple interface circuits. Therefore, it is necessary to determine which interface circuits the user needs to perform data protocol conversion on according to the protocol conversion instructions sent by the user.
- the command line parser of the system layer such as the CMD parser under Windows, is automatically invoked to convert and analyze the protocol pre-built by the developer.
- the script and the input protocol conversion instruction are sent to the command line parser, and the protocol conversion instruction is automatically parsed, thereby obtaining the interface information of one or more interface circuits.
- the initialization of the protocol stack and the routing system according to the protocol conversion instruction input by the user includes:
- Step A Initialize the routing system, and when the routing system fails to initialize, re-receive the protocol conversion instruction input by the user;
- the initialization of the routing system includes cleaning up the cache of the routing system, checking the garbage collection timer, checking the security of the IP layer protocol, and so on.
- the Timer timer of the System.Threading class in the C++ programming language can be called. After the call is successful, the system garbage can be automatically recovered by running the Timer timer.
- a key system such as Kerberos
- use the key system to generate a temporary encryption key temporarily encrypt the data packet transmitted by the routing system, and read the encrypted data packet. Modify and insert verification to determine whether the IP layer protocol has passed the verification.
- Step B When the routing system is successfully initialized, obtain one or more interface circuit protocols supported by the interface circuit, and initialize the protocol stack according to the interface circuit protocol.
- the initialization of the protocol stack according to the interface circuit protocol includes:
- the routing system is used to start the process of the initialization function corresponding to the interface circuit protocol; according to the process of the initialization function, the protocol stack is sequentially initialized.
- kernel_thread is called in the routing system to start the process of the initialization function, and the function named do_basic_setup is called by this process to initialize the entrance of the Internet packet switching protocol of the TCP/IP protocol stack.
- the system layer 102 is used for creating interface data calling functions in the routing system when the protocol stack and the routing system are initialized successfully.
- creating an interface data calling function in the routing system includes: using the interface circuit protocol as an input parameter of a pre-built data calling API to generate a raw data calling function; compiling the raw data calling function to obtain The interface data calls the function.
- the original data call function is:
- Define-call(Data-communication-protocol): means the calling function of data call API, its function name is API-call, and data-communication-protocol needs to be assigned, so the interface circuit protocol is assigned to Telnet protocol Call the API for the data, and call the function for the original data.
- compiling the original data calling function includes: using a compiler to compile the original data calling function to obtain an assembly calling function, and calling an assembler to convert the assembly calling function into the interface data calling function.
- the compiler is a program that translates a high-level language into a low-level language.
- the high-level language is the above-mentioned C++ programming language.
- the low-level language includes assembly language that can be directly operated by the computer. It is guaranteed that the original data call function will not make mistakes in the future.
- Assembler is a program that translates assembly language into programming language.
- the embodiment of the present application parses the protocol conversion instruction input by the user to obtain one or more interface circuits corresponding to the protocol conversion instruction, and the protocol corresponding to each interface circuit is different, such as the first interface circuit Corresponding to protocol A, the second interface circuit corresponds to protocol B, etc. Therefore, it is necessary to construct an interface data calling function corresponding to each interface circuit according to the interface circuit protocol corresponding to the interface circuit.
- the driver layer 103 is used to call functions using the interface data, and obtain interface protocol data from the interface circuit.
- using the interface data to call a function and obtaining interface protocol data from an interface circuit includes: using the interface data to call a function to start a pre-built driver; and using the driver to obtain the interface protocol data from the corresponding interface circuit.
- Interface protocol data
- the embodiment of the present application activates the driver in the driver layer of the data protocol conversion system, and uses the driver to obtain the interface protocol data from the interface circuit.
- the interface protocol data can be divided into device status interface protocol data, device control interface protocol data, device start-stop interface protocol data, device rule issuance interface protocol data, device update interface protocol data, according to different interface circuits. Device timing interface protocol data, etc.
- the network layer 101 is also used to decapsulate the interface protocol data to obtain the original protocol data, and encapsulate the protocol original data according to the preset protocol rules and the protocol stack to obtain the protocol encapsulated data, according to the The protocol conversion instruction returns the protocol encapsulated data to the user.
- the interface protocol data described in the embodiments of the present application need to be decapsulated according to the data format.
- the interface protocol data includes MAC data, IP data, TCP data, source data, etc., where the source data includes the runtime information of the interface circuit.
- the decapsulation includes splitting the interface protocol data into MAC data, IP data, TCP data, source data, etc., and recording the source data as protocol original data.
- the interface protocol data struct _MAC_FRAME_HEADER is transmitted in the following order:
- typedefstruct _MAC_FRAME_HEADER ⁇ charm_cDstMacAddress;charm_cSrcMacAddress; //mac data shortm_cType; //IP protocol and data ⁇ _
- the MAC data and IP data can be parsed from struct _MAC_FRAME_HEADER, and so on, to obtain the original data of the protocol.
- the embodiment of the present application uses the operating system in the system layer to input the original data of the protocol into the network layer for encapsulation.
- the encapsulation methods are different, for example, the protocol
- the original data is encapsulated in the head and tail of a set of protocols
- the original data of the protocol is encapsulated in the head and tail of a set of protocols, which is called a preset protocol rule, and then the protocol is converted according to the protocol conversion instruction entered by the user.
- the packaged data is returned to the user.
- FIG. 6 it is a schematic diagram of the structure of an electronic device that implements the data protocol conversion method of the present application.
- the electronic device 1 may include a processor 10, a memory 11, and a bus, and may also include a computer program stored in the memory 11 and running on the processor 10, such as a data protocol conversion program 12.
- the memory 11 includes at least one type of readable storage medium, and the readable storage medium may be volatile or nonvolatile.
- the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc.
- the memory 11 may be an internal storage unit of the electronic device 1 in some embodiments, for example, a mobile hard disk of the electronic device 1.
- the memory 11 may also be an external storage device of the electronic device 1, such as a plug-in mobile hard disk, a smart memory card (SmartMediaCard, SMC), and a secure digital (SecureDigital, SD) equipped on the electronic device 1. Card, flash card (FlashCard), etc.
- the memory 11 may also include both an internal storage unit of the electronic device 1 and an external storage device.
- the memory 11 can be used not only to store application software and various data installed in the electronic device 1, such as the code of the data protocol conversion program 12, etc., but also to temporarily store data that has been output or will be output.
- the processor 10 may be composed of integrated circuits in some embodiments, for example, may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits with the same function or different functions, including one or more Combinations of central processing unit (CentralProcessingunit, CPU), microprocessor, digital processing chip, graphics processor and various control chips, etc.
- the processor 10 is the control core (ControlUnit) of the electronic device, which uses various interfaces and lines to connect the various components of the entire electronic device, and runs or executes programs or modules (such as execution data) stored in the memory 11 Protocol conversion program, etc.), and call the data stored in the memory 11 to execute various functions of the electronic device 1 and process data.
- ControlUnit ControlUnit
- the bus may be a peripheral component interconnection standard (peripheral component interconnect, referred to as PCI) bus or an extended industry standard architecture (extended industry standard architecture, referred to as EISA) bus, etc.
- PCI peripheral component interconnect
- EISA extended industry standard architecture
- the bus can be divided into address bus, data bus, control bus and so on.
- the bus is configured to implement connection and communication between the memory 11 and at least one processor 10 and the like.
- FIG. 6 only shows an electronic device with components. Those skilled in the art can understand that the structure shown in FIG. 5 does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown Components, or a combination of certain components, or different component arrangements.
- the electronic device 1 may also include a power source (such as a battery) for supplying power to various components.
- the power source may be logically connected to the at least one processor 10 through a power management device, thereby controlling power
- the device implements functions such as charge management, discharge management, and power consumption management.
- the power supply may also include any components such as one or more DC or AC power supplies, recharging devices, power failure detection circuits, power converters or inverters, and power status indicators.
- the electronic device 1 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
- the electronic device 1 may also include a network interface.
- the network interface may include a wired interface and/or a wireless interface (such as a Wi-Fi interface, a Bluetooth interface, etc.), which is usually used in the electronic device 1 Establish a communication connection with other electronic devices.
- the electronic device 1 may also include a user interface.
- the user interface may be a display (Display) and an input unit (such as a keyboard (Keyboard)).
- the user interface may also be a standard wired interface or a wireless interface.
- the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc.
- the display can also be appropriately called a display screen or a display unit, which is used to display the information processed in the electronic device 1 and to display a visualized user interface.
- the protocol conversion program 12 of the data stored in the memory 11 in the electronic device 1 is a combination of multiple instructions. When running in the processor 10, it can realize:
- protocol conversion instructions entered by the user initialize the protocol stack and routing system
- the original protocol data is encapsulated to obtain the protocol encapsulated data, and the protocol encapsulated data is returned to the user according to the protocol conversion instruction.
- the integrated module/unit of the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
- the computer-readable storage medium may be volatile or non-volatile.
- the computer-readable storage medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read -OnlyMemory).
- the computer usable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function, etc.; the storage data area may store a block chain node Use the created data, etc.
- modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
- the functional modules in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
- the above-mentioned integrated unit may be implemented in the form of hardware, or may be implemented in the form of hardware plus software functional modules.
- the blockchain referred to in this application is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
- Blockchain essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information for verification. The validity of the information (anti-counterfeiting) and the generation of the next block.
- the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Communication Control (AREA)
Abstract
一种数据的协议转化方法,涉及数据处理领域,包括:根据用户输入的协议转化指令,初始化协议栈及路由系统(S1),当所述协议栈及所述路由系统初始化成功时,在所述路由系统内创建接口数据调用函数(S2),利用所述接口数据调用函数,从接口电路中获取接口协议数据(S3),解封所述接口协议数据,得到协议原始数据(S4),根据预先设定的协议规则及所述协议栈,封装所述协议原始数据,得到协议封装数据,根据所述协议转化指令,将所述协议封装数据返回至用户(S5)。还涉及区块链技术,所述协议封装数据可以存储在区块链节点中。还涉及一种数据的协议转化系统(100)、电子设备(1)及存储介质。可以解决协议转化时配置步骤繁琐,进而造成资料浪费的问题。
Description
本申请要求于2020年10月09日提交中国专利局、申请号为202011073525.X,发明名称为“数据的协议转化方法、系统、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及数据处理领域,尤其涉及一种数据的协议转化方法、系统、电子设备及计算机可读存储介质。
随着科技的快速发展,对各种设备的交互性要求也随之提高,但由于不同设备所依赖的协议不尽相同,因此在交互之前需统一设备的协议数据。
发明人意识到,目前常用的协议数据转化包括特征关键字协议转化方法、比特型固定格式转化方法等,虽然可以完成协议转化功能,但由于不同协议转化方法单独存在,且所依赖的运行环境不同,导致配置各协议转化方法的配置步骤繁琐,进而造成资料浪费。
本申请提供的一种数据的协议转化方法,包括:
根据用户输入的协议转化指令,初始化协议栈及路由系统;
当所述协议栈及所述路由系统初始化成功时,在所述路由系统内创建接口数据调用函数;
利用所述接口数据调用函数,从接口电路中获取接口协议数据;
解封所述接口协议数据,得到协议原始数据;
根据预先设定的协议规则及所述协议栈,封装所述协议原始数据,得到协议封装数据,根据所述协议转化指令,将所述协议封装数据返回至用户。
本申请还提供一种数据协议转化系统,其中,所述系统包括网络层、系统层及驱动层,其中:
所述网络层,用于根据用户输入的协议转化指令,初始化协议栈及路由系统;
所述系统层,用于当所述协议栈及所述路由系统初始化成功时,在所述路由系统内创建接口数据调用函数;
所述驱动层,用于利用所述接口数据调用函数,从接口电路中获取接口协议数据;
所述网络层,还用于解封所述接口协议数据,得到协议原始数据,根据预先设定的协议规则及所述协议栈,封装所述协议原始数据,得到协议封装数据,根据所述协议转化指令,将所述协议封装数据返回至用户。
本申请还提供一种电子设备,所述电子设备包括:至少一个处理器;以及,
与所述至少一个处理器通信连接的存储器;其中,
所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如下所述的数据的协议转化方法:
根据用户输入的协议转化指令,初始化协议栈及路由系统;
当所述协议栈及所述路由系统初始化成功时,在所述路由系统内创建接口数据调用函数;
利用所述接口数据调用函数,从接口电路中获取接口协议数据;
解封所述接口协议数据,得到协议原始数据;
根据预先设定的协议规则及所述协议栈,封装所述协议原始数据,得到协议封装数据,根据所述协议转化指令,将所述协议封装数据返回至用户。
本申请还提供一种计算机可读存储介质,包括存储数据区和存储程序区,其中,所述存储数据区存储创建的数据,所述存储程序区存储有计算机程序;其中,所述计算机程序被处理器执行时实现如下所述的数据的协议转化方法:
根据用户输入的协议转化指令,初始化协议栈及路由系统;
当所述协议栈及所述路由系统初始化成功时,在所述路由系统内创建接口数据调用函数;
利用所述接口数据调用函数,从接口电路中获取接口协议数据;
解封所述接口协议数据,得到协议原始数据;
根据预先设定的协议规则及所述协议栈,封装所述协议原始数据,得到协议封装数据,根据所述协议转化指令,将所述协议封装数据返回至用户。
图1为本申请一实施例提供的数据的协议转化方法的数据交互图;
图2为本申请一实施例提供的数据的协议转化方法的流程示意图;
图3为本申请一实施例提供的数据的协议转化方法中S2的详细流程示意图;
图4为本申请一实施例提供的数据的协议转化方法中S3的详细流程示意图;
图5为本申请一实施例提供的数据协议转化系统的示意图
图6为本申请一实施例提供的实现数据的协议转化方法的电子设备的内部结构示意图;
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请实施例提供的数据的协议转化方法的执行主体包括但不限于服务端、终端等能够被配置为执行本申请实施例提供的该方法的电子设备中的至少一种。换言之,所述数据的协议转化方法可以由安装在终端设备或服务端设备的软件或硬件来执行,所述软件可以是区块链平台。所述服务端包括但不限于:单台服务器、服务器集群、云端服务器或云端服务器集群等。
本申请的实施方式涉及一种数据的协议转化系统及方法,本实施方式的核心在于利用构建的数据协议转化系统,从接口电路中获取协议数据,并将协议数据转化为指定协议数据,从而解决不同接口电路所在设备因协议不同,导致交互困难的问题。
下面对本实施方式的数据的协议转化实现细节进行具体的说明,以下内容仅为方便理解提供的实现细节,并非实施本方案的必须。
本申请实施例如图1所示,展示了所述数据协议转化系统、接口电路与用户之间的数据交互过程,详细地包括:
用户向数据协议转化系统发送协议转化指令;
所述数据协议转化系统根据所述协议转化指令,向预先绑定的接口电路中获取接口协议数据;
当所述数据协议转化系统获取到所述接口协议数据后,在所述数据协议转化系统内,对所述接口协议数据进行协议转化。
进一步地,如图1所示,所述数据协议转化系统包括应用层、网络层、系统层及驱动层。其中:
应用层001主要用来实现与用户的交互功能,如接收用户输入的所述协议转化指令,解析所述协议转化指令,得到与所述协议转化指令对应的一个或多个接口电路。
网络层002主要用来实现协议栈功能,用于根据协议转化指令,初始化协议栈及路由系统、解封接口协议数据得到协议原始数据,根据预先设定的协议规则及所述协议栈,封装所述协议原始数据,得到协议封装数据。其中协议栈(英语:Protocolstack)又称协议堆叠,是指网络中各层协议的总和各层协议所依赖的转化方法。各层协议包括上层协议、底层协议等,其中上层协议如应用层与用户交互所依赖的协议,底层协议如驱动层与接口电路交互的协议等。进一步地,本申请所述协议栈可使用当前已公开的TCP/IP协议、OSI协议栈及ZigBee协议栈等,如将OSI协议栈所依赖的代码、函数库等封装在网络层中,并提供初始化协议栈接口、数据协议转化接口等。
系统层003主要实现在所述路由系统内创建接口数据调用函数的功能。其中,由于系统层中包括协议数据之间传输的路由系统、用户操作应用层、驱动层与接口电路连接等操作系统,因此可利用系统层内的操作系统,构建出接口数据调用函数。较佳地,所述协议栈运行在所述路由系统上。
驱动层004主要利用所述接口数据调用函数,从接口电路中获取接口协议数据,驱动层主要包括驱动器,可利用所述驱动器及所述接口数据调用函数,驱动接口电路发送出接口协议数据。所述驱动器包括RS232驱动器、ZigBee驱动器、CAN驱动器等。
进一步地,本申请其中一实施例还提供一种数据的协议转化方法,参照图2所示,在本实施例中,所述数据的协议转化方法的流程包括:
S1、根据用户输入的协议转化指令,初始化协议栈及路由系统。
本申请较佳实施例中,所述协议栈可使用当前已公开的TCP/IP协议、OSI协议栈及ZigBee协议栈等,如将OSI协议栈所依赖的代码、函数库等进行封装,并提供一个自动化的初始化协议栈接口,当接受到用户输入的协议转化指令,自动触发所述初始化协议栈接口,校验协议栈所依赖的代码、函数库是否封装成功等。
另外,根据上述图1中关于数据协议转化系统的数据交互可知,协议转化指令一般由用户发送至应用层,且数据协议转化系统一般绑定多个接口电路,因此需根据用户发送的协议转化指令,确定用户需要对哪些接口电路进行数据协议转化。故详细地,在所述S1之前包括:
接收用户输入的协议转化指令,解析所述协议转化指令,得到与所述协议转化指令对应的一个或多个接口电路的接口信息。
详细地,本申请较佳实施例中,当接收用户输入的协议转化指令后,自动调用所述系统层的命令行解析器,如Windows下的CMD解析器,将开发人员预先构建的协议转化解析脚本及输入协议转化指令至命令行解析器中,自动解析所述协议转化指令,从而得到一个或多个接口电路的接口信息。
进一步地,当得到与所述协议转化指令对应的一个或多个接口电路后,所述S1包括:
步骤A、初始化所述路由系统,当所述路由系统初始化失败时,重新接收用户输入的协议转化指令;
由于所述可知,协议栈运行在路由系统上,所以在对协议栈初始化之前,需先完成路由系统的初始化,防止路由系统故障导致协议栈初始化出现问题。
进一步地,所述路由系统的初始化包括清理所述路由系统的缓存、校验垃圾回收定时器、校验IP层协议安全性等。
本申请较佳实施例中,可调用C++编程语言中System.Threading类的Timer定时器,当调用成功后,通过运行Timer定时器可自动回收系统垃圾。另外,使用密钥系统(如Kerberos)校验IP层协议安全性,利用密钥系统生成临时加密密钥,将路由系统传送的数据包进行临时加密,并将加密后的数据包进行读取、修改和插入验证,判断IP层协议是否校验通过。
步骤B、当所述路由系统初始化成功时,获取一个或多个所述接口电路所支持的接口电路协议,根据所述接口电路协议,初始化所述协议栈。
详细地,所述根据所述接口电路协议,初始化所述协议栈,包括:
利用所述路由系统开启与所述接口电路协议对应的初始化函数的进程;根据所述初始化函数的进程,依次初始化所述协议栈。
如在路由系统中调用名为kernel_thread的内核,启动了初始化函数的进程,利用该进程调用名为do_basic_setup的函数,初始化TCP/IP协议栈的互联网分组交换协议的入口。
S2、当所述协议栈及所述路由系统初始化成功时,在所述路由系统内创建接口数据调用函数。
本申请实施例中,当路由系统及协议栈初始化成功后,在所述网络层中生成接口数据调用函数。详细地,参阅图3所示,所述在所述路由系统内创建接口数据调用函数,包括:
S21、将所述接口电路协议作为预构建的数据调用API的输入参数,生成原始数据调用函数;
如原始数据调用函数为:
DefAPI-call(Data-communication-protocol):
Data-communication-protocol = Telnet
其中,“DefAPI-call(Data-communication-protocol):”表示数据调用API的调用函数,其函数名为API-call,且需要给Data-communication-protocol赋值,因此将接口电路协议为Telnet协议赋值给数据调用API,得到原始数据调用函数。
S22、编译所述原始数据调用函数,得到所述接口数据调用函数。
详细地,编译所述原始数据调用函数包括:利用编译器编译所述原始数据调用函数,得到汇编调用函数,调用汇编器将所述汇编调用函数变为所述接口数据调用函数。
所述编译器是一种将高级语言翻译为低级语言的程序,高级语言如上述的C++编程语言,低级语言包括计算机可直接操作的汇编语言,编译是为了让计算机可以试运行原始数据调用函数,保障原始数据调用函数在后续不会出错。汇编器(Assembler)是将汇编语言翻译为编程语言的程序。
由上所述,本申请实施例解析用户输入的协议转化指令,得到与所述协议转化指令对应的一个或多个接口电路,而每个接口电路对应的协议不尽相同,如第一接口电路对应协议A、第二接口电路对应协议B等,因此需要根据接口电路对应的接口电路协议,构建出符合每个接口电路对应的接口数据调用函数。
S3、利用所述接口数据调用函数,从接口电路中获取接口协议数据。
详细地,参阅图4所示,所述S3包括:
S31、利用所述接口数据调用函数,启动预构建的驱动器;
S32、利用所述驱动器从对应的接口电路中获取所述接口协议数据。
如上所述,本申请实施例启动数据协议转化系统中驱动层内的驱动器,利用所述驱动器从接口电路中获取所述接口协议数据。
详细地,所述接口协议数据按照接口电路的不同,可分为设备状态接口协议数据、设备控制接口协议数据、设备启停接口协议数据、设备规则下发接口协议数据、设备更新接口协议数据、设备定时接口协议数据等。
S4、解封所述接口协议数据,得到协议原始数据。
优选地,本申请实施例中所述接口协议数据需要根据数据形式进行对应解封,如接口协议数据包括MAC数据、IP数据、TCP数据及源数据等,其中源数据包括接口电路的运行时的运行数据,则所述解封包括将接口协议数据拆分为MAC数据、IP数据、TCP数据及源数据等,并将源数据记录为协议原始数据。
如接口协议数据struct _MAC_FRAME_HEADER以如下顺序进行传送:
typedefstruct _MAC_FRAME_HEADER
{charm_cDstMacAddress;charm_cSrcMacAddress; //mac数据shortm_cType; //IP协议及数据}_
则按照顺序可对应从struct _MAC_FRAME_HEADER解析出MAC数据和IP数据,以此类推,从而得到协议原始数据。
S5、根据预先设定的协议规则及所述协议栈,封装所述协议原始数据,得到协议封装数据,根据所述协议转化指令,将所述协议封装数据返回至用户。
详细地,当得到所述协议原始数据后,本申请实施例利用系统层内的操作系统,将所述协议原始数据输入至网络层中进行封装,所述封装的方法不尽相同,如将协议原始数据封装在一组协议的头和尾中,则将协议原始数据封装在一组协议的头和尾中称为预先设定的协议规则。进而根据用户输入的协议转化指令,将得到的协议封装数据返回至用户。
本申请实施例先根据协议转化指令,初始化协议栈及路由系统,其中协议栈包括网络中各层协议及各层协议所依赖的转化方法,为了保证协议栈运行无误,同时初始化协议栈及协议栈所在的路由系统,当协议栈及路由系统初始化成功后,根据接口数据调用函数从接口电路中获取接口协议数据,并根据所述协议栈转化所述接口协议数据。因协议栈依赖路由系统,而路由系统可支持接口数据调用函数,从接口电路中获取接口协议数据,在得到接口协议数据后,利用协议栈内的转化方法进行数据转化,可见整个转化过程自动化程度高,不用因为不同协议转化方法而单独配置运行环境,解决了在数据转化中配置步骤繁琐、进而造成资料浪费的问题,故本申请提出的数据的协议转化方法、系统及计算机可读存储介质,可以解决在数据转化中配置繁琐、进而造成资料浪费的问题。
如图5所示,是本申请数据协议转化系统的模块示意图。
本申请实施例所述数据协议转化系统100可以安装于电子设备中。根据实现的功能,所述数据协议转化系统可以包括网络层101、系统层102、驱动层103。本发所述模块也可以称之为单元,是指一种能够被电子设备处理器所执行,并且能够完成固定功能的一系列计算机程序段,其存储在电子设备的存储器中。
在本申请实施例中,关于各模块/单元的功能如下:
所述网络层101用于根据用户输入的协议转化指令,初始化协议栈及路由系统。
本申请较佳实施例中,所述协议栈可使用当前已公开的TCP/IP协议、OSI协议栈及ZigBee协议栈等,如将OSI协议栈所依赖的代码、函数库等进行封装,并提供一个自动化的初始化协议栈接口,当接受到用户输入的协议转化指令,自动触发所述初始化协议栈接口,校验协议栈所依赖的代码、函数库是否封装成功等。
详细地,所述数据协议转化系统还包括应用层104,用于解析所述协议转化指令,得到与所述协议转化指令对应的一个或多个接口电路的接口信息。
协议转化指令一般由用户发送至应用层104,且数据协议转化系统一般绑定多个接口电路,因此需根据用户发送的协议转化指令,确定用户需要对哪些接口电路进行数据协议转化。
详细地,本申请较佳实施例中,当接收用户输入的协议转化指令后,自动调用所述系统层的命令行解析器,如Windows下的CMD解析器,将开发人员预先构建的协议转化解析脚本及输入协议转化指令至命令行解析器中,自动解析所述协议转化指令,从而得到一个或多个接口电路的接口信息。
进一步地,当得到与所述协议转化指令对应的一个或多个接口电路后,所述根据用户输入的协议转化指令,初始化协议栈及路由系统包括:
步骤A、初始化所述路由系统,当所述路由系统初始化失败时,重新接收用户输入的协议转化指令;
由于所述可知,协议栈运行在路由系统上,所以在对协议栈初始化之前,需先完成路由系统的初始化,防止路由系统故障导致协议栈初始化出现问题。
进一步地,所述路由系统的初始化包括清理所述路由系统的缓存、校验垃圾回收定时器、校验IP层协议安全性等。
本申请较佳实施例中,可调用C++编程语言中System.Threading类的Timer定时器,当调用成功后,通过运行Timer定时器可自动回收系统垃圾。另外,使用密钥系统(如Kerberos)校验IP层协议安全性,利用密钥系统生成临时加密密钥,将路由系统传送的数据包进行临时加密,并将加密后的数据包进行读取、修改和插入验证,判断IP层协议是否校验通过。
步骤B、当所述路由系统初始化成功时,获取一个或多个所述接口电路所支持的接口电路协议,根据所述接口电路协议,初始化所述协议栈。
详细地,所述根据所述接口电路协议,初始化所述协议栈,包括:
利用所述路由系统开启与所述接口电路协议对应的初始化函数的进程;根据所述初始化函数的进程,依次初始化所述协议栈。
如在路由系统中调用名为kernel_thread的内核,启动了初始化函数的进程,利用该进程调用名为do_basic_setup的函数,初始化TCP/IP协议栈的互联网分组交换协议的入口。
所述系统层102用于当所述协议栈及所述路由系统初始化成功时,在所述路由系统内创建接口数据调用函数。
本申请实施例中,当路由系统及协议栈初始化成功后,在所述网络层中生成接口数据调用函数。详细地所述在所述路由系统内创建接口数据调用函数,包括:将所述接口电路协议作为预构建的数据调用API的输入参数,生成原始数据调用函数;编译所述原始数据调用函数,得到所述接口数据调用函数。
如原始数据调用函数为:
DefAPI-call(Data-communication-protocol):
Data-communication-protocol = Telnet
其中,“DefAPI-call(Data-communication-protocol):”表示数据调用API的调用函数,其函数名为API-call,且需要给Data-communication-protocol赋值,因此将接口电路协议为Telnet协议赋值给数据调用API,得到原始数据调用函数。
详细地,编译所述原始数据调用函数包括:利用编译器编译所述原始数据调用函数,得到汇编调用函数,调用汇编器将所述汇编调用函数变为所述接口数据调用函数。
所述编译器是一种将高级语言翻译为低级语言的程序,高级语言如上述的C++编程语言,低级语言包括计算机可直接操作的汇编语言,编译是为了让计算机可以试运行原始数据调用函数,保障原始数据调用函数在后续不会出错。汇编器(Assembler)是将汇编语言翻译为编程语言的程序。
由上所述,本申请实施例解析用户输入的协议转化指令,得到与所述协议转化指令对应的一个或多个接口电路,而每个接口电路对应的协议不尽相同,如第一接口电路对应协议A、第二接口电路对应协议B等,因此需要根据接口电路对应的接口电路协议,构建出符合每个接口电路对应的接口数据调用函数。
所述驱动层103用于利用所述接口数据调用函数,从接口电路中获取接口协议数据。
详细地,所述利用所述接口数据调用函数,从接口电路中获取接口协议数据包括:利用所述接口数据调用函数,启动预构建的驱动器;利用所述驱动器从对应的接口电路中获取所述接口协议数据。
如上所述,本申请实施例启动数据协议转化系统中驱动层内的驱动器,利用所述驱动器从接口电路中获取所述接口协议数据。
详细地,所述接口协议数据按照接口电路的不同,可分为设备状态接口协议数据、设备控制接口协议数据、设备启停接口协议数据、设备规则下发接口协议数据、设备更新接口协议数据、设备定时接口协议数据等。
所述网络层101,还用于解封所述接口协议数据,得到协议原始数据,根据预先设定的协议规则及所述协议栈,封装所述协议原始数据,得到协议封装数据,根据所述协议转化指令,将所述协议封装数据返回至用户。
优选地,本申请实施例中所述接口协议数据需要根据数据形式进行对应解封,如接口协议数据包括MAC数据、IP数据、TCP数据及源数据等,其中源数据包括接口电路的运行时的运行数据,则所述解封包括将接口协议数据拆分为MAC数据、IP数据、TCP数据及源数据等,并将源数据记录为协议原始数据。
如接口协议数据struct _MAC_FRAME_HEADER以如下顺序进行传送:
typedefstruct _MAC_FRAME_HEADER
{charm_cDstMacAddress;charm_cSrcMacAddress; //mac数据shortm_cType; //IP协议及数据}_
则按照顺序可对应从struct _MAC_FRAME_HEADER解析出MAC数据和IP数据,以此类推,从而得到协议原始数据。
详细地,当得到所述协议原始数据后,本申请实施例利用系统层内的操作系统,将所述协议原始数据输入至网络层中进行封装,所述封装的方法不尽相同,如将协议原始数据封装在一组协议的头和尾中,则将协议原始数据封装在一组协议的头和尾中称为预先设定的协议规则,进而根据用户输入的协议转化指令,将得到的协议封装数据返回至用户。
如图6所示,是本申请实现数据的协议转化方法的电子设备的结构示意图。
所述电子设备1可以包括处理器10、存储器11和总线,还可以包括存储在所述存储器11中并可在所述处理器10上运行的计算机程序,如数据的协议转化程序12。
其中,所述存储器11至少包括一种类型的可读存储介质,所述可读存储介质可以是易失性的,也可以是非易失性的。具体的,所述可读存储介质包括闪存、移动硬盘、多媒体卡、卡型存储器(例如:SD或DX存储器等)、磁性存储器、磁盘、光盘等。所述存储器11在一些实施例中可以是电子设备1的内部存储单元,例如该电子设备1的移动硬盘。所述存储器11在另一些实施例中也可以是电子设备1的外部存储设备,例如电子设备1上配备的插接式移动硬盘、智能存储卡(SmartMediaCard, SMC)、安全数字(SecureDigital, SD)卡、闪存卡(FlashCard)等。进一步地,所述存储器11还可以既包括电子设备1的内部存储单元也包括外部存储设备。所述存储器11不仅可以用于存储安装于电子设备1的应用软件及各类数据,例如数据的协议转化程序12的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。
所述处理器10在一些实施例中可以由集成电路组成,例如可以由单个封装的集成电路所组成,也可以是由多个相同功能或不同功能封装的集成电路所组成,包括一个或者多个中央处理器(CentralProcessingunit,CPU)、微处理器、数字处理芯片、图形处理器及各种控制芯片的组合等。所述处理器10是所述电子设备的控制核心(ControlUnit),利用各种接口和线路连接整个电子设备的各个部件,通过运行或执行存储在所述存储器11内的程序或者模块(例如执行数据的协议转化程序等),以及调用存储在所述存储器11内的数据,以执行电子设备1的各种功能和处理数据。
所述总线可以是外设部件互连标准(peripheralcomponentinterconnect,简称PCI)总线或扩展工业标准结构(extendedindustrystandardarchitecture,简称EISA)总线等。该总线可以分为地址总线、数据总线、控制总线等。所述总线被设置为实现所述存储器11以及至少一个处理器10等之间的连接通信。
图6仅示出了具有部件的电子设备,本领域技术人员可以理解的是,图5示出的结构并不构成对所述电子设备1的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。
例如,尽管未示出,所述电子设备1还可以包括给各个部件供电的电源(比如电池),优选地,电源可以通过电源管理装置与所述至少一个处理器10逻辑相连,从而通过电源管理装置实现充电管理、放电管理、以及功耗管理等功能。电源还可以包括一个或一个以上的直流或交流电源、再充电装置、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。所述电子设备1还可以包括多种传感器、蓝牙模块、Wi-Fi模块等,在此不再赘述。
进一步地,所述电子设备1还可以包括网络接口,可选地,所述网络接口可以包括有线接口和/或无线接口(如WI-FI接口、蓝牙接口等),通常用于在该电子设备1与其他电子设备之间建立通信连接。
可选地,该电子设备1还可以包括用户接口,用户接口可以是显示器(Display)、输入单元(比如键盘(Keyboard)),可选地,用户接口还可以是标准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(OrganicLight-EmittingDiode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在电子设备1中处理的信息以及用于显示可视化的用户界面。
应该了解,所述实施例仅为说明之用,在专利申请范围上并不受此结构的限制。
所述电子设备1中的所述存储器11存储的数据的协议转化程序12是多个指令的组合,在所述处理器10中运行时,可以实现:
根据用户输入的协议转化指令,初始化协议栈及路由系统;
当所述协议栈及所述路由系统初始化成功时,在所述路由系统内创建接口数据调用函数;
利用所述接口数据调用函数,从接口电路中获取接口协议数据;
解封所述接口协议数据,得到协议原始数据;
根据预先设定的协议规则及所述协议栈,封装所述协议原始数据,得到协议封装数据,根据所述协议转化指令,将所述协议封装数据返回至用户。
进一步地,所述电子设备1集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。所述计算机可读存储介质可以是易失性的,也可以是非易失性的。具体的,所述计算机可读存储介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-OnlyMemory)。
进一步地,所述计算机可用存储介质可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序等;存储数据区可存储根据区块链节点的使用所创建的数据等。
在本申请所提供的几个实施例中,应该理解到,所揭露的设备,系统和方法,可以通过其它的方式实现。例如,以上所描述的系统实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。
对于本领域技术人员而言,显然本申请不限于上述示范性实施例的细节,而且在不背离本申请的精神或基本特征的情况下,能够以其他的具体形式实现本申请。
因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本申请的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本申请内。不应将权利要求中的任何附关联图表记视为限制所涉及的权利要求。
本申请所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。
此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。系统权利要求中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第二等词语用来表示名称,而并不表示任何特定的顺序。
最后应说明的是,以上实施例仅用以说明本申请的技术方案而非限制,尽管参照较佳实施例对本申请进行了详细说明,本领域的普通技术人员应当理解,可以对本申请的技术方案进行修改或等同替换,而不脱离本申请技术方案的精神和范围。
Claims (20)
- 一种数据的协议转化方法,其中,所述方法包括:根据用户输入的协议转化指令,初始化协议栈及路由系统;当所述协议栈及所述路由系统初始化成功时,在所述路由系统内创建接口数据调用函数;利用所述接口数据调用函数,从接口电路中获取接口协议数据;解封所述接口协议数据,得到协议原始数据;根据预先设定的协议规则及所述协议栈,封装所述协议原始数据,得到协议封装数据,根据所述协议转化指令,将所述协议封装数据返回至用户。
- 如权利要求1所述的数据的协议转化方法,其中,所述根据协议转化指令,初始化协议栈及路由系统之前,还包括:接收用户输入的所述协议转化指令,解析所述协议转化指令,得到与所述协议转化指令对应的一个或多个接口电路的接口信息。
- 如权利要求2所述的数据的协议转化方法,其中,所述根据协议转化指令,初始化协议栈及路由系统,包括:初始化所述路由系统,当所述路由系统初始化失败时,重新接收用户输入的协议转化指令;当所述路由系统初始化成功时,获取一个或多个所述接口电路所支持的接口电路协议,根据所述接口电路协议,初始化所述协议栈。
- 如权利要求3中所述的数据的协议转化方法,其中,所述在所述路由系统内创建接口数据调用函数,包括:将所述接口电路协议作为预构建的数据调用API的输入参数,生成原始数据调用函数;编译所述原始数据调用函数,得到所述接口数据调用函数。
- 如权利要求1所述的数据的协议转化方法,其中,所述利用所述接口数据调用函数,从接口电路中获取接口协议数据,包括:利用所述接口数据调用函数,启动预构建的驱动器;利用所述驱动器从对应的接口电路中获取所述接口协议数据。
- 如权利要求1中所述的数据的协议转化方法,其中,所述接口协议数据包括:状态接口协议数据、控制接口协议数据、启停接口协议数据、规则下发接口协议数据、更新接口协议数据、定时接口协议数据。
- 一种数据协议转化系统,其中,所述系统包括网络层、系统层及驱动层,其中:所述网络层,用于根据用户输入的协议转化指令,初始化协议栈及路由系统;所述系统层,用于当所述协议栈及所述路由系统初始化成功时,在所述路由系统内创建接口数据调用函数;所述驱动层,用于利用所述接口数据调用函数,从接口电路中获取接口协议数据;所述网络层,还用于解封所述接口协议数据,得到协议原始数据,根据预先设定的协议规则及所述协议栈,封装所述协议原始数据,得到协议封装数据,根据所述协议转化指令,将所述协议封装数据返回至用户。
- 如权利要求7所述的数据协议转化系统,其中,所述系统还包括应用层,其中:所述应用层,用于接收用户输入的所述协议转化指令,解析所述协议转化指令,得到与所述协议转化指令对应的一个或多个接口电路的接口信息。
- 一种电子设备,其中,所述电子设备包括:至少一个处理器;以及,与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如下所述的数据的协议转化方法:根据用户输入的协议转化指令,初始化协议栈及路由系统;当所述协议栈及所述路由系统初始化成功时,在所述路由系统内创建接口数据调用函数;利用所述接口数据调用函数,从接口电路中获取接口协议数据;解封所述接口协议数据,得到协议原始数据;根据预先设定的协议规则及所述协议栈,封装所述协议原始数据,得到协议封装数据,根据所述协议转化指令,将所述协议封装数据返回至用户。
- 如权利要求9所述的电子设备,其中,所述根据协议转化指令,初始化协议栈及路由系统之前,还包括:接收用户输入的所述协议转化指令,解析所述协议转化指令,得到与所述协议转化指令对应的一个或多个接口电路的接口信息。
- 如权利要求10所述的电子设备,其中,所述根据协议转化指令,初始化协议栈及路由系统,包括:初始化所述路由系统,当所述路由系统初始化失败时,重新接收用户输入的协议转化指令;当所述路由系统初始化成功时,获取一个或多个所述接口电路所支持的接口电路协议,根据所述接口电路协议,初始化所述协议栈。
- 如权利要求11中所述的电子设备,其中,所述在所述路由系统内创建接口数据调用函数,包括:将所述接口电路协议作为预构建的数据调用API的输入参数,生成原始数据调用函数;编译所述原始数据调用函数,得到所述接口数据调用函数。
- 如权利要求9所述的电子设备,其中,所述利用所述接口数据调用函数,从接口电路中获取接口协议数据,包括:利用所述接口数据调用函数,启动预构建的驱动器;利用所述驱动器从对应的接口电路中获取所述接口协议数据。
- 如权利要求9中所述的电子设备,其中,所述接口协议数据包括:状态接口协议数据、控制接口协议数据、启停接口协议数据、规则下发接口协议数据、更新接口协议数据、定时接口协议数据。
- 一种计算机可读存储介质,包括存储数据区和存储程序区,其中,所述存储数据区存储创建的数据,所述存储程序区存储有计算机程序;其中,所述计算机程序被处理器执行时实现如下所述的数据的协议转化方法:根据用户输入的协议转化指令,初始化协议栈及路由系统;当所述协议栈及所述路由系统初始化成功时,在所述路由系统内创建接口数据调用函数;利用所述接口数据调用函数,从接口电路中获取接口协议数据;解封所述接口协议数据,得到协议原始数据;根据预先设定的协议规则及所述协议栈,封装所述协议原始数据,得到协议封装数据,根据所述协议转化指令,将所述协议封装数据返回至用户。
- 如权利要求15所述的计算机可读存储介质,其中,所述根据协议转化指令,初始化协议栈及路由系统之前,还包括:接收用户输入的所述协议转化指令,解析所述协议转化指令,得到与所述协议转化指令对应的一个或多个接口电路的接口信息。
- 如权利要求16所述的计算机可读存储介质,其中,所述根据协议转化指令,初始化协议栈及路由系统,包括:初始化所述路由系统,当所述路由系统初始化失败时,重新接收用户输入的协议转化指令;当所述路由系统初始化成功时,获取一个或多个所述接口电路所支持的接口电路协议,根据所述接口电路协议,初始化所述协议栈。
- 如权利要求17中所述的计算机可读存储介质,其中,所述在所述路由系统内创建接口数据调用函数,包括:将所述接口电路协议作为预构建的数据调用API的输入参数,生成原始数据调用函数;编译所述原始数据调用函数,得到所述接口数据调用函数。
- 如权利要求15所述的计算机可读存储介质,其中,所述利用所述接口数据调用函数,从接口电路中获取接口协议数据,包括:利用所述接口数据调用函数,启动预构建的驱动器;利用所述驱动器从对应的接口电路中获取所述接口协议数据。
- 如权利要求15中所述的计算机可读存储介质,其中,所述接口协议数据包括:状态接口协议数据、控制接口协议数据、启停接口协议数据、规则下发接口协议数据、更新接口协议数据、定时接口协议数据。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202011073525.XA CN112202798B (zh) | 2020-10-09 | 2020-10-09 | 数据的协议转化方法、系统、电子设备及存储介质 |
| CN202011073525.X | 2020-10-09 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2021189898A1 true WO2021189898A1 (zh) | 2021-09-30 |
Family
ID=74013792
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2020/131975 Ceased WO2021189898A1 (zh) | 2020-10-09 | 2020-11-26 | 数据的协议转化方法、系统、电子设备及存储介质 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN112202798B (zh) |
| WO (1) | WO2021189898A1 (zh) |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114338448A (zh) * | 2021-12-29 | 2022-04-12 | 北京天融信网络安全技术有限公司 | 性能测试方法、装置、电子设备及存储介质 |
| CN115580665A (zh) * | 2022-11-18 | 2023-01-06 | 中国信息通信研究院 | 基于区块链的传输协议转化方法、装置、存储介质和设备 |
| CN116647588A (zh) * | 2023-04-26 | 2023-08-25 | 深圳开鸿数字产业发展有限公司 | 一种远程通信方法、装置、设备及存储介质 |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114968360B (zh) * | 2022-06-02 | 2026-02-03 | 杭州东方通信软件技术有限公司 | 一种基于api控制器的指令下发方法 |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20050021640A1 (en) * | 2001-08-24 | 2005-01-27 | Dalen Rutger Van | System for remote data acquisition based on e-mail message communication through public and private networks |
| CN109672732A (zh) * | 2018-12-18 | 2019-04-23 | 浩云科技股份有限公司 | 一种接口适配方法、装置及系统 |
| CN109857569A (zh) * | 2018-11-08 | 2019-06-07 | 深圳壹账通智能科技有限公司 | 接口调用处理方法及装置、存储介质、计算机设备 |
| CN110166485A (zh) * | 2019-06-14 | 2019-08-23 | 北京经纬恒润科技有限公司 | 一种协议的调度使用方法及装置 |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN100512282C (zh) * | 2004-07-30 | 2009-07-08 | 国家数字交换系统工程技术研究中心 | 采用单进程处理路由协议栈的方法 |
| GB0919253D0 (en) * | 2009-11-03 | 2009-12-16 | Cullimore Ian | Atto 1 |
| CN111541688B (zh) * | 2020-04-21 | 2022-05-27 | 深圳市高川自动化技术有限公司 | 一种兼容多协议的嵌入式系统、数据处理方法及装置 |
-
2020
- 2020-10-09 CN CN202011073525.XA patent/CN112202798B/zh active Active
- 2020-11-26 WO PCT/CN2020/131975 patent/WO2021189898A1/zh not_active Ceased
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20050021640A1 (en) * | 2001-08-24 | 2005-01-27 | Dalen Rutger Van | System for remote data acquisition based on e-mail message communication through public and private networks |
| CN109857569A (zh) * | 2018-11-08 | 2019-06-07 | 深圳壹账通智能科技有限公司 | 接口调用处理方法及装置、存储介质、计算机设备 |
| CN109672732A (zh) * | 2018-12-18 | 2019-04-23 | 浩云科技股份有限公司 | 一种接口适配方法、装置及系统 |
| CN110166485A (zh) * | 2019-06-14 | 2019-08-23 | 北京经纬恒润科技有限公司 | 一种协议的调度使用方法及装置 |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114338448A (zh) * | 2021-12-29 | 2022-04-12 | 北京天融信网络安全技术有限公司 | 性能测试方法、装置、电子设备及存储介质 |
| CN114338448B (zh) * | 2021-12-29 | 2024-02-20 | 北京天融信网络安全技术有限公司 | 性能测试方法、装置、电子设备及存储介质 |
| CN115580665A (zh) * | 2022-11-18 | 2023-01-06 | 中国信息通信研究院 | 基于区块链的传输协议转化方法、装置、存储介质和设备 |
| CN116647588A (zh) * | 2023-04-26 | 2023-08-25 | 深圳开鸿数字产业发展有限公司 | 一种远程通信方法、装置、设备及存储介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN112202798A (zh) | 2021-01-08 |
| CN112202798B (zh) | 2022-07-15 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2021189898A1 (zh) | 数据的协议转化方法、系统、电子设备及存储介质 | |
| CN110716748B (zh) | 业务处理方法、装置、计算机可读介质及电子设备 | |
| KR101442934B1 (ko) | 반도체 시스템, 반도체 디바이스 및 전자 디바이스 초기화 방법 | |
| US8347318B2 (en) | Application component communication apparatus of SCA-based system and method thereof | |
| US10303449B2 (en) | Compiling non-native constants | |
| CN112528307A (zh) | 服务请求校验方法、装置、电子设备及存储介质 | |
| CN112965721B (zh) | 基于Android的项目编译方法、装置、计算机设备及存储介质 | |
| CN113391796A (zh) | 一种集成开发环境的构建方法、装置、设备及介质 | |
| US10579366B2 (en) | Data upgrade framework for distributed systems | |
| CN101051269A (zh) | 智能平台管理接口韧体架构及其建立方法 | |
| US7380024B2 (en) | System and method for communication with host internal area access | |
| CN100587705C (zh) | 主机对多厂商芯片设备数据交换协议进行动态转换的方法 | |
| US20170161125A1 (en) | Method and module in operating system for controlling hardware device | |
| US11886326B2 (en) | Configuring test operations on a per-module basis | |
| CN107608672A (zh) | 一种ui模块管理器、ui模块管理方法和系统 | |
| CN112764995B (zh) | 一种服务器硬件资源监控方法、装置和介质 | |
| CN100428171C (zh) | 数据平面与控制平面之间的通讯方法 | |
| US10394610B2 (en) | Managing split packages in a module system | |
| CN114721952A (zh) | 多套测试环境同步部署方法、装置、设备及存储介质 | |
| CN118432971B (zh) | 数据处理方法、系统、计算机设备及存储介质 | |
| US20140298303A1 (en) | Method of processing program and program | |
| WO2011160359A1 (zh) | 脚本驱动软件构建方法和装置 | |
| CN116149760A (zh) | 基于Vue框架的前端项目打包方法及装置 | |
| WO2022105494A1 (zh) | 数据自动回填方法、装置、电子设备及计算机存储介质 | |
| CN115455328A (zh) | 页面权限的自动生成方法、装置、设备及存储介质 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 20927327 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 20927327 Country of ref document: EP Kind code of ref document: A1 |