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 #	include <sys/statfs.h>
79 #	include <sys/statvfs.h>
80 #	include <sys/types.h>
81 #	include <sys/socket.h>
82 #	include <netdb.h>
83 #	include <netinet/in.h>
84 #       include <arpa/inet.h>
85 #endif
86 #if ( defined WNT )                     // Windows
87 #include <tools/prewin.h>
88 // #	include <windows.h>
89 #	include <winsock.h>
90 #	include <string.h>
91 #include <tools/postwin.h>
92 #endif
93 
94 
95 //------------------------------------------------------------------------
96 // macro definition for the ASCII array/OUString declarations,
97 // we use p### for the ASCII array,
98 //        a### for the OUString,
99 //        n###Len for its length
100 //------------------------------------------------------------------------
101 
102 #define OSLTEST_DECLARE( str_name, str_value ) \
103 	static const sal_Char  p##str_name[]        = str_value;  \
104 	static const sal_Int32 n##str_name##Len     = sizeof( p##str_name ) -1; \
105 	::rtl::OUString a##str_name                 = rtl::OUString::createFromAscii( p##str_name )
106 
107 
108 //------------------------------------------------------------------------
109 // Ip version definition
110 //------------------------------------------------------------------------
111 #define IP_VER     4                   /// currently only IPv4 is considered.
112 
113 //------------------------------------------------------------------------
114 // Ip port definition
115 //------------------------------------------------------------------------
116 #define IP_PORT_ZERO    0
117 #define IP_PORT_FTP    21
118 #define IP_PORT_TELNET 23
119 #define IP_PORT_SMTP 25
120 #define IP_PORT_GOPHER 70
121 #define IP_PORT_HTTP1  80
122 #define IP_PORT_POP3  110
123 #define IP_PORT_NETBIOS_DGM  138
124 #define IP_PORT_NETBIOS  139
125 #define IP_PORT_IMAP  143
126 #define IP_PORT_HTTPS  443
127 #define IP_PORT_HTTP2  8080
128 /**reference: http://www.iana.org/assignments/port-numbers */
129 #define IP_PORT_MYPORT  8881 	//8888
130 #define IP_PORT_MYPORT1  8882	//8889
131 #define IP_PORT_MYPORT2  8883	//8890
132 #define IP_PORT_MYPORT3  8884	//8891
133 #define IP_PORT_MYPORT4  8885	//8892
134 #define IP_PORT_MYPORT5  8886	//8893
135 #define IP_PORT_MYPORT6  8887	//8894
136 #define IP_PORT_MYPORT7  8895
137 #define IP_PORT_MYPORT8  8896
138 #define IP_PORT_MYPORT9  8897
139 #define IP_PORT_MYPORT10  8898
140 
141 #define IP_PORT_TMP    9999
142 #define IP_PORT_INVAL  99999
143 
144 //------------------------------------------------------------------------
145 // service definitions.
146 //------------------------------------------------------------------------
147 OSLTEST_DECLARE( ServiceFTP,  "ftp" );
148 OSLTEST_DECLARE( ServiceTELNET,  "telnet" );
149 OSLTEST_DECLARE( ServiceGOPHER,  "gopher" );
150 OSLTEST_DECLARE( ServiceIMAP,  "imap" );
151 OSLTEST_DECLARE( ServiceHTTPS,  "https" );
152 OSLTEST_DECLARE( ServiceNETBIOS,  "netbios-dgm" );
153 
154 //------------------------------------------------------------------------
155 // protocol definitions.
156 //------------------------------------------------------------------------
157 OSLTEST_DECLARE( ProtocolTCP,  "tcp" );
158 OSLTEST_DECLARE( ProtocolUDP,  "udp" );
159 
160 //------------------------------------------------------------------------
161 // Hostnames.
162 //------------------------------------------------------------------------
163 OSLTEST_DECLARE( HostName1,  "localhost" );
164 OSLTEST_DECLARE( HostIp1,  "127.0.0.1" );
165 OSLTEST_DECLARE( HostName2,  "longshot.prc.sun.com" );
166 OSLTEST_DECLARE( HostIp2,  "129.158.217.202" );
167 OSLTEST_DECLARE( HostName3,  "deuce.prc.sun.com" );
168 OSLTEST_DECLARE( HostIp3,  "129.158.217.199" );
169 OSLTEST_DECLARE( HostName4,  "sceri.PRC.Sun.COM" );  //Beijing server for test
170 OSLTEST_DECLARE( HostIp4,  "129.158.217.107" );
171 OSLTEST_DECLARE( HostName5,  "koori.SFBay.Sun.COM" );  //"grande.Germany.Sun.COM" );  //Germany server for test
172 OSLTEST_DECLARE( HostIp5,  "10.5.32.20" );
173 OSLTEST_DECLARE( HostName6,  "crumple.SFBay.Sun.COM" );  //sfbay
174 OSLTEST_DECLARE( HostIp6,  "10.6.103.83" );
175 OSLTEST_DECLARE( HostIpInval,  "123.45.67.89" );	//this is valid ip number,but can not arrive --mindy
176 OSLTEST_DECLARE( HostIpInval1,  "123.345.67.89" );	//this is real invalid ip number --mindy
177 OSLTEST_DECLARE( HostNameInval,  "www.the_hostname_that_can_not_resolvable_to_an_IP_Address.com" );
178 OSLTEST_DECLARE( HostIpZero,  "0.0.0.0" );
179 
180 //------------------------------------------------------------------------
181 // OS independent file definition
182 //------------------------------------------------------------------------
183 OSLTEST_DECLARE( NullURL,  "" );
184 
185 //------------------------------------------------------------------------
186 //------------------------------------------------------------------------
187 
188 #ifdef __cplusplus
189 }
190 #endif
191 
192 //------------------------------------------------------------------------
193 //------------------------------------------------------------------------
194 
195 
196 #endif /* _OSL_SOCKET_CONST_H_ */
197