• 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;
    }
      


  • 相关阅读:
    LeetCode91 Decode Ways
    LeetCode93 Restore IP Addresses
    LeetCode92 Reverse Linked List II
    LeetCode90 Subsets II
    LeetCode89 Gray Code
    最长公共子序列及其引申问题
    constexpr:编译期与运行期之间的神秘关键字
    I/O模型: 阻塞、非阻塞、I/O复用、同步、异步
    LeetCode86 Partition List
    maven 安装 过程
  • 原文地址:https://www.cnblogs.com/qingjoin/p/2413791.html
Copyright © 2020-2023  润新知