23 lines
782 B
Kotlin
23 lines
782 B
Kotlin
package fr.acinq.lightning.vsock
|
|
|
|
import fr.acinq.lightning.vsock.native.VSockImpl
|
|
|
|
actual object VSockImplLib {
|
|
actual fun loadLibrary() {
|
|
val libsPath = System.getenv("LIBS_PATH")
|
|
?: throw IllegalStateException("LIBS_PATH environment variable not set")
|
|
|
|
val libPath = "$libsPath/libjniVSockImpl.so"
|
|
System.load(libPath)
|
|
}
|
|
|
|
actual external fun socketCreate()
|
|
actual external fun connect(address: VSockAddress)
|
|
actual external fun close()
|
|
actual external fun write(b: ByteArray, off: Int, len: Int)
|
|
actual external fun read(b: ByteArray, off: Int, len: Int): Int
|
|
actual external fun bind(address: VSockAddress)
|
|
actual external fun listen(backlog: Int)
|
|
actual external fun accept(peerVSock: VSockImplLib)
|
|
}
|