⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transportint.h

📁 基于h323协议的软phone
💻 H
字号:
/***********************************************************************
        Copyright (c) 2002 RADVISION Ltd.
************************************************************************
NOTICE:
This document contains information that is confidential and proprietary
to RADVISION Ltd.. No part of this document may be reproduced in any
form whatsoever without written prior approval by RADVISION Ltd..

RADVISION Ltd. reserve the right to revise this publication and make
changes without obligation to notify any person of such revisions or
changes.
***********************************************************************/

#ifndef _TRANSPORTINT_H
#define _TRANSPORTINT_H

#include "rvinternal.h"
#include "rvlock.h"
#include "rvmutex.h"
#include "rvlog.h"
#include "ema.h"
#include "hash.h"
#include "rpool.h"
#include "rvh323timer.h"
#include "cat.h"
#include "pvaltree.h"
#include "annexe.h"
#include "tpkt.h"
#include "transport.h"

#ifdef __cplusplus
extern "C" {
#endif

/* TPKT header for messages sent on TCP */
#define TPKT_HEADER_SIZE 4

/* Size of the header of a message stored in RPOOL. This header holds the pointer to the
   next message we want to send on the same host/session */
#define MSG_HEADER_SIZE sizeof(void*)

#define TRANS_RPOOL_CHUNK_SIZE 1024


/* Types of connection */
typedef enum
{
    cmTransTPKTAnnexECompetition = 0,
    cmTransTPKTConn,
    cmTransAnnexEConn
} TRANSINTCONNTYPE;

typedef enum
{
    hostIdle,
    hostListenning,
    hostConnecting,
    hostListenningConnecting,
    hostConnected,
    hostBusy,
    hostClosing,
    hostClosed
} HOSTSTATE;

typedef enum
{
    tunnNo,
    tunnPossible,
    tunnOffered,
    tunnApproved,
    tunnRejected
} TUNNSTATE;

typedef enum
{
    parllNo,
    parllOffered,
    parllApproved
} PARTUNNSTATE;

typedef enum
{
    fsNo,
    fsOffered,
    fsApproved,
    fsRejected
} FSSTATE;


typedef struct
{
    RvUint32    bufferSize;
    RvUint8*    buffer;
} transThreadCoderLocalStorage;

typedef struct _cmTransSession cmTransSession;
typedef struct
{
    TRANSCONNTYPE       type;
    RvBool              closeOnNoSessions;
    RvBool              isMultiplexed;
    RvBool              remoteCloseOnNoSessions;
    RvBool              remoteIsMultiplexed;
    RvBool              hostIsApproved;
    RvBool              incoming; /* RV_TRUE for incoming hosts */
    RvBool              reported;
    RvBool              dummyHost;
    cmAnnexEUsageMode   annexEUsageMode;
    HOSTSTATE           state; /* State of the host */
    cmTransportAddress  remoteAddress;
    cmTransportAddress  localAddress;
    HTPKT               hTpkt;
    HTPKT               h245Listen;
    void                *hashEntry;
    cmTransSession      *firstSession;
    HRPOOLELEM          firstMessage;
    HRPOOLELEM          lastMessage;
    HRPOOLELEM          incomingMessage;
} cmTransHost;

struct _cmTransSession
{
    cmTransHost         *Q931Connection;
    cmTransHost         *annexEConnection;
    cmTransHost         *H245Connection;
    RvBool              isTunnelingSupported;
    RvBool              isParallelTunnelingSupported;
    RvBool              notEstablishControl;
    RvBool              closeOnNoSessions;
    RvBool              isMultiplexed;
    RvBool              firstMessageSent;
    RvBool              connectedToHost;
    RvBool              reportedH245Connect;
    RvBool              reportedQ931Connect;
    RvBool              openControlWasAsked;
    RvBool              switchToSeparateWasAsked;
    RvBool              outgoing;
    RvBool              holdTunneling;
    RvBool              forceTunneledMessage;
    RvBool              needToSendFacilityStartH245;
    RvBool              notFirstTunnelingMessage;
    RvBool              hostWasSet;
    TUNNSTATE           tunnelingState;
    PARTUNNSTATE        parallelTunnelingState;
    FSSTATE             faststartState;
    cmAnnexEUsageMode   annexEUsageMode;
    cmH245Stage         h245Stage;
    RvUint8             callId[16];
    RvUint16            CRV;
    void                *hashEntry;
    cmTransSession      *nextSession;
    cmTransSession      *prevSession;
    cmTransSession      *nextPending;
    cmTransSession      *prevPending;
    HRPOOLELEM          firstMessage;
    HRPOOLELEM          lastMessage;
    RvPvtNodeId         h450Element;
    RvPvtNodeId         h450AlertElement;
    RvPvtNodeId         annexMElement;
    RvPvtNodeId         annexLElement;

    /* The following are used for zero-timer. They allow us to send a callback to
       the application as if we got it from the network. We use a single timer with
       several booleans on it to allow better memory consumption. */
    RvBool              zeroTimerOnH245Connection; /* RV_TRUE if the zero-timer should notify
                                                      about H245 being connected */
    RvBool              zeroTimerOnAnnexEConnection; /* RV_TRUE if the zero-timer should notify
                                                        about AnnexE being connected */
    RvBool              zeroTimerOnQ931Connection; /* RV_TRUE if the zero-timer should notify
                                                      about Q931 being connected */
    RvTimer*            zeroTimer; /* Zero timer object to use */
};


typedef struct
{
    HAPPATRANS              hAppATrans;
    RvMutex                 lockSessionsList; /* Lock used to protect the list on the session elements */
                                              /* Must be a mutex since closeHostInternal is reentrant */
    RvLock                  lockHash; /* Lock used to protect access to the hash tables */

    RvLogSource             hLog; /* Transport log source */
    RvLogSource             hTPKTCHAN; /* TPKTCHAN log source */

    HPVT                    hPvt; /* ValTree to use for ASN.1 mesages */
    HPST                    synProtQ931; /* Syntax tree of Q931Message */
    HPST                    synProtH245; /* Syntax tree for MultimediaSystemControlMessage */
    HPST                    synProtH450; /* Syntax tree for h4501SupplementaryService */

    HRPOOL                      messagesRPool; /* RPOOL storing messages before they are processed and sent */

    HEMA                    hEmaSessions; /* EMA holding the sessions. A session is a call */
    HEMA                    hEmaHosts; /* EMA holding the hosts. A host is a TCP or UDP socket connection */
    HHASH                   hHashHosts;
    HHASH                   hHashSessions;
    TRANSSESSIONEVENTS      sessionEventHandlers;
    TRANSHOSTEVENTS         hostEventHandlers;
    HTPKTCTRL               tpktCntrl;
    HANNEXE                 annexECntrl;
    cmTransHost             *hTPKTListen;
    RvSize_t                codingBufferSize;
    cmTransSession          *pendingList;
    RvUint32                localIPAddress;
    RvH323TimerPoolHandle   hTimers;
    RvBool                  annexESupported;

    /* Resource values as given by the watchdog */
    RvUint32                rpoolResourceVal;
    RvUint32                timersResourceVal;

    RvUint32                maxUsedNumOfMessagesInRpool;
    RvUint32                curUsedNumOfMessagesInRpool;
} cmTransGlobals;


#define sizeof_hostKey 12
typedef struct
{
    RvUint32        ip;
    RvUint32        port;
    RvBool          type;
} hostKey;


#define sizeof_sessionKey 4
typedef struct
{
    RvInt32     CRV;
} sessionKey;



#ifdef __cplusplus
}
#endif


#endif  /* _TRANSPORTINT_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -