Skip to content
Snippets Groups Projects
Verified Commit 0555828e authored by Vladimír Čunát's avatar Vladimír Čunát Committed by Tomas Krizek
Browse files

adjust RR-dumping style a little

The former "default" dumping style isn't really used anywhere in Knot.
The only visible difference is that RRSIGs are now logged *without*
replacing their TTLs by the original non-decremented TTL values.
That can avoid some confusion when reading debug logs.
(Those original TTLs are still shown a bit further on each line.)
parent b38b0805
No related branches found
No related tags found
No related merge requests found
......@@ -11,7 +11,7 @@ struct timeval {
};
typedef struct knot_dump_style knot_dump_style_t;
extern const knot_dump_style_t KNOT_DUMP_STYLE_DEFAULT;
extern const knot_dump_style_t KR_DUMP_STYLE_DEFAULT;
struct kr_cdb_api {};
struct lru {};
typedef enum {KNOT_ANSWER, KNOT_AUTHORITY, KNOT_ADDITIONAL} knot_section_t;
......
......@@ -11,7 +11,7 @@ struct timeval {
};
typedef struct knot_dump_style knot_dump_style_t;
extern const knot_dump_style_t KNOT_DUMP_STYLE_DEFAULT;
extern const knot_dump_style_t KR_DUMP_STYLE_DEFAULT;
struct kr_cdb_api {};
struct lru {};
typedef enum {KNOT_ANSWER, KNOT_AUTHORITY, KNOT_ADDITIONAL} knot_section_t;
......
......@@ -64,7 +64,7 @@ EOF
printf "
typedef struct knot_dump_style knot_dump_style_t;
extern const knot_dump_style_t KNOT_DUMP_STYLE_DEFAULT;
extern const knot_dump_style_t KR_DUMP_STYLE_DEFAULT;
struct kr_cdb_api {};
struct lru {};
"
......
......@@ -395,7 +395,7 @@ ffi.metatype( knot_rrset_t, {
if rr:rdcount() > 0 then
local ret
if i ~= nil then
ret = knot.knot_rrset_txt_dump_data(rr, i, rrset_buf, rrset_buflen, knot.KNOT_DUMP_STYLE_DEFAULT)
ret = knot.knot_rrset_txt_dump_data(rr, i, rrset_buf, rrset_buflen, C.KR_DUMP_STYLE_DEFAULT)
else
ret = -1
end
......@@ -412,7 +412,7 @@ ffi.metatype( knot_rrset_t, {
local size = ffi.new('size_t[1]', { bufsize }) -- one size_t = bufsize
local ret = knot.knot_rrset_txt_dump(rr, dump, size,
style or knot.KNOT_DUMP_STYLE_DEFAULT)
style or C.KR_DUMP_STYLE_DEFAULT)
local result = nil
if ret >= 0 then
result = ffi.string(dump[0], ret)
......@@ -428,7 +428,7 @@ ffi.metatype( knot_rrset_t, {
ffi.gc(dump, C.free)
local ret = knot.knot_rrset_txt_dump_data(rr, i, dump, 1024,
knot.KNOT_DUMP_STYLE_DEFAULT)
C.KR_DUMP_STYLE_DEFAULT)
if ret >= 0 then
local out = {}
out.owner = dname2str(rr:owner())
......
......@@ -1010,6 +1010,10 @@ char *kr_pkt_text(const knot_pkt_t *pkt)
return result;
}
const knot_dump_style_t KR_DUMP_STYLE_DEFAULT = { /* almost all = false, */
.show_ttl = true,
};
char *kr_rrset_text(const knot_rrset_t *rr)
{
if (!rr) {
......@@ -1019,7 +1023,7 @@ char *kr_rrset_text(const knot_rrset_t *rr)
/* Note: knot_rrset_txt_dump will double the size until the rrset fits */
size_t bufsize = 128;
char *buf = malloc(bufsize);
int ret = knot_rrset_txt_dump(rr, &buf, &bufsize, &KNOT_DUMP_STYLE_DEFAULT);
int ret = knot_rrset_txt_dump(rr, &buf, &bufsize, &KR_DUMP_STYLE_DEFAULT);
if (ret < 0) {
free(buf);
return NULL;
......
......@@ -401,6 +401,11 @@ int kr_ranked_rrarray_set_wire(ranked_rr_array_t *array, bool to_wire,
uint32_t qry_uid, bool check_dups,
bool (*extraCheck)(const ranked_rr_array_entry_t *));
/** Style used by the kr_*_text() functions. */
KR_EXPORT extern
const knot_dump_style_t KR_DUMP_STYLE_DEFAULT;
/**
* @return Newly allocated string representation of packet.
* Caller has to free() returned string.
......
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