Class StunServer
A STUN server.
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public class StunServer : Dynamic
Properties
CreateDatagramSocket
Gets or sets the create callback to create a datagram socket.
Declaration
public Function1<DatagramSocketCreateArgs, DatagramSocket> CreateDatagramSocket { get; set; }
Property Value
Type | Description |
---|---|
Function1<DatagramSocketCreateArgs, DatagramSocket> |
CreateStreamSocket
Gets or sets the create callback to create a stream socket.
Declaration
public Function1<StreamSocketCreateArgs, StreamSocket> CreateStreamSocket { get; set; }
Property Value
Type | Description |
---|---|
Function1<StreamSocketCreateArgs, StreamSocket> |
DisableTcp
Gets or sets whether to prevent the server from listening for TCP requests.
Declaration
public bool DisableTcp { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
DisableTls
Gets or sets whether to prevent the server from listening for TLS requests.
Declaration
public bool DisableTls { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
DisableUdp
Gets or sets whether to prevent the server from listening for UDP requests.
Declaration
public bool DisableUdp { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Label
Gets the label.
Declaration
protected virtual string Label { get; }
Property Value
Type | Description |
---|---|
System.String |
LocalTcpAddress
Gets the local TCP address.
Declaration
public ServerAddress LocalTcpAddress { get; }
Property Value
Type | Description |
---|---|
ServerAddress |
LocalTcpAddresses
Gets the local TCP addresses.
Declaration
public ServerAddress[] LocalTcpAddresses { get; }
Property Value
Type | Description |
---|---|
ServerAddress[] |
LocalUdpAddress
Gets the local UDP address.
Declaration
public ServerAddress LocalUdpAddress { get; }
Property Value
Type | Description |
---|---|
ServerAddress |
LocalUdpAddresses
Gets the local UDP addresses.
Declaration
public ServerAddress[] LocalUdpAddresses { get; }
Property Value
Type | Description |
---|---|
ServerAddress[] |
StreamSendTimeout
Gets or sets timeout for asynchronous data sending over stream sockets in ms. Defaults to unset.
Declaration
public int StreamSendTimeout { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
TcpAddresses
Gets the TCP server addresses.
Declaration
public ServerAddress[] TcpAddresses { get; }
Property Value
Type | Description |
---|---|
ServerAddress[] |
TlsAddresses
Gets the TLS server addresses.
Declaration
public ServerAddress[] TlsAddresses { get; }
Property Value
Type | Description |
---|---|
ServerAddress[] |
UdpAddresses
Gets the UDP server addresses.
Declaration
public ServerAddress[] UdpAddresses { get; }
Property Value
Type | Description |
---|---|
ServerAddress[] |
Methods
CreateErrorResponse(Message, TransportAddress, String)
Creates an error response with a ganeric Stun server error.
Declaration
protected virtual Message CreateErrorResponse(Message request, TransportAddress remoteAddress, string errorMessage)
Parameters
Type | Name | Description |
---|---|---|
Message | request | The request. |
TransportAddress | remoteAddress | The remote address. |
System.String | errorMessage | The erro messager. |
Returns
Type | Description |
---|---|
Message |
CreateExceptionResponse(Message, TransportAddress, Error)
Creates an exception response.
Declaration
protected virtual Message CreateExceptionResponse(Message request, TransportAddress remoteAddress, Error error)
Parameters
Type | Name | Description |
---|---|---|
Message | request | The request. |
TransportAddress | remoteAddress | The remote address. |
Error | error | The Stun error. |
Returns
Type | Description |
---|---|
Message |
GetPrefix(Boolean, Boolean)
Gets a prefix.
Declaration
protected string GetPrefix(bool udp, bool secure)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | udp | |
System.Boolean | secure |
Returns
Type | Description |
---|---|
System.String |
Process(Message, DatagramSocket, StreamSocket, ServerAddress, TransportAddress)
Processes the specified request.
Declaration
protected virtual Message Process(Message request, DatagramSocket udpServerSocket, StreamSocket tcpServerSocket, ServerAddress localAddress, TransportAddress remoteAddress)
Parameters
Type | Name | Description |
---|---|---|
Message | request | The request. |
DatagramSocket | udpServerSocket | The UDP server socket. |
StreamSocket | tcpServerSocket | The TCP server socket. |
ServerAddress | localAddress | The local address. |
TransportAddress | remoteAddress | The remote address. |
Returns
Type | Description |
---|---|
Message |
ProcessBuffer(DataBuffer, DatagramSocket, StreamSocket, ServerAddress, TransportAddress, out Int32)
Processes the buffer.
Declaration
protected virtual bool ProcessBuffer(DataBuffer buffer, DatagramSocket udpServerSocket, StreamSocket tcpServerSocket, ServerAddress localAddress, TransportAddress remoteAddress, out int readLength)
Parameters
Type | Name | Description |
---|---|---|
DataBuffer | buffer | The buffer. |
DatagramSocket | udpServerSocket | The UDP server socket. |
StreamSocket | tcpServerSocket | The TCP server socket. |
ServerAddress | localAddress | The local address. |
TransportAddress | remoteAddress | The remote address. |
System.Int32 | readLength | Length of the read. |
Returns
Type | Description |
---|---|
System.Boolean |
Start()
Starts the server.
Declaration
public bool Start()
Returns
Type | Description |
---|---|
System.Boolean |
Start(ServerAddress[])
Starts the server.
Declaration
public bool Start(ServerAddress[] udpAddresses)
Parameters
Type | Name | Description |
---|---|---|
ServerAddress[] | udpAddresses | The UDP addresses to listen on. |
Returns
Type | Description |
---|---|
System.Boolean |
Start(ServerAddress[], ServerAddress[])
Starts the server.
Declaration
public bool Start(ServerAddress[] udpAddresses, ServerAddress[] tcpAddresses)
Parameters
Type | Name | Description |
---|---|---|
ServerAddress[] | udpAddresses | The UDP addresses to listen on. |
ServerAddress[] | tcpAddresses | The TCP addresses to listen on. |
Returns
Type | Description |
---|---|
System.Boolean |
Start(ServerAddress[], ServerAddress[], ServerAddress[])
Starts the server.
Declaration
public virtual bool Start(ServerAddress[] udpAddresses, ServerAddress[] tcpAddresses, ServerAddress[] tlsAddresses)
Parameters
Type | Name | Description |
---|---|---|
ServerAddress[] | udpAddresses | The UDP addresses to listen on. |
ServerAddress[] | tcpAddresses | The TCP addresses to listen on. |
ServerAddress[] | tlsAddresses | The TLS addresses to listen on. |
Returns
Type | Description |
---|---|
System.Boolean |
Stop()
Stops the server.
Declaration
public virtual bool Stop()
Returns
Type | Description |
---|---|
System.Boolean |