Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../usr/include/bind9/isccc
File: util.h
/*
[0] Fix | Delete
* Portions Copyright (C) Internet Systems Consortium, Inc. ("ISC")
[1] Fix | Delete
*
[2] Fix | Delete
* This Source Code Form is subject to the terms of the Mozilla Public
[3] Fix | Delete
* License, v. 2.0. If a copy of the MPL was not distributed with this
[4] Fix | Delete
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
[5] Fix | Delete
*
[6] Fix | Delete
* See the COPYRIGHT file distributed with this work for additional
[7] Fix | Delete
* information regarding copyright ownership.
[8] Fix | Delete
*
[9] Fix | Delete
* Portions Copyright (C) 2001 Nominum, Inc.
[10] Fix | Delete
*
[11] Fix | Delete
* Permission to use, copy, modify, and/or distribute this software for any
[12] Fix | Delete
* purpose with or without fee is hereby granted, provided that the above
[13] Fix | Delete
* copyright notice and this permission notice appear in all copies.
[14] Fix | Delete
*
[15] Fix | Delete
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
[16] Fix | Delete
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
[17] Fix | Delete
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
[18] Fix | Delete
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
[19] Fix | Delete
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
[20] Fix | Delete
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
[21] Fix | Delete
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
[22] Fix | Delete
*/
[23] Fix | Delete
[24] Fix | Delete
[25] Fix | Delete
#ifndef ISCCC_UTIL_H
[26] Fix | Delete
#define ISCCC_UTIL_H 1
[27] Fix | Delete
[28] Fix | Delete
#include <inttypes.h>
[29] Fix | Delete
[30] Fix | Delete
#include <isc/util.h>
[31] Fix | Delete
[32] Fix | Delete
/*! \file isccc/util.h
[33] Fix | Delete
* \brief
[34] Fix | Delete
* Macros for dealing with unaligned numbers.
[35] Fix | Delete
*
[36] Fix | Delete
* \note no side effects are allowed when invoking these macros!
[37] Fix | Delete
*/
[38] Fix | Delete
[39] Fix | Delete
#define GET8(v, w) \
[40] Fix | Delete
do { \
[41] Fix | Delete
v = *w; \
[42] Fix | Delete
w++; \
[43] Fix | Delete
} while (0)
[44] Fix | Delete
[45] Fix | Delete
#define GET16(v, w) \
[46] Fix | Delete
do { \
[47] Fix | Delete
v = (unsigned int)w[0] << 8; \
[48] Fix | Delete
v |= (unsigned int)w[1]; \
[49] Fix | Delete
w += 2; \
[50] Fix | Delete
} while (0)
[51] Fix | Delete
[52] Fix | Delete
#define GET24(v, w) \
[53] Fix | Delete
do { \
[54] Fix | Delete
v = (unsigned int)w[0] << 16; \
[55] Fix | Delete
v |= (unsigned int)w[1] << 8; \
[56] Fix | Delete
v |= (unsigned int)w[2]; \
[57] Fix | Delete
w += 3; \
[58] Fix | Delete
} while (0)
[59] Fix | Delete
[60] Fix | Delete
#define GET32(v, w) \
[61] Fix | Delete
do { \
[62] Fix | Delete
v = (unsigned int)w[0] << 24; \
[63] Fix | Delete
v |= (unsigned int)w[1] << 16; \
[64] Fix | Delete
v |= (unsigned int)w[2] << 8; \
[65] Fix | Delete
v |= (unsigned int)w[3]; \
[66] Fix | Delete
w += 4; \
[67] Fix | Delete
} while (0)
[68] Fix | Delete
[69] Fix | Delete
#define GET64(v, w) \
[70] Fix | Delete
do { \
[71] Fix | Delete
v = (uint64_t)w[0] << 56; \
[72] Fix | Delete
v |= (uint64_t)w[1] << 48; \
[73] Fix | Delete
v |= (uint64_t)w[2] << 40; \
[74] Fix | Delete
v |= (uint64_t)w[3] << 32; \
[75] Fix | Delete
v |= (uint64_t)w[4] << 24; \
[76] Fix | Delete
v |= (uint64_t)w[5] << 16; \
[77] Fix | Delete
v |= (uint64_t)w[6] << 8; \
[78] Fix | Delete
v |= (uint64_t)w[7]; \
[79] Fix | Delete
w += 8; \
[80] Fix | Delete
} while (0)
[81] Fix | Delete
[82] Fix | Delete
#define GETC16(v, w, d) \
[83] Fix | Delete
do { \
[84] Fix | Delete
GET8(v, w); \
[85] Fix | Delete
if (v == 0) \
[86] Fix | Delete
d = ISCCC_TRUE; \
[87] Fix | Delete
else { \
[88] Fix | Delete
d = ISCCC_FALSE; \
[89] Fix | Delete
if (v == 255) \
[90] Fix | Delete
GET16(v, w); \
[91] Fix | Delete
} \
[92] Fix | Delete
} while (0)
[93] Fix | Delete
[94] Fix | Delete
#define GETC32(v, w) \
[95] Fix | Delete
do { \
[96] Fix | Delete
GET24(v, w); \
[97] Fix | Delete
if (v == 0xffffffu) \
[98] Fix | Delete
GET32(v, w); \
[99] Fix | Delete
} while (0)
[100] Fix | Delete
[101] Fix | Delete
#define GET_OFFSET(v, w) GET32(v, w)
[102] Fix | Delete
[103] Fix | Delete
#define GET_MEM(v, c, w) \
[104] Fix | Delete
do { \
[105] Fix | Delete
memmove(v, w, c); \
[106] Fix | Delete
w += c; \
[107] Fix | Delete
} while (0)
[108] Fix | Delete
[109] Fix | Delete
#define GET_TYPE(v, w) \
[110] Fix | Delete
do { \
[111] Fix | Delete
GET8(v, w); \
[112] Fix | Delete
if (v > 127) { \
[113] Fix | Delete
if (v < 255) \
[114] Fix | Delete
v = ((v & 0x7f) << 16) | ISCCC_RDATATYPE_SIG; \
[115] Fix | Delete
else \
[116] Fix | Delete
GET32(v, w); \
[117] Fix | Delete
} \
[118] Fix | Delete
} while (0)
[119] Fix | Delete
[120] Fix | Delete
#define PUT8(v, w) \
[121] Fix | Delete
do { \
[122] Fix | Delete
*w = (v & 0x000000ffU); \
[123] Fix | Delete
w++; \
[124] Fix | Delete
} while (0)
[125] Fix | Delete
[126] Fix | Delete
#define PUT16(v, w) \
[127] Fix | Delete
do { \
[128] Fix | Delete
w[0] = (v & 0x0000ff00U) >> 8; \
[129] Fix | Delete
w[1] = (v & 0x000000ffU); \
[130] Fix | Delete
w += 2; \
[131] Fix | Delete
} while (0)
[132] Fix | Delete
[133] Fix | Delete
#define PUT24(v, w) \
[134] Fix | Delete
do { \
[135] Fix | Delete
w[0] = (v & 0x00ff0000U) >> 16; \
[136] Fix | Delete
w[1] = (v & 0x0000ff00U) >> 8; \
[137] Fix | Delete
w[2] = (v & 0x000000ffU); \
[138] Fix | Delete
w += 3; \
[139] Fix | Delete
} while (0)
[140] Fix | Delete
[141] Fix | Delete
#define PUT32(v, w) \
[142] Fix | Delete
do { \
[143] Fix | Delete
w[0] = (v & 0xff000000U) >> 24; \
[144] Fix | Delete
w[1] = (v & 0x00ff0000U) >> 16; \
[145] Fix | Delete
w[2] = (v & 0x0000ff00U) >> 8; \
[146] Fix | Delete
w[3] = (v & 0x000000ffU); \
[147] Fix | Delete
w += 4; \
[148] Fix | Delete
} while (0)
[149] Fix | Delete
[150] Fix | Delete
#define PUT64(v, w) \
[151] Fix | Delete
do { \
[152] Fix | Delete
w[0] = (v & 0xff00000000000000ULL) >> 56; \
[153] Fix | Delete
w[1] = (v & 0x00ff000000000000ULL) >> 48; \
[154] Fix | Delete
w[2] = (v & 0x0000ff0000000000ULL) >> 40; \
[155] Fix | Delete
w[3] = (v & 0x000000ff00000000ULL) >> 32; \
[156] Fix | Delete
w[4] = (v & 0x00000000ff000000ULL) >> 24; \
[157] Fix | Delete
w[5] = (v & 0x0000000000ff0000ULL) >> 16; \
[158] Fix | Delete
w[6] = (v & 0x000000000000ff00ULL) >> 8; \
[159] Fix | Delete
w[7] = (v & 0x00000000000000ffULL); \
[160] Fix | Delete
w += 8; \
[161] Fix | Delete
} while (0)
[162] Fix | Delete
[163] Fix | Delete
#define PUTC16(v, w) \
[164] Fix | Delete
do { \
[165] Fix | Delete
if (v > 0 && v < 255) \
[166] Fix | Delete
PUT8(v, w); \
[167] Fix | Delete
else { \
[168] Fix | Delete
PUT8(255, w); \
[169] Fix | Delete
PUT16(v, w); \
[170] Fix | Delete
} \
[171] Fix | Delete
} while (0)
[172] Fix | Delete
[173] Fix | Delete
#define PUTC32(v, w) \
[174] Fix | Delete
do { \
[175] Fix | Delete
if (v < 0xffffffU) \
[176] Fix | Delete
PUT24(v, w); \
[177] Fix | Delete
else { \
[178] Fix | Delete
PUT24(0xffffffU, w); \
[179] Fix | Delete
PUT32(v, w); \
[180] Fix | Delete
} \
[181] Fix | Delete
} while (0)
[182] Fix | Delete
[183] Fix | Delete
#define PUT_OFFSET(v, w) PUT32(v, w)
[184] Fix | Delete
[185] Fix | Delete
#include <string.h>
[186] Fix | Delete
[187] Fix | Delete
#define PUT_MEM(s, c, w) \
[188] Fix | Delete
do { \
[189] Fix | Delete
memmove(w, s, c); \
[190] Fix | Delete
w += c; \
[191] Fix | Delete
} while (0)
[192] Fix | Delete
[193] Fix | Delete
/*
[194] Fix | Delete
* Regions.
[195] Fix | Delete
*/
[196] Fix | Delete
#define REGION_SIZE(r) ((unsigned int)((r).rend - (r).rstart))
[197] Fix | Delete
#define REGION_EMPTY(r) ((r).rstart == (r).rend)
[198] Fix | Delete
#define REGION_FROMSTRING(r, s) do { \
[199] Fix | Delete
(r).rstart = (unsigned char *)s; \
[200] Fix | Delete
(r).rend = (r).rstart + strlen(s); \
[201] Fix | Delete
} while (0)
[202] Fix | Delete
[203] Fix | Delete
/*%
[204] Fix | Delete
* Use this to remove the const qualifier of a variable to assign it to
[205] Fix | Delete
* a non-const variable or pass it as a non-const function argument ...
[206] Fix | Delete
* but only when you are sure it won't then be changed!
[207] Fix | Delete
* This is necessary to sometimes shut up some compilers
[208] Fix | Delete
* (as with gcc -Wcast-qual) when there is just no other good way to avoid the
[209] Fix | Delete
* situation.
[210] Fix | Delete
*/
[211] Fix | Delete
#define DE_CONST(konst, var) \
[212] Fix | Delete
do { \
[213] Fix | Delete
union { const void *k; void *v; } _u; \
[214] Fix | Delete
_u.k = konst; \
[215] Fix | Delete
var = _u.v; \
[216] Fix | Delete
} while (0)
[217] Fix | Delete
[218] Fix | Delete
#endif /* ISCCC_UTIL_H */
[219] Fix | Delete
[220] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function