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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4602 - (hide annotations) (download)
Thu May 12 01:27:52 2005 UTC (14 years, 8 months ago) by derek
File size: 6190 byte(s)
added missing vocal licences
1 derek 3706
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     }
107 derek 4602
108     /* ====================================================================
109     * The Vovida Software License, Version 1.0
110     *
111     * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
112     *
113     * Redistribution and use in source and binary forms, with or without
114     * modification, are permitted provided that the following conditions
115     * are met:
116     *
117     * 1. Redistributions of source code must retain the above copyright
118     * notice, this list of conditions and the following disclaimer.
119     *
120     * 2. Redistributions in binary form must reproduce the above copyright
121     * notice, this list of conditions and the following disclaimer in
122     * the documentation and/or other materials provided with the
123     * distribution.
124     *
125     * 3. The names "VOCAL", "Vovida Open Communication Application Library",
126     * and "Vovida Open Communication Application Library (VOCAL)" must
127     * not be used to endorse or promote products derived from this
128     * software without prior written permission. For written
129     * permission, please contact vocal@vovida.org.
130     *
131     * 4. Products derived from this software may not be called "VOCAL", nor
132     * may "VOCAL" appear in their name, without prior written
133     * permission of Vovida Networks, Inc.
134     *
135     * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
136     * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
137     * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
138     * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
139     * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
140     * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
141     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
142     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
143     * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
144     * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
145     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
146     * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
147     * DAMAGE.
148     *
149     * ====================================================================
150     *
151     * This software consists of voluntary contributions made by Vovida
152     * Networks, Inc. and many individuals on behalf of Vovida Networks,
153     * Inc. For more information on Vovida Networks, Inc., please see
154     * <http://www.vovida.org/>.
155     *
156     */

Properties

Name Value
svn:eol-style LF

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27