# Accessing and reading a Q.931 buffer

To read the raw data in an incoming Q.931 message, the application uses the following macros to access the buffer containing the message. acumessage is a standard ACU message (for example ACU_CONN_IN). For example, Acu_conn_in_a_q931.

Macro | Description
--- | ---
acumessage_q931_size1 | Size of Q.931 buffer, in bytes
acumessage_a_q931 | Pointer to Q.931 buffer

For this data to be available, the NS_BEHAVIOUR_NIL bit must be set in the acu_behaviour substructure referenced in the ISDN_PROTOCOL_PARMS_Q931CC structure passed to isdnStartProtocol. By default, this bit is 0.

The following code fragment shows how to set this bit prior to calling isdnStartProtocol:

myStartProtocol()
{
struct ISDN_PROTOCOL_PARMS_Q931 parms;
...
memset(&parms,0,sizeof(ISDN_PROTOCOL_PARMS_Q931CC));
parms.size = sizeof(ISDN_PROTOCOL_PARMS_Q931CC);
parms.services_list[0] = ACU_VOICE_SERVICE;
/* Other services may be added here */
parms.services_list[1] = ACU_NO_SERVICE;
parms.acu_behaviour = ACU_SEND_Q931_BUFFER;
...
isdnStartProtocol ( ctahd,
ISDN_PROTOCOL_Q931CC,
networkoperator,
country,
partner,
SM->nai,
&parms ); /* Instead of NULL */
...
}

The buffer is not null terminated. It cannot be read by functions that expect null termination (such as strcpy).

The total amount of data (all buffers, including the raw Q.931 data buffer) that can be received in an ISDN message is MAX_ISDN_BUFFER_SIZE. (This value is defined in isdnparm.h.) If the size of incoming data is greater than MAX_ISDN_BUFFER_SIZE, the raw Q.931 data buffer is omitted.