/*
 * Nic: configuration for a network interface
 *
 * Copyright (c) 1998 David L Parsons 
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms are permitted
 * provided that the above copyright notice and this paragraph are
 * duplicated in all such forms and that any documentation,
 * advertising materials, and other materials related to such
 * distribution and use acknowledge that the software was developed
 * by David L Parsons (orc@pell.chi.il.us).  My name may not be used
 * to endorse or promote products derived from this software without
 * specific prior written permission.  THIS SOFTWARE IS PROVIDED
 * ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
 * WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE.
 */
#ifndef _NIC_D
#define _NIC_D

#ifdef TESTING
#define NET_DIR	"NET.CF"
#else
#define NET_DIR	"/etc/rc.d/net.cf"
#endif

#include <basis/Karray.H>

class Nic:public Karray {
private:
    int _found;			/* net configuration found on disk? */
    int _valid;			/* network device exists? */
    char *_device;		/* Nic this configuration is for */
    int _if_found(char *dev);
    int _if_first();
public:
    Nic(char*);			/* load configuration from disk */
    Nic();			/* get configuration for first interface */
    ~Nic();			/* clobber ourself */

    int isnew() 		{ return !_found; }
    int isvalid()		{ return _valid; } 
    char *device()		{ return _device; }

    int commit();		/* commit changes to disk */
    int Refresh();		/* load latest configuration */
    int dirty();		/* has the disk configuration been
				 * changed out from under us?
				 */
} ;

#endif/*_NIC_D*/
