protocol

package
v0.0.0-...-62eada6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLC_BaselineAck

type CLC_BaselineAck struct {
	Tick     uint32
	Baseline bool // alternates every time the baseline changes
}

func (*CLC_BaselineAck) PacketType

func (p *CLC_BaselineAck) PacketType() int

func (*CLC_BaselineAck) ReadFrom

func (p *CLC_BaselineAck) ReadFrom(r *bits.Reader) error

type CLC_ClientInfo

type CLC_ClientInfo struct {
	ServerCount   uint32
	SendTableCRC  uint32
	IsHLTV        bool
	AccountID     uint32
	Name          string
	CustomFileCRC [4]*uint32
}

func (*CLC_ClientInfo) PacketType

func (p *CLC_ClientInfo) PacketType() int

func (*CLC_ClientInfo) ReadFrom

func (p *CLC_ClientInfo) ReadFrom(r *bits.Reader) error

type CLC_CmdKeyValues

type CLC_CmdKeyValues struct {
	Data kvpacker.Data // 32-bit length
}

func (*CLC_CmdKeyValues) PacketType

func (p *CLC_CmdKeyValues) PacketType() int

func (*CLC_CmdKeyValues) ReadFrom

func (p *CLC_CmdKeyValues) ReadFrom(r *bits.Reader) error

type CLC_FileCRCCheck

type CLC_FileCRCCheck struct {
	// reserved bit (0)
	// 2 bits (0 or 1+index into commonPaths)
	// if 0, string
	Path string
	// 3 bits (0 or 1+index into commonFilenamePrefixes)
	// if non-zero, implied slash
	// string
	FileName string
	CRC32    uint32
}

func (*CLC_FileCRCCheck) PacketType

func (p *CLC_FileCRCCheck) PacketType() int

func (*CLC_FileCRCCheck) ReadFrom

func (p *CLC_FileCRCCheck) ReadFrom(r *bits.Reader) error

type CLC_ListenEvents

type CLC_ListenEvents struct {
	Flags [(1 << 9) / 32]uint32
}

func (*CLC_ListenEvents) PacketType

func (p *CLC_ListenEvents) PacketType() int

func (*CLC_ListenEvents) ReadFrom

func (p *CLC_ListenEvents) ReadFrom(r *bits.Reader) error

type CLC_LoadingProgress

type CLC_LoadingProgress struct {
	Progress uint8
}

func (*CLC_LoadingProgress) PacketType

func (p *CLC_LoadingProgress) PacketType() int

func (*CLC_LoadingProgress) ReadFrom

func (p *CLC_LoadingProgress) ReadFrom(r *bits.Reader) error

type CLC_Move

type CLC_Move struct {
	NewCommands    uint8 // 4 bits
	BackupCommands uint8 // 3 bits
	BitLength      uint16
	UserCmdData    []byte
}

func (*CLC_Move) PacketType

func (p *CLC_Move) PacketType() int

func (*CLC_Move) ReadFrom

func (p *CLC_Move) ReadFrom(r *bits.Reader) error

type CLC_RespondCvarValue

type CLC_RespondCvarValue struct {
	Cookie     int32
	StatusCode int8 // 4 bits
	CVar       KeyValuePair
}

func (*CLC_RespondCvarValue) PacketType

func (p *CLC_RespondCvarValue) PacketType() int

func (*CLC_RespondCvarValue) ReadFrom

func (p *CLC_RespondCvarValue) ReadFrom(r *bits.Reader) error

type CLC_SplitPlayerConnect

type CLC_SplitPlayerConnect struct {
	ConVars NET_SetConVar
}

func (*CLC_SplitPlayerConnect) PacketType

func (p *CLC_SplitPlayerConnect) PacketType() int

func (*CLC_SplitPlayerConnect) ReadFrom

func (p *CLC_SplitPlayerConnect) ReadFrom(r *bits.Reader) error

type CLC_VoiceData

type CLC_VoiceData struct {
	BitLength uint16
	Data      []byte
}

func (*CLC_VoiceData) PacketType

func (p *CLC_VoiceData) PacketType() int

func (*CLC_VoiceData) ReadFrom

func (p *CLC_VoiceData) ReadFrom(r *bits.Reader) error

type KeyValuePair

type KeyValuePair struct {
	Key, Value string
}

type NET_Disconnect

type NET_Disconnect struct {
	Reason string
}

func (*NET_Disconnect) PacketType

func (p *NET_Disconnect) PacketType() int

func (*NET_Disconnect) ReadFrom

