SYNOPSIS

#include <socket.h>

Inherits ost::Socket.

Public Member Functions

virtual bool onAccept (const IPV4Host &ia, tpport_t port)

A method to call in a derived DCCPSocket class that is acting as a server when a connection request is being accepted. virtual bool onAccept (const IPV6Host &ia, tpport_t port)

virtual IPV4Host getIPV4Sender (tpport_t *port=NULL) const

virtual IPV6Host getIPV6Sender (tpport_t *port=NULL) const

DCCPSocket (const IPV4Address &bind, tpport_t port, unsigned backlog=5)

A DCCP 'server' is created as a DCCP socket that is bound to a hardware address and port number on the local machine and that has a backlog queue to listen for remote connection requests. DCCPSocket (const IPV6Address &bind, tpport_t port, unsigned backlog=5)

DCCPSocket (const char *name, Family family=IPV4, unsigned backlog=5)

Create a named dccp socket by service and/or interface id. DCCPSocket (Family family=IPV4)

Create an unconnected ephemeral DCCP client socket. DCCPSocket (DCCPSocket &server, timeout_t timeout=0)

Create a server session by accepting a DCCP Socket. void reject (void)

Used to reject the next incoming connection request. void disconnect (void)

Disconnect active dccp connection (client use). bool setCCID (uint8 ccid)

Set CCID DCCP. int getTxCCID ()

Get TX CCID DCCP. int getRxCCID ()

Get RX CCID DCCP. size_t available ()

Return number of bytes to be read. void connect (const IPV4Host &host, tpport_t port, timeout_t timeout=0)

Create a DCCP client connection to a DCCP socket (on a remote machine). void connect (const IPV6Host &host, tpport_t port, timeout_t timeout=0)

void connect (const char *name)

Connect to a named client. bool isPendingConnection (timeout_t timeout=TIMEOUT_INF)

Used to wait for pending connection requests. virtual ~DCCPSocket ()

Use base socket handler for ending this socket.

Additional Inherited Members

Detailed Description

DCCP sockets are used for stream based connected sessions between two sockets.

Both error recovery and flow control operate transparently for a DCCP socket connection. The DCCP socket base class is used both for client connections and to bind a DCCP 'server' for accepting DCCP streams.

An implicit and unique DCCPSocket object exists in Common C++ to represent a bound DCCP socket acting as a 'server' for receiving connection requests. This class is not part of DCCPStream because such objects normally perform no physical I/O (read or write operations) other than to specify a listen backlog queue and perform 'accept' operations for pending connections. The Common C++ DCCPSocket offers a Peek method to examine where the next pending connection is coming from, and a Reject method to flush the next request from the queue without having to create a session.

The DCCPSocket also supports a 'OnAccept' method which can be called when a DCCPStream related object is created from a DCCPSocket. By creating a DCCPStream from a DCCPSocket, an accept operation automatically occurs, and the DCCPSocket can then still reject the client connection through the return status of it's OnAccept method.

Author:

Leandro Sales [email protected]

Heverton Stuart [email protected] bound server for DCCP streams and sessions.

Constructor & Destructor Documentation

ost::DCCPSocket::DCCPSocket (const \fBIPV4Address\fP &bind, \fBtpport_t\fPport, unsignedbacklog = \fC5\fP)

A DCCP 'server' is created as a DCCP socket that is bound to a hardware address and port number on the local machine and that has a backlog queue to listen for remote connection requests. If the server cannot be created, an exception is thrown.

Parameters:

bind local ip address or interface to use.

port number to bind socket under.

backlog size of connection request queue.

ost::DCCPSocket::DCCPSocket (const \fBIPV6Address\fP &bind, \fBtpport_t\fPport, unsignedbacklog = \fC5\fP)

ost::DCCPSocket::DCCPSocket (const char *name, \fBFamily\fPfamily = \fC\fBIPV4\fP\fP, unsignedbacklog = \fC5\fP)

Create a named dccp socket by service and/or interface id. For IPV4 we use [host:]svc or [host/]svc for the string. If we have getaddrinfo, we use that to obtain the addr to bind for.

Parameters:

name of host interface and service port to bind.

backlog size of connection request queue.

ost::DCCPSocket::DCCPSocket (\fBFamily\fPfamily = \fC\fBIPV4\fP\fP)

Create an unconnected ephemeral DCCP client socket.

ost::DCCPSocket::DCCPSocket (\fBDCCPSocket\fP &server, \fBtimeout_t\fPtimeout = \fC0\fP)

Create a server session by accepting a DCCP Socket.

virtual ost::DCCPSocket::~DCCPSocket ()\fC [virtual]\fP

Use base socket handler for ending this socket.

Member Function Documentation

size_t ost::DCCPSocket::available ()

Return number of bytes to be read.

void ost::DCCPSocket::connect (const \fBIPV4Host\fP &host, \fBtpport_t\fPport, \fBtimeout_t\fPtimeout = \fC0\fP)

Create a DCCP client connection to a DCCP socket (on a remote machine).

Parameters:

host address of remote DCCP server.

port number to connect.

void ost::DCCPSocket::connect (const \fBIPV6Host\fP &host, \fBtpport_t\fPport, \fBtimeout_t\fPtimeout = \fC0\fP)

void ost::DCCPSocket::connect (const char *name)

Connect to a named client.

void ost::DCCPSocket::disconnect (void)

Disconnect active dccp connection (client use).

virtual \fBIPV4Host\fP ost::DCCPSocket::getIPV4Sender (\fBtpport_t\fP *port = \fCNULL\fP) const\fC [virtual]\fP

Reimplemented from ost::Socket.

virtual \fBIPV6Host\fP ost::DCCPSocket::getIPV6Sender (\fBtpport_t\fP *port = \fCNULL\fP) const\fC [virtual]\fP

Reimplemented from ost::Socket.

int ost::DCCPSocket::getRxCCID ()

Get RX CCID DCCP.

int ost::DCCPSocket::getTxCCID ()

Get TX CCID DCCP.

bool ost::DCCPSocket::isPendingConnection (\fBtimeout_t\fPtimeout = \fC\fBTIMEOUT_INF\fP\fP)\fC [inline]\fP

Used to wait for pending connection requests.

Returns:

true if data packets available.

Parameters:

timeout in milliseconds. TIMEOUT_INF if not specified.

References ost::Socket::isPending(), and ost::Socket::pendingInput.

virtual bool ost::DCCPSocket::onAccept (const \fBIPV4Host\fP &ia, \fBtpport_t\fPport)\fC [virtual]\fP

A method to call in a derived DCCPSocket class that is acting as a server when a connection request is being accepted. The server can implement protocol specific rules to exclude the remote socket from being accepted by returning false. The Peek method can also be used for this purpose.

Returns:

true if client should be accepted.

Parameters:

ia internet host address of the client.

port number of the client.

virtual bool ost::DCCPSocket::onAccept (const \fBIPV6Host\fP &ia, \fBtpport_t\fPport)\fC [virtual]\fP

void ost::DCCPSocket::reject (void)

Used to reject the next incoming connection request.

bool ost::DCCPSocket::setCCID (\fBuint8\fPccid)

Set CCID DCCP.

Member Data Documentation

struct sockaddr_in ost::DCCPSocket::ipv4

struct sockaddr_in6 ost::DCCPSocket::ipv6

Author

Generated automatically by Doxygen for GNU CommonC++ from the source code.