Thread portable class


Gate portable class


Timer class


Pool class


Terimber 2.0


About C++


Downloads Products & Services Support Clients Open Source About



Home / Open source / Terimber 2.0

msg_sock_listener Class Reference

class implements the socket listener that supports both types of connection More...

#include <msg_sock.h>

Inheritance diagram for msg_sock_listener:

msg_listener terimber_aiosock_callback msg_base terimber_log_helper terimber_log

List of all members.

Public Member Functions

 msg_sock_listener (msg_communicator *communicator, const conf_listener &info)
 costructor
virtual ~msg_sock_listener ()
 destructor
virtual transport_type get_type () const
 returns the sock listener type

Protected Member Functions

virtual void v_on ()
 action on turn on
virtual void v_off ()
 action on turn off
virtual void v_on_error (size_t handle, int err, aiosock_type mask, void *userdata)
 port will call function after error occured
virtual void v_on_connect (size_t handle, const sockaddr_in &peeraddr, void *userdata)
 port will call function after successfully connecting to socket
virtual void v_on_send (size_t handle, void *buf, size_t requested, size_t processed, const sockaddr_in &peeraddr, void *userdata)
 port will call function after successfully sending buffer to socket
virtual void v_on_receive (size_t handle, void *buf, size_t requested, size_t processed, const sockaddr_in &peeraddr, void *userdata)
 port will call function after successfully receiving buffer from socket
virtual void v_on_accept (size_t handle, size_t handle_accepted, terimber_aiosock_callback *&callback, const sockaddr_in &peeraddr, void *userdata)
 port will call function after successfully accepting the new incoming connection user can change the callback, by default it's an object which created a listener

Private Attributes

size_t _handle
 socket handle


Detailed Description

class implements the socket listener that supports both types of connection

Definition at line 149 of file msg_sock.h.


Constructor & Destructor Documentation

msg_sock_listener::msg_sock_listener ( msg_communicator communicator,
const conf_listener info 
)

costructor

Parameters:
communicator  communicator pointer
info  listener info

Definition at line 444 of file msg_sock.cpp.

msg_sock_listener::~msg_sock_listener (  )  [virtual]

destructor

Definition at line 450 of file msg_sock.cpp.

References msg_base::_communicator, _handle, aiosock::close(), and msg_communicator::get_aiosock().


Member Function Documentation

virtual transport_type msg_sock_listener::get_type (  )  const [inline, virtual]

returns the sock listener type

Implements msg_listener.

Definition at line 163 of file msg_sock.h.

References sock.

void msg_sock_listener::v_on (  )  [protected, virtual]

void msg_sock_listener::v_off (  )  [protected, virtual]

action on turn off

Reimplemented from msg_base.

Definition at line 479 of file msg_sock.cpp.

References msg_base::_communicator, _handle, aiosock::close(), msg_communicator::get_aiosock(), msg_base::is_on(), and msg_base::v_off().

void msg_sock_listener::v_on_error ( size_t  handle,
int  err,
aiosock_type  mask,
void *  userdata 
) [protected, virtual]

port will call function after error occured

aio callbacks

Parameters:
handle  socket handle
err  error code
mask  reason
userdata  user defined data

Implements terimber_aiosock_callback.

Definition at line 496 of file msg_sock.cpp.

References _handle.

void msg_sock_listener::v_on_connect ( size_t  handle,
const sockaddr_in &  peeraddr,
void *  userdata 
) [protected, virtual]

port will call function after successfully connecting to socket

Parameters:
handle  socket handle
peeraddr  peer address
userdata  user defined data

Implements terimber_aiosock_callback.

Definition at line 504 of file msg_sock.cpp.

void msg_sock_listener::v_on_send ( size_t  handle,
void *  buf,
size_t  requested,
size_t  processed,
const sockaddr_in &  peeraddr,
void *  userdata 
) [protected, virtual]

port will call function after successfully sending buffer to socket

Parameters:
handle  socket handle
buf  buffer
requested  requested bytes to send
processed  actually porcessed bytes
peeraddr  peer address
userdata  user defined data

Implements terimber_aiosock_callback.

Definition at line 512 of file msg_sock.cpp.

void msg_sock_listener::v_on_receive ( size_t  handle,
void *  buf,
size_t  requested,
size_t  processed,
const sockaddr_in &  peeraddr,
void *  userdata 
) [protected, virtual]

port will call function after successfully receiving buffer from socket

Parameters:
handle  socket handle
buf  buffer
requested  requested bytes to receive
processed  actually processed bytes
peeraddr  peer address
userdata  user defined data

Implements terimber_aiosock_callback.

Definition at line 520 of file msg_sock.cpp.

void msg_sock_listener::v_on_accept ( size_t  handle,
size_t  handle_accepted,
terimber_aiosock_callback *&  callback,
const sockaddr_in &  peeraddr,
void *  userdata 
) [protected, virtual]

port will call function after successfully accepting the new incoming connection user can change the callback, by default it's an object which created a listener

Parameters:
handle  listener handle
handle_accepted  accepted socket handle
callback  aiosock callback
peeraddr  peer address
userdata  user defined data

Implements terimber_aiosock_callback.

Definition at line 528 of file msg_sock.cpp.

References msg_base::_communicator, _handle, msg_listener::_info, and msg_sock_connection::accept().


Member Data Documentation

size_t msg_sock_listener::_handle [private]

socket handle

Definition at line 227 of file msg_sock.h.

Referenced by v_off(), v_on(), v_on_accept(), v_on_error(), and ~msg_sock_listener().


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


© Copyright Terimber 2003-.