Edition de lien registerrpc
Un problème d'édition de lein pour registerrpc.
Merci de votre aide.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| ====================
#include <stdio.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
#include <rpc/rpc.h>
typedef struct { int val1;
int val2; } couple_entier;
// Le filtre xdr
bool_t xdr_couple(XDR *p, couple_entier *x)
{ return (xdr_int(p, &x->val1) && xdr_int(p, &x->val2));
}
// La procedure RPC
static int i;
int *somme (couple_entier *x)
{ i = x->val1 + x->val2; return &i;}
/* Les numeros */
#define NUM_PROG 0x22222222 /* numero de programme */
#define NUM_VERSION_1 1 /* le numero de version ici 1 */
#define NUM_SOMME 1 /* numero de la procedure somme */
main ()
{
/* enregistrement du service aupres du rpcbind*/
if (registerrpc((unsigned long)NUM_PROG,(unsigned long) NUM_VERSION_1,(unsigned long) NUM_SOMME,(char *(*)(char *)) somme,(xdrproc_t) xdr_couple, (xdrproc_t) xdr_int) ==-1)
{perror(" Probleme enregistrement du service somme "); exit(1); }
printf("Attente de client \n");
svc_run();
printf(" Sortie du service \n");
} |