summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);
/**