func (p *NET_Disconnect) ReadFrom(r *bits.Reader) error

type NET_File

type NET_File struct {
	TransferID uint32
	Name       string
	IsRequest  bool // if it's not a request, this is a rejection
}

func (*NET_File) PacketType

func (p *NET_File) PacketType() int

func (*NET_File) ReadFrom

func (p *NET_File) ReadFrom(r *bits.Reader) error

type NET_NOP

type NET_NOP struct {
}

func (*NET_NOP) PacketType

func (p *NET_NOP) PacketType() int

func (*NET_NOP) ReadFrom

func (p *NET_NOP) ReadFrom(r *bits.Reader) error

type NET_SetConVar

type NET_SetConVar struct {
	// uint8 count followed by strings
	ConVars []KeyValuePair
}

func (*NET_SetConVar) PacketType

func (p *NET_SetConVar) PacketType() int

func (*NET_SetConVar) ReadFrom

func (p *NET_SetConVar) ReadFrom(r *bits.Reader) error

type NET_SignonState

type NET_SignonState struct {
	State      SignonState
	SpawnCount uint32
}

func (*NET_SignonState) PacketType

func (p *NET_SignonState) PacketType() int

func (*NET_SignonState) ReadFrom

func (p *NET_SignonState) ReadFrom(r *bits.Reader) error

type NET_SplitScreenUser

type NET_SplitScreenUser struct {
	Slot uint8 // 2 bits
}

func (*NET_SplitScreenUser) PacketType

func (p *NET_SplitScreenUser) PacketType() int

func (*NET_SplitScreenUser) ReadFrom

func (p *NET_SplitScreenUser) ReadFrom(r *bits.Reader) error

type NET_StringCmd

type NET_StringCmd struct {
	Command string
}

func (*NET_StringCmd) PacketType

func (p *NET_StringCmd) PacketType() int

func (*NET_StringCmd) ReadFrom

func (p *NET_StringCmd) ReadFrom(r *bits.Reader) error

type NET_Tick

type NET_Tick struct {
	TickNumber int32
	// 0.5 fixed point seconds (that is, max value is 655.35 milliseconds)
	FrameTime       uint16
	FrameTimeStdDev uint16
}

func (*NET_Tick) PacketType

func (p *NET_Tick) PacketType() int

func (*NET_Tick) ReadFrom

func (p *NET_Tick) ReadFrom(r *bits.Reader) error

type Packet

type Packet interface {
	PacketType() int

	ReadFrom(r *bits.Reader) error
}

func NewPacket

func NewPacket(id int, client bool) Packet

func ReadPacket

func ReadPacket(r *bits.Reader, client bool) (Packet, error)

type SVC_BSPDecal

type SVC_BSPDecal struct {
	Position [3]float32 // BitVec3Coord

	DecalTextureIndex uint16 // 9 bits

	// if these are both 0, write a 0 bit and skip them.
	// otherwise, write a 1 bit and then the next two fields.
	EntityIndex uint16 // 11 bits
	ModelIndex  uint16 // 11 bits

	LowPriority bool
}

func (*SVC_BSPDecal) PacketType

func (p *SVC_BSPDecal) PacketType() int

func (*SVC_BSPDecal) ReadFrom

func (p *SVC_BSPDecal) ReadFrom(r *bits.Reader) error

type SVC_ClassInfo

type SVC_ClassInfo struct {
	NumClasses     uint16
	CreateOnClient bool
	Info           []ServerClassInfo
}

func (*SVC_ClassInfo) PacketType

func (p *SVC_ClassInfo) PacketType() int

func (*SVC_ClassInfo) ReadFrom

func (p *SVC_ClassInfo) ReadFrom(r *bits.Reader) error

type SVC_CmdKeyValues

type SVC_CmdKeyValues struct {
	Data kvpacker.Data // 32-bit length
}

func (*SVC_CmdKeyValues) PacketType

func (p *SVC_CmdKeyValues) PacketType() int

func (*SVC_CmdKeyValues) ReadFrom

func (p *SVC_CmdKeyValues) ReadFrom(r *bits.Reader) error

type SVC_CreateStringTable

type SVC_CreateStringTable struct {
	TableName  string
	MaxEntries uint16
	// number of bits is smallest number of bits needed to hold MaxEntries+1
	NumEntries        uint16
	BitLength         uint32 // 20 bits
	UserDataFixedSize bool
	UserDataSizeBytes uint16 // 12 bits (only if UserDataFixedSize)
	UserDataSizeBits  uint16 // 4 bits (only if UserDataFixedSize)
	DataCompressed    bool
	IsFilenames       bool
	Data              []byte
}

