aboutsummaryrefslogtreecommitdiff
path: root/external/unbound/pythonmod/doc/examples/example0-1.py
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2014-10-06 08:51:44 +0200
committerRiccardo Spagni <ric@spagni.net>2014-10-06 08:52:16 +0200
commit3463f0ab52a84b79977c3e67177637e62265c89c (patch)
tree1e2077aa15fa18fcc9b00fa23c9514d46df6ef95 /external/unbound/pythonmod/doc/examples/example0-1.py
parentfce9dea1b9be05d031c332fcbb30288a83ff8eae (diff)
parent32be6ae3817a2e32d39d3d28363e37413d534cff (diff)
downloadmonzero-core-3463f0ab52a84b79977c3e67177637e62265c89c.tar.gz
monzero-core-3463f0ab52a84b79977c3e67177637e62265c89c.tar.xz
monzero-core-3463f0ab52a84b79977c3e67177637e62265c89c.zip
Merge pull request #171
32be6ae added aabramov's gpg key (Riccardo Spagni) 010bfcf minor English wordlist tweaks (Riccardo Spagni) 9ef094b added unbound to external deps (Riccardo Spagni) 732493c split mnemonic printout over 3 lines (Riccardo Spagni)
Diffstat (limited to 'external/unbound/pythonmod/doc/examples/example0-1.py')
-rw-r--r--external/unbound/pythonmod/doc/examples/example0-1.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/external/unbound/pythonmod/doc/examples/example0-1.py b/external/unbound/pythonmod/doc/examples/example0-1.py
new file mode 100644
index 000000000..3b234f1e0
--- /dev/null
+++ b/external/unbound/pythonmod/doc/examples/example0-1.py
@@ -0,0 +1,34 @@
+
+def init(id, cfg):
+ log_info("pythonmod: init called, module id is %d port: %d script: %s" % (id, cfg.port, cfg.python_script))
+ return True
+
+def deinit(id):
+ log_info("pythonmod: deinit called, module id is %d" % id)
+ return True
+
+def inform_super(id, qstate, superqstate, qdata):
+ return True
+
+def operate(id, event, qstate, qdata):
+ log_info("pythonmod: operate called, id: %d, event:%s" % (id, strmodulevent(event)))
+
+ if event == MODULE_EVENT_NEW:
+ qstate.ext_state[id] = MODULE_WAIT_MODULE
+ return True
+
+ if event == MODULE_EVENT_MODDONE:
+ log_info("pythonmod: module we are waiting for is done")
+ qstate.ext_state[id] = MODULE_FINISHED
+ return True
+
+ if event == MODULE_EVENT_PASS:
+ log_info("pythonmod: event_pass")
+ qstate.ext_state[id] = MODULE_ERROR
+ return True
+
+ log_err("pythonmod: BAD event")
+ qstate.ext_state[id] = MODULE_ERROR
+ return True
+
+log_info("pythonmod: script loaded.")