(Page 1 of 1 in this chapter)
|
|
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. AG ISDN Messaging API Application Flowchart
- A message structure (if needed). For messages that require additional data, a message structure is sent containing the data. The data differs for each message type. For details on each message type, see Chapter 8.

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 pad; /* Pad */
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 id (LIBEVN_xxx in `libdef.h') */
CTAHD ctahd; /* CTA context handle */
DWORD timestamp;/* Timestamp */
DWORD userid; /* User-supplied ID */
DWORD size; /* Size of buffer if buffer is not NULL */
void *buffer; /* Buffer pointer */
DWORD value; /* Event status or reason or other data */
DWORD reserved; /* Must be 0 */
} CTA_EVENT;
|
This prefix...
|
Indicates...
|
|---|---|
|
CTAEVN
|
A CT Access event.
|
|
ADIEVN
|
An ADI service event.
|
|
ISDNEVN
|
An AG ISDN 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;
(Page 1 of 1 in this chapter)