Managing Protocol Services

Push

lgo_Push()

Stack one protocol service on top of another.

Syntax
#include "laygo.h"

LResult lgo_Push
    (
        LCid    stackTop,
        LCid    newTop
    );
stackTopconnection currently on top of the stack
newTopconnection to be placed on top of the stack
Description

lgo_Push() stacks one connection on another or one connection on a stack of others. The connections must both be in the open state to push them. This is the mechanism by which layered protocols such as X.25 are created. First the individual layers are opened and then they are arranged in the proper order using lgo_Push().

Return Values

If successful, lgo_Push() returns a non-negative value. Otherwise, it returns a negative value indicating the reason it failed. Possible unsuccessful return values are:

See Also

lgo_Pop()

Example
LCid    physicalLayer;
LCid    linkLayer;

/* Open the physical layer */
if ((physicalLayer = lgo_Open("X21_0")) < 0)
{
    return (FAILURE);
}

/* Open the link layer */
if ((linkLayer = lgo_Open("LAPB_0")) < 0)
{
    lgo_Close(physicalLayer);
    return (FAILURE);
}

/* Push the link layer onto the physical */
lgo_Push(physicalLayer, linkLayer);