WO2014026493A1 - Data transmission method, terminal and system - Google Patents

Data transmission method, terminal and system Download PDF

Info

Publication number
WO2014026493A1
WO2014026493A1 PCT/CN2013/076137 CN2013076137W WO2014026493A1 WO 2014026493 A1 WO2014026493 A1 WO 2014026493A1 CN 2013076137 W CN2013076137 W CN 2013076137W WO 2014026493 A1 WO2014026493 A1 WO 2014026493A1
Authority
WO
WIPO (PCT)
Prior art keywords
identifier
terminal
local
layer
address
Prior art date
Application number
PCT/CN2013/076137
Other languages
French (fr)
Chinese (zh)
Inventor
毕军
王优
胡虹雨
王旸旸
张伟
Original Assignee
华为技术有限公司
清华大学
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 华为技术有限公司, 清华大学 filed Critical 华为技术有限公司
Publication of WO2014026493A1 publication Critical patent/WO2014026493A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/10Mapping addresses of different types
    • H04L61/103Mapping addresses of different types across network layers, e.g. resolution of network layer into physical layer addresses or address resolution protocol [ARP]

Definitions

  • the present invention relates to the field of network communication technologies, and in particular, to a data transmission method, terminal, and system. Background technique
  • a new module is created under the transport layer of the host end or a transport layer identifier is implemented by adding or modifying a transport layer protocol.
  • IP Internet Protocol
  • Embodiments of the present invention provide a data transmission method, terminal, and system.
  • the technical solution is as follows:
  • a method for data transmission comprising:
  • the first terminal sends the identifier layer interface of the local end to the second identifier through the application layer of the local end.
  • the second terminal sends data
  • the IP address is sent to the second terminal corresponding to the second IP address by calling the transport layer interface of the local end.
  • the method before the sending, by the application layer of the local end, the identifier layer interface of the local end to send data to the second terminal corresponding to the second identifier, the method further includes:
  • the IP address, and the local layer's transport layer interface is called to send a connection request to the second terminal corresponding to the second IP address to establish an identifier-based connection with the second terminal.
  • the identifier layer of the local end acquires the second terminal corresponding to the second identifier according to the second identifier After the second IP address, it also includes:
  • mapping by the identifier layer of the local end, the second identifier to the second Internet Protocol IP address corresponding to the second terminal, specifically:
  • the mapping relationship between the IP addresses maps the second identifier to a second IP address corresponding to the second terminal.
  • the method further includes:
  • a terminal in a second aspect, includes: a calling module, configured to send, by using an identifier layer interface of the local end by the application layer of the local end, data to the second terminal corresponding to the second identifier;
  • mapping module configured to map the second identifier to a second Internet Protocol IP address corresponding to the second terminal by using an identifier layer of the local end that is invoked by the calling module;
  • a sending module configured to send the data to the second terminal corresponding to the second IP address obtained by mapping by the mapping module by using the local layer's transport layer interface.
  • the calling module is further configured to: call, by the application layer of the local end, the identifier layer interface of the local end to the second identifier corresponding to the second identifier
  • the terminal sends a connection request
  • the mapping module is further configured to acquire, by using an identifier layer of the local end that is invoked by the calling module, a second IP address corresponding to the second terminal according to the second identifier;
  • the sending module is further configured to send a connection request to the second terminal corresponding to the second IP address acquired by the mapping module by using the identifier layer of the local end to call the transport layer interface of the local end, to establish a connection with the second terminal.
  • the connection of the identifier is further configured to send a connection request to the second terminal corresponding to the second IP address acquired by the mapping module by using the identifier layer of the local end to call the transport layer interface of the local end, to establish a connection with the second terminal.
  • the connection of the identifier is further configured to send a connection request to the second terminal corresponding to the second IP address acquired by the mapping module by using the identifier layer of the local end to call the transport layer interface of the local end
  • the terminal further includes:
  • a storage module configured to, by using an identifier layer of the local end, the second identifier and the second identifier of the second terminal
  • mapping relationship between IP addresses is stored in the local mapping table.
  • the mapping module is configured to map, by the identifier layer of the local end, the second identifier to the foregoing according to a mapping relationship between the second identifier and the second IP address in the local mapping table.
  • the second IP address corresponding to the second terminal.
  • the calling module is further configured to: when the local end updates the first IP address, invoke the local identifier layer interface by using the local application layer Sending a mapping update message to the second terminal, where the mapping update message includes an identifier corresponding to the local end and a new IP address;
  • the mapping module is configured to map the second identifier to a second IP address corresponding to the second terminal by using an identifier layer of the local end;
  • the sending module is further configured to send the mapping update message to the second terminal corresponding to the second IP address by using the local layer's transport layer interface to restore the new IP address according to the new IP address. Data transfer with the second terminal.
  • a method for data transmission includes: The second terminal receives the data sent by the first terminal corresponding to the first identifier by using the identifier layer interface of the local end by the application layer of the local end;
  • the data sent by the first terminal corresponding to the first identifier is received by the local layer's transport layer interface.
  • the third aspect in a first possible implementation manner of the third aspect, before the application layer of the local end invokes the identifier layer interface of the local end to receive the data sent by the first terminal corresponding to the first identifier, also includes:
  • connection layer sent by the first terminal corresponding to the first identifier is received by the local layer's transport layer interface to establish an identifier-based connection with the first terminal.
  • the application layer of the local end invokes the identifier layer interface of the local end to receive the first identifier before the connection request sent by the first terminal, the method further includes:
  • the local layer's identifier layer interface is used to listen to the connection request sent by the first terminal corresponding to the first identifier.
  • the local layer's transport layer interface is used to listen to the connection request sent by the first terminal corresponding to the first identifier.
  • the identifier layer of the local end invokes the local transport layer interface to monitor the corresponding identifier of the first identifier.
  • the method further includes:
  • An IP address and storing, by the identifier layer of the local end, a mapping relationship between the first identifier of the first terminal and the first IP address in a local mapping table, according to the first identifier in the local mapping table
  • the mapping relationship between the symbol and the first IP address sends data to the first terminal corresponding to the first identifier.
  • the method further includes:
  • mapping layer interface of the local terminal And receiving, by the application layer of the local end, the mapping layer interface of the local terminal, the mapping update file, the mapping identifier, the first identifier corresponding to the first terminal, and the new first IP address;
  • the transport layer interface of the local end receiving the location sent by the first terminal And mapping the update message to recover data transmission with the first terminal according to the new first IP address.
  • the transmitting layer interface that invokes the local end receives the location sent by the first terminal corresponding to the first IP address After the mapping update message, the method further includes:
  • mapping relationship between the first identifier and the new first IP address is stored in the local mapping table by the identifier layer of the local end.
  • the method further includes: The application layer directly invokes the transport layer interface of the local end to forward the data sent by the first terminal corresponding to the first identifier to the third terminal corresponding to the third identifier;
  • a terminal where the terminal includes:
  • a calling module configured to receive, by using an identifier layer interface of the local end, the data sent by the first terminal corresponding to the first identifier by using an application layer of the local end;
  • the receiving module is configured to receive, by using the identifier layer of the local end that is invoked by the calling module, the data transmitted by the first terminal corresponding to the first identifier obtained by mapping the mapping module by using the transport layer interface of the local end.
  • the calling module is further configured to receive, by using an identifier layer interface of the local end by the application layer of the local end, the first identifier corresponding to the first identifier. a connection request sent by the terminal;
  • the receiving module is further configured to: receive, by using an identifier layer of the local end, the connection layer interface of the local end to receive a connection request sent by the first terminal corresponding to the first identifier, to establish an identifier-based connection with the first terminal. .
  • the calling module is further configured to: listen to the identifier by using an identifier layer interface of the local end by using an application layer of the local end The connection request sent by the first terminal corresponding to the first identifier;
  • the receiving module is further configured to invoke the local transport layer interface monitoring device by using the identifier layer of the local end. a connection request sent by the first terminal corresponding to the first identifier.
  • the terminal further includes:
  • An acquiring module configured to acquire, by using an identifier layer of the local end, the first IP address corresponding to the first terminal according to the first identifier;
  • a storage module configured to store, by using an identifier layer of the local end, a mapping relationship between the first identifier of the first terminal and the first IP address obtained by the acquiring module in a local mapping table, according to the local
  • the mapping relationship between the first identifier and the first IP address in the mapping table sends data to the first terminal corresponding to the first identifier.
  • the calling module is further configured to: if the first terminal updates the first IP address, The application layer of the local end invokes the identifier layer interface of the local end to receive the mapping update packet sent by the first terminal.
  • the receiving module is further configured to: call the transport layer interface of the local end to receive the mapping update packet sent by the first terminal, to recover data between the first terminal and the first terminal according to the new first IP address. transmission.
  • the terminal further includes:
  • the checking module is configured to check the legality of the mapping relationship between the first identifier and the new first IP address by using an identifier layer interface of the local end by the application layer of the local end;
  • the storage module is further configured to store the mapping relationship between the first identifier and the new first IP address in a local mapping table by using an identifier layer of the local end, if the check result is legal.
  • the terminal further includes:
  • a forwarding module configured to forward, by the application layer of the local end, the data sent by the first terminal corresponding to the first identifier to the third terminal corresponding to the third identifier; and/or Receiving, by the application layer of the local end, the data of the third terminal corresponding to the third identifier is directly received by the local layer, and the third terminal is sent by using the identifier layer of the local end by the application layer of the local end. The data is forwarded to the first terminal corresponding to the first identifier.
  • the fifth aspect further provides a system for data transmission, where the system includes: a first terminal and a second terminal;
  • the first terminal is the terminal according to the second aspect above;
  • the second terminal is the terminal according to the above fourth aspect.
  • the identifier layer is mapped to the IP address by the identifier layer, and the transport layer interface is called to implement the identifier-based communication between the two parties.
  • Data transmission eliminates the need to modify the original protocol layer in the terminal protocol stack, solving the problem of difficult deployment and backward compatibility.
  • FIG. 1 is a schematic diagram of a protocol stack of a terminal according to an embodiment of the present invention.
  • FIG. 2 is a flowchart of a first method for data transmission according to an embodiment of the present invention
  • FIG. 3 is a flowchart of a second method for data transmission according to an embodiment of the present invention.
  • FIG. 4 is a flowchart of a third method for data transmission according to another embodiment of the present invention.
  • FIG. 5 is a flowchart of a fourth method for data transmission according to another embodiment of the present invention.
  • FIG. 6 is a schematic structural diagram of a first terminal according to another embodiment of the present invention.
  • FIG. 7 is a schematic structural diagram of a second terminal according to another embodiment of the present invention.
  • FIG. 8 is a schematic structural diagram of a third terminal according to another embodiment of the present invention.
  • FIG. 9 is a schematic structural diagram of a fourth terminal according to another embodiment of the present invention.
  • FIG. 10 is a schematic structural diagram of a fifth terminal according to another embodiment of the present invention.
  • FIG. 11 is a schematic structural diagram of a sixth terminal according to another embodiment of the present invention.
  • FIG. 12 is a schematic structural diagram of a system for data transmission according to another embodiment of the present invention. detailed description
  • Embodiments of the present invention provide a data transmission method, which implements separation of an IP address and an identifier by establishing an identifier layer between an application layer and a transport layer in a terminal protocol stack.
  • the schematic diagram of the terminal protocol stack is shown in Figure 1.
  • the identifier layer provides a new API (Application Programming Interface) to the application layer App, enabling the application layer to initiate a session based on the identifiers of the communicating parties.
  • the identifier layer maintains the session and maps the identifier to the corresponding IP address to establish and manage the transport layer connection so that the transport layer still transmits data based on the IP address.
  • this embodiment uses the first terminal to send data to the second terminal as an example, and illustrates a method for data transmission. Referring to FIG. 2, the process of the method provided in this embodiment is specifically as follows:
  • the first terminal sends the data to the second terminal corresponding to the second identifier by using the identifier layer interface of the local end by the application layer of the local end;
  • the method further includes:
  • IP address After the IP address, it also includes:
  • mapping relationship between the second identifier of the second terminal and the second IP address is stored in the local mapping table by using the identifier layer of the local end;
  • IP address including:
  • the second identifier is mapped to the second IP address corresponding to the second terminal by the identifier layer of the local end according to the mapping relationship between the second identifier and the second IP address in the local mapping table.
  • the second identifier is mapped to the second IP address corresponding to the second terminal by using the identifier layer of the local end, and the data of the local end is sent to the second terminal corresponding to the second IP address.
  • the method further includes:
  • the local layer's identifier layer interface is used to send a mapping update message to the second terminal, and the mapping update includes the identifier corresponding to the local end and the new IP address.
  • the second identifier is mapped to the second IP address corresponding to the second terminal by the identifier layer of the local end, and the mapping update interface is sent to the second terminal corresponding to the second IP address by using the transport layer interface of the local end. To recover data transmission with the second terminal according to the new IP address.
  • this embodiment uses the second terminal to receive the data sent by the first terminal as an example, and illustrates a method for data transmission.
  • the process of the method provided in this embodiment is specifically as follows:
  • the second terminal receives the data sent by the first terminal corresponding to the first identifier by using the identifier layer interface of the local end by the application layer of the local end;
  • the method further includes:
  • connection layer sent by the first terminal corresponding to the first identifier is received by the local layer's transport layer interface to establish an identifier-based connection with the first terminal.
  • the method further includes:
  • the local layer's identifier layer interface is used to listen to the connection request sent by the first terminal corresponding to the first identifier.
  • the local layer's transport layer interface is used to listen to the connection request sent by the first terminal corresponding to the first identifier.
  • the identifier layer of the local end further includes:
  • the mapping relationship is stored in the local mapping table to send data to the first terminal corresponding to the first identifier mapping according to the mapping relationship between the first identifier and the first IP address in the local mapping table.
  • the local layer's transport layer interface is used to receive data sent by the first terminal corresponding to the first identifier by using the identifier layer of the local end.
  • the method further includes:
  • the layer invokes the transport layer interface of the local end to receive the mapping update packet sent by the first terminal, to recover the data transmission with the first terminal according to the new first IP address. Further, after the calling the transport layer interface of the local end receives the mapping update packet sent by the first terminal corresponding to the first IP address, the method further includes:
  • the local layer's identifier layer interface is used to check the legality of the mapping relationship between the first identifier and the new first IP address.
  • the mapping relationship between the first identifier and the new first IP address is stored in the local mapping table through the identifier layer of the local end.
  • the method further includes:
  • the data sent by the first terminal corresponding to the received first identifier is forwarded to the third terminal corresponding to the third identifier by directly calling the local layer's transport layer interface;
  • the local layer of the transport layer directly calls the local end of the transport layer interface to receive the data sent by the third terminal corresponding to the third identifier, and the local layer's identifier layer interface is used to send the data sent by the third terminal through the local application layer. Forwarding to the first terminal corresponding to the first identifier.
  • the method provided by the embodiment of the present invention completes the mapping of the identifier to the IP address by the identifier layer by establishing an identifier layer between the application layer and the transport layer, and calling the identifier layer interface by using the application layer, and calling the transport layer.
  • the interface implements identifier-based data transmission between the two communicating parties, thereby eliminating the need to modify the original protocol layer in the terminal protocol stack, thereby solving the problem of difficulty in deployment and backward compatibility.
  • Another embodiment of the present invention provides a method for data transmission. For convenience of description, the present embodiment combines the contents of the foregoing embodiment and the protocol stack diagram shown in FIG. 1 to lay out the terminal A and the layout of the identifier layer.
  • the data is transmitted between the terminal B of the identifier layer, and the identifier of the terminal A is the identifier A, the IP address of the terminal A is the address A, the identifier of the terminal B is the identifier B, and the IP address of the terminal B is the address B.
  • the method for data transmission provided in this embodiment is exemplified.
  • the identifier layer in the protocol stack is first described in conjunction with the protocol stack shown in FIG.
  • the identifier layer provides the following functions in order to implement the mapping of identifiers to IP addresses and to establish and manage transport layer connections:
  • the argument to this function is an identifier.
  • the function is configured to send a mapping query request to the mapping server according to the input identifier, and obtain an IP address corresponding to the current identifier of the identifier, and cache the mapping table;
  • IDUpdate The parameters of this function are the identifier and the corresponding IP address.
  • the function is used to send a mapping update request to a communication peer or a mapping server;
  • IDCheck The parameters of this function are the identifier and the corresponding IP address. This function is used to complete the RR (Return Routability) process and check the legality of the correspondence between the two. If the relationship is legal, the identifier and the corresponding IP address are cached into the mapping table.
  • IDSocket The parameters of this function include the protocol cluster used, the transport layer protocol, and so on. This function is used to create an identifier-based session Socket, which maintains the session-related data of both parties, including the identifiers, ports, IP addresses, etc., and calls the Socket function in the traditional Socket interface.
  • IDBind The parameters of this function include local identifier, local port, local IP (optional). This function is used to call the Bind function in the traditional Socket interface with the obtained local Port and IP;
  • IDConnect The parameters of this function include local identifier, peer identifier, peer port, peer
  • the UIDLookup function is called. This function is used to call the Connect function in the traditional Socket interface by using the obtained peer port and IP, and needs to inform the peer of its own identifier (such as using an IPv6 extension header);
  • IDListen This function is used to call the Listen function in the traditional Socket interface.
  • IDAccept This function is used to obtain the identifier of the peer, check its legality, and call the Accept function in the traditional Socket interface.
  • IDWrite This function is used to send data to the peer.
  • the packet needs to carry its own identifier (such as using the IPv6 extension header), and call the Write function in the traditional Socket interface.
  • IDRead This function is used to receive data from the peer and call the Read function in the traditional Socket interface.
  • terminal A sends a connection request to terminal B corresponding to identifier B by calling the identifier layer interface of terminal A through the application layer of terminal A;
  • the ID socket function and the IDBind function in the identifier layer of the terminal A may be first invoked by the application layer of the terminal A to initialize the identifier layer interface of the terminal A, and then the terminal A passes the terminal.
  • the application layer of A calls the identifier layer interface IDSocket of the terminal A to send a connection request to the terminal B corresponding to the identifier B.
  • the identifier layer interface IDSocket of the terminal A can be analogized to the traditional Socket interface, so that the application layer is equivalent to providing a new API.
  • the identifier layer can obtain the address B corresponding to the terminal B through the identifier layer function IDLookup of the terminal A, Then, the function IDConnect is called, and the function IDConnect uses the port B of the terminal B and the address B corresponding to the terminal B to call the Connect function in the traditional transport layer Socket interface, and completes the operation of sending a connection request to the terminal B corresponding to the address B, in the connection request. Carrying the identifier of the terminal A itself.
  • the function IDLookup sends a mapping query request to the mapping server according to the identifier B of the terminal B, so as to obtain the address B corresponding to the identifier, and the process of obtaining the address B corresponding to the terminal B is repeated.
  • the mapping relationship between the identifier B and the address B of the terminal B can be stored in the local mapping table, so that the next direct mapping table will be used.
  • the identifier B is mapped to the address B.
  • the terminal B uses the identifier layer interface of the terminal B to listen to the connection request sent by the terminal A corresponding to the identifier A through the application layer of the terminal B;
  • the terminal B can use the ID socket function in the identifier layer interface of the terminal B of the terminal B to implement the terminal A corresponding to the interception identifier A. Connection request.
  • the terminal B invokes the transport layer interface of the terminal B through the identifier layer of the terminal B to listen to the connection request sent by the terminal A corresponding to the identifier A.
  • the identifier layer of the terminal B invokes the transport layer interface of the terminal B to listen to the connection request sent by the terminal A corresponding to the identifier A.
  • the function IDlisten is called, and the listen function in the transport layer Socket interface of the terminal B is called by the function IDListen to listen to the connection request sent by the terminal A corresponding to the address A.
  • the method provided in this embodiment further includes: The step of obtaining the address A corresponding to the terminal A according to the identifier A by the identifier layer of the terminal B.
  • the function IDLookup can be called by the identifier layer of the terminal B, and the function IDLookup is used according to the identifier A of the terminal A.
  • the local mapping server sends a mapping query request, and obtains the address A corresponding to the current identifier A, and in order to enable the transmission of data to the terminal A after the establishment of the identifier-based connection with the terminal A, and avoids duplication
  • the process of obtaining the address A corresponding to the terminal A is performed.
  • the step further includes storing the mapping relationship between the identifier A of the terminal A and the address A through the identifier layer of the terminal B.
  • the step of mapping the table locally, so that the terminal B can send data to the terminal A corresponding to the identifier A according to the mapping relationship between the identifier A and the address A in the local mapping table.
  • the terminal B receives the connection request sent by the terminal A corresponding to the identifier A by using the identifier layer interface of the terminal B through the application layer of the terminal B;
  • the terminal B receives the connection request sent by the terminal A corresponding to the identifier A through the identifier layer interface IDSocket of the terminal B through the application layer of the terminal B.
  • the terminal B receives the connection request sent by the terminal A corresponding to the identifier A by calling the transport layer interface of the terminal B through the identifier layer of the terminal B.
  • the terminal B receives the identifier through the identifier layer interface of the terminal B through the application layer of the terminal B in step 405.
  • the method provided in this embodiment receives the connection request sent by the terminal A corresponding to the identifier A by calling the transport layer interface of the terminal B through the identifier layer of the terminal B.
  • it also includes an operation of checking the validity of the identifier A. If the check result is legal, the function IDAccept is called by the identifier layer, and the Accept function in the transport layer Socket interface of the terminal B is called by the function IDAccept to receive the identifier A.
  • the connection request sent by terminal A is accessed by the terminal A.
  • the above steps 401 to 406 are specific procedures for establishing an identifier-based connection between the terminal A and the terminal B. After the identifier-based connection is established, the identifier-based multiple data transmission can be performed between the terminal A and the terminal B without interruption of the connection, without re-establishing the identifier every time data transmission is performed.
  • the connection that is, the operation of the above steps 401 to 406 is performed only before the terminal A and the terminal B transmit data for the first time or after the connection is interrupted.
  • terminal A sends data to terminal B corresponding to identifier B through the identifier layer interface of terminal A through the application layer of terminal A;
  • the communication parties can perform data transmission and reception based on the identifier.
  • the terminal A sends the data to the terminal B corresponding to the identifier B through the application layer of the terminal A
  • the terminal A can call the identifier layer interface ID socket of the terminal A to the identifier through the application layer of the terminal A.
  • Terminal B corresponding to B transmits data.
  • the terminal A maps the identifier B to the address B corresponding to the terminal B through the identifier layer of the terminal A, and calls the transport layer interface of the terminal A to send the data to the terminal B corresponding to the address B.
  • the terminal A invokes the identifier layer interface of the terminal A through the application layer of the terminal A in step 407.
  • the terminal A can map the identifier B to the address B corresponding to the terminal B through the identifier layer of the terminal A, that is, through the terminal A.
  • the identifier layer maps the identifier B to the address B corresponding to the terminal B according to the mapping relationship between the identifier B and the address B in the local mapping table.
  • the function IDWrite is called through the identifier layer, and the function of the call layer Socket interface of the terminal A is called by the function IDWrite to send the data to the terminal B corresponding to the address B.
  • the terminal B receives the data sent by the terminal A corresponding to the identifier A by using the identifier layer interface of the terminal B through the application layer of the terminal B;
  • the terminal B can send the terminal A corresponding to the identifier A through the identifier layer interface ID socket of the terminal B through the application layer of the terminal B.
  • the data is sent by the terminal A.
  • the terminal B receives the data sent by the terminal A corresponding to the identifier A by calling the transport layer interface of the terminal B through the identifier layer of the terminal B.
  • step 409 after the terminal B receives the data sent by the terminal A corresponding to the identifier A through the identifier layer interface of the terminal B, the terminal B can call the function IDRead through the identifier layer, and the function IDRead The Read function in the transport layer Socket interface of the calling terminal B receives the data sent by the terminal A corresponding to the identifier A, and thus, the data transmission between the terminal A in which the identifier layer is laid out and the terminal B in which the identifier layer is laid out is realized. .
  • the terminal A and the terminal B establish an identifier-based connection
  • the terminal A or the terminal B updates the IP address, in order to enable the data transmission between the terminal A and the terminal B, the IP address needs to be updated.
  • the terminal notifies the peer end of the updated IP address to recover the data transmission with the peer end according to the new IP address.
  • the terminal A is updated from the original address A to the address A.
  • the method provided in this embodiment further includes the following steps:
  • Step a Terminal A sends a mapping update message to terminal B through the identifier layer interface IDSocket of terminal A through the application layer of terminal A, and the mapping update includes the identifier and address corresponding to terminal A;
  • Step b The terminal A passes the identifier layer of the terminal A according to the identifier B and the ground in the local mapping table.
  • the mapping relationship between the addresses B maps the identifier B to the address B corresponding to the terminal B.
  • the function IDUpdate is called by the identifier layer, and the Update function in the transport layer Socket interface of the terminal A is called by the function IDUpdate to send the map update message to the terminal B corresponding to the address B.
  • Step C The terminal B receives the mapping update message sent by the terminal A by using the identifier layer interface IDSocket of the terminal B through the application layer of the terminal B, and the mapping update includes the identifier A and the address A corresponding to the terminal A,
  • Step d Terminal B calls the function IDAccept through the identifier layer of the terminal B, and the function IDAccept obtains the identifier of the terminal A, and checks its legality. If the check result is legal, the Accept function in the traditional transport layer Socket interface is called to receive the address A. Corresponding mapping update message sent by terminal A to recover data transmission with terminal A according to new address A.
  • the method provided by the embodiment of the present invention completes the mapping of the identifier to the IP address by the identifier layer by establishing an identifier layer between the application layer and the transport layer, and calling the identifier layer interface by using the application layer, and calling the transport layer.
  • the interface implements identifier-based data transmission between the two communicating parties, thereby eliminating the need to modify the original protocol layer in the terminal protocol stack, thereby solving the problem of difficulty in deployment and backward compatibility.
  • Another embodiment of the present invention provides a data transmission method. For convenience of description, this embodiment combines the contents of the foregoing embodiment and the protocol stack diagram shown in FIG. 1 to deploy an identifier layer, terminal B, with terminal A.
  • the identifier layer is not deployed, and the identifier-based connection is established between the terminal A and the terminal node C on which the identifier layer is deployed, and the TCP (Transmission Control Protocol) is established between the terminal C and the terminal B.
  • the method of data transmission provided by the embodiment of the present invention is exemplified by a method of transmitting data between the terminal A and the terminal B by using the terminal C as an example of a transport layer connection such as a UDP (User Datagram Protocol).
  • the identifier corresponding to the proxy node C is the identifier C, and the IP address is the address C.
  • the terminal A and the terminal A establish an identifier-based connection in the same manner as the terminal A in the foregoing embodiment.
  • a manner of establishing an identifier connection with the terminal B, and a method of establishing a transport layer connection such as a TCP or a UDP between the terminal C and the terminal B may be implemented by using an existing connection establishment manner, which is not specifically limited in this embodiment. .
  • the process of the method provided in this embodiment is specifically as follows:
  • the terminal A sends the data to the terminal C corresponding to the identifier C through the identifier layer interface of the terminal A through the application layer of the terminal A; after the identifier-based connection is established between the terminal A and the terminal C, the communication parties can be based on the identifier. get on The transmission and reception of data.
  • the terminal A can transmit data to the terminal C corresponding to the identifier C through the identifier layer interface IDSocket of the terminal A through the application layer of the terminal A.
  • Terminal A maps the identifier C to the IP address C corresponding to the terminal C through the identifier layer of the terminal A, and calls the transport layer interface of the terminal A to send the data to the terminal C corresponding to the address C.
  • the terminal A has acquired the address C corresponding to the terminal C, and stores it in the local mapping table.
  • the terminal A passes the terminal A.
  • the terminal A can map the identifier C to the terminal through the identifier layer of the terminal A.
  • the address C corresponding to C that is, the identifier C of the terminal A is mapped to the address C corresponding to the terminal C according to the mapping relationship between the identifier C and the address C in the local mapping table.
  • the function IDWrite is called through the identifier layer, and the transfer function of the terminal A is called by the function IDWrite.
  • the Write function in the Socket interface sends the data to the terminal C corresponding to the address C.
  • the terminal C receives the data sent by the terminal A corresponding to the identifier A through the identifier layer interface of the terminal C through the application layer of the terminal C.
  • the terminal C can send the terminal A corresponding to the identifier A through the identifier layer interface IDSocket of the terminal C of the application layer of the terminal C.
  • the data is sent by the terminal A.
  • the terminal C receives the data sent by the terminal A corresponding to the identifier A by using the identifier layer of the terminal C to invoke the transport layer interface of the terminal C.
  • the terminal C may The function IDRead is called by the identifier layer, and the Read function in the transport layer Socket interface of the terminal C is called by the function IDRead to receive the data sent by the terminal A corresponding to the address A.
  • the terminal A and the layout identifier of the identifier layer are realized. Data transfer between terminals C of the layer.
  • the terminal C directly calls the transport layer interface of the terminal C to forward the data sent by the terminal A corresponding to the identifier A to the identifier B, and the corresponding terminal B, through the application layer of the terminal C.
  • the terminal C calls the function IDRead through the identifier layer of the terminal C, and the Read function in the transport layer Socket interface of the terminal C is called by the function IDRead to receive the data sent by the terminal A corresponding to the address A, as
  • the proxy node since the traditional transport layer connection has been established between the terminal C and the terminal B, the terminal C can be directly adjusted through the application layer of the terminal C.
  • the data sent by the terminal A corresponding to the received identifier A is forwarded to the identifier B, the corresponding terminal B, by using the transport layer Socket interface of the terminal C.
  • the terminal C can also directly call the transport layer Socket interface of the terminal C to receive the identifier B, the corresponding terminal B, the transmitted data, and call the identifier of the terminal C through the application layer of the terminal C through the application layer of the terminal C.
  • the symbol IDSocket interface forwards the data sent by the terminal B to the terminal A corresponding to the identifier A, thereby realizing the transmission of data between the terminal A and the terminal B.
  • any one of the terminal A and the terminal C may also update the IP address, and in this case, the processing mode and the communication terminal in the above embodiment generate IP.
  • the address update is performed in the same manner. For details, refer to the related description in step 410 in the foregoing embodiment.
  • the method provided by the embodiment of the present invention completes the mapping of the identifier to the IP address by the identifier layer by establishing an identifier layer between the application layer and the transport layer, and calling the identifier layer interface by using the application layer, and calling the transport layer.
  • the interface implements identifier-based data transmission between the two communicating parties, thereby eliminating the need to modify the original protocol layer in the terminal protocol stack, thereby solving the problem of difficulty in deployment and backward compatibility.
  • Another embodiment of the present invention provides a first type of terminal, which is used to perform the functions performed by the terminal that sends data in the foregoing embodiment. Referring to FIG. 6, the terminal 60 includes:
  • the calling module 61 is configured to send the data to the second terminal corresponding to the second identifier by using the identifier layer interface of the local end by the application layer of the local end;
  • the mapping module 62 is configured to map the second identifier to the second IP address corresponding to the second terminal by using the identifier layer of the local end that is invoked by the calling module 61;
  • the sending module 63 is configured to send the data to the second terminal corresponding to the second IP address mapped by the mapping module 62 by using the local layer's transport layer interface.
  • the calling module 61 is further configured to send a connection request to the second terminal corresponding to the second identifier by using the identifier layer interface of the local end by the application layer of the local end;
  • the mapping module 62 is further configured to acquire, by using the identifier layer of the local end, the calling module 61, the second IP address corresponding to the second terminal according to the second identifier;
  • the sending module 63 is further configured to send a connection request to the second terminal corresponding to the second IP address acquired by the mapping module 62 by using the identifier layer of the local end to invoke the transport layer interface of the local end, to establish an identifier-based connection with the second terminal. .
  • the terminal 70 further includes: a storage module 64, configured to store, by using an identifier layer of the local end, a mapping relationship between the second identifier of the second terminal and the second IP address into the local mapping table;
  • the mapping module 62 is configured to map the second identifier to the second IP address corresponding to the second terminal according to the mapping relationship between the second identifier and the second IP address in the local mapping table by the identifier layer of the local end.
  • the calling module 61 is further configured to: if the local end updates the first IP address, send the mapping update to the second terminal by using the identifier layer interface of the local end by the application layer of the local end, and the mapping update includes the local end. Corresponding identifier and new IP address;
  • the mapping module 62 is configured to map the second identifier to the second IP address corresponding to the second terminal by using the identifier layer of the local end;
  • the sending module 63 is further configured to send the mapping update message to the second terminal corresponding to the second IP address by using the local layer's transport layer interface to restore the relationship between the second terminal and the second terminal according to the new IP address. data transmission.
  • the terminal provided by the embodiment of the present invention completes the mapping of the identifier to the IP address by the identifier layer by establishing an identifier layer between the application layer and the transport layer, and calling the identifier layer interface by using the application layer, and calling the transport layer.
  • the interface implements identifier-based data transmission between the two communicating parties, thereby eliminating the need to modify the original protocol layer in the terminal protocol stack, thereby solving the problem of difficulty in deployment and backward compatibility.
  • Another embodiment of the present invention provides a first terminal, where the terminal includes:
  • a transmitter configured to send data to the second terminal corresponding to the second identifier by using an identifier layer interface of the local end by using an application layer of the local end;
  • a processor configured to map the second identifier to a second Internet Protocol IP address corresponding to the second terminal by using an identifier layer of the local end;
  • the transmitter is further configured to send the data of the local end to send the data to the second terminal corresponding to the second IP address.
  • the transmitter is further configured to send a connection request to the second terminal corresponding to the second identifier by using an identifier layer interface of the local end by using an application layer of the local end;
  • the processor is further configured to obtain, by using the identifier layer of the local end, the second IP address corresponding to the second terminal according to the second identifier;
  • the transmitter is further configured to send a connection request to the second terminal corresponding to the second IP address by using the local transport layer interface to establish an identifier-based connection with the second terminal.
  • the processor is further configured to store the mapping relationship between the second identifier of the second terminal and the second IP address in the local mapping table by using the identifier layer of the local end; and according to the local mapping table by using the identifier layer of the local end The mapping relationship between the second identifier and the second IP address maps the second identifier to a second IP address corresponding to the second terminal.
  • the processor is further configured to send, by using an identifier layer interface of the local end, the mapping update interface of the local end to the second terminal, where the mapping update includes the identifier corresponding to the local end and the new IP address;
  • the second identifier is mapped to the second IP address corresponding to the second terminal by the identifier layer of the local end;
  • the transmitter is further configured to send the mapping update interface of the local end to send the mapping update packet to the second corresponding to the second IP address.
  • the terminal to recover data transmission with the second terminal according to the new IP address.
  • the terminal provided by the embodiment of the present invention completes the mapping of the identifier to the IP address by the identifier layer by establishing an identifier layer between the application layer and the transport layer, and calling the identifier layer interface by using the application layer, and calling the transport layer.
  • the interface implements identifier-based data transmission between the two communicating parties, thereby eliminating the need to modify the original protocol layer in the terminal protocol stack, and solving the problem of difficulty in deployment and backward compatibility.
  • Another embodiment of the present invention provides a second terminal, which is used to perform the functions performed by the terminal that receives data in the foregoing embodiment. Referring to FIG. 8, the terminal 80 includes:
  • the calling module 81 is configured to receive, by using an identifier layer interface of the local end, the data sent by the first terminal corresponding to the first identifier by the application layer of the local end;
  • the receiving module 82 is configured to receive the data sent by the first terminal corresponding to the first identifier by using the local layer identifier layer of the local end called by the calling module 81.
  • the calling module 81 is further configured to: receive, by the application layer of the local end, the identifier layer interface of the local end to receive the connection request sent by the first terminal corresponding to the first identifier;
  • the receiving module 82 is further configured to receive, by using the identifier layer of the local end, the connection layer interface of the local end to receive the connection request sent by the first terminal corresponding to the first identifier, to establish an identifier-based connection with the first terminal.
  • the calling module 81 is further configured to, by using an application layer of the local end, invoke the identifier layer interface of the local end to listen to the connection request sent by the first terminal corresponding to the first identifier;
  • the receiving module 82 is further configured to, by using the identifier layer of the local end, invoke the transport layer interface of the local end to listen to the connection request sent by the first terminal corresponding to the first identifier.
  • terminal 90 also includes:
  • the obtaining module 83 is configured to obtain, by using the identifier layer of the local end, the first terminal corresponding to the first identifier.
  • First IP address
  • the storage module 84 is configured to store, by using the identifier layer of the local end, a mapping relationship between the first identifier of the first terminal and the first IP address obtained by the obtaining module 83 in the local mapping table, according to the local mapping table.
  • the mapping relationship between the identifier and the first IP address sends data to the first terminal corresponding to the first identifier.
  • the calling module 81 is further configured to: if the first terminal updates the first IP address, the application layer of the local end invokes the identifier layer interface of the local end to receive the mapping update message sent by the first terminal; the mapping module 82 is configured to pass The identifier layer of the local end maps the first identifier to the first IP address corresponding to the first terminal;
  • the receiving module 83 is further configured to: call the transport layer interface of the local end to receive the mapping update packet sent by the first terminal corresponding to the first IP address, to recover the data transmission with the first terminal according to the new first IP address.
  • the terminal 100 further includes:
  • the checking module 85 is configured to check the legality of the mapping relationship between the first identifier and the new first IP address by using the local layer identifier layer interface by the application layer of the local end;
  • the storage module 84 is further configured to store the mapping relationship between the first identifier and the new first IP address in the local mapping table by using the identifier layer of the local end, if the check result is legal.
  • the terminal 110 further includes:
  • the forwarding module 86 is configured to directly forward the data sent by the first terminal corresponding to the received first identifier to the third terminal corresponding to the third identifier by using the local layer of the local layer; and/or The data layer sent by the third terminal corresponding to the third identifier is directly received by the application layer of the local end, and the data sent by the third terminal is forwarded to the first through the identifier layer of the local end by the application layer of the local end. The first terminal corresponding to the identifier.
  • the terminal provided by the embodiment of the present invention completes the mapping of the identifier to the IP address by the identifier layer by establishing an identifier layer between the application layer and the transport layer, and calling the identifier layer interface by using the application layer, and calling the transport layer.
  • the interface implements identifier-based data transmission between the two communicating parties, thereby eliminating the need to modify the original protocol layer in the terminal protocol stack, thereby solving the problem of difficulty in deployment and backward compatibility.
  • Another embodiment of the present invention provides a second terminal, where the terminal includes:
  • the receiver is configured to receive the data sent by the first terminal corresponding to the first identifier by using the identifier layer interface of the local end by the application layer of the local end; and receive the transmission layer interface of the local end by using the identifier layer of the local end The data sent by the first terminal corresponding to the first identifier.
  • the receiver is further configured to receive the connection request sent by the first terminal corresponding to the first identifier by using the identifier layer interface of the local end by the application layer of the local end, and receive the first transmission layer interface by using the identifier layer of the local end.
  • the processor is configured to: listen to the connection request sent by the first terminal corresponding to the first identifier by using the identifier layer interface of the local end by the application layer of the local end; and invoke the transport layer interface of the local end to listen to the first identifier by using the identifier layer of the local end The connection request sent by the first terminal.
  • the processor is further configured to acquire, by using the identifier layer of the local end, the first IP address corresponding to the first terminal according to the first identifier, and the first identifier of the first terminal and the first identifier by using the identifier layer of the local end
  • the mapping relationship between the IP addresses is stored in the local mapping table to send data to the first terminal corresponding to the first identifier according to the mapping relationship between the first identifier and the first IP address in the local mapping table.
  • the processor is further configured to receive, by using an identifier layer interface of the local end, the mapping update interface sent by the first terminal, where the mapping update packet includes the first identifier corresponding to the first terminal, and the new identifier.
  • First IP address
  • the receiver is further configured to receive the mapping update packet sent by the first terminal by using the local layer's transport layer interface to restore the data transmission with the first terminal according to the new first IP address.
  • the processor is further configured to: by using an identifier layer interface of the local end of the local end, check the legality of the mapping relationship between the first identifier and the new first IP address; if the check result is legal, pass the The identifier layer of the local end stores the mapping relationship between the first identifier and the new first IP address in the local mapping table.
  • the receiver is further configured to directly forward the data sent by the first terminal corresponding to the received first identifier to the third terminal corresponding to the third identifier by using the local layer of the local layer;
  • the transmitter is configured to directly receive the data sent by the third terminal corresponding to the third identifier by using the local layer of the local layer, and send the third terminal by using the identifier layer of the local end by the application layer of the local end.
  • the data is forwarded to the first terminal corresponding to the first identifier.
  • the terminal completes the mapping of the identifier to the IP address by the identifier layer by establishing an identifier layer between the application layer and the transport layer, and calling the identifier layer interface by using the application layer, and calling the transport layer.
  • the interface implements identifier-based data transmission between the two parties, thus eliminating the need for a terminal protocol
  • the original protocol layer in the stack is modified to solve the problem of difficult deployment and backward compatibility.
  • Another embodiment of the present invention provides a system for data transmission, which is used to perform the data transmission method provided by the foregoing embodiments. Referring to Figure 12, the system includes:
  • the first terminal 1201 and the second terminal 1202 are connected to The first terminal 1201 and the second terminal 1202;
  • the first terminal 1201 is the first terminal provided by the foregoing embodiment
  • the second terminal 1202 is the second terminal provided by the foregoing embodiment.
  • the system provided by the embodiment of the present invention completes the mapping of the identifier to the IP address by the identifier layer by establishing an identifier layer between the application layer and the transport layer, and calling the identifier layer interface by using the application layer, and calling the transport layer.
  • the interface implements identifier-based data transmission between the two communicating parties, thereby eliminating the need to modify the original protocol layer in the terminal protocol stack, thereby solving the problem of difficulty in deployment and backward compatibility.
  • the terminal provided by the foregoing embodiment sends data and receives data, only the division of each functional module is illustrated. In actual applications, the function distribution may be completed by different functional modules as needed.
  • the internal structure of the terminal is divided into different functional modules to complete all or part of the functions described above.
  • the terminal, the data transmission system and the data transmission method embodiment provided by the foregoing embodiments are in the same concept, and the specific implementation process is described in the method embodiment, and details are not described herein again.
  • a person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium.
  • the storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.

