smb.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * smb.h
  3. *
  4. * Copyright (C) 1995, 1996 by Paal-Kr. Engstad and Volker Lendecke
  5. * Copyright (C) 1997 by Volker Lendecke
  6. *
  7. */
  8. #ifndef _LINUX_SMB_H
  9. #define _LINUX_SMB_H
  10. #include <linux/types.h>
  11. #include <linux/magic.h>
  12. enum smb_protocol {
  13. SMB_PROTOCOL_NONE,
  14. SMB_PROTOCOL_CORE,
  15. SMB_PROTOCOL_COREPLUS,
  16. SMB_PROTOCOL_LANMAN1,
  17. SMB_PROTOCOL_LANMAN2,
  18. SMB_PROTOCOL_NT1
  19. };
  20. enum smb_case_hndl {
  21. SMB_CASE_DEFAULT,
  22. SMB_CASE_LOWER,
  23. SMB_CASE_UPPER
  24. };
  25. struct smb_dskattr {
  26. __u16 total;
  27. __u16 allocblocks;
  28. __u16 blocksize;
  29. __u16 free;
  30. };
  31. struct smb_conn_opt {
  32. /* The socket */
  33. unsigned int fd;
  34. enum smb_protocol protocol;
  35. enum smb_case_hndl case_handling;
  36. /* Connection-Options */
  37. __u32 max_xmit;
  38. __u16 server_uid;
  39. __u16 tid;
  40. /* The following are LANMAN 1.0 options */
  41. __u16 secmode;
  42. __u16 maxmux;
  43. __u16 maxvcs;
  44. __u16 rawmode;
  45. __u32 sesskey;
  46. /* The following are NT LM 0.12 options */
  47. __u32 maxraw;
  48. __u32 capabilities;
  49. __s16 serverzone;
  50. };
  51. #ifdef __KERNEL__
  52. #define SMB_NLS_MAXNAMELEN 20
  53. struct smb_nls_codepage {
  54. char local_name[SMB_NLS_MAXNAMELEN];
  55. char remote_name[SMB_NLS_MAXNAMELEN];
  56. };
  57. #define SMB_MAXNAMELEN 255
  58. #define SMB_MAXPATHLEN 1024
  59. /*
  60. * Contains all relevant data on a SMB networked file.
  61. */
  62. struct smb_fattr {
  63. __u16 attr;
  64. unsigned long f_ino;
  65. umode_t f_mode;
  66. nlink_t f_nlink;
  67. uid_t f_uid;
  68. gid_t f_gid;
  69. dev_t f_rdev;
  70. loff_t f_size;
  71. struct timespec f_atime;
  72. struct timespec f_mtime;
  73. struct timespec f_ctime;
  74. unsigned long f_blksize;
  75. unsigned long f_blocks;
  76. int f_unix;
  77. };
  78. enum smb_conn_state {
  79. CONN_VALID, /* everything's fine */
  80. CONN_INVALID, /* Something went wrong, but did not
  81. try to reconnect yet. */
  82. CONN_RETRIED, /* Tried a reconnection, but was refused */
  83. CONN_RETRYING /* Currently trying to reconnect */
  84. };
  85. #define SMB_HEADER_LEN 37 /* includes everything up to, but not
  86. * including smb_bcc */
  87. #define SMB_INITIAL_PACKET_SIZE 4000
  88. #define SMB_MAX_PACKET_SIZE 32768
  89. /* reserve this much space for trans2 parameters. Shouldn't have to be more
  90. than 10 or so, but OS/2 seems happier like this. */
  91. #define SMB_TRANS2_MAX_PARAM 64
  92. #endif
  93. #endif