(Page 1 of 1 in this chapter) Version


Appendix D

TCAP Sample Application


Overview
Data Structures and File
Checkpoint Message Structure
Transaction Structure
The Commands.800 File
Threads
UDP to TCAP Event
Running the TCAPdemo Program
Command Line Options

Overview

The TCAP sample application, tcapdemo, is a multi-threaded program utilizing the redundancy features of the NMS TCAP layer. It is a skeletal implementation of a toll switch with a simple user interface for placing and receiving test calls.

Data Structures and File

The following sections describe data structures that are called by the tcapdemo application.

Checkpoint Message Structure

The checkpoint message structure, ChkPntMsg, is used to transfer transaction information from the primary application to the backup application.

typedef struct checkPointMsg
{
    U32     msgId;       /* message Id                          */
    U32     position;    /* position in "command.800" file      */
    U32     transId;     /* transaction Id                      */
    U8      invokeId;    /* invoke Id                           */
    U8      readFlag;    /* flaf for reading "command.800" file */
} ChkPntMsg;

Transaction Structure

The transaction structure, Event, is used to pass information between threads. This is done by passing a pointer to an event in the buffer member of a CTA_EVENT structure.

typedef struct trans
{
    U32     position;
    U32     transId;
    U8      invokeId;
    U8      readFlag;
} Trans;

The Commands.800 File

The transaction file, commands.800, informs the main thread of the transaction sequence to be executed. This file has the following format:
Field

Description

qr_nl

Begin or query without permission message

qr_l

Begin or query with permission message

cv_nl

Continue or converse without permission message

cv_l

Continue or converse with permission message

Threads

The tcapdemo application is comprised of the following threads:
Thread

Description

Main thread

Parses command line arguments, initializes global data, starts UDP thread, and sends/receives 800 number translation requests (according to transaction sequence defined in the command.800 file). It can act as an 800 number server, or as a client requesting an 800 number translation.

UDP thread

Receives checkpoint messages from the mate application, which result in checkpoint events generated to main thread.

UDP to TCAP Event

This event ID value is used to pass information from the UDP thread and Main thread.
Event

Description

CHKPNT_EVT

Indicates a checkpoint message has been received from the mate application.

Running the TCAPdemo Program

The following sections provide commands/command line options for use with the tcapdemo application.

Command Line Options

The following command line options are accepted by the tcapdemo application. Options may be entered in any order. At the command line, enter the following:

tcapdemo [options] pointcode:subsystem phonenum

where options include:
Option

Description

-b boardNum

TX board number (Default = 1).

-p sapno

Service access point ID (Default = 0). Valid range is 0 - 255.

-da address

Internet address of mate application in dotted decimal format
(Default = loopback (127.0.0.1).

-dn name

Host on which mate application is running.

-dp port

UDP port number of mate application (Default = 4096).

-lp port

UDP port number for this application instance (Default = 4096).

-n number

Subsystem number to be used (Default = 254). Valid range is 0 - 255.

-i iterations

Number of times transaction is repeated (Default = 1).
Valid range is 0 - 32000.

-j delay

Delay (in ms) between repetitions (Default = 1). Valid range is 1-65536.

-t

Uses ITU addressing. The tcapdemo program defaults to ANSI.

-s

Causes tcapdemo to act as 800-number server. The tcapdemo program acts as a client by default.

The pointcode:subsystem parameter specifies the pointcode and subsystem number of the 800-number server. The phonenum parameter specifies the 800-number to be translated (only used by clients). Both parameters are used only by clients.

Note: If multiple instances of tcapdemo are bound to the same TX board, the SAP ID (-s parameter) and the subsystem number (-n parameter) must be unique for each instance. Acting as a 800 number server

To start tcapdemo as an 800 number server, type:

tcapdemo -b 1 -p 0 -n 255 -s

The tcapdemo program binds to TX board one, uses SAP ID zero, and uses subsystem number 255. Since the -s parameter is specified, tcapdemo also acts as a server.

If binding is completed successfully, tcapdemo receives a Run State Indication event from the TCAP task. The tcapdemo program uses the information it receives to determine its run status. The run status must be one of the following
Run Status

Description

Standalone or Primary

The tcapdemo program waits for an 800-number request to arrive

Backup

The tcapdemo program stops working as a server and waits for another Run State Indication event

:

When a request arrives and run status is standalone or primary, tcapdemo compares the received 800-number to the information in the numbers.800 file.

Note: The numbers.800 file must be in the same directory as the tcapdemo.exe file.

The numbers.800 file looks like this:

[800 Numbers]
8001234567=3122456789
8004561234=8477069700

Additional 800-numbers may be added, as long as they are listed after the [800 Numbers] section header, and conform to the syntax:

800nnnnnnn=yyyyyyyyyy

If a matching 800-number is found, the tcapdemo server returns the translated number in a RETURN_RESULT [last] component.

If no matching 800-number is found, the tcapdemo server returns a RETURN_ERROR component.

The tcapdemo server continues to listen for and respond to requests indefinitely. To stop the server, press the Q key.

Acting as an 800 number client

To start tcapdemo as a client:

tcapdemo -b 2 -p 1 -j 100 -n 254 1.1.1:255 8001234567

In this case, tcapdemo binds to TX board two, uses SAP ID one, and uses subsystem number 254. Since the -s parameter is not specified, tcapdemo acts as a client.

If binding is completed successfully, tcapdemo receives a Run State Indication event from the TCAP task. The tcapdemo program uses the information it receives to determine its run status. The run status must be one of the following
Run Status

Description

Standalone or Primary

The tcapdemo program sends an 800-number request to the specified pointcode and subsystem specified

Backup

The tcapdemo program stops working as a client and waits for another Run State Indication event

:

After sending the 800-number request, tcapdemo waits for a response.

After a response is received, tcapdemo continues to run, but no further requests are sent. To stop the client, press the Q key.



(Page 1 of 1 in this chapter) Version


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