smb_types.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //---------------------------------------------------------------------------
  2. // __________________ _________ _____ _____ .__ ._.
  3. // \______ \______ \ / _____/ / \ / _ \ |__| ____ | |
  4. // | | _/| | \ \_____ \ / \ / \ / /_\ \| _/ __ \ | |
  5. // | | \| ` \/ / Y \ / | | \ ___/ \|
  6. // |______ /_______ /_______ \____|__ / /\ \____|__ |__|\___ | __
  7. // \/ \/ \/ \/ )/ \/ \/ \/
  8. //
  9. // This file is part of libdsm. Copyright © 2014 VideoLabs SAS
  10. //
  11. // Author: Julien 'Lta' BALLET <contact@lta.io>
  12. //
  13. // This program is free software. It comes without any warranty, to the extent
  14. // permitted by applicable law. You can redistribute it and/or modify it under
  15. // the terms of the Do What The Fuck You Want To Public License, Version 2, as
  16. // published by Sam Hocevar. See the COPYING file for more details.
  17. //----------------------------------------------------------------------------
  18. /**
  19. * @file smb_types.h
  20. * @brief liBDSM types and structures
  21. */
  22. #ifndef __BDSM_SMB_TYPES_H_
  23. #define __BDSM_SMB_TYPES_H_
  24. #include <netinet/ip.h>
  25. #include <stddef.h>
  26. #include <libtasn1.h>
  27. #include <stdbool.h>
  28. /**
  29. * @struct smb_tid
  30. * @brief The id of a connection to a share within a session.
  31. */
  32. typedef uint16_t smb_tid;
  33. /**
  34. * @struct smb_fid
  35. * @brief The id of a file within a share within a session.
  36. */
  37. typedef uint16_t smb_fid;
  38. // Concatenation of the two above, representing a file inside of a session
  39. // First 4 bytes are the TreeID (smb_tid), last 4 are the File ID (FUID)
  40. // A map between smb_fd and smb_file is maintained inside each session
  41. /** @struct smb_fd
  42. * @brief SMB File descriptor, represents a file within a session.
  43. */
  44. typedef uint32_t smb_fd;
  45. // An structure to store user credentials;
  46. // login:password@domain (also DOMAIN\login)
  47. typedef struct
  48. {
  49. char *domain;
  50. char *login;
  51. char *password;
  52. } smb_creds;
  53. /**
  54. * @brief An opaque data structure to represent a SMB Session.
  55. */
  56. typedef struct smb_session smb_session;
  57. /**
  58. * @struct smb_share_list
  59. * @brief An opaque object representing the list of share of a SMB file server.
  60. */
  61. typedef char **smb_share_list;
  62. /**
  63. * @brief An opaque data structure to represent file
  64. */
  65. typedef struct smb_file smb_file;
  66. /**
  67. * @struct smb_stat_list
  68. * @brief An opaque structure containing a list of file status
  69. */
  70. typedef smb_file *smb_stat_list;
  71. /**
  72. * @struct smb_stat
  73. * @brief An opaque structure containing info about a file
  74. */
  75. typedef smb_file *smb_stat;
  76. #endif