Abstract

The present invention relates to the technical field of network communications. Disclosed are a data transmission method, terminal and system, the method comprising: a first terminal invokes a local identifier layer interface via a local application layer to transmit data to a second terminal corresponding to a second identifier; mapping the second identifier to a second internet protocol (IP) address corresponding to the second terminal via a local identifier layer, and invoking a local transport layer interface to transmit the data to the second terminal corresponding to the second IP address. The present invention establishes an identifier layer between an application layer and a transport layer, utilizes the application layer to invoke an identifier layer interface, completes the mapping from an identifier to an IP address via the identifier layer, and invokes a transport layer interface to realize identifier-based data transmission between two communication ends, thus requiring no modification to an original protocol layer in a protocol stack of a terminal, and addressing the issues of difficult deployment and backward compatibility.

Description

说 明 书 数据传输的方法、 终端及系统 本申请要求于 2012 年 08 月 17 日提交中国专利局、 申请号为 201210295742.2、 发明名称为 "数据传输的方法、 终端及系统" 的中国专利申 请的优先权, 其全部内容通过引用结合在本申请中。 技术领域  The present invention claims the priority of a Chinese patent application filed on August 17, 2012 by the Chinese Patent Office, Application No. 201210295742.2, and entitled "Data Transmission Method, Terminal and System". The entire contents of this application are incorporated herein by reference. Technical field
本发明涉及网络通信技术领域, 特别涉及一种数据传输的方法、 终端及系 统。 背景技术  The present invention relates to the field of network communication technologies, and in particular, to a data transmission method, terminal, and system. Background technique
随着网络通信技术的不断发展, 数据传输以其快速、 方便的特点受到人们 越来越多的重视。在数据传输过程中采用标识与地址分离机制实现网络数据的 传输, 是当前互联网技术研究中的热点问题。  With the continuous development of network communication technology, data transmission has received more and more attention from people because of its fast and convenient features. The use of identification and address separation mechanism to realize network data transmission in the process of data transmission is a hot issue in current Internet technology research.
现有技术中, 采用标识与地址分离机制实现数据传输时主要有两种方式: 第一种方式, 通过在主机端的传输层之下新建一个模块或者通过增加或修改传 输层协议来实现传输层标识 ID到网络之间互联的协议 IP ( Internet Protocol,网 际协议)地址的映射, 并依此实现数据传输; 第二种方式, 通过在主机端的应 用层的特定应用程序中实现标识与地址分离, 并依此实现数据传输。  In the prior art, there are two main ways to implement data transmission by using an identity and address separation mechanism: In the first method, a new module is created under the transport layer of the host end or a transport layer identifier is implemented by adding or modifying a transport layer protocol. The mapping of the protocol IP (Internet Protocol) addresses interconnected by the ID to the network, and the data transmission is implemented accordingly; the second method realizes the separation of the identifier and the address in a specific application of the application layer at the host side, and In this way, data transmission is achieved.
在实现本发明的过程中, 发明人发现现有技术至少存在以下问题: 第一种方式, 因为需要修改主机协议栈中的协议层, 所以存在部署难度大 的问题; 第二种方式, 因为在特定的应用程序上实现标识与地址分离, 所以无 法满足应用程序的向后兼容性。 发明内容  In the process of implementing the present invention, the inventor has found that the prior art has at least the following problems: In the first mode, since the protocol layer in the host protocol stack needs to be modified, there is a problem that the deployment is difficult; The implementation is separated from the address on a specific application, so the backward compatibility of the application cannot be satisfied. Summary of the invention
本发明实施例提供了一种数据传输的方法、 终端及系统。 所述技术方案如 下:  Embodiments of the present invention provide a data transmission method, terminal, and system. The technical solution is as follows:
第一方面, 提供了一种数据传输的方法, 所述方法包括:  In a first aspect, a method for data transmission is provided, the method comprising:
第一终端通过本端的应用层调用本端的标识符层接口向第二标识符对应 的第二终端发送数据; The first terminal sends the identifier layer interface of the local end to the second identifier through the application layer of the local end. The second terminal sends data;
通过本端的标识符层将所述第二标识符映射为所述第二终端对应的第二 Mapping the second identifier to a second corresponding to the second terminal by using an identifier layer of the local end
IP地址, 并调用本端的传输层接口将所述数据发送给所述第二 IP地址对应的 第二终端。 The IP address is sent to the second terminal corresponding to the second IP address by calling the transport layer interface of the local end.
结合第一方面, 在第一方面的第一种可能的实现方式中, 所述通过本端的 应用层调用本端的标识符层接口向第二标识符对应的第二终端发送数据之前, 还包括:  With reference to the first aspect, in a first possible implementation manner of the first aspect, before the sending, by the application layer of the local end, the identifier layer interface of the local end to send data to the second terminal corresponding to the second identifier, the method further includes:
通过本端的应用层调用本端的标识符层接口向所述第二标识符对应的第 二终端发送连接请求;  Sending, by the application layer of the local end, the identifier layer interface of the local end to send a connection request to the second terminal corresponding to the second identifier;
通过本端的标识符层根据所述第二标识符获取所述第二终端对应的第二 Obtaining, by the identifier layer of the local end, the second terminal corresponding to the second terminal according to the second identifier
IP地址, 并调用本端的传输层接口向所述第二 IP地址对应的第二终端发送连 接请求, 以与所述第二终端建立基于标识符的连接。 The IP address, and the local layer's transport layer interface is called to send a connection request to the second terminal corresponding to the second IP address to establish an identifier-based connection with the second terminal.
结合第一方面的第一种可能的实现方式, 在第一方面的第二种可能的实现 方式中, 所述通过本端的标识符层根据所述第二标识符获取所述第二终端对应 的第二 IP地址之后, 还包括:  With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner of the first aspect, the identifier layer of the local end acquires the second terminal corresponding to the second identifier according to the second identifier After the second IP address, it also includes:
通过本端的标识符层将所述第二终端的第二标识符与第二 IP地址之间的 映射关系存入本地映射表;  And storing, by using the identifier layer of the local end, a mapping relationship between the second identifier of the second terminal and the second IP address in the local mapping table;
所述通过本端的标识符层将所述第二标识符映射为所述第二终端对应的 第二网际协议 IP地址, 具体包括:  And mapping, by the identifier layer of the local end, the second identifier to the second Internet Protocol IP address corresponding to the second terminal, specifically:
通过本端的标识符层根据所述本地映射表中所述第二标识符与所述第二 Passing the identifier layer of the local end according to the second identifier and the second identifier in the local mapping table
IP地址之间的映射关系将所述第二标识符映射为所述第二终端对应的第二 IP 地址。 The mapping relationship between the IP addresses maps the second identifier to a second IP address corresponding to the second terminal.
结合第一方面, 在第一方面的第三种可能的实现方式中, 如果本端更新 IP 地址, 所述方法还包括:  In conjunction with the first aspect, in a third possible implementation manner of the first aspect, if the local end updates the IP address, the method further includes:
通过本端的应用层调用本端的标识符层接口向所述第二终端发送映射更 新才艮文, 所述映射更新 4艮文中包括本端对应的标识符和新的 IP地址;  Sending, by the application layer of the local end, the identifier layer interface of the local end to the second terminal, and sending a mapping update to the second terminal, where the mapping update includes the identifier corresponding to the local end and the new IP address;
通过本端的标识符层将所述第二标识符映射为所述第二终端对应的第二 Mapping the second identifier to a second corresponding to the second terminal by using an identifier layer of the local end
IP地址, 并调用本端的传输层接口将所述映射更新报文发送给所述第二 IP地 址对应的第二终端, 以根据所述新的 IP地址恢复与所述第二终端之间的数据 传输。 Sending the mapping update message to the second terminal corresponding to the second IP address to restore the data between the second terminal and the second terminal according to the new IP address. transmission.
第二方面, 提供了一种终端, 所述终端包括: 调用模块, 用于通过本端的应用层调用本端的标识符层接口向第二标识符 对应的第二终端发送数据; In a second aspect, a terminal is provided, where the terminal includes: a calling module, configured to send, by using an identifier layer interface of the local end by the application layer of the local end, data to the second terminal corresponding to the second identifier;
映射模块, 用于通过所述调用模块调用的本端的标识符层将所述第二标识 符映射为所述第二终端对应的第二网际协议 IP地址;  a mapping module, configured to map the second identifier to a second Internet Protocol IP address corresponding to the second terminal by using an identifier layer of the local end that is invoked by the calling module;
发送模块, 用于通过本端的标识符层调用本端的传输层接口将所述数据发 送给所述映射模块映射得到的第二 IP地址对应的第二终端。  And a sending module, configured to send the data to the second terminal corresponding to the second IP address obtained by mapping by the mapping module by using the local layer's transport layer interface.
结合第二方面, 在第二方面的第一种可能的实现方式中, 所述调用模块, 还用于通过本端的应用层调用本端的标识符层接口向所述第二标识符对应的 第二终端发送连接请求;  With reference to the second aspect, in a first possible implementation manner of the second aspect, the calling module is further configured to: call, by the application layer of the local end, the identifier layer interface of the local end to the second identifier corresponding to the second identifier The terminal sends a connection request;
所述映射模块,还用于通过所述调用模块调用的本端的标识符层根据所述 第二标识符获取所述第二终端对应的第二 IP地址;  The mapping module is further configured to acquire, by using an identifier layer of the local end that is invoked by the calling module, a second IP address corresponding to the second terminal according to the second identifier;
所述发送模块,还用于通过本端的标识符层调用本端的传输层接口向所述 映射模块获取到的第二 IP地址对应的第二终端发送连接请求, 以与所述第二 终端建立基于标识符的连接。  The sending module is further configured to send a connection request to the second terminal corresponding to the second IP address acquired by the mapping module by using the identifier layer of the local end to call the transport layer interface of the local end, to establish a connection with the second terminal. The connection of the identifier.
结合第二方面的第一种可能的实现方式, 在第二方面的第二种可能的实现 方式中, 所述终端, 还包括:  With reference to the first possible implementation of the second aspect, in the second possible implementation manner of the second aspect, the terminal further includes:
存储模块, 用于通过本端的标识符层将所述第二终端的第二标识符与第二 a storage module, configured to, by using an identifier layer of the local end, the second identifier and the second identifier of the second terminal
IP地址之间的映射关系存入本地映射表; The mapping relationship between IP addresses is stored in the local mapping table.
所述映射模块, 具体用于通过本端的标识符层根据所述本地映射表中所述 第二标识符与所述第二 IP地址之间的映射关系将所述第二标识符映射为所述 第二终端对应的第二 IP地址。  The mapping module is configured to map, by the identifier layer of the local end, the second identifier to the foregoing according to a mapping relationship between the second identifier and the second IP address in the local mapping table. The second IP address corresponding to the second terminal.
结合第二方面, 在第二方面的第三种可能的实现方式中, 所述调用模块, 还用于如果本端更新所述第一 IP地址, 通过本端的应用层调用本端的标识符 层接口向所述第二终端发送映射更新报文, 所述映射更新报文中包括本端对应 的标识符和新的 IP地址;  With reference to the second aspect, in a third possible implementation manner of the second aspect, the calling module is further configured to: when the local end updates the first IP address, invoke the local identifier layer interface by using the local application layer Sending a mapping update message to the second terminal, where the mapping update message includes an identifier corresponding to the local end and a new IP address;
所述映射模块, 用于通过本端的标识符层将所述第二标识符映射为所述第 二终端对应的第二 IP地址;  The mapping module is configured to map the second identifier to a second IP address corresponding to the second terminal by using an identifier layer of the local end;
所述发送模块,还用于通过本端的标识符层调用本端的传输层接口将所述 映射更新报文发送给所述第二 IP地址对应的第二终端, 以根据所述新的 IP地 址恢复与所述第二终端之间的数据传输。  The sending module is further configured to send the mapping update message to the second terminal corresponding to the second IP address by using the local layer's transport layer interface to restore the new IP address according to the new IP address. Data transfer with the second terminal.
第三方面, 还提供了一种数据传输的方法, 所述方法包括: 第二终端通过本端的应用层调用本端的标识符层接口接收第一标识符对 应的第一终端发送的数据; In a third aspect, a method for data transmission is provided, where the method includes: The second terminal receives the data sent by the first terminal corresponding to the first identifier by using the identifier layer interface of the local end by the application layer of the local end;
通过本端的标识符层调用本端的传输层接口接收所述第一标识符对应的 第一终端发送的数据。  The data sent by the first terminal corresponding to the first identifier is received by the local layer's transport layer interface.
结合第三方面, 在第三方面的第一种可能的实现方式中, 所述通过本端的 应用层调用本端的标识符层接口接收所述第一标识符对应的第一终端发送的 数据之前, 还包括:  With the third aspect, in a first possible implementation manner of the third aspect, before the application layer of the local end invokes the identifier layer interface of the local end to receive the data sent by the first terminal corresponding to the first identifier, Also includes:
通过本端的应用层调用本端的标识符层接口接收所述第一标识符对应的 第一终端发送的连接请求;  Receiving, by the application layer of the local end, the identifier layer interface of the local end, the connection request sent by the first terminal corresponding to the first identifier;
通过本端的标识符层调用本端的传输层接口接收所述第一标识符对应的 第一终端发送的连接请求, 以与所述第一终端建立基于标识符的连接。  The connection layer sent by the first terminal corresponding to the first identifier is received by the local layer's transport layer interface to establish an identifier-based connection with the first terminal.
结合第三方面的第一种可能的实现方式, 在第三方面的第二种可能的实现 方式中, 所述通过本端的应用层调用本端的标识符层接口接收所述第一标识符 对应的第一终端发送的连接请求之前, 还包括:  With the first possible implementation of the third aspect, in a second possible implementation manner of the third aspect, the application layer of the local end invokes the identifier layer interface of the local end to receive the first identifier Before the connection request sent by the first terminal, the method further includes:
通过本端的应用层调用本端的标识符层接口监听所述第一标识符对应的 第一终端发送的所述连接请求;  The local layer's identifier layer interface is used to listen to the connection request sent by the first terminal corresponding to the first identifier.
通过本端的标识符层调用本端的传输层接口监听所述第一标识符对应的 第一终端发送的连接请求。  The local layer's transport layer interface is used to listen to the connection request sent by the first terminal corresponding to the first identifier.
结合第三方面的第二种可能的实现方式, 在第三方面的第三种可能的实现 方式中, 所述通过本端的标识符层调用本端的传输层接口监听所述第一标识符 对应的第一终端发送的连接请求之后, 还包括:  With the second possible implementation of the third aspect, in a third possible implementation manner of the third aspect, the identifier layer of the local end invokes the local transport layer interface to monitor the corresponding identifier of the first identifier. After the connection request sent by the first terminal, the method further includes:
通过本端的标识符层根据所述第一标识符获取所述第一终端对应的第一 Acquiring the first corresponding to the first terminal according to the first identifier by using the identifier layer of the local end
IP地址, 并通过本端的标识符层将所述第一终端的第一标识符与第一 IP地址 之间的映射关系存入本地映射表, 以根据所述本地映射表中所述第一标识符与 所述第一 IP地址之间的映射关系向所述第一标识符对应的第一终端发送数据。 An IP address, and storing, by the identifier layer of the local end, a mapping relationship between the first identifier of the first terminal and the first IP address in a local mapping table, according to the first identifier in the local mapping table The mapping relationship between the symbol and the first IP address sends data to the first terminal corresponding to the first identifier.
结合第三方面的第三种可能的实现方式, 在第三方面的第四种可能的实现 方式中, 如果所述第一终端更新所述第一 IP地址, 所述方法还包括:  With the third possible implementation of the third aspect, in a fourth possible implementation manner of the third aspect, if the first terminal updates the first IP address, the method further includes:
通过本端的应用层调用本端的标识符层接口接收所述第一终端发送的映 射更新 文, 所述映射更新 文中包括所述第一终端对应的第一标识符和新的 第一 IP地址;  And receiving, by the application layer of the local end, the mapping layer interface of the local terminal, the mapping update file, the mapping identifier, the first identifier corresponding to the first terminal, and the new first IP address;
通过本端的标识符层调用本端的传输层接口接收所述第一终端发送的所 述映射更新报文, 以根据所述新的第一 IP地址恢复与所述第一终端之间的数 据传输。 Receiving, by the identifier layer of the local end, the transport layer interface of the local end, receiving the location sent by the first terminal And mapping the update message to recover data transmission with the first terminal according to the new first IP address.
结合第三方面的第四种可能的实现方式, 在第三方面的第五种可能的实现 方式中, 所述调用本端的传输层接口接收所述第一 IP地址对应的第一终端发 送的所述映射更新报文之后, 还包括:  With the fourth possible implementation of the third aspect, in a fifth possible implementation manner of the third aspect, the transmitting layer interface that invokes the local end receives the location sent by the first terminal corresponding to the first IP address After the mapping update message, the method further includes:
通过本端的应用层调用本端的标识符层接口检查所述第一标识符与所述 新的第一 IP地址之间的映射关系的合法性;  Checking the legality of the mapping relationship between the first identifier and the new first IP address by using an identifier layer interface of the local end by the application layer of the local end;
如果检查结果为合法, 则通过本端的标识符层将所述第一标识符与所述新 的第一 IP地址之间的映射关系存入本地映射表。  If the check result is legal, the mapping relationship between the first identifier and the new first IP address is stored in the local mapping table by the identifier layer of the local end.
结合第三方面, 在第三方面的第六种可能的实现方式中, 所述调用本端的 传输层接口接收所述第一 IP地址对应的第一终端发送的数据之后, 还包括: 通过本端的应用层直接调用本端的传输层接口将接收到的所述第一标识 符对应的第一终端发送的数据转发给第三标识符对应的第三终端;  With reference to the third aspect, in a sixth possible implementation manner of the third aspect, after the transmitting layer interface that invokes the local end receives the data sent by the first terminal corresponding to the first IP address, the method further includes: The application layer directly invokes the transport layer interface of the local end to forward the data sent by the first terminal corresponding to the first identifier to the third terminal corresponding to the third identifier;
和 /或,通过本端的应用层直接调用本端的传输层接口接收所述第三标识符 对应的第三终端发送的数据, 并通过本端的应用层调用本端的标识符层接口将 所述第三终端发送的数据转发给所述第一标识符对应的第一终端。  And/or, directly receiving the data sent by the third terminal corresponding to the third identifier by using the local layer's transport layer interface, and calling the third identifier layer interface of the local end through the local application layer The data sent by the terminal is forwarded to the first terminal corresponding to the first identifier.
第四方面, 还提供了一种终端, 所述终端包括:  In a fourth aspect, a terminal is provided, where the terminal includes:
调用模块, 用于通过本端的应用层调用本端的标识符层接口接收第一标识 符对应的第一终端发送的数据;  a calling module, configured to receive, by using an identifier layer interface of the local end, the data sent by the first terminal corresponding to the first identifier by using an application layer of the local end;
接收模块, 用于通过所述调用模块调用的本端的标识符层调用本端的传输 层接口接收所述映射模块映射得到的第一标识符对应的第一终端发送的数据。  The receiving module is configured to receive, by using the identifier layer of the local end that is invoked by the calling module, the data transmitted by the first terminal corresponding to the first identifier obtained by mapping the mapping module by using the transport layer interface of the local end.
结合第四方面, 在第四方面的第一种可能的实现方式中, 所述调用模块, 还用于通过本端的应用层调用本端的标识符层接口接收所述第一标识符对应 的第一终端发送的连接请求;  With reference to the fourth aspect, in a first possible implementation manner of the fourth aspect, the calling module is further configured to receive, by using an identifier layer interface of the local end by the application layer of the local end, the first identifier corresponding to the first identifier. a connection request sent by the terminal;
所述接收模块,还用于通过本端的标识符层调用本端的传输层接口接收所 述第一标识符对应的第一终端发送的连接请求, 以与所述第一终端建立基于标 识符的连接。  The receiving module is further configured to: receive, by using an identifier layer of the local end, the connection layer interface of the local end to receive a connection request sent by the first terminal corresponding to the first identifier, to establish an identifier-based connection with the first terminal. .
结合第四方面的第一种可能的实现方式, 在第四方面的第二种可能的实现 方式中, 所述调用模块, 还用于通过本端的应用层调用本端的标识符层接口监 听所述第一标识符对应的第一终端发送的所述连接请求;  In conjunction with the first possible implementation manner of the fourth aspect, in a second possible implementation manner of the fourth aspect, the calling module is further configured to: listen to the identifier by using an identifier layer interface of the local end by using an application layer of the local end The connection request sent by the first terminal corresponding to the first identifier;
所述接收模块,还用于通过本端的标识符层调用本端的传输层接口监听所 述第一标识符对应的第一终端发送的连接请求。 The receiving module is further configured to invoke the local transport layer interface monitoring device by using the identifier layer of the local end. a connection request sent by the first terminal corresponding to the first identifier.
结合第四方面的第二种可能的实现方式, 在第四方面的第三种可能的实现 方式中, 所述终端, 还包括:  With reference to the second possible implementation of the fourth aspect, in a third possible implementation manner of the fourth aspect, the terminal further includes:
获取模块, 用于通过本端的标识符层根据所述第一标识符获取所述第一终 端对应的第一 IP地址;  An acquiring module, configured to acquire, by using an identifier layer of the local end, the first IP address corresponding to the first terminal according to the first identifier;
存储模块, 用于通过本端的标识符层将所述第一终端的第一标识符与所述 获取模块获取到的第一 IP地址之间的映射关系存入本地映射表, 以根据所述 本地映射表中所述第一标识符与所述第一 IP地址之间的映射关系向所述第一 标识符对应的第一终端发送数据。  a storage module, configured to store, by using an identifier layer of the local end, a mapping relationship between the first identifier of the first terminal and the first IP address obtained by the acquiring module in a local mapping table, according to the local The mapping relationship between the first identifier and the first IP address in the mapping table sends data to the first terminal corresponding to the first identifier.
结合第四方面的第三种可能的实现方式, 在第四方面的第四种可能的实现 方式中, 所述调用模块, 还用于如果所述第一终端更新所述第一 IP地址, 通 过本端的应用层调用本端的标识符层接口接收所述第一终端发送的映射更新 报文;  With the third possible implementation of the fourth aspect, in a fourth possible implementation manner of the fourth aspect, the calling module is further configured to: if the first terminal updates the first IP address, The application layer of the local end invokes the identifier layer interface of the local end to receive the mapping update packet sent by the first terminal.
所述接收模块,还用于调用本端的传输层接口接收所述第一终端发送的所 述映射更新报文, 以根据所述新的第一 IP地址恢复与所述第一终端之间的数 据传输。  The receiving module is further configured to: call the transport layer interface of the local end to receive the mapping update packet sent by the first terminal, to recover data between the first terminal and the first terminal according to the new first IP address. transmission.
结合第四方面的第四种可能的实现方式, 在第四方面的第五种可能的实现 方式中, 所述终端, 还包括:  With reference to the fourth possible implementation manner of the fourth aspect, in a fifth possible implementation manner of the fourth aspect, the terminal further includes:
检查模块, 用于通过本端的应用层调用本端的标识符层接口检查所述第一 标识符与所述新的第一 IP地址之间的映射关系的合法性;  The checking module is configured to check the legality of the mapping relationship between the first identifier and the new first IP address by using an identifier layer interface of the local end by the application layer of the local end;
所述存储模块, 还用于如果检查结果为合法, 则通过本端的标识符层将所 述第一标识符与所述新的第一 IP地址之间的映射关系存入本地映射表。  The storage module is further configured to store the mapping relationship between the first identifier and the new first IP address in a local mapping table by using an identifier layer of the local end, if the check result is legal.
结合第四方面, 在第四方面的第六种可能的实现方式中, 所述终端, 还包 括:  With reference to the fourth aspect, in a sixth possible implementation manner of the fourth aspect, the terminal further includes:
转发模块, 用于通过本端的应用层直接调用本端的传输层接口将接收到的 所述第一标识符对应的第一终端发送的数据转发给第三标识符对应的第三终 端; 和 /或,通过本端的应用层直接调用本端的传输层接口接收所述第三标识符 对应的第三终端发送的数据, 并通过本端的应用层调用本端的标识符层接口将 所述第三终端发送的数据转发给所述第一标识符对应的第一终端。  a forwarding module, configured to forward, by the application layer of the local end, the data sent by the first terminal corresponding to the first identifier to the third terminal corresponding to the third identifier; and/or Receiving, by the application layer of the local end, the data of the third terminal corresponding to the third identifier is directly received by the local layer, and the third terminal is sent by using the identifier layer of the local end by the application layer of the local end. The data is forwarded to the first terminal corresponding to the first identifier.
第五方面, 还提供了一种数据传输的系统, 所述系统包括: 第一终端和第 二终端; 其中, 所述第一终端如上面第二方面所述的终端; The fifth aspect, further provides a system for data transmission, where the system includes: a first terminal and a second terminal; The first terminal is the terminal according to the second aspect above;
所述第二终端如上面第四方面所述的终端。  The second terminal is the terminal according to the above fourth aspect.
本发明实施例提供的技术方案带来的有益效果是:  The beneficial effects brought by the technical solutions provided by the embodiments of the present invention are:
通过在应用层和传输层之间建立一个标识符层, 并利用应用层调用标识符 层接口, 由标识符层完成标识符到 IP地址的映射, 并调用传输层接口实现通 信双方基于标识符的数据传输,从而无需对终端协议栈中的原有协议层进行修 改, 解决了部署难度大及向后兼容的问题。 附图说明  By establishing an identifier layer between the application layer and the transport layer, and using the application layer to call the identifier layer interface, the identifier layer is mapped to the IP address by the identifier layer, and the transport layer interface is called to implement the identifier-based communication between the two parties. Data transmission eliminates the need to modify the original protocol layer in the terminal protocol stack, solving the problem of difficult deployment and backward compatibility. DRAWINGS
为了更清楚地说明本发明实施例中的技术方案, 下面将对实施例描述中所 需要使用的附图作筒单地介绍, 显而易见地, 下面描述中的附图仅仅是本发明 的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下, 还可以根据这些附图获得其他的附图。  In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present invention. Other drawings may also be obtained from those of ordinary skill in the art in light of the inventive work.
图 1是本发明实施例提供的一种终端内部协议栈示意图;  1 is a schematic diagram of a protocol stack of a terminal according to an embodiment of the present invention;
图 2是本发明实施例提供的第一种数据传输的方法流程图;  2 is a flowchart of a first method for data transmission according to an embodiment of the present invention;
图 3是本发明实施例提供的第二种数据传输的方法流程图;  3 is a flowchart of a second method for data transmission according to an embodiment of the present invention;
图 4是本发明另一实施例提供的第三种数据传输的方法流程图;  4 is a flowchart of a third method for data transmission according to another embodiment of the present invention;
图 5是本发明另一实施例提供的第四种数据传输的方法流程图;  FIG. 5 is a flowchart of a fourth method for data transmission according to another embodiment of the present invention; FIG.
图 6是本发明另一实施例提供的第一种终端的结构示意图;  6 is a schematic structural diagram of a first terminal according to another embodiment of the present invention;
图 7是本发明另一实施例提供的第二种终端的结构示意图;  FIG. 7 is a schematic structural diagram of a second terminal according to another embodiment of the present invention; FIG.
图 8是本发明另一实施例提供的第三种终端的结构示意图;  FIG. 8 is a schematic structural diagram of a third terminal according to another embodiment of the present invention; FIG.
图 9是本发明另一实施例提供的第四种终端的结构示意图;  9 is a schematic structural diagram of a fourth terminal according to another embodiment of the present invention;
图 10是本发明另一实施例提供的第五种终端的结构示意图;  FIG. 10 is a schematic structural diagram of a fifth terminal according to another embodiment of the present invention; FIG.
图 11是本发明另一实施例提供的第六种终端的结构示意图;  FIG. 11 is a schematic structural diagram of a sixth terminal according to another embodiment of the present invention;
图 12是本发明另一实施例提供的一种数据传输的系统的结构示意图。 具体实施方式  FIG. 12 is a schematic structural diagram of a system for data transmission according to another embodiment of the present invention. detailed description
为使本发明的目的、 技术方案和优点更加清楚, 下面将结合附图对本发明 实施方式作进一步地详细描述。  The embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
本发明实施例提供了一种数据传输的方法, 该方法通过在终端协议栈中的 应用层与传输层之间建立一个标识符层, 实现 IP地址与标识符的分离。 其中, 终端协议栈示意图如图 1所示, 图 1中, 标识符层向应用层 App提供新的 API ( Application Programming Interface,应用程序编程接口),使应用层能够基于通 信双方的标识符发起会话, 由标识符层维护该会话, 并将标识符映射为相应的 IP地址, 从而建立并管理传输层的连接, 使传输层仍基于 IP地址传输数据。 基于图 1所示的终端协议栈, 本实施例以第一终端向第二终端发送数据为例, 对数据传输的方法进行举例说明。 参见图 2, 本实施例提供的方法流程具体如 下: Embodiments of the present invention provide a data transmission method, which implements separation of an IP address and an identifier by establishing an identifier layer between an application layer and a transport layer in a terminal protocol stack. among them, The schematic diagram of the terminal protocol stack is shown in Figure 1. In Figure 1, the identifier layer provides a new API (Application Programming Interface) to the application layer App, enabling the application layer to initiate a session based on the identifiers of the communicating parties. The identifier layer maintains the session and maps the identifier to the corresponding IP address to establish and manage the transport layer connection so that the transport layer still transmits data based on the IP address. Based on the terminal protocol stack shown in FIG. 1, this embodiment uses the first terminal to send data to the second terminal as an example, and illustrates a method for data transmission. Referring to FIG. 2, the process of the method provided in this embodiment is specifically as follows:
201 : 第一终端通过本端的应用层调用本端的标识符层接口向第二标识符 对应的第二终端发送数据;  201: The first terminal sends the data to the second terminal corresponding to the second identifier by using the identifier layer interface of the local end by the application layer of the local end;
进一步地,通过本端的应用层调用本端的标识符层接口向第二标识符对应 的第二终端发送数据之前, 还包括:  Further, before the application layer of the local end invokes the identifier layer of the local end to send data to the second terminal corresponding to the second identifier, the method further includes:
通过本端的应用层调用本端的标识符层接口向第二标识符对应的第二终 端发送连接请求;  Sending a connection request to the second terminal corresponding to the second identifier by using the local layer identifier layer interface by the local application layer;
通过本端的标识符层根据第二标识符获取第二终端对应的第二 IP地址, 并调用本端的传输层接口向第二 IP地址对应的第二终端发送连接请求, 以与 第二终端建立基于标识符的连接。  Obtaining, by the identifier layer of the local end, the second IP address corresponding to the second terminal according to the second identifier, and calling the transport layer interface of the local end to send a connection request to the second terminal corresponding to the second IP address, to establish a connection with the second terminal. The connection of the identifier.
进一步地,通过本端的标识符层根据第二标识符获取第二终端对应的第二 Further, obtaining, by the identifier layer of the local end, the second terminal corresponding to the second terminal according to the second identifier
IP地址之后, 还包括: After the IP address, it also includes:
通过本端的标识符层将第二终端的第二标识符与第二 IP地址之间的映射 关系存入本地映射表;  The mapping relationship between the second identifier of the second terminal and the second IP address is stored in the local mapping table by using the identifier layer of the local end;
通过本端的标识符层将第二标识符映射为第二终端对应的第二网际协议 Mapping the second identifier to the second internet protocol corresponding to the second terminal by using the identifier layer of the local end
IP地址, 具体包括: IP address, including:
通过本端的标识符层根据本地映射表中第二标识符与第二 IP地址之间的 映射关系将第二标识符映射为第二终端对应的第二 IP地址。  The second identifier is mapped to the second IP address corresponding to the second terminal by the identifier layer of the local end according to the mapping relationship between the second identifier and the second IP address in the local mapping table.
202: 通过本端的标识符层将第二标识符映射为第二终端对应的第二 IP地 址, 并调用本端的传输层接口将数据发送给第二 IP地址对应的第二终端。  202: The second identifier is mapped to the second IP address corresponding to the second terminal by using the identifier layer of the local end, and the data of the local end is sent to the second terminal corresponding to the second IP address.
进一步地, 如果本端更新 IP地址, 方法还包括:  Further, if the local end updates the IP address, the method further includes:
通过本端的应用层调用本端的标识符层接口向第二终端发送映射更新报 文, 映射更新 ^艮文中包括本端对应的标识符和新的 IP地址;  The local layer's identifier layer interface is used to send a mapping update message to the second terminal, and the mapping update includes the identifier corresponding to the local end and the new IP address.
通过本端的标识符层将第二标识符映射为第二终端对应的第二 IP地址, 并调用本端的传输层接口将映射更新报文发送给第二 IP地址对应的第二终端, 以根据新的 IP地址恢复与第二终端之间的数据传输。 The second identifier is mapped to the second IP address corresponding to the second terminal by the identifier layer of the local end, and the mapping update interface is sent to the second terminal corresponding to the second IP address by using the transport layer interface of the local end. To recover data transmission with the second terminal according to the new IP address.
基于图 1所示的终端协议栈, 本实施例以第二终端接收第一终端发送的数 据为例, 对数据传输的方法进行举例说明。 参见图 3 , 本实施例提供的方法流 程具体如下:  Based on the terminal protocol stack shown in FIG. 1, this embodiment uses the second terminal to receive the data sent by the first terminal as an example, and illustrates a method for data transmission. Referring to FIG. 3, the process of the method provided in this embodiment is specifically as follows:
301 : 第二终端通过本端的应用层调用本端的标识符层接口接收第一标识 符对应的第一终端发送的数据;  301: The second terminal receives the data sent by the first terminal corresponding to the first identifier by using the identifier layer interface of the local end by the application layer of the local end;
进一步地,通过本端的应用层调用本端的标识符层接口接收第一标识符对 应的第一终端发送的数据之前, 还包括:  Further, before the application layer of the local end calls the identifier layer interface of the local end to receive the data sent by the first terminal corresponding to the first identifier, the method further includes:
通过本端的应用层调用本端的标识符层接口接收第一标识符对应的第一 终端发送的连接请求;  Receiving, by the application layer of the local end, the identifier layer interface of the local end, the connection request sent by the first terminal corresponding to the first identifier;
通过本端的标识符层调用本端的传输层接口接收第一标识符对应的第一 终端发送的连接请求, 以与第一终端建立基于标识符的连接。  The connection layer sent by the first terminal corresponding to the first identifier is received by the local layer's transport layer interface to establish an identifier-based connection with the first terminal.
进一步地,通过本端的应用层调用本端的标识符层接口接收第一标识符对 应的第一终端发送的连接请求之前, 还包括:  Further, before the application layer of the local end calls the identifier layer interface of the local end to receive the connection request sent by the first terminal corresponding to the first identifier, the method further includes:
通过本端的应用层调用本端的标识符层接口监听第一标识符对应的第一 终端发送的连接请求;  The local layer's identifier layer interface is used to listen to the connection request sent by the first terminal corresponding to the first identifier.
通过本端的标识符层调用本端的传输层接口监听第一标识符对应的第一 终端发送的连接请求。  The local layer's transport layer interface is used to listen to the connection request sent by the first terminal corresponding to the first identifier.
进一步地,通过本端的标识符层调用本端的传输层接口监听所述第一标识 符对应的第一终端发送的连接请求之后, 还包括:  Further, after the local layer's transport layer interface is used to listen to the connection request sent by the first terminal corresponding to the first identifier, the identifier layer of the local end further includes:
通过本端的标识符层根据所述第一标识符获取所述第一终端对应的第一 IP地址, 并通过本端的标识符层将第一终端的第一标识符与第一 IP地址之间 的映射关系存入本地映射表, 以根据本地映射表中第一标识符与第一 IP地址 之间的映射关系向第一标识符映射对应的第一终端发送数据。  Obtaining, by the identifier layer of the local end, the first IP address corresponding to the first terminal according to the first identifier, and connecting the first identifier of the first terminal with the first IP address by using the identifier layer of the local end The mapping relationship is stored in the local mapping table to send data to the first terminal corresponding to the first identifier mapping according to the mapping relationship between the first identifier and the first IP address in the local mapping table.
302: 通过本端的标识符层调用本端的传输层接口接收第一标识符对应的 第一终端发送的数据。  302: The local layer's transport layer interface is used to receive data sent by the first terminal corresponding to the first identifier by using the identifier layer of the local end.
进一步地, 如果第一终端更新第一 IP地址, 方法还包括:  Further, if the first terminal updates the first IP address, the method further includes:
通过本端的应用层调用本端的标识符层接口接收第一终端发送的映射更 新才艮文, 映射更新 文中包括第一终端对应的第一标识符和新的第一 IP地址; 通过本端的标识符层调用本端的传输层接口接收第一终端发送的映射更 新报文, 以根据新的第一 IP地址恢复与第一终端之间的数据传输。 进一步地, 调用本端的传输层接口接收第一 IP地址对应的第一终端发送 的映射更新报文之后, 还包括: Receiving, by the local application layer, the identifier layer interface of the local end, the mapping update sent by the first terminal, where the mapping update text includes the first identifier corresponding to the first terminal and the new first IP address; The layer invokes the transport layer interface of the local end to receive the mapping update packet sent by the first terminal, to recover the data transmission with the first terminal according to the new first IP address. Further, after the calling the transport layer interface of the local end receives the mapping update packet sent by the first terminal corresponding to the first IP address, the method further includes:
通过本端的应用层调用本端的标识符层接口检查第一标识符与新的第一 IP地址之间的映射关系的合法性;  The local layer's identifier layer interface is used to check the legality of the mapping relationship between the first identifier and the new first IP address.
如果检查结果为合法,则通过本端的标识符层将第一标识符与新的第一 IP 地址之间的映射关系存入本地映射表。  If the check result is legal, the mapping relationship between the first identifier and the new first IP address is stored in the local mapping table through the identifier layer of the local end.
进一步地, 调用本端的传输层接口接收第一 IP地址对应的第一终端发送 的数据之后, 还包括:  Further, after the calling the transport layer interface of the local end receives the data sent by the first terminal corresponding to the first IP address, the method further includes:
通过本端的应用层直接调用本端的传输层接口将接收到的第一标识符对 应的第一终端发送的数据转发给第三标识符对应的第三终端;  The data sent by the first terminal corresponding to the received first identifier is forwarded to the third terminal corresponding to the third identifier by directly calling the local layer's transport layer interface;
和 /或,通过本端的应用层直接调用本端的传输层接口接收第三标识符对应 的第三终端发送的数据, 并通过本端的应用层调用本端的标识符层接口将第三 终端发送的数据转发给第一标识符对应的第一终端。  And/or, the local layer of the transport layer directly calls the local end of the transport layer interface to receive the data sent by the third terminal corresponding to the third identifier, and the local layer's identifier layer interface is used to send the data sent by the third terminal through the local application layer. Forwarding to the first terminal corresponding to the first identifier.
本发明实施例提供的方法, 通过在应用层和传输层之间建立一个标识符 层, 并利用应用层调用标识符层接口, 由标识符层完成标识符到 IP地址的映 射, 并调用传输层接口实现通信双方基于标识符的数据传输, 从而无需对终端 协议栈中的原有协议层进行修改, 解决了部署难度大及向后兼容的问题。 本发明另一实施例提供了一种数据传输的方法, 为了便于说明, 本实施例 结合上述实施例的内容以及图 1所示的协议栈示意图, 以布局了标识符层的终 端 A与布局了标识符层的终端 B之间进行数据传输, 且终端 A的标识符为标 识符 A, 终端 A的 IP地址为地址 A , 终端 B的标识符为标识符 B, 终端 B的 IP地址为地址 B为例,对本实施例提供的数据传输的方法进行举例说明。在说 明本实施例提供的方法之前, 首先结合图 1所示的协议栈, 对协议栈中的标识 符层进行说明。 该标识符层为了实现标识符到 IP地址的映射, 以及建立和管 理传输层的连接, 提供以下函数:  The method provided by the embodiment of the present invention completes the mapping of the identifier to the IP address by the identifier layer by establishing an identifier layer between the application layer and the transport layer, and calling the identifier layer interface by using the application layer, and calling the transport layer. The interface implements identifier-based data transmission between the two communicating parties, thereby eliminating the need to modify the original protocol layer in the terminal protocol stack, thereby solving the problem of difficulty in deployment and backward compatibility. Another embodiment of the present invention provides a method for data transmission. For convenience of description, the present embodiment combines the contents of the foregoing embodiment and the protocol stack diagram shown in FIG. 1 to lay out the terminal A and the layout of the identifier layer. The data is transmitted between the terminal B of the identifier layer, and the identifier of the terminal A is the identifier A, the IP address of the terminal A is the address A, the identifier of the terminal B is the identifier B, and the IP address of the terminal B is the address B. For example, the method for data transmission provided in this embodiment is exemplified. Before describing the method provided by this embodiment, the identifier layer in the protocol stack is first described in conjunction with the protocol stack shown in FIG. The identifier layer provides the following functions in order to implement the mapping of identifiers to IP addresses and to establish and manage transport layer connections:
IDLookup: 该函数的参数为标识符。 该函数用于根据输入的标识符向映射 服务器发送映射查询请求, 并获得该标识符当前所对应的 IP地址, 緩存入映 射表;  IDLookup: The argument to this function is an identifier. The function is configured to send a mapping query request to the mapping server according to the input identifier, and obtain an IP address corresponding to the current identifier of the identifier, and cache the mapping table;
IDUpdate: 该函数的参数为标识符与对应的 IP地址。 该函数用于向通信 对端或映射服务器发送映射更新请求; IDCheck: 该函数的参数为标识符与对应的 IP地址。 该函数用于针对其完 成 RR ( Return Routability,往返可路由 )过程,检查两者的对应关系的合法性。 若关系合法, 则将该标识符与对应 IP地址緩存入映射表。 IDUpdate: The parameters of this function are the identifier and the corresponding IP address. The function is used to send a mapping update request to a communication peer or a mapping server; IDCheck: The parameters of this function are the identifier and the corresponding IP address. This function is used to complete the RR (Return Routability) process and check the legality of the correspondence between the two. If the relationship is legal, the identifier and the corresponding IP address are cached into the mapping table.
IDSocket: 该函数的参数包括使用的协议簇、 传输层协议等。 该函数用于 创建一个基于标识符的会话 Socket, 该 IDSocket在本地维护双方会话相关数 据, 包括双方标识符、 端口、 IP地址等, 并调用传统 Socket接口中的 Socket 函数;  IDSocket: The parameters of this function include the protocol cluster used, the transport layer protocol, and so on. This function is used to create an identifier-based session Socket, which maintains the session-related data of both parties, including the identifiers, ports, IP addresses, etc., and calls the Socket function in the traditional Socket interface.
IDBind: 该函数的参数包括本地标识符、 本地 Port、 本地 IP (可选)。 该 函数用于利用获得的本地 Port和 IP调用传统 Socket接口中的 Bind函数;  IDBind: The parameters of this function include local identifier, local port, local IP (optional). This function is used to call the Bind function in the traditional Socket interface with the obtained local Port and IP;
IDConnect: 该函数的参数包括本地标识符、 对端标识符、 对端 Port、 对端 IDConnect: The parameters of this function include local identifier, peer identifier, peer port, peer
IP (可选)。 若用户没有指定对端 IP地址, 则需要在此处完成标识符到 IP的映 射查询, 即调用 UIDLookup函数。 该函数用于利用获得的对端 Port和 IP调用 传统 Socket接口中的 Connect函数, 同时需要告知对端自身的标识符(如使用 IPv6扩展头); IP (optional). If the user does not specify the peer IP address, then the identifier-to-IP mapping query needs to be completed here, that is, the UIDLookup function is called. This function is used to call the Connect function in the traditional Socket interface by using the obtained peer port and IP, and needs to inform the peer of its own identifier (such as using an IPv6 extension header);
IDListen: 该函数用于调用传统 Socket接口中的 Listen函数;  IDListen: This function is used to call the Listen function in the traditional Socket interface.
IDAccept: 该函数用于获得对端的标识符, 检查其合法性, 并调用传统 Socket接口中的 Accept函数;  IDAccept: This function is used to obtain the identifier of the peer, check its legality, and call the Accept function in the traditional Socket interface.
IDWrite: 该函数用于向对端发送数据, 报文中需携带自身标识符(如使用 IPv6扩展头), 调用传统 Socket接口中的 Write函数;  IDWrite: This function is used to send data to the peer. The packet needs to carry its own identifier (such as using the IPv6 extension header), and call the Write function in the traditional Socket interface.
IDRead: 该函数用于从对端接收数据, 调用传统 Socket接口中的 Read函 数。  IDRead: This function is used to receive data from the peer and call the Read function in the traditional Socket interface.
结合上述标识符层提供的函数, 参见图 4, 本实施例提供的方法流程具体 :¾口下:  In conjunction with the function provided by the identifier layer, referring to FIG. 4, the method flow provided by this embodiment is specifically: 3⁄4:
401 :终端 A通过终端 A的应用层调用终端 A的标识符层接口向标识符 B 对应的终端 B发送连接请求;  401: terminal A sends a connection request to terminal B corresponding to identifier B by calling the identifier layer interface of terminal A through the application layer of terminal A;
针对该步骤, 具体实现时, 可先由终端 A的应用层调用终端 A的标识符 层中的 IDSocket函数和 IDBind函数,以对终端 A的标识符层接口进行初始化, 之后再由终端 A通过终端 A的应用层调用终端 A的标识符层接口 IDSocket向 标识符 B对应的终端 B发送连接请求。  For the specific implementation, the ID socket function and the IDBind function in the identifier layer of the terminal A may be first invoked by the application layer of the terminal A to initialize the identifier layer interface of the terminal A, and then the terminal A passes the terminal. The application layer of A calls the identifier layer interface IDSocket of the terminal A to send a connection request to the terminal B corresponding to the identifier B.
其中, 终端 A的标识符层接口 IDSocket可类比于传统 Socket接口, 因而 对应用层而言, 相当于提供了新的 API。 402: 终端 A的标识符层根据标识符 B获取终端 B对应的地址 B, 并调用 终端 A的传输层接口向地址 B对应的终端 B发送连接请求。 The identifier layer interface IDSocket of the terminal A can be analogized to the traditional Socket interface, so that the application layer is equivalent to providing a new API. 402: The identifier layer of the terminal A acquires the address B corresponding to the terminal B according to the identifier B, and invokes the transport layer interface of the terminal A to send a connection request to the terminal B corresponding to the address B.
具体地, 在上述步骤 401中终端 A的应用层调用终端 A的标识符层接口 后, 为了调用传输层接口, 标识符层可通过终端 A的标识符层函数 IDLookup 获取终端 B对应的地址 B , 然后再调用函数 IDConnect, 由函数 IDConnect利 用终端 B的端口和终端 B对应的地址 B调用传统传输层 Socket接口中的 Connect函数, 完成向地址 B对应的终端 B发送连接请求的操作, 该连接请求 中携带了终端 A自身的标识符。  Specifically, after the application layer of the terminal A invokes the identifier layer interface of the terminal A in the foregoing step 401, in order to invoke the transport layer interface, the identifier layer can obtain the address B corresponding to the terminal B through the identifier layer function IDLookup of the terminal A, Then, the function IDConnect is called, and the function IDConnect uses the port B of the terminal B and the address B corresponding to the terminal B to call the Connect function in the traditional transport layer Socket interface, and completes the operation of sending a connection request to the terminal B corresponding to the address B, in the connection request. Carrying the identifier of the terminal A itself.
其中, 函数 IDLookup具体根据终端 B的标识符 B向映射服务器发送映射 查询请求, 从而获得该标识符当前所对应的地址 B, 且为了避免重复执行获取 终端 B对应的地址 B的过程, 本实施例提供的方法在终端 A第一次获取到终 端 B对应的地址 B之后, 可将终端 B的标识符 B与地址 B之间的映射关系存 入本地映射表, 以便下次直接 居本地映射表将标识符 B映射为地址 B。  The function IDLookup sends a mapping query request to the mapping server according to the identifier B of the terminal B, so as to obtain the address B corresponding to the identifier, and the process of obtaining the address B corresponding to the terminal B is repeated. After the terminal A obtains the address B corresponding to the terminal B for the first time, the mapping relationship between the identifier B and the address B of the terminal B can be stored in the local mapping table, so that the next direct mapping table will be used. The identifier B is mapped to the address B.
403: 终端 B通过终端 B的应用层调用终端 B的标识符层接口监听标识符 A对应的终端 A发送的连接请求;  403: The terminal B uses the identifier layer interface of the terminal B to listen to the connection request sent by the terminal A corresponding to the identifier A through the application layer of the terminal B;
针对该步骤, 作为数据接收方, 为了监听终端 A发送的连接请求, 终端 B 可通过终端 B的应用层调用终端 B的标识符层接口中的 IDSocket函数实现监 听标识符 A对应的终端 A发送的连接请求。  For this step, as the data receiver, in order to listen to the connection request sent by the terminal A, the terminal B can use the ID socket function in the identifier layer interface of the terminal B of the terminal B to implement the terminal A corresponding to the interception identifier A. Connection request.
404: 终端 B通过终端 B的标识符层调用终端 B的传输层接口监听标识符 A对应的终端 A发送的连接请求。  404: The terminal B invokes the transport layer interface of the terminal B through the identifier layer of the terminal B to listen to the connection request sent by the terminal A corresponding to the identifier A.
具体地, 终端 B的标识符层接口被应用层调用后, 终端 B的标识符层调 用终端 B的传输层接口监听标识符 A对应的终端 A发送的连接请求, 具体实 现时, 标识符层可调用函数 IDlisten, 由函数 IDListen调用终端 B 的传输层 Socket接口中的 listen函数监听地址 A对应的终端 A发送的连接请求。  Specifically, after the identifier layer interface of the terminal B is invoked by the application layer, the identifier layer of the terminal B invokes the transport layer interface of the terminal B to listen to the connection request sent by the terminal A corresponding to the identifier A. The function IDlisten is called, and the listen function in the transport layer Socket interface of the terminal B is called by the function IDListen to listen to the connection request sent by the terminal A corresponding to the address A.
另外, 在通过标识符层调用传输层接口中的 listen函数监听标识符 A对应 的终端 A发送的连接请求之后, 如果监听到终端 A发送的连接请求, 本实施 例提供的方法还包括: 终端 B通过终端 B的标识符层根据标识符 A获取终端 A对应的地址 A的步骤, 该步骤在具体实现时, 可由终端 B的标识符层调用 函数 IDLookup, 由函数 IDLookup根据终端 A的标识符 A向本地映射服务器 发送映射查询请求, 并获得该标识符 A当前所对应的地址 A,且为了在与终端 A建立基于标识符的连接之后, 为了能够实现向终端 A发送数据, 并避免重复 执行获取终端 A对应的地址 A的过程, 该步骤在获取到终端 A对应的地址 A 之后, 还包括通过终端 B的标识符层将终端 A的标识符 A与地址 A之间的映 射关系存入本地映射表的步骤, 以使终端 B 能够根据本地映射表中标识符 A 与地址 A之间的映射关系向标识符 A对应的终端 A发送数据。 In addition, after the listener function in the transport layer interface is called by the identifier layer to listen to the connection request sent by the terminal A corresponding to the identifier A, if the connection request sent by the terminal A is detected, the method provided in this embodiment further includes: The step of obtaining the address A corresponding to the terminal A according to the identifier A by the identifier layer of the terminal B. In the specific implementation, the function IDLookup can be called by the identifier layer of the terminal B, and the function IDLookup is used according to the identifier A of the terminal A. The local mapping server sends a mapping query request, and obtains the address A corresponding to the current identifier A, and in order to enable the transmission of data to the terminal A after the establishment of the identifier-based connection with the terminal A, and avoids duplication The process of obtaining the address A corresponding to the terminal A is performed. After obtaining the address A corresponding to the terminal A, the step further includes storing the mapping relationship between the identifier A of the terminal A and the address A through the identifier layer of the terminal B. The step of mapping the table locally, so that the terminal B can send data to the terminal A corresponding to the identifier A according to the mapping relationship between the identifier A and the address A in the local mapping table.
405: 终端 B通过终端 B的应用层调用终端 B的标识符层接口接收标识符 A对应的终端 A发送的连接请求;  405: The terminal B receives the connection request sent by the terminal A corresponding to the identifier A by using the identifier layer interface of the terminal B through the application layer of the terminal B;
针对该步骤, 当终端 A发送的连接请求发送至终端 B后, 终端 B通过终 端 B的应用层调用终端 B的标识符层接口 IDSocket接收标识符 A对应的终端 A发送的连接请求。  For this step, after the connection request sent by the terminal A is sent to the terminal B, the terminal B receives the connection request sent by the terminal A corresponding to the identifier A through the identifier layer interface IDSocket of the terminal B through the application layer of the terminal B.
406: 终端 B通过终端 B的标识符层调用终端 B的传输层接口接收标识符 A对应的终端 A发送的连接请求。  406: The terminal B receives the connection request sent by the terminal A corresponding to the identifier A by calling the transport layer interface of the terminal B through the identifier layer of the terminal B.
具体地, 由于上述步骤 404已经获取到终端 A对应的地址 A, 并将其存入 本地映射表, 则在步骤 405中终端 B通过终端 B的应用层调用终端 B的标识 符层接口接收标识符 A对应的终端 A发送的连接请求后, 在该步骤 406中, 本实施例提供的方法在通过终端 B的标识符层调用终端 B的传输层接口接收 标识符 A对应的终端 A发送的连接请求之前, 还包括检查标识符 A的合法性 的操作, 如果检查结果为合法, 则通过标识符层调用函数 IDAccept, 由函数 IDAccept调用终端 B的传输层 Socket接口中的 Accept函数接收标识符 A对应 的终端 A发送的连接请求。  Specifically, since the foregoing step 404 has acquired the address A corresponding to the terminal A and stores it in the local mapping table, the terminal B receives the identifier through the identifier layer interface of the terminal B through the application layer of the terminal B in step 405. After the connection request sent by the terminal A corresponding to A, in the step 406, the method provided in this embodiment receives the connection request sent by the terminal A corresponding to the identifier A by calling the transport layer interface of the terminal B through the identifier layer of the terminal B. Previously, it also includes an operation of checking the validity of the identifier A. If the check result is legal, the function IDAccept is called by the identifier layer, and the Accept function in the transport layer Socket interface of the terminal B is called by the function IDAccept to receive the identifier A. The connection request sent by terminal A.
需要说明的是, 以上步骤 401至步骤 406为终端 A与终端 B之间建立基 于标识符的连接的具体过程。 在建立基于标识符的连接后, 在连接未发生中断 的情况下, 终端 A和终端 B之间可进行基于标识符的多次数据传输, 而无需 在每次进行数据传输时均重新建立标识符的连接,也就是说,仅在终端 A和终 端 B首次传输数据之前或连接中断后才执行上述步骤 401至步骤 406的操作。  It should be noted that the above steps 401 to 406 are specific procedures for establishing an identifier-based connection between the terminal A and the terminal B. After the identifier-based connection is established, the identifier-based multiple data transmission can be performed between the terminal A and the terminal B without interruption of the connection, without re-establishing the identifier every time data transmission is performed. The connection, that is, the operation of the above steps 401 to 406 is performed only before the terminal A and the terminal B transmit data for the first time or after the connection is interrupted.
407:终端 A通过终端 A的应用层调用终端 A的标识符层接口向标识符 B 对应的终端 B发送数据;  407: terminal A sends data to terminal B corresponding to identifier B through the identifier layer interface of terminal A through the application layer of terminal A;
针对该步骤, 在执行完上述步骤 401至步骤 406后, 即终端 A与终端 B 已经建立起基于标识符的连接,通信双方便可基于标识符进行数据的发送与接 收。 在终端 A通过终端 A的应用层调用终端 A的标识符层接口向标识符 B对 应的终端 B发送数据时, 终端 A可通过终端 A的应用层调用终端 A的标识符 层接口 IDSocket向标识符 B对应的终端 B发送数据。 408:终端 A通过终端 A的标识符层将标识符 B映射为终端 B对应的地址 B, 并调用终端 A的传输层接口将数据发送给地址 B对应的终端 B。 For this step, after performing the above steps 401 to 406, that is, the terminal A and the terminal B have established an identifier-based connection, the communication parties can perform data transmission and reception based on the identifier. When the terminal A sends the data to the terminal B corresponding to the identifier B through the application layer of the terminal A, the terminal A can call the identifier layer interface ID socket of the terminal A to the identifier through the application layer of the terminal A. Terminal B corresponding to B transmits data. 408: The terminal A maps the identifier B to the address B corresponding to the terminal B through the identifier layer of the terminal A, and calls the transport layer interface of the terminal A to send the data to the terminal B corresponding to the address B.
具体地, 由于上述步骤 402中终端 A已经获取到终端 B对应的地址 B,并 将其存入本地映射表,则在步骤 407中终端 A通过终端 A的应用层调用终端 A 的标识符层接口向标识符 B对应的终端 B发送数据后, 为了实现发送数据, 在该步骤 408中, 终端 A可通过终端 A的标识符层将标识符 B映射为终端 B 对应的地址 B,即通过终端 A的标识符层 ^据本地映射表中标识符 B与地址 B 之间的映射关系将标识符 B映射为终端 B对应的地址 B。之后再通过标识符层 调用函数 IDWrite,由函数 IDWrite调用终端 A的传输层 Socket接口中的 Write 函数将数据发送给地址 B对应的终端 B。  Specifically, since the terminal B has obtained the address B corresponding to the terminal B in the above step 402 and stores it in the local mapping table, the terminal A invokes the identifier layer interface of the terminal A through the application layer of the terminal A in step 407. After transmitting the data to the terminal B corresponding to the identifier B, in order to implement the transmission of the data, in step 408, the terminal A can map the identifier B to the address B corresponding to the terminal B through the identifier layer of the terminal A, that is, through the terminal A. The identifier layer maps the identifier B to the address B corresponding to the terminal B according to the mapping relationship between the identifier B and the address B in the local mapping table. Then, the function IDWrite is called through the identifier layer, and the function of the call layer Socket interface of the terminal A is called by the function IDWrite to send the data to the terminal B corresponding to the address B.
409: 终端 B通过终端 B的应用层调用终端 B的标识符层接口接收标识符 A对应的终端 A发送的数据;  409: The terminal B receives the data sent by the terminal A corresponding to the identifier A by using the identifier layer interface of the terminal B through the application layer of the terminal B;
针对该步骤,在执行完步骤 408后,如果终端 A发送的数据发送至终端 B, 则终端 B可通过终端 B的应用层调用终端 B的标识符层接口 IDSocket接收标 识符 A对应的终端 A发送的数据。  For this step, after the step 408 is executed, if the data sent by the terminal A is sent to the terminal B, the terminal B can send the terminal A corresponding to the identifier A through the identifier layer interface ID socket of the terminal B through the application layer of the terminal B. The data.
410: 终端 B通过终端 B的标识符层调用终端 B的传输层接口接收标识符 A对应的终端 A发送的数据。  410: The terminal B receives the data sent by the terminal A corresponding to the identifier A by calling the transport layer interface of the terminal B through the identifier layer of the terminal B.
具体地, 在步骤 409中终端 B通过终端 B的应用层调用终端 B的标识符 层接口接收标识符 A对应的终端 A发送的数据后, 终端 B可通过标识符层调 用函数 IDRead, 由函数 IDRead调用终端 B的传输层 Socket接口中的 Read函 数接收标识符 A对应的终端 A发送的数据, 至此, 实现了布局了标识符层的 终端 A与布局了标识符层的终端 B之间的数据传输。  Specifically, in step 409, after the terminal B receives the data sent by the terminal A corresponding to the identifier A through the identifier layer interface of the terminal B, the terminal B can call the function IDRead through the identifier layer, and the function IDRead The Read function in the transport layer Socket interface of the calling terminal B receives the data sent by the terminal A corresponding to the identifier A, and thus, the data transmission between the terminal A in which the identifier layer is laid out and the terminal B in which the identifier layer is laid out is realized. .
进一步地, 在终端 A与终端 B建立了基于标识符的连接后, 如果终端 A 或终端 B更新了 IP地址, 则为了实现终端 A与终端 B之间能够继续进行数据 传输, 需要更新 IP地址的终端将更新后的 IP地址通知对端, 以根据新的 IP地 址恢复与对端的数据传输。 为了便于理解, 以终端 A由原来的地址 A更新为 地址 A,为例, 本实施例提供的方法还包括如下步骤:  Further, after the terminal A and the terminal B establish an identifier-based connection, if the terminal A or the terminal B updates the IP address, in order to enable the data transmission between the terminal A and the terminal B, the IP address needs to be updated. The terminal notifies the peer end of the updated IP address to recover the data transmission with the peer end according to the new IP address. For the sake of understanding, the terminal A is updated from the original address A to the address A. For example, the method provided in this embodiment further includes the following steps:
步骤 a:终端 A通过终端 A的应用层调用终端 A的标识符层接口 IDSocket 向终端 B发送映射更新 文, 该映射更新 文中包括终端 A对应的标识符和 地址 Α' ;  Step a: Terminal A sends a mapping update message to terminal B through the identifier layer interface IDSocket of terminal A through the application layer of terminal A, and the mapping update includes the identifier and address corresponding to terminal A;
步骤 b: 终端 A通过终端 A的标识符层根据本地映射表中标识符 B与地 址 B之间的映射关系将标识符 B映射为终端 B对应的地址 B。 然后通过标识 符层调用函数 IDUpdate, 由函数 IDUpdate调用终端 A的传输层 Socket接口中 的 Update函数将映射更新报文发送给地址 B对应的终端 B。 Step b: The terminal A passes the identifier layer of the terminal A according to the identifier B and the ground in the local mapping table. The mapping relationship between the addresses B maps the identifier B to the address B corresponding to the terminal B. Then, the function IDUpdate is called by the identifier layer, and the Update function in the transport layer Socket interface of the terminal A is called by the function IDUpdate to send the map update message to the terminal B corresponding to the address B.
步骤 c:终端 B通过终端 B的应用层调用终端 B的标识符层接口 IDSocket 接收终端 A发送的映射更新^艮文, 该映射更新 文中包括终端 A对应的标识 符 A和地址 A,;  Step C: The terminal B receives the mapping update message sent by the terminal A by using the identifier layer interface IDSocket of the terminal B through the application layer of the terminal B, and the mapping update includes the identifier A and the address A corresponding to the terminal A,
步骤 d:终端 B通过终端 B的标识符层调用函数 IDAccept, 函数 IDAccept 获得终端 A的标识符, 并检查其合法性, 如果检查结果合法, 则调用传统传输 层 Socket接口中的 Accept函数接收地址 A对应的终端 A发送的映射更新报文, 以根据新的地址 A恢复与终端 A之间的数据传输。  Step d: Terminal B calls the function IDAccept through the identifier layer of the terminal B, and the function IDAccept obtains the identifier of the terminal A, and checks its legality. If the check result is legal, the Accept function in the traditional transport layer Socket interface is called to receive the address A. Corresponding mapping update message sent by terminal A to recover data transmission with terminal A according to new address A.
本发明实施例提供的方法, 通过在应用层和传输层之间建立一个标识符 层, 并利用应用层调用标识符层接口, 由标识符层完成标识符到 IP地址的映 射, 并调用传输层接口实现通信双方基于标识符的数据传输, 从而无需对终端 协议栈中的原有协议层进行修改, 解决了部署难度大及向后兼容的问题。 本发明另一实施例提供了一种数据传输的方法, 为了便于说明, 本实施 例结合上述实施例的内容以及图 1所示的协议栈示意图,以终端 A部署了标识 符层,终端 B,未部署标识符层,终端 A与部署了标识符层的代理节点即终端 C 之间建立了基于标识符的连接, 而终端 C 与终端 B,之间又建立了 TCP ( Transmission Control Protocol , 传输控制协议 ) 或 UDP ( User Datagram Protocol, 用户数据 协议)等传输层连接, 通过终端 C实现终端 A和终端 B, 之间的数据传输为例, 对本发明实施例提供的数据传输的方法进行举例说明。 其中, 代理节点终端 C对应的标识符为标识符 C、 IP地址为地址 C, 终端 C 与终端 A之间建立基于标识符连接的方式同上述实施例中步骤 401至步骤 406 所述的终端 A与终端 B,之间建立标识符连接的方式, 终端 C与终端 B,之间建 立 TCP或 UDP等传输层连接的方式可采用现有的连接建立方式实现, 本实施 例对此均不作具体限定。 参见图 5, 本实施例提供的方法流程具体如下:  The method provided by the embodiment of the present invention completes the mapping of the identifier to the IP address by the identifier layer by establishing an identifier layer between the application layer and the transport layer, and calling the identifier layer interface by using the application layer, and calling the transport layer. The interface implements identifier-based data transmission between the two communicating parties, thereby eliminating the need to modify the original protocol layer in the terminal protocol stack, thereby solving the problem of difficulty in deployment and backward compatibility. Another embodiment of the present invention provides a data transmission method. For convenience of description, this embodiment combines the contents of the foregoing embodiment and the protocol stack diagram shown in FIG. 1 to deploy an identifier layer, terminal B, with terminal A. The identifier layer is not deployed, and the identifier-based connection is established between the terminal A and the terminal node C on which the identifier layer is deployed, and the TCP (Transmission Control Protocol) is established between the terminal C and the terminal B. The method of data transmission provided by the embodiment of the present invention is exemplified by a method of transmitting data between the terminal A and the terminal B by using the terminal C as an example of a transport layer connection such as a UDP (User Datagram Protocol). The identifier corresponding to the proxy node C is the identifier C, and the IP address is the address C. The terminal A and the terminal A establish an identifier-based connection in the same manner as the terminal A in the foregoing embodiment. A manner of establishing an identifier connection with the terminal B, and a method of establishing a transport layer connection such as a TCP or a UDP between the terminal C and the terminal B may be implemented by using an existing connection establishment manner, which is not specifically limited in this embodiment. . Referring to FIG. 5, the process of the method provided in this embodiment is specifically as follows:
501 :终端 A通过终端 A的应用层调用终端 A的标识符层接口向标识符 C 对应的终端 C发送数据; 在终端 A与终端 C建立基于标识符的连接后, 通信双方便可基于标识符进行 数据的发送与接收。 此处该终端 A可通过终端 A的应用层调用终端 A的标识 符层接口 IDSocket向标识符 C对应的终端 C发送数据。 501: The terminal A sends the data to the terminal C corresponding to the identifier C through the identifier layer interface of the terminal A through the application layer of the terminal A; after the identifier-based connection is established between the terminal A and the terminal C, the communication parties can be based on the identifier. get on The transmission and reception of data. Here, the terminal A can transmit data to the terminal C corresponding to the identifier C through the identifier layer interface IDSocket of the terminal A through the application layer of the terminal A.
502: 终端 A通过终端 A的标识符层将标识符 C映射为终端 C对应的 IP 地址 C , 并调用终端 A的传输层接口将数据发送给地址 C对应的终端 C。  502: Terminal A maps the identifier C to the IP address C corresponding to the terminal C through the identifier layer of the terminal A, and calls the transport layer interface of the terminal A to send the data to the terminal C corresponding to the address C.
具体地, 由于在终端 A与终端 C建立标识符连接的过程中, 终端 A已经 获取到终端 C对应的地址 C, 并将其存入本地映射表, 则在步骤 501中终端 A 通过终端 A的应用层调用终端 A的标识符层接口向标识符 C对应的终端 C发 送数据后, 为了实现发送数据, 在该步骤 502中, 终端 A可通过终端 A的标 识符层将标识符 C映射为终端 C对应的地址 C, 即通过终端 A的标识符层根 据本地映射表中标识符 C与地址 C之间的映射关系将标识符 C映射为终端 C 对应的地址 C。之后再通过标识符层调用函数 IDWrite, 由函数 IDWrite调用终 端 A的传输层 Socket接口中的 Write函数将数据发送给地址 C对应的终端 C。  Specifically, in the process of establishing the identifier connection between the terminal A and the terminal C, the terminal A has acquired the address C corresponding to the terminal C, and stores it in the local mapping table. In step 501, the terminal A passes the terminal A. After the application layer calls the identifier layer interface of the terminal A to transmit the data to the terminal C corresponding to the identifier C, in order to implement the transmission of data, in step 502, the terminal A can map the identifier C to the terminal through the identifier layer of the terminal A. The address C corresponding to C, that is, the identifier C of the terminal A is mapped to the address C corresponding to the terminal C according to the mapping relationship between the identifier C and the address C in the local mapping table. Then, the function IDWrite is called through the identifier layer, and the transfer function of the terminal A is called by the function IDWrite. The Write function in the Socket interface sends the data to the terminal C corresponding to the address C.
503: 终端 C通过终端 C的应用层调用终端 C的标识符层接口接收标识符 A对应的终端 A发送的数据;  503: The terminal C receives the data sent by the terminal A corresponding to the identifier A through the identifier layer interface of the terminal C through the application layer of the terminal C.
针对该步骤,在执行完步骤 502后,如果终端 A发送的数据发送至终端 C, 则终端 C可通过终端 C的应用层调用终端 C的标识符层接口 IDSocket接收标 识符 A对应的终端 A发送的数据。  For this step, after the step 502 is performed, if the data sent by the terminal A is sent to the terminal C, the terminal C can send the terminal A corresponding to the identifier A through the identifier layer interface IDSocket of the terminal C of the application layer of the terminal C. The data.
504: 终端 C通过终端 C的标识符层调用终端 C的传输层接口接收标识符 A对应的终端 A发送的数据;  504: The terminal C receives the data sent by the terminal A corresponding to the identifier A by using the identifier layer of the terminal C to invoke the transport layer interface of the terminal C.
具体地, 在步骤 503中终端 C通过终端 C的应用层调用终端 C的标识符 层接口接收标识符 A对应的终端 A发送的数据后, 为了实现接收数据, 在该 步骤 504中, 终端 C可通过标识符层调用函数 IDRead, 由函数 IDRead调用终 端 C的传输层 Socket接口中的 Read函数接收地址 A对应的终端 A发送的数 据, 至此, 实现了布局了标识符层的终端 A与布局了标识符层的终端 C之间 的数据传输。  Specifically, in step 503, after the terminal C receives the data sent by the terminal A corresponding to the identifier A through the identifier layer interface of the terminal C of the application C of the terminal C, in order to implement the received data, in step 504, the terminal C may The function IDRead is called by the identifier layer, and the Read function in the transport layer Socket interface of the terminal C is called by the function IDRead to receive the data sent by the terminal A corresponding to the address A. Thus, the terminal A and the layout identifier of the identifier layer are realized. Data transfer between terminals C of the layer.
505: 终端 C通过终端 C的应用层直接调用终端 C的传输层接口将接收到 的标识符 A对应的终端 A发送的数据转发给标识符 B,对应的终端 B,。  505: The terminal C directly calls the transport layer interface of the terminal C to forward the data sent by the terminal A corresponding to the identifier A to the identifier B, and the corresponding terminal B, through the application layer of the terminal C.
针对该步骤, 在上述步骤 504中终端 C通过终端 C的标识符层调用函数 IDRead, 由函数 IDRead调用终端 C的传输层 Socket接口中的 Read函数接收 地址 A对应的终端 A发送的数据之后, 作为代理节点, 由于终端 C与终端 B, 之间已经建立了传统的传输层连接, 该终端 C可通过终端 C的应用层直接调 用终端 C的传输层 Socket接口将接收到的标识符 A对应的终端 A发送的数据 转发给标识符 B,对应的终端 B,。 For this step, in the above step 504, the terminal C calls the function IDRead through the identifier layer of the terminal C, and the Read function in the transport layer Socket interface of the terminal C is called by the function IDRead to receive the data sent by the terminal A corresponding to the address A, as The proxy node, since the traditional transport layer connection has been established between the terminal C and the terminal B, the terminal C can be directly adjusted through the application layer of the terminal C. The data sent by the terminal A corresponding to the received identifier A is forwarded to the identifier B, the corresponding terminal B, by using the transport layer Socket interface of the terminal C.
除此之外, 终端 C还可通过终端 C 的应用层直接调用终端 C 的传输层 Socket接口接收标识符 B,对应的终端 B,发送的数据, 并通过终端 C的应用层 调用终端 C的标识符层 IDSocket接口将终端 B,发送的数据转发给标识符 A对 应的终端 A, 由此实现数据在终端 A与终端 B,之间的传输。  In addition, the terminal C can also directly call the transport layer Socket interface of the terminal C to receive the identifier B, the corresponding terminal B, the transmitted data, and call the identifier of the terminal C through the application layer of the terminal C through the application layer of the terminal C. The symbol IDSocket interface forwards the data sent by the terminal B to the terminal A corresponding to the identifier A, thereby realizing the transmission of data between the terminal A and the terminal B.
需要说明的是, 本实施例中的终端 A和终端 C在通信过程中, 其中的任 意一方也可发生更新 IP地址的情况, 则针对该种情况, 处理方式与上述实施 例中通信终端发生 IP地址更新的处理方式相同, 具体可参考上述实施例中步 骤 410中的相关描述, 本实施例在此不再赘述。  It should be noted that, in the communication process, any one of the terminal A and the terminal C may also update the IP address, and in this case, the processing mode and the communication terminal in the above embodiment generate IP. The address update is performed in the same manner. For details, refer to the related description in step 410 in the foregoing embodiment.
本发明实施例提供的方法, 通过在应用层和传输层之间建立一个标识符 层, 并利用应用层调用标识符层接口, 由标识符层完成标识符到 IP地址的映 射, 并调用传输层接口实现通信双方基于标识符的数据传输, 从而无需对终端 协议栈中的原有协议层进行修改, 解决了部署难度大及向后兼容的问题。 本发明另一实施例提供了第一种终端, 该终端用于执行上述实施例中发送 数据的终端所执行的功能, 参见图 6, 终端 60包括:  The method provided by the embodiment of the present invention completes the mapping of the identifier to the IP address by the identifier layer by establishing an identifier layer between the application layer and the transport layer, and calling the identifier layer interface by using the application layer, and calling the transport layer. The interface implements identifier-based data transmission between the two communicating parties, thereby eliminating the need to modify the original protocol layer in the terminal protocol stack, thereby solving the problem of difficulty in deployment and backward compatibility. Another embodiment of the present invention provides a first type of terminal, which is used to perform the functions performed by the terminal that sends data in the foregoing embodiment. Referring to FIG. 6, the terminal 60 includes:
调用模块 61 ,用于通过本端的应用层调用本端的标识符层接口向第二标识 符对应的第二终端发送数据;  The calling module 61 is configured to send the data to the second terminal corresponding to the second identifier by using the identifier layer interface of the local end by the application layer of the local end;
映射模块 62, 用于通过调用模块 61调用的本端的标识符层将第二标识符 映射为第二终端对应的第二 IP地址;  The mapping module 62 is configured to map the second identifier to the second IP address corresponding to the second terminal by using the identifier layer of the local end that is invoked by the calling module 61;
发送模块 63,用于通过本端的标识符层调用本端的传输层接口将数据发送 给映射模块 62映射得到的第二 IP地址对应的第二终端。  The sending module 63 is configured to send the data to the second terminal corresponding to the second IP address mapped by the mapping module 62 by using the local layer's transport layer interface.
进一步地,调用模块 61 ,还用于通过本端的应用层调用本端的标识符层接 口向第二标识符对应的第二终端发送连接请求;  Further, the calling module 61 is further configured to send a connection request to the second terminal corresponding to the second identifier by using the identifier layer interface of the local end by the application layer of the local end;
映射模块 62, 还用于通过调用模块 61调用的本端的标识符层根据第二标 识符获取第二终端对应的第二 IP地址;  The mapping module 62 is further configured to acquire, by using the identifier layer of the local end, the calling module 61, the second IP address corresponding to the second terminal according to the second identifier;
发送模块 63,还用于通过本端的标识符层调用本端的传输层接口向映射模 块 62获取到的第二 IP地址对应的第二终端发送连接请求, 以与第二终端建立 基于标识符的连接。  The sending module 63 is further configured to send a connection request to the second terminal corresponding to the second IP address acquired by the mapping module 62 by using the identifier layer of the local end to invoke the transport layer interface of the local end, to establish an identifier-based connection with the second terminal. .
参见图 7, 终端 70还包括: 存储模块 64, 用于通过本端的标识符层将第二终端的第二标识符与第二 IP地址之间的映射关系存入本地映射表; Referring to FIG. 7, the terminal 70 further includes: a storage module 64, configured to store, by using an identifier layer of the local end, a mapping relationship between the second identifier of the second terminal and the second IP address into the local mapping table;
映射模块 62,具体用于通过本端的标识符层根据本地映射表中第二标识符 与第二 IP地址之间的映射关系将第二标识符映射为第二终端对应的第二 IP地 址。  The mapping module 62 is configured to map the second identifier to the second IP address corresponding to the second terminal according to the mapping relationship between the second identifier and the second IP address in the local mapping table by the identifier layer of the local end.
进一步地, 调用模块 61 , 还用于如果本端更新第一 IP地址, 通过本端的 应用层调用本端的标识符层接口向第二终端发送映射更新 ^¾文, 映射更新 4艮文 中包括本端对应的标识符和新的 IP地址;  Further, the calling module 61 is further configured to: if the local end updates the first IP address, send the mapping update to the second terminal by using the identifier layer interface of the local end by the application layer of the local end, and the mapping update includes the local end. Corresponding identifier and new IP address;
映射模块 62,用于通过本端的标识符层将第二标识符映射为第二终端对应 的第二 IP地址;  The mapping module 62 is configured to map the second identifier to the second IP address corresponding to the second terminal by using the identifier layer of the local end;
发送模块 63 ,还用于通过本端的标识符层调用本端的传输层接口将映射更 新报文发送给第二 IP地址对应的第二终端, 以根据新的 IP地址恢复与第二终 端之间的数据传输。  The sending module 63 is further configured to send the mapping update message to the second terminal corresponding to the second IP address by using the local layer's transport layer interface to restore the relationship between the second terminal and the second terminal according to the new IP address. data transmission.
本发明实施例提供的终端, 通过在应用层和传输层之间建立一个标识符 层, 并利用应用层调用标识符层接口, 由标识符层完成标识符到 IP地址的映 射, 并调用传输层接口实现通信双方基于标识符的数据传输, 从而无需对终端 协议栈中的原有协议层进行修改, 解决了部署难度大及向后兼容的问题。 本发明另一实施例提供了第一种终端, 该终端包括:  The terminal provided by the embodiment of the present invention completes the mapping of the identifier to the IP address by the identifier layer by establishing an identifier layer between the application layer and the transport layer, and calling the identifier layer interface by using the application layer, and calling the transport layer. The interface implements identifier-based data transmission between the two communicating parties, thereby eliminating the need to modify the original protocol layer in the terminal protocol stack, thereby solving the problem of difficulty in deployment and backward compatibility. Another embodiment of the present invention provides a first terminal, where the terminal includes:
发射器, 用于通过本端的应用层调用本端的标识符层接口向第二标识符对 应的第二终端发送数据;  a transmitter, configured to send data to the second terminal corresponding to the second identifier by using an identifier layer interface of the local end by using an application layer of the local end;
处理器, 用于通过本端的标识符层将第二标识符映射为第二终端对应的第 二网际协议 IP地址;  a processor, configured to map the second identifier to a second Internet Protocol IP address corresponding to the second terminal by using an identifier layer of the local end;
发射器, 还用于调用本端的传输层接口将数据发送给第二 IP地址对应的 第二终端。  The transmitter is further configured to send the data of the local end to send the data to the second terminal corresponding to the second IP address.
进一步地, 发射器, 还用于通过本端的应用层调用本端的标识符层接口向 第二标识符对应的第二终端发送连接请求;  Further, the transmitter is further configured to send a connection request to the second terminal corresponding to the second identifier by using an identifier layer interface of the local end by using an application layer of the local end;
处理器,还用于通过本端的标识符层根据第二标识符获取第二终端对应的 第二 IP地址;  The processor is further configured to obtain, by using the identifier layer of the local end, the second IP address corresponding to the second terminal according to the second identifier;
发射器, 还用于调用本端的传输层接口向第二 IP地址对应的第二终端发 送连接请求, 以与第二终端建立基于标识符的连接。 进一步地, 处理器, 还用于通过本端的标识符层将第二终端的第二标识符 与第二 IP地址之间的映射关系存入本地映射表; 通过本端的标识符层根据本 地映射表中第二标识符与第二 IP地址之间的映射关系将第二标识符映射为第 二终端对应的第二 IP地址。 The transmitter is further configured to send a connection request to the second terminal corresponding to the second IP address by using the local transport layer interface to establish an identifier-based connection with the second terminal. Further, the processor is further configured to store the mapping relationship between the second identifier of the second terminal and the second IP address in the local mapping table by using the identifier layer of the local end; and according to the local mapping table by using the identifier layer of the local end The mapping relationship between the second identifier and the second IP address maps the second identifier to a second IP address corresponding to the second terminal.
进一步地, 处理器, 还用于通过本端的应用层调用本端的标识符层接口向 第二终端发送映射更新^¾文,映射更新4艮文中包括本端对应的标识符和新的 IP 地址; 通过本端的标识符层将第二标识符映射为第二终端对应的第二 IP地址; 发射器, 还用于调用本端的传输层接口将映射更新报文发送给第二 IP地 址对应的第二终端, 以根据新的 IP地址恢复与第二终端之间的数据传输。  Further, the processor is further configured to send, by using an identifier layer interface of the local end, the mapping update interface of the local end to the second terminal, where the mapping update includes the identifier corresponding to the local end and the new IP address; The second identifier is mapped to the second IP address corresponding to the second terminal by the identifier layer of the local end; the transmitter is further configured to send the mapping update interface of the local end to send the mapping update packet to the second corresponding to the second IP address. The terminal, to recover data transmission with the second terminal according to the new IP address.
本发明实施例提供的终端,通过在应用层和传输层之间建立一个标识符层, 并利用应用层调用标识符层接口, 由标识符层完成标识符到 IP地址的映射, 并调用传输层接口实现通信双方基于标识符的数据传输,从而无需对终端协议 栈中的原有协议层进行修改, 解决了部署难度大及向后兼容的问题。 本发明另一实施例提供了第二种终端, 该终端用于执行上述实施例中接收 数据的终端所执行的功能, 参见图 8, 终端 80包括:  The terminal provided by the embodiment of the present invention completes the mapping of the identifier to the IP address by the identifier layer by establishing an identifier layer between the application layer and the transport layer, and calling the identifier layer interface by using the application layer, and calling the transport layer. The interface implements identifier-based data transmission between the two communicating parties, thereby eliminating the need to modify the original protocol layer in the terminal protocol stack, and solving the problem of difficulty in deployment and backward compatibility. Another embodiment of the present invention provides a second terminal, which is used to perform the functions performed by the terminal that receives data in the foregoing embodiment. Referring to FIG. 8, the terminal 80 includes:
调用模块 81 ,用于通过本端的应用层调用本端的标识符层接口接收第一标 识符对应的第一终端发送的数据;  The calling module 81 is configured to receive, by using an identifier layer interface of the local end, the data sent by the first terminal corresponding to the first identifier by the application layer of the local end;
接收模块 82, 用于通过调用模块 81调用的本端的标识符层调用本端的传 输层接口接收第一标识符对应的第一终端发送的数据。  The receiving module 82 is configured to receive the data sent by the first terminal corresponding to the first identifier by using the local layer identifier layer of the local end called by the calling module 81.
进一步地,调用模块 81 ,还用于通过本端的应用层调用本端的标识符层接 口接收第一标识符对应的第一终端发送的连接请求;  Further, the calling module 81 is further configured to: receive, by the application layer of the local end, the identifier layer interface of the local end to receive the connection request sent by the first terminal corresponding to the first identifier;
接收模块 82,还用于通过本端的标识符层调用本端的传输层接口接收第一 标识符对应的第一终端发送的连接请求, 以与第一终端建立基于标识符的连 接。  The receiving module 82 is further configured to receive, by using the identifier layer of the local end, the connection layer interface of the local end to receive the connection request sent by the first terminal corresponding to the first identifier, to establish an identifier-based connection with the first terminal.
进一步地,调用模块 81 ,还用于通过本端的应用层调用本端的标识符层接 口监听第一标识符对应的第一终端发送的连接请求;  Further, the calling module 81 is further configured to, by using an application layer of the local end, invoke the identifier layer interface of the local end to listen to the connection request sent by the first terminal corresponding to the first identifier;
接收模块 82,还用于通过本端的标识符层调用本端的传输层接口监听第一 标识符对应的第一终端发送的连接请求。  The receiving module 82 is further configured to, by using the identifier layer of the local end, invoke the transport layer interface of the local end to listen to the connection request sent by the first terminal corresponding to the first identifier.
参见图 9, 终端 90还包括:  Referring to Figure 9, terminal 90 also includes:
获取模块 83,用于通过本端的标识符层根据第一标识符获取第一终端对应 的第一 IP地址; The obtaining module 83 is configured to obtain, by using the identifier layer of the local end, the first terminal corresponding to the first identifier. First IP address;
存储模块 84,用于通过本端的标识符层将第一终端的第一标识符与获取模 块 83获取到的第一 IP地址之间的映射关系存入本地映射表, 以根据本地映射 表中第一标识符与第一 IP地址之间的映射关系向第一标识符对应的第一终端 发送数据。  The storage module 84 is configured to store, by using the identifier layer of the local end, a mapping relationship between the first identifier of the first terminal and the first IP address obtained by the obtaining module 83 in the local mapping table, according to the local mapping table. The mapping relationship between the identifier and the first IP address sends data to the first terminal corresponding to the first identifier.
进一步地, 调用模块 81 , 还用于如果第一终端更新第一 IP地址, 通过本 端的应用层调用本端的标识符层接口接收第一终端发送的映射更新报文; 映射模块 82,用于通过本端的标识符层将第一标识符映射为第一终端对应 的第一 IP地址;  Further, the calling module 81 is further configured to: if the first terminal updates the first IP address, the application layer of the local end invokes the identifier layer interface of the local end to receive the mapping update message sent by the first terminal; the mapping module 82 is configured to pass The identifier layer of the local end maps the first identifier to the first IP address corresponding to the first terminal;
接收模块 83 , 还用于调用本端的传输层接口接收第一 IP地址对应的第一 终端发送的映射更新报文, 以根据新的第一 IP地址恢复与第一终端之间的数 据传输。  The receiving module 83 is further configured to: call the transport layer interface of the local end to receive the mapping update packet sent by the first terminal corresponding to the first IP address, to recover the data transmission with the first terminal according to the new first IP address.
参见图 10, 终端 100还包括:  Referring to FIG. 10, the terminal 100 further includes:
检查模块 85,用于通过本端的应用层调用本端的标识符层接口检查第一标 识符与新的第一 IP地址之间的映射关系的合法性;  The checking module 85 is configured to check the legality of the mapping relationship between the first identifier and the new first IP address by using the local layer identifier layer interface by the application layer of the local end;
存储模块 84,还用于如果检查结果为合法, 则通过本端的标识符层将第一 标识符与新的第一 IP地址之间的映射关系存入本地映射表。  The storage module 84 is further configured to store the mapping relationship between the first identifier and the new first IP address in the local mapping table by using the identifier layer of the local end, if the check result is legal.
参见图 11 , 终端 110还包括:  Referring to FIG. 11, the terminal 110 further includes:
转发模块 86,用于通过本端的应用层直接调用本端的传输层接口将接收到 的第一标识符对应的第一终端发送的数据转发给第三标识符对应的第三终端; 和 /或,通过本端的应用层直接调用本端的传输层接口接收第三标识符对应的第 三终端发送的数据, 并通过本端的应用层调用本端的标识符层接口将第三终端 发送的数据转发给第一标识符对应的第一终端。  The forwarding module 86 is configured to directly forward the data sent by the first terminal corresponding to the received first identifier to the third terminal corresponding to the third identifier by using the local layer of the local layer; and/or The data layer sent by the third terminal corresponding to the third identifier is directly received by the application layer of the local end, and the data sent by the third terminal is forwarded to the first through the identifier layer of the local end by the application layer of the local end. The first terminal corresponding to the identifier.
本发明实施例提供的终端, 通过在应用层和传输层之间建立一个标识符 层, 并利用应用层调用标识符层接口, 由标识符层完成标识符到 IP地址的映 射, 并调用传输层接口实现通信双方基于标识符的数据传输, 从而无需对终端 协议栈中的原有协议层进行修改, 解决了部署难度大及向后兼容的问题。 本发明另一实施例提供了第二种终端, 该终端包括:  The terminal provided by the embodiment of the present invention completes the mapping of the identifier to the IP address by the identifier layer by establishing an identifier layer between the application layer and the transport layer, and calling the identifier layer interface by using the application layer, and calling the transport layer. The interface implements identifier-based data transmission between the two communicating parties, thereby eliminating the need to modify the original protocol layer in the terminal protocol stack, thereby solving the problem of difficulty in deployment and backward compatibility. Another embodiment of the present invention provides a second terminal, where the terminal includes:
接收器,用于通过本端的应用层调用本端的标识符层接口接收第一标识符 对应的第一终端发送的数据; 通过本端的标识符层调用本端的传输层接口接收 第一标识符对应的第一终端发送的数据。 The receiver is configured to receive the data sent by the first terminal corresponding to the first identifier by using the identifier layer interface of the local end by the application layer of the local end; and receive the transmission layer interface of the local end by using the identifier layer of the local end The data sent by the first terminal corresponding to the first identifier.
进一步地, 接收器, 还用于通过本端的应用层调用本端的标识符层接口接 收第一标识符对应的第一终端发送的连接请求; 通过本端的标识符层调用本端 的传输层接口接收第一标识符对应的第一终端发送的连接请求, 以与第一终端 建立基于标识符的连接。  Further, the receiver is further configured to receive the connection request sent by the first terminal corresponding to the first identifier by using the identifier layer interface of the local end by the application layer of the local end, and receive the first transmission layer interface by using the identifier layer of the local end. A connection request sent by the first terminal corresponding to the identifier to establish an identifier-based connection with the first terminal.
处理器, 用于通过本端的应用层调用本端的标识符层接口监听第一标识符 对应的第一终端发送的连接请求; 通过本端的标识符层调用本端的传输层接口 监听第一标识符对应的第一终端发送的连接请求。  The processor is configured to: listen to the connection request sent by the first terminal corresponding to the first identifier by using the identifier layer interface of the local end by the application layer of the local end; and invoke the transport layer interface of the local end to listen to the first identifier by using the identifier layer of the local end The connection request sent by the first terminal.
进一步地, 处理器, 还用于通过本端的标识符层根据第一标识符获取第一 终端对应的第一 IP地址, 并通过本端的标识符层将第一终端的第一标识符与 第一 IP地址之间的映射关系存入本地映射表, 以根据本地映射表中第一标识 符与第一 IP地址之间的映射关系向第一标识符对应的第一终端发送数据。  Further, the processor is further configured to acquire, by using the identifier layer of the local end, the first IP address corresponding to the first terminal according to the first identifier, and the first identifier of the first terminal and the first identifier by using the identifier layer of the local end The mapping relationship between the IP addresses is stored in the local mapping table to send data to the first terminal corresponding to the first identifier according to the mapping relationship between the first identifier and the first IP address in the local mapping table.
进一步地, 处理器, 还用于通过本端的应用层调用本端的标识符层接口接 收第一终端发送的映射更新报文, 映射更新报文中包括第一终端对应的第一标 识符和新的第一 IP地址;  Further, the processor is further configured to receive, by using an identifier layer interface of the local end, the mapping update interface sent by the first terminal, where the mapping update packet includes the first identifier corresponding to the first terminal, and the new identifier. First IP address;
接收器,还用于通过本端的标识符层调用本端的传输层接口接收第一终端 发送的映射更新报文, 以根据新的第一 IP地址恢复与第一终端之间的数据传 输。  The receiver is further configured to receive the mapping update packet sent by the first terminal by using the local layer's transport layer interface to restore the data transmission with the first terminal according to the new first IP address.
进一步地, 处理器, 还用于通过本端的应用层调用本端的标识符层接口检 查第一标识符与新的第一 IP地址之间的映射关系的合法性; 如果检查结果为 合法, 则通过本端的标识符层将第一标识符与新的第一 IP地址之间的映射关 系存入本地映射表。  Further, the processor is further configured to: by using an identifier layer interface of the local end of the local end, check the legality of the mapping relationship between the first identifier and the new first IP address; if the check result is legal, pass the The identifier layer of the local end stores the mapping relationship between the first identifier and the new first IP address in the local mapping table.
进一步地, 接收器, 还用于通过本端的应用层直接调用本端的传输层接口 将接收到的第一标识符对应的第一终端发送的数据转发给第三标识符对应的 第三终端;  Further, the receiver is further configured to directly forward the data sent by the first terminal corresponding to the received first identifier to the third terminal corresponding to the third identifier by using the local layer of the local layer;
发射器, 用于通过本端的应用层直接调用本端的传输层接口接收第三标识 符对应的第三终端发送的数据, 并通过本端的应用层调用本端的标识符层接口 将第三终端发送的数据转发给第一标识符对应的第一终端。  The transmitter is configured to directly receive the data sent by the third terminal corresponding to the third identifier by using the local layer of the local layer, and send the third terminal by using the identifier layer of the local end by the application layer of the local end. The data is forwarded to the first terminal corresponding to the first identifier.
本发明实施例提供的终端,通过在应用层和传输层之间建立一个标识符层, 并利用应用层调用标识符层接口, 由标识符层完成标识符到 IP地址的映射, 并调用传输层接口实现通信双方基于标识符的数据传输,从而无需对终端协议 栈中的原有协议层进行修改, 解决了部署难度大及向后兼容的问题。 本发明另一实施例提供了一种数据传输的系统, 该系统用于执行上述实施 例提供的数据传输的方法。 参见图 12, 该系统包括: The terminal provided by the embodiment of the present invention completes the mapping of the identifier to the IP address by the identifier layer by establishing an identifier layer between the application layer and the transport layer, and calling the identifier layer interface by using the application layer, and calling the transport layer. The interface implements identifier-based data transmission between the two parties, thus eliminating the need for a terminal protocol The original protocol layer in the stack is modified to solve the problem of difficult deployment and backward compatibility. Another embodiment of the present invention provides a system for data transmission, which is used to perform the data transmission method provided by the foregoing embodiments. Referring to Figure 12, the system includes:
第一终端 1201和第二终端 1202;  The first terminal 1201 and the second terminal 1202;
其中, 第一终端 1201如上述实施例提供的第一种终端;  The first terminal 1201 is the first terminal provided by the foregoing embodiment;
第二终端 1202如上述实施例提供的第二种终端。  The second terminal 1202 is the second terminal provided by the foregoing embodiment.
本发明实施例提供的系统, 通过在应用层和传输层之间建立一个标识符 层, 并利用应用层调用标识符层接口, 由标识符层完成标识符到 IP地址的映 射, 并调用传输层接口实现通信双方基于标识符的数据传输, 从而无需对终端 协议栈中的原有协议层进行修改, 解决了部署难度大及向后兼容的问题。 需要说明的是: 上述实施例提供的终端在发送数据和接收数据时, 仅以上 述各功能模块的划分进行举例说明, 实际应用中, 可以根据需要而将上述功能 分配由不同的功能模块完成, 即将终端的内部结构划分成不同的功能模块, 以 完成以上描述的全部或者部分功能。 另外, 上述实施例提供的终端、 数据传输 的系统与数据传输的方法实施例属于同一构思, 其具体实现过程详见方法实施 例, 这里不再赘述。  The system provided by the embodiment of the present invention completes the mapping of the identifier to the IP address by the identifier layer by establishing an identifier layer between the application layer and the transport layer, and calling the identifier layer interface by using the application layer, and calling the transport layer. The interface implements identifier-based data transmission between the two communicating parties, thereby eliminating the need to modify the original protocol layer in the terminal protocol stack, thereby solving the problem of difficulty in deployment and backward compatibility. It should be noted that, when the terminal provided by the foregoing embodiment sends data and receives data, only the division of each functional module is illustrated. In actual applications, the function distribution may be completed by different functional modules as needed. The internal structure of the terminal is divided into different functional modules to complete all or part of the functions described above. In addition, the terminal, the data transmission system and the data transmission method embodiment provided by the foregoing embodiments are in the same concept, and the specific implementation process is described in the method embodiment, and details are not described herein again.
上述本发明实施例序号仅仅为了描述, 不代表实施例的优劣。  The serial numbers of the embodiments of the present invention are merely for the description, and do not represent the advantages and disadvantages of the embodiments.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通 过硬件来完成, 也可以通过程序来指令相关的硬件完成, 所述的程序可以存储 于一种计算机可读存储介质中, 上述提到的存储介质可以是只读存储器, 磁盘 或光盘等。  A person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium. The storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.
以上所述仅为本发明的较佳实施例, 并不用以限制本发明, 凡在本发明的 精神和原则之内, 所作的任何修改、 等同替换、 改进等, 均应包含在本发明的 保护范围之内。  The above is only the preferred embodiment of the present invention, and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., which are within the spirit and scope of the present invention, should be included in the protection of the present invention. Within the scope.

