ON Semiconductor / mbed-os

Dependents:   mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510

Embed: (wiki syntax)

« Back to documentation index

snmp_core.h File Reference

snmp_core.h File Reference

SNMP core API for implementing MIBs. More...

Go to the source code of this file.

Data Structures

struct  snmp_obj_id
 internal object identifier representation More...
union  snmp_variant_value
 SNMP variant value, used as reference in struct snmp_node_instance and table implementation. More...
struct  snmp_node
 node "base class" layout, the mandatory fields for a node More...
struct  snmp_node_instance
 SNMP node instance. More...
struct  snmp_tree_node
 SNMP tree node. More...
struct  snmp_leaf_node
 SNMP leaf node. More...
struct  snmp_mib
 represents a single mib with its base oid and root node More...
struct  snmp_oid_range
 OID range structure. More...
struct  snmp_next_oid_state
 state for next_oid_init / next_oid_check functions More...

Enumerations

enum  snmp_err_t
 

error codes predefined by SNMP prot.

More...
enum  snmp_access_t
 

SNMP node instance access types.

More...

Functions

u8_t snmp_oid_in_range (const u32_t *oid_in, u8_t oid_len, const struct snmp_oid_range *oid_ranges, u8_t oid_ranges_len)
 checks if incoming OID length and values are in allowed ranges
void snmp_next_oid_init (struct snmp_next_oid_state *state, const u32_t *start_oid, u8_t start_oid_len, u32_t *next_oid_buf, u8_t next_oid_max_len)
 initialize struct next_oid_state using this function before passing it to next_oid_check
u8_t snmp_next_oid_precheck (struct snmp_next_oid_state *state, const u32_t *oid, const u8_t oid_len)
 checks if the passed incomplete OID may be a possible candidate for snmp_next_oid_check(); this methid is intended if the complete OID is not yet known but it is very expensive to build it up, so it is possible to test the starting part before building up the complete oid and pass it to snmp_next_oid_check()
u8_t snmp_next_oid_check (struct snmp_next_oid_state *state, const u32_t *oid, const u8_t oid_len, void *reference)
 checks the passed OID if it is a candidate to be the next one (get_next); returns !=0 if passed oid is currently closest, otherwise 0
u8_t snmp_oid_equal (const u32_t *oid1, u8_t oid1_len, const u32_t *oid2, u8_t oid2_len)
 Check of two OIDs are equal.
s8_t snmp_oid_compare (const u32_t *oid1, u8_t oid1_len, const u32_t *oid2, u8_t oid2_len)
 Compare two OIDs.
u8_t snmp_oid_to_ip4 (const u32_t *oid, ip4_addr_t *ip)
 Conversion from InetAddressIPv4 oid to lwIP ip4_addr.
void snmp_ip4_to_oid (const ip4_addr_t *ip, u32_t *oid)
 Convert ip4_addr to InetAddressIPv4 (no InetAddressType)
u8_t snmp_oid_to_ip6 (const u32_t *oid, ip6_addr_t *ip)
 Conversion from InetAddressIPv6 oid to lwIP ip6_addr.
void snmp_ip6_to_oid (const ip6_addr_t *ip, u32_t *oid)
 Convert ip6_addr to InetAddressIPv6 (no InetAddressType)
u8_t snmp_ip_to_oid (const ip_addr_t *ip, u32_t *oid)
 Convert to InetAddressType+InetAddress.
u8_t snmp_ip_port_to_oid (const ip_addr_t *ip, u16_t port, u32_t *oid)
 Convert to InetAddressType+InetAddress+InetPortNumber.
u8_t snmp_oid_to_ip (const u32_t *oid, u8_t oid_len, ip_addr_t *ip)
 Convert from InetAddressType+InetAddress to ip_addr_t.
u8_t snmp_oid_to_ip_port (const u32_t *oid, u8_t oid_len, ip_addr_t *ip, u16_t *port)
 Convert from InetAddressType+InetAddress+InetPortNumber to ip_addr_t and u16_t.
u8_t netif_to_num (const struct netif *netif)
 Convert netif to interface index.
err_t snmp_decode_bits (const u8_t *buf, u32_t buf_len, u32_t *bit_value)
 Decodes BITS pseudotype value from ASN.1 OctetString.
u8_t snmp_encode_bits (u8_t *buf, u32_t buf_len, u32_t bit_value, u8_t bit_count)
 Encodes BITS pseudotype value into ASN.1 OctetString.

Detailed Description

SNMP core API for implementing MIBs.

Definition in file snmp_core.h.


Enumeration Type Documentation

SNMP node instance access types.

Definition at line 173 of file snmp_core.h.

enum snmp_err_t

error codes predefined by SNMP prot.

Definition at line 100 of file snmp_core.h.


Function Documentation

u8_t netif_to_num ( const struct netif netif )

Convert netif to interface index.

Parameters:
netif
Returns:
index

Definition at line 619 of file lwip_snmp_core.c.

err_t snmp_decode_bits ( const u8_t *  buf,
u32_t  buf_len,
u32_t *  bit_value 
)

Decodes BITS pseudotype value from ASN.1 OctetString.

Note:
Because BITS pseudo type is encoded as OCTET STRING, it cannot directly be encoded/decoded by the agent. Instead call this function as required from get/test/set methods.
Parameters:
bufpoints to a buffer holding the ASN1 octet string
buf_lenlength of octet string
bit_valuedecoded Bit value with Bit0 == LSB
Returns:
ERR_OK if successful, ERR_ARG if bit value contains more than 32 bit

