Lines Matching +full:commit +full:- +full:message
2 * Message Processing Stack, Reader implementation
5 * SPDX-License-Identifier: Apache-2.0
11 * http://www.apache.org/licenses/LICENSE-2.0
47 * and significantly increases the C-code line count, but
60 * on failure - this in turn has two benefits:
67 * and/or non-sensical calls.
68 * Moreover, it might even reduce code-size because
78 if( rd->acc == NULL ) in mps_reader_is_accumulating()
81 acc_remaining = rd->acc_share.acc_remaining; in mps_reader_is_accumulating()
88 unsigned char *frag = rd->frag; in mps_reader_is_producing()
101 unsigned char *acc = rd->acc; in mps_reader_get_fragment_offset()
107 frag_offset = rd->acc_share.frag_offset; in mps_reader_get_fragment_offset()
117 end = rd->end; in mps_reader_serving_from_accumulator()
126 * to overlook fields which should not be zero-initialized. in mps_reader_zero()
133 .commit = 0, in mps_reader_zero()
152 rd->acc = acc; in mbedtls_mps_reader_init()
153 rd->acc_len = acc_len; in mbedtls_mps_reader_init()
181 unsigned char *acc = rd->acc; in mbedtls_mps_reader_feed()
182 mbedtls_mps_size_t acc_remaining = rd->acc_share.acc_remaining; in mbedtls_mps_reader_feed()
183 mbedtls_mps_size_t acc_available = rd->acc_available; in mbedtls_mps_reader_feed()
200 acc_remaining -= copy_to_acc; in mbedtls_mps_reader_feed()
205 rd->acc_share.acc_remaining = acc_remaining; in mbedtls_mps_reader_feed()
206 rd->acc_available = acc_available; in mbedtls_mps_reader_feed()
216 rd->acc_share.frag_offset = acc_available; in mbedtls_mps_reader_feed()
218 rd->acc_available = acc_available; in mbedtls_mps_reader_feed()
222 rd->acc_share.frag_offset = 0; in mbedtls_mps_reader_feed()
225 rd->frag = new_frag; in mbedtls_mps_reader_feed()
226 rd->frag_len = new_frag_len; in mbedtls_mps_reader_feed()
227 rd->commit = 0; in mbedtls_mps_reader_feed()
228 rd->end = 0; in mbedtls_mps_reader_feed()
247 end = rd->end; in mbedtls_mps_reader_get()
255 * - Allowed #1 in mbedtls_mps_reader_get()
257 * +-----------------------------------+ in mbedtls_mps_reader_get()
259 * +-----------------------------------+ in mbedtls_mps_reader_get()
263 * +-----v-------v-------------+ in mbedtls_mps_reader_get()
265 * +---------------------------+ in mbedtls_mps_reader_get()
269 * - Allowed #2 in mbedtls_mps_reader_get()
271 * +-----------------------------------+ in mbedtls_mps_reader_get()
273 * +-----------------------------------+ in mbedtls_mps_reader_get()
277 * +----------v----------------v in mbedtls_mps_reader_get()
279 * +---------------------------+ in mbedtls_mps_reader_get()
283 * - Not allowed #1 (could be served, but we don't actually use it): in mbedtls_mps_reader_get()
285 * +-----------------------------------+ in mbedtls_mps_reader_get()
287 * +-----------------------------------+ in mbedtls_mps_reader_get()
291 * +------v-------------v------+ in mbedtls_mps_reader_get()
293 * +---------------------------+ in mbedtls_mps_reader_get()
298 * - Not allowed #2 (can't be served with a contiguous buffer): in mbedtls_mps_reader_get()
300 * +-----------------------------------+ in mbedtls_mps_reader_get()
302 * +-----------------------------------+ in mbedtls_mps_reader_get()
306 * +------v--------------------+ v in mbedtls_mps_reader_get()
308 * +---------------------------+ in mbedtls_mps_reader_get()
320 if( frag_offset - end < desired ) in mbedtls_mps_reader_get()
323 acc_available = rd->acc_available; in mbedtls_mps_reader_get()
324 if( acc_available - end != desired ) in mbedtls_mps_reader_get()
341 acc = rd->acc; in mbedtls_mps_reader_get()
349 rd->end = end; in mbedtls_mps_reader_get()
350 rd->pending = 0; in mbedtls_mps_reader_get()
359 frag_len = rd->frag_len; in mbedtls_mps_reader_get()
360 frag_fetched = end - frag_offset; /* The amount of data from the current in mbedtls_mps_reader_get()
363 frag_remaining = frag_len - frag_fetched; /* Remaining data in fragment */ in mbedtls_mps_reader_get()
377 rd->pending = desired - frag_remaining; in mbedtls_mps_reader_get()
379 "Remember to collect %u bytes before re-opening", in mbedtls_mps_reader_get()
380 (unsigned) rd->pending ); in mbedtls_mps_reader_get()
391 frag = rd->frag; in mbedtls_mps_reader_get()
399 rd->end = end; in mbedtls_mps_reader_get()
400 rd->pending = 0; in mbedtls_mps_reader_get()
411 end = rd->end; in mbedtls_mps_reader_commit()
412 rd->commit = end; in mbedtls_mps_reader_commit()
421 mbedtls_mps_size_t pending, commit; in mbedtls_mps_reader_reclaim() local
431 frag = rd->frag; in mbedtls_mps_reader_reclaim()
432 acc = rd->acc; in mbedtls_mps_reader_reclaim()
433 pending = rd->pending; in mbedtls_mps_reader_reclaim()
434 commit = rd->commit; in mbedtls_mps_reader_reclaim()
435 frag_len = rd->frag_len; in mbedtls_mps_reader_reclaim()
442 "No unsatisfied read-request has been logged." ); in mbedtls_mps_reader_reclaim()
445 if( commit < frag_offset || commit - frag_offset < frag_len ) in mbedtls_mps_reader_reclaim()
449 rd->end = commit; in mbedtls_mps_reader_reclaim()
453 rd->acc_available = 0; in mbedtls_mps_reader_reclaim()
454 rd->acc_share.acc_remaining = 0; in mbedtls_mps_reader_reclaim()
482 acc_len = rd->acc_len; in mbedtls_mps_reader_reclaim()
486 if( commit < frag_offset ) in mbedtls_mps_reader_reclaim()
491 acc_backup_offset = commit; in mbedtls_mps_reader_reclaim()
492 acc_backup_len = frag_offset - commit; in mbedtls_mps_reader_reclaim()
497 frag_backup_offset = commit - frag_offset; in mbedtls_mps_reader_reclaim()
498 frag_backup_len = frag_len - frag_backup_offset; in mbedtls_mps_reader_reclaim()
514 * since the last commit. */ in mbedtls_mps_reader_reclaim()
515 rd->end = commit; in mbedtls_mps_reader_reclaim()
516 rd->pending = 0; in mbedtls_mps_reader_reclaim()
543 rd->acc_available = backup_len; in mbedtls_mps_reader_reclaim()
544 rd->acc_share.acc_remaining = pending; in mbedtls_mps_reader_reclaim()
550 rd->frag = NULL; in mbedtls_mps_reader_reclaim()
551 rd->frag_len = 0; in mbedtls_mps_reader_reclaim()
553 rd->commit = 0; in mbedtls_mps_reader_reclaim()
554 rd->end = 0; in mbedtls_mps_reader_reclaim()
555 rd->pending = 0; in mbedtls_mps_reader_reclaim()
559 (unsigned) rd->acc_available, (unsigned) rd->acc_len, in mbedtls_mps_reader_reclaim()
560 (unsigned) rd->acc_share.acc_remaining ); in mbedtls_mps_reader_reclaim()