]>
git.saurik.com Git - apple/network_cmds.git/blob - unbound/pythonmod/doc/examples/example0-1.py
3b234f1e099c513c5e83fb496627157dfa10ddbc
3 log_info("pythonmod: init called, module id is %d port: %d script: %s" % (id, cfg
.port
, cfg
.python_script
))
7 log_info("pythonmod: deinit called, module id is %d" % id)
10 def inform_super(id, qstate
, superqstate
, qdata
):
13 def operate(id, event
, qstate
, qdata
):
14 log_info("pythonmod: operate called, id: %d, event:%s" % (id, strmodulevent(event
)))
16 if event
== MODULE_EVENT_NEW
:
17 qstate
.ext_state
[id] = MODULE_WAIT_MODULE
20 if event
== MODULE_EVENT_MODDONE
:
21 log_info("pythonmod: module we are waiting for is done")
22 qstate
.ext_state
[id] = MODULE_FINISHED
25 if event
== MODULE_EVENT_PASS
:
26 log_info("pythonmod: event_pass")
27 qstate
.ext_state
[id] = MODULE_ERROR
30 log_err("pythonmod: BAD event")
31 qstate
.ext_state
[id] = MODULE_ERROR
34 log_info("pythonmod: script loaded.")