Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Check for memleack and fix some compilation error with full flags.
[simgrid.git] / src / surf / surf_routing_none.c
1 /* Copyright (c) 2009, 2010, 2011. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include "surf_routing_private.h"
8
9 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_none, surf, "Routing part of surf");
10
11 static xbt_dynar_t none_get_onelink_routes(AS_t rc) {
12   return NULL;
13 }
14
15 static void none_get_route_and_latency(AS_t rc, network_element_t src, network_element_t dst,
16                                        route_t res,double *lat)
17 {
18 }
19
20 static route_t none_get_bypass_route(AS_t rc,
21     network_element_t src,
22     network_element_t dst) {
23   return NULL;
24 }
25
26 static int none_parse_PU(AS_t rc, network_element_t elm) {
27   xbt_dynar_push(rc->index_network_elm, (void *)elm);
28   /* don't care about PUs */
29   return -1;
30 }
31
32 static int none_parse_AS(AS_t rc, network_element_t elm) {
33   xbt_dynar_push(rc->index_network_elm, (void *)elm);
34   /* even don't care about sub-ASes -- I'm as nihilist as an old punk*/
35   return -1;
36 }
37
38 /* Creation routing model functions */
39 AS_t model_none_create() {
40   return model_none_create_sized(sizeof(s_as_t));
41 }
42 AS_t model_none_create_sized(size_t childsize) {
43   AS_t new_component = xbt_malloc0(childsize);
44   new_component->parse_PU = none_parse_PU;
45   new_component->parse_AS = none_parse_AS;
46   new_component->parse_route = NULL;
47   new_component->parse_ASroute = NULL;
48   new_component->parse_bypassroute = NULL;
49   new_component->get_route_and_latency = none_get_route_and_latency;
50   new_component->get_onelink_routes = none_get_onelink_routes;
51   new_component->get_bypass_route = none_get_bypass_route;
52   new_component->finalize = model_none_finalize;
53   new_component->routing_sons = xbt_dict_new_homogeneous(NULL);
54   new_component->index_network_elm = xbt_dynar_new(sizeof(char*),NULL);
55
56   return new_component;
57 }
58
59 void model_none_finalize(AS_t as) {
60   xbt_dict_free(&as->routing_sons);
61   xbt_dynar_free(&as->index_network_elm);
62   xbt_free(as);
63 }
64