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 >
Text File  |  1993-10-25  |  5KB  |  165 lines

  1. /************************************************************************
  2.  
  3.     PROGRAMMER:  Deb Agarwal    6/15/1993
  4.  
  5. ***********************************************************************/
  6.  
  7. /*
  8. **    Interface: Building block for linked list of interface names or addresses
  9. */
  10. typedef struct interface{
  11.     NAME      name;
  12.     ADDRESS   address;
  13.     ADDRESS   mask;
  14.     u_long    type;
  15.     long      metric;
  16.     long      threshold;
  17.     NAME      to_name;                      /* char string representing node */
  18.     ADDRESS   to_addr;                      /* unsigned long representing node */
  19.     long      to_node;                      /* node index in adjacency list */
  20.     int       in_tree;
  21.     struct    interface  *next;
  22.     }Interface;
  23.  
  24. /*    definitions for the interface types */
  25. #define     TYPE_MASK      0x000000ff   /* mask for interface type bits */
  26. #define     TUNNEL         0x00000001
  27. #define     QUERIER        0x00000002
  28. #define     SRCRT          0x00000004
  29. #define     SUBNET         0x00000008   /* This node represents the subnet itself*/
  30. #define     ASSUMED        0x00000010   /* This was assumed to be a tunnel */
  31. #define     STAT_MASK      0x0000ff00   /* mask for status bit of type */
  32. #define     DOWN           0x00000100
  33. #define     DISABLED       0x00000200
  34. #define     SUSPECT        0x00000400   /* this edge was not in input file */
  35. #define     ROUTE_MASK     0x00ff0000   /* mask for routing bits of type */
  36. #define     LEAF           0x00010000
  37. #define     CHILD          0x00020000
  38. #define     PARENT         0x00040000
  39.  
  40. /*
  41. **    Ifc_list: Anchor for linked list of interface names or addresses
  42. */
  43. typedef struct ifc_list{
  44.     long      number;
  45.     struct    interface   *first;
  46.     }Ifc_list;
  47.  
  48.  
  49. /*
  50. **    Equivalence: Building block for keeping a linked
  51. **    list of the interfaces that are at the same site and
  52. **    therefore 'equivalent'.
  53. */
  54. typedef struct equivalence{
  55.     struct    ifc_list      ifcs;
  56.     struct      equivalence   *next;
  57.     }Equivalence;
  58.  
  59. /*
  60. **    DVTable:  The table of distance vectors and additional
  61. **    information calculated for the multicast routing.
  62. **    There is a table stored at each node.
  63. */
  64. typedef struct dvtable{
  65.     long         destination;
  66.     long         distance;
  67.     int          in_tree;
  68.     Interface   *next_hop_subnet;  /* parent */
  69.     long         next_hop_node;    /* parent's node number */
  70.     }DVTable;
  71.  
  72. /*
  73. **    Node:  A node in the adjacency list
  74. */
  75. typedef struct node{
  76.         long     index;                        /* node's index in the adjacency list */
  77.     struct   ifc_list   interfaces;
  78.     long      degree;
  79.     long     type;
  80.     struct   dvtable    dist_vects;
  81.     } Node;
  82.  
  83. #define     SUBNET         0x00000008   /* This node represents the subnet itself*/
  84. #define     ROUTER         0x00000004   /* This node is a router on the net */
  85. /*
  86. **   Change_item:  An item for a linked list of network changes
  87. */
  88. typedef struct change_item{
  89.         u_long    type;
  90.         NAME      frm_name;                    /* interface name this change belongs with */
  91.     NAME      to_name;
  92.     long      val1;                     /* used if a parameter value was changed */
  93.     long      val2;
  94.     struct    change_item  *next;
  95.         }Change_item;
  96.  
  97. /*    definitions for the change types */
  98. #define     DISABLE_TUNNEL 0x00000001   /*disable a tunnel  */
  99. #define     DISABLE_IFC    0x00000002
  100. #define     ADD_TUNNEL     0x00000010
  101. #define     ADD_IFC        0x00000020
  102. #define     CHANGE_METRIC  0x00000100
  103. #define     CHANGE_THRESH  0x00000200
  104.  
  105. /*
  106. **   Change_stack: The head of a stack of network changes
  107. */
  108. typedef struct change_stack{
  109.         long      number;
  110.     struct    change_item     *last;
  111.         }Change_stack;
  112.  
  113. /*
  114. **   Path_item: An item for a linked list containing the path from a
  115. **   source to the destination.
  116. */
  117. typedef struct path_item{
  118.         NAME     name;
  119.     long     distance;
  120.     long     threshold;
  121.     int      suspect;
  122.     int      same_node;
  123.     int      print;
  124.     long     type;
  125.     struct   path_item  *next;
  126.         }Path_item;
  127.  
  128. /*
  129. **   Path_stack:  The head of a stack of path elements
  130. */
  131. typedef struct  path_stack{
  132.         long    number;
  133.     struct  path_item  *first;
  134.         }Path_stack;
  135.  
  136. /*
  137. **   Network:  The M-Bone
  138. */
  139. typedef struct network{
  140.     long     no_nodes;
  141.     long     no_alloc;
  142.     long     no_interfaces;
  143.     struct   htable     name_map;
  144.     struct   htable     ip_map;
  145.     struct   node      *adj_list;
  146.     struct   change_stack  changes;
  147.     }Network;
  148.  
  149. /*
  150. **       Function prototypes for data_struct.c
  151. */
  152.  
  153. void       insert_name( Ifc_list *name_list, char *name );
  154. void       insert_ifc( Ifc_list *name_list, Interface *new );
  155. void       delete_name( Ifc_list *name_list, char *name );
  156. Interface *find_name( Ifc_list *name_list, char *name );
  157. Interface *find_conn_subnet( Ifc_list *name_list, char *name );
  158. int        compare_names( NAME name1, NAME name2 );
  159. int        find_ip_name( NAME full_name, NAME ip_name );
  160. HENTRY_t  *find_actual_name( Network *net, NAME name, Ifc_list *subnets );
  161. ADDRESS    inet_parse(char *name, ADDRESS *address, ADDRESS *mask);
  162. char      *inet_fmt(ADDRESS addr, ADDRESS mask, char *name);
  163. Interface *find_ifc( Network *net, Interface *ifc_p, NAME frm_name, NAME to_name);
  164.  
  165.