📄 rvmegacotrans.h
字号:
#if (0)
******************************************************************************
Filename :rvmegacotrans.h
Description :This file contains the structures used for the Transaction
Manager Control Blocks
******************************************************************************
Copyright (c) 2000 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:$
$Author:L.Amberger$
******************************************************************************
#endif
#ifndef RV_MEGACOTRANS_H
#define RV_MEGACOTRANS_H
#if defined(__cplusplus)
extern "C" {
#endif
#include "rvmutex.h"
#include "rvtimer.h"
#include "rvtime.h"
#include "rvmegacoobjects.h"
#include "rvstrstream.h"
struct RvMegacoStack_;
struct RvMegacoEntity_;
struct RvMegacoTCB_;
/*$
{type:
{name: RvTransactionStatus}
{include: rvmegacotrans.h}
{description:
{p: Possible stack return codes:}
{p: RVTRANSACTIONSTATUS_SENDREQ_LLFAIL: The send of a request failed at the low level. }
{p: RVTRANSACTIONSTATUS_SENDREPLY_LLFAIL: The send of a reply failed at the low level. }
{p: RVTRANSACTIONSTATUS_SENDREQ_FAIL: The send of a request failed. }
{p: RVTRANSACTIONSTATUS_SENDREPLY_TIMEOUT: The send of a reply timed out.No response ACK was received. }
{p: RVTRANSACTIONSTATUS_RCV_REPLY: The transaction was received in reply to a request that was sent.}
{p: RVTRANSACTIONSTATUS_RCV_PENDING_REPLY: A pending reply was received in reply to a request that was sent.}
{p: RVTRANSACTIONSTATUS_RCV_REPLYACK: The ack transaction was received in response to a reply that was sent.}
{p: RVTRANSACTIONSTATUS_TCB_CLEANUP: The transaction control block is being cleaned up. }
}
}
$*/
typedef enum
{
RVTRANSACTIONSTATUS_SENDREQ_LLFAIL,
RVTRANSACTIONSTATUS_SENDREPLY_LLFAIL,
RVTRANSACTIONSTATUS_SENDREQ_FAIL,
RVTRANSACTIONSTATUS_SENDREPLY_TIMEOUT,
RVTRANSACTIONSTATUS_RCV_REPLY,
RVTRANSACTIONSTATUS_RCV_PENDING_REPLY,
RVTRANSACTIONSTATUS_RCV_REPLYACK,
RVTRANSACTIONSTATUS_TCB_CLEANUP,
RVTRANSACTIONSTATUS_ENTITY_DESTRUCT
} RvTransactionStatus;
/*$
{callback:
{name: RvMegacoReplyCb}
{include: rvmegacotrans.h}
{description:
{p: Template for application callbacks for handling replies to requests.}
}
{proto: typedef void (*RvMegacoReplyCb)(RvMegacoTcb *tcb, const RvMegacoTransactionReply *reply, void *data, RvTransactionStatus code);}
{params:
{param: {n:tcb} {d:The transaction control block.}}
{param: {n:reply} {d:The transaction reply.}}
{param: {n:data} {d:The user data pointer that was passed when the request was sent.}}
{param: {n:code} {d:The RvTransactionStatus provides status information}}
}
}
$*/
typedef void (*RvMegacoReplyCb)(struct RvMegacoTCB_ *, const RvMegacoTransactionReply *, void *, RvTransactionStatus);
/*$
{callback:
{name: RvMegacoAckCB}
{include: rvmegacotrans.h}
{description:
{p: Template for application callbacks for handling reply acknowledgements.}
}
{proto: typedef void (*RvMegacoAckCB)( RvMegacoTcb *tcb, void *data, RvTransactionStatus code);}
{params:
{param: {n:tcb} {d:The transaction control block.}}
{param: {n:data} {d:The user data pointer that was passed when the reply was sent.}}
{param: {n:code} {d:The RvTransactionStatus provides status information}}
}
}
$*/
typedef void (*RvMegacoAckCB)(struct RvMegacoTCB_ *, void* , RvTransactionStatus );
/*$
{type:
{name: RvMegacoTcb}
{include: rvmegacotrans.h}
{description:
{p: A megaco transaction control block,
used to associate transactions with their responses.}
}
{methods:
{method: RvMegacoTransactionId rvMegacoTcbGetId(const RvMegacoTcb *tcb);}
{method: void rvMegacoTcbSendReply(RvMegacoTcb *tcb, const RvMegacoTransactionReply *t, RvMegacoAckCB f, void *data);}
{method: void rvMegacoTcbSendPending(RvMegacoTcb *tcb, RvMegacoAckCB f, void *data);}
}
}
$*/
typedef enum /* The possible transaction states*/
{
RV_MEGACOTCB_STATE_IDLE,
RV_MEGACOTCB_STATE_RESP_TO_SEND,
RV_MEGACOTCB_STATE_RESPONDED,
RV_MEGACOTCB_STATE_WAITAPPLRESPONSE,
RV_MEGACOTCB_STATE_CMD_TO_SEND,
RV_MEGACOTCB_STATE_CMDSENT,
RV_MEGACOTCB_STATE_INACTIVE,
RV_MEGACOTCB_STATE_CMD_SEND_FAIL,
RV_MEGACOTCB_STATE_RESP_SEND_FAIL
} RvMegacoTcbState;
/* Below is the Control Block Structure for Transactions.*/
typedef struct RvMegacoTCB_
{
RvMutex lock; /* Mutex (Semaphore) for this TCB */
RvMegacoTransactionId tId;
RvMegacoTcbState state; /* Transaction State*/
RvTimer Timer[2];
RvUint CurrentTimer;
RvBool firstSend; /* first time message sent? */
RvBool SentPending; /* has a pending response been sent? */
RvBool msgFreed; /* has a encoded transaction been freed? */
RvBool useLocal; /* Was this TCB stored under the local entity or not? */
RvBool EntityDestructed; /* Flag to indicate that the Entity for this TCB was deleted */
RvBool replyReceived; /* Has a reply been received? */
RvHrtime OrigSendTime; /* Timestamp for original message send */
RvHrtime TimerStartTime; /* Timestamp for this send attempt */
RvStrStream encodedTransaction; /* Pointer to the message buffer */
RvMegacoReplyCb ReplyCallBack; /* Pointer to the callback - when a command was sent */
RvMegacoAckCB AckCallBack;/* Pointer to callback - when a reply was sent */
void *data; /* The application data associated with the current command */
struct RvMegacoStack_ *stack;
struct RvMegacoEntity_ *destEntity;
struct RvMegacoEntity_ *localEntity;
} RvMegacoTcb;
/*$
{function:
{name: rvMegacoTcbGetId}
{class: RvMegacoTcb}
{include: rvmegacotrans.h}
{description:
{p: Gets the transaction id of the transaction control block.}
}
{proto: RvMegacoTransactionId rvMegacoTcbGetId(const RvMegacoTcb *tcb);}
{params:
{param: {n:tcb} {d:The transaction control block.}}
}
{returns: The transaction id.}
}
$*/
#define rvMegacoTcbGetId(t) ((t)->tId)
#define rvMegacoTcbGetUserData(t) ((t)->data)
/*$
{function:
{name: rvMegacoTcbGetLocalEntity}
{class: RvMegacoTcb}
{include: rvmegacotrans.h}
{description:
{p: Gets the local entity associated with the transaction control block.}
}
{proto: RvMegacoEntity *rvMegacoTcbGetLocalEntity(const RvMegacoTcb *tcb);}
{params:
{param: {n:tcb} {d:The transaction control block.}}
}
{returns: A pointer to the local entity for the transaction.}
}
$*/
#define rvMegacoTcbGetLocalEntity(tcb) ((tcb)->localEntity)
/*$
{function:
{name: rvMegacoTcbGetRemoteEntity}
{class: RvMegacoTcb}
{include: rvmegacotrans.h}
{description:
{p: Gets the remote entity associated with the transaction control block.}
}
{proto: RvMegacoEntity *rvMegacoTcbGetRemoteEntity(const RvMegacoTcb *tcb);}
{params:
{param: {n:tcb} {d:The transaction control block.}}
}
{returns: A pointer to the remote entity for the transaction.}
}
$*/
#define rvMegacoTcbGetRemoteEntity(tcb) ((tcb)->destEntity)
/* Private *//* Private *//* Private *//* Private *//* Private */
#define RV_MEGACOTCB_ENCODEBUFINITSIZE 256
void rvMegacoTcbMarkForDestruct(RvMegacoTcb *tcbPtr,RvTransactionStatus reason);
void rvMegacoTcbUpdateOnSend (RvMegacoTcb *tcb);
void rvMegacoTcbUpdateFailedSend (RvMegacoTcb *tcb);
void rvMegacoTcbSendReply(RvMegacoTcb *tcbPtr, const RvMegacoTransactionReply *t, RvMegacoAckCB f, void *data);
void rvMegacoTcbSendPending(RvMegacoTcb *tcbPtr, RvMegacoAckCB f, void *data);
#if defined(__cplusplus)
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -