Embodiment
Below in conjunction with accompanying drawing a kind of smart card network data transmitting method and the device that the embodiment of the invention provides is described in detail.
As shown in Figure 1, be a kind of smart card network data transmitting method that the embodiment of the invention provides, this method, the specific implementation process is as follows:
101: the gateway of terminal equipment receives at least one data request message (for example initiating the http request); Be specially: the gateway of described terminal equipment receives a plurality of data request information of Client-initiated, and this data request information can come from a plurality of data sources; For example: terminal equipment receives the user and opens a plurality of browsing pages simultaneously, and the data request information that each webpage of browsing can be by a series is obtained corresponding data from smart card is distolateral, as picture, voice, text or the like.
102: the gateway of terminal equipment is set up the channel information structure of each data request information correspondence, described channel information structure writes down the relevant information of described data request information and the data transmission channel information corresponding with it, the corresponding channel information structural identification of described channel information structure is so that the described data request information data transmission channel corresponding with it bound mutually; Wherein, described channel information structure is first interrecord structure; This structure comprises: data transmission channel information, request of data information, socket (socket) information and receive listening port information of described data request information etc.Wherein, described socket is used to guarantee the consistency of described data request information and response thereof, that is to say, described data request information and response thereof need be finished data interaction by same data transmission channel; Described request of data information comprises length information of described request of data data or the like.
Be specially: the data request information that receives described a plurality of data source transmissions when the gateway of described terminal equipment, then set up corresponding channel information structure according to the data request information of current reception for it, this structure can be used for writing down the relevant information of current data request message and the data transmission channel information corresponding with it; Wherein, the relevant information of described current data request message is request of data information, socket information and the listening port information that receives described data request information etc.
103: according to described channel information structural identification, the gateway of terminal equipment is handled described data request information; Can make the channel information structure as one group of set of queues according to receiving the channel information structural identification of putting in order out after the data request information, wait for that processed thread handles one by one, each request of data information of being about to and corresponding information such as data transmission channel information thereof are handled as an independent integral body, are not subjected to the interference of other request of data.
As shown in Figure 2, be the another kind of smart card network data transmitting method that the embodiment of the invention provides, this method, the specific implementation process is as follows:
201: the gateway of terminal equipment receives at least one data request message; Be specially: the gateway of described terminal equipment receives a plurality of data request information of Client-initiated, and this data request information can come from a plurality of data sources; For example: user side is initiated the http request, the gateway of terminal equipment receives the user and opens a plurality of browsing pages simultaneously, each webpage of browsing can be by a series data request information obtain corresponding data from smart card is distolateral, as picture, voice, text or the like.
202: the gateway of terminal equipment is inquired about described channel status, if the idle channel of not opened then adds the channel information structural identification and sets up corresponding channel information structure; Have the available idle channel of having opened if inquire about described channel status, then execution in step 204.Be specially: for example: 1-N passage arranged, in the process of inquiry passage 1-N, if existence has been opened and state is idle passage 2, then directly use described passage 2, wherein, channel information structure label is 2, and execution in step 204 entered in the data transmission channel information that the channel information structure that it is corresponding comprises, request of data information, socket (socket) information and the records such as listening port information that receive described data request information; If no passage is opened and is left unused, then open up passage n, promptly add channel information structural identification n, set up corresponding channel information structure, the information in its corresponding channel information structure of being about to is recorded in the channel information structure of channel information structural identification correspondence and goes.
203: the gateway of terminal equipment is set up the channel information structure of each data request information correspondence, described channel information structure writes down the relevant information of described data request information and the data transmission channel information corresponding with it, and described channel information structure can corresponding channel information structural identification; Wherein, the relevant information of described data request information comprises: request of data information, socket information and the listening port information that receives described data request information; Described data transmission channel information comprises: the channel number of data transmission channel, channel status of data transmission channel or the like.Be specially: the gateway of described terminal equipment adds the channel information of described passage and listening port information, socket information and the request of data information of the described current data request message that receives in the described channel information structure to; More specifically, exactly the data transmission channel information of distributing, the listening port information that receives described data request information and request of data information are associated with described data request information and add in the described channel information structure, thereby guarantee the gateway and the mutual consistency of smart card end data of described terminal equipment.For example: when terminal equipment receive relevant certain webpage that the user sends data request information the time, then the gateway of terminal equipment adds listening port information, socket information and the request of data information of channel information, described data request information in the described channel information structure to.Wherein, described channel information structure can comprise: channel information, request of data information, socket information and the listening port information that receives described data request information.
204: the gateway of terminal equipment is handled described data request information according to described channel information structural identification; Can make the channel information structure as one group of set of queues according to receiving the channel information structural identification of putting in order out after the data request information, wait for that processed thread handles one by one, each request of data information of being about to and corresponding information such as data transmission channel information thereof are handled as an independent integral body, are not subjected to the interference of other request of data.
As shown in Figure 3, be the another kind of smart card network data transmitting method that the embodiment of the invention provides, this method, the specific implementation process is as follows:
301: smart card receives at least one data request message; Be specially: described smart card can receive at least one data request information of Client-initiated by each data transmission channel of being set up with the BIP gateway.
302: smart card is set up the channel information structure of each data request information correspondence, described channel information structure writes down the relevant information of described data request information and the data transmission channel information corresponding with it, the corresponding channel information structural identification of described channel information structure is so that the described data request information data transmission channel corresponding with it bound mutually.Wherein, described channel information structure is second interrecord structure, this structure comprises: described second interrecord structure comprises: the buffer memory that receives described data request information, receive the length of described data request information, receive the data transmission channel number and the channel status of described data request information, receive the end sign of described data request information, TLS (Transport Layer Security, Transport Layer Security) link identification, described data transmission channel is opened pattern information, the total data length that described data transmission channel receives and sends, open the port information of passage.
Be specially: smart card is bound the described data request information data transmission channel corresponding with it that receives from the gateway of terminal equipment mutually, is about to described second interrecord structure and comprises: the buffer memory that receives described data request information, receive the length of described data request information, receive the data transmission channel number and the channel status of described data request information, receive the end sign of described data request information, the Transport Layer Security link identification, described data transmission channel is opened pattern information, the total data length that described data transmission channel receives and sends, port information of opening passage or the like records in described second interrecord structure.
303, according to described channel information structural identification, smart card is handled described data request information.
As shown in Figure 4, be the another kind of smart card network data transmitting method that the embodiment of the invention provides, this method, the specific implementation process is as follows:
401: smart card receives at least one data request message; Be specially: described smart card can receive at least one data request information of Client-initiated by each data transmission channel of being set up with the BIP gateway.
402: smart card inquiry channel status, if described smart card channel status is then carried out following steps for opening.
403: smart card is set up the channel information structure of each data request information correspondence, described channel information structure writes down the relevant information of described data request information and the data transmission channel information corresponding with it, and described channel information structure can corresponding channel information structural identification; Wherein, the relevant information of described data request information comprises: the end sign, the Transport Layer Security link identification that receive the buffer memory of described data request information, the length that receives described data request information, the described data request information of reception; Described data transmission channel information comprises: data transmission channel number and channel status, described data transmission channel are opened pattern information, described data transmission channel receives and total data length of sending or the like.Described several channel information structure is second interrecord structure, and this structure comprises: receive described data request information buffer memory, receive described data request information length, receive the data transmission channel number of described data request information and channel status, the end sign of the described data request information of reception, Transport Layer Security link identification, described data transmission channel are opened pattern information, described data transmission channel receives and the total data length that sends, the port information of opening passage.
404: according to described channel information structural identification, described smart card is handled described data request information.Be specially: described smart card will block data after end is resolved as the response data to described request, send to the gateway of terminal equipment by the response to described data request information.Card end is one group of indivisible independent information by the information of setting up channel information machine interrecord structure and guaranteeing a passage when each data arrive or send, can not change because of the incident of other passages.
As shown in Figure 5, be a kind of smart card network data transmitting device that the embodiment of the invention provides, this device specifically comprises:
Message sink unit 501 is used to receive at least one data request message;
The channel information structure is set up unit 502, be used to set up the channel information structure of each data request information correspondence, described channel information structure writes down the relevant information of described data request information and the data transmission channel information corresponding with it, the corresponding channel information structural identification of described channel information structure is so that the described data request information data transmission channel corresponding with it bound mutually;
Information process unit 503 is used for according to described channel information structural identification described data request information being handled.
It should be noted that this device also comprises:
Query unit is used to inquire about channel status.Be specially: in inquiry, run into and open and state is that idle passage then directly uses,, then open up passage, promptly add the channel information structural identification and set up the channel information structure if no passage is opened and leave unused by passage 1-N.For example: 1-N passage arranged, in the process of inquiry passage 1-N, if existence has been opened and state is idle passage 2, then directly use described passage 2, wherein, channel information structure label is 2, and the data transmission channel information that the channel information structure that it is corresponding comprises, request of data information, socket (socket) information and the records such as listening port information that receive described data request information are entered; If no passage is opened and is left unused, then open up passage n, promptly add channel information structural identification n, set up corresponding channel information structure, the information in its corresponding channel information structure of being about to is recorded in the channel information structure of channel information structural identification correspondence and goes.
It should be noted that the above channel information structure comprises: first interrecord structure, described first interrecord structure is set up at gateway side, so that the gateway of the terminal equipment data transmission channel that described data request information is corresponding with it is bound mutually.
Described channel information structure also comprises: second interrecord structure, described second interrecord structure is set up at the card end, so that the card end data transmission channel that described data request information is corresponding with it is bound mutually.
Wherein, described first interrecord structure comprises: data transmission channel information, request of data information, socket information and the listening port information that receives described data request information;
Described second interrecord structure comprises: receive described data request information buffer memory, receive described data request information length, receive the data transmission channel number of described data request information and channel status, the end sign of the described data request information of reception, Transport Layer Security link identification, described data transmission channel are opened pattern information, described data transmission channel receives and the total data length that sends, the port information of opening passage.
As shown in Figure 6, a kind of smart card network data transmitting method that provides for the embodiment of the invention; The embodiment of the invention is an example with 7 data transmission channels, the idiographic flow of this method can for:
601: whether the gateway of terminal equipment is monitored 3516 and 4,116 two tcp ports has data request information to arrive; If do not listen to data request information, then continue to monitor; Arrive if listened to data request information, then carry out following steps.
602: when listen to described 3516 ports have data request information arrival and or listen to described 4116 ports when having data request information to arrive, judge whether the data length of described data request information is 0; If the data length of described data request information is not 0, then execution in step 603; If the data length of described data request information is 0, notice smart card channel status is for connecting but free of data, and then execution in step 609.
603: the gateway of terminal equipment obtains channel number to be 1 to 7 data transmission channel information and to be the described data request information distribute data transmission channel that receives.
604: the gateway according to described terminal equipment is the described data transmission channel that data request information is distributed that receives, for described data request information is added the channel information structural identification, and in the pairing channel information structure of described channel information structural identification, write down the relevant information of described data request information and the data transmission channel information corresponding with it.
605: the data transmission channel by described distribution sends described data request information.
606: smart card receives described data request information, and described data request information is carried out data parsing.
607: according to described data parsing result, for the data request information that the gateway of described terminal equipment sends is returned response.
608: judge whether described smart card is sent completely the response of returning of described data request information; If be sent completely, then carry out following steps.
609: smart card is closed the data transmission channel of described smart card and terminal equipment, and notifies described terminal equipment to continue to monitor.
As shown in Figure 7, the flow chart of data processing of smart card end in a kind of smart card network data transmitting method that provides for the embodiment of the invention; The embodiment of the invention is an example with 7 data transmission channels, and the idiographic flow of the data processing of described smart card end is:
701: initialization is provided with 7 BIP data transmission channel message structures; Described BIP data transmission channel message structure comprises: receive the buffer memory of described data request information, the length that receives described data request information, the channel information that receives described data request information, the end sign that receives described data request information, the port information of the described data request information of reception and the port information that sends the response of described data request information.
702: receive the data request information that described terminal equipment sends by described BIP data transmission channel; Described BIP data transmission channel can transmit 7 data request messages simultaneously.
703: judge that the described data request information that receives receives? if receive, then execution in step 704; If do not receive, then continue execution in step 702;
704: the described data request information that receives is handled;
705: judge whether the described data request information that receives is the TLS link, if the TLS link, then execution in step 706; If not the TLS link, then execution in step 707;
706: the data of being asked in the described data request information are carried out encryption, and the response by described data request information sends the gateway of described encryption data to described terminal equipment;
707: the gateway that the data of being asked in the described data request information is sent to described terminal equipment by the response of described data request information.
Do 708: the data of judging described data request information described request send and finish? finish if send, then execution in step 709; Do not finish if send, then carry out and continue to send.
709: smart card is closed the data transmission channel of described smart card and terminal equipment gateway, and notifies the gateway of described terminal equipment.
A kind of smart card network data transmitting method and device that the embodiment of the invention provides, by setting up corresponding channel information structure for described each data request information that receives, described channel information structure writes down the relevant information of described data request information and the data transmission channel information corresponding with it, the corresponding channel information structural identification of described channel information structure is so that the described data request information data transmission channel corresponding with it bound mutually; And, described data request information is handled according to described channel information structural identification.Like this, the gateway of terminal equipment can be bound mutually by the described channel information structure data transmission channel that described data request information is corresponding with it; The card end also can be bound mutually by the described channel information structure data transmission channel that described data request information is corresponding with it, make the request of data that gateway sent and its corresponding response message of terminal equipment transmit at same passage, guaranteed the consistency of request of data with its corresponding response message, can not produce entanglement because the multidata request initiates simultaneously, thereby realized the multi-data source request of data of terminal equipment initiation and the information interaction between the smart card, improved the utilance of resource in the smart card.
Through the above description of the embodiments, one of ordinary skill in the art will appreciate that: realize that all or part of step in the foregoing description method is to instruct relevant hardware to finish by program, described program can be stored in the computer read/write memory medium, this program is when carrying out, comprise step as above-mentioned method embodiment, described storage medium, as: ROM/RAM, magnetic disc, CD etc.
The above; only be the specific embodiment of the present invention, but protection scope of the present invention is not limited thereto, anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; can expect easily changing or replacing, all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection range of claim.