OMNeT++中INET模块@display、@networkNode、@labels属性咨询
Understanding @display, @networkNode, and @labels in INET's INetworkNode
Let’s break down each of these NED attributes you spotted in inet/src/inet/node/inet/INetworkNode.ned—I’ll cover what each does, why they matter, and where to find their handling code in the OMNeT++/INET codebase:
@display
- What it does: This is a core OMNeT++ attribute that controls how the module/interface renders in the graphical network editor (Qtenv) and simulation visualizations. The value
"bgb=,448"sets the base geometry bounds: the448here defines the default height (width auto-adjusts to fit the node’s content). It ensures your network nodes have a consistent, clean size when you drag them into the editor, keeping your topology layout uniform. - Where to find the code: Since this is an OMNeT++ core feature, look in the OMNeT++ source tree:
omnetpp/src/qtenv/display: Handles Qtenv’s visualization logic for@displayattributesomnetpp/src/nedxml: Parses NED files, including the@displayattribute syntax
@networkNode
- What it does: This is an INET-specific marker that flags a module as a top-level network node. INET’s internal infrastructure (like routing protocols, topology discovery tools, or network management components) uses this attribute to quickly distinguish full nodes from submodules (like individual network interfaces or apps). For example, some routing modules will only scan modules tagged with
@networkNodeto build the network’s routing graph. - Where to find the code: Check INET’s core utility files:
inet/src/inet/common/ModuleAccess.h/.cc: Functions likefindNetworkNode()rely on this attribute to locate parent network nodesinet/src/inet/networklayer/common/NetworkInterface.h: Some link-layer logic uses this attribute to validate if a module belongs to a full network node
@labels
- What it does: This attribute adds arbitrary, comma-separated tags to the module/interface for filtering, categorization, or conditional behavior. The tags
node,ethernet-node,wireless-nodemark this interface as representing a node that supports both Ethernet and wireless connectivity. INET components (like wireless medium modules or visualization filters) can check these labels to apply logic only to modules matching specific tags. - Where to find the code: Handling is split between OMNeT++ core and INET:
- OMNeT++:
omnetpp/src/nedxml/NedAttribute.cc: Parses the@labelsattribute syntax - INET:
inet/src/inet/common/ModuleTagging.h/.cc: Contains helper functions to check for specific labels, used across the codebase (e.g., in wireless simulation logic)
- OMNeT++:
Quick Tip for Digging Deeper
If you want to explore further, use your IDE’s "Find in Path" feature to search for the attribute name (with or without the @ prefix) across the OMNeT++ and INET source trees. This will directly lead you to where the attribute is checked or used in the code.
内容的提问来源于stack exchange,提问作者Yang. fr
相关产品推荐
相关产品推荐

