From: martijn Date: Wed, 19 Jan 2022 10:36:35 +0000 (+0000) Subject: Implement snmpe_send to allow to allow the new application layer to send X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=21c0ccae22a052705745e49c71f7513710df1b34;p=openbsd Implement snmpe_send to allow to allow the new application layer to send messages through the current transport mapping code. OK jmatthew@ tested as part of larger diff by sthen@ and Joel Carnat --- diff --git a/usr.sbin/snmpd/snmpe.c b/usr.sbin/snmpd/snmpe.c index e6686dbf36d..36b20555d16 100644 --- a/usr.sbin/snmpd/snmpe.c +++ b/usr.sbin/snmpd/snmpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpe.c,v 1.80 2022/01/19 10:28:13 martijn Exp $ */ +/* $OpenBSD: snmpe.c,v 1.81 2022/01/19 10:36:35 martijn Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter @@ -820,6 +820,20 @@ snmpe_dispatchmsg(struct snmp_message *msg) snmpe_response(msg); } +void +snmpe_send(struct snmp_message *msg, enum snmp_pdutype type, int32_t requestid, + int32_t error, uint32_t index, struct ber_element *varbindlist) +{ + msg->sm_request = requestid; + msg->sm_pdutype = type; + msg->sm_error = error; + msg->sm_errorindex = index; + msg->sm_varbindresp = varbindlist; + + msg->sm_pdutype = SNMP_C_RESPONSE; + snmpe_response(msg); +} + void snmpe_response(struct snmp_message *msg) { diff --git a/usr.sbin/snmpd/snmpe.h b/usr.sbin/snmpd/snmpe.h index b0bd1a024b6..265a7a1a340 100644 --- a/usr.sbin/snmpd/snmpe.h +++ b/usr.sbin/snmpd/snmpe.h @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpe.h,v 1.1 2022/01/19 10:22:48 martijn Exp $ */ +/* $OpenBSD: snmpe.h,v 1.2 2022/01/19 10:36:35 martijn Exp $ */ /* * Copyright (c) 2021 Martijn van Duren @@ -20,5 +20,7 @@ struct snmp_message; +void snmpe_send(struct snmp_message *, enum snmp_pdutype, int32_t, + int32_t, uint32_t, struct ber_element *); const char *snmpe_pdutype2string(enum snmp_pdutype); void snmp_msgfree(struct snmp_message *);