2 * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1998-2002 Internet Software Consortium.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
18 /* $Id: region.h,v 1.25 2007/06/19 23:47:18 tbox Exp $ */
21 #define ISC_REGION_H 1
23 /*! \file isc/region.h */
25 #include <isc/types.h>
32 struct isc_textregion {
37 /* XXXDCL questionable ... bears discussion. we have been putting off
38 * discussing the region api.
40 struct isc_constregion {
45 struct isc_consttextregion {
52 * The region structure is not opaque, and is usually directly manipulated.
53 * Some macros are defined below for convenience.
56 #define isc_region_consume(r,l) \
58 isc_region_t *_r = (r); \
59 unsigned int _l = (l); \
60 INSIST(_r->length >= _l); \
65 #define isc_textregion_consume(r,l) \
67 isc_textregion_t *_r = (r); \
68 unsigned int _l = (l); \
69 INSIST(_r->length >= _l); \
74 #define isc_constregion_consume(r,l) \
76 isc_constregion_t *_r = (r); \
77 unsigned int _l = (l); \
78 INSIST(_r->length >= _l); \
85 isc_region_compare(isc_region_t *r1, isc_region_t *r2);
87 * Compares the contents of two regions
90 *\li 'r1' is a valid region
91 *\li 'r2' is a valid region
94 *\li < 0 if r1 is lexicographically less than r2
95 *\li = 0 if r1 is lexicographically identical to r2
96 *\li > 0 if r1 is lexicographically greater than r2
99 #endif /* ISC_REGION_H */