WO2017202034A1 - 数据包的发送、接收方法及装置、电子设备 - Google Patents

数据包的发送、接收方法及装置、电子设备 Download PDF

Info

Publication number
WO2017202034A1
WO2017202034A1 PCT/CN2017/070184 CN2017070184W WO2017202034A1 WO 2017202034 A1 WO2017202034 A1 WO 2017202034A1 CN 2017070184 W CN2017070184 W CN 2017070184W WO 2017202034 A1 WO2017202034 A1 WO 2017202034A1
Authority
WO
WIPO (PCT)
Prior art keywords
data packet
ethernet
raw
packet
address
Prior art date
Application number
PCT/CN2017/070184
Other languages
English (en)
French (fr)
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 WO2017202034A1 publication Critical patent/WO2017202034A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/45Network directories; Name-to-address mapping
    • H04L61/4505Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols
    • H04L61/4511Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols using domain name system [DNS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • H04L61/5014Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]

Definitions

  • the present application relates to the field of communications, for example, to a method and device for transmitting and receiving data packets, and an electronic device.
  • the Mac machine is a kind of device that uses the mac operating system (also called OS X system), which is exclusive to Apple.
  • OS X system also called OS X system
  • the data is all Ethernet packets, and now that the original Raw Ip concept is introduced, more and more machines and devices already support Raw Ip frames.
  • windows supports Raw Ip protocol from win7, but existing Mac machines do not support Raw Ip, so there will be such a problem.
  • Devices and windows support Raw Ip.
  • Devices can be networked normally on Windows, but not on Mac. use.
  • the wireless data card can virtualize various wireless network cards and connect through a virtual wireless network card.
  • Wireless data cards on Mac computers can be networked in three ways. Modem (Modem) mode, Network Driver Interface Specification (Ndis) and Ethernet Control Model (ECM).
  • Modem Modem
  • Ndis Network Driver Interface Specification
  • ECM Ethernet Control Model
  • the Modem mode is relatively common and the lowest rate; the Ndis mode is the Ethernet frame format and does not support the Raw Ip frame format; the ECM uses the system driver.
  • the related art has the following problem: if the device supports the format of the Raw Ip frame, it can only be used under Windows.
  • the embodiment of the invention provides a method and a device for transmitting and receiving a data packet, and an electronic device, so as to at least solve the problem that the data of the Raw Ip frame format in the related art cannot be used on the Mac system.
  • a method for transmitting a data packet includes: acquiring an Ethernet data packet to be sent by a Mac device; encapsulating the Ethernet data packet into an original Raw IP data packet; and transmitting the encapsulated The Raw IP packet.
  • the encapsulating the Ethernet data packet into a Raw IP data packet includes: removing an Ethernet packet header of the Ethernet data packet to obtain a first data packet; adding a header byte and a padding to the first data packet Bytes, constituting a second data packet; combining one or more of the second data packets to obtain the Raw IP data packet.
  • adding a header byte and a padding byte on the first data packet includes: adding a header byte in a header of the first data packet, and adding a padding byte at a packet end of the first data packet .
  • the total length of the second data packet is an integer multiple of 4 bytes.
  • the Ethernet packet header includes: a destination address destination address, a source address source address, and a protocol format type.
  • the method further includes: determining a format of the Ethernet data packet; where the format of the Ethernet data packet is IPV4 protocol or IPV6 When the protocol is determined, it is determined that the Ethernet data packet is encapsulated into a Raw IP data packet.
  • the format of the Ethernet data packet is the address resolution protocol ARP, determining whether the IP address requested by the Ethernet data packet is an IP address of the Mac device; When the IP address requested by the data packet is not the IP address of the Mac device, the IP address requested by the Ethernet data packet is sent, and/or, when the determination result is yes, the Ethernet data packet is discarded. The requested IP address.
  • the method before the encapsulating the Ethernet data packet into the original Raw IP data packet, the method further includes: determining whether the Ethernet end of the Ethernet data packet supports the Ethernet data packet; When the receiving end of the Ethernet data packet does not support the Ethernet data packet, it is determined to encapsulate the Ethernet data packet into an original Raw IP data packet.
  • a method for receiving a data packet which is applied to a Mac operating system, includes: receiving an original Raw IP data packet; decapsulating the Raw IP data packet into an Ethernet data packet; The encapsulated Ethernet packet is sent to the Mac device.
  • decapsulating the Raw IP data packet into an Ethernet data packet includes: splitting the Raw IP data packet into one or more second data packets; and removing the header for each of the second data packets Byte and fill Filling the byte to obtain the first data packet; adding an Ethernet header to the first data packet to obtain an Ethernet data packet.
  • the method before the decapsulating the Raw IP data packet into an Ethernet data packet, the method further includes: determining whether the Mac device supports the Raw IP data packet; and determining that the Mac device is not When the Raw IP data packet is supported, it is determined that the Raw IP data packet is decapsulated into an Ethernet data packet.
  • a data packet sending apparatus which is applied to a Mac operating system, and includes: an obtaining module configured to acquire an Ethernet data packet to be sent by a Mac device; and a packaging module configured to be configured To encapsulate the Ethernet data packet into an original Raw IP data packet; the sending module is configured to send the encapsulated Raw IP data packet.
  • a data packet receiving apparatus which is applied to a Mac operating system, and includes: a receiving module configured to receive an original Raw IP data packet; and a decapsulation module configured to The Raw IP data packet is decapsulated into an Ethernet data packet; the sending module is configured to send the encapsulated Ethernet data packet to the Mac device.
  • an electronic device includes: a sending module configured to acquire an Ethernet data packet to be sent by a Mac device, and package the Ethernet data packet into an original Raw After the IP data packet is sent, the receiving module is configured to receive the original Raw IP data packet, decapsulate the Raw IP data packet into an Ethernet data packet, and send the data to the Mac device.
  • a non-transitory computer readable storage medium storing computer executable instructions arranged to perform the above method.
  • An embodiment of the present invention further provides an electronic device, including:
  • At least one processor At least one processor
  • the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to cause the at least one processor to perform the method described above.
  • an Ethernet data packet to be sent by a Mac device is obtained, and then the Ethernet data packet is encapsulated into an original Raw IP data packet, and then the encapsulated Raw IP data packet is transmitted. Since the Ethernet packets to be sent by the Mac device are packaged and converted into Raw IP packets, the Mac device and the corresponding Mac system can also use the Raw Ip frame format data, so the Raw Ip frame format in the related art can be solved. Data can't be used on Mac systems, reach Mac system Efficient networking between other operating systems increases the user experience on the Mac.
  • FIG. 1 is a flowchart of a method of transmitting a data packet according to an embodiment of the present invention
  • FIG. 2 is a flowchart of a method of receiving a data packet according to an embodiment of the present invention
  • FIG. 3 is a structural block diagram of a device for transmitting a data packet according to an embodiment of the present invention
  • FIG. 4 is a structural block diagram of a receiving apparatus of a data packet according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of the operation of the transmitting module of the embodiment.
  • FIG. 6 is a schematic diagram of the operation of the receiving module of the embodiment.
  • FIG. 8 is a schematic diagram of an Ethernet frame and a Raw Ip frame according to the embodiment.
  • FIG. 9 is a schematic flowchart of a process of transmitting data according to the embodiment.
  • FIG. 10 is a schematic diagram of a format of a DHCP data packet in this embodiment.
  • FIG. 11 is a flowchart of a DHCP acquisition IP address in this embodiment
  • FIG. 12 is a flowchart of PC driving processing ARP data according to the embodiment.
  • FIG. 13 is a schematic diagram of a packet format of the embodiment.
  • FIG. 14 is a schematic diagram of a PC driver and a device negotiation group package according to the embodiment.
  • FIG. 15 is a schematic diagram of a processing flow of a PC sending module according to an embodiment of the present invention.
  • 17 is a schematic structural view of an electronic device of the embodiment.
  • FIG. 1 is a flowchart of a method for sending a data packet according to an embodiment of the present invention. As shown in FIG. 1, the process includes the following steps:
  • Step S102 Acquire an Ethernet data packet to be sent by the Mac device.
  • Step S104 the Ethernet data packet is encapsulated into the original Raw IP data packet
  • Step S106 Send the encapsulated Raw IP data packet.
  • the Ethernet data packet to be sent by the Mac device is obtained, and then the Ethernet data packet is encapsulated into the original Raw IP data packet, and then the encapsulated Raw IP data packet is sent. Since the Ethernet packets to be sent by the Mac device are packaged and converted into Raw IP packets, the Mac device and the corresponding Mac system can also use the Raw Ip frame format data, so the Raw Ip frame format in the related art can be solved. The data can't be used on Mac systems, and it can achieve efficient networking between Mac and other operating systems, improving the user experience under Mac.
  • the execution body of the foregoing steps may be a wireless network card or the like, but is not limited thereto.
  • Ethernet packet can be encapsulated into a Raw IP packet by the following steps:
  • adding a header byte and a padding byte on the first data packet includes: adding a header byte in a header of the first data packet, and adding a padding byte at a packet end of the first data packet.
  • the length of the first byte can be 4 bytes, and the total length of the second packet is an integer multiple of 4 bytes.
  • the Ethernet packet header includes: a destination address destination address, a source address source address, and a protocol format type.
  • the method further includes:
  • Ethernet data packet determines to encapsulate the Ethernet data packet into a Raw IP data packet.
  • the method in this embodiment further includes:
  • FIG. 2 is a flowchart of a method for receiving a data packet according to an embodiment of the present invention.
  • the reverse process of the foregoing sending method is as shown in FIG. 2, and the process includes The following steps:
  • Step S202 receiving an original Raw IP data packet
  • Step S204 decapsulating the Raw IP data packet into an Ethernet data packet
  • Step S206 the encapsulated Ethernet data packet is sent to the Mac device.
  • decapsulating the Raw IP packet into an Ethernet packet includes:
  • the method in this embodiment further includes:
  • the method according to the above embodiments can be implemented by means of software plus a general hardware platform, and of course, can also be implemented by hardware.
  • the technical solution of the present disclosure which is essential or contributes to the related art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk, CD-ROM).
  • the instructions include a number of instructions for causing a terminal device (which may be a cell phone, computer, server, or network device, etc.) to perform the methods of various embodiments of the present invention.
  • a data packet sending device a receiving device, and a wireless network card are also provided.
  • the device is configured to implement the foregoing embodiments, and details are not described herein.
  • the term "module” may implement a combination of software and/or hardware of a predetermined function.
  • FIG. 3 is a structural block diagram of a device for transmitting a data packet according to an embodiment of the present invention. As shown in FIG. 3, the device includes:
  • the obtaining module 30 is configured to acquire an Ethernet data packet to be sent by the Mac device;
  • Encapsulating module 32 configured to encapsulate the Ethernet data packet into an original Raw IP data packet
  • the sending module 34 is configured to send the encapsulated Raw IP data packet.
  • FIG. 4 is a structural block diagram of a device for receiving a data packet according to an embodiment of the present invention. As shown in FIG. 4, the device includes:
  • the receiving module 40 is configured to receive the original Raw IP data packet
  • the decapsulation module 42 is configured to encapsulate the Raw IP data packet into an Ethernet data packet
  • the sending module 44 is configured to send the encapsulated Ethernet data packet to the Mac device.
  • the embodiment further provides an electronic device.
  • the electronic device can be a wireless network card, a data card, etc., and can be flexibly plugged and unplugged on the computer, or can be a wireless network card driver or a data card driver, etc., installed on the Mac.
  • the above transmitting device and receiving device are disposed therein, respectively:
  • the sending module is configured to obtain an Ethernet data packet to be sent by the Mac device, and package the Ethernet data packet into the original Raw IP data packet, and then send the data packet;
  • the receiving module is configured to receive the original Raw IP data packet, decapsulate the Raw IP data packet into an Ethernet data packet, and send the data to the Mac device.
  • the above modules may be implemented by software or hardware.
  • the foregoing may be implemented by, but not limited to, the above modules are all located in the same processor; or, the above modules are respectively located in different combinations. In the processor.
  • This embodiment is an optional embodiment of the present invention, which is used to explain and explain the solution in detail:
  • the Mac system cannot recognize the Raw Ip frame data packet and only recognizes the Ethernet frame data packet with the link layer frame header. Therefore, the Raw Ip driver needs to be composed of several modules:
  • FIG. 5 is a schematic diagram of the operation of the transmitting module of the embodiment, as shown in FIG. 5.
  • Receive module Data card -> PC, to package the 14-byte frame header of the Raw Ip packet and submit it to the OS, which is the mac system.
  • FIG. 6 is a schematic diagram of the operation of the receiving module of the embodiment, as shown in FIG. 6.
  • Packet format identification module separately processes the differentiated IPV4, IPV6 and ARP packets.
  • FIG. 7 is a schematic diagram of an Ethernet frame data packet of this embodiment, as shown in FIG. 7.
  • FIG. 8 is a schematic diagram of the Ethernet frame and the Raw Ip frame of the present embodiment, as shown in FIG. 8.
  • the sending module determines that the data packet format is IPV4 or IPV6, and removes the 14-byte Ethernet header. If it is an ARP packet, it is not processed by the PC driver.
  • Figure 9 is the implementation A schematic diagram of a transmission data processing flow of an example is shown in FIG.
  • the work of the receiving module and the sending module is reversed, that is, the three parameters of the 14 byte need to be filled.
  • Destination address this parameter is the Mac address of the USB physical network card, and the driver is obtained from the board side through QMI.
  • Source address, source address, Mac operating system is not concerned, all padded to 0.
  • IPV4/IPV6 format which indicates the protocol format of the packet. Since only Ethernet is analyzed, only the IPV4/IPV6 format is judged and the corresponding protocol code is added. These can be obtained from the IP header.
  • the process of the receiving module is simpler than the process of sending the module, because the data packets sent by the device will only be IPV4 and IPV6, so only the corresponding header is needed.
  • DHCP Dynamic Host Configuration Protocol
  • UDP User Datagram Protocol
  • FIG. 10 is a schematic diagram of a DHCP packet format of the embodiment, as shown in FIG.
  • the DHCP message type is determined by the Value value in the DHCP Message type option in the option field. There are 8 types, and we often pay attention to the first four types:
  • ARP Address Resolution Protocol
  • IP address is a TCP/IP protocol that acquires a physical address based on an IP address.
  • the host sends the information, it broadcasts the ARP request containing the destination IP address to all hosts on the network, and receives the return message to determine the physical address of the target host. After receiving the return message, the IP address and physical address are stored in the local ARP. Cache and keep it for a while, next time The ARP cache is directly queried when requesting to save resources.
  • the IP address of the PC local and data card gateway can be obtained through DHCP.
  • the Raw Ip mechanism the device no longer responds to ARP requests, and requires a Mac driver to complete the process.
  • the strategy is:
  • ARP request IP address is the IP address assigned to the Mac by the network, it will not reply;
  • ARP request IP address is 169 network segment IP address, then reply.
  • the network assigns an IP address and how to obtain the IP address of the network DNS server, which needs to be parsed from the DHCP offer package.
  • FIG. 11 is a flow chart of the DHCP acquisition IP address in the embodiment.
  • FIG. 12 is a flowchart of the PC driver processing ARP data in the embodiment, as shown in FIG.
  • Figure 13 is a schematic diagram of the packet format of the present embodiment, and Figure 13 shows the relationship between a Data packet and a packet transmitted in the Bulk pipe.
  • Header is part of the entire DataPacket, which is added before each IP packet of the Datapacket. There is a Header in front of each Raw Ip package, which is 4 bytes long.
  • the Header+Raw Ip package constitutes a Data Unit, which consists of several Data Units in a single USB transfer.
  • the length of the PAD padding of each Data Unit is defined in the Header
  • IP Packet is the Raw Ip packet to be transmitted
  • PAD is to make the total length of the Data Unit an integer multiple of 4bytes, which needs to be ignored in data processing.
  • the device supports Raw Ip
  • the Mac machine does not support Raw Ip
  • the PC driver supports Raw Ip (on the wireless network card).
  • the PC driver negotiates with the device whether to group the package, and the device support group package replies; if it does not support, it does not reply, and the PC driver waits for the response to time out to confirm.
  • 14 is a schematic diagram of a PC driver and a device negotiation group package according to the embodiment. As shown in Figure 14.
  • FIG. 15 is a schematic diagram of a processing flow of a PC sending module according to the embodiment. As shown in FIG. 15, the processing procedure of the PC sending module is as follows:
  • Steps S201-S202 the PC sends an Ethernet packet to the PC driver layer
  • Step S203 The PC driver determines the format of the data packet coming from the PC. IPV4, IPV6 or ARP data packets;
  • Step S204 If it is an IPV4 or IPV6 data packet, the Ethernet packet header of 14 bytes is removed; if it is an ARP data packet, then step S205 is performed;
  • Step S206 Add a Header and a PAD to the Raw IP packet of the IPV4 and IPV6 to which the Ethernet header is removed, and become a Data Unit;
  • Step S207 Combine multiple Data Units into one large data packet, and send it to the S208 device for processing;
  • Steps S209-S211 The DHCP offer message obtained from the network side can parse the IP address of the Mac machine and the IP address of the network DNS server;
  • Step S212 The PC driver receives the ARP data request sent by the PC side, and combines the Mac machine IP address and the network DNS server IP address parsed by the S209-S211 to determine whether the PC requests the IP address of the Mac machine. If yes, then to S214, no reply; if not, then to S213, reply to the corresponding Mac address corresponding to the IP address.
  • FIG. 16 is a flowchart of processing a PC receiving module according to the embodiment. As shown in FIG. 16, the processing process of the PC receiving module includes:
  • Steps S301-S302 The device returns a large data packet consisting of Raw IP format to the PC driver;
  • Steps S303-S304 unpacking the large data packet and splitting into multiple Data unit units
  • Step S305 Removing the Header and the PAD from a single Data unit packet to become a single Raw IP packet
  • Steps S306-S307 Add an Ethernet header to the Raw IP packet and transmit it to the PC.
  • the PC driver completes the function of adapting the data card to the Mac machine, and improves the USB transmission capability by means of group packing.
  • the PC driver provided by this solution can perform normal and efficient networking functions, and improve the user experience under the Mac.
  • the grouping mode in the solution may be replaced by the NTB grouping mode, but the grouping structure is complicated.
  • Embodiments of the present invention also provide a non-transitory computer readable storage medium storing computer executable instructions arranged to perform the method of any of the above embodiments.
  • the foregoing storage medium may be configured to store program code for performing the following steps:
  • the foregoing storage medium may include, but not limited to, a USB flash drive, a Read-Only Memory (ROM), a Random Access Memory (RAM), a mobile hard disk, and a magnetic memory.
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • a mobile hard disk e.g., a hard disk
  • magnetic memory e.g., a hard disk
  • the processor performs to acquire an Ethernet data packet to be sent by the Mac device according to the stored program code in the storage medium;
  • the processor performs to encapsulate the Ethernet data packet into the original Raw IP data packet according to the stored program code in the storage medium;
  • the processor performs sending the encapsulated Raw IP data packet according to the stored program code in the storage medium.
  • the embodiment of the invention further provides a schematic structural diagram of an electronic device.
  • the electronic device includes:
  • At least one processor 170, one processor 170 is taken as an example in FIG. 17; and a memory (memory) 171, which may also include a communication interface (Communications Interface) 172 and a bus 173.
  • the processor 170, the communication interface 172, and the memory 171 can complete communication with each other through the bus 173.
  • Communication interface 172 can be used for information transfer.
  • the processor 170 can call logic instructions in the memory 171 to perform the methods of the above-described embodiments.
  • logic instructions in the memory 171 described above may be implemented in the form of a software functional unit and sold or used as a stand-alone product, and may be stored in a computer readable storage medium.
  • the memory 171 is used as a computer readable storage medium, and can be used to store a software program, a computer executable program, and a program instruction/module corresponding to the method in the embodiment of the present invention.
  • the processor 170 executes the function application and the data processing by executing the software program, the instruction, and the module stored in the memory 171, that is, the method for transmitting and receiving the data packet in the foregoing method embodiment.
  • the memory 171 may include a storage program area that can store an operating system, an application required for at least one function, and a storage data area that can store data created according to usage of the terminal device, and the like. Further, the memory 171 may include a high speed random access memory, and may also include a nonvolatile memory.
  • the technical solution of the embodiment of the present invention may be embodied in the form of a software product stored in a storage medium, including one or more instructions for causing a computer device (which may be a personal computer, a server, or a network) The device or the like) performs all or part of the steps of the method described in the embodiments of the present invention.
  • the foregoing storage medium may be a non-transitory storage medium, including: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and the like.
  • modules or steps of the present disclosure described above can be implemented by a general-purpose computing device that can be centralized on a single computing device or distributed across a network of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein. Perform the steps shown or described, or separate them It is made by making individual integrated circuit modules, or by making a plurality of modules or steps of them into a single integrated circuit module. As such, the disclosure is not limited to any specific combination of hardware and software.
  • the method and device for transmitting and receiving data packets and the electronic device provided by the present application solve the problem that the data of the Raw Ip frame format in the related art cannot be used on the Mac system.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本公开提供了一种数据包的发送、接收方法及装置、电子设备,其中,该方法包括:获取Mac设备待发送的以太网数据包;将所述以太网数据包封装成原始Raw IP数据包;发送封装后的所述Raw IP数据包,解决了相关技术中Raw Ip帧格式的数据不能在Mac系统上无法使用的问题。

Description

数据包的发送、接收方法及装置、电子设备 技术领域
本申请涉及通信领域,例如涉及一种数据包的发送、接收方法及装置、电子设备。
背景技术
相关技术中,Mac机器是一类使用mac操作系统(也叫OS X系统)的设备,是苹果公司专属,在市场上主要区分于使用比较广泛的安装windows操作系统的设备,Mac机器和网络上的数据都是以太网包,而现在原始Raw Ip的概念推出后,越来越多的机器和设备已经支持Raw Ip frame。比如windows从win7开始支持Raw Ip协议,但是现有的Mac机器并不支持Raw Ip,所以会存在这样的问题,设备和windows都支持Raw Ip,设备可以在windows上正常联网,但是在Mac上无法使用。
相关技术中,无线数据卡可以虚拟出各种无线网卡,通过虚拟无线网卡进行联网。而在Mac电脑上的无线数据卡通过三种方式可以进行联网。Modem(调制解调器)方式、网络驱动接口规范(Network Driver Interface Specification,简称为Ndis)方式和以太网控制模型(Ethernet Control Model,简称为ECM)方式。其中Modem方式比较常见,也是速率最低的;Ndis方式都是走的Ethernet frame(以太网帧)格式,并不支持Raw Ip frame的格式;ECM则使用了系统驱动。
相关技术中存在如下问题:如果设备是支持Raw Ip frame的格式,那么只能在windows下使用。
针对相关技术中存在的上述问题,目前尚未发现有效的解决方案。
发明内容
本发明实施例提供了一种数据包的发送、接收方法及装置、电子设备,以至少解决相关技术中Raw Ip帧格式的数据不能在Mac系统上无法使用的问题。
根据本发明的一个实施例,提供了一种数据包的发送方法,包括:获取Mac设备待发送的以太网数据包;将所述以太网数据包封装成原始Raw IP数据包;发送封装后的所述Raw IP数据包。
可选地,将所述以太网数据包封装成Raw IP数据包包括:去掉所述以太网数据包的以太网包头得到第一数据包;在所述第一数据包上添加头字节和填充字节,组成第二数据包;将一个或多个所述第二数据包进行组合得到所述Raw IP数据包。
可选地,在所述第一数据包上添加头字节和填充字节包括:在所述第一数据包的包头添加头字节,在所述第一数据包的包尾添加填充字节。
可选地,所述第二数据包的总长度为4字节的整数倍。
可选地,所述以太网包头包括:目的地址destination address、源地址source address、协议格式type。
可选地,在将所述以太网数据包封装成Raw IP数据包之前,所述方法还包括:判断所述以太网数据包的格式;在所述以太网数据包的格式是IPV4协议或IPV6协议时,确定将所述以太网数据包封装成Raw IP数据包。
可选地,在所述以太网数据包的格式是地址解析协议ARP时,判断所述以太网数据包所请求的IP地址是否为所述Mac设备的IP地址;在判断结果为所述以太网数据包所请求的IP地址不是所述Mac设备的IP地址时,发送所述以太网数据包所请求的IP地址,和/或,在判断结果为是时,放弃发送所述以太网数据包所请求的IP地址。
可选的,在将所述以太网数据包封装成原始Raw IP数据包之前,所述方法还包括:判断所述以太网数据包的接收端是否支持所述以太网数据包;在判断结果为所述以太网数据包的接收端不支持所述以太网数据包时,确定将所述以太网数据包封装成原始Raw IP数据包。
根据本发明的一个实施例,提供了一种数据包的接收方法,应用在Mac操作系统中,包括:接收原始Raw IP数据包;将所述Raw IP数据包解封装成以太网数据包;将封装后的所述以太网数据包发送给Mac设备。
可选地,将所述Raw IP数据包解封装成以太网数据包包括:将所述Raw IP数据包拆分成一个或多个第二数据包;对每个所述第二数据包去掉头字节和填 充字节得到第一数据包;对所述第一数据包添加以太网包头得到以太网数据包。
可选的,在将所述Raw IP数据包解封装成以太网数据包之前,所述方法还包括:判断所述Mac设备是否支持所述Raw IP数据包;在判断结果为所述Mac设备不支持所述Raw IP数据包时,确定将所述Raw IP数据包解封装成以太网数据包。
根据本发明的另一个实施例,提供了一种数据包的发送装置,应用在Mac操作系统中,包括:获取模块,被配置为获取Mac设备待发送的以太网数据包;封装模块,被配置为将所述以太网数据包封装成原始Raw IP数据包;发送模块,被配置为发送封装后的所述Raw IP数据包。
根据本发明的另一个实施例,提供了一种数据包的接收装置,应用在Mac操作系统中,包括:接收模块,被配置为接收原始Raw IP数据包;解封装模块,被配置为将所述Raw IP数据包解封装成以太网数据包;发送模块,被配置为将封装后的所述以太网数据包发送给Mac设备。
根据本发明的又一个实施例,提供了一种电子设备,所述无线网卡包括:发送模块:被配置为获取Mac设备待发送的以太网数据包,将所述以太网数据包封装成原始Raw IP数据包后进行发送;接收模块,被配置为接收原始Raw IP数据包,将所述Raw IP数据包解封装成以太网数据包后发送给所述Mac设备。
根据本发明的又一个实施例,还提供了一种非暂态计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令设置为执行上述方法。
本发明实施例还提供了一种电子设备,包括:
至少一个处理器;以及
与所述至少一个处理器通信连接的存储器;其中,
所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器执行上述的方法。
通过本公开,获取Mac设备待发送的以太网数据包,然后将所述以太网数据包封装成原始Raw IP数据包,之后再发送封装后的所述Raw IP数据包。由于将Mac设备待发送的以太网数据包封装和转换成了Raw IP数据包,使得Mac设备和对应的Mac系统也能使用Raw Ip帧格式的数据,因此,可以解决相关技术中Raw Ip帧格式的数据不能在Mac系统上无法使用的问题,达到Mac系统 和其他操作系统之间高效的联网功能,提高了在Mac下的用户体验。
附图概述
此处所说明的附图用来提供对本公开的理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本公开,并不构成对本公开的不当限定。在附图中:
图1是根据本发明实施例的数据包的发送方法的流程图;
图2是根据本发明实施例的数据包的接收方法的流程图;
图3是根据本发明实施例的数据包的发送装置的结构框图;
图4是根据本发明实施例的数据包的接收装置的结构框图;
图5是本实施例的发送模块工作示意图;
图6是本实施例的接收模块工作示意图;
图7是本实施例的Ethernet frame数据包的示意图;
图8是本实施例的Ethernet frame和Raw Ip frame的示意图;
图9是本实施例的发送数据处理流程示意图;
图10是本实施例的DHCP数据包格式示意图;
图11是本实施例的DHCP获取IP地址流程图;
图12是本实施例的PC驱动处理ARP数据流程图;
图13是本实施例的组包格式示意图;
图14是本实施例的PC驱动和设备协商组包示意图;
图15为本实施例的PC发送模块处理流程示意图;
图16为本实施例的PC接收模块处理流程图;以及
图17是本实施例的电子设备的结构示意图。
本发明的实施方式
下文中将参考附图并结合实施例来详细说明本公开。在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。
本公开的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。
实施例1
在本实施例中提供了一种数据包的发送方法,图1是根据本发明实施例的数据包的发送方法的流程图,如图1所示,该流程包括如下步骤:
步骤S102,获取Mac设备待发送的以太网数据包;
步骤S104,将以太网数据包封装成原始Raw IP数据包;
步骤S106,发送封装后的Raw IP数据包。
通过上述步骤,获取Mac设备待发送的以太网数据包,然后将以太网数据包封装成原始Raw IP数据包,之后再发送封装后的Raw IP数据包。由于将Mac设备待发送的以太网数据包封装和转换成了Raw IP数据包,使得Mac设备和对应的Mac系统也能使用Raw Ip帧格式的数据,因此,可以解决相关技术中Raw Ip帧格式的数据不能在Mac系统上无法使用的问题,达到Mac系统和其他操作系统之间高效的联网功能,提高了在Mac下的用户体验。
可选地,上述步骤的执行主体可以为无线网卡等,但不限于此。
可选的,可以通过如下步骤将以太网数据包封装成Raw IP数据包:
S11,去掉以太网数据包的以太网包头得到第一数据包;
S12,在第一数据包上添加头字节和填充字节,组成第二数据包;
S13,将一个或多个第二数据包进行组合得到Raw IP数据包。
可选的,在第一数据包上添加头字节和填充字节包括:在第一数据包的包头添加头字节,在第一数据包的包尾添加填充字节。头字节的长度可以是4个字节,第二数据包的总长度为4字节的整数倍。
在本实施例中,以太网包头包括:目的地址destination address、源地址source address、协议格式type。
可选的,在将以太网数据包封装成Raw IP数据包之前,方法还包括:
S21,判断以太网数据包的格式;
S22,在以太网数据包的格式是IPV4协议或IPV6协议时,确定将以太网数据包封装成Raw IP数据包。
作为另外一个分支,在以太网数据包的格式是地址解析协议ARP时,执行:
S23,判断以太网数据包所请求的IP地址是否为Mac设备的IP地址;
S24,在判断结果为所述以太网数据包所请求的IP地址不是Mac设备的IP地址时,发送以太网数据包所请求的IP地址,和/或,在判断结果为是时,放弃发送以太网数据包所请求的IP地址。
可选的,在封装之前还可以判断报文是否需要封装,在以太网数据包的接收端不支持以太网数据包,或者只支持Raw IP数据包时,才执行后续的封装操作,而在相互兼容的情况下,则不需要封装,减少了系统对数据包的额外处理。在将所述以太网数据包封装成原始Raw IP数据包之前,本实施例的方法还包括:
S31,判断所述以太网数据包的接收端是否支持所述以太网数据包;
S32,在判断结果为所述以太网数据包的接收端不支持所述以太网数据包时,确定将所述以太网数据包封装成原始Raw IP数据包。
在本实施例中提供了一种数据包的发送方法,图2是根据本发明实施例的数据包的接收方法的流程图,为上述发送方法的逆过程,如图2所示,该流程包括如下步骤:
步骤S202,接收原始Raw IP数据包;
步骤S204,将Raw IP数据包解封装成以太网数据包;
步骤S206,将封装后的以太网数据包发送给Mac设备。
可选的,将Raw IP数据包解封装成以太网数据包包括:
S41,将Raw IP数据包拆分成一个或多个第二数据包;
S42,对每个第二数据包去掉头字节和填充字节得到第一数据包;
S43,对第一数据包添加以太网包头得到以太网数据包。
可选的,在解封装之前还可以判断报文是否需要解封装,在Mac设备不支 持Raw IP数据包,或者只支持以太网数据包时,才执行后续的解封装操作,而在Mac设备可以兼容的情况下,则不需要解封装,减少了系统对数据包的额外处理。在将所述Raw IP数据包解封装成以太网数据包之前,本实施例的方法还包括:
S51,判断所述Mac设备是否支持所述Raw IP数据包;
S52,在判断结果为所述Mac设备不支持所述Raw IP数据包时,确定将所述Raw IP数据包解封装成以太网数据包。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加通用硬件平台的方式来实现,当然也可以通过硬件实现。基于这样的理解,本公开的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本发明各个实施例的方法。
实施例2
在本实施例中还提供了一种数据包的发送装置、接收装置、无线网卡,该装置被配置为实现上述实施例,已经进行过说明的不再赘述。如以下所使用的,术语“模块”可以实现预定功能的软件和/或硬件的组合。尽管以下实施例所描述的装置可以通过软件实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。
图3是根据本发明实施例的数据包的发送装置的结构框图,如图3所示,该装置包括:
获取模块30,被配置为获取Mac设备待发送的以太网数据包;
封装模块32,被配置为将以太网数据包封装成原始Raw IP数据包;
发送模块34,被配置为发送封装后的Raw IP数据包。
图4是根据本发明实施例的数据包的接收装置的结构框图,如图4所示,该装置包括:
接收模块40,被配置为接收原始Raw IP数据包;
解封装模块42,被配置为将Raw IP数据包封装成以太网数据包;
发送模块44,被配置为将封装后的以太网数据包发送给Mac设备。
本实施例还提供一种电子设备,可选的,该电子设备可以是无线网卡、数据卡等,可以灵活在电脑上进行插拔,也可以是无线网卡驱动或数据卡驱动等,安装在Mac设备的系统内,将上述发送装置和接收装置设置在其中,分别为:
发送模块:被配置为获取Mac设备待发送的以太网数据包,将以太网数据包封装成原始Raw IP数据包后进行发送;
接收模块,被配置为接收原始Raw IP数据包,将Raw IP数据包解封装成以太网数据包后发送给Mac设备。
上述各个模块是可以通过软件或硬件来实现的,对于后者,可以通过以下方式实现,但不限于此:上述模块均位于同一处理器中;或者,上述各个模块以任意组合的形式分别位于不同的处理器中。
实施例3
本实施例是本发明的可选实施例,用于对本方案进行详细的解释和说明:
相关技术中,Mac系统无法识别Raw Ip frame数据包,只能识别带有链路层帧头的Ethernet frame数据包,因此Raw Ip驱动需要一下几部分模块组成:
发送模块:PC->数据卡,要去掉Ethernet的14字节帧头。图5是本实施例的发送模块工作示意图,如图5所示。
接收模块:数据卡->PC,要对Raw Ip数据包进行封装14字节帧头后递交OS,即mac系统。图6是本实施例的接收模块工作示意图,如图6所示。
数据包格式识别模块:对区分出的IPV4、IPV6和ARP数据包分别进行处理。
发送模块中,Ethernet包头包含了6byte的destination address、6byte的source address以及2byte的type,总共14byte。图7是本实施例的Ethernet frame数据包的示意图,如图7所示。
图8是本实施例的Ethernet frame和Raw Ip frame的示意图,如图8所示。
发送模块,判断出数据包格式为IPV4或者IPV6则去掉14byte的Ethernet包头,如果是ARP数据包则不到设备,直接在PC驱动中处理。图9是本实施 例的发送数据处理流程示意图,如图9所示。
接收模块与发送模块的工作是相反的,也就是需要填充这14byte的三个参数。
destination address,这个参数就是USB物理网卡的Mac地址,驱动通过QMI从板侧获得。
source address,源地址,Mac操作系统并不关注,全部填充为0。
type,表明了数据包的协议格式,因只分析以太网,所以仅判断IPV4/IPV6格式,并添加相应的协议码。这些可以从IP包头获得。
接收模块的流程相比发送模块的流程较为简单,因为设备发过来的数据包只会是IPV4和IPV6,所以只需要加上相应的包头即可。
PC驱动处理ARP模块:
DHCP(Dynamic Host Configuration Protocol,动态主机配置协议)是一个局域网的网络协议,使用UDP协议工作,主要用途有两个,给内部网络或网络服务供应商自动分配IP地址,给用户或者内部网络管理员作为对所有计算机中央管理的手段。它是在Bootstrap Protocol引导程序协议发展来的。
DHCP可以使计算机用一个消息获取它所需要的所有配置信息,即传送配置信息的协议。允许计算机快速、动态的获取IP地址,即动态分配IP地址的机制。图10是本实施例的DHCP数据包格式示意图,如图10所示。
DHCP报文类型由选项字段中的DHCP Message type选项中的Value值来决定,共有一下8种类型,其中我们常关注前四种:
DHCPDISCOVER(01)DHCPOFFER(02)
DHCPREQUEST(03)DHCPACK(05)
DHCPDECLINE(04)DHCPN53139AK(06)
DHCPRELEASE(07)DHCPINFORM(08)
ARP(Address Resolution Protocol,地址解析协议),是根据IP地址获取物理地址的一个TCP/IP协议。主机发送信息时将包含目标IP地址的ARP请求广播到网络上的所有主机,并接收返回消息,来确定目标主机的物理地址;收到返回消息后将该IP地址和物理地址存入本机ARP缓存中并保留一段时间,下次 请求时直接查询ARP缓存以节约资源。
通过DHCP,可以获得PC本机和数据卡网关的IP地址。
通过ARP,得到数据卡IP地址和Mac地址的对应关系,正常获得后,通过arp-a可以查询到目前缓存中已有的对应关系。
Raw Ip机制,设备已经不再应答ARP请求,需要Mac驱动来完成这个过程,策略为:
如果ARP请求IP地址为网络分配给Mac机的IP地址,则不回复;
如果ARP请求IP地址为网络DNS服务器IP地址,则应答;
如果ARP请求IP地址为169网段IP地址,则应答。
网络分配IP地址以及如何获取网络DNS服务器IP地址,则需要从DHCP offer包中解析出来。
图11是本实施例的DHCP获取IP地址流程图,如图11所示,图12是本实施例的PC驱动处理ARP数据流程图,如图12所示。
图13是本实施例的组包格式示意图,图13显示了在Bulk管道中传输的一个Data packet和组包之间的关系。Header是整个DataPacket的一部分,它添加在Datapacket的每个IP数据包前。在每个Raw Ip包前都有个Header,长4byte。
Header+Raw Ip包构成一个Data Unit,一次USB传输中由数个Data Unit组成。
Header中定义了每个Data Unit的PAD填充的长度;
IP Packet是要传输的Raw Ip包;
PAD是为了使Data Unit的总长度为4bytes的整数倍,在数据处理中需要忽略。
以下是装置侧方法实施例:
预置前提:设备支持Raw Ip,Mac机器不支持Raw Ip,PC驱动支持Raw Ip(无线网卡上)。
PC驱动与设备协商是否组包,设备支持组包则回复;不支持则不回复,PC驱动等待回复超时则确认。图14是本实施例的PC驱动和设备协商组包示意图, 如图14所示。
图15为本实施例的PC发送模块处理流程示意图,如图15所示,PC发送模块处理流程如下:
步骤S201-S202:PC发送以太网包到PC驱动层;
步骤S203:PC驱动判断从PC过来的数据包是何种格式?IPV4、IPV6或者ARP数据包;
步骤S204:如果是IPV4或IPV6数据包,则去掉14bytes的以太网数据包头;如果是ARP数据包的话,则到S205步骤;
步骤S206:对去了以太网包头的IPV4和IPV6的Raw IP包添加一个Header和PAD,成为一个Data Unit;
步骤S207:将多个Data Unit组合成一个大数据包,发送到S208设备上进行处理;
步骤S209-S211:从网络侧获取的DHCP offer消息中,可以解析出Mac机器的IP地址和网络DNS服务器的IP地址;
步骤S212:PC驱动收到PC侧发过来的ARP数据请求,结合S209-S211解析出的Mac机器IP地址和网络DNS服务器IP地址,判断PC请求的是Mac机器的IP地址吗?如果是,则到S214,不回复;如果不是,则到S213,回复相应IP地址多对应的Mac地址。
图16为本实施例的PC接收模块处理流程图,如图16所示,PC接收模块处理流程包括:
步骤S301-S302:设备向PC驱动返回Raw IP格式组成的大数据包;
步骤S303-S304:对大数据包进行解包,拆分成多个Data unit单元;
步骤S305:对单个Data unit数据包去掉Header和PAD,成为单个的Raw IP数据包;
步骤S306-S307:对Raw IP数据包添加以太网包头,并传送到PC端。
通过以上所有流程,PC驱动完成了数据卡适配Mac机器的功能,并且通过组包的方式提高了USB传输能力。
用户将仅支持Raw IP的无线网卡,插入仅支持以太网数据的Mac机器上时, 能够通过本方案提供的PC驱动,进行正常且高效的联网功能,提高了在Mac下的用户体验。
可选的,可以将本方案中的组包方式替换为NTB的组包方式,但这种方式组包结构复杂。
通过本实施例提供的PC驱动,进行正常且高效的联网功能,提高了在Mac下的用户体验。
实施例4
本发明的实施例还提供了一种非暂态计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令设置为执行上述任一实施例中的方法。可选地,在本实施例中,上述存储介质可以被设置为存储用于执行以下步骤的程序代码:
S1,获取Mac设备待发送的以太网数据包;
S2,将以太网数据包封装成原始Raw IP数据包;
S3,发送封装后的Raw IP数据包。
可选地,在本实施例中,上述存储介质可以包括但不限于:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。
可选地,在本实施例中,处理器根据存储介质中已存储的程序代码执行获取Mac设备待发送的以太网数据包;
可选地,在本实施例中,处理器根据存储介质中已存储的程序代码执行将以太网数据包封装成原始Raw IP数据包;
可选地,在本实施例中,处理器根据存储介质中已存储的程序代码执行发送封装后的Raw IP数据包。
可选地,本实施例中的示例可以参考上述实施例及可选实施方式中所描述的示例,本实施例在此不再赘述。
本发明实施例还提供了一种电子设备的结构示意图。参见图17,该电子设备包括:
至少一个处理器(processor)170,图17中以一个处理器170为例;和存储器 (memory)171,还可以包括通信接口(Communications Interface)172和总线173。其中,处理器170、通信接口172、存储器171可以通过总线173完成相互间的通信。通信接口172可以用于信息传输。处理器170可以调用存储器171中的逻辑指令,以执行上述实施例的方法。
此外,上述的存储器171中的逻辑指令可以通过软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。
存储器171作为一种计算机可读存储介质,可用于存储软件程序、计算机可执行程序,如本发明实施例中的方法对应的程序指令/模块。处理器170通过运行存储在存储器171中的软件程序、指令以及模块,从而执行功能应用以及数据处理,即实现上述方法实施例中的数据包的发送、接收方法。
存储器171可包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序;存储数据区可存储根据终端设备的使用所创建的数据等。此外,存储器171可以包括高速随机存取存储器,还可以包括非易失性存储器。
本发明实施例的技术方案可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括一个或多个指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明实施例所述方法的全部或部分步骤。而前述的存储介质可以是非暂态存储介质,包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等多种可以存储程序代码的介质,也可以是暂态存储介质。
显然,本领域的技术人员应该明白,上述的本公开的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别 制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本公开不限制于任何特定的硬件和软件结合。
以上所述仅为本发明的实施例而已,并不用于限制本公开,对于本领域的技术人员来说,本公开可以有各种更改和变化。凡在本发明的实施例范围内,所作的任何修改、等同替换、改进等,均应包含在本公开的保护范围之内。
工业实用性
本申请提供的数据包的发送、接收方法及装置、电子设备,解决了相关技术中Raw Ip帧格式的数据不能在Mac系统上无法使用的问题。

Claims (16)

  1. 一种数据包的发送方法,包括:
    获取Mac设备待发送的以太网数据包;
    将所述以太网数据包封装成原始Raw IP数据包;
    发送封装后的所述Raw IP数据包。
  2. 根据权利要求1所述的方法,其中,将所述以太网数据包封装成Raw IP数据包包括:
    去掉所述以太网数据包的以太网包头得到第一数据包;
    在所述第一数据包上添加头字节和填充字节,组成第二数据包;
    将一个或多个所述第二数据包进行组合得到所述Raw IP数据包。
  3. 根据权利要求2所述的方法,其中,在所述第一数据包上添加头字节和填充字节包括:
    在所述第一数据包的包头添加头字节,在所述第一数据包的包尾添加填充字节。
  4. 根据权利要求2或3所述的方法,其中,所述第二数据包的总长度为4字节的整数倍。
  5. 根据权利要求2所述的方法,其中,所述以太网包头包括:目的地址destination address、源地址source address、协议格式type。
  6. 根据权利要求1所述的方法,其中,在将所述以太网数据包封装成Raw IP数据包之前,所述方法还包括:
    判断所述以太网数据包的格式;
    在所述以太网数据包的格式是IPV4协议或IPV6协议时,确定将所述以太网数据包封装成Raw IP数据包。
  7. 根据权利要求6所述的方法,还包括:
    在所述以太网数据包的格式是地址解析协议ARP时,判断所述以太网数据包所请求的IP地址是否为所述Mac设备的IP地址;
    在判断结果为所述以太网数据包所请求的IP地址不是所述Mac设备的IP地址时,发送所述以太网数据包所请求的IP地址,和/或,在判断结果为是时,放弃发送所述以太网数据包所请求的IP地址。
  8. 根据权利要求1所述的方法,其中,在将所述以太网数据包封装成原始Raw IP数据包之前,所述方法还包括:
    判断所述以太网数据包的接收端是否支持所述以太网数据包;
    在判断结果为所述以太网数据包的接收端不支持所述以太网数据包时,确定将所述以太网数据包封装成原始Raw IP数据包。
  9. 一种数据包的接收方法,包括:
    接收原始Raw IP数据包;
    将所述Raw IP数据包解封装成以太网数据包;
    将封装后的所述以太网数据包发送给Mac设备。
  10. 根据权利要求9所述的方法,其中,将所述Raw IP数据包解封装成以太网数据包包括:
    将所述Raw IP数据包拆分成一个或多个第二数据包;
    对每个所述第二数据包去掉头字节和填充字节得到第一数据包;
    对所述第一数据包添加以太网包头得到以太网数据包。
  11. 根据权利要求9所述的方法,其中,在将所述Raw IP数据包解封装成以太网数据包之前,所述方法还包括:
    判断所述Mac设备是否支持所述Raw IP数据包;
    在判断结果为所述Mac设备不支持所述Raw IP数据包时,确定将所述Raw IP数据包解封装成以太网数据包。
  12. 一种数据包的发送装置,应用在Mac操作系统中,包括:
    获取模块,被配置为获取Mac设备待发送的以太网数据包;
    封装模块,被配置为将所述以太网数据包封装成原始Raw IP数据包;
    发送模块,被配置为发送封装后的所述Raw IP数据包。
  13. 一种数据包的接收装置,应用在Mac操作系统中,包括:
    接收模块,被配置为接收原始Raw IP数据包;
    解封装模块,被配置为将所述Raw IP数据包解封装成以太网数据包;
    发送模块,被配置为将封装后的所述以太网数据包发送给Mac设备。
  14. 一种电子设备,包括:
    发送模块:被配置为获取Mac设备待发送的以太网数据包,将所述以太网数据包封装成原始Raw IP数据包后进行发送;
    接收模块,被配置为接收原始Raw IP数据包,将所述Raw IP数据包解封装成以太网数据包后发送给所述Mac设备。
  15. 一种非暂态计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令设置为执行权利要求1-8中任一项的方法。
  16. 一种非暂态计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令设置为执行权利要求9-11中任一项的方法。
PCT/CN2017/070184 2016-05-24 2017-01-04 数据包的发送、接收方法及装置、电子设备 WO2017202034A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610353279.0A CN107426263A (zh) 2016-05-24 2016-05-24 数据包的发送、接收方法及装置、电子设备
CN201610353279.0 2016-05-24

Publications (1)

Publication Number Publication Date
WO2017202034A1 true WO2017202034A1 (zh) 2017-11-30

Family

ID=60412070

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/070184 WO2017202034A1 (zh) 2016-05-24 2017-01-04 数据包的发送、接收方法及装置、电子设备

Country Status (2)

Country Link
CN (1) CN107426263A (zh)
WO (1) WO2017202034A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110505222A (zh) * 2019-08-14 2019-11-26 中国电力科学研究院有限公司 一种用于电力设备专用校准装置的协议转换系统及方法
WO2020088527A1 (en) * 2018-10-30 2020-05-07 Mediatek Singapore Pte. Ltd. Overhead reduction in transmission of small ethernet packets over a wireless link

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111221622B (zh) * 2019-12-17 2023-10-24 京信网络系统股份有限公司 通信模块间通信方法、装置、计算机设备和可读存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1264977A (zh) * 1999-02-26 2000-08-30 朗迅科技公司 非封装移动网际协议
CN1504034A (zh) * 2001-03-12 2004-06-09 �����ɷ� 基于宽带调制的时分复用方法和装置
CN1863165A (zh) * 2006-01-24 2006-11-15 华为技术有限公司 分组域网络中减少数据ip分片数量的方法
CN101226700A (zh) * 2008-01-28 2008-07-23 哈尔滨工业大学 Ip数据报的分片与重组过程的教学实验方法
WO2013126918A1 (en) * 2012-02-24 2013-08-29 Ruckus Wireless, Inc. Wireless services gateway

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100484101C (zh) * 2006-09-16 2009-04-29 华为技术有限公司 一种以太网传输IPv6报文方法、系统与装置
CN102377632B (zh) * 2010-08-06 2014-08-20 北京乾唐视联网络科技有限公司 一种兼容以太网的方法及系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1264977A (zh) * 1999-02-26 2000-08-30 朗迅科技公司 非封装移动网际协议
CN1504034A (zh) * 2001-03-12 2004-06-09 �����ɷ� 基于宽带调制的时分复用方法和装置
CN1863165A (zh) * 2006-01-24 2006-11-15 华为技术有限公司 分组域网络中减少数据ip分片数量的方法
CN101226700A (zh) * 2008-01-28 2008-07-23 哈尔滨工业大学 Ip数据报的分片与重组过程的教学实验方法
WO2013126918A1 (en) * 2012-02-24 2013-08-29 Ruckus Wireless, Inc. Wireless services gateway

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020088527A1 (en) * 2018-10-30 2020-05-07 Mediatek Singapore Pte. Ltd. Overhead reduction in transmission of small ethernet packets over a wireless link
CN110505222A (zh) * 2019-08-14 2019-11-26 中国电力科学研究院有限公司 一种用于电力设备专用校准装置的协议转换系统及方法
CN110505222B (zh) * 2019-08-14 2022-09-20 中国电力科学研究院有限公司 一种用于电力设备专用校准装置的协议转换方法

