#ifndef RAS_SESSION_H
#define RAS_SESSION_H

#include "socktool.h"
#include "connection.h"
#include "server.h"

#include <sys/types.h>

#define RAS_SESSION(x)  ((RasSession*)(x))

typedef struct {
	RasConn   conn;
	RasBuffer buffer;
	pid_t     shell_pid;
	int       shell_stdio;
	int       shell_use_pty : 1;
} RasSession;

int   ras_session_init (RasSession* sesssion, RasServer* server, int fd, int cid);
void  ras_session_destroy (RasSession* session);
char* ras_session_getline (RasSession* session, int* len);
int   ras_session_read_header (RasSession* session);
int   ras_session_start_shell (RasSession* session);

/* Access parent methods */
#define ras_session_log(x, ...) ras_conn_log(RAS_CONN(x), __VA_ARGS__)

#endif /* RAS_SESSION_H */