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

📄 rvmegacotermmgr.h

📁 h.248协议源码
💻 H
字号:
/******************************************************************************
Filename   : rvmegacotermmgr.h
Description: Header file for MEGACO Termination Manager
******************************************************************************
                Copyright (c) 1999 RADVision Inc.
************************************************************************
NOTICE:
This document contains information that is proprietary to RADVision LTD.
No part of this publication may be reproduced in any form whatsoever 
without written prior approval by RADVision LTD..

RADVision LTD. reserves the right to revise this publication and make 
changes without obligation to notify any person of such revisions or 
changes.
******************************************************************************
$Revision:$
$Date:11.9.00$
$Author: D.Elbert$
******************************************************************************/
#ifndef RV_MEGACOTERMMGR_H
#define RV_MEGACOTERMMGR_H

#include "rvptrlist.h"
#include "rvmegacoobjects.h"
#include "rvmegacocontext.h"
#include "rvmegacoterm.h"
#include "rvmdm.h"
#include "rvmegacoentity.h"

typedef enum {
	RV_MEGACOTERMMGRSTATE_DOWN,
	RV_MEGACOTERMMGRSTATE_REGISTERING,
	RV_MEGACOTERMMGRSTATE_REGISTERED,
	RV_MEGACOTERMMGRSTATE_UNREGISTERING,
	RV_MEGACOTERMMGRSTATE_DISCONNECTED,
	RV_MEGACOTERMMGRSTATE_DISABLED
} RvMegacoTermMgrState;

/* Used for contexts */
typedef RvMegacoContext* RvMegacoContextPtr;
rvDeclareHash(RvUint32,RvMegacoContextPtr)

typedef struct  RvMegacoTermMgr_ {
	RvMegacoEntity*			localEntity;	
	RvHash(RvUint32,RvMegacoContextPtr) contextTable;
	RvMegacoContext		    nullContext;
	RvMegacoContext		    ephContext;
	struct RvMegacoTerm_ *  rootTermination;    
	RvMdmTermMgr *          mdmTermMgr;

	RvUint32   curId;
	RvAlloc	*  alloc;
	RvAlloc *  physTermAlloc;
	RvAlloc *  ephTermAlloc;
	
	RvList(RvMegacoEntityAddress)		mgcAddrList;
	RvListIter(RvMegacoEntityAddress)		mgcAddrListIter;
	RvMegacoEntityAddress	lastConnectedAddress;	/* the address of the entity that the MG was last connected to */
	RvMegacoEntity mgcEntity;	/* The current MGC */
	RvBool mgcEntityValid;
	/* State of the termination manager */
	RvMegacoTermMgrState	state;
	RvMegacoServiceChangeDescriptor		sc;

	RvMutex lock;				/* Mutex (Semaphore) for this Term Mgr */ 
	RvMutex startMdmLock;		/* Mutex for the start state */ 
	RvQueue					eventQueue;
	RvThread				eventThread;

/*	int msgCounter;  *//* for future use: recovery mechanism */
	
	/* mdm timer mechanism*/
	RvBool needStartMdm;         /* true if we need to start mdm */
	RvMegacoTermTimer* mdmTimer; /* timer for starting the mdm */
	RvMegacoServiceChangeDescriptor   sc1; /*store service change message to send when timer expires */
} RvMegacoTermMgr;

/* Constructor/Destructor */
RvMegacoTermMgr* rvMegacoTermMgrConstructA(RvMegacoTermMgr * mgr,	RvMegacoEntity*	localEntity, RvAlloc * a);
void rvMegacoTermMgrDestruct(RvMegacoTermMgr * mgr);
void rvMegacoTermMgrMgcAddrListAdd(RvMegacoTermMgr * mgr,RvMegacoEntityAddress* mgcAddr);
void rvMegacoTermMgrMgcAddrListClear(RvMegacoTermMgr * mgr);
void rvMegacoTermMgrSetMdmMgr(RvMegacoTermMgr * mgr,RvMdmTermMgr * mdmMgr);

