将 unsigned long long 与 rpcgen 一起使用会出错

Use of unsigned long long with rpcgen gives error

我有一个文件 reken.x、client.c 和 server.c 来创建一个分布式系统。客户端将两个质数(因此是一个数)的乘积发送到服务器上的 "ontbind" 函数,该函数将数字分解回两个质数。当我在 "reken_in" 和 "reken_uit" 结构中将变量 "getal1"、"antwoord1" 和 "antwoord2" 声明为整数时,这工作正常。但是,当我使用 unsigned long long 时,出现以下错误:

user@DTP12771:~/Desktop/tarbal$ rpcgen reken.x
 unsigned long long getal1;
^^^^^^^^^^^^^^^^^^^
reken.x, line 2: expected '*' or 'identifier'

我如何使用 unsigned long long 类型使其工作?请参考我下面的代码。

reken.x

struct reken_in { /*input argument*/
    unsigned long long getal1;
};

struct reken_uit {
        unsigned long long antwoord1;
    unsigned long long antwoord2;
};

program BEREKEN {
    version  BERVERS{
        reken_uit ONTBIND(reken_in) =1; /*procedure nr. 1*/
         }=1;
}=0x31230000;     /*programma nummer*/

client.c

#include    <stdio.h>
#include    <rpc/rpc.h>
#include    "reken.h"
#include    <stdlib.h>

main(int argc,char *argv[])
{
//hi
CLIENT *cl;
char *server;
reken_in getallen;
reken_uit *antw;

if(argc !=3) {
    puts("aantal argumenten niet goed  <server   productPriemen>");
    exit(1);
}

server=argv[1];
getallen.getal1= strtoull(argv[2], NULL, 10);

cl=clnt_create(server,BEREKEN,BERVERS,"tcp");
if(cl==NULL) {
  printf("fout bij het zoeken naar de server");
  clnt_pcreateerror(server);
  exit(1);
}

antw= ontbind_1(&getallen,cl);
if(antw==NULL)
  puts("fout bij teruggeef parameter");

printf("Het getal %llu is het product van priemgetal %llu en %llu\n",getallen.getal1, antw->antwoord1, antw->antwoord2);
exit (0);
}

server.c

#include  <stdio.h>
#include <rpc/rpc.h>
#include <dirent.h>

#include "reken.h"
#include <math.h>

reken_uit *ontbind_1_svc(struct reken_in *g,struct svc_req *reg)
{
   static reken_uit getallen;

   unsigned long long number = g->getal1;
   unsigned long long i;
   unsigned long long fact;
    for(i = 2; i <= sqrt(number); i++) { //loop tot de sqrt
        if (!isPrime(i) || (i % 2 == 0 && i != 2)) continue;

        if ( number % i != 0 ) continue;

        fact = number / i;      //deel door de i. De i is een prime

        int prime = isPrime(fact);

        if (!prime) continue;

        getallen.antwoord1 = i;
        getallen.antwoord2 = fact;
        return (&getallen);
    }

    return (&getallen);
}

int isPrime (const long long number) {
    int i;  
    for(i = 2; i < number / 2; i++) { // 7
        if ((number % i) == 0) // 7 % 2 == 1
            return 0;
    }
    return 1;
}

在 XDR 中,unsigned long long 未定义,而是使用: unsigned hyperhyper 已签名。有关详细信息,请查找 spec