forked from nielsAD/gowarcraft3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bncs.go
32 lines (29 loc) · 1017 Bytes
/
bncs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Author: Niels A.D.
// Project: gowarcraft3 (https://github.com/nielsAD/gowarcraft3)
// License: Mozilla Public License, v2.0
// Package bncs implements the old Battle.net chat protocol for Warcraft III.
// The protocol is used for multiple classic games, but this package only
// implements the small set of packets required for Warcraft III to log
// on and enter chat.
//
// Based on protocol documentation by https://bnetdocs.org/
//
// Each packet type is mapped to a struct type that implements the Packet
// interface. To deserialize from a binary stream, use DeserializePacket().
//
// This package tries to keep ammortized heap memory allocations to 0.
//
// General serialization format:
//
// (UINT8) Protocol signature (0xFF)
// (UINT8) Packet type ID
// (UINT16) Packet size
// [Packet Data]
//
package bncs
import "github.com/nielsAD/gowarcraft3/protocol"
// Packet interface.
type Packet interface {
Serialize(buf *protocol.Buffer) error
Deserialize(buf *protocol.Buffer) error
}