亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? pbuf.c

?? FreeRtos Source code Version 4.04
?? C
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
pbuf_ref(struct pbuf *p)
{
  SYS_ARCH_DECL_PROTECT(old_level);
  /* pbuf given? */
  if (p != NULL) {
    SYS_ARCH_PROTECT(old_level);
    ++(p->ref);
    SYS_ARCH_UNPROTECT(old_level);
  }
}

/**
 * Concatenate two pbufs (each may be a pbuf chain) and take over
 * the caller's reference of the tail pbuf.
 * 
 * @note The caller MAY NOT reference the tail pbuf afterwards.
 * Use pbuf_chain() for that purpose.
 * 
 * @see pbuf_chain()
 */

void
pbuf_cat(struct pbuf *h, struct pbuf *t)
{
  struct pbuf *p;

  LWIP_ASSERT("h != NULL (programmer violates API)", h != NULL);
  LWIP_ASSERT("t != NULL (programmer violates API)", t != NULL);
  if ((h == NULL) || (t == NULL)) return;

  /* proceed to last pbuf of chain */
  for (p = h; p->next != NULL; p = p->next) {
    /* add total length of second chain to all totals of first chain */
    p->tot_len += t->tot_len;
  }
  /* { p is last pbuf of first h chain, p->next == NULL } */
  LWIP_ASSERT("p->tot_len == p->len (of last pbuf in chain)", p->tot_len == p->len);
  LWIP_ASSERT("p->next == NULL", p->next == NULL);
  /* add total length of second chain to last pbuf total of first chain */
  p->tot_len += t->tot_len;
  /* chain last pbuf of head (p) with first of tail (t) */
  p->next = t;
  /* p->next now references t, but the caller will drop its reference to t,
   * so netto there is no change to the reference count of t.
   */
}

/**
 * Chain two pbufs (or pbuf chains) together.
 * 
 * The caller MUST call pbuf_free(t) once it has stopped
 * using it. Use pbuf_cat() instead if you no longer use t.
 * 
 * @param h head pbuf (chain)
 * @param t tail pbuf (chain)
 * @note The pbufs MUST belong to the same packet.
 * @note MAY NOT be called on a packet queue.
 *
 * The ->tot_len fields of all pbufs of the head chain are adjusted.
 * The ->next field of the last pbuf of the head chain is adjusted.
 * The ->ref field of the first pbuf of the tail chain is adjusted.
 *
 */
void
pbuf_chain(struct pbuf *h, struct pbuf *t)
{
  pbuf_cat(h, t);
  /* t is now referenced by h */
  pbuf_ref(t);
  LWIP_DEBUGF(PBUF_DEBUG | DBG_FRESH | 2, ("pbuf_chain: %p references %p\n", (void *)h, (void *)t));
}

/* For packet queueing. Note that queued packets MUST be dequeued first
 * using pbuf_dequeue() before calling other pbuf_() functions. */
#if ARP_QUEUEING
/**
 * Add a packet to the end of a queue.
 *
 * @param q pointer to first packet on the queue
 * @param n packet to be queued
 *
 * Both packets MUST be given, and must be different.
 */
void
pbuf_queue(struct pbuf *p, struct pbuf *n)
{
#if PBUF_DEBUG /* remember head of queue */
  struct pbuf *q = p;
#endif
  /* programmer stupidity checks */
  LWIP_ASSERT("p == NULL in pbuf_queue: this indicates a programmer error\n", p != NULL);
  LWIP_ASSERT("n == NULL in pbuf_queue: this indicates a programmer error\n", n != NULL);
  LWIP_ASSERT("p == n in pbuf_queue: this indicates a programmer error\n", p != n);
  if ((p == NULL) || (n == NULL) || (p == n)){
    LWIP_DEBUGF(PBUF_DEBUG | DBG_HALT | 3, ("pbuf_queue: programmer argument error\n"))
    return;
  }

  /* iterate through all packets on queue */
  while (p->next != NULL) {
/* be very picky about pbuf chain correctness */
#if PBUF_DEBUG
    /* iterate through all pbufs in packet */
    while (p->tot_len != p->len) {
      /* make sure invariant condition holds */
      LWIP_ASSERT("p->len < p->tot_len", p->len < p->tot_len);
      /* make sure each packet is complete */
      LWIP_ASSERT("p->next != NULL", p->next != NULL);
      p = p->next;
      /* { p->tot_len == p->len => p is last pbuf of a packet } */
    }
    /* { p is last pbuf of a packet } */
    /* proceed to next packet on queue */
#endif
    /* proceed to next pbuf */
    if (p->next != NULL) p = p->next;
  }
  /* { p->tot_len == p->len and p->next == NULL } ==>
   * { p is last pbuf of last packet on queue } */
  /* chain last pbuf of queue with n */
  p->next = n;
  /* n is now referenced to by the (packet p in the) queue */
  pbuf_ref(n);
#if PBUF_DEBUG
  LWIP_DEBUGF(PBUF_DEBUG | DBG_FRESH | 2,
    ("pbuf_queue: newly queued packet %p sits after packet %p in queue %p\n",
    (void *)n, (void *)p, (void *)q));
#endif
}

/**
 * Remove a packet from the head of a queue.
 *
 * The caller MUST reference the remainder of the queue (as returned). The
 * caller MUST NOT call pbuf_ref() as it implicitly takes over the reference
 * from p.
 * 
 * @param p pointer to first packet on the queue which will be dequeued.
 * @return first packet on the remaining queue (NULL if no further packets).
 *
 */
struct pbuf *
pbuf_dequeue(struct pbuf *p)
{
  struct pbuf *q;
  LWIP_ASSERT("p != NULL", p != NULL);

  /* iterate through all pbufs in packet p */
  while (p->tot_len != p->len) {
    /* make sure invariant condition holds */
    LWIP_ASSERT("p->len < p->tot_len", p->len < p->tot_len);
    /* make sure each packet is complete */
    LWIP_ASSERT("p->next != NULL", p->next != NULL);
    p = p->next;
  }
  /* { p->tot_len == p->len } => p is the last pbuf of the first packet */
  /* remember next packet on queue in q */
  q = p->next;
  /* dequeue packet p from queue */
  p->next = NULL;
  /* any next packet on queue? */
  if (q != NULL) {
    /* although q is no longer referenced by p, it MUST be referenced by
     * the caller, who is maintaining this packet queue. So, we do not call
     * pbuf_free(q) here, resulting in an implicit pbuf_ref(q) for the caller. */
    LWIP_DEBUGF(PBUF_DEBUG | DBG_FRESH | 2, ("pbuf_dequeue: first remaining packet on queue is %p\n", (void *)q));
  } else {
    LWIP_DEBUGF(PBUF_DEBUG | DBG_FRESH | 2, ("pbuf_dequeue: no further packets on queue\n"));
  }
  return q;
}
#endif

/**
 *
 * Create PBUF_POOL (or PBUF_RAM) copies of PBUF_REF pbufs.
 *
 * Used to queue packets on behalf of the lwIP stack, such as
 * ARP based queueing.
 *
 * Go through a pbuf chain and replace any PBUF_REF buffers
 * with PBUF_POOL (or PBUF_RAM) pbufs, each taking a copy of
 * the referenced data.
 *
 * @note You MUST explicitly use p = pbuf_take(p);
 * The pbuf you give as argument, may have been replaced
 * by a (differently located) copy through pbuf_take()!
 *
 * @note Any replaced pbufs will be freed through pbuf_free().
 * This may deallocate them if they become no longer referenced.
 *
 * @param p Head of pbuf chain to process
 *
 * @return Pointer to head of pbuf chain
 */
struct pbuf *
pbuf_take(struct pbuf *p)
{
  struct pbuf *q , *prev, *head;
  LWIP_ASSERT("pbuf_take: p != NULL\n", p != NULL);
  LWIP_DEBUGF(PBUF_DEBUG | DBG_TRACE | 3, ("pbuf_take(%p)\n", (void*)p));

  prev = NULL;
  head = p;
  /* iterate through pbuf chain */
  do
  {
    /* pbuf is of type PBUF_REF? */
    if (p->flags == PBUF_FLAG_REF) {
      LWIP_DEBUGF(PBUF_DEBUG | DBG_TRACE, ("pbuf_take: encountered PBUF_REF %p\n", (void *)p));
      /* allocate a pbuf (w/ payload) fully in RAM */
      /* PBUF_POOL buffers are faster if we can use them */
      if (p->len <= PBUF_POOL_BUFSIZE) {
        q = pbuf_alloc(PBUF_RAW, p->len, PBUF_POOL);
        if (q == NULL) {
          LWIP_DEBUGF(PBUF_DEBUG | DBG_TRACE | 2, ("pbuf_take: Could not allocate PBUF_POOL\n"));
        }
      } else {
        /* no replacement pbuf yet */
        q = NULL;
        LWIP_DEBUGF(PBUF_DEBUG | DBG_TRACE | 2, ("pbuf_take: PBUF_POOL too small to replace PBUF_REF\n"));
      }
      /* no (large enough) PBUF_POOL was available? retry with PBUF_RAM */
      if (q == NULL) {
        q = pbuf_alloc(PBUF_RAW, p->len, PBUF_RAM);
        if (q == NULL) {
          LWIP_DEBUGF(PBUF_DEBUG | DBG_TRACE | 2, ("pbuf_take: Could not allocate PBUF_RAM\n"));
        }
      }
      /* replacement pbuf could be allocated? */
      if (q != NULL)
      {
        /* copy p to q */
        /* copy successor */
        q->next = p->next;
        /* remove linkage from original pbuf */
        p->next = NULL;
        /* remove linkage to original pbuf */
        if (prev != NULL) {
          /* prev->next == p at this point */
          LWIP_ASSERT("prev->next == p", prev->next == p);
          /* break chain and insert new pbuf instead */
          prev->next = q;
        /* prev == NULL, so we replaced the head pbuf of the chain */
        } else {
          head = q;
        }
        /* copy pbuf payload */
        memcpy(q->payload, p->payload, p->len);
        q->tot_len = p->tot_len;
        q->len = p->len;
        /* in case p was the first pbuf, it is no longer refered to by
         * our caller, as the caller MUST do p = pbuf_take(p);
         * in case p was not the first pbuf, it is no longer refered to
         * by prev. we can safely free the pbuf here.
         * (note that we have set p->next to NULL already so that
         * we will not free the rest of the chain by accident.)
         */
        pbuf_free(p);
        /* do not copy ref, since someone else might be using the old buffer */
        LWIP_DEBUGF(PBUF_DEBUG, ("pbuf_take: replaced PBUF_REF %p with %p\n", (void *)p, (void *)q));
        p = q;
      } else {
        /* deallocate chain */
        pbuf_free(head);
        LWIP_DEBUGF(PBUF_DEBUG | 2, ("pbuf_take: failed to allocate replacement pbuf for %p\n", (void *)p));
        return NULL;
      }
    /* p->flags != PBUF_FLAG_REF */
    } else {
      LWIP_DEBUGF(PBUF_DEBUG | DBG_TRACE | 1, ("pbuf_take: skipping pbuf not of type PBUF_REF\n"));
    }
    /* remember this pbuf */
    prev = p;
    /* proceed to next pbuf in original chain */
    p = p->next;
  } while (p);
  LWIP_DEBUGF(PBUF_DEBUG | DBG_TRACE | 1, ("pbuf_take: end of chain reached.\n"));

  return head;
}

/**
 * Dechains the first pbuf from its succeeding pbufs in the chain.
 *
 * Makes p->tot_len field equal to p->len.
 * @param p pbuf to dechain
 * @return remainder of the pbuf chain, or NULL if it was de-allocated.
 * @note May not be called on a packet queue.
 */
