xref: /trunk/main/sal/qa/osl/socket/osl_Socket_Const.h (revision e6348c9c)
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_TELNET 23
117 // #define IP_PORT_SMTP 25
118 // #define IP_PORT_GOPHER 70
119 // #define IP_PORT_POP3  110
120 // #define IP_PORT_NETBIOS_DGM  138
121 // #define IP_PORT_NETBIOS  139
122 // #define IP_PORT_IMAP  143
123 // #define IP_PORT_HTTPS  443
124 // /**reference: http://www.iana.org/assignments/port-numbers */
125 // #define IP_PORT_MYPORT  8881 	//8888
126 // #define IP_PORT_MYPORT1  8882	//8889
127 // #define IP_PORT_MYPORT3  8884	//8891
128 // #define IP_PORT_MYPORT4  8885	//8892
129 // #define IP_PORT_MYPORT5  8886	//8893
130 // #define IP_PORT_MYPORT6  8887	//8894
131 // #define IP_PORT_MYPORT7  8895
132 // #define IP_PORT_MYPORT8  8896
133 // #define IP_PORT_MYPORT9  8897
134 // #define IP_PORT_MYPORT10  8898
135 //
136 // #define IP_PORT_TMP    9999
137 // #define IP_PORT_INVAL  99999
138 
139 //------------------------------------------------------------------------
140 // service definitions.
141 //------------------------------------------------------------------------
142 // OSLTEST_DECLARE( ServiceFTP,  "ftp" );
143 // OSLTEST_DECLARE( ServiceTELNET,  "telnet" );
144 // OSLTEST_DECLARE( ServiceGOPHER,  "gopher" );
145 // OSLTEST_DECLARE( ServiceIMAP,  "imap" );
146 // OSLTEST_DECLARE( ServiceHTTPS,  "https" );
147 // OSLTEST_DECLARE( ServiceNETBIOS,  "netbios-dgm" );
148 
149 //------------------------------------------------------------------------
150 // protocol definitions.
151 //------------------------------------------------------------------------
152 // OSLTEST_DECLARE( ProtocolTCP,  "tcp" );
153 // OSLTEST_DECLARE( ProtocolUDP,  "udp" );
154 
155 //------------------------------------------------------------------------
156 // Hostnames.
157 //------------------------------------------------------------------------
158 // OSLTEST_DECLARE( HostName1,  "localhost" );
159 // OSLTEST_DECLARE( HostIp1,  "127.0.0.1" );
160 OSLTEST_DECLARE( HostName2,  "longshot.prc.sun.com" );
161 OSLTEST_DECLARE( HostIp2,  "129.158.217.202" );
162 OSLTEST_DECLARE( HostName3,  "deuce.prc.sun.com" );
163 OSLTEST_DECLARE( HostIp3,  "129.158.217.199" );
164 OSLTEST_DECLARE( HostName4,  "sceri.PRC.Sun.COM" );  //Beijing server for test
165 OSLTEST_DECLARE( HostIp4,  "129.158.217.107" );
166 OSLTEST_DECLARE( HostName5,  "koori.SFBay.Sun.COM" );  //"grande.Germany.Sun.COM" );  //Germany server for test
167 OSLTEST_DECLARE( HostIp5,  "10.5.32.20" );
168 OSLTEST_DECLARE( HostName6,  "crumple.SFBay.Sun.COM" );  //sfbay
169 OSLTEST_DECLARE( HostIp6,  "10.6.103.83" );
170 OSLTEST_DECLARE( HostIpInval,  "123.45.67.89" );	//this is valid ip number,but can not arrive --mindy
171 // OSLTEST_DECLARE( HostIpInval1,  "123.345.67.89" );	//this is real invalid ip number --mindy
172 OSLTEST_DECLARE( HostNameInval,  "www.the_hostname_that_can_not_resolvable_to_an_IP_Address.com" );
173 OSLTEST_DECLARE( HostIpZero,  "0.0.0.0" );
174 
175 //------------------------------------------------------------------------
176 // OS independent file definition
177 //------------------------------------------------------------------------
178 OSLTEST_DECLARE( NullURL,  "" );
179 
180 //------------------------------------------------------------------------
181 //------------------------------------------------------------------------
182 
183 #ifdef __cplusplus
184 }
185 #endif
186 
187 //------------------------------------------------------------------------
188 //------------------------------------------------------------------------
189 
190 
191 #endif /* _OSL_SOCKET_CONST_H_ */
192