|
1 | 1 | namespace MLAPI.Data
|
2 | 2 | {
|
| 3 | + /// <summary> |
| 4 | + /// A UDP transport |
| 5 | + /// </summary> |
3 | 6 | public interface IUDPTransport
|
4 | 7 | {
|
| 8 | + /// <summary> |
| 9 | + /// The channelType the Internal library will use |
| 10 | + /// </summary> |
5 | 11 | ChannelType InternalChannel { get; }
|
| 12 | + /// <summary> |
| 13 | + /// The clientId to use when you want to send to the server from client |
| 14 | + /// </summary> |
6 | 15 | uint ServerNetId { get; }
|
| 16 | + /// <summary> |
| 17 | + /// A dummy clientId to represent the host client |
| 18 | + /// </summary> |
7 | 19 | uint HostDummyId { get; }
|
| 20 | + /// <summary> |
| 21 | + /// A invalid clientId to represent a clientId of server |
| 22 | + /// </summary> |
8 | 23 | uint InvalidDummyId { get; }
|
| 24 | + /// <summary> |
| 25 | + /// Queues a message for sending. |
| 26 | + /// </summary> |
| 27 | + /// <param name="clientId">The clientId to send to</param> |
| 28 | + /// <param name="dataBuffer">The buffer to read from</param> |
| 29 | + /// <param name="dataSize">The amount of data to send from the buffer</param> |
| 30 | + /// <param name="channelId">The channelId to send on</param> |
| 31 | + /// <param name="skipQueue">Wheter or not Send will have to be called for this message to be sent</param> |
| 32 | + /// <param name="error">Error byte. Does nothhing</param> |
9 | 33 | void QueueMessageForSending(uint clientId, ref byte[] dataBuffer, int dataSize, int channelId, bool skipQueue, out byte error);
|
| 34 | + /// <summary> |
| 35 | + /// Sends queued messages for a specific clientId |
| 36 | + /// </summary> |
| 37 | + /// <param name="clientId">The clientId to send</param> |
| 38 | + /// <param name="error">Error byte. Does nothhing</param> |
10 | 39 | void SendQueue(uint clientId, out byte error);
|
| 40 | + /// <summary> |
| 41 | + /// Polls for incomming events |
| 42 | + /// </summary> |
| 43 | + /// <param name="clientId">The clientId this event is for</param> |
| 44 | + /// <param name="channelId">The channelId this message comes from</param> |
| 45 | + /// <param name="data">The data buffer, if any</param> |
| 46 | + /// <param name="bufferSize">The size of the buffer</param> |
| 47 | + /// <param name="receivedSize">The amount of bytes we received</param> |
| 48 | + /// <param name="error">Error byte. Does nothhing</param> |
| 49 | + /// <returns>Returns the event type</returns> |
11 | 50 | NetEventType PollReceive(out uint clientId, out int channelId, ref byte[] data, int bufferSize, out int receivedSize, out byte error);
|
| 51 | + /// <summary> |
| 52 | + /// Adds a channel with a specific type |
| 53 | + /// </summary> |
| 54 | + /// <param name="type">The channelType</param> |
| 55 | + /// <param name="settings">The settings object used by the transport</param> |
| 56 | + /// <returns>Returns a unique id for the channel</returns> |
12 | 57 | int AddChannel(ChannelType type, object settings);
|
| 58 | + /// <summary> |
| 59 | + /// Connects client to server |
| 60 | + /// </summary> |
| 61 | + /// <param name="address">The address to connect to</param> |
| 62 | + /// <param name="port">The port to connect to</param> |
| 63 | + /// <param name="settings">The settings object to use for the transport</param> |
| 64 | + /// <param name="error">Error byte. Does nothhing</param> |
13 | 65 | void Connect(string address, int port, object settings, out byte error);
|
| 66 | + /// <summary> |
| 67 | + /// Starts to listen for incomming clients. |
| 68 | + /// </summary> |
| 69 | + /// <param name="settings">The settings object for the transport</param> |
14 | 70 | void RegisterServerListenSocket(object settings);
|
| 71 | + /// <summary> |
| 72 | + /// Disconnects a client from the server |
| 73 | + /// </summary> |
| 74 | + /// <param name="clientId">The clientId to disconnect</param> |
15 | 75 | void DisconnectClient(uint clientId);
|
| 76 | + /// <summary> |
| 77 | + /// Disconnects client from the server |
| 78 | + /// </summary> |
16 | 79 | void DisconnectFromServer();
|
| 80 | + /// <summary> |
| 81 | + /// Gets the round trip time for a specific client |
| 82 | + /// </summary> |
| 83 | + /// <param name="clientId">The clientId to get the rtt from</param> |
| 84 | + /// <param name="error">Error byte. Does nothhing</param> |
| 85 | + /// <returns>Returns the event type</returns> |
17 | 86 | int GetCurrentRTT(uint clientId, out byte error);
|
| 87 | + /// <summary> |
| 88 | + /// Gets a delay in miliseconds based on a timestamp |
| 89 | + /// </summary> |
| 90 | + /// <param name="clientId">The clientId to get the delay for</param> |
| 91 | + /// <param name="remoteTimestamp">The timestamp</param> |
| 92 | + /// <param name="error">Error byte. Does nothhing</param> |
| 93 | + /// <returns>Returns the delay in miliseconds</returns> |
18 | 94 | int GetRemoteDelayTimeMS(uint clientId, int remoteTimestamp, out byte error);
|
| 95 | + /// <summary> |
| 96 | + /// Gets a timestamp to be used for calculating latency |
| 97 | + /// </summary> |
| 98 | + /// <returns>The timestamp</returns> |
19 | 99 | int GetNetworkTimestamp();
|
| 100 | + /// <summary> |
| 101 | + /// Inits the transport and returns a settings object to be used for listening, connecting and registering channels |
| 102 | + /// </summary> |
| 103 | + /// <returns>The settings object</returns> |
20 | 104 | object GetSettings();
|
| 105 | + /// <summary> |
| 106 | + /// Shuts down the transport |
| 107 | + /// </summary> |
21 | 108 | void Shutdown();
|
22 | 109 | }
|
23 | 110 | }
|
0 commit comments