eXosip2代码分析
主要类型定义:
1、struct eXtl_protocol
struct eXtl_protocol {
int enabled;
int proto_port;
char proto_name[];
char proto_ifs[];
int proto_num;
int proto_family;
int proto_secure;
int proto_reliable;
int (*tl_init) (void);
int (*tl_free) (void);
int (*tl_open) (void);
int (*tl_set_fdset) (fd_set * osip_fdset, fd_set * osip_wrset, int *fd_max);
int (*tl_read_message) (fd_set * osip_fdset, fd_set * osip_wrset);
int (*tl_send_message) (osip_transaction_t * tr, osip_message_t * sip,
char *host, int port, int out_socket);
int (*tl_keepalive) (void);
int (*tl_set_socket) (int socket);
int (*tl_masquerade_contact) (const char *ip, int port);
int (*tl_get_masquerade_contact) (char *ip, int ip_size, char *port,
int port_size);
};
struct eXtl_protocol eXtl_udp = {
,
,
"UDP",
"0.0.0.0",
IPPROTO_UDP,
AF_INET,
,
,
&udp_tl_init,
&udp_tl_free,
&udp_tl_open,
&udp_tl_set_fdset,
&udp_tl_read_message,
&udp_tl_send_message,
&udp_tl_keepalive,
&udp_tl_set_socket,
&udp_tl_masquerade_contact,
&udp_tl_get_masquerade_contact
};
struct eXtl_protocol eXtl_tcp = {
,
,
"TCP",
"0.0.0.0",
IPPROTO_TCP,
AF_INET,
,
,
&tcp_tl_init,
&tcp_tl_free,
&tcp_tl_open,
&tcp_tl_set_fdset,
&tcp_tl_read_message,
&tcp_tl_send_message,
&tcp_tl_keepalive,
&tcp_tl_set_socket,
&tcp_tl_masquerade_contact,
&tcp_tl_get_masquerade_contact
};
struct eXtl_protocol eXtl_dtls = {
,
,
"DTLS-UDP",
"0.0.0.0",
IPPROTO_UDP,
AF_INET,
,
,
&dtls_tl_init,
&dtls_tl_free,
&dtls_tl_open,
&dtls_tl_set_fdset,
&dtls_tl_read_message,
&dtls_tl_send_message,
&dtls_tl_keepalive,
&dtls_tl_set_socket,
&dtls_tl_masquerade_contact,
&dtls_tl_get_masquerade_contact
};
struct eXtl_protocol eXtl_tls = {
,
,
"TLS",
"0.0.0.0",
IPPROTO_TCP,
AF_INET,
,
,
&tls_tl_init,
&tls_tl_free,
&tls_tl_open,
&tls_tl_set_fdset,
&tls_tl_read_message,
&tls_tl_send_message,
&tls_tl_keepalive,
&tls_tl_set_socket,
&tls_tl_masquerade_contact,
&tls_tl_get_masquerade_contact
};
2、typedef struct eXosip_t eXosip_t;
struct eXosip_t {
struct eXtl_protocol *eXtl;
char transport[];
char *user_agent;
eXosip_call_t *j_calls; /* my calls */
#ifndef MINISIZE
eXosip_subscribe_t *j_subscribes; /* my friends */
eXosip_notify_t *j_notifies; /* my susbscribers */
#endif
osip_list_t j_transactions;
eXosip_reg_t *j_reg; /* my registrations */
#ifndef MINISIZE
eXosip_pub_t *j_pub; /* my publications */
#endif
#ifdef OSIP_MT
void *j_cond;
void *j_mutexlock;
#endif
osip_t *j_osip;
int j_stop_ua;
#ifdef OSIP_MT
void *j_thread;
jpipe_t *j_socketctl;
jpipe_t *j_socketctl_event;
#endif
osip_fifo_t *j_events;
jauthinfo_t *authinfos;
int keep_alive;
int keep_alive_options;
int learn_port;
#ifndef MINISIZE
int http_port;
char http_proxy[];
char http_outbound_proxy[];
int dontsend_101;
#endif
int use_rport;
int dns_capabilities;
int dscp;
char ipv4_for_gateway[];
char ipv6_for_gateway[];
#ifndef MINISIZE
char event_package[];
#endif
struct eXosip_dns_cache dns_entries[MAX_EXOSIP_DNS_ENTRY];
struct eXosip_account_info account_entries[MAX_EXOSIP_ACCOUNT_INFO];
struct eXosip_http_auth http_auths[MAX_EXOSIP_HTTP_AUTH];
CbSipCallback cbsipCallback;
};
3、eXosip_event_t
/**
* Structure for event description
* @struct eXosip_event
*/
struct eXosip_event
{
eXosip_event_type_t type; /**< type of the event */
char textinfo[256]; /**< text description of event */
void *external_reference; /**< external reference (for calls) */ osip_message_t *request; /**< request within current transaction */
osip_message_t *response; /**< last response within current transaction */
osip_message_t *ack; /**< ack within current transaction */ int tid; /**< unique id for transactions (to be used for answers) */
int did; /**< unique id for SIP dialogs */ int rid; /**< unique id for registration */
int cid; /**< unique id for SIP calls (but multiple dialogs!) */
int sid; /**< unique id for outgoing subscriptions */
int nid; /**< unique id for incoming subscriptions */ int ss_status; /**< current Subscription-State for subscription */
int ss_reason; /**< current Reason status for subscription */
};
主要函数说明:
1、eXosip_init
/**
* Initiate the eXtented oSIP library.
*
*/
int eXosip_init (void);
2、eXosip_listen_addr
/**
* Listen on a specified socket.
*
* @param transport IPPROTO_UDP for udp. (soon to come: TCP/TLS?)
* @param addr the address to bind (NULL for all interface)
* @param port the listening port. (0 for random port)
* @param family the IP family (AF_INET or AF_INET6).
* @param secure 0 for UDP or TCP, 1 for TLS (with TCP).
*/
int eXosip_listen_addr (int transport, const char *addr, int port, int family,
int secure);
3、eXosip_execute
/**
* Process (non-threaded mode ONLY) eXosip events.
*
*/
int eXosip_execute (void);
4、eXosip_lock、eXosip_unlock
#ifdef OSIP_MT /**
* Lock the eXtented oSIP library.
*
*/
int eXosip_lock (void); /**
* UnLock the eXtented oSIP library.
*
*/
int eXosip_unlock (void); #else
5、__eXosip_wakeup_event
/**
* Wake Up the eXosip_event_wait method.
*
*/
#ifdef OSIP_MT
void __eXosip_wakeup_event (void);
#else
#define __eXosip_wakeup_event() ;
#endif
6、eXosip_event_wait
/**
* Wait for an eXosip event.
*
* @param tv_s timeout value (seconds).
* @param tv_ms timeout value (mseconds).
*/
eXosip_event_t *eXosip_event_wait (int tv_s, int tv_ms);
aa
eXosip2代码分析的更多相关文章
- Android代码分析工具lint学习
1 lint简介 1.1 概述 lint是随Android SDK自带的一个静态代码分析工具.它用来对Android工程的源文件进行检查,找出在正确性.安全.性能.可使用性.可访问性及国际化等方面可能 ...
- pmd静态代码分析
在正式进入测试之前,进行一定的静态代码分析及code review对代码质量及系统提高是有帮助的,以上为数据证明 Pmd 它是一个基于静态规则集的Java源码分析器,它可以识别出潜在的如下问题:– 可 ...
- [Asp.net 5] DependencyInjection项目代码分析-目录
微软DI文章系列如下所示: [Asp.net 5] DependencyInjection项目代码分析 [Asp.net 5] DependencyInjection项目代码分析2-Autofac [ ...
- [Asp.net 5] DependencyInjection项目代码分析4-微软的实现(5)(IEnumerable<>补充)
Asp.net 5的依赖注入注入系列可以参考链接: [Asp.net 5] DependencyInjection项目代码分析-目录 我们在之前讲微软的实现时,对于OpenIEnumerableSer ...
- 完整全面的Java资源库(包括构建、操作、代码分析、编译器、数据库、社区等等)
构建 这里搜集了用来构建应用程序的工具. Apache Maven:Maven使用声明进行构建并进行依赖管理,偏向于使用约定而不是配置进行构建.Maven优于Apache Ant.后者采用了一种过程化 ...
- STM32启动代码分析 IAR 比较好
stm32启动代码分析 (2012-06-12 09:43:31) 转载▼ 最近开始使用ST的stm32w108芯片(也是一款zigbee芯片).开始看他的启动代码看的晕晕呼呼呼的. 还好在c ...
- 常用 Java 静态代码分析工具的分析与比较
常用 Java 静态代码分析工具的分析与比较 简介: 本文首先介绍了静态代码分析的基 本概念及主要技术,随后分别介绍了现有 4 种主流 Java 静态代码分析工具 (Checkstyle,FindBu ...
- SonarQube-5.6.3 代码分析平台搭建使用
python代码分析 官网主页: http://docs.sonarqube.org/display/PLUG/Python+Plugin Windows下安装使用: 快速使用: 1.下载jdk ht ...
- angular代码分析之异常日志设计
angular代码分析之异常日志设计 错误异常是面向对象开发中的记录提示程序执行问题的一种重要机制,在程序执行发生问题的条件下,异常会在中断程序执行,同时会沿着代码的执行路径一步一步的向上抛出异常,最 ...
随机推荐
- VS禁止特定警告
项目右键-属性-配置属性-C/C++-高级-禁用特定警告-填写警告编号例如4996
- Struts文件上传allowedTypes问题,烦人的“允许上传的文件类型”
Struts的文件上传问题,相信很多人都会使用allowedTypes参数来配置允许上传的文件类型,如下. <param name="allowedTypes"> im ...
- delete 类对象指针的注意事项]
http://blog.csdn.net/infoworld/article/details/45560219 场景:1. C++类有构造和析构函数,析构函数是在类对象被delete时(或局部变量自动 ...
- TCP的长连接和短连接
TCP/IP是个协议组,可分为三个层次:网络层.传输层和应用层. 在网络层有IP协议.ICMP协议.ARP协议.RARP协议和BOOTP协议. 在传输层中有TCP协议与UDP协议. 在应用层有FTP. ...
- 面向服务的体系结构(SOA)——(5)关于MEP(Message Exchange Patterns)
SOA中的MEP和JavaEE中的JMS类似,当然了就应该是类似的,因为都是关于消息方面的.一个是对系统架构当中消息的解决思路,一个是针对Java平台中的消息的具体解决办法(严格说不是具体的,只是提供 ...
- WPF控件委托
this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart)delegate { //要执行的代码 });
- 64位ubuntu安装32位jdk
转自:http://blog.csdn.net/anladeyatou/article/details/8213334 ubuntu-11.10-desktop-amd64 jdk-6u23-linu ...
- Android开发之日历控件实现
Android开发之日历控件实现:以下都是转载的. 日历控件 日历控件 日历控件 日历控件
- 安装完最小化 RHEL/CentOS 7 后需要做的 30 件事情(四)码农网
17. 安装 Webmin Webmin 是基于 Web 的 Linux 配置工具.它像一个中央系统,用于配置各种系统设置,比如用户.磁盘分配.服务以及 HTTP 服务器.Apache.MySQL 等 ...
- C#之MemberwiseClone与Clone
MemberwiseClone 方法创建一个浅表副本,具体来说就是创建一个新对象,然后将当前对象的非静态字段复制到该新对象.如果字段是值类型的,则对该字段执行逐位复制.如果字段是引用类型,则复制引用但 ...