reSIProcate/stack  9694
Via.hxx
Go to the documentation of this file.
00001 #if !defined(RESIP_VIA_HXX)
00002 #define RESIP_VIA_HXX 
00003 
00004 #include <iosfwd>
00005 #include "rutil/Data.hxx"
00006 #include "resip/stack/ParserCategory.hxx"
00007 #include "resip/stack/ParserContainer.hxx"
00008 
00009 namespace resip
00010 {
00011 class PoolBase;
00012 
00017 class Via : public ParserCategory
00018 {
00019    public:
00020       enum {commaHandling = CommasAllowedOutputMulti};
00021 
00022       Via();
00023       Via(const HeaderFieldValue& hfv, 
00024             Headers::Type type,
00025             PoolBase* pool=0);
00026       Via(const Via& orig,
00027             PoolBase* pool=0);
00028       Via& operator=(const Via&);
00029 
00030       Data& protocolName();
00031       const Data& protocolName() const;
00032       Data& protocolVersion();
00033       const Data& protocolVersion() const;
00034       Data& transport();
00035       const Data& transport() const;
00036       Data& sentHost();
00037       const Data& sentHost() const;
00038       int& sentPort();
00039       int sentPort() const;
00040 
00041       virtual void parse(ParseBuffer& pb);
00042       virtual ParserCategory* clone() const;
00043       virtual ParserCategory* clone(void* location) const;
00044       virtual ParserCategory* clone(PoolBase* pool) const;
00045       virtual EncodeStream& encodeParsed(EncodeStream& str) const;
00046 
00047       // Inform the compiler that overloads of these may be found in
00048       // ParserCategory, too.
00049       using ParserCategory::exists;
00050       using ParserCategory::remove;
00051       using ParserCategory::param;
00052 
00053       virtual Parameter* createParam(ParameterTypes::Type type, ParseBuffer& pb, const std::bitset<256>& terminators, PoolBase* pool);
00054       bool exists(const Param<Via>& paramType) const;
00055       void remove(const Param<Via>& paramType);
00056 
00057 #define defineParam(_enum, _name, _type, _RFC_ref_ignored)                      \
00058       const _enum##_Param::DType& param(const _enum##_Param& paramType) const;  \
00059       _enum##_Param::DType& param(const _enum##_Param& paramType); \
00060       friend class _enum##_Param
00061 
00062 defineParam(branch, "branch", BranchParameter, "RFC 3261");
00063 defineParam(comp, "comp", DataParameter, "RFC 3486");
00064 defineParam(received, "received", DataParameter, "RFC 3261");
00065 defineParam(rport, "rport", RportParameter, "RFC 3581");
00066 defineParam(ttl, "ttl", UInt32Parameter, "RFC 3261");
00067 defineParam(sigcompId, "sigcomp-id", QuotedDataParameter, "RFC 5049");
00068 defineParam(maddr, "maddr", DataParameter, "RFC 3261");
00069 
00070 #undef defineParam
00071 
00072    private:
00073       Data mProtocolName;
00074       Data mProtocolVersion;
00075       Data mTransport;
00076       Data mSentHost;
00077       int mSentPort;
00078 
00079       static ParameterTypes::Factory ParameterFactories[ParameterTypes::MAX_PARAMETER];
00080 };
00081 typedef ParserContainer<Via> Vias;
00082 
00083  
00084 }
00085 
00086 
00087 #endif
00088 
00089 /* ====================================================================
00090  * The Vovida Software License, Version 1.0 
00091  * 
00092  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00093  * 
00094  * Redistribution and use in source and binary forms, with or without
00095  * modification, are permitted provided that the following conditions
00096  * are met:
00097  * 
00098  * 1. Redistributions of source code must retain the above copyright
00099  *    notice, this list of conditions and the following disclaimer.
00100  * 
00101  * 2. Redistributions in binary form must reproduce the above copyright
00102  *    notice, this list of conditions and the following disclaimer in
00103  *    the documentation and/or other materials provided with the
00104  *    distribution.
00105  * 
00106  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00107  *    and "Vovida Open Communication Application Library (VOCAL)" must
00108  *    not be used to endorse or promote products derived from this
00109  *    software without prior written permission. For written
00110  *    permission, please contact vocal@vovida.org.
00111  *
00112  * 4. Products derived from this software may not be called "VOCAL", nor
00113  *    may "VOCAL" appear in their name, without prior written
00114  *    permission of Vovida Networks, Inc.
00115  * 
00116  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00117  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00118  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00119  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00120  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00121  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00122  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00123  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00124  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00125  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00126  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00127  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00128  * DAMAGE.
00129  * 
00130  * ====================================================================
00131  * 
00132  * This software consists of voluntary contributions made by Vovida
00133  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00134  * Inc.  For more information on Vovida Networks, Inc., please see
00135  * <http://www.vovida.org/>.
00136  *
00137  */