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

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

?? api_lib.c

?? stm32+ucos-ii
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/**
 * @file
 * Sequential API External module
 *
 */
 
/*
 * Copyright (c) 2001-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. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission. 
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 lwIP TCP/IP stack.
 * 
 * Author: Adam Dunkels <adam@sics.se>
 *
 */

/* This is the part of the API that is linked with
   the application */

#include "lwip/opt.h"

#if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */

#include "lwip/api.h"
#include "lwip/tcpip.h"
#include "lwip/memp.h"

#include "lwip/ip.h"
#include "lwip/raw.h"
#include "lwip/udp.h"
#include "lwip/tcp.h"

#include <string.h>

/**
 * Create a new netconn (of a specific type) that has a callback function.
 * The corresponding pcb is also created.
 *
 * @param t the type of 'connection' to create (@see enum netconn_type)
 * @param proto the IP protocol for RAW IP pcbs
 * @param callback a function to call on status changes (RX available, TX'ed)
 * @return a newly allocated struct netconn or
 *         NULL on memory error
 */
struct netconn*
netconn_new_with_proto_and_callback(enum netconn_type t, u8_t proto, netconn_callback callback)
{
  struct netconn *conn;
  struct api_msg msg;

  conn = netconn_alloc(t, callback);
  if (conn != NULL ) {
    msg.function = do_newconn;
    msg.msg.msg.n.proto = proto;
    msg.msg.conn = conn;
    TCPIP_APIMSG(&msg);

    if (conn->err != ERR_OK) {
      LWIP_ASSERT("freeing conn without freeing pcb", conn->pcb.tcp == NULL);
      LWIP_ASSERT("conn has no op_completed", conn->op_completed != SYS_SEM_NULL);
      LWIP_ASSERT("conn has no recvmbox", conn->recvmbox != SYS_MBOX_NULL);
      LWIP_ASSERT("conn->acceptmbox shouldn't exist", conn->acceptmbox == SYS_MBOX_NULL);
      sys_sem_free(conn->op_completed);
      sys_mbox_free(conn->recvmbox);
      memp_free(MEMP_NETCONN, conn);
      return NULL;
    }
  }
  return conn;
}

/**
 * Close a netconn 'connection' and free its resources.
 * UDP and RAW connection are completely closed, TCP pcbs might still be in a waitstate
 * after this returns.
 *
 * @param conn the netconn to delete
 * @return ERR_OK if the connection was deleted
 */
err_t
netconn_delete(struct netconn *conn)
{
  struct api_msg msg;

  /* No ASSERT here because possible to get a (conn == NULL) if we got an accept error */
  if (conn == NULL) {
    return ERR_OK;
  }

  msg.function = do_delconn;
  msg.msg.conn = conn;
  tcpip_apimsg(&msg);

  conn->pcb.tcp = NULL;
  netconn_free(conn);

  return ERR_OK;
}

/**
 * Get the local or remote IP address and port of a netconn.
 * For RAW netconns, this returns the protocol instead of a port!
 *
 * @param conn the netconn to query
 * @param addr a pointer to which to save the IP address
 * @param port a pointer to which to save the port (or protocol for RAW)
 * @param local 1 to get the local IP address, 0 to get the remote one
 * @return ERR_CONN for invalid connections
 *         ERR_OK if the information was retrieved
 */
err_t
netconn_getaddr(struct netconn *conn, struct ip_addr *addr, u16_t *port, u8_t local)
{
  struct api_msg msg;

  LWIP_ERROR("netconn_getaddr: invalid conn", (conn != NULL), return ERR_ARG;);
  LWIP_ERROR("netconn_getaddr: invalid addr", (addr != NULL), return ERR_ARG;);
  LWIP_ERROR("netconn_getaddr: invalid port", (port != NULL), return ERR_ARG;);

  msg.function = do_getaddr;
  msg.msg.conn = conn;
  msg.msg.msg.ad.ipaddr = addr;
  msg.msg.msg.ad.port = port;
  msg.msg.msg.ad.local = local;
  TCPIP_APIMSG(&msg);

  return conn->err;
}

/**
 * Bind a netconn to a specific local IP address and port.
 * Binding one netconn twice might not always be checked correctly!
 *
 * @param conn the netconn to bind
 * @param addr the local IP address to bind the netconn to (use IP_ADDR_ANY
 *             to bind to all addresses)
 * @param port the local port to bind the netconn to (not used for RAW)
 * @return ERR_OK if bound, any other err_t on failure
 */
err_t
netconn_bind(struct netconn *conn, struct ip_addr *addr, u16_t port)
{
  struct api_msg msg;

  LWIP_ERROR("netconn_bind: invalid conn", (conn != NULL), return ERR_ARG;);

  msg.function = do_bind;
  msg.msg.conn = conn;
  msg.msg.msg.bc.ipaddr = addr;
  msg.msg.msg.bc.port = port;
  TCPIP_APIMSG(&msg);
  return conn->err;
}

