2013-07-05 4 views
0

Solaris에서 RPC 서버를 실행하고 있습니다. 솔라리스에서 잘 돌아가는 RPC 클라이언트가 있습니다. Linux (RHEL 5 또는 6)에서 동일한 코드를 컴파일하고 실행할 때 서버에서 인수를 디코딩하는 중 오류가 발생합니다. 문제를 어떻게 발견해야합니까?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

솔라리스 측면에서 나는 rpc 서버를 제공하는 일부 시스코 어플리케이션을 가지고 있으며, 로그에서 디코딩 인수에 오류가 있음을 알았지 만 인수가 무엇이 잘못되었는지 이해하는 방법을 모릅니다. – Zeratul

+0

그리고 ypu는 솔라리스 나 리눅스에서 보낸 메시지의 다른 점을 이해하기 위해 인수로 RPC 호출 메시지를받는 방법을 알려주시겠습니까? – Zeratul

답변

0

Set PIN = ""; // 0 대신, 그것은 작동합니다 :)

헤드 엔드와 클라이언트 측 모두에서 C 컴파일러 사이에 차이가 있습니다. 그들은 문자열을 다르게 처리합니다.

BR은 이것을 Chandan CHHABRA