op_sar_buf_size()
Abstract
Obtains the number of bits stored in the specified buffer.
Syntax
op_sar_buf_size (sb_hndl)
| Argument | Type | Description |
|---|---|---|
sb_hndl |
Sbhandle |
handle identifying the buffer-of-interest [This value can identify any of the three Sar buffer types: segmentation, reassembly, or resegmentation. A Sar buffer handle is obtained when a buffer is created via the KP op_sar_buf_create().] |
Return Type
OpT_Sar_Size
Total number of bits stored in the specified buffer.
Example
/* Obtain a segment from input stream. */
seg_pkptr = op_pk_get (SEG_INSTRM);
/* Determine the size of the segment. */
seg_size = op_pk_total_size_get (seg_pkptr);
/* Loop from 3 minutes to 20 seconds, successively reducing the flush time */
/* and flushing the reassembly buffer of packets older than this time. Stop */
/* when the buffer is less than threshold value for adding new segment. */
for (ft = 180.0, buf_overflow = 0; ((pksize + op_sar_buf_size (rsm_sbh))
> MAX_RSM_BUF_SIZE); ft -= 20.0)
{
if (ft == 0.0) { buf_overflow = 1; break; }
/* Flush buffer using current iteration of flush time. */
op_sar_rsmbuf_pk_flush (rsm_sbh, ft);
}
/* Insert segment into reassembly buffer if buffer overflow has not occurred. */
if (!buf_overflow)
op_sar_rsmbuf_seg_insert (rsm_sbh, seg_pkptr);
Details
This KP can be applied to all three types of Sar buffer. The definition of the total number of bits in a Sar buffer is always comprehensive, but the computation method depends on the type of buffer:
- segmentation buffer—sum of the bits contained in all stored source packets awaiting segmentation, including the first packet, which may be partially reduced due to segmentation.
- resegmentation buffer—sum of the bits contained in all stored segments, including the first segment, which may be partially reduced due to resegmentation.
- reassembly buffer—sum of the bits contained in all stored source packets, including complete and incomplete packets.
Purpose
Provides a mechanism for determining the number of data bits stored in a Sar buffer. This is useful when a Sar buffer is representing a packet data storage resource in a real system, and the utilization of that resource is a concern. For instance, the available storage for packet reassembly at a real node may be limited, so the size of a Sar reassembly buffer that represents this storage will have to be monitored and restricted.
Errors
- Standard Sar errors (see Table 15)
Reference
- Use the KP op_pk_total_size_get() to determine the number of bits in a source packet or Sar segment
- Use the KP op_sar_buf_print() to print detailed information about a Sar buffer to the standard output
- Use the KP op_sar_buf_create() to create a Sar buffer