OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [go/] [crypto/] [tls/] [alert.go] - Blame information for rev 747

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
// Copyright 2009 The Go Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
4
 
5
package tls
6
 
7
import "strconv"
8
 
9
type alert uint8
10
 
11
const (
12
        // alert level
13
        alertLevelWarning = 1
14
        alertLevelError   = 2
15
)
16
 
17
const (
18
        alertCloseNotify            alert = 0
19
        alertUnexpectedMessage      alert = 10
20
        alertBadRecordMAC           alert = 20
21
        alertDecryptionFailed       alert = 21
22
        alertRecordOverflow         alert = 22
23
        alertDecompressionFailure   alert = 30
24
        alertHandshakeFailure       alert = 40
25
        alertBadCertificate         alert = 42
26
        alertUnsupportedCertificate alert = 43
27
        alertCertificateRevoked     alert = 44
28
        alertCertificateExpired     alert = 45
29
        alertCertificateUnknown     alert = 46
30
        alertIllegalParameter       alert = 47
31
        alertUnknownCA              alert = 48
32
        alertAccessDenied           alert = 49
33
        alertDecodeError            alert = 50
34
        alertDecryptError           alert = 51
35
        alertProtocolVersion        alert = 70
36
        alertInsufficientSecurity   alert = 71
37
        alertInternalError          alert = 80
38
        alertUserCanceled           alert = 90
39
        alertNoRenegotiation        alert = 100
40
)
41
 
42
var alertText = map[alert]string{
43
        alertCloseNotify:            "close notify",
44
        alertUnexpectedMessage:      "unexpected message",
45
        alertBadRecordMAC:           "bad record MAC",
46
        alertDecryptionFailed:       "decryption failed",
47
        alertRecordOverflow:         "record overflow",
48
        alertDecompressionFailure:   "decompression failure",
49
        alertHandshakeFailure:       "handshake failure",
50
        alertBadCertificate:         "bad certificate",
51
        alertUnsupportedCertificate: "unsupported certificate",
52
        alertCertificateRevoked:     "revoked certificate",
53
        alertCertificateExpired:     "expired certificate",
54
        alertCertificateUnknown:     "unknown certificate",
55
        alertIllegalParameter:       "illegal parameter",
56
        alertUnknownCA:              "unknown certificate authority",
57
        alertAccessDenied:           "access denied",
58
        alertDecodeError:            "error decoding message",
59
        alertDecryptError:           "error decrypting message",
60
        alertProtocolVersion:        "protocol version not supported",
61
        alertInsufficientSecurity:   "insufficient security level",
62
        alertInternalError:          "internal error",
63
        alertUserCanceled:           "user canceled",
64
        alertNoRenegotiation:        "no renegotiation",
65
}
66
 
67
func (e alert) String() string {
68
        s, ok := alertText[e]
69
        if ok {
70
                return s
71
        }
72
        return "alert(" + strconv.Itoa(int(e)) + ")"
73
}
74
 
75
func (e alert) Error() string {
76
        return e.String()
77
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.