7 .. function:: ntohs(netshort)
9 This subroutine converts values between the host and network byte order.
10 Specifically, **ntohs()** converts 16-bit quantities from network byte order
13 :param netshort: 16-bit short addr
14 :rtype: converted addr
20 .. function:: storeQueryInCache(qstate, qinfo, msgrep, is_referral)
22 Store pending query in local cache.
24 :param qstate: :class:`module_qstate`
25 :param qinfo: :class:`query_info`
26 :param msgrep: :class:`reply_info`
27 :param is_referral: integer
30 .. function:: invalidateQueryInCache(qstate, qinfo)
32 Invalidate record in local cache.
34 :param qstate: :class:`module_qstate`
35 :param qinfo: :class:`query_info`
41 .. function:: register_edns_option(env, code, bypass_cache_stage=False, no_aggregation=False)
43 Register EDNS option code.
45 :param env: :class:`module_env`
46 :param code: option code(integer)
47 :param bypass_cache_stage: whether to bypass the cache response stage
48 :param no_aggregation: whether this query should be unique
49 :return: ``1`` if successful, ``0`` otherwise
52 .. function:: edns_opt_list_find(list, code)
54 Find the EDNS option code in the EDNS option list.
56 :param list: linked list of :class:`edns_option`
57 :param code: option code (integer)
58 :return: the edns option if found or None
59 :rtype: :class:`edns_option` or None
61 .. function:: edns_opt_list_remove(list, code);
63 Remove an ENDS option code from the list.
64 .. note:: All :class:`edns_option` with the code will be removed
66 :param list: linked list of :class:`edns_option`
67 :param code: option code (integer)
68 :return: ``1`` if at least one :class:`edns_option` was removed, ``0`` otherwise
71 .. function:: edns_opt_list_append(list, code, data, region)
73 Append given EDNS option code with data to the list.
75 :param list: linked list of :class:`edns_option`
76 :param code: option code (integer)
77 :param data: EDNS data. **Must** be a :class:`bytearray`
78 :param region: :class:`regional`
80 .. function:: edns_opt_list_is_empty(list)
82 Check if an EDNS option list is empty.
84 :param list: linked list of :class:`edns_option`
85 :return: ``1`` if list is empty, ``0`` otherwise
92 .. function:: inplace_cb_reply(qinfo, qstate, rep, rcode, edns, opt_list_out, region, \*\*kwargs)
94 Function prototype for callback functions used in
95 `register_inplace_cb_reply`_, `register_inplace_cb_reply_cache`_,
96 `register_inplace_cb_reply_local` and `register_inplace_cb_reply_servfail`.
98 :param qinfo: :class:`query_info`
99 :param qstate: :class:`module_qstate`
100 :param rep: :class:`reply_info`
101 :param rcode: return code (integer), check ``RCODE_`` constants.
102 :param edns: :class:`edns_data`
103 :param opt_list_out: :class:`edns_option`. EDNS option list to append options to.
104 :param region: :class:`regional`
105 :param \*\*kwargs: Dictionary that may contain parameters added in a future
106 release. Current parameters:
107 ``repinfo``: :class:`comm_reply`. Reply information for a communication point.
109 .. function:: inplace_cb_query(qinfo, flags, qstate, addr, zone, region)
111 Function prototype for callback functions used in
112 `register_inplace_cb_query`_.
114 :param qinfo: :class:`query_info`
115 :param flags: query flags (integer)
116 :param qstate: :class:`module_qstate`
117 :param addr: :class:`sockaddr_storage`
118 :param zone: zone name in wire format (bytes)
119 :param region: :class:`regional`
121 .. function:: register_inplace_cb_reply(py_cb, env, id)
123 Register py_cb as an inplace reply callback function.
125 :param py_cb: Python function that follows `inplace_cb_reply`_'s prototype. **Must** be callable.
126 :param env: :class:`module_env`
127 :param id: Module ID.
128 :return: True on success, False otherwise
131 .. function:: register_inplace_cb_reply_cache(py_cb, env, id)
133 Register py_cb as an inplace reply_cache callback function.
135 :param py_cb: Python function that follows `inplace_cb_reply`_'s prototype. **Must** be callable.
136 :param env: :class:`module_env`
137 :param id: Module ID.
138 :return: True on success, False otherwise
141 .. function:: register_inplace_cb_reply_local(py_cb, env, id)
143 Register py_cb as an inplace reply_local callback function.
145 :param py_cb: Python function that follows `inplace_cb_reply`_'s prototype. **Must** be callable.
146 :param env: :class:`module_env`
147 :param id: Module ID.
148 :return: True on success, False otherwise
151 .. function:: register_inplace_cb_reply_servfail(py_cb, env, id)
153 Register py_cb as an inplace reply_servfail callback function.
155 :param py_cb: Python function that follows `inplace_cb_reply`_'s prototype. **Must** be callable.
156 :param env: :class:`module_env`
157 :param id: Module ID.
158 :return: True on success, False otherwise
161 .. function:: register_inplace_cb_query(py_cb, env, id)
163 Register py_cb as an inplace query callback function.
165 :param py_cb: Python function that follows `inplace_cb_query`_'s prototype. **Must** be callable.
166 :param env: :class:`module_env`
167 :param id: Module ID.
168 :return: True on success, False otherwise
174 .. function:: verbose(level, msg)
176 Log a verbose message, pass the level for this message.
177 No trailing newline is needed.
179 :param level: verbosity level for this message, compared to global verbosity setting.
180 :param msg: string message
182 .. function:: log_info(msg)
184 Log informational message. No trailing newline is needed.
186 :param msg: string message
188 .. function:: log_err(msg)
190 Log error message. No trailing newline is needed.
192 :param msg: string message
194 .. function:: log_warn(msg)
196 Log warning message. No trailing newline is needed.
198 :param msg: string message
200 .. function:: log_hex(msg, data, length)
202 Log a hex-string to the log. Can be any length.
203 performs mallocs to do so, slow. But debug useful.
205 :param msg: string desc to accompany the hexdump.
206 :param data: data to dump in hex format.
207 :param length: length of data.
209 .. function:: log_dns_msg(str, qinfo, reply)
213 :param str: string message
214 :param qinfo: :class:`query_info`
215 :param reply: :class:`reply_info`
217 .. function:: log_query_info(verbosity_value, str, qinf)
219 Log query information.
221 :param verbosity_value: see constants
222 :param str: string message
223 :param qinf: :class:`query_info`
225 .. function:: regional_log_stats(r)
227 Log regional statistics.
229 :param r: :class:`regional`
235 .. function:: strextstate(module_ext_state)
237 Debug utility, module external qstate to string.
239 :param module_ext_state: the state value.
240 :rtype: descriptive string.
242 .. function:: strmodulevent(module_event)
244 Debug utility, module event to string.
246 :param module_event: the module event value.
247 :rtype: descriptive string.
249 .. function:: ldns_rr_type2str(atype)
251 Convert RR type to string.
253 .. function:: ldns_rr_class2str(aclass)
255 Convert RR class to string.