Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef __LWIP_SNMP_ASN1_H__
00036 #define __LWIP_SNMP_ASN1_H__
00037
00038 #include "lwip/opt.h"
00039 #include "lwip/err.h"
00040 #include "lwip/pbuf.h"
00041 #include "lwip/snmp.h"
00042
00043 #if LWIP_SNMP
00044
00045 #ifdef __cplusplus
00046 extern "C" {
00047 #endif
00048
00049 #define SNMP_ASN1_UNIV (!0x80 | !0x40)
00050 #define SNMP_ASN1_APPLIC (!0x80 | 0x40)
00051 #define SNMP_ASN1_CONTXT ( 0x80 | !0x40)
00052
00053 #define SNMP_ASN1_CONSTR (0x20)
00054 #define SNMP_ASN1_PRIMIT (!0x20)
00055
00056
00057 #define SNMP_ASN1_INTEG 2
00058 #define SNMP_ASN1_OC_STR 4
00059 #define SNMP_ASN1_NUL 5
00060 #define SNMP_ASN1_OBJ_ID 6
00061 #define SNMP_ASN1_SEQ 16
00062
00063
00064 #define SNMP_ASN1_IPADDR 0
00065 #define SNMP_ASN1_COUNTER 1
00066 #define SNMP_ASN1_GAUGE 2
00067 #define SNMP_ASN1_TIMETICKS 3
00068 #define SNMP_ASN1_OPAQUE 4
00069
00070
00071 #define SNMP_ASN1_PDU_GET_REQ 0
00072 #define SNMP_ASN1_PDU_GET_NEXT_REQ 1
00073 #define SNMP_ASN1_PDU_GET_RESP 2
00074 #define SNMP_ASN1_PDU_SET_REQ 3
00075 #define SNMP_ASN1_PDU_TRAP 4
00076
00077 err_t snmp_asn1_dec_type(struct pbuf *p, u16_t ofs, u8_t *type);
00078 err_t snmp_asn1_dec_length(struct pbuf *p, u16_t ofs, u8_t *octets_used, u16_t *length);
00079 err_t snmp_asn1_dec_u32t(struct pbuf *p, u16_t ofs, u16_t len, u32_t *value);
00080 err_t snmp_asn1_dec_s32t(struct pbuf *p, u16_t ofs, u16_t len, s32_t *value);
00081 err_t snmp_asn1_dec_oid(struct pbuf *p, u16_t ofs, u16_t len, struct snmp_obj_id *oid);
00082 err_t snmp_asn1_dec_raw(struct pbuf *p, u16_t ofs, u16_t len, u16_t raw_len, u8_t *raw);
00083
00084 void snmp_asn1_enc_length_cnt(u16_t length, u8_t *octets_needed);
00085 void snmp_asn1_enc_u32t_cnt(u32_t value, u16_t *octets_needed);
00086 void snmp_asn1_enc_s32t_cnt(s32_t value, u16_t *octets_needed);
00087 void snmp_asn1_enc_oid_cnt(u8_t ident_len, s32_t *ident, u16_t *octets_needed);
00088 err_t snmp_asn1_enc_type(struct pbuf *p, u16_t ofs, u8_t type);
00089 err_t snmp_asn1_enc_length(struct pbuf *p, u16_t ofs, u16_t length);
00090 err_t snmp_asn1_enc_u32t(struct pbuf *p, u16_t ofs, u8_t octets_needed, u32_t value);
00091 err_t snmp_asn1_enc_s32t(struct pbuf *p, u16_t ofs, u8_t octets_needed, s32_t value);
00092 err_t snmp_asn1_enc_oid(struct pbuf *p, u16_t ofs, u8_t ident_len, s32_t *ident);
00093 err_t snmp_asn1_enc_raw(struct pbuf *p, u16_t ofs, u8_t raw_len, u8_t *raw);
00094
00095 #ifdef __cplusplus
00096 }
00097 #endif
00098
00099 #endif
00100
00101 #endif