/*
    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_DEVICE_H_
#define __GDAM_DEVICE_H_

#include "gdamsink.h"
#include "gdamacl.h"

/* Servers should call this to verify the user has
 * permission to open the device. */
gboolean       gdam_device_may_open      (const char*      device,
                                          GdamPermissions* permissions);

/* We form a registry of special sinks, which correspond to physical
 * devices... */
GdamSink      *gdam_device_open          (const char      *device_name);
GdamSink      *gdam_device_is_open       (const char      *device_name);

/* To register a device, you must provide a function that
 * opens it... the closing should be done in the `destroy'
 * signal. */
typedef GdamSink *(*GdamDeviceOpenFunc)  (gpointer        device_data,
                                          const char     *device_name,
                                          const char     *device_options);
void           gdam_device_register      (const char     *device_name,
                                          GdamDeviceOpenFunc open_func,
                                          gpointer        device_data,
                                          const char     *device_options,
                                          GdamAcl        *access_control);
void           gdam_device_register_prefix(const char    *devname_prefix,
                                          GdamDeviceOpenFunc open_func,
					  gpointer        device_data,
                                          const char     *device_options,
                                          GdamAcl        *access_control);

/* And the destroy function should call: */
void           gdam_device_is_closing    (GdamSink       *closed_device);

void           gdam_device_reopen        (const char     *device_name);

#endif
