?? rvmegacosystem.c
字號:
/***********************************************************************
Filename : rvmegacosystem.c
Description : megaco system initialization and teardown
************************************************************************
Copyright (c) 2001 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.
***********************************************************************/
#include "rvmegacosystem.h"
#include "rvcore.h"
#include "rvptrvector.h"
#include "rvdefalloc.h"
struct
{
RvPtrVector stacks;
} rvMegacoSystem;
/*$
{function:
{name: rvMegacoSystemInit}
{include: rvmegacosystem.h}
{description:
{p: Initialize the megaco system for use.}
}
{proto: RvBool rvMegacoSystemInit();}
{returns: rvTrue if initialization succeeded, rvFalse if initialization failed.}
}
$*/
RvBool rvMegacoSystemInit()
{
if(!rvCoreInit())
return rvFalse;
rvPtrVectorConstruct(&rvMegacoSystem.stacks, &rvDefaultAlloc);
return rvTrue;
}
/*$
{function:
{name: rvMegacoSystemEnd}
{include: rvmegacosystem.h}
{description:
{p: Tear down the megaco system after use.}
}
{proto: void rvMegacoSystemEnd();}
}
$*/
void rvMegacoSystemEnd()
{
RvPtrVectorIter iter;
for(iter = rvPtrVectorBegin(&rvMegacoSystem.stacks);
iter != rvPtrVectorEnd(&rvMegacoSystem.stacks);
iter = rvPtrVectorIterNext(iter))
{
rvMegacoStackStop(*rvPtrVectorIterData(iter));
}
rvPtrVectorDestruct(&rvMegacoSystem.stacks);
rvCoreEnd();
}
/*$
{function:
{name: rvMegacoSystemRegisterStack}
{include: rvmegacosystem.h}
{description:
{p: Registers a stack with the megaco system. }
}
{proto: void rvMegacoSystemRegisterStack(RvMegacoStack *stack);}
{params:
{param: {n:stack} {d:The stack.}}
}
}
$*/
void rvMegacoSystemRegisterStack(RvMegacoStack *stack)
{
rvPtrVectorPushBack(&rvMegacoSystem.stacks, stack);
rvMegacoStackStart(stack);
}
/*$
{function:
{name: rvMegacoSystemUnregisterStack}
{include: rvmegacosystem.h}
{description:
{p: Unregisters a stack from the megaco system.}
}
{proto: void rvMegacoSystemUnregisterStack(RvMegacoStack *stack);}
{params:
{param: {n:stack} {d:The stack.}}
}
}
$*/
void rvMegacoSystemUnregisterStack(RvMegacoStack *stack)
{
RvPtrVectorIter iter;
for(iter = rvPtrVectorBegin(&rvMegacoSystem.stacks);
iter != rvPtrVectorEnd(&rvMegacoSystem.stacks);
iter = rvPtrVectorIterNext(iter))
{
if(*rvPtrVectorIterData(iter) == stack)
{
rvPtrVectorErase(&rvMegacoSystem.stacks, iter);
rvMegacoStackStop(stack);
break;
}
}
}
/*$
{function:
{name: rvMegacoSystemGetNumStacks}
{include: rvmegacosystem.h}
{description:
{p: Gets the number of stacks running on the megaco system.}
}
{proto: size_t rvMegacoSystemGetNumStacks();}
{returns: The number of stacks.}
}
$*/
size_t rvMegacoSystemGetNumStacks()
{
return rvPtrVectorSize(&rvMegacoSystem.stacks);
}
/*$
{function:
{name: rvMegacoSystemGetStack}
{include: rvmegacosystem.h}
{description:
{p: Gets one of the stacks running on the megaco system.}
}
{proto: RvMegacoStack *rvMegacoSystemGetStack(size_t index);}
{params:
{param: {n:index} {d:The index of the stack.}}
}
{returns: The stack.}
}
$*/
RvMegacoStack *rvMegacoSystemGetStack(size_t index)
{
return *rvPtrVectorAt(&rvMegacoSystem.stacks, index);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -