Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
d4f6fb8e
提交
d4f6fb8e
authored
3月 17, 2007
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@4632
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
0f9eecd3
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
53 行增加
和
22 行删除
+53
-22
switch.h
src/include/switch.h
+1
-1
switch_loadable_module.h
src/include/switch_loadable_module.h
+1
-1
switch_types.h
src/include/switch_types.h
+5
-0
mod_commands.c
src/mod/applications/mod_commands/mod_commands.c
+5
-2
switch_loadable_module.c
src/switch_loadable_module.c
+41
-18
没有找到文件。
src/include/switch.h
浏览文件 @
d4f6fb8e
...
...
@@ -48,7 +48,7 @@
#endif
#define FREESWITCH_PEN "27880"
#define FREESWITCH_
MIB
".1.3.6.1.4.1." FREESWITCH_PEN
#define FREESWITCH_
OID_PREFIX
".1.3.6.1.4.1." FREESWITCH_PEN
#define FREESWITCH_ITAD "543"
...
...
src/include/switch_loadable_module.h
浏览文件 @
d4f6fb8e
...
...
@@ -240,7 +240,7 @@ SWITCH_DECLARE(switch_status_t) switch_api_execute(char *cmd, char *arg, switch_
\param fname the file name of the module
\return the status
*/
SWITCH_DECLARE
(
switch_status_t
)
switch_loadable_module_load_module
(
char
*
dir
,
char
*
fname
);
SWITCH_DECLARE
(
switch_status_t
)
switch_loadable_module_load_module
(
char
*
dir
,
char
*
fname
,
switch_bool_t
runtime
);
/* Prototypes of module interface functions */
...
...
src/include/switch_types.h
浏览文件 @
d4f6fb8e
...
...
@@ -128,6 +128,11 @@ SWITCH_BEGIN_EXTERN_C
#define SWITCH_BITS_PER_BYTE 8
typedef
uint8_t
switch_byte_t
;
typedef
enum
{
SWITCH_FALSE
=
0
,
SWITCH_TRUE
=
1
}
switch_bool_t
;
typedef
enum
{
SSM_NA
,
SSM_PRONOUNCED
,
...
...
src/mod/applications/mod_commands/mod_commands.c
浏览文件 @
d4f6fb8e
...
...
@@ -158,8 +158,11 @@ static switch_status_t load_function(char *mod, switch_core_session_t *session,
return
SWITCH_STATUS_SUCCESS
;
}
switch_loadable_module_load_module
((
char
*
)
SWITCH_GLOBAL_dirs
.
mod_dir
,
(
char
*
)
mod
);
stream
->
write_function
(
stream
,
"OK
\n
"
);
if
(
switch_loadable_module_load_module
((
char
*
)
SWITCH_GLOBAL_dirs
.
mod_dir
,
(
char
*
)
mod
,
SWITCH_TRUE
)
==
SWITCH_STATUS_SUCCESS
)
{
stream
->
write_function
(
stream
,
"OK
\n
"
);
}
else
{
stream
->
write_function
(
stream
,
"ERROR
\n
"
);
}
return
SWITCH_STATUS_SUCCESS
;
}
...
...
src/switch_loadable_module.c
浏览文件 @
d4f6fb8e
...
...
@@ -96,8 +96,22 @@ static void *switch_loadable_module_exec(switch_thread_t *thread, void *obj)
}
static
void
switch_loadable_module_runtime
(
void
)
{
switch_hash_index_t
*
hi
;
void
*
val
;
switch_loadable_module_t
*
module
;
for
(
hi
=
switch_hash_first
(
loadable_modules
.
pool
,
loadable_modules
.
module_hash
);
hi
;
hi
=
switch_hash_next
(
hi
))
{
switch_hash_this
(
hi
,
NULL
,
NULL
,
&
val
);
module
=
(
switch_loadable_module_t
*
)
val
;
if
(
module
->
switch_module_runtime
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
"Starting runtime thread for %s
\n
"
,
module
->
module_interface
->
module_name
);
switch_core_launch_thread
(
switch_loadable_module_exec
,
module
,
loadable_modules
.
pool
);
}
}
}
static
switch_status_t
switch_loadable_module_process
(
char
*
key
,
switch_loadable_module_t
*
new_module
)
{
...
...
@@ -349,13 +363,20 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
if
(
!
ptr
->
relative_oid
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed to load management interface from %s due to no interface name.
\n
"
,
key
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"Adding Management interface '%s'
\n
"
,
ptr
->
relative_oid
);
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_MODULE_LOAD
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"type"
,
"management"
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"name"
,
"%s"
,
ptr
->
relative_oid
);
switch_event_fire
(
&
event
);
if
(
switch_core_hash_find
(
loadable_modules
.
management_hash
,
ptr
->
relative_oid
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Failed to load management interface %s. OID %s already exists
\n
"
,
key
,
ptr
->
relative_oid
);
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_NOTICE
,
"Adding Management interface '%s' OID[%s.%s]
\n
"
,
key
,
FREESWITCH_OID_PREFIX
,
ptr
->
relative_oid
);
switch_core_hash_insert
(
loadable_modules
.
management_hash
,
ptr
->
relative_oid
,
(
const
void
*
)
ptr
);
if
(
switch_event_create
(
&
event
,
SWITCH_EVENT_MODULE_LOAD
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"type"
,
"management"
);
switch_event_add_header
(
event
,
SWITCH_STACK_BOTTOM
,
"name"
,
"%s"
,
ptr
->
relative_oid
);
switch_event_fire
(
&
event
);
}
}
switch_core_hash_insert
(
loadable_modules
.
management_hash
,
ptr
->
relative_oid
,
(
const
void
*
)
ptr
);
}
}
}
...
...
@@ -429,10 +450,6 @@ static switch_status_t switch_loadable_module_load_file(char *filename, switch_l
module
->
lib
=
dso
;
if
(
module
->
switch_module_runtime
)
{
switch_core_launch_thread
(
switch_loadable_module_exec
,
module
,
loadable_modules
.
pool
);
}
*
new_module
=
module
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
"Successfully Loaded [%s]
\n
"
,
module_interface
->
module_name
);
...
...
@@ -440,7 +457,7 @@ static switch_status_t switch_loadable_module_load_file(char *filename, switch_l
}
SWITCH_DECLARE
(
switch_status_t
)
switch_loadable_module_load_module
(
char
*
dir
,
char
*
fname
)
SWITCH_DECLARE
(
switch_status_t
)
switch_loadable_module_load_module
(
char
*
dir
,
char
*
fname
,
switch_bool_t
runtime
)
{
switch_size_t
len
=
0
;
char
*
path
;
...
...
@@ -485,10 +502,15 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_load_module(char *dir, ch
}
if
((
status
=
switch_loadable_module_load_file
(
path
,
&
new_module
)
==
SWITCH_STATUS_SUCCESS
))
{
return
switch_loadable_module_process
((
char
*
)
file
,
new_module
);
}
else
{
return
status
;
if
((
status
=
switch_loadable_module_process
((
char
*
)
file
,
new_module
))
==
SWITCH_STATUS_SUCCESS
&&
runtime
)
{
if
(
new_module
->
switch_module_runtime
)
{
switch_core_launch_thread
(
switch_loadable_module_exec
,
new_module
,
loadable_modules
.
pool
);
}
}
}
return
status
;
}
SWITCH_DECLARE
(
switch_status_t
)
switch_loadable_module_build_dynamic
(
char
*
filename
,
...
...
@@ -625,7 +647,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init()
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
"Invalid extension for %s
\n
"
,
val
);
continue
;
}
switch_loadable_module_load_module
((
char
*
)
SWITCH_GLOBAL_dirs
.
mod_dir
,
(
char
*
)
val
);
switch_loadable_module_load_module
((
char
*
)
SWITCH_GLOBAL_dirs
.
mod_dir
,
(
char
*
)
val
,
SWITCH_FALSE
);
count
++
;
}
}
...
...
@@ -645,7 +667,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init()
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CONSOLE
,
"Invalid extension for %s
\n
"
,
val
);
continue
;
}
switch_loadable_module_load_module
((
char
*
)
SWITCH_GLOBAL_dirs
.
mod_dir
,
(
char
*
)
val
);
switch_loadable_module_load_module
((
char
*
)
SWITCH_GLOBAL_dirs
.
mod_dir
,
(
char
*
)
val
,
SWITCH_FALSE
);
count
++
;
}
}
...
...
@@ -685,11 +707,12 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init()
continue
;
}
switch_loadable_module_load_module
((
char
*
)
SWITCH_GLOBAL_dirs
.
mod_dir
,
(
char
*
)
fname
);
switch_loadable_module_load_module
((
char
*
)
SWITCH_GLOBAL_dirs
.
mod_dir
,
(
char
*
)
fname
,
SWITCH_FALSE
);
}
apr_dir_close
(
module_dir_handle
);
}
switch_loadable_module_runtime
();
return
SWITCH_STATUS_SUCCESS
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论