|
reSIProcate/stack
9694
|
00001 #if !defined(RESIP_NAME_ADDR_HXX) 00002 #define RESIP_NAME_ADDR_HXX 00003 00004 #include <iosfwd> 00005 #include "rutil/Data.hxx" 00006 #include "resip/stack/ParserCategory.hxx" 00007 #include "resip/stack/ParserContainer.hxx" 00008 #include "resip/stack/Uri.hxx" 00009 00010 namespace resip 00011 { 00012 00018 class NameAddr : public ParserCategory 00019 { 00020 public: 00021 enum {commaHandling = CommasAllowedOutputMulti}; 00022 00023 NameAddr(); 00024 NameAddr(const HeaderFieldValue& hfv, 00025 Headers::Type type, 00026 PoolBase* pool=0); 00027 explicit NameAddr(const Uri& orig); 00028 explicit NameAddr(const Data& unparsed, bool preCacheAor=false); 00029 00030 NameAddr(const NameAddr& orig, 00031 PoolBase* pool=0); 00032 NameAddr& operator=(const NameAddr&); 00033 bool operator==(const NameAddr& other) const; 00034 00035 virtual ~NameAddr(); 00036 00037 Uri& uri(); 00038 const Uri& uri() const; 00039 Data& displayName(); 00040 const Data& displayName() const; 00041 bool isAllContacts() const; 00042 void setAllContacts(); 00043 00044 virtual void parse(ParseBuffer& pb); 00045 virtual ParserCategory* clone() const; 00046 virtual ParserCategory* clone(void* location) const; 00047 virtual ParserCategory* clone(PoolBase* pool) const; 00048 virtual EncodeStream& encodeParsed(EncodeStream& str) const; 00049 00050 bool operator<(const NameAddr& other) const; 00051 00052 bool mustQuoteDisplayName() const; 00053 00054 // Inform the compiler that overloads of these may be found in 00055 // ParserCategory, too. 00056 using ParserCategory::exists; 00057 using ParserCategory::remove; 00058 using ParserCategory::param; 00059 00060 virtual Parameter* createParam(ParameterTypes::Type type, ParseBuffer& pb, const std::bitset<256>& terminators, PoolBase* pool); 00061 bool exists(const Param<NameAddr>& paramType) const; 00062 void remove(const Param<NameAddr>& paramType); 00063 00064 #define defineParam(_enum, _name, _type, _RFC_ref_ignored) \ 00065 const _enum##_Param::DType& param(const _enum##_Param& paramType) const; \ 00066 _enum##_Param::DType& param(const _enum##_Param& paramType); \ 00067 friend class _enum##_Param 00068 00069 defineParam(data, "data", ExistsParameter, "RFC 3840"); 00070 defineParam(control, "control", ExistsParameter, "RFC 3840"); 00071 defineParam(mobility, "mobility", QuotedDataParameter, "RFC 3840"); // mobile|fixed 00072 defineParam(description, "description", QuotedDataParameter, "RFC 3840"); // <> quoted 00073 defineParam(events, "events", QuotedDataParameter, "RFC 3840"); // list 00074 defineParam(priority, "priority", QuotedDataParameter, "RFC 3840"); // non-urgent|normal|urgent|emergency 00075 defineParam(methods, "methods", QuotedDataParameter, "RFC 3840"); // list 00076 defineParam(schemes, "schemes", QuotedDataParameter, "RFC 3840"); // list 00077 defineParam(application, "application", ExistsParameter, "RFC 3840"); 00078 defineParam(video, "video", ExistsParameter, "RFC 3840"); 00079 defineParam(language, "language", QuotedDataParameter, "RFC 3840"); // list 00080 defineParam(type, "type", QuotedDataParameter, "RFC 3840"); // list 00081 defineParam(isFocus, "isfocus", ExistsParameter, "RFC 3840"); 00082 defineParam(actor, "actor", QuotedDataParameter, "RFC 3840"); // principal|msg-taker|attendant|information 00083 defineParam(text, "text", ExistsOrDataParameter, "RFC 3840"); 00084 defineParam(extensions, "extensions", QuotedDataParameter, "RFC 3840"); //list 00085 defineParam(Instance, "+sip.instance", QuotedDataParameter, "RFC 5626"); // <> quoted 00086 defineParam(regid, "reg-id", UInt32Parameter, "RFC 5626"); 00087 defineParam(pubGruu, "pub-gruu", QuotedDataParameter, "RFC 5627"); 00088 defineParam(tempGruu, "temp-gruu", QuotedDataParameter, "RFC 5627"); 00089 defineParam(expires, "expires", UInt32Parameter, "RFC 3261"); 00090 defineParam(q, "q", QValueParameter, "RFC 3261"); 00091 defineParam(tag, "tag", DataParameter, "RFC 3261"); 00092 00093 #undef defineParam 00094 00095 protected: 00096 bool mAllContacts; 00097 Uri mUri; 00098 Data mDisplayName; 00099 Data* mUnknownUriParametersBuffer; 00100 00101 private: 00102 00103 static ParameterTypes::Factory ParameterFactories[ParameterTypes::MAX_PARAMETER]; 00104 }; 00105 typedef ParserContainer<NameAddr> NameAddrs; 00106 00107 } 00108 00109 #endif 00110 /* ==================================================================== 00111 * The Vovida Software License, Version 1.0 00112 * 00113 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. 00114 * 00115 * Redistribution and use in source and binary forms, with or without 00116 * modification, are permitted provided that the following conditions 00117 * are met: 00118 * 00119 * 1. Redistributions of source code must retain the above copyright 00120 * notice, this list of conditions and the following disclaimer. 00121 * 00122 * 2. Redistributions in binary form must reproduce the above copyright 00123 * notice, this list of conditions and the following disclaimer in 00124 * the documentation and/or other materials provided with the 00125 * distribution. 00126 * 00127 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00128 * and "Vovida Open Communication Application Library (VOCAL)" must 00129 * not be used to endorse or promote products derived from this 00130 * software without prior written permission. For written 00131 * permission, please contact vocal@vovida.org. 00132 * 00133 * 4. Products derived from this software may not be called "VOCAL", nor 00134 * may "VOCAL" appear in their name, without prior written 00135 * permission of Vovida Networks, Inc. 00136 * 00137 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00138 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00139 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00140 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00141 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00142 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00143 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00144 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00145 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00146 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00147 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00148 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00149 * DAMAGE. 00150 * 00151 * ==================================================================== 00152 * 00153 * This software consists of voluntary contributions made by Vovida 00154 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00155 * Inc. For more information on Vovida Networks, Inc., please see 00156 * <http://www.vovida.org/>. 00157 * 00158 */
1.7.5.1