#include <isc/lang.h>
#include <isc/magic.h>
#include <dns/compress.h>
#include <dns/masterdump.h>
#include <dns/types.h>
#include <dst/dst.h>
Go to the source code of this file.
Data Structures | |
struct | dns_message |
struct | dns_ednsopt |
Defines | |
#define | DNS_MESSAGE_H 1 |
#define | DNS_MESSAGEFLAG_QR 0x8000U |
#define | DNS_MESSAGEFLAG_AA 0x0400U |
#define | DNS_MESSAGEFLAG_TC 0x0200U |
#define | DNS_MESSAGEFLAG_RD 0x0100U |
#define | DNS_MESSAGEFLAG_RA 0x0080U |
#define | DNS_MESSAGEFLAG_AD 0x0020U |
#define | DNS_MESSAGEFLAG_CD 0x0010U |
EDNS0 extended message flags. | |
#define | DNS_MESSAGEEXTFLAG_DO 0x8000U |
EDNS0 extended OPT codes. | |
#define | DNS_OPT_NSID 0x0003 |
NSID opt code. | |
#define | DNS_OPT_CLIENT_SUBNET 0x0008 |
client subnet opt code | |
#define | DNS_OPT_EXPIRE 0x0009 |
EXPIRE opt code. | |
#define | DNS_OPT_SIT 65001 |
SIT opt code. | |
#define | DNS_EDNSOPTIONS 5 |
#define | DNS_MESSAGE_REPLYPRESERVE (DNS_MESSAGEFLAG_RD|DNS_MESSAGEFLAG_CD) |
#define | DNS_MESSAGEEXTFLAG_REPLYPRESERVE (DNS_MESSAGEEXTFLAG_DO) |
#define | DNS_MESSAGE_HEADERLEN 12 |
6 isc_uint16_t's | |
#define | DNS_MESSAGE_MAGIC ISC_MAGIC('M','S','G','@') |
#define | DNS_MESSAGE_VALID(msg) ISC_MAGIC_VALID(msg, DNS_MESSAGE_MAGIC) |
#define | DNS_SECTION_ANY (-1) |
#define | DNS_SECTION_QUESTION 0 |
#define | DNS_SECTION_ANSWER 1 |
#define | DNS_SECTION_AUTHORITY 2 |
#define | DNS_SECTION_ADDITIONAL 3 |
#define | DNS_SECTION_MAX 4 |
#define | DNS_PSEUDOSECTION_ANY (-1) |
#define | DNS_PSEUDOSECTION_OPT 0 |
#define | DNS_PSEUDOSECTION_TSIG 1 |
#define | DNS_PSEUDOSECTION_SIG0 2 |
#define | DNS_PSEUDOSECTION_MAX 3 |
#define | DNS_MESSAGETEXTFLAG_NOCOMMENTS 0x0001 |
#define | DNS_MESSAGETEXTFLAG_NOHEADERS 0x0002 |
#define | DNS_MESSAGETEXTFLAG_ONESOA 0x0004 |
#define | DNS_MESSAGETEXTFLAG_OMITSOA 0x0008 |
#define | DNS_MESSAGETEXTFLAG_COMMENTDATA 0x0010 |
#define | DNS_SECTION_ZONE DNS_SECTION_QUESTION |
#define | DNS_SECTION_PREREQUISITE DNS_SECTION_ANSWER |
#define | DNS_SECTION_UPDATE DNS_SECTION_AUTHORITY |
#define | DNS_MESSAGE_INTENTUNKNOWN 0 |
internal use only | |
#define | DNS_MESSAGE_INTENTPARSE 1 |
parsing messages | |
#define | DNS_MESSAGE_INTENTRENDER 2 |
rendering | |
#define | DNS_MESSAGEPARSE_PRESERVEORDER 0x0001 |
preserve rdata order | |
#define | DNS_MESSAGEPARSE_BESTEFFORT 0x0002 |
return a message if a recoverable parse error occurs | |
#define | DNS_MESSAGEPARSE_CLONEBUFFER 0x0004 |
save a copy of the source buffer | |
#define | DNS_MESSAGEPARSE_IGNORETRUNCATION 0x0008 |
truncation errors are not fatal. | |
#define | DNS_MESSAGERENDER_ORDERED 0x0001 |
don't change order | |
#define | DNS_MESSAGERENDER_PARTIAL 0x0002 |
allow a partial rdataset | |
#define | DNS_MESSAGERENDER_OMITDNSSEC 0x0004 |
omit DNSSEC records | |
#define | DNS_MESSAGERENDER_PREFER_A 0x0008 |
prefer A records in additional section. | |
#define | DNS_MESSAGERENDER_PREFER_AAAA 0x0010 |
prefer AAAA records in additional section. | |
Typedefs | |
typedef int | dns_section_t |
typedef int | dns_pseudosection_t |
typedef int | dns_messagetextflag_t |
typedef struct dns_msgblock | dns_msgblock_t |
Functions | |
ISC_LANG_BEGINDECLS isc_result_t | dns_message_create (isc_mem_t *mctx, unsigned int intent, dns_message_t **msgp) |
Create msg structure. | |
void | dns_message_reset (dns_message_t *msg, unsigned int intent) |
Reset a message structure to default state. All internal lists are freed or reset to a default state as well. This is simply a more efficient way to call dns_message_destroy() followed by dns_message_allocate(), since it avoid many memory allocations. | |
void | dns_message_destroy (dns_message_t **msgp) |
Destroy all state in the message. | |
isc_result_t | dns_message_sectiontotext (dns_message_t *msg, dns_section_t section, const dns_master_style_t *style, dns_messagetextflag_t flags, isc_buffer_t *target) |
isc_result_t | dns_message_pseudosectiontotext (dns_message_t *msg, dns_pseudosection_t section, const dns_master_style_t *style, dns_messagetextflag_t flags, isc_buffer_t *target) |
Convert section 'section' or 'pseudosection' of message 'msg' to a cleartext representation. | |
isc_result_t | dns_message_totext (dns_message_t *msg, const dns_master_style_t *style, dns_messagetextflag_t flags, isc_buffer_t *target) |
Convert all sections of message 'msg' to a cleartext representation. | |
isc_result_t | dns_message_parse (dns_message_t *msg, isc_buffer_t *source, unsigned int options) |
Parse raw wire data in 'source' as a DNS message. | |
isc_result_t | dns_message_renderbegin (dns_message_t *msg, dns_compress_t *cctx, isc_buffer_t *buffer) |
Begin rendering on a message. Only one call can be made to this function per message. | |
isc_result_t | dns_message_renderchangebuffer (dns_message_t *msg, isc_buffer_t *buffer) |
Reset the buffer. This can be used after growing the old buffer on a ISC_R_NOSPACE return from most of the render functions. | |
isc_result_t | dns_message_renderreserve (dns_message_t *msg, unsigned int space) |
XXXMLG should use size_t rather than unsigned int once the buffer API is cleaned up. | |
void | dns_message_renderrelease (dns_message_t *msg, unsigned int space) |
XXXMLG should use size_t rather than unsigned int once the buffer API is cleaned up. | |
isc_result_t | dns_message_rendersection (dns_message_t *msg, dns_section_t section, unsigned int options) |
Render all names, rdatalists, etc from the given section at the specified priority or higher. | |
void | dns_message_renderheader (dns_message_t *msg, isc_buffer_t *target) |
Render the message header. This is implicitly called by dns_message_renderend(). | |
isc_result_t | dns_message_renderend (dns_message_t *msg) |
Finish rendering to the buffer. Note that more data can be in the 'msg' structure. Destroying the structure will free this, or in a multi- part EDNS1 message this data can be rendered to another buffer later. | |
void | dns_message_renderreset (dns_message_t *msg) |
Reset the message so that it may be rendered again. | |
isc_result_t | dns_message_firstname (dns_message_t *msg, dns_section_t section) |
Set internal per-section name pointer to the beginning of the section. | |
isc_result_t | dns_message_nextname (dns_message_t *msg, dns_section_t section) |
Sets the internal per-section name pointer to point to the next name in that section. | |
void | dns_message_currentname (dns_message_t *msg, dns_section_t section, dns_name_t **name) |
Sets 'name' to point to the name where the per-section internal name pointer is currently set. | |
isc_result_t | dns_message_findname (dns_message_t *msg, dns_section_t section, dns_name_t *target, dns_rdatatype_t type, dns_rdatatype_t covers, dns_name_t **foundname, dns_rdataset_t **rdataset) |
Search for a name in the specified section. If it is found, *name is set to point to the name, and *rdataset is set to point to the found rdataset (if type is specified as other than dns_rdatatype_any). | |
isc_result_t | dns_message_findtype (dns_name_t *name, dns_rdatatype_t type, dns_rdatatype_t covers, dns_rdataset_t **rdataset) |
Search the name for the specified type. If it is found, *rdataset is filled in with a pointer to that rdataset. | |
isc_result_t | dns_message_find (dns_name_t *name, dns_rdataclass_t rdclass, dns_rdatatype_t type, dns_rdatatype_t covers, dns_rdataset_t **rdataset) |
Search the name for the specified rdclass and type. If it is found, *rdataset is filled in with a pointer to that rdataset. | |
void | dns_message_movename (dns_message_t *msg, dns_name_t *name, dns_section_t fromsection, dns_section_t tosection) |
Move a name from one section to another. | |
void | dns_message_addname (dns_message_t *msg, dns_name_t *name, dns_section_t section) |
Adds the name to the given section. | |
void | dns_message_removename (dns_message_t *msg, dns_name_t *name, dns_section_t section) |
Remove a existing name from a given section. | |
isc_result_t | dns_message_gettempname (dns_message_t *msg, dns_name_t **item) |
Return a name that can be used for any temporary purpose, including inserting into the message's linked lists. The name must be returned to the message code using dns_message_puttempname() or inserted into one of the message's sections before the message is destroyed. | |
isc_result_t | dns_message_gettempoffsets (dns_message_t *msg, dns_offsets_t **item) |
Return an offsets array that can be used for any temporary purpose, such as attaching to a temporary name. The offsets will be freed when the message is destroyed or reset. | |
isc_result_t | dns_message_gettemprdata (dns_message_t *msg, dns_rdata_t **item) |
Return a rdata that can be used for any temporary purpose, including inserting into the message's linked lists. The rdata will be freed when the message is destroyed or reset. | |
isc_result_t | dns_message_gettemprdataset (dns_message_t *msg, dns_rdataset_t **item) |
Return a rdataset that can be used for any temporary purpose, including inserting into the message's linked lists. The name must be returned to the message code using dns_message_puttempname() or inserted into one of the message's sections before the message is destroyed. | |
isc_result_t | dns_message_gettemprdatalist (dns_message_t *msg, dns_rdatalist_t **item) |
Return a rdatalist that can be used for any temporary purpose, including inserting into the message's linked lists. The rdatalist will be destroyed when the message is destroyed or reset. | |
void | dns_message_puttempname (dns_message_t *msg, dns_name_t **item) |
Return a borrowed name to the message's name free list. | |
void | dns_message_puttemprdata (dns_message_t *msg, dns_rdata_t **item) |
Return a borrowed rdata to the message's rdata free list. | |
void | dns_message_puttemprdataset (dns_message_t *msg, dns_rdataset_t **item) |
Return a borrowed rdataset to the message's rdataset free list. | |
void | dns_message_puttemprdatalist (dns_message_t *msg, dns_rdatalist_t **item) |
Return a borrowed rdatalist to the message's rdatalist free list. | |
isc_result_t | dns_message_peekheader (isc_buffer_t *source, dns_messageid_t *idp, unsigned int *flagsp) |
Assume the remaining region of "source" is a DNS message. Peek into it and fill in "*idp" with the message id, and "*flagsp" with the flags. | |
isc_result_t | dns_message_reply (dns_message_t *msg, isc_boolean_t want_question_section) |
Start formatting a reply to the query in 'msg'. | |
dns_rdataset_t * | dns_message_getopt (dns_message_t *msg) |
Get the OPT record for 'msg'. | |
isc_result_t | dns_message_setopt (dns_message_t *msg, dns_rdataset_t *opt) |
Set the OPT record for 'msg'. | |
dns_rdataset_t * | dns_message_gettsig (dns_message_t *msg, dns_name_t **owner) |
Get the TSIG record and owner for 'msg'. | |
isc_result_t | dns_message_settsigkey (dns_message_t *msg, dns_tsigkey_t *key) |
Set the tsig key for 'msg'. This is only necessary for when rendering a query or parsing a response. The key (if non-NULL) is attached to, and will be detached when the message is destroyed. | |
dns_tsigkey_t * | dns_message_gettsigkey (dns_message_t *msg) |
Gets the tsig key for 'msg'. | |
isc_result_t | dns_message_setquerytsig (dns_message_t *msg, isc_buffer_t *querytsig) |
Indicates that 'querytsig' is the TSIG from the signed query for which 'msg' is the response. This is also used for chained TSIGs in TCP responses. | |
isc_result_t | dns_message_getquerytsig (dns_message_t *msg, isc_mem_t *mctx, isc_buffer_t **querytsig) |
Gets the tsig from the TSIG from the signed query 'msg'. This is also used for chained TSIGs in TCP responses. Unlike dns_message_gettsig, this makes a copy of the data, so can be used if the message is destroyed. | |
dns_rdataset_t * | dns_message_getsig0 (dns_message_t *msg, dns_name_t **owner) |
Get the SIG(0) record and owner for 'msg'. | |
isc_result_t | dns_message_setsig0key (dns_message_t *msg, dst_key_t *key) |
Set the SIG(0) key for 'msg'. | |
dst_key_t * | dns_message_getsig0key (dns_message_t *msg) |
Gets the SIG(0) key for 'msg'. | |
void | dns_message_takebuffer (dns_message_t *msg, isc_buffer_t **buffer) |
Give the *buffer to the message code to clean up when it is no longer needed. This is usually when the message is reset or destroyed. | |
isc_result_t | dns_message_signer (dns_message_t *msg, dns_name_t *signer) |
If this message was signed, return the identity of the signer. Unless ISC_R_NOTFOUND is returned, signer will reflect the name of the key that signed the message. | |
isc_result_t | dns_message_checksig (dns_message_t *msg, dns_view_t *view) |
If this message was signed, verify the signature. | |
isc_result_t | dns_message_rechecksig (dns_message_t *msg, dns_view_t *view) |
Reset the signature state and then if the message was signed, verify the message. | |
void | dns_message_resetsig (dns_message_t *msg) |
Reset the signature state. | |
isc_region_t * | dns_message_getrawmessage (dns_message_t *msg) |
Retrieve the raw message in compressed wire format. The message must have been successfully parsed for it to have been saved. | |
void | dns_message_setsortorder (dns_message_t *msg, dns_rdatasetorderfunc_t order, const void *order_arg) |
Define the order in which RR sets get rendered by dns_message_rendersection() to be the ascending order defined by the integer value returned by 'order' when given each RR and 'arg' as arguments. If 'order' and 'order_arg' are NULL, a default order is used. | |
void | dns_message_settimeadjust (dns_message_t *msg, int timeadjust) |
Adjust the time used to sign/verify a message by timeadjust. Currently only TSIG. | |
int | dns_message_gettimeadjust (dns_message_t *msg) |
Return the current time adjustment. | |
void | dns_message_logpacket (dns_message_t *message, const char *description, isc_logcategory_t *category, isc_logmodule_t *module, int level, isc_mem_t *mctx) |
void | dns_message_logpacket2 (dns_message_t *message, const char *description, isc_sockaddr_t *address, isc_logcategory_t *category, isc_logmodule_t *module, int level, isc_mem_t *mctx) |
void | dns_message_logfmtpacket (dns_message_t *message, const char *description, isc_logcategory_t *category, isc_logmodule_t *module, const dns_master_style_t *style, int level, isc_mem_t *mctx) |
void | dns_message_logfmtpacket2 (dns_message_t *message, const char *description, isc_sockaddr_t *address, isc_logcategory_t *category, isc_logmodule_t *module, const dns_master_style_t *style, int level, isc_mem_t *mctx) |
Log 'message' at the specified logging parameters. | |
isc_result_t | dns_message_buildopt (dns_message_t *msg, dns_rdataset_t **opt, unsigned int version, isc_uint16_t udpsize, unsigned int flags, dns_ednsopt_t *ednsopts, size_t count) |
Built a opt record. |
How this beast works:
When a dns message is received in a buffer, dns_message_fromwire() is called on the memory region. Various items are checked including the format of the message (if counts are right, if counts consume the entire sections, and if sections consume the entire message) and known pseudo-RRs in the additional data section are analyzed and removed.
TSIG checking is also done at this layer, and any DNSSEC transaction signatures should also be checked here.
Notes on using the gettemp*() and puttemp*() functions:
These functions return items (names, rdatasets, etc) allocated from some internal state of the dns_message_t.
Names and rdatasets must be put back into the dns_message_t in one of two ways. Assume a name was allocated via dns_message_gettempname():
On the other hand, offsets, rdatalists and rdatas allocated using dns_message_gettemp*() will always be freed automatically when the message is reset or destroyed; calling dns_message_puttemp*() on rdatalists and rdatas is optional and serves only to enable the item to be reused multiple times during the lifetime of the message; offsets cannot be reused.
Buffers allocated using isc_buffer_allocate() can be automatically freed as well by giving the buffer to the message using dns_message_takebuffer(). Doing this will cause the buffer to be freed using isc_buffer_free() when the section lists are cleared, such as in a reset or in a destroy. Since the buffer itself exists until the message is destroyed, this sort of code can be written:
buffer = isc_buffer_allocate(mctx, 512); name = NULL; name = dns_message_gettempname(message, &name); dns_name_init(name, NULL); result = dns_name_fromtext(name, &source, dns_rootname, 0, buffer); dns_message_takebuffer(message, &buffer);
TODO:
XXX Needed: ways to set and retrieve EDNS information, add rdata to a section, move rdata from one section to another, remove rdata, etc.
Definition in file message.h.
#define DNS_MESSAGEFLAG_QR 0x8000U |
Definition at line 95 of file message.h.
Referenced by client_request(), dns_message_reply(), dns_message_totext(), getsection(), ns_client_error(), printmessage(), recv_done(), resquery_response(), sendstream(), tcp_recv(), and udp_recv().
#define DNS_MESSAGEFLAG_AA 0x0400U |
Definition at line 96 of file message.h.
Referenced by addoptout(), answer_response(), dns_message_totext(), is_lame(), noanswer_response(), notify_createmessage(), ns_client_error(), ns_query_start(), printmessage(), query_find(), query_send(), refresh_callback(), respond(), resquery_response(), sendstream(), setup_lookup(), stub_callback(), and xfrin_recv_done().
#define DNS_MESSAGEFLAG_TC 0x0200U |
Definition at line 97 of file message.h.
Referenced by client_send(), dns_message_renderend(), dns_message_rendersection(), dns_message_totext(), printmessage(), query_find(), recv_done(), refresh_callback(), resquery_response(), and stub_callback().
#define DNS_MESSAGEFLAG_RD 0x0100U |
Definition at line 98 of file message.h.
Referenced by client_request(), dns_message_totext(), ns_query_start(), printmessage(), request_soa(), resquery_send(), setup_lookup(), and start_update().
#define DNS_MESSAGEFLAG_RA 0x0080U |
Definition at line 99 of file message.h.
Referenced by client_send(), dns_message_totext(), printmessage(), recv_done(), and sendstream().
#define DNS_MESSAGEFLAG_AD 0x0020U |
Definition at line 100 of file message.h.
Referenced by dns_message_rendersection(), dns_message_totext(), ns_client_error(), ns_query_start(), printmessage(), query_find(), and setup_lookup().
#define DNS_MESSAGEFLAG_CD 0x0010U |
EDNS0 extended message flags.
Definition at line 101 of file message.h.
Referenced by dns_message_totext(), log_query(), ns_client_error(), ns_query_start(), printmessage(), query_find(), resquery_send(), and setup_lookup().
#define DNS_MESSAGEEXTFLAG_DO 0x8000U |
EDNS0 extended OPT codes.
Definition at line 104 of file message.h.
Referenced by dns_message_pseudosectiontotext(), fctx_addopt(), log_query(), ns_query_start(), and setup_lookup().
#define DNS_OPT_NSID 0x0003 |
NSID opt code.
Definition at line 107 of file message.h.
Referenced by add_opt(), dns_message_pseudosectiontotext(), ns_client_addopt(), process_opt(), resquery_send(), and setup_lookup().
#define DNS_OPT_CLIENT_SUBNET 0x0008 |
client subnet opt code
Definition at line 108 of file message.h.
Referenced by dns_message_pseudosectiontotext(), fromwire_opt(), ns_client_addopt(), process_opt(), and setup_lookup().
#define DNS_OPT_EXPIRE 0x0009 |
EXPIRE opt code.
Experimental options [65001...65534] as per RFC6891
Definition at line 109 of file message.h.
Referenced by add_opt(), dns_message_pseudosectiontotext(), fromwire_opt(), get_edns_expire(), ns_client_addopt(), process_opt(), and setup_lookup().
#define DNS_OPT_SIT 65001 |
SIT opt code.
The number of EDNS options we know about.
Definition at line 112 of file message.h.
Referenced by dns_message_pseudosectiontotext(), ns_client_addopt(), process_opt(), resquery_send(), and setup_lookup().
#define DNS_EDNSOPTIONS 5 |
Definition at line 115 of file message.h.
Referenced by add_opt(), ns_client_addopt(), resquery_send(), and setup_lookup().
#define DNS_MESSAGE_REPLYPRESERVE (DNS_MESSAGEFLAG_RD|DNS_MESSAGEFLAG_CD) |
#define DNS_MESSAGEEXTFLAG_REPLYPRESERVE (DNS_MESSAGEEXTFLAG_DO) |
#define DNS_MESSAGE_HEADERLEN 12 |
6 isc_uint16_t's
Definition at line 120 of file message.h.
Referenced by dns_dnssec_signmessage(), dns_dnssec_verifymessage(), dns_message_parse(), dns_message_peekheader(), dns_message_renderbegin(), dns_message_renderend(), dns_message_renderheader(), dns_request_createraw4(), dns_tsig_sign(), dns_tsig_verify(), and tsig_verify_tcp().
#define DNS_MESSAGE_MAGIC ISC_MAGIC('M','S','G','@') |
#define DNS_MESSAGE_VALID | ( | msg | ) | ISC_MAGIC_VALID(msg, DNS_MESSAGE_MAGIC) |
Definition at line 123 of file message.h.
Referenced by dns_message_buildopt(), dns_message_checksig(), dns_message_currentname(), dns_message_destroy(), dns_message_firstname(), dns_message_getopt(), dns_message_getquerytsig(), dns_message_getrawmessage(), dns_message_getsig0(), dns_message_getsig0key(), dns_message_gettempname(), dns_message_gettempoffsets(), dns_message_gettemprdata(), dns_message_gettemprdatalist(), dns_message_gettemprdataset(), dns_message_gettimeadjust(), dns_message_gettsig(), dns_message_gettsigkey(), dns_message_nextname(), dns_message_parse(), dns_message_pseudosectiontotext(), dns_message_puttempname(), dns_message_puttemprdata(), dns_message_puttemprdatalist(), dns_message_puttemprdataset(), dns_message_renderbegin(), dns_message_renderchangebuffer(), dns_message_renderend(), dns_message_renderheader(), dns_message_renderrelease(), dns_message_renderreserve(), dns_message_renderreset(), dns_message_rendersection(), dns_message_reply(), dns_message_reset(), dns_message_resetsig(), dns_message_sectiontotext(), dns_message_setopt(), dns_message_setquerytsig(), dns_message_setsig0key(), dns_message_setsortorder(), dns_message_settimeadjust(), dns_message_settsigkey(), dns_message_signer(), dns_message_takebuffer(), dns_message_totext(), and dns_tsig_verify().
#define DNS_SECTION_ANY (-1) |
Definition at line 130 of file message.h.
Referenced by dns_message_setopt(), dns_message_setsig0key(), dns_message_settsigkey(), getquestions(), getsection(), and msginitprivate().
#define DNS_SECTION_QUESTION 0 |
Definition at line 131 of file message.h.
Referenced by buildquery(), client_send(), create_query(), detailsection(), dns_message_parse(), dns_message_renderend(), dns_message_renderheader(), dns_message_rendersection(), dns_message_reply(), dns_message_sectiontotext(), dns_message_totext(), dns_tkey_processquery(), dns_zone_notifyreceive(), getquestions(), getsection(), notify_createmessage(), ns_notify_start(), ns_query_start(), ns_xfr_start(), printmessage(), printsection(), receive_soa(), recv_done(), recvsoa(), render(), req_render(), request_soa(), resquery_send(), same_question(), sendstream(), setup_lookup(), start_update(), and xfrin_send_request().
#define DNS_SECTION_ANSWER 1 |
Definition at line 132 of file message.h.
Referenced by addoptout(), answer_response(), buildquery(), cache_message(), chase_cnamechain(), check_for_more_data(), check_section(), checknames(), client_send(), detailsection(), dns_message_parse(), dns_message_renderend(), dns_message_renderheader(), dns_message_rendersection(), dns_message_reply(), dns_message_sectiontotext(), dns_message_totext(), dns_tkey_gssnegotiate(), dns_tkey_processdeleteresponse(), dns_tkey_processdhresponse(), dns_tkey_processgssresponse(), dns_tkey_processquery(), dns_zone_notifyreceive(), fix_mustbedelegationornxdomain(), followup_lookup(), getsection(), is_lame(), iscname(), ncache_message(), noanswer_response(), notify_createmessage(), printmessage(), printsection(), query_add_cname(), query_addrrset(), query_dns64(), query_filter64(), query_find(), query_isduplicate(), query_send(), receive_soa(), recv_done(), recvsoa(), refresh_callback(), render(), req_render(), resquery_response(), save_nsrrset(), sendstream(), short_answer(), stub_callback(), and xfrin_recv_done().
#define DNS_SECTION_AUTHORITY 2 |
Definition at line 133 of file message.h.
Referenced by addoptout(), answer_response(), betterreferral(), checknames(), client_send(), detailsection(), dns_message_parse(), dns_message_renderheader(), dns_message_rendersection(), dns_message_totext(), findnoqname(), fix_mustbedelegationornxdomain(), followup_lookup(), insert_soa(), is_lame(), ncache_message(), noanswer_response(), ns_xfr_start(), printmessage(), query_addbestns(), query_addds(), query_addnoqnameproof(), query_addns(), query_addnxrrsetnsec(), query_addrrset(), query_addwildcardproof(), query_dns64(), query_filter64(), query_find(), receive_soa(), recv_done(), recvsoa(), refresh_callback(), render(), req_render(), resquery_response(), setup_lookup(), val_rdataset_first(), val_rdataset_next(), validate_authority(), and xfrin_send_request().
#define DNS_SECTION_ADDITIONAL 3 |
Definition at line 134 of file message.h.
Referenced by answer_in_glue(), buildquery(), cache_message(), chase_additional(), check_related(), checknames(), client_send(), detailsection(), dns_message_parse(), dns_message_renderend(), dns_message_renderheader(), dns_message_rendersection(), dns_message_totext(), dns_tkey_builddhquery(), dns_tkey_gssnegotiate(), dns_tkey_processdeleteresponse(), dns_tkey_processdhresponse(), dns_tkey_processgssresponse(), dns_tkey_processquery(), fix_mustbedelegationornxdomain(), getsection(), printmessage(), process_dhtkey(), query_addadditional(), query_addadditional2(), query_addsoa(), query_find(), query_isduplicate(), render(), req_render(), resquery_send(), and save_nsrrset().
#define DNS_SECTION_MAX 4 |
Definition at line 135 of file message.h.
Referenced by dns_message_create(), dns_message_renderreset(), msginitprivate(), and msgresetnames().
#define DNS_PSEUDOSECTION_OPT 0 |
Definition at line 139 of file message.h.
Referenced by dns_message_pseudosectiontotext(), dns_message_totext(), and printmessage().
#define DNS_PSEUDOSECTION_TSIG 1 |
Definition at line 140 of file message.h.
Referenced by dns_message_pseudosectiontotext(), dns_message_totext(), and printmessage().
#define DNS_PSEUDOSECTION_SIG0 2 |
Definition at line 141 of file message.h.
Referenced by dns_message_pseudosectiontotext(), dns_message_totext(), and printmessage().
#define DNS_MESSAGETEXTFLAG_NOCOMMENTS 0x0001 |
Definition at line 145 of file message.h.
Referenced by dns_message_pseudosectiontotext(), dns_message_sectiontotext(), and printmessage().
#define DNS_MESSAGETEXTFLAG_NOHEADERS 0x0002 |
Definition at line 146 of file message.h.
Referenced by dns_message_pseudosectiontotext(), dns_message_sectiontotext(), dns_message_totext(), and printmessage().
#define DNS_MESSAGETEXTFLAG_ONESOA 0x0004 |
Definition at line 147 of file message.h.
Referenced by dns_message_sectiontotext(), and printmessage().
#define DNS_MESSAGETEXTFLAG_OMITSOA 0x0008 |
Definition at line 148 of file message.h.
Referenced by dns_message_sectiontotext(), and printmessage().
#define DNS_SECTION_ZONE DNS_SECTION_QUESTION |
Definition at line 154 of file message.h.
Referenced by ns_notify_start(), ns_update_start(), send_update(), and setzone().
#define DNS_SECTION_PREREQUISITE DNS_SECTION_ANSWER |
Definition at line 155 of file message.h.
Referenced by dns_client_startupdate(), dns_message_reply(), dns_rdata_updateop(), make_prereq(), start_update(), update(), and update_action().
#define DNS_SECTION_UPDATE DNS_SECTION_AUTHORITY |
Definition at line 156 of file message.h.
Referenced by dns_client_startupdate(), dns_rdata_updateop(), getsection(), start_update(), update(), update_action(), and update_addordelete().
#define DNS_MESSAGE_INTENTPARSE 1 |
parsing messages
Definition at line 162 of file message.h.
Referenced by client_create(), dns_message_create(), dns_message_parse(), dns_message_reset(), dns_message_signer(), fctx_create(), fctx_query(), forward_callback(), notify_done(), ns_client_endrequest(), receive_soa(), recv_done(), recvsoa(), refresh_callback(), stub_callback(), update_completed(), update_done(), and xfrin_recv_done().
#define DNS_MESSAGE_INTENTRENDER 2 |
rendering
Definition at line 163 of file message.h.
Referenced by create_query(), dns_client_startupdate(), dns_message_addname(), dns_message_create(), dns_message_movename(), dns_message_removename(), dns_message_renderbegin(), dns_message_renderreset(), dns_message_reply(), dns_message_reset(), dns_message_setopt(), dns_message_setsig0key(), dns_message_settsigkey(), fctx_create(), notify_createmessage(), request_soa(), reset_system(), resquery_send(), sendstream(), setup_lookup(), start_update(), and xfrin_send_request().
#define DNS_MESSAGEPARSE_PRESERVEORDER 0x0001 |
preserve rdata order
Definition at line 168 of file message.h.
Referenced by forward_callback(), getsection(), notify_done(), receive_soa(), recv_done(), recvsoa(), update_completed(), update_done(), and xfrin_recv_done().
#define DNS_MESSAGEPARSE_BESTEFFORT 0x0002 |
return a message if a recoverable parse error occurs
Definition at line 169 of file message.h.
Referenced by getquestions(), getsection(), and recv_done().
#define DNS_MESSAGEPARSE_CLONEBUFFER 0x0004 |
save a copy of the source buffer
Definition at line 172 of file message.h.
Referenced by dns_message_parse(), and forward_callback().
#define DNS_MESSAGEPARSE_IGNORETRUNCATION 0x0008 |
truncation errors are not fatal.
Definition at line 174 of file message.h.
Referenced by dns_message_parse(), and recv_done().
#define DNS_MESSAGERENDER_ORDERED 0x0001 |
don't change order
Definition at line 180 of file message.h.
Referenced by dns_message_rendersection().
#define DNS_MESSAGERENDER_PARTIAL 0x0002 |
allow a partial rdataset
Definition at line 181 of file message.h.
Referenced by client_send(), and dns_message_rendersection().
#define DNS_MESSAGERENDER_OMITDNSSEC 0x0004 |
omit DNSSEC records
Definition at line 182 of file message.h.
Referenced by client_send(), and dns_message_rendersection().
#define DNS_MESSAGERENDER_PREFER_A 0x0008 |
prefer A records in additional section.
Definition at line 183 of file message.h.
Referenced by client_send(), and dns_message_rendersection().
#define DNS_MESSAGERENDER_PREFER_AAAA 0x0010 |
prefer AAAA records in additional section.
Definition at line 185 of file message.h.
Referenced by client_send(), and dns_message_rendersection().
typedef int dns_section_t |
typedef int dns_pseudosection_t |
typedef int dns_messagetextflag_t |
typedef struct dns_msgblock dns_msgblock_t |
ISC_LANG_BEGINDECLS isc_result_t dns_message_create | ( | isc_mem_t * | mctx, | |
unsigned int | intent, | |||
dns_message_t ** | msgp | |||
) |
Create msg structure.
This function will allocate some internal blocks of memory that are expected to be needed for parsing or rendering nearly any type of message.
Requires:
Definition at line 719 of file message.c.
References dns_message::cctx, cleanup(), dns_message::cleanup, DNS_MESSAGE_INTENTPARSE, DNS_MESSAGE_INTENTRENDER, DNS_MESSAGE_MAGIC, DNS_SECTION_MAX, dns_message::from_to_wire, isc_buffer_allocate(), isc_buffer_free(), ISC_LIST_APPEND, ISC_LIST_HEAD, ISC_LIST_INIT, ISC_LIST_UNLINK, isc_mem_attach(), isc_mem_get, isc_mem_putanddetach, isc_mempool_create(), isc_mempool_destroy(), isc_mempool_setfreemax(), isc_mempool_setname(), ISC_R_NOMEMORY, ISC_R_SUCCESS, dns_message::magic, dns_message::mctx, msginit(), NAME_COUNT, dns_message::namepool, dns_message::rdspool, REQUIRE, dns_message::scratchpad, SCRATCHPAD_SIZE, and dns_message::sections.
Referenced by client_create(), create_query(), dns_client_startupdate(), fctx_create(), forward_callback(), notify_createmessage(), notify_done(), receive_soa(), recv_done(), recvsoa(), refresh_callback(), request_soa(), reset_system(), sendstream(), setup_lookup(), start_update(), stub_callback(), update_completed(), update_done(), xfrin_recv_done(), and xfrin_send_request().
void dns_message_reset | ( | dns_message_t * | msg, | |
unsigned int | intent | |||
) |
Reset a message structure to default state. All internal lists are freed or reset to a default state as well. This is simply a more efficient way to call dns_message_destroy() followed by dns_message_allocate(), since it avoid many memory allocations.
If any data loanouts (buffers, names, rdatas, etc) were requested, the caller must no longer use them after this call.
The intended next use of the message will be 'intent'.
Requires:
Definition at line 809 of file message.c.
References DNS_MESSAGE_INTENTPARSE, DNS_MESSAGE_INTENTRENDER, DNS_MESSAGE_VALID, dns_message::from_to_wire, ISC_FALSE, msgreset(), and REQUIRE.
Referenced by fctx_query(), ns_client_endrequest(), reset_system(), and resquery_send().
void dns_message_destroy | ( | dns_message_t ** | msgp | ) |
Destroy all state in the message.
Requires:
Definition at line 819 of file message.c.
References DNS_MESSAGE_VALID, isc_mem_putanddetach, isc_mempool_destroy(), ISC_TRUE, dns_message::magic, dns_message::mctx, msgreset(), dns_message::namepool, dns_message::rdspool, and REQUIRE.
Referenced by cleanup(), client_create(), create_query(), destroy_libs(), destroy_lookup(), dns_client_startupdate(), doshutdown(), exit_check(), fctx_create(), fctx_destroy(), flush_lookup_list(), forward_callback(), forward_done(), notify_createmessage(), notify_done(), notify_send_toaddr(), ns_query(), receive_soa(), recv_done(), recvsoa(), refresh_callback(), request_soa(), sendstream(), soa_query(), start_update(), stub_callback(), update_done(), update_sendevent(), xfrin_recv_done(), and xfrin_send_request().
isc_result_t dns_message_sectiontotext | ( | dns_message_t * | msg, | |
dns_section_t | section, | |||
const dns_master_style_t * | style, | |||
dns_messagetextflag_t | flags, | |||
isc_buffer_t * | target | |||
) |
Definition at line 3140 of file message.c.
References ADD_STRING, dns_master_questiontotext(), dns_master_rdatasettotext(), dns_message_currentname(), dns_message_firstname(), dns_message_nextname(), DNS_MESSAGE_VALID, DNS_MESSAGETEXTFLAG_NOCOMMENTS, DNS_MESSAGETEXTFLAG_NOHEADERS, DNS_MESSAGETEXTFLAG_OMITSOA, DNS_MESSAGETEXTFLAG_ONESOA, dns_name_init(), dns_opcode_update, DNS_SECTION_ANSWER, DNS_SECTION_QUESTION, ISC_FALSE, ISC_LIST_EMPTY, ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_R_NOMORE, ISC_R_SUCCESS, ISC_TRUE, name, dns_message::opcode, REQUIRE, dns_message::sections, dns_rdataset::type, and VALID_SECTION.
Referenced by dns_message_totext(), and printmessage().
isc_result_t dns_message_pseudosectiontotext | ( | dns_message_t * | msg, | |
dns_pseudosection_t | section, | |||
const dns_master_style_t * | style, | |||
dns_messagetextflag_t | flags, | |||
isc_buffer_t * | target | |||
) |
Convert section 'section' or 'pseudosection' of message 'msg' to a cleartext representation.
Notes:
Definition at line 3248 of file message.c.
References ADD_STRING, dns_rdata::data, dns_master_rdatasettotext(), dns_message_getopt(), dns_message_getsig0(), dns_message_gettsig(), DNS_MESSAGE_VALID, DNS_MESSAGEEXTFLAG_DO, DNS_MESSAGETEXTFLAG_NOCOMMENTS, DNS_MESSAGETEXTFLAG_NOHEADERS, DNS_OPT_CLIENT_SUBNET, DNS_OPT_EXPIRE, DNS_OPT_NSID, DNS_OPT_SIT, DNS_PSEUDOSECTION_OPT, DNS_PSEUDOSECTION_SIG0, DNS_PSEUDOSECTION_TSIG, dns_rdata_init(), dns_rdataset_current(), dns_rdataset_first(), dns_ttl_totext(), INSIST, isc_buffer_add, isc_buffer_availablelength, isc_buffer_current, isc_buffer_forward, isc_buffer_getuint16(), isc_buffer_getuint32(), isc_buffer_init, isc_buffer_putmem, isc_buffer_putstr, isc_buffer_remaininglength, ISC_R_NOSPACE, ISC_R_SUCCESS, ISC_R_UNEXPECTED, ISC_TRUE, dns_rdata::length, name, dns_rdataset::rdclass, render_ecs(), REQUIRE, dns_message::sitbad, dns_message::sitok, dns_rdataset::ttl, and VALID_PSEUDOSECTION.
Referenced by dns_message_totext(), and printmessage().
isc_result_t dns_message_totext | ( | dns_message_t * | msg, | |
const dns_master_style_t * | style, | |||
dns_messagetextflag_t | flags, | |||
isc_buffer_t * | target | |||
) |
Convert all sections of message 'msg' to a cleartext representation.
Notes:
Requires:
Definition at line 3416 of file message.c.
References ADD_STRING, dns_message::counts, dns_message_pseudosectiontotext(), dns_message_sectiontotext(), DNS_MESSAGE_VALID, DNS_MESSAGEFLAG_AA, DNS_MESSAGEFLAG_AD, DNS_MESSAGEFLAG_CD, DNS_MESSAGEFLAG_QR, DNS_MESSAGEFLAG_RA, DNS_MESSAGEFLAG_RD, DNS_MESSAGEFLAG_TC, DNS_MESSAGETEXTFLAG_NOHEADERS, dns_opcode_update, DNS_PSEUDOSECTION_OPT, DNS_PSEUDOSECTION_SIG0, DNS_PSEUDOSECTION_TSIG, DNS_SECTION_ADDITIONAL, DNS_SECTION_ANSWER, DNS_SECTION_AUTHORITY, DNS_SECTION_QUESTION, dns_message::flags, dns_message::id, ISC_R_SUCCESS, dns_message::opcode, dns_message::rcode, and REQUIRE.
Referenced by _dns_tkey_dumpmessage(), logfmtpacket(), ns_client_dumpmessage(), and show_message().
isc_result_t dns_message_parse | ( | dns_message_t * | msg, | |
isc_buffer_t * | source, | |||
unsigned int | options | |||
) |
Parse raw wire data in 'source' as a DNS message.
OPT records are detected and stored in the pseudo-section "opt". TSIGs are detected and stored in the pseudo-section "tsig".
If DNS_MESSAGEPARSE_PRESERVEORDER is set, or if the opcode of the message is UPDATE, a separate dns_name_t object will be created for each RR in the message. Each such dns_name_t will have a single rdataset containing the single RR, and the order of the RRs in the message is preserved. Otherwise, only one dns_name_t object will be created for each unique owner name in the section, and each such dns_name_t will have a list of rdatasets. To access the names and their data, use dns_message_firstname() and dns_message_nextname().
If DNS_MESSAGEPARSE_BESTEFFORT is set, errors in message content will not be considered FORMERRs. If the entire message can be parsed, it will be returned and DNS_R_RECOVERABLE will be returned.
If DNS_MESSAGEPARSE_IGNORETRUNCATION is set then return as many complete RR's as possible, DNS_R_RECOVERABLE will be returned.
OPT and TSIG records are always handled specially, regardless of the 'preserve_order' setting.
Requires:
Definition at line 1593 of file message.c.
References isc_region::base, dns_message::counts, DNS_COMPRESS_GLOBAL14, DNS_DECOMPRESS_ANY, dns_decompress_init(), dns_decompress_setmethods(), dns_lctx, DNS_LOGMODULE_MESSAGE, DNS_MESSAGE_FLAG_MASK, DNS_MESSAGE_HEADERLEN, DNS_MESSAGE_INTENTPARSE, DNS_MESSAGE_OPCODE_MASK, DNS_MESSAGE_OPCODE_SHIFT, DNS_MESSAGE_RCODE_MASK, DNS_MESSAGE_VALID, DNS_MESSAGEPARSE_CLONEBUFFER, DNS_MESSAGEPARSE_IGNORETRUNCATION, DNS_R_RECOVERABLE, DNS_SECTION_ADDITIONAL, DNS_SECTION_ANSWER, DNS_SECTION_AUTHORITY, DNS_SECTION_QUESTION, dns_message::flags, dns_message::free_saved, dns_message::from_to_wire, getquestions(), getsection(), dns_message::header_ok, dns_message::id, isc_buffer_base, isc_buffer_getuint16(), isc_buffer_remainingregion, isc_buffer_usedlength, isc_buffer_usedregion, ISC_FALSE, ISC_LOG_DEBUG, isc_log_write(), ISC_LOGCATEGORY_GENERAL, isc_mem_get, ISC_R_NOMEMORY, ISC_R_SUCCESS, ISC_R_UNEXPECTEDEND, ISC_TF, ISC_TRUE, isc_region::length, dns_message::mctx, dns_message::opcode, dns_message::question_ok, r, dns_message::rcode, REQUIRE, and dns_message::saved.
Referenced by client_request(), dns_request_getresponse(), recv_done(), resquery_response(), and xfrin_recv_done().
isc_result_t dns_message_renderbegin | ( | dns_message_t * | msg, | |
dns_compress_t * | cctx, | |||
isc_buffer_t * | buffer | |||
) |
Begin rendering on a message. Only one call can be made to this function per message.
The compression context is "owned" by the message library until dns_message_renderend() is called. It must be invalidated by the caller.
The buffer is "owned" by the message library until dns_message_renderend() is called.
Requires:
Definition at line 1710 of file message.c.
References dns_message::buffer, dns_message::cctx, DNS_MESSAGE_HEADERLEN, DNS_MESSAGE_INTENTRENDER, DNS_MESSAGE_VALID, dns_message::from_to_wire, isc_buffer_add, isc_buffer_availableregion, isc_buffer_clear, ISC_R_NOSPACE, ISC_R_SUCCESS, isc_region::length, r, REQUIRE, and dns_message::reserved.
Referenced by client_send(), render(), req_render(), resquery_send(), sendstream(), and setup_lookup().
isc_result_t dns_message_renderchangebuffer | ( | dns_message_t * | msg, | |
isc_buffer_t * | buffer | |||
) |
Reset the buffer. This can be used after growing the old buffer on a ISC_R_NOSPACE return from most of the render functions.
On successful completion, the old buffer is no longer used by the library. The new buffer is owned by the library until dns_message_renderend() is called.
Requires:
Definition at line 1749 of file message.c.
References isc_region::base, dns_message::buffer, DNS_MESSAGE_VALID, isc_buffer_add, isc_buffer_availableregion, isc_buffer_clear, isc_buffer_usedregion, ISC_R_SUCCESS, isc_region::length, r, and REQUIRE.
isc_result_t dns_message_renderreserve | ( | dns_message_t * | msg, | |
unsigned int | space | |||
) |
XXXMLG should use size_t rather than unsigned int once the buffer API is cleaned up.
Reserve "space" bytes in the given buffer.
Requires:
Definition at line 1786 of file message.c.
References dns_message::buffer, DNS_MESSAGE_VALID, isc_buffer_availableregion, ISC_R_NOSPACE, ISC_R_SUCCESS, isc_region::length, r, REQUIRE, and dns_message::reserved.
Referenced by dns_message_reply(), dns_message_setopt(), dns_message_setsig0key(), and dns_message_settsigkey().
void dns_message_renderrelease | ( | dns_message_t * | msg, | |
unsigned int | space | |||
) |
XXXMLG should use size_t rather than unsigned int once the buffer API is cleaned up.
Release "space" bytes in the given buffer that was previously reserved.
Requires:
Definition at line 1778 of file message.c.
References DNS_MESSAGE_VALID, REQUIRE, and dns_message::reserved.
Referenced by dns_message_renderend(), dns_message_settsigkey(), msgresetopt(), and msgresetsigs().
isc_result_t dns_message_rendersection | ( | dns_message_t * | msg, | |
dns_section_t | section, | |||
unsigned int | options | |||
) |
Render all names, rdatalists, etc from the given section at the specified priority or higher.
Requires:
Definition at line 1864 of file message.c.
References dns_rdataset::attributes, dns_message::buffer, dns_message::cctx, dns_msgblock::count, dns_message::counts, dns_compress_rollback(), DNS_MESSAGE_VALID, DNS_MESSAGEFLAG_AD, DNS_MESSAGEFLAG_TC, DNS_MESSAGERENDER_OMITDNSSEC, DNS_MESSAGERENDER_ORDERED, DNS_MESSAGERENDER_PARTIAL, DNS_MESSAGERENDER_PREFER_A, DNS_MESSAGERENDER_PREFER_AAAA, dns_rdataset_towirepartial(), dns_rdataset_towiresorted(), DNS_RDATASETATTR_RENDERED, DNS_RDATASETATTR_REQUIREDGLUE, DNS_RDATASETTOWIRE_OMITDNSSEC, DNS_SECTION_ADDITIONAL, DNS_SECTION_ANSWER, DNS_SECTION_AUTHORITY, DNS_SECTION_QUESTION, dns_trust_secure, dns_message::flags, INSIST, ISC_FALSE, ISC_LIST_HEAD, ISC_LIST_NEXT, ISC_R_NOSPACE, ISC_R_SUCCESS, ISC_TRUE, isc_buffer::length, name, OPTOUT, dns_message::order, dns_message::order_arg, REQUIRE, dns_message::reserved, dns_message::sections, dns_rdataset::trust, isc_buffer::used, VALID_NAMED_SECTION, and wrong_priority().
Referenced by client_send(), dns_message_renderend(), render(), req_render(), resquery_send(), sendstream(), and setup_lookup().
void dns_message_renderheader | ( | dns_message_t * | msg, | |
isc_buffer_t * | target | |||
) |
Render the message header. This is implicitly called by dns_message_renderend().
Requires:
Definition at line 2091 of file message.c.
References dns_message::counts, DNS_MESSAGE_FLAG_MASK, DNS_MESSAGE_HEADERLEN, DNS_MESSAGE_OPCODE_MASK, DNS_MESSAGE_OPCODE_SHIFT, DNS_MESSAGE_RCODE_MASK, DNS_MESSAGE_VALID, DNS_SECTION_ADDITIONAL, DNS_SECTION_ANSWER, DNS_SECTION_AUTHORITY, DNS_SECTION_QUESTION, dns_message::flags, dns_message::id, INSIST, isc_buffer_availableregion, isc_buffer_putuint16, isc_region::length, dns_message::opcode, r, dns_message::rcode, and REQUIRE.
Referenced by dns_dnssec_signmessage(), dns_message_renderend(), and dns_tsig_sign().
isc_result_t dns_message_renderend | ( | dns_message_t * | msg | ) |
Finish rendering to the buffer. Note that more data can be in the 'msg' structure. Destroying the structure will free this, or in a multi- part EDNS1 message this data can be rendered to another buffer later.
Requires:
Definition at line 2125 of file message.c.
References isc_region::base, dns_message::buffer, dns_message::cctx, dns_msgblock::count, dns_message::counts, dns_compress_rollback(), dns_dnssec_signmessage(), DNS_MESSAGE_EDNSRCODE_MASK, DNS_MESSAGE_HEADERLEN, DNS_MESSAGE_RCODE_MASK, dns_message_renderheader(), dns_message_renderrelease(), dns_message_renderreset(), dns_message_rendersection(), DNS_MESSAGE_VALID, DNS_MESSAGEFLAG_TC, DNS_R_FORMERR, dns_rdataset_towire(), dns_rootname, DNS_SECTION_ADDITIONAL, DNS_SECTION_ANSWER, DNS_SECTION_QUESTION, dns_tsig_sign(), dns_message::flags, isc_buffer_add, isc_buffer_clear, isc_buffer_init, isc_buffer_usedregion, ISC_R_NOSPACE, ISC_R_SUCCESS, isc_region::length, msgresetnames(), dns_message::opt, dns_message::opt_reserved, r, dns_message::rcode, REQUIRE, dns_message::sig0, dns_message::sig0key, dns_message::sig_reserved, dns_message::tsig, dns_message::tsigkey, dns_message::tsigname, and dns_rdataset::ttl.
Referenced by client_send(), render(), req_render(), resquery_send(), sendstream(), and setup_lookup().
void dns_message_renderreset | ( | dns_message_t * | msg | ) |
Reset the message so that it may be rendered again.
Notes:
Definition at line 2241 of file message.c.
References dns_rdataset::attributes, dns_message::buffer, dns_message::counts, dns_message::cursors, DNS_MESSAGE_INTENTRENDER, dns_message_puttempname(), dns_message_puttemprdataset(), DNS_MESSAGE_VALID, dns_rdataset_disassociate(), DNS_RDATASETATTR_RENDERED, DNS_SECTION_MAX, dns_message::from_to_wire, ISC_LIST_HEAD, ISC_LIST_NEXT, name, REQUIRE, dns_message::sections, dns_message::sig0, dns_message::tsig, and dns_message::tsigname.
Referenced by dns_message_renderend(), dns_request_createvia4(), receive_soa(), recvsoa(), req_render(), update_completed(), and update_done().
isc_result_t dns_message_firstname | ( | dns_message_t * | msg, | |
dns_section_t | section | |||
) |
Set internal per-section name pointer to the beginning of the section.
The functions dns_message_firstname() and dns_message_nextname() may be used for iterating over the owner names in a section.
Requires:
Definition at line 2281 of file message.c.
References dns_message::cursors, DNS_MESSAGE_VALID, ISC_LIST_HEAD, ISC_R_NOMORE, ISC_R_SUCCESS, REQUIRE, dns_message::sections, and VALID_NAMED_SECTION.
Referenced by addoptout(), answer_response(), betterreferral(), cache_message(), chase_additional(), check_for_more_data(), checknamessection(), detailsection(), dns_client_startupdate(), dns_message_sectiontotext(), dns_tkey_processdhresponse(), dns_tkey_processquery(), find_tkey(), findnoqname(), fix_mustbedelegationornxdomain(), followup_lookup(), is_lame(), message_count(), ncache_message(), noanswer_response(), ns_notify_start(), ns_query_start(), ns_update_start(), ns_xfr_start(), printsection(), process_dhtkey(), query_addds(), receive_soa(), recv_done(), recvsoa(), same_question(), setzone(), short_answer(), start_update(), update_action(), val_rdataset_first(), validate_authority(), and xfrin_recv_done().
isc_result_t dns_message_nextname | ( | dns_message_t * | msg, | |
dns_section_t | section | |||
) |
Sets the internal per-section name pointer to point to the next name in that section.
Requires:
Definition at line 2294 of file message.c.
References dns_message::cursors, DNS_MESSAGE_VALID, ISC_LIST_NEXT, ISC_R_NOMORE, ISC_R_SUCCESS, REQUIRE, and VALID_NAMED_SECTION.
Referenced by addoptout(), answer_response(), betterreferral(), cache_message(), chase_additional(), check_for_more_data(), checknamessection(), detailsection(), dns_message_sectiontotext(), dns_tkey_processdhresponse(), find_tkey(), findnoqname(), fix_mustbedelegationornxdomain(), followup_lookup(), is_lame(), message_count(), ncache_message(), noanswer_response(), ns_notify_start(), ns_query_start(), ns_update_start(), ns_xfr_start(), printsection(), process_dhtkey(), receive_soa(), recv_done(), recvsoa(), short_answer(), update_action(), val_rdataset_next(), validate_authority(), and xfrin_recv_done().
void dns_message_currentname | ( | dns_message_t * | msg, | |
dns_section_t | section, | |||
dns_name_t ** | name | |||
) |
Sets 'name' to point to the name where the per-section internal name pointer is currently set.
This function returns the name in the database, so any data associated with it (via the name's "list" member) contains the actual rdatasets.
Requires:
Definition at line 2308 of file message.c.
References dns_message::cursors, DNS_MESSAGE_VALID, REQUIRE, and VALID_NAMED_SECTION.
Referenced by addoptout(), answer_response(), betterreferral(), cache_message(), chase_additional(), check_for_more_data(), checknamessection(), detailsection(), dns_client_startupdate(), dns_message_sectiontotext(), dns_tkey_processdhresponse(), dns_tkey_processquery(), find_tkey(), findnoqname(), fix_mustbedelegationornxdomain(), followup_lookup(), get_current_rr(), is_lame(), message_count(), ncache_message(), noanswer_response(), ns_notify_start(), ns_query_start(), ns_update_start(), ns_xfr_start(), printsection(), process_dhtkey(), query_addds(), receive_soa(), recv_done(), recvsoa(), same_question(), setzone(), short_answer(), start_update(), val_rdataset_first(), val_rdataset_next(), validate_authority(), and xfrin_recv_done().
isc_result_t dns_message_findname | ( | dns_message_t * | msg, | |
dns_section_t | section, | |||
dns_name_t * | target, | |||
dns_rdatatype_t | type, | |||
dns_rdatatype_t | covers, | |||
dns_name_t ** | foundname, | |||
dns_rdataset_t ** | rdataset | |||
) |
Search for a name in the specified section. If it is found, *name is set to point to the name, and *rdataset is set to point to the found rdataset (if type is specified as other than dns_rdatatype_any).
Requires:
Definition at line 2320 of file message.c.
References dns_message_findtype(), DNS_R_NXDOMAIN, DNS_R_NXRRSET, findname(), ISC_R_NOTFOUND, ISC_R_SUCCESS, REQUIRE, dns_message::sections, and VALID_SECTION.
Referenced by chase_cnamechain(), check_section(), dns_tkey_processdhresponse(), dns_tkey_processquery(), dns_zone_notifyreceive(), iscname(), query_addrrset(), query_dns64(), query_filter64(), query_isduplicate(), refresh_callback(), and save_nsrrset().
isc_result_t dns_message_findtype | ( | dns_name_t * | name, | |
dns_rdatatype_t | type, | |||
dns_rdatatype_t | covers, | |||
dns_rdataset_t ** | rdataset | |||
) |
Search the name for the specified type. If it is found, *rdataset is filled in with a pointer to that rdataset.
Requires:
Definition at line 880 of file message.c.
References dns_rdataset::covers, ISC_LIST_PREV, ISC_LIST_TAIL, ISC_R_NOTFOUND, ISC_R_SUCCESS, REQUIRE, and dns_rdataset::type.
Referenced by check_section(), dns_message_findname(), dns_tkey_processdhresponse(), find_tkey(), followup_lookup(), process_dhtkey(), query_addds(), receive_soa(), and recvsoa().
isc_result_t dns_message_find | ( | dns_name_t * | name, | |
dns_rdataclass_t | rdclass, | |||
dns_rdatatype_t | type, | |||
dns_rdatatype_t | covers, | |||
dns_rdataset_t ** | rdataset | |||
) |
Search the name for the specified rdclass and type. If it is found, *rdataset is filled in with a pointer to that rdataset.
Requires:
Definition at line 855 of file message.c.
References dns_rdataset::covers, ISC_LIST_PREV, ISC_LIST_TAIL, ISC_R_NOTFOUND, ISC_R_SUCCESS, dns_rdataset::rdclass, REQUIRE, and dns_rdataset::type.
Referenced by getquestions(), and getsection().
void dns_message_movename | ( | dns_message_t * | msg, | |
dns_name_t * | name, | |||
dns_section_t | fromsection, | |||
dns_section_t | tosection | |||
) |
Move a name from one section to another.
Requires:
Definition at line 2371 of file message.c.
References DNS_MESSAGE_INTENTRENDER, dns_message::from_to_wire, ISC_LIST_APPEND, ISC_LIST_UNLINK, REQUIRE, dns_message::sections, and VALID_NAMED_SECTION.
void dns_message_addname | ( | dns_message_t * | msg, | |
dns_name_t * | name, | |||
dns_section_t | section | |||
) |
Adds the name to the given section.
It is the caller's responsibility to enforce any unique name requirements in a section.
Requires:
Definition at line 2389 of file message.c.
References DNS_MESSAGE_INTENTRENDER, dns_message::from_to_wire, ISC_LIST_APPEND, REQUIRE, dns_message::sections, and VALID_NAMED_SECTION.
Referenced by buildquery(), create_query(), dns_client_startupdate(), dns_tkey_builddhquery(), dns_tkey_processquery(), insert_soa(), make_prereq(), notify_createmessage(), query_addadditional(), query_addadditional2(), query_addrrset(), query_dns64(), query_filter64(), query_find(), request_soa(), resquery_send(), send_update(), sendstream(), setup_lookup(), setzone(), start_update(), update_addordelete(), and xfrin_send_request().
void dns_message_removename | ( | dns_message_t * | msg, | |
dns_name_t * | name, | |||
dns_section_t | section | |||
) |
Remove a existing name from a given section.
It is the caller's responsibility to ensure the name is part of the given section.
Requires:
Definition at line 2401 of file message.c.
References DNS_MESSAGE_INTENTRENDER, dns_message::from_to_wire, ISC_LIST_UNLINK, REQUIRE, dns_message::sections, and VALID_NAMED_SECTION.
Referenced by setzone().
isc_result_t dns_message_gettempname | ( | dns_message_t * | msg, | |
dns_name_t ** | item | |||
) |
Return a name that can be used for any temporary purpose, including inserting into the message's linked lists. The name must be returned to the message code using dns_message_puttempname() or inserted into one of the message's sections before the message is destroyed.
It is the caller's responsibility to initialize this name.
Requires:
Definition at line 2413 of file message.c.
References DNS_MESSAGE_VALID, dns_name_init(), isc_mempool_get, ISC_R_NOMEMORY, ISC_R_SUCCESS, dns_message::namepool, and REQUIRE.
Referenced by add_rdata_to_list(), buildquery(), copy_name(), create_query(), dns_tsig_sign(), insert_soa(), notify_createmessage(), parse_name(), query_add_cname(), query_addns(), query_addsoa(), query_find(), query_newname(), request_soa(), resquery_send(), send_update(), sendstream(), setup_lookup(), setzone(), start_update(), tuple2msgname(), and xfrin_send_request().
isc_result_t dns_message_gettempoffsets | ( | dns_message_t * | msg, | |
dns_offsets_t ** | item | |||
) |
Return an offsets array that can be used for any temporary purpose, such as attaching to a temporary name. The offsets will be freed when the message is destroyed or reset.
Requires:
Definition at line 2426 of file message.c.
References DNS_MESSAGE_VALID, ISC_R_NOMEMORY, ISC_R_SUCCESS, newoffsets(), and REQUIRE.
isc_result_t dns_message_gettemprdata | ( | dns_message_t * | msg, | |
dns_rdata_t ** | item | |||
) |
Return a rdata that can be used for any temporary purpose, including inserting into the message's linked lists. The rdata will be freed when the message is destroyed or reset.
Requires:
Definition at line 2438 of file message.c.
References DNS_MESSAGE_VALID, ISC_R_NOMEMORY, ISC_R_SUCCESS, newrdata(), and REQUIRE.
Referenced by add_rdata_to_list(), buildquery(), copy_name(), dns_dnssec_signmessage(), dns_message_buildopt(), dns_message_setquerytsig(), dns_tkey_builddhquery(), dns_tsig_sign(), insert_soa(), make_prereq(), notify_createmessage(), query_add_cname(), query_dns64(), query_filter64(), sendstream(), tuple2msgname(), and update_addordelete().
isc_result_t dns_message_gettemprdataset | ( | dns_message_t * | msg, | |
dns_rdataset_t ** | item | |||
) |
Return a rdataset that can be used for any temporary purpose, including inserting into the message's linked lists. The name must be returned to the message code using dns_message_puttempname() or inserted into one of the message's sections before the message is destroyed.
Requires:
Definition at line 2450 of file message.c.
References DNS_MESSAGE_VALID, dns_rdataset_init(), isc_mempool_get, ISC_R_NOMEMORY, ISC_R_SUCCESS, dns_message::rdspool, and REQUIRE.
Referenced by add_question(), add_rdata_to_list(), buildquery(), copy_name(), create_query(), dns_acache_getentry(), dns_dnssec_signmessage(), dns_message_buildopt(), dns_message_setquerytsig(), dns_tsig_sign(), insert_soa(), make_prereq(), notify_createmessage(), query_add_cname(), query_dns64(), query_filter64(), query_newrdataset(), request_soa(), resquery_send(), send_update(), sendstream(), setzone(), start_update(), tuple2msgname(), update_addordelete(), and xfrin_send_request().
isc_result_t dns_message_gettemprdatalist | ( | dns_message_t * | msg, | |
dns_rdatalist_t ** | item | |||
) |
Return a rdatalist that can be used for any temporary purpose, including inserting into the message's linked lists. The rdatalist will be destroyed when the message is destroyed or reset.
Requires:
Definition at line 2464 of file message.c.
References DNS_MESSAGE_VALID, ISC_R_NOMEMORY, ISC_R_SUCCESS, newrdatalist(), and REQUIRE.
Referenced by add_rdata_to_list(), buildquery(), copy_name(), dns_dnssec_signmessage(), dns_message_buildopt(), dns_message_setquerytsig(), dns_tsig_sign(), insert_soa(), make_prereq(), notify_createmessage(), query_add_cname(), query_dns64(), query_filter64(), sendstream(), tuple2msgname(), and update_addordelete().
void dns_message_puttempname | ( | dns_message_t * | msg, | |
dns_name_t ** | item | |||
) |
Return a borrowed name to the message's name free list.
Requires:
Definition at line 2476 of file message.c.
References DNS_MESSAGE_VALID, dns_name_dynamic(), dns_name_free(), isc_mempool_put, dns_message::mctx, dns_message::namepool, and REQUIRE.
Referenced by add_rdata_to_list(), buildquery(), copy_name(), create_query(), dns_message_renderreset(), dns_tsig_sign(), free_namelist(), make_prereq(), notify_createmessage(), ns_client_qnamereplace(), query_add_cname(), query_find(), query_releasename(), query_reset(), request_soa(), resquery_send(), send_update(), sendstream(), setup_lookup(), setzone(), start_update(), update_addordelete(), and xfrin_send_request().
void dns_message_puttemprdata | ( | dns_message_t * | msg, | |
dns_rdata_t ** | item | |||
) |
Return a borrowed rdata to the message's rdata free list.
Requires:
Definition at line 2487 of file message.c.
References DNS_MESSAGE_VALID, releaserdata(), and REQUIRE.
Referenced by add_rdata_to_list(), dns_message_buildopt(), dns_message_setquerytsig(), dns_tsig_sign(), notify_createmessage(), query_add_cname(), query_dns64(), query_filter64(), sendstream(), tuple2msgname(), and update_addordelete().
void dns_message_puttemprdataset | ( | dns_message_t * | msg, | |
dns_rdataset_t ** | item | |||
) |
Return a borrowed rdataset to the message's rdataset free list.
Requires:
Definition at line 2496 of file message.c.
References DNS_MESSAGE_VALID, dns_rdataset_isassociated(), isc_mempool_put, dns_message::rdspool, and REQUIRE.
Referenced by add_rdata_to_list(), buildquery(), create_query(), dns_acache_getentry(), dns_message_buildopt(), dns_message_renderreset(), dns_message_setopt(), dns_message_setquerytsig(), exit_check(), free_namelist(), notify_createmessage(), ns_client_endrequest(), query_add_cname(), query_dns64(), query_filter64(), query_find(), query_putrdataset(), request_soa(), resquery_send(), sendstream(), setzone(), start_update(), tuple2msgname(), and xfrin_send_request().
void dns_message_puttemprdatalist | ( | dns_message_t * | msg, | |
dns_rdatalist_t ** | item | |||
) |
Return a borrowed rdatalist to the message's rdatalist free list.
Requires:
Definition at line 2506 of file message.c.
References DNS_MESSAGE_VALID, releaserdatalist(), and REQUIRE.
Referenced by add_rdata_to_list(), dns_message_buildopt(), dns_message_setquerytsig(), dns_tsig_sign(), notify_createmessage(), query_add_cname(), query_dns64(), query_filter64(), sendstream(), and tuple2msgname().
isc_result_t dns_message_peekheader | ( | isc_buffer_t * | source, | |
dns_messageid_t * | idp, | |||
unsigned int * | flagsp | |||
) |
Assume the remaining region of "source" is a DNS message. Peek into it and fill in "*idp" with the message id, and "*flagsp" with the flags.
Requires:
Definition at line 2515 of file message.c.
References buffer, DNS_MESSAGE_FLAG_MASK, DNS_MESSAGE_HEADERLEN, isc_buffer_getuint16(), isc_buffer_remainingregion, ISC_R_SUCCESS, ISC_R_UNEXPECTEDEND, isc_region::length, r, and REQUIRE.
Referenced by client_request(), recv_done(), tcp_recv(), and udp_recv().
isc_result_t dns_message_reply | ( | dns_message_t * | msg, | |
isc_boolean_t | want_question_section | |||
) |
Start formatting a reply to the query in 'msg'.
Requires:
Definition at line 2544 of file message.c.
References isc_region::base, DNS_MESSAGE_INTENTRENDER, dns_message_renderreserve(), DNS_MESSAGE_REPLYPRESERVE, DNS_MESSAGE_VALID, DNS_MESSAGEFLAG_QR, dns_opcode_notify, dns_opcode_query, dns_opcode_update, DNS_R_FORMERR, dns_rcode_noerror, DNS_SECTION_ANSWER, DNS_SECTION_PREREQUISITE, DNS_SECTION_QUESTION, dns_tsigerror_badtime, dns_message::flags, dns_message::free_query, dns_message::free_saved, dns_message::from_to_wire, dns_message::header_ok, ISC_FALSE, ISC_R_SUCCESS, ISC_TRUE, isc_region::length, msginitprivate(), msgresetnames(), msgresetopt(), msgresetsigs(), dns_message::opcode, dns_message::query, dns_message::querytsigstatus, dns_message::question_ok, REQUIRE, dns_message::saved, dns_message::sig_reserved, spacefortsig(), dns_message::tsigkey, and dns_message::tsigstatus.
Referenced by dns_tkey_processquery(), ns_client_error(), ns_query_start(), respond(), and sendstream().
dns_rdataset_t* dns_message_getopt | ( | dns_message_t * | msg | ) |
Get the OPT record for 'msg'.
Requires:
Definition at line 2606 of file message.c.
References DNS_MESSAGE_VALID, dns_message::opt, and REQUIRE.
Referenced by client_request(), dns_message_pseudosectiontotext(), printmessage(), and resquery_response().
isc_result_t dns_message_setopt | ( | dns_message_t * | msg, | |
dns_rdataset_t * | opt | |||
) |
Set the OPT record for 'msg'.
Requires:
Definition at line 2618 of file message.c.
References cleanup(), DNS_MESSAGE_INTENTRENDER, dns_message_puttemprdataset(), dns_message_renderreserve(), DNS_MESSAGE_VALID, DNS_RDATA_INIT, dns_rdataset_current(), dns_rdataset_disassociate(), dns_rdataset_first(), DNS_SECTION_ANY, dns_message::from_to_wire, ISC_R_SUCCESS, dns_rdata::length, msgresetopt(), dns_message::opt, dns_message::opt_reserved, REQUIRE, dns_message::state, and dns_rdataset::type.
Referenced by add_opt(), client_send(), fctx_addopt(), and sendstream().
dns_rdataset_t* dns_message_gettsig | ( | dns_message_t * | msg, | |
dns_name_t ** | owner | |||
) |
Get the TSIG record and owner for 'msg'.
Requires:
Definition at line 2669 of file message.c.
References DNS_MESSAGE_VALID, REQUIRE, dns_message::tsig, and dns_message::tsigname.
Referenced by client_request(), dns_message_pseudosectiontotext(), printmessage(), update_completed(), and xfrin_recv_done().
isc_result_t dns_message_settsigkey | ( | dns_message_t * | msg, | |
dns_tsigkey_t * | key | |||
) |
Set the tsig key for 'msg'. This is only necessary for when rendering a query or parsing a response. The key (if non-NULL) is attached to, and will be detached when the message is destroyed.
Requires:
Definition at line 2684 of file message.c.
References DNS_MESSAGE_INTENTRENDER, dns_message_renderrelease(), dns_message_renderreserve(), DNS_MESSAGE_VALID, DNS_SECTION_ANY, dns_tsigkey_attach(), dns_tsigkey_detach(), dns_message::from_to_wire, ISC_R_SUCCESS, REQUIRE, dns_message::sig0key, dns_message::sig_reserved, spacefortsig(), dns_message::state, and dns_message::tsigkey.
Referenced by dns_request_createvia4(), dns_request_getresponse(), receive_soa(), recv_done(), recvsoa(), resquery_response(), resquery_send(), sendstream(), setup_lookup(), update_completed(), update_done(), xfrin_recv_done(), and xfrin_send_request().
dns_tsigkey_t* dns_message_gettsigkey | ( | dns_message_t * | msg | ) |
Gets the tsig key for 'msg'.
Requires:
Definition at line 2719 of file message.c.
References DNS_MESSAGE_VALID, REQUIRE, and dns_message::tsigkey.
Referenced by dns_tsig_sign(), dns_tsig_verify(), dns_zone_notifyreceive(), ns_notify_start(), ns_xfr_start(), resquery_send(), tsig_verify_tcp(), and xfrin_recv_done().
isc_result_t dns_message_setquerytsig | ( | dns_message_t * | msg, | |
isc_buffer_t * | querytsig | |||
) |
Indicates that 'querytsig' is the TSIG from the signed query for which 'msg' is the response. This is also used for chained TSIGs in TCP responses.
Requires:
Definition at line 2731 of file message.c.
References isc_region::base, cleanup(), dns_message_gettemprdata(), dns_message_gettemprdatalist(), dns_message_gettemprdataset(), dns_message_puttemprdata(), dns_message_puttemprdatalist(), dns_message_puttemprdataset(), dns_message_takebuffer(), DNS_MESSAGE_VALID, dns_rdata_fromregion(), dns_rdata_init(), dns_rdatalist_tordataset(), isc_buffer_allocate(), isc_buffer_putmem, isc_buffer_usedregion, ISC_LIST_APPEND, ISC_R_NOMEMORY, ISC_R_SUCCESS, isc_region::length, dns_message::mctx, dns_message::querytsig, r, and REQUIRE.
Referenced by dns_request_getresponse(), recv_done(), resquery_response(), sendstream(), and xfrin_recv_done().
isc_result_t dns_message_getquerytsig | ( | dns_message_t * | msg, | |
isc_mem_t * | mctx, | |||
isc_buffer_t ** | querytsig | |||
) |
Gets the tsig from the TSIG from the signed query 'msg'. This is also used for chained TSIGs in TCP responses. Unlike dns_message_gettsig, this makes a copy of the data, so can be used if the message is destroyed.
Requires:
Ensures:
Definition at line 2785 of file message.c.
References isc_region::base, DNS_MESSAGE_VALID, DNS_RDATA_INIT, dns_rdata_toregion(), dns_rdataset_current(), dns_rdataset_first(), isc_buffer_allocate(), isc_buffer_putmem, ISC_R_SUCCESS, isc_region::length, r, REQUIRE, and dns_message::tsig.
Referenced by dns_request_createvia4(), ns_xfr_start(), recv_done(), resquery_send(), sendstream(), xfrin_recv_done(), and xfrin_send_request().
dns_rdataset_t* dns_message_getsig0 | ( | dns_message_t * | msg, | |
dns_name_t ** | owner | |||
) |
Get the SIG(0) record and owner for 'msg'.
Requires:
Definition at line 2812 of file message.c.
References DNS_MESSAGE_VALID, dns_rootname, REQUIRE, dns_message::sig0, and dns_message::sig0name.
Referenced by dns_message_pseudosectiontotext().
isc_result_t dns_message_setsig0key | ( | dns_message_t * | msg, | |
dst_key_t * | key | |||
) |
Set the SIG(0) key for 'msg'.
Requires:
Definition at line 2835 of file message.c.
References DNS_MESSAGE_INTENTRENDER, dns_message_renderreserve(), DNS_MESSAGE_VALID, dns_name_toregion(), DNS_SECTION_ANY, dst_key_name(), dst_key_sigsize(), dns_message::from_to_wire, ISC_R_SUCCESS, isc_region::length, r, REQUIRE, dns_message::sig0key, dns_message::sig_reserved, dns_message::state, and dns_message::tsigkey.
Referenced by send_update().
dst_key_t* dns_message_getsig0key | ( | dns_message_t * | msg | ) |
Gets the SIG(0) key for 'msg'.
Requires:
Definition at line 2887 of file message.c.
References DNS_MESSAGE_VALID, REQUIRE, and dns_message::sig0key.
void dns_message_takebuffer | ( | dns_message_t * | msg, | |
isc_buffer_t ** | buffer | |||
) |
Give the *buffer to the message code to clean up when it is no longer needed. This is usually when the message is reset or destroyed.
Requires:
Definition at line 2899 of file message.c.
References dns_message::cleanup, DNS_MESSAGE_VALID, ISC_BUFFER_VALID, ISC_LIST_APPEND, and REQUIRE.
Referenced by add_rdata_to_list(), buildquery(), copy_name(), dns_dnssec_signmessage(), dns_message_buildopt(), dns_message_setquerytsig(), dns_message_signer(), dns_tkey_builddhquery(), dns_tsig_sign(), notify_createmessage(), parse_name(), parse_rdata(), query_dns64(), and query_filter64().
isc_result_t dns_message_signer | ( | dns_message_t * | msg, | |
dns_name_t * | signer | |||
) |
If this message was signed, return the identity of the signer. Unless ISC_R_NOTFOUND is returned, signer will reflect the name of the key that signed the message.
Requires:
Definition at line 2909 of file message.c.
References DNS_MESSAGE_INTENTPARSE, dns_message_takebuffer(), DNS_MESSAGE_VALID, dns_name_clone(), dns_name_hasbuffer(), dns_name_setbuffer(), DNS_R_NOIDENTITY, DNS_R_NOTVERIFIEDYET, DNS_R_SIGINVALID, DNS_R_TSIGERRORSET, DNS_R_TSIGVERIFYFAILURE, dns_rcode_noerror, dns_rdata_freestruct(), DNS_RDATA_INIT, dns_rdata_tostruct(), dns_rdataset_current(), dns_rdataset_first(), dns_tsigkey_identity, dns_message::from_to_wire, INSIST, isc_buffer_allocate(), ISC_R_NOTFOUND, ISC_R_SUCCESS, dns_message::mctx, dns_tsigkey::name, REQUIRE, dns_message::sig0, dns_message::sig0status, dns_message::tsig, dns_message::tsigkey, dns_message::tsigstatus, dns_message::verified_sig, and dns_message::verify_attempted.
Referenced by client_request(), and dns_tkey_processquery().
isc_result_t dns_message_checksig | ( | dns_message_t * | msg, | |
dns_view_t * | view | |||
) |
If this message was signed, verify the signature.
Requires:
Definition at line 3039 of file message.c.
References isc_region::base, dns_rdata::data, dns_dnssec_verifymessage(), DNS_KEYPROTO_ANY, DNS_KEYPROTO_DNSSEC, DNS_MESSAGE_VALID, DNS_R_KEYUNAUTHORIZED, dns_rdata_freestruct(), DNS_RDATA_INIT, dns_rdata_reset(), dns_rdata_tostruct(), dns_rdataset_current(), dns_rdataset_disassociate(), dns_rdataset_first(), dns_rdataset_init(), dns_rdataset_isassociated(), dns_rdataset_next(), dns_trust_secure, dns_tsig_verify(), dns_view_checksig(), dns_view_simplefind(), dst_key_alg(), dst_key_free(), dst_key_fromdns(), dst_key_id(), dst_key_proto(), INSIST, isc_buffer_add, isc_buffer_init, ISC_FALSE, ISC_R_NOMORE, ISC_R_SUCCESS, ISC_R_UNEXPECTEDEND, key, dns_rdata::length, isc_region::length, dns_view::mctx, dns_message::mctx, dns_rdata::rdclass, REQUIRE, dns_message::saved, dns_message::sig0, dns_rdataset::trust, dns_message::tsig, and dns_message::tsigkey.
Referenced by dns_message_rechecksig(), resquery_response(), and xfrin_recv_done().
isc_result_t dns_message_rechecksig | ( | dns_message_t * | msg, | |
dns_view_t * | view | |||
) |
Reset the signature state and then if the message was signed, verify the message.
Requires:
Definition at line 3004 of file message.c.
References dns_message_checksig(), and dns_message_resetsig().
Referenced by client_request().
void dns_message_resetsig | ( | dns_message_t * | msg | ) |
Reset the signature state.
Requires:
Definition at line 2990 of file message.c.
References DNS_MESSAGE_VALID, dns_rcode_noerror, dns_tsigkey_detach(), REQUIRE, dns_message::sig0status, dns_message::timeadjust, dns_message::tsigkey, dns_message::tsigstatus, dns_message::verified_sig, and dns_message::verify_attempted.
Referenced by client_request(), and dns_message_rechecksig().
isc_region_t* dns_message_getrawmessage | ( | dns_message_t * | msg | ) |
Retrieve the raw message in compressed wire format. The message must have been successfully parsed for it to have been saved.
Requires:
Definition at line 3526 of file message.c.
References DNS_MESSAGE_VALID, REQUIRE, and dns_message::saved.
Referenced by client_request(), dns_zone_forwardupdate(), and ns_client_sendraw().
void dns_message_setsortorder | ( | dns_message_t * | msg, | |
dns_rdatasetorderfunc_t | order, | |||
const void * | order_arg | |||
) |
Define the order in which RR sets get rendered by dns_message_rendersection() to be the ascending order defined by the integer value returned by 'order' when given each RR and 'arg' as arguments. If 'order' and 'order_arg' are NULL, a default order is used.
Requires:
Definition at line 3532 of file message.c.
References DNS_MESSAGE_VALID, dns_message::order, dns_message::order_arg, and REQUIRE.
Referenced by setup_query_sortlist().
void dns_message_settimeadjust | ( | dns_message_t * | msg, | |
int | timeadjust | |||
) |
Adjust the time used to sign/verify a message by timeadjust. Currently only TSIG.
Requires:
Definition at line 3541 of file message.c.
References DNS_MESSAGE_VALID, REQUIRE, and dns_message::timeadjust.
int dns_message_gettimeadjust | ( | dns_message_t * | msg | ) |
Return the current time adjustment.
Requires:
Definition at line 3547 of file message.c.
References DNS_MESSAGE_VALID, REQUIRE, and dns_message::timeadjust.
void dns_message_logpacket | ( | dns_message_t * | message, | |
const char * | description, | |||
isc_logcategory_t * | category, | |||
isc_logmodule_t * | module, | |||
int | level, | |||
isc_mem_t * | mctx | |||
) |
void dns_message_logpacket2 | ( | dns_message_t * | message, | |
const char * | description, | |||
isc_sockaddr_t * | address, | |||
isc_logcategory_t * | category, | |||
isc_logmodule_t * | module, | |||
int | level, | |||
isc_mem_t * | mctx | |||
) |
Definition at line 3573 of file message.c.
References dns_master_style_debug, logfmtpacket(), and REQUIRE.
Referenced by resquery_response(), and xfrin_recv_done().
void dns_message_logfmtpacket | ( | dns_message_t * | message, | |
const char * | description, | |||
isc_logcategory_t * | category, | |||
isc_logmodule_t * | module, | |||
const dns_master_style_t * | style, | |||
int | level, | |||
isc_mem_t * | mctx | |||
) |
void dns_message_logfmtpacket2 | ( | dns_message_t * | message, | |
const char * | description, | |||
isc_sockaddr_t * | address, | |||
isc_logcategory_t * | category, | |||
isc_logmodule_t * | module, | |||
const dns_master_style_t * | style, | |||
int | level, | |||
isc_mem_t * | mctx | |||
) |
Log 'message' at the specified logging parameters.
For dns_message_logpacket and dns_message_logfmtpacket expect the 'description' to end in a newline.
For dns_message_logpacket2 and dns_message_logfmtpacket2 'description' will be emitted at the start of the message followed by the formatted address and a newline.
Requires:
Definition at line 3595 of file message.c.
References logfmtpacket(), and REQUIRE.
Referenced by resquery_response(), and resquery_send().
isc_result_t dns_message_buildopt | ( | dns_message_t * | msg, | |
dns_rdataset_t ** | opt, | |||
unsigned int | version, | |||
isc_uint16_t | udpsize, | |||
unsigned int | flags, | |||
dns_ednsopt_t * | ednsopts, | |||
size_t | count | |||
) |
Built a opt record.
Requires:
Definition at line 3656 of file message.c.
References cleanup(), dns_rdata::data, dns_message_gettemprdata(), dns_message_gettemprdatalist(), dns_message_gettemprdataset(), dns_message_puttemprdata(), dns_message_puttemprdatalist(), dns_message_puttemprdataset(), dns_message_takebuffer(), DNS_MESSAGE_VALID, dns_rdatalist_tordataset(), dns_rdataset_init(), dns_rdata::flags, isc_buffer_allocate(), isc_buffer_base, isc_buffer_putmem, isc_buffer_putuint16, ISC_LIST_APPEND, ISC_R_NOSPACE, ISC_R_SUCCESS, dns_rdata::length, dns_message::mctx, dns_rdata::rdclass, dns_rdatalist::rdclass, REQUIRE, RUNTIME_CHECK, dns_rdatalist::ttl, dns_rdata::type, and dns_rdatalist::type.
Referenced by add_opt(), fctx_addopt(), and ns_client_addopt().