reSIProcate/stack  9694
testRlmi.cxx
Go to the documentation of this file.
00001 #include <iostream>
00002 #include <memory>
00003 
00004 #include "resip/stack/MultipartMixedContents.hxx"
00005 #include "resip/stack/Rlmi.hxx"
00006 #include "resip/stack/SipMessage.hxx"
00007 #include "resip/stack/test/TestSupport.hxx"
00008 #include "rutil/ParseBuffer.hxx"
00009 
00010 using namespace resip;
00011 using namespace std;
00012 
00013 int
00014 main()
00015 {
00016    {
00017       const Data txt("NOTIFY sip:terminal.example.com SIP/2.0\r\n"
00018                      "Via: SIP/2.0/TCP pres.example.com;branch=z9hG4bKMgRenTETmm\r\n"
00019                      "Max-Forwards: 70\r\n"
00020                      "From: <sip:adam-buddies@pres.example.com>;tag=zpNctbZq\r\n"
00021                      "To: <sip:adam@example.com>;tag=ie4hbb8t\r\n"
00022                      "Call-ID: cdB34qLToC@terminal.example.com\r\n"
00023                      "CSeq: 997935768 NOTIFY\r\n"
00024                      "Contact: <sip:pres.example.com>\r\n"
00025                      "Event: presence\r\n"
00026                      "Subscription-State: active;expires=7200\r\n"
00027                      "Require: eventlist\r\n"
00028                      "Content-Type: application/rlmi+xml;charset=\"UTF-8\"\r\n"
00029                      "Content-Length: 681\r\n"
00030                      "\r\n"
00031                      "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
00032                      "<list xmlns=\"urn:ietf:params:xml:ns:rmli\"\r\n"
00033                      "      uri=\"sip:adam-friends@pres.example.com\" version=\"1\"\r\n"
00034                      "      name=\"Buddy List at COM\" fullState=\"true\">\r\n"
00035                      "  <resource uri=\"sip:bob@example.com\" name=\"Bob Smith\">\r\n"
00036                      "    <instance id=\"juwigmtboe\" state=\"active\"\r\n"
00037                      "              cid=\"bUZBsM@pres.example.com\"/>\r\n"
00038                      "  </resource>\r\n"
00039                      "  <resource uri=\"sip:dave@example.com\" name=\"Dave Jones\">\r\n"
00040                      "    <instance id=\"hqzsuxtfyq\" state=\"active\"\r\n"
00041                      "              cid=\"ZvSvkz@pres.example.com\"/>\r\n"
00042                      "  </resource>\r\n"
00043                      "  <resource uri=\"sip:ed@example.net\" name=\"Ed at NET\" />\r\n"
00044                      "  <resource uri=\"sip:adam-friends@example.org\"\r\n"
00045                      "            name=\"My Friends at ORG\" />\r\n"
00046                      "</list>\r\n"
00047                      "\r\n");
00048 
00049       auto_ptr<SipMessage> msg(TestSupport::makeMessage(txt.c_str()));
00050 
00051       Rlmi* rlmi = dynamic_cast<Rlmi*>(msg->getContents());
00052 
00053       assert(rlmi);
00054 
00055       cerr << rlmi->get() << endl;
00056    }
00057 }      
00058 
00059 /* ====================================================================
00060  * The Vovida Software License, Version 1.0 
00061  * 
00062  * Copyright (c) 2000-2005 Vovida Networks, Inc.  All rights reserved.
00063  * 
00064  * Redistribution and use in source and binary forms, with or without
00065  * modification, are permitted provided that the following conditions
00066  * are met:
00067  * 
00068  * 1. Redistributions of source code must retain the above copyright
00069  *    notice, this list of conditions and the following disclaimer.
00070  * 
00071  * 2. Redistributions in binary form must reproduce the above copyright
00072  *    notice, this list of conditions and the following disclaimer in
00073  *    the documentation and/or other materials provided with the
00074  *    distribution.
00075  * 
00076  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00077  *    and "Vovida Open Communication Application Library (VOCAL)" must
00078  *    not be used to endorse or promote products derived from this
00079  *    software without prior written permission. For written
00080  *    permission, please contact vocal@vovida.org.
00081  *
00082  * 4. Products derived from this software may not be called "VOCAL", nor
00083  *    may "VOCAL" appear in their name, without prior written
00084  *    permission of Vovida Networks, Inc.
00085  * 
00086  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00087  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00088  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00089  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00090  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00091  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00092  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00093  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00094  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00095  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00096  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00097  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00098  * DAMAGE.
00099  * 
00100  * ====================================================================
00101  * 
00102  * This software consists of voluntary contributions made by Vovida
00103  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00104  * Inc.  For more information on Vovida Networks, Inc., please see
00105  * <http://www.vovida.org/>.
00106  *
00107  */