func (*SVC_CreateStringTable) PacketType

func (p *SVC_CreateStringTable) PacketType() int

func (*SVC_CreateStringTable) ReadFrom

func (p *SVC_CreateStringTable) ReadFrom(r *bits.Reader) error

type SVC_CrosshairAngle

type SVC_CrosshairAngle struct {
	// fixed point angle (0 to 65536 -> 0 to 360 degrees)
	Pitch, Yaw, Roll uint16
}

func (*SVC_CrosshairAngle) PacketType

func (p *SVC_CrosshairAngle) PacketType() int

func (*SVC_CrosshairAngle) ReadFrom

func (p *SVC_CrosshairAngle) ReadFrom(r *bits.Reader) error

type SVC_EntityMessage

type SVC_EntityMessage struct {
	EntityIndex uint16 // 11 bits
	ClassID     uint16 // 9 bits
	BitLength   uint16 // 11 bits
	Data        []byte
}

func (*SVC_EntityMessage) PacketType

func (p *SVC_EntityMessage) PacketType() int

func (*SVC_EntityMessage) ReadFrom

func (p *SVC_EntityMessage) ReadFrom(r *bits.Reader) error

type SVC_FixAngle

type SVC_FixAngle struct {
	Relative bool
	// fixed point angle (0 to 65536 -> 0 to 360 degrees)
	Pitch, Yaw, Roll uint16
}

func (*SVC_FixAngle) PacketType

func (p *SVC_FixAngle) PacketType() int

func (*SVC_FixAngle) ReadFrom

func (p *SVC_FixAngle) ReadFrom(r *bits.Reader) error

type SVC_GameEvent

type SVC_GameEvent struct {
	BitLength uint16 // 13 bits
	Data      []byte
}

func (*SVC_GameEvent) PacketType

func (p *SVC_GameEvent) PacketType() int

func (*SVC_GameEvent) ReadFrom

func (p *SVC_GameEvent) ReadFrom(r *bits.Reader) error

type SVC_GameEventList

type SVC_GameEventList struct {
	NumEvents uint16 // 9 bits
	BitLength uint32 // 20 bits
	Data      []byte
}

func (*SVC_GameEventList) PacketType

func (p *SVC_GameEventList) PacketType() int

func (*SVC_GameEventList) ReadFrom

func (p *SVC_GameEventList) ReadFrom(r *bits.Reader) error

type SVC_GetCvarValue

type SVC_GetCvarValue struct {
	Cookie int32
	Name   string
}

func (*SVC_GetCvarValue) PacketType

func (p *SVC_GetCvarValue) PacketType() int

func (*SVC_GetCvarValue) ReadFrom

func (p *SVC_GetCvarValue) ReadFrom(r *bits.Reader) error

type SVC_Menu

type SVC_Menu struct {
	Type uint16
	Data []byte // 16-bit length but can only be up to 4096 bytes
}

func (*SVC_Menu) PacketType

func (p *SVC_Menu) PacketType() int

func (*SVC_Menu) ReadFrom

func (p *SVC_Menu) ReadFrom(r *bits.Reader) error

type SVC_PacketEntities

type SVC_PacketEntities struct {
	MaxEntries     uint16 // 11 bits
	DeltaFrom      int32  // if -1, written as a single 0 bit. otherwise, prefixed with a 1 bit.
	Baseline       bool
	UpdatedEntries uint16 // 11 bits
	BitLength      uint32 // 20 bits
	UpdateBaseline bool
	Data           []byte
}

func (*SVC_PacketEntities) PacketType

func (p *SVC_PacketEntities) PacketType() int

func (*SVC_PacketEntities) ReadFrom

func (p *SVC_PacketEntities) ReadFrom(r *bits.Reader) error

type SVC_Prefetch

type SVC_Prefetch struct {
	SoundIndex uint16 // 13 bits
}

func (*SVC_Prefetch) PacketType

func (p *SVC_Prefetch) PacketType() int

func (*SVC_Prefetch) ReadFrom

func (p *SVC_Prefetch) ReadFrom(r *bits.Reader) error

type SVC_Print

type SVC_Print struct {
	Text string
}

func (*SVC_Print) PacketType

func (p *SVC_Print) PacketType() int

func (*SVC_Print) ReadFrom

func (p *SVC_Print) ReadFrom(r *bits.Reader) error

type SVC_SendTable

