forked from radsecproxy/radsecproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdns.h
66 lines (56 loc) · 1.53 KB
/
dns.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* Copyright (c) 2021, SWITCH */
/* See LICENSE for licensing information. */
#ifndef _DNS_H
#define _DNS_H
#include <stdlib.h>
#include <arpa/nameser.h>
/* maximum character string length in a DNS response, including null-terminator */
#define MAXCHARSTRLEN 256
struct naptr_record {
uint32_t ttl;
uint16_t order;
uint16_t preference;
char flags[MAXCHARSTRLEN];
char services[MAXCHARSTRLEN];
char regexp[MAXCHARSTRLEN];
char replacement[NS_MAXDNAME];
};
struct srv_record {
uint32_t ttl;
uint16_t priority;
uint16_t weight;
uint16_t port;
char host[NS_MAXDNAME];
/* TODO add A and AAAA records from additional section */
};
/**
* query DNS NAPTR record for name
* caller must free memory by calling freenaptrresponse
*
* @param name the name to query
* @param timeout query timeout
* @return null terminated array of struct naptr_record*
*/
struct naptr_record **querynaptr(const char *name, int timeout);
/**
* free memory allocated by querynaptr
*
* @param response the response to free
*/
void freenaptrresponse(struct naptr_record **response);
/**
* query a DNS SRV record for name.
* caller must free memory by calling freesrvresponse.
*
* @param name the name to query
* @param timeout query timeout
* @return null terminated array of struct srv_record*
*/
struct srv_record **querysrv(const char *name, int timeout);
/**
* free memory allocated by querysrv
*
* @param response the response to free
*/
void freesrvresponse(struct srv_record **response);
#endif /*_DNS_H*/