Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Achou.Wang
accel-ppp
提交
f1c39d3f
A
accel-ppp
项目概览
Achou.Wang
/
accel-ppp
通知
6
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
accel-ppp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
f1c39d3f
编写于
12月 27, 2011
作者:
K
Kozlov Dmitry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
snmp: implemneted new node (ACCEL-PPP-MIB::cli.0) which can be used to send cli commands
上级
1ade87d0
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
150 addition
and
1 deletion
+150
-1
README
README
+3
-0
accel-pppd/cli/cli.c
accel-pppd/cli/cli.c
+1
-1
accel-pppd/extra/net-snmp/ACCEL-PPP-MIB.txt
accel-pppd/extra/net-snmp/ACCEL-PPP-MIB.txt
+8
-0
accel-pppd/extra/net-snmp/CMakeLists.txt
accel-pppd/extra/net-snmp/CMakeLists.txt
+1
-0
accel-pppd/extra/net-snmp/agent.c
accel-pppd/extra/net-snmp/agent.c
+2
-0
accel-pppd/extra/net-snmp/exec_cli.c
accel-pppd/extra/net-snmp/exec_cli.c
+123
-0
accel-pppd/extra/net-snmp/exec_cli.h
accel-pppd/extra/net-snmp/exec_cli.h
+12
-0
未找到文件。
README
浏览文件 @
f1c39d3f
...
...
@@ -149,6 +149,9 @@ snmpset -m +ACCEL-PPP-MIB -v 2c -c local 127.0.0.1 ACCEL-PPP-MIB::termByIfName.0
snmpset -m +ACCEL-PPP-MIB -v 2c -c local 127.0.0.1 ACCEL-PPP-MIB::termByIP.0 = 192.168.10.10
6. Terminate session by username:
snmpset -m +ACCEL-PPP-MIB -v 2c -c local 127.0.0.1 ACCEL-PPP-MIB::termByUsername.0 = user1
7. Execute cli command:
snmpset -m +ACCEL-PPP-MIB -v 2c -c local 127.0.0.1 ACCEL-PPP-MIB::cli.0 = "shaper change all 1024 temp"
Warning !!!
...
...
accel-pppd/cli/cli.c
浏览文件 @
f1c39d3f
...
...
@@ -128,7 +128,7 @@ static int split(char *buf, char **ptr)
return
i
;
}
int
cli_process_cmd
(
struct
cli_client_t
*
cln
)
int
__export
cli_process_cmd
(
struct
cli_client_t
*
cln
)
{
struct
cli_simple_cmd_t
*
cmd1
;
struct
cli_regexp_cmd_t
*
cmd2
;
...
...
accel-pppd/extra/net-snmp/ACCEL-PPP-MIB.txt
浏览文件 @
f1c39d3f
...
...
@@ -323,4 +323,12 @@ shutdown OBJECT-TYPE
"shutdown accel-ppp"
::= { accelPPPAdmin 2 }
cli OBJECT-TYPE
SYNTAX OCTET STRING
MAX-ACCESS write-only
STATUS current
DESCRIPTION
"execute cli command"
::= { accelPPPAdmin 3 }
END
accel-pppd/extra/net-snmp/CMakeLists.txt
浏览文件 @
f1c39d3f
...
...
@@ -12,6 +12,7 @@ SET(sources
statPPTP.c
terminate.c
shutdown.c
exec_cli.c
)
ADD_LIBRARY
(
net-snmp SHARED
${
sources
}
)
...
...
accel-pppd/extra/net-snmp/agent.c
浏览文件 @
f1c39d3f
...
...
@@ -16,6 +16,7 @@
#include "terminate.h"
#include "shutdown.h"
#include "sessionTable.h"
#include "exec_cli.h"
static
const
char
*
conf_agent_name
=
"accel-ppp"
;
static
int
conf_master
=
0
;
...
...
@@ -96,6 +97,7 @@ static void *snmp_thread(void *a)
init_terminate
();
init_shutdown
();
init_sessionTable
();
init_cli
();
init_snmp
(
conf_agent_name
);
...
...
accel-pppd/extra/net-snmp/exec_cli.c
0 → 100644
浏览文件 @
f1c39d3f
/*
* Note: this file originally auto-generated by mib2c using
* : mib2c.scalar.conf 11805 2005-01-07 09:37:18Z dts12 $
*/
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "exec_cli.h"
#include "cli_p.h"
#include "memdebug.h"
static
void
no_disconnect
(
struct
cli_client_t
*
tcln
)
{
}
static
int
no_send
(
struct
cli_client_t
*
tcln
,
const
void
*
_buf
,
int
size
)
{
return
0
;
}
static
int
no_sendv
(
struct
cli_client_t
*
tcln
,
const
char
*
fmt
,
va_list
ap
)
{
return
0
;
}
static
void
set_action
(
const
char
*
cmd
,
size_t
len
)
{
struct
cli_client_t
cc
=
{
.
cmdline
=
_malloc
(
len
+
1
),
.
send
=
no_send
,
.
sendv
=
no_sendv
,
.
disconnect
=
no_disconnect
,
};
memcpy
(
cc
.
cmdline
,
cmd
,
len
);
cc
.
cmdline
[
len
]
=
0
;
cli_process_cmd
(
&
cc
);
_free
(
cc
.
cmdline
);
}
/** Initializes the cli module */
void
init_cli
(
void
)
{
static
oid
cli_oid
[]
=
{
1
,
3
,
6
,
1
,
4
,
1
,
8072
,
100
,
3
,
3
};
DEBUGMSGTL
((
"cli"
,
"Initializing
\n
"
));
netsnmp_register_scalar
(
netsnmp_create_handler_registration
(
"cli"
,
handle_cli
,
cli_oid
,
OID_LENGTH
(
cli_oid
),
HANDLER_CAN_RWRITE
));
}
int
handle_cli
(
netsnmp_mib_handler
*
handler
,
netsnmp_handler_registration
*
reginfo
,
netsnmp_agent_request_info
*
reqinfo
,
netsnmp_request_info
*
requests
)
{
int
ret
;
/* We are never called for a GETNEXT if it's registered as a
"instance", as it's "magically" handled for us. */
/* a instance handler also only hands us one request at a time, so
we don't need to loop over a list of requests; we'll only get one. */
switch
(
reqinfo
->
mode
)
{
case
MODE_GET
:
netsnmp_set_request_error
(
reqinfo
,
requests
,
SNMP_NOSUCHINSTANCE
);
break
;
/*
* SET REQUEST
*
* multiple states in the transaction. See:
* http://www.net-snmp.org/tutorial-5/toolkit/mib_module/set-actions.jpg
*/
case
MODE_SET_RESERVE1
:
/* or you could use netsnmp_check_vb_type_and_size instead */
ret
=
netsnmp_check_vb_type
(
requests
->
requestvb
,
ASN_OCTET_STR
);
if
(
ret
!=
SNMP_ERR_NOERROR
)
{
netsnmp_set_request_error
(
reqinfo
,
requests
,
ret
);
}
break
;
case
MODE_SET_RESERVE2
:
/* XXX malloc "undo" storage buffer */
break
;
case
MODE_SET_FREE
:
/* XXX: free resources allocated in RESERVE1 and/or
RESERVE2. Something failed somewhere, and the states
below won't be called. */
break
;
case
MODE_SET_ACTION
:
/* XXX: perform the value change here */
set_action
((
char
*
)
requests
->
requestvb
->
val
.
string
,
requests
->
requestvb
->
val_len
);
break
;
case
MODE_SET_COMMIT
:
/* XXX: delete temporary storage */
break
;
case
MODE_SET_UNDO
:
/* XXX: UNDO and return to previous value for the object */
break
;
default:
/* we should never get here, so this is a really bad error */
snmp_log
(
LOG_ERR
,
"unknown mode (%d) in handle_cli
\n
"
,
reqinfo
->
mode
);
return
SNMP_ERR_GENERR
;
}
return
SNMP_ERR_NOERROR
;
}
accel-pppd/extra/net-snmp/exec_cli.h
0 → 100644
浏览文件 @
f1c39d3f
/*
* Note: this file originally auto-generated by mib2c using
* : mib2c.scalar.conf 11805 2005-01-07 09:37:18Z dts12 $
*/
#ifndef CLI_H
#define CLI_H
/* function declarations */
void
init_cli
(
void
);
Netsnmp_Node_Handler
handle_cli
;
#endif
/* CLI_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录