/[resiprocate]/main/rutil/test/testDnsUtil.cxx
ViewVC logotype

Contents of /main/rutil/test/testDnsUtil.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8161 - (show annotations) (download)
Fri Jul 25 20:54:42 2008 UTC (11 years, 3 months ago) by jmatthewsr
File MIME type: text/plain
File size: 4636 byte(s)
Stream performance enhancements for encoding objects.  New encoding code should use 'EncodeStream','resipCerr' and 'resipCout' for encoding any resip objects.  Merge from b-jmatthewsr-streamperf2 -r 8137:8160.  
1 #include <iostream>
2 #include "assert.h"
3
4 #include "rutil/DnsUtil.hxx"
5 #include "rutil/Logger.hxx"
6 #include "rutil/Inserter.hxx"
7
8 using namespace resip;
9 using namespace std;
10
11 #define RESIPROCATE_SUBSYSTEM Subsystem::TEST
12
13 int
14 main(int argc, char* argv[])
15 {
16 Log::Level l = Log::Debug;
17 Log::initialize(Log::Cout, l, argv[0]);
18
19 {
20 resipCerr << "Network Interfaces: " << endl << Inserter(DnsUtil::getInterfaces()) << endl << endl;
21 }
22
23 {
24 Data addr("1:1");
25 resipCerr << "!! "<< addr << endl;
26 assert(DnsUtil::isIpV6Address(addr));
27 }
28
29 {
30 Data addr("1:1:192.168.2.233");
31 resipCerr << "!! "<< addr << endl;
32 assert(DnsUtil::isIpV6Address(addr));
33 }
34
35 {
36 Data addr("1:1:::::");
37 resipCerr << "!! "<< addr << endl;
38 assert(DnsUtil::isIpV6Address(addr));
39 }
40
41 {
42 Data addr("1:1::::::168.192.2.233");
43 resipCerr << "!! "<< addr << endl;
44 assert(DnsUtil::isIpV6Address(addr));
45 }
46
47 {
48 Data addr("5f1b:df00:ce3e:e200:20:800:2b37:6426");
49 resipCerr << "!! "<< addr << endl;
50 assert(DnsUtil::isIpV6Address(addr));
51 }
52
53 {
54 Data addr("5f1b:df00:ce3e:e200:20:800:2b37:6426:121.12.131.12");
55 resipCerr << "!! "<< addr << endl;
56 assert(DnsUtil::isIpV6Address(addr));
57 }
58
59 {
60 Data addr("192.168.2.233");
61 resipCerr << "!! "<< addr << endl;
62 assert(!DnsUtil::isIpV6Address(addr));
63 }
64
65 {
66 Data addr("u@a.tv:1290");
67 resipCerr << "!! "<< addr << endl;
68 assert(!DnsUtil::isIpV6Address(addr));
69 }
70
71 {
72 Data addr("::1");
73 resipCerr << "!! "<< addr << endl;
74 assert(DnsUtil::isIpV6Address(addr));
75 }
76
77 {
78 Data addr("::");
79 resipCerr << "!! "<< addr << endl;
80 assert(DnsUtil::isIpV6Address(addr));
81 }
82
83 {
84 Data addr("FF01::43");
85 resipCerr << "!! "<< addr << endl;
86 assert(DnsUtil::isIpV6Address(addr));
87 }
88
89 {
90 Data c("apple:5060");
91 Data addr(Data::Share, c.c_str(), 5);
92 resipCerr << "!! " << addr << endl;
93 assert(!DnsUtil::isIpV6Address(addr));
94 }
95
96 {
97 Data addr(":zzz");
98 if(DnsUtil::isIpV6Address(addr))
99 {
100 DnsUtil::canonicalizeIpV6Address(addr);
101 }
102 }
103
104 resipCerr << "All OK" << endl;
105 }
106 /* ====================================================================
107 * The Vovida Software License, Version 1.0
108 *
109 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
110 *
111 * Redistribution and use in source and binary forms, with or without
112 * modification, are permitted provided that the following conditions
113 * are met:
114 *
115 * 1. Redistributions of source code must retain the above copyright
116 * notice, this list of conditions and the following disclaimer.
117 *
118 * 2. Redistributions in binary form must reproduce the above copyright
119 * notice, this list of conditions and the following disclaimer in
120 * the documentation and/or other materials provided with the
121 * distribution.
122 *
123 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
124 * and "Vovida Open Communication Application Library (VOCAL)" must
125 * not be used to endorse or promote products derived from this
126 * software without prior written permission. For written
127 * permission, please contact vocal@vovida.org.
128 *
129 * 4. Products derived from this software may not be called "VOCAL", nor
130 * may "VOCAL" appear in their name, without prior written
131 * permission of Vovida Networks, Inc.
132 *
133 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
134 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
135 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
136 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
137 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
138 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
139 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
140 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
141 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
142 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
144 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
145 * DAMAGE.
146 *
147 * ====================================================================
148 *
149 * This software consists of voluntary contributions made by Vovida
150 * Networks, Inc. and many individuals on behalf of Vovida Networks,
151 * Inc. For more information on Vovida Networks, Inc., please see
152 * <http://www.vovida.org/>.
153 *
154 */

Properties

Name Value
svn:eol-style native
svn:mime-type text/plain

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27