op_sar_pk_is_segment()
Abstract
Determines if the specified packet is a Sar segment.
Syntax
op_sar_pk_is_segment (pkptr)
| Argument | Type | Description |
|---|---|---|
pkptr |
Packet* |
pointer to the packet-of-interest [A pointer to a packet can be obtained from many KPs; in the context of this KP, the most common sources of a packet pointer are op_pk_copy(), op_pk_get(), op_subq_pk_access(), and op_subq_pk_remove().] |
Return Type
Boolean
Boolean value indicating whether the specified packet is a Sar-derived segment of a source packet.
[The returned value is OPC_TRUE if the packet is a segment, and OPC_FALSE otherwise.]
Example
/* Receive an incoming packet. */
pkptr = op_pk_get (INSTRM_1);
/* Determine if the received packet is a segment, or normal packet. */
if (op_sar_pk_is_segment (pkptr) == OPC_TRUE)
{
/* Received a segment; add to reassembly buffer. */
op_sar_rsmbuf_seg_insert (rsm_sbh, pkptr);
/* See if any packets are ready to be removed from reassembly buffer. */
while ((pkptr = op_sar_rsmbuf_pk_remove (rsm_sbh)) != OPC_NIL)
op_pk_send (pkptr, OUTSTRM_1);
}
else
{
/* Received a normal packet; forward on to output stream. */
op_pk_send (pkptr, OUTSTRM_1);
}
Details
If simulation packets (Packet data structure) have never been processed by Sar package KPs, then they are considered “normal” packets. op_sar_pk_is_segment() returns OPC_FALSE if applied to these packets.
Packets inserted into a Sar segmentation buffer are termed source packets. The segmentation buffer splits or combines source packets into Sar segments, which are removed or accessed (copied) from the buffer via Sar KPs.
Sar segments are represented using the standard Packet data structure, and they are treated as normal packets with respect to the Pk package and packet-processing objects such as queues, transceivers, and links. However, segments have special internal accounting information relevant to source packet reassembly that can only be manipulated by Sar KPs. op_sar_pk_is_segment() returns OPC_TRUE if applied to Sar segments.
Sar segments can be inserted into Sar resegmentation buffers, which will reset the boundaries of the segments as needed to satisfy segment removal requests. Packets removed from resegmentation buffers are also Sar segments. Sar segments can also be inserted into Sar segmentation buffers, which will split or combine the segment into other Sar segments.
Sar segments can be inserted into Sar reassembly buffers, which reconstruct the segments into source packets if provided with all necessary constituent segments. The reassembled source packets may be normal packets, or they may be Sar segments that had been recursively segmented.
Purpose
Provides a mechanism for determining if a particular packet is a segment created by the Sar package, or a normal packet that has not been processed by the Sar package. This packet classification capability is necessary when a process model will encounter both types of packets, and it must provide different processing for each type of packet.
Errors
- Standard Sar errors (see Table 15)
- Abort: Packet pointer references destroyed packet
Reference
- Use the KP op_sar_rsmbuf_seg_insert() to insert a Sar segment into a reassembly buffer
- Use the KP op_sar_rsgbuf_seg_insert() to insert a Sar segment into a resegmentation buffer
- Use the KP op_sar_segbuf_pk_insert() to insert a source packet into a segmentation buffer