blob: 85caf6c33f7317a3329a400e1f716720bba0bb04 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/* -*-C++-*- */
// $Id$
#ifndef WPDU_H_
#define WPDU_H_
// ============================================================================
//
// = LIBRARY
// asnmp
//
// = FILENAME
// wpdu.h
//
// = DESCRIPTION
// Adapter class. Converts a Pdu and GenTarget into a format
// that can be stuffed out a I/O port
//
// = AUTHOR
// Michael R. MacFaden re-worked api, use ACE API
// Peter E Mellquist wrote original class snmpmsg
//
// ============================================================================
#include "ace/OS.h"
#include "asnmp/asn1.h"
#include "asnmp/pdu.h"
#include "asnmp/target.h"
// this is an adapter class, it peforms the following transformations
// PDU / Target -> iovec buffer
// iovec buffer -> PDU / Target
struct snmp_pdu;
class ACE_Export wpdu
// = TITLE
// Implement an Adapter pattern between CMU SNMP and HP SNMP++
//
{
public:
wpdu(const Pdu& pdu, const UdpTarget& target);
// construct CMU data from HP SNMP++ objects
wpdu(const iovec& buffer);
// construct HP SNMP++ objects from raw buffer via CMU SNMP datatypes
wpdu(); // same as using iovec?
~wpdu();
int valid() const;
// constructor completed ok? rc = 1 else 0
const iovec& get_buffer() const;
// return raw data stream via CMU code
int get_pdu(Pdu& pdu, snmp_version& version);
// return HP SNMP++ pdu
const unsigned char *get_community() const;
// return community strptr
private:
int convert_vb_to_smival( Vb &tempvb, SmiVALUE *smival );
int load_vbs(snmp_pdu *raw_pdu, const Pdu& pdu);
int restore_vbs(Pdu& pdu, const snmp_pdu *raw_pdu) const;
void free_smival_descriptor( SmiVALUE *smival );
static void copy_iovec(iovec& dest, const iovec& src);
int set_trap_info(snmp_pdu *raw_pdu, const Pdu& pdu) const;
iovec iovec_;
// raw format
int valid_flag_;
// object construction state
snmp_version version_;
// snmp version
unsigned char community_name[MAX_COMM_STR_LEN];
unsigned long comm_len; // = MAX_COMM_STR_LEN;
};
#endif // WPDU_H_
|