You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

184 lines
3.4 KiB

  1. /*
  2. ISC License
  3. Copyright (c) 2019, Antonio SJ Musumeci <trapexit@spawn.link>
  4. Permission to use, copy, modify, and/or distribute this software for any
  5. purpose with or without fee is hereby granted, provided that the above
  6. copyright notice and this permission notice appear in all copies.
  7. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  8. WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  9. MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  10. ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  11. WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  12. ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  13. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  14. */
  15. #pragma once
  16. #include "policy.hpp"
  17. #include "policies.hpp"
  18. #include "tofrom_string.hpp"
  19. #include <string>
  20. namespace Func
  21. {
  22. namespace Base
  23. {
  24. class Action : public ToFromString
  25. {
  26. public:
  27. Action(Policy::ActionImpl *policy_)
  28. : policy(policy_)
  29. {}
  30. public:
  31. int from_string(const std::string &s) final;
  32. std::string to_string() const final;
  33. public:
  34. Policy::Action policy;
  35. };
  36. class Create : public ToFromString
  37. {
  38. public:
  39. Create(Policy::CreateImpl *policy_)
  40. : policy(policy_)
  41. {}
  42. public:
  43. int from_string(const std::string &s) final;
  44. std::string to_string() const final;
  45. public:
  46. Policy::Create policy;
  47. };
  48. class Search : public ToFromString
  49. {
  50. public:
  51. Search(Policy::SearchImpl *policy_)
  52. : policy(policy_)
  53. {}
  54. public:
  55. int from_string(const std::string &s) final;
  56. std::string to_string() const final;
  57. public:
  58. Policy::Search policy;
  59. };
  60. class ActionDefault : public Action
  61. {
  62. public:
  63. ActionDefault()
  64. : Func::Base::Action(&Policies::Action::epall)
  65. {
  66. }
  67. };
  68. class CreateDefault : public Create
  69. {
  70. public:
  71. CreateDefault()
  72. : Func::Base::Create(&Policies::Create::epmfs)
  73. {
  74. }
  75. };
  76. class SearchDefault : public Search
  77. {
  78. public:
  79. SearchDefault()
  80. : Func::Base::Search(&Policies::Search::ff)
  81. {
  82. }
  83. };
  84. }
  85. class Access final : public Base::SearchDefault
  86. {
  87. };
  88. class Chmod final : public Base::ActionDefault
  89. {
  90. };
  91. class Chown final : public Base::ActionDefault
  92. {
  93. };
  94. class Create final : public Base::CreateDefault
  95. {
  96. };
  97. class GetAttr final : public Base::SearchDefault
  98. {
  99. };
  100. class GetXAttr final : public Base::SearchDefault
  101. {
  102. };
  103. class Link final : public Base::ActionDefault
  104. {
  105. };
  106. class ListXAttr final : public Base::SearchDefault
  107. {
  108. };
  109. class Mkdir final : public Base::CreateDefault
  110. {
  111. };
  112. class Mknod final : public Base::CreateDefault
  113. {
  114. };
  115. class Open final : public Base::SearchDefault
  116. {
  117. };
  118. class Readlink final : public Base::SearchDefault
  119. {
  120. };
  121. class RemoveXAttr final : public Base::ActionDefault
  122. {
  123. };
  124. class Rename final : public Base::ActionDefault
  125. {
  126. };
  127. class Rmdir final : public Base::ActionDefault
  128. {
  129. };
  130. class SetXAttr final : public Base::ActionDefault
  131. {
  132. };
  133. class Symlink final : public Base::CreateDefault
  134. {
  135. };
  136. class Truncate final : public Base::ActionDefault
  137. {
  138. };
  139. class Unlink final : public Base::ActionDefault
  140. {
  141. };
  142. class Utimens final : public Base::ActionDefault
  143. {
  144. };
  145. }