Fusion.Sockets
Responsible for encrypting and decrypting data buffers
Encrypts the data in the provided buffer.
The buffer containing the data to be encrypted.
The length of the data in the buffer.
The total capacity of the buffer.
Returns true if the encryption was successful, false otherwise.
Thrown when the encryption provider is not initialized.
Thrown when the original buffer cannot hold the encrypted data.
Build a new AES Implementation
Build a new HMACSHA256 Implementation
Clear and return the IN Encrypt Buffer
Clear and return the OUT Encrypt Buffer
Interface for classes that manage the encryption/decryption of byte arrays
Setup the encryption implementation with the right key
Generate the key used used by the encryption implementation
Key used to setup the encryption implementation
Encrypt data in place and update it's length.
Data to encrypt
Length of the data to encrypt
Buffer total capacity
True if the encryption was completed, false otherwise
Decrypt data in place and update it's length.
Data to decrypt
Length of the data to decrypt
Buffer total capacity
True if the decryption was completed, false otherwise
Compute the Buffer hash and append it to the buffer itself
Data to compute the hash
Length of the data to hash
Buffer total capacity
True if the hash was properly computed, false otherwise
Verify the buffer hash that was appended to the buffer
Buffer to check the hash
Length of the data to hash
Buffer total capacity
True if the hash was properly verified, false otherwise
The EncryptionManager class manages encryption keys for different handles.
A type that implements the IDataEncryption interface.
A type that implements the IEquatable interface.
This class is unsafe because it uses pointers in its methods.
A dictionary that maps handle IDs to their corresponding encryption objects.
Disposes all encryption objects in the _cyphers dictionary.
This method is called when the EncryptionManager object is being disposed.
Registers a new encryption key for a specific handle.
The handle ID for which the encryption key is to be registered.
The encryption key to be registered.
Deletes the encryption key for a specific handle.
The handle ID for which the encryption key is to be deleted.
Check if a handle has encryption setup
Handle ID
True if the handle has encryption setup, false otherwise
Wraps the provided buffer with encryption and computes a hash for it.
The handle ID for which the packet is to be encrypted and hashed.
The data buffer array containing the packet to be encrypted and hashed.
The length of the buffer array.
The total capacity of the buffer array.
Returns true if both the encryption and hash computation were successful, false otherwise.
Unwraps the provided buffer by verifying its hash and decrypting it.
The handle ID for which the packet is to be verified and decrypted.
The data buffer array containing the packet to be verified and decrypted.
The length of the buffer array.
The total capacity of the buffer array.
Returns true if both the hash verification and decryption were successful, false otherwise.
Generates a new encryption key.
A byte array representing the generated encryption key.
Computes the hash for the data in the buffer for a specific handle.
The handle for which to compute the hash.
The buffer containing the data to hash.
The length of the data in the buffer.
The total capacity of the buffer.
True if the hash was computed successfully, false otherwise.
Verifies the hash for the data in the buffer for a specific handle.
The handle for which to verify the hash.
The buffer containing the data to verify the hash.
The length of the data in the buffer.
The total capacity of the buffer.
True if the hash was verified successfully, false otherwise.
Encrypts a packet for a specific handle.
The handle ID for which the packet is to be encrypted.
The data buffer array containing the packet to be encrypted.
The length of the buffer array.
The total capacity of the buffer array.
Returns true if the encryption was successful, false otherwise.
Decrypts a packet from a specific handle.
The handle ID from which the packet is to be decrypted.
The data buffer array containing the packet to be decrypted.
The length of the buffer array.
The total capacity of the buffer array.
Returns true if the decryption was successful, false otherwise.
Represents an encryption token.
Enabled the Encryption Feature
Represents a Network Address, which includes a IP and Port
This can contains either a IPv4 or a IPv6 address
Retrieves the Remote Actor ID which this Represents
Signal if the is a Relayed connection
Signal if the represents an IPv6 Address
Signal if this is not default/empty
Build a new based on an ActorId
ActorId used to build the NetAddress
Relay NetAddress that references the ActorId
ActorId must be 0 or greated
Build 64Bit Hash
Address to build the Hash
64bit Hash
Create a new NetAddress on the LocalHost address with the desired Port
Port used to build the NetAddress
New NetAddress reference
Create a new on the LocalHost IPv6 Address with the desired Port
Port used to build the NetAddress
New NetAddress reference
Create a new NetAddress using the "Any" IPv4 Address representation (0.0.0.0)
with the Port passed as argument
Port used to build the NetAddress
New NetAddress reference
Create a new NetAddress using the "Any" IPv6 Address representation (::)
with the Port passed as argument
Port used to build the NetAddress
New NetAddress reference
Create a new NetAddress based on the IP and Port passed as argument
String representation of an IP, either IPv4 or IPv6
Port used to build the NetAddress
New NetAddress reference
If IP is empty/null or an invalid IP, or port < 0
If unable to parse IP
IPv4 Subnet Mask Utilities
List of IPv4 Subnet Masks
Check if two IPv4 seems to be in the same Subnet.
The addresses are checked against all subnet masks in .
EndPoint A
EndPoint B
True if both addresses seems to be in the same subnet
Extracts the Network Address of an IPv4 EndPoint based on a particular Subnet Mask
EndPoint
Subnet Mask
Network Address based on the Subnet Mask
Represents a linked list of
Add a at the beginning of the List
NetBitBuffer to add to the list
Add a at the end of the list.
NetBitBuffer to add to the list
Removes the first element of the list
NetBitBuffer reference
Remove a specific from the list
NetBitBuffer to remove
Check if a specific is in the list
NetBitBuffer to check
True if the list contains the item, false otherwise
Describe the Type of a Command Packet
Network Command Header
Describe its type and usual settings for all commands
Create a new NetCommandHeader based on a type
Type of Command that should be created
New NetCommandHeader reference based on the Command Type
Connect Command used to signal a remote server that a client is trying to connect to it
Accepted Command, sent by the server when a remote client connection is accepted
Refuse Command, sent by the server when the connection was refused.
This happens when the server has reached its max connection capacity.
Disconnect Command, it can be used by either side of the connection
General configuration used to drive the behavior of the Socket library
Pre-allocated number of data buffers used to send data
Number of Connection Groups supported by the local instance
Max Number of Connections supported by the local instance
Max number of Connection per Group based on the and
Size of the internal Socket send buffer
Size of the internal Socket receive buffer
default Maximum Transmission Unit
UDP Packet Size in Bytes
UDP Packet Size in Bits based on
Number of Connection Attempts tried by the peer before cancel the connection
Interval in Seconds between attempts to connect to a remote server
Max Allowed time for the Send and Receive operations, in milliseconds
Initial RTT
Connection Timeout in seconds
Interval in Seconds between ping being sent to a remote end
Timeout in Seconds to allow a disconnected Connection to be released from the Group Mapping
Network Address used to bind the internal Socket
Package acknowledgment system configuration
Network simulation system configuration
Builds a with the default values
The reason a connection with a remote server has failed
Server is not responding.
Server has accepted the max allowed Players
Server refused the connection
Client Unique ID size in bytes
Disconnect Reason Flag
Describe the type of a Networked Packet
IPv6 header: 40 bytes, UDP header: 8 bytes, Realtime Header: 96 bytes
MinimumTransferUnit bytes.
MinimumTransferUnit bits.
MaximumTransferUnit bytes.
MaximumTransferUnit bits. (ipv6 header: 40 bytes, udp header: 8 bytes)
Calculates the distance between two sequence numbers, taking into account the circular nature of the sequence.
The sequence number to start from.
The sequence number to calculate the distance to.
The distance between the two sequence numbers.
If 'from' is larger than 'to', the result is positive.
If 'from' is lesser than 'to', the result is negative.
If they are the same, the result is zero.
Thrown when the calculated distance is outside the range of an integer.
Encryption System
Sets up the encryption system by initializing the encryption manager,
registering the encryption key, and creating the encryption token and buffer.
The encryption key.
The encrypted key.
If is null, it indicates that the peer is a server.
If is not null, the peer is a client.
Handles the outgoing encryption process for the given address and buffer.
The address to which the data is being sent.
The buffer containing the data to be sent.
The length of the data to be sent.
Returns true if the encryption process is successful, false otherwise.
Handles the incoming encryption process for the given address and buffer.
The address from which the data is received.
The buffer containing the received data.
The length of the received data.
The number of bytes received.
Returns true if the decryption process is successful, false otherwise.
Resets the encryption system by disposing the encryption manager and resetting the session key.
Deletes the encryption key associated with the given address.
The address whose associated encryption key is to be deleted.
Random ID of this socket
Reference to Current Communicator
Local Peer Address is based on the current Player Actor Number inside the Room
Specifies UDP network type.
Invalid NAT Type
UDP is always blocked.
No NAT, public IP, no firewall.
A full cone NAT is one where all requests from the same internal IP address and port are
mapped to the same external IP address and port. Furthermore, any external host can send
a packet to the internal host, by sending a packet to the mapped external address.
A symmetric NAT is one where all requests from the same internal IP address and port,
to a specific destination IP address and port, are mapped to the same external IP address and
port. If the same host sends a packet with the same source address and port, but to
a different destination, a different mapping is used. Furthermore, only the external host that
receives a packet can send a UDP packet back to the internal host.
This class implements STUN Client. Defined in RFC 8489
Session Traversal Utilities for NAT (STUN)
Traversal Using Relays around NAT (TURN): Relay Extensions to Session Traversal Utilities for NAT(STUN)
Happy Eyeballs Version 2: Better Connectivity Using Concurrency
State of Peer-to-Peer (P2P) Communication across Network Address Translators(NATs)
List of public DNS Servers
Sends a STUN Binding Request to a public STUN server to discover peer reflexive addresses.
A reference to the network peer.
A reference to the network socket.
The original address family.
The ID of the request. This is a reference parameter that may be changed within the method if necessary.
Returns true if the STUN Binding Request was successfully sent, false otherwise.
Thrown when an error occurs while sending the STUN Binding Request.
Retrieves the local IP endpoint currently active.
The address family to be used.
The local IP address that is currently active. This is an output parameter.
Returns true if the local IP address was successfully retrieved, false otherwise.
Thrown when an error occurs while creating the socket or connecting to the test IP.
This class implements STUN ERROR-CODE. Defined in RFC RFC 5389 15.6
Gets or sets error code.
Gets reason text.
Default constructor.
Error code.
Reason text.
Implements STUN message. Defined in RFC 3489.
Cache Stun Message Types
STUN Message Type
STUN Attribute Type
Global Stun Related defined values
IP Address Family
STUN Message Type
STUN Transaction ID
Gets transaction ID.
Gets or sets IP end point what was actually connected to STUN server. Returns null if not specified.
Gets or sets user name. Value null means not specified.
Gets or sets error info. Returns null if not specified.
Default constructor.
Parses STUN message from raw data packet.
Raw STUN message.
Length of raw STUN message.
Converts this to raw STUN packet.
Returns raw STUN packet.
Parses attribute from data.
SIP message data.
Offset in data.
Pasrses IP endpoint attribute.
STUN message data.
Offset in data.
Returns parsed IP end point.
Stores ip end point attribute to buffer.
Attribute type.
IP end point.
Buffer where to store.
Offset in buffer.
This class holds the result of a STUN Query
Current NAT Type of the peer
Signal if Result is valid
Gets public IP end point.
Gets private IP end point.
Invalid StunResult Reference
Initializes a new instance of the class.
The public IP endpoint. Defaults to an unspecified IPv4 address.
The private IP endpoint. Defaults to an unspecified IPv4 address.
List of public STUN Servers
Builds a STUN server object from a given STUN server address.
The STUN server address in the format "ip:port".
A Task that represents the asynchronous operation. The Task's result is the STUN server object.
Thrown when the provided STUN server address is not in the correct format.
Thrown when an error is encountered when resolving the hostname to an IP address.
Total size in BITS of the buffer
Current read/write position in BITS inside the Buffer
Size of written buffer in BYTES
Ammount of bytes required considering the total of written bytes
Total Size in BYTES of the Buffer
Signal if the buffer was completely written
Signal if the buffer is overflowing
Signal if the Buffer is in Write Mode
Signal if the Buffer is in Read Mode
Internal Byte Array
Handles Protocol Msgs sent by the Fusion Plugin
It converts the byte buffer into usable Protocol Msgs
Sender Actor of the Protocol Msg, generally the Plugin
Object that stores the buffer to be converted
Convert the Data object into a usable Byte Buffer.
How the conversion happens depends on the the Type of Communicator
Change master client request Message
Used to signal that Fusion Simulation should start
Player Unique Ref
Base Protocol Message.
This concentrates the basics for serialization and cloning
Max Lenght of the Custom Data
Stores the Current Protocol Message version
Stores the Current Fusion Serialization Version
Custom data send along side any Protocol Message
Creates a copy of this Message
Created a new Message with a certain version
Protocol Message Version
Fusion Serialization Version
Serialize this Message into or from a .
Buffer to read from or write into the data of the Message
Used by the specialized versions of Message to serialize its data
Buffer to read from or write into the data of the Message
Check if this Message is compatible with target versions
Target Protocol Message Version
Target Fusion Serialization Version
True if message is compatible with versions
Disconnect Protocol Message.
Used to signal a peer that it will be disconnected from Photon Cloud
Disconnect Reason
Disconnect Protocol Message
Disconnect Protocol Message
The reason for the disconnection.
The version of the protocol to be used. Defaults to the latest protocol version.
The version of the serialization to be used. Defaults to null.
List all Disconnect reason used by the Plugin to remove an Actor from the Room
Abstract disconnect reason
Used when an event with other code other then the treated ones is received by the plugin
When the Join Message is not of the Request Type
When the Join Message does not contain a valid Game Mode
When any of the major settings of a message does not align with the current settings,
like GameMode, Protocol Version, Serialization Version and Peer Mode
When there is already a Server running on the current Room
An error occured on the Plugin
Local Peer Mode
message Type
Sent by Peer to Request to Join on the Plugin
Sent by the Plugin to confirm the Join of a Peer
Type of Peer which the Peer is starting as
No Mode Selected, means Invalid
Server Mode
Client Mode
Join Requests sent by the Plugin to request data from the Peer
No request in the Join Message
Request the Network Config
Request for Reflexive Information
Request to Disable NAT Punch
Join Message
It is used to join a Fusion Room Session with extra information about the Peer.
This is unrelated to the Join Operation into a Photon Room.
Join Message Type
Requested Plugin Game Mode
Local Peer Mode
Requests sent from Plugin
Peer Unique ID
Player Unique Ref
Peer Encryption Key
Peer Encryption Key
Network Config Msg Type
Request Network Config
Response to a Request
Override Signal for the Network Config
NetworkConfig Protocol Msgs
It is used to serialize the Fusion NetworkConfig and send to Photon Cloud Plugin
Network Config Type
JSON Serialized NetworkConfig
Reflexive Info Msgs
Used to transport information about the Reflexive Addresses of a Peer
Actor ID to which this info is related
Peer Public Address
Peer Private Address
Peer NAT Type
Signal if this Reflexive Info is Valid or not
Peer Unique ID
Snapshot Message Type
Invalid/Empty Type
Base Snapshot
Confirmation sent by the Plugin
State Snapshot Protocol Msgs
Used to sync the current Server Game State with the Photon Cloud Plugin
in order to perform an eventual Host Migration
Tick to which this Snapshot represents
Last NetworkID from the Server
Snapshot Type
Snapshot Total number of bytes stored or expected to be stored on the Snapshot
Check if the Snapshot has a valid Data based on the expected CRC
True if the Snapshot has a valid data
Get Snapshot internal Data Buffer
Internal Data Buffer
CRC Hash based on the content of the internal data or the expected CRC after all fragments are computed
Computes the CRC64 of the current Buffer Data stored on the Snapshot
Create a clone with this Snapshot and reset reference
Start Message Requests
No Requests
Peer should connect to Shared Server
Peer should wait for the Server Reflexive Info
Start Protocol Msgs
Used to signal that Fusion Simulation should start
Actor ID of the Remote Server
Start Requests
Defines the Mode the Plugin should run
No Game Mode set
Client Server Game Mode
The Plugin will act just as a relay, exchanging data between the peers.
Shared Game Mode
The Plugin will act as a Fusion Server and will accept remote connections
Photon Event Codes used by the Fusion to communicate with the Photon Cloud
Protocol Event Code
Data Event Code
Zero (0) means: if it should be the room itself (authorative event).
Default CustomData Key of Realtime Events
Protocol Messages Serializer
Serialize a Protocol Message into a BitStream
Protocol Message to be serialized
BitStream containing the Protocol Message
True if the Protocol Message was serialized
Deserialize a Protocol Message from a BitStream
Stream containing a Protocol Message
Deserialized Protocol Message
True if a Protocol Message was deserialized
Invalid Version
Initial Version
Added Support to Fusion Serialization Version
Added Custom Data to all Protocol Messages
Added NAT Type to Reflexive Info
Added Host Migration Support
Added Peer Unique Key
Added Join Message PlayerRef
Rework Host Migration
Added Encryption Support
Always points to the Latest version