Skip to content
Snippets Groups Projects
Commit 705ea9fa authored by Daniel Salzman's avatar Daniel Salzman
Browse files

utils: add comments

refs #2137
parent f1cfbd3b
No related branches found
No related tags found
No related merge requests found
......@@ -48,18 +48,53 @@ typedef struct {
/*! \brief Default dump style. */
extern const knot_dump_style_t KNOT_DUMP_STYLE_DEFAULT;
/*!
* \brief Dumps rrset header.
*
* \param rrset RRset to dump.
* \param pos Position of the record to dump.
* \param dst Output buffer.
* \param maxlen Otuput buffer size.
* \param style Output style.
*
* \retval output length if success.
* \retval < 0 if error.
*/
int knot_rrset_txt_dump_header(const knot_rrset_t *rrset,
const size_t pos,
char *dst,
const size_t maxlen,
const knot_dump_style_t *style);
/*!
* \brief Dumps rrset data.
*
* \param rrset RRset to dump.
* \param pos Position of the record to dump.
* \param dst Output buffer.
* \param maxlen Otuput buffer size.
* \param style Output style.
*
* \retval output length if success.
* \retval < 0 if error.
*/
int knot_rrset_txt_dump_data(const knot_rrset_t *rrset,
const size_t pos,
char *dst,
const size_t maxlen,
const knot_dump_style_t *style);
/*!
* \brief Dumps rrset.
*
* \param rrset RRset to dump.
* \param dst Output buffer.
* \param maxlen Otuput buffer size.
* \param style Output style.
*
* \retval output length if success.
* \retval < 0 if error.
*/
int knot_rrset_txt_dump(const knot_rrset_t *rrset,
char *dst,
const size_t maxlen,
......
......@@ -18,7 +18,7 @@
*
* \author Daniel Salzman <daniel.salzman@nic.cz>
*
* \brief dig/host executives
* \brief Common executives for utils.
*
* \addtogroup knot_utils
* @{
......@@ -31,20 +31,57 @@
#include "utils/common/params.h" // style_t
#include "libknot/libknot.h"
/*! \brief Operation codes. */
extern knot_lookup_table_t opcodes[];
/*! \brief Response codes. */
extern knot_lookup_table_t rcodes[];
/*! \brief Messages for host-like output. */
extern knot_lookup_table_t rtypes[];
/*!
* \brief Allocates empty packet and sets packet size and random id.
*
* \param type Packet preallocation type.
* \param max_size Maximal packet size.
*
* \retval packet if success.
* \retval NULL if error.
*/
knot_packet_t* create_empty_packet(const knot_packet_prealloc_type_t type,
const size_t max_size);
/*!
* \brief Prints information header for transfer.
*
* \param owner Name of the zone.
* \param type Transfer type.
* \param style Style of the output.
*/
void print_header_xfr(const char *owner,
const uint16_t type,
const style_t *style);
/*!
* \brief Prints answer section for 1 transfer message.
*
* \param packet Response packet.
* \param style Style of the output.
*/
void print_data_xfr(const knot_packet_t *packet,
const style_t *style);
/*!
* \brief Prints trailing statistics for transfer.
*
* \param total_len Total reply size (all messages).
* \param msg_count Number of messages.
* \param rr_count Total number of answer records.
* \param net Connection information.
* \param elapse Total elapsed time.
* \param style Style of the otput.
*/
void print_footer_xfr(const size_t total_len,
const size_t msg_count,
const size_t rr_count,
......@@ -52,6 +89,16 @@ void print_footer_xfr(const size_t total_len,
const float elapsed,
const style_t *style);
/*!
* \brief Prints one response packet.
*
* \param packet Response packet..
* \param total_len Total reply size (all messages).
* \param net Connection information.
* \param elapse Total elapsed time.
* \param incoming Indicates if the packet is input.
* \param style Style of the otput.
*/
void print_packet(const knot_packet_t *packet,
const size_t total_len,
const net_t *net,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment