InputBuffer.h
Go to the documentation of this file.
1 /****
2  * Sming Framework Project - Open Source framework for high efficiency native ESP8266 development.
3  * Created 2015 by Skurydin Alexey
4  * http://github.com/SmingHub/Sming
5  * All files of the Sming Core are provided under the LGPL v3 license.
6  *
7  * InputBuffer.h
8  *
9  ****/
10 
11 #pragma once
12 
13 #include <cstdlib>
14 #include <cstdint>
15 #include <lwip/pbuf.h>
16 
17 namespace Ssl
18 {
23 {
24 public:
25  InputBuffer(pbuf* buf) : buf(buf)
26  {
27  }
28 
29  size_t available() const
30  {
31  return buf ? (buf->tot_len - offset) : 0;
32  }
33 
34  size_t read(uint8_t* buffer, size_t bufSize);
35 
36 private:
37  pbuf* buf;
38  uint16_t offset = 0;
39 };
40 
41 } // namespace Ssl
Wraps a pbuf for reading in chunks.
Definition: InputBuffer.h:23
InputBuffer(pbuf *buf)
Definition: InputBuffer.h:25
size_t read(uint8_t *buffer, size_t bufSize)
size_t available() const
Definition: InputBuffer.h:29
Definition: Alert.h:16