1     /*********************************************************************\
2     *  Copyright (c) 2003 by Radim Kolar (hsn@cybermail.net)              *
3     *  Copyright (c) 1991 by Wen-King Su (wen-king@vlsi.cs.caltech.edu)   *
4     *                                                                     *
5     *  You may copy or modify this file in any manner you wish, provided  *
6     *  that this notice is always included, and that you hold the author  *
7     *  harmless for any loss or damage resulting from the installation or *
8     *  use of this software.                                              *
9     \*********************************************************************/
10 
11 #include "tweak.h"
12 #include "client_def.h"
13 #include "c_extern.h"
14 #include "merge.h"
15 #include <stdio.h>
16 #include <stdlib.h>
17 #ifdef HAVE_UNISTD_H
18 #include <unistd.h>
19 #endif
20 
main(int argc,char ** argv)21 int main (int argc, char ** argv)
22 {
23   UBUF *ub;
24   unsigned int len, tput = 0, len2;
25   char *v1, *v2;
26 
27   if(argc == 1)	{ /* no arg supplied, get version string of server */
28     env_client();
29     ub = client_interact(CC_VERSION,0L, 0, (unsigned char *)NULLP, 0,
30 			 (unsigned char *)NULLP);
31     len = BB_READ2(ub->bb_len);
32 
33     len2 = BB_READ4(ub->bb_pos);
34     /* is the above still causing problems under Solaris?  */
35 
36     v1 = ub->buf; v2 = ub->buf+len;
37     printf("Remote FSP version: %s\n",v1);
38 
39     /* we have a new type of server */
40     if(len2) {
41       if(*v2 & VER_LOG)
42 	printf("\tLogging of all server transactions is ENABLED.\n");
43       else
44 	printf("\tLogging of all server transactions is DISABLED.\n");
45       if(*v2 & VER_READONLY)
46 	printf("\tRemote server is run in READONLY mode.\n");
47       else
48 	printf("\tRemote server is run in READ/WRITE mode.\n");
49       if(*v2 & VER_REVNAME)
50 	printf("\tServer REQUIRES connections to reverse name.\n");
51       else
52 	printf("\tServer DOESN'T REQUIRE connections to reverse.\n");
53       if(*v2 & VER_PRIVMODE)
54 	printf("\tRemote server is run in PRIVATE mode.\n");
55       else
56 	printf("\tRemote server is run in PUBLIC mode.\n");
57       if(*v2 & VER_THRUPUT) {
58 	printf("\tRemote server throughput control is ENABLED.");
59 	tput |= (((unsigned)*(++v2) << 24) & 0xff000000);
60 	tput |= (((unsigned)*(++v2) << 16) & 0x00ff0000);
61 	tput |= (((unsigned)*(++v2) << 8) & 0x0000ff00);
62 	tput |= ((unsigned)*(++v2) & 0x000000ff);
63 	printf(" (max %d bytes/sec)\n", tput);
64       } else
65 	printf("\tRemote server throughput control is DISABLED.\n");
66       if (*v2 & VER_XTRADATA)
67         printf("\tServer can process extra data in input packets.\n");
68 
69       /* check for optional max. packet size block */
70       if(++v2 < ub->buf+len+len2)
71       {
72 	  tput=0;
73           tput = BB_READ2(v2);
74 	  if (tput > 1024)
75 	       printf("\tMax. payload size supported by server is %d bytes.\n",tput);
76 	  else
77 	       printf("\tPayload size prefered by server is %d bytes.\n",tput);
78       }
79     }
80     else
81 	printf("\tRemote server do not send extended info.\n");
82     client_done();
83   } else
84   {
85     printf("Local FSP version: %s\n\n",PACKAGE_VERSION);
86     printf("Max. packet size supported by client: %d\n",UBUF_MAXSPACE);
87     printf("System startup file: %s\n",FSPRC);
88     printf("Local startup file: %s\n",FSPPROF);
89     printf("Locking method is: ");
90 #if defined(FSP_USE_SHAREMEM_AND_LOCKF)
91     printf("SHAREMEM_AND_LOCKF");
92 #elif defined(FSP_USE_FLOCK)
93     printf("FLOCK");
94 #elif defined(FSP_USE_LOCKF)
95     printf("LOCKF");
96 #elif defined(FSP_NOLOCKING)
97     printf("None");
98 #elif defined(FSP_USE_SHAREMEM_AND_SEMOP)
99     printf("SHAREMEM_AND_SEMOP");
100 #else
101 #error "We do not have any locking method defined!"
102 #endif
103     printf("\n");
104 #ifndef FSP_NOLOCKING
105     printf("Lock prefix is: %s\n",FSP_KEY_PREFIX);
106 #endif
107     printf("Timestamping supported: ");
108 #ifdef HAVE_UTIME_H
109     printf("yes\n");
110 #else
111     printf("no\n");
112 #endif
113     printf("Large file support: ");
114 #ifdef NATIVE_LARGEFILES
115     printf("Yes, native\n");
116 #else
117     printf("No\n");
118 #endif
119     printf("Maximum file size: ");
120 #ifdef NATIVE_LARGEFILES
121     printf("4 GB (FSP limit)\n");
122 #else
123     printf("2 GB (No large file support)\n");
124 #endif
125     printf("Host lookup: ");
126 #ifdef HOST_LOOKUP
127     printf("yes\n");
128 #else
129     printf("no\n");
130 #endif
131     printf("Timeouts enabled: ");
132 #ifdef CLIENT_TIMEOUT
133     printf("yes\n");
134 #else
135     printf("no\n");
136 #endif
137   }
138   exit(EX_OK);
139 }
140