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代码分析之异常日志设计 错误异常是面向对象开发中的记录提示程序执行问题的一种重要机制,在程序执行发生问题的条件下,异常会在中断程序执行,同时会沿着代码的执行路径一步一步的向上抛出异常,最 ...
随机推荐
- Repairing Company(poj 3216)
题目大意: 有Q个地点,告诉你Q个地点之间的相互距离(从i地点赶到j地点需要的时间).有M项任务, 给你M项任务所在的地点block.开始时间start和任务完成需要时间time.一个工人只有在 他准 ...
- C语言,输入一个正整数,按由大到小的顺序输出它的所有质数的因子(如180=5*3*3*2*2)
#include <iostream> using namespace std; int main() { long num; while(cin >> num){ ){ co ...
- SecureCRT乱码
http://jingyan.baidu.com/article/948f59245be128d80ff5f9aa.html
- Oracle 性能查看
http://blog.chinaunix.net/uid-20784775-id-373968.html
- IIS网站服务器性能优化指南(转载)
原文网址:http://www.phontol.com/20090507_419416_1.html Windows Server自带的互联网信息服务器(Internet Informat ...
- 比较StringBuffer字符串内容是否相等?
为什么会有这个问题呢?首先得看看String和StringBuffer的比较区别: ==只能比较两个字符串的内存地址是否一样,不能比较字符串内容: String的equals方法因为重写了Object ...
- Web开发中运行环境的配置:(Tomcat7.0.59)和开发环境的配置
第一部分:运行环境的配置 1.下载压缩包,解压即可 2.配置系统变量JAVA_HOME为jdk的安装路径 3.如有需要修改端口号,比如8080已被占用的时候,可以将其改为9080等 apache-to ...
- 如何修改HDFS的备份数
我这个是看别人发的,记录一下,解决办法如下:
- Hark的数据结构与算法练习之地精(侏儒)排序
算法说明 地精排序是交换排序的一种,它是冒泡排序的一种改良,我感觉和鸡尾酒排序挺像的. 不同之处是鸡尾酒排序是从小到大,然后再从大到小切换着排序的.而地精排序是上来先从小到大排序,碰到交换到再从大到小 ...
- 编译x264 for ios
Tested with: x264-snapshot-20140914-2245 我用的是x264-snapshot-20150813-2245.tar.bz2 Xcode 7 依赖gas-prep ...