/src/resiprocate/resip/stack/Pidf.hxx
Line | Count | Source (jump to first uncovered line) |
1 | | #if !defined(RESIP_PIDF_HXX) |
2 | | #define RESIP_PIDF_HXX |
3 | | |
4 | | #include <vector> |
5 | | |
6 | | #include "resip/stack/Contents.hxx" |
7 | | #include "rutil/Data.hxx" |
8 | | #include "rutil/HashMap.hxx" |
9 | | #include "resip/stack/Uri.hxx" |
10 | | #include "rutil/HeapInstanceCounter.hxx" |
11 | | #include "resip/stack/QValue.hxx" |
12 | | |
13 | | namespace resip |
14 | | { |
15 | | |
16 | | /** |
17 | | @deprecated |
18 | | @brief Deprecated |
19 | | |
20 | | SIP body type for holding PIDF contents (MIME content-type application/pidf+xml). |
21 | | */ |
22 | | class Pidf : public Contents |
23 | | { |
24 | | public: |
25 | | static const Pidf Empty; |
26 | | |
27 | | RESIP_HeapCount(Pidf); |
28 | | Pidf(const Mime& contentType); |
29 | | explicit Pidf(const Uri& entity); |
30 | | Pidf(); |
31 | | Pidf(const Data& txt); |
32 | | Pidf(const HeaderFieldValue& hfv, const Mime& contentType); |
33 | | Pidf(const Data& txt, const Mime& contentType); |
34 | | Pidf(const Pidf& rhs); |
35 | | virtual ~Pidf(); |
36 | | Pidf& operator=(const Pidf& rhs); |
37 | | |
38 | | /** @brief duplicate an Pidf object |
39 | | @return pointer to a new Pidf object |
40 | | **/ |
41 | | virtual Contents* clone() const; |
42 | | static const Mime& getStaticType() ; |
43 | | virtual EncodeStream& encodeParsed(EncodeStream& str) const; |
44 | | virtual void parse(ParseBuffer& pb); |
45 | | |
46 | | void setSimpleId(const Data& id); |
47 | | void setEntity(const Uri& entity); |
48 | | const Uri& getEntity() const; |
49 | | void setSimpleStatus(bool online, const Data& note = Data::Empty, |
50 | | const Data& contact = Data::Empty); |
51 | | bool getSimpleStatus(Data* note=NULL) const; |
52 | | |
53 | 0 | Data& text() {checkParsed(); return mNote;} |
54 | | |
55 | | static bool init(); |
56 | | |
57 | | /** @deprecated |
58 | | @brief Deprecated |
59 | | */ |
60 | | class Tuple |
61 | | { |
62 | | public: |
63 | | bool status; |
64 | | Data id; |
65 | | Data contact; |
66 | | QValue contactPriority; |
67 | | Data note; |
68 | | Data timeStamp; |
69 | | HashMap<Data, Data> attributes; |
70 | | }; |
71 | | |
72 | | std::vector<Tuple>& getTuples(); |
73 | | const std::vector<Tuple>& getTuples() const; |
74 | | int getNumTuples() const; |
75 | | |
76 | | // combine tuples |
77 | | void merge(const Pidf& other); |
78 | | |
79 | | private: |
80 | | Data mNote; |
81 | | Uri mEntity; |
82 | | std::vector<Tuple> mTuples; |
83 | | }; |
84 | | |
85 | | EncodeStream& operator<<(EncodeStream& strm, const Pidf::Tuple& tuple); |
86 | | |
87 | | static bool invokePidfInit = Pidf::init(); |
88 | | |
89 | | } |
90 | | |
91 | | #endif |
92 | | |
93 | | /* ==================================================================== |
94 | | * The Vovida Software License, Version 1.0 |
95 | | * |
96 | | * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. |
97 | | * |
98 | | * Redistribution and use in source and binary forms, with or without |
99 | | * modification, are permitted provided that the following conditions |
100 | | * are met: |
101 | | * |
102 | | * 1. Redistributions of source code must retain the above copyright |
103 | | * notice, this list of conditions and the following disclaimer. |
104 | | * |
105 | | * 2. Redistributions in binary form must reproduce the above copyright |
106 | | * notice, this list of conditions and the following disclaimer in |
107 | | * the documentation and/or other materials provided with the |
108 | | * distribution. |
109 | | * |
110 | | * 3. The names "VOCAL", "Vovida Open Communication Application Library", |
111 | | * and "Vovida Open Communication Application Library (VOCAL)" must |
112 | | * not be used to endorse or promote products derived from this |
113 | | * software without prior written permission. For written |
114 | | * permission, please contact vocal@vovida.org. |
115 | | * |
116 | | * 4. Products derived from this software may not be called "VOCAL", nor |
117 | | * may "VOCAL" appear in their name, without prior written |
118 | | * permission of Vovida Networks, Inc. |
119 | | * |
120 | | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED |
121 | | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
122 | | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND |
123 | | * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA |
124 | | * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES |
125 | | * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, |
126 | | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
127 | | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
128 | | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
129 | | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
130 | | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE |
131 | | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
132 | | * DAMAGE. |
133 | | * |
134 | | * ==================================================================== |
135 | | * |
136 | | * This software consists of voluntary contributions made by Vovida |
137 | | * Networks, Inc. and many individuals on behalf of Vovida Networks, |
138 | | * Inc. For more information on Vovida Networks, Inc., please see |
139 | | * <http://www.vovida.org/>. |
140 | | * |
141 | | */ |