4 //=============================================================================
8 * Adapter class. Converts a Pdu and GenTarget into a format
9 * that can be stuffed out a I/O port
11 * @author Michael R. MacFaden re-worked api
12 * @author use ACE APIPeter E Mellquist wrote original class snmpmsg
14 //=============================================================================
17 #include "ace/config-all.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #include "asnmp/asn1.h"
24 #include "asnmp/pdu.h"
25 #include "asnmp/target.h"
31 * @brief Implement an Adapter pattern between CMU SNMP and HP SNMP++
33 * this is an adapter class, it peforms the following transformations
34 * PDU / Target -> iovec buffer
35 * iovec buffer -> PDU / Target
37 class ASNMP_Export wpdu
40 /// construct CMU data from HP SNMP++ objects
41 /// construct HP SNMP++ objects from raw buffer via CMU SNMP datatypes
42 wpdu(const Pdu
& pdu
, const UdpTarget
& target
);
43 wpdu(const iovec
& buffer
);
44 wpdu(); // same as using iovec?
48 /// constructor completed ok? rc = 1 else 0
51 /// return raw data stream via CMU code
52 const iovec
& get_buffer() const;
54 /// return HP SNMP++ pdu
55 int get_pdu(Pdu
& pdu
, snmp_version
& version
);
57 /// return community strptr
58 const unsigned char *get_community() const;
61 int convert_vb_to_smival( Vb
&tempvb
, SmiVALUE
*smival
);
62 int load_vbs(snmp_pdu
*raw_pdu
, const Pdu
& pdu
);
63 int restore_vbs(Pdu
& pdu
, const snmp_pdu
*raw_pdu
) const;
64 void free_smival_descriptor( SmiVALUE
*smival
);
65 static void copy_iovec(iovec
& dest
, const iovec
& src
);
66 int set_trap_info(snmp_pdu
*raw_pdu
, const Pdu
& pdu
) const;
71 /// object construction state
75 snmp_version version_
;
77 unsigned char community_name
[MAX_COMM_STR_LEN
];
78 unsigned long comm_len
; // = MAX_COMM_STR_LEN;