diff options
Diffstat (limited to 'lib/snmp/src')
-rw-r--r-- | lib/snmp/src/agent/snmpa.erl | 25 | ||||
-rw-r--r-- | lib/snmp/src/app/snmp.erl | 13 | ||||
-rw-r--r-- | lib/snmp/src/manager/snmpm.erl | 21 | ||||
-rw-r--r-- | lib/snmp/src/misc/snmp_log.erl | 17 |
4 files changed, 40 insertions, 36 deletions
diff --git a/lib/snmp/src/agent/snmpa.erl b/lib/snmp/src/agent/snmpa.erl index 3804966e61..aea63effe6 100644 --- a/lib/snmp/src/agent/snmpa.erl +++ b/lib/snmp/src/agent/snmpa.erl @@ -129,7 +129,8 @@ -include("snmpa_internal.hrl"). -include_lib("snmp/include/snmp_types.hrl"). % type of me needed. --define(DISCO_EXTRA_INFO, undefined). +-define(DISCO_EXTRA_INFO, undefined). +-define(ATL_BLOCK_DEFAULT, true). %%----------------------------------------------------------------- @@ -893,7 +894,7 @@ log_to_txt(LogDir, Block) snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block); log_to_txt(LogDir, Mibs) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, OutFile = "snmpa_log.txt", LogName = ?audit_trail_log_name, LogFile = ?audit_trail_log_file, @@ -915,7 +916,7 @@ log_to_txt(LogDir, Mibs, Block) LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block); log_to_txt(LogDir, Mibs, OutFile) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, LogName = ?audit_trail_log_name, LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block). @@ -937,7 +938,7 @@ log_to_txt(LogDir, Mibs, OutFile, Block) LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block); log_to_txt(LogDir, Mibs, OutFile, LogName) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block). @@ -959,7 +960,7 @@ log_to_txt(LogDir, Mibs, OutFile, LogName, Block) LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block); log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block). -spec log_to_txt(LogDir :: snmp:dir(), @@ -981,7 +982,7 @@ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block) when ((Block =:= true) orelse (Block =:= false)) -> snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block); log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start). -spec log_to_txt(LogDir :: snmp:dir(), @@ -1006,7 +1007,7 @@ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start) snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start); log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start, Stop) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop). -spec log_to_txt(LogDir :: snmp:dir(), @@ -1033,7 +1034,7 @@ log_to_io(LogDir, Block) LogFile = ?audit_trail_log_file, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block); log_to_io(LogDir, Mibs) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, LogName = ?audit_trail_log_name, LogFile = ?audit_trail_log_file, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block). @@ -1044,7 +1045,7 @@ log_to_io(LogDir, Mibs, Block) LogFile = ?audit_trail_log_file, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block); log_to_io(LogDir, Mibs, LogName) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, LogFile = ?audit_trail_log_file, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block). @@ -1053,21 +1054,21 @@ log_to_io(LogDir, Mibs, LogName, Block) LogFile = ?audit_trail_log_file, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block); log_to_io(LogDir, Mibs, LogName, LogFile) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block). log_to_io(LogDir, Mibs, LogName, LogFile, Block) when ((Block =:= true) orelse (Block =:= false)) -> snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block); log_to_io(LogDir, Mibs, LogName, LogFile, Start) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start). log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start) when ((Block =:= true) orelse (Block =:= false)) -> snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start); log_to_io(LogDir, Mibs, LogName, LogFile, Start, Stop) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop). log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop) -> diff --git a/lib/snmp/src/app/snmp.erl b/lib/snmp/src/app/snmp.erl index c8d1ef28ef..8b3a8af77d 100644 --- a/lib/snmp/src/app/snmp.erl +++ b/lib/snmp/src/app/snmp.erl @@ -172,6 +172,7 @@ -define(APPLICATION, snmp). +-define(ATL_BLOCK_DEFAULT, true). -include_lib("snmp/include/snmp_types.hrl"). @@ -904,7 +905,7 @@ read_mib(FileName) -> %%%----------------------------------------------------------------- log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, Start = null, Stop = null, log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop). @@ -915,7 +916,7 @@ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block) Stop = null, log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop); log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, Stop = null, log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop). @@ -924,7 +925,7 @@ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start) Stop = null, log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop); log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start, Stop) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop). log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop) -> @@ -933,7 +934,7 @@ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop) -> log_to_io(LogDir, Mibs, LogName, LogFile) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, Start = null, Stop = null, log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop). @@ -944,7 +945,7 @@ log_to_io(LogDir, Mibs, LogName, LogFile, Block) Stop = null, log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop); log_to_io(LogDir, Mibs, LogName, LogFile, Start) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, Stop = null, log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop). @@ -953,7 +954,7 @@ log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start) Stop = null, log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop); log_to_io(LogDir, Mibs, LogName, LogFile, Start, Stop) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop). log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop) -> diff --git a/lib/snmp/src/manager/snmpm.erl b/lib/snmp/src/manager/snmpm.erl index a62379de97..c97b635fc6 100644 --- a/lib/snmp/src/manager/snmpm.erl +++ b/lib/snmp/src/manager/snmpm.erl @@ -124,6 +124,7 @@ -include("snmp_verbosity.hrl"). -define(DEFAULT_AGENT_PORT, 161). +-define(ATL_BLOCK_DEFAULT, true). %%----------------------------------------------------------------- @@ -807,7 +808,7 @@ log_to_txt(LogDir, Block) LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block); log_to_txt(LogDir, Mibs) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, OutFile = "snmpm_log.txt", LogName = ?audit_trail_log_name, LogFile = ?audit_trail_log_file, @@ -829,7 +830,7 @@ log_to_txt(LogDir, Mibs, Block) LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block); log_to_txt(LogDir, Mibs, OutFile) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, LogName = ?audit_trail_log_name, LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block). @@ -851,7 +852,7 @@ log_to_txt(LogDir, Mibs, OutFile, Block) LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block); log_to_txt(LogDir, Mibs, OutFile, LogName) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block). @@ -873,7 +874,7 @@ log_to_txt(LogDir, Mibs, OutFile, LogName, Block) LogFile = ?audit_trail_log_file, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block); log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block). -spec log_to_txt(LogDir :: snmp:dir(), @@ -895,7 +896,7 @@ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block) when ((Block =:= true) orelse (Block =:= false)) -> snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block); log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start). -spec log_to_txt(LogDir :: snmp:dir(), @@ -919,7 +920,7 @@ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start) when ((Block =:= true) orelse (Block =:= false)) -> snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start); log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start, Stop) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop). -spec log_to_txt(LogDir :: snmp:dir(), @@ -956,7 +957,7 @@ log_to_io(LogDir, Mibs, Block) LogFile = ?audit_trail_log_file, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block); log_to_io(LogDir, Mibs, LogName) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, LogFile = ?audit_trail_log_file, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block). @@ -965,21 +966,21 @@ log_to_io(LogDir, Mibs, LogName, Block) LogFile = ?audit_trail_log_file, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block); log_to_io(LogDir, Mibs, LogName, LogFile) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block). log_to_io(LogDir, Mibs, LogName, LogFile, Block) when ((Block =:= true) orelse (Block =:= false)) -> snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block); log_to_io(LogDir, Mibs, LogName, LogFile, Start) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start). log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start) when ((Block =:= true) orelse (Block =:= false)) -> snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start); log_to_io(LogDir, Mibs, LogName, LogFile, Start, Stop) -> - Block = false, + Block = ?ATL_BLOCK_DEFAULT, snmp:log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop). log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop) -> diff --git a/lib/snmp/src/misc/snmp_log.erl b/lib/snmp/src/misc/snmp_log.erl index 862c1c7c0c..e4089870b8 100644 --- a/lib/snmp/src/misc/snmp_log.erl +++ b/lib/snmp/src/misc/snmp_log.erl @@ -53,8 +53,9 @@ -define(VMODULE,"LOG"). -include("snmp_verbosity.hrl"). --define(LOG_FORMAT, internal). --define(LOG_TYPE, wrap). +-define(LOG_FORMAT, internal). +-define(LOG_TYPE, wrap). +-define(BLOCK_DEFAULT, true). -record(snmp_log, {id, seqno}). @@ -401,7 +402,7 @@ do_change_size(Log, NewSize) -> %% <BACKWARD-COMPAT> log_to_txt(Log, FileName, Dir, Mibs, TextFile) -> - log_to_txt(Log, false, FileName, Dir, Mibs, TextFile). + log_to_txt(Log, ?BLOCK_DEFAULT, FileName, Dir, Mibs, TextFile). %% </BACKWARD-COMPAT> log_to_txt(Log, Block, FileName, Dir, Mibs, TextFile) @@ -409,7 +410,7 @@ log_to_txt(Log, Block, FileName, Dir, Mibs, TextFile) log_to_txt(Log, Block, FileName, Dir, Mibs, TextFile, null, null); %% <BACKWARD-COMPAT> log_to_txt(Log, FileName, Dir, Mibs, TextFile, Start) -> - log_to_txt(Log, false, FileName, Dir, Mibs, TextFile, Start, null). + log_to_txt(Log, ?BLOCK_DEFAULT, FileName, Dir, Mibs, TextFile, Start, null). %% </BACKWARD-COMPAT> log_to_txt(Log, Block, FileName, Dir, Mibs, TextFile, Start) @@ -417,7 +418,7 @@ log_to_txt(Log, Block, FileName, Dir, Mibs, TextFile, Start) log_to_txt(Log, Block, FileName, Dir, Mibs, TextFile, Start, null); %% <BACKWARD-COMPAT> log_to_txt(Log, FileName, Dir, Mibs, TextFile, Start, Stop) -> - log_to_txt(Log, false, FileName, Dir, Mibs, TextFile, Start, Stop). + log_to_txt(Log, ?BLOCK_DEFAULT, FileName, Dir, Mibs, TextFile, Start, Stop). %% </BACKWARD-COMPAT> log_to_txt(Log, Block, FileName, Dir, Mibs, TextFile, Start, Stop) @@ -446,7 +447,7 @@ log_to_txt(Log, Block, FileName, Dir, Mibs, TextFile, Start, Stop) %% <BACKWARD-COMPAT> log_to_io(Log, FileName, Dir, Mibs) -> - log_to_io(Log, false, FileName, Dir, Mibs, null, null). + log_to_io(Log, ?BLOCK_DEFAULT, FileName, Dir, Mibs, null, null). %% </BACKWARD-COMPAT> log_to_io(Log, Block, FileName, Dir, Mibs) @@ -454,7 +455,7 @@ log_to_io(Log, Block, FileName, Dir, Mibs) log_to_io(Log, Block, FileName, Dir, Mibs, null, null); %% <BACKWARD-COMPAT> log_to_io(Log, FileName, Dir, Mibs, Start) -> - log_to_io(Log, false, FileName, Dir, Mibs, Start, null). + log_to_io(Log, ?BLOCK_DEFAULT, FileName, Dir, Mibs, Start, null). %% </BACKWARD-COMPAT> log_to_io(Log, Block, FileName, Dir, Mibs, Start) @@ -462,7 +463,7 @@ log_to_io(Log, Block, FileName, Dir, Mibs, Start) log_to_io(Log, Block, FileName, Dir, Mibs, Start, null); %% <BACKWARD-COMPAT> log_to_io(Log, FileName, Dir, Mibs, Start, Stop) -> - log_to_io(Log, false, FileName, Dir, Mibs, Start, Stop). + log_to_io(Log, ?BLOCK_DEFAULT, FileName, Dir, Mibs, Start, Stop). %% </BACKWARD-COMPAT> log_to_io(Log, Block, FileName, Dir, Mibs, Start, Stop) |