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


  • 相关阅读:
    jsp <img src="“> src 相对路径的问题
    记一次Intellij-IDEA配置JDK1.8,支持Lambda新特性
    centOS6.5 查看 启动 关闭防火墙
    java设计模式之--工厂方法模式
    BlockingQueue之---ArrayBlockingQueue
    两个线程,一个为123456,一个为ABCDEF、交替打印出1A2B3C...
    JUC之---超好用的阻塞锁
    JUC之---读写锁
    java设计模式之--代理模式
    java设计模式之--线程安全的单例模式
  • 原文地址:https://www.cnblogs.com/qingjoin/p/2413791.html
Copyright © 2011-2022 走看看