aboutsummaryrefslogtreecommitdiff
path: root/src/stream.c
diff options
context:
space:
mode:
authorOskari Timperi <oskari.timperi@iki.fi>2017-03-18 09:29:19 +0200
committerOskari Timperi <oskari.timperi@iki.fi>2017-03-18 09:29:19 +0200
commit7aeef53b089272f4633cc40512296bfd884a58d4 (patch)
tree894753ced0495f725ad8362859f88d5b61e29eb7 /src/stream.c
parente9958e8a0f5aa5fbe0a4a03be42b8bf640add6f7 (diff)
parent2c76b0da9e0aba2211d5b4a8e51c79e47ad9b6c8 (diff)
downloadmqtt-0.5.tar.gz
mqtt-0.5.zip
Merge branch 'the-great-refactor'v0.5
* the-great-refactor: Add big_message_test Fix publish message serialization Modify the code to use nonblocking sockets Fix indentation Free userName and password in MqttClientFree() Add forgotten files Massive refactoring of the internals
Diffstat (limited to 'src/stream.c')
-rw-r--r--src/stream.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/stream.c b/src/stream.c
index fd154a1..1c46668 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -47,6 +47,11 @@ int64_t StreamReadUint16Be(uint16_t *v, Stream *stream)
return 2;
}
+int64_t StreamReadByte(unsigned char *byte, Stream *stream)
+{
+ return StreamRead(byte, sizeof(*byte), stream);
+}
+
int64_t StreamWrite(const void *ptr, size_t size, Stream *stream)
{
STREAM_CHECK_OP(stream, write);
@@ -65,6 +70,11 @@ int64_t StreamWriteUint16Be(uint16_t v, Stream *stream)
return StreamWrite(data, sizeof(data), stream);
}
+int64_t StreamWriteByte(unsigned char byte, Stream *stream)
+{
+ return StreamWrite(&byte, sizeof(byte), stream);
+}
+
int StreamSeek(Stream *stream, int64_t offset, int whence)
{
STREAM_CHECK_OP(stream, seek);