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代码分析之异常日志设计 错误异常是面向对象开发中的记录提示程序执行问题的一种重要机制,在程序执行发生问题的条件下,异常会在中断程序执行,同时会沿着代码的执行路径一步一步的向上抛出异常,最 ...
随机推荐
- [Android Pro] 横竖屏切换时,禁止activity重新创建,android:configChanges="keyboardHidden|orientation" 不起作用
referece to : http://blog.csdn.net/mybook1122/article/details/24978025 这个网上搜索,很多结果都是: AndroidManifes ...
- (九)STM32之AFIO
也许你以为IO和AFIO是很简单的,事实上有几个误区可能很多人都没注意过,当你只用现成的开发板来学习的时候,别人已经帮你做好了资源分配,所有的外设功能学习都是照着别人给你的例程去做的,这才没让你觉得奇 ...
- 用mtrace检查内存泄漏
http://blog.csdn.net/ixidof/article/details/6638066内存泄漏检查方法(for Linux) 如果你更想读原始文档, 请参考glibc info的&qu ...
- C++类的成员函数使用的一些小总结
From: http://blog.csdn.net/xiayefanxing/article/details/7607506 这一阵做项目代码开发的时候,用到了在一个C++文件中使用另一个类的成员函 ...
- 脚踏实地学C#2-引用类型和值类型
引用类型和值类型介绍 CLR支持两种类型,引用类型和值类型两种基本的类型: 值类型下有int.double.枚举等类型同时也可以称为结构,如int结构类型.double结构类型,所有的值类型都是隐式密 ...
- jquery 展开折叠效果
仅供参考 图片 jquery.js 自己处理 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"& ...
- hdu 4393 优先队列
用优先队列储存每个人的初始距离和编号,每轮求出最快的人,然后pop掉 一开始想遍历队列的,后来发现队列没办法遍历,汗-_-! 题意,给几个第一秒冲出的距离和以后速度,求每秒后最前面人的编号,求完后最前 ...
- HDU 4292 Food 最大流
Food Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submis ...
- zookeeper 4 letter 描述与实践
命令示例描述 Conf echo conf | nc localhost 2181 (New in 3.3.0)输出相关服务配置的详细信息.比如端口.zk数据及日志配置路径.最大连接数,session ...
- PDA手持终端在ERP系统仓库管理出入库盘点环节的应用
PDA手持终端在ERP系统仓库管理出入库盘点环节的应用 传统库存管理的数据录入过程,常采用PC机录入数据,或在电脑上结合条码枪扫描条码进行管理(非实时),造成管理上的不便.因而,采用无线(WIFI)手 ...