1snmpa_mpd(3) Erlang Module Definition snmpa_mpd(3)
2
3
4
6 snmpa_mpd - Message Processing and Dispatch module for the SNMP agent
7
9 The module snmpa_mpd implements the version independent Message Pro‐
10 cessing and Dispatch functionality in SNMP for the agent. It is sup‐
11 posed to be used from a Network Interface process (Definition of Agent
12 Net if).
13
15 See the data types in snmpa_conf.
16
18 init(Vsns) -> mpd_state()
19
20 Types:
21
22 Vsns = [Vsn]
23 Vsn = v1 | v2 | v3
24
25 This function can be called from the net_if process at start-up.
26 The options list defines which versions to use.
27
28 It also initializes some SNMP counters.
29
30 process_packet(Packet, From, State, NoteStore, Log) -> {ok, Vsn, Pdu,
31 PduMS, ACMData} | {discarded, Reason} | {discovery, DiscoPacket}
32 process_packet(Packet, From, LocalEngineID, State, NoteStore, Log) ->
33 {ok, Vsn, Pdu, PduMS, ACMData} | {discarded, Reason} | {discovery, Dis‐
34 coPacket}
35
36 Types:
37
38 Packet = binary()
39 From = {TDomain, TAddr}
40 TDomain = transportDomainUdpIpv4 | transportDomainUdpIpv6
41 TAddr = {IpAddr, IpPort}
42 LocalEngineID = string()
43 IpAddr = inet:ip_address()
44 IpPort = inet:port_number()
45 State = mpd_state()
46 NoteStore = pid()
47 Log = snmp_log()
48 Vsn = 'version-1' | 'version-2' | 'version-3'
49 Pdu = #pdu
50 PduMs = integer()
51 ACMData = acm_data()
52 Reason = term()
53 DiscoPacket = binary()
54
55 Processes an incoming packet. Performs authentication and
56 decryption as necessary. The return values should be passed to
57 the agent.
58
59 Note:
60 Note that the use of the LocalEngineID argument is only intended
61 for special cases, if the agent is to "emulate" multiple
62 EngineIDs! By default, the agent uses the value of SnmpEngineID
63 (see SNMP-FRAMEWORK-MIB).
64
65
66 generate_response_msg(Vsn, RePdu, Type, ACMData, Log) -> {ok, Packet} |
67 {discarded, Reason}
68 generate_response_msg(Vsn, RePdu, Type, ACMData, LocalEngineID, Log) ->
69 {ok, Packet} | {discarded, Reason}
70
71 Types:
72
73 Vsn = 'version-1' | 'version-2' | 'version-3'
74 RePdu = #pdu
75 Type = atom()
76 ACMData = acm_data()
77 LocalEngineID = string()
78 Packet = binary()
79
80 Generates a possibly encrypted response packet to be sent to the
81 network. Type is the #pdu.type of the original request.
82
83 Note:
84 Note that the use of the LocalEngineID argument is only intended
85 for special cases, if the agent is to "emulate" multiple
86 EngineIDs! By default, the agent uses the value of SnmpEngineID
87 (see SNMP-FRAMEWORK-MIB).
88
89
90 generate_msg(Vsn, NoteStore, Pdu, MsgData, To) -> {ok, PacketsAndAd‐
91 dresses} | {discarded, Reason}
92 generate_msg(Vsn, NoteStore, Pdu, MsgData, LocalEngineID, To) -> {ok,
93 PacketsAndAddresses} | {discarded, Reason}
94
95 Types:
96
97 Vsn = 'version-1' | 'version-2' | 'version-3'
98 NoteStore = pid()
99 Pdu = #pdu
100 MsgData = msg_data()
101 LocalEngineID = string()
102 To = [dest_addrs()]
103 PacketsAndAddresses = [{TDomain, TAddress, Packet}]
104 TDomain = snmpUDPDomain
105 TAddress = {Ip, Udp}
106 Ip = {integer(), integer(), integer(), integer()}
107 Udp = integer()
108 Packet = binary()
109
110 Generates a possibly encrypted request packet to be sent to the
111 network.
112
113 MsgData is the message specific data used in the SNMP message.
114 This value is received in a send_pdu or send_pdu_req message
115 from the agent. In SNMPv1 and SNMPv2c, this message data is the
116 community string. In SNMPv3, it is the context information.
117
118 To is a list of destination addresses and their corresponding
119 security parameters. This value is received in the same message
120 from the agent and then transformed trough process_taddrs before
121 passed to this function.
122
123 Note:
124 Note that the use of the LocalEngineID argument is only intended
125 for special cases, if the agent is to "emulate" multiple
126 EngineIDs! By default, the agent uses the value of SnmpEngineID
127 (see SNMP-FRAMEWORK-MIB).
128
129
130 process_taddrs(TDests) -> Dests
131
132 Types:
133
134 TDests = [TDest]
135 TDest = {{TDomain, TAddr}, SecData} | {TDomain, TAddr}
136 TDomain = term() % Not at tuple
137 TAddr = term()
138 SecData = term()
139 Dests = [Dest]
140 Dest = {{Domain, Addr}, SecData} | {Domain, Addr}
141 Domain = transportDomain()
142 Addr = transportAddress() % Depends on Domain
143
144 Transforms addresses from internal MIB format to one more useful
145 to Agent Net if.
146
147 See also generate_msg.
148
149 discarded_pdu(Variable) -> void()
150
151 Types:
152
153 Variable = atom()
154
155 Increments the variable associated with a discarded pdu. This
156 function can be used when the net_if process receives a dis‐
157 carded_pdu message from the agent.
158
159
160
161Ericsson AB snmp 5.8 snmpa_mpd(3)