Scopira 20080306

scopira::tool::netflow Class Reference

#include <netflow.h>

Inheritance diagram for scopira::tool::netflow:
scopira::tool::iflow_i scopira::tool::oflow_i scopira::tool::flow_i scopira::tool::flow_i scopira::tool::object scopira::tool::object

List of all members.

Public Types

enum  { tcp_nodelay_c = 1 }

Public Member Functions

 netflow (void)
 netflow (const netaddr *_addr, int _port, int socket_options=0)
virtual ~netflow ()
virtual bool failed (void) const
 are we in a failed state?
virtual size_t read (byte_t *_buf, size_t _maxsize)
 read raw block data, returns num read in
virtual size_t write (const byte_t *_buf, size_t _size)
 write a raw block of data
size_t read_short (byte_t *_buf, size_t _maxsize)
void open (const netaddr *_addr, int _port, int socket_options=0)
void close (void)
 close the file
bool accept (netflow &nconn)
bool read_ready (int msec)
const netaddrget_addr (void) const
 gets the address
int get_port (void) const
 gets the port

Protected Member Functions

void open_relay (socket_handle_t _fd, const flow_i::byte_t *_addr, int _addrlen, int _port)
 internal, used by server ::accept

Detailed Description

a network flow (TCP)

Aleksander Demko

Constructor & Destructor Documentation

scopira::tool::netflow::netflow ( void  )

default constructor, you can open() later.

Aleksander Demko
scopira::tool::netflow::netflow ( const netaddr _addr,
int  _port,
int  socket_options = 0 

Openning ctor. _addr may be null for servers. The pointer is not used after this call returns. (ie. it can be a termporary).

Aleksander Demko

Member Function Documentation

bool scopira::tool::netflow::accept ( netflow nconn)

(for server), opens the given connection to the new link returns true if a new linke came in, false on error

void scopira::tool::netflow::open ( const netaddr _addr,
int  _port,
int  socket_options = 0 

Opens a client socket, null _addr for server socket The _addr object is not refered to after this call (ie. it can be a termporary).

Aleksander Demko
bool scopira::tool::netflow::read_ready ( int  msec)

is anything in the input buffer, within the given time? (false==timeout) 1000msec = 1 second

TODO: in the future, add a select() like thing for a bunch of them (and perhaps for fileflow too?) and udpflow, etc? common base class for read_read'able things?

Aleksander Demko
size_t scopira::tool::netflow::read_short ( byte_t _buf,
size_t  _maxsize 

read raw block data, returns num read in this variant will return as soon as any data arrives though, so the return/read in size may often be less than _maxsize

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