xref: /inferno-os/module/registries.m (revision 46439007cf417cbd9ac8049bb4122c890097a0fa)
1*46439007SCharles.ForsythRegistries: module {
2*46439007SCharles.Forsyth	PATH:	con "/dis/lib/registries.dis";
3*46439007SCharles.Forsyth	init:			fn();
4*46439007SCharles.Forsyth
5*46439007SCharles.Forsyth	Attributes: adt {
6*46439007SCharles.Forsyth		attrs: list of (string, string);
7*46439007SCharles.Forsyth
8*46439007SCharles.Forsyth		get:	fn(a: self ref Attributes, attr: string): string;
9*46439007SCharles.Forsyth		set:	fn(a: self ref Attributes, attr, val: string);
10*46439007SCharles.Forsyth		new:	fn(attrs: list of (string, string)): ref Attributes;
11*46439007SCharles.Forsyth	};
12*46439007SCharles.Forsyth
13*46439007SCharles.Forsyth	Attached: adt {
14*46439007SCharles.Forsyth		fd:			ref Sys->FD;
15*46439007SCharles.Forsyth		signerpkhash:	string;
16*46439007SCharles.Forsyth		localuser:		string;
17*46439007SCharles.Forsyth		remoteuser:	string;
18*46439007SCharles.Forsyth	};
19*46439007SCharles.Forsyth
20*46439007SCharles.Forsyth	Service: adt {
21*46439007SCharles.Forsyth		addr: string;			# dial this to connect to the service.
22*46439007SCharles.Forsyth		attrs: ref Attributes;		# information about the nature of the service.
23*46439007SCharles.Forsyth
24*46439007SCharles.Forsyth		attach:	fn(s: self ref Service, user: string, keydir: string): ref Attached;
25*46439007SCharles.Forsyth	};
26*46439007SCharles.Forsyth
27*46439007SCharles.Forsyth	Registered: adt {
28*46439007SCharles.Forsyth		addr:	string;
29*46439007SCharles.Forsyth		reg:		ref Registry;
30*46439007SCharles.Forsyth		fd:		ref Sys->FD;
31*46439007SCharles.Forsyth	};
32*46439007SCharles.Forsyth
33*46439007SCharles.Forsyth	Registry: adt {
34*46439007SCharles.Forsyth		dir:		string;
35*46439007SCharles.Forsyth		indexfd:	ref Sys->FD;
36*46439007SCharles.Forsyth
37*46439007SCharles.Forsyth		new:		fn(dir: string): ref Registry;
38*46439007SCharles.Forsyth		connect:	fn(svc: ref Service, user: string, keydir: string): ref Registry;
39*46439007SCharles.Forsyth		services:	fn(r: self ref Registry): (list of ref Service, string);
40*46439007SCharles.Forsyth		find:		fn(r: self ref Registry, a: list of (string, string)): (list of ref Service, string);
41*46439007SCharles.Forsyth		register:	fn(r: self ref Registry, addr: string, attrs: ref Attributes, persist: int): (ref Registered, string);
42*46439007SCharles.Forsyth		unregister:	fn(r: self ref Registry, addr: string): string;
43*46439007SCharles.Forsyth	};
44*46439007SCharles.Forsyth};
45