mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-09 08:22:04 -04:00
[master] deprecate isc_bitsrting
3727. [func] The isc_bitstring API is no longer used and has been removed from libisc. [RT #35284]
This commit is contained in:
parent
62cce60a15
commit
e5f9fa7e18
11 changed files with 7 additions and 332 deletions
3
CHANGES
3
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]
|
||||
|
|
|
|||
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -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 <config.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <isc/magic.h>
|
||||
#include <isc/bitstring.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#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--;
|
||||
}
|
||||
}
|
||||
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -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 <isc/lang.h>
|
||||
#include <isc/types.h>
|
||||
|
||||
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 */
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -44,9 +44,6 @@
|
|||
<ClInclude Include="..\include\isc\bind9.h">
|
||||
<Filter>Library Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\isc\bitstring.h">
|
||||
<Filter>Library Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\isc\boolean.h">
|
||||
<Filter>Library Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -443,9 +440,6 @@
|
|||
<ClCompile Include="..\bind9.c">
|
||||
<Filter>Library Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\bitstring.c">
|
||||
<Filter>Library Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\buffer.c">
|
||||
<Filter>Library Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
|||
|
|
@ -265,7 +265,6 @@ copy /Y @VCREDIST_PATH@ ..\Build\Release\
|
|||
<ClInclude Include="..\include\isc\base32.h" />
|
||||
<ClInclude Include="..\include\isc\base64.h" />
|
||||
<ClInclude Include="..\include\isc\bind9.h" />
|
||||
<ClInclude Include="..\include\isc\bitstring.h" />
|
||||
<ClInclude Include="..\include\isc\boolean.h" />
|
||||
<ClInclude Include="..\include\isc\buffer.h" />
|
||||
<ClInclude Include="..\include\isc\bufferlist.h" />
|
||||
|
|
@ -376,7 +375,6 @@ copy /Y @VCREDIST_PATH@ ..\Build\Release\
|
|||
<ClCompile Include="..\base32.c" />
|
||||
<ClCompile Include="..\base64.c" />
|
||||
<ClCompile Include="..\bind9.c" />
|
||||
<ClCompile Include="..\bitstring.c" />
|
||||
<ClCompile Include="..\buffer.c" />
|
||||
<ClCompile Include="..\bufferlist.c" />
|
||||
<ClCompile Include="..\commandline.c" />
|
||||
|
|
|
|||
Loading…
Reference in a new issue