Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
063d5992
提交
063d5992
authored
1月 25, 2013
作者:
Steve Underwood
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Properly enforce the far end max datagram when constructing UDPTL packets
上级
6cb3be7d
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
27 行增加
和
4 行删除
+27
-4
udptl.c
src/mod/applications/mod_spandsp/udptl.c
+27
-4
没有找到文件。
src/mod/applications/mod_spandsp/udptl.c
浏览文件 @
063d5992
...
@@ -349,6 +349,8 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
...
@@ -349,6 +349,8 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
int
len
;
int
len
;
int
limit
;
int
limit
;
int
high_tide
;
int
high_tide
;
int
len_before_entries
;
int
previous_len
;
/* UDPTL cannot cope with zero length messages, and our buffering for redundancy limits their
/* UDPTL cannot cope with zero length messages, and our buffering for redundancy limits their
maximum length. */
maximum length. */
...
@@ -392,15 +394,26 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
...
@@ -392,15 +394,26 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
entries
=
s
->
error_correction_entries
;
entries
=
s
->
error_correction_entries
;
else
else
entries
=
s
->
tx_seq_no
;
entries
=
s
->
tx_seq_no
;
len_before_entries
=
len
;
/* The number of entries will always be small, so it is pointless allowing
/* The number of entries will always be small, so it is pointless allowing
for the fragmented case here. */
for the fragmented case here. */
if
(
encode_length
(
buf
,
&
len
,
entries
)
<
0
)
if
(
encode_length
(
buf
,
&
len
,
entries
)
<
0
)
return
-
1
;
return
-
1
;
/* Encode the elements */
/* Encode the elements */
for
(
i
=
0
;
i
<
entries
;
i
++
)
{
for
(
m
=
0
;
m
<
entries
;
m
++
)
{
j
=
(
entry
-
i
-
1
)
&
UDPTL_BUF_MASK
;
previous_len
=
len
;
j
=
(
entry
-
m
-
1
)
&
UDPTL_BUF_MASK
;
if
(
encode_open_type
(
buf
,
&
len
,
s
->
tx
[
j
].
buf
,
s
->
tx
[
j
].
buf_len
)
<
0
)
if
(
encode_open_type
(
buf
,
&
len
,
s
->
tx
[
j
].
buf
,
s
->
tx
[
j
].
buf_len
)
<
0
)
return
-
1
;
return
-
1
;
/* If we have exceeded the far end's max datagram size, don't include this last chunk,
and stop trying to add more. */
if
(
len
>
s
->
far_max_datagram_size
)
{
len
=
previous_len
;
if
(
encode_length
(
buf
,
&
len_before_entries
,
m
)
<
0
)
return
-
1
;
break
;
}
}
}
break
;
break
;
case
UDPTL_ERROR_CORRECTION_FEC
:
case
UDPTL_ERROR_CORRECTION_FEC
:
...
@@ -417,11 +430,13 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
...
@@ -417,11 +430,13 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
/* Span is defined as an inconstrained integer, which it dumb. It will only
/* Span is defined as an inconstrained integer, which it dumb. It will only
ever be a small value. Treat it as such. */
ever be a small value. Treat it as such. */
buf
[
len
++
]
=
1
;
buf
[
len
++
]
=
1
;
buf
[
len
++
]
=
(
uint8_t
)
span
;
buf
[
len
++
]
=
(
uint8_t
)
span
;
len_before_entries
=
len
;
/* The number of entries is defined as a length, but will only ever be a small
/* The number of entries is defined as a length, but will only ever be a small
value. Treat it as such. */
value. Treat it as such. */
buf
[
len
++
]
=
(
uint8_t
)
entries
;
buf
[
len
++
]
=
(
uint8_t
)
entries
;
for
(
m
=
0
;
m
<
entries
;
m
++
)
{
for
(
m
=
0
;
m
<
entries
;
m
++
)
{
previous_len
=
len
;
/* Make an XOR'ed entry the maximum length */
/* Make an XOR'ed entry the maximum length */
limit
=
(
entry
+
m
)
&
UDPTL_BUF_MASK
;
limit
=
(
entry
+
m
)
&
UDPTL_BUF_MASK
;
high_tide
=
0
;
high_tide
=
0
;
...
@@ -439,6 +454,14 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
...
@@ -439,6 +454,14 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
}
}
if
(
encode_open_type
(
buf
,
&
len
,
fec
,
high_tide
)
<
0
)
if
(
encode_open_type
(
buf
,
&
len
,
fec
,
high_tide
)
<
0
)
return
-
1
;
return
-
1
;
/* If we have exceeded the far end's max datagram size, don't include this last chunk,
and stop trying to add more. */
if
(
len
>
s
->
far_max_datagram_size
)
{
len
=
previous_len
;
buf
[
len_before_entries
]
=
(
uint8_t
)
m
;
break
;
}
}
}
break
;
break
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论