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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1741 - (show annotations) (download)
Sun Sep 14 04:15:28 2003 UTC (16 years, 4 months ago) by fluffy
File size: 2596 byte(s)
added the config.h include in

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

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27