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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? netbuf.c

?? 一個tcp/ip協議棧,帶有PPP、IP、TCP、UDP等協議
?? C
?? 第 1 頁 / 共 3 頁
字號:
                }
                nDst->nextBuf = nTmp;
                nDst = nTmp;
            }
                
            /* Copy it and advance to the next source buffer if needed. */
            memcpy(&nDst->data[nDst->len], &nSrc->data[off0], copySz);
#if STATS_SUPPORT > 0
            if ((nTop->chainLen += copySz) > nBufStats.maxChainLen.val)
                nBufStats.maxChainLen.val = nTop->chainLen;
#else
            nTop->chainLen += copySz;
#endif
            nDst->len += copySz;
            st += copySz;
            len -= copySz;
            off0 = 0;
            nSrc = nSrc->nextBuf;
        }
    }
    
    return st;
}


/*
 * nAppendFromQ - Append data from a source queue starting from the offset
 * onto the end of the destination chain.
 * Return the number of characters appended.
 */
u_int nAppendFromQ(
    NBuf *nDst,                 /* The destination chain. */
    NBufQHdr *nSrcQ,            /* The source queue. */
    u_int off0,                 /* The starting offset into the source. */
    u_int len                   /* The maximum bytes to copy. */
)
{
    u_int st = 0, copySz;
    NBuf *nDstTop, *nSrc, *nSrcTop, *nTmp;
    
    /* Validate parameters. */
    if (!nDst || !nSrcQ)
        return 0;
    
    /* Find the end of the destination chain. */
    nDstTop = nDst;
    while (nDst->nextBuf)
        nDst = nDst->nextBuf;
        
    /* Find the starting chain in the source queue. */
    for (nSrc = nSrcQ->qHead; nSrc && off0 >= nSrc->chainLen; nSrc = nSrc->nextChain) {
        off0 -= nSrc->chainLen;
    }
    nSrcTop = nSrc;
    
    /* Find the starting position in the source chain. */
    for (; nSrc && off0 >= nSrc->len; nSrc = nSrc->nextBuf) {
        off0 -= nSrc->len;
    }

    while (nSrc && nDst && len) {
        /* 
         * Compute how much to copy from the current source buffer. 
         * Note that since we copy from a single source buffer at a
         * time, we don't have to check that the copy size fits in
         * a single buffer.
         */
        copySz = min(len, nSrc->len - off0);

        /* Append another destination buffer if needed. */
        /* 
         * Note that we don't attempt to fill small spaces at the
         * end of the current destination buffer since on average,
         * we don't expect that it would reduce the number of
         * buffers used and it would complicate and slow the 
         * operation.
         */
        if (nTRAILINGSPACE(nDst) < copySz) {
            nGET(nTmp);
            if (!nTmp) {
                NBUFDEBUG((LOG_ERR, "nAppendFromQ: No free buffers"));
                nDst = NULL;
                break;
            }
            nDst->nextBuf = nTmp;
            nDst = nTmp;
        }
            
        /* Copy it and advance to the next source buffer if needed. */
        memcpy(&nDst->data[nDst->len], &nSrc->data[off0], copySz);
#if STATS_SUPPORT > 0
        if ((nDstTop->chainLen += copySz) > nBufStats.maxChainLen.val)
            nBufStats.maxChainLen.val = nDstTop->chainLen;
#else
        nDstTop->chainLen += copySz;
#endif
        nDst->len += copySz;
        st += copySz;
        len -= copySz;
        off0 = 0;
        if ((nSrc = nSrc->nextBuf) == NULL)
            nSrc = nSrcTop = nSrcTop->nextChain;
            
    }
    
    return st;
}


/*
 * nBufCopy - Return a new nBuf chain containing a copy of up to len bytes of
 * an nBuf chain starting "off0" bytes from the beginning.
 * Return the new chain on success, otherwise NULL. 
 */
NBuf *nBufCopy(
    NBuf *nSrc,                 /* Top of nBuf chain to be copied. */
    u_int off0,                 /* Offset into the nBuf chain's data. */
    u_int len                   /* Maximum bytes to copy. */
)
{
    u_int i;
    NBuf *nTop = NULL, *nDst, *nTmp;
    
    /* Find the starting position in the source chain. */
    for (; nSrc && off0 > nSrc->len; nSrc = nSrc->nextBuf)
        off0 -= nSrc->len;
    
    if (nSrc) {
        nGET(nDst);
        nTop = nDst;
        
        while (nDst && len) {
            /* Compute how much to copy from the current source buffer. */
            i = nSrc->len - off0;
            if (i > len)
                i = len;
            
            /* Copy it and advance to the next buffer if needed. */
            memcpy(nDst->data, &nSrc->data[off0], i);
#if STATS_SUPPORT > 0
            if ((nTop->chainLen += i) > nBufStats.maxChainLen.val)
                nBufStats.maxChainLen.val = nTop->chainLen;
#else
            nTop->chainLen += i;
#endif
            nDst->len = i;
            len -= i;
            off0 = 0;
            nSrc = nSrc->nextBuf;
            if (len && nSrc) {
                nGET(nTmp);
                if (nTmp) {
                    nDst->nextBuf = nTmp;
                    nDst = nTmp;
                } else {
                    NBUFDEBUG((LOG_ERR, "nBufCopy: No free buffers"));
                    (void)nFreeChain(nTop);
                    nTop = NULL;
                }
            } else {
                /*** Let's just break out...
                nDst = NULL;
                ***/
                break;
            }
        }
    }
    return nTop;
}


/*
 * nPullup - Rearange an nBuf chain so that len bytes are contiguous and in
 * the data area of the buffer thereby allowing direct access to a structure
 * of size len. 
 * Return the resulting nBuf chain on success.  On failure, the original
 * nBuf is freed and NULL is returned.
 */
NBuf *nPullup(NBuf *nIn, u_int len)
{
    char *s, *d;
    u_int i;
    NBuf *nTmp, *nPrev, *nNext;
    
    if (!nIn)
        ;
    /* If the required data is already in the first buffer, we're done! */
    else if (nIn->len >= len)
        ;
    /* If the required data won't fit in the first buffer, fail! */
    else if (len > NBUFSZ) {
        (void)nFreeChain(nIn);
        nIn = NULL;
    } else {
        /* If there's not enough space at the end, shift the data to the beginning. */
        if (nTRAILINGSPACE(nIn) < len) {
            s = nBUFTOPTR(nIn, char *);
            d = nIn->data = &nIn->body[0];
            for (i = nIn->len; i > 0; i--)
                *d++ = *s++;
        }
        /* Move the data in from successive buffers. */
        nPrev = nIn;
        nNext = nIn->nextBuf;
        while (len && nNext) {
            i = min(len, nNext->len);
            memcpy(&nIn->data[nIn->len], nNext->data, i);
            nIn->len += i;
            /* If this emptied the buffer, free it. */
            if ((nNext->len -= i) == 0) {
                nTmp = nNext;
                nFREE(nTmp, nNext);
                nPrev->nextBuf = nNext;
            } else {
                nNext->data += i;
            }
            len -= i;
            nPrev = nNext;
            nNext = nNext->nextBuf;
        }
    }
    return nIn;
}


/*
 * nCopyOut - Copy len bytes from an nBuf chain starting from an offset in
 * that chain.
 * Return the number of bytes copied.
 */
u_int nCopyOut(
    char *d,                    /* Destination string. */
    NBuf *n0,                   /* Source nBuf chain. */
    u_int off0,                 /* Offset into the nBuf chain's data. */
    u_int len                   /* Max bytes to copy. */
)
{
    u_int copied = 0, i;
    NBuf *nNext;
    
    /* Find the starting position in the original chain. */
    for (nNext = n0; nNext && off0 > nNext->len; nNext = nNext->nextBuf)
        off0 -= nNext->len;
    
    while (len && nNext) {
        i = min(len, nNext->len - off0);
        memcpy(&d[copied], &nNext->data[off0], i);
        off0 = 0;
        copied += i;
        len -= i;
        nNext = nNext->nextBuf;
    }
    
    return copied;
}

/*
 * nSplit - Partition an nBuf chain in two pieces leaving len bytes in the
 * original chain.  A len of zero leaves an empty nBuf for n0.  A len longer
 * than the amount of data in the chain returns NULL.
 * Return the new chain produced by the tail on success.  Otherwise, return
 * NULL and attempt to restore the chain to its original state.
 */
NBuf *nSplit(
    NBuf *n0,                   /* The chain to be split. */
    u_int len                   /* The bytes to leave in the original chain. */
)
{
    NBuf *n1 = NULL, *nNext;
    u_int off0 = len;
    
    /* Find the starting position in the original chain. */
    for (nNext = n0; nNext && len > nNext->len; nNext = nNext->nextBuf)
        len -= nNext->len;
    
    /* If the chain is too short, return nothing. */
    if (!nNext)
        ;
    /* If the chain breaks on the desired boundary, trivial case. */
    else if (len == nNext->len) {
        n1 = nNext->nextBuf;
        nNext->nextBuf = NULL;
        n1->chainLen = n0->chainLen - off0;
        n0->chainLen = off0;
    }
    /* Otherwise we need to split this next buffer. */
    else {
        nGET(n1);
        if (n1) {
            n1->len = nNext->len - len;
            n1->nextBuf = nNext->nextBuf;
            nNext->nextBuf = NULL;
            /* Move the data to the end of the new buffer to leave space for
             * new headers. */
            n1->data = &n1->body[NBUFSZ - n1->len];

            memcpy(n1->data, &nNext->data[len], n1->len);
            nNext->len -= n1->len;

            n1->chainLen = n0->chainLen - off0;
            n0->chainLen = off0;
        }
        /* If !n1, we return NULL. */
    }
    
    return n1;
}


/* 
 * nTrim - Trim up to len bytes from the chain, copying the data into
 * dst if dst is not NULL.  len > 0 trims off the front,
 * len < 0 trims off the end.  *nb is set to the new chain, NULL if
 * |len| >= the amount of data in the chain.
 * Note that this depends on the chain length field being accurate.
 * Return the actual number of bytes trimmed (always positive).
 */
