zoukankan      html  css  js  c++  java
  • Set_Ntp and Get_Ntp 主要是IP

    
    
    int  __ns8__GetNTP(struct soap* soap, struct _ns8__GetNTP *ns8__GetNTP, struct _ns8__GetNTPResponse *ns8__GetNTPResponse)
    {

    printf("%s\n",__FUNCTION__);

    readIPaddr(); //read NTP configuration
    struct ns3__NTPInformation *pNTPInformation;
    pNTPInformation=(struct ns3__NTPInformation*)soap_malloc(soap, sizeof(struct ns3__NTPInformation));
    memset(pNTPInformation, 0, sizeof(struct ns3__NTPInformation));

    // No support DHCP
    pNTPInformation->FromDHCP = xsd__boolean__false_;
    pNTPInformation->__sizeNTPFromDHCP = 0;
    pNTPInformation->__sizeNTPManual = 1;

    // Set NTP Manual parameter
    struct ns3__NetworkHost *pNTPManual;
    pNTPManual=(struct ns3__NetworkHost*)soap_malloc(soap, sizeof(struct ns3__NetworkHost));
    memset(pNTPManual, 0, sizeof(struct ns3__NetworkHost));
    pNTPManual->Type = ns3__NetworkHostType__IPv4;

    static char *pAddr[16] = {NULL};
    static char szTmp[16] = {0};

    strcpy(szTmp, readIPaddr_r[0].IP4);

    *pAddr = szTmp;

    pNTPManual->IPv4Address = pAddr;

    pNTPInformation->NTPManual = pNTPManual;

    ns8__GetNTPResponse->NTPInformation = pNTPInformation;

    return SOAP_OK;
    }


    int  __ns8__SetNTP(struct soap* soap, struct _ns8__SetNTP *ns8__SetNTP, struct _ns8__SetNTPResponse *ns8__SetNTPResponse)
    {
    printf("%s\n",__FUNCTION__);

    if (xsd__boolean__true_ == ns8__SetNTP->FromDHCP)
    {
    return soap_receiver_fault_subcode(soap, "ActionNotSupported", "DHCPNotSupported", NULL);
    }

    if (ns3__NetworkHostType__IPv4 == ns8__SetNTP->NTPManual->Type)
    {

    char *pszIP = NULL;
    int judge_IPv4;
    pszIP = *(ns8__SetNTP->NTPManual->IPv4Address);

    judge_IPv4 = is_valid_ip(pszIP); //判断IP是不是合法  
                                                                                       //IP 地址的判断点这里可以到在这里。
            if(0 == judge_IPv4)
    {
    writeNTPaddr(pszIP); //保存NTP信息
    //printf("success\n");
    }
    else
    {
    return soap_receiver_fault_subcode(soap, "ActionNotSupported", "invalidIPv4Address", "invalidIPv4Address IPv4");
    }
    printf("ip4:%s\n",*(ns8__SetNTP->NTPManual->IPv4Address ));
    }
    else if (ns3__NetworkHostType__IPv6 == ns8__SetNTP->NTPManual->Type)
    {
    return soap_receiver_fault_subcode(soap, "ActionNotSupported", "NoSupportedIPv6Address", "No Support IPv6");
    }
    else if (ns3__NetworkHostType__DNS == ns8__SetNTP->NTPManual->Type)
    {
    return soap_receiver_fault_subcode(soap, "ActionNotSupported", "NoSupportedDnsName ", "No Support DNS");
    }

    return SOAP_OK;
    }
      


  • 相关阅读:
    查找表类算法//字母异位词分组
    查找表类算法//四数相加 II
    查找表类算法//四数相加 II
    第六章 类文件结构
    第六章 类文件结构
    查找表的算法//四数之和
    查找表的算法//四数之和
    第五章 调优案例分析与实战
    第五章 调优案例分析与实战
    C++_基础4-分支语句和逻辑运算符
  • 原文地址:https://www.cnblogs.com/qingjoin/p/2413791.html
Copyright © 2011-2022 走看看