aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'lib/snmp/src/app')
-rw-r--r--lib/snmp/src/app/Makefile4
-rw-r--r--lib/snmp/src/app/snmp.erl118
-rw-r--r--lib/snmp/src/app/snmp_internal.hrl4
3 files changed, 111 insertions, 15 deletions
diff --git a/lib/snmp/src/app/Makefile b/lib/snmp/src/app/Makefile
index 716add8b9e..b8cc4b8754 100644
--- a/lib/snmp/src/app/Makefile
+++ b/lib/snmp/src/app/Makefile
@@ -2,7 +2,7 @@
# %CopyrightBegin%
#
-# Copyright Ericsson AB 2003-2012. All Rights Reserved.
+# Copyright Ericsson AB 2003-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
@@ -79,6 +79,8 @@ endif
# FLAGS
# ----------------------------------------------------
+ERL_COMPILE_FLAGS += -pa $(ERL_TOP)/lib/snmp/ebin
+
ifeq ($(WARN_UNUSED_VARS),true)
ERL_COMPILE_FLAGS += +warn_unused_vars
endif
diff --git a/lib/snmp/src/app/snmp.erl b/lib/snmp/src/app/snmp.erl
index 1bb562654a..c8d1ef28ef 100644
--- a/lib/snmp/src/app/snmp.erl
+++ b/lib/snmp/src/app/snmp.erl
@@ -49,8 +49,8 @@
read_mib/1,
- log_to_txt/5, log_to_txt/6, log_to_txt/7,
- log_to_io/4, log_to_io/5, log_to_io/6,
+ log_to_txt/5, log_to_txt/6, log_to_txt/7, log_to_txt/8,
+ log_to_io/4, log_to_io/5, log_to_io/6, log_to_io/7,
change_log_size/2,
octet_string_to_bits/1, bits_to_octet_string/1,
@@ -91,7 +91,31 @@
]).
-export_type([
+ dir/0,
+ snmp_timer/0,
+
+ engine_id/0,
+ tdomain/0,
+ community/0,
+ mms/0,
+ version/0,
+ sec_model/0,
+ sec_name/0,
+ sec_level/0,
+
oid/0,
+ varbind/0,
+ ivarbind/0,
+ asn1_type/0,
+ table_info/0,
+ variable_info/0,
+ me/0,
+ trap/0,
+ notification/0,
+ pdu/0,
+ trappdu/0,
+ mib/0,
+ mib_name/0,
void/0
]).
@@ -149,14 +173,40 @@
-define(APPLICATION, snmp).
+-include_lib("snmp/include/snmp_types.hrl").
%%-----------------------------------------------------------------
%% Types
%%-----------------------------------------------------------------
--type oid() :: [non_neg_integer()].
--type void() :: term().
+-type dir() :: string().
+-type snmp_timer() :: #snmp_incr_timer{}.
+
+-type engine_id() :: string().
+-type tdomain() :: transportDomainUdpIpv4 | transportDomainUdpIpv6.
+-type community() :: string().
+-type mms() :: non_neg_integer().
+-type version() :: v1 | v2 | v3.
+-type sec_model() :: any | v1 | v2c | usm.
+-type sec_name() :: string().
+-type sec_level() :: noAuthNoPriv | authNoPriv | authPriv.
+
+-type oid() :: [non_neg_integer()].
+-type varbind() :: #varbind{}.
+-type ivarbind() :: #ivarbind{}.
+-type asn1_type() :: #asn1_type{}.
+-type table_info() :: #table_info{}.
+-type variable_info() :: #variable_info{}.
+-type me() :: #me{}.
+-type trap() :: #trap{}.
+-type notification() :: #notification{}.
+-type mib() :: #mib{}.
+-type mib_name() :: string().
+-type pdu() :: #pdu{}.
+-type trappdu() :: #trappdu{}.
+
+-type void() :: term().
%%-----------------------------------------------------------------
@@ -854,18 +904,60 @@ read_mib(FileName) ->
%%%-----------------------------------------------------------------
log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile) ->
- snmp_log:log_to_txt(LogName, LogFile, LogDir, Mibs, OutFile).
+ Block = false,
+ Start = null,
+ Stop = null,
+ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop).
+
+log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block)
+ when ((Block =:= true) orelse (Block =:= false)) ->
+ Start = null,
+ Stop = null,
+ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop);
log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start) ->
- snmp_log:log_to_txt(LogName, LogFile, LogDir, Mibs, OutFile, Start).
+ Block = false,
+ Stop = null,
+ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop).
+
+log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start)
+ when ((Block =:= true) orelse (Block =:= false)) ->
+ Stop = null,
+ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop);
log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Start, Stop) ->
- snmp_log:log_to_txt(LogName, LogFile, LogDir, Mibs, OutFile, Start, Stop).
+ Block = false,
+ log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop).
+
+log_to_txt(LogDir, Mibs, OutFile, LogName, LogFile, Block, Start, Stop) ->
+ snmp_log:log_to_txt(LogName, Block, LogFile, LogDir, Mibs, OutFile,
+ Start, Stop).
+
log_to_io(LogDir, Mibs, LogName, LogFile) ->
- snmp_log:log_to_io(LogName, LogFile, LogDir, Mibs).
+ Block = false,
+ Start = null,
+ Stop = null,
+ log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop).
+
+log_to_io(LogDir, Mibs, LogName, LogFile, Block)
+ when ((Block =:= true) orelse (Block =:= false)) ->
+ Start = null,
+ Stop = null,
+ log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop);
log_to_io(LogDir, Mibs, LogName, LogFile, Start) ->
- snmp_log:log_to_io(LogName, LogFile, LogDir, Mibs, Start).
+ Block = false,
+ Stop = null,
+ log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop).
+
+log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start)
+ when ((Block =:= true) orelse (Block =:= false)) ->
+ Stop = null,
+ log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop);
log_to_io(LogDir, Mibs, LogName, LogFile, Start, Stop) ->
- snmp_log:log_to_io(LogName, LogFile, LogDir, Mibs, Start, Stop).
+ Block = false,
+ log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop).
+
+log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop) ->
+ snmp_log:log_to_io(LogName, Block, LogFile, LogDir, Mibs, Start, Stop).
change_log_size(LogName, NewSize) ->
snmp_log:change_size(LogName, NewSize).
@@ -878,12 +970,12 @@ change_log_size(LogName, NewSize) ->
%% Usage: erl -s snmp str_apply '{Mod,Func,ArgList}'
str_apply([Atom]) ->
Str = atom_to_list(Atom),
- {Mod,Func,Args} = to_erlang_term(Str),
- apply(Mod,Func,Args).
+ {Mod, Func, Args} = to_erlang_term(Str),
+ apply(Mod, Func, Args).
to_erlang_term(String) ->
{ok, Tokens, _} = erl_scan:string(lists:append([String, ". "])),
- {ok,Term} = erl_parse:parse_term(Tokens),
+ {ok, Term} = erl_parse:parse_term(Tokens),
Term.
diff --git a/lib/snmp/src/app/snmp_internal.hrl b/lib/snmp/src/app/snmp_internal.hrl
index 5ff715e0b7..f04fa4dd53 100644
--- a/lib/snmp/src/app/snmp_internal.hrl
+++ b/lib/snmp/src/app/snmp_internal.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2006-2009. All Rights Reserved.
+%% Copyright Ericsson AB 2006-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
@@ -24,6 +24,8 @@
-define(APPLICATION, snmp).
-endif.
+-define(STACK(), erlang:get_stacktrace()).
+
-define(snmp_info(C, F, A), ?snmp_msg(info_msg, C, F, A)).
-define(snmp_warning(C, F, A), ?snmp_msg(warning_msg, C, F, A)).
-define(snmp_error(C, F, A), ?snmp_msg(error_msg, C, F, A)).