00001 #ifndef PRO_SNMP_PDU_H 00002 #define PRO_SNMP_PDU_H 00003 00004 /* 00005 * Copyright 2009 by egnite GmbH 00006 * Copyright 1998-2007 by egnite Software GmbH 00007 * Copyright 1988, 1989, 1991, 1992 by Carnegie Mellon University 00008 * 00009 * Redistribution and use in source and binary forms, with or without 00010 * modification, are permitted provided that the following conditions 00011 * are met: 00012 * 00013 * 1. Redistributions of source code must retain the above copyright 00014 * notice, this list of conditions and the following disclaimer. 00015 * 2. Redistributions in binary form must reproduce the above copyright 00016 * notice, this list of conditions and the following disclaimer in the 00017 * documentation and/or other materials provided with the distribution. 00018 * 3. Neither the name of the copyright holders nor the names of 00019 * contributors may be used to endorse or promote products derived 00020 * from this software without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00023 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00024 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00025 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00026 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00027 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00028 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 00029 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 00030 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00031 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 00032 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00033 * SUCH DAMAGE. 00034 * 00035 * For additional information see http://www.ethernut.de/ 00036 */ 00037 00047 #include <pro/asn1.h> 00048 00053 00054 typedef struct _SNMP_VARLIST SNMP_VARLIST; 00055 00056 struct _SNMP_VARLIST { 00057 SNMP_VARLIST *var_next; 00058 OID *var_name; 00059 int var_nlen; 00060 uint8_t var_type; 00061 long var_val; 00062 uint8_t *var_vptr; 00063 int var_vlen; 00064 }; 00065 00066 typedef struct { 00068 int pdu_cmd; 00069 00070 uint32_t pdu_reqid; /* Request id */ 00071 uint32_t pdu_errstat; /* Error status */ 00072 uint32_t pdu_errindex; /* Error index */ 00073 00074 /* Trap information */ 00075 OID *pdu_enterprise;/* System OID */ 00076 int pdu_enterprise_length; 00077 uint32_t pdu_agent_addr; /* address of object generating trap */ 00078 int pdu_trap_type; /* trap type */ 00079 int pdu_specific_type; /* specific type */ 00080 uint32_t pdu_time; /* Uptime */ 00081 00082 SNMP_VARLIST *pdu_variables; 00083 } SNMP_PDU; 00084 00087 extern SNMP_PDU *SnmpPduCreate(int cmd, CONST OID *ep, size_t ep_len); 00088 extern void SnmpPduDestroy(SNMP_PDU *pdu); 00089 00090 extern int SnmpPduAddVariable(SNMP_PDU *pdu, OID *name, size_t nlen, uint8_t type, uint8_t *value, size_t vlen); 00091 00092 #endif