#ifndef H_NET
#define H_NET

#include "bptypes.h"
#include "devices.h"

struct netInterface {
    int isConfigured, isUp;
    char dev[10];
    int useBootp;

    int isPtp;			/* if true, netmask and broadcast are
				   meaningless and network is the machine
				   on the other side of the link */

    /* broadcast and netmask don't really need to be here, but it keeps our
       interface configuration ioctl()'s a bit more generic */
    int32 ip, netmask, broadcast, network;
} ;

struct netConfig {
    int isConfigured;
    char hostname[255];
    char domainname[255];
    char * nameserver[3];
    char defaultGateway[255];
} ;

int readNetInterfaceConfig(char * prefix, char * device,
				  struct netInterface * intf);
int writeNetInterfaceConfig(char * prefix, struct netInterface * intf);
int writeNetConfig(char * prefix, struct netConfig * netc, 
		   struct netInterface * gwdev, int verbose);
int writeResolvConf(char * prefix, struct netConfig * netc);
int writeHosts(char * prefix, struct netConfig * netc, 
	       struct netInterface * intf);
int readNetConfig(char * prefix, struct netConfig * netc);
int addDefaultRoute(struct netConfig netc);
int bringUpNetworking(struct netInterface * intf, struct netConfig * netc,
		      struct driversLoaded ** dl);
int checkNetConfig(struct netInterface * intf, struct netConfig * netc,
		   struct driversLoaded ** dl);
int netDeviceAvailable(char * device);

#endif