Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
9ff4cfd5
提交
9ff4cfd5
authored
11月 10, 2010
作者:
Stefan Knoblich
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ftmod_libpri: "ftdm libpri debug <span>" now prints the current debug flags
Signed-off-by:
Stefan Knoblich
<
s.knoblich@axsentis.de
>
上级
b278dd23
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
45 行增加
和
4 行删除
+45
-4
ftmod_libpri.c
libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c
+45
-4
没有找到文件。
libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c
浏览文件 @
9ff4cfd5
...
...
@@ -167,19 +167,23 @@ static void s_pri_message(struct pri *pri, char *s)
ftdm_log
(
FTDM_LOG_DEBUG
,
"%s"
,
s
);
}
#define PRI_DEBUG_Q921_ALL (PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_STATE)
#define PRI_DEBUG_Q931_ALL (PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q931_ANOMALY)
static
const
struct
ftdm_libpri_debug
{
const
char
*
name
;
const
int
flags
;
}
ftdm_libpri_debug
[]
=
{
/* NOTE: order is important for print_debug() */
{
"q921_all"
,
PRI_DEBUG_Q921_ALL
},
{
"q921_raw"
,
PRI_DEBUG_Q921_RAW
},
{
"q921_dump"
,
PRI_DEBUG_Q921_DUMP
},
{
"q921_state"
,
PRI_DEBUG_Q921_STATE
},
{
"q921_all"
,
(
PRI_DEBUG_Q921_RAW
|
PRI_DEBUG_Q921_DUMP
|
PRI_DEBUG_Q921_STATE
)
},
{
"q931_all"
,
PRI_DEBUG_Q931_ALL
},
{
"q931_dump"
,
PRI_DEBUG_Q931_DUMP
},
{
"q931_state"
,
PRI_DEBUG_Q931_STATE
},
{
"q931_anomaly"
,
PRI_DEBUG_Q931_ANOMALY
},
{
"q931_all"
,
(
PRI_DEBUG_Q931_DUMP
|
PRI_DEBUG_Q931_STATE
|
PRI_DEBUG_Q931_ANOMALY
)
},
{
"config"
,
PRI_DEBUG_CONFIG
},
{
"apdu"
,
PRI_DEBUG_APDU
},
...
...
@@ -217,13 +221,43 @@ static int parse_debug(const char *in, uint32_t *flags)
return
res
;
}
static
int
print_debug
(
uint32_t
flags
,
char
*
tmp
,
const
int
size
)
{
int
offset
=
0
;
int
res
=
0
;
int
i
;
if
((
flags
&
PRI_DEBUG_ALL
)
==
PRI_DEBUG_ALL
)
{
strcat
(
tmp
,
"all"
);
return
0
;
}
else
if
(
!
flags
)
{
strcat
(
tmp
,
"none"
);
return
0
;
}
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
ftdm_libpri_debug
);
i
++
)
{
if
((
flags
&
ftdm_libpri_debug
[
i
].
flags
)
==
ftdm_libpri_debug
[
i
].
flags
)
{
res
=
snprintf
(
&
tmp
[
offset
],
size
-
offset
,
"%s,"
,
ftdm_libpri_debug
[
i
].
name
);
if
(
res
<=
0
||
res
==
(
size
-
offset
))
goto
out
;
offset
+=
res
;
flags
&=
~
ftdm_libpri_debug
[
i
].
flags
;
/* remove detected flags to make *_all work correctly */
}
}
out:
tmp
[
offset
-
1
]
=
'\0'
;
return
0
;
}
static
ftdm_status_t
ftdm_libpri_start
(
ftdm_span_t
*
span
);
static
ftdm_io_interface_t
ftdm_libpri_interface
;
static
const
char
*
ftdm_libpri_usage
=
"Usage:
\n
"
"libpri kill <span>
\n
"
"libpri debug <span>
<all|none|flag,...flagN>
\n
"
"libpri debug <span>
[all|none|flag,...flagN]
\n
"
"
\n
"
"Possible debug flags:
\n
"
"
\t
q921_raw - Q.921 Raw messages
\n
"
...
...
@@ -289,7 +323,7 @@ static FIO_API_FUNCTION(ftdm_libpri_api)
}
}
if
(
argc
>
2
)
{
if
(
argc
>
=
2
)
{
if
(
!
strcasecmp
(
argv
[
0
],
"debug"
))
{
ftdm_span_t
*
span
=
NULL
;
...
...
@@ -302,6 +336,13 @@ static FIO_API_FUNCTION(ftdm_libpri_api)
goto
done
;
}
if
(
argc
==
2
)
{
char
tmp
[
100
]
=
{
0
};
print_debug
(
pri_get_debug
(
isdn_data
->
spri
.
pri
),
tmp
,
sizeof
(
tmp
));
stream
->
write_function
(
stream
,
"%s: +OK current debug flags: '%s'
\n
"
,
__FILE__
,
tmp
);
goto
done
;
}
if
(
parse_debug
(
argv
[
2
],
&
flags
)
==
-
1
)
{
stream
->
write_function
(
stream
,
"%s: -ERR invalid debug flags given
\n
"
,
__FILE__
);
goto
done
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论