socketserver

TCP/UDP Server Primitives

Functions

FunctionDescription
_srv_byte_atInternal byte reader.
_srv_copyInternal: copy bytes.
_srv_parse_intInternal: parse integer from bytes at offset, returns value.
srv_tcp_newCreate a TCP server handle.
srv_tcp_startStart listening (stub — returns -1, would use socket/bind/listen syscalls).
srv_tcp_acceptAccept a connection (stub — returns -1).
srv_parse_addrParse “host:port” string into a server handle.
srv_addr_portGet the port from a server handle.
srv_addr_host_lenGet the host length from a server handle.
srv_addr_hostCopy host string to output buffer. Returns length.

Details

_srv_byte_at

fn _srv_byte_at(buf: &i8, idx: i64) -> i64

Internal byte reader.

_srv_copy

fn _srv_copy(dst: &i8, doff: i64, src: &i8, soff: i64, len: i64) -> i64

Internal: copy bytes.

_srv_parse_int

fn _srv_parse_int(buf: &i8, off: i64, len: i64) -> i64

Internal: parse integer from bytes at offset, returns value.

srv_tcp_new

fn srv_tcp_new(port: i64, backlog: i64) -> &i64

Create a TCP server handle.

srv_tcp_start

fn srv_tcp_start(h: &i64) -> i64

Start listening (stub — returns -1, would use socket/bind/listen syscalls).

srv_tcp_accept

fn srv_tcp_accept(h: &i64) -> i64

Accept a connection (stub — returns -1).

srv_parse_addr

fn srv_parse_addr(buf: &i8, len: i64) -> &i64

Parse “host:port” string into a server handle.

srv_addr_port

fn srv_addr_port(h: &i64) -> i64

Get the port from a server handle.

srv_addr_host_len

fn srv_addr_host_len(h: &i64) -> i64

Get the host length from a server handle.

srv_addr_host

fn srv_addr_host(h: &i64, out: &i8) -> i64

Copy host string to output buffer. Returns length.