1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 //------------------------------------------------------------------------
25 //------------------------------------------------------------------------
26 
27 #ifndef _OSL_SOCKET_CONST_H_
28 #define _OSL_SOCKET_CONST_H_
29 
30 //------------------------------------------------------------------------
31 //------------------------------------------------------------------------
32 #include <sal/types.h>
33 #include <rtl/textenc.h>
34 #include <rtl/ustring.hxx>
35 #include <rtl/ustring.h>
36 
37 #ifndef _OSL_SOCLET_HXX_
38 #include <osl/socket.hxx>
39 #endif
40 #include <osl/socket.h>
41 
42 #ifndef _OSL_THREAD_HXX
43 #include <osl/thread.hxx>
44 #endif
45 
46 #ifndef _OSL_FILE_HXX
47 #include <osl/file.hxx>
48 #endif
49 
50 #ifndef _OSL_MUTEX_HXX
51 #include <osl/mutex.hxx>
52 #endif
53 #include <osl/time.h>
54 
55 const char * pTestString1 = "test socket";
56 const char * pTestString2 = " Passed#OK";
57 //define read count
58 //------------------------------------------------------------------------
59 //------------------------------------------------------------------------
60 
61 #ifdef __cplusplus
62 extern "C"
63 {
64 #endif
65 
66 #	include <stdio.h>
67 //------------------------------------------------------------------------
68 // OS dependent declaration and includes
69 //------------------------------------------------------------------------
70 #if ( defined UNX ) || ( defined OS2 )  //Unix
71 #	include <unistd.h>
72 #	include <limits.h>
73 #	include <string.h>
74 #	include <math.h>
75 #	include <errno.h>
76 #	include <fcntl.h>
77 #	include <sys/stat.h>
78 #   ifndef __FreeBSD__
79 #       include <sys/statfs.h>
80 #   endif
81 #	include <sys/statvfs.h>
82 #	include <sys/types.h>
83 #	include <sys/socket.h>
84 #	include <netdb.h>
85 #	include <netinet/in.h>
86 #       include <arpa/inet.h>
87 #endif
88 #if ( defined WNT )                     // Windows
89 #	include <winsock.h>
90 #	include <string.h>
91 #endif
92 
93 
94 //------------------------------------------------------------------------
95 // macro definition for the ASCII array/OUString declarations,
96 // we use p### for the ASCII array,
97 //        a### for the OUString,
98 //        n###Len for its length
99 //------------------------------------------------------------------------
100 
101 #define OSLTEST_DECLARE( str_name, str_value ) \
102 	static const sal_Char  p##str_name[]        = str_value;  \
103 	static const sal_Int32 n##str_name##Len     = sizeof( p##str_name ) -1; \
104 	::rtl::OUString a##str_name                 = rtl::OUString::createFromAscii( p##str_name )
105 
106 
107 //------------------------------------------------------------------------
108 // Ip version definition
109 //------------------------------------------------------------------------
110 #define IP_VER     4                   /// currently only IPv4 is considered.
111 
112 //------------------------------------------------------------------------
113 // Ip port definition
114 //------------------------------------------------------------------------
115 #define IP_PORT_ZERO    0
116 #define IP_PORT_FTP    21
117 #define IP_PORT_TELNET 23
118 #define IP_PORT_SMTP 25
119 #define IP_PORT_GOPHER 70
120 #define IP_PORT_HTTP1  80
121 #define IP_PORT_POP3  110
122 #define IP_PORT_NETBIOS_DGM  138
123 #define IP_PORT_NETBIOS  139
124 #define IP_PORT_IMAP  143
125 #define IP_PORT_HTTPS  443
126 #define IP_PORT_HTTP2  8080
127 /**reference: http://www.iana.org/assignments/port-numbers */
128 #define IP_PORT_MYPORT  8881 	//8888
129 #define IP_PORT_MYPORT1  8882	//8889
130 #define IP_PORT_MYPORT2  8883	//8890
131 #define IP_PORT_MYPORT3  8884	//8891
132 #define IP_PORT_MYPORT4  8885	//8892
133 #define IP_PORT_MYPORT5  8886	//8893
134 #define IP_PORT_MYPORT6  8887	//8894
135 #define IP_PORT_MYPORT7  8895
136 #define IP_PORT_MYPORT8  8896
137 #define IP_PORT_MYPORT9  8897
138 #define IP_PORT_MYPORT10  8898
139 
140 #define IP_PORT_TMP    9999
141 #define IP_PORT_INVAL  99999
142 
143 //------------------------------------------------------------------------
144 // service definitions.
145 //------------------------------------------------------------------------
146 OSLTEST_DECLARE( ServiceFTP,  "ftp" );
147 OSLTEST_DECLARE( ServiceTELNET,  "telnet" );
148 OSLTEST_DECLARE( ServiceGOPHER,  "gopher" );
149 OSLTEST_DECLARE( ServiceIMAP,  "imap" );
150 OSLTEST_DECLARE( ServiceHTTPS,  "https" );
151 OSLTEST_DECLARE( ServiceNETBIOS,  "netbios-dgm" );
152 
153 //------------------------------------------------------------------------
154 // protocol definitions.
155 //------------------------------------------------------------------------
156 OSLTEST_DECLARE( ProtocolTCP,  "tcp" );
157 OSLTEST_DECLARE( ProtocolUDP,  "udp" );
158 
159 //------------------------------------------------------------------------
160 // Hostnames.
161 //------------------------------------------------------------------------
162 OSLTEST_DECLARE( HostName1,  "localhost" );
163 OSLTEST_DECLARE( HostIp1,  "127.0.0.1" );
164 OSLTEST_DECLARE( HostName2,  "longshot.prc.sun.com" );
165 OSLTEST_DECLARE( HostIp2,  "129.158.217.202" );
166 OSLTEST_DECLARE( HostName3,  "deuce.prc.sun.com" );
167 OSLTEST_DECLARE( HostIp3,  "129.158.217.199" );
168 OSLTEST_DECLARE( HostName4,  "sceri.PRC.Sun.COM" );  //Beijing server for test
169 OSLTEST_DECLARE( HostIp4,  "129.158.217.107" );
170 OSLTEST_DECLARE( HostName5,  "koori.SFBay.Sun.COM" );  //"grande.Germany.Sun.COM" );  //Germany server for test
171 OSLTEST_DECLARE( HostIp5,  "10.5.32.20" );
172 OSLTEST_DECLARE( HostName6,  "crumple.SFBay.Sun.COM" );  //sfbay
173 OSLTEST_DECLARE( HostIp6,  "10.6.103.83" );
174 OSLTEST_DECLARE( HostIpInval,  "123.45.67.89" );	//this is valid ip number,but can not arrive --mindy
175 OSLTEST_DECLARE( HostIpInval1,  "123.345.67.89" );	//this is real invalid ip number --mindy
176 OSLTEST_DECLARE( HostNameInval,  "www.the_hostname_that_can_not_resolvable_to_an_IP_Address.com" );
177 OSLTEST_DECLARE( HostIpZero,  "0.0.0.0" );
178 
179 //------------------------------------------------------------------------
180 // OS independent file definition
181 //------------------------------------------------------------------------
182 OSLTEST_DECLARE( NullURL,  "" );
183 
184 //------------------------------------------------------------------------
185 //------------------------------------------------------------------------
186 
187 #ifdef __cplusplus
188 }
189 #endif
190 
191 //------------------------------------------------------------------------
192 //------------------------------------------------------------------------
193 
194 
195 #endif /* _OSL_SOCKET_CONST_H_ */
196