/*
    GDAM - Geoff & Dave's Audio Mixer
    Copyright (C) 1999    Dave Benson, Geoff Matters.

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library 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
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA

    Contact:
        daveb@ffem.org <Dave Benson>
        geoff@ugcs.caltech.edu <Geoff Matters>
*/
#ifndef __GDAM_AUTHENTICATOR_H_
#define __GDAM_AUTHENTICATOR_H_

#include <gdam/common/gdambuffer.h>
#include <gdam/server/gdampermissions.h>
typedef struct _GdamAuthenticator GdamAuthenticator;

/*
 *                         GdamAuthenticator
 *
 * An authenticator does the initial handshaking with the
 * client, in the form of accepting `incoming_message's
 * and setting up a permission structure.
 */
struct _GdamAuthenticator {
	/*
	 * The authenticating virtual:
	 *      incoming_message      a message from the client.
	 *      perms_to_set          the client's permissions, to configure.
	 *      done_authenticating   should be set `TRUE' if the
	 *                            authentication is over (this
	 *                            will trigger the authenticator to
	 *                            be destroyed.
	 *
	 * Returns: buffer, which will have its length prepended
	 *          before being shoved off to the client.
	 */
        GdamBuffer     *(*authenticate)(GdamAuthenticator *auth,
                                        GdamBuffer       *incoming_message,
                                        GdamPermissions  *perms_to_set,
                                        gboolean         *done_authenticating,
                                        gboolean         *failed);
        void            (*destroy)(GdamAuthenticator*);
};

GdamAuthenticator       *gdam_authenticator_root();
GdamAuthenticator       *gdam_authenticator_none();

#endif
