Archived
3
0

adding switch functions

This commit is contained in:
Karchnu 2020-07-08 16:49:09 +02:00
parent 58ec731530
commit 50107123ea

View File

@ -4,9 +4,10 @@ lib LibIPC
INFTIM = -1 INFTIM = -1
enum ConnectionType enum ConnectionType
IPC IPC # IO op. are handled by libipc.
External External # IO op. are handled by the libipc user app.
Server Server # Should listen and accept new IPC users.
Switched # IO op. are handled by callbacks.
end end
struct Connection struct Connection
@ -88,6 +89,7 @@ lib LibIPC
# Context is allocated, ipcd is requested and the connection/initialisation is performed. # Context is allocated, ipcd is requested and the connection/initialisation is performed.
fun ipc_server_init(ctx : Ctx*, sname : LibC::Char*) : IPCError fun ipc_server_init(ctx : Ctx*, sname : LibC::Char*) : IPCError
fun ipc_connection(Ctx*, LibC::Char*) : IPCError fun ipc_connection(Ctx*, LibC::Char*) : IPCError
fun ipc_connection_switched(Ctx*, LibC::Char*) : IPCError
# Closing connections. # Closing connections.
fun ipc_close(ctx : Ctx*, index : LibC::UInt64T) : IPCError fun ipc_close(ctx : Ctx*, index : LibC::UInt64T) : IPCError
@ -102,6 +104,7 @@ lib LibIPC
fun ipc_add(Ctx*, Connection*, Pollfd*) : IPCError fun ipc_add(Ctx*, Connection*, Pollfd*) : IPCError
fun ipc_del(Ctx*, LibC::UInt) : IPCError fun ipc_del(Ctx*, LibC::UInt) : IPCError
fun ipc_add_fd(Ctx*, LibC::Int) : IPCError fun ipc_add_fd(Ctx*, LibC::Int) : IPCError
fun ipc_add_fd_switched(Ctx*, LibC::Int) : IPCError
fun ipc_del_fd(Ctx*, LibC::Int) : IPCError fun ipc_del_fd(Ctx*, LibC::Int) : IPCError
# Sending a message (will wait the fd to become available for IO operations). # Sending a message (will wait the fd to become available for IO operations).
@ -115,6 +118,24 @@ lib LibIPC
fun ipc_receive_fd (sock : LibC::Int, fd : LibC::Int*) : IPCError fun ipc_receive_fd (sock : LibC::Int, fd : LibC::Int*) : IPCError
fun ipc_provide_fd (sock : LibC::Int, fd : LibC::Int ) : IPCError fun ipc_provide_fd (sock : LibC::Int, fd : LibC::Int ) : IPCError
# To change the type of a fd.
fun ipc_ctx_fd_type(Ctx*, LibC::Int, LibIPC::ConnectionType) : IPCError
enum IPCCB
NoError #
Closing #
Error #
ParsingError #
end
# Changing the callbacks for switched fd.
# ipc_switching_callbacks: ctx, fd
# , enum ipccb cb_in (fd, *ipc_message)
# , enum ipccb cb_out (fd, *ipc_message)
fun ipc_switching_callbacks(Ctx*, LibC::Int,
cb_in : (LibC::Int, Pointer(LibIPC::Message)) -> LibIPC::IPCCB,
cb_out : (LibC::Int, Pointer(LibIPC::Message)) -> LibIPC::IPCCB) : IPCError
fun ipc_switching_add (switch : Switchings*, fd1 : LibC::Int, fd2 : LibC::Int) # Void fun ipc_switching_add (switch : Switchings*, fd1 : LibC::Int, fd2 : LibC::Int) # Void
fun ipc_switching_del (switch : Switchings*, fd : LibC::Int ) : LibC::Int fun ipc_switching_del (switch : Switchings*, fd : LibC::Int ) : LibC::Int
fun ipc_switching_get (switch : Switchings*, fd : LibC::Int ) : LibC::Int fun ipc_switching_get (switch : Switchings*, fd : LibC::Int ) : LibC::Int