reSIProcate/stack  9694
testEmptyHeader.cxx
Go to the documentation of this file.
00001 #include <iostream>
00002 #include <memory>
00003 
00004 #include "rutil/DataStream.hxx"
00005 #include "resip/stack/SipMessage.hxx"
00006 #include "resip/stack/Helper.hxx"
00007 #include "resip/stack/test/TestSupport.hxx"
00008 #include "resip/stack/ExtensionHeader.hxx"
00009 #include "resip/stack/UnknownParameterType.hxx"
00010 #include "rutil/Logger.hxx"
00011 
00012 #include "resip/stack/test/tassert.h"
00013 
00014 using namespace resip;
00015 using namespace std;
00016 
00017 #define RESIPROCATE_SUBSYSTEM Subsystem::TEST
00018 #define CRLF "\r\n"
00019 
00020 int
00021 main(int argc, char** argv)
00022 {
00023   
00024    Log::initialize(Log::Cout, Log::Debug, argv[0]);
00025    
00026    {
00027      tassert_init(1); (void)tassert_stack_ptr;
00028      tassert_reset();
00029      const char * txt =(              
00030        "SIP/2.0 489 Bad Event" CRLF
00031        "Via: SIP/2.0/UDP RjS.localdomain:5070;branch=z9hG4bK-c87542-899769382-1--c87542-" CRLF
00032        "CSeq: 1 SUBSCRIBE" CRLF
00033        "Allow-Events: " CRLF
00034        "Call-ID:  f354ce714fb8a95c" CRLF
00035        "From:  <sip:RjS@127.0.0.1:5070>;tag=59e7dd57" CRLF
00036        "To:  <sip:RjS@127.0.0.1:5060>" CRLF
00037        CRLF
00038        );
00039      TestSupport::prettyPrint(txt,strlen(txt));
00040 
00041      auto_ptr<SipMessage> response(TestSupport::makeMessage(txt,true));
00042 
00043      cerr << *response << endl;
00044      
00045      tassert(response->exists(h_AllowEvents));
00046 
00047      const char * txt2 =(              
00048        "SIP/2.0 489 Bad Event" CRLF
00049        "Via: SIP/2.0/UDP RjS.localdomain:5070;branch=z9hG4bK-c87542-899769382-1--c87542-" CRLF
00050        "CSeq: 1 SUBSCRIBE" CRLF
00051        "Call-ID:  f354ce714fb8a95c" CRLF
00052        "From:  <sip:RjS@127.0.0.1:5070>;tag=59e7dd57" CRLF
00053        "To:  <sip:RjS@127.0.0.1:5060>" CRLF
00054        "Allow-Events: " CRLF
00055        CRLF
00056        );
00057 
00058      SipMessage * r2 = TestSupport::makeMessage(txt2,true);
00059 
00060      tassert(r2->exists(h_AllowEvents) );
00061 
00062      tassert_verify(1);
00063      tassert_report();
00064      return 0;
00065    }
00066 }
00067 /* ====================================================================
00068  * The Vovida Software License, Version 1.0 
00069  * 
00070  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00071  * 
00072  * Redistribution and use in source and binary forms, with or without
00073  * modification, are permitted provided that the following conditions
00074  * are met:
00075  * 
00076  * 1. Redistributions of source code must retain the above copyright
00077  *    notice, this list of conditions and the following disclaimer.
00078  * 
00079  * 2. Redistributions in binary form must reproduce the above copyright
00080  *    notice, this list of conditions and the following disclaimer in
00081  *    the documentation and/or other materials provided with the
00082  *    distribution.
00083  * 
00084  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00085  *    and "Vovida Open Communication Application Library (VOCAL)" must
00086  *    not be used to endorse or promote products derived from this
00087  *    software without prior written permission. For written
00088  *    permission, please contact vocal@vovida.org.
00089  *
00090  * 4. Products derived from this software may not be called "VOCAL", nor
00091  *    may "VOCAL" appear in their name, without prior written
00092  *    permission of Vovida Networks, Inc.
00093  * 
00094  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00095  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00096  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00097  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00098  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00099  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00100  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00101  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00102  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00103  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00104  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00105  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00106  * DAMAGE.
00107  * 
00108  * ====================================================================
00109  * 
00110  * This software consists of voluntary contributions made by Vovida
00111  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00112  * Inc.  For more information on Vovida Networks, Inc., please see
00113  * <http://www.vovida.org/>.
00114  *
00115  */