📄 rvwatchdog.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 _RV_WATCHDOG_INTERNAL_H
#define _RV_WATCHDOG_INTERNAL_H
#include "rvlog.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum
{
RvWatchdogInitialVal,
RvWatchdogMaxVal,
RvWatchdogMaxUsage,
RvWatchdogCurrent,
RvWatchdogDeltaVal
} RvWatchdogResourceType;
typedef int (RVCALLCONV *RvWatchdogResourceCallback_T) (
IN void* context,
IN RvUint32 resource,
IN RvWatchdogResourceType type,
OUT RvUint32* value);
typedef struct
{
RvBool initialized; /* RV_TRUE if this entry is in use */
char name[20]; /* Name of resource */
char group[10]; /* Group of this resource */
const char* description; /* Description of this resource */
void* context; /* Context for callback */
RvUint32 initialValue; /* Initial value of the resource */
RvUint32 currentValue; /* Latest value got for this resource */
RvWatchdogResourceCallback_T cbFunc; /* Callback to get the resources */
} RvWatchdogTable_S;
/*handle to watchdog*/
typedef struct
{
RvWatchdogTable_S* hTable;
RvUint32 nextFreeEntrance;
RvUint32 maxEntrances;
RvBool isInit;
} RvWatchdog;
/********************************************************************************
RvWatchdogAddResource
this function is called by the varios modules while initializing. it set a
resource data in the internal table.
INPUT -
hApp - the application handle - used to get the watchdog
handle
name - the name of the resource - to put in the table
group - the name of the group this resource belongs to
description - the description of the resource - to put in the table
resourceCallback - the module callback function, whith which the watchdog
will get a resource value when needed
context - the application handle that will be sent to the call
back function
OUTPUT -
resourceEnumeration - the enumeratin of resources that will be sent to
the callback function
RETURN -
the recource value
*********************************************************************************/
int RvWatchdogAddResource(
IN RvWatchdog* hWD,
IN const char* name,
IN const char* group,
IN const char* description,
IN RvWatchdogResourceCallback_T resourceCallback,
IN void* context,
OUT RvUint32* resourceEnumeration);
/********************************************************************************
RvWatchdogDeleteResource
this function is called by the varios modules while to delete resources from
the watchdog.
INPUT -
hApp - the application handle - used to get the watchdog
handle
resourceEnumeration - the enumeratino of the resource to delete
OUTPUT - none
RETURN -
non negative value - if success.
negative value - if failed to initialize the ss instance.
*********************************************************************************/
int RvWatchdogDeleteResource(
IN RvWatchdog* hWD,
IN RvUint32 resourceEnumeration);
/********************************************************************************
RvWatchdogAllocate
this function allocates the internal resource table of thewatchdog. it is the
first thing initialize in this module. cmInitialize calls it at the beginnig
of its operation
INPUT -
watchdog - Watchdog object to initialize
numOfResources - the numbers of resources the watchdog support. it is used
to detarmine the size of the table.
OUTPUT - none
RETURN -
Non-negative value on success, other on failure
*********************************************************************************/
int RvWatchdogAllocate(IN RvWatchdog* watchdog, IN int numOfResources);
/********************************************************************************
RvWatchdogInit
this it the main initialization of the watchdog.
cmInitialize calls it after initializing all its modules.
the function used the callback function allready set in the internal table,
and set initial and current values of each resource .
INPUT -
Hwd - the watchdog handle
OUTPUT - none
RETURN -
non negative value - if success.
negative value - if failed to initialize the ss instance.
*********************************************************************************/
int RvWatchdogInit(
IN RvWatchdog* Hwd);
/********************************************************************************
RvWatchdogEnd
this function free allocations made in teh module.
INPUT -
watchdog - Watchdog object to initialize
OUTPUT - none
RETURN -
Non-negative value
*********************************************************************************/
int RvWatchdogEnd(IN RvWatchdog* watchdog);
/********************************************************************************
RvWatchdogPrint
this function goes over all recources from the table, get thier values and
print it at the log file.
INPUT -
hWD - Watchdog handle
logSource - Log source to print to
OUTPUT - none
RETURN - non negative value - if success.
negative value - if failed to initialize the ss instance.
*********************************************************************************/
int RvWatchdogPrint(IN RvWatchdog* hWD, IN RvLogSource* logSource);
/********************************************************************************
RvWatchdogNextResource
this function gets the names of resources from the stack. It can be used
to loop on all the resources of the stack with RvWatchdogGetResource().
To stop looping, make sure the return value is non-negative.
INPUT -
hApp - the application handle
prevResource - Handle to previous resource.
First time should be called with NULL
OUTPUT -
resourceHandle - Handle to the current resource
Should be used as prevResourcefor the next call to this
function.
resourceName - Name of the resource (maximum of 40 bytes)
Can be used for RvWatchdogGetResource()
RETURN - non negative value - if success.
negative value - if failed or if there are no more resource.
*********************************************************************************/
int RvWatchdogNextResource(
IN RvWatchdog* hWD,
IN void* prevResource,
OUT void** resourceHandle,
OUT char* resourceName);
/********************************************************************************
RvWatchdogGetResource
this function get the value of a specific resource and return it
INPUT -
hApp - the application handle
name - the resource name, used to locate resource in the table
type - the type of data needed (current/max/....)
OUTPUT -
value - the value of the resource requested
resourceGroupName - name of group this resource belongs to. Can be passed
as NULL. Up to 40 characters
RETURN - non negative value - if success.
negative value - if failed to initialize the ss instance.
*********************************************************************************/
int RvWatchdogGetResource(
IN RvWatchdog* hWD,
IN const char* name,
IN RvWatchdogResourceType type,
OUT RvUint32* value,
OUT char* resourceGroupName);
#ifdef __cplusplus
}
#endif
#endif /* _RV_WATCHDOG_INTERNAL_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -