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