CN116436994B - Profinet protocol message transmission method, device, equipment and medium - Google Patents

Profinet protocol message transmission method, device, equipment and medium Download PDF

Info

Publication number
CN116436994B
CN116436994B CN202310706944.XA CN202310706944A CN116436994B CN 116436994 B CN116436994 B CN 116436994B CN 202310706944 A CN202310706944 A CN 202310706944A CN 116436994 B CN116436994 B CN 116436994B
Authority
CN
China
Prior art keywords
protocol message
profinet protocol
profinet
mac address
received
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
Application number
CN202310706944.XA
Other languages
Chinese (zh)
Other versions
CN116436994A (en
Inventor
吴伟
张宇
黄进忠
李政镖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hexin Semiconductor Co ltd
Original Assignee
Hangzhou Hexin Semiconductor Co ltd
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 Hangzhou Hexin Semiconductor Co ltd filed Critical Hangzhou Hexin Semiconductor Co ltd
Priority to CN202310706944.XA priority Critical patent/CN116436994B/en
Publication of CN116436994A publication Critical patent/CN116436994A/en
Application granted granted Critical
Publication of CN116436994B publication Critical patent/CN116436994B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Communication Control (AREA)

Abstract

The application discloses a Profinet protocol message transmission method, a device, equipment and a medium, which relate to the technical field of communication and comprise the following steps: when the fact that the to-be-received Profinet protocol message and/or the to-be-transmitted Profinet protocol message exist in the target equipment is monitored, protocol type judgment is carried out on the Profinet protocol message through the Profinet protocol message transmitting/receiving module, corresponding Profinet protocol message transmission steps are carried out according to judgment results, data transmission among different target equipment is achieved, a message transmission module is constructed in a mode that protocol message receiving processing flow and protocol message transmitting processing flow are added to each target equipment, an exchanger or an exchange chip is replaced, data communication among different node equipment can be achieved without an external exchanger or an exchange chip in the whole communication process, and complexity and cost expenditure of networking of an industrial field are remarkably reduced.

Description

Profinet protocol message transmission method, device, equipment and medium
Technical Field
The present application relates to the field of communications technologies, and in particular, to a Profinet protocol packet transmission method, device, equipment, and medium.
Background
The Profinet protocol is increasingly fireblasted in the industrial network market. In general, in the star network topology of Profinet, a switch is used to implement mapping between a physical port and a logical port, as shown in fig. 1, that is, the node device does not need to care about the position of the other party in the network in communication, and the switch can perform corresponding identification on the node device connected to itself, and perform memorizing and identifying through the physical address of the network card of each device. Under such premise, broadcast searching is not needed any more, but the memorized MAC address can be directly found out to the corresponding node and the communication of data transmission between two nodes without external interference is completed through a temporary special data transmission channel, but the mode needs to be supported by an independent switch. As shown in fig. 2, in the other linear network topology, although the problem of complicated wiring of the star network topology is solved, there is no significant improvement in terms of cost due to the necessity of adding an ethernet switching chip to each device.
In summary, how to solve the dependence of Profinet devices in network topology on ethernet switches or ethernet switch chips, saving cost, and achieving convenient and simple wiring is a technical problem to be solved in the field.
Disclosure of Invention
Accordingly, the present application aims to provide a Profinet protocol message transmission method, device, equipment and medium, which can solve the problem that Profinet equipment in network topology depends on an ethernet switch or an ethernet switch chip, save cost, and realize convenient and simple wiring. The specific scheme is as follows:
in a first aspect, the application discloses a Profinet protocol message transmission method, which comprises the following steps:
when the fact that a to-be-received Profinet protocol message and/or a to-be-sent Profinet protocol message exists in target equipment is detected, detecting whether the to-be-received Profinet protocol message and/or the to-be-sent Profinet protocol message is a link layer discovery protocol or not;
if yes, analyzing the Profinet protocol message to be received and storing the Profinet protocol message in a management information base of a target receiving network port corresponding to the Profinet protocol message to be received, and/or determining a first target sending network port for sending the Profinet protocol message to be sent according to a source MAC address in the Profinet protocol message to be sent;
if not, determining an MAC address table of a receiving network port for receiving the to-be-received Profinet protocol message, and jumping to execute the step of monitoring whether the to-be-received Profinet protocol message exists in the target equipment and/or determining a second target sending network port for sending the to-be-sent Profinet protocol message based on a target MAC address in the to-be-sent Profinet protocol message and the MAC address tables of all network ports.
Optionally, after determining that the MAC address table of the receiving network port of the Profinet protocol packet to be received is received, if not, the method further includes:
judging whether the MAC address table of the receiving network port has the MAC address of the transmitting equipment or not;
if not, the MAC address of the sending equipment is stored in the MAC address table of the receiving network port;
if so, checking whether the MAC address of the sending equipment exists in the MAC address tables of other network ports except the receiving network port.
Optionally, after checking whether the MAC address of the sending device exists in the MAC address tables of the other network ports except the receiving network port, the method further includes:
if not, the to-be-received Profinet protocol message is sent to a Profinet protocol stack for processing;
if the network port exists, deleting the MAC address of the transmitting equipment recorded in the MAC address tables of the other network ports, and updating the MAC address tables of the other network ports.
Optionally, when it is detected that the Profinet protocol message to be sent exists in the target device, detecting whether the Profinet protocol message to be sent is a link layer discovery protocol includes:
and inquiring a Profinet protocol stack in the target equipment until the fact that the to-be-transmitted Profinet protocol message exists in the target equipment is inquired, and detecting whether the to-be-transmitted Profinet protocol message is a link layer discovery protocol or not.
Optionally, if not, determining, based on the destination MAC address in the Profinet protocol packet to be sent and the MAC address table of each network port, a second target sending network port for sending the Profinet protocol packet to be sent, including:
if not, respectively matching whether the target MAC address in the to-be-transmitted Profinet protocol message is matched with the MAC address recorded in the MAC address table of each network port, and acquiring a corresponding matching result;
and if the matching result is that the matching is failed, using all network ports as second target transmission network ports to transmit the to-be-transmitted Profinet protocol message.
Optionally, after the obtaining the corresponding matching result, the method further includes:
and if the matching result is that the matching is successful, using the network port successfully matched as a second target sending network port to send the Profinet protocol message to be sent.
Optionally, before the step of detecting that the Profinet protocol message to be received and/or the Profinet protocol message to be sent exist in the target device, the method further includes:
initializing target equipment and establishing a MAC address table of each network port in the target equipment.
In a second aspect, the present application discloses a Profinet protocol message transmission device, which includes:
the protocol detection module is used for detecting whether the to-be-received Profinet protocol message and/or the to-be-sent Profinet protocol message is a link layer discovery protocol or not when the to-be-received Profinet protocol message and/or the to-be-sent Profinet protocol message exist in the target equipment;
the first protocol processing module is used for analyzing the to-be-received Profinet protocol message and storing the to-be-received Profinet protocol message in a management information base of a target receiving network port corresponding to the to-be-received Profinet protocol message and/or determining a first target sending network port for sending the to-be-sent Profinet protocol message according to a source MAC address in the to-be-sent Profinet protocol message;
and the second protocol processing module is used for determining an MAC address table of a receiving network port for receiving the Profinet protocol message to be received, and performing the step of monitoring whether the Profinet protocol message to be received exists in the target equipment or not in a jumping mode, and/or determining a second target sending network port for sending the Profinet protocol message to be sent based on a target MAC address in the Profinet protocol message to be sent and the MAC address table of each network port.
In a third aspect, the present application discloses an electronic device, comprising:
a memory for storing a computer program;
and a processor for executing the computer program to implement the steps of the Profinet protocol message transmission method disclosed in the foregoing.
In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein the computer program when executed by a processor implements the steps of the previously disclosed Profinet protocol message transmission method.
The application discloses a Profinet protocol message transmission method, which comprises the following steps: when the fact that a to-be-received Profinet protocol message and/or a to-be-sent Profinet protocol message exists in target equipment is detected, detecting whether the to-be-received Profinet protocol message and/or the to-be-sent Profinet protocol message is a link layer discovery protocol or not; if yes, analyzing the Profinet protocol message to be received and storing the Profinet protocol message in a management information base of a target receiving network port corresponding to the Profinet protocol message to be received, and/or determining a first target sending network port for sending the Profinet protocol message to be sent according to a source MAC address in the Profinet protocol message to be sent; if not, determining an MAC address table of a receiving network port for receiving the to-be-received Profinet protocol message, and jumping to execute the step of monitoring whether the to-be-received Profinet protocol message exists in the target equipment and/or determining a second target sending network port for sending the to-be-sent Profinet protocol message based on a target MAC address in the to-be-sent Profinet protocol message and the MAC address tables of all network ports. Therefore, the Profinet protocol message transmission module is constructed by adding the Profinet protocol message receiving processing flow and the Profinet protocol message sending processing flow in each target device to replace a switch or a switch chip, so that the whole communication process does not need to be externally connected with the switch or the switch chip, data communication among different node devices can be realized, and the networking complexity and the cost expenditure of an industrial field are obviously reduced.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present application, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a diagram of a topology of a star network as disclosed in the prior art;
FIG. 2 is a diagram of a topology of a linear network as disclosed in the prior art;
fig. 3 is a flowchart of a Profinet protocol message transmission method disclosed in the present application;
FIG. 4 is a schematic diagram of a port-to-network connection according to the present disclosure;
fig. 5 is a block diagram of a Profinet protocol message transmission system disclosed in the present application;
fig. 6 is a flowchart of a Profinet protocol message receiving process disclosed in the present application;
fig. 7 is a flowchart of a specific Profinet protocol message transmission method disclosed in the present application;
fig. 8 is a flowchart of a Profinet protocol message sending process disclosed in the present application;
fig. 9 is a schematic structural diagram of a Profinet protocol packet transmission device according to the present application;
fig. 10 is a block diagram of an electronic device according to the present disclosure.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The Profinet protocol is increasingly fireblasted in the industrial network market. In general, in the star network topology of Profinet, a switch is used to implement mapping between a physical port and a logical port, as shown in fig. 1, that is, the node device does not need to care about the position of the other party in the network in communication, and the switch can perform corresponding identification on the node device connected to itself, and perform memorizing and identifying through the physical address of the network card of each device. Under such premise, broadcast searching is not needed any more, but the memorized MAC address can be directly found out to the corresponding node and the communication of data transmission between two nodes without external interference is completed through a temporary special data transmission channel, but the mode needs to be supported by an independent switch. As shown in fig. 2, in the other linear network topology, although the problem of complicated wiring of the star network topology is solved, there is no significant improvement in terms of cost due to the necessity of adding an ethernet switching chip to each device.
Therefore, the application provides a Profinet protocol message transmission scheme, which can solve the problem that Profinet equipment in network topology depends on an Ethernet switch or an Ethernet switch chip, saves cost and is convenient and simple to realize.
Referring to fig. 3, the embodiment of the application discloses a Profinet protocol message transmission method, which comprises the following steps:
step S11: and detecting whether the to-be-received Profinet protocol message and/or the to-be-sent Profinet protocol message is a link layer discovery protocol or not when the to-be-received Profinet protocol message and/or the to-be-sent Profinet protocol message exists in the target equipment.
In this embodiment, taking se:Sub>A target device in se:Sub>A linear network topology chart as an example, se:Sub>A Profinet protocol message receiving/sending module is set in the target device, se:Sub>A Profinet protocol message to be received and se:Sub>A Profinet protocol message to be sent in the target device are subjected to corresponding message monitoring and message processing by se:Sub>A Profinet protocol message transmission system including the Profinet protocol message receiving/sending module, so that the corresponding relation between the target device and each network port is realized by the Profinet protocol message transmission system, and the requirement of se:Sub>A Profinet consistency level CC-B is met on the premise of no need of se:Sub>A switch or se:Sub>A switch chip, wherein the Profinet IO consistency level (Conformance Class, CC) prescribes which functions and some optional functions the target device must have, and is se:Sub>A standard for authentication of the Profinet IO, and CC-A refers to se:Sub>A Profinet IO basic function for providing integrated real-time communication; CC-B refers to providing network diagnostic and management functions based on CC-A. For example: as shown in fig. 4, a management port X1, a network port X1P 1, and a network port X1P 2 are defined. The three interfaces are respectively provided with independent MAC addresses, and then a Profinet message receiving/transmitting processing module is added between a standard Profinet protocol stack and a physical network port, and the module can realize the corresponding relation between a management port X1 and the network ports X1P 1 and X1P 2 in the figure. Therefore, when the Profinet protocol message receiving/transmitting module detects that the Profinet protocol message to be received and/or the Profinet protocol message to be transmitted exist, the message detection is performed on the Profinet protocol message to be received and/or the Profinet protocol message to be transmitted respectively, and whether the Profinet protocol message to be received and/or the Profinet protocol message to be transmitted is a link layer discovery protocol, namely an LLDP protocol is detected.
Referring to fig. 5, the constructed Profinet protocol message transmission system specifically includes four modules: the system comprises a Profinet protocol stack, a Profinet message receiving/transmitting processing module, a network port driver and a physical network port, wherein the Profinet protocol stack is responsible for carrying out corresponding processing on the received Profinet protocol message or generating the Profinet protocol message to be transmitted aiming at other target devices; the Profinet message receiving/sending processing module is responsible for classifying received Profinet protocol messages to be processed, determining which network port the Profinet protocol messages to be processed need to be transmitted to the Profinet protocol stack, and avoiding excessive or too little of the Profinet protocol messages to be processed queued by the Profinet protocol stack; and each physical network port can be coordinated and mobilized by the network port drive according to the related instructions of the Profinet message receiving/transmitting processing module. In addition, in a more complex industrial field, the Profinet protocol message transmission system can be used not only in the online networking but also in a branch of the tree-shaped or star-shaped networking.
In this embodiment, after the Profinet protocol packet transmission system of the target device is set up, it is monitored whether there is a Profinet protocol packet to be received and/or a Profinet protocol packet to be sent in the target device, where in the monitoring process, the following results may be monitored: the method comprises the steps of not monitoring a Profinet protocol message to be received or a Profinet protocol message to be sent, simultaneously monitoring the Profinet protocol message to be received and the Profinet protocol message to be sent, monitoring the existence of the Profinet protocol message to be received, not monitoring the Profinet protocol message to be sent and the Profinet protocol message to be received, and monitoring the existence of the Profinet protocol message to be sent.
In this embodiment, before detecting that there is a Profinet protocol packet to be received and/or a Profinet protocol packet to be sent in the target device, the method further includes: initializing target equipment and establishing a MAC address table of each network port in the target equipment. It can be understood that before the Profinet protocol message receiving/transmitting module is used to process the Profinet protocol message to be received and/or the Profinet protocol message to be transmitted in the target device, the target device is initialized first, and when the target device is initialized, the target device establishes the MAC address table of each network port in the device, and the MAC address tables correspond to the network port X1P 1 and the network port X2P 2 respectively. Each network port's own MAC address table can store a plurality of MAC addresses.
Step S12: if yes, analyzing the Profinet protocol message to be received, storing the Profinet protocol message to be received in a management information base of a target receiving network port corresponding to the Profinet protocol message to be received, and/or determining a first target sending network port for sending the Profinet protocol message to be sent according to a source MAC address in the Profinet protocol message to be sent.
In this embodiment, if it is detected that the Profinet protocol message to be received is an LLDP protocol message, the Profinet protocol message to be received is stored in a mib information base of a corresponding target receiving network port that receives the Profinet protocol message. If the Profinet protocol message to be sent is detected to be the LLDP protocol message, finding out a network port corresponding to a source MAC address contained in the Profinet protocol message to be sent from all network ports of the target equipment as a first target sending network port, so that the first target sending network port is used for sending the Profinet protocol message to be sent to other target equipment.
Step S13: if not, determining an MAC address table of a receiving network port for receiving the to-be-received Profinet protocol message, and jumping to execute the step of monitoring whether the to-be-received Profinet protocol message exists in the target equipment and/or determining a second target sending network port for sending the to-be-sent Profinet protocol message based on a target MAC address in the to-be-sent Profinet protocol message and the MAC address tables of all network ports.
In this embodiment, if the Profinet protocol message to be received is not the LLDP protocol, determining a receiving network port of the target device for receiving the Profinet protocol message to be received, acquiring an MAC address table of the receiving network port, recording an MAC address of a sender of the Profinet protocol message to be received in the MAC address table of the receiving network port, updating the MAC address table of the receiving network port, so that when the target device processes the Profinet protocol message to be received and generates the Profinet protocol message to be sent, the MAC address of the original sender can be determined from the MAC address table of the original receiving network port, so that the original receiving network port is used as a sending network port, sending the Profinet protocol message to be sent to the original sender, and feeding back a corresponding processing result to the original sender. And after updating the MAC address table of the receiving network port, jumping to the step of monitoring whether the to-be-received Profinet protocol message exists in the target equipment. When a to-be-transmitted Profinet protocol message is prepared to be transmitted in target equipment, if the to-be-transmitted Profinet protocol message is not an LLDP message, a destination MAC address contained in the to-be-transmitted Profinet protocol message is obtained, an MAC address table for recording the destination MAC address is determined from MAC address tables of all network ports contained in the target equipment, and the network port corresponding to the MAC address table is used as a second target transmission network port for transmitting the to-be-transmitted Profinet protocol message.
In this embodiment, after determining that the MAC address table of the receiving portal of the Profinet protocol packet to be received is received, if not, the method further includes: judging whether the MAC address table of the receiving network port has the MAC address of the transmitting equipment or not; if not, the MAC address of the sending equipment is stored in the MAC address table of the receiving network port; if so, checking whether the MAC address of the sending equipment exists in the MAC address tables of other network ports except the receiving network port. It can be understood that, as shown in fig. 6, after determining the MAC address table of the receiving network port to receive the Profinet protocol packet, it is determined whether the MAC address table has the MAC address of the transmitting device, if not, the MAC address of the transmitting device is stored in the MAC address table of the receiving network port, and if the MAC address of the transmitting device is present in the MAC address table, it is immediately checked whether the MAC address of the transmitting device is present in the MAC address tables of other receiving network ports except the interface network port.
After checking whether the MAC address of the transmitting device exists in the MAC address tables of other network ports except the receiving network port, the method further includes: if not, the to-be-received Profinet protocol message is sent to a Profinet protocol stack for processing; if the network port exists, deleting the MAC address of the transmitting equipment recorded in the MAC address tables of the other network ports, and updating the MAC address tables of the other network ports. It can be understood that, referring to fig. 6, after checking whether the MAC address of the sending device exists in other receiving network ports, based on the checking result, a corresponding processing mode is further selected to process the Profinet protocol message to be received and the related information thereof, specifically, when checking that the MAC address of the sending device does not exist in the MAC address tables of the other network ports except the receiving network port, the Profinet protocol message to be received is directly submitted to the Profinet protocol stack to be processed; if the MAC address of the transmitting equipment exists in the MAC address tables of other receiving network ports, deleting the MAC address of the transmitting equipment recorded in the MAC address tables of other network ports, and updating the MAC address tables of other network ports at the same time, so that the MAC address of the transmitting equipment exists only in the MAC address tables of the receiving network ports, and the consistency of information transmission is ensured.
The application discloses a Profinet protocol message transmission method, which comprises the following steps: when the fact that a to-be-received Profinet protocol message and/or a to-be-sent Profinet protocol message exists in target equipment is detected, detecting whether the to-be-received Profinet protocol message and/or the to-be-sent Profinet protocol message is a link layer discovery protocol or not; if yes, analyzing the Profinet protocol message to be received and storing the Profinet protocol message in a management information base of a target receiving network port corresponding to the Profinet protocol message to be received, and/or determining a first target sending network port for sending the Profinet protocol message to be sent according to a source MAC address in the Profinet protocol message to be sent; if not, determining an MAC address table of a receiving network port for receiving the to-be-received Profinet protocol message, and jumping to execute the step of monitoring whether the to-be-received Profinet protocol message exists in the target equipment and/or determining a second target sending network port for sending the to-be-sent Profinet protocol message based on a target MAC address in the to-be-sent Profinet protocol message and the MAC address tables of all network ports. Therefore, the Profinet protocol message transmission module is constructed by adding the Profinet protocol message receiving processing flow and the Profinet protocol message sending processing flow in each target device to replace a switch or a switch chip, so that the whole communication process does not need to be externally connected with the switch or the switch chip, data communication among different node devices can be realized, and the networking complexity and the cost expenditure of an industrial field are obviously reduced.
Referring to fig. 7, the embodiment of the application discloses a specific Profinet protocol message transmission method, and compared with the previous embodiment, the embodiment further describes and optimizes the technical scheme. Specific:
step S21: and inquiring a Profinet protocol stack in target equipment, and detecting whether the Profinet protocol message to be sent is a link layer discovery protocol or not until the fact that the Profinet protocol message to be sent exists in the target equipment is inquired.
Step S22: if yes, determining a first target sending network port for sending the Profinet protocol message to be sent according to the source MAC address in the Profinet protocol message to be sent.
In this embodiment, referring to fig. 8, if the Profinet protocol packet to be sent is a link layer discovery protocol, that is, an LLDP protocol, a source MAC address included in the Profinet protocol packet to be sent is directly found, a corresponding network port is directly determined according to the source MAC address as a first target sending network port, and then the Profinet protocol packet to be sent is directly sent to other target devices through the first target sending network port.
Step S23: if not, respectively matching whether the target MAC address in the to-be-transmitted Profinet protocol message is matched with the MAC address recorded in the MAC address table of each network port, and acquiring a corresponding matching result.
In this embodiment, if the Profinet protocol packet to be sent is not the LLDP protocol, it is required to find out whether the destination MAC address in the packet exists in the MAC address table of a certain network port, that is, match the MAC address recorded in the MAC address table of each network port with the destination MAC address, so as to obtain a matching result of each network port and the destination MAC address.
Step S24: if the matching result is that the matching fails, all network ports are used as second target transmission network ports to transmit the to-be-transmitted Profinet protocol message
In this embodiment, if the matching between the destination MAC address and all the network ports fails, that is, the MAC address table of each network port has no destination MAC address recorded, it indicates that other target devices corresponding to the destination MAC address communicate with the target device for the first time, and all the network ports are used as second target sending network ports, and the Profinet protocol message to be sent is sent in a broadcast or other form, so that the destination MAC address can receive the protocol message.
Step S25: and if the matching result is that the matching is successful, using the network port successfully matched as a second target sending network port to send the Profinet protocol message to be sent.
In this embodiment, if the matching result is that the matching is successful, it indicates that the MAC address table with the network port includes the destination MAC address, and correspondingly, the network port is used as the second target network port, and the Profinet protocol message to be sent is sent through the second target network port. And then jumping to query the Profinet protocol stack, and continuing to execute the steps.
Therefore, through the transmission processing flow of the to-be-transmitted Profinet protocol message, the fact that the to-be-transmitted Profinet protocol message can be accurately matched with each network port through the transmission processing module of the Profinet protocol message is found, data transmission between different target devices can be achieved without a switch or a switch chip, complexity and cost expenditure of industrial field networking can be remarkably reduced, and the line topology structure formed by different target devices is simple, field installation is easy, and transmission lines are short.
Referring to fig. 9, the embodiment of the application also correspondingly discloses a Profinet protocol message transmission device, which comprises:
the protocol detection module 11 is configured to detect, when it is detected that a Profinet protocol packet to be received and/or a Profinet protocol packet to be sent exist in a target device, whether the Profinet protocol packet to be received and/or the Profinet protocol packet to be sent is a link layer discovery protocol;
the first protocol processing module 12 is configured to, if yes, parse the Profinet protocol packet to be received and store the parsed Profinet protocol packet in a management information base of a target receiving network port corresponding to the Profinet protocol packet to be received and/or determine a first target sending network port for sending the Profinet protocol packet to be sent according to a source MAC address in the Profinet protocol packet to be sent;
and the second protocol processing module 13 is configured to determine, if not, a MAC address table of a receiving network port that receives the Profinet protocol packet to be received, and skip and execute a step of monitoring whether the Profinet protocol packet to be received exists in the target device, and/or determine, based on a destination MAC address in the Profinet protocol packet to be sent and the MAC address tables of the network ports, a second target sending network port that is used for sending the Profinet protocol packet to be sent.
The application discloses that when the fact that the to-be-received Profinet protocol message and/or the to-be-sent Profinet protocol message exist in the target equipment is detected, whether the to-be-received Profinet protocol message and/or the to-be-sent Profinet protocol message is a link layer discovery protocol or not is detected; if yes, analyzing the Profinet protocol message to be received and storing the Profinet protocol message in a management information base of a target receiving network port corresponding to the Profinet protocol message to be received, and/or determining a first target sending network port for sending the Profinet protocol message to be sent according to a source MAC address in the Profinet protocol message to be sent; if not, determining an MAC address table of a receiving network port for receiving the to-be-received Profinet protocol message, and jumping to execute the step of monitoring whether the to-be-received Profinet protocol message exists in the target equipment and/or determining a second target sending network port for sending the to-be-sent Profinet protocol message based on a target MAC address in the to-be-sent Profinet protocol message and the MAC address tables of all network ports. Therefore, the Profinet protocol message transmission module is constructed by adding the Profinet protocol message receiving processing flow and the Profinet protocol message sending processing flow in each target device to replace a switch or a switch chip, so that the whole communication process does not need to be externally connected with the switch or the switch chip, data communication among different node devices can be realized, and the networking complexity and the cost expenditure of an industrial field are obviously reduced.
Further, the embodiment of the present application further discloses an electronic device, and fig. 10 is a block diagram of an electronic device 20 according to an exemplary embodiment, where the content of the diagram is not to be considered as any limitation on the scope of use of the present application.
Fig. 10 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input output interface 25, and a communication bus 26. The memory 22 is configured to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the Profinet protocol message transmission method disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in the present embodiment may be specifically an electronic computer.
In this embodiment, the power supply 23 is configured to provide an operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and the communication protocol to be followed is any communication protocol applicable to the technical solution of the present application, which is not specifically limited herein; the input/output interface 25 is used for acquiring external input data or outputting external output data, and the specific interface type thereof may be selected according to the specific application requirement, which is not limited herein.
Processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 may be implemented in at least one hardware form of DSP (Digital Signal Processing ), FPGA (Field-Programmable Gate Array, field programmable gate array), PLA (Programmable Logic Array ). The processor 21 may also comprise a main processor, which is a processor for processing data in an awake state, also called CPU (Central Processing Unit ); a coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 21 may integrate a GPU (Graphics Processing Unit, image processor) for rendering and drawing of content required to be displayed by the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence ) processor for processing computing operations related to machine learning.
The memory 22 may be a carrier for storing resources, such as a read-only memory, a random access memory, a magnetic disk, or an optical disk, and the resources stored thereon may include an operating system 221, a computer program 222, and the like, and the storage may be temporary storage or permanent storage.
The operating system 221 is used for managing and controlling various hardware devices on the electronic device 20 and the computer program 222, so as to implement the operation and processing of the processor 21 on the mass data 223 in the memory 22, which may be Windows Server, netware, unix, linux, etc. The computer program 222 may further comprise a computer program capable of performing other specific tasks in addition to the computer program capable of performing the Profinet protocol messaging method performed by the electronic device 20 as disclosed in any of the previous embodiments. The data 223 may include, in addition to data received by the electronic device and transmitted by the external device, data collected by the input/output interface 25 itself, and so on.
Further, the application also discloses a computer readable storage medium for storing a computer program; wherein the computer program, when executed by the processor, implements the previously disclosed Profinet protocol message transmission method. For specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, and no further description is given here.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. 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. The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above detailed description of the method, the device, the equipment and the medium for transmitting Profinet protocol messages provided by the application applies specific examples to illustrate the principle and the implementation of the application, and the description of the above examples is only used for helping to understand the method and the core idea of the application; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.

Claims (10)

1. The Profinet protocol message transmission method is characterized by comprising the following steps:
when the fact that a to-be-received Profinet protocol message and/or a to-be-sent Profinet protocol message exists in target equipment is detected, detecting whether the to-be-received Profinet protocol message and/or the to-be-sent Profinet protocol message is a link layer discovery protocol or not;
if yes, analyzing the Profinet protocol message to be received and storing the Profinet protocol message in a management information base of a target receiving network port corresponding to the Profinet protocol message to be received, and/or determining a first target sending network port for sending the Profinet protocol message to be sent according to a source MAC address in the Profinet protocol message to be sent;
if not, determining an MAC address table of a receiving network port for receiving the to-be-received Profinet protocol message, and skipping to execute the step of monitoring whether the to-be-received Profinet protocol message exists in target equipment and/or determining a second target sending network port for sending the to-be-sent Profinet protocol message based on a target MAC address in the to-be-sent Profinet protocol message and the MAC address tables of all network ports;
before the fact that the Profinet protocol message to be received and/or the Profinet protocol message to be sent exists in the target device is monitored, the method further comprises the following steps:
and setting a Profinet protocol message receiving/transmitting module in the target equipment so as to utilize the Profinet protocol message receiving/transmitting module to perform corresponding message monitoring and message processing on the Profinet protocol message to be received and/or the Profinet protocol message to be transmitted.
2. The Profinet protocol message transmission method according to claim 1, wherein after determining that the MAC address table of the receiving network port of the Profinet protocol message to be received is received if not, further comprises:
judging whether the MAC address table of the receiving network port has the MAC address of the transmitting equipment or not;
if not, the MAC address of the sending equipment is stored in the MAC address table of the receiving network port;
if so, checking whether the MAC address of the sending equipment exists in the MAC address tables of other network ports except the receiving network port.
3. The Profinet protocol message transmission method according to claim 2, wherein after checking whether the MAC address of the transmitting device exists in the MAC address table of the other network port except the receiving network port, further comprising:
if not, the to-be-received Profinet protocol message is sent to a Profinet protocol stack for processing;
if the network port exists, deleting the MAC address of the transmitting equipment recorded in the MAC address tables of the other network ports, and updating the MAC address tables of the other network ports.
4. The Profinet protocol message transmission method according to claim 1, wherein when it is detected that there is a Profinet protocol message to be transmitted in the target device, detecting whether the Profinet protocol message to be transmitted is a link layer discovery protocol includes:
and inquiring a Profinet protocol stack in the target equipment until the fact that the to-be-transmitted Profinet protocol message exists in the target equipment is inquired, and detecting whether the to-be-transmitted Profinet protocol message is a link layer discovery protocol or not.
5. The Profinet protocol message transmission method according to claim 1, wherein if not, determining a second target transmission network port for transmitting the Profinet protocol message to be transmitted based on the destination MAC address in the Profinet protocol message to be transmitted and the MAC address table of each network port, includes:
if not, respectively matching whether the target MAC address in the to-be-transmitted Profinet protocol message is matched with the MAC address recorded in the MAC address table of each network port, and acquiring a corresponding matching result;
and if the matching result is that the matching is failed, using all network ports as second target transmission network ports to transmit the to-be-transmitted Profinet protocol message.
6. The Profinet protocol message transmission method according to claim 5, wherein after the corresponding matching result is obtained, further comprising:
and if the matching result is that the matching is successful, using the network port successfully matched as a second target sending network port to send the Profinet protocol message to be sent.
7. The Profinet protocol message transmission method according to any one of claims 1 to 6, wherein before detecting that there is a Profinet protocol message to be received and/or a Profinet protocol message to be sent in the target device, the method further comprises:
initializing target equipment and establishing a MAC address table of each network port in the target equipment.
8. A Profinet protocol message transmission device, comprising:
the protocol detection module is used for detecting whether the to-be-received Profinet protocol message and/or the to-be-sent Profinet protocol message is a link layer discovery protocol or not when the to-be-received Profinet protocol message and/or the to-be-sent Profinet protocol message exist in the target equipment;
the first protocol processing module is used for analyzing the to-be-received Profinet protocol message and storing the to-be-received Profinet protocol message in a management information base of a target receiving network port corresponding to the to-be-received Profinet protocol message and/or determining a first target sending network port for sending the to-be-sent Profinet protocol message according to a source MAC address in the to-be-sent Profinet protocol message;
the second protocol processing module is used for determining an MAC address table of a receiving network port for receiving the Profinet protocol message to be received, and performing the step of monitoring whether the Profinet protocol message to be received exists in the target equipment or not in a jumping mode, and/or determining a second target sending network port for sending the Profinet protocol message to be sent based on a target MAC address in the Profinet protocol message to be sent and the MAC address table of each network port;
the Profinet protocol message transmission device is specifically configured to set a Profinet protocol message receiving/transmitting module in a target device, so that the Profinet protocol message receiving/transmitting module is used for carrying out corresponding message monitoring and message processing on a Profinet protocol message to be received and/or a Profinet protocol message to be transmitted.
9. An electronic device, comprising:
a memory for storing a computer program;
processor for executing the computer program for carrying out the steps of the Profinet protocol message transmission method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program; wherein the computer program when executed by a processor implements the steps of the Profinet protocol message transmission method of any one of claims 1 to 7.
CN202310706944.XA 2023-06-15 2023-06-15 Profinet protocol message transmission method, device, equipment and medium Active CN116436994B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310706944.XA CN116436994B (en) 2023-06-15 2023-06-15 Profinet protocol message transmission method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310706944.XA CN116436994B (en) 2023-06-15 2023-06-15 Profinet protocol message transmission method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN116436994A CN116436994A (en) 2023-07-14
CN116436994B true CN116436994B (en) 2023-08-25

