• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ queuebuf_free函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中queuebuf_free函数的典型用法代码示例。如果您正苦于以下问题:C++ queuebuf_free函数的具体用法?C++ queuebuf_free怎么用?C++ queuebuf_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了queuebuf_free函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: send_broadcast

/*---------------------------------------------------------------------------*/
static void
send_broadcast(mac_callback_t sent, void *ptr)
{
    struct queuebuf *qb;

    qb = queuebuf_new_from_packetbuf();
    if(!qb || (NETSTACK_FRAMER.create() < 0)) {
        PRINTF("coresec-strategy: Did not send broadcast\n");
        if(qb) {
            queuebuf_free(qb);
        }
        sent(ptr, MAC_TX_ERR, 0);
        return;
    }

    prepare_announce();
    adaptivesec_send_command_frame();
    watchdog_periodic();

    queuebuf_to_packetbuf(qb);
    queuebuf_free(qb);
#if WITH_BROADCAST_ENCRYPTION
    {
        uint8_t ignore[ADAPTIVESEC_BROADCAST_MIC_LEN];

        if(packetbuf_attr(PACKETBUF_ATTR_SECURITY_LEVEL) & (1 << 2)) {
            adaptivesec_aead(adaptivesec_group_key, 1, ignore, 1);
        }
    }
#endif /* WITH_BROADCAST_ENCRYPTION */
    NETSTACK_MAC.send(sent, ptr);
}
开发者ID:hpiseth,项目名称:contiki,代码行数:33,代码来源:coresec-strategy.c


示例2: recv_from_ipolite

/*---------------------------------------------------------------------------*/
static void
recv_from_ipolite(struct ipolite_conn *ipolite, const rimeaddr_t *from)
{
    PRINTF("%d.%d: netflood recv_from_ipolite\n",
	   rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]);

  struct netflood_conn *c = (struct netflood_conn *)ipolite;
  struct netflood_hdr hdr;
  uint8_t hops;
  struct queuebuf *queuebuf;

  memcpy(&hdr, packetbuf_dataptr(), sizeof(struct netflood_hdr));
  hops = hdr.hops;

  /* Remember packet if we need to forward it. */
  queuebuf = queuebuf_new_from_packetbuf();

  packetbuf_hdrreduce(sizeof(struct netflood_hdr));
  if(c->u->recv != NULL) {
    if(!(rimeaddr_cmp(&hdr.originator, &c->last_originator) &&
	 hdr.originator_seqno <= c->last_originator_seqno)) {

      if(c->u->recv(c, from, &hdr.originator, hdr.originator_seqno,
		    hops)) {
	
	if(queuebuf != NULL) {
	  queuebuf_to_packetbuf(queuebuf);
	  queuebuf_free(queuebuf);
	  queuebuf = NULL;
	  memcpy(&hdr, packetbuf_dataptr(), sizeof(struct netflood_hdr));
	  
	  /* Rebroadcast received packet. */
	  if(hops < HOPS_MAX) {
	    PRINTF("%d.%d: netflood rebroadcasting %d.%d/%d (%d.%d/%d) hops %d\n",
		   rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
		   hdr.originator.u8[0], hdr.originator.u8[1],
		   hdr.originator_seqno,
		   c->last_originator.u8[0], c->last_originator.u8[1],
		   c->last_originator_seqno,
		  hops);
	    hdr.hops++;
	    memcpy(packetbuf_dataptr(), &hdr, sizeof(struct netflood_hdr));
	    send(c);
	    rimeaddr_copy(&c->last_originator, &hdr.originator);
	    c->last_originator_seqno = hdr.originator_seqno;
	  }
	}
      }
    }
  }
  if(queuebuf != NULL) {
    queuebuf_free(queuebuf);
  }
}
开发者ID:persuader72,项目名称:contiki,代码行数:55,代码来源:netflood.c


示例3: data_packet_forward

/*---------------------------------------------------------------------------*/
static rimeaddr_t *
data_packet_forward(struct multihop_conn *multihop,
		    const rimeaddr_t *originator,
		    const rimeaddr_t *dest,
		    const rimeaddr_t *prevhop, uint8_t hops)
{
  struct route_entry *rt;
  struct mesh_conn *c = (struct mesh_conn *)
    ((char *)multihop - offsetof(struct mesh_conn, multihop));

  rt = route_lookup(dest);
  if(rt == NULL) {
    if(c->queued_data != NULL) {
      queuebuf_free(c->queued_data);
    }

    PRINTF("data_packet_forward: queueing data, sending rreq\n");
    c->queued_data = queuebuf_new_from_packetbuf();
    rimeaddr_copy(&c->queued_data_dest, dest);
    route_discovery_discover(&c->route_discovery_conn, dest, PACKET_TIMEOUT);

    return NULL;
  } else {
    route_refresh(rt);
  }
  
  return &rt->R_next_addr;
}
开发者ID:adrianhihi,项目名称:LOADng,代码行数:29,代码来源:mesh.backup.c


