diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/protocol.h | 32 | ||||
-rw-r--r-- | include/utils.h | 7 |
2 files changed, 17 insertions, 22 deletions
diff --git a/include/protocol.h b/include/protocol.h index 5872fa3..9d5b518 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -23,8 +23,8 @@ #include <errno.h> -#define SUCCESS (0) -#define TLV_OVERFLOW (1 << 0) +#define E_TLV_OVERFLOW (1 << 0) +#define E_UNKNOWN_TYPE (1 << 1) enum packet_type { REGURAL, @@ -33,27 +33,27 @@ enum packet_type { }; enum tlv_type { - /* NULL-terminated string. */ + /** NULL-terminated string. */ TEXT, - - /* Fixed point. 1 decimal digit of precision. */ + + /** Fixed point. 1 decimal digit of precision. */ FPI1, - - /* Literally time_t*/ + + /** Literally time_t*/ TIMESTAMP, - - /* Represents a request for lost message. Data is unsigned integer - * that uniquely identifies the message. + + /** Represents a request for lost message. Data is unsigned integer + * that uniquely identifies the message. */ REQUEST, - - /* Response to request. Begins with unsigned integer that represents - * which message is begin repeated and the actual null-terminated + + /** Response to request. Begins with unsigned integer that represents + * which message is being repeated and the actual null-terminated * message after that. */ REPLY, - - /* UUID that represents a particular device. + + /** UUID that represents a particular device. */ UUID }; @@ -88,7 +88,7 @@ void clear_data(void); /* Appends data to the next packet to be sent. Type of data is determined by * enum tlv_type. * */ -void push_data(char *data, enum tlv_type); +int push_data(const char *data, enum tlv_type); /* Sends packet towards the other end. * */ diff --git a/include/utils.h b/include/utils.h index daea864..e4feb9a 100644 --- a/include/utils.h +++ b/include/utils.h @@ -4,16 +4,11 @@ #include <stdint.h> typedef struct uuid_s { - uint64_t low; - uint64_t hi; + char bytes[16]; } uuid_t; int cmp_uuid(uuid_t *first, uuid_t *second); -/* Prints uuid in cannonical format. - */ -void uuid_to_str(uuid_t *to_print, char *buf); - typedef int fpi1_t; fpi1_t add(fpi1_t a, fpi1_t b); |