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