~ubuntu-branches/ubuntu/hardy/klibc/hardy-updates

« back to all changes in this revision

Viewing changes to usr/kinit/ipconfig/netdev.h

  • Committer: Bazaar Package Importer
  • Author(s): Jeff Bailey
  • Date: 2006-01-04 20:24:52 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060104202452-ec4v3n829rymukuv
Tags: 1.1.15-0ubuntu1
* New upstream version.

* Patch to fix compilation on parisc64 kernels.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * ipconfig/netdev.h
 
3
 */
 
4
#include <sys/utsname.h>
 
5
#include <net/if.h>
 
6
 
 
7
#define BPLEN           40
 
8
 
 
9
struct netdev {
 
10
        const char      *name;                  /* Device name          */
 
11
        unsigned int    ifindex;                /* interface index      */
 
12
        unsigned int    hwtype;                 /* ARPHRD_xxx           */
 
13
        unsigned int    hwlen;                  /* HW address length    */
 
14
        __u8            hwaddr[16];             /* HW address           */
 
15
        __u8            hwbrd[16];              /* Broadcast HW address */
 
16
        unsigned int    mtu;                    /* Device mtu           */
 
17
        unsigned int    caps;                   /* Capabilities         */
 
18
        time_t          open_time;
 
19
 
 
20
        struct {                                /* BOOTP/DHCP info      */
 
21
                int     fd;
 
22
                __u32   xid;
 
23
                __u32   gateway;                /* BOOTP/DHCP gateway   */
 
24
        } bootp;
 
25
 
 
26
        struct {                                /* RARP information     */
 
27
                int     fd;
 
28
        } rarp;
 
29
 
 
30
        __u32           ip_addr;                /* my address           */
 
31
        __u32           ip_broadcast;           /* broadcast address    */
 
32
        __u32           ip_server;              /* server address       */
 
33
        __u32           ip_netmask;             /* my subnet mask       */
 
34
        __u32           ip_gateway;             /* my gateway           */
 
35
        __u32           ip_nameserver[2];       /* two nameservers      */
 
36
        __u32           serverid;               /* dhcp serverid        */
 
37
        char            hostname[SYS_NMLN];     /* hostname             */
 
38
        char            dnsdomainname[SYS_NMLN];/* dns domain name      */
 
39
        char            nisdomainname[SYS_NMLN];/* nis domain name      */
 
40
        char            bootpath[BPLEN];        /* boot path            */
 
41
        struct netdev   *next;                  /* next configured i/f  */
 
42
};
 
43
 
 
44
/*
 
45
 * Device capabilities
 
46
 */
 
47
#define CAP_BOOTP       (1<<0)
 
48
#define CAP_DHCP        (1<<1)
 
49
#define CAP_RARP        (1<<2)
 
50
 
 
51
/*
 
52
 * Device states
 
53
 */
 
54
#define DEVST_UP        0
 
55
#define DEVST_BOOTP     1
 
56
#define DEVST_DHCPDISC  2
 
57
#define DEVST_DHCPREQ   3
 
58
#define DEVST_COMPLETE  4
 
59
#define DEVST_ERROR     5
 
60
 
 
61
int netdev_getflags(struct netdev *dev, short *flags);
 
62
int netdev_setaddress(struct netdev *dev);
 
63
int netdev_setdefaultroute(struct netdev *dev);
 
64
int netdev_up(struct netdev *dev);
 
65
int netdev_down(struct netdev *dev);
 
66
int netdev_init_if(struct netdev *dev);
 
67
int netdev_setmtu(struct netdev *dev);
 
68
 
 
69
static inline int netdev_running(struct netdev *dev)
 
70
{
 
71
        short flags;
 
72
        int ret = netdev_getflags(dev, &flags);
 
73
 
 
74
        return ret ? 0 : !!(flags & IFF_RUNNING);
 
75
}