-
Notifications
You must be signed in to change notification settings - Fork 0
/
__attr_framed_protocol.go
executable file
·75 lines (57 loc) · 1.37 KB
/
__attr_framed_protocol.go
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
package radgo
import (
. "asdf"
)
type EAfpValue uint32
func (me EAfpValue) Tag() string {
return "Framed-Protocol"
}
func (me EAfpValue) Begin() int {
return int(afpBegin)
}
func (me EAfpValue) End() int {
return int(afpEnd)
}
func (me EAfpValue) Int() int {
return int(me)
}
func (me EAfpValue) IsGood() bool {
return IsGoodEnum(me) &&
len(afpBind) == me.End() &&
len(afpBind[me]) > 0
}
func (me EAfpValue) ToString() string {
var b EnumBinding = afpBind[:]
return b.EntryShow(me)
}
func (me *EAfpValue) FromString(Name string) error {
if e, ok := afpMap[Name]; ok {
*me = e
return nil
}
return ErrNoFound
}
const (
afpBegin EAfpValue = 1
AfpPpp EAfpValue = 1
AfpSlip EAfpValue = 2
AfpArap EAfpValue = 3 // AppleTalk Remote Access Protocol (ARAP)
AfpGandalf EAfpValue = 4 // Gandalf proprietary SingleLink/MultiLink protocol
AfpIpx EAfpValue = 5 // Xylogics proprietary IPX/SLIP
AfpX75 EAfpValue = 6 // X.75 Synchronous
afpEnd EAfpValue = 7
)
var afpBind = [afpEnd]string{
AfpPpp: "PPP",
AfpSlip: "SLIP",
AfpArap: "AppleTalk Remote Access Protocol (ARAP)",
AfpGandalf: "Gandalf proprietary SingleLink/MultiLink protocol",
AfpIpx: "Xylogics proprietary IPX/SLIP",
AfpX75: "X.75 Synchronous",
}
var afpMap = map[string]EAfpValue{}
func initAfp() {
for i := afpBegin; i < afpEnd; i++ {
afpMap[afpBind[i]] = i
}
}