session.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. typedef struct VtAuth VtAuth;
  10. /* op codes */
  11. enum {
  12. VtRError = 1,
  13. VtQPing,
  14. VtRPing,
  15. VtQHello,
  16. VtRHello,
  17. VtQGoodbye,
  18. VtRGoodbye, /* not used */
  19. VtQAuth0,
  20. VtRAuth0,
  21. VtQAuth1,
  22. VtRAuth1,
  23. VtQRead,
  24. VtRRead,
  25. VtQWrite,
  26. VtRWrite,
  27. VtQSync,
  28. VtRSync,
  29. VtMaxOp
  30. };
  31. /* connection state */
  32. enum {
  33. VtStateAlloc,
  34. VtStateConnected,
  35. VtStateClosed,
  36. };
  37. /* auth state */
  38. enum {
  39. VtAuthHello,
  40. VtAuth0,
  41. VtAuth1,
  42. VtAuthOK,
  43. VtAuthFailed,
  44. };
  45. struct VtAuth {
  46. int state;
  47. unsigned char client[VtScoreSize];
  48. unsigned char sever[VtScoreSize];
  49. };
  50. struct VtSession {
  51. VtLock *lk;
  52. VtServerVtbl *vtbl; /* == nil means client side */
  53. int cstate; /* connection state */
  54. int fd;
  55. char fderror[ERRMAX];
  56. VtAuth auth;
  57. VtSha1 *inHash;
  58. VtLock *inLock;
  59. Packet *part; /* partial packet */
  60. VtSha1 *outHash;
  61. VtLock *outLock;
  62. int debug;
  63. int version;
  64. int ref;
  65. char *uid;
  66. char *sid;
  67. int cryptoStrength;
  68. int compression;
  69. int crypto;
  70. int codec;
  71. };