/*
 *   Copyright (c) 1996 David Parsons. All rights reserved.
 *   
 *   Redistribution and use in source and binary forms, with or without
 *   modification, are permitted provided that the following conditions
 *   are met:
 *  1. Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *  2. Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in
 *     the documentation and/or other materials provided with the
 *     distribution.
 *  3. All advertising materials mentioning features or use of this
 *     software must display the following acknowledgement:
 *     
 *   This product includes software developed by David Parsons
 *   (orc@pell.chi.il.us)
 *
 *  4. My name may not be used to endorse or promote products derived
 *     from this software without specific prior written permission.
 *     
 *  THIS SOFTWARE IS PROVIDED BY DAVID PARSONS ``AS IS'' AND ANY
 *  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 *  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 *  PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID
 *  PARSONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 *  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 *  IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 *  THE POSSIBILITY OF SUCH DAMAGE.
 */
#ifndef _MEDIA_D
#define _MEDIA_D

#include "util.h"

/*
 * media descriptor table: this gives all the ways we can mount installation
 * sets on the machine, indexed by mediatype (see above)
 */
enum mediatypes { M_VOID=0, M_ZIP, M_NET, M_CDROM, M_DOS, M_FILE };

extern void		*getmedia(enum mediatypes mtype);


struct diskmedia {	/* ZIP, CDROM, DOS PARTITON */
    char *mountpoint;		/* mount point */
    char *path;			/* file path from that mountpoint */
    char *opts;			/* mount options */
    int   fd;			/* file descriptor */
};

struct ethmedia {	/* ethernet connection */
    int   configured;
    char  *site, *path;
    int   dhcp;				/* if 0, use below to configure */
    char  address[20],
	  netmask[20],
	  gateway[20],
	  dns[20];
};

#if !MEDIA_C
/* An ungrateful person would ask "why in the name of G-d didn't you do
 * this as a C++ class??"   And they'd be right.
 */
extern int		mOpen(void *);
extern int		mClose(void *);
extern int		mEject(void *);
extern int		mLoad(void *);
extern int		mInstall(void *, char *);
extern enum mediatypes	mType(void*);
extern char		*mDesc(void*);
extern char		*mName(void*);
extern void		setmName(void*,char*);
extern char		*mDev(void*);
extern void		setmDev(void*,char*);
extern char		*mFS(void*);
extern void		setmFS(void*,char*);
extern void		*mData(void*);
extern void		setmData(void*,void*);
extern int		check_install_media(void*);
extern void		*newmDisk(char*,int);
extern void		*newmNetwork(char*);
extern void		*newmFile();
extern void		freeMedia(void*);
extern char		*describe_disk(void*);
extern void		*mPublic(void*);

#define DISK(x)	((struct diskmedia*)mPublic(x))
#define ETH(x)	((struct ethmedia*)mPublic(x))
#endif


#endif/*_MEDIA_D*/
