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

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

?? psock.h

?? 最新版FreeRTOS, 包擴多種開發平臺的移植
?? H
字號:
/*
 * Copyright (c) 2004, Swedish Institute of Computer Science.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of the Institute nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * This file is part of the uIP TCP/IP stack
 *
 * Author: Adam Dunkels <adam@sics.se>
 *
 * $Id: psock.h,v 1.3 2006/06/12 08:00:30 adam Exp $
 */

/**
 * \defgroup psock Protosockets library
 * @{
 *
 * The protosocket library provides an interface to the uIP stack that is
 * similar to the traditional BSD socket interface. Unlike programs
 * written for the ordinary uIP event-driven interface, programs
 * written with the protosocket library are executed in a sequential
 * fashion and does not have to be implemented as explicit state
 * machines.
 *
 * Protosockets only work with TCP connections.
 *
 * The protosocket library uses \ref pt protothreads to provide
 * sequential control flow. This makes the protosockets lightweight in
 * terms of memory, but also means that protosockets inherits the
 * functional limitations of protothreads. Each protosocket lives only
 * within a single function. Automatic variables (stack variables) are
 * not retained across a protosocket library function call.
 *
 * \note Because the protosocket library uses protothreads, local
 * variables will not always be saved across a call to a protosocket
 * library function. It is therefore advised that local variables are
 * used with extreme care.
 *
 * The protosocket library provides functions for sending data without
 * having to deal with retransmissions and acknowledgements, as well
 * as functions for reading data without having to deal with data
 * being split across more than one TCP segment.
 *
 * Because each protosocket runs as a protothread, the protosocket has to be
 * started with a call to PSOCK_BEGIN() at the start of the function
 * in which the protosocket is used. Similarly, the protosocket protothread can
 * be terminated by a call to PSOCK_EXIT().
 *
 */

/**
 * \file
 * Protosocket library header file
 * \author
 * Adam Dunkels <adam@sics.se>
 *
 */

#ifndef __PSOCK_H__
#define __PSOCK_H__

#include "uipopt.h"
#include "pt.h"

 /*
 * The structure that holds the state of a buffer.
 *
 * This structure holds the state of a uIP buffer. The structure has
 * no user-visible elements, but is used through the functions
 * provided by the library.
 *
 */
struct psock_buf {
  u8_t *ptr;
  unsigned short left;
};

/**
 * The representation of a protosocket.
 *
 * The protosocket structrure is an opaque structure with no user-visible
 * elements.
 */
struct psock {
  struct pt pt, psockpt; /* Protothreads - one that's using the psock
			    functions, and one that runs inside the
			    psock functions. */
  const u8_t *sendptr;   /* Pointer to the next data to be sent. */
  u8_t *readptr;         /* Pointer to the next data to be read. */
  
  char *bufptr;          /* Pointer to the buffer used for buffering
			    incoming data. */
  
  u16_t sendlen;         /* The number of bytes left to be sent. */
  u16_t readlen;         /* The number of bytes left to be read. */

  struct psock_buf buf;  /* The structure holding the state of the
			    input buffer. */
  unsigned int bufsize;  /* The size of the input buffer. */
  
  unsigned char state;   /* The state of the protosocket. */
};

void psock_init(struct psock *psock, char *buffer, unsigned int buffersize);
/**
 * Initialize a protosocket.
 *
 * This macro initializes a protosocket and must be called before the
 * protosocket is used. The initialization also specifies the input buffer
 * for the protosocket.
 *
 * \param psock (struct psock *) A pointer to the protosocket to be
 * initialized
 *
 * \param buffer (char *) A pointer to the input buffer for the
 * protosocket.
 *
 * \param buffersize (unsigned int) The size of the input buffer.
 *
 * \hideinitializer
 */
#define PSOCK_INIT(psock, buffer, buffersize) \
  psock_init(psock, buffer, buffersize)

/**
 * Start the protosocket protothread in a function.
 *
 * This macro starts the protothread associated with the protosocket and
 * must come before other protosocket calls in the function it is used.
 *
 * \param psock (struct psock *) A pointer to the protosocket to be
 * started.
 *
 * \hideinitializer
 */
#define PSOCK_BEGIN(psock) PT_BEGIN(&((psock)->pt))

