aboutsummaryrefslogtreecommitdiffstats
path: root/demo/qwd/set.go
diff options
context:
space:
mode:
Diffstat (limited to 'demo/qwd/set.go')
-rw-r--r--demo/qwd/set.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/demo/qwd/set.go b/demo/qwd/set.go
new file mode 100644
index 0000000..d7cc48d
--- /dev/null
+++ b/demo/qwd/set.go
@@ -0,0 +1,35 @@
+package qwd
+
+import (
+ "github.com/osm/quake/common/buffer"
+ "github.com/osm/quake/common/context"
+)
+
+type Set struct {
+ SeqOut uint32
+ SeqIn uint32
+}
+
+func (cmd *Set) Bytes() []byte {
+ buf := buffer.New()
+
+ buf.PutUint32(cmd.SeqOut)
+ buf.PutUint32(cmd.SeqIn)
+
+ return buf.Bytes()
+}
+
+func parseSet(ctx *context.Context, buf *buffer.Buffer) (*Set, error) {
+ var err error
+ var cmd Set
+
+ if cmd.SeqOut, err = buf.GetUint32(); err != nil {
+ return nil, err
+ }
+
+ if cmd.SeqIn, err = buf.GetUint32(); err != nil {
+ return nil, err
+ }
+
+ return &cmd, nil
+}