lgo_Push()
Stack one protocol service on top of another.
#include "laygo.h" LResult lgo_Push ( LCid stackTop, LCid newTop );
stackTop | connection currently on top of the stack |
newTop | connection to be placed on top of the stack |
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().
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:
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);