aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2011-03-02 17:47:37 +0100
committerMicael Karlberg <[email protected]>2011-03-02 17:47:37 +0100
commit8e312df7663c203ab936c9555cc0f61bbf83cb2f (patch)
tree37e893037e85c79d3de3bc0fb84b11d124879992 /lib/snmp/src
parent92893c6df0f01c6c1d16f9d52a135f44393e9b01 (diff)
downloadotp-8e312df7663c203ab936c9555cc0f61bbf83cb2f.tar.gz
otp-8e312df7663c203ab936c9555cc0f61bbf83cb2f.tar.bz2
otp-8e312df7663c203ab936c9555cc0f61bbf83cb2f.zip
Added taddress and tdomain create functions.
Diffstat (limited to 'lib/snmp/src')
-rw-r--r--lib/snmp/src/misc/snmp_conf.erl28
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).