xref: /netbsd-src/external/bsd/unbound/dist/pythonmod/doc/modules/functions.rst (revision 3b6c3722d8f990f9a667d638078aee8ccdc3c0f3)
1Scriptable functions
2====================
3
4Network
5-------
6
7.. function:: ntohs(netshort)
8
9   This subroutine converts values between the host and network byte order.
10   Specifically, **ntohs()** converts 16-bit quantities from network byte order to host byte order.
11
12   :param netshort: 16-bit short addr
13   :rtype: converted addr
14
15
16Cache
17-----
18
19.. function:: storeQueryInCache(qstate, qinfo, msgrep, is_referral)
20
21   Store pending query in local cache.
22
23   :param qstate: :class:`module_qstate`
24   :param qinfo: :class:`query_info`
25   :param msgrep: :class:`reply_info`
26   :param is_referal: integer
27   :rtype: boolean
28
29.. function:: invalidateQueryInCache(qstate, qinfo)
30
31   Invalidate record in local cache.
32
33   :param qstate: :class:`module_qstate`
34   :param qinfo: :class:`query_info`
35
36
37Logging
38-------
39
40.. function:: verbose(level, msg)
41
42   Log a verbose message, pass the level for this message.
43   No trailing newline is needed.
44
45   :param level: verbosity level for this message, compared to global verbosity setting.
46   :param msg: string message
47
48.. function:: log_info(msg)
49
50   Log informational message. No trailing newline is needed.
51
52   :param msg: string message
53
54.. function:: log_err(msg)
55
56   Log error message. No trailing newline is needed.
57
58   :param msg: string message
59
60.. function:: log_warn(msg)
61
62   Log warning message. No trailing newline is needed.
63
64   :param msg: string message
65
66.. function:: log_hex(msg, data, length)
67
68   Log a hex-string to the log. Can be any length.
69   performs mallocs to do so, slow. But debug useful.
70
71   :param msg: string desc to accompany the hexdump.
72   :param data: data to dump in hex format.
73   :param length: length of data.
74
75.. function:: log_dns_msg(str, qinfo, reply)
76
77   Log DNS message.
78
79   :param str: string message
80   :param qinfo: :class:`query_info`
81   :param reply: :class:`reply_info`
82
83.. function:: log_query_info(verbosity_value, str, qinf)
84
85   Log query information.
86
87   :param verbosity_value: see constants
88   :param str: string message
89   :param qinf: :class:`query_info`
90
91.. function:: regional_log_stats(r)
92
93   Log regional statistics.
94
95   :param r: :class:`regional`
96
97Debugging
98---------
99
100.. function:: strextstate(module_ext_state)
101
102   Debug utility, module external qstate to string.
103
104   :param module_ext_state: the state value.
105   :rtype: descriptive string.
106
107.. function:: strmodulevent(module_event)
108
109   Debug utility, module event to string.
110
111   :param module_event: the module event value.
112   :rtype: descriptive string.
113
114.. function:: ldns_rr_type2str(atype)
115
116   Convert RR type to string.
117
118.. function:: ldns_rr_class2str(aclass)
119
120   Convert RR class to string.
121