⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tport_internal.h

📁 this is simple sip stack.
💻 H
📖 第 1 页 / 共 2 页
字号:
/* * This file is part of the Sofia-SIP package * * Copyright (C) 2005 Nokia Corporation. * * Contact: Pekka Pessi <pekka.pessi@nokia.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * */#ifndef TPORT_INTERNAL_H/** Defined when <tport.h> has been included. */#define TPORT_INTERNAL_H/**@file tport_internal.h * @brief Transport interface * * @author Pekka Pessi <Pekka.Pessi@nokia.com> * * @date Created: Thu Jun 29 15:58:06 2000 ppessi */#ifndef SU_H#include <sofia-sip/su.h>#endif#include <sofia-sip/su_uniqueid.h>#ifndef MSG_ADDR_H#include <sofia-sip/msg_addr.h>#endif#ifndef TPORT_H#include <sofia-sip/tport.h>#endif#if HAVE_SOFIA_STUN#include "sofia-sip/stun.h"#include "sofia-sip/stun_tag.h"#endif#include <sofia-sip/tport_plugins.h>#ifndef SU_DEBUG#define SU_DEBUG 3#endif#define SU_LOG   tport_log#include <sofia-sip/su_debug.h>#if !defined(MSG_NOSIGNAL) || defined(__CYGWIN__)#undef MSG_NOSIGNAL#define MSG_NOSIGNAL (0)#endif#if !HAVE_MSG_TRUNC#define MSG_TRUNC (0)#endif#ifndef NONE#define NONE ((void *)-1)#endifSOFIA_BEGIN_DECLStypedef struct tport_master tport_master_t;typedef struct tport_pending_s tport_pending_t;typedef struct tport_primary tport_primary_t;typedef struct tport_vtable tport_vtable_t;struct sigcomp_state_handler;struct sigcomp_algorithm;struct sigcomp_udvm;struct sigcomp_magic;struct sigcomp_compartment;typedef long unsigned LU; 	/* for printf() and friends *//** Transport parameters */typedef struct {  unsigned tpp_mtu;		/**< Maximum packet size */  unsigned tpp_idle;		/**< Allowed connection idle time. */  unsigned tpp_timeout;		/**< Allowed idle time for message. */  unsigned tpp_sigcomp_lifetime;  /**< SigComp compartment lifetime  */  unsigned tpp_thrpsize;	/**< Size of thread pool */  unsigned tpp_thrprqsize;	/**< Length of per-thread recv queue */  unsigned tpp_qsize;		/**< Size of queue */  unsigned tpp_drop;		/**< Packet drop probablity */  unsigned tpp_conn_orient:1;   /**< Connection-orienteded */  unsigned tpp_sdwn_error:1;	/**< If true, shutdown is error. */  unsigned tpp_stun_server:1;	/**< If true, use stun server */  unsigned :0;} tport_params_t;/** Transport object. * * A transport object can be used in three roles, to represent transport * list (aka master transport), to represent available transports (aka * primary transport) and to represent actual transport connections (aka * secondary transport). */struct tport_s {  su_home_t           tp_home[1];       /**< Memory home */  int                 tp_refs;		/**< Number of references to tport */  unsigned            tp_black:1;       /**< Used by red-black-tree */    unsigned            tp_accepted:1;    /**< Originally server? */  unsigned            tp_conn_orient:1;	/**< Is connection-oriented */  unsigned            tp_connected : 1;	/**< Has real connection */  unsigned            tp_reusable:1;    /**< Can this connection be reused */  unsigned            tp_closed : 1;    /**< This transport is closed */  /**< Remote end has sent FIN (2) or we should not just read */  unsigned            tp_recv_close:2;  /** We will send FIN (1) or have sent FIN (2) */  unsigned            tp_send_close:2;   unsigned            tp_has_keepalive:1;  unsigned            tp_has_stun_server:1;  unsigned            tp_trunc:1;  unsigned:0;  tport_t *tp_left, *tp_right, *tp_dad; /**< Links in tport tree */  tport_master_t     *tp_master;        /**< Master transport */  tport_primary_t    *tp_pri;           /**< Primary transport */  tport_params_t     *tp_params;        /**< Transport parameters */  tp_magic_t         *tp_magic; 	/**< Context provided by consumer */  msg_t const        *tp_rlogged;       /**< Last logged when receiving */  msg_t const        *tp_slogged;       /**< Last logged when sending */  unsigned            tp_time;	        /**< When this transport was last used */  tp_name_t           tp_name[1];	/**< Transport name.					 * 					 * This is either our name (if primary)					 * or peer name (if secondary).					 */#define tp_protoname tp_name->tpn_proto#define tp_canon     tp_name->tpn_canon#define tp_host      tp_name->tpn_host#define tp_port      tp_name->tpn_port#define tp_ident     tp_name->tpn_ident  su_socket_t  	      tp_socket;	/**< Socket of this tport*/  int                 tp_index;		/**< Root registration index */  int                 tp_events;        /**< Subscribed events */  su_addrinfo_t       tp_addrinfo[1];   /**< Peer/own address info */  su_sockaddr_t       tp_addr[1];	/**< Peer/own address */#define tp_addrlen tp_addrinfo->ai_addrlen  /* ==== Receive queue ================================================== */  msg_t   	     *tp_msg;		/**< Message being received */  /* ==== Pending messages =============================================== */  tport_pending_t    *tp_pending;       /**< Pending requests */  tport_pending_t    *tp_released;      /**< Released pends */  unsigned            tp_plen;          /**< Size of tp_pending */  unsigned            tp_pused;         /**< Used pends */  unsigned            tp_reported;      /**< Report counter */  /* ==== Send queue ===================================================== */  msg_t             **tp_queue;		/**< Messages being sent */  unsigned short      tp_qhead;		/**< Head of queue */  msg_iovec_t        *tp_unsent;	/**< Pointer to first unsent iovec */  unsigned            tp_unsentlen;	/**< Number of unsent iovecs */  msg_iovec_t        *tp_iov;		/**< Iovecs allocated for sending */  unsigned            tp_iovlen;	/**< Number of allocated iovecs */  /* ==== Extensions  ===================================================== */  tport_compressor_t *tp_comp;  /* ==== Statistics  ===================================================== */    struct {    uint64_t sent_bytes, sent_on_line, recv_bytes, recv_on_line;    uint64_t sent_msgs, recv_msgs;  } tp_stats;};/** Primary structure */struct tport_primary {  tport_t             pri_primary[1];   /**< Transport part */#if DOX  su_home_t           pri_home[1];#else#define pri_home      pri_primary->tp_home#define pri_master    pri_primary->tp_master#define pri_protoname pri_primary->tp_name->tpn_proto#endif  tport_vtable_t const                     *pri_vtable;  int                 pri_public;       /**< Type of primary transport; 					 * tport_type_local,					 * tport_type_stun, etc. 					 */  char                pri_ident[16];  tport_primary_t    *pri_next;	        /**< Next primary tport */  tport_t            *pri_secondary;	/**< Secondary tports */  unsigned            pri_updating:1;   /**< Currently updating address */  unsigned            pri_natted:1;	/**< Using natted address  */  unsigned            pri_has_tls:1;	/**< Supports tls  */  unsigned:0;  void               *pri_stun_handle;  tport_params_t      pri_params[1];      /**< Transport parameters */};/** Master structure */struct tport_master {  tport_t             mr_master[1];#if DOX  su_home_t           mr_home[1];#else#define mr_home mr_master->tp_home#endif  int                 mr_stun_step_ready; /**< for stun's callback */  tp_stack_t  	     *mr_stack;         /**< Transport consumer */  tp_stack_class_t                const *mr_tpac;		/**< Methods provided by stack */  int                 mr_log;	        /**< Do logging of parsed messages */  su_root_t    	     *mr_root;		/**< SU root pointer */  /**< Timer reclaiming unused connections and compartment */  su_timer_t         *mr_timer;		  /** File to dump received and sent data */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -