檢視原始碼 snmpm_network_interface 行為 (snmp v5.18)

SNMP 管理器網路介面的行為模組。

此模組定義了管理器網路介面的行為。一個符合 snmpm_network_interface 的模組必須匯出以下函式

它們的語義及其確切簽名在下面解釋。

為了向後兼容,舊版 API 函式 send_pdu/7 具有單獨的 IpAddrPortNumber 參數,仍然可以像以前一樣使用。

摘要

回呼函式

稽核追蹤日誌由網路介面程序管理。因此,必須由此程序返回實際的日誌類型。

返回的資訊基本上由實作者決定。此應用程式提供的實作會提供關於記憶體配置和各種 socket 資訊。

指示網路介面程序向 inform-request 發送回應(確認)。

更改 note-store 程序的 pid。這會在伺服器重新啟動 note-store 時使用 (例如在當機後)。

請求網路介面程序 (Pid) 發送此 PDU (Pdu)。

稽核追蹤日誌由網路介面程序管理。因此,必須由此程序實際更改類型。

啟動並連結網路介面程序。

停止網路介面程序。

更改網路介面程序的詳細程度。

回呼函式

-callback get_log_type(Pid) -> {ok, LogType} | {error, Reason}
                          when Pid :: pid(), LogType :: snmp:atl_type(), Reason :: term().

稽核追蹤日誌由網路介面程序管理。因此,必須由此程序返回實際的日誌類型。

-callback info(Pid) -> Info when Pid :: pid(), Info :: [{Key, Value}], Key :: term(), Value :: term().

返回的資訊基本上由實作者決定。此應用程式提供的實作會提供關於記憶體配置和各種 socket 資訊。

此函式返回的資訊,會與呼叫 snmpm:info() 函式時,管理器收集的其他資訊一起返回(使用鍵 net_if 標記)。

連結到此回呼函式

inform_response(Pid, Ref, Addr, Port)

檢視原始碼
-callback inform_response(Pid, Ref, Addr, Port) -> snmp:void()
                             when
                                 Pid :: pid(),
                                 Ref :: term(),
                                 Addr :: inet:ip_address(),
                                 Port :: inet:port_number().

指示網路介面程序向 inform-request 發送回應(確認)。

Ref 是可以用於識別 inform-request 的內容,例如 inform-request 的請求 id。

AddrPort 識別發起 inform-request 的代理。

連結到此回呼函式

note_store(Pid, NoteStore)

檢視原始碼
-callback note_store(Pid, NoteStore) -> snmp:void() when Pid :: pid(), NoteStore :: pid().

更改 note-store 程序的 pid。這會在伺服器重新啟動 note-store 時使用 (例如在當機後)。

連結到此回呼函式

send_pdu(Pid, Pdu, Vsn, MsgData, Domain, Addr, ExtraInfo)

檢視原始碼
-callback send_pdu(Pid, Pdu, Vsn, MsgData, Domain, Addr, ExtraInfo) -> snmp:void()
                      when
                          Pid :: pid(),
                          Pdu :: snmp:pdu(),
                          Vsn :: 'version-1' | 'version-2' | 'version-3',
                          MsgData :: term(),
                          Domain :: snmp:tdomain(),
                          Addr :: {inet:ip_address(), inet:port_number()},
                          ExtraInfo :: term().

請求網路介面程序 (Pid) 發送此 PDU (Pdu)。

ExtraInfo 是一些傳遞給 net-if 程序的不透明資料。它源自於呼叫 同步 get-request非同步 get-request同步 get-next-request非同步 get-next-request同步 set-request非同步 set-request 函式中的 ExtraInfo 參數。 net-if 程序是否選擇使用它,取決於實作。此應用程式中包含的 net-if 程序會忽略它。

連結到此回呼函式

set_log_type(Pid, NewType)

檢視原始碼
-callback set_log_type(Pid, NewType) -> {ok, OldType} | {error, Reason}
                          when
                              Pid :: pid(),
                              NewType :: snmp:atl_type(),
                              OldType :: snmp:atl_type(),
                              Reason :: term().

稽核追蹤日誌由網路介面程序管理。因此,必須由此程序實際更改類型。

請參閱 snmpm:set_log_type/1 以取得更多資訊。

連結到此回呼函式

start_link(Server, NoteStore)

檢視原始碼
-callback start_link(Server, NoteStore) -> {ok, Pid} | {error, Reason}
                        when Server :: pid(), NoteStore :: pid(), Pid :: pid(), Reason :: term().

啟動並連結網路介面程序。

Server 是管理程序的 pid。

NoteStorenote-store 程序的 pid。

-callback stop(Pid) -> snmp:void() when Pid :: pid().

停止網路介面程序。

-callback verbosity(Pid, Verbosity) -> snmp:void() when Pid :: pid(), Verbosity :: snmp:verbosity().

更改網路介面程序的詳細程度。