35 #ifndef __LWIP_SNMP_ASN1_H__
36 #define __LWIP_SNMP_ASN1_H__
40 #include "lwip/pbuf.h"
41 #include "lwip/snmp.h"
49 #define SNMP_ASN1_UNIV (0)
50 #define SNMP_ASN1_APPLIC (0x40)
51 #define SNMP_ASN1_CONTXT (0x80)
53 #define SNMP_ASN1_CONSTR (0x20)
54 #define SNMP_ASN1_PRIMIT (0)
57 #define SNMP_ASN1_INTEG 2
58 #define SNMP_ASN1_OC_STR 4
59 #define SNMP_ASN1_NUL 5
60 #define SNMP_ASN1_OBJ_ID 6
61 #define SNMP_ASN1_SEQ 16
64 #define SNMP_ASN1_IPADDR 0
65 #define SNMP_ASN1_COUNTER 1
66 #define SNMP_ASN1_GAUGE 2
67 #define SNMP_ASN1_TIMETICKS 3
68 #define SNMP_ASN1_OPAQUE 4
71 #define SNMP_ASN1_PDU_GET_REQ 0
72 #define SNMP_ASN1_PDU_GET_NEXT_REQ 1
73 #define SNMP_ASN1_PDU_GET_RESP 2
74 #define SNMP_ASN1_PDU_SET_REQ 3
75 #define SNMP_ASN1_PDU_TRAP 4
77 err_t snmp_asn1_dec_type(
struct pbuf *p, u16_t ofs, u8_t *type);
78 err_t snmp_asn1_dec_length(
struct pbuf *p, u16_t ofs, u8_t *octets_used, u16_t *length);
79 err_t snmp_asn1_dec_u32t(
struct pbuf *p, u16_t ofs, u16_t len, u32_t *value);
80 err_t snmp_asn1_dec_s32t(
struct pbuf *p, u16_t ofs, u16_t len, s32_t *value);
81 err_t snmp_asn1_dec_oid(
struct pbuf *p, u16_t ofs, u16_t len,
struct snmp_obj_id *oid);
82 err_t snmp_asn1_dec_raw(
struct pbuf *p, u16_t ofs, u16_t len, u16_t raw_len, u8_t *raw);
84 void snmp_asn1_enc_length_cnt(u16_t length, u8_t *octets_needed);
85 void snmp_asn1_enc_u32t_cnt(u32_t value, u16_t *octets_needed);
86 void snmp_asn1_enc_s32t_cnt(s32_t value, u16_t *octets_needed);
87 void snmp_asn1_enc_oid_cnt(u8_t ident_len, s32_t *ident, u16_t *octets_needed);
88 err_t snmp_asn1_enc_type(
struct pbuf *p, u16_t ofs, u8_t type);
89 err_t snmp_asn1_enc_length(
struct pbuf *p, u16_t ofs, u16_t length);
90 err_t snmp_asn1_enc_u32t(
struct pbuf *p, u16_t ofs, u16_t octets_needed, u32_t value);
91 err_t snmp_asn1_enc_s32t(
struct pbuf *p, u16_t ofs, u16_t octets_needed, s32_t value);
92 err_t snmp_asn1_enc_oid(
struct pbuf *p, u16_t ofs, u8_t ident_len, s32_t *ident);
93 err_t snmp_asn1_enc_raw(
struct pbuf *p, u16_t ofs, u16_t raw_len, u8_t *raw);