/**
 * Connect a netconn to a specific remote IP address and port.
 *
 * @param conn the netconn to connect
 * @param addr the remote IP address to connect to
 * @param port the remote port to connect to (no used for RAW)
 * @return ERR_OK if connected, return value of tcp_/udp_/raw_connect otherwise
 */
err_t
netconn_connect(struct netconn *conn, struct ip_addr *addr, u16_t port)
{
  struct api_msg msg;

  LWIP_ERROR("netconn_connect: invalid conn", (conn != NULL), return ERR_ARG;);

  msg.function = do_connect;
  msg.msg.conn = conn;
  msg.msg.msg.bc.ipaddr = addr;
  msg.msg.msg.bc.port = port;
  /* This is the only function which need to not block tcpip_thread */
  tcpip_apimsg(&msg);
  return conn->err;
}

/**
 * Disconnect a netconn from its current peer (only valid for UDP netconns).
 *
 * @param conn the netconn to disconnect
 * @return TODO: return value is not set here...
 */
err_t
netconn_disconnect(struct netconn *conn)
{
  struct api_msg msg;

  LWIP_ERROR("netconn_disconnect: invalid conn", (conn != NULL), return ERR_ARG;);

  msg.function = do_disconnect;
  msg.msg.conn = conn;
  TCPIP_APIMSG(&msg);
  return conn->err;
}

/**
 * Set a TCP netconn into listen mode
 *
 * @param conn the tcp netconn to set to listen mode
 * @param backlog the listen backlog, only used if TCP_LISTEN_BACKLOG==1
 * @return ERR_OK if the netconn was set to listen (UDP and RAW netconns
 *         don't return any error (yet?))
 */
err_t
netconn_listen_with_backlog(struct netconn *conn, u8_t backlog)
{
  struct api_msg msg;

  /* This does no harm. If TCP_LISTEN_BACKLOG is off, backlog is unused. */
  LWIP_UNUSED_ARG(backlog);

  LWIP_ERROR("netconn_listen: invalid conn", (conn != NULL), return ERR_ARG;);

  msg.function = do_listen;
  msg.msg.conn = conn;
#if TCP_LISTEN_BACKLOG
  msg.msg.msg.lb.backlog = backlog;
#endif /* TCP_LISTEN_BACKLOG */
  TCPIP_APIMSG(&msg);
  return conn->err;
}

/**
 * Accept a new connection on a TCP listening netconn.
 *
 * @param conn the TCP listen netconn
 * @return the newly accepted netconn or NULL on timeout
 */
struct netconn *
netconn_accept(struct netconn *conn)
{
  struct netconn *newconn;

  LWIP_ERROR("netconn_accept: invalid conn",       (conn != NULL),                      return NULL;);
  LWIP_ERROR("netconn_accept: invalid acceptmbox", (conn->acceptmbox != SYS_MBOX_NULL), return NULL;);

#if LWIP_SO_RCVTIMEO
  if (sys_arch_mbox_fetch(conn->acceptmbox, (void *)&newconn, conn->recv_timeout) == SYS_ARCH_TIMEOUT) {
    newconn = NULL;
  } else
#else
  sys_arch_mbox_fetch(conn->acceptmbox, (void *)&newconn, 0);
#endif /* LWIP_SO_RCVTIMEO*/
  {
    /* Register event with callback */
    API_EVENT(conn, NETCONN_EVT_RCVMINUS, 0);

#if TCP_LISTEN_BACKLOG
    if (newconn != NULL) {
      /* Let the stack know that we have accepted the connection. */
      struct api_msg msg;
      msg.function = do_recv;
      msg.msg.conn = conn;
      TCPIP_APIMSG(&msg);
    }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91.麻豆视频| 亚洲免费观看在线视频| 欧美一个色资源| 欧美日韩国产综合草草| 欧美综合在线视频| 在线免费视频一区二区| 日本韩国欧美三级| 色偷偷88欧美精品久久久| 99久久er热在这里只有精品15 | 国产成人精品亚洲午夜麻豆| 黄网站免费久久| 久久成人久久爱| 国产成人综合自拍| 国产精品911| 99视频精品全部免费在线| www.日韩精品| 91福利视频久久久久| 欧美亚一区二区| 欧美精品日日鲁夜夜添| 6080午夜不卡| 精品国产sm最大网站免费看| 久久亚区不卡日本| 国产日产欧美一区二区视频| 国产精品传媒视频| 亚洲一区中文日韩| 日本伊人色综合网| 韩国视频一区二区| 成人免费电影视频| 一本一道久久a久久精品| 精品视频一区 二区 三区| 欧美一区二区三区的| 2020日本不卡一区二区视频| 国产精品乱码一区二区三区软件| 依依成人综合视频| 日韩精品欧美精品| 国产一区二区三区电影在线观看 | 欧美肥大bbwbbw高潮| 久久久午夜精品| ㊣最新国产の精品bt伙计久久| 亚洲精品免费看| 美国三级日本三级久久99| 国产经典欧美精品| 91福利视频久久久久| 日韩亚洲欧美在线| 国产精品毛片久久久久久久| 亚洲一区二区三区在线看 | 欧美videofree性高清杂交| 久久久国际精品| 一区二区三区高清不卡| 久久精品久久99精品久久| 国产成人精品一区二| 欧美日韩免费电影| 久久看人人爽人人| 亚洲精品国产精华液| 老司机免费视频一区二区| 97se狠狠狠综合亚洲狠狠| 91.xcao| 亚洲图片激情小说| 蜜桃精品视频在线观看| 99re视频精品| 精品国产乱码久久久久久蜜臀 | 精品国产乱码久久久久久图片| 国产精品狼人久久影院观看方式| 视频一区中文字幕国产| aaa欧美大片| 日韩欧美123| 一级精品视频在线观看宜春院| 国产在线精品不卡| 欧美日韩久久久久久| 国产精品国产三级国产有无不卡| 另类小说欧美激情| 欧美日韩一区视频| 1024成人网色www| 国产精品综合一区二区| 欧美精品久久一区二区三区| 亚洲欧美日韩在线不卡| 韩国v欧美v亚洲v日本v| 制服丝袜中文字幕一区| 亚洲美女屁股眼交3| 懂色av一区二区三区免费观看| 日韩一区二区免费电影| 亚洲综合在线免费观看| 99re这里都是精品| 欧美国产97人人爽人人喊| 韩国欧美国产一区| 91麻豆精品国产无毒不卡在线观看| 亚洲美女屁股眼交3| 99免费精品在线| 国产欧美日产一区| 精品一区二区免费视频| 91精品国产综合久久久久久久| 亚洲午夜久久久久| 色综合天天综合色综合av| 中文成人综合网| 国产91精品精华液一区二区三区| 久久综合久色欧美综合狠狠| 老色鬼精品视频在线观看播放| 制服丝袜亚洲播放| 日韩精品成人一区二区三区| 欧美日韩免费在线视频| 一区二区成人在线| 91成人在线观看喷潮| 一区二区三区中文在线| 色欧美88888久久久久久影院| 亚洲三级视频在线观看| 972aa.com艺术欧美| 亚洲视频免费看| 色综合咪咪久久| 一区二区三区四区蜜桃| 色婷婷精品久久二区二区蜜臂av | 国产在线视频一区二区三区| 精品国产制服丝袜高跟| 激情五月激情综合网| 久久精品亚洲精品国产欧美kt∨| 国产精品一色哟哟哟| 久久九九影视网| av电影在线不卡| 伊人一区二区三区| 欧美视频完全免费看| 婷婷激情综合网| 欧美mv和日韩mv的网站| 国产999精品久久| 亚洲色图制服诱惑 | 在线免费一区三区| 午夜av区久久| 久久老女人爱爱| 99综合影院在线| 亚洲午夜激情av| 日韩欧美你懂的| 国产精品一区二区在线看| 国产精品久久久久久久裸模| 国产精品久久久久久户外露出| 91在线视频官网| 亚欧色一区w666天堂| 日韩精品一区二区三区视频在线观看| 国产乱一区二区| 亚洲人吸女人奶水| 欧美无人高清视频在线观看| 奇米四色…亚洲| 国产精品久久久久久一区二区三区| 欧美亚洲日本一区| 久久99精品国产麻豆不卡| 国产精品传媒入口麻豆| 制服丝袜中文字幕一区| 国产999精品久久久久久绿帽| 一区二区三区中文字幕精品精品 | 免费成人深夜小野草| 国产片一区二区三区| 欧美自拍丝袜亚洲| 久草在线在线精品观看| 国产精品久久久久久一区二区三区 | 国产精品69毛片高清亚洲| 亚洲资源在线观看| 26uuu欧美| 欧美在线综合视频| 国产一区二区三区高清播放| 亚洲精品中文在线观看| 精品国产伦一区二区三区免费| 91蜜桃在线免费视频| 美日韩一级片在线观看| 一区二区三区久久| 久久精品在这里| 欧美日韩五月天| 99精品国产99久久久久久白柏| 美女精品一区二区| 一区二区三区久久久| 国产农村妇女精品| 欧美一区二视频| 91免费版在线| 国产福利91精品| 免费人成黄页网站在线一区二区| 亚洲欧美在线另类| 欧美精品一区二区在线观看| 欧美中文字幕亚洲一区二区va在线 | 一区二区三区四区亚洲| 欧美国产一区视频在线观看| 欧美第一区第二区| 欧美日韩免费观看一区二区三区| 在线免费不卡视频| 激情都市一区二区| 视频在线观看91| 一个色在线综合| 亚洲欧洲精品一区二区三区不卡| 欧美成人aa大片| 欧美精品三级在线观看| 日本韩国一区二区| 波多野结衣在线一区| 国产福利91精品一区| 久久精品国产亚洲aⅴ| 五月婷婷激情综合网| 1000部国产精品成人观看| 久久精品无码一区二区三区| 日韩久久免费av| 日韩欧美亚洲另类制服综合在线| 欧美片网站yy| 在线不卡a资源高清| 欧美日韩国产123区| 欧美性受xxxx黑人xyx| 91精品办公室少妇高潮对白| 91在线观看成人|