summaryrefslogtreecommitdiff
path: root/src/main/kotlin/NinePConnection.kt
blob: 8514ffdc63637cb6a832655d44f4c8c4a4dfa441 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.io.IOException

/**
 * This class represents a 9P connection. It provides a practical implementation with networking to the 9P methods
 * described in [NinePTranslator]. Details about methods related to 9P can be found in [NinePTranslator]. Remember to
 * disconnect using [disconnect] after use.
 *
 * Details about network-related topics can be found in [NetworkPacketTransporter] and the implementation of choice.
 *
 * Details about 9P messages and methods can be found in [NinePTranslator].
 *
 * @param netPackTrans The networking API backend of choice.
 *
 * @throws UnresolvableHostException if the host resolution made by [netPackTrans] failed.
 */
class NinePConnection(netPackTrans: NetworkPacketTransporter) : NinePTranslator {
    /**
     * Networking API.
     */
    val npt: NetworkPacketTransporter = netPackTrans

    /**
     * Disconnect from the remote host,
     *
     * @throws IOException if an I/O error occurred while closing the socket.
     */
    fun disconnect() {
        this.npt.close()
    }

    // TODO: implement methods from NinePTranslator
}