Version



|
|
Asynchronous
|
Synchronous
|
|---|---|---|
|
Operation complete when function returns
|
NO
|
YES
|
|
Returns a DONE event when function is complete
|
YES
|
NO
|
|
Function can fail after function returns
|
YES
|
NO
|
Figure 11. Asynchronous Programming Model

Figure 12. NMS ISDN Messaging API Application Flowchart


Figure 13. isdnSendMessage Data Structures
typedef struct ISDN_MESSAGE
{
nai_t nai; /* Network access interface index */
ent_id_t from_ent;/* Message source */
ent_id_t to_ent; /* Message destination */
sapi_t to_sapi; /* Destination Service Access Point */
union {
add_t conn_id; /* Connection identifier for the ACU layer */
add_t crv; /* Call Reference value for the NS layer. Not used. */
add_t ces; /* Connection Endpoint suffix (DL later upper half) */
add_t tei; /* Terminal Endpoint ID (DL layer lower half). Not used.*/
add_t chani; /* Physical layer channel identifier. Not used. */
} add;
code_t code; /* Primitive code unique only between two entities */
WORD inf0; /* Information location 0 */
WORD inf1; /* Information location 1 */
WORD inf2; /* Information location 2 */
WORD inf3; /* Information location 3 */
WORD inf4; /* Information location 4 */
WORD data_size; /* Size of data to follow */
WORD nfas_group; /* NFAS group number */
DWORD userid; /* User ID */
} ISDN_MESSAGE;

void build_cc_conn_rs(char *buffer, int *len, char ts)
{
struct acu_conn_rs_args *p_data;
p_data = (struct acu_conn_rs_args *)buffer;
memset(p_data, OFF, ISDN_BUFFER_DATA_LGTH);
/* Fill in two fields using macros*/
Acu_conn_rs_data_chani = ts; /* T1/E1 time-slot */
Acu_conn_rs_data_chani_nb = 1; /* Only one B channel */
/* User to user information could go here */
*len = sizeof( struct acu_conn_rs_args );
return;
}


typedef struct CTA_EVENT
{
DWORD id; /* Event code (and source service ID) */
CTAHD ctahd; /* Context handle */
DWORD timestamp; /* Timestamp */
DWORD userid; /* User ID (defined by ctaCreateContext) */
DWORD size; /* Size of buffer if buffer != NULL */
void *buffer; /* Buffer pointer */
DWORD value; /* Event status or event-specific data */
DWORD objHd; /* Service client side object handle */
} CTA_EVENT;

Figure 14. Receiving Protocol Stack Messages
cta_ret = ctaWaitEvent(ctaqueuehd, &cta_event, CTA_WAIT_FOREVER);
if (cta_ret != SUCCESS)
{
printf("isdnproc: ctaWaitEvent failure %d %x\n",
cta_ret, cta_ret);
continue;
}
/* We have an event -- switch on the type */
switch (cta_event.id)
{
.
.
.
case ISDNEVN_RCV_MESSAGE:
/* Pick up the ISDN_PACKET structure */
isdnpkt = (ISDN_PACKET *)adi_event.buffer;
isdnmsg = (ISDN_MESSAGE *)&isdnpkt->message;
/* Extract information from the ISDN incoming packet */
message = isdnmsg->code;
sender = isdnmsg->from_ent;
recipient = isdnmsg->to_ent;
CRN = isdnmsg->add.conn_id;
Version