constants

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: AGPL-3.0 Imports: 0 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// PacketFlagAck is the ID for the PRUDP Ack Flag
	PacketFlagAck uint16 = 0x1

	// PacketFlagReliable is the ID for the PRUDP Reliable Flag
	PacketFlagReliable uint16 = 0x2

	// PacketFlagNeedsAck is the ID for the PRUDP NeedsAck Flag
	PacketFlagNeedsAck uint16 = 0x4

	// PacketFlagHasSize is the ID for the PRUDP HasSize Flag
	PacketFlagHasSize uint16 = 0x8

	// PacketFlagMultiAck is the ID for the PRUDP MultiAck Flag
	PacketFlagMultiAck uint16 = 0x200
)
View Source
const (
	// SynPacket is the ID for the PRUDP Syn Packet type
	SynPacket uint16 = 0x0

	// ConnectPacket is the ID for the PRUDP Connect Packet type
	ConnectPacket uint16 = 0x1

	// DataPacket is the ID for the PRUDP Data Packet type
	DataPacket uint16 = 0x2

	// DisconnectPacket is the ID for the PRUDP Disconnect Packet type
	DisconnectPacket uint16 = 0x3

	// PingPacket is the ID for the PRUDP Ping Packet type
	PingPacket uint16 = 0x4
)

Variables

This section is empty.

Functions

This section is empty.

Types

type NATFilteringProperties

type NATFilteringProperties uint8

NATFilteringProperties is an implementation of the nn::nex::NATProperties::FilteringProperties enum.

NATFilteringProperties is used to indicate the NAT filtering properties of the users router.

See https://datatracker.ietf.org/doc/html/rfc4787 for more details

const (
	// UnknownNATFiltering indicates the NAT type could not be identified
	UnknownNATFiltering NATFilteringProperties = iota

	// PIFNATFiltering indicates port-independent filtering
	PIFNATFiltering

	// PDFNATFiltering indicates port-dependent filtering
	PDFNATFiltering
)

type NATMappingProperties

type NATMappingProperties uint8

NATMappingProperties is an implementation of the nn::nex::NATProperties::MappingProperties enum.

NATMappingProperties is used to indicate the NAT mapping properties of the users router.

See https://datatracker.ietf.org/doc/html/rfc4787 for more details

const (
	// UnknownNATMapping indicates the NAT type could not be identified
	UnknownNATMapping NATMappingProperties = iota

	// EIMNATMapping indicates endpoint-independent mapping
	EIMNATMapping

	// EDMNATMapping indicates endpoint-dependent mapping
	EDMNATMapping
)

type SignatureMethod

type SignatureMethod uint8

SignatureMethod is an implementation of the nn::nex::PRUDPMessageInterface::SignatureMethod enum.

The signature method is used as part of the packet signature calculation process. It determines what data is used and from where when calculating the packets signature.

Currently unused. Implemented for future use and dodumentation/note taking purposes.

The following notes are derived from Xenoblade on the Wii U. Many details are unknown.

Based on the `nn::nex::PRUDPMessageV1::CalcSignatureHelper` (`__CPR210__CalcSignatureHelper__Q3_2nn3nex14PRUDPMessageV1FPCQ3_2nn3nex6PacketQ4_2nn3nex21PRUDPMessageInterface15SignatureMethodPCQ3_2nn3nex3KeyQJ68J3nex6Stream4TypePCQ3_2nn3nex14SignatureBytesRQ3_2nn3nexJ167J`) function:

There appears to be 9 signature methods. Methods 0, 2, 3, and 9 seem to do nothing. Method 1 seems to calculate the signature using the connection address. Methods 4-8 calculate the signature using parts of the packet.

  • Method 0: Calls `func_0x04b10f90` and bails immediately?
  • Method 1: Seems to calculate the signature using ONLY the connections address? It uses the values from `nn::nex::InetAddress::GetAddress` and `nn::nex::InetAddress::GetPortNumber`, among others. It does NOT follow the same code path as methods 4-9
  • Method 2: Unknown. Bails without doing anything
  • Method 3: Unknown. Bails without doing anything

