📄 message.h
字号:
isc_result_tdns_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: * * 'msg' be valid. * * 'cctx' be valid. * * 'buffer' is a valid buffer. * * Side Effects: * * The buffer is cleared before it is used. * * Returns: * ISC_R_SUCCESS -- all is well * ISC_R_NOSPACE -- output buffer is too small */isc_result_tdns_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: * * 'msg' be valid. * * dns_message_renderbegin() was called. * * buffer != NULL. * * Returns: * ISC_R_NOSPACE -- new buffer is too small * ISC_R_SUCCESS -- all is well. */isc_result_tdns_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: * * 'msg' be valid. * * dns_message_renderbegin() was called. * * Returns: * ISC_R_SUCCESS -- all is well. * ISC_R_NOSPACE -- not enough free space in the buffer. */voiddns_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: * * 'msg' be valid. * * 'space' is less than or equal to the total amount of space reserved * via prior calls to dns_message_renderreserve(). * * dns_message_renderbegin() was called. */isc_result_tdns_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: * 'msg' be valid. * * 'section' be a valid section. * * dns_message_renderbegin() was called. * * Returns: * ISC_R_SUCCESS -- all records were written, and there are * no more records for this section. * ISC_R_NOSPACE -- Not enough room in the buffer to write * all records requested. * DNS_R_MOREDATA -- All requested records written, and there * are records remaining for this section. */voiddns_message_renderheader(dns_message_t *msg, isc_buffer_t *target);/* * Render the message header. This is implicitly called by * dns_message_renderend(). * * Requires: * * 'msg' be a valid message. * * dns_message_renderbegin() was called. * * 'target' is a valid buffer with enough space to hold a message header */isc_result_tdns_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: * * 'msg' be a valid message. * * dns_message_renderbegin() was called. * * Returns: * ISC_R_SUCCESS -- all is well. */voiddns_message_renderreset(dns_message_t *msg);/* * Reset the message so that it may be rendered again. * * Notes: * * If dns_message_renderbegin() has been called, dns_message_renderend() * must be called before calling this function. * * Requires: * * 'msg' be a valid message with rendering intent. */isc_result_tdns_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: * * 'msg' be valid. * * 'section' be a valid section. * * Returns: * ISC_R_SUCCESS -- All is well. * ISC_R_NOMORE -- No names on given section. */isc_result_tdns_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: * * 'msg' be valid. * * 'section' be a valid section. * * dns_message_firstname() must have been called on this section, * and the result was ISC_R_SUCCESS. * * Returns: * ISC_R_SUCCESS -- All is well. * ISC_R_NOMORE -- No more names in given section. */voiddns_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: * * 'msg' be valid. * * 'name' be non-NULL, and *name be NULL. * * 'section' be a valid section. * * dns_message_firstname() must have been called on this section, * and the result of it and any dns_message_nextname() calls was * ISC_R_SUCCESS. */isc_result_tdns_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: * 'msg' be valid. * * 'section' be a valid section. * * If a pointer to the name is desired, 'foundname' should be non-NULL. * If it is non-NULL, '*foundname' MUST be NULL. * * If a type other than dns_datatype_any is searched for, 'rdataset' * may be non-NULL, '*rdataset' be NULL, and will point at the found * rdataset. If the type is dns_datatype_any, 'rdataset' must be NULL. * * 'target' be a valid name. * * 'type' be a valid type. * * If 'type' is dns_rdatatype_rrsig, 'covers' must be a valid type. * Otherwise it should be 0. * * Returns: * ISC_R_SUCCESS -- all is well. * DNS_R_NXDOMAIN -- name does not exist in that section. * DNS_R_NXRRSET -- The name does exist, but the desired * type does not. */isc_result_tdns_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: * if '**rdataset' is non-NULL, *rdataset needs to be NULL. * * 'type' be a valid type, and NOT dns_rdatatype_any. * * If 'type' is dns_rdatatype_rrsig, 'covers' must be a valid type. * Otherwise it should be 0. * * Returns: * ISC_R_SUCCESS -- all is well. * ISC_R_NOTFOUND -- the desired type does not exist. */voiddns_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: * * 'msg' be valid. * * 'name' must be a name already in 'fromsection'. * * 'fromsection' must be a valid section. * * 'tosection' must be a valid section. */voiddns_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: * * 'msg' be valid, and be a renderable message. * * 'name' be a valid absolute name. * * 'section' be a named section. *//* * LOANOUT FUNCTIONS * * Each of these functions loan a particular type of data to the caller. * The storage for these will vanish when the message is destroyed or * reset, and must NOT be used after these operations. */isc_result_tdns_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: * msg be a valid message * * item != NULL && *item == NULL * * Returns: * ISC_R_SUCCESS -- All is well. * ISC_R_NOMEMORY -- No item can be allocated. */isc_result_tdns_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: * msg be a valid message * * item != NULL && *item == NULL * * Returns: * ISC_R_SUCCESS -- All is well. * ISC_R_NOMEMORY -- No item can be allocated. */isc_result_tdns_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: * msg be a valid message * * item != NULL && *item == NULL * * Returns: * ISC_R_SUCCESS -- All is well. * ISC_R_NOMEMORY -- No item can be allocated. */isc_result_tdns_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: * msg be a valid message * * item != NULL && *item == NULL * * Returns: * ISC_R_SUCCESS -- All is well. * ISC_R_NOMEMORY -- No item can be allocated. */isc_result_tdns_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: * msg be a valid message * * item != NULL && *item == NULL * * Returns: * ISC_R_SUCCESS -- All is well. * ISC_R_NOMEMORY -- No item can be allocated. */voiddns_message_puttempname(dns_message_t *msg, dns_name_t **item);/* * Return a borrowed name to the message's name free list. * * Requires: * msg be a valid message * * item != NULL && *item point to a name returned by * dns_message_gettempname() * * Ensures: * *item == NULL */voiddns_message_puttemprdata(dns_message_t *msg, dns_rdata_t **item);/* * Return a borrowed rdata to the message's rdata free list. * * Requires:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -