CN109639555B - Link layer message generation method, link layer message generation device and terminal equipment - Google Patents
Link layer message generation method, link layer message generation device and terminal equipment Download PDFInfo
- Publication number
- CN109639555B CN109639555B CN201811646854.1A CN201811646854A CN109639555B CN 109639555 B CN109639555 B CN 109639555B CN 201811646854 A CN201811646854 A CN 201811646854A CN 109639555 B CN109639555 B CN 109639555B
- Authority
- CN
- China
- Prior art keywords
- layer message
- network layer
- preset
- link layer
- variable
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/46—Interconnection of networks
- H04L12/4633—Interconnection of networks using encapsulation techniques, e.g. tunneling
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/24—Traffic characterised by specific attributes, e.g. priority or QoS
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/50—Queue scheduling
- H04L47/62—Queue scheduling characterised by scheduling criteria
- H04L47/625—Queue scheduling characterised by scheduling criteria for service slots or service orders
- H04L47/6275—Queue scheduling characterised by scheduling criteria for service slots or service orders based on priority
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer And Data Communications (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The application provides a link layer message generation method, a link layer message generation device and a terminal device, wherein the method comprises the following steps: performing at a data link layer in a network communication system: acquiring a network layer message to be packaged and a variable value of a preset variable corresponding to the network layer message; judging whether the variable value of the preset variable is a preset value or not; and if the preset value is the preset value, generating a link layer message encapsulated with the network layer message, wherein the priority of the link layer message is the highest priority defined in a communication protocol used by the link layer message. The method and the device can solve the technical problem that the terminal equipment cannot acquire the server response for a long time due to the fact that the relay equipment has large message processing burden to a certain extent.
Description
Technical Field
The present application belongs to the field of communications technologies, and in particular, to a link layer packet generation method, a link layer packet generation apparatus, a terminal device, and a computer-readable storage medium.
Background
At present, when a terminal device accesses the internet, message transmission needs to be performed between a relay device (such as a wireless router) and a server, and if a relay device through which a message to be communicated with the server needs to process more messages, the terminal device cannot acquire a response of the server for a long time due to a large message processing burden of the relay device, so that the network speed of a user accessing the internet is slow.
Disclosure of Invention
In view of this, the present application provides a link layer packet generating method, a link layer packet generating apparatus, a terminal device, and a computer-readable storage medium, which can solve the technical problem that a server response cannot be acquired by a terminal device for a long time due to a large packet processing burden of a relay device to a certain extent.
A first aspect of the present application provides a method for generating a link layer packet, including:
performing at a data link layer in a network communication system:
acquiring a network layer message to be packaged and a variable value of a preset variable corresponding to the network layer message;
judging whether the variable value of the preset variable is a preset value or not;
and if the preset value is the preset value, generating a link layer message encapsulated with the network layer message, wherein the priority of the link layer message is the highest priority defined in a communication protocol used by the link layer message.
A second aspect of the present application provides a link layer packet generating apparatus, including:
a message acquisition module, configured to execute at a data link layer in a network communication system: acquiring a network layer message to be packaged and a variable value of a preset variable corresponding to the network layer message;
a variable judgment module, configured to execute, at a data link layer in a network communication system: judging whether the variable value of the preset variable is a preset value or not;
a message generation module configured to execute at a data link layer in a network communication system: and if the preset value is the preset value, generating a link layer message encapsulated with the network layer message, wherein the priority of the link layer message is the highest priority defined in a communication protocol used by the link layer message.
A third aspect of the present application provides a terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to the first aspect when executing the computer program.
A fourth aspect of the present application provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method of the first aspect as described above.
A fifth aspect of the present application provides a computer program product comprising a computer program which, when executed by one or more processors, performs the steps of the method of the first aspect as described above.
From the above, the present application provides a method for generating a link layer packet, which executes the following steps at a data link layer of a network communication system: firstly, acquiring a network layer message to be packaged and a variable value of a preset variable corresponding to the network layer message; secondly, judging whether the variable value of the preset variable is a preset value, if so, generating a link layer message encapsulated with the network layer message, wherein the priority of the link layer message is the highest priority defined in a communication protocol used by the link layer message. Therefore, in the technical scheme provided by the application, the terminal device can generate the link layer message with higher priority, so that the relay device can preferentially process the link layer message when the link layer message with higher priority is sent to the relay device. Therefore, the technical scheme provided by the application can shorten the time for the terminal equipment to acquire the server response to a certain extent, so that the technical problem that the terminal equipment cannot acquire the server response for a long time due to large message processing burden of the relay equipment can be solved to a certain extent. In addition, in the technical solution provided by the present application, instead of setting the priority of a higher-layer message (such as a network layer message or a transport layer message) in a network communication system to the highest priority, the terminal device sets the priority of a message at a data link layer to the highest priority, which may cause the priority of the higher-layer message sent by the terminal device and received by a server for responding to the terminal device to be the default priority, and in general, in a configuration procedure of many servers, when the higher-layer message with a non-default priority is received, the server may execute some commands that are not desired by us (such as not responding to the terminal device sending the higher-layer message), therefore, in the technical solution provided by the present application, when the default priority of the higher-layer message sent by the terminal device is not the highest priority, since the terminal device does not forcibly change the priority of the higher layer packet from the default priority to the highest priority, the server receiving the higher layer packet does not execute some commands that we do not want because the priority of the higher layer packet is not the default priority. Therefore, the technical scheme provided by the application has strong compatibility to the server.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed for the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a schematic flow chart illustrating an implementation of a link layer packet generation method according to an embodiment of the present application;
fig. 2 is a schematic flow chart illustrating an implementation of another link layer packet generation method according to a second embodiment of the present application;
fig. 3 is a schematic structural diagram of a link layer packet generating device according to a third embodiment of the present application;
fig. 4 is a schematic structural diagram of a terminal device according to a fourth embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
The link layer message generation method provided by the embodiment of the present application is applicable to a terminal device, and illustratively, the terminal device includes but is not limited to: smart phones, palm computers, notebooks, desktop computers, intelligent wearable devices, and the like.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the present application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to a determination" or "in response to a detection". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
In addition, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not intended to indicate or imply relative importance.
In order to explain the technical solution described in the present application, the following description will be given by way of specific examples.
Example one
Referring to fig. 1, the method for generating a link layer packet in the first embodiment of the present application includes steps S101 to S103, where the steps S101 to S103 are executed when a terminal device runs a code corresponding to a data link layer.
In step S101, a network layer packet to be encapsulated and a variable value of a preset variable corresponding to the network layer packet are obtained;
in this embodiment of the present application, a network layer packet to be encapsulated may correspond to a preset variable, and before encapsulating the network layer packet, a terminal device first obtains the network layer packet to be encapsulated and a variable value of the preset variable corresponding to the network layer packet to be encapsulated, so that the terminal device can generate a link layer packet in which the network layer packet is encapsulated according to the variable value of the preset variable.
In general, the network layer packet to be encapsulated and some parameters associated with the network layer packet to be encapsulated are both stored in a sk _ buff data structure, and therefore, the step S101 may specifically be: and acquiring a network layer message to be encapsulated and a variable value of the preset variable corresponding to the network layer message from the sk _ buff data structure.
In addition, in this embodiment of the present application, not all network layer messages to be encapsulated need to have the preset variable, and therefore, the "obtaining a network layer message to be encapsulated and a variable value of the preset variable corresponding to the network layer message from the sk _ buff data structure" may include the following steps:
step A, obtaining the network layer message to be encapsulated from the sk _ buff data structure;
step B, judging whether the preset variable corresponding to the network layer message is stored in the sk _ buff data structure or not;
and C, if the preset variable corresponding to the network layer message is stored in the sk _ buff data structure, acquiring a variable value of the preset variable corresponding to the network layer message from the sk _ buff data structure.
In step S102, determining whether a variable value of the preset variable is a preset value;
after the variable value of the preset variable corresponding to the network layer packet to be encapsulated is obtained in step S101, it is determined whether the variable value of the preset variable is a preset value, and if so, the subsequent step S103 is executed.
In addition, if the network layer packet to be encapsulated obtained in step S101 does not correspond to the preset variable, or if the determination result in step S102 is that the variable value of the preset variable corresponding to the network layer packet to be encapsulated is not the preset value, the network layer packet obtained in step S101 may be encapsulated according to a mode specified by a communication protocol used in the current communication.
In step S103, if the value is the preset value, a link layer packet encapsulating the network layer packet is generated, where the priority of the link layer packet is the highest priority defined in the communication protocol used by the link layer packet;
if the determination result in the step S102 is positive, a link layer packet encapsulating the network layer packet is generated, where the priority of the link layer packet is the highest priority defined in the communication protocol used by the link layer packet. For example, if the field for indicating the priority of the link layer packet in the link layer packet is composed of 3-bit binary, and the communication protocol used by the link layer packet specifies that when the 3-bit binary is 111, the priority of the link layer packet is the highest, in the step S103, a link layer packet is generated, and the 3-bit binary in the link layer packet is 111.
Therefore, in the first embodiment of the present application, the terminal device may generate the link layer packet with a higher priority, so that when the link layer packet with the higher priority is sent to the relay device, the relay device may preferentially process the link layer packet. Therefore, the time for the terminal device to acquire the server response can be shortened to a certain extent, and the technical problem that the terminal device cannot acquire the server response for a long time due to large message processing burden of the relay device can be solved to a certain extent.
In addition, in order to solve the technical problem that the terminal device cannot acquire the server response for a long time due to a large message processing load of the relay device, the terminal device may also change the priority of the network layer message or the transport layer message to be sent.
For example, in general, the IP header of the network layer packet includes an 8-bit TOS (Type of Service) field, the upper 3 bits of the TOS field are priority subfields, so that the priority of the network layer packet can be set by using the upper 3 bits of the TOS field (the higher the value corresponding to the 3-bit binary system is, the higher the priority of the network layer packet is), in addition, the lowest bit of the TOS field must be set to 0, and the remaining 4 bits respectively represent from the upper bit to the lower bit: minimum delay, maximum throughput, minimum cost, and maximum reliability. Therefore, the terminal device may set the TOS field of the network layer packet to be transmitted to a value such as 11001000 (0Xc8) or 11110000 (0xf0) to increase the speed of the relay device for processing the network layer packet, so that the relay device preferentially processes the network layer packet, thereby solving the technical problem that the terminal device cannot acquire a server response for a long time due to a large packet processing burden of the relay device. In addition, there are many methods in the prior art to set the TOS field, for example, the following firewall command "iptables-t rule-a OUTPUT-p udp-dport 53-j TOS-set-TOS 0xc 8" can be configured at the terminal device to set the TOS field of the network layer packet with the target port number of 53 to 0xc 8.
Compared with the technical scheme that the priority of a higher layer message (such as a network layer message or a transmission layer message) is set to be a higher priority, the technical scheme provided by the first embodiment of the application has stronger server compatibility, and the specific reason is that: in general, in many configuration procedures of a server, when a higher-layer packet with a non-default priority is received, the server may execute some commands that we do not want (for example, does not respond to a terminal device that sends the higher-layer packet), and therefore, in the technical solution provided in this embodiment of the present application, when the default priority of the higher-layer packet sent by the terminal device is not the highest priority, since the terminal device does not forcibly change the priority of the higher-layer packet from the default priority to a higher priority, the server that receives the higher-layer packet may not execute some commands that we do not want because the priority of the higher-layer packet is not the default priority. Therefore, the technical scheme provided by the first embodiment of the application has strong compatibility with the server.
Example two
Referring to fig. 2, the link layer packet generating method in the second embodiment of the present application includes steps S201 to S206, where steps S201 to S203 are executed when the terminal device runs a code corresponding to a network layer, and steps S204 to S206 are executed when the terminal device runs a code corresponding to a data link layer.
In step S201, a target port number of a network layer packet to be encapsulated is obtained;
the target port number is used for indicating a receiver port of the network layer message to be encapsulated. In general, a network layer packet often includes a destination port number field, so that the destination port number of the network layer packet to be encapsulated can be directly obtained from the network layer packet to be encapsulated.
In step S202, determining whether a target port number of the network layer packet to be encapsulated is a preset port number;
in this embodiment of the present application, after the target port number corresponding to the network layer packet to be encapsulated is obtained, whether the target port number is a preset port number may be determined, and if the target port number is the preset port number, step S203 is executed.
In step S203, if the number is the preset port number, setting a variable value of a preset variable corresponding to the network layer packet to be encapsulated as a preset value;
if the determination result in step S202 is positive, the variable value of the preset variable corresponding to the network layer packet to be encapsulated is set as the preset value, and the following steps S204 to S206 are performed. If the determination result in the step S202 is negative, the preset variable corresponding to the network layer packet to be encapsulated may be set to another value besides the preset value, or the preset variable may not be corresponding to the network layer packet to be encapsulated.
In step S204, obtaining the network layer packet to be encapsulated and the variable value of the preset variable corresponding to the network layer packet to be encapsulated;
in step S205, it is determined whether the variable value of the preset variable is the preset value;
in step S206, if the value is the preset value, a link layer packet encapsulating the network layer packet is generated, where the priority of the link layer packet is the highest priority defined in the communication protocol used by the link layer packet;
the steps S204 to S206 are performed at the data link layer, and the performing manner is completely the same as that of the steps S101 to S103 in the first embodiment, which may be referred to specifically for the description of the first embodiment, and is not described herein again.
As can be seen by those skilled in the art, in the second embodiment of the present application, the priority of the link layer packet sent to the preset port number is set to be the highest priority. For example, in a general case, when a terminal device accesses the internet, it is necessary to first send a network layer packet for querying an IP address to a DNS server, and a destination port number of the network layer packet is 53, and assuming that a "preset port number" in the second embodiment of the present application is 53, a priority of a link layer packet for querying an IP address sent to the DNS server may be set to be a highest priority, so that the link layer packet can be preferentially processed by a relay device, and the terminal device can more quickly obtain the IP address to be queried.
In general, in a data link layer, a terminal device cannot acquire a target port number of a network layer message to be encapsulated, so that the target port number of the network layer message to be encapsulated must be acquired in the network layer, and when the target port number is a preset port number, a preset variable corresponding to the network layer message to be encapsulated is set to be a preset value, so that in the data link layer, the terminal device can determine whether to generate a link layer message with the highest priority by querying a value of the preset variable.
Furthermore, in the second embodiment of the present application, steps S201 to S203 in the second embodiment of the present application may be replaced with step D: and setting the variable value of the preset variable corresponding to the first target network layer message as the preset value, wherein the first target network layer message is a network layer message of which the target port number is the preset port number. For example, assuming that the preset variable is mark and the preset value is 0X800000, the following firewall instruction X may be configured in the terminal device to implement that "the mark value corresponding to the network layer packet with the target port number of 53 is set to 0X 800000", where the firewall instruction X is: iptables-t rule-A OUTPUT-p udp- -dport 53-j mark- -set-mark 0x 800000. That is, the firewall instruction X can be used to implement step D.
In addition, in the second embodiment of the present application, the terminal device may also perform the following step E or step F in the network layer:
step E: judging whether the source of the network layer message to be packaged is a preset application program or not; and if the network layer message is the preset application program, setting a variable value of a preset variable corresponding to the network layer message to be packaged as a preset value.
Step F is as follows: and setting the variable value of the preset variable corresponding to a second target network layer message as the preset value, wherein the second target network layer message is a network layer message of which the source is a preset application program.
That is, when the terminal device executes the code corresponding to the network layer, the following are implemented: the method comprises the steps that a preset variable corresponding to a network layer message from a preset application program (such as QQ) is set to be a preset value, so that the terminal device sets the priority of a link layer message corresponding to the network layer message to be the highest priority, the relay device can process the link layer message preferentially, and a user can acquire the response of a server about the application program more rapidly.
The second embodiment of the present application provides a technical solution in which the priority of a link layer packet sent to a preset port number is set to be the highest priority, so that a terminal device can more quickly obtain a response to some specific types of packets, for example, if the preset port number is 53, the terminal device can more quickly obtain an IP address to be queried. In addition, the second embodiment of the present application is the same as the first embodiment, and can solve the technical problem that the terminal device cannot acquire the server response for a long time due to a large message processing load of the relay device to a certain extent, and has strong compatibility with the server.
It should be understood that, the size of the serial number of each step in the foregoing method embodiments does not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
EXAMPLE III
For convenience of description, only the parts related to the present application are shown, and as shown in fig. 3, the link layer packet generating apparatus 300 includes:
a packet obtaining module 301, configured to execute, at a data link layer in a network communication system: acquiring a network layer message to be packaged and a variable value of a preset variable corresponding to the network layer message;
a variable judgment module 302, configured to perform, at a data link layer in a network communication system: judging whether the variable value of the preset variable is a preset value or not;
a message generating module 303, configured to execute, at a data link layer in the network communication system: and if the preset value is the preset value, generating a link layer message encapsulated with the network layer message, wherein the priority of the link layer message is the highest priority defined in a communication protocol used by the link layer message.
Optionally, the link layer packet generating device 300 further includes:
a port acquisition module for performing, at a network layer in a network communication system: acquiring a target port number of the network layer message to be encapsulated;
a port judgment module, configured to execute, at a network layer in a network communication system: judging whether the target port number of the network layer message to be packaged is a preset port number or not;
a first variable setting module for performing, at a network layer in a network communication system: and if the port judgment module judges that the target port number of the network layer message to be encapsulated is the upper set port number, setting the variable value of the preset variable corresponding to the network layer message to be encapsulated as the preset value.
Optionally, the link packet generating device 300 further includes:
a second variable setting module for performing, at a network layer in the network communication system: and setting the variable value of the preset variable corresponding to the first target network layer message as the preset value, wherein the first target network layer message is a network layer message of which the target port number is the preset port number.
Optionally, the link layer packet generating device 300 further includes:
a third variable setting module for performing, at a network layer in the network communication system: and setting the variable value of the preset variable corresponding to a second target network layer message as the preset value, wherein the second target network layer message is a network layer message of which the source is a preset application program.
Optionally, the message obtaining module 301 is specifically configured to: performing at a data link layer in a network communication system: and obtaining the network layer message to be encapsulated and the variable value of the preset variable corresponding to the network layer message from the sk _ buff data structure.
Optionally, the message obtaining module 301 includes:
a message obtaining unit, configured to obtain the network layer message to be encapsulated from a sk _ buff data structure;
a variable determining unit, configured to determine whether the preset variable corresponding to the network layer packet is stored in the sk _ buff data structure;
a variable obtaining unit, configured to obtain a variable value of the preset variable corresponding to the network layer packet from the sk _ buff data structure if the preset variable corresponding to the network layer packet is stored in the sk _ buff data structure.
It should be noted that, for the information interaction, execution process, and other contents between the above-mentioned devices/units, the specific functions and technical effects thereof are based on the same concept as those of the embodiment of the method of the present application, and specific reference may be made to the part of the embodiment of the method, which is not described herein again.
Example four
Fig. 4 is a schematic diagram of a terminal device according to a fourth embodiment of the present application. As shown in fig. 4, the terminal device 4 of this embodiment includes: a processor 40, a memory 41 and a computer program 42 stored in said memory 41 and executable on said processor 40. The processor 40 implements the steps of the various method embodiments described above, such as steps S101 to S103 shown in fig. 1, when executing the computer program 42. Alternatively, the processor 40, when executing the computer program 42, implements the functions of the modules/units in the device embodiments, such as the functions of the modules 301 to 303 shown in fig. 3.
Illustratively, the computer program 42 may be divided into one or more modules/units, which are stored in the memory 41 and executed by the processor 40 to complete the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program 42 in the terminal device 4. For example, the computer program 42 may be divided into a message acquisition module, a variable determination module, and a message generation module, and each module specifically functions as follows:
performing at a data link layer in a network communication system:
acquiring a network layer message to be packaged and a variable value of a preset variable corresponding to the network layer message;
judging whether the variable value of the preset variable is a preset value or not;
and if the preset value is the preset value, generating a link layer message encapsulated with the network layer message, wherein the priority of the link layer message is the highest priority defined in a communication protocol used by the link layer message.
The terminal device may include, but is not limited to, a processor 40 and a memory 41. Those skilled in the art will appreciate that fig. 4 is merely an example of a terminal device 4 and does not constitute a limitation of terminal device 4 and may include more or fewer components than shown, or some components may be combined, or different components, for example, the terminal device may also include input-output devices, network access devices, buses, etc.
The Processor 40 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 41 may be an internal storage unit of the terminal device 4, such as a hard disk or a memory of the terminal device 4. The memory 41 may be an external storage device of the terminal device 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like provided in the terminal device 4. Further, the memory 41 may include both an internal storage unit and an external storage device of the terminal device 4. The memory 41 is used for storing the computer program and other programs and data required by the terminal device. The above-mentioned memory 41 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned functions may be distributed as different functional units and modules according to needs, that is, the internal structure of the apparatus may be divided into different functional units or modules to implement all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the above modules or units is only one logical function division, and there may be other division manners in actual implementation, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units described above, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow in the method of the embodiments described above may be implemented by a computer program, which may be stored in a computer readable storage medium and used by a processor to implement the steps of the embodiments of the methods described above. The computer program includes computer program code, and the computer program code may be in a source code form, an object code form, an executable file or some intermediate form. The computer readable medium may include: any entity or device capable of carrying the above-mentioned computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signal, telecommunication signal, software distribution medium, etc. It should be noted that the computer readable medium described above may include content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media that does not include electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.
Claims (9)
1. A method for generating a link layer message is characterized by comprising the following steps:
performing at a data link layer in a network communication system:
acquiring a network layer message to be packaged and a variable value of a preset variable corresponding to the network layer message;
judging whether the variable value of the preset variable is a preset value or not;
if the link layer message is the preset value, generating a link layer message encapsulated with the network layer message, wherein the priority of the link layer message is the highest priority defined in a communication protocol used by the link layer message;
the acquiring of the variable values of the network layer message to be encapsulated and the preset variable corresponding to the network layer message includes:
and obtaining the network layer message to be packaged and the variable value of the preset variable corresponding to the network layer message from a sk _ buff data structure.
2. The link layer packet generation method according to claim 1, wherein the link layer packet generation method further comprises:
performing at a network layer in a network communication system:
acquiring a target port number of the network layer message to be packaged;
judging whether the target port number of the network layer message to be packaged is a preset port number or not;
and if the number is the preset port number, setting the variable value of the preset variable corresponding to the network layer message to be packaged as the preset value.
3. The link layer packet generation method according to claim 1, wherein the link layer packet generation method further comprises:
performing at a network layer in a network communication system:
and setting the variable value of the preset variable corresponding to the first target network layer message as the preset value, wherein the first target network layer message is a network layer message of which the target port number is the preset port number.
4. The link layer packet generation method according to claim 1, wherein the link layer packet generation method further comprises:
performing at a network layer in a network communication system:
and setting the variable value of the preset variable corresponding to a second target network layer message as the preset value, wherein the second target network layer message is a network layer message of which the source is a preset application program.
5. The method according to claim 4, wherein the obtaining the network layer packet to be encapsulated and the variable value of the preset variable corresponding to the network layer packet from the sk _ buff data structure includes:
acquiring the network layer message to be encapsulated from the sk _ buff data structure;
judging whether the preset variable corresponding to the network layer message is stored in the sk _ buff data structure or not;
if the preset variable corresponding to the network layer message is stored in the sk _ buff data structure, obtaining a variable value of the preset variable corresponding to the network layer message from the sk _ buff data structure.
6. A link layer packet generating apparatus, comprising:
a message acquisition module, configured to execute at a data link layer in a network communication system: acquiring a network layer message to be packaged and a variable value of a preset variable corresponding to the network layer message;
a variable judgment module, configured to execute, at a data link layer in a network communication system: judging whether the variable value of the preset variable is a preset value or not;
a message generation module configured to execute at a data link layer in a network communication system: if the variable judgment module judges that the variable value of the preset variable is the preset value, generating a link layer message encapsulated with the network layer message, wherein the priority of the link layer message is the highest priority defined in a communication protocol used by the link layer message;
the acquiring of the variable values of the network layer message to be encapsulated and the preset variable corresponding to the network layer message includes:
and obtaining the network layer message to be packaged and the variable value of the preset variable corresponding to the network layer message from a sk _ buff data structure.
7. The link layer packet generation apparatus of claim 6, wherein the link layer packet generation apparatus further comprises:
a port acquisition module for performing, at a network layer in a network communication system: acquiring a target port number of the network layer message to be packaged;
a port judgment module, configured to execute, at a network layer in a network communication system: judging whether the target port number of the network layer message to be packaged is a preset port number or not;
a first variable setting module for performing, at a network layer in a network communication system: if the port judgment module judges that the target port number of the network layer message to be packaged is the preset port number, the variable value of the preset variable corresponding to the network layer message to be packaged is set as the preset value.
8. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 5 when executing the computer program.
9. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811646854.1A CN109639555B (en) | 2018-12-29 | 2018-12-29 | Link layer message generation method, link layer message generation device and terminal equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811646854.1A CN109639555B (en) | 2018-12-29 | 2018-12-29 | Link layer message generation method, link layer message generation device and terminal equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109639555A CN109639555A (en) | 2019-04-16 |
CN109639555B true CN109639555B (en) | 2021-03-02 |
Family
ID=66054927
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811646854.1A Active CN109639555B (en) | 2018-12-29 | 2018-12-29 | Link layer message generation method, link layer message generation device and terminal equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109639555B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115334176B (en) * | 2022-07-27 | 2024-08-16 | 广州安凯微电子股份有限公司 | Data transmission method, apparatus, computer device, storage medium, and program product |
CN116192713B (en) * | 2023-02-21 | 2024-10-01 | 中银金融科技有限公司 | Message transmission link problem detection method, device, equipment and medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101132374A (en) * | 2006-10-09 | 2008-02-27 | 杭州华三通信技术有限公司 | Method and device for transmitting message |
CN101252534A (en) * | 2008-03-28 | 2008-08-27 | 清华大学 | Method for improving mobile self-organizing network communication capacity through link layer message combination |
CN101997871A (en) * | 2010-09-21 | 2011-03-30 | 电子科技大学 | Device for quickly capturing, filtering and forwarding data |
CN105981318A (en) * | 2014-12-10 | 2016-09-28 | Lg电子株式会社 | Broadcast signal transmission apparatus, broadcast signal receiving apparatus, broadcast signal transmission method, and broadcast signal receiving method |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10212215B2 (en) * | 2014-02-11 | 2019-02-19 | Samsung Electronics Co., Ltd. | Apparatus and method for providing metadata with network traffic |
-
2018
- 2018-12-29 CN CN201811646854.1A patent/CN109639555B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101132374A (en) * | 2006-10-09 | 2008-02-27 | 杭州华三通信技术有限公司 | Method and device for transmitting message |
CN101252534A (en) * | 2008-03-28 | 2008-08-27 | 清华大学 | Method for improving mobile self-organizing network communication capacity through link layer message combination |
CN101997871A (en) * | 2010-09-21 | 2011-03-30 | 电子科技大学 | Device for quickly capturing, filtering and forwarding data |
CN105981318A (en) * | 2014-12-10 | 2016-09-28 | Lg电子株式会社 | Broadcast signal transmission apparatus, broadcast signal receiving apparatus, broadcast signal transmission method, and broadcast signal receiving method |
Non-Patent Citations (1)
Title |
---|
"高速网络环境下基于零拷贝的报文捕获机制研究与实现";杜英明;《中国优秀硕士学位论文全文数据库-信息科技辑》;20090715;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN109639555A (en) | 2019-04-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106850402B (en) | Message transmission method and device | |
WO2020052605A1 (en) | Network slice selection method and device | |
US20070070904A1 (en) | Feedback mechanism for flexible load balancing in a flow-based processor affinity scheme | |
CN108616927B (en) | Data sending and receiving method and device | |
CN109586962B (en) | Device and method for processing HTTPS (hypertext transfer protocol secure) outer chain problem of upgrading IPv4 to IPv6 and electronic equipment | |
CN112152940B (en) | Message processing method, device and system | |
CN109561395A (en) | A kind of blue-tooth transmission method and device | |
CN109639555B (en) | Link layer message generation method, link layer message generation device and terminal equipment | |
CN111431871A (en) | Processing method and device of TCP (Transmission control protocol) semi-transparent proxy | |
CN114070755B (en) | Virtual machine network flow determination method and device, electronic equipment and storage medium | |
CN110191200A (en) | Network Access Method, device, electronic equipment and computer-readable medium | |
CN110519388B (en) | Processing method and device for block chain request, electronic equipment and readable storage medium | |
CN107968848A (en) | A kind of method, terminal device and storage medium for obtaining IP address | |
US20230300720A1 (en) | Network distribution method and apparatus | |
CN115208836A (en) | Data packet processing method, device, equipment and computer readable storage medium | |
CN113438169A (en) | Data scheduling method, electronic equipment and storage medium | |
CN113986969A (en) | Data processing method and device, electronic equipment and storage medium | |
CN112019492B (en) | Access control method, device and storage medium | |
CN112422485B (en) | Communication method and device of transmission control protocol | |
CN115442177B (en) | Data communication method and device of CAN (controller area network) | |
CN113965367B (en) | Policy object upper limit control method, system, computer and storage medium | |
CN105915639B (en) | Page access method and device | |
JP2011091711A (en) | Node, method for distributing transmission frame, and program | |
KR101794200B1 (en) | Method for transmitting and receiving protocol packet using packet processor based LINUX in distributed packet transport network | |
CN110288356B (en) | Payment service processing method, device, electronic equipment, storage medium and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |