// // This code is generated by csbindgen. // DON'T CHANGE THIS DIRECTLY. // #pragma warning disable CS8500 #pragma warning disable CS8981 using System; using System.Runtime.InteropServices; namespace RegorusFFI { internal static unsafe partial class API { const string __DllName = "regorusc"; /// Drop a `RegorusResult`. `output` and `error_message` strings are not valid after drop. [DllImport(__DllName, EntryPoint = "regorus_result_drop", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void regorus_result_drop(RegorusResult r); /// Construct a new Engine See https://docs.rs/regorus/latest/regorus/struct.Engine.html [DllImport(__DllName, EntryPoint = "regorus_engine_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern RegorusEngine* regorus_engine_new(); /// Clone a [`RegorusEngine`] To avoid having to parse same policy again, the engine can be cloned after policies and data have been added. [DllImport(__DllName, EntryPoint = "regorus_engine_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern RegorusEngine* regorus_engine_clone(RegorusEngine* engine); [DllImport(__DllName, EntryPoint = "regorus_engine_drop", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void regorus_engine_drop(RegorusEngine* engine); /// Add a policy The policy is parsed into AST. See https://docs.rs/regorus/latest/regorus/struct.Engine.html#method.add_policy * `path`: A filename to be associated with the policy. * `rego`: Rego policy. [DllImport(__DllName, EntryPoint = "regorus_engine_add_policy", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern RegorusResult regorus_engine_add_policy(RegorusEngine* engine, byte* path, byte* rego); [DllImport(__DllName, EntryPoint = "regorus_engine_add_policy_from_file", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern RegorusResult regorus_engine_add_policy_from_file(RegorusEngine* engine, byte* path); /// Add policy data. See https://docs.rs/regorus/latest/regorus/struct.Engine.html#method.add_data * `data`: JSON encoded value to be used as policy data. [DllImport(__DllName, EntryPoint = "regorus_engine_add_data_json", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern RegorusResult regorus_engine_add_data_json(RegorusEngine* engine, byte* data); [DllImport(__DllName, EntryPoint = "regorus_engine_add_data_from_json_file", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern RegorusResult regorus_engine_add_data_from_json_file(RegorusEngine* engine, byte* path); /// Clear policy data. See https://docs.rs/regorus/0.1.0-alpha.2/regorus/struct.Engine.html#method.clear_data [DllImport(__DllName, EntryPoint = "regorus_engine_clear_data", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern RegorusResult regorus_engine_clear_data(RegorusEngine* engine); /// Set input. See https://docs.rs/regorus/0.1.0-alpha.2/regorus/struct.Engine.html#method.set_input * `input`: JSON encoded value to be used as input to query. [DllImport(__DllName, EntryPoint = "regorus_engine_set_input_json", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern RegorusResult regorus_engine_set_input_json(RegorusEngine* engine, byte* input); [DllImport(__DllName, EntryPoint = "regorus_engine_set_input_from_json_file", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern RegorusResult regorus_engine_set_input_from_json_file(RegorusEngine* engine, byte* path); /// Evaluate query. See https://docs.rs/regorus/0.1.0-alpha.2/regorus/struct.Engine.html#method.eval_query * `query`: Rego expression to be evaluate. [DllImport(__DllName, EntryPoint = "regorus_engine_eval_query", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern RegorusResult regorus_engine_eval_query(RegorusEngine* engine, byte* query); } [StructLayout(LayoutKind.Sequential)] internal unsafe partial struct RegorusResult { public RegorusStatus status; public byte* output; public byte* error_message; } [StructLayout(LayoutKind.Sequential)] internal unsafe partial struct RegorusEngine { } internal enum RegorusStatus : uint { RegorusStatusOk, RegorusStatusError, } }