xref: /plan9/sys/src/liboventi/session.h (revision 368c31ab13393dea083228fdd1c3445076f83a4b)
1 typedef struct VtAuth VtAuth;
2 
3 /* op codes */
4 enum {
5 	VtRError = 1,
6 	VtQPing,
7 	VtRPing,
8 	VtQHello,
9 	VtRHello,
10 	VtQGoodbye,
11 	VtRGoodbye,	/* not used */
12 	VtQAuth0,
13 	VtRAuth0,
14 	VtQAuth1,
15 	VtRAuth1,
16 	VtQRead,
17 	VtRRead,
18 	VtQWrite,
19 	VtRWrite,
20 	VtQSync,
21 	VtRSync,
22 
23 	VtMaxOp
24 };
25 
26 /* connection state */
27 enum {
28 	VtStateAlloc,
29 	VtStateConnected,
30 	VtStateClosed,
31 };
32 
33 /* auth state */
34 enum {
35 	VtAuthHello,
36 	VtAuth0,
37 	VtAuth1,
38 	VtAuthOK,
39 	VtAuthFailed,
40 };
41 
42 struct VtAuth {
43 	int state;
44 	uchar client[VtScoreSize];
45 	uchar sever[VtScoreSize];
46 };
47 
48 struct VtSession {
49 	VtLock *lk;
50 	VtServerVtbl *vtbl;	/* == nil means client side */
51 	int cstate;		/* connection state */
52 	int fd;
53 	char fderror[ERRMAX];
54 
55 	VtAuth auth;
56 
57 	VtSha1 *inHash;
58 	VtLock *inLock;
59 	Packet *part;		/* partial packet */
60 
61 	VtSha1 *outHash;
62 	VtLock *outLock;
63 
64 	int debug;
65 	int version;
66 	int ref;
67 	char *uid;
68 	char *sid;
69 	int cryptoStrength;
70 	int compression;
71 	int crypto;
72 	int codec;
73 };
74 
75