|
reSIProcate/DialogUsageManager
9694
|
00001 00002 #include "resip/stack/MultipartMixedContents.hxx" 00003 #include "resip/stack/GenericContents.hxx" 00004 #include "resip/stack/Rlmi.hxx" 00005 #include "resip/stack/Pidf.hxx" 00006 #include "resip/stack/Pkcs7Contents.hxx" 00007 #include "resip/stack/MultipartSignedContents.hxx" 00008 #include "resip/stack/MultipartRelatedContents.hxx" 00009 #include "resip/stack/SipMessage.hxx" 00010 #include "resip/stack/test/TestSupport.hxx" 00011 #include "rutil/ParseBuffer.hxx" 00012 #include "rutil/CountStream.hxx" 00013 00014 00015 #include <iostream> 00016 #include <fstream> 00017 #include <memory> 00018 00019 00020 using namespace resip; 00021 using namespace std; 00022 00023 int 00024 main (int argc, char** argv) 00025 { 00026 { 00027 const Data txt( 00028 "--50UBfW7LSCVLtggUPe5z\r\n" 00029 "Content-Transfer-Encoding: binary\r\n" 00030 "Content-ID: <nXYxAE@pres.example.com>\r\n" 00031 "Content-Type: application/rlmi+xml;charset=\"UTF-8\"\r\n" 00032 "\r\n" 00033 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" 00034 "<list xmlns=\"urn:ietf:params:xml:ns:rmli\"\r\n" 00035 " uri=\"sip:adam-friends@pres.example.com\" version=\"1\"\r\n" 00036 " name=\"Buddy List at COM\" fullState=\"true\">\r\n" 00037 " <resource uri=\"sip:bob@example.com\" name=\"Bob Smith\">\r\n" 00038 " <instance id=\"juwigmtboe\" state=\"active\"\r\n" 00039 " cid=\"bUZBsM@pres.example.com\"/>\r\n" 00040 " </resource>\r\n" 00041 " <resource uri=\"sip:dave@example.com\" name=\"Dave Jones\">\r\n" 00042 " <instance id=\"hqzsuxtfyq\" state=\"active\"\r\n" 00043 " cid=\"ZvSvkz@pres.example.com\"/>\r\n" 00044 " </resource>\r\n" 00045 " <resource uri=\"sip:ed@example.net\" name=\"Ed at NET\" />\r\n" 00046 " <resource uri=\"sip:adam-friends@example.org\"\r\n" 00047 " name=\"My Friends at ORG\" />\r\n" 00048 "</list>\r\n" 00049 "\r\n" 00050 "--50UBfW7LSCVLtggUPe5z\r\n" 00051 "Content-Transfer-Encoding: binary\r\n" 00052 "Content-ID: <bUZBsM@pres.example.com>\r\n" 00053 "Content-Type: application/pidf+xml;charset=\"UTF-8\"\r\n" 00054 "\r\n" 00055 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" 00056 "<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\r\n" 00057 " entity=\"sip:bob@example.com\">\r\n" 00058 " <tuple id=\"sg89ae\">\r\n" 00059 " <status>\r\n" 00060 " <basic>open</basic>\r\n" 00061 " </status>\r\n" 00062 " <contact priority=\"1.0\">sip:bob@example.com</contact>\r\n" 00063 " </tuple>\r\n" 00064 "</presence>\r\n" 00065 "\r\n" 00066 "--50UBfW7LSCVLtggUPe5z\r\n" 00067 "Content-Transfer-Encoding: binary\r\n" 00068 "Content-ID: <ZvSvkz@pres.example.com>\r\n" 00069 "Content-Type: application/pidf+xml;charset=\"UTF-8\"\r\n" 00070 "\r\n" 00071 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" 00072 "<presence xmlns=\"urn:ietf:params:xml:ns:pidf\"\r\n" 00073 " entity=\"sip:dave@example.com\">\r\n" 00074 " <tuple id=\"slie74\">\r\n" 00075 " <status>\r\n" 00076 " <basic>closed</basic>\r\n" 00077 " </status>\r\n" 00078 " </tuple>\r\n" 00079 "</presence>\r\n" 00080 "\r\n" 00081 "--50UBfW7LSCVLtggUPe5z--\r\n" 00082 ); 00083 00084 ofstream outfile; 00085 outfile.open("c:\\fullHeaders.bytes", ofstream::out | ofstream::trunc | ofstream::binary); 00086 00087 Mime mpr("multipart", "related"); 00088 mpr.param(p_type) = "application/rlmi+xml"; 00089 mpr.param(p_boundary) = "50UBfW7LSCVLtggUPe5z"; 00090 00091 HeaderFieldValue hfv(txt.data(), txt.size()); 00092 MultipartRelatedContents orig(&hfv, mpr); 00093 00094 size_t size; 00095 { 00096 CountStream cs(size); 00097 orig.encode(cs); 00098 } 00099 outfile << "Content-Length: " << size << "\r\n"; 00100 orig.encodeHeaders(outfile); 00101 orig.encode(outfile); 00102 outfile.close(); 00103 } 00104 00105 return 0; 00106 } 00107 00108 /* ==================================================================== 00109 * The Vovida Software License, Version 1.0 00110 * 00111 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. 00112 * 00113 * Redistribution and use in source and binary forms, with or without 00114 * modification, are permitted provided that the following conditions 00115 * are met: 00116 * 00117 * 1. Redistributions of source code must retain the above copyright 00118 * notice, this list of conditions and the following disclaimer. 00119 * 00120 * 2. Redistributions in binary form must reproduce the above copyright 00121 * notice, this list of conditions and the following disclaimer in 00122 * the documentation and/or other materials provided with the 00123 * distribution. 00124 * 00125 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00126 * and "Vovida Open Communication Application Library (VOCAL)" must 00127 * not be used to endorse or promote products derived from this 00128 * software without prior written permission. For written 00129 * permission, please contact vocal@vovida.org. 00130 * 00131 * 4. Products derived from this software may not be called "VOCAL", nor 00132 * may "VOCAL" appear in their name, without prior written 00133 * permission of Vovida Networks, Inc. 00134 * 00135 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00136 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00137 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00138 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00139 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00140 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00141 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00142 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00143 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00144 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00145 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00146 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00147 * DAMAGE. 00148 * 00149 * ==================================================================== 00150 * 00151 * This software consists of voluntary contributions made by Vovida 00152 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00153 * Inc. For more information on Vovida Networks, Inc., please see 00154 * <http://www.vovida.org/>. 00155 * 00156 */
1.7.5.1