session.h 936 B

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