Family

ID=87092962

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310706944.XA Active CN116436994B (en) 2023-06-15 2023-06-15 Profinet protocol message transmission method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN116436994B (en)

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008089901A1 (en) * 2007-01-22 2008-07-31 Phoenix Contact Gmbh & Co. Kg Method and installation for the optimized transmission of data between a control device and a plurality of field devices
CN103986601A (en) * 2014-05-16 2014-08-13 北京东土科技股份有限公司 Message transmission delay obtaining method and device
CN104601569A (en) * 2015-01-13 2015-05-06 国家电网公司 Method for improving communication message usage rate in PROFINET protocol
CN108809949A (en) * 2018-05-21 2018-11-13 辽宁大学 The method converted and dispatched between profinet, FF H1, CAN and profibus agreements
WO2019227891A1 (en) * 2018-05-31 2019-12-05 杭州海康威视数字技术股份有限公司 Method and apparatus for implementing communication between nodes, and electronic device
CN111526051A (en) * 2020-04-17 2020-08-11 深圳市汇川技术股份有限公司 System and method for realizing conversion from PROFINET to CANopen
CN111866020A (en) * 2020-07-31 2020-10-30 深圳市英威腾电气股份有限公司 Communication card and communication method
CN112448924A (en) * 2019-08-30 2021-03-05 北京东土科技股份有限公司 Message processing method, system and switching equipment compatible with multiple protocols
WO2021094572A1 (en) * 2019-11-14 2021-05-20 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. Wireless data switch for isochronous real-time communication
WO2021120285A1 (en) * 2019-12-16 2021-06-24 中国科学院沈阳自动化研究所 Profinet protocol-based access method in industrial sdn
CN114827292A (en) * 2022-04-14 2022-07-29 重庆邮电大学 Industrial heterogeneous protocol high-speed conversion optimization processing method and system
CN115457754A (en) * 2022-07-20 2022-12-09 新华三技术有限公司 Message transmission method and device
CN116122832A (en) * 2023-02-24 2023-05-16 中铁电气化局集团有限公司 System for be used for remote control shield to construct machine

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008089901A1 (en) * 2007-01-22 2008-07-31 Phoenix Contact Gmbh & Co. Kg Method and installation for the optimized transmission of data between a control device and a plurality of field devices
CN103986601A (en) * 2014-05-16 2014-08-13 北京东土科技股份有限公司 Message transmission delay obtaining method and device
CN104601569A (en) * 2015-01-13 2015-05-06 国家电网公司 Method for improving communication message usage rate in PROFINET protocol
CN108809949A (en) * 2018-05-21 2018-11-13 辽宁大学 The method converted and dispatched between profinet, FF H1, CAN and profibus agreements
WO2019227891A1 (en) * 2018-05-31 2019-12-05 杭州海康威视数字技术股份有限公司 Method and apparatus for implementing communication between nodes, and electronic device
CN112448924A (en) * 2019-08-30 2021-03-05 北京东土科技股份有限公司 Message processing method, system and switching equipment compatible with multiple protocols
WO2021094572A1 (en) * 2019-11-14 2021-05-20 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. Wireless data switch for isochronous real-time communication
WO2021120285A1 (en) * 2019-12-16 2021-06-24 中国科学院沈阳自动化研究所 Profinet protocol-based access method in industrial sdn
CN111526051A (en) * 2020-04-17 2020-08-11 深圳市汇川技术股份有限公司 System and method for realizing conversion from PROFINET to CANopen
CN111866020A (en) * 2020-07-31 2020-10-30 深圳市英威腾电气股份有限公司 Communication card and communication method
CN114827292A (en) * 2022-04-14 2022-07-29 重庆邮电大学 Industrial heterogeneous protocol high-speed conversion optimization processing method and system
CN115457754A (en) * 2022-07-20 2022-12-09 新华三技术有限公司 Message transmission method and device
CN116122832A (en) * 2023-02-24 2023-05-16 中铁电气化局集团有限公司 System for be used for remote control shield to construct machine

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
IP地址组建管理及策略研究;张斌;邱礼龙;;科协论坛(下半月)(第12期);全文 *

Also Published As

Publication number Publication date
CN116436994A (en) 2023-07-14

Similar Documents

Publication Publication Date Title
CN110401568B (en) Network topology discovery method and equipment
EP1892929B1 (en) A method, an apparatus and a system for message transmission
CN112953774B (en) Network topology generation method, system, equipment and computer storage medium
CN108924274B (en) Domain name system DNS processing method and device, storage medium and electronic equipment
US8472420B2 (en) Gateway device
US20020124079A1 (en) System for inference of presence of network infrastructure devices
CN107947994B (en) Network topology self-discovery method and device, network equipment and computer storage medium
CN113273135B (en) Network topology discovery in a substation
CN114285695B (en) Communication method, device, apparatus, system and storage medium
CN109861869B (en) Configuration file generation method and device
CN107181689B (en) Message interaction method and device between routers
CN108881247B (en) Message conversion method, device, gateway equipment and storage medium
CN116827801B (en) Network topology construction method, device, computer equipment and readable storage medium
CN116436994B (en) Profinet protocol message transmission method, device, equipment and medium
CN113596017A (en) Protocol analysis method, device, soft gateway and storage medium
CN112994936A (en) Networking information display method, device and system and routing equipment
CN112866107B (en) IP address notification method, traffic guidance method and network equipment
CN112910910B (en) Method, device, equipment and storage medium for processing OPCDA protocol message
CN112543142B (en) Method and device for realizing RSTP ring network protocol based on FPGA
CN114422437A (en) Method and device for forwarding heterogeneous messages
CN113904980B (en) Channel switching method, device, switch and storage medium
WO2015131617A1 (en) Flow table processing method, device, openflow controller and openflow switch
US20080155047A1 (en) Method for managing and setting many network devices
CN117082033A (en) Method, device, equipment and medium for establishing network connection between storage equipment and host
CN112804095B (en) Port information management method and device and electronic equipment

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