/[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 2299 - (hide annotations) (download)
Sun Feb 1 23:25:41 2004 UTC (15 years, 11 months ago) by davidb
File size: 5029 byte(s)
header file static init

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

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27