📄 message.h
字号:
* msg be a valid message * * item != NULL && *item point to a rdata returned by * dns_message_gettemprdata() * * Ensures: * *item == NULL */voiddns_message_puttemprdataset(dns_message_t *msg, dns_rdataset_t **item);/* * Return a borrowed rdataset to the message's rdataset free list. * * Requires: * msg be a valid message * * item != NULL && *item point to a rdataset returned by * dns_message_gettemprdataset() * * Ensures: * *item == NULL */voiddns_message_puttemprdatalist(dns_message_t *msg, dns_rdatalist_t **item);/* * Return a borrowed rdatalist to the message's rdatalist free list. * * Requires: * msg be a valid message * * item != NULL && *item point to a rdatalist returned by * dns_message_gettemprdatalist() * * Ensures: * *item == NULL */isc_result_tdns_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: * * source != NULL * * Ensures: * * if (idp != NULL) *idp == message id. * * if (flagsp != NULL) *flagsp == message flags. * * Returns: * * ISC_R_SUCCESS -- all is well. * * ISC_R_UNEXPECTEDEND -- buffer doesn't contain enough for a header. */isc_result_tdns_message_reply(dns_message_t *msg, isc_boolean_t want_question_section);/* * Start formatting a reply to the query in 'msg'. * * Requires: * * 'msg' is a valid message with parsing intent, and contains a query. * * Ensures: * * The message will have a rendering intent. If 'want_question_section' * is true, the message opcode is query or notify, and the question * section is present and properly formatted, then the question section * will be included in the reply. All other sections will be cleared. * The QR flag will be set, the RD flag will be preserved, and all other * flags will be cleared. * * Returns: * * ISC_R_SUCCESS -- all is well. * * DNS_R_FORMERR -- the header or question section of the * message is invalid, replying is impossible. * If DNS_R_FORMERR is returned when * want_question_section is ISC_FALSE, then * it's the header section that's bad; * otherwise either of the header or question * sections may be bad. */dns_rdataset_t *dns_message_getopt(dns_message_t *msg);/* * Get the OPT record for 'msg'. * * Requires: * * 'msg' is a valid message. * * Returns: * * The OPT rdataset of 'msg', or NULL if there isn't one. */isc_result_tdns_message_setopt(dns_message_t *msg, dns_rdataset_t *opt);/* * Set the OPT record for 'msg'. * * Requires: * * 'msg' is a valid message with rendering intent * and no sections have been rendered. * * 'opt' is a valid OPT record. * * Ensures: * * The OPT record has either been freed or ownership of it has * been transferred to the message. * * If ISC_R_SUCCESS was returned, the OPT record will be rendered * when dns_message_renderend() is called. * * Returns: * * ISC_R_SUCCESS -- all is well. * * ISC_R_NOSPACE -- there is no space for the OPT record. */dns_rdataset_t *dns_message_gettsig(dns_message_t *msg, dns_name_t **owner);/* * Get the TSIG record and owner for 'msg'. * * Requires: * * 'msg' is a valid message. * 'owner' is NULL or *owner is NULL. * * Returns: * * The TSIG rdataset of 'msg', or NULL if there isn't one. * * Ensures: * * If 'owner' is not NULL, it will point to the owner name. */isc_result_tdns_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: * * 'msg' is a valid message with rendering intent, * dns_message_renderbegin() has been called, and no sections have been * rendered. * 'key' is a valid tsig key or NULL. * * Returns: * * ISC_R_SUCCESS -- all is well. * * ISC_R_NOSPACE -- there is no space for the TSIG record. */dns_tsigkey_t *dns_message_gettsigkey(dns_message_t *msg);/* * Gets the tsig key for 'msg'. * * Requires: * * 'msg' is a valid message */isc_result_tdns_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: * * 'querytsig' is a valid buffer as returned by dns_message_getquerytsig() * or NULL * * 'msg' is a valid message * * Returns: * * ISC_R_SUCCESS * ISC_R_NOMEMORY */isc_result_tdns_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: * * 'msg' is a valid signed message * 'mctx' is a valid memory context * querytsig != NULL && *querytsig == NULL * * Returns: * * ISC_R_SUCCESS * ISC_R_NOMEMORY * * Ensures: * 'tsig' points to NULL or an allocated buffer which must be freed * by the caller. */dns_rdataset_t *dns_message_getsig0(dns_message_t *msg, dns_name_t **owner);/* * Get the SIG(0) record and owner for 'msg'. * * Requires: * * 'msg' is a valid message. * 'owner' is NULL or *owner is NULL. * * Returns: * * The SIG(0) rdataset of 'msg', or NULL if there isn't one. * * Ensures: * * If 'owner' is not NULL, it will point to the owner name. */isc_result_tdns_message_setsig0key(dns_message_t *msg, dst_key_t *key);/* * Set the SIG(0) key for 'msg'. * * Requires: * * 'msg' is a valid message with rendering intent, * dns_message_renderbegin() has been called, and no sections have been * rendered. * 'key' is a valid sig key or NULL. * * Returns: * * ISC_R_SUCCESS -- all is well. * * ISC_R_NOSPACE -- there is no space for the SIG(0) record. */dst_key_t *dns_message_getsig0key(dns_message_t *msg);/* * Gets the SIG(0) key for 'msg'. * * Requires: * * 'msg' is a valid message */voiddns_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: * * msg be a valid message. * * buffer != NULL && *buffer is a valid isc_buffer_t, which was * dynamincally allocated via isc_buffer_allocate(). */isc_result_tdns_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: * * msg is a valid parsed message. * signer is a valid name * * Returns: * * ISC_R_SUCCESS - the message was signed, and *signer * contains the signing identity * * ISC_R_NOTFOUND - no TSIG or SIG(0) record is present in the * message * * DNS_R_TSIGVERIFYFAILURE - the message was signed by a TSIG, but the * signature failed to verify * * DNS_R_TSIGERRORSET - the message was signed by a TSIG and * verified, but the query was rejected by * the server * * DNS_R_NOIDENTITY - the message was signed by a TSIG and * verified, but the key has no identity since * it was generated by an unsigned TKEY process * * DNS_R_SIGINVALID - the message was signed by a SIG(0), but * the signature failed to verify * * DNS_R_NOTVERIFIEDYET - the message was signed by a TSIG or SIG(0), * but the signature has not been verified yet */isc_result_tdns_message_checksig(dns_message_t *msg, dns_view_t *view);/* * If this message was signed, verify the signature. * * Requires: * * msg is a valid parsed message. * view is a valid view or NULL * * Returns: * * ISC_R_SUCCESS - the message was unsigned, or the message * was signed correctly. * * DNS_R_EXPECTEDTSIG - A TSIG was expected, but not seen * DNS_R_UNEXPECTEDTSIG - A TSIG was seen but not expected * DNS_R_TSIGVERIFYFAILURE - The TSIG failed to verify */isc_result_tdns_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: * * msg is a valid parsed message. * view is a valid view or NULL * * Returns: * * ISC_R_SUCCESS - the message was unsigned, or the message * was signed correctly. * * DNS_R_EXPECTEDTSIG - A TSIG was expected, but not seen * DNS_R_UNEXPECTEDTSIG - A TSIG was seen but not expected * DNS_R_TSIGVERIFYFAILURE - The TSIG failed to verify */voiddns_message_resetsig(dns_message_t *msg);/* * Reset the signature state. * * Requires: * 'msg' is a valid parsed message. */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: * msg is a valid parsed message. * * Returns: * NULL if there is no saved message. * a pointer to a region which refers the dns message. */voiddns_message_setsortorder(dns_message_t *msg, dns_rdatasetorderfunc_t order, 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: * msg be a valid message. * order_arg is NULL if and only if order is NULL. */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: * msg be a valid message. */int dns_message_gettimeadjust(dns_message_t *msg);/* * Return the current time adjustment. * * Requires: * msg be a valid message. */ISC_LANG_ENDDECLS#endif /* DNS_MESSAGE_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -