summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGravatar Ramūnas Mažeikis <ramunasnezinomas@gmail.com> 2019-05-28 20:42:39 +0300
committerGravatar Ramūnas Mažeikis <ramunasnezinomas@gmail.com> 2019-05-28 20:42:39 +0300
commitafef44b519153463838ed54327f1b7fca184d97d (patch)
tree37d4a027fe001ff58defa26c331f3816455d35e0 /include
parent9f6e34103aeb44fafdcd8d4878281c783b7c9ed2 (diff)
downloadusurpation-afef44b519153463838ed54327f1b7fca184d97d.tar.gz
usurpation-afef44b519153463838ed54327f1b7fca184d97d.tar.bz2
usurpation-afef44b519153463838ed54327f1b7fca184d97d.zip
Protocol: more docs.
Signed-off-by: Ramūnas Mažeikis <ramunasnezinomas@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/protocol.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/protocol.h b/include/protocol.h
index 38f5aa9..6d8bbd9 100644
--- a/include/protocol.h
+++ b/include/protocol.h
@@ -102,12 +102,24 @@ struct tlv {
void *data;
};
+/**
+ * Keeps state of the parsing process.
+ *
+ * Related functions return one tlv at a time.
+ */
struct tlv_parser {
char *data;
size_t offset;
size_t size;
};
+
+/**
+ * Fills tlv structure to represent the next tlv in the packet.
+ *
+ * Returns END_OF_PACKET if all tlv's were read of E_TLV_OVERFLOW, if the last
+ * tlv, according to its declared size should not fit in a packet.
+ */
int get_tlv(struct tlv_parser *parser, struct tlv *ret);
/**