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.

221 lines
2.9 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 "tofrom_string.hpp"
  18. #include <string>
  19. #include <iostream>
  20. class Func : public ToFromString
  21. {
  22. public:
  23. Func(const Policy &policy_)
  24. : policy(&policy_)
  25. {
  26. }
  27. public:
  28. int from_string(const std::string &s);
  29. std::string to_string() const;
  30. public:
  31. const Policy *policy;
  32. };
  33. class FuncAccess : public Func
  34. {
  35. public:
  36. FuncAccess()
  37. : Func(Policy::ff)
  38. {
  39. }
  40. };
  41. class FuncChmod : public Func
  42. {
  43. public:
  44. FuncChmod()
  45. : Func(Policy::epall)
  46. {
  47. }
  48. };
  49. class FuncChown : public Func
  50. {
  51. public:
  52. FuncChown()
  53. : Func(Policy::epall)
  54. {
  55. }
  56. };
  57. class FuncCreate : public Func
  58. {
  59. public:
  60. FuncCreate()
  61. : Func(Policy::epmfs)
  62. {
  63. }
  64. };
  65. class FuncGetAttr : public Func
  66. {
  67. public:
  68. FuncGetAttr()
  69. : Func(Policy::ff)
  70. {
  71. }
  72. };
  73. class FuncGetXAttr : public Func
  74. {
  75. public:
  76. FuncGetXAttr()
  77. : Func(Policy::ff)
  78. {
  79. }
  80. };
  81. class FuncLink : public Func
  82. {
  83. public:
  84. FuncLink()
  85. : Func(Policy::epall)
  86. {
  87. }
  88. };
  89. class FuncListXAttr : public Func
  90. {
  91. public:
  92. FuncListXAttr()
  93. : Func(Policy::ff)
  94. {
  95. }
  96. };
  97. class FuncMkdir : public Func
  98. {
  99. public:
  100. FuncMkdir()
  101. : Func(Policy::epmfs)
  102. {
  103. }
  104. };
  105. class FuncMknod : public Func
  106. {
  107. public:
  108. FuncMknod()
  109. : Func(Policy::epmfs)
  110. {
  111. }
  112. };
  113. class FuncOpen : public Func
  114. {
  115. public:
  116. FuncOpen()
  117. : Func(Policy::ff)
  118. {
  119. }
  120. };
  121. class FuncReadlink : public Func
  122. {
  123. public:
  124. FuncReadlink()
  125. : Func(Policy::ff)
  126. {
  127. }
  128. };
  129. class FuncRemoveXAttr : public Func
  130. {
  131. public:
  132. FuncRemoveXAttr()
  133. : Func(Policy::epall)
  134. {
  135. }
  136. };
  137. class FuncRename : public Func
  138. {
  139. public:
  140. FuncRename()
  141. : Func(Policy::epall)
  142. {
  143. }
  144. };
  145. class FuncRmdir : public Func
  146. {
  147. public:
  148. FuncRmdir()
  149. : Func(Policy::epall)
  150. {
  151. }
  152. };
  153. class FuncSetXAttr : public Func
  154. {
  155. public:
  156. FuncSetXAttr()
  157. : Func(Policy::epall)
  158. {
  159. }
  160. };
  161. class FuncSymlink : public Func
  162. {
  163. public:
  164. FuncSymlink()
  165. : Func(Policy::epmfs)
  166. {
  167. }
  168. };
  169. class FuncTruncate : public Func
  170. {
  171. public:
  172. FuncTruncate()
  173. : Func(Policy::epall)
  174. {
  175. }
  176. };
  177. class FuncUnlink : public Func
  178. {
  179. public:
  180. FuncUnlink()
  181. : Func(Policy::epall)
  182. {
  183. }
  184. };
  185. class FuncUtimens : public Func
  186. {
  187. public:
  188. FuncUtimens()
  189. : Func(Policy::epall)
  190. {
  191. }
  192. };