type SVC_SendTable struct {
	NeedsDecoder bool
	BitLength    uint16
	Data         []byte
}

func (*SVC_SendTable) PacketType

func (p *SVC_SendTable) PacketType() int

func (*SVC_SendTable) ReadFrom

func (p *SVC_SendTable) ReadFrom(r *bits.Reader) error

type SVC_ServerInfo

type SVC_ServerInfo struct {
	Protocol       uint16
	ServerCount    uint32
	IsHLTV         bool
	IsReplay       bool
	IsDedicated    bool
	ClientDLLCRC   uint32
	StringTableCRC uint32
	MaxClasses     uint16
	MapCRC         uint32
	PlayerSlot     uint8
	MaxClients     uint8
	TickInterval   float32
	OS             byte
	GameDir        string
	MapName        string
	SkyName        string
	HostName       string
}

func (*SVC_ServerInfo) PacketType

func (p *SVC_ServerInfo) PacketType() int

func (*SVC_ServerInfo) ReadFrom

func (p *SVC_ServerInfo) ReadFrom(r *bits.Reader) error

type SVC_SetPause

type SVC_SetPause struct {
	Paused bool
}

func (*SVC_SetPause) PacketType

func (p *SVC_SetPause) PacketType() int

func (*SVC_SetPause) ReadFrom

func (p *SVC_SetPause) ReadFrom(r *bits.Reader) error

type SVC_SetView

type SVC_SetView struct {
	EntityIndex uint16 // 11 bits
}

func (*SVC_SetView) PacketType

func (p *SVC_SetView) PacketType() int

func (*SVC_SetView) ReadFrom

func (p *SVC_SetView) ReadFrom(r *bits.Reader) error

type SVC_Sounds

type SVC_Sounds struct {
	Reliable  bool
	NumSounds uint8  // if Reliable, there is 1 sound
	BitLength uint16 // if Reliable, sent as 8 bits
	Data      []byte
}

func (*SVC_Sounds) PacketType

func (p *SVC_Sounds) PacketType() int

func (*SVC_Sounds) ReadFrom

func (p *SVC_Sounds) ReadFrom(r *bits.Reader) error

type SVC_SplitScreen

type SVC_SplitScreen struct {
	Remove      bool
	Slot        uint8  // 2 bits
	EntityIndex uint16 // 11 bits (name is a guess based on size; haven't verified yet)
}

func (*SVC_SplitScreen) PacketType

func (p *SVC_SplitScreen) PacketType() int

func (*SVC_SplitScreen) ReadFrom

func (p *SVC_SplitScreen) ReadFrom(r *bits.Reader) error

type SVC_TempEntities

type SVC_TempEntities struct {
	NumEntries uint8
	BitLength  uint32 // 17 bits
	Data       []byte
}

func (*SVC_TempEntities) PacketType

func (p *SVC_TempEntities) PacketType() int

func (*SVC_TempEntities) ReadFrom

func (p *SVC_TempEntities) ReadFrom(r *bits.Reader) error

type SVC_UpdateStringTable

type SVC_UpdateStringTable struct {
	TableID        uint8  // 5 bits
	ChangedEntries uint16 // if 1, encoded as a single 0 bit, otherwise encoded as a 1 bit followed by a 16 bit integer
	BitLength      uint32 // 20 bits
	Data           []byte
}

func (*SVC_UpdateStringTable) PacketType

func (p *SVC_UpdateStringTable) PacketType() int

func (*SVC_UpdateStringTable) ReadFrom

func (p *SVC_UpdateStringTable) ReadFrom(r *bits.Reader) error

type SVC_UserMessage

type SVC_UserMessage struct {
	MessageType uint8
	BitLength   uint16 // 12 bits
	Data        []byte
}

func (*SVC_UserMessage) PacketType

func (p *SVC_UserMessage) PacketType() int

func (*SVC_UserMessage) ReadFrom

func (p *SVC_UserMessage) ReadFrom(r *bits.Reader) error

type SVC_VoiceData

type SVC_VoiceData struct {
	FromClient uint8
	Proximity  bool // 8 bits(!)
	BitLength  uint16
	Data       []byte
}

func (*SVC_VoiceData) PacketType

func (p *SVC_VoiceData) PacketType() int

func (*SVC_VoiceData) ReadFrom

func (p *SVC_VoiceData) ReadFrom(r *bits.Reader) error

type SVC_VoiceInit

type SVC_VoiceInit struct {
	Codec   string
	Quality uint8
}

func (*SVC_VoiceInit) PacketType

