Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Software
Commits
c8ca9ade
Commit
c8ca9ade
authored
Jun 24, 2014
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
snmp library: make Scalar work, redoing commit
65e0ac40
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
b9e83a64
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
47 deletions
+9
-47
wrsScalar.c
userspace/snmpd/wrsScalar.c
+9
-47
No files found.
userspace/snmpd/wrsScalar.c
View file @
c8ca9ade
...
...
@@ -8,6 +8,9 @@
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "wrsScalar.h"
#include <stdint.h>
static
uint32_t
fakeStatValue
;
/** Initializes the wrsScalar module */
void
init_wrsScalar
(
void
)
...
...
@@ -44,13 +47,10 @@ handle_wrsScalarOne(netsnmp_mib_handler *handler,
switch
(
reqinfo
->
mode
)
{
case
MODE_GET
:
fakeStatValue
++
;
snmp_set_var_typed_value
(
requests
->
requestvb
,
ASN_INTEGER
,
/*
* XXX: a pointer to the scalar's data
*/
,
/*
* XXX: the length of the data in bytes
*/
);
&
fakeStatValue
,
sizeof
(
fakeStatValue
));
break
;
/*
...
...
@@ -70,57 +70,19 @@ handle_wrsScalarOne(netsnmp_mib_handler *handler,
break
;
case
MODE_SET_RESERVE2
:
/*
* XXX malloc "undo" storage buffer
*/
if
(
/* XXX if malloc, or whatever, failed: */
)
{
netsnmp_set_request_error
(
reqinfo
,
requests
,
SNMP_ERR_RESOURCEUNAVAILABLE
);
}
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
*/
if
(
/* XXX: error? */
)
{
netsnmp_set_request_error
(
reqinfo
,
requests
,
/* some error */
);
}
/* FIXME: set... */
break
;
case
MODE_SET_COMMIT
:
/*
* XXX: delete temporary storage
*/
if
(
/* XXX: error? */
)
{
/*
* try _really_really_ hard to never get to this point
*/
netsnmp_set_request_error
(
reqinfo
,
requests
,
SNMP_ERR_COMMITFAILED
);
}
/* FIXME: commit */
break
;
case
MODE_SET_UNDO
:
/*
* XXX: UNDO and return to previous value for the object
*/
if
(
/* XXX: error? */
)
{
/*
* try _really_really_ hard to never get to this point
*/
netsnmp_set_request_error
(
reqinfo
,
requests
,
SNMP_ERR_UNDOFAILED
);
}
/* FIXME: undo */
break
;
default:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment