imgtSendMessage

Sends a message to the management manager with attached data.

Prototype

DWORD imgtSendMessage ( CTAHD ctahd, IMGT_MESSAGE *pmessage, unsigned size, void *pbuff )

Argument

Description

ctahd

Context handle returned by ctaCreateContext.

pmessage

Pointer to IMGT_MESSAGE structure.

size

Size of data block.

pbuff

Pointer to the primitive-specific data structure (as specified in the IMGT_CONFIG structure).

typedef struct IMGT_MESSAGE
{
    BYTE nai;             /* Network Access Identifier                 */
    BYTE code;            /* Primitive code                            */
    WORD nfas_group;      /* NFAS group number, only required for 
                             Configurations with duplicate NAI values 
                             on a board                                */
    DWORD status;         /* Status or error for START/STOP            */
} IMGT_MESSAGE
 

 


Return values

Return value

Description

SUCCESS

 

CTAERR_BAD_ARGUMENT

This return value means any of the following:

  • The pmessage argument is NULL.

  • The pbuff is NULL but size is non zero.

  • The size of the data exceeds MAX_IMGT_BUFFER_SIZE.

 

CTAERR_INVALID_HANDLE

The specified context handle is invalid.

IMGTERR_IMGT_NOT_STARTED

A management session has not been initialized.


Events

Event

Reason code

IMGTEVN_SEND_MESSAGE

The event value field contains one of the following reasons or an error code:

SUCCESS

IMGTERR_BUFFER_TOO_BIG
The size of the buffer is too large.


Details

See IMGT_CONFIG structure for a list of valid messages and their associated buffer structures.

Example

void MySendOOS( CTAHD ctahd, unsigned char nai, unsigned char Bchannel )
{
    IMGT_MESSAGE msg;
    char pdata[MAX_IMGT_BUFFER_SIZE];
    unsigned size;
    struct imgt_service *psvc;
    char *errortext="";
     
    /* send SERVICE_RQ on nai to set Bchannel out of service */
    msg.nai = nai;
    msg.code = IMGT_SERVICE_RQ;
     
    psvc = (struct imgt_service *) pdata;
    psvc->type = PREFERENCE_BCHANNEL;
    psvc->nai = msg.nai;
    psvc->Bchannel = Bchannel;
    psvc->status = OUT_OF_SERVICE;
    size = sizeof( struct imgt_service );

    ret = imgtSendMessage( ctahd, &msg, size, pdata );
    if (ret != SUCCESS)
    {
            ctaGetText( ctahd, ret, (char *) errortext, 40);
            printf( "imgtSendMessage failure: %s\n",errortext );
            exit( 1 );
    }
}