diff options
author | 2019-05-21 17:41:21 +0300 | |
---|---|---|
committer | 2019-05-21 17:41:21 +0300 | |
commit | cabb90c1240015ee5cd17d91573588527bcc2482 (patch) | |
tree | 0e3b07fa887ca25a12e32f5c126407d149483a21 /src/device/protocol_device.ino | |
parent | bb70fccb66f55e9cc2b9ed0bf366479828f41346 (diff) | |
download | usurpation-cabb90c1240015ee5cd17d91573588527bcc2482.tar.gz usurpation-cabb90c1240015ee5cd17d91573588527bcc2482.tar.bz2 usurpation-cabb90c1240015ee5cd17d91573588527bcc2482.zip |
Protocol: changes to interface and some re-implementation.
Most functions exposed in protocol.h take a connection descriptor
(cd_t) as first argument. This allows for multiple connections. Device
gets only one connection which means that cd_t is effectively 0 all
the time.
Additionaly, any function that actually does anything with a
connection descriptor instead of just passing it to another function
must be implemented separately in device and daemon.
Signed-off-by: Ramūnas Mažeikis <ramunasnezinomas@gmail.com>
Diffstat (limited to 'src/device/protocol_device.ino')
-rwxr-xr-x | src/device/protocol_device.ino | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/device/protocol_device.ino b/src/device/protocol_device.ino new file mode 100755 index 0000000..778196d --- /dev/null +++ b/src/device/protocol_device.ino @@ -0,0 +1,38 @@ +#include "protocol.h" +#include "protocol_private.h" +#include "protocol_device_private.h" +#include <ESP8266WiFi.h> +#include <time.h> +#include <stdlib.h> + +static struct connection_t connection; + +static int push_bytes(cd_t cd, char *data, size_t size) +{ + int ret = 0; + + if (cd >= MAX_CONNECTIONS) { + ret = E_IVALID_DESCRIPTOR; + } else if (connection.outp_crs + size >= sizeof(connection.outp_buf)) { + ret = E_PACKET_OVERFLOW; + } else { + + } + return ret; +} + +static int push_tlv_header(cd_t connection, enum tlv_type type, size_t size) +{ + return 0; +} + +struct tlv * get_tlv() +{ + return NULL; +} + + +void get_last_data(cd_t connection) +{ + +} |