home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.ee.lbl.gov
/
2014.05.ftp.ee.lbl.gov.tar
/
ftp.ee.lbl.gov
/
mrdebug.tar.Z
/
mrdebug.tar
/
data_struct_proto.h
< prev
next >
Wrap
Text File
|
1993-10-25
|
5KB
|
165 lines
/************************************************************************
PROGRAMMER: Deb Agarwal 6/15/1993
***********************************************************************/
/*
** Interface: Building block for linked list of interface names or addresses
*/
typedef struct interface{
NAME name;
ADDRESS address;
ADDRESS mask;
u_long type;
long metric;
long threshold;
NAME to_name; /* char string representing node */
ADDRESS to_addr; /* unsigned long representing node */
long to_node; /* node index in adjacency list */
int in_tree;
struct interface *next;
}Interface;
/* definitions for the interface types */
#define TYPE_MASK 0x000000ff /* mask for interface type bits */
#define TUNNEL 0x00000001
#define QUERIER 0x00000002
#define SRCRT 0x00000004
#define SUBNET 0x00000008 /* This node represents the subnet itself*/
#define ASSUMED 0x00000010 /* This was assumed to be a tunnel */
#define STAT_MASK 0x0000ff00 /* mask for status bit of type */
#define DOWN 0x00000100
#define DISABLED 0x00000200
#define SUSPECT 0x00000400 /* this edge was not in input file */
#define ROUTE_MASK 0x00ff0000 /* mask for routing bits of type */
#define LEAF 0x00010000
#define CHILD 0x00020000
#define PARENT 0x00040000
/*
** Ifc_list: Anchor for linked list of interface names or addresses
*/
typedef struct ifc_list{
long number;
struct interface *first;
}Ifc_list;
/*
** Equivalence: Building block for keeping a linked
** list of the interfaces that are at the same site and
** therefore 'equivalent'.
*/
typedef struct equivalence{
struct ifc_list ifcs;
struct equivalence *next;
}Equivalence;
/*
** DVTable: The table of distance vectors and additional
** information calculated for the multicast routing.
** There is a table stored at each node.
*/
typedef struct dvtable{
long destination;
long distance;
int in_tree;
Interface *next_hop_subnet; /* parent */
long next_hop_node; /* parent's node number */
}DVTable;
/*
** Node: A node in the adjacency list
*/
typedef struct node{
long index; /* node's index in the adjacency list */
struct ifc_list interfaces;
long degree;
long type;
struct dvtable dist_vects;
} Node;
#define SUBNET 0x00000008 /* This node represents the subnet itself*/
#define ROUTER 0x00000004 /* This node is a router on the net */
/*
** Change_item: An item for a linked list of network changes
*/
typedef struct change_item{
u_long type;
NAME frm_name; /* interface name this change belongs with */
NAME to_name;
long val1; /* used if a parameter value was changed */
long val2;
struct change_item *next;
}Change_item;
/* definitions for the change types */
#define DISABLE_TUNNEL 0x00000001 /*disable a tunnel */
#define DISABLE_IFC 0x00000002
#define ADD_TUNNEL 0x00000010
#define ADD_IFC 0x00000020
#define CHANGE_METRIC 0x00000100
#define CHANGE_THRESH 0x00000200
/*
** Change_stack: The head of a stack of network changes
*/
typedef struct change_stack{
long number;
struct change_item *last;
}Change_stack;
/*
** Path_item: An item for a linked list containing the path from a
** source to the destination.
*/
typedef struct path_item{
NAME name;
long distance;
long threshold;
int suspect;
int same_node;
int print;
long type;
struct path_item *next;
}Path_item;
/*
** Path_stack: The head of a stack of path elements
*/
typedef struct path_stack{
long number;
struct path_item *first;
}Path_stack;
/*
** Network: The M-Bone
*/
typedef struct network{
long no_nodes;
long no_alloc;
long no_interfaces;
struct htable name_map;
struct htable ip_map;
struct node *adj_list;
struct change_stack changes;
}Network;
/*
** Function prototypes for data_struct.c
*/
void insert_name( Ifc_list *name_list, char *name );
void insert_ifc( Ifc_list *name_list, Interface *new );
void delete_name( Ifc_list *name_list, char *name );
Interface *find_name( Ifc_list *name_list, char *name );
Interface *find_conn_subnet( Ifc_list *name_list, char *name );
int compare_names( NAME name1, NAME name2 );
int find_ip_name( NAME full_name, NAME ip_name );
HENTRY_t *find_actual_name( Network *net, NAME name, Ifc_list *subnets );
ADDRESS inet_parse(char *name, ADDRESS *address, ADDRESS *mask);
char *inet_fmt(ADDRESS addr, ADDRESS mask, char *name);
Interface *find_ifc( Network *net, Interface *ifc_p, NAME frm_name, NAME to_name);