2020-05-08 12:42:02 +02:00
|
|
|
#ifndef CONEXION_H
|
|
|
|
#define CONEXION_H
|
|
|
|
#include "config_reader.h"
|
|
|
|
|
|
|
|
class conexion
|
|
|
|
{
|
|
|
|
public:
|
2020-06-01 23:24:24 +02:00
|
|
|
/**
|
|
|
|
* @brief conexion
|
|
|
|
* Create a conexion
|
|
|
|
* @param conf Config file to give the parameters of conexion
|
|
|
|
*/
|
2020-05-08 12:42:02 +02:00
|
|
|
conexion(config_reader &conf);
|
2020-06-01 23:24:24 +02:00
|
|
|
/**
|
|
|
|
* @brief read_string
|
|
|
|
* Read a string in the socket
|
|
|
|
* @param input String readed
|
|
|
|
* @param size Length to read
|
|
|
|
* @return Size of bytes readed
|
|
|
|
*/
|
|
|
|
virtual ssize_t read_string(std::string &input, int size);
|
|
|
|
/**
|
|
|
|
* @brief write_string
|
|
|
|
* Write a sitring in the socket
|
|
|
|
* @param output String to send
|
|
|
|
* @return bytes sended
|
|
|
|
*/
|
|
|
|
virtual ssize_t write_string(std::string output);
|
2020-06-02 15:21:59 +02:00
|
|
|
/**
|
|
|
|
* @brief get_conf
|
|
|
|
* Get the config object
|
|
|
|
* @return Config object
|
|
|
|
*/
|
|
|
|
config_reader* get_conf();
|
2020-05-08 12:42:02 +02:00
|
|
|
protected:
|
|
|
|
config_reader *config;
|
|
|
|
int fd;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CONEXION_H
|