Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
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
Software for White Rabbit PTP Core
Commits
9d52aaaf
Commit
9d52aaaf
authored
Apr 18, 2016
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/snmp: (no technical change) move OID_FIELD_* and oid_array
Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
6a2b56f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
38 deletions
+42
-38
snmp.c
lib/snmp.c
+42
-38
No files found.
lib/snmp.c
View file @
9d52aaaf
...
...
@@ -62,6 +62,38 @@
#define SNMP_SET_FUNCTION(X) .set = NULL
#endif
/* used to define write only OIDs */
#define NO_SET NULL
#define OID_FIELD_STRUCT(_oid, _getf, _setf, _asn, _type, _pointer, _field) { \
.oid_match = _oid, \
.oid_len = sizeof(_oid), \
.get = _getf, \
SNMP_SET_FUNCTION(_setf), \
.asn = _asn, \
.p = _pointer, \
.offset = offsetof(_type, _field), \
.data_size = sizeof(((_type *)0)->_field) \
}
#define OID_FIELD(_oid, _fname, _asn) { \
.oid_match = _oid, \
.oid_len = sizeof(_oid), \
.get = _fname, \
.asn = _asn, \
}
#define OID_FIELD_VAR(_oid, _getf, _setf, _asn, _pointer) { \
.oid_match = _oid, \
.oid_len = sizeof(_oid), \
.get = _getf, \
SNMP_SET_FUNCTION(_setf), \
.asn = _asn, \
.p = _pointer, \
.offset = 0, \
.data_size = sizeof(*_pointer) \
}
struct
snmp_oid
{
uint8_t
*
oid_match
;
int
(
*
get
)(
uint8_t
*
buf
,
struct
snmp_oid
*
obj
);
...
...
@@ -81,6 +113,7 @@ char snmp_system_name[SNMP_SYSTEM_NAME_LEN] = CONFIG_SNMP_SYSTEM_NAME;
/* store SNMP version, not fully used yet */
uint8_t
snmp_version
;
static
uint8_t
__snmp_queue
[
256
];
static
struct
wrpc_socket
__static_snmp_socket
=
{
.
queue
.
buff
=
__snmp_queue
,
...
...
@@ -94,6 +127,15 @@ static int get_i32sat(uint8_t *buf, uint8_t asn, void *p);
static
int
set_pp
(
uint8_t
*
buf
,
struct
snmp_oid
*
obj
);
static
int
set_p
(
uint8_t
*
buf
,
struct
snmp_oid
*
obj
);
/* NOTE: to have SNMP_GET_NEXT working properly this array has to be sorted by
OIDs */
static
struct
snmp_oid
oid_array
[]
=
{
{
0
,
}
};
static
void
snmp_init
(
void
)
{
/* Use UDP engine activated by function arguments */
...
...
@@ -249,44 +291,6 @@ static int set_p(uint8_t *buf, struct snmp_oid *obj)
}
#define OID_FIELD_STRUCT(_oid, _getf, _setf, _asn, _type, _pointer, _field) { \
.oid_match = _oid, \
.oid_len = sizeof(_oid), \
.get = _getf, \
SNMP_SET_FUNCTION(_setf), \
.asn = _asn, \
.p = _pointer, \
.offset = offsetof(_type, _field), \
.data_size = sizeof(((_type *)0)->_field) \
}
#define OID_FIELD(_oid, _fname, _asn) { \
.oid_match = _oid, \
.oid_len = sizeof(_oid), \
.get = _fname, \
.asn = _asn, \
}
#define OID_FIELD_VAR(_oid, _getf, _setf, _asn, _pointer) { \
.oid_match = _oid, \
.oid_len = sizeof(_oid), \
.get = _getf, \
SNMP_SET_FUNCTION(_setf), \
.asn = _asn, \
.p = _pointer, \
.offset = 0, \
.data_size = sizeof(*_pointer) \
}
#define NO_SET NULL
/* NOTE: to have SNMP_GET_NEXT working properly this array has to be sorted by
OIDs */
static
struct
snmp_oid
oid_array
[]
=
{
{
0
,
}
};
/*
* Perverse... snmpwalk does getnext anyways.
*
...
...
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