MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / NewParam

Function NewParam

pkg/event/param_windows.go:54–71  ·  view source on GitHub ↗

NewParam creates a new event parameter. Since the parameter type is already categorized, we can coerce the value to the appropriate representation (e.g. hex, IP address)

(name string, typ params.Type, value params.Value, options ...ParamOption)

Source from the content-addressed store, hash-verified

52// NewParam creates a new event parameter. Since the parameter type is already categorized,
53// we can coerce the value to the appropriate representation (e.g. hex, IP address)
54func NewParam(name string, typ params.Type, value params.Value, options ...ParamOption) *Param {
55 var opts paramOpts
56 for _, opt := range options {
57 opt(&opts)
58 }
59 var v params.Value
60 switch typ {
61 case params.IPv4:
62 v = ip.ToIPv4(value.(uint32))
63 case params.IPv6:
64 v = ip.ToIPv6(value.([]byte))
65 case params.Port:
66 v = windows.Ntohs(value.(uint16))
67 default:
68 v = value
69 }
70 return &Param{Name: name, Type: typ, Value: v, Flags: opts.flags, Enum: opts.enum}
71}
72
73var devMapper = fs.NewDevMapper()
74

Callers 1

AppendMethod · 0.85

Calls 2

ToIPv4Function · 0.92
ToIPv6Function · 0.92

Tested by

no test coverage detected