#include <InetMaster.h>
Inheritance diagram for InetMaster:
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 | |
InetMaster () | |
constructor | |
virtual | ~InetMaster () |
destructor | |
virtual bool | startlisten (const short port)=0 |
start listening on port | |
virtual bool | stoplisten ()=0 |
stop listening | |
virtual void | setProcessor (Processor *processor)=0 |
set the processor for this object | |
virtual bool | isListening ()=0 |
return listening status of this object | |
virtual bool | setTransportManager (InetTransportManager *const transMan)=0 |
set the transport manager for this master | |
void | setReuseSockAddr (bool reuseAddr) |
set SO_REUSEADDR after socket creation | |
bool | handle ()=0 |
handle the service | |
bool | transmit (const std::string &data)=0 |
transmit outgoing data | |
virtual const int | getHandle () const =0 |
the network socket descriptor used by the service | |
virtual const std::string | getStatusString (void)=0 |
get human readable string describing the status of this object | |
virtual std::string | getName ()=0 |
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 | 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 | |
bool | _reuseAddr |
true: set SO_REUSEADDR on socket | |
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 |
|
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
|
|
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 ...
|
|
get address type of this object
|
|
get last error
|
|
get a string description of an InetOSCError
|
|
the network socket descriptor used by the service this is used e.g. by the InetServiceManager to call a poll()
Implemented in InetTCPMaster, InetTCPSlave, and InetUDPMaster. |
|
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)
Reimplemented from Transmit. Implemented in InetTCPMaster, InetTCPSlave, and InetUDPMaster. |
|
get port number out of a network address structure
|
|
get human readable string describing the status of this object
Implemented in InetTCPMaster, InetTCPSlave, and InetUDPMaster. |
|
handle the service
Implements Service. Implemented in InetTCPMaster, InetTCPSlave, and InetUDPMaster. |
|
return listening status of this object
Implemented in InetTCPMaster, and InetUDPMaster. |
|
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.
|
|
set the processor for this object
Implemented in InetTCPMaster, and InetUDPMaster. |
|
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 SO_REUSEADDR after socket creation
|
|
set a socket descriptor non blocking
|
|
set SO_REUSEADDR option of a socket descriptor
|
|
set the transport manager for this master
Implemented in InetTCPMaster, and InetUDPMaster. |
|
start listening on port
Implemented in InetTCPMaster, and InetUDPMaster. |
|
stop listening
Implemented in InetTCPMaster, and InetUDPMaster. |
|
transmit outgoing data
Implements Transmit. Implemented in InetTCPMaster, InetTCPSlave, and InetUDPMaster. |