Gateway access method and device, electronic equipment and storage medium
By designing an access gateway system adapted to the integrated protocol, unified access and data management of multiple heterogeneous devices in the sky, earth and sea are realized, solving the problems of incompatibility in equipment access and poor data transmission in the existing technology, and achieving efficient, secure and real-time access and management effects.
Patent Information
- Application Number
- CN202411722798.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-03-21
AI Technical Summary
The existing technology is difficult to achieve unified access and data management of multiple heterogeneous devices in the sky, earth and sea, and lacks support for multiple communication protocols, resulting in incompatible access of equipment, poor data transmission, and high management and maintenance costs.
Design an access gateway system that integrates protocol adaptation, and realizes unified access to multiple devices through protocol conversion through access requirements compatible with different protocols. The system includes receiving, parsing, and reorganizing modules, which can identify target protocols and reorganize data packets into standard protocol formats.
It realizes efficient, secure, real-time access and data management of multiple devices, is compatible with access requirements of different protocols, reduces management and maintenance costs, and meets the needs of the integrated perception platform of space, earth and sea.
Smart Images

Figure CN119676323A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of wireless communication technology, and in particular to a method, device, electronic device and storage medium for accessing a gateway. Background Art
[0002] With the widespread deployment of IoT devices in the fields of air, space, land and sea, heterogeneous devices including satellites, drones, ground sensors and ocean buoys are gradually increasing. The protocols and data formats between these devices are very different, and they are restricted by different transmission links and physical environments, resulting in complex device access, poor data transmission, and high management and maintenance costs. The traditional IoT architecture lacks unified access and data management methods across regions and environments, making it difficult to meet the needs of a three-dimensional perception platform. Most existing access gateways rely on a single protocol stack for device access and lack support for multiple communication protocols, resulting in incompatible access between different devices. How to design an access gateway system that is compatible with multiple types of devices and provide a secure, stable, and real-time access solution for the integrated perception platform of air, space, land and sea is an urgent problem to be solved. Summary of the invention
[0003] The embodiments of the present application provide a method, device, electronic device and storage medium for accessing a gateway, which can be compatible with access requirements of different protocols through protocol conversion, and realize unified access of multiple devices to the gateway.
[0004] The first aspect of the present application provides a method for accessing a gateway, which is applied to the gateway and includes:
[0005] Receive a first data packet sent by a target device to the gateway;
[0006] Obtaining a target parsing function for parsing the first data packet;
[0007] Parsing the first data packet through the target parsing function to obtain key data information in the first data packet;
[0008] The key data information is reorganized according to a preset standard protocol format to obtain a second data packet, and the gateway sends the second data packet.
[0009] In some possible embodiments, obtaining a target parsing function for parsing the first data packet includes:
[0010] Acquire characteristic information of the first data packet;
[0011] Identifying a target protocol corresponding to the first data packet through characteristic information of the data packet;
[0012] The target parsing function is obtained through the target protocol through the pre-stored first correspondence between the protocol and the parsing function.
[0013] In some possible embodiments, the first data packet includes the target device type information, and the step of obtaining a target parsing function for parsing the first data packet includes:
[0014] Obtaining the target device type information in the first data packet;
[0015] According to a pre-stored second correspondence between device types and communication protocols, obtaining an optional protocol corresponding to the target device type according to the target device type information;
[0016] Acquire characteristic information of the first data packet, and identify the target protocol corresponding to the data packet in the optional protocols according to the characteristic information of the data packet;
[0017] The target parsing function is obtained through the target protocol through the pre-stored first correspondence between the protocol and the parsing function.
[0018] In some possible embodiments, the method further includes:
[0019] When the target parsing function cannot correctly parse the first data packet, record error information and reparse the first data packet using the target parsing function; or
[0020] When the reorganization of the key data information fails, the error information is recorded and a prompt information is output.
[0021] In some possible embodiments, the method further includes:
[0022] Receive a login request from the target device, wherein the login request includes identity authentication information of the target device;
[0023] The target device completes the gateway login based on the identity information of the target device and the pre-stored identity information of the authenticated device. When the identity information of the target device matches the pre-stored identity information of the authenticated device, the target device completes the gateway login.
[0024] In some possible embodiments, obtaining pre-stored verified device identity authentication information includes:
[0025] Receiving a registration request message sent by a registration device, wherein the registration request message includes identity authentication information of the registration device;
[0026] The identity verification information is verified, and after the verification is passed, the identity verification information of the registered device is stored.
[0027] In some possible embodiments, the first data packet further includes a data type, and the data type includes: image data and environment data. The method further includes:
[0028] When the data type is an environmental data type and the data value in the first data packet is greater than a preset data value threshold corresponding to the environmental data, outputting a prompt message;
[0029] When the data type is an image data type, event information is obtained through the first data packet, and when the event information matches pre-stored abnormal event information, measures corresponding to the pre-stored abnormal event information are triggered.
[0030] A second aspect of the present application provides an access gateway device, which is applied to a gateway, including:
[0031] A receiving module, used for receiving a first data packet sent by a target device to the gateway;
[0032] An acquisition module, used for acquiring a target parsing function for parsing the first data packet;
[0033] A parsing module, used for parsing the first data packet through the target parsing function to obtain key data information in the first data packet;
[0034] The reassembly module is used to reassemble the key data information according to the format of the standard protocol preset by the data processing platform to obtain a second data packet, and the gateway sends the second data packet.
[0035] A third aspect of the present application provides an electronic device, including:
[0036] processor;
[0037] a memory for storing instructions executable by the processor;
[0038] The processor is configured to execute the instructions to implement an access gateway method as described in any one of the embodiments of the first aspect of the present application.
[0039] The fourth aspect embodiment of the present application provides a storage medium. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute an access gateway method as described in any one of the embodiments of the first aspect of the present application.
[0040] The technical solution provided by the embodiment of the present application includes at least the following beneficial effects:
[0041] The embodiments of the present application propose a gateway access method, device, electronic device and storage medium, which are applied to the gateway, including: receiving a first data packet sent by a target device to the gateway; obtaining a target parsing function for parsing the first data packet; parsing the first data packet through the target parsing function to obtain key data information in the first data packet; reorganizing the key data information according to a preset standard protocol format to obtain a second data packet, and the gateway sends the second data packet, and converts the protocols of different device types into a preset standard protocol format to be compatible with the access requirements of different protocols, thereby realizing unified access of multiple devices to the gateway. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A schematic diagram of an application scenario of an access gateway method proposed in an embodiment of the present application;
[0043] Figure 2 A schematic diagram of a flow chart of a gateway access method proposed in an embodiment of the present application;
[0044] Figure 3 A flowchart of another gateway access method proposed in an embodiment of the present application;
[0045] Figure 4 A flowchart of another gateway access method proposed in an embodiment of the present application;
[0046] Figure 5 A flowchart of another gateway access method proposed in an embodiment of the present application;
[0047] Figure 6 A schematic diagram of the structure of an access gateway device proposed in an embodiment of the present application;
[0048] Figure 7 This is a schematic diagram of the structure of another access gateway device proposed in an embodiment of the present application. DETAILED DESCRIPTION
[0049] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0050] In order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first" and "second" are used to distinguish the same items or similar items with substantially the same functions and effects. For example, the first instruction and the second instruction are to distinguish different user instructions, and their order is not limited. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not necessarily limit them to be different.
[0051] It should be noted that, in the embodiments of the present application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.
[0052] In addition, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can mean: a, or b, or c, or a and b, or a and c, or b and c, or a, b and c, where a, b, c can be single or multiple.
[0053] It should be noted that in the embodiments of the present application, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0054] With the widespread deployment of IoT devices in the air, space, land and sea, heterogeneous devices including satellites, drones, ground sensors and ocean buoys are gradually increasing. The protocols and data formats of these devices are very different, and they are restricted by different transmission links and physical environments, which leads to complex device access, poor data transmission and high management and maintenance costs.
[0055] Although the existing technology has been applied to the access of IoT devices to a certain extent, the relevant technology still has significant defects when facing the unified access requirements of multiple heterogeneous devices in the air, space, land and sea. First, insufficient multi-protocol support is a major problem. Most of the existing access gateways rely on a single protocol stack for device access and lack support for multiple communication protocols, resulting in incompatible access between different devices. Secondly, the lack of efficient real-time data processing capabilities is also an important problem. The existing IoT access methods often upload all data to the cloud for processing, ignoring the need for real-time data processing, especially in application scenarios that require rapid response, the system latency is high and cannot meet the requirements of real-time monitoring. In addition, insufficient security protection is also a major shortcoming of the existing technology. The existing IoT access gateway lacks comprehensive security measures for devices and data transmission, and cannot effectively prevent network attacks, data leakage or tampering. Finally, when dealing with the rapidly growing number of devices and complex device management, the existing technology has poor system scalability, and it is difficult to add new devices to access and maintain. Therefore, how to solve the above technical defects and achieve efficient, secure and real-time management of multi-device access has become a technical problem that needs to be solved in the field of marine IoT.
[0056] In order to solve the above technical problems, the embodiment of the present application proposes a unified access gateway technology, designs an access gateway system with integrated protocol adaptation that is compatible with multiple types of devices, and provides a safe, stable, and real-time access solution for the integrated perception platform of air, land, and sea. The system can effectively solve the heterogeneity problem of device access, realize unified access of devices, real-time transmission of data, and multi-level data analysis, and ensure the confidentiality and integrity of data through security modules. It is a problem that needs to be solved urgently.
[0057] An example of an application scenario of an embodiment of the present application is explained in detail below. For example, Figure 1 As shown, it includes: multiple access devices 101, a gateway 102, and a server 103, which can communicate with each other.
[0058] First, there are multiple access devices 101, which include devices in different physical spaces, such as satellites, drones, offshore buoys, and ground sensor heterogeneous devices. Among them, heterogeneous devices refer to devices that use different hardware architectures, operating systems, communication protocols, or data formats in the same system or network. These devices may come from different manufacturers and have different processing capabilities and functional characteristics. The existence of heterogeneous devices is a common phenomenon in modern computing and IoT environments, especially in complex systems that need to integrate multiple different types of devices. These devices are connected to the 5G network through specific communication protocols and transmission channels, realizing efficient data upload and remote issuance of instructions.
[0059] Gateway 102 is the core of the embodiment of the present application and is composed of multiple functional modules. The protocol adapter module is responsible for protocol conversion, compatible with the access requirements of different protocols, and ensures that the data of different devices can be processed and analyzed in a unified format on the server. The data processing module cleans, converts the format and performs simple analysis on the data to improve the data quality and reduce the processing burden of the cloud platform. The edge computing module provides low-latency data processing capabilities, reduces the pressure on the cloud, and improves the system response speed. The security authentication module implements device authentication, data encryption and access control to ensure the security of the system. The exception handling module monitors and isolates abnormal device data, and the flow control module dynamically adjusts the data transmission rate to avoid network congestion and ensure efficient and stable data transmission.
[0060] Server 103 is responsible for data storage, in-depth analysis and unified management. Exemplarily, the server can be a data center and a cloud platform. Among them, the pre-processed data is further analyzed by the cloud platform to achieve data mining, anomaly detection and decision support. In order to efficiently store large-scale sensor data, the data center adopts a distributed storage system, such as Hadoop HDFS, Ceph or object storage service (such as Amazon S3, Alibaba Cloud OSS), which can provide high availability and scalability. The cloud platform uses its powerful computing resources to perform complex modeling and analysis of data through big data processing frameworks (such as Apache Spark, Hadoop), support the operation of artificial intelligence algorithms, and thus achieve predictive analysis. In addition, using deep learning frameworks such as TensorFlow and PyTorch, machine learning models can be trained and deployed to further enhance the capabilities of data mining and anomaly detection. Data visualization tools (such as Tableau, Power BI) are used to display analysis results to help users intuitively understand data. Real-time stream processing engines (such as Apache Kafka, Flink) are used to achieve real-time data processing and analysis, combined with batch processing technology, support offline and online data analysis, and provide comprehensive data insights. The remote control function is implemented through an API interface (such as RESTful API), allowing applications to call and issue control commands to front-end devices; at the same time, control commands are managed through message queues (such as RabbitMQ, Kafka) to ensure reliable transmission of commands. The real-time monitoring system tracks the status and response of front-end devices to ensure the execution of control commands. The permission management system controls access and operation permissions to front-end devices based on user permissions and roles to ensure the security of the system. The logging mechanism records all control operations and device responses for post-audit and troubleshooting. In short, data centers and cloud platforms provide users with an efficient, secure and intelligent data processing and analysis environment by comprehensively using technologies such as distributed storage, big data processing, machine learning, data visualization, real-time stream processing and remote control.
[0061] To summarize, the embodiments of the present application effectively solve the deficiencies of the prior art in terms of multi-protocol support, real-time data processing, security and scalability by constructing a unified access gateway that integrates multiple functions, and realizes efficient, secure and real-time management of multi-device access, providing strong technical support for applications in the field of marine Internet of Things.
[0062] After understanding the system architecture and related functions of the embodiment of the present application, we will now introduce in detail the execution steps of the unified gateway access method proposed in the embodiment of the present application in the system.
[0063] Steps of process Figure 2 As shown:
[0064] Step 201: Receive a first data packet sent by a target device to the gateway;
[0065] The gateway receives the first data packet sent by the target device, wherein the information of the first data packet includes at least: device ID, device type: such as camera, sensor, controller, etc., device manufacturer, device MAC address, device universal unique identifier (UUID), wherein the device MAC address is the physical address of the device, which is used for unique identification in the network, and the device UUID is used to ensure the uniqueness of the ID in a distributed system without central coordination. UUID is a 128-bit long number, usually represented by 32 hexadecimal digits, and generated by a specific algorithm to ensure that each UUID is unique.
[0066] The gateway receives the first data packet sent by the target device. This data packet is transmitted over the network, which may be through a wired or wireless connection (such as Wi-Fi, Bluetooth, Zigbee, etc.).
[0067] Step 202: Obtain a target parsing function for parsing the first data packet;
[0068] According to a large number of data features contained in the first data packet to indicate relevant information corresponding to the target device, a parsing function preset in the corresponding protocol is identified through one or more features.
[0069] Among them, the method of identifying the target parsing function of the corresponding protocol includes two methods. One is to identify by analyzing the characteristics of the first data packet sent by the device, such as: port number, protocol header, where different protocols usually use specific port numbers. For example, Hyper Text Transfer Protocol (HTTP) usually uses port 80, Hyper Text Transfer Protocol Secure (HTTPS) protocol uses port 443, FTP protocol control connection uses port 21, etc.
[0070] The protocol header includes the IP header, the Transmission Control Protocol (TCP) header, and the User Datagram Protocol (UDP) header. The IP header includes the version, header length, service type, total length, identification, flag, fragment offset, lifetime, protocol number, etc. The TCP header includes the source port, destination port, sequence number, confirmation number, header length, flags (such as SYN, ACK, FIN, RST), window size, checksum, etc. The UDP header includes the source port, destination port, length, checksum, and other information.
[0071] The second method is to obtain the optional protocol through the mapping relationship table between the device type and the target resolution function, and then determine the final target resolution function through the port number and the protocol header.
[0072] In detail, the first method is as follows Figure 3 As shown, the following steps are included:
[0073] Step 301: Acquire characteristic information of the first data packet;
[0074] Protocol feature identification is an important part of network traffic analysis and security monitoring. It identifies the communication protocol used by analyzing the specific features of the data packet. In addition to the port number and protocol header, there are many other features that can be used for protocol identification. The following are some common features: packet size, state machine behavior.
[0075] Exemplarily, data packets of certain protocols have a fixed size. For example, Internet Control Message Protocol (ICMP Echo Request, ICMP) is usually fixed at 64 bytes.
[0076] For example, the packet size of some protocols is variable, but usually has a certain range. For example, the packet size of an HTTP response varies depending on the content.
[0077] For example, some protocols have clear session establishment and termination procedures, such as TCP three-way handshake and four-way wave.
[0078] Interaction pattern: Some protocols have a specific request-response pattern. For example, HTTP request-response pairs.
[0079] By analyzing these characteristics, specific communication protocols can be identified more accurately, thus playing an important role in network security monitoring, traffic analysis, and performance optimization.
[0080] Step 302: Identify a target protocol corresponding to the first data packet through characteristic information of the first data packet;
[0081] Step 302 describes identifying the communication protocol used by the target device by analyzing the characteristic information of the first data packet. This process usually involves a detailed inspection of the content, format and structure of the data packet. The detailed method includes:
[0082] First, check the information in the packet header. Many protocols include a field in the packet header that clearly identifies the protocol used. For example, in an IP packet, there is an 8-bit "protocol" field that identifies the upper layer protocol (such as TCP, UDP, ICMP, etc.). For transport layer protocols (such as TCP and UDP), the port number can provide important clues, such as HTTP usually uses port 80 and HTTPS uses port 443.
[0083] Secondly, analyze the format of the data packet. Some protocols have a fixed format or a specific field order. By examining these fields and their values, the protocol can be identified. For example, the data packet of a DNS query has a specific structure, including fields such as query ID, flags, number of questions, number of answers, etc. In addition, the data packets of some protocols contain specific keywords or strings, such as the first line of an HTTP request is usually GET / path HTTP / 1.1 or POST / path HTTP / 1.1.
[0084] Next, parse the protocol header. Each protocol has its own specific header fields. By parsing these fields, the protocol type can be determined. For example, the TCP header contains fields such as source port, destination port, sequence number, and acknowledgment number. The headers of some protocols also contain flags that can provide additional information, such as the SYN, ACK, and FIN flags in the TCP header.
[0085] In addition, network analysis tools (such as Wireshark) can be used to automatically identify and parse multiple protocols. These tools can display the detailed contents of the data packet and provide the name and related information of the protocol. In programming, specialized libraries (such as Scapy, libpcap, etc.) can be used to parse the data packet and identify the protocol.
[0086] Finally, contextual information can also help identify protocols.
[0087] Step 303: Obtain the target parsing function through the target protocol through the pre-stored first correspondence between the protocol and the parsing function.
[0088] Exemplarily, the HTTP protocol corresponds to the HTTP parsing function, and the MQTT protocol corresponds to the MQTT parsing function.
[0089] In the second method, the type of device (such as camera, sensor, etc.) is already known, and the possible protocol can be inferred based on the device type. For example, a camera may use RTSP (Real-time Streaming Protocol) or ONVIF (Open Network Video Interface Forum) protocol. Some manufacturers may have specific private protocols. Through the device manufacturer information, you can find relevant documents or databases to understand the commonly used protocols of the manufacturer. In other words, the second method first identifies the protocol that the device may use, and then further determines what the protocol is.
[0090] In detail, the second method is as follows Figure 4 As shown, the first data packet also includes target device type information, and the method includes the following steps:
[0091] Step 401: Obtain the target device type information in the first data packet;
[0092] Extract the device type information from the first data packet. The device type information is usually contained in the header or payload of the data packet. Based on the extracted information, identify the specific device type. This step may require further confirmation in combination with other metadata such as device ID, manufacturer information, MAC address, etc.
[0093] Exemplarily, identifying the target device type is to obtain different protocols and data formats of the corresponding device.
[0094] Step 402: according to the pre-stored second correspondence between the device type and the communication protocol, obtaining the optional protocol corresponding to the target device type according to the target device type information;
[0095] Exemplarily, the protocols that may be used by the device are identified according to the device type (such as a camera, a temperature sensor, etc.). In order to implement this process, it is first necessary to define a mapping table or dictionary to associate each device type with the communication protocol that it may use.
[0096] For example, the camera may use the Real Time Streaming Protocol (RTSP) and HTTP protocols, and the temperature sensor may use the Message Queuing Telemetry Transport (MQTT) and Constrained Application Protocol (CoAP) protocols. Next, extract the type information of the target device from the received data packet or registration request. Use the pre-stored mapping table to find the list of optional protocols corresponding to the device type. Finally, return the found list of optional protocols to the caller for further data processing or configuration.
[0097] In some possible embodiments, in order to improve the flexibility of the system, the correspondence between device types and protocols can be dynamically updated at runtime to adapt to new device types or protocols. If the device types have more detailed classifications, nested dictionaries or multi-level mapping structures can be used to represent these complex hierarchical relationships. At the same time, error handling logic is added to ensure that when the device type cannot be found, it can be properly handled and corresponding feedback can be provided.
[0098] In this way, the system can quickly identify the protocols that may be used based on the device type, allowing for more efficient data processing and device management.
[0099] Step 403: Acquire characteristic information of the first data packet, and identify the target protocol corresponding to the first data packet in the optional protocols according to the characteristic information of the first data packet;
[0100] Furthermore, in order to improve accuracy, characteristic information in the first data is obtained. The characteristic information may include a port number, a protocol header, etc. The target protocol adopted by the target device is further determined through the characteristic information.
[0101] Step 404: Obtain the target parsing function through the target protocol through the pre-stored first correspondence between the protocol and the parsing function.
[0102] After obtaining the target parsing function corresponding to the protocol of the target device, step 203 is executed.
[0103] Step 203: parsing the first data packet through the target parsing function to obtain key data information in the first data packet;
[0104] Use preset parsing functions to parse data of different protocols and extract key data fields.
[0105] Exemplarily, an HTTP parsing function is used to parse data in HTTP requests and responses to extract URLs, methods, header information, and body content.
[0106] Exemplarily, an MQTT parsing function is used to parse the topic, quality of service (QoS) level, reservation flag and payload data in the MQTT message.
[0107] Exemplarily, a CoAP parsing function is used to parse the method, option, and payload data in the CoAP message.
[0108] Exemplarily, a Modbus parsing function is used to parse function codes, register addresses and data values in Modbus requests and responses.
[0109] Exemplarily, a Zigbee parsing function is used to parse the frame type, source address, destination address and payload data in the Zigbee message.
[0110] After parsing the data of the protocol corresponding to the target device through a preset parsing function, extract the key field information, for example, extract the device identification information device ID in the data packet. Extract the data type information (such as temperature, humidity, video stream, etc.) in the data packet. Extract the timestamp information and specific measurement value or data content in the data packet.
[0111] Exemplarily, in an embodiment of the present application, different data packets may be marked with timestamps to ensure the time order and consistency of the data. Specifically, when the first data packet is parsed by the target parsing function, the order of the data packets is ensured by marking the timestamps, including:
[0112] Comparing the second timestamp of the first data packet with the first timestamp of a previous tag;
[0113] If the second timestamp of the first data packet is greater than or equal to the first timestamp, update the first timestamp to the second timestamp of the first data packet, and parse the first data packet through the target parsing function;
[0114] If the second timestamp of the first data packet is smaller than the second timestamp, the data packet is invalid and is discarded or marked as an error.
[0115] Step 204: reorganize the key data information according to the format of a preset standard protocol to obtain a second data packet, and the gateway sends the second data packet.
[0116] The process of converting the protocol data of the target device identified above into a preset standard protocol involves the reorganization of the data fields, as shown below.
[0117] For example, the parsed data needs to be reassembled into a pre-set standard protocol format. The pre-set standard protocol format can be pre-defined by the data center and the cloud platform. The pre-set standard protocol specifies the key information that should be included in the data packet to ensure the accuracy and consistency of the data. In other words, each data packet should contain the following fields:
[0118] Device ID: Used to uniquely identify the source device of the data, ensuring that the data can be traced back to the specific device.
[0119] Data type: describes the specific type of data, such as temperature, humidity, video stream, etc., to facilitate subsequent data processing and analysis.
[0120] Timestamp: records the time when data is collected, provides the time context of the data, and facilitates time series analysis and real-time monitoring.
[0121] Data value: contains specific measurement values or data content. This is the core part of the data packet and reflects the actual measurement results or status of the device.
[0122] Other metadata: This includes additional information such as device location and device status. These metadata provide more contextual information about the device and its environment, which helps to more fully understand and analyze the data.
[0123] Through this standardized data format, the system can efficiently process data from different devices, ensuring data consistency and parseability, thereby supporting more accurate data analysis and decision support.
[0124] Exemplarily, the key data information is reorganized according to a pre-set standard protocol format to obtain a second data packet, wherein the reorganization process includes the following steps: data encapsulation, format verification and data transmission are important steps for reorganizing the key data information according to the standard protocol format and sending it to the data processing module. These steps ensure the correctness and integrity of the data so that the data can be correctly parsed and processed by the target system.
[0125] First, according to the provisions of the standard protocol, the various data fields are reorganized and placed in the appropriate positions, and the necessary header information (such as protocol version, message type, length, etc.) is added.
[0126] For example, if the HTTP protocol is used, the request line, request header, and request body need to be combined in sequence; if the MQTT protocol is used, the fixed header, variable header, and payload need to be combined in sequence.
[0127] In order to ensure that the reorganized data complies with the format requirements of the standard protocol, a format check is performed on the format of the reorganized standard protocol.
[0128] During the format verification process, each part of the data packet is checked to see if it complies with the protocol specifications, such as field length, field value validity, checksum, etc.
[0129] For example, for the HTTP protocol, it is necessary to check whether the format of the request line is correct and whether the fields in the request header are legal; for the MQTT protocol, it is necessary to check whether the control flag in the fixed header is correct and whether the topic name in the variable header complies with the specification.
[0130] In the process of sending the reassembled data to the data processing module for further processing, the reassembled data packet is sent to the target address or port through a network socket or other communication mechanism.
[0131] During the protocol conversion process, various errors and abnormal situations may be encountered. Protocol conversion needs to have error handling and logging functions to ensure the stability and traceability of the system.
[0132] In some possible embodiments, when the target parsing function cannot correctly parse the first data packet, error information is recorded and the first data packet is reparsed using the target parsing function;
[0133] Or when the critical data information fails to be reorganized, the error information is recorded and a prompt message is output.
[0134] Exemplarily, during the initial parsing process, the target parsing function is used to attempt to parse the data packet.
[0135] If the parsing is successful, continue with the subsequent processing. If the parsing fails, record the error information.
[0136] If the parsing fails, the target parsing function should be used to try to reparse the data packet. Exemplarily, during the re-parsing process, an upper limit of the number of retries can be set, such as 3 times.
[0137] Each time you retry, the number of retries and error information are recorded. If the upper limit of retries is reached and the parsing is still unsuccessful, a prompt message is output. The data packet can be marked as invalid and stored in the log file for subsequent analysis.
[0138] Exemplarily, when the critical data information fails to be reassembled, error information is recorded.
[0139] For example, a prompt message may be output to inform the user of the reason for the reorganization failure. The original data and error message may also be stored in a log file for subsequent analysis.
[0140] Through the above examples, we have demonstrated how to record error information and perform appropriate processing when the target parsing function cannot correctly parse the data packet or the key data information fails to be reassembled. These measures not only improve the robustness of the system, but also enhance the user experience, allowing users to better understand and solve problems. Whether it is a parsing failure or a reassembly failure, it is crucial to record detailed error information and provide clear prompt information.
[0141] In order to avoid the target parsing function from being unable to correctly parse the data packet or the failure of key data information reassembly, input validation and preprocessing can be used to achieve this.
[0142] Before parsing or reorganizing the data, the input data is strictly verified and preprocessed to ensure the integrity and legality of the data.
[0143] Data integrity checking: Ensures that data packets have not been truncated or corrupted.
[0144] Format validation: Checks whether the data conforms to the expected format. For example, for HTTP requests, check whether the request line, request header, and request body conform to the standard format.
[0145] Boundary condition processing: Process possible boundary conditions, such as empty data packets, oversized data packets, etc.
[0146] In some possible embodiments, before the target device accesses the gateway, it is necessary to authenticate the target device.
[0147] Exemplarily, before the target device accesses the gateway for the first time, the gateway receives a registration request message sent by the registration device, wherein the registration request message includes the identity authentication information of the registration device;
[0148] The identity verification information is verified, and after the verification is passed, the identity verification information of the registered device is stored.
[0149] For example, when the target device is not accessing the gateway for the first time, the gateway first receives a login request from the target device. The request contains the device's authentication information, such as the device ID, key, device serial number, and certificate. Among them, the device serial number is a unique identifier generated by the manufacturer during the production process and permanently stored in the device, which is used to uniquely identify each device in the network. It can not only help manufacturers and dealers track the production and sales of equipment, but also prevent counterfeit devices from accessing the system by verifying the authenticity of the equipment, and users can obtain after-sales services such as warranty and repair through the serial number. On the other hand, a certificate is a digital file used to prove the identity of a device or entity, usually containing subject information, public key, validity period, issuer information, and a digital signature of the certificate content by the certificate authority to ensure that the certificate has not been tampered with. The main uses of certificates include identity authentication, confirming the identity of a device or entity by verifying the signature in the certificate; data encryption, using the public key in the certificate to encrypt data, and only the device with the corresponding private key can decrypt the data; data integrity, using the private key in the certificate to sign data, and the recipient can use the public key to verify the integrity and source of the data; and secure communication, certificates are often used to establish secure communication channels, such as HTTPS, TLS / SSL and other protocols. By combining the use of device serial numbers and certificates, a more secure and reliable device authentication system can be built to ensure that only legitimate devices can access the network and communicate.
[0150] Next, the gateway matches the received authentication information with the pre-stored authentication information of the verified device. In detail, the gateway checks whether the device ID and key are correct, and verifies the legitimacy of the device serial number and certificate. If all of this information matches successfully, it means that the device's identity is legitimate, allowing it to log in, and can record login events and update device status, etc. If any of the verifications fail, the login request is rejected and the corresponding error message is returned. In this way, the gateway can ensure that only devices that have undergone multiple authentications can complete the login, thereby further improving the security and reliability of the system.
[0151] For example, when the target device is not accessing the gateway for the first time, Figure 5 As shown, the method also includes:
[0152] Step 501: receiving a login request from the target device, wherein the login request includes identity authentication information of the target device;
[0153] Step 502: When the identity information of the target device matches the pre-stored verified device identity information, the target device completes gateway login.
[0154] The target device completes the gateway login based on the identity information of the target device and the pre-stored identity information of the authenticated device. When the identity information of the target device matches the pre-stored identity information of the authenticated device, the target device completes the gateway login.
[0155] For example, when the target device is not accessing the gateway for the first time, the gateway first receives a login request from the target device, which contains the device's authentication information, such as the device ID and key. Then, the gateway matches the received authentication information with the pre-stored and verified device authentication information; if the match is successful, it means that the device's identity is legal, and it is allowed to log in, and the login event can be recorded and the device status can be updated; if the match fails, the login request is rejected and the corresponding error message is returned. In this way, the gateway can ensure that only authenticated devices can complete the login, thereby ensuring the security and reliability of the system.
[0156] Exemplarily, when the target device is not accessing the gateway for the first time, the first data packet includes the identity authentication information of the target device, and the step of acquiring a target parsing function for parsing the first data includes:
[0157] According to the identity authentication information of the target device and the pre-stored identity authentication information of the authenticated device, when it is determined that the target device is an authenticated device, a target parsing function for parsing the first data is obtained.
[0158] If the identity verification is successful, the gateway selects a suitable target parsing function according to the device type or protocol. The target parsing function is used to parse the data content in the first data packet. The first data packet is parsed using the selected target parsing function. The parsed data can be further processed or passed to other modules.
[0159] For further data security, data encryption and user authentication-access control are key measures to ensure system security and data integrity. During data transmission, encrypting sensitive data through existing encryption algorithms (such as AES, RSA, etc.) can effectively prevent data from being intercepted or tampered with during transmission, thereby protecting the confidentiality and integrity of the data. In order to further enhance the security of the system, user authentication mechanisms are widely used in access control. Users need to authenticate themselves when accessing the system. Common authentication methods include traditional username / password combinations, two-factor authentication (2FA), and more advanced biometric technologies (such as fingerprint recognition, facial recognition, etc.). These multi-level authentication methods can significantly improve the security of the system and reduce the risk of unauthorized access.
[0160] Once a user is authenticated, the system sets different access levels based on the user's permissions. This role and permission management mechanism assigns different roles and permissions to users based on their responsibilities and needs. For example, administrators have the highest permissions and can manage devices, users, and other system resources; while ordinary users can only view and manipulate data related to them and cannot access information beyond their permissions. Such permission stratification not only helps maintain the privacy of the system, but also ensures the integrity of the data and prevents unauthorized operations.
[0161] In addition, recording user access behavior and operation logs is also an important part of ensuring system security. By recording in detail the user's login time, accessed resources, and operations performed, system administrators can audit and track afterwards. This not only helps to discover potential security threats, but can also be used to investigate and analyze security incidents and provide necessary evidence support. The comprehensive use of data encryption, user identity authentication-access control, and detailed logging can build a multi-level, all-round security protection system to ensure the stable operation of the system and the security of data. This comprehensive security strategy can not only protect the system from external attacks, but also improve the transparency and traceability of internal management, laying a solid foundation for the long-term safe operation of the system.
[0162] After the target device establishes a secure communication connection with the gateway, in order to reduce the load on the data center and cloud platform and provide a faster response speed, the data should be analyzed and processed in real time, and edge computing resources should be used to process data near the access gateway to avoid high latency.
[0163] In some possible embodiments, the first data packet further includes a data type, and the data type includes: image data and environment data. The method further includes:
[0164] When the data type is an environmental data type and the data value in the first data packet is greater than a preset data value threshold corresponding to the environmental data, outputting a prompt message;
[0165] When the data type is an image data type, event information is obtained through the first data packet, and when the event information matches pre-stored abnormal event information, measures corresponding to the pre-stored abnormal event information are triggered.
[0166] By transferring data processing and analysis tasks from the cloud to edge devices close to the data source, network latency can be significantly reduced, cloud load can be reduced, and faster response speed can be provided. For example, the edge computing module processes data at the edge of the network by utilizing resources such as edge servers and intelligent gateways, rather than sending all data to a remote cloud server for processing, thereby achieving distributed computing. This approach has significant advantages: first, data processing occurs close to the data source, reducing the time for data transmission and the latency of the overall system; second, only necessary data or processing results are sent to the cloud, effectively saving network bandwidth; finally, even when the connection to the cloud is unstable, the edge device can still operate independently, ensuring the continuity and reliability of the system. In terms of real-time data analysis, the edge computing module can monitor and analyze video streams, images, and environmental data (such as temperature, humidity, light intensity, etc.) in real time.
[0167] For example, when the temperature in the environment exceeds the preset threshold or the humidity is abnormal, the system will immediately sound an alarm to remind relevant personnel to take measures. In addition, through video stream or image analysis, intrusion detection and fire detection can also be realized. Once unauthorized personnel enter the monitored area or flames or smoke are detected, the system will immediately sound an alarm and trigger corresponding response measures.
[0168] When an abnormality is detected in the environmental data, the system will immediately sound an alarm; when an intrusion, fire or other event is detected, it will trigger alarms, send notifications, record logs and other response measures; through the edge-side AI model, it can also provide real-time equipment status monitoring and automatic control to improve the intelligence level of the system. In short, edge computing not only improves the system's performance and user experience through distributed computing, real-time data analysis and model reasoning, but also enhances the system's reliability and security, while reducing the burden on the cloud and providing users with more immediate and accurate services.
[0169] In some possible embodiments, implementing data routing control is a complex but critical task, especially in a network environment that needs to process large amounts of data and ensure high reliability and efficiency. The following are detailed strategies and implementation methods:
[0170] Different priorities are defined based on the type of data, such as emergency alarm, live video stream, regular sensor data, etc. For example, emergency alarm data may have the highest priority, while regular sensor data may have a lower priority.
[0171] Add a priority field to the packet header to mark the priority of each packet. For example, use the Differentiated Services Code Point (DSCP) field to mark the priority in the IP header.
[0172] Queue management: Use priority queues or weighted fair queues to manage packets of different priorities. High-priority packets are dequeued first, while low-priority packets wait in order.
[0173] In order to select the best transmission path according to the current network conditions and ensure that data can be transmitted quickly and reliably, dynamic routing protocols (such as OSPF and BGP) can be used to automatically discover and select the best path. These protocols dynamically adjust the routing table according to the network topology and link status.
[0174] To achieve load balancing: load balancing can be performed between multiple transmission paths to improve transmission efficiency and network resource utilization.
[0175] For example, a traffic scheduler (such as LVS, HAProxy) is used to distribute traffic among multiple paths. Load balancing can be performed based on traffic size, number of connections, number of sessions, etc.
[0176] Exemplarily, load balancing is performed based on the content of the data (such as data type, data source), for example, video stream data and sensor data are respectively allocated to different paths.
[0177] Through the above method, the synchronous transmission and routing control of data can be effectively realized, ensuring the priority transmission of key data, selecting the best path, and load balancing among multiple paths, thereby improving the overall network performance and reliability.
[0178] It should be understood that although Figure 2-5 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-5 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0179] In some embodiments, Figure 6 As shown, an access gateway device is provided, including: a receiving module 601, an acquisition module 602, a parsing module 603, and a reorganization module 604, wherein:
[0180] Receiving module 601, used to receive a first data packet sent by a target device to the gateway;
[0181] An acquisition module 602 is used to acquire a target parsing function for parsing the first data packet;
[0182] A parsing module 603, configured to parse the first data packet through the target parsing function to obtain key data information in the first data packet;
[0183] The reassembly module 604 is used to reassemble the key data information according to the format of the standard protocol preset by the data processing platform to obtain a second data packet, and the gateway sends the second data packet.
[0184] For further limitations on the access gateway device, please refer to the above limitations on the encryption method, which will not be repeated here. Each module in the above access gateway device can be implemented in whole or in part by software, hardware, and a combination thereof. Each of the above modules can be embedded in or independent of the processor in the terminal device in hardware form, or can be stored in the memory of the terminal device in software form, so that the processor can call and execute the operations corresponding to each of the above modules.
[0185] Another embodiment provides a computer-readable storage medium, which is used to store a computer program. This computer program includes instructions for implementing the method described in the embodiment of the present application. By installing this computer program on a computer, the computer can execute the corresponding method to perform communication encryption.
[0186] Another embodiment proposes that this embodiment provides a computer program product, which includes computer program codes. When these computer program codes are run on a computer, they enable the computer to implement the method proposed in the embodiment of the present application. In this way, users can implement communication encryption by using this computer program product.
[0187] For example, Figure 7 It is a schematic block diagram of a device of another unified gateway access method provided in an embodiment of the present application.
[0188] Figure 7 The device 700 shown is composed of four main parts: processor 701, memory 702, communication interface 703 and bus 704. Each part has its specific function and role, and these components and their functions in unified gateway access will be explained in detail below.
[0189] The processor 701 is the core of the device, responsible for performing various computing and processing tasks, running the operating system and applications, and managing the operation of the entire device. In the unified gateway access method proposed in the embodiment of the present application, the processor 701 is responsible for parsing and processing various network protocols (such as HTTP, HTTPS, TCP / IP, etc.) to ensure the correct transmission and processing of data packets; implement firewall, intrusion detection and defense functions to ensure network security; manage and optimize network traffic to ensure efficient data transmission; and handle gateway configuration and management tasks, including user authentication, access control, etc.
[0190] The memory 702 is used to store data and program codes, including volatile memory (such as RAM) and non-volatile memory (such as ROM, flash memory). In the unified gateway access method proposed in the embodiment of the present application, the memory 702 temporarily stores network data packets to increase data processing speed; saves the configuration files and settings of the gateway to ensure that it can still work normally after restart; and stores system logs and event records to facilitate troubleshooting and auditing.
[0191] The communication interface 703 is responsible for exchanging data with other devices and networks, and may include a wired interface (such as an Ethernet port) and a wireless interface (such as Wi-Fi, 4G / 5G). In the unified gateway access method proposed in the embodiment of the present application, the communication interface 703 realizes connection with the external network and transmits data packets; supports multiple communication protocols to ensure compatibility with different types of devices and networks; monitors the network connection status, and promptly discovers and handles network problems.
[0192] The bus 704 is a communication channel connecting various components, ensuring efficient transmission of data and control signals between various components. In the unified gateway access method proposed in the embodiment of the present application, the bus 704 transmits data and instructions between the processor, memory and communication interface, ensuring synchronization and coordination between various components, and improving the overall performance of the system.
[0193] Through the collaborative work of the above parts, the device 700 can efficiently and securely achieve unified gateway access to meet the needs of various network environments. The device 700 achieves unified access to various network protocols and devices through the processor 701 and the communication interface 703, simplifying network management; the collaborative work of the processor 701 and the memory 702 ensures high-speed data processing capabilities and efficient resource management; the security control function implemented by the processor 701 protects the network from attacks and illegal access; the bus 704 ensures stable communication between various components, improving the reliability and stability of the system.
[0194] It should be understood that in the embodiments of the present application, the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0195] In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software. The steps of the method disclosed in conjunction with the embodiment of the present application can be directly embodied as a hardware processor for execution, or a combination of hardware and software modules in a processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor executes the instructions in the memory, and completes the steps of the above method in conjunction with its hardware. To avoid repetition, it is not described in detail here.
[0196] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.
[0197] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0198] In the several embodiments provided in the embodiments of the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0199] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0200] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0201] If the function 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. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0202] The above is only a specific implementation of the embodiment of the present application, but the protection scope of the embodiment of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed in the embodiment of the present application, which should be included in the protection scope of the embodiment of the present application. Therefore, the protection scope of the embodiment of the present application should be based on the protection scope of the claims.
Claims
1. A method for accessing a gateway, characterized in that: Applied to gateways, including: Receive a first data packet sent by a target device to the gateway; Obtaining a target parsing function for parsing the first data packet; Parsing the first data packet through the target parsing function to obtain key data information in the first data packet; The key data information is reorganized according to a preset standard protocol format to obtain a second data packet, and the gateway sends the second data packet.
2. The method according to claim 1, characterized in that: The obtaining of a target parsing function for parsing the first data packet includes: Acquire characteristic information of the first data packet; Identifying a target protocol corresponding to the first data packet through characteristic information of the data packet; The target parsing function is obtained through the target protocol through the pre-stored first correspondence between the protocol and the parsing function.
3. The method according to claim 1, characterized in that The first data packet includes the target device type information, and the step of obtaining a target parsing function for parsing the first data packet includes: Obtaining the target device type information in the first data packet; According to a pre-stored second correspondence between device types and communication protocols, obtaining an optional protocol corresponding to the target device type according to the target device type information; Acquire characteristic information of the first data packet, and identify the target protocol corresponding to the data packet in the optional protocols according to the characteristic information of the data packet; The target parsing function is obtained through the target protocol through the pre-stored first correspondence between the protocol and the parsing function.
4. The method according to claim 1, characterized in that: The method further comprises: When the target parsing function cannot correctly parse the first data packet, record error information and reparse the first data packet using the target parsing function; or When the reorganization of the key data information fails, the error information is recorded and a prompt information is output.
5. The method according to claim 1, characterized in that The method further comprises: Receive a login request from the target device, wherein the login request includes identity authentication information of the target device; Based on the identity authentication information of the target device and the pre-stored identity authentication information of the authenticated device, when the identity information of the target device matches the pre-stored authenticated device identity information, the target device completes the gateway login.
6. The method according to claim 5, characterized in that Obtain pre-stored verified device identity information, including: Receiving a registration request message sent by a registration device, wherein the registration request message includes identity authentication information of the registration device; The identity verification information is verified, and after the verification is passed, the identity verification information of the registered device is stored.
7. The method according to claim 1, characterized in that The first data packet also includes data types, and the data types include: image data and environmental data. The method further includes: When the data type is an environmental data type and the data value in the first data packet is greater than a preset data value threshold corresponding to the environmental data, outputting a prompt message; When the data type is an image data type, event information is obtained through the first data packet, and when the event information matches pre-stored abnormal event information, measures corresponding to the pre-stored abnormal event information are triggered.
8. An access gateway device, characterized in that: Applied to gateways, including: A receiving module, used for receiving a first data packet sent by a target device to the gateway; An acquisition module, used for acquiring a target parsing function for parsing the first data packet; A parsing module, used for parsing the first data packet through the target parsing function to obtain key data information in the first data packet; The reassembly module is used to reassemble the key data information according to the format of the standard protocol preset by the data processing platform to obtain a second data packet, and the gateway sends the second data packet.
9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instruction to implement a method for accessing a gateway as described in any one of claims 1 to 7.
10. A storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute a method for accessing a gateway as described in any one of claims 1 to 7.
Citation Information
Cited By
Data acquisition and remote control method of fire alarm host and related equipment
CN121078102A
Multi-source heterogeneous BLE device data aggregation processing method and related device
CN122534413A