xref: /AOO41X/main/sal/qa/osl/socket/osl_Socket_Const_orig.h (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 //------------------------------------------------------------------------
29 //------------------------------------------------------------------------
30 
31 #ifndef _OSL_SOCKET_CONST_H_
32 #define _OSL_SOCKET_CONST_H_
33 
34 //------------------------------------------------------------------------
35 //------------------------------------------------------------------------
36 #include <sal/types.h>
37 #include <rtl/textenc.h>
38 #include <rtl/ustring.hxx>
39 #include <rtl/ustring.h>
40 
41 #ifndef _OSL_SOCLET_HXX_
42 #include <osl/socket.hxx>
43 #endif
44 #include <osl/socket.h>
45 
46 #ifndef _OSL_THREAD_HXX
47 #include <osl/thread.hxx>
48 #endif
49 
50 #ifndef _OSL_FILE_HXX
51 #include <osl/file.hxx>
52 #endif
53 
54 #ifndef _OSL_MUTEX_HXX
55 #include <osl/mutex.hxx>
56 #endif
57 #include <osl/time.h>
58 
59 const char * pTestString1 = "test socket";
60 const char * pTestString2 = " Passed#OK";
61 //define read count
62 //------------------------------------------------------------------------
63 //------------------------------------------------------------------------
64 
65 #ifdef __cplusplus
66 extern "C"
67 {
68 #endif
69 
70 #	include <stdio.h>
71 //------------------------------------------------------------------------
72 // OS dependent declaration and includes
73 //------------------------------------------------------------------------
74 #if ( defined UNX ) || ( defined OS2 )  //Unix
75 #	include <unistd.h>
76 #	include <limits.h>
77 #	include <string.h>
78 #	include <math.h>
79 #	include <errno.h>
80 #	include <fcntl.h>
81 #	include <sys/stat.h>
82 #	include <sys/statfs.h>
83 #	include <sys/statvfs.h>
84 #	include <sys/types.h>
85 #	include <sys/socket.h>
86 #	include <netdb.h>
87 #	include <netinet/in.h>
88 #       include <arpa/inet.h>
89 #endif
90 #if ( defined WNT )                     // Windows
91 #include <tools/prewin.h>
92 // #	include <windows.h>
93 #	include <winsock.h>
94 #	include <string.h>
95 #include <tools/postwin.h>
96 #endif
97 
98 
99 //------------------------------------------------------------------------
100 // macro definition for the ASCII array/OUString declarations,
101 // we use p### for the ASCII array,
102 //        a### for the OUString,
103 //        n###Len for its length
104 //------------------------------------------------------------------------
105 
106 #define OSLTEST_DECLARE( str_name, str_value ) \
107 	static const sal_Char  p##str_name[]        = str_value;  \
108 	static const sal_Int32 n##str_name##Len     = sizeof( p##str_name ) -1; \
109 	::rtl::OUString a##str_name                 = rtl::OUString::createFromAscii( p##str_name )
110 
111 
112 //------------------------------------------------------------------------
113 // Ip version definition
114 //------------------------------------------------------------------------
115 #define IP_VER     4                   /// currently only IPv4 is considered.
116 
117 //------------------------------------------------------------------------
118 // Ip port definition
119 //------------------------------------------------------------------------
120 #define IP_PORT_ZERO    0
121 #define IP_PORT_FTP    21
122 #define IP_PORT_TELNET 23
123 #define IP_PORT_SMTP 25
124 #define IP_PORT_GOPHER 70
125 #define IP_PORT_HTTP1  80
126 #define IP_PORT_POP3  110
127 #define IP_PORT_NETBIOS_DGM  138
128 #define IP_PORT_NETBIOS  139
129 #define IP_PORT_IMAP  143
130 #define IP_PORT_HTTPS  443
131 #define IP_PORT_HTTP2  8080
132 /**reference: http://www.iana.org/assignments/port-numbers */
133 #define IP_PORT_MYPORT  8881 	//8888
134 #define IP_PORT_MYPORT1  8882	//8889
135 #define IP_PORT_MYPORT2  8883	//8890
136 #define IP_PORT_MYPORT3  8884	//8891
137 #define IP_PORT_MYPORT4  8885	//8892
138 #define IP_PORT_MYPORT5  8886	//8893
139 #define IP_PORT_MYPORT6  8887	//8894
140 #define IP_PORT_MYPORT7  8895
141 #define IP_PORT_MYPORT8  8896
142 #define IP_PORT_MYPORT9  8897
143 #define IP_PORT_MYPORT10  8898
144 
145 #define IP_PORT_TMP    9999
146 #define IP_PORT_INVAL  99999
147 
148 //------------------------------------------------------------------------
149 // service definitions.
150 //------------------------------------------------------------------------
151 OSLTEST_DECLARE( ServiceFTP,  "ftp" );
152 OSLTEST_DECLARE( ServiceTELNET,  "telnet" );
153 OSLTEST_DECLARE( ServiceGOPHER,  "gopher" );
154 OSLTEST_DECLARE( ServiceIMAP,  "imap" );
155 OSLTEST_DECLARE( ServiceHTTPS,  "https" );
156 OSLTEST_DECLARE( ServiceNETBIOS,  "netbios-dgm" );
157 
158 //------------------------------------------------------------------------
159 // protocol definitions.
160 //------------------------------------------------------------------------
161 OSLTEST_DECLARE( ProtocolTCP,  "tcp" );
162 OSLTEST_DECLARE( ProtocolUDP,  "udp" );
163 
164 //------------------------------------------------------------------------
165 // Hostnames.
166 //------------------------------------------------------------------------
167 OSLTEST_DECLARE( HostName1,  "localhost" );
168 OSLTEST_DECLARE( HostIp1,  "127.0.0.1" );
169 OSLTEST_DECLARE( HostName2,  "longshot.prc.sun.com" );
170 OSLTEST_DECLARE( HostIp2,  "129.158.217.202" );
171 OSLTEST_DECLARE( HostName3,  "deuce.prc.sun.com" );
172 OSLTEST_DECLARE( HostIp3,  "129.158.217.199" );
173 OSLTEST_DECLARE( HostName4,  "sceri.PRC.Sun.COM" );  //Beijing server for test
174 OSLTEST_DECLARE( HostIp4,  "129.158.217.107" );
175 OSLTEST_DECLARE( HostName5,  "koori.SFBay.Sun.COM" );  //"grande.Germany.Sun.COM" );  //Germany server for test
176 OSLTEST_DECLARE( HostIp5,  "10.5.32.20" );
177 OSLTEST_DECLARE( HostName6,  "crumple.SFBay.Sun.COM" );  //sfbay
178 OSLTEST_DECLARE( HostIp6,  "10.6.103.83" );
179 OSLTEST_DECLARE( HostIpInval,  "123.45.67.89" );	//this is valid ip number,but can not arrive --mindy
180 OSLTEST_DECLARE( HostIpInval1,  "123.345.67.89" );	//this is real invalid ip number --mindy
181 OSLTEST_DECLARE( HostNameInval,  "www.the_hostname_that_can_not_resolvable_to_an_IP_Address.com" );
182 OSLTEST_DECLARE( HostIpZero,  "0.0.0.0" );
183 
184 //------------------------------------------------------------------------
185 // OS independent file definition
186 //------------------------------------------------------------------------
187 OSLTEST_DECLARE( NullURL,  "" );
188 
189 //------------------------------------------------------------------------
190 //------------------------------------------------------------------------
191 
192 #ifdef __cplusplus
193 }
194 #endif
195 
196 //------------------------------------------------------------------------
197 //------------------------------------------------------------------------
198 
199 
200 #endif /* _OSL_SOCKET_CONST_H_ */
201