2024-06-20 03:08:52 +00:00
|
|
|
package messages7
|
|
|
|
|
|
|
|
import (
|
|
|
|
"slices"
|
|
|
|
|
2024-06-22 05:59:27 +00:00
|
|
|
"github.com/teeworlds-go/go-teeworlds-protocol/chunk7"
|
|
|
|
"github.com/teeworlds-go/go-teeworlds-protocol/network7"
|
|
|
|
"github.com/teeworlds-go/go-teeworlds-protocol/packer"
|
2024-06-20 03:08:52 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type CtrlConnect struct {
|
|
|
|
Token [4]byte
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *CtrlConnect) MsgId() int {
|
2024-06-20 03:08:52 +00:00
|
|
|
return network7.MsgCtrlConnect
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *CtrlConnect) MsgType() network7.MsgType {
|
2024-06-20 03:08:52 +00:00
|
|
|
return network7.TypeControl
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *CtrlConnect) System() bool {
|
2024-06-20 03:08:52 +00:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *CtrlConnect) Vital() bool {
|
2024-06-20 03:08:52 +00:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *CtrlConnect) Pack() []byte {
|
2024-06-20 03:08:52 +00:00
|
|
|
return slices.Concat(
|
|
|
|
[]byte{network7.MsgCtrlConnect},
|
|
|
|
msg.Token[:],
|
|
|
|
[]byte{512: 0},
|
|
|
|
)
|
|
|
|
}
|
2024-06-20 05:07:10 +00:00
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *CtrlConnect) Unpack(u *packer.Unpacker) error {
|
2024-06-22 04:25:29 +00:00
|
|
|
msg.Token = [4]byte(u.Rest())
|
2024-06-23 19:18:54 +00:00
|
|
|
return nil
|
2024-06-20 05:07:10 +00:00
|
|
|
}
|
2024-06-21 01:38:59 +00:00
|
|
|
|
|
|
|
func (msg *CtrlConnect) Header() *chunk7.ChunkHeader {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (msg *CtrlConnect) SetHeader(header *chunk7.ChunkHeader) {
|
|
|
|
}
|