1Factotum: module 2{ 3 PATH: con "/dis/lib/factotum.dis"; 4 5 # client interface to Plan 9 or Inferno factotum 6 7 Authinfo: adt { 8 cuid: string; # caller id 9 suid: string; # server id 10 cap: string; # capability (only valid on server side) 11 secret: array of byte; 12 # TO DO: add attrs 13 14 unpack: fn(a: array of byte): (int, ref Authinfo); 15 read: fn(fd: ref Sys->FD): ref Authinfo; 16 }; 17 18 mount: fn(fd: ref Sys->FD, mnt: string, flags: int, aname: string, keyspec: string): (int, ref Authinfo); 19 20 # factotum interaction 21 AuthRpcMax: con 4096; 22 23 init: fn(); 24 open: fn(): ref Sys->FD; 25 rpc: fn(fd: ref Sys->FD, verb: string, a: array of byte): (string, array of byte); 26 proxy: fn(afd: ref Sys->FD, facfd: ref Sys->FD, arg: string): ref Authinfo; 27 genproxy: fn( 28 readc: chan of (array of byte, chan of (int, string)), 29 writec: chan of (array of byte, chan of (int, string)), 30 donec: chan of (ref Authinfo, string), 31 afd: ref Sys->FD, 32 params: string); 33 rpcattrs: fn(afd: ref Sys->FD): list of ref Attr; 34 35 getuserpasswd: fn(keyspec: string): (string, string); 36 37 # challenge/response 38 Challenge: adt { 39 user: string; 40 chal: string; 41 afd: ref Sys->FD; 42 }; 43 44 challenge: fn(keyspec: string): ref Challenge; 45 response: fn(c: ref Challenge, resp: string): ref Authinfo; 46 respond: fn(chal: string, keyspec: string): (string, string); 47 48 dump: fn(a: array of byte): string; 49 setdebug: fn(i: int); 50 51 Aattr, Aval, Aquery: con iota; 52 53 Attr: adt { 54 tag: int; 55 name: string; 56 val: string; 57 58 text: fn(a: self ref Attr): string; 59 }; 60 61 parseattrs: fn(s: string): list of ref Attr; 62 copyattrs: fn(l: list of ref Attr): list of ref Attr; 63 delattr: fn(l: list of ref Attr, n: string): list of ref Attr; 64 takeattrs: fn(l: list of ref Attr, names: list of string): list of ref Attr; 65 findattr: fn(l: list of ref Attr, n: string): ref Attr; 66 findattrval: fn(l: list of ref Attr, n: string): string; 67 publicattrs: fn(l: list of ref Attr): list of ref Attr; 68 attrtext: fn(l: list of ref Attr): string; 69}; 70