2013-07-05 39 views
0

我有一個運行在Solaris中的RPC服務器。我有一個RPC客戶端,它在Solaris中運行良好。 當我在Linux(RHEL 5或6)中編譯並運行相同的代碼時,我得到了服務器中的Error解碼參數。 我應該如何找出問題?Linux和Solaris之間的RPC調用

的代碼的某些部分是:

/* now allocate a LoopListRequestStruct and fill it with request data */ 

    llrs = malloc(sizeof(LoopListRequestStruct)); 

    fill_llrs(llrs); 

    /* Now, make the client request to the bossServer */ 

    client_call_status = clnt_call(request_client, ModifyDhctState, 
      (xdrproc_t)xdr_LoopListRequestStruct, 
      (caddr_t)llrs, 
      (xdrproc_t)xdr_void, 
      0, 
      dummy_timeval 
     ); 

void fill_llrs(LoopListRequestStruct* llrs) 
{ 

    Descriptor_Loop* dl = 0; 
    DhctState_d *dhct_state_ptr = 0; 
    PackageAuthorization_d *pkg_auth_ptr = 0; 

    llrs->TRANS_NUM = 999999; /* strictly arbitraty, use whatever you want */ 
           /* the bossServer simply passes this back in */ 
           /* in the response you use it to match  */ 
           /* request/response if you want or you can */ 
           /* choose to ignore it if you want   */ 

    /* now set the response program number, this is the program number of */ 
    /* transient program that was set up using the svc_reg_utils.[ch]  */ 
    /* it is that program that the response will be sent to    */ 

    llrs->responseProgramNum = response_program_number; 

    /* now allocate some memory for the data structures that will actually */ 
    /* carry the request data */ 

    llrs->ARG_PTR = malloc(sizeof(LoopListRequestArgs)); 

    dl = llrs->ARG_PTR->loopList.Loop_List_val; 

    /* we are using a single descriptor loop at a time, this should always */ 
    /* be the case */ 

    llrs->ARG_PTR->loopList.Loop_List_len = 1; 
    llrs->ARG_PTR->loopList.Loop_List_val = malloc(sizeof(Descriptor_Loop)); 

    /* now allocate memory and set the size for the ModifyDhctConfiguration */ 
    /* this transaction always has 3 descriptors, the DhctMacAddr_d, the */ 
    /* DhctState_d, and the PackageAuthorization_d       */ 

    dl = llrs->ARG_PTR->loopList.Loop_List_val; 
    dl->Descriptor_Loop_len = 2; 
    dl->Descriptor_Loop_val = 
     malloc((2 * sizeof(Resource_descriptor_union))); 

    /* now, populate each descriptor */ 
    /* the order doesn't really matter I'm just doing it in the order I */ 
    /* always have done */ 

    /* first the mac address descriptor */ 

    dl->Descriptor_Loop_val->type = 
     dhct_mac_addr_type; 

    strcpy(
    dl->Descriptor_Loop_val[0].Resource_descriptor_union_u.dhctMacAddr.dhctMacAddr, 
     dhct_mac_addr 
    ); 

    /* second the dhct state descriptor */ 

    dl->Descriptor_Loop_val[1].type = 
     dhct_state_type; 

    dhct_state_ptr = 
     &(dl->Descriptor_Loop_val[1].Resource_descriptor_union_u.dhctState); 

    if(dis_enable) 
     dhct_state_ptr->disEnableFlag = DIS_Enabled; 
    else 
     dhct_state_ptr->disEnableFlag = DIS_Disabled; 

    if(dms_enable) 
     dhct_state_ptr->dmsEnableFlag = DMS_Enabled; 
    else 
     dhct_state_ptr->dmsEnableFlag = DMS_Disabled; 

    if(analog_enable) 
     dhct_state_ptr->analogEnableFlag = AEF_Enabled; 
    else 
     dhct_state_ptr->analogEnableFlag = AEF_Disabled; 

    if(ippv_enable) 
     dhct_state_ptr->ippvEnableFlag = IEF_Enabled; 
    else 
     dhct_state_ptr->ippvEnableFlag = IEF_Disabled; 

    dhct_state_ptr->creditLimit = credit_limit; 
    dhct_state_ptr->maxIppvEvents = max_ippv_events; 

    /* we don't currently use the powerkey pin, instead we use an  */ 
    /* application layer pin for purchases and blocking so always turn */ 
    /* pinEnable off */ 

    dhct_state_ptr->pinEnable = PE_Disabled; 
    dhct_state_ptr->pin = 0; 


    if(fast_refresh_enable) 
     dhct_state_ptr->fastRefreshFlag = FRF_Enabled; 
    else 
     dhct_state_ptr->fastRefreshFlag = FRF_Disabled; 

    dhct_state_ptr->locationX = location_x; 
    dhct_state_ptr->locationY = location_y; 

} 
+0

你能描述錯誤信息更精確? – kofemann

+0

在Solaris端我有一些提供rpc服務器的cisco應用程序,在它的日誌中我發現它在解碼參數時出錯,但我不知道如何理解參數有什麼問題。 – Zeratul

+0

可以請你告訴我,如果知道,如何獲得帶有參數的RPC調用消息以理解從solaris或linux發送的消息中的不同點? – Zeratul

回答

0

Set PIN = ""; //而不是零,它的工作:)

有兩個頭端和客戶端的C編譯器之間的差異。他們以不同方式處理字符串

BR, CHANDAN爾斯基