diff options
Diffstat (limited to 'src/libs6dns')
-rw-r--r-- | src/libs6dns/deps-lib/s6dns | 1 | ||||
-rw-r--r-- | src/libs6dns/s6dns_message_parse_question.c | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/libs6dns/deps-lib/s6dns b/src/libs6dns/deps-lib/s6dns index 95c2bf5..e9646fa 100644 --- a/src/libs6dns/deps-lib/s6dns +++ b/src/libs6dns/deps-lib/s6dns @@ -54,6 +54,7 @@ s6dns_message_parse.o s6dns_message_parse_getrr.o s6dns_message_parse_init.o s6dns_message_parse_next.o +s6dns_message_parse_question.o s6dns_message_parse_skipqd.o s6dns_rci_free.o s6dns_rci_here.o diff --git a/src/libs6dns/s6dns_message_parse_question.c b/src/libs6dns/s6dns_message_parse_question.c new file mode 100644 index 0000000..e2b639f --- /dev/null +++ b/src/libs6dns/s6dns_message_parse_question.c @@ -0,0 +1,20 @@ +/* ISC license. */ + +#include <errno.h> + +#include <skalibs/posixishard.h> +#include <skalibs/uint16.h> + +#include <s6-dns/s6dns-constants.h> +#include <s6-dns/s6dns-message.h> + +int s6dns_message_parse_question (s6dns_domain_t *name, uint16_t *qtype, char const *packet, unsigned int packetlen, unsigned int *pos) +{ + uint16_t qclass ; + if (!s6dns_message_get_domain(name, packet, packetlen, pos)) return 0 ; + if (*pos + 4 > packetlen) return (errno = EPROTO, 0) ; + uint16_unpack_big(packet + *pos, qtype) ; *pos += 2 ; + uint16_unpack_big(packet + *pos, &qclass) ; *pos += 2 ; + if (qclass != S6DNS_C_IN) return (errno = ENOTSUP, 0) ; + return 1 ; +} |