📄 siptransactionlevels.hxx
字号:
#ifndef _Sip_Transaction_Levels__hxx#define _Sip_Transaction_Levels__hxx/* ==================================================================== * The Vovida Software License, Version 1.0 * * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The names "VOCAL", "Vovida Open Communication Application Library", * and "Vovida Open Communication Application Library (VOCAL)" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact vocal@vovida.org. * * 4. Products derived from this software may not be called "VOCAL", nor * may "VOCAL" appear in their name, without prior written * permission of Vovida Networks, Inc. * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. * * ==================================================================== * * This software consists of voluntary contributions made by Vovida * Networks, Inc. and many individuals on behalf of Vovida Networks, * Inc. For more information on Vovida Networks, Inc., please see * <http://www.vovida.org/>. * */static const char* const SipTransactionLevels_hxx_version = "$Id: SipTransactionLevels.hxx,v 1.10.2.2 2003/02/20 10:14:32 chok Exp $";#include "SipTransactionId.hxx"#include "SipTransactionList.hxx"#include "SipTransHashTable.hxx"#include "SipMsg.hxx"#include "VRWLock.hxx"#include "VMutex.h"#include "NetworkAddress.h"#include "cpLog.h"namespace Vocal{ #define DEBUG_NEW_STACK LOG_DEBUG_STACKstruct SipTransLevel1Node;struct SipTransLevel2Node;struct SipTransLevel3Node;struct SipMsgPair;struct SipMsgContainer;static const char * const NOVAL = "";/** * this is top level node that'll be accessible from the hash table. hence, * we'll not keep the key value here (it's uniquely accessible) */struct SipTransLevel1Node{ /// state specific data Data toTag; Data fromTag; int msgCount; /// next level list SipTransactionList<SipTransLevel2Node*> level2; /** lock for processing the call leg * for 1xx responses we'll need the read lock only, for other msgs * write lock * keep it simple, just lock all as write lock */ VMutex lock; /// back reference into hashtable (needed by cleanup thread) SipTransHashTable::Node* bucketNode; SipTransLevel1Node() : toTag(NOVAL), fromTag(NOVAL), msgCount(0),level2(), lock(), bucketNode(0) {} SipTransactionList<SipTransLevel2Node*>::SipTransListNode * findOrInsert(const SipTransactionId& id); SipTransactionList<SipTransLevel2Node*>::SipTransListNode * find(const SipTransactionId& id); SipTransactionList<SipTransLevel3Node*>::SipTransListNode * findLevel3AckInvite(const SipTransactionId& id);};struct SipTransLevel2Node{ /// the 2nd level key SipTransactionId::KeyTypeII myKey; bool seqSet; int seqNumber; /// next level list SipTransactionList<SipTransLevel3Node*> level3; /************ TO DO **************\ * either put a ref to self's container in list of prev level* * or some thing to get the ref to self's container * * (in level2 and level3 nodes) * * modify transaction GC and sent res/req DBs * \*********************************/ /// back reference to the top level node SipTransLevel1Node * topNode; SipTransactionList<SipTransLevel2Node*>::SipTransListNode *myPtr; SipTransLevel2Node() : myKey(), seqSet(false), seqNumber(-1), level3(), topNode(0), myPtr(0) {} SipTransactionList<SipTransLevel3Node*>::SipTransListNode * findOrInsert(const SipTransactionId& id); SipTransactionList<SipTransLevel3Node*>::SipTransListNode * find(const SipTransactionId& id); SipTransactionList<SipTransLevel3Node*>::SipTransListNode * findInvite();};struct SipMsgPair{ /// the request SipMsgContainer *request; /// and the response SipMsgContainer *response; SipMsgPair() : request(0), response(0) {} ~SipMsgPair() { /// these are deleted explicitly by the cleanup }};struct SipTransLevel3Node{ /// the 3rd level key SipTransactionId::KeyTypeIII myKey; /// message sequence. we don't want to keep a msg queue here 'coz /// on every recieve a copy of msg queue is constructed anyway. /// atleast keep the operations fast by direct lookup. /// /// NOTE: the msg queue for ACK's will be constructed by combining /// it w/ level3 node of INVITE SipMsgPair msgs; /************ TO DO **************\ * either put a ref to self's container in list of prev level * * or some thing to get the ref to self's container * * (in level2 and level3 nodes) * * modify transaction GC and sent res/req DBs * \*********************************/ /// back reference to level2 node SipTransLevel2Node *level2Ptr; SipTransactionList<SipTransLevel3Node*>::SipTransListNode *myPtr; SipTransLevel3Node() : myKey(), msgs(), level2Ptr(0), myPtr(0) {}};struct SipMsgContainer{ struct m { /// refence to the message (for incoming messages) Sptr<SipMsg> in; /// reference to raw msg txt (for outgoing messages) Data out; //Host Sptr<NetworkAddress> netAddr; // int type; // Data transport; } msg; /// transport specific data int retransCount; bool collected; /************ TO DO **************\ * either put a ref to self's container in list of prev level * * or some thing to get the ref to self's container * * (in level2 and level3 nodes) * * modify transaction GC and sent res/req DBs * \*********************************/ /// back reference to level3 node SipTransLevel3Node *level3Ptr; /// to control race between CANCEL and transport layer VMutex myLock; /// constructed with default value for stateless mode SipMsgContainer() : msg(), retransCount(1),collected(false), level3Ptr(0), myLock() {}}; } // namespace Vocal/* Local Variables: *//* c-file-style: "stroustrup" *//* indent-tabs-mode: nil *//* c-file-offsets: ((access-label . -) (inclass . ++)) *//* c-basic-offset: 4 *//* End: */#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -