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

#include <errno.h>

#include <skalibs/posixishard.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 ;
}