- Add patch from Jan Vcelak for pythonmod,

add sockaddr_storage getters, add support for query callbacks,
  allow raw address access via comm_reply and update API documentation.


git-svn-id: file:///svn/unbound/trunk@4962 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards
2018-11-20 12:24:40 +00:00
parent f7e99131b9
commit 04d73b9192
7 changed files with 305 additions and 41 deletions
+24
View File
@@ -247,6 +247,25 @@ def inplace_servfail_callback(qinfo, qstate, rep, rcode, edns, opt_list_out,
return True
def inplace_query_callback(qinfo, flags, qstate, addr, zone, region, **kwargs):
"""
Function that will be registered as an inplace callback function.
It will be called before sending a query to a backend server.
:param qinfo: query_info struct;
:param flags: flags of the query;
:param qstate: module qstate. opt_lists are available here;
:param addr: struct sockaddr_storage. Address of the backend server;
:param zone: zone name in binary;
:param region: region to allocate temporary data. Needs to be used when we
want to append a new option to opt_lists.
:param **kwargs: Dictionary that may contain parameters added in a future
release.
"""
log_info("python: outgoing query to {}@{}".format(addr.addr, addr.port))
return True
def init_standard(id, env):
"""
New version of the init function.
@@ -281,6 +300,11 @@ def init_standard(id, env):
if not register_inplace_cb_reply_servfail(inplace_servfail_callback, env, id):
return False
# Register the inplace_query_callback function as an inplace callback
# before sending a query to a backend server.
if not register_inplace_cb_query(inplace_query_callback, env, id):
return False
return True