smb_share.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. #ifndef __BDSM_SMB_SHARE_H_
  19. #define __BDSM_SMB_SHARE_H_
  20. #include "bdsm/smb_session.h"
  21. #include "bdsm/smb_file.h"
  22. /**
  23. * @file smb_share.h
  24. * @brief List and connect to SMB shares
  25. */
  26. /**
  27. * @brief List the existing share of this sessions's machine
  28. * @details This function makes a RPC to the machine this session is currently
  29. * authenticated to and list all the existing shares of this machines. The share
  30. * starting with a $ are supposed to be system/hidden share.
  31. *
  32. * @param[in] s The session object
  33. * @param[out] list A pointer to an opaque share_list object.
  34. *
  35. * @return The number of share listed or 0 if there was an error (There
  36. * theorically cannot be 0 share on a machine, there's at least $IPC)
  37. */
  38. size_t smb_share_get_list(smb_session *s, smb_share_list *list);
  39. /**
  40. * @brief Get the number of share in the list
  41. *
  42. * @param list An opaque share list returned by smb_share_list()
  43. * @return The number of share in the opaque share_list object
  44. */
  45. size_t smb_share_list_count(smb_share_list list);
  46. /**
  47. * @brief Get the name of the share in the list at the given index
  48. * @param list An opaque share list object
  49. * @param index The index of the returned item in the list
  50. *
  51. * @return The string has been decoded from UTF16 to you local encoding
  52. */
  53. const char *smb_share_list_at(smb_share_list list, size_t index);
  54. /**
  55. * @brief Destroy an opaque share list object
  56. *
  57. * @param list The list to destroy. The object is not usable anymore afterward,
  58. * you can set it to 'NULL'
  59. */
  60. void smb_share_list_destroy(smb_share_list list);
  61. /**
  62. * @brief Connects to a SMB share
  63. * @details Before being able to list/read files on a SMB file server, you have
  64. * to be connected to the share containing the files you want to read or
  65. * the directories you want to list
  66. *
  67. * @param s The session object
  68. * @param name The share name @see smb_share_list
  69. *
  70. * @return An opaque value representing an open share (like a file descriptor)
  71. * or 0 if there was an error
  72. */
  73. smb_tid smb_tree_connect(smb_session *s, const char *name);
  74. /**
  75. * @brief Disconnect from a share
  76. * @details UNIMPLEMENTED
  77. *
  78. * @return ?
  79. */
  80. int smb_tree_disconnect(smb_session *s, smb_tid tid);
  81. #endif