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_srv.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/libs6dns/s6dns_message_get_srv.c (limited to 'src/libs6dns/s6dns_message_get_srv.c') diff --git a/src/libs6dns/s6dns_message_get_srv.c b/src/libs6dns/s6dns_message_get_srv.c new file mode 100644 index 0000000..13ecf13 --- /dev/null +++ b/src/libs6dns/s6dns_message_get_srv.c @@ -0,0 +1,15 @@ +/* ISC license. */ + +#include +#include +#include +#include + +int s6dns_message_get_srv (s6dns_message_rr_srv_t *srv, char const *packet, unsigned int packetlen, unsigned int *pos) +{ + if (*pos + 7 > packetlen) return (errno = EPROTO, 0) ; + uint16_unpack_big(packet + *pos, &srv->priority) ; *pos += 2 ; + uint16_unpack_big(packet + *pos, &srv->weight) ; *pos += 2 ; + uint16_unpack_big(packet + *pos, &srv->port) ; *pos += 2 ; + return s6dns_message_get_domain(&srv->target, packet, packetlen, pos) ; +} -- cgit v1.2.3