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

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

?? mbufsocklib.c

?? vxwork源代碼
?? C
字號:
/* mbufSockLib.c - BSD mbuf socket interface library *//* Copyright 1984-2001 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01f,15oct01,rae  merge from truestack01e,04dec00,adb  if (errno = EWOULDBLOCK) changed to if (EWOULDBLOCK == errno)01d,25aug97,vin  fixed SPR8908.01d,22nov96,vin  added new cluster support, initialized header fields for		 for every packet.01c,13nov95,dzb  changed to validate mbufId.type off MBUF_VALID (SPR #4066).01b,20nov94,kdl	 Fix blank line in comment block, for mangen.01a,08nov94,dzb  written.*//*DESCRIPTIONThis library contains routines that communicate over BSD sockets usingthe `mbuf interface' described in the mbufLib manual page.  These mbufsocket calls interoperate with BSD sockets in a similar manner to thesocket routines in sockLib, but they avoid copying data unnecessarilybetween application buffers and network buffers.NOMANUAL*//* includes */#include "vxWorks.h"#include "sockLib.h"#include "zbufSockLib.h"#include "mbufSockLib.h"#include "sys/socket.h"/* declare mbuf socket interface function table */LOCAL ZBUF_SOCK_FUNC	mbufSockFunc =    {    (FUNCPTR) _mbufLibInit,			/* back-end init pointer */    (FUNCPTR) _mbufSockSend,    (FUNCPTR) _mbufSockSendto,    (FUNCPTR) _mbufSockBufSend,    (FUNCPTR) _mbufSockBufSendto,    (FUNCPTR) _mbufSockRecv,    (FUNCPTR) _mbufSockRecvfrom    };/********************************************************************************* _mbufSockLibInit - initialize the BSD mbuf socket interface library** The mbufSockLib API func table "mbufSockFunc" is published to the caller* by the return value of this routine.  Typically, this func table is used by* the zbufSock facility to call mbufSock routines within this library to* perform socket operations.  Even though the zbufSock interface defines* the ZBUF_SOCK_FUNC struct, it doesn't necessarily mean that zbufs must* be present.  This library may be used even if zbufs have been scaled out* of the system.** RETURNS:* A pointer to a func table containing the mbufSockLib API.** NOMANUAL*/void * _mbufSockLibInit (void)    {    return ((void *) &mbufSockFunc);		/* no init necessary */    }/********************************************************************************* _mbufSockSend - send mbuf data to a socket** This routine transmits all of the data in <mbufId> to a previously* established connection-based (stream) socket.** The <mbufLen> parameter is only used for determining the amount of space* needed from the socket write buffer.  <mbufLen> has no affect on how many* bytes are sent; the entire mbuf chain will be transmitted.  If the length of* <mbufId> is not known, it must be determined using _mbufLength() before* calling this routine.** This routine transfers ownership of the mbuf chain from the user application* to the VxWorks network stack.  The mbuf ID <mbufId> is deleted by this* routine, and should not be used after this routine is called, even if* an ERROR status is returned.  The exceptions to this are if this routine* failed because the mbuf socket interface library was not uninitialized or an* invalid mbuf ID was passed in, in which case <mbufId> is not deleted.* Additionally, if the call fails during a non-blocking I/O socket write* with an errno of EWOULDBLOCK, then <mbufId> is not deleted, so that it may* be re-sent by the caller at a later time.** RETURNS* The number of bytes sent, or ERROR if the call fails.** SEE ALSO: mbufLength** NOMANUAL*/int _mbufSockSend    (    int			s,		/* socket to send to */    MBUF_ID		mbufId,		/* mbuf chain to transmit */    int			mbufLen,	/* length of entire mbuf chain */    int			flags		/* flags to underlying protocols */    )    {    MBUF_SEG		mbufSeg;		/* start of chain */    int			retVal = 0;		/* send() return status */    if (mbufId->type != MBUF_VALID)		/* invalid mbuf ID ? */	{	errno = S_mbufLib_ID_INVALID;	return (ERROR);	}    if ((mbufSeg = mbufId->mbufHead) != NULL)	/* send mbuf chain */	{	mbufSeg->m_pkthdr.rcvif = NULL;	mbufSeg->m_pkthdr.len = mbufLen;        mbufSeg->m_flags |= M_PKTHDR;	        retVal = send (s, (char *) mbufSeg, mbufLen, flags | MSG_MBUF);	}    /* do not delete mbuf ID on EWOULDBLOCK error so user can resend ID */    if ((retVal != ERROR) || (errno != EWOULDBLOCK))        MBUF_ID_DELETE_EMPTY(mbufId);    return (retVal);    }/********************************************************************************* _mbufSockSendto - send a mbuf message to a socket** This routine sends the entire message in <mbufId> to the datagram socket* named by <to>.  The socket <s> will be received by the receiver as the* sending socket.** The <mbufLen> parameter is only used for determining the amount of space* needed from the socket write buffer.  <mbufLen> has no affect on how many* bytes are sent; the entire mbuf chain will be transmitted.  If the length of* <mbufId> is not known, it must be determined using _mbufLength() before* calling this routine.** This routine transfers ownership of the mbuf chain from the user application* to the VxWorks network stack.  The mbuf ID <mbufId> is deleted by this* routine, and should not be used after this routine is called, even if* an ERROR status is returned.  The exceptions to this are if this routine* failed because the mbuf socket interface library was not uninitialized or an* invalid mbuf ID was passed in, in which case <mbufId> is not deleted.* Additionally, if the call fails during a non-blocking I/O socket write* with an errno of EWOULDBLOCK, then <mbufId> is not deleted, so that it may* be re-sent by the caller at a later time.** RETURNS* The number of bytes sent, or ERROR if the call fails.** SEE ALSO: mbufLength** NOMANUAL*/int _mbufSockSendto    (    int			s,		/* socket to send to */    MBUF_ID		mbufId,		/* mbuf chain to transmit */    int			mbufLen,	/* length of entire mbuf chain */    int			flags,		/* flags to underlying protocols */    struct sockaddr *	to,		/* recipient's address */    int			tolen		/* length of <to> sockaddr */    )    {    MBUF_SEG		mbufSeg;		/* start of chain */    int			retVal = 0;		/* sendto() return status */    if (mbufId->type != MBUF_VALID)		/* invalid mbuf ID ? */	{	errno = S_mbufLib_ID_INVALID;	return (ERROR);	}    if ((mbufSeg = mbufId->mbufHead) != NULL)	/* send mbuf chain */	{	mbufSeg->m_pkthdr.rcvif = NULL;	mbufSeg->m_pkthdr.len = mbufLen;        mbufSeg->m_flags |= M_PKTHDR;	        retVal = sendto (s, (char *) mbufSeg, mbufLen, flags | MSG_MBUF,	to, tolen);	}    /* do not delete mbuf ID on EWOULDBLOCK error so user can resend ID */    if ((retVal != ERROR) || (errno != EWOULDBLOCK))        MBUF_ID_DELETE_EMPTY(mbufId);    return (retVal);    }/********************************************************************************* _mbufSockBufSend - create an mbuf from user data and send it to a socket** This routine creates an mbuf from the user buffer <buf>, and transmits* it to a previously established connection-based (stream) socket.** The user provided free routine <freeRtn> will be called when <buf>* is no longer being used by the TCP/IP network stack.  If <freeRtn> is NULL,* this routine will function normally, except that the user will not be* notified when <buf> is released by the network stack.  <freeRtn> will be* called from the context of the task that last references it.  This is* typically either tNetTask context, or the caller's task context.* <freeRtn> should be declared as follows:* .CS*       void freeRtn*           (*           caddr_t     buf,    /@ pointer to user buffer @/*           int         freeArg /@ user provided argument to free routine @/*           )* .CE** RETURNS:* The number of bytes sent, or ERROR if the call fails.** NOMANUAL*/int _mbufSockBufSend    (    int			s,		/* socket to send to */    char *		buf,		/* pointer to data buffer */    int			bufLen,		/* number of bytes to send */    VOIDFUNCPTR		freeRtn,	/* free routine callback */    int			freeArg,	/* argument to free routine */    int			flags		/* flags to underlying protocols */    )    {    struct mbufId	mbufIdNew;		/* dummy ID to insert into */    MBUF_SEG		mbufSeg;		/* start of mbuf chain */    int			retVal = 0;		/* send() return status */    mbufIdNew.mbufHead = NULL;			/* init dummy ID */    mbufIdNew.type = MBUF_VALID;    /* build an mbuf chain with the user buffer as only mbuf */    if ((mbufSeg = _mbufInsertBuf (&mbufIdNew, NULL, 0, buf,	bufLen, freeRtn, freeArg)) == NULL)	{        if (freeRtn != NULL)			/* call free routine on error */	    (*freeRtn) (buf, freeArg);        return (ERROR);	}    mbufSeg->m_pkthdr.rcvif = NULL;    mbufSeg->m_pkthdr.len = bufLen;     mbufSeg->m_flags |= M_PKTHDR;	    if (((retVal = send (s, (char *) mbufSeg, bufLen, flags | MSG_MBUF)) ==	ERROR) && (errno == EWOULDBLOCK))        m_freem (mbufSeg);			/* free for EWOULDBLOCK case */    return (retVal);    }/********************************************************************************* _mbufSockBufSendto - create an mbuf from a message and send it to a socket** This routine creates an mbuf from the user buffer <buf>, and sends* it to the datagram socket named by <to>.  The socket <s> will be* received by the receiver as the sending socket.** The user provided free routine <freeRtn> will be called when <buf>* is no longer being used by the UDP/IP network stack.  If <freeRtn> is NULL,* this routine will function normally, except that the user will not be* notified when <buf> is released by the network stack.  <freeRtn> will be* called from the context of the task that last references it.  This is* typically either tNetTask context or the caller's task context.* <freeRtn> should be declared as follows:* .CS*       void freeRtn*           (*           caddr_t     buf,    /@ pointer to user buffer @/*           int         freeArg /@ user provided argument to free routine @/*           )* .CE** RETURNS:* The number of bytes sent, or ERROR if the call fails.** NOMANUAL*/int _mbufSockBufSendto    (    int			s,		/* socket to send to */    char *		buf,		/* pointer to data buffer */    int			bufLen,		/* number of bytes to send */    VOIDFUNCPTR		freeRtn,	/* free routine callback */    int			freeArg,	/* argument to free routine */    int			flags,		/* flags to underlying protocols */    struct sockaddr *	to,		/* recipient's address */    int			tolen		/* length of <to> sockaddr */    )    {    struct mbufId	mbufIdNew;		/* dummy ID to insert into */    MBUF_SEG		mbufSeg;		/* start of mbuf chain */    int			retVal = 0;		/* sendto() return status */    mbufIdNew.mbufHead = NULL;			/* init dummy ID */    mbufIdNew.type = MBUF_VALID;    /* build an mbuf chain with the user buffer as only mbuf */    if ((mbufSeg = _mbufInsertBuf (&mbufIdNew, NULL, 0, buf,	bufLen, freeRtn, freeArg)) == NULL)	{        if (freeRtn != NULL)			/* call free routine on error */	    (*freeRtn) (buf, freeArg);        return (ERROR);	}    mbufSeg->m_pkthdr.rcvif = NULL;    mbufSeg->m_pkthdr.len = bufLen;     mbufSeg->m_flags |= M_PKTHDR;	    if (((retVal = sendto (s, (char *) mbufSeg, bufLen, flags | MSG_MBUF,        to, tolen)) == ERROR) && (EWOULDBLOCK == errno))        m_freem (mbufSeg);			/* free for EWOULDBLOCK case */    return (retVal);    }/********************************************************************************* _mbufSockRecv - receive data from a socket and place into a mbuf** This routine receives data from a connection-based (stream) socket, and* returns the data to the user in a newly created mbuf chain.** The <pLen> parameter indicates the number of bytes requested by the caller.* If the operation is successful, the number of bytes received will be* returned through this paramter.** RETURNS:* The mbuf ID of a newly created mbuf chain containing the received data,* or NULL if the operation failed.** NOMANUAL*/MBUF_ID _mbufSockRecv    (    int			s,		/* socket to receive data from */    int			flags,		/* flags to underlying protocols */    int *		pLen		/* length of mbuf requested/received */    )    {    MBUF_ID		mbufId;			/* mbuf returned to user */    MBUF_SEG		mbufSeg = NULL;		/* received mbuf chain */    int			status;			/* recv() return status */    MBUF_ID_CREATE(mbufId);			/* create ID for recv data */    if (mbufId == NULL)        return (NULL);    if ((status = (recv (s, (char *) &mbufSeg, *pLen, flags | MSG_MBUF))) ==	ERROR)					/* Rx data from the socket */	{	MBUF_ID_DELETE_EMPTY(mbufId);	return (NULL);	}    mbufId->mbufHead = mbufSeg;			/* hook into mbuf ID */    *pLen = status;				/* stuff return length */    return (mbufId);    }/********************************************************************************* _mbufSockRecvfrom - receive a message from a socket and place into a mbuf** This routine receives a message from a datagram socket, and* returns the message to the user in a newly created mbuf chain.** The message is received regardless of whether the socket is connected.* If <from> is non-zero, the address of the sender's socket is copied to it.* The value-result parameter <pFromLen> should be initialized to the size of* the <from> buffer.  On return, <pFromLen> contains the actual size of the* address stored in <from>.** The <pLen> parameter indicates the number of bytes requested by the caller.* If the operation is successful, the number of bytes received will be* returned through this paramter.** RETURNS:* The mbuf ID of a newly created mbuf chain containing the received message,* or NULL if the operation failed.** NOMANUAL*/MBUF_ID _mbufSockRecvfrom    (    int			s,		/* socket to receive from */    int			flags,		/* flags to underlying protocols */    int *		pLen,		/* length of mbuf requested/received */    struct sockaddr *	from,		/* where to copy sender's addr */    int *		pFromLen	/* value/result length of <from> */    )    {    MBUF_ID		mbufId;			/* mbuf returned to user */    MBUF_SEG		mbufSeg = NULL;		/* received mbuf chain */    int			status;			/* recvfrom() return status */    MBUF_ID_CREATE(mbufId);			/* create ID for recv data */    if (mbufId == NULL)        return (NULL);    if ((status = (recvfrom (s, (char *) &mbufSeg, *pLen, flags | MSG_MBUF,	from, pFromLen))) == ERROR)		/* Rx message from the socket */	{	MBUF_ID_DELETE_EMPTY(mbufId);	return (NULL);	}    mbufId->mbufHead = mbufSeg;			/* hook into mbuf ID */    *pLen = status;				/* stuff return length */    return (mbufId);    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久视频一区二区| 国产精品成人网| 91视频你懂的| 奇米在线7777在线精品| 国产精品免费久久久久| 欧美一区二区成人6969| 色婷婷av一区二区三区大白胸| 老汉av免费一区二区三区| 亚洲四区在线观看| 国产日韩欧美综合在线| 日韩视频永久免费| 欧美性生活大片视频| 99久久99久久精品免费看蜜桃| 精品一区二区三区视频在线观看| 亚洲国产日韩在线一区模特| 中文av一区二区| 久久青草欧美一区二区三区| 欧美一区二区三区性视频| 欧美在线制服丝袜| 波多野结衣精品在线| 国产精品一区二区在线播放| 麻豆精品视频在线观看| 午夜精品福利在线| 亚洲国产美国国产综合一区二区| 亚洲欧美另类综合偷拍| 日本一区二区三区在线不卡 | 国内外成人在线视频| 亚洲18色成人| 五月激情丁香一区二区三区| 亚洲男帅同性gay1069| 中文字幕 久热精品 视频在线| 久久综合久久综合亚洲| 精品国产三级电影在线观看| 欧美极品美女视频| 日韩精品专区在线| 日韩视频永久免费| 26uuu久久天堂性欧美| 精品国产免费久久| 久久天天做天天爱综合色| 久久午夜免费电影| 精品不卡在线视频| 精品久久久久久亚洲综合网 | av电影在线不卡| 99久久精品99国产精品| 99久久精品国产一区二区三区| 成人免费va视频| av在线播放不卡| 色婷婷综合五月| 欧美日韩国产首页| 欧美一卡二卡在线| 久久免费看少妇高潮| 国产亚洲成年网址在线观看| 国产精品乱码一区二三区小蝌蚪| 亚洲色图视频免费播放| 亚洲电影一级黄| 狠狠色丁香婷综合久久| 国产a久久麻豆| 色婷婷综合久久久中文字幕| 欧美亚日韩国产aⅴ精品中极品| 欧美日韩中文一区| 欧美电影免费观看高清完整版在| 久久综合久久综合久久综合| 国产精品嫩草99a| 婷婷久久综合九色综合绿巨人 | 欧美一区二区黄| 精品国产乱子伦一区| 亚洲国产激情av| 亚洲国产成人av网| 精品综合免费视频观看| 福利一区在线观看| 欧美性一区二区| 久久毛片高清国产| 中文字幕亚洲一区二区va在线| 一区二区三区欧美日| 麻豆精品视频在线观看免费| 99天天综合性| 制服丝袜国产精品| 国产欧美精品一区二区色综合 | 亚洲黄色免费网站| 欧美a级理论片| av在线不卡电影| 日韩一区国产二区欧美三区| 国产精品第13页| 美国av一区二区| 99r精品视频| 精品1区2区在线观看| 亚洲图片一区二区| 国产美女娇喘av呻吟久久| 欧美综合天天夜夜久久| 久久综合色天天久久综合图片| 一区二区三区四区国产精品| 国产精品一品视频| 欧美挠脚心视频网站| 亚洲欧洲日韩一区二区三区| 久久国产生活片100| 在线观看一区日韩| 国产欧美一区视频| 另类小说图片综合网| 色欧美日韩亚洲| 国产欧美日韩卡一| 久久精品999| 欧美精品久久天天躁| 亚洲色图一区二区| 国产成人激情av| 日韩免费看网站| 日韩精品久久久久久| 91蜜桃视频在线| 国产精品久久久久婷婷二区次| 麻豆精品一区二区| 7777精品伊人久久久大香线蕉| 亚洲欧美视频在线观看视频| 成人小视频在线| 久久久久久麻豆| 久久精品99久久久| 在线不卡免费欧美| 爽好久久久欧美精品| 欧美四级电影网| 一区二区三区久久久| 91啪在线观看| 亚洲欧美另类小说| 色综合中文字幕国产 | 国产风韵犹存在线视精品| 欧美不卡一区二区| 轻轻草成人在线| 911精品国产一区二区在线| 亚洲国产成人av网| 91视频精品在这里| 亚洲色图欧美在线| av不卡一区二区三区| 成人欧美一区二区三区1314| 成人免费视频视频| 国产精品久久久久天堂| 成人av午夜电影| 国产精品丝袜91| www.性欧美| 亚洲日本一区二区| 在线观看欧美精品| 亚洲一区二三区| 欧美久久久久久久久| 日韩精品免费视频人成| 欧美一区二区三区免费观看视频| 美女视频一区二区三区| 精品日韩在线观看| 国产99精品国产| 国产精品久99| 91传媒视频在线播放| 爽爽淫人综合网网站| 欧美zozo另类异族| 成人一区二区三区视频在线观看| 国产精品麻豆网站| 91亚洲大成网污www| 亚洲成a天堂v人片| 日韩欧美国产综合| 成人高清免费在线播放| 亚洲精品视频观看| 欧美精品日韩一区| 国产一区二区精品久久| 国产精品女同一区二区三区| 在线中文字幕不卡| 毛片基地黄久久久久久天堂| 日本一区二区成人| 欧美在线免费观看视频| 男男成人高潮片免费网站| 国产色爱av资源综合区| 色猫猫国产区一区二在线视频| 日本免费在线视频不卡一不卡二| 国产欧美日韩久久| 欧美性欧美巨大黑白大战| 久久激情综合网| 18欧美亚洲精品| 91精品欧美综合在线观看最新 | 日韩高清一区在线| 国产亚洲成av人在线观看导航| 在线一区二区三区四区| 精品制服美女丁香| 自拍偷在线精品自拍偷无码专区| 在线成人av网站| www.66久久| 秋霞影院一区二区| 国产精品卡一卡二| 欧美一区午夜精品| 99久久精品情趣| 久久99热99| 亚洲精品福利视频网站| 日韩精品一区二区三区蜜臀| 91小宝寻花一区二区三区| 久久国产人妖系列| 亚洲午夜免费视频| 久久久国产午夜精品| 欧美日韩专区在线| 成人动漫av在线| 精品一区二区三区av| 亚洲午夜成aⅴ人片| 国产精品三级av| 精品久久久久久久久久久久久久久| 99r国产精品| 成人精品一区二区三区四区| 蜜桃视频一区二区三区在线观看| 亚洲精品国产一区二区三区四区在线| 精品久久一区二区|