Also Published As

Publication number Publication date
CN107426263A (zh) 2017-12-01

Similar Documents

Publication Publication Date Title
CA3010757C (en) Method and system of providing carrier grade nat (cgn) to a subset of a subscriber base
EP2645679B1 (en) Method and apparatus for message transmission
US11018892B2 (en) Broadband remote access server (BRAS) system-based packet encapsulation
US10038646B2 (en) Method and apparatus for acquiring port range resource, and method and apparatus for allocating port range resource
US11405314B2 (en) Packet processing method and apparatus
WO2016086670A1 (zh) Vxlan报文传输方法及装置、存储介质
JP6128352B2 (ja) 認証情報を転送するための方法、中継装置、サーバ、およびシステム
WO2017000565A1 (zh) 一种用户接入的控制方法、装置、中继设备及服务器
WO2017202034A1 (zh) 数据包的发送、接收方法及装置、电子设备
WO2014101891A1 (zh) 一种配置ip地址方法和设备
US20200274948A1 (en) Service flow configuration method and apparatus
US20170310634A1 (en) Network access method, system and terminal device, and computer storage medium
CN106302845B (zh) 数据通道产品的域名系统地址配置方法及装置
CN112272244A (zh) 一种路由器WAN端IPv6上网模式配置方法及装置
TW201818699A (zh) 資料傳輸的方法、設備、裝置及系統
WO2016177185A1 (zh) 媒体访问控制mac地址的处理方法及装置
US11962563B2 (en) Enabling low latency traffic handling within IPv6 MAP-T environment using NAT
WO2015085558A1 (zh) 一种动态分配ip地址的方法、装置和系统
CN106850871B (zh) 一种单物理网卡多vlan的dhcp服务器实现方法
EP3029913A1 (en) Method for processing raw ip packet, and corresponding apparatus
US20160006809A1 (en) Method and device for centralized storage of photographs
CN111654390B (zh) 一种数据传输方法、装置、终端设备和存储介质
JP4745008B2 (ja) クライアント装置、サーバ装置及び通信システム
TWM554679U (zh) 網路資源分配伺服器
CN112261165B (zh) 通信方法、系统、装置、计算机设备和存储介质

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

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

Ref document number: 17801892

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 17801892

Country of ref document: EP

Kind code of ref document: A1