git-svn-id: svn://db.shs.com.ru/pip@635 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
/*! \file pimulticast.h
|
||||
* \brief Multicast for all interfaces, including loopback
|
||||
/*! \file pibroadcast.h
|
||||
* \brief Broadcast for all interfaces, including loopback
|
||||
*/
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
Multicast for all interfaces, including loopback
|
||||
Broadcast for all interfaces, including loopback
|
||||
Copyright (C) 2018 Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -20,33 +20,44 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PIMULTICAST_H
|
||||
#define PIMULTICAST_H
|
||||
#ifndef PIBROADCAST_H
|
||||
#define PIBROADCAST_H
|
||||
|
||||
#include "piethutilbase.h"
|
||||
#include "piethernet.h"
|
||||
|
||||
#define SMDEVICE_PORT 22555
|
||||
|
||||
class PIMulticast: public PIThread, public PIEthUtilBase {
|
||||
PIOBJECT(PIMulticast)
|
||||
class PIBroadcast: public PIThread, public PIEthUtilBase {
|
||||
PIOBJECT_SUBCLASS(PIBroadcast, PIThread)
|
||||
public:
|
||||
PIMulticast(bool send_only = false);
|
||||
~PIMulticast();
|
||||
|
||||
void setMulticastGroup(const PIString & mg) {mcast_address.setIP(mg);}
|
||||
enum Channel {
|
||||
Multicast = 0x01,
|
||||
Broadcast = 0x02,
|
||||
Loopback = 0x04,
|
||||
All = 0xFFFF,
|
||||
};
|
||||
typedef PIFlags<Channel> Channels;
|
||||
|
||||
PIBroadcast(bool send_only = false);
|
||||
~PIBroadcast();
|
||||
|
||||
void setChannels(Channels ch);
|
||||
Channels channels() const {return _channels;}
|
||||
|
||||
void setMulticastGroup(const PIString & mg);
|
||||
PIString multicastGroup() const {return mcast_address.ipString();}
|
||||
void setMulticastPort(ushort port) {mcast_address.setPort(port);}
|
||||
void setMulticastPort(ushort port);
|
||||
ushort multicastPort() const {return mcast_address.port();}
|
||||
void setMulticastAddress(const PIEthernet::Address & addr) {mcast_address = addr;}
|
||||
void setMulticastAddress(const PIEthernet::Address & addr);
|
||||
PIEthernet::Address multicastAddress() const {return mcast_address;}
|
||||
|
||||
void setBroadcastPort(ushort port) {bcast_port = port;}
|
||||
void setBroadcastPort(ushort port);
|
||||
ushort broadcastPort() {return bcast_port;}
|
||||
|
||||
void setLoopbackPort(ushort port) {lo_port = port;}
|
||||
void setLoopbackPort(ushort port);
|
||||
ushort loopbackPort() {return lo_port;}
|
||||
void setLoopbackPortsCount(int count) {lo_pcnt = count;}
|
||||
void setLoopbackPortsCount(int count);
|
||||
int loopbackPortsCount() const {return lo_pcnt;}
|
||||
|
||||
void startRead();
|
||||
@@ -65,6 +76,7 @@ private:
|
||||
void initAll(PIVector<PIEthernet::Address> al);
|
||||
void run();
|
||||
|
||||
Channels _channels;
|
||||
PIEthernet::Address mcast_address;
|
||||
PIMutex mcast_mutex;
|
||||
PIVector<PIEthernet*> eth_mcast;
|
||||
@@ -76,4 +88,4 @@ private:
|
||||
|
||||
};
|
||||
|
||||
#endif // PIMULTICAST_H
|
||||
#endif // PIBROADCAST_H
|
||||
Reference in New Issue
Block a user