/**
 * @file
 * $Id$
 * $Revision$
 * $Author$
 * $Date$
 *
 * This file is part of The iWear Framework.
 *
 * The iWear Framework is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by the
 * Free Software Foundation as in version 2 of the License.

 * 
 * The iWear Framework is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * The iWear Framework; if not, write to the Free Software Foundation, Inc., 59
 * Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __IWEAR_UNIXCONNECTION_H
#define __IWEAR_UNIXCONNECTION_H

#ifndef __IWEAR_STREAMCONNECTION_H
#include <net/streamconnection.h>
#endif

#ifndef __IWEAR_IPV6ADDRESS_H
#include <net/ipv6address.h>
#endif

extern "C" {
}


namespace iwear
{
    namespace net
    {
/**
 * This class encapsulates a connection over a unix socket
 */	
class UnixConnection : public SocketConnection, public StreamConnection
{
private:
protected:
public:
   /**
    * A Unix Connection stays in either blocking or non-blocking mode for the
    * rest of its life. This is because changing it during runtime may affect
    * other portions of a program that might rely on this or that behaviour.
    */
    Unixconnection( block_mode bm = blocking, ip_version ipv = IPv4, int prot = 0);

    virtual ~Unixconnection();

   /**
    * This static function creates a proper Unixconnection that is able to
    * connect to the specified address type.
    */
    static Unixconnection* create_Unixconnection( const IPAddress& ip, block_mode bm  = non_blocking);

   /**
    * Issues a listen on the actual fd. A bind has to be called before this works
    */
    void listen( void );
    Connection* accept( double to = DEFAULT_TIMEOUT );
};
}
}
#endif

