git-svn-id: svn://db.shs.com.ru/pip@636 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2018-09-28 19:22:34 +00:00
parent 452350fcd9
commit 052fe86633
901 changed files with 23068 additions and 4078 deletions

View File

@@ -31,43 +31,98 @@ class PIBroadcast: public PIThread, public PIEthUtilBase {
PIOBJECT_SUBCLASS(PIBroadcast, PIThread)
public:
//! %PIBroadcast channels, can be used independently
enum Channel {
Multicast = 0x01,
Broadcast = 0x02,
Loopback = 0x04,
All = 0xFFFF,
Multicast /** Use multicast addresses */ = 0x01,
Broadcast /** Use broadcast addresses */ = 0x02,
Loopback /** Use loopback addresses */ = 0x04,
All /** Use all channels */ = 0xFFFF,
};
typedef PIFlags<Channel> Channels;
/** Contructs %PIBroadcast, if \"send_only\" not set
* all PIEthernets will be binded to receive data
* */
PIBroadcast(bool send_only = false);
~PIBroadcast();
//! Set channels to \"ch\" and queue to reinit
void setChannels(Channels ch);
//! Returns channels
Channels channels() const {return _channels;}
//! Returns if is send_only
bool isSendOnly() const {return _send_only;}
//! Set multicast IP to \"mg\" and queue to reinit
void setMulticastGroup(const PIString & mg);
//! Returns multicast IP
PIString multicastGroup() const {return mcast_address.ipString();}
//! Set multicast port to \"port\" and queue to reinit
void setMulticastPort(ushort port);
//! Returns multicast port
ushort multicastPort() const {return mcast_address.port();}
//! Set multicast address to \"addr\" and queue to reinit
void setMulticastAddress(const PIEthernet::Address & addr);
//! Returns multicast address
PIEthernet::Address multicastAddress() const {return mcast_address;}
//! Set broadcast port to \"port\" and queue to reinit
void setBroadcastPort(ushort port);
//! Returns broadcast port
ushort broadcastPort() {return bcast_port;}
//! Set loopback start port to \"port\" and queue to reinit
void setLoopbackPort(ushort port);
//! Returns loopback start port
ushort loopbackPort() {return lo_port;}
//! Set loopback ports count to \"count\" and queue to reinit
void setLoopbackPortsCount(int count);
//! Returns loopback ports count
int loopbackPortsCount() const {return lo_pcnt;}
//! If not send_only starts all threaded reads
void startRead();
//! Stop all threaded reads
void stopRead();
//! Reinit all PIEthernets with current \a PIEthernet::allAddresses()
void reinit();
//! Send packet
void send(const PIByteArray & data);
EVENT1(receiveEvent, PIByteArray, data)
//! \events
//! \{
//! \fn void receiveEvent(PIByteArray data)
//! \brief Raise on packet received
//! \}
protected:
//! Called when packet received
virtual void received(PIByteArray data) {}
private: