File 3301-snmp-agent-Add-function-to-get-list-of-transports.patch of Package erlang
From f4842e93b0f95bcf399db0bed916eb22b88cf760 Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Thu, 14 Jan 2021 12:55:18 +0100
Subject: [PATCH 1/4] [snmp|agent] Add function to get list of transports
Add an official and documented function to get a list of
configured transports.
OTP-17109
---
lib/snmp/src/agent/snmpa.erl | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/lib/snmp/src/agent/snmpa.erl b/lib/snmp/src/agent/snmpa.erl
index 9e428466fa..729789d487 100644
--- a/lib/snmp/src/agent/snmpa.erl
+++ b/lib/snmp/src/agent/snmpa.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2016. All Rights Reserved.
+%% Copyright Ericsson AB 2004-2021. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -63,6 +63,8 @@
register_subagent/3, unregister_subagent/2,
+ which_transports/0,
+
send_notification2/3,
send_notification/3, send_notification/4, send_notification/5,
send_notification/6, send_notification/7,
@@ -830,6 +832,18 @@ sys_up_time() ->
(snmp_misc:now(cs) - StartTime) rem (2 bsl 31).
+%%%-----------------------------------------------------------------
+
+which_transports() ->
+ {value, Transports} = snmp_framework_mib:intAgentTransports(get),
+ [case Kind of
+ all ->
+ {Domain, Address};
+ _ ->
+ {Domain, Address, Kind}
+ end || {Domain, Address, Kind, _} <- Transports].
+
+
%%%-----------------------------------------------------------------
restart_worker() ->
--
2.26.2