/*
 * netconfig_net.h:
 *
 * See the README file for copyright information and how to reach the author.
 *
 * $Id: netconfig_net.h,v 1.1.1.1 2005/06/27 13:37:56 cm Exp $
 */

#ifndef __NCNET_H
#define __NCNET_H

#include <netinet/in.h>

enum eSockAddr { saAddress, saNetmask, saBroadcast, saHwAddr };
enum eIntValue { ivMtu, ivMetric };

class cNetconfigNetDevice {
  private:
    bool TestFlag(const char *device, short flag);
    const struct sockaddr *SetSockAddr(const char *device, eSockAddr type, struct sockaddr *addr);
    const struct sockaddr *GetSockAddr(const char *device, eSockAddr type);
    int GetIValue(const char *device, eIntValue);
  public:
    cNetconfigNetDevice();
    ~cNetconfigNetDevice();
    bool isUp(const char *device);
    bool isLoopback(const char *device);
    bool isMulticast(const char *device);
    bool isPointToPoint(const char *device);
    bool isRunning(const char *device);
    bool isPromiscuous(const char *device);
    bool isBroadcast(const char *device);
    bool SetState(const char *device, bool up);
    unsigned long GetAddr(const char *device);
    unsigned long SetAddr(const char *device, unsigned long addr);
    unsigned long GetMask(const char *device);
    unsigned long SetMask(const char *device, unsigned long mask);
    unsigned long GetBcast(const char *device);
    unsigned long SetBcast(const char *device, unsigned long bcast);
    struct sockaddr *GetHwAddr(const char *device);
    int GetMetric(const char *device);
    int GetMtu(const char *device);
};

#endif