示例4: found_route

/*---------------------------------------------------------------------------*/
static void
found_route(struct route_discovery_conn *rdc, const rimeaddr_t *dest)
{
  struct route_entry *rt;
  struct mesh_conn *c = (struct mesh_conn *)
    ((char *)rdc - offsetof(struct mesh_conn, route_discovery_conn));

  PRINTF("found_route\n");

  if(c->queued_data != NULL &&
     rimeaddr_cmp(dest, &c->queued_data_dest)) {
    queuebuf_to_packetbuf(c->queued_data);
    queuebuf_free(c->queued_data);
    c->queued_data = NULL;

    rt = route_lookup(dest);
    if(rt != NULL) {
      multihop_resend(&c->multihop, &rt->R_next_addr);
      if(c->cb->sent != NULL) {
        c->cb->sent(c);
      }
    } else {
      if(c->cb->timedout != NULL) {
        c->cb->timedout(c);
      }
    }
  }
}
开发者ID:adrianhihi,项目名称:LOADng,代码行数:29,代码来源:mesh.backup.c


示例5: mesh_send

/*---------------------------------------------------------------------------*/
int
mesh_send(struct mesh_conn *c, const rimeaddr_t *to)
{
  int could_send;

  PRINTF("%d.%d: mesh_send to %d.%d\n",
	 rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
	 to->u8[0], to->u8[1]);
  
  could_send = multihop_send(&c->multihop, to);

  if(!could_send) {
    if(c->queued_data != NULL) {
      queuebuf_free(c->queued_data);
    }

    PRINTF("mesh_send: queueing data, sending rreq\n");
    c->queued_data = queuebuf_new_from_packetbuf();
    rimeaddr_copy(&c->queued_data_dest, to);
    route_discovery_discover(&c->route_discovery_conn, to,
			     PACKET_TIMEOUT);
    return 0;
  }
  c->cb->sent(c);
  return 1;
}
开发者ID:Dawooga,项目名称:contiki-jn51xx-1,代码行数:27,代码来源:mesh.c


示例6: free_packet

/*---------------------------------------------------------------------------*/
static void
free_packet(struct neighbor_queue *n, struct rdc_buf_list *p, int status)
{
  if(p != NULL) {
    /* Remove packet from list and deallocate */
    list_remove(n->queued_packet_list, p);

    queuebuf_free(p->buf);
    memb_free(&metadata_memb, p->ptr);
    memb_free(&packet_memb, p);
    PRINTF("csma: free_queued_packet, queue length %d, free packets %d\n",
           list_length(n->queued_packet_list), memb_numfree(&packet_memb));
    if(list_head(n->queued_packet_list) != NULL) {
      /* There is a next packet. We reset current tx information */
      n->transmissions = 0;
      n->collisions = CSMA_MIN_BE;
      /* Schedule next transmissions */
      schedule_transmission(n);
    } else {
      /* This was the last packet in the queue, we free the neighbor */
      ctimer_stop(&n->transmit_timer);
      list_remove(neighbor_list, n);
      memb_free(&neighbor_memb, n);
    }
  }
}
开发者ID:cetic,项目名称:6lbr,代码行数:27,代码来源:csma.c


示例7: recv

/*---------------------------------------------------------------------------*/
static void
recv(struct broadcast_conn *broadcast, const linkaddr_t *from)
{
  struct ipolite_conn *c = (struct ipolite_conn *)broadcast;
  if(c->q != NULL &&
     packetbuf_datalen() == queuebuf_datalen(c->q) &&
     memcmp(packetbuf_dataptr(), queuebuf_dataptr(c->q),
	    MIN(c->hdrsize, packetbuf_datalen())) == 0) {
    /* We received a copy of our own packet, so we increase the
       duplicate counter. If it reaches its maximum, do not send out
       our packet. */
    c->dups++;
    if(c->dups == c->maxdups) {
      queuebuf_free(c->q);
      c->q = NULL;
      ctimer_stop(&c->t);
      if(c->cb->dropped) {
        c->cb->dropped(c);
      }
    }
  }
  if(c->cb->recv) {
    c->cb->recv(c, from);
  }
}
开发者ID:Anagalcala,项目名称:contiki-upstream-unstable,代码行数:26,代码来源:ipolite.c


