Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

intf.h

Go to the documentation of this file.
00001 /*
00002  * intf.c
00003  *
00004  * Network interface operations.
00005  *
00006  * Copyright (c) 2000 Dug Song <dugsong@monkey.org>
00007  *
00008  * $Id: intf.h,v 1.16 2004/01/13 07:41:09 dugsong Exp $
00009  */
00010 
00011 #ifndef DNET_INTF_H
00012 #define DNET_INTF_H
00013 
00014 /*
00015  * Interface entry
00016  */
00017 #define INTF_NAME_LEN   16
00018 
00019 struct intf_entry {
00020         u_int           intf_len;                   /* length of entry */
00021         char            intf_name[INTF_NAME_LEN];   /* interface name */
00022         u_short         intf_type;                  /* interface type (r/o) */
00023         u_short         intf_flags;                 /* interface flags */
00024         u_int           intf_mtu;                   /* interface MTU */
00025         struct addr     intf_addr;                  /* interface address */
00026         struct addr     intf_dst_addr;              /* point-to-point dst */
00027         struct addr     intf_link_addr;             /* link-layer address */
00028         u_int           intf_alias_num;             /* number of aliases */
00029         struct addr     intf_alias_addrs __flexarr; /* array of aliases */
00030 };
00031 
00032 /*
00033  * MIB-II interface types - http://www.iana.org/assignments/ianaiftype-mib
00034  */
00035 #define INTF_TYPE_OTHER         1       /* other */
00036 #define INTF_TYPE_ETH           6       /* Ethernet */
00037 #define INTF_TYPE_TOKENRING     9       /* Token Ring */
00038 #define INTF_TYPE_FDDI          15      /* FDDI */
00039 #define INTF_TYPE_PPP           23      /* Point-to-Point Protocol */
00040 #define INTF_TYPE_LOOPBACK      24      /* software loopback */
00041 #define INTF_TYPE_SLIP          28      /* Serial Line Interface Protocol */
00042 #define INTF_TYPE_TUN           53      /* proprietary virtual/internal */
00043 
00044 /*
00045  * Interface flags
00046  */
00047 #define INTF_FLAG_UP            0x01    /* enable interface */
00048 #define INTF_FLAG_LOOPBACK      0x02    /* is a loopback net (r/o) */
00049 #define INTF_FLAG_POINTOPOINT   0x04    /* point-to-point link (r/o) */
00050 #define INTF_FLAG_NOARP         0x08    /* disable ARP */
00051 #define INTF_FLAG_BROADCAST     0x10    /* supports broadcast (r/o) */
00052 #define INTF_FLAG_MULTICAST     0x20    /* supports multicast (r/o) */
00053 
00054 typedef struct intf_handle intf_t;
00055 
00056 typedef int (*intf_handler)(const struct intf_entry *entry, void *arg);
00057 
00058 __BEGIN_DECLS
00059 intf_t  *intf_open(void);
00060 int      intf_get(intf_t *i, struct intf_entry *entry);
00061 int      intf_get_src(intf_t *i, struct intf_entry *entry, struct addr *src);
00062 int      intf_get_dst(intf_t *i, struct intf_entry *entry, struct addr *dst);
00063 int      intf_set(intf_t *i, const struct intf_entry *entry);
00064 int      intf_loop(intf_t *i, intf_handler callback, void *arg);
00065 intf_t  *intf_close(intf_t *i);
00066 __END_DECLS
00067 
00068 #endif /* DNET_INTF_H */

Generated on Sun May 14 14:51:10 2006 by  doxygen 1.4.2