Skip to content

Commit

Permalink
tidy up last bits
Browse files Browse the repository at this point in the history
  • Loading branch information
k0ekk0ek committed Dec 19, 2023
1 parent afc4218 commit 1dfddc9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 39 deletions.
41 changes: 11 additions & 30 deletions include/zone.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,10 @@ struct zone_name_buffer {
uint8_t octets[ ZONE_NAME_SIZE + ZONE_PADDING_SIZE ];
};

//
// FIXME: explain why we need padding for NSEC
// include the calculation etc!
//
// FIXME: explain need for NSEC padding
typedef struct zone_rdata_buffer zone_rdata_buffer_t;
struct zone_rdata_buffer {
//size_t length; /**< Length of RDATA stored in buffer */
// >> we could extend the octets table by another 4k so that we can
// fit a bitmask for all svcparams there too!!!! (see if there are
// duplicates)
uint8_t octets[ ZONE_RDATA_SIZE + 4096 /* nsec padding */ ];
uint8_t octets[ ZONE_RDATA_SIZE + 4096 /* NSEC padding */ ];
};

// @private
Expand Down Expand Up @@ -321,10 +314,6 @@ struct zone_name {
// invoked for each resource record (host order). header (owner, type, class and ttl)
// fields are passed individually for convenience. rdata fields can be visited
// individually by means of the iterator
//
// update this comment to state that every application that must handle dns data
// must simply know about the wire format.
//
typedef int32_t(*zone_accept_t)(
zone_parser_t *,
const zone_name_t *, // owner (length + octets)
Expand All @@ -346,8 +335,7 @@ typedef struct {
bool no_includes;
/** Enable 1h2m3s notations for TTLS. */
bool pretty_ttls;
// FIXME: make origin a pointer to wire presentation and offer a parse
// function instead.
// FIXME: require origin to be in wire format? (#115)
const char *origin;
uint32_t default_ttl;
uint16_t default_class;
Expand Down Expand Up @@ -402,13 +390,6 @@ struct zone_parser {
zone_file_t *file, first;
};


//
// FIXME: reorder the error codes so that QUOTED, CONTIGUOUS, etc
// can be checked using binary AND
//


/**
* @defgroup return_codes Return codes
*
Expand All @@ -417,21 +398,21 @@ struct zone_parser {
/** Success */
#define ZONE_SUCCESS (0)
/** Syntax error */
#define ZONE_SYNTAX_ERROR (-1)
#define ZONE_SYNTAX_ERROR (-256) // (-1 << 8)
/** Semantic error */
#define ZONE_SEMANTIC_ERROR (-2)
#define ZONE_SEMANTIC_ERROR (-512) // (-2 << 8)
/** Operation failed due to lack of memory */
#define ZONE_OUT_OF_MEMORY (-3)
#define ZONE_OUT_OF_MEMORY (-768) // (-3 << 8)
/** Bad parameter value */
#define ZONE_BAD_PARAMETER (-4)
#define ZONE_BAD_PARAMETER (-1024) // (-4 << 8)
/** Error reading zone file */
#define ZONE_READ_ERROR (-5)
#define ZONE_READ_ERROR (-1280) // (-5 << 8)
/** Control directive or support for record type is not implemented */
#define ZONE_NOT_IMPLEMENTED (-6)
#define ZONE_NOT_IMPLEMENTED (-1536) // (-6 << 8)
/** Specified file does not exist */
#define ZONE_NOT_A_FILE (-6)
#define ZONE_NOT_A_FILE (-1792) // (-7 << 8)
/** Access to specified file is not allowed */
#define ZONE_NOT_PERMITTED (-7)
#define ZONE_NOT_PERMITTED (-2048) // (-8 << 8)
/** @} */

/**
Expand Down
7 changes: 1 addition & 6 deletions src/generic/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ static really_inline int32_t parse_owner(
size_t length = 0;
uint8_t *octets = parser->file->owner.octets;

//
// now I remember, we should parse to the current owner buffer... right?!?!
// there was something special going on with that stuff anyway...
//

if (likely(is_contiguous(token))) {
// a freestanding "@" denotes the origin
if (token->length == 1 && token->data[0] == '@')
Expand Down Expand Up @@ -359,7 +354,7 @@ static inline int32_t parse(parser_t *parser)
code = parse_rr(parser, &token);
} else if (is_end_of_file(&token)) {
if (parser->file->end_of_file == ZONE_NO_MORE_DATA)
break; // << FIXME: this is not correct. we must close the file
break;
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/generic/wks.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,6 @@ static really_inline int32_t scan_service(
return -1;
}
} else {
//
// FIXME: just call scan_int16 here!!!!
//
int32_t number = digit;
size_t index = 1;

Expand Down

0 comments on commit 1dfddc9

Please sign in to comment.