Claims

权 利 要 求 书 claims
1、 一种数据传输的方法, 其特征在于, 所述方法包括: 1. A method of data transmission, characterized in that the method includes:
第一终端通过本端的应用层调用本端的标识符层接口向第二标识符对应的 第二终端发送数据; The first terminal calls the local identifier layer interface through the local application layer to send data to the second terminal corresponding to the second identifier;
通过所述本端的标识符层将所述第二标识符映射为所述第二终端对应的第 二网际协议 IP地址,并调用本端的传输层接口将所述数据发送给所述第二 IP地 址对应的第二终端。 The second identifier is mapped to the second Internet Protocol IP address corresponding to the second terminal through the identifier layer of the local end, and the transport layer interface of the local end is called to send the data to the second IP address. The corresponding second terminal.
2、 根据权利要求 1所述的方法, 其特征在于, 所述通过本端的应用层调用 本端的标识符层接口向第二标识符对应的第二终端发送数据之前, 还包括: 通过本端的应用层调用本端的标识符层接口向所述第二标识符对应的第二 终端发送连接请求; 2. The method according to claim 1, characterized in that, before calling the local identifier layer interface through the local application layer to send data to the second terminal corresponding to the second identifier, the method further includes: using the local application. The layer calls the identifier layer interface of the local terminal to send a connection request to the second terminal corresponding to the second identifier;
通过本端的标识符层根据所述第二标识符获取所述第二终端对应的第二 IP 地址, 并调用本端的传输层接口向所述第二 IP地址对应的第二终端发送连接请 求, 以与所述第二终端建立基于标识符的连接。 Obtain the second IP address corresponding to the second terminal through the identifier layer of the local terminal according to the second identifier, and call the transport layer interface of the local terminal to send a connection request to the second terminal corresponding to the second IP address, so as to An identifier-based connection is established with the second terminal.
3、 根据权利要求 2所述的方法, 其特征在于, 所述通过本端的标识符层根 据所述第二标识符获取所述第二终端对应的第二 IP地址之后, 还包括: 3. The method according to claim 2, characterized in that, after obtaining the second IP address corresponding to the second terminal according to the second identifier through the identifier layer of the local terminal, it further includes:
通过本端的标识符层将所述第二终端的第二标识符与第二 IP地址之间的映 射关系存入本地映射表; Store the mapping relationship between the second identifier of the second terminal and the second IP address in the local mapping table through the local identifier layer;
所述通过本端的标识符层将所述第二标识符映射为所述第二终端对应的第 二网际协议 IP地址, 具体包括: Mapping the second identifier to the second Internet Protocol IP address corresponding to the second terminal through the local identifier layer specifically includes:
通过本端的标识符层根据所述本地映射表中所述第二标识符与所述第二 IP 地址之间的映射关系将所述第二标识符映射为所述第二终端对应的第二 IP地 址。 The local identifier layer maps the second identifier to the second IP corresponding to the second terminal according to the mapping relationship between the second identifier and the second IP address in the local mapping table. address.
4、 根据权利要求 1所述的方法, 其特征在于, 如果本端更新 IP地址, 所述 方法还包括: 4. The method according to claim 1, characterized in that if the local terminal updates the IP address, the method further includes:
通过本端的应用层调用本端的标识符层接口向所述第二终端发送映射更新 才艮文, 所述映射更新 ^艮文中包括本端对应的标识符和新的 IP地址; The application layer of the local terminal calls the identifier layer interface of the local terminal to send a mapping update message to the second terminal, where the mapping update message includes the identifier corresponding to the local terminal and the new IP address;
通过本端的标识符层将所述第二标识符映射为所述第二终端对应的第二 IP 地址, 并调用本端的传输层接口将所述映射更新报文发送给所述第二 IP地址对 应的第二终端, 以根据所述新的 IP地址恢复与所述第二终端之间的数据传输。 The second identifier is mapped to the second IP corresponding to the second terminal through the local identifier layer. address, and calls the local transport layer interface to send the mapping update message to the second terminal corresponding to the second IP address, so as to resume data transmission with the second terminal based on the new IP address. .
5、 一种终端, 其特征在于, 所述终端包括: 5. A terminal, characterized in that, the terminal includes:
调用模块, 用于通过本端的应用层调用本端的标识符层接口向第二标识符 对应的第二终端发送数据; The calling module is used to call the local identifier layer interface through the local application layer to send data to the second terminal corresponding to the second identifier;
映射模块, 用于通过所述调用模块调用的本端的标识符层将所述第二标识 符映射为所述第二终端对应的第二网际协议 IP地址; A mapping module, configured to map the second identifier to the second Internet Protocol IP address corresponding to the second terminal through the identifier layer of the local terminal called by the calling module;
发送模块, 用于通过本端的标识符层调用本端的传输层接口将所述数据发 送给所述映射模块映射得到的第二 IP地址对应的第二终端。 The sending module is configured to call the local transport layer interface through the local identifier layer to send the data to the second terminal corresponding to the second IP address mapped by the mapping module.
6、 根据权利要求 5所述的终端, 其特征在于, 所述调用模块, 还用于通过 本端的应用层调用本端的标识符层接口向所述第二标识符对应的第二终端发送 连接请求; 6. The terminal according to claim 5, wherein the calling module is further configured to call the local identifier layer interface through the local application layer to send a connection request to the second terminal corresponding to the second identifier. ;
所述映射模块, 还用于通过所述调用模块调用的本端的标识符层根据所述 第二标识符获取所述第二终端对应的第二 IP地址; The mapping module is also configured to obtain the second IP address corresponding to the second terminal according to the second identifier through the identifier layer of the local terminal called by the calling module;
所述发送模块, 还用于通过本端的标识符层调用本端的传输层接口向所述 映射模块获取到的第二 IP地址对应的第二终端发送连接请求, 以与所述第二终 端建立基于标识符的连接。 The sending module is also configured to call the local transport layer interface through the local identifier layer to send a connection request to the second terminal corresponding to the second IP address obtained by the mapping module, so as to establish a connection with the second terminal based on Identifier connection.
7、 根据权利要求 6所述的终端, 其特征在于, 所述终端, 还包括: 存储模块, 用于通过本端的标识符层将所述第二终端的第二标识符与第二 IP地址之间的映射关系存入本地映射表; 7. The terminal according to claim 6, characterized in that, the terminal further includes: a storage module, configured to combine the second identifier of the second terminal and the second IP address through the identifier layer of the local terminal. The mapping relationship between them is stored in the local mapping table;
所述映射模块, 具体用于通过本端的标识符层根据所述本地映射表中所述 第二标识符与所述第二 IP地址之间的映射关系将所述第二标识符映射为所述第 二终端对应的第二 IP地址。 The mapping module is specifically configured to map the second identifier to the second IP address according to the mapping relationship between the second identifier and the second IP address in the local mapping table through the local identifier layer. The second IP address corresponding to the second terminal.
8、 根据权利要求 5所述的终端, 其特征在于, 所述调用模块, 还用于如果 本端更新所述第一 IP地址, 通过本端的应用层调用本端的标识符层接口向所述 第二终端发送映射更新4艮文, 所述映射更新 文中包括本端对应的标识符和新 的 IP地址; 所述映射模块, 用于通过本端的标识符层将所述第二标识符映射为所述第 二终端对应的第二 IP地址; 8. The terminal according to claim 5, wherein the calling module is further configured to, if the local terminal updates the first IP address, call the local terminal’s identifier layer interface through the local terminal’s application layer to the first IP address. The second terminal sends a mapping update message, where the mapping update message includes the identifier corresponding to the local terminal and the new IP address; The mapping module is configured to map the second identifier to the second IP address corresponding to the second terminal through the local identifier layer;
所述发送模块, 还用于通过本端的标识符层调用本端的传输层接口将所述 映射更新报文发送给所述第二 IP地址对应的第二终端,以根据所述新的 IP地址 恢复与所述第二终端之间的数据传输。 The sending module is also configured to call the local transport layer interface through the local identifier layer to send the mapping update message to the second terminal corresponding to the second IP address, so as to recover according to the new IP address. Data transmission with the second terminal.
9、 一种数据传输的方法, 其特征在于, 所述方法包括: 9. A method of data transmission, characterized in that the method includes:
第二终端通过本端的应用层调用本端的标识符层接口接收第一标识符对应 的第一终端发送的数据; The second terminal calls the local identifier layer interface through the local application layer to receive the data sent by the first terminal corresponding to the first identifier;
通过本端的标识符层调用本端的传输层接口接收所述第一标识符对应的第 一终端发送的数据。 The local end's transport layer interface is called through the local end's identifier layer to receive the data sent by the first terminal corresponding to the first identifier.
10、 根据权利要求 9所述的方法, 其特征在于, 所述通过本端的应用层调 用本端的标识符层接口接收所述第一标识符对应的第一终端发送的数据之前, 还包括: 10. The method according to claim 9, characterized in that, before calling the local identifier layer interface through the local application layer to receive the data sent by the first terminal corresponding to the first identifier, the method further includes:
通过本端的应用层调用本端的标识符层接口接收所述第一标识符对应的第 一终端发送的连接请求; Call the local identifier layer interface through the local application layer to receive the connection request sent by the first terminal corresponding to the first identifier;
通过本端的标识符层调用本端的传输层接口接收所述第一标识符对应的第 一终端发送的连接请求, 以与所述第一终端建立基于标识符的连接。 The local transport layer interface is called through the local identifier layer to receive the connection request sent by the first terminal corresponding to the first identifier, so as to establish an identifier-based connection with the first terminal.
11、 根据权利要求 10所述的方法, 其特征在于, 所述通过本端的应用层调 用本端的标识符层接口接收所述第一标识符对应的第一终端发送的连接请求之 前, 还包括: 11. The method according to claim 10, characterized in that, before calling the local identifier layer interface through the local application layer to receive the connection request sent by the first terminal corresponding to the first identifier, the method further includes:
通过本端的应用层调用本端的标识符层接口监听所述第一标识符对应的第 一终端发送的所述连接请求; Call the local identifier layer interface through the local application layer to monitor the connection request sent by the first terminal corresponding to the first identifier;
通过本端的标识符层调用本端的传输层接口监听所述第一标识符对应的第 一终端发送的连接请求。 The local transport layer interface is called through the local identifier layer to monitor the connection request sent by the first terminal corresponding to the first identifier.
12、 根据权利要求 11所述的方法, 其特征在于, 所述通过本端的标识符层 调用本端的传输层接口监听所述第一标识符对应的第一终端发送的连接请求之 后, 还包括: 通过本端的标识符层根据所述第一标识符获取所述第一终端对应的第一 IP 地址, 并通过本端的标识符层将所述第一终端的第一标识符与第一 IP地址之间 的映射关系存入本地映射表, 以根据所述本地映射表中所述第一标识符与所述 第一 IP地址之间的映射关系向所述第一标识符对应的第一终端发送数据。 12. The method according to claim 11, characterized in that, after calling the local transport layer interface through the local identifier layer to monitor the connection request sent by the first terminal corresponding to the first identifier, the method further includes: Obtain the first IP address corresponding to the first terminal according to the first identifier through the local identifier layer, and combine the first identifier of the first terminal with the first IP address through the local identifier layer. The mapping relationship between the first identifier and the first IP address is stored in a local mapping table to send data to the first terminal corresponding to the first identifier according to the mapping relationship between the first identifier and the first IP address in the local mapping table. .
13、 根据权利要求 12所述的方法, 其特征在于, 如果所述第一终端更新所 述第一 IP地址, 所述方法还包括: 13. The method according to claim 12, wherein if the first terminal updates the first IP address, the method further includes:
通过本端的应用层调用本端的标识符层接口接收所述第一终端发送的映射 更新报文, 所述映射更新报文中包括所述第一终端对应的第一标识符和新的第 一 IP地址; The local application layer calls the local identifier layer interface to receive the mapping update message sent by the first terminal. The mapping update message includes the first identifier corresponding to the first terminal and the new first IP. address;
通过本端的标识符层调用本端的传输层接口接收所述第一终端发送的所述 映射更新报文, 以根据所述新的第一 IP地址恢复与所述第一终端之间的数据传 输。 The local end's identifier layer calls the local end's transport layer interface to receive the mapping update message sent by the first terminal, so as to resume data transmission with the first terminal based on the new first IP address.
14、 根据权利要求 13所述的方法, 其特征在于, 所述调用本端的传输层接 口接收所述第一 IP地址对应的第一终端发送的所述映射更新报文之后,还包括: 通过本端的应用层调用本端的标识符层接口检查所述第一标识符与所述新 的第一 IP地址之间的映射关系的合法性; 14. The method according to claim 13, characterized in that, after the calling local transport layer interface receives the mapping update message sent by the first terminal corresponding to the first IP address, the method further includes: The application layer of the end calls the identifier layer interface of the end to check the legality of the mapping relationship between the first identifier and the new first IP address;
如果检查结果为合法, 则通过本端的标识符层将所述第一标识符与所述新 的第一 IP地址之间的映射关系存入本地映射表。 If the check result is legal, the mapping relationship between the first identifier and the new first IP address is stored in the local mapping table through the local identifier layer.
15、 根据权利要求 9所述的方法, 其特征在于, 所述调用本端的传输层接 口接收所述第一 IP地址对应的第一终端发送的数据之后, 还包括: 15. The method according to claim 9, characterized in that, after calling the transport layer interface of the local terminal to receive the data sent by the first terminal corresponding to the first IP address, it further includes:
通过本端的应用层直接调用本端的传输层接口将接收到的所述第一标识符 对应的第一终端发送的数据转发给第三标识符对应的第三终端; The local application layer directly calls the local transport layer interface to forward the data sent by the first terminal corresponding to the received first identifier to the third terminal corresponding to the third identifier;
和 /或, 通过本端的应用层直接调用本端的传输层接口接收所述第三标识符 对应的第三终端发送的数据, 并通过本端的应用层调用本端的标识符层接口将 所述第三终端发送的数据转发给所述第一标识符对应的第一终端。 And/or, directly call the local transport layer interface through the local application layer to receive the data sent by the third terminal corresponding to the third identifier, and call the local identifier layer interface through the local application layer to transfer the third identifier. The data sent by the terminal is forwarded to the first terminal corresponding to the first identifier.
16、 一种终端, 其特征在于, 所述终端包括: 16. A terminal, characterized in that, the terminal includes:
调用模块, 用于通过本端的应用层调用本端的标识符层接口接收第一标识 符对应的第一终端发送的数据; The calling module is used to call the local identifier layer interface through the local application layer to receive the first identifier. The data sent by the first terminal corresponding to the symbol;
接收模块, 用于通过所述调用模块调用的本端的标识符层调用本端的传输 层接口接收所述第一标识符对应的第一终端发送的数据。 The receiving module is configured to call the transport layer interface of the local terminal through the identifier layer of the local terminal called by the calling module to receive the data sent by the first terminal corresponding to the first identifier.
17、 根据权利要求 16所述的终端, 其特征在于, 所述调用模块, 还用于通 过本端的应用层调用本端的标识符层接口接收所述第一标识符对应的第一终端 发送的连接请求; 17. The terminal according to claim 16, wherein the calling module is further configured to call the local identifier layer interface through the local application layer to receive the connection sent by the first terminal corresponding to the first identifier. ask;
所述接收模块, 还用于通过本端的标识符层调用本端的传输层接口接收所 述第一标识符对应的第一终端发送的连接请求, 以与所述第一终端建立基于标 识符的连接。 The receiving module is also configured to call the local transport layer interface through the local identifier layer to receive the connection request sent by the first terminal corresponding to the first identifier, so as to establish an identifier-based connection with the first terminal. .
18、 根据权利要求 17所述的终端, 其特征在于, 所述调用模块, 还用于通 过本端的应用层调用本端的标识符层接口监听所述第一标识符对应的第一终端 发送的所述连接请求; 18. The terminal according to claim 17, characterized in that the calling module is further configured to call the local identifier layer interface through the local application layer to monitor all the messages sent by the first terminal corresponding to the first identifier. Described connection request;
所述接收模块, 还用于通过本端的标识符层调用本端的传输层接口监听所 述第一标识符对应的第一终端发送的连接请求。 The receiving module is also configured to call the local transport layer interface through the local identifier layer to monitor the connection request sent by the first terminal corresponding to the first identifier.
19、 根据权利要求 18所述的终端, 其特征在于, 所述终端, 还包括: 获取模块, 用于通过本端的标识符层根据所述第一标识符获取所述第一终 端对应的第一 IP地址; 19. The terminal according to claim 18, characterized in that, the terminal further includes: an acquisition module, configured to obtain the first identifier corresponding to the first terminal through the identifier layer of the local terminal according to the first identifier. IP address;
存储模块, 用于通过本端的标识符层将所述第一终端的第一标识符与所述 获取模块获取到的第一 IP地址之间的映射关系存入本地映射表, 以根据所述本 地映射表中所述第一标识符与所述第一 IP地址之间的映射关系向所述第一标识 符对应的第一终端发送数据。 The storage module is configured to store the mapping relationship between the first identifier of the first terminal and the first IP address obtained by the acquisition module into a local mapping table through the identifier layer of the local terminal, so as to store the mapping relationship between the first identifier of the first terminal and the first IP address obtained by the acquisition module. The mapping relationship between the first identifier and the first IP address in the mapping table sends data to the first terminal corresponding to the first identifier.
20、 根据权利要求 19所述的终端, 其特征在于, 所述调用模块, 还用于如 果所述第一终端更新所述第一 IP地址, 通过本端的应用层调用本端的标识符层 接口接收所述第一终端发送的映射更新报文; 20. The terminal according to claim 19, wherein the calling module is further configured to, if the first terminal updates the first IP address, call the identifier layer interface of the local terminal to receive the information through the local application layer. The mapping update message sent by the first terminal;
所述接收模块, 还用于调用本端的传输层接口接收所述第一终端发送的所 述映射更新报文, 以根据所述新的第一 IP地址恢复与所述第一终端之间的数据 传输。 The receiving module is also configured to call the local transport layer interface to receive the mapping update message sent by the first terminal, so as to restore data with the first terminal according to the new first IP address. transmission.
21、 根据权利要求 20所述的终端, 其特征在于, 所述终端, 还包括: 检查模块, 用于通过本端的应用层调用本端的标识符层接口检查所述第一 标识符与所述新的第一 IP地址之间的映射关系的合法性; 21. The terminal according to claim 20, characterized in that, the terminal further includes: a checking module, configured to call the identifier layer interface of the local terminal through the local application layer to check the first identifier and the new identifier. The legality of the mapping relationship between the first IP addresses;
所述存储模块, 还用于如果检查结果为合法, 则通过本端的标识符层将所 述第一标识符与所述新的第一 IP地址之间的映射关系存入本地映射表。 The storage module is also configured to store the mapping relationship between the first identifier and the new first IP address in the local mapping table through the local identifier layer if the check result is legal.
22、 根据权利要求 16所述的终端, 其特征在于, 所述终端, 还包括: 转发模块, 用于通过本端的应用层直接调用本端的传输层接口将接收到的 所述第一标识符对应的第一终端发送的数据转发给第三标识符对应的第三终 端; 和 /或, 通过本端的应用层直接调用本端的传输层接口接收所述第三标识符 对应的第三终端发送的数据, 并通过本端的应用层调用本端的标识符层接口将 所述第三终端发送的数据转发给所述第一标识符对应的第一终端。 22. The terminal according to claim 16, characterized in that, the terminal further includes: a forwarding module, configured to directly call the transport layer interface of the local terminal through the local application layer to correspond to the received first identifier. The data sent by the first terminal is forwarded to the third terminal corresponding to the third identifier; and/or, the local application layer directly calls the local transport layer interface to receive the data sent by the third terminal corresponding to the third identifier. , and forwards the data sent by the third terminal to the first terminal corresponding to the first identifier by calling the identifier layer interface of the local terminal through the local application layer.
23、 一种数据传输的系统, 其特征在于, 所述系统包括: 第一终端和第二 终端; 23. A data transmission system, characterized in that the system includes: a first terminal and a second terminal;
其中, 所述第一终端如所述权利要求 5至权利要求 8中任一权利要求所述 的终端; 所述第二终端如所述权利要求 16至权利要求 22中任一权利要求所述的终 端。 Wherein, the first terminal is as described in any one of claims 5 to 8; and the second terminal is as described in any one of claims 16 to 22. terminal.
PCT/CN2013/076137 2012-08-17 2013-05-23 Data transmission method, terminal and system WO2014026493A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201210295742.2A CN103595823B (en) 2012-08-17 2012-08-17 Method, terminal and the system of data transfer
CN201210295742.2 2012-08-17

