From: Mazet Laurent Date: Tue, 8 Apr 2025 01:20:58 +0000 (+0200) Subject: wip X-Git-Tag: v1.0~58 X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=c79bcecf5b4737550143de2185fdcd467249daa0;p=morep.git wip --- diff --git a/pdu_channel.h b/pdu_channel.h index 6d30cb0..4a7eb79 100644 --- a/pdu_channel.h +++ b/pdu_channel.h @@ -1,7 +1,7 @@ /* - 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 @@ -12,8 +12,8 @@ - initial version */ -#ifndef __MESSAGE_H__ -#define __MESSAGE_H__ +#ifndef __CHANNEL_H__ +#define __CHANNEL_H__ #include #include @@ -30,8 +30,55 @@ typedef struct { 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: */ diff --git a/pdu_encrypted_data.h b/pdu_encrypted_data.h index 41c91ec..f4780a2 100644 --- a/pdu_encrypted_data.h +++ b/pdu_encrypted_data.h @@ -34,6 +34,53 @@ typedef struct { 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__ */ diff --git a/pdu_key.h b/pdu_key.h index ad58f9c..560fc9c 100644 --- a/pdu_key.h +++ b/pdu_key.h @@ -30,6 +30,53 @@ typedef struct { 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__ */ diff --git a/pdu_prng_param.h b/pdu_prng_param.h index bbe9b16..79335cd 100644 --- a/pdu_prng_param.h +++ b/pdu_prng_param.h @@ -31,6 +31,53 @@ typedef struct { 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__ */ diff --git a/pdu_status.h b/pdu_status.h index aef2288..5b3d326 100644 --- a/pdu_status.h +++ b/pdu_status.h @@ -29,6 +29,53 @@ typedef struct { 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__ */