<commit_before>/**
 * host2str.h -  txt presentation of RRs
 *
 * a Net::DNS like library for C
 *
 * (c) NLnet Labs, 2005-2006
 *
 * See the file LICENSE for the license
 */

/**
 * \file
 *
 * Contains functions to translate the main structures to their text
 * representation, as well as functions to print them.
 */

#ifndef LDNS_HOST2STR_H
#define LDNS_HOST2STR_H

#include <ldns/common.h>
#include <ldns/error.h>
#include <ldns/rr.h>
#include <ldns/rdata.h>
#include <ldns/packet.h>
#include <ldns/buffer.h>
#include <ldns/resolver.h>
#include <ldns/zone.h>
#include <ctype.h>

#include "ldns/util.h"

#ifdef __cplusplus
extern "C" {
#endif

#define LDNS_APL_IP4            1
#define LDNS_APL_IP6            2
#define LDNS_APL_MASK           0x7f
#define LDNS_APL_NEGATION       0x80

/** 
 * Represent a NULL pointer (instead of a pointer to a ldns_rr as "; (null)" 
 * as opposed to outputting nothing at all in such a case.
 */
/*	Flag Name			Flag Nr.	Has data associated
	---------------------------------------------------------------------*/
#define LDNS_COMMENT_NULLS		(1 <<  0)
/** Show key id with DNSKEY RR's as comment */
#define LDNS_COMMENT_KEY_ID		(1 <<  1)
/** Show if a DNSKEY is a ZSK or KSK as comment */
#define LDNS_COMMENT_KEY_TYPE		(1 <<  2)
/** Show DNSKEY key size as comment */
#define LDNS_COMMENT_KEY_SIZE		(1 <<  3)
/** Provide bubblebabble representation for DS RR's as comment */
#define LDNS_COMMENT_BUBBLEBABBLE	(1 <<  4)
/** Show when a NSEC3 RR has the optout flag set as comment */
#define LDNS_COMMENT_FLAGS		(1 <<  5)
/** Show the unhashed owner and next owner names for NSEC3 RR's as comment */
#define LDNS_COMMENT_NSEC3_CHAIN	(1 <<  6)	/* yes */
/** Print mark up */
#define LDNS_COMMENT_LAYOUT		(1 <<  7)
/** Also comment KEY_ID with RRSIGS **/
#define LDNS_COMMENT_RRSIGS		(1 <<  8)
#define LDNS_FMT_ZEROIZE_RRSIGS		(1 <<  9)
#define LDNS_FMT_PAD_SOA_SERIAL		(1 << 10)
#define LDNS_FMT_RFC3597		(1 << 11)	/* yes */

#define LDNS_FMT_FLAGS_WITH_DATA			    2

/** Show key id, type and size as comment for DNSKEY RR's */
#define LDNS_COMMENT_KEY		(LDNS_COMMENT_KEY_ID  \
					|LDNS_COMMENT_KEY_TYPE\
					|LDNS_COMMENT_KEY_SIZE)

/**
 * Output format specifier
 *
 * Determines how Packets, Resource Records and Resource record data field are
 * formatted when printing or converting to string.
 * Currently it is only used to specify what aspects of a Resource Record are
 * annotated in the comment section of the textual representation the record.
 * This is speciefed with flags and potential extra data (such as for example
 * a lookup map of hashes to real names for annotation NSEC3 records).
 */
struct ldns_struct_output_format
{
	/** Specification of how RR's should be formatted in text */
	int   flags;
	/** Potential extra data to be used with formatting RR's in text */
	void *data;
};
typedef struct ldns_struct_output_format ldns_output_format;

/**
 * Output format struct with additional data for flags that use them.
 * This struct may not be initialized directly. Use ldns_output_format_init
 * to initialize.
 */
struct ldns_struct_output_format_storage
{	int   flags;
	ldns_rbtree_t* hashmap;    /* for LDNS_COMMENT_NSEC3_CHAIN */
	ldns_rdf*      bitmap;     /* for LDNS_FMT_RFC3597     */
};
typedef struct ldns_struct_output_format_storage ldns_output_format_storage;

/**
 * Standard output format record that disables commenting in the textual 
 * representation of Resource Records completely.
 */
extern const ldns_output_format *ldns_output_format_nocomments;
/**<commit_msg>spelling: specified<commit_after>/**
 * host2str.h -  txt presentation of RRs
 *
 * a Net::DNS like library for C
 *
 * (c) NLnet Labs, 2005-2006
 *
 * See the file LICENSE for the license
 */

