Module: sems
Branch: master
Commit: 14c5d59afbed207d3a71e03e28d4f5583859b0e4
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=14c5d59afbed207d3a71e03e28d4f5583859b0e4

Author: Raphael Coeffic <[email protected]>
Committer: Raphael Coeffic <[email protected]>
Date:   Sun Feb 13 15:28:55 2011 +0100

adds a reverse mapping between LocalSIPIP and interface.

---

 core/AmConfig.cpp |   10 +++++++---
 core/AmConfig.h   |    6 ++++--
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/core/AmConfig.cpp b/core/AmConfig.cpp
index 99b47f4..b1a7681 100644
--- a/core/AmConfig.cpp
+++ b/core/AmConfig.cpp
@@ -50,8 +50,9 @@ string       AmConfig::ExcludePayloads         = "";
 int          AmConfig::LogLevel                = L_INFO;
 bool         AmConfig::LogStderr               = false;
 
-vector<AmConfig::IP_interface> AmConfig::Ifs;
-map<string,unsigned short>     AmConfig::If_names;
+vector<AmConfig::IP_interface>  AmConfig::Ifs;
+map<string,unsigned short>      AmConfig::If_names;
+multimap<string,unsigned short> AmConfig::LocalSIPIP2If;
 
 #ifndef DISABLE_DAEMON_MODE
 bool         AmConfig::DaemonMode              = DEFAULT_DAEMON_MODE;
@@ -546,7 +547,10 @@ static int readInterface(AmConfigReader& cfg, const 
string& i_name)
   }
 
   AmConfig::Ifs.push_back(intf);
-  return ret;  
+  AmConfig::LocalSIPIP2If.insert(std::make_pair(intf.LocalSIPIP,
+                                               AmConfig::Ifs.size()-1));
+
+  return ret;
 }
 
 static int readInterfaces(AmConfigReader& cfg)
diff --git a/core/AmConfig.h b/core/AmConfig.h
index 7d09211..c3ec82e 100644
--- a/core/AmConfig.h
+++ b/core/AmConfig.h
@@ -37,6 +37,7 @@
 using std::string;
 #include <map>
 using std::map;
+using std::multimap;
 #include <utility>
 
 /**
@@ -97,8 +98,9 @@ struct AmConfig
     int LocalSIPPort;
   };
 
-  static vector<IP_interface>       Ifs;
-  static map<string,unsigned short> If_names;
+  static vector<IP_interface>            Ifs;
+  static map<string,unsigned short>      If_names;
+  static multimap<string,unsigned short> LocalSIPIP2If;
 
   static string& LocalIP() {
     return (Ifs[0].LocalIP);

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to