Lines Matching refs:b
31 isc__buffer_init(isc_buffer_t *b, const void *base, unsigned int length) { in isc__buffer_init() argument
37 REQUIRE(b != NULL); in isc__buffer_init()
39 ISC__BUFFER_INIT(b, base, length); in isc__buffer_init()
43 isc__buffer_initnull(isc_buffer_t *b) { in isc__buffer_initnull() argument
49 ISC__BUFFER_INIT(b, NULL, 0); in isc__buffer_initnull()
53 isc_buffer_reinit(isc_buffer_t *b, void *base, unsigned int length) { in isc_buffer_reinit() argument
63 REQUIRE(b->length <= length); in isc_buffer_reinit()
66 (void)memmove(base, b->base, b->length); in isc_buffer_reinit()
67 b->base = base; in isc_buffer_reinit()
68 b->length = length; in isc_buffer_reinit()
72 isc__buffer_invalidate(isc_buffer_t *b) { in isc__buffer_invalidate() argument
77 REQUIRE(ISC_BUFFER_VALID(b)); in isc__buffer_invalidate()
78 REQUIRE(!ISC_LINK_LINKED(b, link)); in isc__buffer_invalidate()
79 REQUIRE(b->mctx == NULL); in isc__buffer_invalidate()
81 ISC__BUFFER_INVALIDATE(b); in isc__buffer_invalidate()
85 isc__buffer_region(isc_buffer_t *b, isc_region_t *r) { in isc__buffer_region() argument
90 REQUIRE(ISC_BUFFER_VALID(b)); in isc__buffer_region()
93 ISC__BUFFER_REGION(b, r); in isc__buffer_region()
97 isc__buffer_usedregion(isc_buffer_t *b, isc_region_t *r) { in isc__buffer_usedregion() argument
102 REQUIRE(ISC_BUFFER_VALID(b)); in isc__buffer_usedregion()
105 ISC__BUFFER_USEDREGION(b, r); in isc__buffer_usedregion()
109 isc__buffer_availableregion(isc_buffer_t *b, isc_region_t *r) { in isc__buffer_availableregion() argument
114 REQUIRE(ISC_BUFFER_VALID(b)); in isc__buffer_availableregion()
117 ISC__BUFFER_AVAILABLEREGION(b, r); in isc__buffer_availableregion()
121 isc__buffer_add(isc_buffer_t *b, unsigned int n) { in isc__buffer_add() argument
126 REQUIRE(ISC_BUFFER_VALID(b)); in isc__buffer_add()
127 REQUIRE(b->used + n <= b->length); in isc__buffer_add()
129 ISC__BUFFER_ADD(b, n); in isc__buffer_add()
133 isc__buffer_subtract(isc_buffer_t *b, unsigned int n) { in isc__buffer_subtract() argument
138 REQUIRE(ISC_BUFFER_VALID(b)); in isc__buffer_subtract()
139 REQUIRE(b->used >= n); in isc__buffer_subtract()
141 ISC__BUFFER_SUBTRACT(b, n); in isc__buffer_subtract()
145 isc__buffer_clear(isc_buffer_t *b) { in isc__buffer_clear() argument
150 REQUIRE(ISC_BUFFER_VALID(b)); in isc__buffer_clear()
152 ISC__BUFFER_CLEAR(b); in isc__buffer_clear()
156 isc__buffer_consumedregion(isc_buffer_t *b, isc_region_t *r) { in isc__buffer_consumedregion() argument
161 REQUIRE(ISC_BUFFER_VALID(b)); in isc__buffer_consumedregion()
164 ISC__BUFFER_CONSUMEDREGION(b, r); in isc__buffer_consumedregion()
168 isc__buffer_remainingregion(isc_buffer_t *b, isc_region_t *r) { in isc__buffer_remainingregion() argument
173 REQUIRE(ISC_BUFFER_VALID(b)); in isc__buffer_remainingregion()
176 ISC__BUFFER_REMAININGREGION(b, r); in isc__buffer_remainingregion()
180 isc__buffer_activeregion(isc_buffer_t *b, isc_region_t *r) { in isc__buffer_activeregion() argument
185 REQUIRE(ISC_BUFFER_VALID(b)); in isc__buffer_activeregion()
188 ISC__BUFFER_ACTIVEREGION(b, r); in isc__buffer_activeregion()
192 isc__buffer_setactive(isc_buffer_t *b, unsigned int n) { in isc__buffer_setactive() argument
197 REQUIRE(ISC_BUFFER_VALID(b)); in isc__buffer_setactive()
198 REQUIRE(b->current + n <= b->used); in isc__buffer_setactive()
200 ISC__BUFFER_SETACTIVE(b, n); in isc__buffer_setactive()
204 isc__buffer_first(isc_buffer_t *b) { in isc__buffer_first() argument
209 REQUIRE(ISC_BUFFER_VALID(b)); in isc__buffer_first()
211 ISC__BUFFER_FIRST(b); in isc__buffer_first()
215 isc__buffer_forward(isc_buffer_t *b, unsigned int n) { in isc__buffer_forward() argument
220 REQUIRE(ISC_BUFFER_VALID(b)); in isc__buffer_forward()
221 REQUIRE(b->current + n <= b->used); in isc__buffer_forward()
223 ISC__BUFFER_FORWARD(b, n); in isc__buffer_forward()
227 isc__buffer_back(isc_buffer_t *b, unsigned int n) { in isc__buffer_back() argument
232 REQUIRE(ISC_BUFFER_VALID(b)); in isc__buffer_back()
233 REQUIRE(n <= b->current); in isc__buffer_back()
235 ISC__BUFFER_BACK(b, n); in isc__buffer_back()
239 isc_buffer_compact(isc_buffer_t *b) { in isc_buffer_compact() argument
249 REQUIRE(ISC_BUFFER_VALID(b)); in isc_buffer_compact()
251 src = isc_buffer_current(b); in isc_buffer_compact()
252 length = isc_buffer_remaininglength(b); in isc_buffer_compact()
253 (void)memmove(b->base, src, (size_t)length); in isc_buffer_compact()
255 if (b->active > b->current) in isc_buffer_compact()
256 b->active -= b->current; in isc_buffer_compact()
258 b->active = 0; in isc_buffer_compact()
259 b->current = 0; in isc_buffer_compact()
260 b->used = length; in isc_buffer_compact()
264 isc_buffer_getuint8(isc_buffer_t *b) { in isc_buffer_getuint8() argument
272 REQUIRE(ISC_BUFFER_VALID(b)); in isc_buffer_getuint8()
273 REQUIRE(b->used - b->current >= 1); in isc_buffer_getuint8()
275 cp = isc_buffer_current(b); in isc_buffer_getuint8()
276 b->current += 1; in isc_buffer_getuint8()
283 isc__buffer_putuint8(isc_buffer_t *b, isc_uint8_t val) { in isc__buffer_putuint8() argument
284 REQUIRE(ISC_BUFFER_VALID(b)); in isc__buffer_putuint8()
285 REQUIRE(b->used + 1 <= b->length); in isc__buffer_putuint8()
287 ISC__BUFFER_PUTUINT8(b, val); in isc__buffer_putuint8()
291 isc_buffer_getuint16(isc_buffer_t *b) { in isc_buffer_getuint16() argument
300 REQUIRE(ISC_BUFFER_VALID(b)); in isc_buffer_getuint16()
301 REQUIRE(b->used - b->current >= 2); in isc_buffer_getuint16()
303 cp = isc_buffer_current(b); in isc_buffer_getuint16()
304 b->current += 2; in isc_buffer_getuint16()
312 isc__buffer_putuint16(isc_buffer_t *b, isc_uint16_t val) { in isc__buffer_putuint16() argument
313 REQUIRE(ISC_BUFFER_VALID(b)); in isc__buffer_putuint16()
314 REQUIRE(b->used + 2 <= b->length); in isc__buffer_putuint16()
316 ISC__BUFFER_PUTUINT16(b, val); in isc__buffer_putuint16()
320 isc__buffer_putuint24(isc_buffer_t *b, isc_uint32_t val) { in isc__buffer_putuint24() argument
321 REQUIRE(ISC_BUFFER_VALID(b)); in isc__buffer_putuint24()
322 REQUIRE(b->used + 3 <= b->length); in isc__buffer_putuint24()
324 ISC__BUFFER_PUTUINT24(b, val); in isc__buffer_putuint24()
328 isc_buffer_getuint32(isc_buffer_t *b) { in isc_buffer_getuint32() argument
337 REQUIRE(ISC_BUFFER_VALID(b)); in isc_buffer_getuint32()
338 REQUIRE(b->used - b->current >= 4); in isc_buffer_getuint32()
340 cp = isc_buffer_current(b); in isc_buffer_getuint32()
341 b->current += 4; in isc_buffer_getuint32()
351 isc__buffer_putuint32(isc_buffer_t *b, isc_uint32_t val) { in isc__buffer_putuint32() argument
352 REQUIRE(ISC_BUFFER_VALID(b)); in isc__buffer_putuint32()
353 REQUIRE(b->used + 4 <= b->length); in isc__buffer_putuint32()
355 ISC__BUFFER_PUTUINT32(b, val); in isc__buffer_putuint32()
359 isc_buffer_getuint48(isc_buffer_t *b) { in isc_buffer_getuint48() argument
368 REQUIRE(ISC_BUFFER_VALID(b)); in isc_buffer_getuint48()
369 REQUIRE(b->used - b->current >= 6); in isc_buffer_getuint48()
371 cp = isc_buffer_current(b); in isc_buffer_getuint48()
372 b->current += 6; in isc_buffer_getuint48()
384 isc__buffer_putuint48(isc_buffer_t *b, isc_uint64_t val) { in isc__buffer_putuint48() argument
388 REQUIRE(ISC_BUFFER_VALID(b)); in isc__buffer_putuint48()
389 REQUIRE(b->used + 6 <= b->length); in isc__buffer_putuint48()
393 ISC__BUFFER_PUTUINT16(b, valhi); in isc__buffer_putuint48()
394 ISC__BUFFER_PUTUINT32(b, vallo); in isc__buffer_putuint48()
398 isc__buffer_putmem(isc_buffer_t *b, const unsigned char *base, in isc__buffer_putmem() argument
401 REQUIRE(ISC_BUFFER_VALID(b)); in isc__buffer_putmem()
402 REQUIRE(b->used + length <= b->length); in isc__buffer_putmem()
404 ISC__BUFFER_PUTMEM(b, base, length); in isc__buffer_putmem()
408 isc__buffer_putstr(isc_buffer_t *b, const char *source) { in isc__buffer_putstr() argument
412 REQUIRE(ISC_BUFFER_VALID(b)); in isc__buffer_putstr()
420 REQUIRE(l <= isc_buffer_availablelength(b)); in isc__buffer_putstr()
422 cp = isc_buffer_used(b); in isc__buffer_putstr()
424 b->used += (u_int)l; /* checked above - no overflow here */ in isc__buffer_putstr()
428 isc_buffer_copyregion(isc_buffer_t *b, const isc_region_t *r) { in isc_buffer_copyregion() argument
432 REQUIRE(ISC_BUFFER_VALID(b)); in isc_buffer_copyregion()
438 base = isc_buffer_used(b); in isc_buffer_copyregion()
439 available = isc_buffer_availablelength(b); in isc_buffer_copyregion()
443 b->used += r->length; in isc_buffer_copyregion()