Public Member Functions | Data Fields | Static Public Attributes | Protected Member Functions

Connection Struct Reference

#include <P_Connection.h>

Inherited by Server.

Collaboration diagram for Connection:
Collaboration graph
[legend]

Public Member Functions

int open (NetVCOptions const &opt=DEFAULT_OPTIONS)
 Create and initialize the socket for this connection.
int connect (sockaddr const *to, NetVCOptions const &opt=DEFAULT_OPTIONS)
 Connect the socket.
void setRemote (sockaddr const *remote_addr)
 Set the internal socket address struct.
int setup_mc_send (sockaddr const *mc_addr, sockaddr const *my_addr, bool non_blocking=NON_BLOCKING, unsigned char mc_ttl=1, bool mc_loopback=DISABLE_MC_LOOPBACK, Continuation *c=NULL)
int setup_mc_receive (sockaddr const *from, sockaddr const *my_addr, bool non_blocking=NON_BLOCKING, Connection *sendchan=NULL, Continuation *c=NULL)
int close ()
void apply_options (NetVCOptions const &opt)
virtual ~Connection ()
 Connection ()

Data Fields

SOCKET fd
 Socket for connection.
IpEndpoint addr
 Associated address.
bool is_bound
 Flag for already bound to a local address.
bool is_connected
 Flag for already connected.
int sock_type

Static Public Attributes

static NetVCOptions const DEFAULT_OPTIONS
 Default options.

Protected Member Functions

void _cleanup ()

Detailed Description

Definition at line 81 of file P_Connection.h.


Constructor & Destructor Documentation

Connection::~Connection (  )  [virtual]

Definition at line 79 of file Connection.cc.

References close().

Connection::Connection (  ) 

Definition at line 69 of file Connection.cc.

References addr.


Member Function Documentation

void Connection::_cleanup (  )  [protected]

Definition at line 354 of file UnixConnection.cc.

References close().

Referenced by connect(), and open().

void Connection::apply_options ( NetVCOptions const &  opt  ) 
int Connection::close (  ) 
int Connection::connect ( sockaddr const *  to,
NetVCOptions const &  opt = DEFAULT_OPTIONS 
)

Connect the socket.

The socket is connected to the remote addr and port. The opt structure is used to control blocking on the socket. All other options are set via open. It is important to pass the same opt to this method as was passed to open.

Returns:
0 on success, -ERRNO on failure.
See also:
open
Parameters:
to Remote address and port.
opt Socket options

Definition at line 320 of file UnixConnection.cc.

References _cleanup(), ats_ip_size(), NetVCOptions::f_blocking, NetVCOptions::f_blocking_connect, fd, ink_assert, is_bound, is_connected, NO_FD, safe_blocking(), safe_nonblocking(), and setRemote().

Referenced by UnixNetVConnection::connectUp().

int Connection::open ( NetVCOptions const &  opt = DEFAULT_OPTIONS  ) 
void Connection::setRemote ( sockaddr const *  remote_addr  )  [inline]

Set the internal socket address struct.

Parameters:
remote_addr Address and port.

Definition at line 122 of file P_Connection.h.

References addr, and ats_ip_copy().

Referenced by connect(), and ICPPeerReadCont::PeerReadStateMachine().

int Connection::setup_mc_receive ( sockaddr const *  from,
sockaddr const *  my_addr,
bool  non_blocking = NON_BLOCKING,
Connection sendchan = NULL,
Continuation c = NULL 
)
int Connection::setup_mc_send ( sockaddr const *  mc_addr,
sockaddr const *  my_addr,
bool  non_blocking = NON_BLOCKING,
unsigned char  mc_ttl = 1,
bool  mc_loopback = DISABLE_MC_LOOPBACK,
Continuation c = NULL 
)

Field Documentation

Default options.

Definition at line 145 of file P_Connection.h.

Flag for already bound to a local address.

Definition at line 85 of file P_Connection.h.

Referenced by close(), connect(), UnixNetVConnection::connectUp(), and open().

Flag for already connected.

Definition at line 86 of file P_Connection.h.

Referenced by close(), connect(), and UnixNetVConnection::connectUp().

Definition at line 87 of file P_Connection.h.

Referenced by apply_options(), UnixNetVConnection::connectUp(), and open().


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