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

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

?? api_lib.c

?? stm32+ucos-ii
?? C
?? 第 1 頁 / 共 2 頁
字號:
/**
 * @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
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩在线播放一区二区| 亚洲欧美日韩国产手机在线| 在线看日本不卡| 一本一道久久a久久精品| 成人高清免费在线播放| 国产福利一区二区三区在线视频| 精品一区二区三区视频在线观看| 婷婷六月综合网| 日韩成人午夜电影| 美女被吸乳得到大胸91| 国产一区91精品张津瑜| 国产成人精品一区二| eeuss鲁一区二区三区| 色婷婷一区二区三区四区| 欧美亚洲精品一区| 日韩欧美国产一二三区| 久久人人97超碰com| 国产精品美女久久久久aⅴ| 亚洲免费观看高清| 日本成人超碰在线观看| 国产精品一区二区久激情瑜伽| 国产激情精品久久久第一区二区| 成人性生交大合| 91国偷自产一区二区三区观看 | 亚洲欧美日韩在线不卡| 亚洲在线观看免费| 美日韩一级片在线观看| 福利电影一区二区三区| 欧美日韩免费不卡视频一区二区三区| 欧美一区二区福利在线| 欧美激情中文字幕| 亚洲成人一区二区| 国产美女在线观看一区| 欧美主播一区二区三区| 国产亚洲成年网址在线观看| 亚洲曰韩产成在线| 国产成人免费在线观看| 欧美最新大片在线看| 久久新电视剧免费观看| 一区二区三区资源| 国产一区二区美女| 欧美日韩视频第一区| 国产欧美日韩在线| 日韩福利视频导航| www.在线欧美| 久久免费的精品国产v∧| 亚洲福利视频一区二区| 丁香五精品蜜臀久久久久99网站 | 国产精品日韩精品欧美在线| 亚洲欧美乱综合| 国产精品夜夜嗨| 欧美一区欧美二区| 一区二区激情小说| 成人亚洲一区二区一| 欧美一区二区三区的| 日韩美女精品在线| 国产69精品久久久久毛片| 欧美一区二区三区在线电影| 亚洲精品午夜久久久| www.一区二区| 日本一区二区三区久久久久久久久不 | 欧美视频你懂的| 亚洲色图制服诱惑| 国产精品成人免费精品自在线观看 | 91福利国产精品| 中文字幕一区二区三区四区| 国产成人在线色| 久久蜜桃av一区二区天堂| 麻豆成人综合网| 在线播放亚洲一区| 午夜婷婷国产麻豆精品| 欧美三级韩国三级日本三斤| 亚洲精品va在线观看| 色综合久久综合中文综合网| 日韩一区在线看| 色呦呦日韩精品| 亚洲资源中文字幕| 欧美久久久久免费| 午夜电影网一区| 337p亚洲精品色噜噜| 天天影视色香欲综合网老头| 欧美电影在线免费观看| 婷婷中文字幕一区三区| 91精品欧美一区二区三区综合在| 亚洲成人你懂的| 欧美一区二区三区免费在线看| 性感美女极品91精品| 欧美精选一区二区| 亚洲mv在线观看| 日韩免费电影一区| 国产激情91久久精品导航| 国产精品毛片久久久久久| 91丨porny丨中文| 亚洲国产精品久久久久婷婷884| 欧美专区亚洲专区| 免费欧美在线视频| 国产亚洲一区二区在线观看| 国产·精品毛片| 一区二区三区不卡视频| 欧美一区二区三区啪啪| 成人在线一区二区三区| 亚洲资源中文字幕| 日韩三级伦理片妻子的秘密按摩| 国内精品国产三级国产a久久| 国产精品欧美一区喷水| 欧美视频自拍偷拍| 精品一区二区三区在线观看| 国产精品不卡在线观看| 欧美精品九九99久久| 国产麻豆日韩欧美久久| 一区二区三区精品久久久| 精品国一区二区三区| 色婷婷狠狠综合| 精品一二三四在线| 亚洲综合色区另类av| 国产人成亚洲第一网站在线播放 | 天堂av在线一区| 日本一区二区三区四区| 51精品秘密在线观看| a美女胸又www黄视频久久| 免播放器亚洲一区| 亚洲久本草在线中文字幕| 欧美大白屁股肥臀xxxxxx| 99久久国产综合精品色伊| 麻豆91精品视频| 又紧又大又爽精品一区二区| 国产日韩欧美一区二区三区综合| 欧美老女人第四色| 99精品一区二区三区| 精品综合免费视频观看| 亚洲二区在线观看| 国产精品久久久久久妇女6080| 精品国产一区二区在线观看| 91国偷自产一区二区使用方法| 成人午夜精品一区二区三区| 韩国视频一区二区| 日韩av中文字幕一区二区三区 | 欧美顶级少妇做爰| 色婷婷亚洲综合| 9色porny自拍视频一区二区| 国产一区二区调教| 久久精品72免费观看| 日本麻豆一区二区三区视频| 午夜精品久久久久久| 一级特黄大欧美久久久| 亚洲柠檬福利资源导航| 国产精品久久二区二区| 国产喂奶挤奶一区二区三区| 久久夜色精品国产噜噜av| 精品入口麻豆88视频| 日韩精品在线看片z| 日韩你懂的在线播放| 日韩精品一区二区三区在线观看| 91精品在线观看入口| 777午夜精品免费视频| 欧美日本一区二区| 欧美丰满一区二区免费视频| 欧美一区午夜视频在线观看| 欧美一区二区三区性视频| 日韩丝袜美女视频| 日韩小视频在线观看专区| 日韩欧美国产综合| 久久久一区二区| 国产精品久久久久aaaa樱花| 欧美国产欧美综合| 亚洲欧美日韩在线播放| 亚洲综合精品久久| 日韩电影免费在线看| 激情成人综合网| 国产在线播精品第三| 北岛玲一区二区三区四区| 色94色欧美sute亚洲线路二| 欧美日韩精品一区二区在线播放| 欧美日本在线一区| 久久久天堂av| 亚洲欧美日韩电影| 五月激情六月综合| 国产一区高清在线| 91黄色在线观看| 欧美草草影院在线视频| 亚洲欧洲精品一区二区三区| 有坂深雪av一区二区精品| 美女性感视频久久| 成人午夜免费电影| 欧美日韩一区不卡| 国产欧美一区在线| 亚洲一区二区综合| 国产精品综合一区二区三区| 一本色道久久综合精品竹菊| 91精品国产全国免费观看| 国产女人18水真多18精品一级做 | 制服丝袜成人动漫| 欧美激情一区二区三区蜜桃视频| 亚洲国产色一区| 成人自拍视频在线| 欧美一区二区三区的| 亚洲欧美日韩久久| 国产精品一区二区你懂的| 欧美日韩精品一区视频| 国产精品日韩成人|