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


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值