aboutsummaryrefslogtreecommitdiff
path: root/include/salticidae/stream.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/salticidae/stream.h')
-rw-r--r--include/salticidae/stream.h20
1 files changed, 16 insertions, 4 deletions
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<size_t N, typename T> class Blob;
@@ -474,15 +474,23 @@ using datastream_t = salticidae::DataStream;
#else
+#include <stdint.h>
+#include <stdbool.h>
+
+#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