/[resiprocate]/main/sip/resiprocate/dum/test/rlsListGenerator.cxx
ViewVC logotype

Contents of /main/sip/resiprocate/dum/test/rlsListGenerator.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4599 - (show annotations) (download)
Wed May 11 23:10:19 2005 UTC (14 years, 8 months ago) by derek
File size: 3816 byte(s)
set svn:eol-style to LF
1
2 #include "resiprocate/MultipartMixedContents.hxx"
3 #include "resiprocate/GenericContents.hxx"
4 #include "resiprocate/Rlmi.hxx"
5 #include "resiprocate/Pidf.hxx"
6 #include "resiprocate/Pkcs7Contents.hxx"
7 #include "resiprocate/MultipartSignedContents.hxx"
8 #include "resiprocate/MultipartRelatedContents.hxx"
9 #include "resiprocate/SipMessage.hxx"
10 #include "resiprocate/test/TestSupport.hxx"
11 #include "resiprocate/os/ParseBuffer.hxx"
12 #include "resiprocate/os/CountStream.hxx"
13
14
15 #include <iostream>
16 #include <fstream>
17 #include <memory>
18
19
20 using namespace resip;
21 using namespace std;
22
23 int
24 main (int argc, char** argv)
25 {
26 {
27 const Data txt(
28 "--50UBfW7LSCVLtggUPe5z\r\n"
29 "Content-Transfer-Encoding: binary\r\n"
30 "Content-ID: <nXYxAE@pres.example.com>\r\n"
31 "Content-Type: application/rlmi+xml;charset=\"UTF-8\"\r\n"
32 "\r\n"
33 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
34 "<list xmlns=\"urn:ietf:params:xml:ns:rmli\"\r\n"
35 " uri=\"sip:adam-friends@pres.example.com\" version=\"1\"\r\n"
36 " name=\"Buddy List at COM\" fullState=\"true\">\r\n"
37 " <resource uri=\"sip:bob@example.com\" name=\"Bob Smith\">\r\n"
38 " <instance id=\"juwigmtboe\" state=\"active\"\r\n"
39 " cid=\"bUZBsM@pres.example.com\"/>\r\n"
40 " </resource>\r\n"
41 " <resource uri=\"sip:dave@example.com\" name=\"Dave Jones\">\r\n"
42 " <instance id=\"hqzsuxtfyq\" state=\"active\"\r\n"
43 " cid=\"ZvSvkz@pres.example.com\"/>\r\n"
44 " </resource>\r\n"
45 " <resource uri=\"sip:ed@example.net\" name=\"Ed at NET\" />\r\n"
46 " <resource uri=\"sip:adam-friends@example.org\"\r\n"
47 " name=\"My Friends at ORG\" />\r\n"
48 "</list>\r\n"
49 "\r\n"
50 "--50UBfW7LSCVLtggUPe5z\r\n"
51 "Content-Transfer-Encoding: binary\r\n"
52 "Content-ID: <bUZBsM@pres.example.com>\r\n"
53 "Content-Type: application/pidf+xml;charset=\"UTF-8\"\r\n"
54 "\r\n"
55 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
56 "<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\r\n"
57 " entity=\"sip:bob@example.com\">\r\n"
58 " <tuple id=\"sg89ae\">\r\n"
59 " <status>\r\n"
60 " <basic>open</basic>\r\n"
61 " </status>\r\n"
62 " <contact priority=\"1.0\">sip:bob@example.com</contact>\r\n"
63 " </tuple>\r\n"
64 "</presence>\r\n"
65 "\r\n"
66 "--50UBfW7LSCVLtggUPe5z\r\n"
67 "Content-Transfer-Encoding: binary\r\n"
68 "Content-ID: <ZvSvkz@pres.example.com>\r\n"
69 "Content-Type: application/pidf+xml;charset=\"UTF-8\"\r\n"
70 "\r\n"
71 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
72 "<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\r\n"
73 " entity=\"sip:dave@example.com\">\r\n"
74 " <tuple id=\"slie74\">\r\n"
75 " <status>\r\n"
76 " <basic>closed</basic>\r\n"
77 " </status>\r\n"
78 " </tuple>\r\n"
79 "</presence>\r\n"
80 "\r\n"
81 "--50UBfW7LSCVLtggUPe5z--\r\n"
82 );
83
84 ofstream outfile;
85 outfile.open("c:\\fullHeaders.bytes", ofstream::out | ofstream::trunc | ofstream::binary);
86
87 Mime mpr("multipart", "related");
88 mpr.param(p_type) = "application/rlmi+xml";
89 mpr.param(p_boundary) = "50UBfW7LSCVLtggUPe5z";
90
91 HeaderFieldValue hfv(txt.data(), txt.size());
92 MultipartRelatedContents orig(&hfv, mpr);
93
94 size_t size;
95 {
96 CountStream cs(size);
97 orig.encode(cs);
98 }
99 outfile << "Content-Length: " << size << "\r\n";
100 orig.encodeHeaders(outfile);
101 orig.encode(outfile);
102 outfile.close();
103 }
104
105 return 0;
106 }

Properties

Name Value
svn:eol-style LF

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27