forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nfs.go
43 lines (38 loc) · 809 Bytes
/
nfs.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
package nfs
import (
"github.com/elastic/beats/libbeat/beat"
"github.com/elastic/beats/libbeat/common"
)
type nfs struct {
vers uint32
proc uint32
event beat.Event
}
func (nfs *nfs) getRequestInfo(xdr *xdr) common.MapStr {
nfsInfo := common.MapStr{}
nfsInfo["version"] = nfs.vers
switch nfs.vers {
case 3:
nfsInfo["opcode"] = nfs.getV3Opcode(int(nfs.proc))
case 4:
switch nfs.proc {
case 0:
nfsInfo["opcode"] = "NULL"
case 1:
tag := xdr.getDynamicOpaque()
nfsInfo["tag"] = string(tag)
nfsInfo["minor_version"] = xdr.getUInt()
nfsInfo["opcode"] = nfs.findV4MainOpcode(xdr)
}
}
return nfsInfo
}
func (nfs *nfs) getNFSReplyStatus(xdr *xdr) string {
switch nfs.proc {
case 0:
return nfsStatus[0]
default:
stat := int(xdr.getUInt())
return nfsStatus[stat]
}
}