diff options
author | Micael Karlberg <[email protected]> | 2013-06-25 12:38:17 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2013-07-04 11:21:43 +0200 |
commit | a6ba7a3327b146d8472b154cc8ba4544f9d4d0fe (patch) | |
tree | 051a8e4d9168e8d369663ddcfb68fc9bb9fb5af0 /lib/snmp/src/misc/snmp_conf.erl | |
parent | f9967a625fe06d47f374e30959f6bb6f098cb25e (diff) | |
download | otp-a6ba7a3327b146d8472b154cc8ba4544f9d4d0fe.tar.gz otp-a6ba7a3327b146d8472b154cc8ba4544f9d4d0fe.tar.bz2 otp-a6ba7a3327b146d8472b154cc8ba4544f9d4d0fe.zip |
[snmp/agent] Cleanup, renaming, appup, proper version and release notes
Add utility functions for checking view masks.
Code cleanup, function renaming and comment fix (%% instead of %).
Also updated the mask check in the vacm config file check function.
Finally, release notes and some cosmetic changes to the agent
config-file(s) user guide chapter.
Diffstat (limited to 'lib/snmp/src/misc/snmp_conf.erl')
-rw-r--r-- | lib/snmp/src/misc/snmp_conf.erl | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/lib/snmp/src/misc/snmp_conf.erl b/lib/snmp/src/misc/snmp_conf.erl index e1e7fab57b..46625989d5 100644 --- a/lib/snmp/src/misc/snmp_conf.erl +++ b/lib/snmp/src/misc/snmp_conf.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2012. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -50,6 +50,7 @@ check_packet_size/1, check_oid/1, + check_imask/1, check_emask/1, check_mp_model/1, check_sec_model/1, check_sec_model/2, check_sec_model/3, @@ -488,6 +489,7 @@ do_check_timer(WaitFor, Factor, Incr, Retry) -> check_integer(Retry, {gte, 0}), ok. + %% --------- all_domains() -> @@ -618,6 +620,37 @@ check_oid(X) -> %% --------- +%% Check a (view) mask in the internal form (all 0 and 1): +check_imask(null) -> + {ok, []}; +check_imask(IMask) when is_list(IMask) -> + do_check_imask(IMask), + {ok, IMask}. + +do_check_imask([0|IMask]) -> + do_check_imask(IMask); +do_check_imask([1|IMask]) -> + do_check_imask(IMask); +do_check_imask([X|_]) -> + error({invalid_internal_mask_element, X}). + + +%% Check a (view) mask in the external form (according to MIB, +%% an OCTET STRING of at most length 16). +check_emask(EMask) when is_list(EMask) andalso (length(EMask) =< 16) -> + do_check_emask(EMask). + +do_check_emask([]) -> + ok; +do_check_emask([X|EMask]) + when is_integer(X) andalso (X >= 16#00) andalso (X =< 16#FF) -> + do_check_emask(EMask); +do_check_emask([X|_]) -> + error({invalid_external_mask_element, X}). + + +%% --------- + all_integer([H|T]) when is_integer(H) -> all_integer(T); all_integer([_H|_T]) -> false; all_integer([]) -> true. |