smb.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. enum smb_protocol {
  12. SMB_PROTOCOL_NONE,
  13. SMB_PROTOCOL_CORE,
  14. SMB_PROTOCOL_COREPLUS,
  15. SMB_PROTOCOL_LANMAN1,
  16. SMB_PROTOCOL_LANMAN2,
  17. SMB_PROTOCOL_NT1
  18. };
  19. enum smb_case_hndl {
  20. SMB_CASE_DEFAULT,
  21. SMB_CASE_LOWER,
  22. SMB_CASE_UPPER
  23. };
  24. struct smb_dskattr {
  25. __u16 total;
  26. __u16 allocblocks;
  27. __u16 blocksize;
  28. __u16 free;
  29. };
  30. struct smb_conn_opt {
  31. /* The socket */
  32. unsigned int fd;
  33. enum smb_protocol protocol;
  34. enum smb_case_hndl case_handling;
  35. /* Connection-Options */
  36. __u32 max_xmit;
  37. __u16 server_uid;
  38. __u16 tid;
  39. /* The following are LANMAN 1.0 options */
  40. __u16 secmode;
  41. __u16 maxmux;
  42. __u16 maxvcs;
  43. __u16 rawmode;
  44. __u32 sesskey;
  45. /* The following are NT LM 0.12 options */
  46. __u32 maxraw;
  47. __u32 capabilities;
  48. __s16 serverzone;
  49. };
  50. #ifdef __KERNEL__
  51. #define SMB_NLS_MAXNAMELEN 20
  52. struct smb_nls_codepage {
  53. char local_name[SMB_NLS_MAXNAMELEN];
  54. char remote_name[SMB_NLS_MAXNAMELEN];
  55. };
  56. #define SMB_MAXNAMELEN 255
  57. #define SMB_MAXPATHLEN 1024
  58. /*
  59. * Contains all relevant data on a SMB networked file.
  60. */
  61. struct smb_fattr {
  62. __u16 attr;
  63. unsigned long f_ino;
  64. umode_t f_mode;
  65. nlink_t f_nlink;
  66. uid_t f_uid;
  67. gid_t f_gid;
  68. dev_t f_rdev;
  69. loff_t f_size;
  70. struct timespec f_atime;
  71. struct timespec f_mtime;
  72. struct timespec f_ctime;
  73. unsigned long f_blksize;
  74. unsigned long f_blocks;
  75. int f_unix;
  76. };
  77. enum smb_conn_state {
  78. CONN_VALID, /* everything's fine */
  79. CONN_INVALID, /* Something went wrong, but did not
  80. try to reconnect yet. */
  81. CONN_RETRIED, /* Tried a reconnection, but was refused */
  82. CONN_RETRYING /* Currently trying to reconnect */
  83. };
  84. #define SMB_SUPER_MAGIC 0x517B
  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