/*
- File name : message.h
+ File name : channel.h
Projet : MERLIN
- Date of creation : 2025/04/03
+ Date of creation : 2025/04/08
Version : 1.0
Copyright : Thales SIX
Author : Laurent Mazet <laurent.mazet@thalesgroup.com>
- initial version
*/
-#ifndef __MESSAGE_H__
-#define __MESSAGE_H__
+#ifndef __CHANNEL_H__
+#define __CHANNEL_H__
#include <stdint.h>
#include <sys/cdefs.h>
uint8_t key_id; /**< key index */
} CHANNEL_t;
+/**
+ @ingroup MESSAGES
+
+ Parse a string containing some channel type fields
+
+ @param line string to analyse
+ @param out output structure
+ @return 0 on success
+*/
+int parse_channel (char *line, CHANNEL_t *out);
+
+/**
+ @ingroup MESSAGES
+
+ Format channel type fields into a string
+
+ @param in input structure
+ @param buffer output string
+ @param maxlen buffer limit
+ @return 0 on success
+*/
+int format_channel (CHANNEL_t *in, char *buffer, int maxlen);
+
+/**
+ @ingroup MESSAGES
+
+ Serial channel type fields into a network stream
+
+ @param in input structure
+ @param buffer network stream
+ @param maxlen buffer limit
+ @return buffer length
+*/
+int serial_channel (CHANNEL_t *in, uint8_t *buffer, int maxlen);
+
+/**
+ @ingroup MESSAGES
+
+ Deserial channel type fields from a network stream
+
+ @param buffer network stream
+ @param maxlen buffer limit
+ @param out output structure
+ @return 0 on success
+*/
+int deserial_channel (uint8_t *buffer, int maxlen, CHANNEL_t *out);
+
__END_DECLS
-#endif /* __MESSAGE_H__ */
+#endif /* __CHANNEL_H__ */
/* vim: set ts=4 sw=4 si et: */
uint8_t iv[12]; /**< initial vector */
} ENCRYPTED_DATA_t;
+/**
+ @ingroup MESSAGES
+
+ Parse a string containing some clear data type fields
+
+ @param line string to analyse
+ @param out output structure
+ @return 0 on success
+*/
+int parse_clear_data (char *line, CLEAR_DATA_t *out);
+
+/**
+ @ingroup MESSAGES
+
+ Format clear data type fields into a string
+
+ @param in input structure
+ @param buffer output string
+ @param maxlen buffer limit
+ @return 0 on success
+*/
+int format_clear_data (CLEAR_DATA_t *in, char *buffer, int maxlen);
+
+/**
+ @ingroup MESSAGES
+
+ Serial clear data type fields into a network stream
+
+ @param in input structure
+ @param buffer network stream
+ @param maxlen buffer limit
+ @return buffer length
+*/
+int serial_clear_data (CLEAR_DATA_t *in, uint8_t *buffer, int maxlen);
+
+/**
+ @ingroup MESSAGES
+
+ Deserial clear data type fields from a network stream
+
+ @param buffer network stream
+ @param maxlen buffer limit
+ @param out output structure
+ @return 0 on success
+*/
+int deserial_clear_data (uint8_t *buffer, int maxlen, CLEAR_DATA_t *out);
+
__END_DECLS
#endif /* __MESSAGE_H__ */
uint8_t key[1495]; /**< raw key */
} KEY_t;
+/**
+ @ingroup MESSAGES
+
+ Parse a string containing some clear data type fields
+
+ @param line string to analyse
+ @param out output structure
+ @return 0 on success
+*/
+int parse_clear_data (char *line, CLEAR_DATA_t *out);
+
+/**
+ @ingroup MESSAGES
+
+ Format clear data type fields into a string
+
+ @param in input structure
+ @param buffer output string
+ @param maxlen buffer limit
+ @return 0 on success
+*/
+int format_clear_data (CLEAR_DATA_t *in, char *buffer, int maxlen);
+
+/**
+ @ingroup MESSAGES
+
+ Serial clear data type fields into a network stream
+
+ @param in input structure
+ @param buffer network stream
+ @param maxlen buffer limit
+ @return buffer length
+*/
+int serial_clear_data (CLEAR_DATA_t *in, uint8_t *buffer, int maxlen);
+
+/**
+ @ingroup MESSAGES
+
+ Deserial clear data type fields from a network stream
+
+ @param buffer network stream
+ @param maxlen buffer limit
+ @param out output structure
+ @return 0 on success
+*/
+int deserial_clear_data (uint8_t *buffer, int maxlen, CLEAR_DATA_t *out);
+
__END_DECLS
#endif /* __MESSAGE_H__ */
uint8_t seed_len; /**< data length (must be aligned to 16 bytes) */
} PRNG_PARAM_t;
+/**
+ @ingroup MESSAGES
+
+ Parse a string containing some clear data type fields
+
+ @param line string to analyse
+ @param out output structure
+ @return 0 on success
+*/
+int parse_clear_data (char *line, CLEAR_DATA_t *out);
+
+/**
+ @ingroup MESSAGES
+
+ Format clear data type fields into a string
+
+ @param in input structure
+ @param buffer output string
+ @param maxlen buffer limit
+ @return 0 on success
+*/
+int format_clear_data (CLEAR_DATA_t *in, char *buffer, int maxlen);
+
+/**
+ @ingroup MESSAGES
+
+ Serial clear data type fields into a network stream
+
+ @param in input structure
+ @param buffer network stream
+ @param maxlen buffer limit
+ @return buffer length
+*/
+int serial_clear_data (CLEAR_DATA_t *in, uint8_t *buffer, int maxlen);
+
+/**
+ @ingroup MESSAGES
+
+ Deserial clear data type fields from a network stream
+
+ @param buffer network stream
+ @param maxlen buffer limit
+ @param out output structure
+ @return 0 on success
+*/
+int deserial_clear_data (uint8_t *buffer, int maxlen, CLEAR_DATA_t *out);
+
__END_DECLS
#endif /* __MESSAGE_H__ */
uint8_t status; /**< status */
} STATUS_t;
+/**
+ @ingroup MESSAGES
+
+ Parse a string containing some clear data type fields
+
+ @param line string to analyse
+ @param out output structure
+ @return 0 on success
+*/
+int parse_clear_data (char *line, CLEAR_DATA_t *out);
+
+/**
+ @ingroup MESSAGES
+
+ Format clear data type fields into a string
+
+ @param in input structure
+ @param buffer output string
+ @param maxlen buffer limit
+ @return 0 on success
+*/
+int format_clear_data (CLEAR_DATA_t *in, char *buffer, int maxlen);
+
+/**
+ @ingroup MESSAGES
+
+ Serial clear data type fields into a network stream
+
+ @param in input structure
+ @param buffer network stream
+ @param maxlen buffer limit
+ @return buffer length
+*/
+int serial_clear_data (CLEAR_DATA_t *in, uint8_t *buffer, int maxlen);
+
+/**
+ @ingroup MESSAGES
+
+ Deserial clear data type fields from a network stream
+
+ @param buffer network stream
+ @param maxlen buffer limit
+ @param out output structure
+ @return 0 on success
+*/
+int deserial_clear_data (uint8_t *buffer, int maxlen, CLEAR_DATA_t *out);
+
__END_DECLS
#endif /* __MESSAGE_H__ */