summaryrefslogtreecommitdiff
path: root/sys/src/liboventi/session.h
blob: 8df857f4d6e705bab0c82f5d339c1df10aa93cdd (plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
typedef struct VtAuth VtAuth;

/* op codes */
enum {
	VtRError = 1,
	VtQPing,
	VtRPing,
	VtQHello,
	VtRHello,
	VtQGoodbye,
	VtRGoodbye,	/* not used */
	VtQAuth0,
	VtRAuth0,
	VtQAuth1,
	VtRAuth1,
	VtQRead,
	VtRRead,
	VtQWrite,
	VtRWrite,
	VtQSync,
	VtRSync,

	VtMaxOp
};

/* connection state */
enum {
	VtStateAlloc,
	VtStateConnected,
	VtStateClosed,
};

/* auth state */
enum {
	VtAuthHello,
	VtAuth0,
	VtAuth1,
	VtAuthOK,
	VtAuthFailed,
};

struct VtAuth {
	int state;
	uchar client[VtScoreSize];
	uchar sever[VtScoreSize];
};

struct VtSession {
	VtLock *lk;
	VtServerVtbl *vtbl;	/* == nil means client side */
	int cstate;		/* connection state */
	int fd;
	char fderror[ERRMAX];

	VtAuth auth;

	VtSha1 *inHash;
	VtLock *inLock;
	Packet *part;		/* partial packet */

	VtSha1 *outHash;
	VtLock *outLock;

	int debug;
	int version;
	int ref;
	char *uid;
	char *sid;
	int cryptoStrength;
	int compression;
	int crypto;
	int codec;
};