示例8: stunicast_send_stubborn

/*---------------------------------------------------------------------------*/
int
stunicast_send_stubborn(struct stunicast_conn *c, const rimeaddr_t *receiver,
		  clock_time_t rxmittime)
{
  if(c->buf != NULL) {
    queuebuf_free(c->buf);
  }
  c->buf = queuebuf_new_from_packetbuf();
  if(c->buf == NULL) {
    return 0;
  }
  rimeaddr_copy(&c->receiver, receiver);
  ctimer_set(&c->t, rxmittime, send, c);

  PRINTF("%d.%d: stunicast_send_stubborn to %d.%d\n",
	 rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
	 c->receiver.u8[0],c->receiver.u8[1]);
  unicast_send(&c->c, &c->receiver);
  /*  if(c->u->sent != NULL) {
    c->u->sent(c);
    }*/
  
  return 1;
  
}
开发者ID:Sowhat2112,项目名称:KreyosFirmware,代码行数:26,代码来源:stunicast.c


示例9: ipolite_send

/*---------------------------------------------------------------------------*/
int
ipolite_send(struct ipolite_conn *c, clock_time_t interval, uint8_t hdrsize)
{
  if(c->q != NULL) {
    /* If we are already about to send a packet, we cancel the old one. */
    PRINTF("%d.%d: ipolite_send: cancel old send\n",
	   rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]);
    queuebuf_free(c->q);
  }
  c->dups = 0;
  c->hdrsize = hdrsize;
  if(interval == 0) {
    PRINTF("%d.%d: ipolite_send: interval 0\n",
	   rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]);
    if(broadcast_send(&c->c)) {
      if(c->cb->sent) {
	c->cb->sent(c);
      }
      return 1;
    }

  } else {
    c->q = queuebuf_new_from_packetbuf();
    if(c->q != NULL) {
      ctimer_set(&c->t,
		 interval / 2 + (random_rand() % (interval / 2)),
		 send, c);
      return 1;
    }
    PRINTF("%d.%d: ipolite_send: could not allocate queue buffer\n",
	   rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]);
  }
  return 0;
}
开发者ID:Sowhat2112,项目名称:KreyosFirmware,代码行数:35,代码来源:ipolite.c


示例10: free_packet

/*---------------------------------------------------------------------------*/
static void
free_packet(struct net_buf *buf, struct neighbor_queue *n, struct rdc_buf_list *p)
{
  if(p != NULL) {
    /* Remove packet from list and deallocate */
    list_remove(n->queued_packet_list, p);

    queuebuf_free(p->buf);
    memb_free(&metadata_memb, p->ptr);
    memb_free(&packet_memb, p);
    PRINTF("csma: free_queued_packet, queue length %d, free packets %d\n",
           list_length(n->queued_packet_list), memb_numfree(&packet_memb));
    if(list_head(n->queued_packet_list) != NULL) {
      /* There is a next packet. We reset current tx information */
      n->transmissions = 0;
      n->collisions = 0;
      n->deferrals = 0;
      transmit_packet_list(buf, n);
    } else {
      /* This was the last packet in the queue, we free the neighbor */
      list_remove(uip_neighbor_list(buf), n);
      memb_free(&neighbor_memb, n);
    }
  }
}
开发者ID:32bitmicro,项目名称:zephyr,代码行数:26,代码来源:csma.c


示例11: free_packet

/*---------------------------------------------------------------------------*/
static void
free_packet(struct neighbor_queue *n, struct rdc_buf_list *p)
{
  if(p != NULL) {
    /* Remove packet from list and deallocate */
    list_remove(n->queued_packet_list, p);

    queuebuf_free(p->buf);
    memb_free(&metadata_memb, p->ptr);
    memb_free(&packet_memb, p);
    PRINTF("csma: free_queued_packet, queue length %d\n",
        list_length(n->queued_packet_list));
    if(list_head(n->queued_packet_list) != NULL) {
      /* There is a next packet. We reset current tx information */
      n->transmissions = 0;
      n->collisions = 0;
      n->deferrals = 0;
      /* Set a timer for next transmissions */
      ctimer_set(&n->transmit_timer, default_timebase(),
                 transmit_packet_list, n);
    } else {
      /* This was the last packet in the queue, we free the neighbor */
      ctimer_stop(&n->transmit_timer);
      list_remove(neighbor_list, n);
      memb_free(&neighbor_memb, n);
    }
  }
}
开发者ID:AlexandreRio,项目名称:contiki,代码行数:29,代码来源:csma.c


示例12: tsch_queue_free_packet

/* Free a packet */
void
tsch_queue_free_packet(struct tsch_packet *p)
{
  if(p != NULL) {
    queuebuf_free(p->qb);
    memb_free(&packet_memb, p);
  }
}
开发者ID:Avinash95,项目名称:contiki,代码行数:9,代码来源:tsch-queue.c


示例13: polite_cancel

/*---------------------------------------------------------------------------*/
void
polite_cancel(struct polite_conn *c)
{
  ctimer_stop(&c->t);
  if(c->q != NULL) {
    queuebuf_free(c->q);
    c->q = NULL;
  }
}
开发者ID:EmuxEvans,项目名称:calipso,代码行数:10,代码来源:polite.c


示例14: stunicast_cancel

/*---------------------------------------------------------------------------*/
void
stunicast_cancel(struct stunicast_conn *c)
{
  ctimer_stop(&c->t);
  if(c->buf != NULL) {
    queuebuf_free(c->buf);
    c->buf = NULL;
  }
}
开发者ID:Sowhat2112,项目名称:KreyosFirmware,代码行数:10,代码来源:stunicast.c


示例15: ipolite_close

/*---------------------------------------------------------------------------*/
void
ipolite_close(struct ipolite_conn *c)
{
  broadcast_close(&c->c);
  ctimer_stop(&c->t);
  if(c->q != NULL) {
    queuebuf_free(c->q);
    c->q = NULL;
  }
}
开发者ID:Anagalcala,项目名称:contiki-upstream-unstable,代码行数:11,代码来源:ipolite.c


示例16: polite_close

/*---------------------------------------------------------------------------*/
void
polite_close(struct polite_conn *c)
{
  abc_close(&c->c);
  ctimer_stop(&c->t);
  if(c->q != NULL) {
    queuebuf_free(c->q);
    c->q = NULL;
  }
}
开发者ID:EmuxEvans,项目名称:calipso,代码行数:11,代码来源:polite.c


示例17: timedout

/*---------------------------------------------------------------------------*/
static void
timedout(struct route_discovery_conn *c)
{
  PRINTF("uip-over-mesh: packet timed out\n");
  if(queued_packet) {
    PRINTF("uip-over-mesh: freeing queued packet\n");
    queuebuf_free(queued_packet);
    queued_packet = NULL;
  }
}
开发者ID:exziled,项目名称:WeatherSystem,代码行数:11,代码来源:uip-over-mesh.c


示例18: remove_queued_packet

/*---------------------------------------------------------------------------*/
static void
remove_queued_packet(void *item)
{
    struct packetqueue_item *i = item;
    struct packetqueue *q = i->queue;

    list_remove(*q->list, i);
    queuebuf_free(i->buf);
    ctimer_stop(&i->lifetimer);
    memb_free(q->memb, i);
    /*  printf("removing queued packet due to timeout\n");*/
}
开发者ID:aiss83,项目名称:nucbit,代码行数:13,代码来源:packetqueue.c


示例19: packetqueue_dequeue

/*---------------------------------------------------------------------------*/
void
packetqueue_dequeue(struct packetqueue *q)
{
	struct packetqueue_item *i;

	i = list_head(*q->list);
	if(i != NULL) {
		list_remove(*q->list, i);
		queuebuf_free(i->buf);
		ctimer_stop(&i->lifetimer);
		memb_free(q->memb, i);
	}
}
开发者ID:martinabr,项目名称:laneflood,代码行数:14,代码来源:packetqueue.c


示例20: found_route

/*---------------------------------------------------------------------------*/
static void
found_route(struct route_discovery_conn *rdc, rimeaddr_t *dest)
{
  struct mesh_conn *c = (struct mesh_conn *)
    ((char *)rdc - offsetof(struct mesh_conn, route_discovery_conn));

  if(c->queued_data != NULL &&
     rimeaddr_cmp(dest, &c->queued_data_dest)) {
    queuebuf_to_packetbuf(c->queued_data);
    queuebuf_free(c->queued_data);
    c->queued_data = NULL;
    multihop_send(&c->multihop, dest);
  }
}
开发者ID:EDAyele,项目名称:ptunes,代码行数:15,代码来源:mesh.c



注:本文中的queuebuf_free函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ queuebuf_to_packetbuf函数代码示例发布时间:2022-05-30
下一篇:
C++ queue_work_on函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap