public class EOS_P2P_Interface
extends com.sun.jna.PointerType
These functions will attempt to punch through NATs, but will fallback to using Epic relay servers if a direct connection cannot be established.
| Constructor and Description |
|---|
EOS_P2P_Interface() |
EOS_P2P_Interface(com.sun.jna.Pointer address) |
| Modifier and Type | Method and Description |
|---|---|
EOS_EResult |
acceptConnection(EOS_P2P_AcceptConnectionOptions options)
Accept or Request a connection with a specific peer on a specific Socket ID.
|
EOS_NotificationId |
addNotifyIncomingPacketQueueFull(EOS_P2P_AddNotifyIncomingPacketQueueFullOptions options,
com.sun.jna.Pointer clientData,
EOS_P2P_OnIncomingPacketQueueFullCallback incomingPacketQueueFullHandler)
Listen for when our packet queue has become full.
|
EOS_NotificationId |
addNotifyPeerConnectionClosed(EOS_P2P_AddNotifyPeerConnectionClosedOptions options,
com.sun.jna.Pointer clientData,
EOS_P2P_OnRemoteConnectionClosedCallback connectionClosedHandler)
Listen for when a previously accepted connection that was either open or pending is closed.
|
EOS_NotificationId |
addNotifyPeerConnectionEstablished(EOS_P2P_AddNotifyPeerConnectionEstablishedOptions options,
com.sun.jna.Pointer clientData,
EOS_P2P_OnPeerConnectionEstablishedCallback connectionEstablishedHandler)
Listen for when a connection is established.
|
EOS_NotificationId |
addNotifyPeerConnectionInterrupted(EOS_P2P_AddNotifyPeerConnectionInterruptedOptions options,
com.sun.jna.Pointer clientData,
EOS_P2P_OnPeerConnectionInterruptedCallback connectionInterruptedHandler)
Listen for when a previously opened connection is interrupted.
|
EOS_NotificationId |
addNotifyPeerConnectionRequest(EOS_P2P_AddNotifyPeerConnectionRequestOptions options,
com.sun.jna.Pointer clientData,
EOS_P2P_OnIncomingConnectionRequestCallback connectionRequestHandler)
Listen for incoming connection requests on a particular Socket ID, or optionally all Socket IDs.
|
EOS_EResult |
clearPacketQueue(EOS_P2P_ClearPacketQueueOptions options)
Clear queued incoming and outgoing packets.
|
EOS_EResult |
closeConnection(EOS_P2P_CloseConnectionOptions options)
For all (or optionally one specific) Socket ID(s) with a specific peer: stop receiving packets, drop any locally queued packets, and if no other
Socket ID is using the connection with the peer, close the underlying connection.
|
EOS_EResult |
closeConnections(EOS_P2P_CloseConnectionsOptions options)
Close any open Connections for a specific Peer Connection ID.
|
EOS_ENATType |
getNATType(EOS_P2P_GetNATTypeOptions options)
Get our last-queried NAT-type, if it has been successfully queried.
|
EOS_EResult |
getNextReceivedPacketSize(EOS_P2P_GetNextReceivedPacketSizeOptions options,
java.nio.IntBuffer outPacketSizeBytes)
Gets the size of the packet that will be returned by ReceivePacket for a particular user, if there is any available
packets to be retrieved.
|
EOS_P2P_PacketQueueInfo |
getPacketQueueInfo(EOS_P2P_GetPacketQueueInfoOptions options)
Gets the current cached information related to the incoming and outgoing packet queues.
|
EOS_EResult |
getPortRange(EOS_P2P_GetPortRangeOptions options,
com.sun.jna.ptr.ShortByReference outPort,
com.sun.jna.ptr.ShortByReference outNumAdditionalPortsToTry)
Get the current chosen port and the amount of other ports to try above the chosen port if the chosen port is unavailable.
|
EOS_EResult |
getRelayControl(EOS_P2P_GetRelayControlOptions options,
java.nio.IntBuffer outRelayControl)
Get the current relay control setting.
|
void |
queryNATType(EOS_P2P_QueryNATTypeOptions options,
com.sun.jna.Pointer clientData,
EOS_P2P_OnQueryNATTypeCompleteCallback completionDelegate)
Query the current NAT-type of our connection.
|
EOS_EResult |
receivePacket(EOS_P2P_ReceivePacketOptions options,
EOS_ProductUserId outPeerId,
EOS_P2P_SocketId outSocketId,
java.nio.ByteBuffer outChannel,
com.sun.jna.Pointer outData,
java.nio.IntBuffer outBytesWritten)
Receive the next packet for the local user, and information associated with this packet, if it exists.
|
void |
removeNotifyIncomingPacketQueueFull(EOS_NotificationId notificationId)
Stop listening for full incoming packet queue events on a previously bound handler.
|
void |
removeNotifyPeerConnectionClosed(EOS_NotificationId notificationId)
Stop notifications for connections being closed on a previously bound handler.
|
void |
removeNotifyPeerConnectionEstablished(EOS_NotificationId notificationId)
Stop notifications for connections being established on a previously bound handler.
|
void |
removeNotifyPeerConnectionInterrupted(EOS_NotificationId notificationId)
Stop notifications for connections being interrupted on a previously bound handler.
|
void |
removeNotifyPeerConnectionRequest(EOS_NotificationId notificationId)
Stop listening for connection requests on a previously bound handler.
|
EOS_EResult |
sendPacket(EOS_P2P_SendPacketOptions options)
Send a packet to a peer at the specified address.
|
EOS_EResult |
setPacketQueueSize(EOS_P2P_SetPacketQueueSizeOptions options)
Sets the maximum packet queue sizes that packets waiting to be sent or received can use.
|
EOS_EResult |
setPortRange(EOS_P2P_SetPortRangeOptions options)
Set configuration options related to network ports.
|
EOS_EResult |
setRelayControl(EOS_P2P_SetRelayControlOptions options)
Set how relay servers are to be used.
|
public EOS_P2P_Interface(com.sun.jna.Pointer address)
public EOS_P2P_Interface()
public EOS_EResult sendPacket(EOS_P2P_SendPacketOptions options)
options - Information about the data being sent, by who, to whoEOS_EResult.EOS_Success - If packet was queued to be sent successfullyEOS_EResult.EOS_InvalidParameters - If input was invalidEOS_EResult.EOS_LimitExceeded - If amount of data being sent is too large, or the outgoing packet queue was fullEOS_EResult.EOS_NoConnection - If bDisableAutoAcceptConnection was set to EOS_TRUE and the connection was not currently accepted (call EOS_P2P_AcceptConnection first, or set bDisableAutoAcceptConnection to EOS_FALSE)public EOS_EResult getNextReceivedPacketSize(EOS_P2P_GetNextReceivedPacketSizeOptions options, java.nio.IntBuffer outPacketSizeBytes)
options - Information about who is requesting the size of their next packetoutPacketSizeBytes - The amount of bytes required to store the data of the next packet for the requested userEOS_EResult.EOS_Success - If OutPacketSizeBytes was successfully set and there is data to be receivedEOS_EResult.EOS_InvalidParameters - If input was invalidEOS_EResult.EOS_NotFound - If there are no packets available for the requesting userpublic EOS_EResult receivePacket(EOS_P2P_ReceivePacketOptions options, EOS_ProductUserId outPeerId, EOS_P2P_SocketId outSocketId, java.nio.ByteBuffer outChannel, com.sun.jna.Pointer outData, java.nio.IntBuffer outBytesWritten)
options - Information about who is requesting the size of their next packet, and how much data can be stored safelyoutPeerId - The Remote User who sent data. Only set if there was a packet to receive.outSocketId - The Socket ID of the data that was sent. Only set if there was a packet to receive.outChannel - The channel the data was sent on. Only set if there was a packet to receive.outData - Buffer to store the data being received. Must be at least EOS_P2P_GetNextReceivedPacketSize in length or data will be truncatedoutBytesWritten - The amount of bytes written to OutData. Only set if there was a packet to receive.EOS_EResult.EOS_Success - If the packet was received successfullyEOS_EResult.EOS_InvalidParameters - If input was invalidEOS_EResult.EOS_NotFound - If there are no packets available for the requesting usergetNextReceivedPacketSize(EOS_P2P_GetNextReceivedPacketSizeOptions, IntBuffer)public EOS_NotificationId addNotifyPeerConnectionRequest(EOS_P2P_AddNotifyPeerConnectionRequestOptions options, com.sun.jna.Pointer clientData, EOS_P2P_OnIncomingConnectionRequestCallback connectionRequestHandler)
options - Information about who would like notifications, and (optionally) only for a specific socketclientData - This value is returned to the caller when ConnectionRequestHandler is invokedconnectionRequestHandler - The callback to be fired when we receive a connection requestEOS_NotificationId.EOS_INVALID_NOTIFICATIONID otherwiseremoveNotifyPeerConnectionRequest(EOS_NotificationId)public void removeNotifyPeerConnectionRequest(EOS_NotificationId notificationId)
notificationId - The previously bound notification IDaddNotifyPeerConnectionRequest(EOS_P2P_AddNotifyPeerConnectionRequestOptions, Pointer, EOS_P2P_OnIncomingConnectionRequestCallback)public EOS_NotificationId addNotifyPeerConnectionEstablished(EOS_P2P_AddNotifyPeerConnectionEstablishedOptions options, com.sun.jna.Pointer clientData, EOS_P2P_OnPeerConnectionEstablishedCallback connectionEstablishedHandler)
options - Information about who would like notifications about established connections, and for which socketclientData - This value is returned to the caller when ConnectionEstablishedHandler is invokedconnectionEstablishedHandler - The callback to be fired when a connection has been establishedEOS_NotificationId.EOS_INVALID_NOTIFICATIONID otherwiseaddNotifyPeerConnectionInterrupted(EOS_P2P_AddNotifyPeerConnectionInterruptedOptions, Pointer, EOS_P2P_OnPeerConnectionInterruptedCallback),
addNotifyPeerConnectionClosed(EOS_P2P_AddNotifyPeerConnectionClosedOptions, Pointer, EOS_P2P_OnRemoteConnectionClosedCallback),
removeNotifyPeerConnectionEstablished(EOS_NotificationId)public void removeNotifyPeerConnectionEstablished(EOS_NotificationId notificationId)
notificationId - The previously bound notification IDaddNotifyPeerConnectionEstablished(EOS_P2P_AddNotifyPeerConnectionEstablishedOptions, Pointer, EOS_P2P_OnPeerConnectionEstablishedCallback)public EOS_NotificationId addNotifyPeerConnectionInterrupted(EOS_P2P_AddNotifyPeerConnectionInterruptedOptions options, com.sun.jna.Pointer clientData, EOS_P2P_OnPeerConnectionInterruptedCallback connectionInterruptedHandler)
If a connection reconnects, it will trigger the P2P PeerConnectionEstablished notification with the EOS_CET_Reconnection connection type. If a connection fails to reconnect, it will trigger the P2P PeerConnectionClosed notification.
options - Information about who would like notifications about interrupted connections, and for which socketclientData - This value is returned to the caller when ConnectionInterruptedHandler is invokedconnectionInterruptedHandler - The callback to be fired when an open connection has been interruptedEOS_NotificationId.EOS_INVALID_NOTIFICATIONID otherwiseaddNotifyPeerConnectionEstablished(EOS_P2P_AddNotifyPeerConnectionEstablishedOptions, Pointer, EOS_P2P_OnPeerConnectionEstablishedCallback),
addNotifyPeerConnectionClosed(EOS_P2P_AddNotifyPeerConnectionClosedOptions, Pointer, EOS_P2P_OnRemoteConnectionClosedCallback),
removeNotifyPeerConnectionInterrupted(EOS_NotificationId)public void removeNotifyPeerConnectionInterrupted(EOS_NotificationId notificationId)
notificationId - The previously bound notification IDaddNotifyPeerConnectionInterrupted(EOS_P2P_AddNotifyPeerConnectionInterruptedOptions, Pointer, EOS_P2P_OnPeerConnectionInterruptedCallback)public EOS_NotificationId addNotifyPeerConnectionClosed(EOS_P2P_AddNotifyPeerConnectionClosedOptions options, com.sun.jna.Pointer clientData, EOS_P2P_OnRemoteConnectionClosedCallback connectionClosedHandler)
options - Information about who would like notifications about closed connections, and for which socketclientData - This value is returned to the caller when ConnectionClosedHandler is invokedconnectionClosedHandler - The callback to be fired when an open connection has been closedEOS_NotificationId.EOS_INVALID_NOTIFICATIONID otherwiseaddNotifyPeerConnectionEstablished(EOS_P2P_AddNotifyPeerConnectionEstablishedOptions, Pointer, EOS_P2P_OnPeerConnectionEstablishedCallback),
addNotifyPeerConnectionInterrupted(EOS_P2P_AddNotifyPeerConnectionInterruptedOptions, Pointer, EOS_P2P_OnPeerConnectionInterruptedCallback),
removeNotifyPeerConnectionClosed(EOS_NotificationId)public void removeNotifyPeerConnectionClosed(EOS_NotificationId notificationId)
notificationId - The previously bound notification IDaddNotifyPeerConnectionClosed(EOS_P2P_AddNotifyPeerConnectionClosedOptions, Pointer, EOS_P2P_OnRemoteConnectionClosedCallback)public EOS_EResult acceptConnection(EOS_P2P_AcceptConnectionOptions options)
If this connection was not already locally accepted, we will securely message the peer, and trigger a PeerConnectionRequest notification notifying them of the connection request. If the PeerConnectionRequest notification is not bound for all Socket IDs or for the requested Socket ID in particular, the request will be silently ignored.
If the remote peer accepts the connection, a notification will be broadcast to the EOS_P2P_AddNotifyPeerConnectionEstablished when the connection is ready to send packets.
If multiple Socket IDs are accepted with one peer, they will share one physical socket.
Even if a connection is already locally accepted, EOS_EResult::EOS_Success will still be returned if the input was valid.
options - Information about who would like to accept a connection, and which connectionEOS_EResult.EOS_Success - if the provided data is validEOS_EResult.EOS_InvalidParameters - if the provided data is invalidpublic EOS_EResult closeConnection(EOS_P2P_CloseConnectionOptions options)
If your application wants to migrate an existing connection with a peer it already connected to, it is recommended to call EOS_P2P_AcceptConnection with the new Socket ID first before calling EOS_P2P_CloseConnection, to prevent the shared physical socket from being torn down prematurely.
options - Information about who would like to close a connection, and which connection.EOS_EResult.EOS_Success - if the provided data is validEOS_EResult.EOS_InvalidParameters - if the provided data is invalidpublic EOS_EResult closeConnections(EOS_P2P_CloseConnectionsOptions options)
options - Information about who would like to close connections, and by what socket IDEOS_EResult.EOS_Success - if the provided data is validEOS_EResult.EOS_InvalidParameters - if the provided data is invalidpublic void queryNATType(EOS_P2P_QueryNATTypeOptions options, com.sun.jna.Pointer clientData, EOS_P2P_OnQueryNATTypeCompleteCallback completionDelegate)
options - Information about what version of the EOS_P2P_QueryNATType API is supportedclientData - arbitrary data that is passed back to you in the CompletionDelegatecompletionDelegate - The callback to be fired when we finish querying our NAT typepublic EOS_ENATType getNATType(EOS_P2P_GetNATTypeOptions options) throws EOSException
options - Information about what version of the EOS_P2P_GetNATType API is supportedEOSNotFoundException - If we do not have queried data cachedEOSExceptionpublic EOS_EResult setRelayControl(EOS_P2P_SetRelayControlOptions options)
options - Information about relay server config optionsEOS_EResult.EOS_Success - if the options were set successfullyEOS_EResult.EOS_InvalidParameters - if the options are invalid in some wayEOS_ERelayControlpublic EOS_EResult getRelayControl(EOS_P2P_GetRelayControlOptions options, java.nio.IntBuffer outRelayControl)
options - Information about what version of the EOS_P2P_GetRelayControl API is supportedoutRelayControl - The relay control setting currently configuredEOS_EResult.EOS_Success - if the input was validEOS_EResult.EOS_InvalidParameters - if the input was invalid in some waypublic EOS_EResult setPortRange(EOS_P2P_SetPortRangeOptions options)
options - Information about network ports config optionsEOS_EResult.EOS_Success - if the options were set successfully
EOS_EResult.EOS_InvalidParameters - if the options are invalid in some waypublic EOS_EResult getPortRange(EOS_P2P_GetPortRangeOptions options, com.sun.jna.ptr.ShortByReference outPort, com.sun.jna.ptr.ShortByReference outNumAdditionalPortsToTry)
options - Information about what version of the EOS_P2P_GetPortRange API is supportedoutPort - The port that will be tried firstoutNumAdditionalPortsToTry - The amount of ports to try above the value in OutPort, if OutPort is unavailableEOS_EResult.EOS_Success - if the input options were valid
EOS_EResult.EOS_InvalidParameters - if the input was invalid in some waypublic EOS_EResult setPacketQueueSize(EOS_P2P_SetPacketQueueSizeOptions options)
options - Information about packet queue sizeEOS_EResult.EOS_Success - if the input options were valid
EOS_EResult.EOS_InvalidParameters - if the input was invalid in some waypublic EOS_P2P_PacketQueueInfo getPacketQueueInfo(EOS_P2P_GetPacketQueueInfoOptions options) throws EOSException
options - Information about what version of the EOS_P2P_GetPacketQueueInfo API is supportedEOSInvalidParametersException - if the input was invalid in some wayEOSExceptionpublic EOS_NotificationId addNotifyIncomingPacketQueueFull(EOS_P2P_AddNotifyIncomingPacketQueueFullOptions options, com.sun.jna.Pointer clientData, EOS_P2P_OnIncomingPacketQueueFullCallback incomingPacketQueueFullHandler)
options - Information about what version of the EOS_P2P_AddNotifyIncomingPacketQueueFull API is supportedclientData - Arbitrary data that is passed back to you in the CompletionDelegateincomingPacketQueueFullHandler - The callback to be fired when the incoming packet queue is fullEOS_NotificationId.EOS_INVALID_NOTIFICATIONID otherwisepublic void removeNotifyIncomingPacketQueueFull(EOS_NotificationId notificationId)
notificationId - The previously bound notification IDpublic EOS_EResult clearPacketQueue(EOS_P2P_ClearPacketQueueOptions options)
options - Information about which queues should be clearedEOS_EResult.EOS_Success - if the input options were valid (even if queues were empty and no packets where cleared)
EOS_EResult.EOS_IncompatibleVersion - if wrong API version
EOS_EResult.EOS_InvalidUser - if an invalid/remote user was used
EOS_EResult.EOS_InvalidParameters - if input was invalid in other way