func (p *SVC_VoiceInit) PacketType() int

func (*SVC_VoiceInit) ReadFrom

func (p *SVC_VoiceInit) ReadFrom(r *bits.Reader) error

type SendProp

type SendProp struct {
	Name          string
	ExcludeDTName string
	Type          SendPropType
	Priority      uint8
	Flags         SendPropFlags
	NumElements   uint16
	LowValue      float32
	HighValue     float32
	Bits          uint8
}

type SendPropFlags

type SendPropFlags uint32
const (
	SPropUnsigned              SendPropFlags = 1 << 0
	SPropCoord                 SendPropFlags = 1 << 1
	SPropNoScale               SendPropFlags = 1 << 2
	SPropRoundDown             SendPropFlags = 1 << 3
	SPropRoundUp               SendPropFlags = 1 << 4
	SPropNormal                SendPropFlags = 1 << 5
	SPropExclude               SendPropFlags = 1 << 6
	SPropXYZE                  SendPropFlags = 1 << 7
	SPropInsideArray           SendPropFlags = 1 << 8
	SPropProxyAlwaysYes        SendPropFlags = 1 << 9
	SPropIsAVectorElem         SendPropFlags = 1 << 10
	SPropCollapsible           SendPropFlags = 1 << 11
	SPropCoordMP               SendPropFlags = 1 << 12
	SPropCoordMPLowPrecision   SendPropFlags = 1 << 13
	SPropCoordMPIntegral       SendPropFlags = 1 << 14
	SPropCellCoord             SendPropFlags = 1 << 15
	SPropCellCoordLowPrecision SendPropFlags = 1 << 16
	SPropCellCoordIntegral     SendPropFlags = 1 << 17
	SPropChangesOften          SendPropFlags = 1 << 18
)

type SendPropType

type SendPropType uint8
const (
	SendPropInt       SendPropType = 0
	SendPropFloat     SendPropType = 1
	SendPropVector    SendPropType = 2
	SendPropVectorXY  SendPropType = 3
	SendPropString    SendPropType = 4
	SendPropArray     SendPropType = 5
	SendPropDataTable SendPropType = 6
	SendPropInt64     SendPropType = 7
	NumSendPropTypes  SendPropType = 8
)

func (SendPropType) String

func (i SendPropType) String() string

type SendTable

type SendTable struct {
	NeedsDecoder bool
	Name         string
	Props        []SendProp
}

func (*SendTable) ReadFrom

func (t *SendTable) ReadFrom(r *bits.Reader) error

type SendTables

type SendTables []SendTable

func (*SendTables) ReadFrom

func (t *SendTables) ReadFrom(r *bits.Reader) error

type ServerClassInfo

type ServerClassInfo struct {
	ClassID       uint32
	ClassName     string
	DataTableName string
}

type ServerClasses

type ServerClasses []ServerClassInfo

func (*ServerClasses) ReadFrom

func (c *ServerClasses) ReadFrom(r *bits.Reader) error

type SignonState

type SignonState uint8
const (
	SignonStateNone        SignonState = 0
	SignonStateChallenge   SignonState = 1
	SignonStateConnected   SignonState = 2
	SignonStateNew         SignonState = 3
	SignonStatePreSpawn    SignonState = 4
	SignonStateSpawn       SignonState = 5
	SignonStateFull        SignonState = 6
	SignonStateChangeLevel SignonState = 7
)

func (SignonState) String

func (i SignonState) String() string

type StringTable

type StringTable struct {
	Name              string
	Strings           []StringTableEntry
	Client            []StringTableEntry
	MaxStrings        int
	EntryBits         int
	IsFilenames       bool
	UserDataFixedSize bool
	UserDataSize      int
	UserDataSizeBits  int
}

func (*StringTable) ReadFrom

func (t *StringTable) ReadFrom(r *bits.Reader) error

func (*StringTable) ReadUpdate

func (t *StringTable) ReadUpdate(r *bits.Reader, numEntries int) error

type StringTableEntry

type StringTableEntry struct {
	String   string
	UserData []byte
}

type StringTables

type StringTables []StringTable

func (*StringTables) CreateFromPacket

func (t *StringTables) CreateFromPacket(p *SVC_CreateStringTable) error

func (StringTables) Find

func (t StringTables) Find(name string) *StringTable

func (StringTables) ReadFrom

func (t StringTables) ReadFrom(r *bits.Reader) error

func (StringTables) UpdateFromPacket

func (t StringTables) UpdateFromPacket(p *SVC_UpdateStringTable) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL