mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
177b969e8c
PiperOrigin-RevId: 238996664 Change-Id: I9646527e2be68ee0b6b371572b7aafe967102e57 Signed-off-by: Christian Blichmann <cblichmann@google.com>
234 lines
7.5 KiB
Plaintext
Executable File
234 lines
7.5 KiB
Plaintext
Executable File
// AUTO-GENERATED by SandboxedAPI generator. Please do not edit.
|
|
// go/sandboxed-api
|
|
|
|
#ifndef SECURITY_SANDBOXED_API_TOOLS_GENERATOR_TESTS_INTERFACE_H_
|
|
#define SECURITY_SANDBOXED_API_TOOLS_GENERATOR_TESTS_INTERFACE_H_
|
|
|
|
#include "sandboxed_api/tools/generator/tests_sapi_generator_embed.h"
|
|
#include "sandboxed_api/sandbox.h"
|
|
#include "sandboxed_api/vars.h"
|
|
|
|
namespace sapi {
|
|
namespace tests {
|
|
|
|
class TestsSandbox : public ::sapi::Sandbox {
|
|
public:
|
|
TestsSandbox() : ::sapi::Sandbox(tests_sapi_generator_embed_create()) {}
|
|
};
|
|
|
|
|
|
typedef unsigned int uint;
|
|
typedef uint* uint_p;
|
|
typedef uint_p* uint_pp;
|
|
typedef void (*function_p)(uint, uint_p, uint_pp);
|
|
typedef void (*function_p2)(void (*)(int, char), void*);
|
|
struct struct_2 {
|
|
uint a;
|
|
char b;
|
|
uint c;
|
|
char d;
|
|
} ;
|
|
typedef struct {
|
|
function_p a;
|
|
function_p2 b;
|
|
void (*c)(int, long int);
|
|
uint d;
|
|
uint_pp e;
|
|
struct struct_2* f;
|
|
} struct_t;
|
|
typedef char** char_pp;
|
|
typedef long int long_arr[8];
|
|
typedef int function_3(int, int);
|
|
typedef union {
|
|
int a;
|
|
char b;
|
|
} union_1;
|
|
struct struct_1 {
|
|
uint a;
|
|
char b;
|
|
uint c;
|
|
char d;
|
|
} ;
|
|
struct struct_3 {
|
|
// Not defined, no debug info about the type
|
|
} ;
|
|
struct struct_4 {
|
|
char a[4];
|
|
int b;
|
|
union {
|
|
uint a;
|
|
char* b;
|
|
} c;
|
|
struct {
|
|
uint a;
|
|
char* b;
|
|
} d;
|
|
function_p func_1;
|
|
const char* const* const_1;
|
|
const char** const_2;
|
|
char* const* const_3;
|
|
int (*coef_bits)[16];
|
|
} ;
|
|
struct struct_6_def;
|
|
typedef struct struct_6_def struct_6;
|
|
typedef struct_6* struct_6p;
|
|
typedef void (*function_p3)(struct_6p);
|
|
struct struct_6_def {
|
|
function_p3 fn;
|
|
} ;
|
|
struct struct_7_def;
|
|
struct struct_7_part_def;
|
|
typedef struct struct_7_part_def s7part;
|
|
typedef struct struct_7_def* s7p;
|
|
struct struct_7_part_def {
|
|
int x;
|
|
int y;
|
|
void (*fn)();
|
|
} ;
|
|
struct struct_7_def {
|
|
s7part part;
|
|
int x;
|
|
} ;
|
|
enum Enumeration { ONE = 0, TWO = 1, THREE = 2 };
|
|
typedef enum { SIX = 6, TEN = 10 } SixOrTen;
|
|
enum class Color { RED = 0, GREEN = 20, BLUE = 21 };
|
|
enum class Direction { LEFT = 108, RIGHT = 114 };
|
|
enum Numbers { UNKNOWN = 0, FIVE = 5, SE7EN = 7 };
|
|
typedef Numbers Nums;
|
|
|
|
|
|
class TestsApi {
|
|
public:
|
|
explicit TestsApi(::sapi::Sandbox* sandbox) : sandbox_(sandbox) {}
|
|
::sapi::Sandbox* GetSandbox() {
|
|
return sandbox_;
|
|
}
|
|
|
|
// bool function_using_simple_types(unsigned char a1, signed char a2, unsigned short a3, short a4, unsigned int a5, int a6, long unsigned int a7, long int a8, long long unsigned int a9, long long int a10)
|
|
util::StatusOr<bool> function_using_simple_types(unsigned char a1, signed char a2, unsigned short a3, short a4, unsigned int a5, int a6, long unsigned int a7, long int a8, long long unsigned int a9, long long int a10) {
|
|
::sapi::v::IntBase<bool> ret;
|
|
::sapi::v::UChar a0_((a1));
|
|
::sapi::v::SChar a1_((a2));
|
|
::sapi::v::UShort a2_((a3));
|
|
::sapi::v::Short a3_((a4));
|
|
::sapi::v::UInt a4_((a5));
|
|
::sapi::v::Int a5_((a6));
|
|
::sapi::v::ULong a6_((a7));
|
|
::sapi::v::Long a7_((a8));
|
|
::sapi::v::ULLong a8_((a9));
|
|
::sapi::v::LLong a9_((a10));
|
|
|
|
RETURN_IF_ERROR(sandbox_->Call("function_using_simple_types", &ret, &a0_, &a1_, &a2_, &a3_, &a4_, &a5_, &a6_, &a7_, &a8_, &a9_));
|
|
return ret.GetValue();
|
|
}
|
|
// bool function_using_simple_types_continued(float a1, double a2, long double a3)
|
|
util::StatusOr<bool> function_using_simple_types_continued(float a1, double a2, long double a3) {
|
|
::sapi::v::IntBase<bool> ret;
|
|
::sapi::v::Reg<float> a0_((a1));
|
|
::sapi::v::Reg<double> a1_((a2));
|
|
::sapi::v::Reg<long double> a2_((a3));
|
|
|
|
RETURN_IF_ERROR(sandbox_->Call("function_using_simple_types_continued", &ret, &a0_, &a1_, &a2_));
|
|
return ret.GetValue();
|
|
}
|
|
// int function_using_class(const ExampleClass* ptr_to_class)
|
|
util::StatusOr<int> function_using_class(::sapi::v::Ptr* ptr_to_class) {
|
|
::sapi::v::Int ret;
|
|
|
|
RETURN_IF_ERROR(sandbox_->Call("function_using_class", &ret, ptr_to_class));
|
|
return ret.GetValue();
|
|
}
|
|
// int GetSum(const ExampleClass* None)
|
|
util::StatusOr<int> GetSum(::sapi::v::Ptr* None) {
|
|
::sapi::v::Int ret;
|
|
|
|
RETURN_IF_ERROR(sandbox_->Call("GetSum", &ret));
|
|
return ret.GetValue();
|
|
}
|
|
// uint function_using_typedefs(uint_p a1, uint_pp a2, function_p a3, function_p2* a4, struct_t* a5, char_pp a6, long_arr* a7, function_3* a8)
|
|
util::StatusOr<unsigned int> function_using_typedefs(::sapi::v::Ptr* a1, ::sapi::v::Ptr* a2, ::sapi::v::Ptr* a3, ::sapi::v::Ptr* a4, ::sapi::v::Ptr* a5, ::sapi::v::Ptr* a6, ::sapi::v::Ptr* a7, ::sapi::v::Ptr* a8) {
|
|
::sapi::v::UInt ret;
|
|
|
|
RETURN_IF_ERROR(sandbox_->Call("function_using_typedefs", &ret, a1, a2, a3, a4, a5, a6, a7, a8));
|
|
return ret.GetValue();
|
|
}
|
|
// int function_using_union(union_1* a1)
|
|
util::StatusOr<int> function_using_union(::sapi::v::Ptr* a1) {
|
|
::sapi::v::Int ret;
|
|
|
|
RETURN_IF_ERROR(sandbox_->Call("function_using_union", &ret, a1));
|
|
return ret.GetValue();
|
|
}
|
|
// unsigned char* function_using_pointers(int* a1, unsigned char* a2, unsigned char a3, const char* a4)
|
|
util::StatusOr<unsigned char*> function_using_pointers(::sapi::v::Ptr* a1, ::sapi::v::Ptr* a2, unsigned char a3, ::sapi::v::Ptr* a4) {
|
|
::sapi::v::Reg<unsigned char*> ret;
|
|
::sapi::v::UChar a2_((a3));
|
|
|
|
RETURN_IF_ERROR(sandbox_->Call("function_using_pointers", &ret, a1, a2, &a2_, a4));
|
|
return ret.GetValue();
|
|
}
|
|
// uint* function_returning_pointer()
|
|
util::StatusOr<uint*> function_returning_pointer() {
|
|
::sapi::v::Reg<uint*> ret;
|
|
|
|
RETURN_IF_ERROR(sandbox_->Call("function_returning_pointer", &ret));
|
|
return ret.GetValue();
|
|
}
|
|
// void function_returning_void(int* a)
|
|
util::Status function_returning_void(::sapi::v::Ptr* a) {
|
|
::sapi::v::Void ret;
|
|
|
|
RETURN_IF_ERROR(sandbox_->Call("function_returning_void", &ret, a));
|
|
return util::OkStatus();
|
|
}
|
|
// int function_using_structures(struct struct_1* a1, struct struct_2* a2, struct struct_3* a3, struct struct_4* a4)
|
|
util::StatusOr<int> function_using_structures(::sapi::v::Ptr* a1, ::sapi::v::Ptr* a2, ::sapi::v::Ptr* a3, ::sapi::v::Ptr* a4) {
|
|
::sapi::v::Int ret;
|
|
|
|
RETURN_IF_ERROR(sandbox_->Call("function_using_structures", &ret, a1, a2, a3, a4));
|
|
return ret.GetValue();
|
|
}
|
|
// void function_using_type_loop(struct_6p a1)
|
|
util::Status function_using_type_loop(::sapi::v::Ptr* a1) {
|
|
::sapi::v::Void ret;
|
|
|
|
RETURN_IF_ERROR(sandbox_->Call("function_using_type_loop", &ret, a1));
|
|
return util::OkStatus();
|
|
}
|
|
// void function_using_incomplete(s7p a1)
|
|
util::Status function_using_incomplete(::sapi::v::Ptr* a1) {
|
|
::sapi::v::Void ret;
|
|
|
|
RETURN_IF_ERROR(sandbox_->Call("function_using_incomplete", &ret, a1));
|
|
return util::OkStatus();
|
|
}
|
|
// int function_using_enums(Enumeration a1, SixOrTen a2, Color a3, Direction a4, Nums a5)
|
|
util::StatusOr<int> function_using_enums(Enumeration a1, SixOrTen a2, Color a3, Direction a4, Nums a5) {
|
|
::sapi::v::Int ret;
|
|
::sapi::v::Reg<Enumeration> a0_((a1));
|
|
::sapi::v::Reg<SixOrTen> a1_((a2));
|
|
::sapi::v::Reg<Color> a2_((a3));
|
|
::sapi::v::Reg<Direction> a3_((a4));
|
|
::sapi::v::Reg<Nums> a4_((a5));
|
|
|
|
RETURN_IF_ERROR(sandbox_->Call("function_using_enums", &ret, &a0_, &a1_, &a2_, &a3_, &a4_));
|
|
return ret.GetValue();
|
|
}
|
|
// struct struct_2* function_returning_struct_ptr()
|
|
util::StatusOr<struct struct_2*> function_returning_struct_ptr() {
|
|
::sapi::v::Reg<struct struct_2*> ret;
|
|
|
|
RETURN_IF_ERROR(sandbox_->Call("function_returning_struct_ptr", &ret));
|
|
return ret.GetValue();
|
|
}
|
|
|
|
private:
|
|
::sapi::Sandbox* sandbox_;
|
|
};
|
|
|
|
} // namespace tests
|
|
} // namespace sapi
|
|
|
|
|
|
#endif // SECURITY_SANDBOXED_API_TOOLS_GENERATOR_TESTS_INTERFACE_H_
|