PT_THREAD(psock_send(struct psock *psock, const char *buf, unsigned int len));
/**
 * Send data.
 *
 * This macro sends data over a protosocket. The protosocket protothread blocks
 * until all data has been sent and is known to have been received by
 * the remote end of the TCP connection.
 *
 * \param psock (struct psock *) A pointer to the protosocket over which
 * data is to be sent.
 *
 * \param data (char *) A pointer to the data that is to be sent.
 *
 * \param datalen (unsigned int) The length of the data that is to be
 * sent.
 *
 * \hideinitializer
 */
#define PSOCK_SEND(psock, data, datalen)		\
    PT_WAIT_THREAD(&((psock)->pt), psock_send(psock, data, datalen))

/**
 * \brief      Send a null-terminated string.
 * \param psock Pointer to the protosocket.
 * \param str  The string to be sent.
 *
 *             This function sends a null-terminated string over the
 *             protosocket.
 *
 * \hideinitializer
 */
#define PSOCK_SEND_STR(psock, str)      		\
    PT_WAIT_THREAD(&((psock)->pt), psock_send(psock, str, strlen(str)))

PT_THREAD(psock_generator_send(struct psock *psock,
				unsigned short (*f)(void *), void *arg));

/**
 * \brief      Generate data with a function and send it
 * \param psock Pointer to the protosocket.
 * \param generator Pointer to the generator function
 * \param arg   Argument to the generator function
 *
 *             This function generates data and sends it over the
 *             protosocket. This can be used to dynamically generate
 *             data for a transmission, instead of generating the data
 *             in a buffer beforehand. This function reduces the need for
 *             buffer memory. The generator function is implemented by
 *             the application, and a pointer to the function is given
 *             as an argument with the call to PSOCK_GENERATOR_SEND().
 *
 *             The generator function should place the generated data
 *             directly in the uip_appdata buffer, and return the
 *             length of the generated data. The generator function is
 *             called by the protosocket layer when the data first is
 *             sent, and once for every retransmission that is needed.
 *
 * \hideinitializer
 */
#define PSOCK_GENERATOR_SEND(psock, generator, arg)     \
    PT_WAIT_THREAD(&((psock)->pt),					\
		   psock_generator_send(psock, generator, arg))


/**
 * Close a protosocket.
 *
 * This macro closes a protosocket and can only be called from within the
 * protothread in which the protosocket lives.
 *
 * \param psock (struct psock *) A pointer to the protosocket that is to
 * be closed.
 *
 * \hideinitializer
 */
#define PSOCK_CLOSE(psock) uip_close()

PT_THREAD(psock_readbuf(struct psock *psock));
/**
 * Read data until the buffer is full.
 *
 * This macro will block waiting for data and read the data into the
 * input buffer specified with the call to PSOCK_INIT(). Data is read
 * until the buffer is full..
 *
 * \param psock (struct psock *) A pointer to the protosocket from which
 * data should be read.
 *
 * \hideinitializer
 */
#define PSOCK_READBUF(psock)				\
  PT_WAIT_THREAD(&((psock)->pt), psock_readbuf(psock))

PT_THREAD(psock_readto(struct psock *psock, unsigned char c));
/**
 * Read data up to a specified character.
 *
 * This macro will block waiting for data and read the data into the
 * input buffer specified with the call to PSOCK_INIT(). Data is only
 * read until the specifieed character appears in the data stream.
 *
 * \param psock (struct psock *) A pointer to the protosocket from which
 * data should be read.
 *
 * \param c (char) The character at which to stop reading.
 *
 * \hideinitializer
 */
#define PSOCK_READTO(psock, c)				\
  PT_WAIT_THREAD(&((psock)->pt), psock_readto(psock, c))

/**
 * The length of the data that was previously read.
 *
 * This macro returns the length of the data that was previously read
 * using PSOCK_READTO() or PSOCK_READ().
 *
 * \param psock (struct psock *) A pointer to the protosocket holding the data.
 *
 * \hideinitializer
 */
#define PSOCK_DATALEN(psock) psock_datalen(psock)

u16_t psock_datalen(struct psock *psock);

/**
 * Exit the protosocket's protothread.
 *
 * This macro terminates the protothread of the protosocket and should
 * almost always be used in conjunction with PSOCK_CLOSE().
 *
 * \sa PSOCK_CLOSE_EXIT()
 *
 * \param psock (struct psock *) A pointer to the protosocket.
 *
 * \hideinitializer
 */
#define PSOCK_EXIT(psock) PT_EXIT(&((psock)->pt))

/**
 * Close a protosocket and exit the protosocket's protothread.
 *
 * This macro closes a protosocket and exits the protosocket's protothread.
 *
 * \param psock (struct psock *) A pointer to the protosocket.
 *
 * \hideinitializer
 */
