Inherits NobleConnect.Stun.IStunExtension.
Public Member Functions | |
TurnExtension (IPEndPoint turnServerEndpoint=null) | |
override Stun.MessageMethod | CreateMessageMethod (byte[] buffer, int bufferIndex) |
override Stun.Attribute | CreateAttribute (byte[] buffer, int bufferIndex, ReadOnlyByteArray transactionID) |
override bool | HandleReceive (byte[] buffer, int index, int count, IPEndPoint remoteEndPoint, IPEndPoint receivedAt) |
Message | ConstructAllocateRequest (byte[] sessionGUID=null, int lifetime=60, Credentials c=null) |
Transaction< Message > | SendAllocateRequest (Action< Message > onSuccess, Action< Message > onFailure=null, Action< Message > onConnectionLost=null, byte[] sessionGUID=null, int lifetime=60, int refreshTime=30, int overrideMaxResend=-1, int overrideTimeout=-1) |
Send an Allocation Request to the Turn server in order to receive our allocated relay address More... | |
void | OnAllocateComplete (Transaction< Message > transaction, int refreshTime, Action< Message > onSuccess=null, Action< Message > onFailure=null, Action< Message > onConnectionLost=null) |
void | QueueRefreshRequest (int allocationLifetime, int refreshTime, Transaction< Message > transaction, Action< Message > onFailure=null, bool sendImmediately=false) |
Transaction< Message > | SendRefreshRequest (int lifetime=60, int refreshTime=30, Action< Message > onSuccess=null, Action< Message > onFailure=null) |
void | RevokeAllocation () |
Transaction< Message > | SendChannelBindRequest (IPEndPoint peerEndPoint) |
Transaction< Message > | SendChannelBindRequest (IPEndPoint peerEndPoint, Action< Message > onSuccess, Action< Message > onFail) |
Transaction< Message > | SendChannelBindRequest (IPEndPoint peerEndPoint, IPEndPoint target, IPEndPoint source, Action< Message > onChannelBind, Action< Message > onFail, bool dontRefresh=false) |
Transaction< Message > | SendChannelBindRequest (ChannelTuple channelTuple, Action< Message > onChannelBind, Action< Message > onFail, bool dontRefresh=false) |
void | QueueChannelBindRefresh (ChannelTuple channelTuple, ChannelIDTuple channelIDTuple) |
void | OnChannelBindRefreshSuccess (ChannelTuple channelTuple, ChannelIDTuple channelIDTuple) |
void | OnChannelBindRefreshFailure (Message response, ChannelTuple channelTuple, ChannelIDTuple channelIDTuple) |
void | RevokeChannel (IPEndPoint peerEndPoint) |
void | RevokeChannel (ChannelTuple tuple) |
void | RevokeAllChannels () |
void | SendCreatePermissionRequest (IPAddress peerIP, Action< Message > onSuccess, Action< Message > onFail) |
void | SendCreatePermissionRequest (IPAddress peerIP, Action< Message > onSuccess, Action< Message > onFail, IPEndPoint relayEndPoint, IPEndPoint target, IPEndPoint source, bool dontRefresh=false, int overrideMaxResend=-1) |
Send a Create Permission Request to the Turn server More... | |
Message | ConstructCreatePermissionMessage (IPAddress peerIP, IPEndPoint relayEndPoint, IPEndPoint target, IPEndPoint source) |
Construct a create permission message More... | |
void | QueuePermissionRefresh (IPAddress peerAddress, IPEndPoint relayEndPoint, IPEndPoint target, IPEndPoint source) |
void | RevokePermission (IPAddress peerIP) |
void | RevokePermission (IPAddress peerIP, IPEndPoint relayEndPoint, IPEndPoint target, IPEndPoint source) |
void | RevokeAllPermissions () |
void | SendData (byte[] data, int offset, int length, IPEndPoint peer) |
void | SendData (byte[] data, int offset, int length, IPEndPoint peer, IPEndPoint target, IPEndPoint source) |
Send some data from a Turn client, over a relay, to a Turn peer More... | |
void | SendChannelMessage (byte[] data, int offset, int length, IPEndPoint peer) |
void | SendChannelMessage (PaddedBuffer buffer, int numBytes, IPEndPoint peer) |
override bool | HandleIndication (Message message, IPEndPoint remoteEndPoint, IPEndPoint receivedAt) |
Handle an INDICATION Message from the Turn server. More... | |
override bool | Send (Message message, IPEndPoint target, IPEndPoint source) |
override bool | HandleErrorResponse (Transaction< Message > transaction, Message message, IPEndPoint source, ref bool isComplete) |
bool | HandleErrorAlternateServer (Transaction< Message > transaction, Message response, IPEndPoint source) |
override int | GetExtensionPriority () |
![]() | |
virtual MessageClass | CreateMessageClass (byte[] buffer, int bufferIndex) |
virtual bool | HandleRequest (Message request, IPEndPoint source, IPEndPoint receivedAt) |
virtual bool | HandleResponse (Transaction< Message > transaction, Message response, IPEndPoint source, IPEndPoint receivedAt) |
virtual Credentials | FindLocalCredentials (Message request) |
void | Dispose () |
Public Attributes | |
IPEndPoint | allocationEndPoint |
The relay allocation endpoints associated with this stun controller More... | |
int | numConsecutiveTimesAllocationLost = 0 |
![]() | |
Controller | stunController |
Protected Member Functions | |
override void | Dispose (bool disposing) |
Properties | |
IPEndPoint | TurnServerEndpoint [get, set] |
NobleConnect.Turn.TurnExtension.TurnExtension | ( | IPEndPoint | turnServerEndpoint = null | ) |
Message NobleConnect.Turn.TurnExtension.ConstructAllocateRequest | ( | byte[] | sessionGUID = null , |
int | lifetime = 60 , |
||
Credentials | c = null |
||
) |
Message NobleConnect.Turn.TurnExtension.ConstructCreatePermissionMessage | ( | IPAddress | peerIP, |
IPEndPoint | relayEndPoint, | ||
IPEndPoint | target, | ||
IPEndPoint | source | ||
) |
Construct a create permission message
peerIP | The IP of the peer to allow communication with over the relay |
relayEndPoint | The IP of the relay allocation to allow sending over. If left out then the stun server will automatically use the allocation associated with this stun controller |
target | The IP of the stun server to send the request to. If left out the stun server associated with this stun controller is used.) |
source | The source, either a stun controller local end point or a relay end point that we are sending from |
|
virtual |
Reimplemented from NobleConnect.Stun.IStunExtension.
|
virtual |
Reimplemented from NobleConnect.Stun.IStunExtension.
|
protectedvirtual |
Reimplemented from NobleConnect.Stun.IStunExtension.
|
virtual |
Implements NobleConnect.Stun.IStunExtension.
bool NobleConnect.Turn.TurnExtension.HandleErrorAlternateServer | ( | Transaction< Message > | transaction, |
Message | response, | ||
IPEndPoint | source | ||
) |
|
virtual |
Reimplemented from NobleConnect.Stun.IStunExtension.
|
virtual |
Handle an INDICATION Message from the Turn server.
This is where incoming Data messages from Turn peers are received on a Turn client. Theoretically other indications would be handled here as well but if there are any I haven't come across them yet.
message | |
transaction |
Reimplemented from NobleConnect.Stun.IStunExtension.
|
virtual |
Reimplemented from NobleConnect.Stun.IStunExtension.
void NobleConnect.Turn.TurnExtension.OnAllocateComplete | ( | Transaction< Message > | transaction, |
int | refreshTime, | ||
Action< Message > | onSuccess = null , |
||
Action< Message > | onFailure = null , |
||
Action< Message > | onConnectionLost = null |
||
) |
void NobleConnect.Turn.TurnExtension.OnChannelBindRefreshFailure | ( | Message | response, |
ChannelTuple | channelTuple, | ||
ChannelIDTuple | channelIDTuple | ||
) |
void NobleConnect.Turn.TurnExtension.OnChannelBindRefreshSuccess | ( | ChannelTuple | channelTuple, |
ChannelIDTuple | channelIDTuple | ||
) |
void NobleConnect.Turn.TurnExtension.QueueChannelBindRefresh | ( | ChannelTuple | channelTuple, |
ChannelIDTuple | channelIDTuple | ||
) |
void NobleConnect.Turn.TurnExtension.QueuePermissionRefresh | ( | IPAddress | peerAddress, |
IPEndPoint | relayEndPoint, | ||
IPEndPoint | target, | ||
IPEndPoint | source | ||
) |
void NobleConnect.Turn.TurnExtension.QueueRefreshRequest | ( | int | allocationLifetime, |
int | refreshTime, | ||
Transaction< Message > | transaction, | ||
Action< Message > | onFailure = null , |
||
bool | sendImmediately = false |
||
) |
void NobleConnect.Turn.TurnExtension.RevokeAllChannels | ( | ) |
void NobleConnect.Turn.TurnExtension.RevokeAllocation | ( | ) |
void NobleConnect.Turn.TurnExtension.RevokeAllPermissions | ( | ) |
void NobleConnect.Turn.TurnExtension.RevokeChannel | ( | ChannelTuple | tuple | ) |
void NobleConnect.Turn.TurnExtension.RevokeChannel | ( | IPEndPoint | peerEndPoint | ) |
void NobleConnect.Turn.TurnExtension.RevokePermission | ( | IPAddress | peerIP | ) |
void NobleConnect.Turn.TurnExtension.RevokePermission | ( | IPAddress | peerIP, |
IPEndPoint | relayEndPoint, | ||
IPEndPoint | target, | ||
IPEndPoint | source | ||
) |
|
virtual |
Reimplemented from NobleConnect.Stun.IStunExtension.
Transaction<Message> NobleConnect.Turn.TurnExtension.SendAllocateRequest | ( | Action< Message > | onSuccess, |
Action< Message > | onFailure = null , |
||
Action< Message > | onConnectionLost = null , |
||
byte[] | sessionGUID = null , |
||
int | lifetime = 60 , |
||
int | refreshTime = 30 , |
||
int | overrideMaxResend = -1 , |
||
int | overrideTimeout = -1 |
||
) |
Send an Allocation Request to the Turn server in order to receive our allocated relay address
The provided onAllocateComplete method is called when the response is received.
onSuccess |
Transaction<Message> NobleConnect.Turn.TurnExtension.SendChannelBindRequest | ( | ChannelTuple | channelTuple, |
Action< Message > | onChannelBind, | ||
Action< Message > | onFail, | ||
bool | dontRefresh = false |
||
) |
Transaction<Message> NobleConnect.Turn.TurnExtension.SendChannelBindRequest | ( | IPEndPoint | peerEndPoint | ) |
Transaction<Message> NobleConnect.Turn.TurnExtension.SendChannelBindRequest | ( | IPEndPoint | peerEndPoint, |
Action< Message > | onSuccess, | ||
Action< Message > | onFail | ||
) |
Transaction<Message> NobleConnect.Turn.TurnExtension.SendChannelBindRequest | ( | IPEndPoint | peerEndPoint, |
IPEndPoint | target, | ||
IPEndPoint | source, | ||
Action< Message > | onChannelBind, | ||
Action< Message > | onFail, | ||
bool | dontRefresh = false |
||
) |
void NobleConnect.Turn.TurnExtension.SendChannelMessage | ( | byte[] | data, |
int | offset, | ||
int | length, | ||
IPEndPoint | peer | ||
) |
void NobleConnect.Turn.TurnExtension.SendChannelMessage | ( | PaddedBuffer | buffer, |
int | numBytes, | ||
IPEndPoint | peer | ||
) |
void NobleConnect.Turn.TurnExtension.SendCreatePermissionRequest | ( | IPAddress | peerIP, |
Action< Message > | onSuccess, | ||
Action< Message > | onFail | ||
) |
void NobleConnect.Turn.TurnExtension.SendCreatePermissionRequest | ( | IPAddress | peerIP, |
Action< Message > | onSuccess, | ||
Action< Message > | onFail, | ||
IPEndPoint | relayEndPoint, | ||
IPEndPoint | target, | ||
IPEndPoint | source, | ||
bool | dontRefresh = false , |
||
int | overrideMaxResend = -1 |
||
) |
Send a Create Permission Request to the Turn server
Before the Turn server will pass data over a relay the Turn client must install a permission for the Turn peer it wishes to communicate with by calling this method and passing in the peer's server reflexive ip. This is the address that the peer receives in response to a Bind Request. How you get the peer address to the client is up to the application developer. For a game this would mean some sort of matchmaking server. The provided onCreatePermission method will be called when a response is received.
peerIP | The IP of the peer to allow communication with over the relay |
onSuccess | Method to call after permission is succesfully created |
onFail | Method to call if permission creation fails |
relayEndPoint | The IP of the relay allocation to allow sending over. If left out then the stun server will automatically use the allocation associated with this stun controller |
target | The stun server to send the request to |
source | The end point to send from, either a local socket address or relay |
dontRefresh | Should the permission be automatically refreshed |
overrideMaxResend | Optionally override number of retries |
void NobleConnect.Turn.TurnExtension.SendData | ( | byte[] | data, |
int | offset, | ||
int | length, | ||
IPEndPoint | peer | ||
) |
void NobleConnect.Turn.TurnExtension.SendData | ( | byte[] | data, |
int | offset, | ||
int | length, | ||
IPEndPoint | peer, | ||
IPEndPoint | target, | ||
IPEndPoint | source | ||
) |
Send some data from a Turn client, over a relay, to a Turn peer
You'll have to know the server reflexive IP Address and Port of the peer you want to send data to. This is the address that the peer receives in response to a Bind Request. How you get the peer address to the client is up to the application developer. For a game this would mean some sort of matchmaking server.
data | |
offset | |
length | |
peer |
Transaction<Message> NobleConnect.Turn.TurnExtension.SendRefreshRequest | ( | int | lifetime = 60 , |
int | refreshTime = 30 , |
||
Action< Message > | onSuccess = null , |
||
Action< Message > | onFailure = null |
||
) |
IPEndPoint NobleConnect.Turn.TurnExtension.allocationEndPoint |
The relay allocation endpoints associated with this stun controller
int NobleConnect.Turn.TurnExtension.numConsecutiveTimesAllocationLost = 0 |
|
getset |