/**
 * \file
 *
 * Contains functions to translate the main structures to their text
 * representation, as well as functions to print them.
 */

#ifndef LDNS_HOST2STR_H
#define LDNS_HOST2STR_H

#include <ldns/common.h>
#include <ldns/error.h>
#include <ldns/rr.h>
#include <ldns/rdata.h>
#include <ldns/packet.h>
#include <ldns/buffer.h>
#include <ldns/resolver.h>
#include <ldns/zone.h>
#include <ctype.h>

#include "ldns/util.h"

#ifdef __cplusplus
extern "C" {
#endif

#define LDNS_APL_IP4            1
#define LDNS_APL_IP6            2
#define LDNS_APL_MASK           0x7f
#define LDNS_APL_NEGATION       0x80

/** 
 * Represent a NULL pointer (instead of a pointer to a ldns_rr as "; (null)" 
 * as opposed to outputting nothing at all in such a case.
 */
/*	Flag Name			Flag Nr.	Has data associated
	---------------------------------------------------------------------*/
#define LDNS_COMMENT_NULLS		(1 <<  0)
/** Show key id with DNSKEY RR's as comment */
#define LDNS_COMMENT_KEY_ID		(1 <<  1)
/** Show if a DNSKEY is a ZSK or KSK as comment */
#define LDNS_COMMENT_KEY_TYPE		(1 <<  2)
/** Show DNSKEY key size as comment */
#define LDNS_COMMENT_KEY_SIZE		(1 <<  3)
/** Provide bubblebabble representation for DS RR's as comment */
#define LDNS_COMMENT_BUBBLEBABBLE	(1 <<  4)
/** Show when a NSEC3 RR has the optout flag set as comment */
#define LDNS_COMMENT_FLAGS		(1 <<  5)
/** Show the unhashed owner and next owner names for NSEC3 RR's as comment */
#define LDNS_COMMENT_NSEC3_CHAIN	(1 <<  6)	/* yes */
/** Print mark up */
#define LDNS_COMMENT_LAYOUT		(1 <<  7)
/** Also comment KEY_ID with RRSIGS **/
#define LDNS_COMMENT_RRSIGS		(1 <<  8)
#define LDNS_FMT_ZEROIZE_RRSIGS		(1 <<  9)
#define LDNS_FMT_PAD_SOA_SERIAL		(1 << 10)
#define LDNS_FMT_RFC3597		(1 << 11)	/* yes */

#define LDNS_FMT_FLAGS_WITH_DATA			    2

/** Show key id, type and size as comment for DNSKEY RR's */
#define LDNS_COMMENT_KEY		(LDNS_COMMENT_KEY_ID  \
					|LDNS_COMMENT_KEY_TYPE\
					|LDNS_COMMENT_KEY_SIZE)

/**
 * Output format specifier
 *
 * Determines how Packets, Resource Records and Resource record data field are
 * formatted when printing or converting to string.
 * Currently it is only used to specify what aspects of a Resource Record are
 * annotated in the comment section of the textual representation the record.
 * This is specified with flags and potential extra data (such as for example
 * a lookup map of hashes to real names for annotation NSEC3 records).
 */
struct ldns_struct_output_format
{
	/** Specification of how RR's should be formatted in text */
	int   flags;
	/** Potential extra data to be used with formatting RR's in text */
	void *data;
};
typedef struct ldns_struct_output_format ldns_output_format;

/**
 * Output format struct with additional data for flags that use them.
 * This struct may not be initialized directly. Use ldns_output_format_init
 * to initialize.
 */
struct ldns_struct_output_format_storage
{	int   flags;
	ldns_rbtree_t* hashmap;    /* for LDNS_COMMENT_NSEC3_CHAIN */
	ldns_rdf*      bitmap;     /* for LDNS_FMT_RFC3597     */
};
typedef struct ldns_struct_output_format_storage ldns_output_format_storage;

/**
 * Standard output format record that disables commenting in the textual 
 * representation of Resource Records completely.
 */
extern const ldns_output_format *ldns_output_format_nocomments;
/**
{'fraction_non_alphanumeric': 0.10962566844919786, 'fraction_numerical': 0.016887137630171686, 'mean_word_length': 3.4474342928660824, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4961531', 'n_tokens_mistral': 2586, 'n_tokens_neox': 2395, 'n_words': 815}