Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
d72a54ff
提交
d72a54ff
authored
1月 25, 2012
作者:
Brian West
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve the on off switch in ZRTP thanks jim
上级
94bcd55e
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
56 行增加
和
50 行删除
+56
-50
switch_rtp.c
src/switch_rtp.c
+56
-50
没有找到文件。
src/switch_rtp.c
浏览文件 @
d72a54ff
...
...
@@ -847,7 +847,9 @@ SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool_t *pool)
zrtp_config
.
is_mitm
=
1
;
zrtp_config
.
lic_mode
=
ZRTP_LICENSE_MODE_ACTIVE
;
switch_snprintf
(
zrtp_cache_path
,
sizeof
(
zrtp_cache_path
),
"%s%szrtp.dat"
,
SWITCH_GLOBAL_dirs
.
db_dir
,
SWITCH_PATH_SEPARATOR
);
zrtp_zstrcpyc
(
ZSTR_GV
(
zrtp_config
.
def_cache_path
),
zrtp_cache_path
);
zrtp_zstrcpyc
((
zrtp_stringn_t
*
)
zrtp_config
.
def_cache_path
.
buffer
,
zrtp_cache_path
);
zrtp_config
.
def_cache_path
.
length
=
strlen
(
zrtp_cache_path
);
zrtp_config
.
def_cache_path
.
max_length
=
255
;
zrtp_config
.
cb
.
event_cb
.
on_zrtp_protocol_event
=
zrtp_event_callback
;
zrtp_config
.
cb
.
misc_cb
.
on_send_packet
=
zrtp_send_rtp_callback
;
zrtp_config
.
cb
.
event_cb
.
on_zrtp_security_event
=
zrtp_event_callback
;
...
...
@@ -1674,7 +1676,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session
}
#ifdef ENABLE_ZRTP
if
(
zrtp_on
)
{
if
(
zrtp_on
&&
!
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_PROXY_MEDIA
)
)
{
switch_rtp_t
*
master_rtp_session
=
NULL
;
int
initiator
=
0
;
...
...
@@ -2169,7 +2171,7 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)
#ifdef ENABLE_ZRTP
/* ZRTP */
if
(
zrtp_on
)
{
if
(
zrtp_on
&&
!
switch_test_flag
((
*
rtp_session
),
SWITCH_RTP_FLAG_PROXY_MEDIA
)
)
{
if
((
*
rtp_session
)
->
zrtp_stream
!=
NULL
)
{
zrtp_stream_stop
((
*
rtp_session
)
->
zrtp_stream
);
...
...
@@ -2605,25 +2607,27 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
if
(
!
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_PROXY_MEDIA
)
&&
!
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_UDPTL
))
{
#ifdef ENABLE_ZRTP
/* ZRTP Recv */
unsigned
int
sbytes
=
(
int
)
*
bytes
;
zrtp_status_t
stat
=
0
;
stat
=
zrtp_process_srtp
(
rtp_session
->
zrtp_stream
,
(
void
*
)
&
rtp_session
->
recv_msg
,
&
sbytes
);
switch
(
stat
)
{
case
zrtp_status_ok
:
*
bytes
=
sbytes
;
break
;
case
zrtp_status_drop
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error: zRTP protection drop with code %d
\n
"
,
stat
);
*
bytes
=
0
;
return
SWITCH_STATUS_SUCCESS
;
case
zrtp_status_fail
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error: zRTP protection fail with code %d
\n
"
,
stat
);
return
SWITCH_STATUS_FALSE
;
default
:
break
;
if
(
zrtp_on
)
{
unsigned
int
sbytes
=
(
int
)
*
bytes
;
zrtp_status_t
stat
=
0
;
stat
=
zrtp_process_srtp
(
rtp_session
->
zrtp_stream
,
(
void
*
)
&
rtp_session
->
recv_msg
,
&
sbytes
);
switch
(
stat
)
{
case
zrtp_status_ok
:
*
bytes
=
sbytes
;
break
;
case
zrtp_status_drop
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error: zRTP protection drop with code %d
\n
"
,
stat
);
*
bytes
=
0
;
return
SWITCH_STATUS_SUCCESS
;
case
zrtp_status_fail
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error: zRTP protection fail with code %d
\n
"
,
stat
);
return
SWITCH_STATUS_FALSE
;
default
:
break
;
}
}
#endif
...
...
@@ -2771,27 +2775,29 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
#ifdef ENABLE_ZRTP
/* ZRTP Recv */
if
(
bytes
)
{
unsigned
int
sbytes
=
(
int
)
*
bytes
;
zrtp_status_t
stat
=
0
;
stat
=
zrtp_process_srtcp
(
rtp_session
->
zrtp_stream
,
(
void
*
)
&
rtp_session
->
rtcp_recv_msg
,
&
sbytes
);
switch
(
stat
)
{
case
zrtp_status_ok
:
*
bytes
=
sbytes
;
break
;
case
zrtp_status_drop
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error: zRTP protection drop with code %d
\n
"
,
stat
);
*
bytes
=
0
;
break
;
case
zrtp_status_fail
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error: zRTP protection fail with code %d
\n
"
,
stat
);
*
bytes
=
0
;
break
;
default
:
break
;
if
(
zrtp_on
&&
!
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_PROXY_MEDIA
))
{
/* ZRTP Recv */
if
(
bytes
)
{
unsigned
int
sbytes
=
(
int
)
*
bytes
;
zrtp_status_t
stat
=
0
;
stat
=
zrtp_process_srtcp
(
rtp_session
->
zrtp_stream
,
(
void
*
)
&
rtp_session
->
rtcp_recv_msg
,
&
sbytes
);
switch
(
stat
)
{
case
zrtp_status_ok
:
*
bytes
=
sbytes
;
break
;
case
zrtp_status_drop
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error: zRTP protection drop with code %d
\n
"
,
stat
);
*
bytes
=
0
;
break
;
case
zrtp_status_fail
:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Error: zRTP protection fail with code %d
\n
"
,
stat
);
*
bytes
=
0
;
break
;
default
:
break
;
}
}
}
#endif
...
...
@@ -3022,12 +3028,12 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
#ifdef ENABLE_ZRTP
/* ZRTP Send */
if
(
1
)
{
if
(
zrtp_on
&&
!
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_PROXY_MEDIA
)
)
{
unsigned
int
sbytes
=
(
int
)
bytes
;
zrtp_status_t
stat
=
zrtp_status_fail
;
stat
=
zrtp_process_rtcp
(
other_rtp_session
->
zrtp_stream
,
(
void
*
)
&
other_rtp_session
->
rtcp_send_msg
,
&
sbytes
);
switch
(
stat
)
{
case
zrtp_status_ok
:
break
;
...
...
@@ -3042,7 +3048,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
default
:
break
;
}
bytes
=
sbytes
;
}
#endif
...
...
@@ -3906,7 +3912,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
#endif
#ifdef ENABLE_ZRTP
/* ZRTP Send */
if
(
1
)
{
if
(
zrtp_on
&&
!
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_PROXY_MEDIA
)
)
{
unsigned
int
sbytes
=
(
int
)
bytes
;
zrtp_status_t
stat
=
zrtp_status_fail
;
...
...
@@ -4027,7 +4033,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
#ifdef ENABLE_ZRTP
/* ZRTP Send */
if
(
1
)
{
if
(
zrtp_on
&&
!
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_PROXY_MEDIA
)
)
{
unsigned
int
sbytes
=
(
int
)
bytes
;
zrtp_status_t
stat
=
zrtp_status_fail
;
...
...
@@ -4356,7 +4362,7 @@ SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
#endif
#ifdef ENABLE_ZRTP
/* ZRTP Send */
if
(
1
)
{
if
(
zrtp_on
&&
!
switch_test_flag
(
rtp_session
,
SWITCH_RTP_FLAG_PROXY_MEDIA
)
)
{
unsigned
int
sbytes
=
(
int
)
bytes
;
zrtp_status_t
stat
=
zrtp_status_fail
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论