From 416ef5e2bf59bb2e45066a1d5d91ac677c0f48e5 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Wed, 10 Dec 2014 03:05:47 +0000 Subject: Initial commit --- src/libs6dns/s6dns_message_get_soa.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/libs6dns/s6dns_message_get_soa.c (limited to 'src/libs6dns/s6dns_message_get_soa.c') diff --git a/src/libs6dns/s6dns_message_get_soa.c b/src/libs6dns/s6dns_message_get_soa.c new file mode 100644 index 0000000..c766231 --- /dev/null +++ b/src/libs6dns/s6dns_message_get_soa.c @@ -0,0 +1,19 @@ +/* ISC license. */ + +#include +#include +#include +#include + +int s6dns_message_get_soa (s6dns_message_rr_soa_t *soa, char const *packet, unsigned int packetlen, unsigned int *pos) +{ + if (!s6dns_message_get_domain(&soa->mname, packet, packetlen, pos)) return 0 ; + if (!s6dns_message_get_domain(&soa->rname, packet, packetlen, pos)) return 0 ; + if (*pos + 20 > packetlen) return (errno = EPROTO, 0) ; + uint32_unpack_big(packet + *pos, &soa->serial) ; *pos += 4 ; + uint32_unpack_big(packet + *pos, &soa->refresh) ; *pos += 4 ; + uint32_unpack_big(packet + *pos, &soa->retry) ; *pos += 4 ; + uint32_unpack_big(packet + *pos, &soa->expire) ; *pos += 4 ; + uint32_unpack_big(packet + *pos, &soa->minimum) ; *pos += 4 ; + return 1 ; +} -- cgit v1.3.1