📄 rvmegacostack.h
字号:
/******************************************************************************
Filename: rvmegacostack.h
Description: megaco stack class
*******************************************************************************
Copyright (c) 2000 RADVision Inc.
*******************************************************************************
NOTICE:
This document contains information that is proprietary to RADVision Inc.
No part of this publication may be reproduced in any form whatsoever without
written prior approval by RADVision Inc.
RADVision Inc. reserves the right to revise this publication and make changes
without obligation to notify any person of such revisions or changes.
******************************************************************************/
#ifndef RV_MEGACOSTACK_H
#define RV_MEGACOSTACK_H
#include "rvtransport.h"
#include "rvmegacoobjects.h"
#include "rvtime.h"
#include "rvpool.h"
#include "rvserialmem.h"
#include "rvstrstream.h"
#include "rvroundtripstats.h"
#ifdef __cplusplus
extern "C" {
#endif
#define RV_MEGACOSTACK_VERSION "Megaco Stack Version 1.1.0.0 Copyright (c) 2001 RADVISION"
struct RvMegacoStack_;
/* public: */
/*$
{callback:
{name: RvSecurityKeyCB}
{include: rvmegacostack.h}
{description:
{p: A function used to get the security key associated with an address.}
}
{proto: typedef const char *(*RvSecurityKeyCB)(const RvSocketAddr *fromAddr, RvTransportType transportType, void *data);}
{params:
{param: {n:fromAddr} {d:Address the message was received on.}}
{param: {n:transportType} {d:Type of transport the message was received on.}}
{param: {n:data} {d:User data that was registered with the callback.}}
}
{returns:
The security key, or NULL if no authentication is required for this address.
}
}
$*/
typedef const char *(*RvSecurityKeyCB)(const RvSocketAddr *fromAddr, RvTransportType transportType, void *data);
/*$
{callback:
{name: RvAuthenticationCB}
{include: rvmegacostack.h}
{description:
{p: A cryptographically secure hashing function used for authentication.}
}
{proto: typedef void (*RvAuthenticationCB)(const char *text, size_t textlen, const char *key, size_t keylen, char *output);}
{params:
{param: {n:text} {d:The message to hash.}}
{param: {n:textlen} {d:The length of the message.}}
{param: {n:key} {d:The security key.}}
{param: {n:keylen} {d:The length of the security key.}}
{param: {n:output} {d:Address to write output to.}}
}
}
$*/
typedef void (*RvAuthenticationCB)(const char *text, size_t textlen, const char *key, size_t keylen, char *output);
/*$
{callback:
{name: RvMegacoRawCB}
{include: rvmegacostack.h}
{description:
{p: A function for operating on raw messages or filtering them.}
}
{proto: typedef RvBool (*RvMegacoRawCB)(RvMegacoStack *stack, char *msg, size_t length, void *data);}
{params:
{param: {n:stack} {d:The stack.}}
{param: {n:msg} {d:The raw message.}}
{param: {n:length} {d:The size of the message buffer.}}
{param: {n:data} {d:User data that was registered with the callback.}}
}
{returns:
The callback can return rvTrue to process the message normally,
or rvFalse to discard the message without doing a send or receive.
}
}
$*/
typedef RvBool (*RvMegacoRawCB)(struct RvMegacoStack_ *, char *msg, size_t length, void *data);
/*$
{callback:
{name: RvMegacoParseErrorCB}
{include: rvmegacostack.h}
{description:
{p: A function for processing parser errors.}
}
{proto: typedef void (*RvMegacoParseErrorCB)(const char *message, const RvParseError *error, const RvSocketAddr *source);}
{params:
{param: {n:message} {d:The message text.}}
{param: {n:error} {d:Information about the parser error.}}
{param: {n:source} {d:The address of the sender of the message.}}
}
}
$*/
typedef void (*RvMegacoParseErrorCB)(const char *message, const RvParseError *error, const RvSocketAddr *source);
/*$
{type:
{name: RvMegacoStack}
{include: rvmegacostack.h}
{description:
{p: A megaco stack object.}
}
{methods:
{method: RvMegacoStack *rvMegacoStackConstruct(RvMegacoStack *stack, size_t numThreads, int priority);}
{method: RvMegacoStack *rvMegacoStackConstructA(RvMegacoStack *stack, size_t numThreads, int priority,
RvAlloc *genAlloc, RvAlloc *sendBufAlloc, RvAlloc *recvBufAlloc,
RvAlloc *msgAlloc, RvAlloc *entityAlloc, RvAlloc *tcbAlloc);}
{method: void rvMegacoStackDestruct(RvMegacoStack *stack);}
{method: void rvMegacoStackSetCompactEncodingMode(RvMegacoStack *stack, RvBool enable);}
{method: void rvMegacoStackRegisterSecurityKeyCB(RvMegacoStack *stack, RvSecurityKeyCB f, void *data);}
{method: void rvMegacoStackRegisterAuthenticationCB(RvMegacoStack *stack, RvAuthenticationCB f, size_t hashLength);}
{method: void rvMegacoStackRegisterRawRecvCB(RvMegacoStack *stack, RvMegacoRawCB f, void *data);}
{method: void rvMegacoStackRegisterRawSendCB(RvMegacoStack *stack, RvMegacoRawCB f, void *data);}
{method: void rvMegacoStackRegisterParseErrorCB(RvMegacoStack *stack, RvMegacoParseErrorCB f, void *data);}
{method: unsigned int rvMegacoStackGetAuthenticationFailures(const RvMegacoStack *stack);}
{method: void rvMegacoStackClearAuthenticationFailures(RvMegacoStack *stack);}
{method: unsigned int rvMegacoStackGetParseErrors(const RvMegacoStack *stack);}
{method: void rvMegacoStackClearParseErrors(RvMegacoStack *stack);}
{method: void rvMegacoStackSetSendDelay(RvMegacoStack *stack, unsigned int ms);}
{method: void rvMegacoStackSetInitialRetransTimeout(RvMegacoStack *stack, unsigned int ms);}
{method: void rvMegacoStackSetMinRetransTimeout(RvMegacoStack *stack, unsigned int ms);}
{method: void rvMegacoStackSetMaxRetransTimeout(RvMegacoStack *stack, unsigned int ms);}
{method: void rvMegacoStackSetRetransWindow(RvMegacoStack *stack, unsigned int ms);}
{method: void rvMegacoStackSetMaxPacketSize(RvMegacoStack *stack, size_t packetSize);}
{method: unsigned int rvMegacoStackGetSendDelay(RvMegacoStack *stack);}
{method: unsigned int rvMegacoStackGetInitialRetransTimeout(const RvMegacoStack *stack);}
{method: unsigned int rvMegacoStackGetMinRetransTimeout(const RvMegacoStack *stack);}
{method: unsigned int rvMegacoStackGetMaxRetransTimeout(const RvMegacoStack *stack);}
{method: unsigned int rvMegacoStackGetRetransWindow(const RvMegacoStack *stack);}
{method: size_t rvMegacoStackGetMaxPacketSize(const RvMegacoStack *stack);}
}
}
$*/
typedef struct RvMegacoStack_
{
RvAlloc *genAlloc, *sendBufAlloc, *msgAlloc, *entityAlloc, *tcbAlloc;
RvTransport transport;
RvBool encodeCompact;
RvSecurityKeyCB getKey;
void *getKeyData;
RvAuthenticationCB authenticate;
size_t hashLength;
unsigned int authenticationFailures;
RvMegacoRawCB rawRecvCb, rawSendCb;
void *rawRecvData, *rawSendData;
RvMegacoParseErrorCB parseErrorCb;
void *parseErrorData;
unsigned int parseErrors;
unsigned int sendDelay;
RvRetransTimeoutLimits timeoutLimits;
RvHrtime tMax;
size_t maxPacketSize;
unsigned int curTransactions, totalTransactions;
RvMutex mutex;
RvBool usingInternalAllocs;
RvPool tcbPool, sendBufPool, recvBufPool;
RvSerialMem serialMem;
RvAlloc myTcbAlloc, mySendBufAlloc, myRecvBufAlloc, serialMemAlloc;
int priority;
} RvMegacoStack;
RvMegacoStack *rvMegacoStackConstruct(RvMegacoStack *stack, size_t numThreads, int priority);
RvMegacoStack *rvMegacoStackConstructA(RvMegacoStack *stack, size_t numThreads, int priority,
RvAlloc *genAlloc, RvAlloc *sendBufAlloc, RvAlloc *recvBufAlloc,
RvAlloc *msgAlloc, RvAlloc *entityAlloc, RvAlloc *tcbAlloc);
void rvMegacoStackDestruct(RvMegacoStack *stack);
void rvMegacoStackSetCompactEncodingMode(RvMegacoStack *stack, RvBool enable);
void rvMegacoStackRegisterSecurityKeyCB(RvMegacoStack *stack, RvSecurityKeyCB f, void *data);
void rvMegacoStackRegisterAuthenticationCB(RvMegacoStack *stack, RvAuthenticationCB f, size_t hashLength);
void rvMegacoStackRegisterRawRecvCB(RvMegacoStack *stack, RvMegacoRawCB f, void *data);
void rvMegacoStackRegisterRawSendCB(RvMegacoStack *stack, RvMegacoRawCB f, void *data);
void rvMegacoStackRegisterParseErrorCB(RvMegacoStack *stack, RvMegacoParseErrorCB f, void *data);
unsigned int rvMegacoStackGetAuthenticationFailures(const RvMegacoStack *stack);
void rvMegacoStackClearAuthenticationFailures(RvMegacoStack *stack);
unsigned int rvMegacoStackGetParseErrors(const RvMegacoStack *stack);
void rvMegacoStackClearParseErrors(RvMegacoStack *stack);
void rvMegacoStackSetSendDelay(RvMegacoStack *stack, unsigned int ms);
void rvMegacoStackSetInitialRetransTimeout(RvMegacoStack *stack, unsigned int ms);
void rvMegacoStackSetMinRetransTimeout(RvMegacoStack *stack, unsigned int ms);
void rvMegacoStackSetMaxRetransTimeout(RvMegacoStack *stack, unsigned int ms);
void rvMegacoStackSetRetransWindow(RvMegacoStack *stack, unsigned int ms);
void rvMegacoStackSetMaxPacketSize(RvMegacoStack *stack, size_t packetSize);
unsigned int rvMegacoStackGetSendDelay(RvMegacoStack *stack);
unsigned int rvMegacoStackGetInitialRetransTimeout(const RvMegacoStack *stack);
unsigned int rvMegacoStackGetMinRetransTimeout(const RvMegacoStack *stack);
unsigned int rvMegacoStackGetMaxRetransTimeout(const RvMegacoStack *stack);
unsigned int rvMegacoStackGetRetransWindow(const RvMegacoStack *stack);
size_t rvMegacoStackGetMaxPacketSize(const RvMegacoStack *stack);
#define rvMegacoStackGetPriority(s) ((s)->priority)
#define rvMegacoStackSetMaxUdpPacketSize rvMegacoStackSetMaxPacketSize
#define rvMegacoStackGetMaxUdpPacketSize rvMegacoStackGetMaxPacketSize
/* private: */
void rvMegacoStackStart(RvMegacoStack *stack);
void rvMegacoStackStop(RvMegacoStack *stack);
RvBool rvMegacoStackSendMessage(RvMegacoStack *stack, RvStrStream *msgStream,
RvSocket *socket, const RvSocketAddr *destAddr, RvTransportType transportType);
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -