#include <InetTCPSlave.h>
Inheritance diagram for InetTCPSlave:
Public Types | |
enum | InetOSCAddrType { OSC_IN_IPv4, OSC_IN_IPv6 } |
address family type More... | |
enum | InetOSCProto { OSC_IN_UDP, OSC_IN_TCP } |
protocol type More... | |
enum | InetOSCError { OSC_IN_SUCCESS = 0x0000, OSC_IN_UNKNOWN = 0x0001, OSC_IN_NOT_IDLE = 0x0002, OSC_IN_WOULDBLOCK = 0x0003, OSC_IN_MAXCYCLES = 0x0004, OSC_IN_CLOSED_CONN = 0x0005, OSC_IN_PROTO_UNKNOWN = 0x0100, OSC_IN_ADDR_UNKNOWN = 0x0101, OSC_IN_NO_PROCESSOR = 0x0200, OSC_IN_NO_TRANSMGR = 0x0201, OSC_IN_NO_TCPMASTER = 0x0202, OSC_IN_ALREADY_SLAVE = 0x0203, OSC_IN_NOT_SLAVE = 0x0204, OSC_IN_GETHOST_ERRNO = 0xC000, OSC_IN_GETPROTO_ERRNO = 0xC001, OSC_IN_SOCKET_ERRNO = 0xC002, OSC_IN_SETSOCKOPT_ERRNO = 0xC003, OSC_IN_FCNTL_ERRNO = 0xC004, OSC_IN_BIND_ERRNO = 0xC005, OSC_IN_LISTEN_ERRNO = 0xC006, OSC_IN_CONNECT_ERRNO = 0xC007, OSC_IN_SHUTDOWN_ERRNO = 0xC008, OSC_IN_CLOSE_ERRNO = 0xC009, OSC_IN_RECV_ERRNO = 0xC00A, OSC_IN_SEND_ERRNO = 0xC00B, OSC_IN_POLL_ERRNO = 0xC00C, OSC_IN_ACCEPT_ERRNO = 0xC00D, OSC_IN_MALLOC_ERRNO = 0xC00E } |
OSC Inet errors. More... | |
Public Member Functions | |
InetTCPSlave (InetTCPMaster *tcpMaster, InetOSCAddrType addrType, int socket, struct sockaddr *remoteAddr) | |
constructor | |
virtual | ~InetTCPSlave () |
destructor | |
bool | handle () |
read incoming data from socket | |
bool | transmit (const std::string &data) |
transmit outgoing data | |
const int | getHandle () const |
return socket descriptor | |
bool | disconnect () |
close connection and deregister from InetTCPMaster | |
const struct sockaddr *const | getRemoteAddr () const |
get a pointer to the struct sockaddr containing the remote host address | |
const std::string | getRemoteHost () const |
get the remote host name in string notation | |
const int | getRemotePort () const |
get the remote port | |
const bool | isConnected () const |
return connect status of this object | |
const bool | isWriteBlocking () const |
return current blocking on write setting of this object | |
void | setWriteBlocking (bool writeblock=true) |
set blocking on write behaviour of this object | |
const std::string | getStatusString (void) |
get human readable string describing the status of this object | |
virtual std::string | getName () |
get name (specializes getName in Transmit) | |
virtual Transmit * | clone () |
Copies self. | |
virtual bool | setReturnPort (const short) |
Set the return port. Defined only for UDP. A hack to get Max to work with wireTAP. | |
const InetOSCError | getError () const |
get last error | |
const int | getLastErrno () const |
get last errno code | |
const InetOSCAddrType | getAddrType (void) const |
get address type of this object | |
void | setMaxHandleCycles (const int cycles=-1) |
set maximum number of cycles in handle() | |
const int | getMaxHandleCycles (void) const |
get maximum number of cycles in handle() setting | |
Static Public Member Functions | |
static const bool | getErrorString (const InetOSCError err, std::string &errString) |
get a string description of an InetOSCError | |
Protected Member Functions | |
bool | justDisconnect () |
close connection with out deregistering | |
bool | createSocket (int *const sd, const InetOSCProto proto, const InetOSCAddrType addrType) |
create socket | |
bool | bindSocketToAny (int *const sd, const short port, const InetOSCAddrType addrType) |
bind socket to any local address | |
bool | closeSocket (int *const sd, const bool setError=true) |
close socket | |
bool | allocSockAddr (const InetOSCAddrType addrType, struct sockaddr **const addr, socklen_t *const addrlen) |
allocate memory for socket address structs | |
bool | setRemoteAddr (const std::string &host, const short port, const InetOSCAddrType addrType, struct sockaddr *const addr) |
resolve hostname and set remote address struct | |
bool | setRemotePort (const short port, const InetOSCAddrType addrType, struct sockaddr *const addr) |
This is here to support a hack which supports the Max wireTAP stack. | |
std::string | getHostAddress (const InetOSCAddrType addrType, const struct sockaddr *const addr) |
get character string notation out of a network address structure | |
std::string | getHostName (const InetOSCAddrType addrType, const struct sockaddr *const addr) |
reverse lookup hostname out of a network address structure | |
short | getPortNumber (const InetOSCAddrType addrType, const struct sockaddr *const addr) |
get port number out of a network address structure | |
bool | setSocketNonBlock (int *const sd) |
set a socket descriptor non blocking | |
bool | setSocketReuseAddr (int *const sd, bool reuse=true) |
set SO_REUSEADDR option of a socket descriptor | |
Protected Attributes | |
InetOSCAddrType | _addrType |
address type of this object | |
InetOSCError | _error |
error code of this object | |
int | _lasterrno |
last errno returned by system call | |
int | _socket |
socket descriptor | |
int | _maxHandleCycles |
maximum handle() cycles | |
Friends | |
class | InetTCPMaster |
|
address family type
|
|
OSC Inet errors. This enum is used to sign an error occurred in a OSCInet object An error usually is signed by a 'false' return value of methods in the OSCInet objects. Use getError() in these objects to get the error code.
|
|
protocol type
|
|
constructor
|
|
allocate memory for socket address structs allocates a struct sockaddr_inX according to the given address type
|
|
bind socket to any local address
|
|
close socket
|
|
create socket getprotobyname, socket ...
|
|
close connection and deregister from InetTCPMaster this method closes the connection, if it is established. it deregisters this object from the associated InetTCPMaster which deregisters it from serviceManager
|
|
get address type of this object
|
|
get last error
|
|
get a string description of an InetOSCError
|
|
return socket descriptor
Implements InetTransport. |
|
get character string notation out of a network address structure
|
|
reverse lookup hostname out of a network address structure
|
|
get last errno code
|
|
get maximum number of cycles in handle() setting
|
|
get name (specializes getName in Transmit)
Implements InetTransport. |
|
get port number out of a network address structure
|
|
get a pointer to the struct sockaddr containing the remote host address
|
|
get the remote host name in string notation
|
|
get the remote port
|
|
get human readable string describing the status of this object
Implements InetTransport. |
|
read incoming data from socket
Implements InetTransport. |
|
return connect status of this object
|
|
return current blocking on write setting of this object
|
|
close connection with out deregistering this method closes the connection, if it is established. it DOES NOT deregister this object from the associated InetTCPMaster which deregisters it from serviceManager.
|
|
set maximum number of cycles in handle() this method determines the maximum number of cycles to read within a handle() call. this is to avoid a "block" of the system if a handle() call never comes back on never-ending receiving of messages. handle() returns in any case if recv got EAGAIN. for InetUDPMaster this settings correlates directly to the maximum number of received OSC packets within one one handle() call, for InetTCPSlave this number means the the number of receive buffers filled within one handle() call, which may contain more or less OSC packets. for InetTCPMaster, this parameter means the maximum number of pending connections getting accepted within one handle() call.
|
|
resolve hostname and set remote address struct
|
|
This is here to support a hack which supports the Max wireTAP stack. The Max OSC objects won't let you send and receive UDP from the same socke t * (thus port): so you must receive OSC on a different port than you send on. * But the default behavior when someone sends a subscribe message is to * subscribe the host and port on which the request was sent (so the reply wi ll * go back to the same place.) The hack lets Max people send an integer value * in the subscribe message, which will be used as the port to send future * traffic back to, on the same address. This requires the ability to reset t he * port on a Transmit. But only really a UDPTransmit - except those don't exi st * anymore, they're InetUDPMasters now.
|
|
set a socket descriptor non blocking
|
|
set SO_REUSEADDR option of a socket descriptor
|
|
set blocking on write behaviour of this object
|
|
transmit outgoing data
Implements InetTransport. |