Documentation

Documentation

Includes

lwip/apps/snmp_opts.h

#include "lwip/apps/snmp_opts.h"
#include "lwip/apps/snmp_opts.h"

lwip/ip_addr.h

#include "lwip/ip_addr.h"
#include "lwip/ip_addr.h"

lwip/err.h

#include "lwip/err.h"
#include "lwip/err.h"

Macros

Marco LWIP_HDR_APPS_SNMP_CORE_H

#define LWIP_HDR_APPS_SNMP_CORE_H


      

Marco SNMP_ASN1_CLASS_UNIVERSAL

#define SNMP_ASN1_CLASS_UNIVERSAL  0
/* basic ASN1 defines */

Marco SNMP_ASN1_CLASS_APPLICATION

#define SNMP_ASN1_CLASS_APPLICATION 64


      

Marco SNMP_ASN1_CLASS_CONTEXT

#define SNMP_ASN1_CLASS_CONTEXT    128


      

Marco SNMP_ASN1_CLASS_PRIVATE

#define SNMP_ASN1_CLASS_PRIVATE    0xC0


      

Marco SNMP_ASN1_CONTENTTYPE_PRIMITIVE

#define SNMP_ASN1_CONTENTTYPE_PRIMITIVE  0


      

Marco SNMP_ASN1_CONTENTTYPE_CONSTRUCTED

#define SNMP_ASN1_CONTENTTYPE_CONSTRUCTED 32


      

Marco SNMP_ASN1_UNIVERSAL_END_OF_CONTENT

#define SNMP_ASN1_UNIVERSAL_END_OF_CONTENT 0
/* universal tags (from ASN.1 spec.) */

Marco SNMP_ASN1_UNIVERSAL_INTEGER

#define SNMP_ASN1_UNIVERSAL_INTEGER        2


      

Marco SNMP_ASN1_UNIVERSAL_OCTET_STRING

#define SNMP_ASN1_UNIVERSAL_OCTET_STRING   4


      

Marco SNMP_ASN1_UNIVERSAL_NULL

#define SNMP_ASN1_UNIVERSAL_NULL           5


      

Marco SNMP_ASN1_UNIVERSAL_OBJECT_ID

#define SNMP_ASN1_UNIVERSAL_OBJECT_ID      6


      

Marco SNMP_ASN1_UNIVERSAL_SEQUENCE_OF

#define SNMP_ASN1_UNIVERSAL_SEQUENCE_OF   16


      

Marco SNMP_ASN1_APPLICATION_IPADDR

#define SNMP_ASN1_APPLICATION_IPADDR   0 /* [APPLICATION 0] IMPLICIT OCTET STRING (SIZE (4)) */
/* application specific (SNMP) tags (from SNMPv2-SMI) */

Marco SNMP_ASN1_APPLICATION_COUNTER

#define SNMP_ASN1_APPLICATION_COUNTER  1 /* [APPLICATION 1] IMPLICIT INTEGER (0..4294967295) => u32_t */


      

Marco SNMP_ASN1_APPLICATION_GAUGE

#define SNMP_ASN1_APPLICATION_GAUGE    2 /* [APPLICATION 2] IMPLICIT INTEGER (0..4294967295) => u32_t */


      

Marco SNMP_ASN1_APPLICATION_TIMETICKS

#define SNMP_ASN1_APPLICATION_TIMETICKS 3 /* [APPLICATION 3] IMPLICIT INTEGER (0..4294967295) => u32_t */


      

Marco SNMP_ASN1_APPLICATION_OPAQUE

#define SNMP_ASN1_APPLICATION_OPAQUE   4 /* [APPLICATION 4] IMPLICIT OCTET STRING */


      

Marco SNMP_ASN1_APPLICATION_COUNTER64

#define SNMP_ASN1_APPLICATION_COUNTER64 6 /* [APPLICATION 6] IMPLICIT INTEGER (0..18446744073709551615) */


      

Marco SNMP_ASN1_CONTEXT_VARBIND_NO_SUCH_INSTANCE

