AG ISDN Messaging API Developer's Reference Manual (6272-17): Alphabetical Function Reference
(Page 3 of 6 in this chapter)
isdnSendMessage
Description
- Sends a message to the ISDN stack, with optional attached data.
Prototype
- DWORD isdnSendMessage ( CTAHD ctahd,
ISDN_MESSAGE *message,
void *pdata,
unsigned size )
- ctahd CTA context handle associated with a D channel, returned by ctaCreateContext.
- message Pointer to ISDN_MESSAGE structure, as follows:
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;
- pdata Pointer to the message data (if any). The data is specific to the type of message specified in ISDN_MESSAGE.
- size Size of data block referenced by pdata. size must match the data_size field in the ISDN_MESSAGE structure.
Return Values
Events
Details
- This function sends a message with optional attached data to the ISDN subsystem. Any ISDN-specific command can be sent to any layer of the protocol stack using this function. The ISDN_MESSAGE structure contains the addressing information for the message.
- The size field of the CTA event contains the user id for the message, as specified in the userid field in ISDN_MESSAGE. This value is sent to distinguish between multiple messages sent to the protocol stack. ISDN_ USERID_ASYNC is reserved for events initiated by the protocol stack.
See Also
- isdnReleaseBuffer
Example
sample_send_message (CTAHD ctahd, int mycode)
{
CTA_EVENT event;
DWORD ret;
ISDN_MESSAGE imsg={0};
code_t code;
unsigned char idata[MAX_ISDN_BUFFER_SIZE];
unsigned datasize;
;
{
;
/*
** Protocol already started
*/
imsg.nai = 0;
/*
** when using ACU, all messages should be directed
** to ENT_ACU and the ACU_SAPI within it.
** The from field should always be ENT_API.
*/
imsg.from_ent = ENT_API;
imsg.to_ent = ENT_CC;
imsg.to_sapi = ACU_SAPI;
/*
** The connection id is the logical connection number.
** For ACU, the lowest unused connection id value must be used.
*/
imsg.add.conn_id = myGetLowestConnectionId();
/*
** Build the contents of the message for place call, release call, etc.
** This should fill the idata with the message contents and return the
** used part of the data buffer in datasize argument and the code for the
** function requested (ACU_CONN_RQ, ACU_CLEAR_RQ, etc).
*/
myBuildMessage( mycode, idata, &datasize, &code);
imsg.datasize = datasize;
imsg.code = code;
/*
** Add an ISDN-specific user id to identify this message if it fails:
*/
imsg.userid = myGetNextMessageId();
ret = isdnSendMessage( ctahd, &imsg, idata, datasize);
if( ret != SUCCESS)
{
ctaGetText(ctahd, ret, errortext, 40;
printf("SEND_FAIL: %s mg id=%x\n", errortext, imsg.userid );
return MY_ERROR_SEND_FAILED;
}
myWaitForEvent( ctahd, &event)
if( event.value != SUCCESS)
{
ctaGetText(ctahd, event.value, errortext, 40);
printf("SEND_FAIL: %s mg id=%x\n", errortext, imsg.userid );
return MY_ERROR_SEND_FAILED;
}
...
}
(Page 3 of 6 in this chapter)
tech_support@nmss.com
Copyright © 1999, Natural MicroSystems, Inc. All rights
reserved.