summaryrefslogblamecommitdiffstats
path: root/src/net/mcast/McastConfiguration.h
blob: f10d487bef20a7a85296122163423f0b2ed453d5 (plain) (tree)






























                                                                               
                                                                 





                                                             

                                                                 



                                                             
                                                               






                                                   
                                                           













































































                                                                    
                                            
         
                                             
         
                                                              
         
                                             


                            









                                                                        






                                             
                                             

         








                               
                                    





                                  
                                      



                                  
/*
# Copyright (c) 2009 - OpenSLX Project, Computer Center University of Freiburg
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
#
# If you have any feedback please consult http://openslx.org/feedback and
# send your suggestions, praise, or complaints to feedback@openslx.org
#
# General information about OpenSLX can be found at http://openslx.org/
# -----------------------------------------------------------------------------
# src/net/mcast/McastConfiguration.h
#    - hold Multicast protocol configuration data
# -----------------------------------------------------------------------------
*/

#ifndef MCASTCONFIGURATION_H_
#define MCASTCONFIGURATION_H_

#include <QObject>
#include <QString>
#include <QtGlobal>

#include "McastConstants.h"

class McastConfiguration: public QObject
{
Q_OBJECT
public:
	McastConfiguration(QObject* parent = 0) :
		QObject(parent),
		_multicastInterface(DEFAULT_MULTICAST_INTERFACE),
		_multicastAddress(DEFAULT_MULTICAST_ADDRESS),
		_multicastRate(DEFAULT_MULTICAST_RATE),
		_multicastSPort(DEFAULT_MULTICAST_SPORT),
		_multicastDPort(DEFAULT_MULTICAST_DPORT),
		_multicastWinSize(DEFAULT_MULTICAST_WSIZ),
		_multicastMTU(DEFAULT_MULTICAST_MTU),
		_multicastUDPPortBase(DEFAULT_MULTICAST_UDPPORT),
		_multicastUseUDP(DEFAULT_MULTICAST_USEUDP)
	{
	}

	McastConfiguration(McastConfiguration const& other) :
		_multicastInterface(other._multicastInterface),
        QObject(),
        _multicastAddress(other._multicastAddress),
        _multicastRate(other._multicastRate),
        _multicastSPort(other._multicastSPort),
        _multicastDPort(other._multicastDPort),
        _multicastWinSize(other._multicastWinSize),
        _multicastMTU(other._multicastMTU),
        _multicastUDPPortBase(other._multicastUDPPortBase),
        _multicastUseUDP(other._multicastUseUDP)
	{
	}

	virtual ~McastConfiguration()
	{
	}

	QString multicastAddress() const
	{
		return _multicastAddress;
	}
	McastConfiguration* multicastAddress(QString const& address)
	{
		_multicastAddress = address;
		return this;
	}

	quint16 multicastSPort() const
	{
		return _multicastSPort;
	}
	McastConfiguration* multicastSPort(quint16 port)
	{
		_multicastSPort = port;
		return this;
	}

	quint16 multicastDPort() const
	{
		return _multicastDPort;
	}
	McastConfiguration* multicastDPort(quint16 port)
	{
		_multicastDPort = port;
		return this;
	}

	quint32 multicastRate() const
	{
		return _multicastRate;
	}
	McastConfiguration* multicastRate(quint32 rate)
	{
		_multicastRate = rate;
		return this;
	}

	quint16 multicastWinSize() const
	{
		return _multicastWinSize;
	}
	McastConfiguration* multicastWinSize(quint16 size)
	{
		_multicastWinSize = size;
		return this;
	}

	quint16 multicastMTU() const
	{
		return _multicastMTU;
	}
	McastConfiguration* multicastMTU(quint16 mtu)
	{
		_multicastMTU = mtu;
		return this;
	}

	bool multicastUseUDP() const
	{
		return _multicastUseUDP;
	}
	McastConfiguration* multicastUseUDP(bool useUDP)
	{
		_multicastUseUDP = useUDP;
		return this;
	}

	quint16 multicastUDPPortBase() const
	{
		return _multicastUDPPortBase;
	}
	McastConfiguration* multicastUDPPortBase(quint16 port)
	{
		_multicastUDPPortBase = port;
		return this;
	}

	QString multicastInterface() const
	{
		return _multicastInterface;
	}
	McastConfiguration* multicastInterface(QString const& interface)
	{
		_multicastInterface = interface;
		return this;
	}

	quint16 multicastUDPUPort() const
	{
		return _multicastUDPPortBase;
	}

	quint16 multicastUDPMPort() const
	{
		return _multicastUDPPortBase;
	}

	void commit()
	{
		emit changed();
	}

signals:
	void changed();

private:
	QString _multicastInterface;
	QString _multicastAddress;
	quint32 _multicastRate;
	quint16 _multicastSPort;
	quint16 _multicastDPort;
	quint16 _multicastWinSize;
	quint16 _multicastMTU;
	quint16 _multicastUDPPortBase;
	bool _multicastUseUDP;
};

#endif /* MCASTCONFIGURATION_H_ */