diff options
-rw-r--r-- | lib/snmp/src/misc/snmp_conf.erl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/snmp/src/misc/snmp_conf.erl b/lib/snmp/src/misc/snmp_conf.erl index 5490d60ac2..6fc261b07e 100644 --- a/lib/snmp/src/misc/snmp_conf.erl +++ b/lib/snmp/src/misc/snmp_conf.erl @@ -39,8 +39,10 @@ check_domain/1, check_tdomain/1, + mk_tdomain/1, check_ip/1, check_taddress/1, check_taddress/2, + mk_taddress/3, check_packet_size/1, @@ -384,6 +386,18 @@ check_tdomain(TDomain) -> %% --------- +mk_tdomain(snmpUDPDomain) -> + ?snmpUDPDomain; +mk_tdomain(transportDomainUdpIpv4) -> + ?transportDomainUdpIpv4; +mk_tdomain(transportDomainUdpIpv6) -> + ?transportDomainUdpIpv6; +mk_tdomain(BadDomain) -> + error({bad_domain, BadDomain}). + + +%% --------- + check_taddress(X) -> check_taddress(snmpUDPDomain, X). @@ -498,6 +512,20 @@ check_domain(Domain) -> %% --------- +%% The values of Ip and Port has both been checked at this +%% point, so we dont need to do that again. +mk_taddress(snmpUDPDomain, Ip, Port) -> + mk_taddress(transportDomainUdpIpv4, Ip, Port); +mk_taddress(transportDomainUdpIpv4, Ip, Port) -> + Ip ++ [Port div 256, Port rem 256]; +mk_taddress(transportDomainUdpIpv6, Ip, Port) -> + Ip ++ [Port div 256, Port rem 256]; +mk_taddress(BadDomain, _Ip, _Port) -> + error({bad_domain, BadDomain}). + + +%% --------- + check_ip(X) -> check_ip(snmpUDPDomain, X). |