diff options
Diffstat (limited to 'include/salticidae/stream.h')
-rw-r--r-- | include/salticidae/stream.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/include/salticidae/stream.h b/include/salticidae/stream.h index 5f54195..9eda2bd 100644 --- a/include/salticidae/stream.h +++ b/include/salticidae/stream.h @@ -29,6 +29,7 @@ #include "salticidae/ref.h" #include "salticidae/crypto.h" +#ifdef __cplusplus namespace salticidae { template<size_t N, typename T> class Blob; @@ -466,4 +467,40 @@ namespace std { }; } +using uint256_t = salticidae::uint256_t; +using datastream_t = salticidae::DataStream; + +#else +typedef struct datastream_t; +typedef struct uint256_t; +#endif + +extern "C" { + +uint256_t *uint256_new(); +uint256_t *uint256_new_from_bytes(const uint8_t *arr); +bool uint256_is_null(const uint256_t *self); +bool uint256_is_eq(const uint256_t *a, const uint256_t *b); +void uint256_serialize(const uint256_t *self, datastream_t *s); +void uint256_unserialize(uint256_t *self, datastream_t *s); + +datastream_t *datastream_new(); +datastream_t *datastream_new_from_bytes(const uint8_t *begin, const uint8_t *end); +void datastream_assign_by_copy(datastream_t *dst, const datastream_t *src); +void datastream_assign_by_move(datastream_t *dst, datastream_t *src); +uint8_t *datastream_data(datastream_t *self); +void datastream_clear(datastream_t *self); +size_t datastream_size(const datastream_t *self); +void datastream_put_u8(datastream_t *self, uint8_t val); +void datastream_put_u16(datastream_t *self, uint16_t val); +void datastream_put_u32(datastream_t *self, uint32_t val); +void datastream_put_i8(datastream_t *self, int8_t val); +void datastream_put_i16(datastream_t *self, int16_t val); +void datastream_put_i32(datastream_t *self, int32_t val); +void datastream_put_data(datastream_t *self, + uint8_t *begin, uint8_t *end); +const uint8_t *datastream_get_data_inplace(datastream_t *self, size_t len); +uint256_t *datastream_get_hash(const datastream_t *self); + +} #endif |