1514f4c20SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3514f4c20SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4514f4c20SAndrew Rist * or more contributor license agreements. See the NOTICE file 5514f4c20SAndrew Rist * distributed with this work for additional information 6514f4c20SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7514f4c20SAndrew Rist * to you under the Apache License, Version 2.0 (the 8514f4c20SAndrew Rist * "License"); you may not use this file except in compliance 9514f4c20SAndrew Rist * with the License. You may obtain a copy of the License at 10514f4c20SAndrew Rist * 11514f4c20SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12514f4c20SAndrew Rist * 13514f4c20SAndrew Rist * Unless required by applicable law or agreed to in writing, 14514f4c20SAndrew Rist * software distributed under the License is distributed on an 15514f4c20SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16514f4c20SAndrew Rist * KIND, either express or implied. See the License for the 17514f4c20SAndrew Rist * specific language governing permissions and limitations 18514f4c20SAndrew Rist * under the License. 19514f4c20SAndrew Rist * 20514f4c20SAndrew Rist *************************************************************/ 21514f4c20SAndrew Rist 22514f4c20SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir //------------------------------------------------------------------------ 25cdf0e10cSrcweir //------------------------------------------------------------------------ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #ifndef _OSL_SOCKET_CONST_H_ 28cdf0e10cSrcweir #define _OSL_SOCKET_CONST_H_ 29cdf0e10cSrcweir 30cdf0e10cSrcweir //------------------------------------------------------------------------ 31cdf0e10cSrcweir //------------------------------------------------------------------------ 32cdf0e10cSrcweir #include <sal/types.h> 33cdf0e10cSrcweir #include <rtl/textenc.h> 34cdf0e10cSrcweir #include <rtl/ustring.hxx> 35cdf0e10cSrcweir #include <rtl/ustring.h> 36cdf0e10cSrcweir 37cdf0e10cSrcweir #ifndef _OSL_SOCLET_HXX_ 38cdf0e10cSrcweir #include <osl/socket.hxx> 39cdf0e10cSrcweir #endif 40cdf0e10cSrcweir #include <osl/socket.h> 41cdf0e10cSrcweir 42cdf0e10cSrcweir #ifndef _OSL_THREAD_HXX 43cdf0e10cSrcweir #include <osl/thread.hxx> 44cdf0e10cSrcweir #endif 45cdf0e10cSrcweir 46cdf0e10cSrcweir #ifndef _OSL_FILE_HXX 47cdf0e10cSrcweir #include <osl/file.hxx> 48cdf0e10cSrcweir #endif 49cdf0e10cSrcweir 50cdf0e10cSrcweir #ifndef _OSL_MUTEX_HXX 51cdf0e10cSrcweir #include <osl/mutex.hxx> 52cdf0e10cSrcweir #endif 53cdf0e10cSrcweir #include <osl/time.h> 54cdf0e10cSrcweir 55cdf0e10cSrcweir const char * pTestString1 = "test socket"; 56cdf0e10cSrcweir const char * pTestString2 = " Passed#OK"; 57cdf0e10cSrcweir //define read count 58cdf0e10cSrcweir //------------------------------------------------------------------------ 59cdf0e10cSrcweir //------------------------------------------------------------------------ 60cdf0e10cSrcweir 61cdf0e10cSrcweir #ifdef __cplusplus 62cdf0e10cSrcweir extern "C" 63cdf0e10cSrcweir { 64cdf0e10cSrcweir #endif 65cdf0e10cSrcweir 66cdf0e10cSrcweir # include <stdio.h> 67cdf0e10cSrcweir //------------------------------------------------------------------------ 68cdf0e10cSrcweir // OS dependent declaration and includes 69cdf0e10cSrcweir //------------------------------------------------------------------------ 70cdf0e10cSrcweir #if ( defined UNX ) || ( defined OS2 ) //Unix 71cdf0e10cSrcweir # include <unistd.h> 72cdf0e10cSrcweir # include <limits.h> 73cdf0e10cSrcweir # include <string.h> 74cdf0e10cSrcweir # include <math.h> 75cdf0e10cSrcweir # include <errno.h> 76cdf0e10cSrcweir # include <fcntl.h> 77cdf0e10cSrcweir # include <sys/stat.h> 78*63d99982SDamjan Jovanovic # ifndef __FreeBSD__ 79*63d99982SDamjan Jovanovic # include <sys/statfs.h> 80*63d99982SDamjan Jovanovic # endif 81cdf0e10cSrcweir # include <sys/statvfs.h> 82cdf0e10cSrcweir # include <sys/types.h> 83cdf0e10cSrcweir # include <sys/socket.h> 84cdf0e10cSrcweir # include <netdb.h> 85cdf0e10cSrcweir # include <netinet/in.h> 86cdf0e10cSrcweir # include <arpa/inet.h> 87cdf0e10cSrcweir #endif 88cdf0e10cSrcweir #if ( defined WNT ) // Windows 89cdf0e10cSrcweir # include <winsock.h> 90cdf0e10cSrcweir # include <string.h> 91cdf0e10cSrcweir #endif 92cdf0e10cSrcweir 93cdf0e10cSrcweir 94cdf0e10cSrcweir //------------------------------------------------------------------------ 95cdf0e10cSrcweir // macro definition for the ASCII array/OUString declarations, 96cdf0e10cSrcweir // we use p### for the ASCII array, 97cdf0e10cSrcweir // a### for the OUString, 98cdf0e10cSrcweir // n###Len for its length 99cdf0e10cSrcweir //------------------------------------------------------------------------ 100cdf0e10cSrcweir 101cdf0e10cSrcweir #define OSLTEST_DECLARE( str_name, str_value ) \ 102cdf0e10cSrcweir static const sal_Char p##str_name[] = str_value; \ 103cdf0e10cSrcweir static const sal_Int32 n##str_name##Len = sizeof( p##str_name ) -1; \ 104cdf0e10cSrcweir ::rtl::OUString a##str_name = rtl::OUString::createFromAscii( p##str_name ) 105cdf0e10cSrcweir 106cdf0e10cSrcweir 107cdf0e10cSrcweir //------------------------------------------------------------------------ 108cdf0e10cSrcweir // Ip version definition 109cdf0e10cSrcweir //------------------------------------------------------------------------ 110cdf0e10cSrcweir #define IP_VER 4 /// currently only IPv4 is considered. 111cdf0e10cSrcweir 112cdf0e10cSrcweir //------------------------------------------------------------------------ 113cdf0e10cSrcweir // Ip port definition 114cdf0e10cSrcweir //------------------------------------------------------------------------ 115cdf0e10cSrcweir // #define IP_PORT_ZERO 0 116cdf0e10cSrcweir // #define IP_PORT_TELNET 23 117cdf0e10cSrcweir // #define IP_PORT_SMTP 25 118cdf0e10cSrcweir // #define IP_PORT_GOPHER 70 119cdf0e10cSrcweir // #define IP_PORT_POP3 110 120cdf0e10cSrcweir // #define IP_PORT_NETBIOS_DGM 138 121cdf0e10cSrcweir // #define IP_PORT_NETBIOS 139 122cdf0e10cSrcweir // #define IP_PORT_IMAP 143 123cdf0e10cSrcweir // #define IP_PORT_HTTPS 443 124cdf0e10cSrcweir // /**reference: http://www.iana.org/assignments/port-numbers */ 125cdf0e10cSrcweir // #define IP_PORT_MYPORT 8881 //8888 126cdf0e10cSrcweir // #define IP_PORT_MYPORT1 8882 //8889 127cdf0e10cSrcweir // #define IP_PORT_MYPORT3 8884 //8891 128cdf0e10cSrcweir // #define IP_PORT_MYPORT4 8885 //8892 129cdf0e10cSrcweir // #define IP_PORT_MYPORT5 8886 //8893 130cdf0e10cSrcweir // #define IP_PORT_MYPORT6 8887 //8894 131cdf0e10cSrcweir // #define IP_PORT_MYPORT7 8895 132cdf0e10cSrcweir // #define IP_PORT_MYPORT8 8896 133cdf0e10cSrcweir // #define IP_PORT_MYPORT9 8897 134cdf0e10cSrcweir // #define IP_PORT_MYPORT10 8898 135cdf0e10cSrcweir // 136cdf0e10cSrcweir // #define IP_PORT_TMP 9999 137cdf0e10cSrcweir // #define IP_PORT_INVAL 99999 138cdf0e10cSrcweir 139cdf0e10cSrcweir //------------------------------------------------------------------------ 140cdf0e10cSrcweir // service definitions. 141cdf0e10cSrcweir //------------------------------------------------------------------------ 142cdf0e10cSrcweir // OSLTEST_DECLARE( ServiceFTP, "ftp" ); 143cdf0e10cSrcweir // OSLTEST_DECLARE( ServiceTELNET, "telnet" ); 144cdf0e10cSrcweir // OSLTEST_DECLARE( ServiceGOPHER, "gopher" ); 145cdf0e10cSrcweir // OSLTEST_DECLARE( ServiceIMAP, "imap" ); 146cdf0e10cSrcweir // OSLTEST_DECLARE( ServiceHTTPS, "https" ); 147cdf0e10cSrcweir // OSLTEST_DECLARE( ServiceNETBIOS, "netbios-dgm" ); 148cdf0e10cSrcweir 149cdf0e10cSrcweir //------------------------------------------------------------------------ 150cdf0e10cSrcweir // protocol definitions. 151cdf0e10cSrcweir //------------------------------------------------------------------------ 152cdf0e10cSrcweir // OSLTEST_DECLARE( ProtocolTCP, "tcp" ); 153cdf0e10cSrcweir // OSLTEST_DECLARE( ProtocolUDP, "udp" ); 154cdf0e10cSrcweir 155cdf0e10cSrcweir //------------------------------------------------------------------------ 156cdf0e10cSrcweir // Hostnames. 157cdf0e10cSrcweir //------------------------------------------------------------------------ 158cdf0e10cSrcweir // OSLTEST_DECLARE( HostName1, "localhost" ); 159cdf0e10cSrcweir // OSLTEST_DECLARE( HostIp1, "127.0.0.1" ); 160cdf0e10cSrcweir OSLTEST_DECLARE( HostName2, "longshot.prc.sun.com" ); 161cdf0e10cSrcweir OSLTEST_DECLARE( HostIp2, "129.158.217.202" ); 162cdf0e10cSrcweir OSLTEST_DECLARE( HostName3, "deuce.prc.sun.com" ); 163cdf0e10cSrcweir OSLTEST_DECLARE( HostIp3, "129.158.217.199" ); 164cdf0e10cSrcweir OSLTEST_DECLARE( HostName4, "sceri.PRC.Sun.COM" ); //Beijing server for test 165cdf0e10cSrcweir OSLTEST_DECLARE( HostIp4, "129.158.217.107" ); 166cdf0e10cSrcweir OSLTEST_DECLARE( HostName5, "koori.SFBay.Sun.COM" ); //"grande.Germany.Sun.COM" ); //Germany server for test 167cdf0e10cSrcweir OSLTEST_DECLARE( HostIp5, "10.5.32.20" ); 168cdf0e10cSrcweir OSLTEST_DECLARE( HostName6, "crumple.SFBay.Sun.COM" ); //sfbay 169cdf0e10cSrcweir OSLTEST_DECLARE( HostIp6, "10.6.103.83" ); 170cdf0e10cSrcweir OSLTEST_DECLARE( HostIpInval, "123.45.67.89" ); //this is valid ip number,but can not arrive --mindy 171cdf0e10cSrcweir // OSLTEST_DECLARE( HostIpInval1, "123.345.67.89" ); //this is real invalid ip number --mindy 172cdf0e10cSrcweir OSLTEST_DECLARE( HostNameInval, "www.the_hostname_that_can_not_resolvable_to_an_IP_Address.com" ); 173cdf0e10cSrcweir OSLTEST_DECLARE( HostIpZero, "0.0.0.0" ); 174cdf0e10cSrcweir 175cdf0e10cSrcweir //------------------------------------------------------------------------ 176cdf0e10cSrcweir // OS independent file definition 177cdf0e10cSrcweir //------------------------------------------------------------------------ 178cdf0e10cSrcweir OSLTEST_DECLARE( NullURL, "" ); 179cdf0e10cSrcweir 180cdf0e10cSrcweir //------------------------------------------------------------------------ 181cdf0e10cSrcweir //------------------------------------------------------------------------ 182cdf0e10cSrcweir 183cdf0e10cSrcweir #ifdef __cplusplus 184cdf0e10cSrcweir } 185cdf0e10cSrcweir #endif 186cdf0e10cSrcweir 187cdf0e10cSrcweir //------------------------------------------------------------------------ 188cdf0e10cSrcweir //------------------------------------------------------------------------ 189cdf0e10cSrcweir 190cdf0e10cSrcweir 191cdf0e10cSrcweir #endif /* _OSL_SOCKET_CONST_H_ */ 192