/* Access methods */
RvMegacoContext * rvMegacoTermMgrGetNullContext(RvMegacoTermMgr * mgr);
RvMegacoContext * rvMegacoTermMgrFindContext(RvMegacoTermMgr * mgr,unsigned int id);
struct RvMegacoTerm_ * rvMegacoTermMgrFindInNullContext(RvMegacoTermMgr * mgr,const char * id);
void			  rvMegacoTermMgrRemoveFromNullContext(RvMegacoTermMgr * mgr,struct RvMegacoTerm_ * term);	
void			  rvMegacoTermMgrRemoveFromEphContext(RvMegacoTermMgr * mgr,struct RvMegacoTerm_ * term);	
void	   		  rvMegacoTermMgrAddToNullContext(RvMegacoTermMgr * mgr,struct RvMegacoTerm_ * term);

struct RvMegacoTerm_ *    rvMegacoTermMgrFindInActiveContexts(RvMegacoTermMgr * mgr,const char * id);
/*RvMegacoTerm    rvMegacoTermMgrGetRootTermination(RvMegacoTermMgr * mgr);*/
#define           rvMegacoTermMgrGetRootTermination(mgr) (((mgr)->rootTermination))    
#define           rvMegacoTermMgrGetMaxContexts(mgr) (((mgr)->mdmTermMgr->maxContexts))
#define           rvMegacoTermMgrGetMaxTermPerContext(mgr) (((mgr)->mdmTermMgr->maxTermPerContext))


RvBool rvMegacoTermMgrForEachInNullContext(RvMegacoTermMgr * mgr,RvGraphNodeFunc f, void *data);
RvBool rvMegacoTermMgrForEachInActiveContexts(RvMegacoTermMgr * mgr,RvGraphNodeFunc f, void *data);

void rvMegacoTermMgrDeleteContext(RvMegacoTermMgr * mgr,RvMegacoContext * context);
RvMegacoContext * rvMegacoTermMgrCreateContext(RvMegacoTermMgr * mgr);

void rvMegacoTermMgrProcessTransaction(RvMegacoTcb *tcb, const RvMegacoTransaction *transaction, void *data);
void rvMegacoTermMgrProcessAction(RvMegacoTermMgr * mgr,const RvMegacoAction * action,RvMegacoTransactionReply * transReply);
void rvMegacoTermMgrProcReply(RvMegacoTcb *tcb, const RvMegacoTransactionReply *reply, void *data, RvTransactionStatus reason);

void rvMegacoTermMgrProcessServiceChangeCommand(RvMegacoTermMgr* termMgr,
												const RvMegacoCommand* command,RvMegacoCommandReply* commandReply);

void rvMegacoTermMgrSendTermServiceChangeUp(RvMegacoTermMgr * mgr,struct RvMegacoTerm_ * term,
											RvMegacoServiceChangeDescriptor * sc);

void rvMegacoTermMgrSendServiceChangeUp(RvMegacoTermMgr * mgr, struct RvMegacoTerm_ * term,
						 RvMegacoServiceChangeDescriptor * sc);


/* May not be required later */
unsigned int rvMegacoTermMgrGetNewTransId(RvMegacoTermMgr * mgr);

#define rvMegacoTermMgrIsUp(x)		  ((x)->state == RV_MEGACOTERMMGRSTATE_REGISTERED)
#define rvMegacoTermMgrIsDisabled(x)  ((x)->state == RV_MEGACOTERMMGRSTATE_DISABLED)

#ifdef RV_MEGACOTERMMGR_TESTSTACKON
/* Implemented in the test MG */
void rvMegacoTestStackSendRequest(RvMegacoTermMgr* mgr,RvMegacoTransaction* trans);
void rvMegacoTestStackSendReply(RvMegacoTermMgr* mgr,RvMegacoTransactionReply* trans);
#endif

void rvMegacoTermMgrCheckStartMdm(RvMegacoTermMgr* mgr);


#endif /* RV_MEGTERMMGR_H */

⌨️ 快捷键说明

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