xref: /netbsd-src/external/mpl/dhcp/bind/dist/lib/isc/include/isc/resultclass.h (revision 4afad4b7fa6d4a0d3dedf41d1587a7250710ae54)
1 /*	$NetBSD: resultclass.h,v 1.1 2024/02/18 20:57:54 christos Exp $	*/
2 
3 /*
4  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
5  *
6  * SPDX-License-Identifier: MPL-2.0
7  *
8  * This Source Code Form is subject to the terms of the Mozilla Public
9  * License, v. 2.0.  If a copy of the MPL was not distributed with this
10  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
11  *
12  * See the COPYRIGHT file distributed with this work for additional
13  * information regarding copyright ownership.
14  */
15 
16 #ifndef ISC_RESULTCLASS_H
17 #define ISC_RESULTCLASS_H 1
18 
19 /*! \file isc/resultclass.h
20  * \brief Registry of Predefined Result Type Classes
21  *
22  * A result class number is an unsigned 16 bit number.  Each class may
23  * contain up to 65536 results.  A result code is formed by adding the
24  * result number within the class to the class number multiplied by 65536.
25  *
26  * Classes < 1024 are reserved for ISC use.
27  * Result classes >= 1024 and <= 65535 are reserved for application use.
28  */
29 
30 #define ISC_RESULTCLASS_FROMNUM(num)  ((num) << 16)
31 #define ISC_RESULTCLASS_TONUM(rclass) ((rclass) >> 16)
32 #define ISC_RESULTCLASS_SIZE	      65536
33 #define ISC_RESULTCLASS_INCLASS(rclass, result) \
34 	((rclass) == ((result)&0xFFFF0000))
35 
36 #define ISC_RESULTCLASS_ISC	 ISC_RESULTCLASS_FROMNUM(0)
37 #define ISC_RESULTCLASS_DNS	 ISC_RESULTCLASS_FROMNUM(1)
38 #define ISC_RESULTCLASS_DST	 ISC_RESULTCLASS_FROMNUM(2)
39 #define ISC_RESULTCLASS_DNSRCODE ISC_RESULTCLASS_FROMNUM(3)
40 #define ISC_RESULTCLASS_OMAPI	 ISC_RESULTCLASS_FROMNUM(4)
41 #define ISC_RESULTCLASS_ISCCC	 ISC_RESULTCLASS_FROMNUM(5)
42 #define ISC_RESULTCLASS_DHCP	 ISC_RESULTCLASS_FROMNUM(6)
43 #define ISC_RESULTCLASS_PK11	 ISC_RESULTCLASS_FROMNUM(7)
44 
45 #endif /* ISC_RESULTCLASS_H */
46