qcc_unpack(3)
NAME
qcc_unpack, qcc_unpack_setup, qcc_unpack_call_proceeding, qcc_unpack_connect, qcc_unpack_connect_ack, qcc_unpack_release, qcc_unpack_release_complete, qcc_unpack_status, qcc_unpack_status_enq, qcc_unpack_restart, qcc_unpack_restart_ack, qcc_unpack_add_party, qcc_unpack_add_party_ack, qcc_unpack_add_party_reject, qcc_unpack_drop_party, qcc_unpack_drop_party_ack − decode Q.2931 messages and unpack into message structures
SYNOPSIS
cc [ flag ... ] file ... −latm [ library ... ]
#include <atm/types.h>
#include <atm/qcc.h>
int qcc_unpack_setup(qcc_setup_t ∗msgp, strbuf_t ∗datap);
int qcc_unpack_call_proceeding(qcc_call_proc_t ∗msgp, strbuf_t ∗datap);
int qcc_unpack_connect(qcc_connect_t ∗msgp, strbuf_t ∗datap);
int qcc_unpack_connect_ack(qcc_connect_ack_t ∗msgp, strbuf_t ∗datap);
int qcc_unpack_release(qcc_release_t ∗msgp, strbuf_t ∗datap);
int qcc_unpack_release_complete(qcc_release_complete_t ∗ msgp, strbuf_t ∗datap);
int qcc_unpack_status_enq(qcc_status_enq_t ∗msgp, strbuf_t ∗datap);
int qcc_unpack_status(qcc_status_t ∗msgp, strbuf_t ∗datap);
int qcc_unpack_restart(qcc_restart_t ∗msgp, strbuf_t ∗datap);
int qcc_unpack_restart_ack(qcc_restart_ack_t ∗msgp, strbuf_t ∗datap);
int qcc_unpack_add_party(qcc_add_party_t ∗msgp, strbuf_t ∗datap);
int qcc_unpack_add_party_ack(qcc_add_party_ack_t ∗msgp, strbuf_t ∗datap);
int qcc_unpack_add_party_reject(qcc_add_party_reject_t ∗ msgp, strbuf_t ∗datap);
int qcc_unpack_drop_party(qcc_drop_party_t ∗msgp, strbuf_t ∗datap);
int qcc_unpack_drop_party_ack(qcc_drop_party_ack_t ∗msgp, strbuf_t ∗datap);
MT-LEVEL
Safe.
AVAILABILITY
The functionality described in this man page is available in the SUNWatma package included with the SunATM adapter board. The libatm.a library, which is located in /usr/lib, must be included at compile time as indicated in the synopsis.
DESCRIPTION
These functions take streams buffers containing encoded Q.2931 messages as input and decode the information, placing the extracted values into the appropriate message structure. The Q.2931 protocol is used for ATM signalling; a full description of the message format and use can be found in the ATM Forum’s User Network Interface Specification, V3.0 or V3.1. Messages conforming to both versions of the UNI standard will be decoded. The functions may be used by processes which are running in user space.
In general, no error checking is performed on the data that is extracted from the message. Whatever data is found will be placed in the message structure without examination.
Each function requires 2 parameters: msgp, which is a pointer to the appropriate message structure; and datap, which is a pointer to a strbuf_t buffer.
datap is the data portion of a received message, corresponding to the M_DATA block of the message that was received from downstream.
The message structure pointed to by msgp should be allocated by the user program which calls a qcc_unpack function.
RETURN VALUES
All functions return 0 on success and -1 on error. The returned message structure contains an entry for each possible Information Element for that message type; if an Information Element is found in the received message, the "valid" field for that IE will be set to 1. If the IE was not found, the "valid" field will be 0.
EXAMPLES
The following code fragment receives a setup message and prints elements in the message structure.
#include <atm/types.h>
#include <atm/qcc.h>
#include <atm/limits.h>
void
wait_for_setup(int fd);
{
int flags = 0;
int vci = -1;
int sap = -1;
qcc_hdr_t ∗hdrp;
qcc_setup_t setup;
struct strbuf ctl, data;
char ctlbuf[QCC_MAX_CTL_LEN];
char databuf[QCC_MAX_DATA_LEN];
ctl.buf = ctlbuf;
data.buf = databuf;
ctl.len = data.len = 0;
ctl.maxlen = QCC_MAX_CTL_LEN;
data.maxlen = QCC_MAX_DATA_LEN;
if (getmsg(fd, &ctl, &data, &flags) < 0) {
perror("getmsg");
exit (-1);
}
hdrp = qcc_get_hdr(&ctl);
if ((hdrp) && (hdrp->type == QCC_SETUP)) {
if ((qcc_unpack_setup(&setup, &data)) < 0) {
printf("parse_setup failed\n");
exit (-1);
}
if (setup.conn_id.valid)
vci = setup.conn_id.vci;
if (setup.bhli.valid)
memcpy((caddr_t) &sap,
(caddr_t) setup.bhli.info, 4);
printf("parse_setup: vci=0x%x, sap=0x%x\n",
vci, sap);
}
}
SEE ALSO
qcc_len(3), qcc_create(3), qcc_set_ie(3), qcc_pack(3), qcc_util(3), q93b(7)
"ATM User-Network Interface Specification, V3.0," ATM Forum.
NOTES
This API is an interim solution until the ATM Forum has standardized an API. At that time, Sun will implement that API, and support for the Q.2931 Call Control library may not be continued.
SunOS ATM_2.0 — Last change: 30 Nov 1995