CN112261647B - ETC bidirectional encryption communication system and method based on Netty - Google Patents

ETC bidirectional encryption communication system and method based on Netty Download PDF

Info

Publication number
CN112261647B
CN112261647B CN202011134931.2A CN202011134931A CN112261647B CN 112261647 B CN112261647 B CN 112261647B CN 202011134931 A CN202011134931 A CN 202011134931A CN 112261647 B CN112261647 B CN 112261647B
Authority
CN
China
Prior art keywords
client
server
request
information
registration
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011134931.2A
Other languages
Chinese (zh)
Other versions
CN112261647A (en
Inventor
谭哲
吴宝才
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Zhufeng Network Technology Co ltd
Original Assignee
Guangzhou Zhufeng Network Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Zhufeng Network Technology Co ltd filed Critical Guangzhou Zhufeng Network Technology Co ltd
Priority to CN202011134931.2A priority Critical patent/CN112261647B/en
Publication of CN112261647A publication Critical patent/CN112261647A/en
Application granted granted Critical
Publication of CN112261647B publication Critical patent/CN112261647B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W12/00Security arrangements; Authentication; Protecting privacy or anonymity
    • H04W12/02Protecting privacy or anonymity, e.g. protecting personally identifiable information [PII]
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07BTICKET-ISSUING APPARATUS; FARE-REGISTERING APPARATUS; FRANKING APPARATUS
    • G07B15/00Arrangements or apparatus for collecting fares, tolls or entrance fees at one or more control points
    • G07B15/06Arrangements for road pricing or congestion charging of vehicles or vehicle users, e.g. automatic toll systems
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07BTICKET-ISSUING APPARATUS; FARE-REGISTERING APPARATUS; FRANKING APPARATUS
    • G07B15/00Arrangements or apparatus for collecting fares, tolls or entrance fees at one or more control points
    • G07B15/06Arrangements for road pricing or congestion charging of vehicles or vehicle users, e.g. automatic toll systems
    • G07B15/063Arrangements for road pricing or congestion charging of vehicles or vehicle users, e.g. automatic toll systems using wireless information transmission between the vehicle and a fixed station
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/11Allocation or use of connection identifiers

Abstract

The invention discloses a Netty-based ETC bidirectional encryption communication system and a method, wherein the system comprises: the server side automatically manages and maintains the connection information of each client side, verifies the legality of the client side, receives and issues the payment request to the client side, and collects the payment information of each client side; the client communicates with the ETC antenna controller and the server and keeps long connection, operates the action of the ETC antenna controller after receiving the fee deduction request, completes the opening transaction, the reading of the electronic tag, the fee deduction, the closing of the transaction and the transaction report, and automatically reconnects the ETC antenna controller and the server after the connection is disconnected; the connection information cache is used for storing the mapping relation between the ip of the server and the client; the ETC antenna controller controls the corresponding ETC antenna according to the lane transaction control instruction of the client; and the ETC antenna scans the electronic tag information under the control of the ETC antenna controller and returns the read information to the ETC antenna controller.

Description

ETC bidirectional encryption communication system and method based on Netty
Technical Field
The invention relates to the technical field of computers, in particular to a Netty-based ETC bidirectional encryption communication system and method.
Background
The ETC charging system is mainly applied to a non-stop charging system on an expressway or a bridge, and achieves the purpose that the vehicle can pay the expense of the expressway or the bridge without parking through a toll station by carrying out short-range communication between an electronic tag (OBU) arranged on a vehicle windshield and an antenna arranged on a lane and carrying out background settlement processing with a bank by utilizing the internet technology. In recent years, with the great increase in the popularity of ETC, the usage scenario of ETC is extending from single high-speed passage to vehicle consumption scenarios such as parking, refueling, and car washing insurance, and is gradually becoming a loop in smart cities.
In the existing ETC charging system, a server and a client communicate through an http protocol, and the communication mode has the following defects:
1. the network relationship between the server and the client needs to be maintained. One disadvantage of using the http protocol is that http is a stateless protocol, and a server must know a network address of a client in advance to issue a message, and in order to achieve this purpose, the server configures the address of the client, and when a client is added or removed, a corresponding configuration must be added or removed, thereby increasing the possibility of manual intervention.
2. Repeatedly developed communication codes. The interaction between the client and the ETC antenna is fixed and unchangeable, and each user accesses ETC hardware to invest manpower and material resources to develop repeated codes, so that a large amount of resources are wasted.
3. An unsecured communication means. The communication between the server and the client is plaintext transmission, so that for people or organizations with certain technical background, communication data can be intercepted and tampered, and great challenges are created on the safety and the effectiveness of the data.
Disclosure of Invention
In order to overcome the defects of the prior art, the invention aims to provide a Netty-based ETC bidirectional encryption communication system and method, which develop the characteristics of disconnection reconnection, multi-machine deployment and bidirectional encryption communication on the basis of a Netty network framework, so that a server only needs to be used as a management center to be mainly responsible for communication with each client, maintain a network list of the client, record payment information such as order numbers, license plate numbers and the like, register the network information and report the payment information of the ETC from the client to the server, simplify the ETC payment information into a payment channel and improve the access efficiency to a great extent.
In order to achieve the above object, the present invention provides a Netty-based ETC bidirectional encrypted communication system, which is based on a Netty network framework, and comprises:
the server side is deployed in a cluster mode and serves as a unified registration center of the client sides, the connection information of all the client sides is automatically managed and maintained, the legality of the client sides is verified, payment requests are received and issued to the client sides, and the payment information of all the client sides is collected;
the client side is communicated with the ETC antenna controller and the server side and keeps long connection, operates the action of the ETC antenna controller after receiving the fee deduction request from the server side, completes the functions of starting transaction, reading electronic tags, deducting fees, closing transaction and reporting transaction, and automatically reconnects the ETC antenna controller and the server side after disconnection;
the connection information cache is used for storing the mapping relation between the ip of the server and the client;
the ETC antenna controller is used for controlling the operation of the corresponding ETC antenna according to the lane transaction control instruction of the client;
and the ETC antenna is used for scanning the electronic tag information under the control of the ETC antenna controller and returning the read information to the ETC antenna controller.
Preferably, the server includes:
the registration processing module is used for receiving the registration request sent by the client, acquiring a public key corresponding to the registration request to verify whether the registration request is legal or not, binding the ip of the server and the information of the client together after the verification is passed, storing the bound ip and the information of the client into the connection information cache to establish a mapping relation, and returning a registration processing result to the client;
the fee deduction request module is used for issuing a fee deduction request message to a corresponding client when receiving a payment request of a local timing and charging system;
and the payment information collection module is used for receiving the reported information of the client and collecting the payment information of each client.
Preferably, when a payment request of the local time-counting charging system is received, the cluster of the server generates a payment order and obtains the connection information cache through key information to find a corresponding server node, issues a fee deduction request message to the client through the fee deduction request module, and sends a delay message corresponding to the payment order to the message queue while issuing the fee deduction request, so that the client marks the payment order as a failure order when the client does not respond to the fee deduction request within a certain time.
Preferably, the client further comprises:
the registration request sending module is used for sending a registration request to the server after establishing connection with the server, creating a registration processor to be cached to the local, blocking all operations of the client when the client registers to the server by the registration processor, and ending blocking after receiving a response of the server;
the register response processing module is used for modifying the register identifier of the register processor after receiving the register response of the server, interrupting the task of the register processor and moving the task out of the local cache;
the antenna connection module is used for connecting the antenna controller with the ETC by using Socket after the registration is successful, responding to heartbeat detection of the ETC antenna controller after the connection is successful so as to keep long connection, and caching the connection to the local;
and the fee deduction request processing module is used for receiving the fee deduction request of the server, generating a local order according to the fee deduction request, checking the legality of fee deduction request information, sending a lane transaction control instruction to the ETC antenna controller according to a check result to control to execute fee collection, processing and reporting the order state.
Preferably, the payment request at least comprises a license plate number of the vehicle needing payment, a lane and fee deduction amount information.
Preferably, after the response of the waiting server is timed out, the registration processor calls the task processing thread to send the message of the registration request again until the response of the server is received.
Preferably, if the server is disconnected from the client, a connection establishment success event is sent out after the reconnection is successful, and the registration request sending module is started to initiate the registration process again after the reconnection success event is captured by the reconnection success event listener, so as to refresh the connection cache of the server.
Preferably, the deduction request processing module further comprises:
the local order generating unit is used for generating a local order according to the fee deduction request;
the lane information checking unit is used for checking whether a lane requested by the server exists or not according to the fee deduction request when the fee deduction request is received, whether fee deduction processes exist in the current lane to be deducted or not is processed, if the lane exists and the current lane to be deducted does not have the fee deduction processes, the lane transaction control instruction generating unit is started, and if not, the order processing unit is started to mark that the current order fails, the transaction of the current ETC is closed, and the transaction is reported to the server;
the lane transaction control instruction generating unit is used for taking out the socket connection from the connection cache after the lane information of the lane information verifying unit passes the verification, setting the information of the current lane in the local cache and sending a lane transaction control instruction to the ETC antenna controller;
the license plate information checking unit is used for checking whether the license plate number in the information is consistent with the license plate number in the fee deduction request of the server side and whether the license plate number is in a blacklist or not according to the acquired information after the electronic tag information returned by the ETC antenna controller is acquired, if the checking is successful, the order processing unit is correctly responded to the ETC antenna controller, otherwise, the order processing unit is started to mark the order failure, the current transaction of the ETC is closed, and the current transaction of the ETC is reported to the server side;
and the order processing unit is used for receiving the fee deduction result of the ETC antenna controller, modifying the order state of the database, sending a transaction closing instruction, and reporting the order closing instruction to the service terminal, or marking the failure of the current order, closing the current transaction of the ETC and reporting the transaction to the service terminal when the verification fails.
Preferably, after the client reports the order successfully, the order is deleted from the local database, after the reporting fails, the process is ended, and then the order is submitted to a timing task component inside the client at regular intervals until the reporting is successful.
In order to achieve the above object, the present invention further provides a Netty-based ETC bidirectional encrypted communication method, including the following steps:
step S1, after the client establishes connection with the server, the client sends a registration request to the server through the connection, the server obtains a public key corresponding to the registration request to verify whether the registration request is legal, and returns a registration processing result to the client to complete the registration of the client;
step S2, after the registration is successful, the client is connected with the ETC antenna controller by using Socket, and after the connection is successful, the client responds to the heartbeat detection of the ETC antenna controller to keep long connection and simultaneously caches the connection to the local;
and step S3, when the server receives the payment request of the local timing charging system, the server issues a fee deduction request message to the corresponding client, the client generates a local order according to the fee deduction request, checks the legality of the fee deduction request message, sends a lane transaction control instruction to the ETC antenna controller according to the check result to control and execute charging, processes and reports the order state.
Compared with the prior art, the invention discloses a Netty-based ETC bidirectional encryption communication system and method, which develop the characteristics of disconnection reconnection, multi-machine deployment and bidirectional encryption communication on the basis of a Netty network framework, so that a server only needs to be used as a management center to mainly communicate with each client, maintain a network list of the client, record payment information such as order numbers, license plate numbers and the like, register the network information and report the payment information of ETC to the server by the client, simplify the system into a payment channel and improve the access efficiency to a great extent.
Drawings
FIG. 1 is a system architecture diagram of a Netty-based ETC two-way encryption communication system of the present invention;
FIG. 2 is a detailed structure diagram of a client according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating steps of a Netty-based ETC two-way encryption communication method according to the present invention;
FIG. 4 is a system architecture diagram of a Netty based ETC two-way encryption communication system in an embodiment of the present invention;
FIG. 5 is a flowchart illustrating the operation of the client in an embodiment of the present invention;
fig. 6 is a fee deduction flow chart of the ETC in the embodiment of the invention.
Detailed Description
Other advantages and capabilities of the present invention will be readily apparent to those skilled in the art from the present disclosure by describing the embodiments of the present invention with specific embodiments thereof in conjunction with the accompanying drawings. The invention is capable of other and different embodiments and its several details are capable of modification in various other respects, all without departing from the spirit and scope of the present invention.
Fig. 1 is a system architecture diagram of the ETC bidirectional encrypted communication system based on Netty according to the present invention. As shown in fig. 1, the ETC bidirectional encryption communication system based on Netty of the present invention is based on a Netty network framework, and comprises:
the server 10, as a unified registration center of the clients, automatically manages and maintains connection information of the clients, verifies the validity of the clients, receives payment requests and issues the payment requests to the clients, and collects payment information of the clients. In the specific embodiment of the invention, the server can be deployed in a cluster, the connection between the client and the server only falls on one server, and the corresponding server is found for calling when the local timing charging system issues the payment request.
Specifically, the server 10 includes:
the registration processing module 101 is configured to receive a registration request sent by a client, obtain a public key corresponding to the registration request to verify whether the registration request is legal, bind the ip of the server and the information of the client together after the verification is passed, store the bound ip and the information of the client in the connection information cache 30 to establish a mapping relationship, and return a registration processing result to the client 20.
Specifically, the client 20 starts to establish a connection with the server 10, and when the connection is successfully established, the client sends a registration request to the server 10 through the connection, the data is transmitted by using an AES encryption method, after receiving the registration request, the server 10 obtains a public key corresponding to the registration request, then verifies whether the registration request is legal, binds the ip of the server and the information of the client together after verification, stores the bound ip and the information of the client in the connection information cache 30 to establish a mapping relationship, and replies that the client 20 indicates that the server 10 has received the registration information.
The deduction request module 102 is configured to issue a message of a deduction request to the corresponding client 20 when receiving a payment request of the local time-counting charging system.
That is to say, when needing to pay, the local timing and charging system sends a payment request to the server cluster, where the payment request at least includes the license plate number of the vehicle needing to pay, the lane, the key information of the client, the fee deduction amount information, and the like, the server cluster generates a "payment order" and obtains the connection information cache through the key information to confirm which server node needs to be used for communication, the server node and the client 20 are in a one-to-one relationship, and the corresponding server node is found, that is, the fee deduction request message can be sent to the client 20 through the fee deduction request module 102. Preferably, the deduction request module 102 sends a delay message corresponding to the payment order to the message queue while issuing the deduction request, and the purpose of the delay message is to mark that the payment order is failed if the client does not respond to the deduction request within a certain time.
And the payment information collection module 103 is configured to receive the report information of the clients and collect payment information of each client.
The client 20 is in communication with the ETC antenna controller 30 and the server 10 and keeps long connection, and after receiving the fee deduction request from the server, the client 20 operates the ETC antenna controller to complete the functions of starting transaction, reading electronic tags, deducting fees, closing transaction and reporting transaction, and automatically reconnects the ETC antenna controller 30 and the server 10 after disconnection.
Specifically, as shown in fig. 2, the client 20 further includes:
a registration request sending module 201, configured to send a registration request to the server 10 after establishing a connection with the server 10, and create a new registration processor to be cached locally, where the registration processor is configured to block all operations of the client when the client registers with the server.
Specifically, the client 20 starts to establish a connection with the server 10, and immediately sends a registration request message to the server 10 through the connection after the connection is successfully established, the data is transmitted by using an AES encryption method, and at the same time, a new registration processor is created and cached locally, the registration processor is used for blocking all operations of the client when the client registers with the server, and ends the blocking after receiving a response from the server 10, and calls a task processing thread to send the registration request message again after waiting for the response timeout from the server until the server receives a response.
That is, when the client 20 registers with the server 10, the registration processor blocks all operations of the client, including establishing connection with the ETC antenna and reporting deduction result operations, which are meaningless actions before establishing connection with the server.
Preferably, because the Netty network framework is provided with a reconnection mechanism of a server and a client, the invention adds a connection establishment success event on the original basis. If the server is disconnected from the client and a connection establishment success event is sent after the reconnection is successful, the registration request sending module 201 is started to initiate a registration process again after the reconnection success event is captured by the reconnection success event listener, so as to refresh the connection cache of the server 10. That is, the invention expands the Netty network framework, and adds an event of successful connection establishment in the self-contained reconnection action of Netty, and the client 20 is responsible for monitoring the event, and the client 20 performs the registration process with the server again after monitoring the event.
Since the first connection and the reconnection cannot be distinguished, the registration success flag registered after the first registration is successful is set to true, because the first registration is performed manually, and the subsequent registrations are triggered by the connection establishment success event listener, so that the successful situation of the first connection needs to be ignored. In the present invention, connection establishment between the client and the server and registration are two actions, where connection establishment is a precondition for bidirectional communication between the server 10 and the client 20, and registration is to find a server node corresponding to the client 20 in a server cluster, because the server and the client 20 correspond to each other one to one. In the specific embodiment of the present invention, the registration processor operates in 2 cases: the first is when the client 20 is started for the first time, the subsequent operation of the client will be blocked under this condition, if the registration response of the server is not received within the specified time, the client will continuously retry until the registration is successful, and the subsequent operation of the client 20 will not be released after the registration is successful; the second is when the client 20 disconnects from the server, which may be done in the presence of interaction between the client 20 and the ETC antenna, and attempts to re-register asynchronously without interrupting this operation. Since a connection establishment success event is triggered when the client 20 establishes a connection with the server 10, and the reconnection success event listener cannot recognize whether it is the first time to start or disconnect reconnection, it is necessary to set the registration success flag to true to distinguish which case the registration processor is to operate. That is, since the Netty network framework provides a function for successfully establishing a connection, based on which a function for sending an event can be added, but when the connection is successfully established, it is impossible to distinguish whether the establishment of the connection is started for the first time or the reconnection is successful in the extended function, and therefore, a registration success flag needs to be set to distinguish which situation the registration processor needs to work according to.
And the registration response processing module 202 is configured to, after receiving the response from the server 10, modify the registration identifier of the registration processor to true, and then interrupt and remove the task of the registration processor from the local cache, that is, destroy the registration processor. In the present invention, the blocking logic of the registration processor is: and circularly judging whether the registration success identifier is true or not, blocking for a period of time when the registration success identifier is not true, and judging again and blocking again after the period of time is exceeded until the registration success identifier is true. When the server 10 responds to the client 20, the registration response processing module 202 of the client 20 immediately modifies the registration success identifier of the registration processor to true, and at this time, the registration processor immediately stops blocking when monitoring that the registration success identifier is true, and then the registration response processing module 202 of the client 20 destroys the registration processor and runs the work after the blocking is finished.
And the antenna connection module 203 is used for connecting with the ETC antenna controller 30 by using Socket after the registration is successful, responding to heartbeat detection of ETC antenna controller hardware after the connection is successful so as to keep long connection, and caching the connection to the local.
The fee deduction request processing module 204 is configured to receive a fee deduction request from the service end 10, generate a local order according to the fee deduction request, check validity of fee deduction request information, send a lane transaction control instruction to the ETC antenna controller according to a check result to control execution of charging, process and report an order state. In the embodiment of the present invention, the verification of the validity of the fee deduction request message includes, but is not limited to, verifying whether the request is from a unique identifier authorized by the service end, verifying whether the lane to be paid is existed, and verifying that the lane to be paid is not currently processed in the fee deduction process.
Specifically, the deduction request processing module 204 further includes:
and the local order generating unit is used for generating a local order according to the fee deduction request. In the present invention, a local order is generated whether the deduction request information passes or fails, and the success or failure is determined by the status of the order, and is reported to the server 10.
And the lane information checking unit is used for checking whether a lane requested by the server 10 exists according to the fee deduction request when the fee deduction request is received, processing whether a fee deduction process exists in the current lane to be deducted, starting the lane transaction control instruction generating unit if the lane exists and the fee deduction process does not exist in the current lane to be deducted, and starting the order processing unit to mark that the current order fails, closing the transaction of the current ETC and reporting the current order to the server 10 if the lane exists and the fee deduction process does not exist in the current lane to be deducted.
And the lane transaction control instruction generating unit is used for taking out the socket connection from the connection cache after the lane information verification of the lane information verifying unit passes (namely the lane exists and no fee deduction process exists in the current lane to be deducted), setting the information of the current lane in the local cache and sending a lane transaction control instruction to the ETC antenna controller 30.
And the license plate information checking unit is used for checking whether the license plate number in the information is consistent with the license plate number in the fee deduction request of the server 10 and whether the license plate number is in a blacklist or not according to the acquired information after the electronic tag information returned by the ETC antenna controller is acquired, correctly responding to the ETC antenna controller 30 if the checking is successful, and starting the order processing unit to mark the order failure if the checking is failed, closing the current transaction of the ETC and reporting the order failure to the server 10. In the present invention, the license plate verification is a process between the client 20 and the ETC antenna controller, and the client 20 can check whether the requested license plate is consistent with the charged license plate after the ETC antenna reads the license plate.
And the order processing unit is used for receiving the fee deduction result of the ETC antenna controller, modifying the order state of the database, sending a transaction closing instruction, and reporting the order closing instruction to the service terminal 10, or marking the current order failure when the verification fails, closing the current transaction of the ETC and reporting the current transaction to the service terminal 10. Preferably, after the client 20 reports the order successfully, the order is deleted from the local database, after the reporting fails, the process is ended, and then the order is reported to the timing task component in the client at regular intervals until the reporting is successful.
And the connection information cache 30 is used for storing the mapping relationship between the ip of the server 10 and the client 20, which is stored by the server 10. In the invention, the server can be deployed in a cluster, the connection between the client and the server can only fall on one server, and the corresponding server is found for calling when a payment request is issued, and the cache of the redis server is mainly used.
And the ETC antenna controllers 40 are used for controlling the operation of the ETC antennas according to lane transaction control instructions of the client 20, and each controller can be connected with at most 4 ETC antennas to represent 4 lanes.
Specifically, after receiving the lane transaction control instruction of the client 20, the ETC antenna controller 40 opens the ETC antenna of the corresponding lane according to the lane transaction control instruction, reads the electronic tag information and returns the electronic tag information to the client 20, the client 20 checks whether the read license plate number is consistent with the license plate number from the fee deduction request of the server 10d and whether the license plate number is in the blacklist, if the check fails, the order is marked to fail, the transaction of the ETC is closed, if the check succeeds, the ETC antenna controller 40 correctly responds to the ETC antenna controller 40, the ETC antenna controller 40 executes fee deduction, and returns the fee deduction result to the client 20.
And an ETC antenna 50 for scanning electronic tag (OBU) information under the control of the ETC antenna controller 40 and returning the read information to the ETC antenna controller 40.
Fig. 3 is a flowchart illustrating steps of an ETC bidirectional encrypted communication method based on Netty according to the present invention. As shown in fig. 3, the ETC bidirectional encrypted communication method based on Netty of the present invention includes the following steps:
step S1, after the client establishes connection with the server, the client sends a registration request to the server through the connection, and the server obtains the public key corresponding to the registration request to verify whether the registration request is legal, and returns the registration processing result to the client to complete registration of the client.
Specifically, step S1 further includes:
step S100, after establishing connection with the server, sending a registration request to the server, and creating a registration processor to be cached to the local, wherein the registration processor blocks all operations of the client when the client registers to the server.
Specifically, a client starts to establish connection with a server, a registration request message is sent to the server through the connection immediately after the connection is successfully established, data is transmitted by using an AES encryption mode, a registration processor is newly built to be cached locally, when the client registers with the server, the registration processor blocks all operations of the client, including establishing connection with an ETC antenna and reporting deduction result operations, and the operations are meaningless actions before the connection is established with the server.
Step S101, the server receives a registration request sent by the client, acquires a public key corresponding to the registration request to verify whether the registration request is legal, binds the ip of the server and the information of the client together after the verification is passed, stores the bound ip and the information of the client into a connection information cache to establish a mapping relation, and returns a registration processing result to the client.
And step S102, when the client receives the response of the server, the registration identifier of the registration processor is changed into true, and then the task of the registration processor is interrupted and moved out of the local cache, namely the registration processor is destroyed.
In the present invention, the blocking logic of the registration processor is: and circularly judging whether the registration success identifier is true or not, blocking for a period of time when the registration success identifier is not true, and judging again and blocking again after the period of time is exceeded until the registration success identifier is true. When the server side responds to the client side, the client side immediately modifies the registration success identification of the registration processor into true, the registration processor immediately stops blocking when monitoring that the registration success identification is true, and then the client side destroys the registration processor and simultaneously runs the work after the blocking is finished.
Preferably, before step S102, the method further includes the following steps:
after the response of the waiting server is overtime, the register processor calls the task processing thread to send the message of the register request to the server again until the response of the server is received.
Preferably, step S1 further includes the steps of:
if the server is disconnected from the client and the reconnection is successful, the client sends a connection establishment success event, and returns to the step S100 to initiate the registration process again after being captured by the reconnection success event listener, so as to refresh the connection cache of the server. Specifically, because the Netty network framework is provided with a reconnection mechanism of a server and a client, a connection establishment success event is added on the original basis, namely after reconnection succeeds, the client sends out the connection establishment success event, and after the reconnection success event is captured by an event monitor, a registration process is initiated again to refresh a connection cache of the server.
Since the first connection and the reconnection cannot be distinguished, the registration success flag registered after the first registration is successful is set to true, because the first registration is performed manually, and the subsequent registrations are triggered by the connection establishment success event listener, so that the successful situation of the first connection needs to be ignored.
And step S2, after the registration is successful, the client is connected with the ETC antenna controller by using Socket, and after the connection is successful, the client responds to the heartbeat detection of the ETC hardware to keep long connection and caches the connection to the local.
And step S3, when the server side receives the payment request, the server side sends a fee deduction request message to the corresponding client side, the client side generates a local order according to the fee deduction request, verifies the legality of the fee deduction request message, and sends a lane transaction control command to the ETC antenna controller according to the verification result to control and execute the fee collection. In the embodiment of the present invention, the verification of the validity of the fee deduction request message includes, but is not limited to, verifying whether the request is from a unique identifier authorized by the service end, verifying whether the lane to be paid is existed, and verifying that the lane to be paid is not currently processed in the fee deduction process.
Specifically, step S3 further includes:
step S300, when receiving the payment request of the local timing charging system, the server side issues a message of the fee deduction request to the corresponding client side. That is to say, when needing to pay, the local time-counting charging system sends a payment request to the server cluster, the payment request at least includes the number of the vehicle license plate, the lane, the information of the fee deduction amount, etc. when receiving the payment request of the local time-counting charging system, the server cluster generates a 'payment order' and obtains the connection information cache through the key information, confirms which server node needs to be used for communication, the server node and the client 20 are in a one-to-one relationship, finds the corresponding server node, and then sends the information of the fee deduction request to the corresponding client. Preferably, the server sends a delay message corresponding to the payment order to the message queue while issuing the deduction request. The purpose of this delay message is to mark that the payment order is failed if the client has not responded to the debit request within a certain time.
Step S301, generating a local order according to the fee deduction request, checking whether the lane requested by the server exists according to the fee deduction request, and processing whether the lane to be deducted fee currently exists or not by the fee deduction process. In the present invention, a local order is generated whether the deduction request information passes or fails, and the success or failure is determined by the status of the order, and is reported to the server 10.
And step S302, if the lane exists and the current lane to be paid is not processed by the fee deduction process, taking out the socket connection from the connection cache, setting the information of the current lane in the local cache, sending a lane transaction control instruction to the ETC antenna controller, and otherwise, marking the failure of the current order, closing the transaction of the current ETC and reporting the transaction to the server.
And step S303, after receiving the lane transaction control instruction of the client, the ETC antenna controller opens the ETC antenna of the corresponding lane according to the lane transaction control instruction, reads the electronic tag information and returns the electronic tag information to the client.
And step S304, after the client side acquires the electronic tag information returned by the ETC antenna controller, checking whether the license plate number in the information is consistent with the license plate number in the fee deduction request of the server side and whether the license plate number is in a blacklist according to the acquired information, if the checking is successful, correctly responding to the ETC antenna controller, otherwise, starting an order processing unit to mark order failure, closing the current transaction of the ETC, and reporting the order failure to the server side. That is to say, the license plate verification is a process between the client and the ETC antenna controller, and the client can check whether the requested license plate is consistent with the paid license plate after the ETC antenna reads the license plate.
In step S305, the ETC antenna controller executes fee deduction after receiving the correct response from the client, and returns a fee deduction result to the client.
Step S306, the client modifies the order state of the database according to the received deduction result and sends a transaction closing instruction, and then the order is reported to the server.
Examples
Fig. 4 is a system architecture diagram of the ETC bidirectional encrypted communication system based on Netty in the embodiment of the present invention. In this embodiment, the system includes:
1. the server side: the method is used as a unified registration center of the client, automatically manages and maintains connection information of each client, verifies the legality of the client, receives and issues payment requests to the clients, and collects payment information of each client.
2. A client: the ETC antenna controller is communicated with the ETC antenna controller and the server, long connection is kept, the actions of the ETC antenna are operated after payment requests from services are received, the functions of opening transactions, reading electronic tags, deducting fees, closing transactions and reporting transactions are completed, and the ETC antenna and the server can be automatically reconnected after connection and disconnection.
3. Caching connection information: the server can be deployed in a cluster, the connection between the client and the server can only fall on one server, the corresponding server is found for calling when the payment request is issued, and the cache of the redis server is mainly used.
4. The ETC antenna controllers control the operation of the ETC antennas, and each controller can be connected with 4 ETC antennas at most and represents 4 lanes.
5. And the ETC antenna scans electronic tag (OBU) information, and the read information is returned to the ETC antenna controller.
Fig. 5 is a flowchart of the operation of the client in the embodiment of the present invention. In this embodiment, the starting process of the client:
1. the client starts to establish connection with the server, immediately sends a registration message to the server through the connection after the connection is successfully established, transmits data by using an AES encryption mode, and manually creates a registration processor to be cached locally.
2. The register processor blocks all operations of the client, including whether the client has registered the identifier, the task processing thread and waiting for the response time of the server, when the client registers in the server, the blocking is ended only after the server responds to the registration request of the client, otherwise, after the response time of the waiting server is overtime, the task processing thread is called to send the registered message again until the server receives the response.
The Netty network framework is provided with a reconnection mechanism of a server and a client, and a connection establishment success event is added on the original basis. If the server is disconnected with the client and a connection establishment success event is sent out after the reconnection is successful, the registration process is initiated again after the reconnection success event is captured by the reconnection success event monitor, so that the connection cache of the server side is refreshed.
Since the first connection and the reconnection cannot be distinguished, the registration success flag registered after the first registration is successful is set to true, because the registration is manually performed during the first registration, and the subsequent registration is triggered by the connection establishment success event listener, so that the successful situation of the first connection needs to be ignored.
3. After receiving the message, the server acquires a public key corresponding to the request, then verifies whether the message is legal, binds the ip of the server and the information of the client together after the verification is passed, stores the bound ip and the information of the client into a redis cache to establish a mapping relation, and replies that the client receives the registration information.
4. After receiving the response of the server, the client firstly changes the registration identifier of the registration processor into true, then interrupts the task of the registration processor and moves the task out of the local cache, then connects the local cache with the ETC antenna controller by using Socket, responds to the heartbeat detection of the ETC hardware after the connection is successful so as to keep long connection, and caches the connection to the local.
Fig. 6 is a fee deduction flow chart of the ETC in the embodiment of the invention. In this embodiment, the fee deduction process of the ETC is as follows:
1. when the server cluster receives a payment request of a local timing charging system, a 'payment order' is generated, connection information cache is obtained through key information, it is confirmed which server node needs to be used for communication, the server nodes and the client 20 are in a one-to-one relationship, a corresponding server node is found, a message of the payment request is sent to the client, a delay message corresponding to the payment order is sent to a message queue, and the message is used for marking that the order is failed if the client does not respond to the payment request within a certain time.
2. After receiving the request for deducting fee, the client checks the legality of the request information, generates a local order whether the request information passes or does not pass, determines success or failure according to the state of the order, and finally reports the order to the server.
3. The client side needs to check whether the lane requested by the server side exists or not, no fee deduction process is carried out on the lane to be deducted currently, after the check is passed, the client side fetches the socket connection from the connection cache, information of the current lane is set in the local cache, and then lane transaction control is sent to the ETC antenna controller.
4. The ETC antenna controller opens the ETC antenna to start reading the electronic tag information and return the electronic tag information to the client after receiving the transaction starting instruction, the client checks whether the read license plate number is consistent with the license plate number requested by the server and whether the license plate number is in a blacklist, if the check fails, the order is marked to fail, and the transaction of the ETC is closed; and if the verification is successful, the ETC antenna controller is correctly responded.
5. The ETC antenna controller executes fee deduction and returns to the fee deduction interface, the client receives the fee deduction result, modifies the order state of the database and sends an order closing instruction, and then the order is reported to the server.
6. After the client side reports the order successfully, the order is deleted from the local database, after the reporting fails, the process is ended, and the order is subsequently submitted to a timing task component in the client side for reporting at regular intervals until the reporting is successful.
In summary, the characteristics of disconnection reconnection, multi-machine deployment and bidirectional encrypted communication are developed on the basis of a Netty network framework, so that the server only needs to serve as a management center to be mainly responsible for communication with each client, a network list of the client is maintained, payment information such as order numbers, license plate numbers and the like is recorded, the client registers the network information and reports the payment information of the ETC to the server, the ETC is simplified into a payment channel, and the access efficiency is improved to a great extent.
The foregoing embodiments are merely illustrative of the principles and utilities of the present invention and are not intended to limit the invention. Modifications and variations can be made to the above-described embodiments by those skilled in the art without departing from the spirit and scope of the present invention. Therefore, the scope of the invention should be determined from the following claims.

Claims (6)

1. A Netty-based ETC bidirectional encrypted communication system based on a Netty network framework comprises:
the system comprises a server side and a client side, wherein the server side is deployed in a cluster mode and serves as a unified registration center of the client side, the connection information of all the client sides is automatically managed and maintained, the legality of the client side is verified, a payment request is received, a payment order is generated according to the payment request, connection information cache is obtained through key information in the payment request to determine which server side node is used for communication, and a fee deduction request is issued to the client side; collecting payment information of each client;
the client side is communicated with the ETC antenna controller and the server side and keeps long connection, operates the action of the ETC antenna controller after receiving the fee deduction request from the server side, completes the functions of starting transaction, reading electronic tags, deducting fees, closing transaction and reporting transaction, and automatically reconnects the ETC antenna controller and the server side after disconnection;
the connection information cache is used for storing the mapping relation between the ip of the server and the client;
the ETC antenna controller is used for controlling the operation of the corresponding ETC antenna according to the lane transaction control instruction of the client;
an ETC antenna for scanning electronic tag information under the control of the ETC antenna controller and returning the read information to the ETC antenna controller,
wherein the client further comprises:
a registration request sending module, configured to send a registration request to the server after establishing a connection with the server, and create a new registration processor to cache to the local, where the registration processor blocks all operations of the client when the client registers with the server, and ends the blocking after receiving a response from the server, and when the server is disconnected from the client, and after receiving a successful connection establishment event from the server, a reconnection successful event listener captures the event and starts the registration request sending module to perform a registration process again in an asynchronous manner according to a registration identifier;
the register response processing module is used for modifying the register identifier of the register processor after receiving the register response of the server, interrupting the task of the register processor and moving the task out of the local cache;
the antenna connection module is used for connecting the antenna controller with the ETC by using Socket after the registration is successful, responding to heartbeat detection of the ETC antenna controller after the connection is successful so as to keep long connection, and caching the connection to the local;
a fee deduction request processing module for receiving the fee deduction request of the server, generating a local order according to the fee deduction request, checking the legality of the fee deduction request information, sending a lane transaction control instruction to the ETC antenna controller to control and execute charging according to the checking result, processing and reporting the order state,
the server side comprises:
the registration processing module is used for receiving the registration request sent by the client, acquiring a public key corresponding to the registration request to verify whether the registration request is legal or not, binding the ip of the server and the information of the client together after the verification is passed, storing the bound ip and the information of the client into the connection information cache to establish a mapping relation, and returning a registration processing result to the client;
the fee deduction request module is used for issuing a fee deduction request message to a corresponding client when receiving a payment request of a local timing and charging system;
a payment information collecting module for receiving the reported information of the client and collecting the payment information of each client
When a payment request of a local timing charging system is received, a cluster of the server generates a payment order and obtains the connection information cache through key information so as to find a corresponding server node, a fee deduction request message is issued to a client through the fee deduction request module, and a delay message corresponding to the payment order is sent to a message queue while the fee deduction request is issued, so that the client marks the payment order as a failure order when the client does not respond to the fee deduction request within a certain time.
2. A Netty based ETC two-way encrypted communications system according to claim 1 wherein: the payment request at least comprises a vehicle license plate number needing payment, a lane and fee deduction amount information.
3. A Netty based ETC two-way encrypted communications system according to claim 2 wherein: and after the response of the waiting server is overtime, the registration processor calls the task processing thread to send the message of the registration request again until the response of the server is received.
4. The Netty based ETC two-way encrypted communication system according to claim 3 wherein the deduction request processing module further comprises:
the local order generating unit is used for generating a local order according to the fee deduction request;
the lane information checking unit is used for checking whether a lane requested by the server exists or not according to the fee deduction request when the fee deduction request is received, whether fee deduction processes exist in the current lane to be deducted or not is processed, if the lane exists and the current lane to be deducted does not have the fee deduction processes, the lane transaction control instruction generating unit is started, and if not, the order processing unit is started to mark that the current order fails, the transaction of the current ETC is closed, and the transaction is reported to the server;
the lane transaction control instruction generating unit is used for taking out the socket connection from the connection cache after the lane information of the lane information verifying unit passes the verification, setting the information of the current lane in the local cache and sending a lane transaction control instruction to the ETC antenna controller;
the license plate information checking unit is used for checking whether the license plate number in the information is consistent with the license plate number in the fee deduction request of the server side and whether the license plate number is in a blacklist or not according to the acquired information after the electronic tag information returned by the ETC antenna controller is acquired, if the checking is successful, the order processing unit is correctly responded to the ETC antenna controller, otherwise, the order processing unit is started to mark the order failure, the current transaction of the ETC is closed, and the current transaction of the ETC is reported to the server side;
and the order processing unit is used for receiving the fee deduction result of the ETC antenna controller, modifying the order state of the database, sending a transaction closing instruction, and reporting the order closing instruction to the service terminal, or marking the failure of the current order, closing the current transaction of the ETC and reporting the transaction to the service terminal when the verification fails.
5. The Netty-based ETC two-way encrypted communication system according to claim 4, wherein: and after the client successfully reports the order, deleting the order from the local database, ending the process after the reporting fails, and subsequently submitting the order to a timing task component in the client for reporting at regular intervals until the reporting is successful.
6. A ETC bidirectional encryption communication method based on Netty comprises the following steps:
step S1, after the client establishes connection with the server, the client sends registration request to the server through the connection, the server obtains the public key corresponding to the registration request to verify whether the registration request is legal, and returns the registration processing result to the client to complete the registration of the client, when the server is disconnected with the client, after receiving the successful event of the connection establishment of the server, the event is captured by the event monitor with successful reconnection and the registration request sending module of the client is started to re-perform the registration process in an asynchronous mode according to the registration identification;
step S2, after the registration is successful, the client is connected with the ETC antenna controller by using Socket, and after the connection is successful, the client responds to the heartbeat detection of the ETC antenna controller to keep long connection and simultaneously caches the connection to the local;
step S3, when the server receives a payment request of a local timing charging system, a payment order is generated according to the payment request, connection information is obtained through key information in the payment request and cached to determine which server node is used for communication, a fee deduction request is issued to a corresponding client, a delay message corresponding to the payment order is sent to a message queue while the fee deduction request is issued, the client marks the payment order as a failure order when the client does not respond to the fee deduction request within a certain time, the client generates a local order according to the fee deduction request, verifies the legality of the fee deduction request information, sends a lane transaction control instruction to an ETC antenna controller according to a verification result to control to execute charging, processes and reports the order state.
CN202011134931.2A 2020-10-21 2020-10-21 ETC bidirectional encryption communication system and method based on Netty Active CN112261647B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011134931.2A CN112261647B (en) 2020-10-21 2020-10-21 ETC bidirectional encryption communication system and method based on Netty

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011134931.2A CN112261647B (en) 2020-10-21 2020-10-21 ETC bidirectional encryption communication system and method based on Netty

Publications (2)

Publication Number Publication Date
CN112261647A CN112261647A (en) 2021-01-22
CN112261647B true CN112261647B (en) 2022-04-22

Family

ID=74263725

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011134931.2A Active CN112261647B (en) 2020-10-21 2020-10-21 ETC bidirectional encryption communication system and method based on Netty

Country Status (1)

Country Link
CN (1) CN112261647B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113345122B (en) * 2021-04-25 2022-10-04 辽宁高速通智慧出行有限责任公司 ETC vehicle information correction method and system
CN114333182A (en) * 2021-12-28 2022-04-12 蜂助手股份有限公司 Method, device and system for realizing voice broadcast of cash box
CN115190455B (en) * 2022-09-13 2023-01-13 安徽高灯微行科技有限公司 Detection and data processing method, system and equipment for vehicle-mounted electronic label equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103345777A (en) * 2013-06-25 2013-10-09 广州杰赛科技股份有限公司 Intelligent vehicle charging system and method
CN103428287A (en) * 2013-08-09 2013-12-04 华为技术有限公司 Method and device for establishing connection

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101178851A (en) * 2007-11-27 2008-05-14 张涛 Intelligent traffic control system and method based on vehicle mounted intelligent terminal
CN107067480A (en) * 2017-03-14 2017-08-18 河海大学 A kind of ETC Lane automatic toll collections system and charging method
US10873567B2 (en) * 2017-06-26 2020-12-22 Open Text Corporation Systems and methods for providing communications between on-premises servers and remote devices
CN108038005A (en) * 2017-12-28 2018-05-15 广东蜂助手网络技术股份有限公司 Shared resource access method, client, server-side, system based on zookeeper
CN109840960A (en) * 2018-12-29 2019-06-04 山东中创软件工程股份有限公司 A kind of highway method of mobile payment and its system
CN111340969B (en) * 2020-03-03 2021-01-05 广州优路加信息科技有限公司 Non-card ETC offline processing method and device, computer equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103345777A (en) * 2013-06-25 2013-10-09 广州杰赛科技股份有限公司 Intelligent vehicle charging system and method
CN103428287A (en) * 2013-08-09 2013-12-04 华为技术有限公司 Method and device for establishing connection

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
一种基于Netty的环保物联网实时双向通信模型研究;庄国强;《郑州师范教育》;20171125(第06期);全文 *

Also Published As

Publication number Publication date
CN112261647A (en) 2021-01-22

Similar Documents

Publication Publication Date Title
CN112261647B (en) ETC bidirectional encryption communication system and method based on Netty
US7107247B2 (en) Electronic value system
CA2397711C (en) Method and apparatus for delivering program to storage module of mobile terminal
CN106447799B (en) extensive applicability and high efficiency parking lot charging system
CN113038418B (en) Vehicle-road cooperative communication method, system, equipment and storage medium
CN110335498B (en) Parking lot barrier gate system based on block chain and information interaction method
CN101635071B (en) Method, system and device for installing/updating e-wallet
CN104599119A (en) Embedding and cloud computing based vending machine mobile electronic payment method
CN111899368B (en) ETC fee deduction system fee deduction method based on remote deployment of PSAM card, ETC fee deduction control equipment and system
CN109887112B (en) Data processing method and device and electronic equipment
CN1630401A (en) A secure device and information processing apparatus
TW201826182A (en) T-BOX, vehicle payment system based on T-BOX and method thereof
US7188149B2 (en) Storage operating data control system
TW503355B (en) System and method for communication with mobile data processing devices by way of ""mobile software agents""
CN110874738A (en) Method and device for collecting and processing traffic violation information of intelligent traffic control and intelligent traffic control
JP4787145B2 (en) Communication device and communication management system
US20230222483A1 (en) Server, ETCS Terminal and Method of Controlling the Same
CN112767566B (en) User equipment, method and ETC system for ETC system
CN113726731A (en) Method and system for realizing real-time communication between terminal APP and server based on TCP
CN114493565A (en) Account association method and account association management system
JP5267594B2 (en) Wireless communication system
CN108600218B (en) Remote authorization system and remote authorization method
CN114841703A (en) Mobile payment method
JP2007128394A (en) Base station apparatus, terminal, and communication system
JP4555428B2 (en) IC chip drive system and chip drive server

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: An etc bidirectional encrypted communication system and method based on netty

Effective date of registration: 20220627

Granted publication date: 20220422

Pledgee: Guangdong Development Bank Limited by Share Ltd. Guangzhou branch

Pledgor: Guangzhou Zhufeng Network Technology Co.,Ltd.

Registration number: Y2022980009029

PC01 Cancellation of the registration of the contract for pledge of patent right
PC01 Cancellation of the registration of the contract for pledge of patent right

Date of cancellation: 20230831

Granted publication date: 20220422

Pledgee: Guangdong Development Bank Limited by Share Ltd. Guangzhou branch

Pledgor: Guangzhou Zhufeng Network Technology Co.,Ltd.

Registration number: Y2022980009029