Commit b636e24c authored by Lubos Slovak's avatar Lubos Slovak

public-libs: Renamed symbols from common.h.

+ Visibility in errcode.c, dname.c, descriptor.c, consts.c
parent 379579be
......@@ -72,7 +72,7 @@ static int reduce_dist(hhash_t *t, int idx, int *empty)
/*! \brief Item comparator. */
static int key_cmp(const char *k1, uint16_t k1_len, const char *k2, uint16_t k2_len)
{
int ret = memcmp(k1, k2, MIN(k1_len, k2_len));
int ret = memcmp(k1, k2, KNOT_MIN(k1_len, k2_len));
if (ret != 0) {
return ret;
}
......
......@@ -461,7 +461,7 @@ int log_update_privileges(int uid, int gid)
int log_reconfigure(const struct conf_t *conf, void *data)
{
// Data not used
UNUSED(data);
KNOT_UNUSED(data);
// Use defaults if no 'log' section is configured.
if (EMPTY_LIST(conf->logs)) {
......
......@@ -18,6 +18,7 @@
#include "common/mempattern.h"
#include "common/mempool.h"
/*! \todo Define the _public_ macro also in common/ */
#include "libknot/common.h"
static void mm_nofree(void *p)
......
......@@ -98,7 +98,7 @@ void dt_reader_free_frame(dt_reader_t *reader, Dnstap__Dnstap **frame_ptr)
return;
}
UNUSED(reader);
KNOT_UNUSED(reader);
dnstap__dnstap__free_unpacked(*frame_ptr, NULL);
*frame_ptr = NULL;
......
......@@ -412,7 +412,7 @@ static int conf_process(conf_t *conf)
size_t size = stor_len + zname_len + 9; // /diff.db,\0
char *dest = malloc(size);
if (dest == NULL) {
ERR_ALLOC_FAILED;
KNOT_ERR_ALLOC_FAILED;
zone->ixfr_db = NULL; /* Not enough memory. */
ret = KNOT_ENOMEM; /* Error report. */
continue;
......@@ -877,13 +877,13 @@ size_t conf_udp_threads(const conf_t *conf)
size_t conf_tcp_threads(const conf_t *conf)
{
size_t thrcount = conf_udp_threads(conf);
return MAX(thrcount * 2, CONFIG_XFERS);
return KNOT_MAX(thrcount * 2, CONFIG_XFERS);
}
int conf_bg_threads(const conf_t *conf)
{
if (conf->bg_workers < 1) {
return MIN(dt_optimal_size(), CONFIG_XFERS);
return KNOT_MIN(dt_optimal_size(), CONFIG_XFERS);
}
return conf->bg_workers;
......
......@@ -172,7 +172,7 @@ void estimator_rrset_memsize_wrap(zs_scanner_t *scanner)
int estimator_free_trie_node(value_t *val, void *data)
{
UNUSED(data);
KNOT_UNUSED(data);
list_t *trie_n = (list_t *)(*val);
WALK_LIST_FREE(*trie_n);
free(trie_n);
......
......@@ -591,25 +591,25 @@ exit:
static int cmd_stop(int argc, char *argv[], unsigned flags)
{
UNUSED(argc);
UNUSED(argv);
UNUSED(flags);
KNOT_UNUSED(argc);
KNOT_UNUSED(argv);
KNOT_UNUSED(flags);
return cmd_remote("stop", KNOT_RRTYPE_TXT, 0, NULL);
}
static int cmd_reload(int argc, char *argv[], unsigned flags)
{
UNUSED(argc);
UNUSED(argv);
UNUSED(flags);
KNOT_UNUSED(argc);
KNOT_UNUSED(argv);
KNOT_UNUSED(flags);
return cmd_remote("reload", KNOT_RRTYPE_TXT, 0, NULL);
}
static int cmd_refresh(int argc, char *argv[], unsigned flags)
{
UNUSED(flags);
KNOT_UNUSED(flags);
if (flags & F_FORCE) {
return cmd_remote("retransfer", KNOT_RRTYPE_NS, argc, argv);
......@@ -620,25 +620,25 @@ static int cmd_refresh(int argc, char *argv[], unsigned flags)
static int cmd_flush(int argc, char *argv[], unsigned flags)
{
UNUSED(flags);
KNOT_UNUSED(flags);
return cmd_remote("flush", KNOT_RRTYPE_NS, argc, argv);
}
static int cmd_status(int argc, char *argv[], unsigned flags)
{
UNUSED(argc);
UNUSED(argv);
UNUSED(flags);
KNOT_UNUSED(argc);
KNOT_UNUSED(argv);
KNOT_UNUSED(flags);
return cmd_remote("status", KNOT_RRTYPE_TXT, 0, NULL);
}
static int cmd_zonestatus(int argc, char *argv[], unsigned flags)
{
UNUSED(argc);
UNUSED(argv);
UNUSED(flags);
KNOT_UNUSED(argc);
KNOT_UNUSED(argv);
KNOT_UNUSED(flags);
return cmd_remote("zonestatus", KNOT_RRTYPE_TXT, 0, NULL);
}
......@@ -650,9 +650,9 @@ static int cmd_signzone(int argc, char *argv[], unsigned flags)
static int cmd_checkconf(int argc, char *argv[], unsigned flags)
{
UNUSED(argc);
UNUSED(argv);
UNUSED(flags);
KNOT_UNUSED(argc);
KNOT_UNUSED(argv);
KNOT_UNUSED(flags);
log_info("configuration is valid");
......@@ -690,7 +690,7 @@ static bool fetch_zone(int argc, char *argv[], conf_zone_t *zone)
static int cmd_checkzone(int argc, char *argv[], unsigned flags)
{
UNUSED(flags);
KNOT_UNUSED(flags);
/* Zone checking */
int rc = 0;
......@@ -729,7 +729,7 @@ static int cmd_checkzone(int argc, char *argv[], unsigned flags)
static int cmd_memstats(int argc, char *argv[], unsigned flags)
{
UNUSED(flags);
KNOT_UNUSED(flags);
/* Zone checking */
double total_size = 0;
......
......@@ -173,8 +173,8 @@ static int remote_zone_sign(zone_t *zone)
*/
static int remote_c_stop(server_t *s, remote_cmdargs_t* a)
{
UNUSED(a);
UNUSED(s);
KNOT_UNUSED(a);
KNOT_UNUSED(s);
return KNOT_CTL_STOP;
}
......@@ -186,7 +186,7 @@ static int remote_c_stop(server_t *s, remote_cmdargs_t* a)
*/
static int remote_c_reload(server_t *s, remote_cmdargs_t* a)
{
UNUSED(a);
KNOT_UNUSED(a);
return server_reload(s, conf()->filename);
}
......@@ -198,8 +198,8 @@ static int remote_c_reload(server_t *s, remote_cmdargs_t* a)
*/
static int remote_c_status(server_t *s, remote_cmdargs_t* a)
{
UNUSED(s);
UNUSED(a);
KNOT_UNUSED(s);
KNOT_UNUSED(a);
dbg_server("remote: %s\n", __func__);
return KNOT_EOK;
}
......
......@@ -364,7 +364,7 @@ static int connect_nsec3_nodes(zone_node_t *a, zone_node_t *b,
{
assert(a);
assert(b);
UNUSED(data);
KNOT_UNUSED(data);
assert(a->rrset_count == 1);
......@@ -497,7 +497,7 @@ static bool nsec3_is_empty(zone_node_t *node)
*/
static int nsec3_mark_empty(zone_node_t **node_p, void *data)
{
UNUSED(data);
KNOT_UNUSED(data);
zone_node_t *node = *node_p;
if (!(node->flags & NODE_FLAGS_EMPTY) && nsec3_is_empty(node)) {
......@@ -546,7 +546,7 @@ static void mark_empty_nodes_tmp(const zone_contents_t *zone)
*/
static int nsec3_reset(zone_node_t **node_p, void *data)
{
UNUSED(data);
KNOT_UNUSED(data);
zone_node_t *node = *node_p;
if (node->flags & NODE_FLAGS_EMPTY) {
......
......@@ -200,14 +200,14 @@ int knot_load_zone_keys(const char *keydir_name, const knot_dname_t *zone_name,
size_t path_len = strlen(keydir_name) + 1 + strlen(entry->d_name);
char *path = malloc((path_len + 1) * sizeof(char));
if (!path) {
ERR_ALLOC_FAILED;
KNOT_ERR_ALLOC_FAILED;
closedir(keydir);
return KNOT_ENOMEM;
}
int written = snprintf(path, path_len + 1, "%s/%s",
keydir_name, entry->d_name);
UNUSED(written);
KNOT_UNUSED(written);
assert(written == path_len);
knot_key_params_t params = { 0 };
......@@ -340,7 +340,7 @@ uint32_t knot_get_next_zone_key_event(const knot_zone_keys_t *keys)
node_t *node = NULL;
WALK_LIST(node, keys->list) {
knot_zone_key_t *key = (knot_zone_key_t *)node;
result = MIN(result, key->next_event);
result = KNOT_MIN(result, key->next_event);
}
return result;
......
......@@ -996,7 +996,7 @@ static int add_rr_type_to_list(const knot_rrset_t *rr, list_t *l)
type_node_t *n = malloc(sizeof(type_node_t));
if (n == NULL) {
ERR_ALLOC_FAILED;
KNOT_ERR_ALLOC_FAILED;
return KNOT_ENOMEM;
}
n->type = rr->type;
......@@ -1031,7 +1031,7 @@ static int rr_already_signed(const knot_rrset_t *rrset, hattrie_t *t,
// Create new info struct
signed_info_t *info = malloc(sizeof(signed_info_t));
if (info == NULL) {
ERR_ALLOC_FAILED;
KNOT_ERR_ALLOC_FAILED;
return KNOT_ENOMEM;
}
memset(info, 0, sizeof(signed_info_t));
......@@ -1044,7 +1044,7 @@ static int rr_already_signed(const knot_rrset_t *rrset, hattrie_t *t,
// Create new list to insert as a value
info->type_list = malloc(sizeof(list_t));
if (info->type_list == NULL) {
ERR_ALLOC_FAILED;
KNOT_ERR_ALLOC_FAILED;
free(info->dname);
free(info);
return KNOT_ENOMEM;
......@@ -1154,7 +1154,7 @@ static int sign_changeset_wrap(knot_rrset_t *chg_rrset, changeset_signing_data_t
*/
static int free_helper_trie_node(value_t *val, void *d)
{
UNUSED(d);
KNOT_UNUSED(d);
signed_info_t *info = (signed_info_t *)*val;
if (info->type_list && !EMPTY_LIST(*(info->type_list))) {
WALK_LIST_FREE(*(info->type_list));
......@@ -1218,7 +1218,7 @@ int knot_zone_sign(const zone_contents_t *zone,
}
// renew the signatures a little earlier
uint32_t expiration = MIN(normal_tree_expiration, nsec3_tree_expiration);
uint32_t expiration = KNOT_MIN(normal_tree_expiration, nsec3_tree_expiration);
// DNSKEY updates
uint32_t dnskey_update = knot_get_next_zone_key_event(zone_keys);
......
......@@ -317,8 +317,8 @@ static int prepare_answer(const knot_pkt_t *query, knot_pkt_t *resp, knot_layer_
if (knot_pkt_has_edns(query)) {
uint16_t client = knot_edns_get_payload(query->opt_rr);
uint16_t server = conf()->max_udp_payload;
uint16_t transfer = MIN(client, server);
resp->max_size = MAX(resp->max_size, transfer);
uint16_t transfer = KNOT_MIN(client, server);
resp->max_size = KNOT_MAX(resp->max_size, transfer);
}
} else {
resp->max_size = KNOT_WIRE_MAX_PKTSIZE;
......
......@@ -548,7 +548,7 @@ int updates_execute(zone_t *zone)
"DDNS, processing %zu updates", update_count);
ret = process_requests(zone, &updates);
}
UNUSED(ret); /* Don't care about the Knot code, RCODEs are set. */
KNOT_UNUSED(ret); /* Don't care about the Knot code, RCODEs are set. */
/* Send responses. */
send_update_responses(zone, &updates);
......
......@@ -68,7 +68,7 @@ static inline int tcp_throttle() {
/*! \brief Sweep TCP connection. */
static enum fdset_sweep_state tcp_sweep(fdset_t *set, int i, void *data)
{
UNUSED(data);
KNOT_UNUSED(data);
assert(set && i < set->n && i >= 0);
int fd = set->pfd[i].fd;
......
......@@ -469,8 +469,8 @@ static int track_ifaces(ifacelist_t *ifaces, fd_set *set, int *maxfd, int *minfd
iface_t *iface = NULL;
WALK_LIST(iface, ifaces->l) {
int fd = iface->fd[IO_UDP];
*maxfd = MAX(fd, *maxfd);
*minfd = MIN(fd, *minfd);
*maxfd = KNOT_MAX(fd, *maxfd);
*minfd = KNOT_MIN(fd, *minfd);
FD_SET(fd, set);
}
......
......@@ -47,7 +47,7 @@ static void rrs_list_clear(list_t *l, knot_mm_ctx_t *mm)
/*! \brief Frees additional data from single node */
static int free_additional(zone_node_t **node, void *data)
{
UNUSED(data);
KNOT_UNUSED(data);
if ((*node)->flags & NODE_FLAGS_NONAUTH) {
// non-auth nodes have no additionals.
return KNOT_EOK;
......@@ -91,7 +91,7 @@ static void delete_empty_node(zone_tree_t *tree, zone_node_t *node)
// Delete node
zone_node_t *removed_node = NULL;
zone_tree_remove(tree, node->owner, &removed_node);
UNUSED(removed_node);
KNOT_UNUSED(removed_node);
node_free(&node, NULL);
}
}
......
......@@ -29,7 +29,7 @@ static int add_rr_to_zone(zone_contents_t *z, const knot_rrset_t *rrset)
{
zone_node_t *n = NULL;
int ret = zone_contents_add_rr(z, rrset, &n);
UNUSED(n);
KNOT_UNUSED(n);
return ret;
}
......@@ -152,7 +152,7 @@ changeset_t *changeset_new(const knot_dname_t *apex)
{
changeset_t *ret = malloc(sizeof(changeset_t));
if (ret == NULL) {
ERR_ALLOC_FAILED;
KNOT_ERR_ALLOC_FAILED;
return NULL;
}
......
......@@ -103,7 +103,7 @@ static int zone_contents_check_node(
static int zone_contents_destroy_node_rrsets_from_tree(
zone_node_t **tnode, void *data)
{
UNUSED(data);
KNOT_UNUSED(data);
assert(tnode != NULL);
if (*tnode != NULL) {
node_free_rrsets(*tnode, NULL);
......@@ -153,7 +153,7 @@ static int discover_additionals(struct rr_data *rr_data,
}
rr_data->additional = malloc(rdcount * sizeof(zone_node_t *));
if (rr_data->additional == NULL) {
ERR_ALLOC_FAILED;
KNOT_ERR_ALLOC_FAILED;
return KNOT_ENOMEM;
}
......@@ -1251,7 +1251,7 @@ int zone_contents_shallow_copy(const zone_contents_t *from, zone_contents_t **to
zone_contents_t *contents = calloc(1, sizeof(zone_contents_t));
if (contents == NULL) {
ERR_ALLOC_FAILED;
KNOT_ERR_ALLOC_FAILED;
return KNOT_ENOMEM;
}
......
......@@ -401,7 +401,7 @@ static int event_update(zone_t *zone)
/* Process update list - forward if zone has master, or execute. */
int ret = updates_execute(zone);
UNUSED(ret); /* Don't care about the Knot code, RCODEs are set. */
KNOT_UNUSED(ret); /* Don't care about the Knot code, RCODEs are set. */
/* Trim extra heap. */
mem_trim();
......@@ -625,7 +625,7 @@ static void replan_flush(zone_t *zone, const zone_t *old_zone)
}
// Pick time to schedule: either reuse or schedule sooner than old event.
const time_t schedule_at = MIN(time(NULL) + zone->conf->dbsync_timeout, flush_time);
const time_t schedule_at = KNOT_MIN(time(NULL) + zone->conf->dbsync_timeout, flush_time);
zone_events_schedule_at(zone, ZONE_EVENT_FLUSH, schedule_at);
}
......
......@@ -88,7 +88,7 @@ zone_node_t *node_new(const knot_dname_t *owner, knot_mm_ctx_t *mm)
{
zone_node_t *ret = knot_mm_alloc(mm, sizeof(zone_node_t));
if (ret == NULL) {
ERR_ALLOC_FAILED;
KNOT_ERR_ALLOC_FAILED;
return NULL;
}
memset(ret, 0, sizeof(*ret));
......
......@@ -531,7 +531,7 @@ static int rdata_nsec_to_type_array(const knot_rdataset_t *rrs, uint16_t type,
uint8_t *bitmap =
malloc(sizeof(uint8_t) * (bitmap_size));
if (bitmap == NULL) {
ERR_ALLOC_FAILED;
KNOT_ERR_ALLOC_FAILED;
free(*array);
return KNOT_ENOMEM;
}
......@@ -548,7 +548,7 @@ static int rdata_nsec_to_type_array(const knot_rdataset_t *rrs, uint16_t type,
sizeof(uint16_t) *
*count);
if (tmp == NULL) {
ERR_ALLOC_FAILED;
KNOT_ERR_ALLOC_FAILED;
free(bitmap);
free(*array);
return KNOT_ENOMEM;
......
......@@ -138,7 +138,7 @@ int zone_dump_text(zone_contents_t *zone, const struct sockaddr_storage *from, F
// Allocate auxiliary buffer for dumping operations.
char *buf = malloc(DUMP_BUF_LEN);
if (buf == NULL) {
ERR_ALLOC_FAILED;
KNOT_ERR_ALLOC_FAILED;
return KNOT_ENOMEM;
}
......
......@@ -314,7 +314,7 @@ void zone_tree_free(zone_tree_t **tree)
static int zone_tree_free_node(zone_node_t **node, void *data)
{
UNUSED(data);
KNOT_UNUSED(data);
if (node) {
node_free(node, NULL);
}
......
......@@ -56,7 +56,7 @@ zone_t* zone_new(conf_zone_t *conf)
zone_t *zone = malloc(sizeof(zone_t));
if (zone == NULL) {
ERR_ALLOC_FAILED;
KNOT_ERR_ALLOC_FAILED;
return NULL;
}
memset(zone, 0, sizeof(zone_t));
......@@ -65,7 +65,7 @@ zone_t* zone_new(conf_zone_t *conf)
knot_dname_to_lower(zone->name);
if (zone->name == NULL) {
free(zone);
ERR_ALLOC_FAILED;
KNOT_ERR_ALLOC_FAILED;
return NULL;
}
......
......@@ -119,7 +119,7 @@ int knot_zonedb_build_index(knot_zonedb_t *db)
knot_zonedb_iter_begin(db, &it);
while (!knot_zonedb_iter_finished(&it)) {
zone_t *zone = knot_zonedb_iter_val(&it);
db->maxlabels = MAX(db->maxlabels, knot_dname_labels(zone->name, NULL));
db->maxlabels = KNOT_MAX(db->maxlabels, knot_dname_labels(zone->name, NULL));
knot_zonedb_iter_next(&it);
}
......
......@@ -209,7 +209,7 @@ int zonefile_open(zloader_t *loader, const char *source, const char *origin,
/* Create context. */
zcreator_t *zc = malloc(sizeof(zcreator_t));
if (zc == NULL) {
ERR_ALLOC_FAILED;
KNOT_ERR_ALLOC_FAILED;
return KNOT_ENOMEM;
}
memset(zc, 0, sizeof(zcreator_t));
......@@ -339,7 +339,7 @@ static int zones_open_free_filename(const char *old_name, char **new_name)
strlcat(*new_name, suffix, max_size);
mode_t old_mode = umask(077);
int fd = mkstemp(*new_name);
UNUSED(umask(old_mode));
KNOT_UNUSED(umask(old_mode));
if (fd < 0) {
free(*new_name);
*new_name = NULL;
......
......@@ -34,25 +34,21 @@
#define _public_ __attribute__((visibility("default")))
#define _hidden_ __attribute__((visibility("hidden")))
#ifndef UINT_DEFINED
#ifndef KNOT_UINT_DEFINED
typedef unsigned int uint; /*!< \brief Unsigned. */
#define UINT_DEFINED
#endif
#ifndef PATH_MAX
#define PATH_MAX 4096
#define KNOT_UINT_DEFINED
#endif
/*! \brief Eliminate compiler warning with unused parameters. */
#define UNUSED(param) (void)(param)
#define KNOT_UNUSED(param) (void)(param)
#ifndef MIN
#ifndef KNOT_MIN
/*! \brief Type-safe minimum macro. */
#define MIN(a, b) \
#define KNOT_MIN(a, b) \
({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
/*! \brief Type-safe maximum macro. */
#define MAX(a, b) \
#define KNOT_MAX(a, b) \
({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a > _b ? _a : _b; })
#endif
......@@ -67,29 +63,10 @@ typedef unsigned int uint; /*!< \brief Unsigned. */
#endif
/*! \todo Refactor theese. We should have an allocator function handling this.*/
#ifndef ERR_ALLOC_FAILED
#define ERR_ALLOC_FAILED fprintf(stderr, \
#ifndef KNOT_ERR_ALLOC_FAILED
#define KNOT_ERR_ALLOC_FAILED fprintf(stderr, \
"Allocation failed at %s:%d (%s ver.%s)\n", \
__FILE__, __LINE__, KNOT_NAME, KNOT_VER)
#endif
#ifndef CHECK_ALLOC_LOG
#define CHECK_ALLOC_LOG(var, ret) \
do { \
if ((var) == NULL) { \
ERR_ALLOC_FAILED; \
return (ret); \
} \
} while (0)
#endif
#ifndef CHECK_ALLOC
#define CHECK_ALLOC(var, ret) \
do { \
if ((var) == NULL) { \
return (ret); \
} \
} while (0)
#endif
/*! @} */
......@@ -14,7 +14,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <libknot/consts.h>
#include "libknot/consts.h"
#include "libknot/common.h"
knot_lookup_table_t knot_opcode_names[] = {
{ KNOT_OPCODE_QUERY, "QUERY" },
......@@ -69,8 +70,8 @@ knot_lookup_table_t knot_tsig_alg_dnames_str[] = {
};
knot_lookup_table_t knot_tsig_alg_dnames[] = {
{ KNOT_TSIG_ALG_GSS_TSIG, "\x08" "gss-tsig" },
{ KNOT_TSIG_ALG_HMAC_MD5, "\x08" "hmac-md5" "\x07" "sig-alg" "\x03" "reg" "\x03" "int" },
{ KNOT_TSIG_ALG_GSS_TSIG, "\x08" "gss-tsig" },
{ KNOT_TSIG_ALG_HMAC_MD5, "\x08" "hmac-md5" "\x07" "sig-alg" "\x03" "reg" "\x03" "int" },
{ KNOT_TSIG_ALG_HMAC_SHA1, "\x09" "hmac-sha1" },
{ KNOT_TSIG_ALG_HMAC_SHA224, "\x0B" "hmac-sha224" },
{ KNOT_TSIG_ALG_HMAC_SHA256, "\x0B" "hmac-sha256" },
......@@ -94,6 +95,7 @@ knot_lookup_table_t knot_dnssec_alg_names[] = {
{ 0, NULL }
};
_public_
size_t knot_tsig_digest_length(const uint8_t algorithm)
{
switch (algorithm) {
......@@ -116,6 +118,7 @@ size_t knot_tsig_digest_length(const uint8_t algorithm)
}
}
_public_
bool knot_dnssec_algorithm_is_zonesign(uint8_t algorithm, bool nsec3_enabled)
{
switch (algorithm) {
......
......@@ -19,6 +19,7 @@
#include <strings.h> // strcasecmp
#include "libknot/descriptor.h"
#include "libknot/common.h"
/*!
* \brief Table with DNS classes.
......@@ -153,6 +154,7 @@ static const rdata_descriptor_t obsolete_rdata_descriptors[] = {
KNOT_RDATA_WF_END }, "NXT" },
};
_public_
const rdata_descriptor_t *knot_get_rdata_descriptor(const uint16_t type)
{
if (type <= KNOT_RRTYPE_ANY &&
......@@ -163,6 +165,7 @@ const rdata_descriptor_t *knot_get_rdata_descriptor(const uint16_t type)
}
}
_public_
const rdata_descriptor_t *knot_get_obsolete_rdata_descriptor(const uint16_t type)
{
if (type <= KNOT_RRTYPE_NXT &&
......@@ -173,6 +176,7 @@ const rdata_descriptor_t *knot_get_obsolete_rdata_descriptor(const uint16_t type
}
}
_public_
int knot_rrtype_to_string(const uint16_t rrtype,
char *out,
const size_t out_len)
......@@ -198,6 +202,7 @@ int knot_rrtype_to_string(const uint16_t rrtype,
}
}
_public_
int knot_rrtype_from_string(const char *name, uint16_t *num)
{
if (name == NULL || num == NULL) {
......@@ -234,6 +239,7 @@ int knot_rrtype_from_string(const char *name, uint16_t *num)
return 0;
}
_public_
int knot_rrclass_to_string(const uint16_t rrclass,
char *out,
const size_t out_len)
......@@ -257,6 +263,7 @@ int knot_rrclass_to_string(const uint16_t rrclass,
}
}
_public_
int knot_rrclass_from_string(const char *name, uint16_t *num)
{
if (name == NULL || num == NULL) {
......@@ -293,6 +300,7 @@ int knot_rrclass_from_string(const char *name, uint16_t *num)
return 0;
}
_public_
int knot_descriptor_item_is_dname(const int item)
{
return item == KNOT_RDATA_WF_FIXED_DNAME ||
......@@ -300,6 +308,7 @@ int knot_descriptor_item_is_dname(const int item)
item == KNOT_RDATA_WF_DECOMPRESSIBLE_DNAME;
}
_public_
int knot_descriptor_item_is_fixed(const int item)
{
if (item > 0) {
......@@ -309,6 +318,7 @@ int knot_descriptor_item_is_fixed(const int item)
}
}
_public_
int knot_descriptor_item_is_remainder(const int item)
{
if (item == KNOT_RDATA_WF_REMAINDER) {
......@@ -318,6 +328,7 @@ int knot_descriptor_item_is_remainder(const int item)
}
}
_public_
int knot_rrtype_is_metatype(const uint16_t type)
{
return type == KNOT_RRTYPE_SIG ||
......@@ -329,6 +340,7 @@ int knot_rrtype_is_metatype(const uint16_t type)
type == KNOT_RRTYPE_ANY;
}
_public_
int knot_rrtype_is_ddns_forbidden(const uint16_t type)
{
return type == KNOT_RRTYPE_RRSIG ||
......@@ -336,6 +348,7 @@ int knot_rrtype_is_ddns_forbidden(const uint16_t type)
type == KNOT_RRTYPE_NSEC3;
}
_public_
int knot_rrtype_additional_needed(const uint16_t type)
{
return type == KNOT_RRTYPE_NS ||
......
......@@ -40,7 +40,7 @@ static int knot_label_is_equal(const uint8_t *lb1, const uint8_t *lb2)
/*----------------------------------------------------------------------------*/
/* API functions */
/*----------------------------------------------------------------------------*/
_public_
int knot_dname_wire_check(const uint8_t *name, const uint8_t *endp,
const uint8_t *pkt)
{
......@@ -100,7 +100,7 @@ int knot_dname_wire_check(const uint8_t *name, const uint8_t *endp,
}
/*----------------------------------------------------------------------------*/
_public_
knot_dname_t *knot_dname_parse(const uint8_t *pkt, size_t *pos, size_t maxpos,
knot_mm_ctx_t *mm)
{
......@@ -136,7 +136,7 @@ knot_dname_t *knot_dname_parse(const uint8_t *pkt, size_t *pos, size_t maxpos,
}
/*----------------------------------------------------------------------------*/
_public_
knot_dname_t *knot_dname_copy(const knot_dname_t *name, knot_mm_ctx_t *mm)
{
if (name == NULL)
......@@ -146,7 +146,7 @@ knot_dname_t *knot_dname_copy(const knot_dname_t *name, knot_mm_ctx_t *mm)
}
<