|
reSIProcate/stack
9694
|
00001 #include <iostream> 00002 00003 #include "TestSupport.hxx" 00004 #include "rutil/Logger.hxx" 00005 #include "resip/stack/ParserCategories.hxx" 00006 using namespace resip; 00007 using namespace std; 00008 00009 #define RESIPROCATE_SUBSYSTEM Subsystem::TEST 00010 class TR 00011 { 00012 private: 00013 ostream& os; 00014 Data label; 00015 00016 TR(const TR&); 00017 00018 void show(const char * s) 00019 { 00020 os << s << ' ' << label << endl; 00021 } 00022 00023 void start() 00024 { 00025 show(">>-"); 00026 } 00027 00028 void end() 00029 { 00030 show("<<-"); 00031 } 00032 00033 public: 00034 TR(Data s,ostream& o = cerr ):os(o),label(s) { start(); } 00035 TR(const char* l,ostream& o = cerr):os(o),label(l) { start(); } 00036 ~TR() { end();} 00037 }; 00038 00039 int 00040 main(int argc, char* argv[]) 00041 { 00042 Log::Level l = Log::Debug; 00043 Log::initialize(Log::Cout, l, argv[0]); 00044 00045 { 00046 TR _tr("Test odd name-addr from odd vendor"); 00047 Data data( 00048 "~U90vw09jlMMs0OY7IIHzdD72c3<sip:~U90vw09jlMMs0OY7IIHzdD72c3@7.8.4.9:5066>"); 00049 Data alt ("alternate"); 00050 00051 NameAddr illegal(data); 00052 cerr<< "++ host: " << illegal.uri().host() << endl; 00053 cerr<< "++ display-name: " << illegal.displayName() << endl; 00054 cerr<< "++ user-info: " << illegal.uri().user() << endl; 00055 assert( illegal.uri().host() == "7.8.4.9"); 00056 assert( illegal.displayName() == "~U90vw09jlMMs0OY7IIHzdD72c3"); 00057 assert( illegal.uri().port() == 5066 ); 00058 cerr << "++ " << illegal << endl; 00059 illegal.displayName() = alt; 00060 cerr << "++ " << illegal << endl; 00061 assert( illegal.displayName() == alt); 00062 00063 } 00064 return 0; 00065 cerr << "All OK" << endl; 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 */
1.7.5.1