Solstice X.25 9.2 Developer's Guide

6.4.7 N_DI--Clear Request/Indication

Synopsis
#include <stream.h>
 #include <netx25/x25_proto.h >

 struct strbuf ctlb;
 struct strbuf datab;

 struct xdiscf disc;
 char          cud[MAX_LENGTH];
 .
 .
 .
 ctlb.len = sizeof(struct xdiscf);
 ctlb.buf = (char *)disc;

 datab.len = cudlen;
 datab.buf = cud;

 putmsg(x25_fd, &ctlb, &datab, 0);
Description

N_DI is used when a Clear Request/Indication crosses the X.25 interface. When used with putmsg, N_DI is a Clear Request, when used with getmsg, it is a Disconnect Indication. Example 6-1shows how a getmsg can be constructed. The control part of the Call Request or Indication is defined by the xdiscf structure. If Fast Select is in use, the data part of the message contains any clear user data.

The X.25 cause and diagnostic bytes, cause and diag, are presented, as well as the CONS originator and reason codes mapped from these. For a Clear Request the user can specify a non-zero cause code. This has no effect for an OSI CONS call; the value is set to zero by the system.

The Clear Request from an application is confirmed unless it is a rejection of a previous Connect Indication. When it is not a rejection, the X.25 driver sends a Clear Confirm to the application when the Clear Confirmation is received. This guarantees that once the Clear Confirm is read by the application no more messages are sent on this stream. For this reason, after requesting disconnection, the application should read and discard all messages from the stream until the Clear Confirm is received.

For call rejection, no acknowledgment is sent. However, the application must supply the connection identifier presented in the Connect Indication so that the appropriate circuit is cleared. In the case of a Disconnect Indication, all messages sent downstream except connect messages are discarded silently.

The xdiscf structure is shown below:

struct xdiscf {
 	unsigned char xl_type; /* Always XL_CTL */
 	unsigned char xl_command; /* Always N_DI */
 	unsigned char originator, /* Originator and Reason mapped
                                  from */
 		reason, /* X.25 cause/diag in indications */
 		cause, /* X.25 cause byte */
 		diag; /* X.25 diagnostic byte */
 	int conn_id; /* The connection id (for reject only) */
 	unsigned char indicated_qos; /* When set, facilities
                                     indicated */
 	struct xaddrf responder; /* CONS responder address */
 	struct xaddrf deflected; /* Deflected address */
 	struct qosformat qos; /* If indicated_qos is set, holds
                              facilities and CONS qos */
 };

The members of the xdiscf structure are.

Table 6-12 Clear Request/Indication Parameters

member 

Description 

originator

OSI CONS mapping of the X.25 cause byte. 

reason

OSI CONS mapping of the X.25 diagnostic byte. Refer to Chapter 9, Error Codes for further information.

cause

The X.25 cause byte. 

diag

The X.25 diagnostic byte. 

indicated_qos

Non-zero value shows that facilities and QOS are being indicated. 

responder

Contains the responding address. 

deflected

Used in conjunction with the call_deflect facility in the qos structure to convey the address of the remote DTE that the call is to be deflected to.

qos

Contains the facilities indicated. This is used with the Charging Information facility and the Call Deflection facility. 


Note -

If a disconnect collision occurs, acknowledgement is taken to be complete.