forked from bunny351/9pfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauth.h
51 lines (44 loc) · 1.02 KB
/
auth.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* Interface for typical callers.
*/
typedef struct AuthInfo AuthInfo;
typedef struct AuthRpc AuthRpc;
enum
{
ARok = 0, /* rpc return values */
ARdone,
ARerror,
ARneedkey,
ARbadkey,
ARwritenext,
ARtoosmall,
ARtoobig,
ARrpcfailure,
ARphase,
AuthRpcMax = 4096
};
struct AuthRpc
{
int afd;
char ibuf[AuthRpcMax+1];
char obuf[AuthRpcMax];
char *arg;
uint narg;
};
struct AuthInfo
{
char *cuid; /* caller id */
char *suid; /* server id */
char *cap; /* capability (only valid on server side) */
int nsecret; /* length of secret */
uchar *secret; /* secret */
};
typedef int AuthGetkey(char*);
extern AuthInfo* fauth_proxy(FFid*, AuthRpc *rpc, AuthGetkey *getkey, char *params);
extern AuthInfo* auth_proxy(FFid*, AuthGetkey *getkey, char *fmt, ...);
extern int auth_getkey(char*);
extern void auth_freeAI(AuthInfo *ai);
extern AuthInfo* auth_getinfo(AuthRpc *rpc);
extern AuthRpc* auth_allocrpc(int afd);
extern void auth_freerpc(AuthRpc *rpc);
extern uint auth_rpc(AuthRpc *rpc, char *verb, void *a, int n);