defines.h 1.36 KB
Newer Older
Marek Vavruša's avatar
Marek Vavruša committed
1
/*  Copyright (C) 2014 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
2

Marek Vavruša's avatar
Marek Vavruša committed
3 4 5 6
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
7

Marek Vavruša's avatar
Marek Vavruša committed
8 9 10 11
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
12

Marek Vavruša's avatar
Marek Vavruša committed
13 14 15
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
16 17 18

#pragma once

19
#include <errno.h>
Marek Vavruša's avatar
Marek Vavruša committed
20 21 22 23
#include <libknot/errcode.h>
#include <libknot/dname.h>
#include <libknot/rrset.h>

24 25 26 27
/*
 * Error codes.
 */
#define kr_ok() 0
28 29 30 31
/* Mark as cold to mark all branches as unlikely. */
static inline int __attribute__((__cold__)) kr_error(int x) {
	return -abs(x);
}
32 33
#define kr_strerror(x) strerror(abs(x))

34 35
/*
 * Connection limits.
36
 * @cond internal
37
 */
38
#define KR_CONN_RTT_MAX 3000 /* Timeout for network activity */
39
#define KR_ITER_LIMIT 50     /* Built-in iterator limit */
40

Marek Vavruša's avatar
Marek Vavruša committed
41 42 43 44
/*
 * Defines.
 */
#define KR_DNS_PORT   53
45
#define KR_EDNS_VERSION 0
Marek Vavruša's avatar
Marek Vavruša committed
46
#define KR_EDNS_PAYLOAD 4096 /* Default UDP payload (max unfragmented UDP is 1452B) */
47
/* @endcond */