zip

package
v0.0.0-...-545087f Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ZIP packets
	FunctionQuery           = 1
	FunctionReply           = 2
	FunctionGetNetInfo      = 5
	FunctionGetNetInfoReply = 6
	FunctionNotify          = 7
	FunctionExtendedReply   = 8

	// ATP packets
	FunctionGetMyZone     = 7
	FunctionGetZoneList   = 8
	FunctionGetLocalZones = 9
)

Variables

This section is empty.

Functions

func UnmarshalPacket

func UnmarshalPacket(data []byte) (any, error)

Non-ATP packets only

Types

type Function

type Function uint8

type GetNetInfoPacket

type GetNetInfoPacket struct {
	// Destination socket = 6
	// DDP type = 6
	// ---
	// ZIP command = 5
	// Flags = 0 (reserved)
	// Four more bytes of 0 (reserved)
	// Zone name length (1 byte)
	ZoneName string
}

func UnmarshalGetNetInfoPacket

func UnmarshalGetNetInfoPacket(data []byte) (*GetNetInfoPacket, error)

type GetNetInfoReplyPacket

type GetNetInfoReplyPacket struct {
	// Source socket = 6
	// DDP type = 6
	// ---
	// ZIP command = 6
	ZoneInvalid  bool // 0x80 - "set if the zone name in the request is invalid for the network from which the request was sent"
	UseBroadcast bool // 0x40 - "set for data links that do not support multicast"
	OnlyOneZone  bool // 0x20 - "set if the network's zone list contains only one zone name"
	// Remainder of flags reserved
	NetStart ddp.Network
	NetEnd   ddp.Network
	// Zone name length (1 byte)
	ZoneName string
	// Multicast address length (1 byte)
	MulticastAddr ethernet.Addr
	// Only if ZoneInvalid flag is set:
	// Default zone length (1 byte)
	DefaultZoneName string
}

func (*GetNetInfoReplyPacket) Marshal

func (p *GetNetInfoReplyPacket) Marshal() ([]byte, error)

type GetZonesPacket

type GetZonesPacket struct {
	// "These requests always ask for a single response packet."
	// TReq   = 0b01000000
	// Bitmap = 0b00000001
	TID uint16
	// --- ATP user bytes
	Function Function // 7, 8, or 9
	// Pad uint8 = 0
	StartIndex uint16 // always 0 for
}

func UnmarshalTReq

func UnmarshalTReq(treq *atp.TReq) (*GetZonesPacket, error)

func (*GetZonesPacket) MarshalTReq

func (p *GetZonesPacket) MarshalTReq() (*atp.TReq, error)

type GetZonesReplyPacket

type GetZonesReplyPacket struct {
	// TResp    = 0b10000000
	// Sequence = 0
	TID uint16
	// --- ATP user bytes
	LastFlag bool // not used for GetMyZone
	// Pad uint8 = 0
	// ZoneCount uint16
	// --- ATP data bytes
	Zones []string // length-prefixed
}

func UnmarshalTResp

func UnmarshalTResp(tresp *atp.TResp) (*GetZonesReplyPacket, error)

func (*GetZonesReplyPacket) MarshalTResp

func (p *GetZonesReplyPacket) MarshalTResp() (*atp.TResp, error)

type QueryPacket

type QueryPacket struct {
	// Function = 1
	// NetworkCount uint8
	Networks []ddp.Network
}

func UnmarshalQueryPacket

func UnmarshalQueryPacket(data []byte) (*QueryPacket, error)

func (*QueryPacket) Marshal

func (p *QueryPacket) Marshal() ([]byte, error)

type ReplyPacket

type ReplyPacket struct {
	// Function = 2 or 8
	Extended     bool
	NetworkCount uint8
	// "Replies contain the number of zones lists indicated in the Reply header"
	// and
	// "Extended Replies can contain only one zones list. ...
	// (the network numbers in each pair will all be the same in an Extended
	// Reply). The network count in the header indicates, not the number of zone
	// names in the packet, but the number of zone names in the entire zones
	// list for the requested network, which may span more than one packet."
	// and
	// "Note: Extended ZIP Replies may also be used for responding to ZIP
	// queries with zones lists that all fit in one Reply packet. In this case,
	// the network count will be equal to the number of zone names in the
	// packet"
	Networks map[ddp.Network][]string
}

func UnmarshalReplyPacket

func UnmarshalReplyPacket(data []byte) (*ReplyPacket, error)

func (*ReplyPacket) Marshal

func (p *ReplyPacket) Marshal() ([]byte, error)

Jump to

Keyboard shortcuts

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