/
active.go
60 lines (47 loc) · 1.19 KB
/
active.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
package pkg
import (
"bytes"
"fmt"
)
const (
SmgpActiveTestReqPktLen uint32 = 12 //12d, 0xc
SmgpActiveTestRespPktLen uint32 = 12 //12d, 0xc
)
type SmgpActiveTestReqPkt struct {
// used in session
SequenceID uint32
}
type SmgpActiveTestRespPkt struct {
// used in session
SequenceID uint32
}
func (p *SmgpActiveTestReqPkt) Pack(seqId uint32) ([]byte, error) {
var w = newPkgWriter(SmgpActiveTestReqPktLen)
// header
w.WriteHeader(SmgpActiveTestReqPktLen, seqId, SMGP_ACTIVE_TEST)
p.SequenceID = seqId
return w.Bytes()
}
func (p *SmgpActiveTestReqPkt) Unpack(data []byte) error {
return nil
}
func (p *SmgpActiveTestReqPkt) String() string {
var b bytes.Buffer
fmt.Fprintln(&b, "--- SMGP ActiveTest Req ---")
return b.String()
}
func (p *SmgpActiveTestRespPkt) Pack(seqId uint32) ([]byte, error) {
var w = newPkgWriter(SmgpActiveTestRespPktLen)
// header
w.WriteHeader(SmgpActiveTestRespPktLen, seqId, SMGP_ACTIVE_TEST_RESP)
p.SequenceID = seqId
return w.Bytes()
}
func (p *SmgpActiveTestRespPkt) Unpack(data []byte) error {
return nil
}
func (p *SmgpActiveTestRespPkt) String() string {
var b bytes.Buffer
fmt.Fprintln(&b, "--- SMGP ActiveTest Resp ---")
return b.String()
}