📄 transutil.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 _TRANSUTIL_H
#define _TRANSUTIL_H
#ifdef __cplusplus
extern "C" {
#endif
/**************************************************************************************
* createMessage
*
* Purpose: creates a skeleton message of the given type and fills in the CRV and callId
* of the given session.
* Input: transGlobals - The global data of the module.
* msgType - which message to create
* CRV - CRV to use.
* callId - call Identifier to use.
*
* Output: node - the created message.
*
* Returned Value: RV_TRUE - success
**************************************************************************************/
RvBool createMessage(cmTransGlobals *transGlobals,
cmCallQ931MsgType msgType,
RvUint16 CRV,
RvUint8 *callId,
int *node);
/**************************************************************************************
* findHostInHash
*
* Purpose: To look for an existing host with the same address as the given one.
* If a suitable host is found, i.e. identical in address and type,
* we check it to be connected (the prefered state). If it's not we look for
* another one which is connected. If none was found we bring a suitable host
* that is not connected. If such a host doesn't exist either, return NULL.
* Input: transGlobals - The global data of the module.
* remoteAddress - The address of the looked for host.
* isMultiplexed - Do we need a host which is multiplexed or not
* isAnnexE - the type of the connection (TPKT or annex E).
*
* Output: None.
*
* Returned Value: A pointer to the found host element or NULL if not found
**************************************************************************************/
cmTransHost *findHostInHash(IN cmTransGlobals *transGlobals,
IN cmTransportAddress *remoteAddress,
IN RvBool isMultiplexed,
IN RvBool isAnnexE);
/**************************************************************************************
* transEncodeMessage
*
* Purpose: to get the given message encoded, either by a callback or by the cmEmEncode.
* Input: host - The host on which the message is to be sent
* session - The session on whose behalf the message is to be sent.
* transGlobals - The global data of the transport module.
* pvtNode - the message to be encoded
* buffer - the buffer into which to encode
*
* Output: encMsgSize - The size of the encoded message.
*
* Returned Value: cmTransErr - in case that the encoding failed, cmTransOK - otherwise
**************************************************************************************/
TRANSERR transEncodeMessage(cmTransHost *host,
cmTransSession *session,
cmTransGlobals *transGlobals,
int pvtNode,
RvUint8 *buffer,
int *encMsgSize);
/**************************************************************************************
* addSessionToPendingList
*
* Purpose: Add a session to the list of sessions that were unable to send a message
* due to lack of rpool resources. Such sessions should be notified when
* resources become available again.
* Input: transGlobals - The global data of the transport module.
* session - The session which failed to send the message.
*
* Output: None.
*
**************************************************************************************/
void addSessionToPendingList(IN cmTransGlobals *transGlobals,
IN cmTransSession *session);
/**************************************************************************************
* removeSessionFromPendingList
*
* Purpose: Remove a session from the list of sessions that were unable to send a message
* due to lack of rpool resources. Such sessions are removed when notified that
* resources become available again.
* Input: transGlobals - The global data of the transport module.
* session - The session which failed to send the message.
*
* Output: None.
*
**************************************************************************************/
void removeSessionFromPendingList(IN cmTransGlobals *transGlobals,
IN cmTransSession *session);
/**************************************************************************************
* saveMessageToPool
*
* Purpose: This routine gets an encoded message and saves it, until it can send it.
* Input: transGlobals - The global data of the transport module.
* session - The session which wants to send the message.
* host - The host on which the message is to be sent.
* buffer - The encoded message.
* encMsgSize - Its size.
* isTunneled - RV_TRUE: save to the tunneled message queue,
* RV_FALSE: to the sending message queue
* addToTop - RV_TRUE: Add the message to the start of the queue
* RV_FALSE: Add it at the end.
* CRV - The CRV of the call on which behalf the message is sent
* (used for annex E session ID field).
*
* Output: None.
*
**************************************************************************************/
HRPOOLELEM saveMessageToPool(cmTransGlobals *transGlobals,
void *element,
RvUint8 *buffer,
int encMsgSize,
RvBool isTunneled,
RvBool addToTop,
RvUint16 CRV);
/**************************************************************************************
* extractMessageFromPool
*
* Purpose: This routine removes an encoded message from the head of the host list.
* The messages extracted here are tunneled messages.
* Input: transGlobals - The global data of the transport module.
* element - The host or session which wants to send the message.
* isTunneled - TRUE: remove from the tunneled message queue,
* FALSE: remove from the sending message queue
*
* Output: None.
*
* Return Value: next message.
*
**************************************************************************************/
HRPOOLELEM extractMessageFromPool(
cmTransGlobals *transGlobals,
void *element,
RvBool isTunneled);
/**************************************************************************************
* processH245OutgoingMessage
*
* Purpose: This routine gets a decoded outgoing H.245 message and modifies it according to
* the different tasks at hand:
* - If tunneling: encodes it and puts it into the H.245 tunneled messages sylo
* and inhibits its sending.
* - If not tunneling: do nothing.
*
* Input: session - The session which wants to send the message.
* host - The host on which the message is to be sent.
* pvtNode - The message.
*
* Output: None.
*
* Returned Value: RV_TRUE - send the message, RV_FALSE - don't send it.
*
**************************************************************************************/
RvBool processH245OutgoingMessage(IN cmTransSession *session,
IN cmTransHost *host,
INOUT int pvtNode);
/**************************************************************************************
* processOutgoingMessage
*
* Purpose: This routine gets a decoded outgoing message and modifies it according to
* the different tasks at hand:
* - Add fields to Q.931 messages, such as multiplexing flags.
* - Save H.245 tunneled messages and eliminate their actual sending
* - Insert H.245 addresses, if necessary to the messages.
* - Insert H.245 tunneled messages.
* Input: session - The session which wants to send the message.
* host - The host on which the message is to be sent.
* pvtNode - The message.
* type - The type of the message (Q.931/H.245)
*
* Output: None.
*
* Returned Value: RV_TRUE - send the message, RV_FALSE - don't send it.
*
**************************************************************************************/
RvBool processOutgoingMessage(IN cmTransSession *session,
IN cmTransHost *host,
INOUT int pvtNode,
IN TRANSTYPE type);
/**************************************************************************************
* transSessionClose
*
* Purpose: This routine closes a session and breaks all its associations.
*
* Input/Output: hsTransSession - The session to be closed.
*
* Output: None.
*
**************************************************************************************/
void transSessionClose(cmTransSession *session);
/**************************************************************************************
* transHostClose
*
* Purpose: This routine reports a host close and tells the sessions connected to
* it that the connection has ended and releasing all the messages kept for it
* in the pool.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -