From: Evan Hunt Date: Thu, 6 Feb 2014 23:36:13 +0000 (-0800) Subject: [master] deprecate isc_bitsrting X-Git-Tag: v9.10.0b1~150^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5f9fa7e18d50569a7d723acbb6f641e13ed3787;p=thirdparty%2Fbind9.git [master] deprecate isc_bitsrting 3727. [func] The isc_bitstring API is no longer used and has been removed from libisc. [RT #35284] --- diff --git a/CHANGES b/CHANGES index cbe306ce69a..9546f0c6dd4 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +3727. [func] The isc_bitstring API is no longer used and + has been removed from libisc. [RT #35284] + 3726. [cleanup] Clarified the error message when attempting to configure more than 32 response-policy zones. [RT #35283] diff --git a/lib/isc/Makefile.in b/lib/isc/Makefile.in index 254ae67d3b7..32dd2663551 100644 --- a/lib/isc/Makefile.in +++ b/lib/isc/Makefile.in @@ -54,7 +54,7 @@ WIN32OBJS = win32/condition.@O@ win32/dir.@O@ win32/file.@O@ \ # Alphabetically OBJS = @ISC_EXTRA_OBJS@ \ assertions.@O@ backtrace.@O@ base32.@O@ base64.@O@ \ - bind9.@O@ bitstring.@O@ buffer.@O@ bufferlist.@O@ \ + bind9.@O@ buffer.@O@ bufferlist.@O@ \ commandline.@O@ crc64.@O@ error.@O@ event.@O@ \ hash.@O@ heap.@O@ hex.@O@ hmacmd5.@O@ hmacsha.@O@ \ httpd.@O@ inet_aton.@O@ iterated_hash.@O@ \ @@ -73,7 +73,7 @@ SYMTBLOBJS = backtrace-emptytbl.@O@ # Alphabetically SRCS = @ISC_EXTRA_SRCS@ \ assertions.c backtrace.c base32.c base64.c bind9.c \ - bitstring.c buffer.c bufferlist.c commandline.c crc64.c \ + buffer.c bufferlist.c commandline.c crc64.c \ error.c event.c heap.c hex.c hmacmd5.c hmacsha.c \ httpd.c inet_aton.c iterated_hash.c \ lex.c lfsr.c lib.c log.c \ diff --git a/lib/isc/bitstring.c b/lib/isc/bitstring.c deleted file mode 100644 index 33c7c1fa6d8..00000000000 --- a/lib/isc/bitstring.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") - * Copyright (C) 1999-2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: bitstring.c,v 1.17 2007/06/19 23:47:17 tbox Exp $ */ - -/*! \file */ - -#include - -#include - -#include -#include -#include - -#define DIV8(x) ((x) >> 3) -#define MOD8(x) ((x) & 0x00000007U) -#define OCTETS(n) (((n) + 7) >> 3) -#define PADDED(n) ((((n) + 7) >> 3) << 3) -#define BITSET(bs, n) (((bs)->data[DIV8(n)] & \ - (1 << (7 - MOD8(n)))) != 0) -#define SETBIT(bs, n) (bs)->data[DIV8(n)] |= (1 << (7 - MOD8(n))) -#define CLEARBIT(bs, n) (bs)->data[DIV8(n)] &= ~(1 << (7 - MOD8(n))) - -#define BITSTRING_MAGIC ISC_MAGIC('B', 'S', 't', 'r') -#define VALID_BITSTRING(b) ISC_MAGIC_VALID(b, BITSTRING_MAGIC) - -void -isc_bitstring_init(isc_bitstring_t *bitstring, unsigned char *data, - unsigned int length, unsigned int size, isc_boolean_t lsb0) -{ - /* - * Make 'bitstring' refer to the bitstring of 'size' bits starting - * at 'data'. 'length' bits of the bitstring are valid. If 'lsb0' - * is set then, bit 0 refers to the least significant bit of the - * bitstring. Otherwise bit 0 is the most significant bit. - */ - - REQUIRE(bitstring != NULL); - REQUIRE(data != NULL); - REQUIRE(length <= size); - - bitstring->magic = BITSTRING_MAGIC; - bitstring->data = data; - bitstring->length = length; - bitstring->size = size; - bitstring->lsb0 = lsb0; -} - -void -isc_bitstring_invalidate(isc_bitstring_t *bitstring) { - - /* - * Invalidate 'bitstring'. - */ - - REQUIRE(VALID_BITSTRING(bitstring)); - - bitstring->magic = 0; - bitstring->data = NULL; - bitstring->length = 0; - bitstring->size = 0; - bitstring->lsb0 = ISC_FALSE; -} - -void -isc_bitstring_copy(isc_bitstring_t *source, unsigned int sbitpos, - isc_bitstring_t *target, unsigned int tbitpos, - unsigned int n) -{ - unsigned int tlast; - - /* - * Starting at bit 'sbitpos', copy 'n' bits from 'source' to - * the 'n' bits of 'target' starting at 'tbitpos'. - */ - - REQUIRE(VALID_BITSTRING(source)); - REQUIRE(VALID_BITSTRING(target)); - REQUIRE(source->lsb0 == target->lsb0); - if (source->lsb0) { - REQUIRE(sbitpos <= source->length); - sbitpos = PADDED(source->size) - sbitpos; - REQUIRE(sbitpos >= n); - sbitpos -= n; - } else - REQUIRE(sbitpos + n <= source->length); - tlast = tbitpos + n; - if (target->lsb0) { - REQUIRE(tbitpos <= target->length); - tbitpos = PADDED(target->size) - tbitpos; - REQUIRE(tbitpos >= n); - tbitpos -= n; - } else - REQUIRE(tlast <= target->size); - - if (tlast > target->length) - target->length = tlast; - - /* - * This is far from optimal... - */ - - while (n > 0) { - if (BITSET(source, sbitpos)) - SETBIT(target, tbitpos); - else - CLEARBIT(target, tbitpos); - sbitpos++; - tbitpos++; - n--; - } -} diff --git a/lib/isc/include/isc/Makefile.in b/lib/isc/include/isc/Makefile.in index f8ea3b65119..bc99bd1ac46 100644 --- a/lib/isc/include/isc/Makefile.in +++ b/lib/isc/include/isc/Makefile.in @@ -26,8 +26,8 @@ top_srcdir = @top_srcdir@ # machine generated. The latter are handled specially in the # install target below. # -HEADERS = app.h assertions.h base64.h bind9.h bitstring.h boolean.h \ - buffer.h bufferlist.h commandline.h entropy.h error.h event.h \ +HEADERS = app.h assertions.h base64.h bind9.h boolean.h buffer.h \ + bufferlist.h commandline.h entropy.h error.h event.h \ eventclass.h file.h formatcheck.h fsaccess.h \ hash.h heap.h hex.h hmacmd5.h hmacsha.h \ httpd.h \ diff --git a/lib/isc/include/isc/bitstring.h b/lib/isc/include/isc/bitstring.h deleted file mode 100644 index 252d1117a78..00000000000 --- a/lib/isc/include/isc/bitstring.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") - * Copyright (C) 1999-2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: bitstring.h,v 1.14 2007/06/19 23:47:18 tbox Exp $ */ - -#ifndef ISC_BITSTRING_H -#define ISC_BITSTRING_H 1 - -/***** - ***** Module Info - *****/ - -/*! \file isc/bitstring.h - * - * \brief Bitstring manipulation functions. - * - * A bitstring is a packed array of bits, stored in a contiguous - * sequence of octets. The "most significant bit" (msb) of a bitstring - * is the high bit of the first octet. The "least significant bit" of a - * bitstring is the low bit of the last octet. - * - * Two bit numbering schemes are supported, "msb0" and "lsb0". - * - * In the "msb0" scheme, bit number 0 designates the most significant bit, - * and any padding bits required to make the bitstring a multiple of 8 bits - * long are added to the least significant end of the last octet. - * - * In the "lsb0" scheme, bit number 0 designates the least significant bit, - * and any padding bits required to make the bitstring a multiple of 8 bits - * long are added to the most significant end of the first octet. - * - * E.g., consider the bitstring "11010001111". This bitstring is 11 bits - * long and will take two octets. Let "p" denote a pad bit. In the msb0 - * encoding, it would be - * - * \verbatim - * Octet 0 Octet 1 - * | - * 1 1 0 1 0 0 0 1 | 1 1 1 p p p p p - * ^ | ^ - * | | - * bit 0 bit 15 - * \endverbatim - * - * In the lsb0 encoding, it would be - * - * \verbatim - * Octet 0 Octet 1 - * | - * p p p p p 1 1 0 | 1 0 0 0 1 1 1 1 - * ^ | ^ - * | | - * bit 15 bit 0 - * \endverbatim - */ - -/*** - *** Imports - ***/ - -#include -#include - -ISC_LANG_BEGINDECLS - -/*** - *** Types - ***/ - -struct isc_bitstring { - unsigned int magic; - unsigned char * data; - unsigned int length; - unsigned int size; - isc_boolean_t lsb0; -}; - -/*** - *** Functions - ***/ - -void -isc_bitstring_init(isc_bitstring_t *bitstring, unsigned char *data, - unsigned int length, unsigned int size, isc_boolean_t lsb0); -/*!< - * \brief Make 'bitstring' refer to the bitstring of 'size' bits starting - * at 'data'. 'length' bits of the bitstring are valid. If 'lsb0' - * is set then, bit 0 refers to the least significant bit of the - * bitstring. Otherwise bit 0 is the most significant bit. - * - * Requires: - * - *\li 'bitstring' points to a isc_bitstring_t. - * - *\li 'data' points to an array of unsigned char large enough to hold - * 'size' bits. - * - *\li 'length' <= 'size'. - * - * Ensures: - * - *\li 'bitstring' is a valid bitstring. - */ - -void -isc_bitstring_invalidate(isc_bitstring_t *bitstring); -/*!< - * \brief Invalidate 'bitstring'. - * - * Requires: - * - *\li 'bitstring' is a valid bitstring. - * - * Ensures: - * - *\li 'bitstring' is not a valid bitstring. - */ - -void -isc_bitstring_copy(isc_bitstring_t *source, unsigned int sbitpos, - isc_bitstring_t *target, unsigned int tbitpos, - unsigned int n); -/*!< - * \brief Starting at bit 'sbitpos', copy 'n' bits from 'source' to - * the 'n' bits of 'target' starting at 'tbitpos'. - * - * Requires: - * - *\li 'source' and target are valid bitstrings with the same lsb0 setting. - * - *\li 'sbitpos' + 'n' is less than or equal to the length of 'source'. - * - *\li 'tbitpos' + 'n' is less than or equal to the size of 'target'. - * - * Ensures: - * - *\li The specified bits have been copied, and the length of 'target' - * adjusted (if required). - */ - -ISC_LANG_ENDDECLS - -#endif /* ISC_BITSTRING_H */ diff --git a/lib/isc/include/isc/types.h b/lib/isc/include/isc/types.h index 011cfd2e324..a32d56130a3 100644 --- a/lib/isc/include/isc/types.h +++ b/lib/isc/include/isc/types.h @@ -44,7 +44,6 @@ typedef struct isc_appctx isc_appctx_t; /*%< Application context */ typedef struct isc_backtrace_symmap isc_backtrace_symmap_t; /*%< Symbol Table Entry */ -typedef struct isc_bitstring isc_bitstring_t; /*%< Bitstring */ typedef struct isc_buffer isc_buffer_t; /*%< Buffer */ typedef ISC_LIST(isc_buffer_t) isc_bufferlist_t; /*%< Buffer List */ typedef struct isc_constregion isc_constregion_t; /*%< Const region */ diff --git a/lib/isc/win32/libisc.def.in b/lib/isc/win32/libisc.def.in index d236307e61b..89262fbbab3 100644 --- a/lib/isc/win32/libisc.def.in +++ b/lib/isc/win32/libisc.def.in @@ -107,9 +107,6 @@ isc_base32hex_totext isc_base64_decodestring isc_base64_tobuffer isc_base64_totext -isc_bitstring_copy -isc_bitstring_init -isc_bitstring_invalidate isc_buffer_allocate isc_buffer_compact isc_buffer_copyregion diff --git a/lib/isc/win32/libisc.dsp.in b/lib/isc/win32/libisc.dsp.in index 08fe918c4c0..ad7a9a8f9f2 100644 --- a/lib/isc/win32/libisc.dsp.in +++ b/lib/isc/win32/libisc.dsp.in @@ -245,10 +245,6 @@ SOURCE=.\include\isc\bindevt.h # End Source File # Begin Source File -SOURCE=..\include\isc\bitstring.h -# End Source File -# Begin Source File - SOURCE=..\include\isc\boolean.h # End Source File # Begin Source File @@ -657,10 +653,6 @@ SOURCE=..\bind9.c # End Source File # Begin Source File -SOURCE=..\bitstring.c -# End Source File -# Begin Source File - SOURCE=..\buffer.c # End Source File # Begin Source File diff --git a/lib/isc/win32/libisc.mak.in b/lib/isc/win32/libisc.mak.in index 554429a3436..be5922c1d2e 100644 --- a/lib/isc/win32/libisc.mak.in +++ b/lib/isc/win32/libisc.mak.in @@ -121,7 +121,6 @@ CLEAN : -@erase "$(INTDIR)\base32.obj" -@erase "$(INTDIR)\base64.obj" -@erase "$(INTDIR)\bind9.obj" - -@erase "$(INTDIR)\bitstring.obj" -@erase "$(INTDIR)\buffer.obj" -@erase "$(INTDIR)\bufferlist.obj" -@erase "$(INTDIR)\commandline.obj" @@ -257,7 +256,6 @@ LINK32_OBJS= \ "$(INTDIR)\base32.obj" \ "$(INTDIR)\base64.obj" \ "$(INTDIR)\bind9.obj" \ - "$(INTDIR)\bitstring.obj" \ "$(INTDIR)\buffer.obj" \ "$(INTDIR)\bufferlist.obj" \ "$(INTDIR)\commandline.obj" \ @@ -341,8 +339,6 @@ CLEAN : -@erase "$(INTDIR)\base64.sbr" -@erase "$(INTDIR)\bind9.obj" -@erase "$(INTDIR)\bind9.sbr" - -@erase "$(INTDIR)\bitstring.obj" - -@erase "$(INTDIR)\bitstring.sbr" -@erase "$(INTDIR)\buffer.obj" -@erase "$(INTDIR)\buffer.sbr" -@erase "$(INTDIR)\bufferlist.obj" @@ -548,7 +544,6 @@ BSC32_SBRS= \ "$(INTDIR)\base32.sbr" \ "$(INTDIR)\base64.sbr" \ "$(INTDIR)\bind9.sbr" \ - "$(INTDIR)\bitstring.sbr" \ "$(INTDIR)\buffer.sbr" \ "$(INTDIR)\bufferlist.sbr" \ "$(INTDIR)\commandline.sbr" \ @@ -646,7 +641,6 @@ LINK32_OBJS= \ "$(INTDIR)\base32.obj" \ "$(INTDIR)\base64.obj" \ "$(INTDIR)\bind9.obj" \ - "$(INTDIR)\bitstring.obj" \ "$(INTDIR)\buffer.obj" \ "$(INTDIR)\bufferlist.obj" \ "$(INTDIR)\commandline.obj" \ @@ -1254,24 +1248,6 @@ SOURCE=..\bind9.c $(CPP) $(CPP_PROJ) $(SOURCE) -!ENDIF - -SOURCE=..\bitstring.c - -!IF "$(CFG)" == "libisc - @PLATFORM@ Release" - - -"$(INTDIR)\bitstring.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "libisc - @PLATFORM@ Debug" - - -"$(INTDIR)\bitstring.obj" "$(INTDIR)\bitstring.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - !ENDIF SOURCE=..\buffer.c diff --git a/lib/isc/win32/libisc.vcxproj.filters.in b/lib/isc/win32/libisc.vcxproj.filters.in index 8b25ec4534e..4bbf2dde1ac 100644 --- a/lib/isc/win32/libisc.vcxproj.filters.in +++ b/lib/isc/win32/libisc.vcxproj.filters.in @@ -44,9 +44,6 @@ Library Header Files - - Library Header Files - Library Header Files @@ -443,9 +440,6 @@ Library Source Files - - Library Source Files - Library Source Files diff --git a/lib/isc/win32/libisc.vcxproj.in b/lib/isc/win32/libisc.vcxproj.in index 84f0db1236c..15378af1c85 100644 --- a/lib/isc/win32/libisc.vcxproj.in +++ b/lib/isc/win32/libisc.vcxproj.in @@ -265,7 +265,6 @@ copy /Y @VCREDIST_PATH@ ..\Build\Release\ - @@ -376,7 +375,6 @@ copy /Y @VCREDIST_PATH@ ..\Build\Release\ -