Publications (1)

Publication Number Publication Date
WO2014026493A1 true WO2014026493A1 (en) 2014-02-20

Family

ID=50085801

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/076137 WO2014026493A1 (en) 2012-08-17 2013-05-23 Data transmission method, terminal and system

Country Status (2)

Country Link
CN (1) CN103595823B (en)
WO (1) WO2014026493A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1522015A (en) * 2003-01-28 2004-08-18 华为技术有限公司 Method for realizing message transmission and transaction reliability processing of media gateway control protocol
KR20040103352A (en) * 2003-05-30 2004-12-08 엘지전자 주식회사 Home network system
CN1741523A (en) * 2004-08-25 2006-03-01 华为技术有限公司 Key exchange protocol method for realizing main machine transferability and multi-home function
CN101945026A (en) * 2010-06-30 2011-01-12 艾默生网络能源有限公司 Data transmission method of application layer in control area network and control area network system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1522015A (en) * 2003-01-28 2004-08-18 华为技术有限公司 Method for realizing message transmission and transaction reliability processing of media gateway control protocol
KR20040103352A (en) * 2003-05-30 2004-12-08 엘지전자 주식회사 Home network system
CN1741523A (en) * 2004-08-25 2006-03-01 华为技术有限公司 Key exchange protocol method for realizing main machine transferability and multi-home function
CN101945026A (en) * 2010-06-30 2011-01-12 艾默生网络能源有限公司 Data transmission method of application layer in control area network and control area network system

