8
struct snmp_secmod_def;
11
* parameter information passed to security model routines
13
struct snmp_secmod_outgoing_params {
20
size_t secEngineIDLen;
31
size_t *wholeMsgOffset;
32
netsnmp_pdu *pdu; /* IN - the pdu getting encoded */
33
netsnmp_session *session; /* IN - session sending the message */
36
struct snmp_secmod_incoming_params {
37
int msgProcModel; /* IN */
38
size_t maxMsgSize; /* IN - Used to calc maxSizeResponse. */
40
u_char *secParams; /* IN - BER encoded securityParameters. */
41
int secModel; /* IN */
42
int secLevel; /* IN - AuthNoPriv; authPriv etc. */
44
u_char *wholeMsg; /* IN - Original v3 message. */
45
size_t wholeMsgLen; /* IN - Msg length. */
47
u_char *secEngineID; /* OUT - Pointer snmpEngineID. */
48
size_t *secEngineIDLen; /* IN/OUT - Len available; len returned. */
50
* NOTE: Memory provided by caller.
53
char *secName; /* OUT - Pointer to securityName. */
54
size_t *secNameLen; /* IN/OUT - Len available; len returned. */
56
u_char **scopedPdu; /* OUT - Pointer to plaintext scopedPdu. */
57
size_t *scopedPduLen; /* IN/OUT - Len available; len returned. */
59
size_t *maxSizeResponse; /* OUT - Max size of Response PDU. */
60
void **secStateRef; /* OUT - Ref to security state. */
61
netsnmp_session *sess; /* IN - session which got the message */
62
netsnmp_pdu *pdu; /* IN - the pdu getting parsed */
63
u_char msg_flags; /* IN - v3 Message flags. */
72
* free's a given security module's data; called at unregistration time
74
typedef int (SecmodSessionCallback) (netsnmp_session *);
75
typedef int (SecmodPduCallback) (netsnmp_pdu *);
76
typedef int (Secmod2PduCallback) (netsnmp_pdu *, netsnmp_pdu *);
77
typedef int (SecmodOutMsg) (struct snmp_secmod_outgoing_params *);
78
typedef int (SecmodInMsg) (struct snmp_secmod_incoming_params *);
79
typedef void (SecmodFreeState) (void *);
82
* definition of a security module
86
* all of these callback functions except the encoding and decoding
87
* routines are optional. The rest of them are available if need.
89
struct snmp_secmod_def {
91
* session maniplation functions
93
SecmodSessionCallback *session_open; /* called in snmp_sess_open() */
94
SecmodSessionCallback *session_close; /* called in snmp_sess_close() */
97
* pdu manipulation routines
99
SecmodPduCallback *pdu_free; /* called in free_pdu() */
100
Secmod2PduCallback *pdu_clone; /* called in snmp_clone_pdu() */
101
SecmodPduCallback *pdu_timeout; /* called when request timesout */
102
SecmodFreeState *pdu_free_state_ref; /* frees pdu->securityStateRef */
105
* de/encoding routines: mandatory
107
SecmodOutMsg *encode_reverse; /* encode packet back to front */
108
SecmodOutMsg *encode_forward; /* encode packet forward */
109
SecmodInMsg *decode; /* decode & validate incoming */
116
struct snmp_secmod_list {
118
struct snmp_secmod_def *secDef;
119
struct snmp_secmod_list *next;
124
* register a security service
126
int register_sec_mod(int, const char *,
127
struct snmp_secmod_def *);
129
* find a security service definition
131
struct snmp_secmod_def *find_sec_mod(int);
133
* register a security service
135
int unregister_sec_mod(int); /* register a security service */
136
void init_secmod(void);
139
* clears the sec_mod list
141
void clear_sec_mod(void);
146
#endif /* SNMPSECMOD_H */