struct pbuf *
pbuf_dechain(struct pbuf *p)
{
  struct pbuf *q;
  u8_t tail_gone = 1;
  /* tail */
  q = p->next;
  /* pbuf has successor in chain? */
  if (q != NULL) {
    /* assert tot_len invariant: (p->tot_len == p->len + (p->next? p->next->tot_len: 0) */
    LWIP_ASSERT("p->tot_len == p->len + q->tot_len", q->tot_len == p->tot_len - p->len);
    /* enforce invariant if assertion is disabled */
    q->tot_len = p->tot_len - p->len;
    /* decouple pbuf from remainder */
    p->next = NULL;
    /* total length of pbuf p is its own length only */
    p->tot_len = p->len;
    /* q is no longer referenced by p, free it */
    LWIP_DEBUGF(PBUF_DEBUG | DBG_STATE, ("pbuf_dechain: unreferencing %p\n", (void *)q));
    tail_gone = pbuf_free(q);
    if (tail_gone > 0) {
      LWIP_DEBUGF(PBUF_DEBUG | DBG_STATE,
                  ("pbuf_dechain: deallocated %p (as it is no longer referenced)\n", (void *)q));
    }
    /* return remaining tail or NULL if deallocated */
  }
  /* assert tot_len invariant: (p->tot_len == p->len + (p->next? p->next->tot_len: 0) */
  LWIP_ASSERT("p->tot_len == p->len", p->tot_len == p->len);
  return (tail_gone > 0? NULL: q);
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩女优电影在线观看| 国产网红主播福利一区二区| 国产一区二区三区不卡在线观看 | 激情久久五月天| 亚洲男女一区二区三区| 精品国产91亚洲一区二区三区婷婷| 波波电影院一区二区三区| 蜜臂av日日欢夜夜爽一区| 亚洲激情在线激情| 中文成人综合网| 欧美tickling挠脚心丨vk| 欧美性xxxxxxxx| hitomi一区二区三区精品| 激情久久五月天| 美女免费视频一区二区| 亚洲无人区一区| 亚洲欧洲日韩一区二区三区| 久久亚洲一级片| 日韩亚洲欧美综合| 精品视频1区2区3区| 91在线小视频| 不卡一卡二卡三乱码免费网站| 国产在线乱码一区二区三区| 在线视频欧美精品| 从欧美一区二区三区| 国产一区二区三区在线观看免费视频 | 日韩国产欧美在线观看| 亚洲另类一区二区| 亚洲九九爱视频| 亚洲欧美色图小说| 1区2区3区欧美| 国产精品乱人伦中文| 久久午夜电影网| 久久人人超碰精品| 久久蜜桃一区二区| 久久这里都是精品| 久久精品一二三| 国产日产亚洲精品系列| 国产欧美日本一区视频| 国产日产欧美一区二区视频| 国产欧美一二三区| 国产精品无码永久免费888| 久久影院视频免费| 国产清纯在线一区二区www| 国产亚洲欧洲997久久综合| 久久久久久久久久久久电影| 日本一区二区三区久久久久久久久不| 亚洲精品一线二线三线| 国产欧美日韩久久| 国产精品另类一区| 亚洲九九爱视频| 亚洲国产视频直播| 琪琪一区二区三区| 国产美女精品人人做人人爽 | 91成人免费在线视频| 色综合欧美在线| 欧美日韩国产一区二区三区地区| 欧美二区乱c少妇| 欧美变态口味重另类| 国产亚洲欧美激情| 亚洲免费伊人电影| 丝袜亚洲另类丝袜在线| 久99久精品视频免费观看| 丁香亚洲综合激情啪啪综合| 99re成人精品视频| 欧美精品tushy高清| xf在线a精品一区二区视频网站| 欧美国产一区视频在线观看| 亚洲精品高清在线观看| 日本不卡123| 丁香网亚洲国际| 欧美性猛交xxxx乱大交退制版 | 91亚洲国产成人精品一区二区三| 色伊人久久综合中文字幕| 337p亚洲精品色噜噜噜| 久久综合九色综合97婷婷| 亚洲欧美日韩成人高清在线一区| 午夜伊人狠狠久久| 国产成人精品亚洲午夜麻豆| 在线视频中文字幕一区二区| 精品久久一区二区| 亚洲天堂a在线| 麻豆91在线播放| 99re成人精品视频| 欧美va天堂va视频va在线| 亚洲另类一区二区| 激情图片小说一区| 欧美视频三区在线播放| 久久久91精品国产一区二区精品 | 一区二区三区日韩在线观看| 久久se精品一区精品二区| 972aa.com艺术欧美| 精品国产区一区| 亚洲午夜电影网| 丰满岳乱妇一区二区三区| 91麻豆精品国产综合久久久久久| 中文字幕一区二区三区在线不卡| 蜜臀久久久久久久| 在线观看日韩高清av| 久久久91精品国产一区二区三区| 亚洲图片一区二区| av电影天堂一区二区在线| 欧美大片在线观看一区| 亚洲香肠在线观看| 成人avav在线| 精品av综合导航| 日本伊人色综合网| 91成人看片片| 亚洲免费在线视频一区 二区| 国产成人综合亚洲91猫咪| 91精选在线观看| 亚洲国产一区在线观看| 色婷婷亚洲婷婷| 国产精品天天看| 国产成人精品一区二区三区四区| 日韩午夜av电影| 日韩精品一区第一页| 在线观看免费视频综合| 中文字幕一区日韩精品欧美| 国产69精品久久777的优势| 欧美电影免费观看高清完整版在线观看| 亚洲二区视频在线| 欧美视频在线一区二区三区| 亚洲精品国产第一综合99久久| av一区二区三区| 中文字幕五月欧美| 成人动漫精品一区二区| 亚洲国产成人在线| 丁香天五香天堂综合| 国产视频一区在线播放| 国产成人在线色| 国产亲近乱来精品视频| 福利91精品一区二区三区| 国产欧美一区二区三区网站| 国产成人三级在线观看| 国产午夜三级一区二区三| 国产精品18久久久久久久久久久久 | 日韩电影在线观看电影| 欧美精选午夜久久久乱码6080| 午夜精品久久一牛影视| 欧美日韩aaa| 蜜桃视频在线观看一区二区| 精品国产免费一区二区三区四区| 久久成人18免费观看| 久久久三级国产网站| 国产盗摄一区二区| 自拍偷拍国产亚洲| 欧美日韩一级片在线观看| 偷拍自拍另类欧美| 日韩精品中文字幕在线不卡尤物| 美脚の诱脚舐め脚责91| 久久亚洲影视婷婷| 99久久免费国产| 亚洲观看高清完整版在线观看| 制服丝袜在线91| 激情成人午夜视频| 最新国产成人在线观看| 欧美亚洲动漫精品| 麻豆国产欧美日韩综合精品二区 | 色综合久久久久综合99| 亚洲成人在线观看视频| 日韩美女天天操| 99久久久精品| 日韩精品福利网| 国产亚洲欧美色| 在线精品视频免费观看| 美女视频黄频大全不卡视频在线播放| 欧美mv日韩mv国产网站| 成人av电影免费观看| 色哟哟一区二区| 日本麻豆一区二区三区视频| 亚洲国产精品成人综合色在线婷婷 | 蜜臀va亚洲va欧美va天堂| 久久天堂av综合合色蜜桃网| caoporen国产精品视频| 三级不卡在线观看| 国产精品欧美一级免费| 欧美精品18+| 成人免费看片app下载| 亚洲成在线观看| 国产日韩影视精品| 欧美日韩国产乱码电影| 国产成人h网站| 日韩电影在线免费| 中文字幕一区二区三区蜜月 | 99视频超级精品| 蜜桃av一区二区三区| 最新日韩av在线| 精品久久免费看| 欧美日韩亚洲丝袜制服| 成人综合婷婷国产精品久久蜜臀 | 日韩理论电影院| 欧美成人综合网站| 在线观看一区二区视频| 国产精品小仙女| 蜜桃久久精品一区二区| 一区二区三区鲁丝不卡| 国产校园另类小说区| 91精品国产综合久久久久久久| 91年精品国产|