types.h 1.4 KB
Newer Older
1 2 3 4
/**
 *  @file
 *  @copyright defined in eos/LICENSE.txt
 */
5 6
#pragma once

7
#include <stdint.h>
8
#include <wchar.h>
9

B
Bart Wyatt 已提交
10
#ifdef __cplusplus
11
extern "C" {
B
Bart Wyatt 已提交
12
#endif
13

14 15 16
/**
 *  @defgroup types Builtin Types
 *  @ingroup contractdev
17 18 19
 *  @brief Specifies typedefs and aliases
 *
 *  @{
20
 */
21

22 23 24 25 26
typedef uint64_t account_name;
typedef uint64_t permission_name;
typedef uint64_t token_name;
typedef uint64_t table_name;
typedef uint32_t time;
27 28 29
typedef uint64_t scope_name;
typedef uint64_t action_name;
typedef uint16_t region_id;
30

31 32
typedef uint64_t asset_symbol;
typedef int64_t share_type;
33
typedef uint16_t weight_type;
34

B
Bucky Kittinger 已提交
35
/* macro to align/overalign a type to ensure calls to intrinsics with pointers/references are properly aligned */ 
36
#define ALIGNED(X) __attribute__ ((aligned (16))) X
37

38
struct public_key {
B
Bucky Kittinger 已提交
39
   char data[34];
40 41
};

42
struct signature {
B
Bucky Kittinger 已提交
43
   uint8_t data[66];
44 45
};

B
Bucky Kittinger 已提交
46
struct ALIGNED(checksum256) {
47 48 49
   uint8_t hash[32];
};

B
Bucky Kittinger 已提交
50
struct ALIGNED(checksum160) {
51 52 53
   uint8_t hash[20];
};

B
Bucky Kittinger 已提交
54
struct ALIGNED(checksum512) {
55 56
   uint8_t hash[64];
};
57

58
struct fixed_string16 {
59
   uint8_t len;
B
Bart Wyatt 已提交
60
   char str[16];
61 62
};

B
Bucky Kittinger 已提交
63
typedef struct checksum256 transaction_id_type;
64

B
Bart Wyatt 已提交
65
typedef struct fixed_string16 field_name;
66

67
struct fixed_string32 {
68
   uint8_t len;
B
Bart Wyatt 已提交
69
   char str[32];
70 71
};

B
Bart Wyatt 已提交
72
typedef struct fixed_string32 type_name;
73

74 75 76 77
struct account_permission {
   account_name account;
   permission_name permission;
};
78

B
Bart Wyatt 已提交
79
#ifdef __cplusplus
80
} /// extern "C"
B
Bart Wyatt 已提交
81
#endif
82
/// @}