#define PSOCK_CLOSE_EXIT(psock)		\
  do {						\
    PSOCK_CLOSE(psock);			\
    PSOCK_EXIT(psock);			\
  } while(0)

/**
 * Declare the end of a protosocket's protothread.
 *
 * This macro is used for declaring that the protosocket's protothread
 * ends. It must always be used together with a matching PSOCK_BEGIN()
 * macro.
 *
 * \param psock (struct psock *) A pointer to the protosocket.
 *
 * \hideinitializer
 */
#define PSOCK_END(psock) PT_END(&((psock)->pt))

char psock_newdata(struct psock *s);

/**
 * Check if new data has arrived on a protosocket.
 *
 * This macro is used in conjunction with the PSOCK_WAIT_UNTIL()
 * macro to check if data has arrived on a protosocket.
 *
 * \param psock (struct psock *) A pointer to the protosocket.
 *
 * \hideinitializer
 */
#define PSOCK_NEWDATA(psock) psock_newdata(psock)

/**
 * Wait until a condition is true.
 *
 * This macro blocks the protothread until the specified condition is
 * true. The macro PSOCK_NEWDATA() can be used to check if new data
 * arrives when the protosocket is waiting.
 *
 * Typically, this macro is used as follows:
 *
 \code
 PT_THREAD(thread(struct psock *s, struct timer *t))
 {
   PSOCK_BEGIN(s);

   PSOCK_WAIT_UNTIL(s, PSOCK_NEWADATA(s) || timer_expired(t));
   
   if(PSOCK_NEWDATA(s)) {
     PSOCK_READTO(s, '\n');
   } else {
     handle_timed_out(s);
   }
   
   PSOCK_END(s);
 }
 \endcode
 *
 * \param psock (struct psock *) A pointer to the protosocket.
 * \param condition The condition to wait for.
 *
 * \hideinitializer
 */
#define PSOCK_WAIT_UNTIL(psock, condition)    \
  PT_WAIT_UNTIL(&((psock)->pt), (condition));

#define PSOCK_WAIT_THREAD(psock, condition)   \
  PT_WAIT_THREAD(&((psock)->pt), (condition))

#endif /* __PSOCK_H__ */

/** @} */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品制服美女久久| 91女神在线视频| 国产精品99久久久久久有的能看| 国产高清不卡二三区| va亚洲va日韩不卡在线观看| 欧美中文字幕一区| 欧美亚洲禁片免费| 久久久国产一区二区三区四区小说| 国产片一区二区| 亚洲精品一区二区三区福利 | 日韩精品在线一区| 久久麻豆一区二区| 亚洲一区影音先锋| 国产一区二区视频在线播放| 一本到不卡精品视频在线观看| 欧美色区777第一页| 国产日韩欧美亚洲| 一区二区三区四区在线| 极品少妇xxxx偷拍精品少妇| 91福利小视频| 久久久不卡影院| 亚洲成av人**亚洲成av**| 国产成人免费视频精品含羞草妖精| 欧美在线不卡视频| 久久精品欧美一区二区三区麻豆| 亚洲国产精品久久艾草纯爱| 成人精品视频.| 欧美精品aⅴ在线视频| 国产精品免费观看视频| 蜜桃av一区二区三区电影| 91天堂素人约啪| 久久久亚洲精华液精华液精华液| 亚洲自拍偷拍综合| 成人一区二区三区| 精品美女被调教视频大全网站| 亚洲国产视频网站| av在线不卡网| 国产精品久久精品日日| 日本午夜一区二区| 欧美天堂一区二区三区| 18涩涩午夜精品.www| 日本成人在线电影网| 欧美午夜在线观看| 有坂深雪av一区二区精品| 岛国精品一区二区| 久久综合五月天婷婷伊人| 日本va欧美va瓶| 欧美日韩国产综合久久| 亚洲欧洲av在线| av不卡在线播放| 中文字幕一区二区三区四区不卡| 国产精品77777| 中文字幕不卡在线观看| 东方aⅴ免费观看久久av| 精品久久久久久久久久久久久久久 | 欧美三日本三级三级在线播放| 亚洲色图一区二区三区| 国产麻豆午夜三级精品| 国内成人免费视频| 99国产精品久久久久| 一区二区三区在线观看欧美| 成人黄色av电影| 色噜噜狠狠成人中文综合| 国产精品每日更新在线播放网址| 国产91露脸合集magnet| 亚洲欧洲在线观看av| 99re成人精品视频| 亚洲国产精品ⅴa在线观看| www.欧美亚洲| 亚洲精品欧美在线| 欧美精品免费视频| 精品一区二区三区香蕉蜜桃 | av电影天堂一区二区在线| 最新中文字幕一区二区三区| 91原创在线视频| 亚洲丰满少妇videoshd| 91免费视频大全| 午夜欧美视频在线观看| 精品国产一区二区三区久久久蜜月| 国内成人自拍视频| 亚洲伦理在线免费看| 91精品国产全国免费观看| 国产精品一区二区久久不卡 | 在线观看日韩国产| 日本女优在线视频一区二区| 欧美丰满少妇xxxbbb| 国产美女久久久久| 亚洲精品一二三区| 精品99一区二区| 成人综合在线网站| 亚洲成av人片一区二区| 国产网站一区二区| 欧美日韩精品二区第二页| 国产综合一区二区| 一区二区三区在线观看视频| 2023国产精品| 在线免费观看视频一区| 国产精品白丝jk黑袜喷水| 亚洲线精品一区二区三区| 欧美精品少妇一区二区三区| eeuss鲁片一区二区三区在线看 | 日韩精品电影一区亚洲| 99久久精品国产一区| 国产精品99久久久久久久女警| 亚洲国产一区二区三区| 亚洲另类在线一区| 成人免费小视频| 中文字幕一区二区三区色视频 | 国产精品性做久久久久久| 麻豆精品在线观看| 日本vs亚洲vs韩国一区三区 | 亚洲午夜私人影院| 亚洲欧美aⅴ...| 国产精品无人区| 国产精品日韩精品欧美在线| 国产午夜精品久久| 国产精品网站导航| 国产精品超碰97尤物18| 国产拍欧美日韩视频二区| 国产亚洲欧美日韩日本| 欧美激情资源网| 欧美激情中文不卡| 国产精品精品国产色婷婷| 国产精品美女久久福利网站 | 色8久久人人97超碰香蕉987| 91丨九色丨蝌蚪富婆spa| 波多野结衣在线一区| av不卡免费电影| 日本电影欧美片| 欧美一区二区三区成人| 日韩一级在线观看| 国产日产欧美一区二区视频| 国产精品妹子av| 亚洲国产成人精品视频| 日韩和的一区二区| 另类调教123区| 国产91精品一区二区麻豆亚洲| 本田岬高潮一区二区三区| 91高清在线观看| 日韩欧美成人午夜| 国产精品久久久久久久久晋中| 亚洲精品日产精品乱码不卡| 人人爽香蕉精品| 国产成人精品免费视频网站| 97久久精品人人澡人人爽| 欧美自拍丝袜亚洲| 欧美大白屁股肥臀xxxxxx| 国产欧美日产一区| 亚洲成a人v欧美综合天堂下载 | www激情久久| 《视频一区视频二区| 日韩成人免费电影| 成人免费高清在线| 欧美亚洲综合在线| 国产欧美视频在线观看| 亚洲动漫第一页| 国产成人免费在线观看不卡| 欧美日韩免费电影| 国产目拍亚洲精品99久久精品| 亚洲综合在线第一页| 国产乱码字幕精品高清av| 欧美午夜免费电影| 中文字幕不卡在线| 日精品一区二区三区| 成人激情动漫在线观看| 日韩欧美第一区| 一区二区三区日本| 不卡视频在线看| 日韩精品一区二区三区在线观看 | 欧美性受xxxx黑人xyx性爽| 26uuu亚洲综合色| 亚洲一区二区三区中文字幕在线| 久久国产欧美日韩精品| 欧美日韩你懂的| 国产精品久久久久久久久图文区 | 色婷婷久久久综合中文字幕| 欧美va在线播放| 亚洲成人激情综合网| eeuss国产一区二区三区| 精品少妇一区二区三区视频免付费| 亚洲综合视频在线| 99综合电影在线视频| 欧美精品一区二区三区在线播放 | 日韩精品久久理论片| 色综合天天综合色综合av | 亚洲一本大道在线| 成人免费三级在线| 久久久久成人黄色影片| 欧美aaa在线| 欧美日韩视频不卡| 亚洲欧美欧美一区二区三区| 高清日韩电视剧大全免费| 精品国产髙清在线看国产毛片| 亚洲伊人色欲综合网| 丁香六月久久综合狠狠色| 2023国产精品自拍| 韩国av一区二区三区四区| 日韩视频一区二区| 老司机免费视频一区二区| 欧美成人video|