<commit_before>#ifndef PHYSICAL_H_
#define PHYSICAL_H_

#include <stdio.h>
#include <stdbool.h>
#include <termios.h>

typedef struct
{
    int fd;
    struct termios term;
} phy_connection;

phy_connection phy_open(const char* term);
ssize_t phy_write(const phy_connection* conn, const char* message, size_t size);
ssize_t phy_read(const phy_connection* conn, char* message, size_t max_size);
bool phy_close(phy_connection* conn);

#endif /* PHYSICAL_H_ */<commit_msg>Add header documentation (physical.h).<commit_after>#ifndef PHYSICAL_H_
#define PHYSICAL_H_

#include <stdio.h>
#include <stdbool.h>
#include <termios.h>

/*! \file physical.h
	\brief Physical layer interface.

	Lower level utility functions that allow the configuration of the serial port
	connection, as the transmission of generic information.
*/

/*! \struct phy_connection
 *	\brief  Physical connection structure.
 *
 *	Encapsulates information about the connection established between the sender
 *	and the receiver.
 */
typedef struct
{
    int fd;					/*!< serial connection file descriptor */
    struct termios term;	/*!< definitions used by the terminal I/O interface */
} phy_connection;

/*! \brief Opens the connection identified by term.
 *
 * \param term connection identifier.
 * \return phy_connection with a positive fd on success, negative otherwise.
 */
phy_connection phy_open(const char* term);

/*! \brief Writes a message with a size given as a parameter to the connection buffer.
 *
 * \param conn connection properties.
 * \param message information to be sent.
 * \param size message size in bytes.
 * \return nonnegative integer on sucess, negative otherwise.
 */
ssize_t phy_write(const phy_connection* conn, const char* message, size_t size);

/*! \brief Reads a message with a size given as parameter from the connection buffer.
 *
 *	\param conn connection properties.
 *	\param message buffer where the read information will be stored.
 *	\param max_size maximum message size.
 */
ssize_t phy_read(const phy_connection* conn, char* message, size_t max_size);

/*! \brief Closes the connection identified by a term.
 *
 *	\param conn connection properties.
 *	\return true on sucess, false otherwise.
 */
bool phy_close(phy_connection* conn);

#endif /* PHYSICAL_H_ */
{'fraction_non_alphanumeric': 0.09118942731277534, 'fraction_numerical': 0.0, 'mean_word_length': 4.330985915492958, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1648118', 'n_tokens_mistral': 692, 'n_tokens_neox': 657, 'n_words': 255}