mirror of
https://github.com/monero-project/monero.git
synced 2025-05-06 12:15:05 -04:00
added unbound to external deps
This commit is contained in:
parent
732493c5cb
commit
9ef094b356
394 changed files with 199264 additions and 0 deletions
350
external/unbound/pythonmod/doc/modules/config.rst
vendored
Normal file
350
external/unbound/pythonmod/doc/modules/config.rst
vendored
Normal file
|
@ -0,0 +1,350 @@
|
|||
Configuration interface
|
||||
=======================
|
||||
|
||||
Currently passed to Python module in init(module_id, cfg).
|
||||
|
||||
config_file
|
||||
--------------------
|
||||
|
||||
.. class:: config_file
|
||||
|
||||
This class provides these data attributes:
|
||||
|
||||
.. attribute:: verbosity
|
||||
|
||||
Verbosity level as specified in the config file.
|
||||
|
||||
.. attribute:: stat_interval
|
||||
|
||||
Statistics interval (in seconds).
|
||||
|
||||
.. attribute:: stat_cumulative
|
||||
|
||||
If false, statistics values are reset after printing them.
|
||||
|
||||
.. attribute:: stat_extended
|
||||
|
||||
If true, the statistics are kept in greater detail.
|
||||
|
||||
.. attribute:: num_threads
|
||||
|
||||
Number of threads to create.
|
||||
|
||||
.. attribute:: port
|
||||
|
||||
Port on which queries are answered.
|
||||
|
||||
.. attribute:: do_ip4
|
||||
|
||||
Do ip4 query support.
|
||||
|
||||
.. attribute:: do_ip6
|
||||
|
||||
Do ip6 query support.
|
||||
|
||||
.. attribute:: do_udp
|
||||
|
||||
Do udp query support.
|
||||
|
||||
.. attribute:: do_tcp
|
||||
|
||||
Do tcp query support.
|
||||
|
||||
.. attribute:: outgoing_num_ports
|
||||
|
||||
Outgoing port range number of ports (per thread).
|
||||
|
||||
.. attribute:: outgoing_num_tcp
|
||||
|
||||
Number of outgoing tcp buffers per (per thread).
|
||||
|
||||
.. attribute:: incoming_num_tcp
|
||||
|
||||
Number of incoming tcp buffers per (per thread).
|
||||
|
||||
.. attribute:: outgoing_avail_ports
|
||||
|
||||
Allowed udp port numbers, array with 0 if not allowed.
|
||||
|
||||
.. attribute:: msg_buffer_size
|
||||
|
||||
Number of bytes buffer size for DNS messages.
|
||||
|
||||
.. attribute:: msg_cache_size
|
||||
|
||||
Size of the message cache.
|
||||
|
||||
.. attribute:: msg_cache_slabs
|
||||
|
||||
Slabs in the message cache.
|
||||
|
||||
.. attribute:: num_queries_per_thread
|
||||
|
||||
Number of queries every thread can service.
|
||||
|
||||
.. attribute:: jostle_time
|
||||
|
||||
Number of msec to wait before items can be jostled out.
|
||||
|
||||
.. attribute:: rrset_cache_size
|
||||
|
||||
Size of the rrset cache.
|
||||
|
||||
.. attribute:: rrset_cache_slabs
|
||||
|
||||
Slabs in the rrset cache.
|
||||
|
||||
.. attribute:: host_ttl
|
||||
|
||||
Host cache ttl in seconds.
|
||||
|
||||
.. attribute:: lame_ttl
|
||||
|
||||
Host is lame for a zone ttl, in seconds.
|
||||
|
||||
.. attribute:: infra_cache_slabs
|
||||
|
||||
Number of slabs in the infra host cache.
|
||||
|
||||
.. attribute:: infra_cache_numhosts
|
||||
|
||||
Max number of hosts in the infra cache.
|
||||
|
||||
.. attribute:: infra_cache_lame_size
|
||||
|
||||
Max size of lame zones per host in the infra cache.
|
||||
|
||||
.. attribute:: target_fetch_policy
|
||||
|
||||
The target fetch policy for the iterator.
|
||||
|
||||
.. attribute:: if_automatic
|
||||
|
||||
Automatic interface for incoming messages. Uses ipv6 remapping,
|
||||
and recvmsg/sendmsg ancillary data to detect interfaces, boolean.
|
||||
|
||||
.. attribute:: num_ifs
|
||||
|
||||
Number of interfaces to open. If 0 default all interfaces.
|
||||
|
||||
.. attribute:: ifs
|
||||
|
||||
Interface description strings (IP addresses).
|
||||
|
||||
.. attribute:: num_out_ifs
|
||||
|
||||
Number of outgoing interfaces to open.
|
||||
If 0 default all interfaces.
|
||||
|
||||
.. attribute:: out_ifs
|
||||
|
||||
Outgoing interface description strings (IP addresses).
|
||||
|
||||
.. attribute:: root_hints
|
||||
|
||||
The root hints.
|
||||
|
||||
.. attribute:: stubs
|
||||
|
||||
The stub definitions, linked list.
|
||||
|
||||
.. attribute:: forwards
|
||||
|
||||
The forward zone definitions, linked list.
|
||||
|
||||
.. attribute:: donotqueryaddrs
|
||||
|
||||
List of donotquery addresses, linked list.
|
||||
|
||||
.. attribute:: acls
|
||||
|
||||
List of access control entries, linked list.
|
||||
|
||||
.. attribute:: donotquery_localhost
|
||||
|
||||
Use default localhost donotqueryaddr entries.
|
||||
|
||||
.. attribute:: harden_short_bufsize
|
||||
|
||||
Harden against very small edns buffer sizes.
|
||||
|
||||
.. attribute:: harden_large_queries
|
||||
|
||||
Harden against very large query sizes.
|
||||
|
||||
.. attribute:: harden_glue
|
||||
|
||||
Harden against spoofed glue (out of zone data).
|
||||
|
||||
.. attribute:: harden_dnssec_stripped
|
||||
|
||||
Harden against receiving no DNSSEC data for trust anchor.
|
||||
|
||||
.. attribute:: harden_referral_path
|
||||
|
||||
Harden the referral path, query for NS,A,AAAA and validate.
|
||||
|
||||
.. attribute:: use_caps_bits_for_id
|
||||
|
||||
Use 0x20 bits in query as random ID bits.
|
||||
|
||||
.. attribute:: private_address
|
||||
|
||||
Strip away these private addrs from answers, no DNS Rebinding.
|
||||
|
||||
.. attribute:: private_domain
|
||||
|
||||
Allow domain (and subdomains) to use private address space.
|
||||
|
||||
.. attribute:: unwanted_threshold
|
||||
|
||||
What threshold for unwanted action.
|
||||
|
||||
.. attribute:: chrootdir
|
||||
|
||||
Chrootdir, if not "" or chroot will be done.
|
||||
|
||||
.. attribute:: username
|
||||
|
||||
Username to change to, if not "".
|
||||
|
||||
.. attribute:: directory
|
||||
|
||||
Working directory.
|
||||
|
||||
.. attribute:: logfile
|
||||
|
||||
Filename to log to.
|
||||
|
||||
.. attribute:: pidfile
|
||||
|
||||
Pidfile to write pid to.
|
||||
|
||||
.. attribute:: use_syslog
|
||||
|
||||
Should log messages be sent to syslogd.
|
||||
|
||||
.. attribute:: hide_identity
|
||||
|
||||
Do not report identity (id.server, hostname.bind).
|
||||
|
||||
.. attribute:: hide_version
|
||||
|
||||
Do not report version (version.server, version.bind).
|
||||
|
||||
.. attribute:: identity
|
||||
|
||||
Identity, hostname is returned if "".
|
||||
|
||||
.. attribute:: version
|
||||
|
||||
Version, package version returned if "".
|
||||
|
||||
.. attribute:: module_conf
|
||||
|
||||
The module configuration string.
|
||||
|
||||
.. attribute:: trust_anchor_file_list
|
||||
|
||||
Files with trusted DS and DNSKEYs in zonefile format, list.
|
||||
|
||||
.. attribute:: trust_anchor_list
|
||||
|
||||
List of trustanchor keys, linked list.
|
||||
|
||||
.. attribute:: trusted_keys_file_list
|
||||
|
||||
Files with trusted DNSKEYs in named.conf format, list.
|
||||
|
||||
.. attribute:: dlv_anchor_file
|
||||
|
||||
DLV anchor file.
|
||||
|
||||
.. attribute:: dlv_anchor_list
|
||||
|
||||
DLV anchor inline.
|
||||
|
||||
.. attribute:: max_ttl
|
||||
|
||||
The number of seconds maximal TTL used for RRsets and messages.
|
||||
|
||||
.. attribute:: val_date_override
|
||||
|
||||
If not 0, this value is the validation date for RRSIGs.
|
||||
|
||||
.. attribute:: bogus_ttl
|
||||
|
||||
This value sets the number of seconds before revalidating bogus.
|
||||
|
||||
.. attribute:: val_clean_additional
|
||||
|
||||
Should validator clean additional section for secure msgs.
|
||||
|
||||
.. attribute:: val_permissive_mode
|
||||
|
||||
Should validator allow bogus messages to go through.
|
||||
|
||||
.. attribute:: val_nsec3_key_iterations
|
||||
|
||||
Nsec3 maximum iterations per key size, string.
|
||||
|
||||
.. attribute:: key_cache_size
|
||||
|
||||
Size of the key cache.
|
||||
|
||||
.. attribute:: key_cache_slabs
|
||||
|
||||
Slabs in the key cache.
|
||||
|
||||
.. attribute:: neg_cache_size
|
||||
|
||||
Size of the neg cache.
|
||||
|
||||
|
||||
.. attribute:: local_zones
|
||||
|
||||
Local zones config.
|
||||
|
||||
.. attribute:: local_zones_nodefault
|
||||
|
||||
Local zones nodefault list.
|
||||
|
||||
.. attribute:: local_data
|
||||
|
||||
Local data RRs configged.
|
||||
|
||||
.. attribute:: remote_control_enable
|
||||
|
||||
Remote control section. enable toggle.
|
||||
|
||||
.. attribute:: control_ifs
|
||||
|
||||
The interfaces the remote control should listen on.
|
||||
|
||||
.. attribute:: control_port
|
||||
|
||||
Port number for the control port.
|
||||
|
||||
.. attribute:: server_key_file
|
||||
|
||||
Private key file for server.
|
||||
|
||||
.. attribute:: server_cert_file
|
||||
|
||||
Certificate file for server.
|
||||
|
||||
.. attribute:: control_key_file
|
||||
|
||||
Private key file for unbound-control.
|
||||
|
||||
.. attribute:: control_cert_file
|
||||
|
||||
Certificate file for unbound-control.
|
||||
|
||||
.. attribute:: do_daemonize
|
||||
|
||||
Daemonize, i.e. fork into the background.
|
||||
|
||||
.. attribute:: python_script
|
||||
|
||||
Python script file.
|
412
external/unbound/pythonmod/doc/modules/env.rst
vendored
Normal file
412
external/unbound/pythonmod/doc/modules/env.rst
vendored
Normal file
|
@ -0,0 +1,412 @@
|
|||
Global environment
|
||||
==================
|
||||
|
||||
Global variables
|
||||
----------------
|
||||
|
||||
.. envvar:: mod_env
|
||||
|
||||
Module environment, contains data pointer for module-specific data.
|
||||
See :class:`pythonmod_env`.
|
||||
|
||||
|
||||
Predefined constants
|
||||
-----------------------
|
||||
|
||||
Module extended state
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. data:: module_state_initial
|
||||
|
||||
Initial state - new DNS query.
|
||||
|
||||
.. data:: module_wait_reply
|
||||
|
||||
Waiting for reply to outgoing network query.
|
||||
|
||||
.. data:: module_wait_module
|
||||
|
||||
Module is waiting for another module.
|
||||
|
||||
.. data:: module_wait_subquery
|
||||
|
||||
Module is waiting for sub-query.
|
||||
|
||||
.. data:: module_error
|
||||
|
||||
Module could not finish the query.
|
||||
|
||||
.. data:: module_finished
|
||||
|
||||
Module is finished with query.
|
||||
|
||||
Module event
|
||||
~~~~~~~~~~~~~
|
||||
.. data:: module_event_new
|
||||
|
||||
New DNS query.
|
||||
|
||||
.. data:: module_event_pass
|
||||
|
||||
Query passed by other module.
|
||||
|
||||
.. data:: module_event_reply
|
||||
|
||||
Reply inbound from server.
|
||||
|
||||
.. data:: module_event_noreply
|
||||
|
||||
No reply, timeout or other error.
|
||||
|
||||
.. data:: module_event_capsfail
|
||||
|
||||
Reply is there, but capitalisation check failed.
|
||||
|
||||
.. data:: module_event_moddone
|
||||
|
||||
Next module is done, and its reply is awaiting you.
|
||||
|
||||
.. data:: module_event_error
|
||||
|
||||
Error occured.
|
||||
|
||||
Security status
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
.. data:: sec_status_unchecked
|
||||
|
||||
Means that object has yet to be validated.
|
||||
|
||||
.. data:: sec_status_bogus
|
||||
|
||||
Means that the object *(RRset or message)* failed to validate
|
||||
*(according to local policy)*, but should have validated.
|
||||
|
||||
.. data:: sec_status_indeterminate
|
||||
|
||||
Means that the object is insecure, but not
|
||||
authoritatively so. Generally this means that the RRset is not
|
||||
below a configured trust anchor.
|
||||
|
||||
.. data:: sec_status_insecure
|
||||
|
||||
Means that the object is authoritatively known to be
|
||||
insecure. Generally this means that this RRset is below a trust
|
||||
anchor, but also below a verified, insecure delegation.
|
||||
|
||||
.. data:: sec_status_secure
|
||||
|
||||
Means that the object (RRset or message) validated according to local policy.
|
||||
|
||||
Resource records (RR sets)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The different RR classes.
|
||||
|
||||
.. data:: RR_CLASS_IN
|
||||
|
||||
Internet.
|
||||
|
||||
.. data:: RR_CLASS_CH
|
||||
|
||||
Chaos.
|
||||
|
||||
.. data:: RR_CLASS_HS
|
||||
|
||||
Hesiod (Dyer 87)
|
||||
|
||||
.. data:: RR_CLASS_NONE
|
||||
|
||||
None class, dynamic update.
|
||||
|
||||
.. data:: RR_CLASS_ANY
|
||||
|
||||
Any class.
|
||||
|
||||
|
||||
The different RR types.
|
||||
|
||||
|
||||
.. data:: RR_TYPE_A
|
||||
|
||||
A host address.
|
||||
|
||||
.. data:: RR_TYPE_NS
|
||||
|
||||
An authoritative name server.
|
||||
|
||||
.. data:: RR_TYPE_MD
|
||||
|
||||
A mail destination (Obsolete - use MX).
|
||||
|
||||
.. data:: RR_TYPE_MF
|
||||
|
||||
A mail forwarder (Obsolete - use MX).
|
||||
|
||||
.. data:: RR_TYPE_CNAME
|
||||
|
||||
The canonical name for an alias.
|
||||
|
||||
.. data:: RR_TYPE_SOA
|
||||
|
||||
Marks the start of a zone of authority.
|
||||
|
||||
.. data:: RR_TYPE_MB
|
||||
|
||||
A mailbox domain name (EXPERIMENTAL).
|
||||
|
||||
.. data:: RR_TYPE_MG
|
||||
|
||||
A mail group member (EXPERIMENTAL).
|
||||
|
||||
.. data:: RR_TYPE_MR
|
||||
|
||||
A mail rename domain name (EXPERIMENTAL).
|
||||
|
||||
.. data:: RR_TYPE_NULL
|
||||
|
||||
A null RR (EXPERIMENTAL).
|
||||
|
||||
.. data:: RR_TYPE_WKS
|
||||
|
||||
A well known service description.
|
||||
|
||||
.. data:: RR_TYPE_PTR
|
||||
|
||||
A domain name pointer.
|
||||
|
||||
.. data:: RR_TYPE_HINFO
|
||||
|
||||
Host information.
|
||||
|
||||
.. data:: RR_TYPE_MINFO
|
||||
|
||||
Mailbox or mail list information.
|
||||
|
||||
.. data:: RR_TYPE_MX
|
||||
|
||||
Mail exchange.
|
||||
|
||||
.. data:: RR_TYPE_TXT
|
||||
|
||||
Text strings.
|
||||
|
||||
.. data:: RR_TYPE_RP
|
||||
|
||||
RFC1183.
|
||||
|
||||
.. data:: RR_TYPE_AFSDB
|
||||
|
||||
RFC1183.
|
||||
|
||||
.. data:: RR_TYPE_X25
|
||||
|
||||
RFC1183.
|
||||
|
||||
.. data:: RR_TYPE_ISDN
|
||||
|
||||
RFC1183.
|
||||
|
||||
.. data:: RR_TYPE_RT
|
||||
|
||||
RFC1183.
|
||||
|
||||
.. data:: RR_TYPE_NSAP
|
||||
|
||||
RFC1706.
|
||||
|
||||
.. data:: RR_TYPE_NSAP_PTR
|
||||
|
||||
RFC1348.
|
||||
|
||||
.. data:: RR_TYPE_SIG
|
||||
|
||||
2535typecode.
|
||||
|
||||
.. data:: RR_TYPE_KEY
|
||||
|
||||
2535typecode.
|
||||
|
||||
.. data:: RR_TYPE_PX
|
||||
|
||||
RFC2163.
|
||||
|
||||
.. data:: RR_TYPE_GPOS
|
||||
|
||||
RFC1712.
|
||||
|
||||
.. data:: RR_TYPE_AAAA
|
||||
|
||||
IPv6 address.
|
||||
|
||||
.. data:: RR_TYPE_LOC
|
||||
|
||||
LOC record RFC1876.
|
||||
|
||||
.. data:: RR_TYPE_NXT
|
||||
|
||||
2535typecode.
|
||||
|
||||
.. data:: RR_TYPE_EID
|
||||
|
||||
draft-ietf-nimrod-dns-01.txt.
|
||||
|
||||
.. data:: RR_TYPE_NIMLOC
|
||||
|
||||
draft-ietf-nimrod-dns-01.txt.
|
||||
|
||||
.. data:: RR_TYPE_SRV
|
||||
|
||||
SRV record RFC2782.
|
||||
|
||||
.. data:: RR_TYPE_ATMA
|
||||
|
||||
http://www.jhsoft.com/rfc/af-saa-0069.000.rtf.
|
||||
|
||||
.. data:: RR_TYPE_NAPTR
|
||||
|
||||
RFC2915.
|
||||
|
||||
.. data:: RR_TYPE_KX
|
||||
|
||||
RFC2230.
|
||||
|
||||
.. data:: RR_TYPE_CERT
|
||||
|
||||
RFC2538.
|
||||
|
||||
.. data:: RR_TYPE_A6
|
||||
|
||||
RFC2874.
|
||||
|
||||
.. data:: RR_TYPE_DNAME
|
||||
|
||||
RFC2672.
|
||||
|
||||
.. data:: RR_TYPE_SINK
|
||||
|
||||
dnsind-kitchen-sink-02.txt.
|
||||
|
||||
.. data:: RR_TYPE_OPT
|
||||
|
||||
Pseudo OPT record.
|
||||
|
||||
.. data:: RR_TYPE_APL
|
||||
|
||||
RFC3123.
|
||||
|
||||
.. data:: RR_TYPE_DS
|
||||
|
||||
draft-ietf-dnsext-delegation.
|
||||
|
||||
.. data:: RR_TYPE_SSHFP
|
||||
|
||||
SSH Key Fingerprint.
|
||||
|
||||
.. data:: RR_TYPE_IPSECKEY
|
||||
|
||||
draft-richardson-ipseckey-rr-11.txt.
|
||||
|
||||
.. data:: RR_TYPE_RRSIG
|
||||
|
||||
draft-ietf-dnsext-dnssec-25.
|
||||
|
||||
.. data:: RR_TYPE_NSEC
|
||||
.. data:: RR_TYPE_DNSKEY
|
||||
.. data:: RR_TYPE_DHCID
|
||||
.. data:: RR_TYPE_NSEC3
|
||||
.. data:: RR_TYPE_NSEC3PARAMS
|
||||
.. data:: RR_TYPE_UINFO
|
||||
.. data:: RR_TYPE_UID
|
||||
.. data:: RR_TYPE_GID
|
||||
.. data:: RR_TYPE_UNSPEC
|
||||
.. data:: RR_TYPE_TSIG
|
||||
.. data:: RR_TYPE_IXFR
|
||||
.. data:: RR_TYPE_AXFR
|
||||
.. data:: RR_TYPE_MAILB
|
||||
|
||||
A request for mailbox-related records (MB, MG or MR).
|
||||
|
||||
.. data:: RR_TYPE_MAILA
|
||||
|
||||
A request for mail agent RRs (Obsolete - see MX).
|
||||
|
||||
.. data:: RR_TYPE_ANY
|
||||
|
||||
Any type *(wildcard)*.
|
||||
|
||||
.. data:: RR_TYPE_DLV
|
||||
|
||||
RFC 4431, 5074, DNSSEC Lookaside Validation.
|
||||
|
||||
Return codes
|
||||
~~~~~~~~~~~~
|
||||
|
||||
Return codes for packets.
|
||||
|
||||
.. data:: RCODE_NOERROR
|
||||
.. data:: RCODE_FORMERR
|
||||
.. data:: RCODE_SERVFAIL
|
||||
.. data:: RCODE_NXDOMAIN
|
||||
.. data:: RCODE_NOTIMPL
|
||||
.. data:: RCODE_REFUSED
|
||||
.. data:: RCODE_YXDOMAIN
|
||||
.. data:: RCODE_YXRRSET
|
||||
.. data:: RCODE_NXRRSET
|
||||
.. data:: RCODE_NOTAUTH
|
||||
.. data:: RCODE_NOTZONE
|
||||
|
||||
Packet data
|
||||
~~~~~~~~~~~~
|
||||
|
||||
.. data:: PKT_QR
|
||||
|
||||
Query - query flag.
|
||||
|
||||
.. data:: PKT_AA
|
||||
|
||||
Authoritative Answer - server flag.
|
||||
|
||||
.. data:: PKT_TC
|
||||
|
||||
Truncated - server flag.
|
||||
|
||||
.. data:: PKT_RD
|
||||
|
||||
Recursion desired - query flag.
|
||||
|
||||
.. data:: PKT_CD
|
||||
|
||||
Checking disabled - query flag.
|
||||
|
||||
.. data:: PKT_RA
|
||||
|
||||
Recursion available - server flag.
|
||||
|
||||
.. data:: PKT_AD
|
||||
|
||||
Authenticated data - server flag.
|
||||
|
||||
|
||||
Verbosity value
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
.. data:: NO_VERBOSE
|
||||
|
||||
No verbose messages.
|
||||
|
||||
.. data:: VERB_OPS
|
||||
|
||||
Operational information.
|
||||
|
||||
.. data:: VERB_DETAIL
|
||||
|
||||
Detailed information.
|
||||
|
||||
.. data:: VERB_QUERY
|
||||
|
||||
Query level information.
|
||||
|
||||
.. data:: VERB_ALGO
|
||||
|
||||
Algorithm level information.
|
120
external/unbound/pythonmod/doc/modules/functions.rst
vendored
Normal file
120
external/unbound/pythonmod/doc/modules/functions.rst
vendored
Normal file
|
@ -0,0 +1,120 @@
|
|||
Scriptable functions
|
||||
====================
|
||||
|
||||
Network
|
||||
-------
|
||||
|
||||
.. function:: ntohs(netshort)
|
||||
|
||||
This subroutine converts values between the host and network byte order.
|
||||
Specifically, **ntohs()** converts 16-bit quantities from network byte order to host byte order.
|
||||
|
||||
:param netshort: 16-bit short addr
|
||||
:rtype: converted addr
|
||||
|
||||
|
||||
Cache
|
||||
-----
|
||||
|
||||
.. function:: storeQueryInCache(qstate, qinfo, msgrep, is_referral)
|
||||
|
||||
Store pending query in local cache.
|
||||
|
||||
:param qstate: :class:`module_qstate`
|
||||
:param qinfo: :class:`query_info`
|
||||
:param msgrep: :class:`reply_info`
|
||||
:param is_referal: integer
|
||||
:rtype: boolean
|
||||
|
||||
.. function:: invalidateQueryInCache(qstate, qinfo)
|
||||
|
||||
Invalidate record in local cache.
|
||||
|
||||
:param qstate: :class:`module_qstate`
|
||||
:param qinfo: :class:`query_info`
|
||||
|
||||
|
||||
Logging
|
||||
-------
|
||||
|
||||
.. function:: verbose(level, msg)
|
||||
|
||||
Log a verbose message, pass the level for this message.
|
||||
No trailing newline is needed.
|
||||
|
||||
:param level: verbosity level for this message, compared to global verbosity setting.
|
||||
:param msg: string message
|
||||
|
||||
.. function:: log_info(msg)
|
||||
|
||||
Log informational message. No trailing newline is needed.
|
||||
|
||||
:param msg: string message
|
||||
|
||||
.. function:: log_err(msg)
|
||||
|
||||
Log error message. No trailing newline is needed.
|
||||
|
||||
:param msg: string message
|
||||
|
||||
.. function:: log_warn(msg)
|
||||
|
||||
Log warning message. No trailing newline is needed.
|
||||
|
||||
:param msg: string message
|
||||
|
||||
.. function:: log_hex(msg, data, length)
|
||||
|
||||
Log a hex-string to the log. Can be any length.
|
||||
performs mallocs to do so, slow. But debug useful.
|
||||
|
||||
:param msg: string desc to accompany the hexdump.
|
||||
:param data: data to dump in hex format.
|
||||
:param length: length of data.
|
||||
|
||||
.. function:: log_dns_msg(str, qinfo, reply)
|
||||
|
||||
Log DNS message.
|
||||
|
||||
:param str: string message
|
||||
:param qinfo: :class:`query_info`
|
||||
:param reply: :class:`reply_info`
|
||||
|
||||
.. function:: log_query_info(verbosity_value, str, qinf)
|
||||
|
||||
Log query information.
|
||||
|
||||
:param verbosity_value: see constants
|
||||
:param str: string message
|
||||
:param qinf: :class:`query_info`
|
||||
|
||||
.. function:: regional_log_stats(r)
|
||||
|
||||
Log regional statistics.
|
||||
|
||||
:param r: :class:`regional`
|
||||
|
||||
Debugging
|
||||
---------
|
||||
|
||||
.. function:: strextstate(module_ext_state)
|
||||
|
||||
Debug utility, module external qstate to string.
|
||||
|
||||
:param module_ext_state: the state value.
|
||||
:rtype: descriptive string.
|
||||
|
||||
.. function:: strmodulevent(module_event)
|
||||
|
||||
Debug utility, module event to string.
|
||||
|
||||
:param module_event: the module event value.
|
||||
:rtype: descriptive string.
|
||||
|
||||
.. function:: ldns_rr_type2str(atype)
|
||||
|
||||
Convert RR type to string.
|
||||
|
||||
.. function:: ldns_rr_class2str(aclass)
|
||||
|
||||
Convert RR class to string.
|
11
external/unbound/pythonmod/doc/modules/index.rst
vendored
Normal file
11
external/unbound/pythonmod/doc/modules/index.rst
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
Unbound module documentation
|
||||
=======================================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
env
|
||||
struct
|
||||
functions
|
||||
config
|
||||
|
427
external/unbound/pythonmod/doc/modules/struct.rst
vendored
Normal file
427
external/unbound/pythonmod/doc/modules/struct.rst
vendored
Normal file
|
@ -0,0 +1,427 @@
|
|||
Scriptable structures
|
||||
=====================
|
||||
|
||||
module_qstate
|
||||
-----------------------
|
||||
|
||||
.. class:: module_qstate
|
||||
|
||||
Module state, per query.
|
||||
|
||||
This class provides these data attributes:
|
||||
|
||||
.. attribute:: qinfo
|
||||
|
||||
(:class:`query_info`) Informations about query being answered. Name, RR type, RR class.
|
||||
|
||||
.. attribute:: query_flags
|
||||
|
||||
(uint16) Flags for query. See QF_BIT\_ predefined constants.
|
||||
|
||||
.. attribute:: is_priming
|
||||
|
||||
If this is a (stub or root) priming query (with hints).
|
||||
|
||||
.. attribute:: reply
|
||||
|
||||
comm_reply contains server replies.
|
||||
|
||||
.. attribute:: return_msg
|
||||
|
||||
(:class:`dns_msg`) The reply message, with message for client and calling module (read-only attribute).
|
||||
Note that if you want to create of modify return_msg you should use :class:`DNSMessage`.
|
||||
|
||||
.. attribute:: return_rcode
|
||||
|
||||
The rcode, in case of error, instead of a reply message. Determines whether the return_msg contains reply.
|
||||
|
||||
.. attribute:: region
|
||||
|
||||
Region for this query. Cleared when query process finishes.
|
||||
|
||||
.. attribute:: curmod
|
||||
|
||||
Which module is executing.
|
||||
|
||||
.. attribute:: ext_state[]
|
||||
|
||||
Module states.
|
||||
|
||||
.. attribute:: env
|
||||
|
||||
Environment for this query.
|
||||
|
||||
.. attribute:: mesh_info
|
||||
|
||||
Mesh related information for this query.
|
||||
|
||||
|
||||
query_info
|
||||
----------------
|
||||
|
||||
.. class:: query_info
|
||||
|
||||
This class provides these data attributes:
|
||||
|
||||
.. attribute:: qname
|
||||
|
||||
The original question in the wireformat format (e.g. \\x03www\\x03nic\\x02cz\\x00 for www.nic.cz)
|
||||
|
||||
.. attribute:: qname_len
|
||||
|
||||
Lenght of question name (number of bytes).
|
||||
|
||||
.. attribute:: qname_list[]
|
||||
|
||||
The question ``qname`` converted into list of labels (e.g. ['www','nic','cz',''] for www.nic.cz)
|
||||
|
||||
.. attribute:: qname_str
|
||||
|
||||
The question ``qname`` converted into string (e.g. www.nic.cz. for www.nic.cz)
|
||||
|
||||
.. attribute:: qtype
|
||||
|
||||
The class type asked for. See RR_TYPE\_ predefined constants.
|
||||
|
||||
.. attribute:: qtype_str
|
||||
|
||||
The ``qtype`` in display presentation format (string) (e.g 'A' for RR_TYPE_A)
|
||||
|
||||
.. attribute:: qclass
|
||||
|
||||
The question class. See RR_CLASS\_ predefined constants.
|
||||
|
||||
.. attribute:: qclass_str
|
||||
|
||||
The ``qclass`` in display presentation format (string).
|
||||
|
||||
reply_info
|
||||
--------------------
|
||||
|
||||
.. class:: reply_info
|
||||
|
||||
This class provides these data attributes:
|
||||
|
||||
.. attribute:: flags
|
||||
|
||||
The flags for the answer, host byte order.
|
||||
|
||||
.. attribute:: qdcount
|
||||
|
||||
Number of RRs in the query section.
|
||||
If qdcount is not 0, then it is 1, and the data that appears
|
||||
in the reply is the same as the query_info.
|
||||
Host byte order.
|
||||
|
||||
.. attribute:: ttl
|
||||
|
||||
TTL of the entire reply (for negative caching).
|
||||
only for use when there are 0 RRsets in this message.
|
||||
if there are RRsets, check those instead.
|
||||
|
||||
.. attribute:: security
|
||||
|
||||
The security status from DNSSEC validation of this message. See sec_status\_ predefined constants.
|
||||
|
||||
.. attribute:: an_numrrsets
|
||||
|
||||
Number of RRsets in each section.
|
||||
The answer section. Add up the RRs in every RRset to calculate
|
||||
the number of RRs, and the count for the dns packet.
|
||||
The number of RRs in RRsets can change due to RRset updates.
|
||||
|
||||
.. attribute:: ns_numrrsets
|
||||
|
||||
Count of authority section RRsets
|
||||
|
||||
.. attribute:: ar_numrrsets
|
||||
|
||||
Count of additional section RRsets
|
||||
|
||||
.. attribute:: rrset_count
|
||||
|
||||
Number of RRsets: an_numrrsets + ns_numrrsets + ar_numrrsets
|
||||
|
||||
.. attribute:: rrsets[]
|
||||
|
||||
(:class:`ub_packed_rrset_key`) List of RR sets in the order in which they appear in the reply message.
|
||||
Number of elements is ancount + nscount + arcount RRsets.
|
||||
|
||||
.. attribute:: ref[]
|
||||
|
||||
(:class:`rrset_ref`) Packed array of ids (see counts) and pointers to packed_rrset_key.
|
||||
The number equals ancount + nscount + arcount RRsets.
|
||||
These are sorted in ascending pointer, the locking order. So
|
||||
this list can be locked (and id, ttl checked), to see if
|
||||
all the data is available and recent enough.
|
||||
|
||||
|
||||
dns_msg
|
||||
--------------
|
||||
|
||||
.. class:: dns_msg
|
||||
|
||||
Region allocated message reply
|
||||
|
||||
This class provides these data attributes:
|
||||
|
||||
.. attribute:: qinfo
|
||||
|
||||
(:class:`query_info`) Informations about query.
|
||||
|
||||
.. attribute:: rep
|
||||
|
||||
(:class:`reply_info`) This attribute points to the packed reply structure.
|
||||
|
||||
|
||||
packed_rrset_key
|
||||
----------------------
|
||||
|
||||
.. class:: packed_rrset_key
|
||||
|
||||
The identifying information for an RRset.
|
||||
|
||||
This class provides these data attributes:
|
||||
|
||||
.. attribute:: dname
|
||||
|
||||
The domain name. If not empty (for ``id = None``) it is allocated, and
|
||||
contains the wireformat domain name. This dname is not canonicalized.
|
||||
E.g., the dname contains \\x03www\\x03nic\\x02cz\\x00 for www.nic.cz.
|
||||
|
||||
.. attribute:: dname_len
|
||||
|
||||
Length of the domain name, including last 0 root octet.
|
||||
|
||||
.. attribute:: dname_list[]
|
||||
|
||||
The domain name ``dname`` converted into list of labels (see :attr:`query_info.qname_list`).
|
||||
|
||||
.. attribute:: dname_str
|
||||
|
||||
The domain name ``dname`` converted into string (see :attr:`query_info.qname_str`).
|
||||
|
||||
.. attribute:: flags
|
||||
|
||||
Flags.
|
||||
|
||||
.. attribute:: type
|
||||
|
||||
The rrset type in network format.
|
||||
|
||||
.. attribute:: type_str
|
||||
|
||||
The rrset type in display presentation format.
|
||||
|
||||
.. attribute:: rrset_class
|
||||
|
||||
The rrset class in network format.
|
||||
|
||||
.. attribute:: rrset_class_str
|
||||
|
||||
The rrset class in display presentation format.
|
||||
|
||||
ub_packed_rrset_key
|
||||
-------------------------
|
||||
|
||||
.. class:: ub_packed_rrset_key
|
||||
|
||||
This structure contains an RRset. A set of resource records that
|
||||
share the same domain name, type and class.
|
||||
Due to memory management and threading, the key structure cannot be
|
||||
deleted, although the data can be. The id can be set to 0 to store and the
|
||||
structure can be recycled with a new id.
|
||||
|
||||
The :class:`ub_packed_rrset_key` provides these data attributes:
|
||||
|
||||
.. attribute:: entry
|
||||
|
||||
(:class:`lruhash_entry`) Entry into hashtable. Note the lock is never destroyed,
|
||||
even when this key is retired to the cache.
|
||||
the data pointer (if not None) points to a :class:`packed_rrset`.
|
||||
|
||||
.. attribute:: id
|
||||
|
||||
The ID of this rrset. unique, based on threadid + sequenceno.
|
||||
ids are not reused, except after flushing the cache.
|
||||
zero is an unused entry, and never a valid id.
|
||||
Check this value after getting entry.lock.
|
||||
The other values in this struct may only be altered after changing
|
||||
the id (which needs a writelock on entry.lock).
|
||||
|
||||
.. attribute:: rk
|
||||
|
||||
(:class:`packed_rrset_key`) RR set data.
|
||||
|
||||
|
||||
lruhash_entry
|
||||
-------------------------
|
||||
|
||||
.. class:: lruhash_entry
|
||||
|
||||
The :class:`ub_packed_rrset_key` provides these data attributes:
|
||||
|
||||
.. attribute:: lock
|
||||
|
||||
rwlock for access to the contents of the entry. Note that you cannot change hash and key, if so, you have to delete it to change hash or key.
|
||||
|
||||
.. attribute:: data
|
||||
|
||||
(:class:`packed_rrset_data`) entry data stored in wireformat (RRs and RRsigs).
|
||||
|
||||
packed_rrset_data
|
||||
-----------------------
|
||||
|
||||
.. class:: packed_rrset_data
|
||||
|
||||
Rdata is stored in wireformat. The dname is stored in wireformat.
|
||||
|
||||
TTLs are stored as absolute values (and could be expired).
|
||||
|
||||
RRSIGs are stored in the arrays after the regular rrs.
|
||||
|
||||
You need the packed_rrset_key to know dname, type, class of the
|
||||
resource records in this RRset. (if signed the rrsig gives the type too).
|
||||
|
||||
The :class:`packed_rrset_data` provides these data attributes:
|
||||
|
||||
.. attribute:: ttl
|
||||
|
||||
TTL (in seconds like time()) of the RRset.
|
||||
Same for all RRs see rfc2181(5.2).
|
||||
|
||||
.. attribute:: count
|
||||
|
||||
Number of RRs.
|
||||
|
||||
.. attribute:: rrsig_count
|
||||
|
||||
Number of rrsigs, if 0 no rrsigs.
|
||||
|
||||
.. attribute:: trust
|
||||
|
||||
The trustworthiness of the RRset data.
|
||||
|
||||
.. attribute:: security
|
||||
|
||||
Security status of the RRset data. See sec_status\_ predefined constants.
|
||||
|
||||
.. attribute:: rr_len[]
|
||||
|
||||
Length of every RR's rdata, rr_len[i] is size of rr_data[i].
|
||||
|
||||
.. attribute:: rr_ttl[]
|
||||
|
||||
TTL of every rr. rr_ttl[i] ttl of rr i.
|
||||
|
||||
.. attribute:: rr_data[]
|
||||
|
||||
Array of RR's rdata (list of strings). The rdata is stored in uncompressed wireformat.
|
||||
The first 16B of rr_data[i] is rdlength in network format.
|
||||
|
||||
|
||||
DNSMessage
|
||||
----------------
|
||||
|
||||
.. class:: DNSMessage
|
||||
|
||||
Abstract representation of DNS message.
|
||||
|
||||
**Usage**
|
||||
|
||||
This example shows how to create an authoritative answer response
|
||||
|
||||
::
|
||||
|
||||
msg = DNSMessage(qstate.qinfo.qname_str, RR_TYPE_A, RR_CLASS_IN, PKT_AA)
|
||||
|
||||
#append RR
|
||||
if (qstate.qinfo.qtype == RR_TYPE_A) or (qstate.qinfo.qtype == RR_TYPE_ANY):
|
||||
msg.answer.append("%s 10 IN A 127.0.0.1" % qstate.qinfo.qname_str)
|
||||
|
||||
#set qstate.return_msg
|
||||
if not msg.set_return_msg(qstate):
|
||||
raise Exception("Can't create response")
|
||||
|
||||
The :class:`DNSMessage` provides these methods and data attributes:
|
||||
|
||||
.. method:: __init__(self, rr_name, rr_type, rr_class = RR_CLASS_IN, query_flags = 0, default_ttl = 0)
|
||||
|
||||
Prepares an answer (DNS packet) from qiven information. Query flags are combination of PKT_xx contants.
|
||||
|
||||
.. method:: set_return_msg(self, qstate)
|
||||
|
||||
This method fills qstate return message according to the given informations.
|
||||
It takes lists of RRs in each section of answer, created necessray RRsets in wire format and store the result in :attr:`qstate.return_msg`.
|
||||
Returns 1 if OK.
|
||||
|
||||
.. attribute:: rr_name
|
||||
|
||||
RR name of question.
|
||||
|
||||
.. attribute:: rr_type
|
||||
|
||||
RR type of question.
|
||||
|
||||
.. attribute:: rr_class
|
||||
|
||||
RR class of question.
|
||||
|
||||
.. attribute:: default_ttl
|
||||
|
||||
Default time-to-live.
|
||||
|
||||
.. attribute:: query_flags
|
||||
|
||||
Query flags. See PKT\_ predefined constants.
|
||||
|
||||
.. attribute:: question[]
|
||||
|
||||
List of resource records that should appear (in the same order) in question section of answer.
|
||||
|
||||
.. attribute:: answer[]
|
||||
|
||||
List of resource records that should appear (in the same order) in answer section of answer.
|
||||
|
||||
.. attribute:: authority[]
|
||||
|
||||
List of resource records that should appear (in the same order) in authority section of answer.
|
||||
|
||||
.. attribute:: additional[]
|
||||
|
||||
List of resource records that should appear (in the same order) in additional section of answer.
|
||||
|
||||
pythonmod_env
|
||||
-----------------------
|
||||
|
||||
.. class:: pythonmod_env
|
||||
|
||||
Global state for the module.
|
||||
|
||||
This class provides these data attributes:
|
||||
|
||||
.. attribute:: data
|
||||
|
||||
Here you can keep your own data shared across each thread.
|
||||
|
||||
.. attribute:: fname
|
||||
|
||||
Python script filename.
|
||||
|
||||
.. attribute:: qstate
|
||||
|
||||
Module query state.
|
||||
|
||||
pythonmod_qstate
|
||||
-----------------------
|
||||
|
||||
.. class:: pythonmod_qstate
|
||||
|
||||
Per query state for the iterator module.
|
||||
|
||||
This class provides these data attributes:
|
||||
|
||||
.. attribute:: data
|
||||
|
||||
Here you can keep your own private data (each thread has own data object).
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue