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 carried out detailed explanation.
As shown in Figure 1, be a kind of smart card network data transmitting method that the embodiment of the invention provides, this method, concrete implementation procedure is following:
101: the gateway of terminal equipment receives at least one data request message (for example initiating the http request); Be specially: the gateway of said 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 through a series is obtained corresponding data from smart card is distolateral, like picture, voice, text or the like.
102: the gateway of terminal equipment is set up the corresponding channel information structure of each data request information; Said channel information structure writes down the relevant information of said data request information and the data transmission channel information corresponding with it; The corresponding channel information structural identification of said channel information structure is so that the said data request information data transmission channel corresponding with it bound each other; 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 said data request information etc.Wherein, described socket is used to guarantee the consistency of said data request information and response thereof, that is to say, said data request information and response thereof need be accomplished data interaction through same data transmission channel; Said request of data information comprises length information of said request of data data or the like.
Be specially: the data request information that receives said a plurality of data source transmissions when the gateway of said 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 said data request information etc.
103: according to said channel information structural identification, the gateway of terminal equipment is handled said 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 is processed thread and 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, do not receive 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, concrete implementation procedure is following:
201: the gateway of terminal equipment receives at least one data request message; Be specially: the gateway of said 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 through a series data request information obtain corresponding data from smart card is distolateral, like picture, voice, text or the like.
202: the gateway of terminal equipment is inquired about said 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 said channel status, then execution in step 204.Be specially: for example: 1-N passage arranged; In the process of inquiry passage 1-N,, then directly use said passage 2 if existence has been opened and state is idle 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 said data request information; If no passage is opened and is left unused; Then carry out stayed n; Promptly add channel information structural identification n, set up corresponding channel information structure, soon the information in its corresponding channel information structure is recorded in the corresponding channel information structure of channel information structural identification and goes.
203: the gateway of terminal equipment is set up the corresponding channel information structure of each data request information; Said channel information structure writes down the relevant information of said data request information and the data transmission channel information corresponding with it, and said channel information structure can corresponding channel information structural identification; Wherein, the relevant information of said data request information comprises: request of data information, socket information and the listening port information that receives said data request information; Said 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 said terminal equipment adds the channel information of said passage and listening port information, socket information and the request of data information of the said current data request message that receives in the said channel information structure to; More specifically; Exactly the data transmission channel information of distributing, the listening port information that receives said data request information and request of data information are associated with said data request information and add in the said channel information structure, thereby guarantee the gateway and the mutual consistency of smart card end data of said 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, said data request information in the said channel information structure to.Wherein, said channel information structure can comprise: channel information, request of data information, socket information and the listening port information that receives said data request information.
204: the gateway of terminal equipment is handled said data request information according to said 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 is processed thread and 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, do not receive 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, concrete implementation procedure is following:
301: smart card receives at least one data request message; Be specially: said smart card can receive at least one data request information of Client-initiated through each data transmission channel of being set up with the BIP gateway.
302: smart card is set up the corresponding channel information structure of each data request information; Said channel information structure writes down the relevant information of said data request information and the data transmission channel information corresponding with it; The corresponding channel information structural identification of said channel information structure is so that the said data request information data transmission channel corresponding with it bound each other.Wherein, Described channel information structure is second interrecord structure; This structure comprises: said second interrecord structure comprises: receive said data request information buffer memory, receive said data request information length, receive the data transmission channel number of said data request information and channel status, the end sign of the said data request information of reception, TLS (Transport Layer Security, Transport Layer Security) link identification, said data transmission channel are opened pattern information, said data transmission channel receives and the total data length of transmission, open the port information of passage.
Be specially: smart card is bound the said data request information data transmission channel corresponding with it that receives from the gateway of terminal equipment each other, is about to said second interrecord structure and comprises: receive said data request information buffer memory, receive said data request information length, receive the data transmission channel number of said data request information and channel status, the end sign of the said data request information of reception, Transport Layer Security link identification, said data transmission channel are opened pattern information, said data transmission channel receives and the total data length of sending, port information of opening passage or the like record in said second interrecord structure.
303, according to said channel information structural identification, smart card is handled said 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, concrete implementation procedure is following:
401: smart card receives at least one data request message; Be specially: said smart card can receive at least one data request information of Client-initiated through each data transmission channel of being set up with the BIP gateway.
402: smart card inquiry channel status, if said smart card channel status is then carried out following steps for opening.
403: smart card is set up the corresponding channel information structure of each data request information; Said channel information structure writes down the relevant information of said data request information and the data transmission channel information corresponding with it, and said 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 said data request information, the length that receives said data request information, the said data request information of reception; Described data transmission channel information comprises: data transmission channel number is opened pattern information with channel status, said data transmission channel, said data transmission channel receives and the total data length of sending or the like.Said several channel information structure is second interrecord structure, and this structure comprises: receive said data request information buffer memory, receive said data request information length, receive the data transmission channel number of said data request information and channel status, the end sign of the said data request information of reception, Transport Layer Security link identification, said data transmission channel are opened pattern information, said data transmission channel receives and the total data length of sending, the port information of opening passage.
404: according to said channel information structural identification, said smart card is handled said data request information.Be specially: said smart card will block data after end is resolved as the response data to described request, send to the gateway of terminal equipment through the response to said data request information.Card end is one group of indivisible independent information through the information of setting up channel information machine interrecord structure and guaranteeing a passage in each data arrives or transmission, 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 corresponding channel information structure of each data request information; Said channel information structure writes down the relevant information of said data request information and the data transmission channel information corresponding with it; The corresponding channel information structural identification of said channel information structure is so that the said data request information data transmission channel corresponding with it bound each other;
Information process unit 503 is used for according to said channel information structural identification said 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 carry out stayed, 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 said 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 said data request information are entered; If no passage is opened and is left unused; Then carry out stayed n; Promptly add channel information structural identification n, set up corresponding channel information structure, soon the information in its corresponding channel information structure is recorded in the corresponding channel information structure of channel information structural identification and goes.
It should be noted that the above channel information structure comprises: first interrecord structure, said first interrecord structure is set up at gateway side, so that the gateway of the terminal equipment data transmission channel that said data request information is corresponding with it is bound each other.
Said channel information structure also comprises: second interrecord structure, said second interrecord structure is set up at the card end, so that the card end data transmission channel that said data request information is corresponding with it is bound each other.
Wherein, said first interrecord structure comprises: data transmission channel information, request of data information, socket information and the listening port information that receives said data request information;
Said second interrecord structure comprises: receive said data request information buffer memory, receive said data request information length, receive the data transmission channel number of said data request information and channel status, the end sign of the said data request information of reception, Transport Layer Security link identification, said data transmission channel are opened pattern information, said data transmission channel receives and the total data length of sending, the port information of opening passage.
A kind of smart card network data transmitting method as shown in Figure 6, as to provide 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 said 3516 ports have data request information arrival with or listen to said 4116 ports when having data request information to arrive, judge whether the data length of said data request information is 0; If the data length of said data request information is not 0, then execution in step 603; If the data length of said data request information is 0, notice smart card channel status is for connect 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 said data request information distribute data transmission channel that receives.
604: the gateway according to said terminal equipment is the said data transmission channel that data request information is distributed that receives; For said data request information is added the channel information structural identification, and in the pairing channel information structure of said channel information structural identification, write down the relevant information of said data request information and the data transmission channel information corresponding with it.
605: the data transmission channel through said distribution sends said data request information.
606: smart card receives said data request information, and said data request information is carried out data parsing.
607: according to said data parsing result, for the data request information that the gateway of said terminal equipment sends is returned response.
608: judge whether said smart card sends the response of returning of accomplishing said data request information; Accomplish if send, then carry out following steps.
609: smart card is closed the data transmission channel of said smart card and terminal equipment, and notifies said 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 said smart card end is:
701: initialization is provided with 7 BIP data transmission channel message structures; Said BIP data transmission channel message structure comprises: receive the buffer memory of said data request information, the length that receives said data request information, the channel information that receives said data request information, the end sign that receives said data request information, the port information of the said data request information of reception and the port information that sends the response of said data request information.
702: receive the data request information that said terminal equipment sends through said BIP data transmission channel; Described BIP data transmission channel can transmit 7 data request messages simultaneously.
Does 703: judging that the said data request information that receives receives finish? Finish if receive, then execution in step 704; Do not finish if receive, then continue execution in step 702;
704: the said data request information that receives is handled;
705: judge whether the said 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 to being asked in the said data request information are carried out encryption, send the gateway that said encryption data are given said terminal equipment through the response of said data request information;
707: the gateway that the data of being asked in the said data request information is sent to said terminal equipment through the response of said data request information.
Are 708: the data of judging said data request information described request sent and are finished? 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 said smart card and terminal equipment gateway, and notifies the gateway of said terminal equipment.
A kind of smart card network data transmitting method and device that the embodiment of the invention provides; Through setting up corresponding channel information structure for said each data request information that receives; Said channel information structure writes down the relevant information of said data request information and the data transmission channel information corresponding with it; The corresponding channel information structural identification of said channel information structure is so that the said data request information data transmission channel corresponding with it bound each other; And, said data request information is handled according to said channel information structural identification.Like this, the gateway of terminal equipment can be bound through the said channel information structure data transmission channel that said data request information is corresponding with it each other; The card end also can be bound through the said channel information structure data transmission channel that said data request information is corresponding with it each other; 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.
Description through above execution mode; 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 accomplish through program; Described program can be stored in the computer read/write memory medium, and this program comprises the step like above-mentioned method embodiment when carrying out; Described storage medium, as: ROM/RAM, magnetic disc, CD etc.
The above; Be merely embodiment of the present invention, but protection scope of the present invention is not limited thereto, any technical staff who is familiar with the present technique field is in the technical scope that the present invention discloses; Can expect easily changing or replacement, 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.