op_sar_rsmbuf_seg_insert()

Abstract

Inserts the specified segment into the specified reassembly buffer.

Syntax

op_sar_rsmbuf_seg_insert (sb_hndl, seg_pkptr)
Argument Type Description
sb_hndl Sbhandle handle identifying the reassembly buffer-of-interest
[This value must identify a Sar reassembly buffer. A Sar buffer handle is obtained when a buffer is created via the KP op_sar_buf_create().]
seg_pkptr Packet* pointer to the segment to be inserted into the buffer
[Sar segments are represented as standard packets, and can be handled by all Pk package KPs; however, their internal data contents is typically only accessed by Sar package KPs to perform reassembly or resegmentation tasks. A pointer to a packet representing a Sar segment is usually first obtained from the KP op_sar_srcbuf_seg_get().]

Return Type

void

No return value.

Example

/* Obtain an arriving segment. */
seg_pkptr = op_pk_get (SEG_INSTRM);

/* Insert the segment into reassembly buffer. */
op_sar_rsmbuf_seg_insert (rsm_sbh, seg_pkptr);

/* Determine the number of complete source packets in reassembly buffer. */
comp_pk_count = op_sar_rsmbuf_pk_count (rsm_sbh);

/* Loop through all complete source packets in reassembly buffer. */
for (pk_index = 0; pk_index < comp_pk_count; pk_index++)
	{
	/* Remove a complete source packet. */
	src_pkptr = op_sar_rsmbuf_pk_remove (rsm_sbh);

	/* Add source packet to internal sub-queue. */
	op_subq_pk_insert (0, src_pkptr, OPC_QPOS_TAIL);
	}

Details

Unlike segmentation or resegmentation buffers, reassembly buffers do not simply have inserted packets placed at the “tail” of the buffer (the tail being the arrival end of an ordered list of buffer packets). The internal structure of reassembly buffers is more complex than the other buffer types, and actually includes two separate ordered lists of source packets: an incomplete list and a complete list.

  • The incomplete list holds incomplete source packets, and absorbs arriving Sar segments as they are inserted into the reassembly buffer. The order of incomplete source packets in this list is based on the arrival sequence of the first segment of each packet.
  • The complete list holds complete source packets, and has packets transferred to it from the incomplete list as they are completed. The order of complete source packets in this list is based on the completion sequence of source packets. Packets removed from the reassembly buffer are taken from the head of this list.

Purpose

Provides a mechanism for inserting a Sar segment into a reassembly buffer, for addition to source packets undergoing reassembly (there is no other mechanism for placing Sar segments into a Sar reassembly buffer). This KP also will accept and insert source packets into the specified reassembly buffer, providing a convenient way to process both segmented and non-segmented packets. Reassembly buffers patch inserted segments together into complete source packets, which can be removed upon completion via the KP op_sar_rsmbuf_pk_remove(). Since source packets are only completed in a reassembly buffer in response to the insertion of new Sar segments, it is usually appropriate to attempt to remove complete source packets immediately after inserting Sar segments (or source packets) into a reassembly buffer.

Errors

  • Standard Sar errors (see Table 15)
  • Program Abort: Buffer handle references destroyed buffer.
  • Program Abort: Buffer type (<type>) is invalid for this KP, should be (reassembly).
  • Program Abort: Packet pointer references unowned packet (<pkid>)
  • Program Abort: Packet pointer references static packet (<pkid>)
  • Program Abort: Segment packet (<seg_pkid>) refers to invalid packet (<src_pkid>)
  • Program Abort: Virtual memory limits exceeded. Too many allocated objects.
  • Recoverable Error: Allocation of object block failed / Object type (<ob_type>).

Reference

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · 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