-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmproc.go
More file actions
51 lines (45 loc) · 788 Bytes
/
mproc.go
File metadata and controls
51 lines (45 loc) · 788 Bytes
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
package opensmtpd
import (
"fmt"
)
const (
mINT = iota
mUINT32
mSIZET
mTIME
mSTRING
mDATA
mID
mEVPID
mMSGID
mSOCKADDR
mMAILADDR
mENVELOPE
)
var mprocTypeName = map[uint8]string{
mINT: "M_INT",
mUINT32: "M_UINT32",
mSIZET: "M_SIZET",
mTIME: "M_TIME",
mSTRING: "M_STRING",
mDATA: "M_DATA",
mID: "M_ID",
mEVPID: "M_EVPID",
mMSGID: "M_MSGID",
mSOCKADDR: "M_SOCKADDR",
mMAILADDR: "M_MAILADDR",
mENVELOPE: "M_ENVELOPE",
}
func mprocType(t uint8) string {
if s, ok := mprocTypeName[t]; ok {
return s
}
return fmt.Sprintf("UNKNOWN %d", t)
}
type mprocTypeErr struct {
want, got uint8
}
func (err mprocTypeErr) Error() string {
return fmt.Sprintf("mproc: expected type %s, got %s",
mprocType(err.want), mprocType(err.got))
}