/* Blinker
Copyright 2011-2019 Stefan Schuermans <stefan@blinkenarea.org>
Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
a blinkenarea.org project */
#ifndef UDP4ADDR_H
#define UDP4ADDR_H
#include <netinet/in.h>
#include <string>
#include <sys/socket.h>
#include <sys/types.h>
#include "Addr.h"
namespace Blinker {
/// UDP v4 address
class Udp4Addr: public Addr
{
public:
/// constructor
Udp4Addr();
/// virtual destructor
virtual ~Udp4Addr();
public:
/// comparison
//@{
int compare(const Udp4Addr &that) const;
bool operator==(const Udp4Addr &that) const;
bool operator!=(const Udp4Addr &that) const;
bool operator<(const Udp4Addr &that) const;
bool operator>(const Udp4Addr &that) const;
bool operator<=(const Udp4Addr &that) const;
bool operator>=(const Udp4Addr &that) const;
//@}
/// return address family
virtual int getFamily() const;
/// return port (use this function only if absolutely necessary)
virtual int getPort() const;
/// set port (use this function only if absolutely necessary)
virtual void setPort(int port);
/**
* @brief parse from string format
* @param[in] str string format