File: dns-util.h

package info (click to toggle)
dovecot 1:2.2.13-12~deb8u4
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 38,792 kB
  • sloc: ansic: 341,472; sh: 16,920; makefile: 5,393; cpp: 1,474; perl: 265; xml: 44; python: 34; pascal: 27
file content (36 lines) | stat: -rw-r--r-- 805 bytes parent folder | download | duplicates (9)
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
#ifndef DNS_UTIL_H
#define DNS_UTIL_H 1

static inline char
dns_tolower(char c)
{
	if (c >= 'A' && c <= 'Z')
		c+='a'-'A';
	return c;
}

/**
 * Will compare names in accordance with RFC4343
 */
int dns_compare(const char *a, const char *b) ATTR_PURE;
int dns_ncompare(const char *a, const char *b, size_t n) ATTR_PURE;

/**
 * Same as above but done by labels from right to left
 *
 * www.example.org and www.example.net would be compared as
 * org = net (return first difference)
 * example = example
 * www = www
 */
int dns_compare_labels(const char *a, const char *b) ATTR_PURE;

/**
 * Will match names in RFC4592 style
 *
 * this means *.foo.bar will match name.foo.bar
 * but *DOES NOT* match something.name.foo.bar
 */
int dns_match_wildcard(const char *name, const char *mask) ATTR_PURE;

#endif