#define SNMP_ASN1_CONTEXT_VARBIND_NO_SUCH_INSTANCE 1
/* context specific (SNMP) tags (from RFC 1905) */

Marco SNMP_ASN1_TYPE_END_OF_CONTENT

#define SNMP_ASN1_TYPE_END_OF_CONTENT (SNMP_ASN1_CLASS_UNIVERSAL | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_UNIVERSAL_END_OF_CONTENT)
/* full ASN1 type defines */

Marco SNMP_ASN1_TYPE_INTEGER

#define SNMP_ASN1_TYPE_INTEGER       (SNMP_ASN1_CLASS_UNIVERSAL | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_UNIVERSAL_INTEGER)


      

Marco SNMP_ASN1_TYPE_OCTET_STRING

#define SNMP_ASN1_TYPE_OCTET_STRING  (SNMP_ASN1_CLASS_UNIVERSAL | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_UNIVERSAL_OCTET_STRING)


      

Marco SNMP_ASN1_TYPE_NULL

#define SNMP_ASN1_TYPE_NULL          (SNMP_ASN1_CLASS_UNIVERSAL | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_UNIVERSAL_NULL)


      

Marco SNMP_ASN1_TYPE_OBJECT_ID

#define SNMP_ASN1_TYPE_OBJECT_ID     (SNMP_ASN1_CLASS_UNIVERSAL | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_UNIVERSAL_OBJECT_ID)


      

Marco SNMP_ASN1_TYPE_SEQUENCE

#define SNMP_ASN1_TYPE_SEQUENCE      (SNMP_ASN1_CLASS_UNIVERSAL | SNMP_ASN1_CONTENTTYPE_CONSTRUCTED | SNMP_ASN1_UNIVERSAL_SEQUENCE_OF)


      

Marco SNMP_ASN1_TYPE_IPADDR

#define SNMP_ASN1_TYPE_IPADDR        (SNMP_ASN1_CLASS_APPLICATION | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_APPLICATION_IPADDR)


      

Marco SNMP_ASN1_TYPE_IPADDRESS

#define SNMP_ASN1_TYPE_IPADDRESS     SNMP_ASN1_TYPE_IPADDR


      

Marco SNMP_ASN1_TYPE_COUNTER

#define SNMP_ASN1_TYPE_COUNTER       (SNMP_ASN1_CLASS_APPLICATION | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_APPLICATION_COUNTER)


      

Marco SNMP_ASN1_TYPE_COUNTER32

#define SNMP_ASN1_TYPE_COUNTER32     SNMP_ASN1_TYPE_COUNTER


      

Marco SNMP_ASN1_TYPE_GAUGE

#define SNMP_ASN1_TYPE_GAUGE         (SNMP_ASN1_CLASS_APPLICATION | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_APPLICATION_GAUGE)


      

Marco SNMP_ASN1_TYPE_GAUGE32

#define SNMP_ASN1_TYPE_GAUGE32       SNMP_ASN1_TYPE_GAUGE


      

Marco SNMP_ASN1_TYPE_UNSIGNED32

#define SNMP_ASN1_TYPE_UNSIGNED32    SNMP_ASN1_TYPE_GAUGE


      

Marco SNMP_ASN1_TYPE_TIMETICKS

#define SNMP_ASN1_TYPE_TIMETICKS     (SNMP_ASN1_CLASS_APPLICATION | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_APPLICATION_TIMETICKS)


      

Marco SNMP_ASN1_TYPE_OPAQUE

#define SNMP_ASN1_TYPE_OPAQUE        (SNMP_ASN1_CLASS_APPLICATION | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_APPLICATION_OPAQUE)


      

Marco SNMP_ASN1_TYPE_COUNTER64

#define SNMP_ASN1_TYPE_COUNTER64     (SNMP_ASN1_CLASS_APPLICATION | SNMP_ASN1_CONTENTTYPE_PRIMITIVE | SNMP_ASN1_APPLICATION_COUNTER64)


      

