reSIProcate/repro  9694
ProcessorMessage.hxx
Go to the documentation of this file.
00001 #ifndef PROCESSOR_MESSAGE_HXX
00002 #define PROCESSOR_MESSAGE_HXX 1
00003 
00004 #include "resip/stack/ApplicationMessage.hxx"
00005 #include "resip/stack/TransactionUser.hxx"
00006 #include "repro/Processor.hxx"
00007 
00008 namespace repro
00009 {
00010 
00011 class ProcessorMessage : public resip::ApplicationMessage
00012 {
00013    public:
00014    
00015       ProcessorMessage(const Processor& proc,
00016                        const resip::Data& tid,
00017                        resip::TransactionUser* tupassed):
00018          mTid(tid)
00019       {
00020          mTu = tupassed;
00021          mReturnAddress = proc.getAddress();
00022          mOriginatorAddress = mReturnAddress;
00023          mType = proc.getChainType();
00024       }
00025 
00026       ProcessorMessage(const ProcessorMessage& orig) :
00027          resip::ApplicationMessage(orig),
00028          mTid(orig.mTid)
00029       {
00030          mReturnAddress=orig.mReturnAddress;
00031          mOriginatorAddress=orig.mOriginatorAddress;
00032          mType=orig.mType;
00033       }
00034 
00035       virtual ~ProcessorMessage(){}
00036 
00037       void pushAddr(int addr)
00038       {
00039          mReturnAddress.push_back(addr);
00040       }
00041       
00042       int popAddr()
00043       {
00044          if(mReturnAddress.empty())
00045          {
00046             return 0;
00047          }
00048          
00049          int addr = mReturnAddress.back();
00050          mReturnAddress.pop_back();
00051          return addr;
00052       }
00053       
00054       std::vector<short>& getOriginatorAddress()
00055       {
00056          return mOriginatorAddress;
00057       }
00058 
00059       Processor::ChainType chainType() const
00060       {
00061          return mType;
00062       }
00063 
00064       virtual Message* clone() const = 0;
00065 
00066       virtual EncodeStream& encode(EncodeStream& strm) const = 0;
00067       virtual EncodeStream& encodeBrief(EncodeStream& strm) const = 0;
00068 
00069       virtual const resip::Data& getTransactionId() const
00070       {
00071          return mTid;
00072       }
00073 
00074    protected:
00075       resip::Data mTid;
00076       std::vector<short> mReturnAddress;
00077       std::vector<short> mOriginatorAddress;
00078       Processor::ChainType mType;
00079 };
00080 
00081 }
00082 #endif
00083 
00084 /* ====================================================================
00085  * The Vovida Software License, Version 1.0 
00086  * 
00087  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00088  * 
00089  * Redistribution and use in source and binary forms, with or without
00090  * modification, are permitted provided that the following conditions
00091  * are met:
00092  * 
00093  * 1. Redistributions of source code must retain the above copyright
00094  *    notice, this list of conditions and the following disclaimer.
00095  * 
00096  * 2. Redistributions in binary form must reproduce the above copyright
00097  *    notice, this list of conditions and the following disclaimer in
00098  *    the documentation and/or other materials provided with the
00099  *    distribution.
00100  * 
00101  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00102  *    and "Vovida Open Communication Application Library (VOCAL)" must
00103  *    not be used to endorse or promote products derived from this
00104  *    software without prior written permission. For written
00105  *    permission, please contact vocal@vovida.org.
00106  *
00107  * 4. Products derived from this software may not be called "VOCAL", nor
00108  *    may "VOCAL" appear in their name, without prior written
00109  *    permission of Vovida Networks, Inc.
00110  * 
00111  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00112  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00113  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00114  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00115  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00116  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00117  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00118  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00119  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00120  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00121  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00122  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00123  * DAMAGE.
00124  * 
00125  * ====================================================================
00126  * 
00127  * This software consists of voluntary contributions made by Vovida
00128  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00129  * Inc.  For more information on Vovida Networks, Inc., please see
00130  * <http://www.vovida.org/>.
00131  *
00132  */