~ubuntu-branches/ubuntu/trusty/libdumbnet/trusty

« back to all changes in this revision

Viewing changes to include/dnet/intf.h

  • Committer: Bazaar Package Importer
  • Author(s): Simon Law
  • Date: 2003-11-13 01:44:56 UTC
  • Revision ID: james.westby@ubuntu.com-20031113014456-6bbmmk2g5clgz71s
Tags: upstream-1.7
ImportĀ upstreamĀ versionĀ 1.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * intf.c
 
3
 *
 
4
 * Network interface operations.
 
5
 *
 
6
 * Copyright (c) 2000 Dug Song <dugsong@monkey.org>
 
7
 *
 
8
 * $Id: intf.h,v 1.15 2002/12/14 04:02:36 dugsong Exp $
 
9
 */
 
10
 
 
11
#ifndef DNET_INTF_H
 
12
#define DNET_INTF_H
 
13
 
 
14
/*
 
15
 * Interface entry
 
16
 */
 
17
#define INTF_NAME_LEN   16
 
18
 
 
19
struct intf_entry {
 
20
        u_int           intf_len;                   /* length of entry */
 
21
        char            intf_name[INTF_NAME_LEN];   /* interface name */
 
22
        u_short         intf_type;                  /* interface type (r/o) */
 
23
        u_short         intf_flags;                 /* interface flags */
 
24
        u_int           intf_mtu;                   /* interface MTU */
 
25
        struct addr     intf_addr;                  /* interface address */
 
26
        struct addr     intf_dst_addr;              /* point-to-point dst */
 
27
        struct addr     intf_link_addr;             /* link-layer address */
 
28
        u_int           intf_alias_num;             /* number of aliases */
 
29
        struct addr     intf_alias_addrs __flexarr; /* array of aliases */
 
30
};
 
31
 
 
32
/*
 
33
 * MIB-II interface types - http://www.iana.org/assignments/ianaiftype-mib
 
34
 */
 
35
#define INTF_TYPE_OTHER         1       /* other */
 
36
#define INTF_TYPE_ETH           6       /* Ethernet */
 
37
#define INTF_TYPE_LOOPBACK      24      /* software loopback */
 
38
#define INTF_TYPE_TUN           53      /* proprietary virtual/internal */
 
39
 
 
40
/*
 
41
 * Interface flags
 
42
 */
 
43
#define INTF_FLAG_UP            0x01    /* enable interface */
 
44
#define INTF_FLAG_LOOPBACK      0x02    /* is a loopback net (r/o) */
 
45
#define INTF_FLAG_POINTOPOINT   0x04    /* point-to-point link (r/o) */
 
46
#define INTF_FLAG_NOARP         0x08    /* disable ARP */
 
47
#define INTF_FLAG_BROADCAST     0x10    /* supports broadcast (r/o) */
 
48
#define INTF_FLAG_MULTICAST     0x20    /* supports multicast (r/o) */
 
49
 
 
50
typedef struct intf_handle intf_t;
 
51
 
 
52
typedef int (*intf_handler)(const struct intf_entry *entry, void *arg);
 
53
 
 
54
__BEGIN_DECLS
 
55
intf_t  *intf_open(void);
 
56
int      intf_get(intf_t *i, struct intf_entry *entry);
 
57
int      intf_get_src(intf_t *i, struct intf_entry *entry, struct addr *src);
 
58
int      intf_get_dst(intf_t *i, struct intf_entry *entry, struct addr *dst);
 
59
int      intf_set(intf_t *i, const struct intf_entry *entry);
 
60
int      intf_loop(intf_t *i, intf_handler callback, void *arg);
 
61
intf_t  *intf_close(intf_t *i);
 
62
__END_DECLS
 
63
 
 
64
#endif /* DNET_INTF_H */