Methods 4-8 build the signature from one or many parts of the packet

  • Methods 4-8: Use the value from `nn::nex::Packet::GetHeaderForSignatureCalc`?
  • Methods 5-8: Use whatever is passed as `signature_bytes_1`, but only if: 1. `signature_bytes_1` is not empty. 2. The packet type is not `SYN`. 3. The packet type is not `CONNECT`. 4. The packet type is not `USER` (?). 5. `type_flags & 0x200 == 0`. 6. `type_flags & 0x400 == 0`.
  • Method 6: Use an optional "key", if not null
  • If method 7 is used, 2 local variables are set to 0. Otherwise they get set the content pointer and size of the calculated signature buffer. In both cases another local variable is set to `packet->field_0x94`, and then some checks are done on it before it's set to the packets payload?
  • Method 8: 16 random numbers generated and appended to `signature_bytes_2`
  • Method 9: The signature seems ignored entirely?
const (
	// SignatureMethod0 is an unknown signature type
	SignatureMethod0 SignatureMethod = iota

	// SignatureMethodConnectionAddress seems to indicate the signature is based on the connection address
	SignatureMethodConnectionAddress

	// SignatureMethod2 is an unknown signature type
	SignatureMethod2

	// SignatureMethod3 is an unknown signature type
	SignatureMethod3

	// SignatureMethod4 is an unknown signature method
	SignatureMethod4

	// SignatureMethod5 is an unknown signature method
	SignatureMethod5

	// SignatureMethodUseKey seems to indicate the signature uses the provided key value, if not null
	SignatureMethodUseKey

	// SignatureMethod7 is an unknown signature method
	SignatureMethod7

	// SignatureMethodUseEntropy seems to indicate the signature includes 16 random bytes
	SignatureMethodUseEntropy

	// SignatureMethodIgnore seems to indicate the signature is ignored
	SignatureMethodIgnore
)

type StationURLFlag

type StationURLFlag uint8

StationURLFlag is an enum of flags used by the StationURL "type" parameter.

const (
	// StationURLFlagBehindNAT indicates the user is behind NAT
	StationURLFlagBehindNAT StationURLFlag = iota + 1

	// StationURLFlagPublic indicates the station is a public address
	StationURLFlagPublic
)

type StationURLType

type StationURLType uint8

StationURLType is an implementation of the nn::nex::StationURL::URLType enum.

StationURLType is used to indicate the type of connection to use when contacting a station.

const (
	// UnknownStationURLType indicates an unknown URL type
	UnknownStationURLType StationURLType = iota

	// StationURLPRUDP indicates the station should be contacted with a standard PRUDP connection
	StationURLPRUDP

	// StationURLPRUDPS indicates the station should be contacted with a secure PRUDP connection
	StationURLPRUDPS

	// StationURLUDP indicates the station should be contacted with raw UDP data. Used for custom protocols
	StationURLUDP
)

type StreamType

type StreamType uint8

StreamType is an implementation of the rdv::Stream::Type enum.

StreamType is used to create VirtualPorts used in PRUDP virtual connections. Each stream may be one of these types, and each stream has it's own state.

const (
	// StreamTypeDO represents the DO PRUDP virtual connection stream type
	StreamTypeDO StreamType = iota + 1

	// StreamTypeRV represents the RV PRUDP virtual connection stream type
	StreamTypeRV

	// StreamTypeOldRVSec represents the OldRVSec PRUDP virtual connection stream type
	StreamTypeOldRVSec

	// StreamTypeSBMGMT represents the SBMGMT PRUDP virtual connection stream type
	StreamTypeSBMGMT

	// StreamTypeNAT represents the NAT PRUDP virtual connection stream type
	StreamTypeNAT

	// StreamTypeSessionDiscovery represents the SessionDiscovery PRUDP virtual connection stream type
	StreamTypeSessionDiscovery

	// StreamTypeNATEcho represents the NATEcho PRUDP virtual connection stream type
	StreamTypeNATEcho

	// StreamTypeRouting represents the Routing PRUDP virtual connection stream type
	StreamTypeRouting

	// StreamTypeGame represents the Game PRUDP virtual connection stream type
	StreamTypeGame

	// StreamTypeRVSecure represents the RVSecure PRUDP virtual connection stream type
	StreamTypeRVSecure

	// StreamTypeRelay represents the Relay PRUDP virtual connection stream type
	StreamTypeRelay
)

func (StreamType) EnumIndex

func (st StreamType) EnumIndex() uint8

EnumIndex returns the StreamType enum index as a uint8

Jump to

Keyboard shortcuts

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