|
|
The reference SMUX peer invokes the routine smux_register when it is ready to terminate the SMUX association with the local agent. smux_register sends an RReqPDU to the agent, with ``priority'' set to -1 and ``operation'' set to 0; this un-registers the peer's highest priority registration for the specified MIB module:
Then the peer calls smux_close, which packages an SMUX_PDUs_close PDU, encodes it in ASN.1 format, sends the PDU to the agent, and then closes the TCP end-point.void close_conn() { /* * - De-register the subtrees that were previously registered * - Then gracefully close the smux connection * - and then the tcp connection itself. */
for (tc = triples; tc->t_tree; tc++) smux_register (tc -> t_name, -1, 0); smux_close(goingDown); exit(0); }
smux_close takes one argument, which will be one of the following: goingDown, packetFormat, unsupportedVersion, protocolError, internalError, or authenticationFailure. See the previous section ``Terminating an SMUX association'' within the section ``An SMUX overview'' for an explanation of these error codes.
If this routine fails, it sets smux_errno to one of the following: congestion, invalidOperation, or youLoseBig. See the following section ``Error recovery'' for an explanation of these error codes.