/[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 1572 - (hide annotations) (download)
Mon Jul 28 10:45:03 2003 UTC (16 years, 5 months ago) by davidb
File size: 2458 byte(s)
generic contents

1 davidb 1572 #include "resiprocate/X_msMsgsInvite.hxx"
2     #include "resiprocate/SipMessage.hxx"
3     #include "resiprocate/os/Logger.hxx"
4    
5     using namespace resip;
6     using namespace std;
7    
8     #define RESIPROCATE_SUBSYSTEM Subsystem::SIP
9    
10     ContentsFactory<X_msMsgsInvite> X_msMsgsInvite::Factory;
11    
12     X_msMsgsInvite::X_msMsgsInvite()
13     : Contents(getStaticType()),
14     mPort(0),
15     mHost()
16     {}
17    
18     X_msMsgsInvite::X_msMsgsInvite(const Data& txt)
19     : Contents(getStaticType()),
20     mPort(0),
21     mHost()
22     {}
23    
24     X_msMsgsInvite::X_msMsgsInvite(HeaderFieldValue* hfv, const Mime& contentsType)
25     : Contents(hfv, contentsType),
26     mPort(0),
27     mHost()
28     {}
29    
30     X_msMsgsInvite::X_msMsgsInvite(const Data& txt, const Mime& contentsType)
31     : Contents(contentsType),
32     mPort(0),
33     mHost()
34     {}
35    
36     X_msMsgsInvite::X_msMsgsInvite(const X_msMsgsInvite& rhs)
37     : Contents(rhs),
38     mPort(rhs.mPort),
39     mHost(rhs.mHost)
40     {}
41    
42     X_msMsgsInvite::~X_msMsgsInvite()
43     {}
44    
45     X_msMsgsInvite&
46     X_msMsgsInvite::operator=(const X_msMsgsInvite& rhs)
47     {
48     if (this != &rhs)
49     {
50     Contents::operator=(rhs);
51     mPort = rhs.mPort;
52     mHost = rhs.mHost;
53     }
54     return *this;
55     }
56    
57     Contents*
58     X_msMsgsInvite::clone() const
59     {
60     return new X_msMsgsInvite(*this);
61     }
62    
63     const Mime&
64     X_msMsgsInvite::getStaticType()
65     {
66     // set charset ?dlb?
67     static Mime type("text","x-msmsgsinvite");
68    
69     return type;
70     }
71    
72     std::ostream&
73     X_msMsgsInvite::encodeParsed(std::ostream& str) const
74     {
75     for (Attributes::const_iterator i = mAttributes.begin();
76     i != mAttributes.end(); i++)
77     {
78     str << i->first << ": " << i->second << Symbols::CRLF;
79     }
80     if (mPort)
81     {
82     str << "Port: " << mPort << Symbols::CRLF;
83     }
84    
85     if (!mHost.empty())
86     {
87     str << "IP-Address: " << mHost << Symbols::CRLF;
88     }
89    
90     return str;
91     }
92    
93     void
94     X_msMsgsInvite::parse(ParseBuffer& pb)
95     {
96     DebugLog(<< "X_msMsgsInvite::parse: " << pb.position());
97    
98     Data attribute;
99     Data value;
100    
101     while (!pb.eof())
102     {
103     const char* anchor = pb.skipWhitespace();
104     pb.skipToChar(Symbols::COLON[0]);
105     pb.data(attribute, anchor);
106     pb.skipChar(Symbols::COLON[0]);
107     pb.skipWhitespace();
108    
109     if (attribute == "Port")
110     {
111     mPort = pb.integer();
112     }
113     else if (attribute == "IP-Address")
114     {
115     pb.skipToChars(Symbols::CRLF);
116     pb.data(mHost, anchor);
117     }
118     else
119     {
120     pb.skipToChars(Symbols::CRLF);
121     pb.data(value, anchor);
122     mAttributes.push_back(make_pair(attribute, value));
123     }
124     }
125     }

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27