📄 cas.h
字号:
/*--------------------------------------------------------------------------------------------------------------------------------
|
| Project: VoiceLink TB640 sample (CAS)
|
| Filename: cas.h
|
| Copyright: TelcoBridges 2002-2005, All Rights Reserved
|
| Description: This file contains the internal structure required by the application
|
| Notes: Tabs = 4
|
*-------------------------------------------------------------------------------------------------------------------------------
|
| Revision: $Revision: 1.24 $
|
*------------------------------------------------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------------------------------------------------
| Define header file
*------------------------------------------------------------------------------------------------------------------------------*/
#ifndef __CAS_H__
#define __CAS_H__
/*--------------------------------------------------------------------------------------------------------------------------------
| C++ support
*------------------------------------------------------------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/*--------------------------------------------------------------------------------------------------------------------------------
| Forward declarations
*------------------------------------------------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------------------------------------------------
| Defines
*------------------------------------------------------------------------------------------------------------------------------*/
/* The following defines create the apppropriate function inlining according to the selected OS */
#define INLINE __inline
/* Maximum number of boards (or softadapters) can this application control */
#define TB640_CAS_MAX_SUPPORTED_ADAPTERS 2
/* Maximum number of trunks on an adapter */
#define TB640_CAS_MAX_SUPPORTED_TRUNKS_PER_ADAPTER 64
/* Maximum number of CTBUS stream on an adapter */
#define TB640_CAS_MAX_SUPPORTED_CTBUS_STREAM_PER_ADAPTER 32
/* Maximum number of TDM timeslot (half-duplex) in a CTBUS stream */
#define TB640_CAS_MAX_TIMESLOT_PER_CTBUS_STREAM 128
/* Maximum number of TDM timeslot (full-duplex) in a trunk */
#define TB640_CAS_MAX_TIMESLOT_IN_TRUNK 32
/*
| Maximum number of trunks controlled by a single operation library (contexts and timers).
| MUST be a multiple of TB640_CAS_MAX_SUPPORTED_TRUNKS_PER_ADAPTER.
*/
#define TB640_CAS_MAX_TRUNK_PER_OPERATION_LIBRARY 16
/* The actual number of operation library to be used */
#define TB640_CAS_NB_OPERATION_LIBRARY_REQUIRED (TB640_CAS_MAX_SUPPORTED_TRUNKS_PER_ADAPTER/TB640_CAS_MAX_TRUNK_PER_OPERATION_LIBRARY)
/* Default name for configuration file (can be overriden with an argument */
#define TB640_CAS_DEFAULT_CONFIGURATION_FILENAME "config.txt"
/* Maximum number of characters in log filename */
#define TB640_CAS_MAX_LOG_FILENAME_LENGTH 32
/* Maximum number of characters in adapter name */
#define TB640_CAS_MAX_ADAPTER_NAME_LENGTH 64
/* Maximum number of characters in a configuration line */
#define TB640_CAS_MAX_CONFIGURATION_LINE_LENGTH 132
/* Maximum idle code value */
#define TB640_CAS_MAX_IDLE_CODE_VALUE 127
/* Maximum timeout value (in sec) after which an adapter is considered down if no activity (and heartbeat) is detected */
#define TB640_CAS_ADAPTER_WATCHDOG_TIMEOUT_SEC 10
/* Maximum timeout waiting for adapters to register */
#define TB640_CAS_ADAPTER_DISCOVERY_TIMEOUT_MSEC (5*1000)
/* Maximum number of adapters being discovered in the network */
#define TB640_CAS_MAX_ADAPTER_DISCOVERED 32
/* Defines the adapter name string to represents any adapter */
#define TB640_CAS_ANY_ADAPTER_STRING "ANY"
/* Define the maximum number of digit in a received number */
#define TB640_CAS_MAX_NB_DIGIT_IN_NUMBERS 32
/* Define the maximum number of states remembered for a specific timeslot */
#define TB640_CAS_NB_HISTORY_FOR_TIMESLOT 256
/* Define the maximum number of states remembered for a specific call */
#define TB640_CAS_NB_HISTORY_FOR_CALL 32
/* Define the maximum number of characters in the origin number */
#define TB640_CAS_MAX_ORIGIN_STRING_SIZE 8
/* Define the maximum number of group B characters that means 'call refusal' */
#define TB640_CAS_MAX_GROUP_B_REFUSAL_DIGIT 16
/* Test controller defines */
#define TB640_CAS_TEST_MAX_OPTIONAL_SIZE_FOR_OPT_ARG 256
#define TB640_CAS_TEST_ARG1_NAME "-TEST"
#define TB640_CAS_TEST_ARG2_NAME "-ID"
#define TB640_CAS_TEST_STRESS_TEST_ARGUMENTS "DELAY=%d, MIN=%d, MAX=%d, REST=%d, IDLE=%d, ADAP=%d, TRK=%s"
/* Test names and argument formats */
#define TB640_CAS_TEST_STRESS_TEST_NO_COL_NAME "STRESS_TEST_NO_COLLISION"
#define TB640_CAS_TEST_STRESS_TEST_WITH_COL_NAME "STRESS_TEST_WITH_COLLISION"
#define TB640_CAS_TEST_EVENT_TRUNK_UNBLOCK_NAME "ALL_TRUNK_UNBLOCK"
/*--------------------------------------------------------------------------------------------------------------------------------
| Types
*------------------------------------------------------------------------------------------------------------------------------*/
/* The different types of automatic test that can be started/stopped */
typedef enum _TB640_CAS_TEST_AUTO_TEST
{
TB640_CAS_TEST_AUTO_TEST_NONE = 0,
TB640_CAS_TEST_AUTO_TEST_STRESS_TEST_NO_COLLISION = 1,
TB640_CAS_TEST_AUTO_TEST_STRESS_TEST_WITH_COLLISION = 2,
} TB640_CAS_TEST_AUTO_TEST, *PTB640_CAS_TEST_AUTO_TEST;
/*
| The following type is used to match a string to a parsing token
*/
typedef struct _TB640_CAS_PARSING_ENTRY
{
PTBX_CHAR pszIdentifier;
TBX_UINT32 un32Value;
} TB640_CAS_PARSING_ENTRY, *PTB640_CAS_PARSING_ENTRY;
/* This structure represents the statistics for stress testing */
typedef struct _TB640_CAS_STRESS_STATS
{
TBX_BOOL fStatsActivated;
TBX_UINT32 un32StartTimestamp;
TBX_UINT32 un32CurrentTimestamp;
TBX_UINT32 un32NbCallOpeningOutOfRes;
TBX_UINT32 un32NbCallOpeningTimeslotBusy;
TBX_UINT32 un32NbCallOpeningFailure;
TBX_UINT32 un32NbCallOpeningSuccess;
TBX_UINT32 un32NbCallClosingTotal;
TBX_UINT32 un32NbCallCompleted;
TBX_UINT32 un32NbCallNoFreeTimeslotToOpen;
TBX_UINT32 un32NbTimeoutOccured;
TBX_UINT32 un32NbRestartAttempt;
TBX_UINT32 un32NbOutgoingCallCollision;
TBX_UINT32 un32NbIncomingCallCollision;
TBX_UINT32 un32NbIncomingCallRefusal;
} TB640_CAS_STRESS_STATS, *PTB640_CAS_STRESS_STATS;
/*
| Enumeration describing the different states of a call
*/
typedef enum _TB640_CAS_CALL_APP_STATE
{
TB640_CAS_CALL_APP_STATE_IDLE = 0x00,
TB640_CAS_CALL_APP_STATE_ONE = 0x10,
TB640_CAS_CALL_APP_STATE_TWO_A = 0x2A,
TB640_CAS_CALL_APP_STATE_TWO = 0x20,
TB640_CAS_CALL_APP_STATE_THREE = 0x30,
TB640_CAS_CALL_APP_STATE_FOUR = 0x40,
TB640_CAS_CALL_APP_STATE_FIVE = 0x50,
TB640_CAS_CALL_APP_STATE_SIX = 0x60,
TB640_CAS_CALL_APP_STATE_SEVEN = 0x70,
TB640_CAS_CALL_APP_STATE_EIGHT = 0x80,
TB640_CAS_CALL_APP_STATE_NINE = 0x90,
TB640_CAS_CALL_APP_STATE_TEN = 0x100,
TB640_CAS_CALL_APP_STATE_ELEVEN = 0x110,
TB640_CAS_CALL_APP_STATE_TWELVE = 0x120,
TB640_CAS_CALL_APP_STATE_THIRTEEN = 0x130,
TB640_CAS_CALL_APP_STATE_FOURTHEEN = 0x140,
TB640_CAS_CALL_APP_STATE_FIFTHEEN = 0x150
} TB640_CAS_CALL_APP_STATE, *PTB640_CAS_CALL_APP_STATE;
/*
| Enumeration describing the different sub states of a call
*/
typedef enum _TB640_CAS_CALL_APP_SUB_STATE
{
TB640_CAS_CALL_APP_SUB_STATE_ENTRY = 0,
TB640_CAS_CALL_APP_SUB_STATE_PROCESS = 1,
} TB640_CAS_CALL_APP_SUB_STATE, *PTB640_CAS_CALL_APP_SUB_STATE;
/* Define the action that can be triggered after an event processig */
typedef enum _TB640_CAS_STATE_ACTION
{
TB640_CAS_STATE_ACTION_WAIT = 1,
TB640_CAS_STATE_ACTION_CONTINUE = 2,
TB640_CAS_STATE_ACTION_DESTROY_CONTEXT = 3,
} TB640_CAS_STATE_ACTION, *PTB640_CAS_STATE_ACTION;
/*
| Enumeration describing the different states of a timeslot
*/
typedef enum _TB640_CAS_TRUNK_RESOURCE_STATE
{
TB640_CAS_TRUNK_RESOURCE_STATE_IDLE = '.',
TB640_CAS_TRUNK_RESOURCE_STATE_OPENING_INCOMING = 'I',
TB640_CAS_TRUNK_RESOURCE_STATE_OPENING_OUTGOING = 'O',
TB640_CAS_TRUNK_RESOURCE_STATE_CONNECTING = '>',
TB640_CAS_TRUNK_RESOURCE_STATE_ACTIVE = '*',
TB640_CAS_TRUNK_RESOURCE_STATE_DISCONNECTING = '<',
TB640_CAS_TRUNK_RESOURCE_STATE_CLOSING = '-',
TB640_CAS_TRUNK_RESOURCE_STATE_RESTARTING = 'R',
TB640_CAS_TRUNK_RESOURCE_STATE_CONDEMNED = 'X',
TB640_CAS_TRUNK_RESOURCE_STATE_FRAMING_UP = 'F',
TB640_CAS_TRUNK_RESOURCE_STATE_FRAMING_DOWN = 'f',
TB640_CAS_TRUNK_RESOURCE_STATE_BLOCKED = 'B',
TB640_CAS_TRUNK_RESOURCE_STATE_NOT_USED = 'N'
} TB640_CAS_TRUNK_RESOURCE_STATE, *PTB640_CAS_TRUNK_RESOURCE_STATE;
/*
| Structure containing state history entry
*/
typedef struct _TB640_CAS_HISTORY_ENTRY
{
TBX_UINT32 un32Timestamp;
TB640_CAS_CALL_HANDLE hCall;
TB640_CAS_TRUNK_RESOURCE_STATE CurrentState;
TBX_UINT32 un32Event;
} TB640_CAS_HISTORY_ENTRY, *PTB640_CAS_HISTORY_ENTRY;
/*
| Structure containing statistics about a specific trunk resource
*/
typedef struct _TB640_CAS_TRUNK_RESOURCE_STATS
{
TB640_CAS_TRUNK_RESOURCE_STATE State;
TBX_UINT32 un32LastIdleTimestamp;
} TB640_CAS_TRUNK_RESOURCE_STATS, *PTB640_CAS_TRUNK_RESOURCE_STATS;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -