pierre31 has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I'would like to do ONC RPC in perl.
"rpcgen" at cpan (http://search.cpan.org/~jake/perlrpcgen-0.71a/) looks like outdatted (1997) and do not compile mainly due to a change in rpc lib.
Does anybody knows sthg about performing RPC ONC in perl, i can't find anything on the net ?

Thanks for your time

Pierre

Output of compilation :

$perl Makefile.PL Writing Makefile for RPC::ONC Writing Makefile for perlrpcgen $make Make[1]: Entering directory `/home/pierrem/perlrpcgen-0.71a/RPC' cc -c -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-s +trict-ali asing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +-O2 -DV ERSION=\"0.5a\" -DXS_VERSION=\"0.5a\" -fPIC "-I/usr/lib/perl/5.8/CORE" + ONC.c ONC.xs:15:25: rpc/svc_soc.h : Aucun fichier ou répertoire de ce type ONC.xs: Dans la fonction « constant »: ONC.xs:138: error: `RPC_CANTCONNECT' undeclared (first use in this fun +ction) ONC.xs:138: error: (Each undeclared identifier is reported only once ONC.xs:138: error: for each function it appears in.) ONC.xs:140: error: `RPC_XPRTFAILED' undeclared (first use in this func +tion) ONC.xs:142: error: `RPC_CANTCREATESTREAM' undeclared (first use in thi +s functio n) ONC.xs: Dans la fonction « XS_RPC__ONC__Client_clnt_create »: ONC.xs:182: error: incompatible type for argument 1 of `set_perl_error +' ONC.xs: Dans la fonction « XS_RPC__ONC__Auth_authsys_create_default »: ONC.xs:239: attention : affectation transforme un entier en pointeur s +ans trans typage ONC.xs: Dans la fonction « XS_RPC__ONC__authsys_parms_aup_time »: ONC.xs:339: error: dereferencing pointer to incomplete type ONC.xs: Dans la fonction « XS_RPC__ONC__authsys_parms_aup_machname »: ONC.xs:349: error: dereferencing pointer to incomplete type ONC.xs: Dans la fonction « XS_RPC__ONC__authsys_parms_aup_uid »: ONC.xs:359: error: dereferencing pointer to incomplete type ONC.xs: Dans la fonction « XS_RPC__ONC__authsys_parms_aup_gid »: ONC.xs:369: error: dereferencing pointer to incomplete type ONC.xs: Dans la fonction « XS_RPC__ONC__authsys_parms_aup_gids »: ONC.xs:382: error: dereferencing pointer to incomplete type ONC.xs:383: error: dereferencing pointer to incomplete type ONC.xs:384: error: dereferencing pointer to incomplete type make[1]: *** [ONC.o] Erreur 1 make[1]: Leaving directory `/home/pierrem/perlrpcgen-0.71a/RPC' make: *** [subdirs] Erreur 2

Replies are listed 'Best First'.
Re: RPC ONC
by Fletch (Bishop) on Apr 11, 2005 at 17:17 UTC

    Given that not much widely used software uses ONC RPC still (at least I can't really think of anything that I'd call "widely used" save NFS off the top of my head) that's not surprising. That's not to say nobody uses it for some internal application, but things like several security holes in rpc.portmapper and what not put an end to widespread use on the Internet as a whole, IMSMR.

    If there's a wrapper library available for the protocol you need you probably can use that via Inline::C; that's also probably going to be your best starting point to reimplement an ONC RPC module yourself (which I'm betting is what you're going to wind up doing, unfortunately). You should also look and see if there isn't an interface available in a more "up to date" RPC protocol such as SOAP, XML-RPC, or CORBA.

    Update: Just thought of what'd be a tremendous kludge, but you might look through the source of old Linux distributions to see if you couldn't find an implementation of the ONC RPC libraries that's source compatible with what's on CPAN and then see if you can get those to compile instead of using what ships with your OS. But again, that'd be a tremendous kludge and possibly more effort than just rewriting your own perlrpcgen from scratch.

      After one week of debugging rpcperlgen I have finally opt for the SWIG library that brought me in a half day a working RPC client from rpcgen's C files.