op_sar_srcbuf_bits_flush()

Abstract

Flushes the specified range of bits from the specified source buffer (either a segmentation or resegmentation buffer).

Syntax

op_sar_srcbuf_bits_flush (sb_hndl, bit_index_loc, bit_count)
Argument Type Description
sb_hndl Sbhandle handle identifying the source buffer-of-interest
[This value must identify a Sar source buffer (i.e., either a segmentation or a resegmentation buffer). A Sar buffer handle is obtained when a buffer is created via the KP op_sar_buf_create().]
bit_index_loc OpT_Sar_Size local index of the first bit in the range to be flushed from the buffer
[A local index is a numeric value that indicates the position in a Sar buffer of the first bit within a specified range of bits. Local index values vary from 0 (for the first bit in the buffer) to N-1 (where N is the number of bits in the buffer, for the last bit in the buffer).]
bit_count OpT_Sar_Size number of bits in the range to be flushed from the buffer

Return Type

Compcode

Completion code indicating whether the specified bit-range was successfully flushed.

[This value can be compared to the two symbolic constants OPC_COMPCODE_SUCCESS and OPC_COMPCODE_FAILURE.]

Example

/* Receive an acknowledgement from the peer process. */
ack_pkptr = op_pk_get (ACK_INSTRM);

/* Determine the sequence number of the source packet being acknowledged. */
op_pk_nfd_get (ack_pkptr, "ack_pk_seqnum", &new_ack_pk_seqnum);

/* Check if new acknowledgment progressed past last acknowledgment. */
if (new_ack_pk_seqnum > old_ack_pk_seqnum)
	{
	/* Determine the buffer-local bit-range of new acknowledgment. */
	op_sar_rsgbuf_lbl_pk_range_get (rsg_sbh, new_ack_pk_seqnum,
		&new_ack_bit_index, &new_ack_bit_count);

	/* Flush the resegmentation buffer of acknowledged bits. */
	op_sar_srcbuf_bits_flush (rsg_sbh, new_ack_bit_index, new_ack_bit_count);

	/* Reset new acknowledgement as old acknowledgement. */
	old_ack_pk_seqnum = new_ack_pk_seqnum;
	}

Details

The bit-range to be flushed by this KP is specified using the local bit index of the first bit of the range. Occasionally, the local bit index of a bit-range can be assumed without any computation, as in the cases where the whole buffer will be flushed, or the first N bits of the buffer will be flushed (local index of 0 in both cases). However, it is frequently useful to flush a buffer of a bit-range associated with a specific source packet or Sar segment. This capability requires KPs that respectively translate the labels of a source packet or Sar segment into a local index-based bit-range: op_sar_rsgbuf_lbl_pk_range_get() and op_sar_rsgbuf_lbl_seg_range_get(). As is apparent from the KP names, this capability is limited to resegmentation buffers.

Flushing a range of bits from a Sar buffer permanently takes them out of the sequence of bits stored in the buffer. If a flushed bit-range is not at the head of the buffer, the buffer’s remaining bits will have a “sequential jump” at the location of the flushed bit-range. If the specified bit-range includes all bits in the buffer associated with a particular segment or source packet, then the segment or source packet association will also be flushed from the buffer. If the specified bit-range includes portions of the bits in the buffer associated with a particular segment or source packet, then the segment or source packet association will be reduced by the flushed portions.

Both the bit_index_loc and bit_count arguments are 64-bit integer numbers to accommodate large ranges.

Purpose

Provides a mechanism to flush a range of bits from a segmentation or resegmentation buffer. The range is identified by the local index of its first bit, and its length. Most invocations of this KP are applied to resegmentation buffers, although flushing a bit-range from a segmentation may occasionally be necessary (for instance, a segmentation buffer can be completely flushed when the bit-range has a length equal to the number of bits in the buffer). Flushing bit-ranges from resegmentation buffers is typically performed when these buffers are being used for retransmission purposes (i.e., to store copies of transmitted data for potential retransmission due to packet loss, excessive delays, etc.). In these cases, when a range of transmitted data has been correctly received, it can be flushed from the reseg. buffer, since it will no longer be needed as “insurance”.

Errors

  • Standard Sar errors (see Table 15)
  • Program Abort: Number of bits value (<bit_count>) must be greater than 0.
  • Program Abort: Buffer type (reassembly) is invalid for this KP, should be (segmentation or resegmentation).
  • Recoverable Error: Index (<bit_index_loc>) is invalid. / Value must be >= 0.
  • Recoverable Error: Combination of number of bits (<bit_count>) and index is invalid. Value must be less than the size of the buffer.

Reference

  • Use the KP op_sar_rsgbuf_lbl_pk_range_get() to determine the local bit index and length of the bit-range associated with a specific source packet in a resegmentation buffer
  • Use the KP op_sar_rsgbuf_lbl_seg_range_get() to determine the local bit index and length of the bit-range associated with a specific Sar segment in a resegmentation buffer
  • Use the KP op_sar_rsgbuf_bits_flush_abs() to flush a bit-range, identified by absolute bit index and length, from a resegmentation buffer
  • Use the KP op_sar_buf_size() to determine the number of bits stored in a Sar buffer

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com