/*
 * $RCSfile: romopt.h,v $
 *
 * x-kernel v3.3
 *
 * Copyright (c) 1993,1991,1990,1996  Arizona Board of Regents
 *
 * $Revision: 1.2 $
 * $Date: 1996/01/29 20:25:55 $
 */

#ifndef romopt_h
#define romopt_h

#ifndef upi_h
#include "upi.h"
#endif

#ifdef __STDC__
typedef XkReturn (*ProtlRomOptFunc)(Protl, char **, int, int, void *);
#else
typedef XkReturn (*ProtlRomOptFunc)();
#endif

typedef struct {
    char            *name;
    int             minFields;
    ProtlRomOptFunc func;
} ProtlRomOpt;

#ifdef __STDC__
typedef XkReturn (*RomOptFunc)(char **, int, int, void *);
#else
typedef XkReturn (*RomOptFunc)();
#endif

typedef struct {
    char       *name;
    int        minFields;
    RomOptFunc func;
} RomOpt;

/*
 * findProtlRomOpts -- Called by a protocol that has defined an array of RomOpt
 * structures.  If the first field of a romfile line matches either the
 * protocol name or the full instance name of the protocol, the romOpt array is
 * scanned.  If the second field of the line matches the name field of one of
 * the RomOpts, or if the name field of one of the romOpts is the empty string,
 * the RomOptFunc for that option is called with the object, all rom fields on
 * that line, the number of fields on that line, the line number and the
 * user-supplied argument.
 *
 * If the first field of a rom line appears to match the protocol but none of
 * the supplied RomOpts matches the second field, an error message will be
 * printed and XK_FAILURE will be returned.  The rest of the rom entries will
 * not be scanned.  This same behaviour results from the RomOptFunc returning
 * XK_FAILURE.
 *
 * Note that default (empty-string) RomOpts must come last in the RomOpt array.
 */
#ifdef __STDC__
XkReturn findProtlRomOpts(Protl, ProtlRomOpt *, int, void *arg);
#else
XkReturn findProtlRomOpts();
#endif

#ifdef __STDC__
XkReturn findRomOpts(char *, RomOpt *, int, void *arg);
#else
XkReturn findRomOpts();
#endif

#endif /* ! romopt_h */
