ResolveResult :: struct {
family: SocketFamily
type: SocketType
proto: SocketProto
addr: SocketAddress
}
Socket :: struct {
stream: Stream
handle: SocketData
type: SocketType
family: SocketFamily
proto: SocketProto
alive: bool
}
Socket.accept :: (s: &Socket) -> Result(SocketAcceptResult, Error)
Socket.bind :: (s: &Socket, bind_address: &SocketAddress) -> bool
Socket.close :: (s: &Socket) -> void
Socket.connect :: (s: &Socket, addr: &SocketAddress) -> Error
Socket.is_alive :: (s: &Socket) -> bool
Socket.listen :: (s: &Socket, backlog: i32) -> bool
Socket.option :: (s: &Socket, setting: SocketOption, flag: bool) -> void
Socket.poll :: (socket: &Socket, timeout: i32) -> Socket_Poll_Status
Socket.recv :: (s: &Socket, maxlen: i32, allocator: Allocator) -> ? [] u8
Socket.recv_into :: (s: &Socket, buffer: [] u8) -> i32
Socket.recvfrom :: (s: &Socket, buffer: [] u8) -> ? SocketRecvFromResult
Socket.send :: (s: &Socket, data: [] u8) -> i32
Socket.sendall :: (s: &Socket, data: [] u8) -> void
Socket.sendto :: (s: &Socket, data: [] u8, addr: &SocketAddress) -> i32
Socket.shutdown :: (s: &Socket, how: SocketShutdown) -> Error
SocketAcceptResult :: struct {
socket: Socket
addr: SocketAddress
}
SocketRecvFromResult :: struct {
addr: SocketAddress
count: i32
}
TCP_Client :: struct {
connection: TCP_Connection
}
TCP_Connection :: struct {
socket: Socket
event_allocator: Allocator
events: [..] TCP_Event
event_cursor: i32
}
TCP_Connection.iter_close :: (conn: &TCP_Connection) -> void
TCP_Connection.iter_next :: (conn: &TCP_Connection) -> ? TCP_Event
TCP_Connection.iter_open :: (conn: &TCP_Connection) -> void
TCP_Event :: struct {
kind: TCP_Event.Kind
data: rawptr
}
TCP_Server :: struct {
connection: TCP_Connection
clients: [] ? Client
client_count: u32
alive: bool
pulse_time_ms: i32
emit_data_events: bool
emit_ready_event_multiple_times: bool
}
TCP_Server.broadcast :: (server: &TCP_Server, data: [] u8, except: &Client) -> void
TCP_Server.event_iter :: (server: &TCP_Server) -> Iterator(TCP_Event)
TCP_Server.handle_events :: macro (server: &TCP_Server, handler: Code) -> void
TCP_Server.kill_client :: (server: &TCP_Server, client: &Client) -> void
TCP_Server.listen :: (server: &TCP_Server, port: u16) -> bool
TCP_Server.pulse :: (server: &TCP_Server) -> bool
TCP_Server.send :: (server: &TCP_Server, client: &Client, data: [] u8) -> void
TCP_Server.stop :: (server: &TCP_Server) -> void
TCP_Server.transfer_client :: (server: &TCP_Server, client: &Client, other_server: &TCP_Server) -> ? Client
SocketFamily :: enum {
Unknown :: 0
Inet :: 1
Inet6 :: 2
Unix :: 3
}
SocketOption :: enum {
NonBlocking :: 1
Broadcast :: 2
ReuseAddress :: 3
}
SocketProto :: enum {
ANY :: 0
IP :: 0
ICMP :: 1
IGMP :: 2
TCP :: 6
UDP :: 17
IPV6 :: 41
}
SocketShutdown :: enum {
Read :: 0
Write :: 1
ReadWrite :: 2
}
SocketStatus :: enum {
Unknown :: 0
Opening :: 1
Open :: 2
Closed :: 3
Errored :: 4
}
SocketType :: enum {
Stream :: 0
Dgram :: 1
}
Socket_Poll_Status :: enum {
No_Change :: 0
Readable :: 1
Closed :: 2
}
SocketAddress :: union {
Unix: [256] u8
Inet:
Inet6:
HostPort:
}
SocketAddress.addr_as_str :: (this: &SocketAddress, allocator: Allocator) -> [] u8
dial :: (host: [] u8, port: u16, type: SocketType) -> Result(Socket, Error)
ipv4_to_str :: (addr: u32) -> [] u8
ipv6_to_str :: (addr: [16] u8) -> [] u8
make_ipv4_address :: (addr: [] u8, port: u16) -> SocketAddress
make_ipv4_address :: (out: &SocketAddress, addr: [] u8, port: u16) -> void
make_unix_address :: (out: &SocketAddress, path: [] u8) -> void
resolve :: (host: [] u8, port: u16, max_results: i32) -> [] ResolveResult
socket_accept :: (s: &Socket) -> Result(SocketAcceptResult, Error)
socket_bind :: (s: &Socket, bind_address: &SocketAddress) -> bool
socket_close :: (s: &Socket) -> void
socket_connect :: (s: &Socket, addr: &SocketAddress) -> Error
socket_create :: (family: SocketFamily, type: SocketType, proto: SocketProto) -> Result(Socket, Error)
socket_from_fd :: (fd: SocketData) -> Socket
socket_is_alive :: (s: &Socket) -> bool
socket_listen :: (s: &Socket, backlog: i32) -> bool
socket_option :: (s: &Socket, setting: SocketOption, flag: bool) -> void
socket_poll :: (socket: &Socket, timeout: i32) -> Socket_Poll_Status
socket_poll_all :: (sockets: [] &Socket, stat_buff: [] Socket_Poll_Status, timeout: i32) -> void
socket_recv :: (s: &Socket, maxlen: i32, allocator: Allocator) -> ? [] u8
socket_recv_into :: (s: &Socket, buffer: [] u8) -> i32
socket_recvfrom :: (s: &Socket, buffer: [] u8) -> ? SocketRecvFromResult
socket_send :: (s: &Socket, data: [] u8) -> i32
socket_sendall :: (s: &Socket, data: [] u8) -> void
socket_sendto :: (s: &Socket, data: [] u8, addr: &SocketAddress) -> i32
socket_shutdown :: (s: &Socket, how: SocketShutdown) -> Error
str_to_ipv4 :: (ip: [] u8) -> u32
tcp_server_broadcast :: (server: &TCP_Server, data: [] u8, except: &Client) -> void
tcp_server_event_iter :: (server: &TCP_Server) -> Iterator(TCP_Event)
tcp_server_handle_events :: macro (server: &TCP_Server, handler: Code) -> void
tcp_server_kill_client :: (server: &TCP_Server, client: &Client) -> void
tcp_server_listen :: (server: &TCP_Server, port: u16) -> bool
tcp_server_make :: (max_clients: i32, allocator: Allocator) -> &TCP_Server
tcp_server_pulse :: (server: &TCP_Server) -> bool
tcp_server_send :: (server: &TCP_Server, client: &Client, data: [] u8) -> void
tcp_server_stop :: (server: &TCP_Server) -> void
tcp_server_transfer_client :: (server: &TCP_Server, client: &Client, other_server: &TCP_Server) -> ? Client