这篇教程C++ uip_ip6addr函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中uip_ip6addr函数的典型用法代码示例。如果您正苦于以下问题:C++ uip_ip6addr函数的具体用法?C++ uip_ip6addr怎么用?C++ uip_ip6addr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了uip_ip6addr函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: set_global_addressstatic voidset_global_address(void){ uip_ipaddr_t ipaddr; uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0); uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF); /* set server address */ uip_ip6addr(&server_ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 1); //uip_ip6addr(&server_ipaddr, 0xfe80, 0, 0, 0,0x0212, 0x7401, 1, 0x0101);}
开发者ID:alirezapourbahram,项目名称:IoT-Wormhole-IDS,代码行数:14,
示例2: set_connection_address/*---------------------------------------------------------------------------*/static voidset_connection_address(uip_ipaddr_t *ipaddr){#define _QUOTEME(x) #x#define QUOTEME(x) _QUOTEME(x)#ifdef UDP_CONNECTION_ADDR if(uiplib_ipaddrconv(QUOTEME(UDP_CONNECTION_ADDR), ipaddr) == 0) { PRINTF("UDP client failed to parse address '%s'/n", QUOTEME(UDP_CONNECTION_ADDR)); }#elif UIP_CONF_ROUTER uip_ip6addr(ipaddr,0xaaaa,0,0,0,0x0212,0x7404,0x0004,0x0404);#else uip_ip6addr(ipaddr,0xfe80,0,0,0,0x6466,0x6666,0x6666,0x6666);#endif /* UDP_CONNECTION_ADDR */}
开发者ID:EmuxEvans,项目名称:Thingsquare-Contiki-O.S-Porting-STM32F4-Discovery,代码行数:16,
示例3: PROCESS_THREAD/*---------------------------------------------------------------------------*/PROCESS_THREAD(unicast_sender_process, ev, data){ static struct etimer periodic_timer; static struct etimer send_timer; uip_ipaddr_t global_ipaddr; PROCESS_BEGIN(); printf("App: %u starting/n", node_id); uip_ip6addr(&root_ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 1); if(node_id == ROOT_ID) { memcpy(&global_ipaddr, &root_ipaddr, 16); uip_ds6_addr_add(&global_ipaddr, 0, ADDR_MANUAL); rpl_dag_t *dag = rpl_set_root(RPL_DEFAULT_INSTANCE, &global_ipaddr); rpl_set_prefix(dag, &global_ipaddr, 64); } else { uip_ip6addr(&global_ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0); uip_ds6_set_addr_iid(&global_ipaddr, &uip_lladdr); uip_ds6_addr_add(&global_ipaddr, 0, ADDR_AUTOCONF); } orpl_init(&global_ipaddr, node_id == ROOT_ID, 1); simple_udp_register(&unicast_connection, UDP_PORT, NULL, UDP_PORT, receiver); if(node_id == ROOT_ID) { NETSTACK_RDC.off(1); } else { etimer_set(&periodic_timer, SEND_INTERVAL); while(1) { etimer_set(&send_timer, random_rand() % (SEND_INTERVAL)); PROCESS_WAIT_UNTIL(etimer_expired(&send_timer)); if(orpl_current_edc() != 0xffff) { app_send_to(ROOT_ID); } else { printf("App: not in DODAG/n"); } PROCESS_WAIT_UNTIL(etimer_expired(&periodic_timer)); etimer_reset(&periodic_timer); } } PROCESS_END();}
开发者ID:Johnyren,项目名称:orpl,代码行数:49,
示例4: PROCESS_THREAD/* Glowny program */PROCESS_THREAD(program_UDP, ev, data) { static struct etimer et; PROCESS_BEGIN();#if UIP_CONF_IPV6 > 0 uip_ip6addr(&ipaddr, addr[0], addr[1], addr[2], addr[3], addr[4], addr[5], addr[6], addr[7]);#else uip_ipaddr(&ipaddr, addr[0], addr[1], addr[2], addr[3]);#endif conn = udp_new(&ipaddr, UIP_HTONS(port), &state); udp_bind(conn, UIP_HTONS(port + 1)); printf("Binded/n"); etimer_set(&et, CLOCK_CONF_SECOND * 3); while (1) { PROCESS_WAIT_EVENT(); if (uip_newdata()) { str = uip_appdata; str[uip_datalen()] = '/0'; printf("Received: '%s'/n", str); } etimer_reset(&et); } PROCESS_END();}
开发者ID:stompdev,项目名称:stomp-contiki,代码行数:30,
示例5: PROCESS_THREAD/*---------------------------------------------------------------------------*/PROCESS_THREAD(start_app, ev, data){ PROCESS_BEGIN(); static int is_coordinator = 0; memset(rx_buf, '/0', sizeof(rx_buf)); /* Define process that handles data */ process_start(&rx_data_process ,NULL); /* Initialise UART1 */ uart1_init(UART1_BAUD_RATE); /* Callback received byte */ uart1_set_input(handleRxChar); /* Start network stack */ if(is_coordinator) { uip_ipaddr_t prefix; uip_ip6addr(&prefix, 0xaaaa, 0, 0, 0, 0, 0, 0, 0); rpl_tools_init(&prefix); } else { rpl_tools_init(NULL); } printf("Starting RPL node/n"); rest_init_engine(); rest_activate_resource(&resource_coap_rx_uart1, "UART1-RX"); rest_activate_resource(&resource_coap_tx_uart1, "UART1-TX"); PROCESS_END();}
开发者ID:1847123212,项目名称:ampm_contiki_wisun,代码行数:30,
示例6: set_net_addressvoid set_net_address(void){ uip_ipaddr_t ipaddr;#if RPL_BORDER_ROUTER rpl_dag_t *dag;#endif uip_ip6addr(&ipaddr, NET_ADDR_A, NET_ADDR_B, NET_ADDR_C, NET_ADDR_D, 0, 0, 0, 0); uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); uip_ds6_addr_add(&ipaddr, 0, ADDR_TENTATIVE); //#if !UIP_CONF_ROUTER// uip_ds6_prefix_add(&ipaddr, 64, 0); // For on-link determination.//#else// uip_ds6_prefix_add(&ipaddr, 64, 0, 0, 600, 600);//#endif print_addresses(); #if RPL_BORDER_ROUTER dag = rpl_set_root(RPL_DEFAULT_INSTANCE,&ipaddr); if(dag != NULL) { PRINTF("This node is setted as root of a DAG./r/n"); } else { PRINTF("Error while setting this node as root of a DAG./r/n"); }#endif }
开发者ID:chanhemow,项目名称:contiki-fork,代码行数:31,
示例7: PROCESS_THREAD/*---------------------------------------------------------------------------*/PROCESS_THREAD(udp_server_process, ev, data){#if UIP_CONF_ROUTER uip_ipaddr_t ipaddr;#endif /* UIP_CONF_ROUTER */ PROCESS_BEGIN(); PRINTF("UDP server started/n");#if UIP_CONF_ROUTER uip_ip6addr(&ipaddr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0); uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);#endif /* UIP_CONF_ROUTER */ print_local_addresses(); server_conn = udp_new(NULL, UIP_HTONS(3001), NULL); udp_bind(server_conn, UIP_HTONS(3000)); while(1) { PROCESS_YIELD(); if(ev == tcpip_event) { tcpip_handler(); } } PROCESS_END();}
开发者ID:13416795,项目名称:contiki,代码行数:30,
示例8: PROCESS_THREAD/*---------------------------------------------------------------------------*/PROCESS_THREAD(udp_server_process, ev, data){ PROCESS_BEGIN(); PRINTF("UDP server started/n");#if UIP_CONF_ROUTER uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0); uip_netif_addr_add(&ipaddr, 64, 0, AUTOCONF);#endif /* UIP_CONF_ROUTER */ print_local_addresses(); server_conn = udp_new(NULL, HTONS(61617), NULL); udp_bind(server_conn, HTONS(61616)); PRINTF("Created a server connection with remote address "); PRINT6ADDR(&server_conn->ripaddr); PRINTF("local/remote port %u/%u/n", HTONS(server_conn->lport), HTONS(server_conn->rport)); while(1) { PROCESS_YIELD(); if(ev == tcpip_event) { tcpip_handler(); } } PROCESS_END();}
开发者ID:mlwymore,项目名称:contiki,代码行数:31,
示例9: PROCESS_THREAD/*---------------------------------------------------------------------------*/PROCESS_THREAD(udp_client_process, ev, data){ static struct etimer et; uip_ipaddr_t ipaddr; PROCESS_BEGIN(); /* NOTE: Use IPv6 address of server here. */ uip_ip6addr(&ipaddr, 0xfe80, 0x0000, 0x0000, 0x0000, 0x48ad, 0x5dff, 0xfe71, 0x5d9d); /* new connection with remote host */ client_conn = udp_new(&ipaddr, UIP_HTONS(3000), NULL); udp_bind(client_conn, UIP_HTONS(3034)); PRINTF("Created a connection with the server "); PRINT6ADDR(&client_conn->ripaddr); PRINTF(" local/remote port %u/%u/n", UIP_HTONS(client_conn->lport), UIP_HTONS(client_conn->rport)); etimer_set(&et, SEND_INTERVAL); while (1) { PROCESS_YIELD(); if (etimer_expired(&et)) { timeout_handler(); etimer_restart(&et); } else if (ev == tcpip_event) { tcpip_handler(); } } PROCESS_END();}
开发者ID:ibr-cm,项目名称:contiki-inga,代码行数:34,
示例10: xtcpd_connect/* ----------------------------------------------------------------------------- * * -------------------------------------------------------------------------- */void xtcpd_connect(int linknum, int port_number, xtcp_ipaddr_t addr, xtcp_protocol_t p) { uip_ipaddr_t uipaddr;#if UIP_CONF_IPV4 uip_ipaddr(&uipaddr, addr.u8[0], addr.u8[1], addr.u8[2], addr.u8[3]);#elif UIP_CONF_IPV6 uip_ip6addr(&uipaddr, addr.u16[0], addr.u16[1], addr.u16[2], addr.u16[3], addr.u16[4], addr.u16[5], addr.u16[6], addr.u16[7]);#endif /* UIP_CONF_IPVx */ if (p == XTCP_PROTOCOL_TCP) { struct uip_conn *conn = uip_connect(&uipaddr, HTONS(port_number)); if (conn != NULL) { xtcpd_state_t *s = (xtcpd_state_t *) &(conn->appstate); s->linknum = linknum; s->s.connect_request = 1; s->conn.connection_type = XTCP_CLIENT_CONNECTION; } } else { struct uip_udp_conn *conn; conn = uip_udp_new(&uipaddr, HTONS(port_number)); if (conn != NULL) { xtcpd_state_t *s = (xtcpd_state_t *) &(conn->appstate); s->linknum = linknum; s->s.connect_request = 1; s->conn.connection_type = XTCP_CLIENT_CONNECTION; } } return;}
开发者ID:ajwlucas,项目名称:lib_xtcp,代码行数:33,
示例11: PROCESS_THREAD/*---------------------------------------------------------------------------*/PROCESS_THREAD(udp_server_process, ev, data){#if UIP_CONF_ROUTER uip_ipaddr_t ipaddr;#endif /* UIP_CONF_ROUTER */ PROCESS_BEGIN(); PRINTF("UDP server started/n");#if RESOLV_CONF_SUPPORTS_MDNS resolv_set_hostname("contiki-udp-server");#endif#if UIP_CONF_ROUTER uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0); uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);#endif /* UIP_CONF_ROUTER */ print_local_addresses(); server_conn = udp_new(NULL, UIP_HTONS(3001), NULL); udp_bind(server_conn, UIP_HTONS(3000)); while(1) { PROCESS_YIELD(); if(ev == tcpip_event) { tcpip_handler(); } } PROCESS_END();}
开发者ID:1uk3,项目名称:contiki,代码行数:34,
示例12: PROCESS_THREAD/*---------------------------------------------------------------------------*/PROCESS_THREAD(udp_server_process, ev, data){// uint16_t ipaddr=(uint16_t) IP_TRANS128;//#if UIP_CONF_ROUTER uip_ipaddr_t ipaddr;//=IP_TRANS128; uip_ip6addr(&ipaddr,0xfe80,0,0,0,0x2001,0x22ff,0xfe33,0x4455);//#endif /* UIP_CONF_ROUTER */ PROCESS_BEGIN(); SENSORS_ACTIVATE(button_sensor);//activate button leds_init(); leds_off(LEDS_ALL); simple_udp_register(&udp_connection, UDP_PORT, NULL, UDP_PORT, receiver); while(1) {// printf("bla1"); PROCESS_WAIT_EVENT_UNTIL(ev == sensors_event && data == &button_sensor); // PROCESS_YIELD(); send_data(&ipaddr); } PROCESS_END();}
开发者ID:johannesst,项目名称:aio-wsn,代码行数:30,
示例13: demo_udp_socket_init/*----------------------------------------------------------------------------*/int8_t demo_udp_socket_init(void) { /* The choice of server address determines its 6LoPAN header compression. * (Our address will be compressed Mode 3 since it is derived from our link-local address) * Obviously the choice made here must also be selected in udp-server.c. * * For correct Wireshark decoding using a sniffer, add the /64 prefix to the 6LowPAN protocol preferences, * e.g. set Context 0 to aaaa::. At present Wireshark copies Context/128 and then overwrites it. * (Setting Context 0 to aaaa::1111:2222:3333:4444 will report a 16 bit compressed address of aaaa::1111:22ff:fe33:xxxx) * * Note the IPCMV6 checksum verification depends on the correct uncompressed addresses. */ /* We know destination IP address but we need to properly convert it */ uip_ip6addr(&un_server_ipaddr, un_server_ipaddr.u16[0],un_server_ipaddr.u16[1],/ un_server_ipaddr.u16[2],un_server_ipaddr.u16[3],/ un_server_ipaddr.u16[4],un_server_ipaddr.u16[5],/ un_server_ipaddr.u16[6],un_server_ipaddr.u16[7]); pst_conn = udp_new(NULL, UIP_HTONS(__SERVER_PORT), NULL); udp_bind(pst_conn, UIP_HTONS(__CLIENT_PORT)); LOG_INFO("%s", "Create connection with the server "); //uip_debug_ipaddr_print(&un_server_ipaddr); LOG_RAW("/n/r"); LOG_INFO("local/remote port %u/%u/n/r", UIP_HTONS(pst_conn->lport), UIP_HTONS(pst_conn->rport)); //printf("Set dudp timer %p/n/r",&st_et); etimer_set(&st_et, SEND_INTERVAL, _demo_udp_callback); evproc_regCallback(EVENT_TYPE_TCPIP,_demo_udp_callback); return 1;}/* demo_udp_init() */
开发者ID:kamejoko80,项目名称:emb6,代码行数:33,
示例14: PROCESS_THREAD//**************************************************************************************************************************************************//PROCESS_THREAD(RSSI_SCAN, ev, data){ static struct etimer rssitimer; static struct rtimer rt; PROCESS_BEGIN(); // Set the local address uip_ip6addr(&my_addr, 0, 0, 0, 0, 0, 0, 0, 0); uip_ds6_set_addr_iid(&my_addr, &uip_lladdr); uip_ds6_addr_add(&my_addr, 0, ADDR_MANUAL); //listening to port 3001 from beacons and sensors listen_conn = udp_new(NULL, UIP_HTONS(0), NULL); //Server Listen connection is bound too port 4001 udp_bind(listen_conn, UIP_HTONS(RECEIVER_PORT)); while(1) { //printf("inside while/n/r"); //etimer_set(&rssitimer, CLOCK_SECOND/200); //GPIO_SET_PIN(GPIO_C_BASE, GPIO_PIN_MASK(1)); //PROCESS_YIELD(); PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); if ((ev == tcpip_event)) { recv_handler(); } } PROCESS_END();}
开发者ID:pjdeavers,项目名称:MotionNetContiki,代码行数:31,
示例15: make_neighborstatic unsigned shortmake_neighbor(void *arg){ struct httpd_state *s = (struct httpd_state *)arg; struct collect_neighbor *n = collect_neighbor_get(s->u.count); if(n == NULL) { return 0; }#if !UIP_CONF_IPV6 return snprintf((char *)uip_appdata, uip_mss(), "<li><a href=/"http://172.16.%d.%d//">%d.%d</a>/r/n", n->addr.u8[0], n->addr.u8[1], n->addr.u8[0], n->addr.u8[1]);#else#if 0 uip_ipaddr_t ipaddr; char ipaddr_str[41]; uip_ip6addr(&ipaddr, NET_ADDR_A, NET_ADDR_B, NET_ADDR_C, NET_ADDR_D, (uint16_t)(((uint16_t)(n->addr.u8[0]^0x02))<<8 | (uint16_t)n->addr.u8[1]), ((uint16_t)(n->addr.u8[2]))<<8 | (uint16_t)n->addr.u8[3], (uint16_t)(n->addr.u8[4])<<8 | n->addr.u8[5], (uint16_t)(n->addr.u8[6])<<8 | n->addr.u8[7]); httpd_sprint_ip6(ipaddr, ipaddr_str); return snprintf((char *)uip_appdata, uip_mss(), "<li><a href=/"http://%s//">%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X</a>/r/n", ipaddr_str, n->addr.u8[0], n->addr.u8[1], n->addr.u8[2], n->addr.u8[3], n->addr.u8[4], n->addr.u8[5], n->addr.u8[6], n->addr.u8[7]);#endif /* Automatic generation of node address. Javascript funcion required. * Client-side generation is simpler than server-side, as parsing http header * would be requied. */ return snprintf((char *)uip_appdata, uip_mss(), "<li><a id=node name='%x:%x:%x:%x'>%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X</a>/r/n", (uint16_t)(((uint16_t)(n->addr.u8[0]^0x02))<<8 | (uint16_t)n->addr.u8[1]), ((uint16_t)(n->addr.u8[2]))<<8 | (uint16_t)n->addr.u8[3], (uint16_t)(n->addr.u8[4])<<8 | n->addr.u8[5], (uint16_t)(n->addr.u8[6])<<8 | n->addr.u8[7], n->addr.u8[0], n->addr.u8[1], n->addr.u8[2], n->addr.u8[3], n->addr.u8[4], n->addr.u8[5], n->addr.u8[6], n->addr.u8[7]); #endif /* UIP_CONF_IPV6 */}
开发者ID:AWRyder,项目名称:contiki,代码行数:60,
示例16: add_routevoid add_route(int dest, int next) { uip_ipaddr_t ipaddr_dest, ipaddr_next;#if !IN_COOJA uint32_t dest_suffix = get_mote_suffix(dest); uint32_t next_suffix = get_mote_suffix(next);#endif PRINTF("add route %d %d/n", dest, next);#if IN_COOJA uip_ip6addr(&ipaddr_dest, 0xaaaa, 0, 0, 0, 0x0212, 0x7400 | dest, dest, dest<<8 | dest); uip_ip6addr(&ipaddr_next, 0xfe80, 0, 0, 0, 0x0212, 0x7400 | next, next, next<<8 | next);#else uip_ip6addr(&ipaddr_dest, 0xaaaa, 0, 0, 0, 0x0212, 0x7400, (dest_suffix >> 16) & 0xffff, dest_suffix & 0xffff); uip_ip6addr(&ipaddr_next, 0xfe80, 0, 0, 0, 0x0212, 0x7400, (next_suffix >> 16) & 0xffff, next_suffix & 0xffff);#endif uip_ds6_route_add(&ipaddr_dest, 128, &ipaddr_next, 0);}
开发者ID:EmuxEvans,项目名称:contiki-cc2530eb,代码行数:16,
示例17: set_global_addressvoid set_global_address(void) { uip_ipaddr_t ipaddr; uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0); uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);}
开发者ID:EmuxEvans,项目名称:contiki-cc2530eb,代码行数:7,
示例18: rpl_link_neighbor_callback/*---------------------------------------------------------------------------*/voidrpl_link_neighbor_callback(const linkaddr_t *addr, int status, int numtx){ uip_ipaddr_t ipaddr; rpl_parent_t *parent; rpl_instance_t *instance; rpl_instance_t *end; uip_ip6addr(&ipaddr, 0xfe80, 0, 0, 0, 0, 0, 0, 0); uip_ds6_set_addr_iid(&ipaddr, (uip_lladdr_t *)addr); for(instance = &instance_table[0], end = instance + RPL_MAX_INSTANCES; instance < end; ++instance) { if(instance->used == 1 ) { parent = rpl_find_parent_any_dag(instance, &ipaddr); if(parent != NULL) { /* Trigger DAG rank recalculation. */ PRINTF("RPL: rpl_link_neighbor_callback triggering update/n"); parent->flags |= RPL_PARENT_FLAG_UPDATED; if(instance->of->neighbor_link_callback != NULL) { instance->of->neighbor_link_callback(parent, status, numtx); parent->last_tx_time = clock_time(); } } } }}
开发者ID:johangas,项目名称:contiki,代码行数:27,
示例19: set_global_address/*---------------------------------------------------------------------------*/static uip_ipaddr_t *set_global_address(void){ static uip_ipaddr_t ipaddr; int i; uint8_t state; uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0); uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF); printf("IPv6 addresses: "); for(i = 0; i < UIP_DS6_ADDR_NB; i++) { state = uip_ds6_if.addr_list[i].state; if(uip_ds6_if.addr_list[i].isused && (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) { uip_debug_ipaddr_print(&uip_ds6_if.addr_list[i].ipaddr); printf("/n"); if(state == ADDR_TENTATIVE) { uip_ds6_if.addr_list[i].state = ADDR_PREFERRED; } } } return &ipaddr;}
开发者ID:lab-anaws,项目名称:lab2,代码行数:27,
示例20: raven_ping6/* Sends a ping packet out the radio */static voidraven_ping6(void){ /* ping ipv6.google.com*/ uip_ip6addr(&ping_addr,0x2001,0x420,0x5FFF,0x7D,0x2D0,0xB7FF,0xFE23,0xE6DB); //uip_ip6addr(&ping_addr, 0x2001, 0x4860, 0, 0x2001, 0, 0, 0, 0x68); //uip_ip6addr(&ping_addr, 0xaaaa, 0, 0, 0, 0, 0, 0, 1); UIP_IP_BUF->vtc = 0x60; UIP_IP_BUF->tcflow = 1; UIP_IP_BUF->flow = 0; UIP_IP_BUF->proto = UIP_PROTO_ICMP6; UIP_IP_BUF->ttl = uip_netif_physical_if.cur_hop_limit; uip_ipaddr_copy(&UIP_IP_BUF->destipaddr, &ping_addr); uip_netif_select_src(&UIP_IP_BUF->srcipaddr, &UIP_IP_BUF->destipaddr); UIP_ICMP_BUF->type = ICMP6_ECHO_REQUEST; UIP_ICMP_BUF->icode = 0; /* set identifier and sequence number to 0 */ memset((void *)UIP_ICMP_BUF + UIP_ICMPH_LEN, 0, 4); uip_len = UIP_ICMPH_LEN + UIP_ICMP6_ECHO_REQUEST_LEN + UIP_IPH_LEN; UIP_IP_BUF->len[0] = (u8_t)((uip_len - 40) >> 8); UIP_IP_BUF->len[1] = (u8_t)((uip_len - 40) & 0x00FF); UIP_ICMP_BUF->icmpchksum = 0; UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); tcpip_ipv6_output();}
开发者ID:arbraham,项目名称:hummingbird,代码行数:32,
示例21: PROCESS_THREADPROCESS_THREAD(raven_lcd_process, ev, data){ PROCESS_BEGIN(); /* Initialize the sensor data history */ memcpy(last_temp, "20.0", sizeof("20.0")); /*Create a udp connection to the server*/ uip_ip6addr(&server_addr, 0xaaaa, 0, 0, 0, 0, 0, 0, 1); /* set destination parameters */ send_conn = udp_new(&server_addr, SERVER_PORT, NULL); /*set local port */ udp_bind(send_conn, HTONS(0xF0B0+1)); /* Listen to port 0xF0B0 for commands */ node_conn = udp_new(NULL, 0, NULL); udp_bind(node_conn, HTONS(0xF0B0)); if(icmp6_new(NULL) != NULL) { while(1) { PROCESS_YIELD(); raven_gui_loop(ev, data); } } PROCESS_END();}
开发者ID:kincki,项目名称:contiki,代码行数:27,
示例22: lookupstatic uip_ipaddr_t *lookup(uip_ipaddr_t *destipaddr, uip_ipaddr_t *nexthop){ static rimeaddr_t rimeaddr; struct route_entry *route; int i; for(i = 1; i < sizeof(rimeaddr); i++) { rimeaddr.u8[i] = destipaddr->u8[sizeof(*destipaddr) - sizeof(rimeaddr) + i]; } rimeaddr.u8[0] = 0; PRINTF("rimeroute: looking up "); PRINT6ADDR(destipaddr); PRINTF(" with Rime address "); PRINTRIMEADDR((&rimeaddr)); PRINTF("/n"); route = route_lookup(&rimeaddr); if(route == NULL) { process_post(&rimeroute_process, rimeroute_event, &rimeaddr); return NULL; } uip_ip6addr(nexthop, 0xfe80, 0, 0, 0, 0, 0, 0, 0); uip_netif_addr_autoconf_set(nexthop, (uip_lladdr_t *)&route->nexthop); PRINTF("rimeroute: "); PRINT6ADDR(destipaddr); PRINTF(" can be reached via "); PRINT6ADDR(nexthop); PRINTF("/n"); return nexthop;}
开发者ID:soohyunc,项目名称:contiki-2.x,代码行数:34,
示例23: PROCESS_THREADPROCESS_THREAD(raven_lcd_process, ev, data){ u8_t error; PROCESS_BEGIN(); /*Create a udp connection to the IPSOserver*/ //swisscom uip_ip6addr(&udp_addr,0x2001,918,0xfff9,0,0,0,0,1); //HE uip_ip6addr(&udp_addr,0x2001,0x470,0x1f12,0x5ec,0x12,0x13ff,0xfe14,0x1516); uip_ip6addr(&udp_addr,0x2001,0x420,0x5FFF,0x7D,0x2D0,0xB7FF,0xFE23,0xE6DB); /* set destination parameters*/ udp_conn = udp_new(&udp_addr, HTONS(0xF0B0), NULL); /*set local port */ udp_bind(udp_conn, HTONS(0xF0B0+1)); if((error = icmp6_new(NULL)) == 0) { while(1) { PROCESS_YIELD(); raven_gui_loop(ev, data); } } PROCESS_END();}
开发者ID:arbraham,项目名称:hummingbird,代码行数:25,
示例24: set_global_address/*---------------------------------------------------------------------------*/static uip_ipaddr_t *set_global_address(void){ static uip_ipaddr_t ipaddr; int i; uint8_t state; /* Assign a unique local address (RFC4193, http://tools.ietf.org/html/rfc4193). */ uip_ip6addr(&ipaddr, 0xfc00, 0, 0, 0, 0, 0, 0, 0); uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF); printf("IPv6 addresses: "); for(i = 0; i < UIP_DS6_ADDR_NB; i++) { state = uip_ds6_if.addr_list[i].state; if(uip_ds6_if.addr_list[i].isused && (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) { uip_debug_ipaddr_print(&uip_ds6_if.addr_list[i].ipaddr); printf("/n"); } } return &ipaddr;}
开发者ID:examyes,项目名称:SMeshStudio,代码行数:26,
示例25: PROCESS_THREAD/*---------------------------------------------------------------------------*/PROCESS_THREAD(start_app, ev, data){ PROCESS_BEGIN(); static int is_coordinator = 0; /* Switch off dongle leds */ /* Initialise ct timer, but don't let it run yet */ ctimer_set(&ct, TOGGLE_TIME, ct_callback, NULL); ctimer_stop(&ct); /* Start net stack */ if(is_coordinator) { uip_ipaddr_t prefix; uip_ip6addr(&prefix, 0xaaaa, 0, 0, 0, 0, 0, 0, 0); rpl_tools_init(&prefix); } else { rpl_tools_init(NULL); } printf("Starting RPL node/n"); rest_init_engine(); rest_activate_resource(&resource_led_toggle, "Dongle/LED-toggle"); PROCESS_END();}
开发者ID:An-S,项目名称:contiki,代码行数:26,
示例26: set_own_addresses/*---------------------------------------------------------------------------*/static voidset_own_addresses(void){ int i; uint8_t state; rpl_dag_t *dag; uip_ipaddr_t ipaddr; uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0); uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF); PRINTF("Our IPv6 addresses:/n"); for(i = 0; i < UIP_DS6_ADDR_NB; i++) { state = uip_ds6_if.addr_list[i].state; if(uip_ds6_if.addr_list[i].isused && (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) { PRINTF(" "); PRINT6ADDR(&uip_ds6_if.addr_list[i].ipaddr); PRINTF("/n"); if(state == ADDR_TENTATIVE) { uip_ds6_if.addr_list[i].state = ADDR_PREFERRED; } } } /* Become root of a new DODAG with ID our global v6 address */ dag = rpl_set_root(RPL_DEFAULT_INSTANCE, &ipaddr); if(dag != NULL) { rpl_set_prefix(dag, &ipaddr, 64); PRINTF("Created a new RPL dag with ID: "); PRINT6ADDR(&dag->dag_id); PRINTF("/n"); }}
开发者ID:200018171,项目名称:contiki,代码行数:36,
示例27: PROCESS_THREAD/*---------------------------------------------------------------------------*/PROCESS_THREAD(udp_client_process, ev, data){ static struct etimer et; uip_ipaddr_t ipaddr; PROCESS_BEGIN(); PRINTF("UDP client process started/n"); uip_ip6addr(&ipaddr, 0xfe80, 0, 0, 0, 0x0215, 0x2000, 0x0002, 0x2145); /* new connection with remote host */ l_conn = udp_new(&ipaddr, UIP_HTONS(3000), NULL); if(!l_conn) { PRINTF("udp_new l_conn error./n"); } udp_bind(l_conn, UIP_HTONS(LOCAL_CONN_PORT)); PRINTF("Link-Local connection with "); PRINT6ADDR(&l_conn->ripaddr); PRINTF(" local/remote port %u/%u/n", UIP_HTONS(l_conn->lport), UIP_HTONS(l_conn->rport)); uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0x0215, 0x2000, 0x0002, 0x2145); g_conn = udp_new(&ipaddr, UIP_HTONS(3000), NULL); if(!g_conn) { PRINTF("udp_new g_conn error./n"); } udp_bind(g_conn, UIP_HTONS(GLOBAL_CONN_PORT)); PRINTF("Global connection with "); PRINT6ADDR(&g_conn->ripaddr); PRINTF(" local/remote port %u/%u/n", UIP_HTONS(g_conn->lport), UIP_HTONS(g_conn->rport)); etimer_set(&et, SEND_INTERVAL); while(1) { PROCESS_YIELD(); if(etimer_expired(&et)) { timeout_handler(); etimer_restart(&et); } else if(ev == tcpip_event) { tcpip_handler(); } } PROCESS_END();}
开发者ID:1847123212,项目名称:ampm_contiki_wisun,代码行数:48,
示例28: set_global_address/*---------------------------------------------------------------------------*/static voidset_global_address(void){ uip_ipaddr_t ipaddr; #if 0 /* Mode 1 - 64 bits inline */ uip_ip6addr(&server_ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 1); #elif 1 /* Mode 2 - 16 bits inline */ uip_ip6addr(&server_ipaddr, 0x2001, 5, 0, 0, 0x200, 0, 0, 1); #else /* Mode 3 - derived from server link-local (MAC) address */ uip_ip6addr(&server_ipaddr, 0xaaaa, 0, 0, 0, 0x0250, 0xc2ff, 0xfea8, 0xcd1a); //redbee-econotag #endif}
开发者ID:iris-yu,项目名称:6Lo-ND-contiki,代码行数:18,
示例29: PROCESS_THREAD PROCESS_THREAD(raven_relay_process, ev, data) { uip_ipaddr_t ipaddr; PROCESS_POLLHANDLER(pollhandler()); PROCESS_EXITHANDLER(exithandler()); // see: http://senstools.gforge.inria.fr/doku.php?id=contiki:examples PROCESS_BEGIN(); PRINTF("Relay process startup./r/n"); // wait 3 second, in order to have the IP addresses well configured etimer_set(&udp_periodic_timer, CLOCK_CONF_SECOND*3); // wait until the timer has expired PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_TIMER); // Define Address of the server that receives our heartbeats. // TODO: Make this dynamic#ifdef UDP_ADDR_A uip_ip6addr(&ipaddr, UDP_ADDR_A,UDP_ADDR_B,UDP_ADDR_C,UDP_ADDR_D, UDP_ADDR_E,UDP_ADDR_F,UDP_ADDR_G,UDP_ADDR_H);#else /* UDP_ADDR_A */ uip_ip6addr(&ipaddr,0xbbbb,0,0,0,0xd69a,0x20ff,0xfe07,0x7664);#endif /* UDP_ADDR_A */ udpconn = udp_new(NULL, HTONS(0), NULL); //udpconn = udp_new(&ipaddr, HTONS(0xF0B0+1), NULL); udp_bind(udpconn, HTONS(0xF0B0)); // udp_attach(udpconn, NULL); PRINTF("Created connection with remote peer "); PRINT6ADDR(&udpconn->ripaddr); PRINTF("/r/nlocal/remote port %u/%u/r/n", HTONS(udpconn->lport),HTONS(udpconn->rport)); print_local_addresses(); etimer_set(&udp_periodic_timer, 60*CLOCK_SECOND); while(1){ PRINTF("--- Relay: Waiting for events./r/n"); // tcpip_poll_udp(udpconn); PROCESS_WAIT_EVENT(); // PROCESS_YIELD(); udphandler(ev, data); } PROCESS_END(); }
开发者ID:gonium,项目名称:octobus,代码行数:46,
注:本文中的uip_ip6addr函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ uip_ipaddr函数代码示例 C++ uip_input函数代码示例 |