Changes between Version 2 and Version 3 of Ticket #40


Ignore:
Timestamp:
Oct 21, 2010, 3:55:43 PM (14 years ago)
Author:
Nicolas Pouillon
Comment:
  • Fixing the recursion API, we needed the input port when walking
  • Adding a selection API. Should be ala SQL select
    • a filter
    • an order
    • a limit
  • Selection API still has to be modified
    • We still have to tell whether a node is better than another (a sorting function)

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #40 – Description

    v2 v3  
    6969  struct device_s *dev;       /// associated device, if any
    7070};
     71
     72/**
     73  The only creteria telling two ports are different is
     74  private must be different. For models not using private,
     75  an useless but different value must be set.
     76 */
     77struct topo_port_s
     78{
     79  struct topo_node_s *node;   // node owning the port
     80  void *private;              // port's private.
     81};
     82
     83enum topo_crit_val_e
     84{
     85  CRIT_DROP,   /// Node is not interesting, stop recursion here in the graph
     86  CRIT_RECURS, /// Node is not selected, but we can recurs through it
     87  CRIT_SELECT, /// Node is selected, and may be recursed down
     88};
    7189}}}
    7290
     
    92110   struct topo_node_s *start,
    93111   struct topo_addr_s *dest);
     112
     113/**
     114  Selector function
     115  @param node Node to filter
     116  @param metrics Metrics from start node to this one
     117  @param priv Selector private data
     118  @returns whether the node is interesting
     119*/
     120typedef enum topo_crit_val_e crit_func_t(struct topo_node_s *node, struct topo_metrics_s *metrics, void *priv);
     121
     122error_t select(
     123   struct topo_node_s *start,          /// Start node
     124   crit_func_t *crit, void *crit_priv, /// Criterium function, telling whether a node is eligible
     125   size_t max_nodes,                   /// Maximal number of nodes to return
     126   struct topo_node_s **nodes);        /// Output nodes. Table must be allocated by caller and be able to contain max_nodes
    94127}}}
    95128(round-trip is sufficient as there is roughly the same energy
     
    133166error_t next(
    134167    struct topo_node_s *node,        /// node of our model where we are coming from
     168    struct topo_port_s *input,       /// input in node. May be NULL on start node
    135169    const struct topo_addr_s *dest,  /// destination address for the current address space
    136170    struct topo_metrics_s *metrics,  /// Metrics to update on the go
    137     struct topo_node_s **next_node); /// Next hop
     171    struct topo_port_s **output_peer); /// Input port of the next hop
     172
     173error_t select_next(
     174    struct topo_node_s *node,        /// node of our model where we are coming from
     175    struct topo_port_s *input,       /// input in node. May be NULL on start node
     176    struct topo_metrics_s *metrics,  /// Metrics to update on the go
     177    struct topo_port_s **output_peer); /// Input port of the next hop
    138178}}}
    139179