/[resiprocate]/main/sip/resiprocate/X_msMsgsInvite.cxx
ViewVC logotype

Annotation of /main/sip/resiprocate/X_msMsgsInvite.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3232 - (hide annotations) (download)
Fri Aug 6 03:06:55 2004 UTC (15 years, 5 months ago) by jason
File size: 5071 byte(s)
compile issue



1 fluffy 1741 #if defined(HAVE_CONFIG_H)
2     #include "resiprocate/config.hxx"
3     #endif
4    
5 davidb 1572 #include "resiprocate/X_msMsgsInvite.hxx"
6     #include "resiprocate/SipMessage.hxx"
7     #include "resiprocate/os/Logger.hxx"
8 jason 3232 #include "resiprocate/os/ParseBuffer.hxx"
9 davidb 1572
10     using namespace resip;
11     using namespace std;
12    
13     #define RESIPROCATE_SUBSYSTEM Subsystem::SIP
14    
15 davidb 2299 bool
16     X_msMsgsInvite::init()
17     {
18     static ContentsFactory<X_msMsgsInvite> factory;
19     (void)factory;
20     return true;
21     }
22 davidb 1572
23     X_msMsgsInvite::X_msMsgsInvite()
24     : Contents(getStaticType()),
25     mPort(0),
26     mHost()
27     {}
28    
29     X_msMsgsInvite::X_msMsgsInvite(const Data& txt)
30     : Contents(getStaticType()),
31     mPort(0),
32     mHost()
33     {}
34    
35     X_msMsgsInvite::X_msMsgsInvite(HeaderFieldValue* hfv, const Mime& contentsType)
36     : Contents(hfv, contentsType),
37     mPort(0),
38     mHost()
39     {}
40    
41     X_msMsgsInvite::X_msMsgsInvite(const Data& txt, const Mime& contentsType)
42     : Contents(contentsType),
43     mPort(0),
44     mHost()
45     {}
46    
47     X_msMsgsInvite::X_msMsgsInvite(const X_msMsgsInvite& rhs)
48     : Contents(rhs),
49     mPort(rhs.mPort),
50     mHost(rhs.mHost)
51     {}
52    
53     X_msMsgsInvite::~X_msMsgsInvite()
54     {}
55    
56     X_msMsgsInvite&
57     X_msMsgsInvite::operator=(const X_msMsgsInvite& rhs)
58     {
59     if (this != &rhs)
60     {
61     Contents::operator=(rhs);
62     mPort = rhs.mPort;
63     mHost = rhs.mHost;
64     }
65     return *this;
66     }
67    
68     Contents*
69     X_msMsgsInvite::clone() const
70     {
71     return new X_msMsgsInvite(*this);
72     }
73    
74     const Mime&
75     X_msMsgsInvite::getStaticType()
76     {
77     // set charset ?dlb?
78     static Mime type("text","x-msmsgsinvite");
79    
80     return type;
81     }
82    
83     std::ostream&
84     X_msMsgsInvite::encodeParsed(std::ostream& str) const
85     {
86     for (Attributes::const_iterator i = mAttributes.begin();
87     i != mAttributes.end(); i++)
88     {
89     str << i->first << ": " << i->second << Symbols::CRLF;
90     }
91     if (mPort)
92     {
93     str << "Port: " << mPort << Symbols::CRLF;
94     }
95    
96     if (!mHost.empty())
97     {
98     str << "IP-Address: " << mHost << Symbols::CRLF;
99     }
100    
101     return str;
102     }
103    
104     void
105     X_msMsgsInvite::parse(ParseBuffer& pb)
106     {
107     DebugLog(<< "X_msMsgsInvite::parse: " << pb.position());
108    
109     Data attribute;
110     Data value;
111    
112     while (!pb.eof())
113     {
114     const char* anchor = pb.skipWhitespace();
115     pb.skipToChar(Symbols::COLON[0]);
116     pb.data(attribute, anchor);
117     pb.skipChar(Symbols::COLON[0]);
118     pb.skipWhitespace();
119    
120     if (attribute == "Port")
121     {
122 jason 1603 mPort = pb.integer();
123 davidb 1572 }
124     else if (attribute == "IP-Address")
125     {
126 jason 1603 pb.skipToChars(Symbols::CRLF);
127     pb.data(mHost, anchor);
128 davidb 1572 }
129     else
130     {
131 jason 1603 pb.skipToChars(Symbols::CRLF);
132     pb.data(value, anchor);
133     mAttributes.push_back(make_pair(attribute, value));
134 davidb 1572 }
135 jason 1603 pb.skipWhitespace();
136 davidb 1572 }
137     }
138 fluffy 1796 /* ====================================================================
139     * The Vovida Software License, Version 1.0
140     *
141     * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
142     *
143     * Redistribution and use in source and binary forms, with or without
144     * modification, are permitted provided that the following conditions
145     * are met:
146     *
147     * 1. Redistributions of source code must retain the above copyright
148     * notice, this list of conditions and the following disclaimer.
149     *
150     * 2. Redistributions in binary form must reproduce the above copyright
151     * notice, this list of conditions and the following disclaimer in
152     * the documentation and/or other materials provided with the
153     * distribution.
154     *
155     * 3. The names "VOCAL", "Vovida Open Communication Application Library",
156     * and "Vovida Open Communication Application Library (VOCAL)" must
157     * not be used to endorse or promote products derived from this
158     * software without prior written permission. For written
159     * permission, please contact vocal@vovida.org.
160     *
161     * 4. Products derived from this software may not be called "VOCAL", nor
162     * may "VOCAL" appear in their name, without prior written
163     * permission of Vovida Networks, Inc.
164     *
165     * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
166     * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
167     * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
168     * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
169     * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
170     * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
171     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
172     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
173     * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
174     * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
175     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
176     * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
177     * DAMAGE.
178     *
179     * ====================================================================
180     *
181     * This software consists of voluntary contributions made by Vovida
182     * Networks, Inc. and many individuals on behalf of Vovida Networks,
183     * Inc. For more information on Vovida Networks, Inc., please see
184     * <http://www.vovida.org/>.
185     *
186     */

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27