Marco SNMP_VARBIND_EXCEPTION_OFFSET

#define SNMP_VARBIND_EXCEPTION_OFFSET 240


      

Marco SNMP_VARBIND_EXCEPTION_MASK

#define SNMP_VARBIND_EXCEPTION_MASK  15


      

Marco SNMP_NODE_TREE

#define SNMP_NODE_TREE        0
/**
SNMP MIB node types
 tree node is the only node the stack can process in order to walk the tree,
 all other nodes are assumed to be leaf nodes.
 This cannot be an enum because users may want to define their own node types.
*/

Marco SNMP_NODE_SCALAR

#define SNMP_NODE_SCALAR      1
/* predefined leaf node types */

Marco SNMP_NODE_SCALAR_ARRAY

#define SNMP_NODE_SCALAR_ARRAY 2


      

Marco SNMP_NODE_TABLE

#define SNMP_NODE_TABLE       3


      

Marco SNMP_NODE_THREADSYNC

#define SNMP_NODE_THREADSYNC  4


      

Marco SNMP_GET_VALUE_RAW_DATA

#define SNMP_GET_VALUE_RAW_DATA 16384 /* do not use 0x8000 because return value of node_instance_get_value_method is signed16 and 0x8000 would be the signed bit */


      

Marco SNMP_CREATE_TREE_NODE(oid, subnodes)

#define SNMP_CREATE_TREE_NODE(oid, subnodes) \
 {{ SNMP_NODE_TREE, (oid) }, \
 (u16_t)LWIP_ARRAYSIZE(subnodes), (subnodes) }


      

Marco SNMP_CREATE_EMPTY_TREE_NODE(oid)

#define SNMP_CREATE_EMPTY_TREE_NODE(oid) \
 {{ SNMP_NODE_TREE, (oid) }, \
 0, NULL }


      

Marco SNMP_MIB_CREATE(oid_list, root_node)

#define SNMP_MIB_CREATE(oid_list, root_node) { (oid_list), (u8_t)LWIP_ARRAYSIZE(oid_list), root_node }

      

Functions

Func snmp_oid_in_range

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 */

Func snmp_next_oid_init

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);


      

Func snmp_next_oid_precheck

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


      

Func snmp_next_oid_check

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


      

Func snmp_oid_assign

void snmp_oid_assign(struct snmp_obj_id* target, const u32_t *oid, u8_t oid_len);


      

Func snmp_oid_combine

void snmp_oid_combine(struct snmp_obj_id* target, const u32_t *oid1, u8_t oid1_len, const u32_t *oid2, u8_t oid2_len);


      

Func snmp_oid_prefix

void snmp_oid_prefix(struct snmp_obj_id* target, const u32_t *oid, u8_t oid_len);


      

Func snmp_oid_append

void snmp_oid_append(struct snmp_obj_id* target, const u32_t *oid, u8_t oid_len);


      

Func snmp_oid_equal

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


      

Func snmp_oid_compare

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


      

Func snmp_oid_to_ip4

u8_t snmp_oid_to_ip4(const u32_t *oid, ip4_addr_t *ip);


      

Func snmp_ip4_to_oid

void snmp_ip4_to_oid(const ip4_addr_t *ip, u32_t *oid);


      

Func snmp_oid_to_ip6

u8_t snmp_oid_to_ip6(const u32_t *oid, ip6_addr_t *ip);


      

Func snmp_ip6_to_oid

void snmp_ip6_to_oid(const ip6_addr_t *ip, u32_t *oid);


      

Func snmp_ip_to_oid

u8_t snmp_ip_to_oid(const ip_addr_t *ip, u32_t *oid);


      

Func snmp_ip_port_to_oid

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


      

Func snmp_oid_to_ip

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


      

Func snmp_oid_to_ip_port

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


      

Func netif_to_num

u8_t netif_to_num(const struct netif *netif);


      

Func snmp_set_test_ok

snmp_err_t snmp_set_test_ok(struct snmp_node_instance* instance, u16_t value_len, void* value);


      

