(Page 1 of 1 in this chapter)


Appendix D

Sending and Receiving Raw Q.931 Data


Introduction

AG ISDN version 1.2 allows an application to include raw Q.931 data in one or more completely custom-built information elements (IEs) in messages sent to the stack. These information elements, called transparent IEs, are inserted verbatim in the Q.931 message generated by the stack. This specification method allows an application access to IEs, and fields in IEs, that cannot be accessed using the macros associated with ACU messages. This method can be used to specify both standard IEs (codeset 0) and extensions (i.e. codeset 6 and 7).

An application can also access and read the raw data in an incoming Q.931 message, rather than reading returned values for specific fields in data structures.

Creating Transparent IEs

The application supplies the data (in hexadecimal format) for the transparent IEs in a buffer referenced in one of the usual ACU messages. The following macros refer to the transparent IE buffer:
Macro

Description

acumessage_tsp_ie_list_size1

Size of transparent IE buffer, in bytes.

Note: When calculating this value, do NOT include a null terminator.

acumessage_a_tsp_ie_list

Pointer to transparent IE buffer.

Note: Do NOT include null terminator in this string.

1 acumessage is a standard ACU message (e.g. ACU_CONN_RQ). For example, Acu_conn_rq_tsp_ie_list_size

To use transparent IEs, the application must disable the stack's syntax checking mechanism. To do this, set the NS_IE_RELAY_BEHAVIOR bit in the ns_behavior sub-structure 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_Q931CC 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.ns_behaviour = NS_IE_RELAY_BEHAVIOR;
...
  isdnStartProtocol (   ctahd, 
            ISDN_PROTOCOL_Q931CC,
            networkoperator,
            country,
            partner,
            SM->nai,
            &parms );          /* instead of NULL */
...
}

Transparent IE Formatting Rules

Accessing and Reading a Q.931 Buffer

To read the raw data in an incoming Q.931 message, the application accesses the buffer containing the message using the following macros:
Macro

Description

acumessage_q931_size1

Size of Q.931 buffer, in bytes

acumessage_a_q931

Pointer to Q.931 buffer

1 acumessage is a standard ACU message (e.g. ACU_CONN_IN). For example, Acu_conn_in_q931

In order for this data to be available, the NS_BEHAVIOR_NIL bit must be set in the acu_behavior sub-structure 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_behavior = ACU_SEND_Q931_BUFFER;
...
  isdnStartProtocol (   ctahd, 
            ISDN_PROTOCOL_Q931CC,
            networkoperator,
            country,
            partner,
            SM->nai,
            &parms );          /* instead of NULL */
...
}

Note: The buffer is NOT null-terminated; thus it cannot be read by functions which 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 would be greater than MAX_ISDN_BUFFER_SIZE, the raw Q.931 data buffer will be omitted.



(Page 1 of 1 in this chapter)


tech_support@nmss.com
Copyright © 1999, Natural MicroSystems, Inc. All rights reserved.