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