/*
 * Copyright (C) 2007-2023 Xagasoft, All rights reserved.
 *
 * This file is part of the libbu++ library and is released under the
 * terms of the license contained in the file LICENSE.
 */

#ifndef BU_SERVER_SOCKET_H
#define BU_SERVER_SOCKET_H

#include <stdint.h>

namespace Bu
{
    class Socket;

    /**
     * Abstract representation of a server socket of some kind. Maybe socket
     * isn't strictly accurate. This could be a tcp/ip socket, a named
     * filesystem based socket, etc.
     *
     *@ingroup Serving
     */
    class ServerSocket
    {
    public:
        ServerSocket();
        virtual ~ServerSocket();

        /**
         * Accept a new connection, returning a connected Bu::Socket object.
         */
        virtual Bu::Socket *accept( int nTimeoutSec=0, int nTimeoutUSec=0 )=0;

        /**
         * Provide the contained file descriptor. Return false if there is no
         * internal file descriptor as such. If the return value is true, then
         * rFdOut will be set to the file descriptor.
         */
        virtual bool getFd( int &rFdOut ) const=0;
    };
}

#endif
