capabilities.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * Copyright (C) by Roeland Jago Douma <roeland@famdouma.nl>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  11. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. * for more details.
  13. */
  14. #ifndef CAPABILITIES_H
  15. #define CAPABILITIES_H
  16. #include "owncloudlib.h"
  17. #include <QVariantMap>
  18. #include <QStringList>
  19. namespace OCC {
  20. /**
  21. * @brief The Capabilities class represents the capabilities of an ownCloud
  22. * server
  23. * @ingroup libsync
  24. */
  25. class OWNCLOUDSYNC_EXPORT Capabilities {
  26. public:
  27. Capabilities(const QVariantMap &capabilities);
  28. bool shareAPI() const;
  29. bool sharePublicLink() const;
  30. bool sharePublicLinkAllowUpload() const;
  31. bool sharePublicLinkEnforcePassword() const;
  32. bool sharePublicLinkEnforceExpireDate() const;
  33. int sharePublicLinkExpireDateDays() const;
  34. bool shareResharing() const;
  35. bool chunkingNg() const;
  36. /// disable parallel upload in chunking
  37. bool chunkingParallelUploadDisabled() const;
  38. /// returns true if the capabilities report notifications
  39. bool notificationsAvailable() const;
  40. /// returns true if the capabilities are loaded already.
  41. bool isValid() const;
  42. /**
  43. * Returns the checksum types the server understands.
  44. *
  45. * When the client uses one of these checksumming algorithms in
  46. * the OC-Checksum header of a file upload, the server will use
  47. * it to validate that data was transmitted correctly.
  48. *
  49. * Path: checksums/supportedTypes
  50. * Default: []
  51. * Possible entries: "Adler32", "MD5", "SHA1"
  52. */
  53. QList<QByteArray> supportedChecksumTypes() const;
  54. /**
  55. * The checksum algorithm that the server recommends for file uploads.
  56. * This is just a preference, any algorithm listed in supportedTypes may be used.
  57. *
  58. * Path: checksums/preferredUploadType
  59. * Default: empty, meaning "no preference"
  60. * Possible values: empty or any of the supportedTypes
  61. */
  62. QByteArray preferredUploadChecksumType() const;
  63. /**
  64. * Helper that returns the preferredUploadChecksumType() if set, or one
  65. * of the supportedChecksumTypes() if it isn't. May return an empty
  66. * QByteArray if no checksum types are supported.
  67. */
  68. QByteArray uploadChecksumType() const;
  69. /**
  70. * List of HTTP error codes should be guaranteed to eventually reset
  71. * failing chunked uploads.
  72. *
  73. * The resetting works by tracking UploadInfo::errorCount.
  74. *
  75. * Note that other error codes than the ones listed here may reset the
  76. * upload as well.
  77. *
  78. * Motivation: See #5344. They should always be reset on 412 (possibly
  79. * checksum error), but broken servers may also require resets on
  80. * unusual error codes such as 503.
  81. *
  82. * Path: dav/httpErrorCodesThatResetFailingChunkedUploads
  83. * Default: []
  84. * Example: [503, 500]
  85. */
  86. QList<int> httpErrorCodesThatResetFailingChunkedUploads() const;
  87. private:
  88. QVariantMap _capabilities;
  89. };
  90. }
  91. #endif //CAPABILITIES_H