Disclosure of Invention
The invention aims to solve the technical problem of providing a heterogeneous network access and conversion method and a gateway oriented to an Internet of things ubiquitous access gateway, and realizing a multi-interface and multi-protocol conversion function in the Internet of things gateway.
The technical scheme adopted by the invention for solving the technical problems is as follows: the heterogeneous network access and conversion method for the Internet of things-oriented ubiquitous access gateway comprises the following steps:
(1) receiving network data, adding a variable frame header in front of a message effective field of the network data, and judging the effectiveness of the network data according to the variable frame header;
(2) when the network data is valid, extracting valid fields of the network data according to the variable frame header;
(3) expressing the extracted effective field by adopting a gateway protocol data format to realize data fusion under a heterogeneous network, extracting a virtual address to carry out network addressing, and completing the conversion of a gateway protocol through an address mapping table;
(4) and delivering the network data after the protocol conversion to the target device.
The variable frame header includes: a message length field for indicating a total length of a packet of the network data; a terminal type field for indicating the source type of the network data; and the interface type field is used for indicating the connection mode of the sending end of the network data and the gateway system.
The variable frame header further comprises: an interface address field for indicating a physical address of an interface between a transmitting end of the network data and the gateway system; and the interface parameter field is used for expressing the parameters of the interface between the sending end of the network data and the gateway system.
The judging the validity of the network data according to the variable frame header in the step (1) means that the validity of the network data is detected through data length check and data format specification.
The step (2) is specifically as follows: and determining the position of an effective field in the network data according to a message length field in the variable frame header, and setting a new data operation pointer to point to the effective field of the network data.
The gateway protocol data format comprises: a protocol version number field for indicating the version number of the gateway protocol data format; a message sequence number field for indicating the sending sequence of the network data; a control field for indicating a data source type; a source address field for indicating an address of a transmitting end of the network data; a destination address field for indicating an address of a receiving end of the network data; a data payload field for placing the valid field.
The virtual address is distributed in the process that the network terminal accesses the network relation and registers information, and the address mapping table is determined.
The virtual address includes: a network domain address and an end node address; the network domain address is positioned at the front section of the virtual address and is used for representing a sub-network to which the network data needs to be delivered, wherein the sub-network comprises a local domain network and a wide area network; the end node address is located at the rear section of the virtual address and is used for representing the host address of the terminal equipment under each sub-network.
The step (3) of extracting the virtual address to perform network addressing and completing the conversion of the gateway protocol through the address mapping table specifically comprises the following steps: and extracting the network domain address in the virtual address, binding the network data represented by the gateway protocol data format to a corresponding receiving end through the address mapping table, and distributing the data operation handle to a corresponding data processing task.
The technical scheme adopted by the invention for solving the technical problems is as follows: the heterogeneous access gateway adopts the heterogeneous network access and conversion method facing the Internet of things ubiquitous access gateway to realize multi-interface and multi-protocol conversion in the Internet of things gateway.
Advantageous effects
Due to the adoption of the technical scheme, compared with the prior art, the invention has the following advantages and positive effects: in the process of judging the effective data, the invention adds a section of variable frame header at the front end of the effective field of the message, can filter the invalid data flow in the gateway by the method, enhances the identification and resolution capability of the gateway system to the network data packet, and simultaneously, the variable frame header comprises an interface address value so as to distinguish different ports in the gateway hardware resource, thereby being beneficial to tracing and tracing the data by the field and simultaneously reducing the coupling of the gateway system. For the characteristic of data multiple sources, the invention also standardizes and standardizes the communication data accessed to the network module through a universal gateway protocol data format, thereby realizing data fusion under a heterogeneous network. Then extracting the content of the network domain address field and completing the conversion of the gateway protocol through the address mapping table.
Detailed Description
The invention will be further illustrated with reference to the following specific examples. It should be understood that these examples are for illustrative purposes only and are not intended to limit the scope of the present invention. Further, it should be understood that various changes or modifications of the present invention may be made by those skilled in the art after reading the teaching of the present invention, and such equivalents may fall within the scope of the present invention as defined in the appended claims.
Under a loose coupling fusion model, the fusion of heterogeneous networks depends on the realization of a network middleware technology, and the interconnection and intercommunication among the networks are realized by adding a third-party system among the networks. As shown in fig. 1, under such a convergence model, the terminal a and the terminal B, which are independent of each other, are sub-networks belonging to different network architectures, and cannot directly perform data communication with each other; in a device called as middleware C, firstly, access communication with each independent subnet needs to be realized at an access layer, and secondly, data intercommunication between subnets is performed through a technology such as protocol conversion. In heterogeneous subnets, a logical connection is used to communicate with other subnets. The model maintains the independence and stability of the subnet structure, has less modification on the internal design of the subnet, is relatively simple in structural design and is relatively flexible in implementation.
The middleware C in this embodiment may be implemented by using an internet of things multimode gateway, where the internet of things multimode gateway is formed by heterogeneous networks of multiple communication systems, and each sub-network has its own communication data format, where the format may be a frame format specified by a manufacturer or a custom-made coding format, and when a network module accesses the internet of things multimode gateway through a terminal interface, the system first needs to perform data analysis on the received network data (the data analysis is a preprocessing on initial data), and then the gateway determines a specific transmission policy of a network data packet according to the specification of the message format and the result of the data analysis, and performs communication protocol conversion on the data packet at an application layer, and finally delivers the data packet to a corresponding transmission port.
A first embodiment of the present invention relates to a heterogeneous network access and conversion method for an internet of things-oriented ubiquitous access gateway, as shown in fig. 2, including the following steps: receiving network data, adding a variable frame header in front of a message effective field of the network data, and judging the effectiveness of the network data according to the variable frame header; when the network data is valid, extracting valid fields of the network data according to the variable frame header; expressing the extracted effective field by adopting a gateway protocol data format to realize data fusion under a heterogeneous network, extracting a virtual address to carry out network addressing, and completing the conversion of a gateway protocol through an address mapping table; and delivering the network data after the protocol conversion to the target device.
When the access scale of the gateway system is enlarged, the probability of mutual interference among network data in the communication process is increased, so that the judgment of effective data is an important step of data analysis. In this embodiment, in addition to the error correction and verification capabilities of the network module and the interface protocol, the mechanism for identifying and determining valid data is further improved by checking the length of data and detecting the specification of the data format.
In order to enhance the recognition and resolution capability of the gateway system for the network data packet, in the process of accessing heterogeneous data aggregation, the system will add a variable frame header containing the identifier of message length, terminal information, interface information, etc. at the front end of the message valid field on the message level, as shown in fig. 3. In this identification mechanism, the system will attach information parameters to each data stream based on the basic information provided by the terminal driver. In this way, invalid data streams in the gateway system can be effectively filtered, and favorable conditions are provided for the analysis and extraction of data packets.
In this embodiment, the length of the variable frame header is 8 bytes, and table 1 gives specific descriptions of each field of the variable frame header, so that the variable frame header can include the key information of the current communication packet while satisfying relatively low communication overhead. The message length field occupies 2 bytes, represents the total length of the data message, can correctly judge whether the data packet is complete and effective or not through the field, and distributes reasonable storage space for effective data in the gateway according to the length of the field message. The terminal type field is used for marking the source type of data, when the wireless terminal under the heterogeneous network reports the data, the interface driver can set corresponding identifiers according to the network type, and up to 256 terminal type devices can be represented through the identifiers with the size of 1 byte, so that the actual application requirements can be met. The device type field characterizes the wireless network type of the network device, such as bluetooth, WiFi, etc., and the interface type field describes the connection mode between the network module from which the message originates and the gateway system, such as SPI, I2C, USART, etc. The variable frame header is also provided with a reserved field, and the reserved field can be reserved for expansion and standby of other functions.
In the embodiment, an interface address value is additionally added to distinguish different ports in the gateway hardware resource, and the interface address value is favorable for tracing and tracing data, so that the coupling of the gateway system is reduced. The interface address value includes two fields, which are respectively: the gateway system comprises an interface address field and an interface parameter field, wherein the interface address field is used for indicating a physical address of an interface between a sending end of the network data and the gateway system; and the interface parameter field is used for expressing the parameters of the interface between the sending end of the network data and the gateway system. Different access ports will configure different parameters, such as working mode, transmission options, etc. according to the specific requirements of the access module, and map to the interface parameter field.
Table 1 variable frame header field description table
The data analysis is a process of extracting effective fields of the communication data cached in the memory through the data flow related information provided by the frame head. The content extractor firstly determines the offset of the valid field in the memory according to the length information of the data stream, then sets a new data operation pointer to point to the valid segment of the network data, and meanwhile releases the storage space of the invalid data packet in the process. The network data transmitted from the terminal device after the data analysis and extraction are transmitted to the protocol conversion program for processing.
In the embodiment, a gateway protocol data format of a terminal network is designed, and data fusion under a heterogeneous network is realized by performing standard standardization on multisource communication data accessed by a gateway, wherein the gateway protocol data format is shown in fig. 4. The initial field in the gateway protocol data format is the version number of the self-defined protocol format, global and verification can be provided when version updating iteration is carried out on the node data format, the result is delivered to the management layer for processing, two communication parties need to use the same protocol version number for data exchange, otherwise, the gateway system throws out message format error prompt. In general, the amount of data to be transmitted in the network is not large, but in order to make the gateway system have high compatibility, problems that may occur when long data frames are transmitted still need to be considered. Therefore, a message sequence number for indicating the network data transmission sequence is added in the protocol format; the sending terminal sets the serial number according to the data volume of the sending terminal, and the receiving terminal integrates and splices data according to a defined format when receiving data packets with different serial numbers. During the operation of the network terminal device, each data source needs to be distinguished according to the function, and such an identifier indicating the type of the data source is embodied in a control field, and the control field is used for specifying the specific control type of the message frame, including the types of the data frame, the command frame, the start frame, the end frame, and the like, as shown in table 2.
Table 2 control field setting table
Frame type
|
Byte setting
|
Data frame
|
0x44(D)
|
Command frame
|
0x43(C)
|
Start frame
|
0x53(S)
|
Ending frame
|
0x45(E) |
On one hand, the data types are different, so that decision bases are provided for the gateway to process heterogeneous network data, and the realization of control commands or data distribution operations for different functions can be supported, and on the other hand, the terminal device further executes related operations in the device by identifying the control types, such as configuring parameters of the network device according to specific command data of command frames.
Interoperability between heterogeneous networks relies on interworking between data of different nodes, and address mapping plays a critical role in this process. Protocol conversion on the message level is to establish a terminal network mapping relationship and to connect different types of networks with each other by using a uniform address standard. In this embodiment, network addressing is performed by setting a virtual address for each type of intelligent terminal in the heterogeneous network, and the virtual address field is shown in table 3.
TABLE 3 virtual Address segment design Table
Network domain address
|
End node address
|
0D0000-0D1111
|
0D000000000000-0D111111111111 |
The virtual address size is 2 bytes, and consists of two parts: network domain address, end node address. The network domain address is positioned at the front section of the virtual address, occupies 4 bits, and is used for indicating a sub-network to which the data packet needs to be sent, including a local area network and a wide area network; the network domain distinguishes each access network of the gateway system and carries out network addressing through a network address mapping table in the system; the rear section of the virtual address is an end node address, which is 12 bits in total and represents the host address of the terminal equipment under each sub-network; each end node may have the same network domain address but its host address must be unique, so that different end nodes located under the same network domain can be found by the end node address. The gateway virtual address is distributed in the process of accessing the gateway and registering information of the network terminal, and the address mapping relation is determined.
Based on the design method of the virtual address of the gateway node, table 4 shows address allocation of heterogeneous networks such as LoRa, BLE, WiFi, and the like in the gateway address pool.
Table 4 gateway node address pool allocation table
Heterogeneous network types
|
Node address
|
LoRa
|
0x1000-0x1FFF
|
BLE
|
0x2000-0x2FFF
|
WiFi
|
0x3000-0x3FFF
|
Reservation
|
0x4000-0xFFFF |
In the specific process of gateway protocol conversion, the network domain address field is firstly extracted and used, the conversion program binds the protocol data packet to the corresponding network terminal through the self-established mapping table, and the data operation handle is distributed to the corresponding data processing task. In the data processing task of each network, a data sending target is set according to the corresponding node address value, and if the target is not in the registered node, the task is stopped and an error prompt is thrown out.
In the process of judging the effective data, the invention adds a section of variable frame header at the front end of the effective field of the message, so that the invalid data flow in the gateway can be filtered, the capability of the gateway system for identifying and distinguishing network data packets is enhanced, and the variable frame header comprises an interface address value so as to distinguish different ports in the gateway hardware resource, thereby being beneficial to tracing and tracking the data through the field and simultaneously reducing the coupling of the gateway system. For the characteristic of data multiple sources, the invention also standardizes and standardizes the communication data accessed to the network module through a universal gateway protocol data format, thereby realizing data fusion under a heterogeneous network. Then extracting the content of the network domain address field and completing the conversion of the gateway protocol through the address mapping table.
The second embodiment of the present invention relates to a heterogeneous access gateway, which can implement multi-interface and multi-protocol conversion in an internet of things gateway by using the above heterogeneous network access and conversion method for an internet of things gateway. As shown in fig. 5, the internet of things system generally uses a plurality of different communication technologies to obtain required data from the sensing terminal device, and communication ports under these heterogeneous networks are accessed in the terminal adaptation module, so as to establish a sensing domain, i.e. a connection inside each heterogeneous network and a communication connection between a subnet and the gateway system. In the terminal adaptation module, a node device driver and a data transmission interface are required to be provided, and data of other modules are sent to a corresponding heterogeneous network through the terminal adaptation module; the network configuration module and the multi-interface module collect and store specific information of the heterogeneous network, such as network interface information and network configuration item information, in a network connection establishing stage, and the multi-interface module establishes a mapping table between data and network interfaces by means of the heterogeneous network information, which plays a critical role in routing decision. The information is collected in a protocol conversion and data forwarding module, received terminal equipment data and network interface related information are analyzed in the module, a packet or decompression operation is carried out on a data frame according to the data flow direction and a related mapping relation, and meanwhile standardized data are transmitted to a corresponding communication port; the service support module and the application configuration module are designed for meeting the characteristics of multi-scene application of the Internet of things, and are used for cooperatively processing data requests under specific application, so that a user can abstract the gateway system into a black box and execute data interaction operation on equipment under each heterogeneous network by means of a related application interface provided by the service module, and the use cost of the user can be reduced. Finally, with the increasing demand for data security and manageability of the system, the gateway system needs to deploy a corresponding security module to provide certain data security services, such as data access control or identity authentication, and due to the expansion of the fusion scale of the internet of things heterogeneous network, the complexity of the system increases, and the gateway system needs to manage and monitor information of components inside the gateway system and device information in the access network by means of the management module.
Therefore, the invention provides a design scheme of a functional module of the multi-mode gateway system of the Internet of things, analyzes and designs a lightweight addressing method and a protocol data packet format of heterogeneous network nodes, and explains intra-domain and inter-domain communication mechanisms of the gateway system. The Internet of things multimode gateway can be built through the miniature embedded system, has basic heterogeneous network fusion capability, has the advantages of diversified accessible network types, strong equipment compatibility and lower deployment cost compared with the traditional gateway equipment, and can meet networking requirements of the Internet of things system under most conditions.