summaryrefslogtreecommitdiffstats
path: root/ksim/monitors/snmp/snmp.h
blob: 4b1e4fbe5603a93b225d71f801fe598ac06f87b9 (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/* This file is part of the KDE project
   Copyright (C) 2003 Simon Hausmann <hausmann@kde.org>

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; see the file COPYING.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef KSIM_SNMP_H
#define KSIM_SNMP_H

#include <tdeconfigbase.h>

#include <tqmap.h>


namespace KSim
{

namespace Snmp
{

enum SnmpVersion { SnmpVersion1, SnmpVersion2c, SnmpVersion3, SnmpLastVersion };
TQStringList allSnmpVersions();
TQString snmpVersionToString( SnmpVersion version );
SnmpVersion stringToSnmpVersion( TQString string, bool *ok = 0 );

enum SecurityLevel { NoAuthPriv, AuthNoPriv, AuthPriv, LastSecurityLevel };
TQStringList allSecurityLevels();
TQString securityLevelToString( SecurityLevel level );
SecurityLevel stringToSecurityLevel( TQString string, bool *ok = 0 );

enum AuthenticationProtocol { MD5Auth, SHA1Auth, LastAuthenticationProtocol };
TQStringList allAuthenticationProtocols();
TQString authenticationProtocolToString( AuthenticationProtocol proto );
AuthenticationProtocol stringToAuthenticationProtocol( TQString string, bool *ok = 0 );

enum PrivacyProtocol {
    AESPrivacy,
    DESPrivacy
};
TQStringList allPrivacyProtocols();
TQString privacyProtocolToString( PrivacyProtocol proto );
PrivacyProtocol stringToPrivacyProtocol( TQString string, bool *ok = 0 );

class ErrorInfo
{
public:
    enum ErrorType {
        NoError = 0,
        ErrUnknown, // ... if we forgot a mapping of error codes

        // api errors
        ErrGeneric,
        ErrInvalidLocalPort,
        ErrUnknownHost,
        ErrUnknownSession,
        ErrTooLong,
        ErrNoSocket,
        ErrCannotSendV2PDUOnV1Session,
        ErrCannotSendV1PDUOnV2Session,
        ErrBadValueForNonRepeaters,
        ErrBadValueForMaxRepetitions,
        ErrBuildingASN1Representation,
        ErrFailureInSendto,
        ErrBadParseOfASN1Type,
        ErrBadVersion,
        ErrBadSourceParty,
        ErrBadDestinationParty,
        ErrBadContext,
        ErrBadCommunity,
        ErrCannotSendNoAuthDesPriv,
        ErrBadACL,
        ErrBadParty,
        ErrSessionAbortFailure,
        ErrUnknownPDU,
        ErrTimeout,
        ErrFailureInRecvfrom,
        ErrUnableToDetermineContextEngineID,
        ErrNoSecurityName,
        ErrUnableToDetermineSecurityLevel,
        ErrASN1ParseError,
        ErrUnknownSecurityModel,
        ErrInvalidMessage,
        ErrUnknownEngineID,
        ErrUnknownUserName,
        ErrUnsupportedSecurityLevel,
        ErrAuthenticationFailure,
        ErrNotInTimeWindow,
        ErrDecryptionError,
        ErrSCAPIGeneralFailure,
        ErrSCAPISubSystemNotConfigured,
        ErrNoKeyTools,
        ErrUnknownReport,
        ErrUSMGenericError,
        ErrUSMUnknownSecurityName,
        ErrUSMUnsupportedSecurityLevel,
        ErrUSMEncryptionError,
        ErrUSMAuthenticationFailure,
        ErrUSMParseError,
        ErrUSMUnknownEngineID,
        ErrUSMNotInTimeWindow,
        ErrUSMDecryptionError,
        ErrMIBNotInitialized,
        ErrValueOutOfRange,
        ErrSubIdOutOfRange,
        ErrBadSubIdInOID,
        ErrOIDTooLong,
        ErrBadValueName,
        ErrBadValueNotation,
        ErrUnknownOID,
        ErrNullPDU,
        ErrMissingVariables,
        ErrBadVariableType,
        ErrOOM,
        ErrKerberos,

        // pdu response errors

        ErrResponseTooLarge,
        ErrNoSuchVariable,
        ErrBadValue,
        ErrReadOnly,
        ErrNoAccess,
        ErrWrongType,
        ErrWrongLength,
        ErrWrongEncoding,
        ErrWrongValue,
        ErrNoCreation,
        ErrInconsistentValue,
        ErrResourceUnavailable,
        ErrCommitFailed,
        ErrUndoFailed,
        ErrAuthorizationFailed,
        ErrNotWritable,
        ErrInconsistentName
    };

    ErrorInfo();
    ErrorInfo( int internalErrorCode );
    ErrorInfo( ErrorType error );

    ErrorType errorCode() const { return m_errorCode; }
    TQString errorMessage() const { return m_errorMessage; }

private:
    ErrorType m_errorCode;
    TQString m_errorMessage;
};

}

}

#endif // KSIMSNMP_H