Let Perl access EngineID
Reviewed-by: Craig Small <csmall@debian.org> Last-Update: 2019-02-07 Gbp-Pq: Name let_perl_access_engineid.diff
This commit is contained in:
parent
39e66f80fb
commit
729a6dbca8
|
@ -1243,6 +1243,16 @@ sub inform {
|
|||
return(wantarray() ? @res : $res[0]);
|
||||
}
|
||||
|
||||
sub get_sec_engine_id {
|
||||
my $this = shift;
|
||||
return SNMP::_get_sec_engine_id($this);
|
||||
}
|
||||
|
||||
sub get_context_engine_id {
|
||||
my $this = shift;
|
||||
return SNMP::_get_context_engine_id($this);
|
||||
}
|
||||
|
||||
package SNMP::TrapSession;
|
||||
@SNMP::TrapSession::ISA = ('SNMP::Session');
|
||||
|
||||
|
@ -2043,6 +2053,17 @@ as well.
|
|||
|
||||
=back
|
||||
|
||||
=item $sess->get_sec_engine_id
|
||||
|
||||
Returns the security engine ID for the current session, whether probed
|
||||
or provided by the client, in hex format suitable for the SecEngineId
|
||||
parameter when creating a session in the future. Returns undef if we have not
|
||||
had not had any contact with the remote agent yet.
|
||||
|
||||
=item $sess->get_context_engine_id
|
||||
|
||||
Like get_sec_engine_id, but for the context engine ID (ContextEngineId).
|
||||
|
||||
=back
|
||||
|
||||
=head1 SNMP::TrapSession
|
||||
|
|
|
@ -4738,6 +4738,50 @@ done:
|
|||
|
||||
|
||||
|
||||
char *
|
||||
snmp_get_sec_engine_id(sess_ref)
|
||||
SV * sess_ref
|
||||
CODE:
|
||||
{
|
||||
RETVAL = NULL;
|
||||
if (SvROK(sess_ref)) {
|
||||
SV **sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
|
||||
SnmpSession *ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
|
||||
if (ss->securityEngineIDLen > 0) {
|
||||
binary_to_hex(ss->securityEngineID,
|
||||
ss->securityEngineIDLen,
|
||||
&RETVAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
CLEANUP:
|
||||
netsnmp_free(RETVAL);
|
||||
|
||||
|
||||
char *
|
||||
snmp_get_context_engine_id(sess_ref)
|
||||
SV * sess_ref
|
||||
CODE:
|
||||
{
|
||||
RETVAL = NULL;
|
||||
if (SvROK(sess_ref)) {
|
||||
SV **sess_ptr_sv = hv_fetch((HV*)SvRV(sess_ref), "SessPtr", 7, 1);
|
||||
SnmpSession *ss = (SnmpSession *)SvIV((SV*)SvRV(*sess_ptr_sv));
|
||||
if (ss->contextEngineIDLen > 0) {
|
||||
binary_to_hex(ss->contextEngineID,
|
||||
ss->contextEngineIDLen,
|
||||
&RETVAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
CLEANUP:
|
||||
netsnmp_free(RETVAL);
|
||||
|
||||
|
||||
char *
|
||||
snmp_get_type(tag, best_guess)
|
||||
char * tag
|
||||
|
|
Loading…
Reference in New Issue