xref: /inferno-os/module/msgio.m (revision a182ad059370106bdb7caf521599e39612bfc7cf)
1*a182ad05SCharles.ForsythMsgio: module
2*a182ad05SCharles.Forsyth{
3*a182ad05SCharles.Forsyth	PATH:	con "/dis/lib/msgio.dis";
4*a182ad05SCharles.Forsyth
5*a182ad05SCharles.Forsyth	init:	fn();
6*a182ad05SCharles.Forsyth
7*a182ad05SCharles.Forsyth	Maxmsg: con 4096;
8*a182ad05SCharles.Forsyth
9*a182ad05SCharles.Forsyth	# message io on a delimited connection (ssl for example)
10*a182ad05SCharles.Forsyth	#  messages >= Maxmsg bytes are truncated
11*a182ad05SCharles.Forsyth	#  errors > 64 bytes are truncated
12*a182ad05SCharles.Forsyth	# getstring and getbytearray return (result, error).
13*a182ad05SCharles.Forsyth	getstring: fn(fd: ref Sys->FD): (string, string);
14*a182ad05SCharles.Forsyth	putstring: fn(fd: ref Sys->FD, s: string): int;
15*a182ad05SCharles.Forsyth	getbytearray: fn(fd: ref Sys->FD): (array of byte, string);
16*a182ad05SCharles.Forsyth	putbytearray: fn(fd: ref Sys->FD, a: array of byte, n: int): int;
17*a182ad05SCharles.Forsyth	puterror: fn(fd: ref Sys->FD, s: string): int;
18*a182ad05SCharles.Forsyth
19*a182ad05SCharles.Forsyth	# to send and receive messages when ssl isn't pushed
20*a182ad05SCharles.Forsyth	getmsg: fn(fd: ref Sys->FD): array of byte;
21*a182ad05SCharles.Forsyth	sendmsg: fn(fd: ref Sys->FD, buf: array of byte, n: int): int;
22*a182ad05SCharles.Forsyth	senderrmsg: fn(fd: ref Sys->FD, s: string): int;
23*a182ad05SCharles.Forsyth};
24