introduce c. etc.
[hippotat] / hippotat / __init__.py
index 6af49b6..8219238 100644 (file)
@@ -18,9 +18,18 @@ from configparser import NoOptionError
 
 import collections
 
+# these need to be defined here so that they can be imported by import *
 cfg = ConfigParser()
 optparser = OptionParser()
 
+class ConfigResults:
+  def __init__(self, d = { }):
+    self.__dict__ = d
+  def __repr__(self):
+    return 'ConfigResults('+repr(self.__dict__)+')'
+
+c = ConfigResults()
+
 #---------- packet parsing ----------
 
 def packet_addrs(packet):
@@ -129,6 +138,12 @@ def crash_on_critical(event):
   if event.get('log_level') >= LogLevel.critical:
     crash(twisted.logger.formatEvent(event))
 
+#---------- config processing ----------
+
+def process_cfg_common_always():
+  global mtu
+  c.mtu = cfg.get('virtual','mtu')
+
 #---------- startup ----------
 
 def common_startup(defcfg):