这篇教程C++ uip_setdraddr函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中uip_setdraddr函数的典型用法代码示例。如果您正苦于以下问题:C++ uip_setdraddr函数的具体用法?C++ uip_setdraddr怎么用?C++ uip_setdraddr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了uip_setdraddr函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: _tcpip_initint_tcpip_init(void){ uip_ipaddr_t ipaddr; timer_set(&periodic_timer, CLOCK_SECOND/2); timer_set(&arp_timer, CLOCK_SECOND * 10); timer_set(&cli_timer, CLOCK_SECOND); mt76xx_dev_init(); uip_init(); //Printf_High("Tcp INIT /n");#ifdef CONFIG_SOFTAP uip_ipaddr(ipaddr, 192,168,81,1); uip_sethostaddr(ipaddr); uip_ipaddr(ipaddr, 192,168,81,1); uip_setdraddr(ipaddr); uip_ipaddr(ipaddr, 255,255,255,0); uip_setnetmask(ipaddr);// Printf_High("TcpIP IniT===/n"); uip_gethostaddr(ipaddr); #endif iot_udp_app_init(); iot_tcp_app_init();#ifndef CONFIG_SOFTAP if (IoTpAd.ComCfg.Use_DHCP!=1) { uip_ipaddr(ipaddr, IoTpAd.ComCfg.STATIC_IP[0],IoTpAd.ComCfg.STATIC_IP[1], IoTpAd.ComCfg.STATIC_IP[2],IoTpAd.ComCfg.STATIC_IP[3]); uip_sethostaddr(ipaddr); uip_ipaddr(ipaddr,IoTpAd.ComCfg.SubnetMask_IP[0], IoTpAd.ComCfg.SubnetMask_IP[1], IoTpAd.ComCfg.SubnetMask_IP[2], IoTpAd.ComCfg.SubnetMask_IP[3]); uip_setnetmask(ipaddr); uip_ipaddr(ipaddr, IoTpAd.ComCfg.GateWay_IP[0], IoTpAd.ComCfg.GateWay_IP[1], IoTpAd.ComCfg.GateWay_IP[2], IoTpAd.ComCfg.GateWay_IP[3]); uip_setdraddr(ipaddr);#if CFG_SUPPORT_DNS uip_ipaddr(ipaddr, IoTpAd.ComCfg.DNS_IP[0],IoTpAd.ComCfg.DNS_IP[1], IoTpAd.ComCfg.DNS_IP[2],IoTpAd.ComCfg.DNS_IP[3]); resolv_conf(ipaddr); resolv_query("www.ablecloud.cn");#endif dhcpc_set_state(STATE_CONFIG_DONE); }#endif cli_fd = -1; return 0;}
开发者ID:cxy560,项目名称:ZCloud,代码行数:53,
示例2: uip_server_initvoid uip_server_init(chanend xtcp[], int num_xtcp, xtcp_ipconfig_t* ipconfig, unsigned char mac_address[6]){ if (ipconfig != NULL) memcpy(&uip_static_ipconfig, ipconfig, sizeof(xtcp_ipconfig_t)); memcpy(&uip_ethaddr, mac_address, 6); uip_init();#if UIP_IGMP igmp_init();#endif if (ipconfig != NULL && (*((int*)ipconfig->ipaddr) != 0)) { uip_static_ip = 1; } if (ipconfig == NULL) { uip_ipaddr_t ipaddr; uip_ipaddr(ipaddr, 0, 0, 0, 0); uip_sethostaddr(ipaddr); uip_setdraddr(ipaddr); uip_setnetmask(ipaddr); uip_setsubnetaddr(); } else { uip_sethostaddr(ipconfig->ipaddr); uip_setdraddr(ipconfig->gateway); uip_setnetmask(ipconfig->netmask); uip_setsubnetaddr();#ifdef XTCP_VERBOSE_DEBUG printstr("Address: ");uip_printip4(uip_hostaddr);printstr("/n"); printstr("Gateway: ");uip_printip4(uip_draddr);printstr("/n"); printstr("Netmask: ");uip_printip4(uip_netmask);printstr("/n");#endif } {#if UIP_USE_AUTOIP int hwsum = mac_address[0] + mac_address[1] + mac_address[2] + mac_address[3] + mac_address[4] + mac_address[5]; autoip_init(hwsum + (hwsum << 16) + (hwsum << 24));#endif#if UIP_USE_DHCP dhcpc_init(uip_ethaddr.addr, 6);#endif xtcpd_init(xtcp, num_xtcp); }}
开发者ID:colinbroad,项目名称:sc_xtcp,代码行数:51,
示例3: _tcpip_initint_tcpip_init(void){ uip_ipaddr_t ipaddr; timer_set(&periodic_timer, CLOCK_SECOND/2); timer_set(&arp_timer, CLOCK_SECOND * 10); timer_set(&cli_timer, CLOCK_SECOND); mt76xx_dev_init(); uip_init();#ifdef CONFIG_SOFTAP uip_ipaddr(ipaddr, UIP_IPADDR0,UIP_IPADDR1,UIP_IPADDR2,UIP_IPADDR3); uip_sethostaddr(ipaddr); uip_ipaddr(ipaddr, UIP_IPADDR0,UIP_IPADDR1,UIP_IPADDR2,UIP_IPADDR3); uip_setdraddr(ipaddr); uip_ipaddr(ipaddr, UIP_NETMASK0,UIP_NETMASK1,UIP_NETMASK2,UIP_NETMASK3); uip_setnetmask(ipaddr); uip_gethostaddr(ipaddr);#endif iot_udp_app_init(); iot_tcp_app_init();#ifdef CONFIG_STATION if (IoTpAd.ComCfg.Use_DHCP!=1) { uip_ipaddr(ipaddr, IoTpAd.ComCfg.STATIC_IP[0],IoTpAd.ComCfg.STATIC_IP[1], IoTpAd.ComCfg.STATIC_IP[2],IoTpAd.ComCfg.STATIC_IP[3]); uip_sethostaddr(ipaddr); uip_ipaddr(ipaddr,IoTpAd.ComCfg.SubnetMask_IP[0], IoTpAd.ComCfg.SubnetMask_IP[1], IoTpAd.ComCfg.SubnetMask_IP[2], IoTpAd.ComCfg.SubnetMask_IP[3]); uip_setnetmask(ipaddr); uip_ipaddr(ipaddr, IoTpAd.ComCfg.GateWay_IP[0], IoTpAd.ComCfg.GateWay_IP[1], IoTpAd.ComCfg.GateWay_IP[2], IoTpAd.ComCfg.GateWay_IP[3]); uip_setdraddr(ipaddr);#if CFG_SUPPORT_DNS uip_ipaddr(ipaddr, IoTpAd.ComCfg.DNS_IP[0],IoTpAd.ComCfg.DNS_IP[1], IoTpAd.ComCfg.DNS_IP[2],IoTpAd.ComCfg.DNS_IP[3]); resolv_conf(ipaddr); resolv_query("www.baidu.com");#endif dhcpc_set_state(STATE_CONFIG_DONE); }#endif cli_fd = -1; return 0;}
开发者ID:Altizon,项目名称:Aliot-SDK-Examples,代码行数:51,
示例4: uip_linkupvoid uip_linkup() { if (get_uip_xtcp_ifstate()) uip_xtcp_down(); if (uip_static_ip) {#if UIP_CONF_IPV6 uip_ipaddr_t ipaddr; uip_ipaddr(ipaddr, uip_static_ipconfig.ipaddr[0], uip_static_ipconfig.ipaddr[1], uip_static_ipconfig.ipaddr[2], uip_static_ipconfig.ipaddr[3]); uip_sethostaddr(ipaddr); uip_ipaddr(ipaddr, uip_static_ipconfig.gateway[0], uip_static_ipconfig.gateway[1], uip_static_ipconfig.gateway[2], uip_static_ipconfig.gateway[3]); uip_setdraddr(ipaddr); uip_ipaddr(ipaddr, uip_static_ipconfig.netmask[0], uip_static_ipconfig.netmask[1], uip_static_ipconfig.netmask[2], uip_static_ipconfig.netmask[3]); uip_setnetmask(ipaddr); uip_setsubnetaddr();#else uip_sethostaddr(uip_static_ipconfig.ipaddr); uip_setdraddr(uip_static_ipconfig.gateway); uip_setnetmask(uip_static_ipconfig.netmask); uip_setsubnetaddr();#endif uip_xtcp_up(); } else { dhcp_done = 0;#if UIP_USE_DHCP dhcpc_stop();#endif#if UIP_USE_AUTOIP#if UIP_USE_DHCP autoip_stop();#else autoip_start();#endif#endif#if UIP_USE_DHCP dhcpc_start();#endif }}
开发者ID:colinbroad,项目名称:sc_xtcp,代码行数:50,
示例5: dhcpc_configuredvoid dhcpc_configured(const struct dhcpc_state *s){ uip_sethostaddr(s->ipaddr); uip_setnetmask(s->netmask); uip_setdraddr(s->default_router); resolv_conf(s->dnsaddr);}
开发者ID:leapwing,项目名称:mb9af314l_ax88796c_uip,代码行数:7,
示例6: dhcpc_configured/** * dhcpc_configured: Global function for uIP DHCPC to use, * notification of DHCP configuration. * /param s Pointer to DHCP state instance */void dhcpc_configured(const struct dhcpc_state *s){ u8_t *pAddr; printf("/n/r"); printf("=== DHCP Configurations ===/n/r"); pAddr = (u8_t *)s->ipaddr; printf("- IP : %d.%d.%d.%d/n/r", pAddr[0], pAddr[1], pAddr[2], pAddr[3]); pAddr = (u8_t *)s->netmask; printf("- Mask : %d.%d.%d.%d/n/r", pAddr[0], pAddr[1], pAddr[2], pAddr[3]); pAddr = (u8_t *)s->default_router; printf("- GW : %d.%d.%d.%d/n/r", pAddr[0], pAddr[1], pAddr[2], pAddr[3]); pAddr = (u8_t *)s->dnsaddr; printf("- DNS : %d.%d.%d.%d/n/r", pAddr[0], pAddr[1], pAddr[2], pAddr[3]); printf("===========================/n/r/n"); uip_sethostaddr(s->ipaddr); uip_setnetmask(s->netmask); uip_setdraddr(s->default_router);#ifdef __RESOLV_H__ resolv_conf(s->dnsaddr);#else printf("DNS NOT enabled in the demo/n/r");#endif}
开发者ID:gstroe,项目名称:Arm,代码行数:34,
示例7: stack_initvoid stack_init(void){ uip_ipaddr_t ipaddr; struct uip_eth_addr mac; mac.addr[0] = mac_addr[0]; mac.addr[1] = mac_addr[1]; mac.addr[2] = mac_addr[2]; mac.addr[3] = mac_addr[3]; mac.addr[4] = mac_addr[4]; mac.addr[5] = mac_addr[5]; timer_set(&periodic_timer, CLOCK_SECOND / 2); timer_set(&arp_timer, CLOCK_SECOND * 10); timer_set(&self_arp_timer, CLOCK_SECOND * 30); uip_init(); uip_setethaddr(mac); udpapp_init(); tcp_app_init(); uip_ipaddr(ipaddr, local_ip[0], local_ip[1], local_ip[2], local_ip[3]); uip_sethostaddr(ipaddr); uip_ipaddr(ipaddr, gateway_ip[0],gateway_ip[1],gateway_ip[2],gateway_ip[3]); uip_setdraddr(ipaddr); uip_ipaddr(ipaddr, subnet_mask[0],subnet_mask[1],subnet_mask[2],subnet_mask[3]); uip_setnetmask(ipaddr); }
开发者ID:ajwlucas,项目名称:mp3_wifi_audio,代码行数:31,
示例8: timer_setvoid Network::init(void){ // two timers for tcp/ip timer_set(&periodic_timer, CLOCK_SECOND / 2); /* 0.5s */ timer_set(&arp_timer, CLOCK_SECOND * 10); /* 10s */ // Initialize the uIP TCP/IP stack. uip_init(); uip_setethaddr(mac_address); if (!use_dhcp) { // manual setup of ip uip_ipaddr_t tip; /* local IP address */ uip_ipaddr(tip, ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3]); uip_sethostaddr(tip); /* host IP address */ printf("IP Addr: %d.%d.%d.%d/n", ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3]); uip_ipaddr(tip, ipgw[0], ipgw[1], ipgw[2], ipgw[3]); uip_setdraddr(tip); /* router IP address */ printf("IP GW: %d.%d.%d.%d/n", ipgw[0], ipgw[1], ipgw[2], ipgw[3]); uip_ipaddr(tip, ipmask[0], ipmask[1], ipmask[2], ipmask[3]); uip_setnetmask(tip); /* mask */ printf("IP mask: %d.%d.%d.%d/n", ipmask[0], ipmask[1], ipmask[2], ipmask[3]); setup_servers(); }else{ #if UIP_CONF_UDP dhcpc_init(mac_address, sizeof(mac_address)); dhcpc_request(); printf("Getting IP address..../n"); #endif }}
开发者ID:2thetop,项目名称:Smoothieware,代码行数:34,
示例9: dhcp_apply_optionsstatic int dhcp_apply_options(uint8_t tag, uint8_t length, uint8_t *value, void *data){ switch (tag) { case DhcpTagSubnetMask: if (length < 4) { printf("Truncated subnet mask./n"); return 1; } else { uip_ipaddr_t netmask; uip_ipaddr(&netmask, value[0], value[1], value[2], value[3]); uip_setnetmask(&netmask); return 0; } case DhcpTagDefaultRouter: if (length < 4) { printf("Truncated routers./n"); return 1; } else { uip_ipaddr_t router; uip_ipaddr(&router, value[0], value[1], value[2], value[3]); uip_setdraddr(&router); return 0; } } return 0;}
开发者ID:coreboot,项目名称:depthcharge,代码行数:29,
示例10: uip_linkup/* ----------------------------------------------------------------------------- * When a cable is plugged in, this function is called * ---------------------------------------------------------------------------*/void uip_linkup() { if (uip_xtcp_get_ifstate()){ uip_xtcp_down(); }#if UIP_CONF_IPV4 if (uip_static_ip) { uip_sethostaddr(&uip_static_ipconfig.ipaddr); uip_setdraddr(&uip_static_ipconfig.gateway); uip_setnetmask(&uip_static_ipconfig.netmask); uip_xtcp_up(); } else { dhcp_done = 0;#if UIP_USE_DHCP dhcpc_stop();#endif#if UIP_USE_AUTOIP#if UIP_USE_DHCP autoip_stop();#else autoip_start();#endif#endif#if UIP_USE_DHCP dhcpc_start();#endif }#endif /* UIP_CONF_IPVx */}
开发者ID:graymalkin,项目名称:sc_xtcp,代码行数:31,
示例11: uIPManagement_Init/** Configures the uIP stack ready for network traffic processing. */void uIPManagement_Init(void){ /* uIP Timing Initialization */ clock_init(); timer_set(&ConnectionTimer, CLOCK_SECOND / 2); timer_set(&ARPTimer, CLOCK_SECOND * 10); /* uIP Stack Initialization */ uip_init(); uip_arp_init(); uip_setethaddr(MACAddress); /* DHCP/Server IP Settings Initialization */ #if defined(ENABLE_DHCP_CLIENT) HaveIPConfiguration = false; DHCPClientApp_Init(); #else HaveIPConfiguration = true; uip_ipaddr_t IPAddress, Netmask, GatewayIPAddress; uip_ipaddr(&IPAddress, DEVICE_IP_ADDRESS[0], DEVICE_IP_ADDRESS[1], DEVICE_IP_ADDRESS[2], DEVICE_IP_ADDRESS[3]); uip_ipaddr(&Netmask, DEVICE_NETMASK[0], DEVICE_NETMASK[1], DEVICE_NETMASK[2], DEVICE_NETMASK[3]); uip_ipaddr(&GatewayIPAddress, DEVICE_GATEWAY[0], DEVICE_GATEWAY[1], DEVICE_GATEWAY[2], DEVICE_GATEWAY[3]); uip_sethostaddr(&IPAddress); uip_setnetmask(&Netmask); uip_setdraddr(&GatewayIPAddress); #endif /* HTTP Webserver Initialization */ HTTPServerApp_Init(); /* TELNET Server Initialization */ #if defined(ENABLE_TELNET_SERVER) TELNETServerApp_Init(); #endif}
开发者ID:AdjacentReality,项目名称:lufa-lib,代码行数:36,
示例12: apply_tcpipconfig/*-----------------------------------------------------------------------------------*/static voidapply_tcpipconfig(void){ uip_ipaddr_t addr; nullterminate(ipaddr); if(uiplib_ipaddrconv(ipaddr, &addr)) { uip_sethostaddr(&addr); } nullterminate(netmask); if(uiplib_ipaddrconv(netmask, &addr)) { uip_setnetmask(&addr); } nullterminate(gateway); if(uiplib_ipaddrconv(gateway, &addr)) { uip_setdraddr(&addr); } #if UIP_UDP nullterminate(dnsserver); if(uiplib_ipaddrconv(dnsserver, &addr)) { resolv_conf(&addr); }#endif /* UIP_UDP */}
开发者ID:AWRyder,项目名称:contiki,代码行数:28,
示例13: net_configurestatic void net_configure(void){ struct in_addr addr;#if defined(CONFIG_EXAMPLE_POLL_NOMAC) uint8_t mac[IFHWADDRLEN];#endif /* Configure uIP */ /* Many embedded network interfaces must have a software assigned MAC */#ifdef CONFIG_EXAMPLE_POLL_NOMAC mac[0] = 0x00; mac[1] = 0xe0; mac[2] = 0xb0; mac[3] = 0x0b; mac[4] = 0xba; mac[5] = 0xbe; uip_setmacaddr("eth0", mac);#endif /* Set up our host address */ addr.s_addr = HTONL(CONFIG_EXAMPLE_POLL_IPADDR); uip_sethostaddr("eth0", &addr); /* Set up the default router address */ addr.s_addr = HTONL(CONFIG_EXAMPLE_POLL_DRIPADDR); uip_setdraddr("eth0", &addr); /* Setup the subnet mask */ addr.s_addr = HTONL(CONFIG_EXAMPLE_POLL_NETMASK); uip_setnetmask("eth0", &addr);}
开发者ID:drasko,项目名称:opendous_nuttx,代码行数:35,
示例14: igmp_mainint igmp_main(int argc, char *argv[]){ struct in_addr addr;#if defined(CONFIG_EXAMPLES_IGMP_NOMAC) uint8_t mac[IFHWADDRLEN];#endif message("Configuring Ethernet.../n"); /* Many embedded network interfaces must have a software assigned MAC */#ifdef CONFIG_EXAMPLES_IGMP_NOMAC mac[0] = 0x00; mac[1] = 0xe0; mac[2] = 0xde; mac[3] = 0xad; mac[4] = 0xbe; mac[5] = 0xef; uip_setmacaddr("eth0", mac);#endif /* Set up our host address */ addr.s_addr = HTONL(CONFIG_EXAMPLES_IGMP_IPADDR); uip_sethostaddr("eth0", &addr); /* Set up the default router address */ addr.s_addr = HTONL(CONFIG_EXAMPLES_IGMP_DRIPADDR); uip_setdraddr("eth0", &addr); /* Setup the subnet mask */ addr.s_addr = HTONL(CONFIG_EXAMPLES_IGMP_NETMASK); uip_setnetmask("eth0", &addr); /* Not much of a test for now */ /* Join the group */ message("Join group.../n"); addr.s_addr = HTONL(CONFIG_EXAMPLES_IGMP_GRPADDR); ipmsfilter("eth0", &addr, MCAST_INCLUDE); /* Wait a while */ message("Wait for timeout.../n"); sleep(5); /* Leave the group */ message("Leave group.../n"); ipmsfilter("eth0", &addr, MCAST_EXCLUDE); /* Wait a while */ sleep(5); message("Exiting.../n"); return 0;}
开发者ID:centurysys,项目名称:NuttX-SA1xx,代码行数:59,
示例15: dhcpc_configured//*****************************************************************************//// Callback for when DHCP client has been configured.////*****************************************************************************voiddhcpc_configured(const struct dhcpc_state *s){ uip_sethostaddr(&s->ipaddr); uip_setnetmask(&s->netmask); uip_setdraddr(&s->default_router); ShowIPAddress(s->ipaddr);}
开发者ID:rikardonm,项目名称:tivaCCSv6,代码行数:13,
示例16: dhcpc_configured//*****************************************************************************//// Callback for when DHCP client has been configured.////*****************************************************************************voiddhcpc_configured(const struct dhcpc_state *s){ uip_sethostaddr(&s->ipaddr); uip_setnetmask(&s->netmask); uip_setdraddr(&s->default_router); DisplayIPAddress((void *)&s->ipaddr, 18, 24);}
开发者ID:yangjunjiao,项目名称:Luminary-Micro-Library,代码行数:13,
示例17: IP_configvoid IP_config(void) {#if UIP_UDP // if DHCP is enabled, then initialize via DHCP, else use static settings if (config.dhcpenable) { dhcpc_init(); } else { uip_sethostaddr(config.ipaddr); uip_setnetmask(config.netmask); uip_setdraddr(config.gateway); }#else // UIP_UDP // configure the interface with static settings uip_sethostaddr(config.ipaddr); uip_setnetmask(config.netmask); uip_setdraddr(config.gateway);#endif // UIP_UDP}
开发者ID:housecream,项目名称:restmcu,代码行数:18,
示例18: dhcpc_configuredvoiddhcpc_configured(const struct dhcpc_state *s){ uip_sethostaddr(&s->ipaddr); uip_setnetmask(&s->netmask); uip_setdraddr(&s->default_router); printf("IP: %d.%d.%d.%d/n", s->ipaddr[0] & 0xff, s->ipaddr[0] >> 8, s->ipaddr[1] & 0xff, s->ipaddr[1] >> 8);}
开发者ID:cubeberg,项目名称:HomeAutomation,代码行数:9,
示例19: dhcp_parse_ackvoid dhcp_parse_ack(void){ uint8_t got_ack = 0; uint8_t op, len; uint8_t *opt_ptr; struct dhcp_message *message = (struct dhcp_message *)uip_appdata; if(message->op != DHCP_OP_REPLY || message->xid != dhcp_s.xid) { return; } /* Skip magic cookie */ opt_ptr = message->options + 4; do { op = *opt_ptr++; len = *opt_ptr++; switch(op) { case DHCP_OPTION_SUBNETMASK: memcpy(&dhcp_s.subnet_mask, opt_ptr, sizeof(dhcp_s.subnet_mask)); break; case DHCP_OPTION_ROUTER: memcpy(&dhcp_s.gateway_addr, opt_ptr, sizeof(dhcp_s.gateway_addr)); break; case DHCP_OPTION_ADDR_TIME: memcpy(&dhcp_s.lease_time, opt_ptr, sizeof(dhcp_s.lease_time)); dhcp_s.lease_time = ntohl(dhcp_s.lease_time); break; case DHCP_OPTION_MSG_TYPE: if(*opt_ptr == DHCPACK) got_ack = 1; break; } opt_ptr += len; } while(op != DHCP_OPTION_END); if(got_ack) { uip_sethostaddr(&dhcp_s.ip_addr); uip_setnetmask(&dhcp_s.subnet_mask); uip_setdraddr(&dhcp_s.gateway_addr); dhcp_s.dhcp_renew_time = get_clock() + dhcp_s.lease_time * CLOCK_TICKS_PER_SECOND / 2; dhcp_s.state = DHCP_STATE_WAIT_RENEW; }}
开发者ID:sli92,项目名称:netcon,代码行数:57,
示例20: set_eeprom_addrstatic voidset_eeprom_addr(){ uip_ipaddr_t ipaddr; erip(ipaddr, EE_IP4_ADDR); uip_sethostaddr(ipaddr); erip(ipaddr, EE_IP4_GATEWAY); uip_setdraddr(ipaddr); erip(ipaddr, EE_IP4_NETMASK); uip_setnetmask(ipaddr); ip_initialized();}
开发者ID:Talustus,项目名称:culfw,代码行数:9,
示例21: network_config_loadvoidnetwork_config_load (void){ /* load settings from eeprom */#ifdef EEPROM_SUPPORT eeprom_restore(mac, uip_ethaddr.addr, 6);#else memcpy_P(uip_ethaddr.addr, PSTR(CONF_ETHERRAPE_MAC), 6);#endif#if defined(BOOTP_SUPPORT) / || (IPV6_SUPPORT && !defined(IPV6_STATIC_SUPPORT)) / || DHCP_SUPPORT return;#else uip_ipaddr_t ip; (void) ip; /* Keep GCC quiet. */ /* Configure the IP address. */#ifdef EEPROM_SUPPORT /* Please Note: ip and &ip are NOT the same (cpp hell) */ eeprom_restore_ip(ip, &ip);#else set_CONF_ETHERRAPE_IP(&ip);#endif uip_sethostaddr(&ip); /* Configure prefix length (IPv6). */#ifdef IPV6_SUPPORT uip_setprefixlen(CONF_ENC_IP6_PREFIX_LEN);#endif#ifdef IPV4_SUPPORT /* Configure the netmask (IPv4). */#ifdef EEPROM_SUPPORT /* Please Note: ip and &ip are NOT the same (cpp hell) */ eeprom_restore_ip(netmask, &ip);#else set_CONF_ETHERRAPE_IP4_NETMASK(&ip);#endif uip_setnetmask(&ip);#endif /* IPV4_SUPPORT */ /* Configure the default gateway */#ifdef EEPROM_SUPPORT /* Please Note: ip and &ip are NOT the same (cpp hell) */ eeprom_restore_ip(gateway, &ip);#else set_CONF_ETHERRAPE_GATEWAY(&ip);#endif uip_setdraddr(&ip);#endif /* No autoconfiguration. */}
开发者ID:patricksebastien,项目名称:ethersex,代码行数:57,
示例22: sys_uip_ip_init_kasmlinkage void sys_uip_ip_init_k(unsigned char *hostaddr, unsigned char*draddr, unsigned char* netmask){ uip_ipaddr_t ipaddr; uip_ipaddr(ipaddr, hostaddr[0], hostaddr[1], hostaddr[2], hostaddr[3]); uip_sethostaddr(ipaddr); uip_ipaddr(ipaddr, draddr[0], draddr[1], draddr[2], draddr[3]); uip_setdraddr(ipaddr); uip_ipaddr(ipaddr, netmask[0], netmask[1], netmask[2], netmask[3]); uip_setnetmask(ipaddr);}
开发者ID:akshar100,项目名称:SPaRK_x86,代码行数:10,
示例23: network_config_loadvoidnetwork_config_load (void){ /* load settings from eeprom */#ifdef EEPROM_SUPPORT eeprom_restore (mac, uip_ethaddr.addr, 6);#else#if defined(BOOTLOADER_SUPPORT) && BOOTLOADER_START_ADDRESS > UINT16_MAX uint_farptr_t src = pgm_get_far_address (conf_mac); uint8_t *dst = uip_ethaddr.addr; for (uint8_t i = 6; i; i--) *dst++ = pgm_read_byte_far (src++);#else memcpy_P (uip_ethaddr.addr, conf_mac, 6);#endif#endif#if (defined(IPV4_SUPPORT) && !defined(BOOTP_SUPPORT) && !defined(DHCP_SUPPORT)) || defined(IPV6_STATIC_SUPPORT) uip_ipaddr_t ip; /* Configure the IP address. */#ifdef EEPROM_SUPPORT /* Please Note: ip and &ip are NOT the same (cpp hell) */ eeprom_restore_ip (ip, &ip);#else set_CONF_ETHERRAPE_IP (&ip);#endif uip_sethostaddr (&ip); /* Configure prefix length (IPv6). */#ifdef IPV6_SUPPORT uip_setprefixlen (CONF_ENC_IP6_PREFIX_LEN);#endif#ifdef IPV4_SUPPORT /* Configure the netmask (IPv4). */#ifdef EEPROM_SUPPORT /* Please Note: ip and &ip are NOT the same (cpp hell) */ eeprom_restore_ip (netmask, &ip);#else set_CONF_ETHERRAPE_IP4_NETMASK (&ip);#endif uip_setnetmask (&ip);#endif /* IPV4_SUPPORT */ /* Configure the default gateway */#ifdef EEPROM_SUPPORT /* Please Note: ip and &ip are NOT the same (cpp hell) */ eeprom_restore_ip (gateway, &ip);#else set_CONF_ETHERRAPE_GATEWAY (&ip);#endif uip_setdraddr (&ip);#endif /* No autoconfiguration. */}
开发者ID:EtherGraf,项目名称:ethersex,代码行数:55,
示例24: tapdev_init//配置网卡硬件,并设置MAC地址 //返回值:0,正常;1,失败;u8 tapdev_init(void){ u32 wait_count; u8 i, res = 0;#ifndef DHCP_ENABLE uip_ipaddr_t ipaddr;#endif res = ENC28J60_Init((u8*)Modbus.mac_addr); //初始化ENC28J60 //把IP地址和MAC地址写入缓存区 for (i = 0; i < 6; i++) { uip_ethaddr.addr[i] = Modbus.mac_addr[i]; } //指示灯状态:0x476 is PHLCON LEDA(绿)=links status, LEDB(红)=receive/transmit //PHLCON:PHY 模块LED 控制寄存器 ENC28J60_PHY_Write(PHLCON, 0x0476); uip_init(); //uIP初始化 if(Modbus.tcp_type == 0) { U8_T temp[4]; uip_ipaddr(ipaddr, Modbus.ip_addr[0], Modbus.ip_addr[1], Modbus.ip_addr[2], Modbus.ip_addr[3]); //设置本地设置IP地址 uip_sethostaddr(ipaddr); uip_ipaddr(ipaddr, Modbus.getway[0], Modbus.getway[1], Modbus.getway[2], Modbus.getway[3]); //设置网关IP地址(其实就是你路由器的IP地址) uip_setdraddr(ipaddr); uip_ipaddr(ipaddr, Modbus.subnet[0], Modbus.subnet[1], Modbus.subnet[2], Modbus.subnet[3]); //设置网络掩码 uip_setnetmask(ipaddr);// flag_dhcp_configured = 2; temp[0] = Modbus.ip_addr[0]; temp[1] = Modbus.ip_addr[1]; temp[2] = Modbus.ip_addr[2]; temp[3] = Modbus.ip_addr[3]; temp[0] |= (255 - Modbus.subnet[0]); temp[1] |= (255 - Modbus.subnet[1]); temp[2] |= (255 - Modbus.subnet[2]); temp[3] |= (255 - Modbus.subnet[3]); uip_ipaddr(uip_hostaddr_submask,temp[0], temp[1],temp[2] ,temp[3]); delay_ms(1); } else // DHCP {// flag_dhcp_configured = 0; dhcpc_init(Modbus.mac_addr, 6); dhcpc_request(); } // printf("res=%u/n/r",res); return res; }
开发者ID:temcocontrols,项目名称:CM5,代码行数:57,
示例25: mainvoidmain(int argc, char **argv){ contiki_argc = argc; contiki_argv = argv;#else /* WITH_ARGS */voidmain(void){#endif /* WITH_ARGS */ process_init();#if 1 ethernet_config = config_read("contiki.cfg");#else { static struct ethernet_config config = {0xDE08, "cs8900a.eth"}; uip_ipaddr_t addr; uip_ipaddr(&addr, 192,168,0,128); uip_sethostaddr(&addr); uip_ipaddr(&addr, 255,255,255,0); uip_setnetmask(&addr); uip_ipaddr(&addr, 192,168,0,1); uip_setdraddr(&addr); uip_ipaddr(&addr, 192,168,0,1); uip_nameserver_update(&addr, UIP_NAMESERVER_INFINITE_LIFETIME); ethernet_config = &config; }#endif procinit_init(); process_start((struct process *)ðernet_process, (void *)ethernet_config); autostart_start(autostart_processes); log_message("Contiki up and running ...", ""); while(1) { process_run(); etimer_request_poll(); }}
开发者ID:SmallLars,项目名称:contiki,代码行数:54,
示例26: dhcpc_configuredvoiddhcpc_configured(const struct dhcpc_state *s){ uip_sethostaddr(s->ipaddr); uip_setnetmask(s->netmask); uip_setdraddr(s->default_router);#if CFG_SUPPORT_DNS resolv_conf(s->dnsaddr); resolv_query("www.ablecloud.cn");#endif}
开发者ID:cxy560,项目名称:ZCloud,代码行数:11,
示例27: sendmail_mainint sendmail_main(int argc, char *argv[]){ struct in_addr addr;#if defined(CONFIG_EXAMPLES_SENDMAIL_NOMAC) uint8_t mac[IFHWADDRLEN];#endif void *handle; printf("sendmail: To: %s/n", g_recipient); printf("sendmail: From: %s/n", g_sender); printf("sendmail: Subject: %s/n", g_subject); printf("sendmail: Body: %s/n", g_msg_body);/* Many embedded network interfaces must have a software assigned MAC */#ifdef CONFIG_EXAMPLES_SENDMAIL_NOMAC mac[0] = 0x00; mac[1] = 0xe0; mac[2] = 0xde; mac[3] = 0xad; mac[4] = 0xbe; mac[5] = 0xef; uip_setmacaddr("eth0", mac);#endif /* Set up our host address */ addr.s_addr = HTONL(CONFIG_EXAMPLES_SENDMAIL_IPADDR); uip_sethostaddr("eth0", &addr); /* Set up the default router address */ addr.s_addr = HTONL(CONFIG_EXAMPLES_SENDMAIL_DRIPADDR); uip_setdraddr("eth0", &addr); /* Setup the subnet mask */ addr.s_addr = HTONL(CONFIG_EXAMPLES_SENDMAIL_NETMASK); uip_setnetmask("eth0", &addr); /* Then send the mail */ uip_ipaddr(addr.s_addr, 127, 0, 0, 1); handle = smtp_open(); if (handle) { smtp_configure(handle, g_host_name, &addr.s_addr); smtp_send(handle, g_recipient, NULL, g_sender, g_subject, g_msg_body, strlen(g_msg_body)); smtp_close(handle); } return 0;}
开发者ID:0919061,项目名称:PX4NuttX,代码行数:53,
示例28: dhcpc_configuredvoid dhcpc_configured(const struct dhcpc_state *s){ #ifdef MY_DEBUG //rprintf("IP : %d.%d.%d.%d/n", uip_ipaddr1(s->ipaddr), uip_ipaddr2(s->ipaddr), uip_ipaddr3(s->ipaddr), uip_ipaddr4(s->ipaddr)); //rprintf("NM : %d.%d.%d.%d/n", uip_ipaddr1(s->netmask), uip_ipaddr2(s->netmask), uip_ipaddr3(s->netmask), uip_ipaddr4(s->netmask)); //rprintf("GW : %d.%d.%d.%d/n", uip_ipaddr1(s->default_router), uip_ipaddr2(s->default_router), uip_ipaddr3(s->default_router), uip_ipaddr4(s->default_router)); #endif uip_sethostaddr(s->ipaddr); uip_setnetmask(s->netmask); uip_setdraddr(s->default_router);}
开发者ID:hokim72,项目名称:AVR-Common,代码行数:12,
注:本文中的uip_setdraddr函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ uip_setnetmask函数代码示例 C++ uip_send函数代码示例 |