本文整理汇总了C++中UIP_LOG函数的典型用法代码示例。如果您正苦于以下问题:C++ UIP_LOG函数的具体用法?C++ UIP_LOG怎么用?C++ UIP_LOG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UIP_LOG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: uip_netif_sched_dad
/*---------------------------------------------------------------------------*/
void
uip_netif_sched_dad(struct uip_netif_addr *ifaddr)
{
if(ifaddr->state != TENTATIVE){
UIP_LOG("DAD called with non tentative address");
return;
}
/*
* check dad is not running
*/
if(dad_ifaddr != NULL){
UIP_LOG("DAD already running");
return;
}
/*
* Set the interface address that is going through DAD
*/
dad_ifaddr = ifaddr;
PRINTF("Scheduling DAD for ipaddr:");
PRINT6ADDR(&dad_ifaddr->ipaddr);
PRINTF("\n");
etimer_set(&uip_netif_timer_dad, random_rand()%(UIP_ND6_MAX_RTR_SOLICITATION_DELAY * CLOCK_SECOND));
}
示例2: uip_netif_addr_add
/*---------------------------------------------------------------------------*/
void
uip_netif_addr_add(uip_ipaddr_t *ipaddr, u8_t length, unsigned long vlifetime, uip_netif_type type) {
/* check prefix has the right length if we are doing autoconf */
if((type == AUTOCONF) && (length != UIP_DEFAULT_PREFIX_LEN)) {
UIP_LOG("Error: UNSUPPORTED PREFIX LENGTH");
return;
}
/* check if addr does not already exist and find a free entry */
for(i = 0; i < UIP_CONF_NETIF_MAX_ADDRESSES; ++i) {
if(uip_netif_physical_if.addresses[i].state == NOT_USED){
/*
* Copying address
* If we are doing autoconf, ipaddr is a prefix, we copy the 128 bits
* of it, then overwrite the last 64 bits with the interface ID at
* next if statement.
* Otherwise ipaddr is an address, we just copy it
*/
uip_ipaddr_copy(&uip_netif_physical_if.addresses[i].ipaddr, ipaddr);
if(type == AUTOCONF) {
/* construct address from prefix and layer2 id */
uip_netif_addr_autoconf_set(&uip_netif_physical_if.addresses[i].ipaddr, &uip_lladdr);
}
/* setting state, type */
uip_netif_physical_if.addresses[i].state = TENTATIVE;
uip_netif_physical_if.addresses[i].type = type;
/* setting lifetime timer if lieftime is not infinite */
if(vlifetime != 0) {
stimer_set(&(uip_netif_physical_if.addresses[i].vlifetime), vlifetime);
uip_netif_physical_if.addresses[i].is_infinite = 0;
} else {
uip_netif_physical_if.addresses[i].is_infinite = 1;
}
PRINTF("Created new address");
PRINT6ADDR(&uip_netif_physical_if.addresses[i].ipaddr);
PRINTF("for interface\n");
/* schedule DAD */
uip_netif_sched_dad(&uip_netif_physical_if.addresses[i]);
return;
}
}
/* If we did not find space, log */
UIP_LOG("ADDRESS LIST FULL");
return;
}
示例3: tcpip_accept_func
static s8_t tcpip_accept_func(void *arg,struct uip_tcp_pcb *newpcb,s8_t err)
{
s32_t s;
struct tcpip_sock *ptr,*newsock = NULL;
struct tcpip_sock *sock = (struct tcpip_sock*)arg;
UIP_LOG("tcpip_accept_func()");
if(!sock) return UIP_ERR_ABRT;
s = tcpip_allocsocket(newpcb);
if(s<0) {
uip_tcp_close(newpcb);
return UIP_ERR_ABRT;
}
newsock = tcpip_getsocket(s);
newsock->pcb->flags |= UIP_TF_NODELAY;
ptr = tcpip_accepted_sockets;
while(ptr && ptr->next) ptr = ptr->next;
if(!ptr) tcpip_accepted_sockets = newsock;
else ptr->next = newsock;
uip_tcp_arg(newpcb,newsock);
uip_tcp_recv(newpcb,tcpip_recved);
uip_tcp_sent(newpcb,tcpip_sent);
uip_tcp_err(newpcb,tcpip_err);
uip_tcp_poll(newpcb,tcpip_poll,4);
return UIP_ERR_OK;
}
示例4: tcpip_input
void
tcpip_input(void)
{
if(inputfunc != NULL) {
inputfunc();
}
UIP_LOG("tcpip_input: Use tcpip_set_inputfunc() to set an input function");
}
示例5: uip_netif_dad_failed
/*---------------------------------------------------------------------------*/
void
uip_netif_dad_failed(uip_ipaddr_t *ipaddr)
{
UIP_LOG("DAD FAILED");
UIP_LOG("THE STACK IS GOING TO SHUT DOWN");
UIP_LOG("THE HOST WILL BE UNREACHABLE");
if(uip_ipaddr_cmp(&dad_ifaddr->ipaddr, ipaddr)){
etimer_stop(&uip_netif_timer_dad);
dad_ifaddr->state = NOT_USED;
dad_ifaddr = NULL;
dad_ns = 0;
}
exit(-1);
}
示例6: tcpip_output
uint8_t
tcpip_output(void)
{
if(outputfunc != NULL) {
return outputfunc();
}
UIP_LOG("tcpip_output: Use tcpip_set_outputfunc() to set an output function");
return 0;
}
示例7: tcpip_output
uint8_t
tcpip_output(struct net_buf *buf, const uip_lladdr_t *a)
{
if(outputfunc != NULL) {
return outputfunc(buf, a);
}
UIP_LOG("tcpip_output: Use tcpip_set_outputfunc() to set an output function");
return 0;
}
示例8: tcpip_output
u8_t
tcpip_output(uip_lladdr_t *a)
{
if(outputfunc != NULL) {
return outputfunc(a);
}
UIP_LOG("tcpip_output: Use tcpip_set_outputfunc() to set an output function");
return 0;
}
示例9: tcpip_output
uint8_t
tcpip_output(const uip_lladdr_t *a)
{
int ret;
if(outputfunc != NULL) {
ret = outputfunc(a);
return ret;
}
UIP_LOG("tcpip_output: Use tcpip_set_outputfunc() to set an output function");
return 0;
}
示例10: uip_netif_addr_autoconf_set
/*---------------------------------------------------------------------------*/
void
uip_netif_addr_autoconf_set(uip_ipaddr_t *ipaddr, uip_lladdr_t *lladdr)
{
/* We consider only links with IEEE EUI-64 identifier or
IEEE 48-bit MAC addresses */
#if (UIP_LLADDR_LEN == 8)
memcpy(ipaddr->u8 + 8, lladdr, UIP_LLADDR_LEN);
ipaddr->u8[8] ^= 0x02;
#elif (UIP_LLADDR_LEN == 6)
memcpy(ipaddr->u8 + 8, lladdr, 3);
ipaddr->u8[11] = 0xff;
ipaddr->u8[12] = 0xfe;
memcpy(ipaddr->u8 + 13, (u8_t*)lladdr + 3, 3);
ipaddr->u8[8] ^= 0x02;
#else
UIP_LOG("CAN NOT BUIL INTERFACE IDENTIFIER");
UIP_LOG("THE STACK IS GOING TO SHUT DOWN");
UIP_LOG("THE HOST WILL BE UNREACHABLE");
exit(-1);
#endif
}
示例11: tcpip_output
uint8_t
tcpip_output(const uip_lladdr_t *a)
{
PRINTF("TCP IP OUTPUT.\n");
int ret;
if(outputfunc != NULL) {
ret = outputfunc(a);
return ret;
}
PRINTF("TCP IP OUTPUT. NO Func\n");
UIP_LOG("tcpip_output: Use tcpip_set_outputfunc() to set an output function");
return 0;
}
示例12: uip_ipinput
s8_t uip_ipinput(struct uip_pbuf *p,struct uip_netif *inp)
{
u16_t iphdr_len;
struct uip_ip_hdr *iphdr;
struct uip_netif *netif;
iphdr = p->payload;
if(UIP_IPH_V(iphdr)!=4) {
UIP_ERROR("uip_ipinput: ip packet dropped due to bad version number.\n");
uip_pbuf_free(p);
return 0;
}
iphdr_len = UIP_IPH_HL(iphdr);
iphdr_len *= 4;
if(iphdr_len>p->len) {
UIP_ERROR("uip_ipinput: ip packet dropped due to too small packet size.\n");
uip_pbuf_free(p);
return 0;
}
if(uip_ipchksum(iphdr,iphdr_len)!=0) {
UIP_STAT(++uip_stat.ip.drop);
UIP_STAT(++uip_stat.ip.chkerr);
UIP_ERROR("uip_ipinput: bad checksum.\n");
uip_pbuf_free(p);
return 0;
}
uip_pbuf_realloc(p,ntohs(UIP_IPH_LEN(iphdr)));
for(netif=uip_netif_list;netif!=NULL;netif=netif->next) {
if(uip_netif_isup(netif) && !ip_addr_isany(&netif->ip_addr)) {
if(ip_addr_cmp(&iphdr->dst,&netif->ip_addr) ||
ip_addr_isbroadcast(&iphdr->dst,netif)) break;
}
}
if(!netif) {
UIP_ERROR("uip_ipinput: no route found.\n");
uip_pbuf_free(p);
return 0;
}
if((UIP_IPH_OFFSET(iphdr)&htons(UIP_IP_OFFMASK|UIP_IP_MF))!=0) {
#if UIP_IP_REASSEMBLY
p = uip_ipreass(p);
if(p==NULL) return UIP_ERR_OK;
iphdr = (struct uip_ip_hdr*)p->payload;
#else
uip_pbuf_free(p);
UIP_STAT(++uip_stat.ip.drop);
UIP_ERROR("ip: fragment dropped.\n");
return 0;
#endif
}
switch(UIP_IPH_PROTO(iphdr)) {
case UIP_PROTO_TCP:
uip_tcpinput(p,inp);
break;
case UIP_PROTO_ICMP:
uip_icmpinput(p,inp);
break;
default:
UIP_LOG("uip_ipinput: Unsupported protocol.\n");
if(!ip_addr_isbroadcast(&(iphdr->dst),inp)
&& !ip_addr_ismulticast(&(iphdr->dst))) {
p->payload = iphdr;
uip_icmp_destunreach(p,UIP_ICMP_DUR_PROTO);
}
uip_pbuf_free(p);
break;
}
return 0;
}
示例13: tcpip_ipv6_output
void
tcpip_ipv6_output(void)
{
uip_ds6_nbr_t *nbr = NULL;
uip_ipaddr_t* nexthop;
if(uip_len == 0) {
return;
}
if(uip_len > UIP_LINK_MTU) {
UIP_LOG("tcpip_ipv6_output: Packet to big");
uip_len = 0;
return;
}
if(uip_is_addr_unspecified(&UIP_IP_BUF->destipaddr)){
UIP_LOG("tcpip_ipv6_output: Destination address unspecified");
uip_len = 0;
return;
}
if(!uip_is_addr_mcast(&UIP_IP_BUF->destipaddr)) {
/* Next hop determination */
nbr = NULL;
if(uip_ds6_is_addr_onlink(&UIP_IP_BUF->destipaddr)){
nexthop = &UIP_IP_BUF->destipaddr;
} else {
uip_ds6_route_t* locrt;
locrt = uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr);
if(locrt == NULL) {
if((nexthop = uip_ds6_defrt_choose()) == NULL) {
#ifdef UIP_FALLBACK_INTERFACE
UIP_FALLBACK_INTERFACE.output();
#else
PRINTF("tcpip_ipv6_output: Destination off-link but no route\n");
#endif
uip_len = 0;
return;
}
} else {
nexthop = &locrt->nexthop;
}
}
/* end of next hop determination */
// if((nbr = uip_ds6_nbr_lookup(nexthop)) == NULL) {
if(0){
/*
* I-D.ietf.6lowpan-nd 5.7: As all prefixes but the link-local prefix are
* always assumed to be off-link, multicast-based address resolution between
* neighbors is not needed.
* In addition, there are neither INCOMPLETE, STALE, DELAY, nor PROBE NCEs
* in 6LoWPAN-ND.
*/
return;
} else {
tcpip_output(&(nbr->lladdr));
uip_len = 0;
return;
}
}
/*multicast IP destination address */
tcpip_output(NULL);
uip_len = 0;
uip_ext_len = 0;
}
示例14: tcpip_ipv6_output
void
tcpip_ipv6_output(void)
{
uip_ds6_nbr_t *nbr = NULL;
uip_ipaddr_t *nexthop;
if(uip_len == 0) {
return;
}
if(uip_len > UIP_LINK_MTU) {
UIP_LOG("tcpip_ipv6_output: Packet to big");
uip_clear_buf();
return;
}
if(uip_is_addr_unspecified(&UIP_IP_BUF->destipaddr)){
UIP_LOG("tcpip_ipv6_output: Destination address unspecified");
uip_clear_buf();
return;
}
if(!uip_is_addr_mcast(&UIP_IP_BUF->destipaddr)) {
/* Next hop determination */
nbr = NULL;
/* We first check if the destination address is on our immediate
link. If so, we simply use the destination address as our
nexthop address. */
if(uip_ds6_is_addr_onlink(&UIP_IP_BUF->destipaddr)){
nexthop = &UIP_IP_BUF->destipaddr;
} else {
uip_ds6_route_t *route;
/* Check if we have a route to the destination address. */
route = uip_ds6_route_lookup(&UIP_IP_BUF->destipaddr);
/* No route was found - we send to the default route instead. */
if(route == NULL) {
PRINTF("tcpip_ipv6_output: no route found, using default route\n");
nexthop = uip_ds6_defrt_choose();
if(nexthop == NULL) {
#ifdef UIP_FALLBACK_INTERFACE
PRINTF("FALLBACK: removing ext hdrs & setting proto %d %d\n",
uip_ext_len, *((uint8_t *)UIP_IP_BUF + 40));
if(uip_ext_len > 0) {
extern void remove_ext_hdr(void);
uint8_t proto = *((uint8_t *)UIP_IP_BUF + 40);
remove_ext_hdr();
/* This should be copied from the ext header... */
UIP_IP_BUF->proto = proto;
}
/* Inform the other end that the destination is not reachable. If it's
* not informed routes might get lost unexpectedly until there's a need
* to send a new packet to the peer */
if(UIP_FALLBACK_INTERFACE.output() < 0) {
PRINTF("FALLBACK: output error. Reporting DST UNREACH\n");
uip_icmp6_error_output(ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_ADDR, 0);
uip_flags = 0;
tcpip_ipv6_output();
return;
}
#else
PRINTF("tcpip_ipv6_output: Destination off-link but no route\n");
#endif /* !UIP_FALLBACK_INTERFACE */
uip_clear_buf();
return;
}
} else {
/* A route was found, so we look up the nexthop neighbor for
the route. */
nexthop = uip_ds6_route_nexthop(route);
/* If the nexthop is dead, for example because the neighbor
never responded to link-layer acks, we drop its route. */
if(nexthop == NULL) {
#if UIP_CONF_IPV6_RPL
/* If we are running RPL, and if we are the root of the
network, we'll trigger a global repair berfore we remove
the route. */
rpl_dag_t *dag;
rpl_instance_t *instance;
dag = (rpl_dag_t *)route->state.dag;
if(dag != NULL) {
instance = dag->instance;
rpl_repair_root(instance->instance_id);
}
#endif /* UIP_CONF_IPV6_RPL */
uip_ds6_route_rm(route);
/* We don't have a nexthop to send the packet to, so we drop
it. */
return;
}
}
#if TCPIP_CONF_ANNOTATE_TRANSMISSIONS
if(nexthop != NULL) {
static uint8_t annotate_last;
//.........这里部分代码省略.........
示例15: tcpip_ipv6_output
void
tcpip_ipv6_output(void)
{
struct uip_nd6_neighbor *nbc = NULL;
struct uip_nd6_defrouter *dr = NULL;
if(uip_len == 0)
return;
if(uip_len > UIP_LINK_MTU){
UIP_LOG("tcpip_ipv6_output: Packet to big");
uip_len = 0;
return;
}
if(uip_is_addr_unspecified(&UIP_IP_BUF->destipaddr)){
UIP_LOG("tcpip_ipv6_output: Destination address unspecified");
uip_len = 0;
return;
}
if(!uip_is_addr_mcast(&UIP_IP_BUF->destipaddr)) {
/*If destination is on link */
nbc = NULL;
if(uip_nd6_is_addr_onlink(&UIP_IP_BUF->destipaddr)){
nbc = uip_nd6_nbrcache_lookup(&UIP_IP_BUF->destipaddr);
} else {
#if UIP_CONF_ROUTER
/*destination is not on link*/
uip_ipaddr_t ipaddr;
uip_ipaddr_t *next_hop;
/* Try to find the next hop address in the local routing table. */
next_hop = uip_router != NULL ?
uip_router->lookup(&UIP_IP_BUF->destipaddr, &ipaddr) : NULL;
if(next_hop != NULL) {
/* Look for the next hop of the route in the neighbor cache.
Add a cache entry if we can't find it. */
nbc = uip_nd6_nbrcache_lookup(next_hop);
if(nbc == NULL) {
nbc = uip_nd6_nbrcache_add(next_hop, NULL, 1, NO_STATE);
}
} else {
#endif /* UIP_CONF_ROUTER */
/* No route found, check if a default router exists and use it then. */
dr = uip_nd6_choose_defrouter();
if(dr != NULL){
nbc = dr->nb;
} else {
/* shall we send a icmp error message destination unreachable ?*/
UIP_LOG("tcpip_ipv6_output: Destination off-link but no router");
uip_len = 0;
return;
}
#if UIP_CONF_ROUTER
}
#endif /* UIP_CONF_ROUTER */
}
/* there are two cases where the entry logically does not exist:
* 1 it really does not exist. 2 it is in the NO_STATE state */
if (nbc == NULL || nbc->state == NO_STATE) {
if (nbc == NULL) {
/* create neighbor cache entry, original packet is replaced by NS*/
nbc = uip_nd6_nbrcache_add(&UIP_IP_BUF->destipaddr, NULL, 0, INCOMPLETE);
} else {
nbc->state = INCOMPLETE;
}
#if UIP_CONF_IPV6_QUEUE_PKT
/* copy outgoing pkt in the queuing buffer for later transmmit */
memcpy(nbc->queue_buf, UIP_IP_BUF, uip_len);
nbc->queue_buf_len = uip_len;
#endif
/* RFC4861, 7.2.2:
* "If the source address of the packet prompting the solicitation is the
* same as one of the addresses assigned to the outgoing interface, that
* address SHOULD be placed in the IP Source Address of the outgoing
* solicitation. Otherwise, any one of the addresses assigned to the
* interface should be used."*/
if(uip_netif_is_addr_my_unicast(&UIP_IP_BUF->srcipaddr)){
uip_nd6_io_ns_output(&UIP_IP_BUF->srcipaddr, NULL, &nbc->ipaddr);
} else {
uip_nd6_io_ns_output(NULL, NULL, &nbc->ipaddr);
}
stimer_set(&(nbc->last_send),
uip_netif_physical_if.retrans_timer / 1000);
nbc->count_send = 1;
} else {
if (nbc->state == INCOMPLETE){
PRINTF("tcpip_ipv6_output: neighbor cache entry incomplete\n");
#if UIP_CONF_IPV6_QUEUE_PKT
/* copy outgoing pkt in the queuing buffer for later transmmit and set
the destination neighbor to nbc */
memcpy(nbc->queue_buf, UIP_IP_BUF, uip_len);
nbc->queue_buf_len = uip_len;
uip_len = 0;
#endif /*UIP_CONF_IPV6_QUEUE_PKT*/
return;
}
/* if running NUD (nbc->state == STALE, DELAY, or PROBE ) keep
sending in parallel see rfc 4861 Node behavior in section 7.7.3*/
//.........这里部分代码省略.........