44 if(modules[domId] == NULL) {
46 case DV : modules[domId] =
new DV_Module<T>(
this, myAddress, _addr, infinite);
break;
47 case LS : modules[domId] =
new LS_Module<T>(
this, myAddress, _addr, infinite);
break;
54 if(modules[domId] != NULL) {
55 delete modules[domId];
62 if(Update * u = dynamic_cast<Update*>(update)) {
63 if(modules[u->domId] != NULL) {
64 return modules[u->domId]->processUpdate(u->u);
73 Update * up =
new Update();
74 up->setDestination(dst);
75 up->setSource(myAddress);
78 for(
const auto & md : modules) {
79 if(md.second == module) {
92 Enter_Method_Silent();
94 AutoMsg * m =
new AutoMsg();
96 for(
const auto & md : modules) {
97 if(md.second == module) {
105 scheduleAt(simTime()+t, m);
111 virtual void insertFlow(
const Address &addr,
const string &dst,
const string& domId,
const T &metric) {
112 if(modules[domId] != NULL) {
113 modules[domId]->addFlow(addr, dst, metric);
117 if(modules[domId] != NULL) {
118 modules[domId]->removeFlow(addr, dst);
123 virtual map<string, map<string, nhLMetric<T> > >
getChanges() {
124 map<string, map<string, nhLMetric<T> > > ret;
125 for(
auto & md : modules) {
126 ret[md.first] = md.second->getChanges();
130 virtual map<string, map<string, nhLMetric<T> > >
getAll() {
131 map<string, map<string, nhLMetric<T> > > ret;
132 for(
auto & md : modules) {
133 ret[md.first] = md.second->getAll();
139 if(AutoMsg * m = dynamic_cast<AutoMsg*>(msg)) {
140 if(modules[m->domId] != NULL) {
141 modules[m->domId]->sendUpdate();
148 void addAddr(
const std::string &domId,
const std::string &syn){
149 if(modules[domId] != NULL) {
150 modules[domId]->addSynonym(syn);
154 void removeAddr(
const std::string &domId,
const std::string &syn){
155 if(modules[domId] != NULL) {
156 modules[domId]->removeSynonym(syn);
164 myAddr = par(
"myAddr").stdstringValue();
166 myAddr = myAddress.getIpcAddress().getName();
171 if(par(
"printAtEnd").boolValue()){
172 EV<<
"Routing at "<< myAddress <<endl;
173 for(
auto & md : modules) {
174 EV <<
"-----With Domain \"" << md.first <<
"\"" << endl;
virtual void insertFlow(const Address &addr, const string &dst, const string &domId, const T &metric)
map< string, Routing_Alg< T > * > modules
virtual bool processUpdate(IntRoutingUpdate *update)
virtual void removeDomain(const string &domId)
virtual void removeFlow(const Address &addr, const string &dst, const string &domId)
virtual map< string, map< string, nhLMetric< T > > > getAll()
void addAddr(const std::string &domId, const std::string &syn)
void setDescriptor(const string &des)
virtual void handleMessage(cMessage *msg)
virtual void chSendUpdate(Routing_Update *update, const Address &dst, Routing_Alg_I *module)
virtual void addDomain(const string &domId, const string &_addr, T infinite, ModuleAlgs alg)
void removeAddr(const std::string &domId, const std::string &syn)
virtual void onPolicyInit()
virtual void chScheduleAt(Routing_Alg_I *module, const simtime_t &t)
Address class holds IPC Process identification.
virtual map< string, map< string, nhLMetric< T > > > getChanges()