39 #include <libxml/tree.h> 52 bExternalTransport_ =
getAttrVal(pNEMNode,
"transport") ==
"external" ? true :
false;
61 for(
auto layer : layers_) {
delete layer; }
84 return bExternalTransport_;
93 haveLayer(
"transport"));
100 if(
getAttrVal(pRoot,
"type") ==
"unstructured")
110 doProcessLayer(pNode);
115 EMANE::NEMConfiguration::doProcessLayer(xmlNodePtr pNode)
117 std::string sLayerName{
reinterpret_cast<const char*
>(pNode->name)};
119 std::string sDefinitionFile{
getAttrVal(pNode,
"definition")};
123 if(!sDefinitionFile.empty())
128 if(sLayerName ==
"shim")
136 if (pIter == layers_.end())
139 layers_.insert(pIter,
146 if ((*pIter)->getDefinitionFile() == sDefinitionFile)
148 (*pIter)->overlayParams(pNode);
152 throw makeException<ValidateException>(
153 "Unexpected definition for '%s'.\n\n" 154 " * Found: '%s', expected: '%s'\n",
156 sDefinitionFile.c_str(),
157 (*pIter)->getDefinitionFile().c_str());
165 EMANE::NEMConfiguration::findFirstLayer(
const std::string & sType)
167 return find_if(layers_.begin(),
171 return l->getType() == sType;
177 EMANE::NEMConfiguration::haveLayer(
const std::string & type)
179 return findFirstLayer(type) != layers_.end();
Provides default implementation to common layer functionalities.
NEMConfiguration(xmlNodePtr pNEMNode, const std::string sDefinitionURI)
void doProcessRootAttributes(xmlNodePtr pRoot)
std::string getDefinitionPath() const
std::list< LayerConfiguration * > LayerConfigurations
void doProcessChildNode(xmlNodePtr pNode)
std::uint16_t getAttrValNumeric(xmlNodePtr pNode, const char *attributename)
const LayerConfigurations & getLayers()
void processDefinition(const char *pxzName, const std::string &sURI)
void overlayParams(xmlNodePtr pNode)
LayerConfigurations::iterator LayerConfigurationsIter
bool isExternalTransport()
Contains the configuration for a MAC layer.
std::string getAttrVal(xmlNodePtr pNode, const char *attributename)