getxattr:检索扩展的属性值不起作用

时间:2019-06-25 04:41:14

标签: c++ embedded-linux

getXAddr(this-> soap)返回默认地址,而不是实际的eth0地址

在库下面添加了

#include <sys/types.h>
#include <attr/xattr.h>

int DeviceBindingService::GetServices(_tds__GetServices *tds__GetServices, _tds__GetServicesResponse &tds__GetServicesResponse)
{
    DEBUG_MSG("Device: %s\n", __FUNCTION__);


    ServiceContext* ctx = (ServiceContext*)this->soap->user;

    std::string XAddr = ctx->getXAddr(this->soap);



    std::cout << "XAddr:%s" << XAddr << std::endl;
    std::cout << "XAddr:%s" << ctx->getXAddr(this->soap) << std::endl;

    //Device Service
    tds__GetServicesResponse.Service.push_back(soap_new_tds__Service(this->soap));
    tds__GetServicesResponse.Service.back()->Namespace  = "http://www.onvif.org/ver10/device/wsdl";
    tds__GetServicesResponse.Service.back()->XAddr      = XAddr;
    tds__GetServicesResponse.Service.back()->Version    = soap_new_req_tt__OnvifVersion(this->soap, 2, 5);
    if( tds__GetServices->IncludeCapability )
    {
        tds__GetServicesResponse.Service.back()->Capabilities        = soap_new__tds__Service_Capabilities(this->soap);
        tds__DeviceServiceCapabilities *capabilities                 = ctx->getDeviceServiceCapabilities(this->soap);
        tds__GetServicesResponse.Service.back()->Capabilities->__any = soap_dom_element(this->soap, NULL, "tds:Capabilities", capabilities, capabilities->soap_type());
    }


    tds__GetServicesResponse.Service.push_back(soap_new_tds__Service(this->soap));
    tds__GetServicesResponse.Service.back()->Namespace  = "http://www.onvif.org/ver10/media/wsdl";
    tds__GetServicesResponse.Service.back()->XAddr      = XAddr;
    tds__GetServicesResponse.Service.back()->Version    = soap_new_req_tt__OnvifVersion(this->soap, 2, 6);
    if (tds__GetServices->IncludeCapability)
    {
        tds__GetServicesResponse.Service.back()->Capabilities        = soap_new__tds__Service_Capabilities(this->soap);
        trt__Capabilities *capabilities                              = ctx->getMediaServiceCapabilities(this->soap);
        tds__GetServicesResponse.Service.back()->Capabilities->__any = soap_dom_element(this->soap, NULL, "trt:Capabilities", capabilities, capabilities->soap_type());
    }


    return SOAP_OK;
}

预期结果是实际的IP地址和端口号

0 个答案:

没有答案