00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef LIBOSC_INETUDPMASTER_H
00027 #define LIBOSC_INETUDPMASTER_H
00028
00029 #include "InetMaster.h"
00030 #include "InetTransportManager.h"
00031 #include "NullTransmit.h"
00032
00033 #ifdef LIBOSC_REPLY
00034 #include "InetUDPReplier.h"
00035 #endif
00036
00037 #include <sstream>
00038 #include <iosfwd>
00039
00051 class InetUDPMaster : public InetMaster
00052 {
00053 #ifdef LIBOSC_REPLY
00054 friend class InetUDPReplier;
00055 #endif
00056 public:
00063 InetUDPMaster (InetOSCAddrType addrType = OSC_IN_IPv4);
00064
00067 InetUDPMaster (InetUDPMaster &);
00068
00070 virtual ~InetUDPMaster ();
00071
00076 bool handle ();
00077
00084 bool transmit(const std::string& data);
00085
00094 bool transmitTo(struct sockaddr *address, const std::string &data);
00095
00100 const int getHandle () const;
00101
00112 bool setDestination (const std::string& host,
00113 const short port);
00114
00118 bool setReturnPort (const short port);
00119
00134 bool startlisten (const short port);
00135
00148 bool stoplisten ();
00149
00159 bool setTransportManager (InetTransportManager *const transMan);
00160
00165 void setProcessor (Processor *processor);
00166
00171 bool isListening ();
00172
00177 const std::string getStatusString (void);
00178
00183 virtual std::string getName();
00184
00185 virtual Transmit *clone ();
00186
00187 protected:
00188
00189
00190 private:
00191
00193 InetTransportManager *_transMan;
00194
00196 Processor *_processor;
00197
00199 bool _listening;
00200
00202 short _port;
00203
00205 struct sockaddr *_remoteSendAddr;
00206
00208 struct sockaddr *_remoteRecvAddr;
00209
00211 socklen_t _addrlen;
00212
00214 char _rbuf[OSC_DGRAM_MAXLENGTH];
00215
00216 };
00217
00218 #endif // #ifndef LIBOSC_INETUDPMASTER_H