1 #ifndef SCD_COMMAND_READER_H
2 #define SCD_COMMAND_READER_H
4 #include "scd_command.h"
5 #include "scd_socket.h"
8 * Reads commands from a socket. The receiption does not have to complete
9 * withing one call. As long as it is ongoing the socket shall not be read
12 class scd_command_reader
17 virtual ~scd_command_reader();
20 * Sets the socket to read from. Do not try to read before setting the
23 void set_socket(scd_socket &sock);
26 * Initiates reading a command if it is not reading yet or continues
27 * to read a previously unfinished command.
32 * Indicates if a command is being read. This is the case between calling
33 * read() and the completion of the command (or failure if an illegal
34 * command was received).
35 * \return true if a command is currently being received
40 * Indicates if a command has been received successfully and is ready
42 * \return true if a command can be collected
47 * Returns a successfully received command. The application has to free
48 * it by itself. The reader does not keep a reference.
49 * \return the command or NULL if has_command() is false
51 scd_command* get_command();
55 scd_command* _command;
61 char _header_buf[SCD_CM_HEADER];