wavelength 1.0.0
Loading...
Searching...
No Matches
Packet Class Referenceabstract

Abstract base of a message that travels between consoles. More...

#include <packet.h>

Inheritance diagram for Packet:
Collaboration diagram for Packet:

Public Types

enum  RouteFlag { kRouteTransport = 1 , kRouteLaunchpad = 2 }
 Bits of Route(). More...

Public Member Functions

void PrintExtra (PrnStream &stream) const override
 Write the sender and the receiver that are set, as from: and to:.
virtual int Route ()=0
 Report the receivers a received packet goes to.
unsigned char GetFlags () const
int GetReceiver () const
int GetSender () const
void SetSender (int nSender)
Public Member Functions inherited from Message
virtual ~Message ()
 Vtable slot 1.
virtual Message * Clone ()=0
 Produce a heap copy of this message.
virtual int Type ()=0
 Report this message's registered identity.
virtual const char * GetName () const =0
 Report this message's class name.
virtual void saveGuts (BinStream &stream) const
 Write this message's payload to a stream.
virtual void restoreGuts (BinStream &stream)
 Read this message's payload from a stream.
virtual ~Message ()
virtual void Unused1 ()
 Not called by the control.
virtual int Type ()=0

Static Public Attributes

static constexpr int kUnset = -2
 Value of mSender and mReceiver that marks the member as unset.
static constexpr int kAllPeers = -1
 Value of mReceiver that addresses every peer.
static constexpr unsigned char kFlagOrdered = 1
 Bit of mFlags that LaunchpadRT::Send() turns into the second delivery bit of the session library.
static constexpr unsigned char kFlagGuaranteed = 2
 Bit of mFlags that NetTransport::Send() turns into its guaranteed delivery bit.

Protected Member Functions

 Packet (unsigned char nFlags, int nReceiver)
 Construct a packet from an unset sender.

Additional Inherited Members

Static Public Member Functions inherited from Message
static Message * NewMessage (int nType)
 Produce a message of the identified class through the factory list.

Detailed Description

Abstract base of a message that travels between consoles.

The RTTI records Message as the one base. ExternalPacket and InternalPacket derive from it. Its vtable at 0x003d5d70 leaves Clone(), Type(), GetName(), and Route() pure. Every concrete packet's allocation stores the three members below, and the network receive routine at 0x00256440 writes the sender after its cast to this class.

Member Enumeration Documentation

◆ RouteFlag

Bits of Route().

Enumerator
kRouteTransport 

The packet goes to the sink of TheNetTransport.

kRouteLaunchpad 

The packet goes to the online session itself.

Constructor & Destructor Documentation

◆ Packet()

Packet::Packet ( unsigned char nFlags,
int nReceiver )
inlineprotected

Construct a packet from an unset sender.

Inline. Every packet allocation expands it.

Parameters
nFlagsThe delivery flags.
nReceiverThe peer the packet is for, kAllPeers, or kUnset.

Member Function Documentation

◆ PrintExtra()

void Packet::PrintExtra ( PrnStream & stream) const
overridevirtual

Write the sender and the receiver that are set, as from: and to:.

Parameters
streamThe stream to write to.
Ghidra address:
NTSC-U/C: 0x00269200
Ghidra address:
PAL: 0x00272e08

Reimplemented from Message.

Reimplemented in PlayerUpdatePacket, RemixerUpdatePacket, ShareRemixPkt, StartGamePkt, TimeRequestPkt, TimeResponsePkt, UpdateRanksPkt, and WelcomePkt.

◆ Route()

virtual int Packet::Route ( )
pure virtual

Report the receivers a received packet goes to.

The receive routine passes the packet to every receiver whose RouteFlag the result sets. The name is inferred.

Returns
A combination of RouteFlag.

Implemented in ExternalPacket, and InternalPacket.

◆ GetFlags()

unsigned char Packet::GetFlags ( ) const
inline
Returns
Delivery flags NetTransport::Send() translates.

◆ GetReceiver()

int Packet::GetReceiver ( ) const
inline
Returns
The peer the packet is for, kAllPeers, or kUnset.

◆ GetSender()

int Packet::GetSender ( ) const
inline
Returns
The peer that sent the packet, or kUnset.

◆ SetSender()

void Packet::SetSender ( int nSender)
inline
Parameters
nSenderThe peer that sent the packet, or kUnset.

Member Data Documentation

◆ kUnset

int Packet::kUnset = -2
staticconstexpr

Value of mSender and mReceiver that marks the member as unset.

◆ kAllPeers

int Packet::kAllPeers = -1
staticconstexpr

Value of mReceiver that addresses every peer.

◆ kFlagOrdered

unsigned char Packet::kFlagOrdered = 1
staticconstexpr

Bit of mFlags that LaunchpadRT::Send() turns into the second delivery bit of the session library.

The name is inferred.

◆ kFlagGuaranteed

unsigned char Packet::kFlagGuaranteed = 2
staticconstexpr

Bit of mFlags that NetTransport::Send() turns into its guaranteed delivery bit.


The documentation for this class was generated from the following file: