#include <stream.h> #include <netx25/x25_proto.h > struct strbuf ctlb; struct strbuf datab; struct xcallf call; char cud[MAX_LENGTH]; . . . ctlb.len = sizeof(struct xcallf); ctlb.buf = (char *)call; datab.len = cudlen; datab.buf = cud; putmsg(x25_fd, &ctlb, &datab, 0);
N_CI is used when calls are requested or indicated across the X.25 interface. When used with putmsg, N_CI is a Call Request, when used with getmsg, it is a Connect Indication. Example 6-1shows how a getmsg can be constructed. The control part of the Call Request or Indication is defined by the xcallf structure. The data part of the message will contain any call user data.
The xcallf structure is shown below:
struct xcallf { unsigned char xl_type; /* Always XL_CTL */ unsigned char xl_command; /* Always N_CI */ int conn_id; /*connection id returned in Call Response or Disconnect */ unsigned char CONS_call; /*When set, indicates a CONS call*/ unsigned char negotiate_qos; /* When set, negotiate facilities etc. or else use defaults */ struct xaddrf calledaddr; /* The called address */ struct xaddrf callingaddr; /* The calling address */ struct qosformat qos; /* Facilities and CONS qos: if negotiate_qos is set */ };
The members of the xcallf structure are:
Table 6-9 Call Request/Indication Message
Member |
Description |
---|---|
conn_id |
For incoming calls, an attempt is made to match the called address and call user data with that of one of the listening applications. If a match is found, then the indication is passed to that application with a conn_id identifier, which must be returned in the Call Response or Clear Request to accept or reject the connection. Leave this value as 0. |
CONS_call |
Indicates that OSI CONS procedures should be used for the call. |
negotiate_qos |
A non-zero value shows that facilities and quality of service (QOS) are being negotiated. A zero value means the initiator is requesting all default values. |
calledaddr |
Holds the called address. |
callingaddr |
The calling address. |
qos |
Any facilities requested or indicated. To use the qos member, you must set negotiate_qos. |