Definition at line 1173 of file lwip_snmp_core.c.

u8_t snmp_encode_bits ( u8_t *  buf,
u32_t  buf_len,
u32_t  bit_value,
u8_t  bit_count 
)

Encodes BITS pseudotype value into ASN.1 OctetString.

Note:
Because BITS pseudo type is encoded as OCTET STRING, it cannot directly be encoded/decoded by the agent. Instead call this function as required from get/test/set methods.
Parameters:
bufpoints to a buffer where the resulting ASN1 octet string is stored to
buf_lenmax length of the bufffer
bit_valueBit value to encode with Bit0 == LSB
bit_countNumber of possible bits for the bit value (according to rfc we have to send all bits independant from their truth value)
Returns:
number of bytes used from buffer to store the resulting OctetString

Definition at line 1247 of file lwip_snmp_core.c.

void snmp_ip4_to_oid ( const ip4_addr_t ip,
u32_t *  oid 
)

Convert ip4_addr to InetAddressIPv4 (no InetAddressType)

Parameters:
ippoints to input struct
oidpoints to u32_t ident[4] output

Definition at line 250 of file lwip_snmp_core.c.

void snmp_ip6_to_oid ( const ip6_addr_t ip,
u32_t *  oid 
)

Convert ip6_addr to InetAddressIPv6 (no InetAddressType)

Parameters:
ippoints to input struct
oidpoints to u32_t ident[16] output

Definition at line 301 of file lwip_snmp_core.c.

u8_t snmp_ip_port_to_oid ( const ip_addr_t ip,
u16_t  port,
u32_t *  oid 
)

Convert to InetAddressType+InetAddress+InetPortNumber.

Parameters:
ip
port
oid
Returns:
OID length

Definition at line 331 of file lwip_snmp_core.c.

u8_t snmp_ip_to_oid ( const ip_addr_t ip,
u32_t *  oid 
)

Convert to InetAddressType+InetAddress.

Parameters:
ip
oid
Returns:
OID length

Definition at line 349 of file lwip_snmp_core.c.

u8_t snmp_next_oid_check ( struct snmp_next_oid_state state,
const u32_t *  oid,
const u8_t  oid_len,
void *  reference 
)

checks the passed OID if it is a candidate to be the next one (get_next); returns !=0 if passed oid is currently closest, otherwise 0

Definition at line 1107 of file lwip_snmp_core.c.

void snmp_next_oid_init ( struct snmp_next_oid_state state,
const u32_t *  start_oid,
u8_t  start_oid_len,
u32_t *  next_oid_buf,
u8_t  next_oid_max_len 
)

initialize struct next_oid_state using this function before passing it to next_oid_check

Definition at line 1071 of file lwip_snmp_core.c.

u8_t snmp_next_oid_precheck ( struct snmp_next_oid_state state,
const u32_t *  oid,
const u8_t  oid_len 
)

checks if the passed incomplete OID may be a possible candidate for snmp_next_oid_check(); this methid is intended if the complete OID is not yet known but it is very expensive to build it up, so it is possible to test the starting part before building up the complete oid and pass it to snmp_next_oid_check()

Definition at line 1087 of file lwip_snmp_core.c.

s8_t snmp_oid_compare ( const u32_t *  oid1,
u8_t  oid1_len,
const u32_t *  oid2,
u8_t  oid2_len 
)

Compare two OIDs.

Parameters:
oid1
oid1_len
oid2
oid2_len
Returns:

Definition at line 567 of file lwip_snmp_core.c.

u8_t snmp_oid_equal ( const u32_t *  oid1,
u8_t  oid1_len,
const u32_t *  oid2,
u8_t  oid2_len 
)

Check of two OIDs are equal.

Parameters:
oid1
oid1_len
oid2
oid2_len
Returns:

Definition at line 608 of file lwip_snmp_core.c.

u8_t snmp_oid_in_range ( const u32_t *  oid_in,
u8_t  oid_len,
const struct snmp_oid_range oid_ranges,
u8_t  oid_ranges_len 
)

checks if incoming OID length and values are in allowed ranges

Definition at line 1133 of file lwip_snmp_core.c.

u8_t snmp_oid_to_ip ( const u32_t *  oid,
u8_t  oid_len,
ip_addr_t ip 
)

Convert from InetAddressType+InetAddress to ip_addr_t.

Parameters:
oid
oid_len
ip
Returns:
Parsed OID length

Definition at line 384 of file lwip_snmp_core.c.

u8_t snmp_oid_to_ip4 ( const u32_t *  oid,
ip4_addr_t ip 
)

Conversion from InetAddressIPv4 oid to lwIP ip4_addr.

Parameters:
oidpoints to u32_t ident[4] input
ippoints to output struct

Definition at line 230 of file lwip_snmp_core.c.

u8_t snmp_oid_to_ip6 ( const u32_t *  oid,
ip6_addr_t ip 
)

Conversion from InetAddressIPv6 oid to lwIP ip6_addr.

Parameters:
oidpoints to u32_t oid[16] input
ippoints to output struct

Definition at line 266 of file lwip_snmp_core.c.

u8_t snmp_oid_to_ip_port ( const u32_t *  oid,
u8_t  oid_len,
ip_addr_t ip,
u16_t *  port 
)

Convert from InetAddressType+InetAddress+InetPortNumber to ip_addr_t and u16_t.

Parameters:
oid
oid_len
ip
port
Returns:
Parsed OID length

Definition at line 460 of file lwip_snmp_core.c.