#include <InetUDPMaster.h>
Inheritance diagram for InetUDPMaster:
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 | |
InetUDPMaster (InetOSCAddrType addrType=OSC_IN_IPv4) | |
constructor | |
InetUDPMaster (InetUDPMaster &) | |
copy constructor | |
virtual | ~InetUDPMaster () |
destructor | |
bool | handle () |
read incoming data from socket | |
bool | transmit (const std::string &data) |
transmit outgoing data | |
bool | transmitTo (struct sockaddr *address, const std::string &data) |
transmit outgoing data to a different address | |
const int | getHandle () const |
return socket descriptor | |
bool | setDestination (const std::string &host, const short port) |
set address and port of the destination host | |
bool | setReturnPort (const short port) |
set return port same as setDestination above, but specialized a bit. | |
bool | startlisten (const short port) |
start listening on port | |
bool | stoplisten () |
stop listening | |
bool | setTransportManager (InetTransportManager *const transMan) |
set the transport manager for this master | |
void | setProcessor (Processor *processor) |
set the processor for this object | |
bool | isListening () |
return listening status 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. | |
void | setReuseSockAddr (bool reuseAddr) |
set SO_REUSEADDR after socket creation | |
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 |
this class listens on a particular UDP port, transmits data using it or just transmits data without receiving
|
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 ...
|
|
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 human readable string describing the status of this object
Implements InetTransport. |
|
read incoming data from socket
Implements InetTransport. |
|
return listening status of this object
Implements InetMaster. |
|
set address and port of the destination host this method sets the destination address of data being sent with send()
|
|
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
Implements InetMaster. |
|
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
Implements InetMaster. |
|
start listening on port this method bounds the socket descriptor to a particular port for listening. all data sent by this object will appear as sent by this port at the other party, thus replies will occur at this object as well
Implements InetMaster. |
|
stop listening this method stops listening by deregistering this object from the service manager. sending data is still possible
Implements InetMaster. |
|
transmit outgoing data
Implements InetTransport. |
|
transmit outgoing data to a different address
|