summaryrefslogtreecommitdiff
path: root/src/libs6dns/s6dns_message_parse_init.c
blob: fe38e685b5a9bcaa2bf0d579a16ebd8bd6a4c294 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* ISC license. */

#include <errno.h>
#include <skalibs/error.h>
#include <s6-dns/s6dns-message.h>

int s6dns_message_parse_init (s6dns_message_header_t *h, s6dns_message_counts_t *counts, char const *packet, unsigned int packetlen, unsigned int *pos)
{
  if (packetlen < 12) return (errno = EPROTO, 0) ;
  s6dns_message_header_unpack(packet, h) ;
  *counts = h->counts ;
  *pos = 12 ;
  return 1 ;
}