-
Notifications
You must be signed in to change notification settings - Fork 2
/
server-condition.lisp
81 lines (68 loc) · 2.91 KB
/
server-condition.lisp
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
;;;; -*- Mode: Lisp -*-
;;;; $Id$
(in-package :snmp)
(define-condition snmp-agent-error (snmp-error)
())
(define-condition snmp-agent-request-error (snmp-agent-error)
((request :initarg :request
:reader snmp-agent-request-error-request)))
(define-condition snmp-request-bad-community-error (snmp-agent-request-error)
((community :initarg :community
:reader snmp-error-community))
(:report (lambda (c stream)
(format stream "Bad community ~S"
(snmp-error-community c)))))
(define-condition snmp-bad-version-error (snmp-agent-request-error)
((requested-version :initarg :requested-version
:reader snmp-error-requested-version))
(:report (lambda (c stream)
(format stream "Requested version ~D not supported"
(snmp-error-requested-version c)))))
(define-condition snmp-agent-unrecognized-pdu-type-error (snmp-agent-request-error)
((pdu-type :initarg :pdu-type
:reader snmp-error-pdu-type))
(:report (lambda (c stream)
(format stream "PDU type ~D not recognized"
(snmp-error-pdu-type c)))))
(define-condition snmp-malformed-pdu-error (snmp-agent-request-error)
()
(:report (lambda (c stream)
(declare (ignore c))
(format stream "Malformed PDU"))))
(define-condition snmpv1-malformed-pdu-error (snmp-agent-request-error)
()
(:report (lambda (c stream)
(declare (ignore c))
(format stream "Malformed SNMPv1 PDU"))))
(define-condition snmp-get-bulk-illegal-max-repetitions (snmp-agent-request-error)
((max-repetitions :initarg :max-repetitions
:reader snmp-error-max-repetitions))
(:report (lambda (c stream)
(let ((max-repetitions (snmp-error-max-repetitions c)))
(format stream "Illegal value ~D for max-repetitions:~%~
should never be less than zero"
max-repetitions)))))
(define-condition snmp-get-bulk-illegal-non-repeaters (snmp-agent-request-error)
((non-repeaters :initarg :non-repeaters :reader snmp-error-non-repeaters))
(:report (lambda (c stream)
(let ((non-repeaters (snmp-error-non-repeaters c)))
(format stream "Illegal value ~D for non-repeaters:~%"
non-repeaters)
(cond ((< non-repeaters 0)
(format stream "non-repeaters should never be less than zero"))
(t (format stream "non-repeaters greater than number of bindings")))))))
(define-condition snmp-agent-specific-variable-error (snmp-agent-request-error)
((variable-index :initarg :index
:type integer
:reader snmp-agent-specific-variable-error-variable-index)))
(define-condition snmp-agent-no-such-name-error
(snmp-agent-specific-variable-error)
()
(:report (lambda (c stream)
(format stream "No such name for binding ~D (~D)"
(snmp-agent-specific-variable-error-variable-index c)
(request-id-of
(snmp-agent-request-error-request c))))))
(defmethod snmp-agent-specific-variable-error-error-status
((c snmp-agent-no-such-name-error))
:no-such-name)