00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "rpcintrf.h"
00018 #include "rcs_prnt.hh"
00019 #include "rcs_defs.hh"
00020
00021 #ifdef _WINDOWS
00022
00023 #if defined(WIN32) && !defined(USE_OLD_WINSOCK)
00024
00025
00026 #include <winsock2.h>
00027 #endif
00028
00029 #include <windows.h>
00030 #include <ctype.h>
00031
00032 static HINSTANCE rpc_library_handle = NULL;
00033 #else
00034 #include <rpc/rpc.h>
00035 #include <rpc/xdr.h>
00036 #include <rpc/clnt.h>
00037
00038 #endif
00039
00040 #if defined(VXWORKS) || defined(linuxppc) || defined(linuxPPC)
00041 #ifdef clnt_control
00042 #undef clnt_control
00043 #define clnt_control(cl,rq,in) \
00044 ((*(bool_t (*)(CLIENT *, int, char *))((cl)->cl_ops->cl_control))((cl),(rq),(in)))
00045 #endif
00046 #ifdef clnt_call
00047 #undef clnt_call
00048 #define clnt_call(clnt,procnum,inproc,in,outproc,out,secs) \
00049 ((*(enum clnt_stat (*)(CLIENT *, u_long, xdrproc_t, char *, xdrproc_t, char *, struct timeval))((clnt)->cl_ops->cl_call))((clnt), (procnum),(inproc), (in), (outproc),(out),(secs)))
00050 #endif
00051 #ifdef clnt_destroy
00052 #undef clnt_destroy
00053 #define clnt_destroy(clnt) \
00054 ((*(void (*)(CLIENT *))((clnt)->cl_ops->cl_destroy))(clnt))
00055 #endif
00056 #ifdef xdr_destroy
00057 #undef xdr_destroy
00058 #define xdr_destroy(xdrs) \
00059 if ((xdrs)->x_ops->x_destroy) \
00060 { (((void (*)(XDR *))(*(xdrs)->x_ops->x_destroy))(xdrs)); }
00061 #endif
00062 #ifdef xdr_getpos
00063 #undef xdr_getpos
00064 #define xdr_getpos(xdrs) \
00065 ((*(u_int (*)(XDR *))((xdrs)->x_ops->x_getpostn))(xdrs))
00066 #endif
00067 #ifdef xdr_setpos
00068 #undef xdr_setpos
00069 #define xdr_setpos(xdrs,pos) \
00070 ((*(bool_t (*)(XDR *,u_int))((xdrs)->x_ops->x_setpostn))((xdrs),(pos)))
00071 #endif
00072 #endif
00073 #include <sys/types.h>
00074 #include <sys/stat.h>
00075 enum RPC_AVAILABILITY
00076 {
00077 RPC_NOT_CHECKED,
00078 RPC_NOT_AVAILABLE,
00079 RPC_AVAILABLE
00080 };
00081
00082 static RPC_AVAILABILITY rpc_availability = RPC_NOT_CHECKED;
00083
00084 PTR_TO_TKDLL_INIT ptr_to_tkdll_init = NULL;
00085 PTR_TO_TKDLL_VERSION ptr_to_tkdll_version = NULL;
00086 PTR_TO_TKDLL_CLEANUP ptr_to_tkdll_cleanup = NULL;
00087 PTR_TO_TKDLL_ERRNO ptr_to_tkdll_errno = NULL;
00088 PTR_TO_RPC_NT_INIT ptr_to_rpc_nt_init = NULL;
00089
00090 PTR_TO_RPC_NT_EXIT ptr_to_rpc_nt_exit = NULL;
00091 PTR_TO_CLNT_CREATE ptr_to_clnt_create = NULL;
00092 PTR_TO_CLNT_CONTROL ptr_to_clnt_control = NULL;
00093 PTR_TO_CLNT_CALL ptr_to_clnt_call = NULL;
00094 PTR_TO_CLNT_DESTROY ptr_to_clnt_destroy = NULL;
00095 PTR_TO_CLNT_SPCREATEERROR ptr_to_clnt_spcreateerror = NULL;
00096 PTR_TO_CLNT_SPERRNO ptr_to_clnt_sperrno = NULL;
00097 PTR_TO_XDRMEM_CREATE ptr_to_xdrmem_create = NULL;
00098 PTR_TO_XDR_DESTROY ptr_to_xdr_destroy = NULL;
00099 PTR_TO_XDR_GETPOS ptr_to_xdr_getpos = NULL;
00100 PTR_TO_XDR_SETPOS ptr_to_xdr_setpos = NULL;
00101 PTR_TO_XDR_CHAR ptr_to_xdr_char = NULL;
00102 PTR_TO_XDR_U_CHAR ptr_to_xdr_u_char = NULL;
00103 PTR_TO_XDR_SHORT ptr_to_xdr_short = NULL;
00104 PTR_TO_XDR_U_SHORT ptr_to_xdr_u_short = NULL;
00105 PTR_TO_XDR_INT ptr_to_xdr_int = NULL;
00106 PTR_TO_XDR_U_INT ptr_to_xdr_u_int = NULL;
00107 PTR_TO_XDR_LONG ptr_to_xdr_long = NULL;
00108 PTR_TO_XDR_U_LONG ptr_to_xdr_u_long = NULL;
00109 PTR_TO_XDR_FLOAT ptr_to_xdr_float = NULL;
00110 PTR_TO_XDR_DOUBLE ptr_to_xdr_double = NULL;
00111 PTR_TO_XDR_VOID ptr_to_xdr_void = NULL;
00112 PTR_TO_XDR_BYTES ptr_to_xdr_bytes = NULL;
00113 PTR_TO_XDR_OPAQUE ptr_to_xdr_opaque = NULL;
00114 PTR_TO_XDR_VECTOR ptr_to_xdr_vector = NULL;
00115
00116 PTR_TO_PASCAL_XDRMEM_CREATE ptr_to_pascal_xdrmem_create = NULL;
00117
00118 PTR_TO_PASCAL_XDR_DESTROY ptr_to_pascal_xdr_destroy = NULL;
00119 PTR_TO_PASCAL_XDR_GETPOS ptr_to_pascal_xdr_getpos = NULL;
00120 PTR_TO_PASCAL_XDR_SETPOS ptr_to_pascal_xdr_setpos = NULL;
00121 PTR_TO_PASCAL_XDR_CHAR ptr_to_pascal_xdr_char = NULL;
00122 PTR_TO_PASCAL_XDR_U_CHAR ptr_to_pascal_xdr_u_char = NULL;
00123 PTR_TO_PASCAL_XDR_SHORT ptr_to_pascal_xdr_short = NULL;
00124 PTR_TO_PASCAL_XDR_U_SHORT ptr_to_pascal_xdr_u_short = NULL;
00125 PTR_TO_PASCAL_XDR_INT ptr_to_pascal_xdr_int = NULL;
00126 PTR_TO_PASCAL_XDR_U_INT ptr_to_pascal_xdr_u_int = NULL;
00127 PTR_TO_PASCAL_XDR_LONG ptr_to_pascal_xdr_long = NULL;
00128 PTR_TO_PASCAL_XDR_U_LONG ptr_to_pascal_xdr_u_long = NULL;
00129 PTR_TO_PASCAL_XDR_FLOAT ptr_to_pascal_xdr_float = NULL;
00130 PTR_TO_PASCAL_XDR_DOUBLE ptr_to_pascal_xdr_double = NULL;
00131 PTR_TO_PASCAL_XDR_VOID ptr_to_pascal_xdr_void = NULL;
00132 PTR_TO_PASCAL_XDR_BYTES ptr_to_pascal_xdr_bytes = NULL;
00133 PTR_TO_PASCAL_XDR_OPAQUE ptr_to_pascal_xdr_opaque = NULL;
00134 PTR_TO_PASCAL_XDR_VECTOR ptr_to_pascal_xdr_vector = NULL;
00135 static int sim_tkdll_errno_errno;
00136
00137 RPC_LIBRARY_TYPE rpc_library_type = RPC_INVALID;
00138
00139 int *
00140 sim_tkdll_errno ()
00141 {
00142 sim_tkdll_errno_errno = 0;
00143 #ifdef WIN32
00144 if (sim_tkdll_errno_errno == 0)
00145 {
00146 sim_tkdll_errno_errno = GetLastError ();
00147 }
00148 #endif
00149 return (&sim_tkdll_errno_errno);
00150 }
00151
00152 static int rpc_load_count = 0;
00153
00154 #ifdef DOS_WINDOWS
00155 static int use_init_and_cleanup = 1;
00156 #endif
00157
00158 #ifdef _WINDOWS
00159 FARPROC
00160 GetProc (LPCSTR proc_name)
00161 {
00162 FARPROC retval = NULL;
00163 static char buffer[128];
00164 char *ptr;
00165 if (rpc_library_handle == NULL)
00166 {
00167 return NULL;
00168 }
00169 retval = GetProcAddress (rpc_library_handle, proc_name);
00170 if (retval != NULL)
00171 {
00172 return retval;
00173 }
00174 strcpy (buffer, proc_name);
00175 ptr = buffer;
00176 while (*ptr)
00177 {
00178 *ptr = (char) toupper (*ptr);
00179 }
00180 retval = GetProcAddress (rpc_library_handle, proc_name);
00181 if (retval != NULL)
00182 {
00183 return retval;
00184 }
00185 ptr = buffer;
00186 while (*ptr)
00187 {
00188 *ptr = (char) tolower (*ptr);
00189 }
00190 retval = GetProcAddress (rpc_library_handle, buffer);
00191 if (retval != NULL)
00192 {
00193 return retval;
00194
00195 }
00196 return NULL;
00197 }
00198 #endif
00199
00200 int
00201 load_rpc_interface ()
00202 {
00203 rpc_load_count++;
00204 if (rpc_load_count > 1)
00205 {
00206 switch (rpc_availability)
00207 {
00208 case RPC_AVAILABLE:
00209 return 0;
00210
00211 default:
00212 return -1;
00213 }
00214 }
00215
00216 #ifndef _Windows
00217 #ifndef __MSDOS__
00218 rpc_library_type = RPC_UNIX;
00219 #else
00220 rpc_library_type = RPC_DOS;
00221 #endif
00222 if (rpc_availability == RPC_AVAILABLE)
00223 {
00224 return 0;
00225 }
00226
00227 #if defined(__MSDOS__) && !defined(_Windows)
00228
00229 if (-1 == rtm_install ("tcp"))
00230 {
00231 rcs_print_error ("CMS: PC-NFS RTM install error.\n");
00232 rcs_print_error ("CMS: errno = %d\n");
00233 rpc_availability = RPC_NOT_AVAILABLE;
00234 return (-1);
00235 }
00236
00237 long version;
00238 version = rtm_version ();
00239 if (version < 400000l)
00240 {
00241 rcs_print_error ("CMS: PC-NFS RTM version must be atleast 4.0\n");
00242 rcs_print_error ("CMS: version = %lx\n", version);
00243 rpc_availability = RPC_NOT_AVAILABLE;
00244 return (-1);
00245 }
00246 #ifdef _WINDOWS
00247 ptr_to_clnt_call = clnt_call;
00248 ptr_to_clnt_create = clnt_create;
00249 ptr_to_clnt_control = clnt_control;
00250 ptr_to_clnt_destroy = clnt_destroy;
00251 ptr_to_clnt_sperrno = clnt_sperrno;
00252 ptr_to_clnt_spcreateerror = clnt_spcreateerror;
00253 ptr_to_xdrmem_create = xdrmem_create;
00254 ptr_to_xdr_destroy = xdr_destroy;
00255 ptr_to_xdr_getpos = xdr_getpos;
00256 ptr_to_xdr_setpos = xdr_setpos;
00257 #endif
00258 #endif
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271 ptr_to_xdr_char = xdr_char;
00272
00273
00274
00275
00276 ptr_to_xdr_u_char = (PTR_TO_XDR_U_CHAR) xdr_u_char;
00277 ptr_to_xdr_short = xdr_short;
00278 ptr_to_xdr_u_short = xdr_u_short;
00279 ptr_to_xdr_int = xdr_int;
00280 ptr_to_xdr_u_int = xdr_u_int;
00281 ptr_to_xdr_long = xdr_long;
00282 ptr_to_xdr_u_long = xdr_u_long;
00283 ptr_to_xdr_float = xdr_float;
00284 ptr_to_xdr_double = xdr_double;
00285 ptr_to_xdr_bytes = (PTR_TO_XDR_BYTES) xdr_bytes;
00286 ptr_to_xdr_opaque = (PTR_TO_XDR_OPAQUE) xdr_opaque;
00287 ptr_to_xdr_vector = (PTR_TO_XDR_VECTOR) xdr_vector;
00288 rpc_availability = RPC_AVAILABLE;
00289
00290
00291 return 0;
00292
00293 #else
00294
00295 static char windows_system_directory[250];
00296 if (RPC_AVAILABLE == rpc_availability)
00297 {
00298 return 0;
00299 }
00300 if (RPC_NOT_AVAILABLE == rpc_availability)
00301 {
00302 return -1;
00303 }
00304 GetSystemDirectory (windows_system_directory, 250);
00305 static char rpc_dll_name[256];
00306 struct stat rpc_dll_stat;
00307
00308 #ifdef __WIN32__
00309 if (rpc_library_handle == NULL)
00310 {
00311 strcpy (rpc_dll_name, windows_system_directory);
00312 strcat (rpc_dll_name, "\\tirpc.dll");
00313 if (!stat (rpc_dll_name, &rpc_dll_stat))
00314 {
00315 use_init_and_cleanup = 0;
00316 rpc_library_type = RHAPCD_ONCRPC_WINDOWS_NT;
00317 rpc_library_handle = LoadLibrary (rpc_dll_name);
00318 #ifdef WIN32
00319 if (rpc_library_handle == NULL)
00320 #else
00321 if (rpc_library_handle < HINSTANCE_ERROR)
00322 #endif
00323 {
00324 rcs_print_error ("Can't load DLL(%s). Error = %d.\n",
00325 rpc_dll_name, rpc_library_handle);
00326 rpc_library_handle = NULL;
00327 }
00328 }
00329 }
00330 #endif
00331
00332 if (rpc_library_handle == NULL)
00333 {
00334 strcpy (rpc_dll_name, windows_system_directory);
00335 strcat (rpc_dll_name, "\\librpc.dll");
00336 if (!stat (rpc_dll_name, &rpc_dll_stat))
00337 {
00338 use_init_and_cleanup = 1;
00339 rpc_library_type = LIBRPC_WINDOWS;
00340 rpc_library_handle = LoadLibrary (rpc_dll_name);
00341 #ifdef WIN32
00342 if (rpc_library_handle == NULL)
00343 #else
00344 if (rpc_library_handle < HINSTANCE_ERROR)
00345 #endif
00346 {
00347 rcs_print_error ("LoadLibrary(%s) Error: %d\n", rpc_dll_name,
00348 rpc_library_handle);
00349 rcs_print_error
00350 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00351 rpc_availability = RPC_NOT_AVAILABLE;
00352 return -1;
00353 }
00354 }
00355 }
00356
00357 if (rpc_library_handle == NULL)
00358 {
00359 strcpy (rpc_dll_name, windows_system_directory);
00360 strcat (rpc_dll_name, "\\tklib.dll");
00361 if (!stat (rpc_dll_name, &rpc_dll_stat))
00362 {
00363 rpc_library_type = PCNFS_TKDLL_WINDOWS_31;
00364 use_init_and_cleanup = 1;
00365 rpc_library_handle = LoadLibrary (rpc_dll_name);
00366 #ifdef WIN32
00367 if (rpc_library_handle == NULL)
00368 #else
00369 if (rpc_library_handle < HINSTANCE_ERROR)
00370 #endif
00371 {
00372 rcs_print_error ("LoadLibrary(%s) Error: %d\n",
00373 rpc_dll_name, rpc_library_handle);
00374 rcs_print_error
00375 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00376 rpc_availability = RPC_NOT_AVAILABLE;
00377 return -1;
00378 }
00379 }
00380 }
00381
00382 if (rpc_library_handle == NULL)
00383 {
00384 rcs_print_error ("Can't find DLL to load rpc interface. \n");
00385 rcs_print_error
00386 ("Check that tklib.dll or tirpc.dll is in the windows system directory.\n");
00387 rcs_print_error ("tirpc.dll will only be used in 32-bit mode.\n");
00388 return -1;
00389 }
00390
00391 rcs_print_debug (PRINT_INTERFACE_LOADING,
00392 "Loading rpc interface with %s\n", rpc_dll_name);
00393
00394 if (use_init_and_cleanup == 1 && rpc_library_type == PCNFS_TKDLL_WINDOWS_31)
00395 {
00396 ptr_to_tkdll_init = (PTR_TO_TKDLL_INIT) GetProc ("_TKDLL_INIT");
00397 if (NULL == ptr_to_tkdll_init)
00398 {
00399 rcs_print_error ("Can not load function tkdll_init\n");
00400 rcs_print_error
00401 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00402 rpc_availability = RPC_NOT_AVAILABLE;
00403 return -1;
00404 }
00405 ptr_to_tkdll_errno = (PTR_TO_TKDLL_ERRNO) GetProc ("_TKDLL_ERRNO");
00406 if (NULL == ptr_to_tkdll_errno)
00407 {
00408 rcs_print_error ("Can not load function tkdll_errno\n");
00409 rcs_print_error
00410 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00411 rpc_availability = RPC_NOT_AVAILABLE;
00412 return -1;
00413 }
00414 ptr_to_tkdll_version =
00415 (PTR_TO_TKDLL_VERSION) GetProc ("_TKDLL_VERSION");
00416 if (NULL == ptr_to_tkdll_version)
00417 {
00418 rcs_print_error ("Can not load function tkdll_version\n");
00419 rcs_print_error
00420 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00421 rpc_availability = RPC_NOT_AVAILABLE;
00422 return -1;
00423 }
00424 ptr_to_tkdll_cleanup =
00425 (PTR_TO_TKDLL_CLEANUP) GetProc ("_TKDLL_CLEANUP");
00426 if (NULL == ptr_to_tkdll_cleanup)
00427 {
00428 rcs_print_error ("Can not load function tkdll_cleanup\n");
00429 rcs_print_error
00430 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00431 rpc_availability = RPC_NOT_AVAILABLE;
00432 return -1;
00433 }
00434 }
00435
00436 if (use_init_and_cleanup == 1 && rpc_library_type == LIBRPC_WINDOWS)
00437 {
00438 ptr_to_rpc_nt_init = (PTR_TO_RPC_NT_INIT) GetProc ("_rpc_nt_init");
00439 if (NULL == ptr_to_rpc_nt_init)
00440 {
00441 rcs_print_error ("Can not load function rpc_nt_init\n");
00442 rcs_print_error
00443 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00444 rpc_availability = RPC_NOT_AVAILABLE;
00445 return -1;
00446 }
00447 ptr_to_tkdll_errno = sim_tkdll_errno;
00448 ptr_to_rpc_nt_exit = (PTR_TO_RPC_NT_EXIT) GetProc ("_RPC_NT_EXIT");
00449 if (NULL == ptr_to_tkdll_cleanup)
00450 {
00451 rcs_print_error ("Can not load function rpc_nt_exit\n");
00452 rcs_print_error
00453 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00454 rpc_availability = RPC_NOT_AVAILABLE;
00455 return -1;
00456 }
00457 }
00458 ptr_to_clnt_create = (PTR_TO_CLNT_CREATE) GetProc ("_CLNT_CREATE");
00459 if (NULL == ptr_to_clnt_create)
00460 {
00461 rcs_print_error ("Can not load function clnt_create\n");
00462 rcs_print_error
00463 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00464 rpc_availability = RPC_NOT_AVAILABLE;
00465 return -1;
00466 }
00467
00468 if (rpc_library_type != LIBRPC_WINDOWS)
00469 {
00470 ptr_to_clnt_call = (PTR_TO_CLNT_CALL) GetProc ("_CLNT_CALL");
00471 if (NULL == ptr_to_clnt_call)
00472 {
00473 rcs_print_error ("Can not load function clnt_call\n");
00474 rcs_print_error
00475 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00476 rpc_availability = RPC_NOT_AVAILABLE;
00477 return -1;
00478 }
00479 ptr_to_clnt_control = (PTR_TO_CLNT_CONTROL) GetProc ("_CLNT_CONTROL");
00480 if (NULL == ptr_to_clnt_control)
00481 {
00482 rcs_print_error ("Can not load function clnt_control\n");
00483 rcs_print_error
00484 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00485 rpc_availability = RPC_NOT_AVAILABLE;
00486 return -1;
00487 }
00488 ptr_to_clnt_destroy = (PTR_TO_CLNT_DESTROY) GetProc ("_CLNT_DESTROY");
00489 if (NULL == ptr_to_clnt_destroy)
00490 {
00491 rcs_print_error ("Can not load function clnt_destroy\n");
00492 rcs_print_error
00493 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00494 rpc_availability = RPC_NOT_AVAILABLE;
00495 return -1;
00496 }
00497 }
00498 ptr_to_clnt_spcreateerror =
00499 (PTR_TO_CLNT_SPCREATEERROR) GetProc ("_CLNT_SPCREATEERROR");
00500 if (NULL == ptr_to_clnt_spcreateerror)
00501 {
00502 rcs_print_error ("Can not load function clnt_spcreateerror\n");
00503 rcs_print_error
00504 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00505 rpc_availability = RPC_NOT_AVAILABLE;
00506 return -1;
00507 }
00508 ptr_to_clnt_sperrno = (PTR_TO_CLNT_SPERRNO) GetProc ("_CLNT_SPERRNO");
00509 if (NULL == ptr_to_clnt_sperrno)
00510 {
00511 rcs_print_error ("Can not load function clnt_sperrno\n");
00512 rcs_print_error
00513 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00514 rpc_availability = RPC_NOT_AVAILABLE;
00515 return -1;
00516 }
00517
00518 if (rpc_library_type == PCNFS_TKDLL_WINDOWS_31)
00519 {
00520 ptr_to_pascal_xdrmem_create =
00521 (PTR_TO_PASCAL_XDRMEM_CREATE) GetProc ("XDRMEM_CREATE");
00522 if (NULL == ptr_to_pascal_xdrmem_create)
00523 {
00524 rcs_print_error ("Can not load function xdrmem_create\n");
00525 rcs_print_error
00526 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00527 rpc_availability = RPC_NOT_AVAILABLE;
00528 return -1;
00529 }
00530 ptr_to_pascal_xdr_destroy =
00531 (PTR_TO_PASCAL_XDR_DESTROY) GetProc ("XDR_DESTROY");
00532 if (NULL == ptr_to_pascal_xdr_destroy)
00533 {
00534 rcs_print_error ("Can not load function xdr_destroy\n");
00535 rcs_print_error
00536 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00537 rpc_availability = RPC_NOT_AVAILABLE;
00538 return -1;
00539 }
00540 ptr_to_pascal_xdr_getpos =
00541 (PTR_TO_PASCAL_XDR_GETPOS) GetProc ("XDR_GETPOS");
00542 if (NULL == ptr_to_pascal_xdr_getpos)
00543 {
00544 rcs_print_error ("Can not load function xdr_getpos\n");
00545 rcs_print_error
00546 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00547 rpc_availability = RPC_NOT_AVAILABLE;
00548 return -1;
00549 }
00550 ptr_to_pascal_xdr_setpos =
00551 (PTR_TO_PASCAL_XDR_SETPOS) GetProc ("XDR_SETPOS");
00552 if (NULL == ptr_to_pascal_xdr_setpos)
00553 {
00554 rcs_print_error ("Can not load function xdr_setpos\n");
00555 rcs_print_error
00556 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00557 rpc_availability = RPC_NOT_AVAILABLE;
00558 return -1;
00559 }
00560 ptr_to_pascal_xdr_void = (PTR_TO_PASCAL_XDR_VOID) GetProc ("XDR_VOID");
00561 if (NULL == ptr_to_pascal_xdr_void)
00562 {
00563 rcs_print_error ("Can not load function xdr_void\n");
00564 rcs_print_error
00565 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00566 rpc_availability = RPC_NOT_AVAILABLE;
00567 return -1;
00568 }
00569 ptr_to_pascal_xdr_char = (PTR_TO_PASCAL_XDR_CHAR) GetProc ("XDR_CHAR");
00570 if (NULL == ptr_to_pascal_xdr_char)
00571 {
00572 rcs_print_error ("Can not load function xdr_char\n");
00573 rcs_print_error
00574 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00575 rpc_availability = RPC_NOT_AVAILABLE;
00576 return -1;
00577 }
00578 ptr_to_pascal_xdr_u_char =
00579 (PTR_TO_PASCAL_XDR_U_CHAR) GetProc ("XDR_U_CHAR");
00580 if (NULL == ptr_to_pascal_xdr_u_char)
00581 {
00582 rcs_print_error ("Can not load function xdr_u_char\n");
00583 rcs_print_error
00584 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00585 rpc_availability = RPC_NOT_AVAILABLE;
00586 return -1;
00587 }
00588 ptr_to_pascal_xdr_short =
00589 (PTR_TO_PASCAL_XDR_SHORT) GetProc ("XDR_SHORT");
00590 if (NULL == ptr_to_pascal_xdr_short)
00591 {
00592 rcs_print_error ("Can not load function xdr_short\n");
00593 rcs_print_error
00594 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00595 rpc_availability = RPC_NOT_AVAILABLE;
00596 return -1;
00597 }
00598 ptr_to_pascal_xdr_u_short =
00599 (PTR_TO_PASCAL_XDR_U_SHORT) GetProc ("XDR_U_SHORT");
00600 if (NULL == ptr_to_pascal_xdr_u_short)
00601 {
00602 rcs_print_error ("Can not load function xdr_u_short\n");
00603 rcs_print_error
00604 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00605 rpc_availability = RPC_NOT_AVAILABLE;
00606 return -1;
00607 }
00608 ptr_to_pascal_xdr_int = (PTR_TO_PASCAL_XDR_INT) GetProc ("XDR_INT");
00609 if (NULL == ptr_to_pascal_xdr_int)
00610 {
00611 rcs_print_error ("Can not load function xdr_int\n");
00612 rcs_print_error
00613 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00614 rpc_availability = RPC_NOT_AVAILABLE;
00615 return -1;
00616 }
00617 ptr_to_pascal_xdr_u_int =
00618 (PTR_TO_PASCAL_XDR_U_INT) GetProc ("XDR_U_INT");
00619 if (NULL == ptr_to_pascal_xdr_u_int)
00620 {
00621 rcs_print_error ("Can not load function xdr_u_int\n");
00622 rcs_print_error
00623 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00624 rpc_availability = RPC_NOT_AVAILABLE;
00625 return -1;
00626 }
00627 ptr_to_pascal_xdr_long = (PTR_TO_PASCAL_XDR_LONG) GetProc ("XDR_LONG");
00628 if (NULL == ptr_to_pascal_xdr_long)
00629 {
00630 rcs_print_error ("Can not load function xdr_long\n");
00631 rcs_print_error
00632 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00633 rpc_availability = RPC_NOT_AVAILABLE;
00634 return -1;
00635 }
00636 ptr_to_pascal_xdr_u_long =
00637 (PTR_TO_PASCAL_XDR_U_LONG) GetProc ("XDR_U_LONG");
00638 if (NULL == ptr_to_clnt_create)
00639 {
00640 rcs_print_error ("Can not load function xdr_u_long\n");
00641 rcs_print_error
00642 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00643 rpc_availability = RPC_NOT_AVAILABLE;
00644 return -1;
00645 }
00646 ptr_to_pascal_xdr_float =
00647 (PTR_TO_PASCAL_XDR_FLOAT) GetProc ("XDR_FLOAT");
00648 if (NULL == ptr_to_pascal_xdr_float)
00649 {
00650 rcs_print_error ("Can not load function xdr_float\n");
00651 rcs_print_error
00652 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00653 rpc_availability = RPC_NOT_AVAILABLE;
00654 return -1;
00655 }
00656 ptr_to_pascal_xdr_double =
00657 (PTR_TO_PASCAL_XDR_DOUBLE) GetProc ("XDR_DOUBLE");
00658 if (NULL == ptr_to_pascal_xdr_double)
00659 {
00660 rcs_print_error ("Can not load function xdr_double\n");
00661 rcs_print_error
00662 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00663 rpc_availability = RPC_NOT_AVAILABLE;
00664 return -1;
00665 }
00666 ptr_to_pascal_xdr_vector =
00667 (PTR_TO_PASCAL_XDR_VECTOR) GetProc ("XDR_VECTOR");
00668 if (NULL == ptr_to_pascal_xdr_vector)
00669 {
00670 rcs_print_error ("Can not load function xdr_vector\n");
00671 rcs_print_error
00672 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00673 rpc_availability = RPC_NOT_AVAILABLE;
00674 return -1;
00675 }
00676 ptr_to_pascal_xdr_bytes =
00677 (PTR_TO_PASCAL_XDR_BYTES) GetProc ("XDR_BYTES");
00678 if (NULL == ptr_to_pascal_xdr_bytes)
00679 {
00680 rcs_print_error ("Can not load function xdr_bytes\n");
00681 rcs_print_error
00682 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00683 rpc_availability = RPC_NOT_AVAILABLE;
00684 return -1;
00685 }
00686 ptr_to_pascal_xdr_opaque =
00687 (PTR_TO_PASCAL_XDR_OPAQUE) GetProc ("XDR_OPAQUE");
00688 if (NULL == ptr_to_pascal_xdr_opaque)
00689 {
00690 rcs_print_error ("Can not load function xdr_opaque\n");
00691 rcs_print_error
00692 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00693 rpc_availability = RPC_NOT_AVAILABLE;
00694 return -1;
00695 }
00696 }
00697 else
00698 {
00699 ptr_to_xdrmem_create =
00700 (PTR_TO_XDRMEM_CREATE) GetProc ("_XDRMEM_CREATE");
00701
00702 if (NULL == ptr_to_xdrmem_create)
00703 {
00704 rcs_print_error ("Can not load function xdrmem_create\n");
00705 rcs_print_error
00706 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00707 rpc_availability = RPC_NOT_AVAILABLE;
00708 return -1;
00709 }
00710 ptr_to_xdr_void = (PTR_TO_XDR_VOID) GetProc ("_XDR_VOID");
00711 if (NULL == ptr_to_xdr_void)
00712 {
00713 rcs_print_error ("Can not load function xdr_void\n");
00714 rcs_print_error
00715 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00716 rpc_availability = RPC_NOT_AVAILABLE;
00717 return -1;
00718 }
00719 ptr_to_xdr_char = (PTR_TO_XDR_CHAR) GetProc ("_XDR_CHAR");
00720 if (NULL == ptr_to_xdr_char)
00721 {
00722 rcs_print_error ("Can not load function xdr_char\n");
00723 rcs_print_error
00724 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00725 rpc_availability = RPC_NOT_AVAILABLE;
00726 return -1;
00727 }
00728 ptr_to_xdr_u_char = (PTR_TO_XDR_U_CHAR) GetProc ("_XDR_U_CHAR");
00729 if (NULL == ptr_to_xdr_u_char)
00730 {
00731 rcs_print_error ("Can not load function xdr_u_char\n");
00732 rcs_print_error
00733 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00734 rpc_availability = RPC_NOT_AVAILABLE;
00735 return -1;
00736 }
00737 ptr_to_xdr_short = (PTR_TO_XDR_SHORT) GetProc ("_XDR_SHORT");
00738 if (NULL == ptr_to_xdr_short)
00739 {
00740 rcs_print_error ("Can not load function xdr_short\n");
00741 rcs_print_error
00742 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00743 rpc_availability = RPC_NOT_AVAILABLE;
00744 return -1;
00745 }
00746 ptr_to_xdr_u_short = (PTR_TO_XDR_U_SHORT) GetProc ("_XDR_U_SHORT");
00747 if (NULL == ptr_to_xdr_u_short)
00748 {
00749 rcs_print_error ("Can not load function xdr_u_short\n");
00750 rcs_print_error
00751 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00752 rpc_availability = RPC_NOT_AVAILABLE;
00753 return -1;
00754 }
00755 ptr_to_xdr_int = (PTR_TO_XDR_INT) GetProc ("_XDR_INT");
00756 if (NULL == ptr_to_xdr_int)
00757 {
00758 rcs_print_error ("Can not load function xdr_int\n");
00759 rcs_print_error
00760 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00761 rpc_availability = RPC_NOT_AVAILABLE;
00762 return -1;
00763 }
00764 ptr_to_xdr_u_int = (PTR_TO_XDR_U_INT) GetProc ("_XDR_U_INT");
00765 if (NULL == ptr_to_xdr_u_int)
00766 {
00767 rcs_print_error ("Can not load function xdr_u_int\n");
00768 rcs_print_error
00769 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00770 rpc_availability = RPC_NOT_AVAILABLE;
00771 return -1;
00772 }
00773 ptr_to_xdr_long = (PTR_TO_XDR_LONG) GetProc ("_XDR_LONG");
00774 if (NULL == ptr_to_xdr_long)
00775 {
00776 rcs_print_error ("Can not load function xdr_long\n");
00777 rcs_print_error
00778 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00779 rpc_availability = RPC_NOT_AVAILABLE;
00780 return -1;
00781 }
00782 ptr_to_xdr_u_long = (PTR_TO_XDR_U_LONG) GetProc ("_XDR_U_LONG");
00783 if (NULL == ptr_to_clnt_create)
00784 {
00785 rcs_print_error ("Can not load function xdr_u_long\n");
00786 rcs_print_error
00787 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00788 rpc_availability = RPC_NOT_AVAILABLE;
00789 return -1;
00790 }
00791 ptr_to_xdr_float = (PTR_TO_XDR_FLOAT) GetProc ("_XDR_FLOAT");
00792 if (NULL == ptr_to_xdr_float)
00793 {
00794 rcs_print_error ("Can not load function xdr_float\n");
00795 rcs_print_error
00796 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00797 rpc_availability = RPC_NOT_AVAILABLE;
00798 return -1;
00799 }
00800 ptr_to_xdr_double = (PTR_TO_XDR_DOUBLE) GetProc ("_XDR_DOUBLE");
00801 if (NULL == ptr_to_xdr_double)
00802 {
00803 rcs_print_error ("Can not load function xdr_double\n");
00804 rcs_print_error
00805 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00806 rpc_availability = RPC_NOT_AVAILABLE;
00807 return -1;
00808 }
00809 ptr_to_xdr_vector = (PTR_TO_XDR_VECTOR) GetProc ("_XDR_VECTOR");
00810 if (NULL == ptr_to_xdr_vector)
00811 {
00812 rcs_print_error ("Can not load function xdr_vector\n");
00813 rcs_print_error
00814 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00815 rpc_availability = RPC_NOT_AVAILABLE;
00816 return -1;
00817 }
00818 ptr_to_xdr_bytes = (PTR_TO_XDR_BYTES) GetProc ("_XDR_BYTES");
00819 if (NULL == ptr_to_xdr_bytes)
00820 {
00821 rcs_print_error ("Can not load function xdr_bytes\n");
00822 rcs_print_error
00823 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00824 rpc_availability = RPC_NOT_AVAILABLE;
00825 return -1;
00826 }
00827 ptr_to_xdr_opaque = (PTR_TO_XDR_OPAQUE) GetProc ("_XDR_OPAQUE");
00828 if (NULL == ptr_to_xdr_opaque)
00829 {
00830 rcs_print_error ("Can not load function xdr_opaque\n");
00831 rcs_print_error
00832 ("Can not load PC-NFS Toolkit Library. (RPC will not be available.)\n");
00833 rpc_availability = RPC_NOT_AVAILABLE;
00834 return -1;
00835 }
00836 }
00837
00838 if (use_init_and_cleanup == 1 && rpc_library_type == PCNFS_TKDLL_WINDOWS_31)
00839 {
00840 int init_ret;
00841
00842 if (!(init_ret = ptr_to_tkdll_init ()))
00843 {
00844 rcs_print_error
00845 ("CMS: Couldn't initialize PC-NFS Toolkit DLL. (%d)\n",
00846 (*(ptr_to_tkdll_errno ())));
00847 rcs_print_error
00848 ("For Windows 3.x make sure RTM (a PCNFS TSR) is started before starting Windows.\n");
00849 rpc_availability = RPC_NOT_AVAILABLE;
00850 return -1;
00851 }
00852 long version;
00853
00854 version = ptr_to_tkdll_version ();
00855 if (version < 4000000l)
00856 {
00857 rcs_print_error ("CMS: PC-NFS DLL must be atleast version 4.0.\n");
00858 rcs_print_error ("CMS: version = %lx\n", version);
00859 rpc_availability = RPC_NOT_AVAILABLE;
00860 return -1;
00861 }
00862 }
00863
00864 if (use_init_and_cleanup == 1 && rpc_library_type == LIBRPC_WINDOWS)
00865 {
00866 int init_ret;
00867
00868 if (!(init_ret = ptr_to_rpc_nt_init ()))
00869 {
00870 rcs_print_error ("CMS: Couldn't initialize RPC DLL. (%d)\n");
00871 }
00872 }
00873 rpc_availability = RPC_AVAILABLE;
00874 return 0;
00875 #endif
00876 }
00877
00878 void
00879 unload_rpc_interface ()
00880 {
00881 rpc_load_count--;
00882 if (rpc_load_count > 0)
00883 {
00884 return;
00885 }
00886 #ifndef _Windows
00887 return;
00888 #else
00889 if (NULL != ptr_to_tkdll_cleanup && use_init_and_cleanup)
00890 {
00891 ptr_to_tkdll_cleanup ();
00892 }
00893 if (NULL != ptr_to_rpc_nt_exit && use_init_and_cleanup)
00894
00895 {
00896 ptr_to_rpc_nt_exit ();
00897 }
00898 #ifdef WIN32
00899 if (rpc_library_handle != NULL)
00900 #else
00901 if (rpc_library_handle > HINSTANCE_ERROR)
00902 #endif
00903 {
00904 FreeLibrary (rpc_library_handle);
00905 }
00906 rpc_library_handle = NULL;
00907 ptr_to_tkdll_init = NULL;
00908 ptr_to_tkdll_cleanup = NULL;
00909 ptr_to_tkdll_version = NULL;
00910 ptr_to_clnt_call = NULL;
00911 ptr_to_clnt_create = NULL;
00912 ptr_to_clnt_control = NULL;
00913 ptr_to_clnt_spcreateerror = NULL;
00914 ptr_to_clnt_sperrno = NULL;
00915 ptr_to_xdrmem_create = NULL;
00916 ptr_to_xdr_destroy = NULL;
00917 ptr_to_xdr_getpos = NULL;
00918 ptr_to_xdr_setpos = NULL;
00919 ptr_to_xdr_char = NULL;
00920 ptr_to_xdr_u_char = NULL;
00921 ptr_to_xdr_int = NULL;
00922 ptr_to_xdr_u_int = NULL;
00923 ptr_to_xdr_long = NULL;
00924 ptr_to_xdr_u_long = NULL;
00925 ptr_to_xdr_float = NULL;
00926 ptr_to_xdr_double = NULL;
00927 rpc_availability = RPC_NOT_CHECKED;
00928 return;
00929 #endif
00930 }
00931
00932 CLIENT *
00933 dl_clnt_create (char *host_name, unsigned long prog,
00934 unsigned long version, char *nettype)
00935 {
00936 #ifndef _WINDOWS
00937 return clnt_create (host_name, prog, version, nettype);
00938 #else
00939 if (rpc_availability != RPC_AVAILABLE || ptr_to_clnt_create == NULL)
00940 {
00941 rcs_print_error
00942 ("Attempt to call dl_clnt_create when RPC interface is not available.\n");
00943 return NULL;
00944 }
00945 return ptr_to_clnt_create (host_name, prog, version, nettype);
00946 #endif
00947 }
00948
00949 bool_t
00950 dl_clnt_control (CLIENT * clnt, u_int request, char *info)
00951 {
00952 #ifndef _WINDOWS
00953 return clnt_control (clnt, request, info);
00954 #else
00955 if (rpc_availability != RPC_AVAILABLE || ptr_to_clnt_control == NULL)
00956 {
00957 if (rpc_library_type == LIBRPC_WINDOWS)
00958 {
00959 if (clnt != NULL)
00960 {
00961 if (clnt->cl_ops != NULL)
00962 {
00963 if (clnt->cl_ops->cl_call != NULL)
00964 {
00965 return
00966 (*((bool_t (*)(CLIENT *, int, char *))
00967 clnt->cl_ops->cl_control)) (clnt, request, info);
00968 }
00969 }
00970 }
00971 }
00972 rcs_print_error
00973 ("Attempt to call dl_clnt_control when RPC interface is not available.\n");
00974 return 0;
00975 }
00976 return ptr_to_clnt_control (clnt, request, info);
00977 #endif
00978 }
00979
00980 enum clnt_stat
00981 dl_clnt_call (CLIENT * clnt, u_long procnum,
00982 xdrproc_t inproc, caddr_t in,
00983 xdrproc_t outproc, caddr_t out, struct timeval tv)
00984 {
00985 #ifndef _WINDOWS
00986 return clnt_call (clnt, procnum, inproc, in, outproc, out, tv);
00987 #else
00988 if (rpc_availability != RPC_AVAILABLE || ptr_to_clnt_call == NULL)
00989 {
00990 if (rpc_library_type == LIBRPC_WINDOWS)
00991 {
00992 if (clnt != NULL)
00993 {
00994 if (clnt->cl_ops != NULL)
00995 {
00996 if (clnt->cl_ops->cl_call != NULL)
00997 {
00998 return
00999 (*
01000 ((enum
01001 clnt_stat (*)(CLIENT *, u_long, xdrproc_t, char *,
01002 xdrproc_t, char *,
01003 struct timeval)) clnt->cl_ops->
01004 cl_call)) (clnt, procnum, inproc, in, outproc, out,
01005 tv);
01006 }
01007 }
01008 }
01009 }
01010 rcs_print_error
01011 ("Attempt to call dl_clnt_call when RPC interface is not available.\n");
01012 return RPC_SYSTEMERROR;
01013 }
01014 return (*ptr_to_clnt_call) (clnt, procnum, inproc, in, outproc, out, tv);
01015 #endif
01016 }
01017
01018 void
01019 dl_clnt_destroy (CLIENT * clnt)
01020 {
01021 #ifndef _WINDOWS
01022 clnt_destroy (clnt);
01023 #else
01024 if (rpc_availability != RPC_AVAILABLE || ptr_to_clnt_destroy == NULL)
01025 {
01026 if (rpc_library_type == LIBRPC_WINDOWS)
01027 {
01028 if (clnt != NULL)
01029 {
01030 if (clnt->cl_ops != NULL)
01031 {
01032 if (clnt->cl_ops->cl_destroy != NULL)
01033 {
01034 (*((void (*)(CLIENT *))
01035 clnt->cl_ops->cl_destroy)) (clnt);
01036 return;
01037 }
01038 }
01039 }
01040 }
01041
01042 rcs_print_error
01043 ("Attempt to call dl_clnt_destroy when RPC interface is not available.\n");
01044 return;
01045 }
01046 ptr_to_clnt_destroy (clnt);
01047 #endif
01048 }
01049
01050 char *
01051 dl_clnt_spcreateerror (char *prefix)
01052 {
01053 #ifndef _WINDOWS
01054 return clnt_spcreateerror (prefix);
01055 #else
01056 if (rpc_availability != RPC_AVAILABLE || ptr_to_clnt_spcreateerror == NULL)
01057 {
01058 rcs_print_error
01059 ("Attempt to call dl_clnt_spcreateerror when RPC interface is not available.\n");
01060 return NULL;
01061 }
01062 return ptr_to_clnt_spcreateerror (prefix);
01063 #endif
01064 }
01065
01066 char *
01067 dl_clnt_sperrno (enum clnt_stat error_type)
01068 {
01069 #ifndef _WINDOWS
01070 return clnt_sperrno (error_type);
01071 #else
01072 if (rpc_availability != RPC_AVAILABLE || ptr_to_clnt_sperrno == NULL)
01073 {
01074 rcs_print_error
01075 ("Attempt to call dl_clnt_sperrno when RPC interface is not available.\n");
01076 return NULL;
01077 }
01078 return ptr_to_clnt_sperrno (error_type);
01079 #endif
01080 }
01081
01082 void
01083 dl_xdrmem_create (XDR * xdrs, char RCS_FAR * buf, unsigned int size,
01084 enum xdr_op type)
01085 {
01086 #ifndef _WINDOWS
01087 xdrmem_create (xdrs, buf, size, type);
01088 #else
01089 if (rpc_library_type != PCNFS_TKDLL_WINDOWS_31)
01090 {
01091 if (rpc_availability != RPC_AVAILABLE || ptr_to_xdrmem_create == NULL)
01092 {
01093 rcs_print_error
01094 ("Attempt to call dl_xdrmem_create when RPC interface is not available.\n");
01095 return;
01096 }
01097 ptr_to_xdrmem_create (xdrs, buf, size, type);
01098 }
01099 else
01100 {
01101 if (rpc_availability != RPC_AVAILABLE ||
01102 ptr_to_pascal_xdrmem_create == NULL)
01103 {
01104 rcs_print_error
01105 ("Attempt to call dl_xdrmem_create when RPC interface is not available.\n");
01106 return;
01107 }
01108 ptr_to_pascal_xdrmem_create (xdrs, buf, size, type);
01109 }
01110 #endif
01111 }
01112
01113 void
01114 dl_xdr_destroy (XDR * xdrs)
01115 {
01116 #ifndef _WINDOWS
01117 xdr_destroy (xdrs);
01118 #else
01119 switch (rpc_library_type)
01120 {
01121 case LIBRPC_WINDOWS:
01122 if (NULL != xdrs)
01123 {
01124 if (NULL != xdrs->x_ops)
01125 {
01126 if (NULL != xdrs->x_ops->x_destroy)
01127 {
01128 ((void (*)(XDR *)) (xdrs->x_ops->x_destroy)) (xdrs);
01129 return;
01130 }
01131 }
01132 }
01133 rcs_print_error
01134 ("Attempt to call dl_xdr_destroy with invalid XDR struct.\n");
01135 return;
01136
01137 case PCNFS_TKDLL_WINDOWS_31:
01138 if (rpc_availability != RPC_AVAILABLE ||
01139 ptr_to_pascal_xdr_destroy == NULL)
01140 {
01141 rcs_print_error
01142 ("Attempt to call dl_xdr_destroy when RPC interface is not available.\n");
01143 return;
01144 }
01145 ptr_to_pascal_xdr_destroy (xdrs);
01146 return;
01147
01148 default:
01149 if (rpc_availability != RPC_AVAILABLE || ptr_to_xdr_destroy == NULL)
01150 {
01151 rcs_print_error
01152 ("Attempt to call dl_xdr_destroy when RPC interface is not available.\n");
01153 return;
01154 }
01155 ptr_to_xdr_destroy (xdrs);
01156 return;
01157 }
01158 #endif
01159 }
01160
01161 u_long
01162 dl_xdr_getpos (XDR * xdrs)
01163 {
01164 #ifndef _WINDOWS
01165 return xdr_getpos (xdrs);
01166 #else
01167 switch (rpc_library_type)
01168 {
01169 case LIBRPC_WINDOWS:
01170 if (NULL != xdrs)
01171 {
01172 if (NULL != xdrs->x_ops)
01173 {
01174 if (NULL != xdrs->x_ops->x_getpostn)
01175 {
01176 return ((unsigned int (*)(XDR *)) (xdrs->x_ops->x_getpostn))
01177 (xdrs);
01178 }
01179 }
01180 }
01181 rcs_print_error
01182 ("Attempt to call dl_xdr_getpos when RPC interface is not available.\n");
01183 return 0;
01184
01185 case PCNFS_TKDLL_WINDOWS_31:
01186 if (rpc_availability != RPC_AVAILABLE ||
01187 ptr_to_pascal_xdr_getpos == NULL)
01188 {
01189 rcs_print_error
01190 ("Attempt to call dl_xdr_getpos when RPC interface is not available.\n");
01191 return 0;
01192 }
01193 return ptr_to_pascal_xdr_getpos (xdrs);
01194
01195 default:
01196 if (rpc_availability != RPC_AVAILABLE || ptr_to_xdr_getpos == NULL)
01197 {
01198 rcs_print_error
01199 ("Attempt to call dl_xdr_getpos when RPC interface is not available.\n");
01200 return 0;
01201 }
01202 return ptr_to_xdr_getpos (xdrs);
01203 }
01204 #endif
01205 }
01206
01207 bool_t
01208 dl_xdr_setpos (XDR * xdrs, u_long pos)
01209 {
01210 #ifndef _WINDOWS
01211 return xdr_setpos (xdrs, pos);
01212 #else
01213 switch (rpc_library_type)
01214 {
01215 case LIBRPC_WINDOWS:
01216 if (NULL != xdrs)
01217 {
01218 if (NULL != xdrs->x_ops)
01219 {
01220 if (NULL != xdrs->x_ops->x_setpostn)
01221 {
01222 return ((bool_t (*)(XDR *, u_long))
01223 (xdrs->x_ops->x_setpostn)) (xdrs, pos);
01224 }
01225 }
01226 }
01227 rcs_print_error
01228 ("Attempt to call dl_xdr_setpos when RPC interface is not available.\n");
01229 return 0;
01230
01231 case PCNFS_TKDLL_WINDOWS_31:
01232 if (rpc_availability != RPC_AVAILABLE ||
01233 ptr_to_pascal_xdr_setpos == NULL)
01234 {
01235 rcs_print_error
01236 ("Attempt to call dl_xdr_setpos when RPC interface is not available.\n");
01237 return 0;
01238 }
01239 return ptr_to_pascal_xdr_setpos (xdrs, pos);
01240
01241 default:
01242 if (rpc_availability != RPC_AVAILABLE || ptr_to_xdr_setpos == NULL)
01243 {
01244 rcs_print_error
01245 ("Attempt to call dl_xdr_setpos when RPC interface is not available.\n");
01246 return 0;
01247 }
01248 return ptr_to_xdr_setpos (xdrs, pos);
01249 }
01250 #endif
01251 }