Func snmp_decode_bits

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


      

Func snmp_decode_truthvalue

err_t snmp_decode_truthvalue(const s32_t *asn1_value, u8_t *bool_value);


      

Func snmp_encode_bits

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


      

Func snmp_encode_truthvalue

u8_t snmp_encode_truthvalue(s32_t *asn1_value, u32_t bool_value);

      

Vars

Variable snmp_node_instance

struct snmp_node_instance;


      

Variable netif

struct netif;

      

Consts

Types

Typedefs

Typedef snmp_err_t;

typedef enum {
 SNMP_ERR_NOERROR            = 0,
/* 
outdated v1 error codes. do not use anmore!
#define SNMP_ERR_NOSUCHNAME 2  use SNMP_ERR_NOSUCHINSTANCE instead
#define SNMP_ERR_BADVALUE   3  use SNMP_ERR_WRONGTYPE,SNMP_ERR_WRONGLENGTH,SNMP_ERR_WRONGENCODING or SNMP_ERR_WRONGVALUE instead
#define SNMP_ERR_READONLY   4  use SNMP_ERR_NOTWRITABLE instead
*/
 SNMP_ERR_GENERROR           = 5,
 SNMP_ERR_NOACCESS           = 6,
 SNMP_ERR_WRONGTYPE          = 7,
 SNMP_ERR_WRONGLENGTH        = 8,
 SNMP_ERR_WRONGENCODING      = 9,
 SNMP_ERR_WRONGVALUE         = 10,
 SNMP_ERR_NOCREATION         = 11,
 SNMP_ERR_INCONSISTENTVALUE  = 12,
 SNMP_ERR_RESOURCEUNAVAILABLE = 13,
 SNMP_ERR_COMMITFAILED       = 14,
 SNMP_ERR_UNDOFAILED         = 15,
 SNMP_ERR_NOTWRITABLE        = 17,
 SNMP_ERR_INCONSISTENTNAME   = 18,

 SNMP_ERR_NOSUCHINSTANCE     = SNMP_VARBIND_EXCEPTION_OFFSET + SNMP_ASN1_CONTEXT_VARBIND_NO_SUCH_INSTANCE
} snmp_err_t;
/** error codes predefined by SNMP prot. */

Typedef snmp_access_t;

typedef enum {
 SNMP_NODE_INSTANCE_ACCESS_READ   = 1,
 SNMP_NODE_INSTANCE_ACCESS_WRITE  = 2,
 SNMP_NODE_INSTANCE_READ_ONLY     = SNMP_NODE_INSTANCE_ACCESS_READ,
 SNMP_NODE_INSTANCE_READ_WRITE    = (SNMP_NODE_INSTANCE_ACCESS_READ | SNMP_NODE_INSTANCE_ACCESS_WRITE),
 SNMP_NODE_INSTANCE_WRITE_ONLY    = SNMP_NODE_INSTANCE_ACCESS_WRITE,
 SNMP_NODE_INSTANCE_NOT_ACCESSIBLE = 0
} snmp_access_t;
/** SNMP node instance access types */

Typedef node_instance_get_value_method

typedef s16_t (*node_instance_get_value_method)(struct snmp_node_instance*, void*);


      

Typedef node_instance_set_test_method

typedef snmp_err_t (*node_instance_set_test_method)(struct snmp_node_instance*, u16_t, void*);


      

Typedef node_instance_set_value_method

typedef snmp_err_t (*node_instance_set_value_method)(struct snmp_node_instance*, u16_t, void*);


      

Typedef node_instance_release_method

typedef void (*node_instance_release_method)(struct snmp_node_instance*);


      

Typedef snmp_next_oid_status_t;

typedef enum {
 SNMP_NEXT_OID_STATUS_SUCCESS,
 SNMP_NEXT_OID_STATUS_NO_MATCH,
 SNMP_NEXT_OID_STATUS_BUF_TO_SMALL
} snmp_next_oid_status_t;