From da42ddf96c78a73b4cf5f8854e98e009f4f174a4 Mon Sep 17 00:00:00 2001 From: Determinant Date: Tue, 4 Jun 2019 18:59:00 -0400 Subject: ... --- include/salticidae/stream.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'include/salticidae/stream.h') diff --git a/include/salticidae/stream.h b/include/salticidae/stream.h index e146273..3f768b3 100644 --- a/include/salticidae/stream.h +++ b/include/salticidae/stream.h @@ -25,11 +25,11 @@ #ifndef _SALTICIDAE_STREAM_H #define _SALTICIDAE_STREAM_H +#ifdef __cplusplus #include "salticidae/type.h" #include "salticidae/ref.h" #include "salticidae/crypto.h" -#ifdef __cplusplus namespace salticidae { template class Blob; @@ -474,15 +474,23 @@ using datastream_t = salticidae::DataStream; #else +#include +#include + +#include "config.h" +#include "type.h" + #ifdef SALTICIDAE_CBINDINGS -typedef struct datastream_t; -typedef struct uint256_t; +typedef struct datastream_t datastream_t; +typedef struct uint256_t uint256_t; #endif #endif #ifdef SALTICIDAE_CBINDINGS +#ifdef __cplusplus extern "C" { +#endif uint256_t *uint256_new(); uint256_t *uint256_new_from_bytes(const uint8_t *arr); @@ -505,7 +513,7 @@ 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 *begin, const uint8_t *end); uint8_t datastream_get_u8(datastream_t *self); uint16_t datastream_get_u16(datastream_t *self); @@ -515,8 +523,12 @@ int16_t datastream_get_i16(datastream_t *self); int32_t datastream_get_i32(datastream_t *self); const uint8_t *datastream_get_data_inplace(datastream_t *self, size_t len); uint256_t *datastream_get_hash(const datastream_t *self); +void datastream_free(const datastream_t *self); +bytearray_t *datastream_to_bytearray(datastream_t *self); +#ifdef __cplusplus } #endif +#endif #endif -- cgit v1.2.3