packet

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Packet type to handler function

View Source
var PacketTypes = map[pb.EDemoCommands]string{
	pb.EDemoCommands_DEM_Error:               "",
	pb.EDemoCommands_DEM_Stop:                "mango.CDemoStop",
	pb.EDemoCommands_DEM_FileHeader:          "mango.CDemoFileHeader",
	pb.EDemoCommands_DEM_FileInfo:            "mango.CDemoFileInfo",
	pb.EDemoCommands_DEM_SyncTick:            "mango.CDemoSyncTick",
	pb.EDemoCommands_DEM_SendTables:          "mango.CDemoSendTables",
	pb.EDemoCommands_DEM_ClassInfo:           "mango.CDemoClassInfo",
	pb.EDemoCommands_DEM_StringTables:        "mango.CDemoStringTables",
	pb.EDemoCommands_DEM_Packet:              "mango.CDemoPacket",
	pb.EDemoCommands_DEM_SignonPacket:        "mango.CDemoPacket",
	pb.EDemoCommands_DEM_ConsoleCmd:          "mango.CDemoConsoleCmd",
	pb.EDemoCommands_DEM_CustomData:          "mango.CDemoCustomData",
	pb.EDemoCommands_DEM_CustomDataCallbacks: "mango.CDemoCustomDataCallbacks",
	pb.EDemoCommands_DEM_UserCmd:             "mango.CDemoUserCmd",
	pb.EDemoCommands_DEM_FullPacket:          "mango.CDemoFullPacket",
	pb.EDemoCommands_DEM_SaveGame:            "mango.CDemoSaveGame",
	pb.EDemoCommands_DEM_SpawnGroups:         "mango.CDemoSpawnGroups",
	pb.EDemoCommands_DEM_Max:                 "",
}

Map of packet type to struct name for creating the correct proto instance

View Source
var Players = map[int]string{}
View Source
var StringTables = map[string][]*pb.CDemoStringTablesItemsT{}

Functions

func GetPacketType

func GetPacketType(command pb.EDemoCommands) (proto.Message, error)

func HandleClassinfo

func HandleClassinfo(p *Packet) error

func HandleEmbedded

func HandleEmbedded(p *Packet) error

Process a packet with embedded data

func HandleFileInfo

func HandleFileInfo(p *Packet) error

func HandleFullEmbedded

func HandleFullEmbedded(p *Packet) error

Process a packet with embedded data

func HandlePlaceHolder

func HandlePlaceHolder(p *Packet) error

Placeholder for unimplemented message types

func HandleSendTables

func HandleSendTables(p *Packet) error

func HandleStringTables

func HandleStringTables(p *Packet) error

Process a string tables packet by saving the tables and putting them into memory

Types

type Packet

type Packet struct {
	Kind         int
	Tick         int
	Size         int
	IsCompressed bool
	RawMessage   []byte
	RawEmbed     []byte
	Command      pb.EDemoCommands
	Message      proto.Message
	Embed        *embedded.EmbeddedPacket
}

func (*Packet) Parse

func (p *Packet) Parse() error

Parse the packet and process the result, dependent on the type

type PacketHandler

type PacketHandler func(*Packet) error

Jump to

Keyboard shortcuts

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