Also Published As

Publication number Publication date
CN103595823B (en) 2018-05-11
CN103595823A (en) 2014-02-19

Similar Documents

Publication Publication Date Title
KR101877188B1 (en) Service layer interworking using mqtt protocol
CN104270379B (en) HTTPS agency retransmission methods and device based on transmission control protocol
US8549286B2 (en) Method and system for forwarding data between private networks
EP2579544B1 (en) Methods and apparatus for a scalable network with efficient link utilization
WO2021135471A1 (en) Data transmission method and apparatus, network card and storage medium
US20120331160A1 (en) Multi-path transmission control protocol proxy service
US20180295190A1 (en) Communication sessions at a coap protocol layer
KR101995145B1 (en) Method operating in a fixed access network and ues
WO2013097401A1 (en) Method, gateway and communication system for browser client directly communicating with back-end server
US10367893B1 (en) Method and apparatus of performing peer-to-peer communication establishment
CN101964799A (en) Solution method of address conflict in point-to-network tunnel mode
CN106604119B (en) Network penetration method and system for private cloud equipment of smart television
CN105376299A (en) A network communication method, an apparatus and a network attached storage apparatus
JP2024504006A (en) Data transmission methods, devices, equipment and computer programs for service integration
US20210273915A1 (en) Multi-access interface for internet protocol security
WO2014161460A1 (en) Session method, network node, server, system and computer storage medium
WO2011015020A1 (en) File transmission method, system and client
CN111711705B (en) Method and device for realizing network connection based on bidirectional NAT (network Address translation) by proxy node
WO2007019809A1 (en) A method and ststem for establishing a direct p2p channel
CN103379182A (en) Data transmission method and client sides
CN108093041A (en) Single channel VDI proxy servers and implementation method
WO2016161774A1 (en) Method and apparatus for terminal application accessing nas
CN113542395B (en) Message processing method and message processing system
WO2014026493A1 (en) Data transmission method, terminal and system
WO2013034037A1 (en) Communication method, system and apparatus applied to fibre channel over ethernet scenario

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13829118

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 13829118

Country of ref document: EP

Kind code of ref document: A1