Skip to content

Handle packets with slices in the sniffer #63

Description

@dcrodman

Some packet structures have variable-length data segments, typically represented in Archon as []byte. In most (all?) cases, these are used for packets that originate on the server side and thus we know how long the variable-length data is going to be, so we can allocate the slice accordingly.

When the packet sniffer receives a packet, it'll create a new packet of that type and copy the data into it. However for packets with these dynamically allocated slices, the data will just end up as <nil> since it can't figure out how long the data should be. Some heuristics need to be added here to determine how much data needs to be allocated and then pass that into reflect.MakeSlice() for any fields of the reflect.Slice kind.

Example packet (captured with the sniffer's --interpet flag):

[CHARACTER] 0x2DC (LoginGuildcardChunkType) | server->client (26640 bytes)
(packets.GuildcardChunk) {
	Header: (packets.BBHeader) {
		Size: (uint16) 26640,
		Type: (uint16) 732,
		Flags: (uint32) 0
	},
	Unknown: (uint32) 0,
	Chunk: (uint32) 0,
	Data: ([]uint8) <nil>
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions