/*
 * This file is part of DesktopBSD, see the README file.
 *
 * Author: Peter Hofer <ph@desktopbsd.net>
 *         (C) 2004, 2005
 *
 * Copyright: BSD, see the COPYING file included in this distribution
 *
 */

#ifndef __IPV4ADDR_H
#define __IPV4ADDR_H

/* struct in_addr */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

class QString;

/** @brief Stores an IPv4 address.
  *
  * This class supports string and in_addr
  * conversions of IP addresses.
  */
class IPv4Addr {
public:
   IPv4Addr();
   IPv4Addr(const in_addr &);
   IPv4Addr(const QString &);

	bool	operator!=(const IPv4Addr &);
	bool	operator==(const IPv4Addr &);

   bool  setAddr(const QString &);
	void	setInvalid();
	bool	isValid() const;

   QString		toString()		const;
   in_addr_t	toInetAddr()	const;

protected:
	bool    valid;
   in_addr addr;
};

#endif /* __IPV4ADDR_H */
