xref: /inferno-os/module/plumbmsg.m (revision 46439007cf417cbd9ac8049bb4122c890097a0fa)
1Plumbmsg: module
2{
3	PATH:	con "/dis/lib/plumbmsg.dis";
4
5	# Message format:
6	#	source application\n
7	#	destination application\n
8	#	working directory\n
9	#	type\n
10	#	properties\n
11	#	nbytes\n
12	#	n bytes
13
14	Msg: adt
15	{
16		src:		string;
17		dst:		string;
18		dir:		string;
19		kind:		string;
20		attr:		string;
21		data:		array of byte;
22
23		# used by applications
24		send: 	fn(msg: self ref Msg): int;
25		recv: 	fn(): ref Msg;
26
27		# used by plumb and send, recv
28		pack: 	fn(msg: self ref Msg): array of byte;
29		unpack: 	fn(b: array of byte): ref Msg;
30	};
31
32	Attr: adt
33	{
34		name:	string;
35		val:		string;
36	};
37
38	init:	fn(doinput: int, rcvport: string, maxdata: int): int;
39	shutdown:	fn();
40
41	string2attrs:	fn(s: string): list of ref Attr;
42	attrs2string:	fn(l: list of ref Attr): string;
43	lookup:	fn(attrs: list of ref Attr, name: string): (int, string);
44};
45