diff options
author | 2019-05-21 20:01:08 +0300 | |
---|---|---|
committer | 2019-05-21 20:01:08 +0300 | |
commit | fe71239fc0d1e65e06ba9dcf2fb35239bff21466 (patch) | |
tree | e1e708310afc253ca006bb22558cc8cba67bdfb6 /src/device/protocol_device.c | |
parent | 5ca7e24e58f6bd657787b9235247149ffff420ae (diff) | |
download | usurpation-fe71239fc0d1e65e06ba9dcf2fb35239bff21466.tar.gz usurpation-fe71239fc0d1e65e06ba9dcf2fb35239bff21466.tar.bz2 usurpation-fe71239fc0d1e65e06ba9dcf2fb35239bff21466.zip |
Protocol: moved udp code out of main.
An effor was made to increase modularity of device code. It was a
partial success. IP adress, communications port, and wifi login
details had to be made static and visible in main.
Time is scarce and I am not about to push this further.
Signed-off-by: Ramūnas Mažeikis <ramunasnezinomas@gmail.com>
Diffstat (limited to 'src/device/protocol_device.c')
-rwxr-xr-x | src/device/protocol_device.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/device/protocol_device.c b/src/device/protocol_device.c index 3e38e19..5910546 100755 --- a/src/device/protocol_device.c +++ b/src/device/protocol_device.c @@ -18,9 +18,15 @@ cd_t protocol_init(void) return 0; } -void clear_data(void) +int clear_data(cd_t cd) { - connection.inp_crs = 0; + int ret = 0; + if (cd >= MAX_CONNECTIONS) { + ret = E_IVALID_DESCRIPTOR; + } else { + connection.inp_crs = 0; + } + return ret; } static int push_bytes(cd_t cd, char *data, size_t size) @@ -81,6 +87,10 @@ struct tlv * get_tlv(cd_t cd) return ret; } +int flush_data(cd_t cd) +{ + return 0; +} int get_last_data(cd_t cd) { |