int nTrim(char *dst, NBuf **nb, int len)
{
    int st = 0;
    NBuf* n0;
    NBuf* n1;
    u_int cLen;             /* Total chain length. */
    
    if (!len || !nb || !(*nb))
        ;
    else if (len > 0) {
        n0 = *nb;
        cLen = n0->chainLen;
        
        /* Trim whole leading buffers. */
        while (n0 && len >= n0->len) {
            st += n0->len;
            len -= n0->len;
            cLen -= n0->len;
            if (dst) {
                memcpy(dst, n0->data, n0->len);
                dst += n0->len;
            }
            nFREE(n0, n1);
            n0 = n1;
        }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成a人亚洲| 美女爽到高潮91| 亚洲女同一区二区| 亚洲国产一区二区在线播放| 亚洲国产日产av| 麻豆成人av在线| 99精品国产一区二区三区不卡| 欧美日韩精品一区视频| 久久夜色精品一区| 亚洲图片欧美综合| 国产69精品久久99不卡| 91色视频在线| 欧美精品一区二区三区一线天视频| xfplay精品久久| 亚洲一二三专区| 丁香激情综合五月| 日韩视频一区二区三区在线播放| 国产精品天干天干在线综合| 亚洲第一搞黄网站| 在线免费观看日本一区| 中文字幕国产精品一区二区| 日韩电影免费一区| 91玉足脚交白嫩脚丫在线播放| 日韩视频国产视频| 午夜成人免费视频| 欧美性猛片aaaaaaa做受| 久久久影视传媒| 日韩av在线播放中文字幕| 一本大道av一区二区在线播放| 久久综合av免费| 亚洲四区在线观看| 成人做爰69片免费看网站| 欧美xxxx在线观看| 国产传媒欧美日韩成人| 精品久久久久久久久久久久久久久| 图片区小说区国产精品视频| 欧美午夜寂寞影院| 日韩综合小视频| 日韩一区二区三区av| 精品一二三四在线| 国产午夜精品福利| 91视频观看视频| 日韩中文字幕1| 久久久亚洲精华液精华液精华液| 极品销魂美女一区二区三区| 久久综合成人精品亚洲另类欧美 | 麻豆精品一二三| 国产午夜精品福利| 欧美在线观看一区| 久久国产精品露脸对白| 中文字幕第一区二区| 在线不卡免费欧美| 国产综合久久久久影院| 中文字幕一区免费在线观看| 91免费看`日韩一区二区| 亚洲精选在线视频| 666欧美在线视频| jizz一区二区| 久久国产免费看| 一区二区三区免费在线观看| 4438成人网| 在线成人高清不卡| 色婷婷激情一区二区三区| 美女一区二区在线观看| 中文字幕制服丝袜一区二区三区| 欧美精品九九99久久| 91蜜桃传媒精品久久久一区二区 | 在线免费观看成人短视频| 日韩在线一区二区三区| 亚洲天堂成人在线观看| 国产欧美日韩在线观看| 欧美变态tickling挠脚心| 欧美女孩性生活视频| 91成人免费在线视频| 色8久久人人97超碰香蕉987| 波多野结衣中文一区| 国产乱码精品一区二区三区五月婷 | 欧美一卡2卡3卡4卡| 欧美精品在线视频| 欧美羞羞免费网站| 欧美在线免费观看亚洲| 91官网在线观看| 精品视频在线视频| 日韩三级在线免费观看| 91精品国产综合久久精品| 日韩欧美亚洲另类制服综合在线 | 国产精品国产自产拍在线| 日韩欧美亚洲另类制服综合在线| 宅男噜噜噜66一区二区66| 日韩一区二区在线免费观看| 日韩一区二区不卡| 国产精品色哟哟网站| 一区二区三区加勒比av| 日本最新不卡在线| 老色鬼精品视频在线观看播放| 久久国产精品无码网站| 国产高清不卡一区二区| 91美女在线视频| 久久日一线二线三线suv| 国产女同互慰高潮91漫画| 一区二区三区精品在线| 日韩国产欧美视频| 成人午夜av电影| 91精品国产综合久久精品图片| 91精品国产综合久久久久久| 久久久99久久精品欧美| 亚洲欧美国产毛片在线| 国产精品一区二区久久精品爱涩 | 国产精品久久久久久久久动漫| 中文字幕佐山爱一区二区免费| 一区二区三区欧美在线观看| 国产一区日韩二区欧美三区| 91福利小视频| 国产精品青草综合久久久久99| 首页欧美精品中文字幕| 日韩电影在线看| 欧美年轻男男videosbes| 精东粉嫩av免费一区二区三区| 欧美精品一二三| 一区二区三区在线视频免费观看 | 欧美日韩一区成人| 亚洲成av人片一区二区三区 | 亚洲欧美国产高清| 9191成人精品久久| 天堂在线一区二区| 日韩丝袜情趣美女图片| 激情久久五月天| 欧美tickling挠脚心丨vk| 奇米777欧美一区二区| 日韩欧美国产电影| 国产一区二区三区香蕉| 久久亚洲一级片| 蜜桃一区二区三区在线观看| 国产午夜精品理论片a级大结局 | 欧美成人国产一区二区| 国产在线一区二区综合免费视频| 日韩精品一区二区三区四区视频| 久久精品国产99国产精品| 久久综合狠狠综合| 92国产精品观看| 成人免费精品视频| 午夜一区二区三区在线观看| 日韩欧美一区二区久久婷婷| 国产乱码精品一区二区三区av | 国产精品一二一区| 一区二区成人在线| 26uuu欧美| 欧美日韩一区二区三区在线看| 理论电影国产精品| 亚洲丶国产丶欧美一区二区三区| 欧美本精品男人aⅴ天堂| 日本精品免费观看高清观看| 黄网站免费久久| 日本特黄久久久高潮| 亚洲美女淫视频| 国产人成一区二区三区影院| 在线视频一区二区三| 成人av网在线| 精品亚洲欧美一区| 日本视频一区二区| 亚洲人午夜精品天堂一二香蕉| 中文字幕欧美日韩一区| 91福利国产精品| 色乱码一区二区三区88| 免费日韩伦理电影| 亚洲一区二区三区中文字幕在线| 久久久亚洲精品石原莉奈| 国产午夜精品一区二区三区四区| 精品久久人人做人人爰| 欧美片在线播放| 欧美一级淫片007| 久久久久久久久久久久久女国产乱| 欧美大白屁股肥臀xxxxxx| 精品日韩一区二区三区| 欧美mv和日韩mv国产网站| 精品久久人人做人人爰| 国产欧美1区2区3区| 亚洲欧美在线视频观看| 亚洲精品国产a久久久久久| 日韩va亚洲va欧美va久久| 激情综合网最新| 成人午夜av在线| 在线视频欧美区| 69久久夜色精品国产69蝌蚪网| 这里是久久伊人| 国产精品久久久久久久岛一牛影视| 亚洲激情五月婷婷| 国产乱国产乱300精品| 色久综合一二码| 日韩午夜激情av| 一区二区在线观看视频| 蜜臀av一区二区在线观看| 成人av网址在线| 日韩亚洲欧美中文三级| 亚洲欧美一区二区不卡| 国产在线视视频有精品| 色88888久久久久久影院按摩| 日韩一区二区在线看片| 一区二区三区久久久| 成人av资源网站|