libshevek
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
shevek::telnet Class Reference

Input and output filters for shevek::socket to make them telnet sockets. More...

#include <telnet.hh>

Inheritance diagram for shevek::telnet:
shevek::socket shevek::fd shevek::refbase

Public Member Functions

std::string & you_there ()
 Return the string that is used in reply to ARE_YOU_THERE requests. More...
 
- Public Member Functions inherited from shevek::socket
void listen_unix (std::string const &file, listen_t cb, unsigned queue=10)
 Listen for new connections on a UNIX socket. Use listen instead.
 
void listen_tcp (std::string const &service, listen_t cb, unsigned queue=10)
 Listen for new connections on a TCP socket. Use listen instead.
 
void listen_avahi (std::string const &service, Glib::ustring const &protocol, Glib::ustring const &name, listen_t cb, unsigned queue=10)
 Listen for new connections on a TCP socket, and register it with avahi. Use listen instead.
 
void listen (std::string const &port, listen_t cb, unsigned queue=10)
 Listen for new connections. More...
 
void connect_unix (std::string const &unix_name)
 Connect to a UNIX socket. Use connect instead.
 
void connect_tcp (std::string const &host, std::string const &service)
 Connect to a TCP socket. Use connect instead.
 
void connect_avahi (avahi::browser::owner const &target, avahi::browser::details const &details=avahi::browser::details())
 Connect to an avahi TCP socket. Use connect instead.
 
void connect (std::string const &port)
 Connect to a socket. More...
 
void accept (Glib::RefPtr< socket > sock)
 Accept a connection (only allowed on a listening socket).
 
std::string get_peer_info (bool numeric=false) const
 Get information about the other side of a connection.
 
std::string get_own_info (bool numeric=false) const
 Get info about our side of the connection.
 
disconnect_t signal_disconnect ()
 Schedule a function to be called when the socket is disconnected.
 
void disconnect ()
 Disconnect the socket without reconnecting.
 
- Public Member Functions inherited from shevek::fd
void read_custom (read_custom_t cb)
 Poll for read with a custom callback to poll. More...
 
void read_priority_custom (read_custom_t cb)
 Poll for priority read with a custom callback to poll.
 
void read (read_t cb)
 Poll for read and set read callback (resets custom callback) More...
 
void read_priority (read_t cb)
 Poll for priority read and set read callback (resets custom callback)
 
void read_lines (read_lines_t cb)
 Poll for read and set read lines callback (resets custom and read callback). Polls for priority read as well.
 
void unread (bool flush_buffer=false, flush_t cb=flush_t())
 Stop polling for read (including priority read).
 
void write (std::string const &data, write_done_t cb=write_done_t())
 Write data and set a callback (defaults to none).
 
void write_raw (std::string const &data, write_done_t cb=write_done_t())
 Write data, ignoring the filter, and set a callback (defaults to none).
 
bool write_block (relative_time timeout=relative_time(-1, 0))
 Block until write buffer is empty. More...
 
std::string & read_block (relative_time timeout=relative_time(-1, 0))
 Block until data is read, try writing if there is a write buffer. More...
 
std::string read_line_block (relative_time timeout=relative_time(-1, 0))
 Call read_block until a line has been read, or the timeout expires.
 
void set_fd (int fd)
 Change file descriptor.
 
void in_filter (filter_t cb)
 If set, incoming data is filtered through this callback before it is put into the buffer.
 
void out_filter (filter_t cb)
 If set, outgoing data is filtered through this callback before it is sent to the file descriptor.
 
void set_error (error_t cb)
 Set a callback for all error types at once. More...
 
void set_poll_error (error_t cb)
 Callback for errors from poll.
 
void set_read_error (error_t cb)
 Callback for errors from read.
 
void set_write_error (error_t cb)
 Callback for errors from write.
 
void set_eof (error_t cb)
 Callback for end of file.
 
void read_reset ()
 Stop reading, delete the buffer.
 
void write_reset ()
 Stop writing, delete the buffer.
 
void reset ()
 Stop reading and writing, delete the buffers.
 
int get_fd () const
 Get the fd. This function should mostly be used by derived classes.
 
Glib::RefPtr< Glib::MainContext > get_main_context ()
 Get the main context. Also mostly used by derived classes.
 
- Public Member Functions inherited from shevek::refbase
template<typename _T >
Glib::RefPtr< _T > cast_dynamic ()
 Identical to GLib::RefPtr <>::cast_dynamic, but nicer to type.
 

Static Public Member Functions

static Glib::RefPtr< telnetcreate (Glib::RefPtr< Glib::MainContext > main=Glib::MainContext::get_default())
 Create a new telnet socket.
 
- Static Public Member Functions inherited from shevek::socket
static Glib::RefPtr< socketcreate (Glib::RefPtr< Glib::MainContext > main=Glib::MainContext::get_default())
 Create a new socket.
 
- Static Public Member Functions inherited from shevek::fd
static Glib::RefPtr< fdcreate (int value=-1, Glib::RefPtr< Glib::MainContext > main=Glib::MainContext::get_default())
 Create a new fd.
 

Protected Member Functions

 telnet (Glib::RefPtr< Glib::MainContext > main)
 Derived classes have their own create function and may call the constructor.
 
- Protected Member Functions inherited from shevek::socket
 socket (Glib::RefPtr< Glib::MainContext > main)
 Constructor.
 
virtual ~socket ()
 Destructor.
 
- Protected Member Functions inherited from shevek::fd
 fd (int value, Glib::RefPtr< Glib::MainContext > main)
 Constructor.
 
 ~fd ()
 Destructor.
 
- Protected Member Functions inherited from shevek::refbase
 refbase ()
 Constructor, increments reference count.
 
virtual ~refbase ()
 Destructor, decrements reference count and destroys the object if it reaches 0.
 
template<typename T >
Glib::RefPtr< T > refptr_this ()
 Get a RefPtr to this, protected because only members should need it. More...
 

Additional Inherited Members

- Public Types inherited from shevek::socket
typedef sigc::signal0< void > disconnect_t
 Disconnect signal type.
 
typedef sigc::slot0< void > listen_t
 New connection callback type.
 
- Public Types inherited from shevek::fd
typedef sigc::slot0< void > read_custom_t
 Function pointer to call when data is read from fd.
 
typedef sigc::slot1< bool,
std::string & > 
read_t
 Function pointer to call when fd is ready for reading.
 
typedef sigc::slot1< void,
std::string const & > 
read_lines_t
 Function pointer to call when a complete line has arrived.
 
typedef sigc::slot0< void > error_t
 Function pointer to call when an error occurs.
 
typedef sigc::slot0< void > write_done_t
 Function pointer to call when data has been written.
 
typedef sigc::slot1< void,
std::string & > 
filter_t
 Function pointer to filter in and outgoing data.
 
typedef sigc::slot0< void > flush_t
 Function pointer to signal that all data is flushed after unread ()
 

Detailed Description

Input and output filters for shevek::socket to make them telnet sockets.

Member Function Documentation

std::string& shevek::telnet::you_there ( )

Return the string that is used in reply to ARE_YOU_THERE requests.

This can also be used to change the reply.


The documentation for this class was generated from the following file: