reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
Mime.hxx
Go to the documentation of this file.
1#if !defined(RESIP_MIME_HXX)
2#define RESIP_MIME_HXX
3
4#include <iosfwd>
5#include "rutil/Data.hxx"
6#include "rutil/HashMap.hxx"
9
10namespace resip
11{
12
13class HeaderFieldValue;
14
19class Mime : public ParserCategory
20{
21 public:
23
24 Mime();
25 Mime(const Data& type, const Data& subType);
26 Mime(const HeaderFieldValue& hfv,
28 PoolBase* pool=0);
29 Mime(const Mime& orig,
30 PoolBase* pool=0);
31 Mime& operator=(const Mime&);
32 bool operator<(const Mime& rhs) const;
33 bool isEqual(const Mime& rhs) const;
34 bool operator==(const Mime& rhs) const;
35 bool operator!=(const Mime& rhs) const;
36
37 const Data& type() const;
38 const Data& subType() const;
39 Data& type();
40 Data& subType();
41
42 virtual void parse(ParseBuffer& pb);
43 virtual ParserCategory* clone() const;
44 virtual ParserCategory* clone(void* location) const;
45 virtual ParserCategory* clone(PoolBase* pool) const;
46
47 virtual EncodeStream& encodeParsed(EncodeStream& str) const;
48
49 // Inform the compiler that overloads of these may be found in
50 // ParserCategory, too.
54
55 virtual Parameter* createParam(ParameterTypes::Type type, ParseBuffer& pb, const std::bitset<256>& terminators, PoolBase* pool);
56 bool exists(const Param<Mime>& paramType) const;
57 void remove(const Param<Mime>& paramType);
58
59#define defineParam(_enum, _name, _type, _RFC_ref_ignored) \
60 const _enum##_Param::DType& param(const _enum##_Param& paramType) const; \
61 _enum##_Param::DType& param(const _enum##_Param& paramType); \
62 friend class _enum##_Param
63
64 defineParam(accessType, "access-type", DataParameter, "RFC 2046");
65 defineParam(boundary, "boundary", DataParameter, "RFC 2046");
66 defineParam(charset, "charset", DataParameter, "RFC 2045");
67 defineParam(directory, "directory", DataParameter, "RFC 2046");
68 defineParam(expiration, "expiration", QuotedDataParameter, "RFC 2046");
69 defineParam(micalg, "micalg", DataParameter, "RFC 1847");
70 defineParam(mode, "mode", DataParameter, "RFC 2046");
71 defineParam(name, "name", DataParameter, "RFC 2046");
72 defineParam(permission, "permission", DataParameter, "RFC 2046");
73 defineParam(protocol, "protocol", QuotedDataParameter, "RFC 1847");
74 defineParam(q, "q", QValueParameter, "RFC 3261");
75 defineParam(server, "server", DataParameter, "RFC 2046");
76 defineParam(site, "site", DataParameter, "RFC 2046");
77 defineParam(size, "size", DataParameter, "RFC 2046");
78 defineParam(smimeType, "smime-type", DataParameter, "RFC 2633");
79 defineParam(url, "url", QuotedDataParameter, "RFC 4483");
80
81#undef defineParam
82
83 private:
84 Data mType;
85 Data mSubType;
86
88};
90
91}
92
93
95
96#endif
97
98/* ====================================================================
99 * The Vovida Software License, Version 1.0
100 *
101 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
102 *
103 * Redistribution and use in source and binary forms, with or without
104 * modification, are permitted provided that the following conditions
105 * are met:
106 *
107 * 1. Redistributions of source code must retain the above copyright
108 * notice, this list of conditions and the following disclaimer.
109 *
110 * 2. Redistributions in binary form must reproduce the above copyright
111 * notice, this list of conditions and the following disclaimer in
112 * the documentation and/or other materials provided with the
113 * distribution.
114 *
115 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
116 * and "Vovida Open Communication Application Library (VOCAL)" must
117 * not be used to endorse or promote products derived from this
118 * software without prior written permission. For written
119 * permission, please contact vocal@vovida.org.
120 *
121 * 4. Products derived from this software may not be called "VOCAL", nor
122 * may "VOCAL" appear in their name, without prior written
123 * permission of Vovida Networks, Inc.
124 *
125 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
126 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
127 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
128 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
129 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
130 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
131 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
132 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
133 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
134 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
135 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
136 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
137 * DAMAGE.
138 *
139 * ====================================================================
140 *
141 * This software consists of voluntary contributions made by Vovida
142 * Networks, Inc. and many individuals on behalf of Vovida Networks,
143 * Inc. For more information on Vovida Networks, Inc., please see
144 * <http://www.vovida.org/>.
145 *
146 */
Wraps your platform's implementation of hash_map, hash_multimap, and hash_set.
#define HashValue(type)
Definition HashMap.hxx:18
Generically represents miscellaneous parameter data.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
Represents the "media-type" element in the RFC 3261 grammar.
Definition Mime.hxx:20
virtual void parse(ParseBuffer &pb)
Definition Mime.cxx:120
static constexpr CommaHandlingMode commaHandling
Definition Mime.hxx:22
virtual Parameter * createParam(ParameterTypes::Type type, ParseBuffer &pb, const std::bitset< 256 > &terminators, PoolBase *pool)
Definition Mime.cxx:168
defineParam(name, "name", DataParameter, "RFC 2046")
virtual ParserCategory * clone() const
Definition Mime.cxx:140
const Data & subType() const
Definition Mime.cxx:100
defineParam(directory, "directory", DataParameter, "RFC 2046")
defineParam(size, "size", DataParameter, "RFC 2046")
defineParam(accessType, "access-type", DataParameter, "RFC 2046")
bool isEqual(const Mime &rhs) const
Definition Mime.cxx:74
defineParam(permission, "permission", DataParameter, "RFC 2046")
defineParam(charset, "charset", DataParameter, "RFC 2045")
bool exists(const Param< Mime > &paramType) const
Definition Mime.cxx:178
defineParam(mode, "mode", DataParameter, "RFC 2046")
defineParam(site, "site", DataParameter, "RFC 2046")
defineParam(smimeType, "smime-type", DataParameter, "RFC 2633")
bool operator!=(const Mime &rhs) const
Definition Mime.cxx:88
Mime & operator=(const Mime &)
Definition Mime.cxx:48
defineParam(server, "server", DataParameter, "RFC 2046")
bool operator==(const Mime &rhs) const
Definition Mime.cxx:81
defineParam(q, "q", QValueParameter, "RFC 3261")
bool operator<(const Mime &rhs) const
Definition Mime.cxx:60
defineParam(url, "url", QuotedDataParameter, "RFC 4483")
defineParam(protocol, "protocol", QuotedDataParameter, "RFC 1847")
void remove(const Param< Mime > &paramType)
Definition Mime.cxx:186
const Data & type() const
Definition Mime.cxx:94
defineParam(micalg, "micalg", DataParameter, "RFC 1847")
defineParam(expiration, "expiration", QuotedDataParameter, "RFC 2046")
virtual EncodeStream & encodeParsed(EncodeStream &str) const
Definition Mime.cxx:158
defineParam(boundary, "boundary", DataParameter, "RFC 2046")
Parameter *(* Factory)(ParameterTypes::Type, ParseBuffer &, const std::bitset< 256 > &terminators, PoolBase *pool)
Provides string-parsing functionality with protection from buffer overflow.
Base class for all SIP grammar elements that can have parameters.
void remove(const ParamBase &paramType)
Removes a natively supported parameter, if the parameter is present.
bool exists(const ParamBase &paramType) const
Checks for the existence of a natively supported parameter.
const Data & param(const ExtensionParameter &param) const
Const accessor for non-natively-supported parameter types.
Container class for ParserCategory, used by SipMessage to represent multi-valued headers (Contact,...
Represents the "q" parameter value of the RFC 3261 grammar.
Generically represents miscellaneous parameter data that is encoded using double quotes.
dcm! – add UnusedChecking(_enum) below;
ParserContainer< Mime > Mimes
Definition Headers.hxx:164
#define EncodeStream