diff options
Diffstat (limited to 'include/protocol.h')
-rw-r--r-- | include/protocol.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/protocol.h b/include/protocol.h index cd28e2d..598b8e3 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -26,6 +26,7 @@ #define E_TLV_OVERFLOW (1 << 0) #define E_UNKNOWN_TYPE (1 << 1) #define E_IVALID_DESCRIPTOR (1 << 2) +#define END_OF_PACKET (1 << 3) /** * Regular packets contain tlv's defined by tlv_type. @@ -114,13 +115,23 @@ int get_tlv(struct tlv_parser *parser, struct tlv *ret); * * In case of overflow return E_TLV_OVERFLOW. * + * On next call after retreiving last packet returns END_OF_PACKET. + * * Overflow can be detected after forming tlv header. This means that the * packet may have changes. * */ int push_data(struct tlv_packet *packet, enum tlv_type type, char *data); + +/** + * Resets offset to 0 and set entire buffer to 0. + */ void clear_data(struct tlv_packet *packet); + +/** + * Tells what size of buffer is needed for next tlv. + */ size_t tlv_data_size(struct tlv_parser *parser); #endif /* PROTOCOL_H_INCLUDED */ |