Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Socket.h File Reference

#include <sys/stat.h>
#include <sys/time.h>
#include <limits.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include "assa/Address.h"
#include "assa/Streambuf.h"

Go to the source code of this file.

Namespaces

namespace  ASSA

Defines

#define BYTES_LEFT_IN_SOCKBUF(s)   ((s).eof () ? -1 : (s).in_avail ())
 BYTES_LEFT_IN_SOCKBUF macro returns number of unprocessed bytes left in ASSA's double-buffer from EventHandler::handle_read() callback.
#define BYTES_LEFT_IN_SIN   (cin.eof () ? -1 : cin.rdbuf ()->in_avail ())
 BYTES_LEFT_IN_SIN macro returns number of unprocessed bytes left in cin internal buffer.

Functions

Socket & flush (Socket &os_)
 flush manipulator.
Socket & endl (Socket &os_)
 endl manipulator.
Socket & ends (Socket &os_)
 ends manipulator.


Detailed Description

Abstraction of socket data type. This will be a subclass of instream

Definition in file Socket.h.


Define Documentation

#define BYTES_LEFT_IN_SIN   (cin.eof () ? -1 : cin.rdbuf ()->in_avail ())
 

BYTES_LEFT_IN_SIN macro returns number of unprocessed bytes left in cin internal buffer.

Definition at line 59 of file Socket.h.

#define BYTES_LEFT_IN_SOCKBUF  )     ((s).eof () ? -1 : (s).in_avail ())
 

BYTES_LEFT_IN_SOCKBUF macro returns number of unprocessed bytes left in ASSA's double-buffer from EventHandler::handle_read() callback.

Unless for a valid reason, this macro should always be called.

Parameters:
s Reference to ASSA::Socket

Definition at line 52 of file Socket.h.


Function Documentation

Socket& ASSA::endl Socket &  os_  )  [inline]
 

endl manipulator.

If you want to insert a newline character ('
') to terminate a text line, you should favor the manipulator endl. This manipulator inserts a newline character and also flushes the stream buffer.

Author:
Vladislav Grinchenko

Definition at line 602 of file Socket.h.

Referenced by ASSA::GenServer::display_help(), ASSA::FileLogger::dump(), ASSA::FileLogger::handle_rollover(), ASSA::GenServer::init(), and ASSA::Logger::log_open().

00603 {
00604     char c = '\n';
00605     os_.write (&c, 1);
00606     os_.flush ();
00607     return (os_);
00608 }

Socket& ASSA::ends Socket &  os_  )  [inline]
 

ends manipulator.

You can insert a null character (without flushing the output stream) with the manipulator ends. A common use for a Socket object is to mediate output to a stream buffer that constructs an in-memory character sequence. Such a sequence wants a terminating null character. The manipulator ends provides highly visible evidence that the null character is indeed being supplied.

Author:
Vladislav Grinchenko

Definition at line 622 of file Socket.h.

Referenced by ASSA::Semaphore::dump(), ASSA::Option::dump(), ASSA::FdSet::dump_c_str(), ASSA::Socket::dumpState(), ASSA::GenServer::get_version(), ASSA::GenServer::handle_signal(), ASSA::Reactor::registerIOHandler(), and ASSA::PidFileLock::write_pid().

00623 {
00624     char c = '\0';
00625     os_.write (&c, 1);
00626     return (os_);
00627 }

Socket& ASSA::flush Socket &  os_  )  [inline]
 

flush manipulator.

Flush a stream buffer.

Definition at line 587 of file Socket.h.

References ASSA::Socket::flush().

Referenced by ASSA::Logger_Impl::format_msg(), ASSA::RemoteLogger::log_close(), ASSA::FileLogger::log_close(), ASSA::RemoteLogger::log_func(), ASSA::FileLogger::log_func(), ASSA::RemoteLogger::log_msg(), ASSA::FileLogger::log_msg(), ASSA::RemoteLogger::log_open(), ASSA::FileLogger::log_raw_msg(), ASSA::StdOutLogger::log_resync(), ASSA::RemoteLogger::log_resync(), and ASSA::FileLogger::log_resync().

00588 {
00589     os_.flush ();
00590     return (os_);
00591 }


Generated on Mon Mar 26 22:47:36 2007 for libassa by  doxygen 1.4.2