My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
routing.h
Go to the documentation of this file.
1 /*
2 START OF LICENSE STUB
3  DeDOS: Declarative Dispersion-Oriented Software
4  Copyright (C) 2017 University of Pennsylvania, Georgetown University
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 END OF LICENSE STUB
19 */
25 #ifndef ROUTING_H_
26 #define ROUTING_H_
27 #include <inttypes.h>
28 #include "dfg.h"
29 #include "message_queue.h"
30 
32 struct msu_endpoint {
34  int id;
38  unsigned int route_id;
40  unsigned int runtime_id;
42  struct msg_queue *queue;
43 };
44 
49 struct routing_table;
50 
55 struct route_set {
56  int n_routes;
58 };
59 
66 int init_route(int route_id, int type_id);
67 
75 int get_route_endpoint(struct routing_table *table, uint32_t key,
76  struct msu_endpoint *endpoint);
77 
87  uint32_t key, struct msu_endpoint *endpoint);
88 
96 int get_endpoint_by_index(struct routing_table *table, int index,
97  struct msu_endpoint *endpoint);
98 
106 int get_endpoint_by_id(struct routing_table *table, int msu_id,
107  struct msu_endpoint *endpoint);
108 
118  struct msu_endpoint *endpoints, int n_endpoints);
119 
127 struct routing_table *get_type_from_route_set(struct route_set *routes, int type_id);
128 
129 int get_n_endpoints(struct routing_table *table);
130 
138 int add_route_endpoint(int route_id, struct msu_endpoint endpoint, uint32_t key);
139 
146 int remove_route_endpoint(int route_id, int msu_id);
147 
155 int modify_route_endpoint(int route_id, int msu_id, uint32_t new_key);
156 
163 int add_route_to_set(struct route_set *set, int route_id);
164 
171 int rm_route_from_set(struct route_set *set, int route_id);
172 
174 int init_msu_endpoint(int msu_id, int runtime_id, struct msu_endpoint *endpoint);
175 #endif
The publicly accessible copy of the routing table.
Definition: routing.h:55
int id
A unque identifier for the endpoint (msu ID)
Definition: routing.h:34
unsigned int runtime_id
The ID for the runtime on which the endpoint resides.
Definition: routing.h:40
The core of the routing system, the routing table lists a route's destinations.
Definition: routing.c:47
int get_endpoints_by_runtime_id(struct routing_table *table, int runtime_id, struct msu_endpoint *endpoints, int n_endpoints)
Gets all of the endpoints in the provided routing table with the right runtime id.
Definition: routing.c:359
int n_endpoints
The number of destinations this route contains.
Definition: routing.c:52
int get_n_endpoints(struct routing_table *table)
Definition: routing.c:378
int get_endpoint_by_index(struct routing_table *table, int index, struct msu_endpoint *endpoint)
Gets endpoint witih given index in route set.
Definition: routing.c:332
int remove_route_endpoint(int route_id, int msu_id)
Removes destination from route with given ID.
Definition: routing.c:419
Container for linked list message queue.
Definition: message_queue.h:56
msu_locality
Whether an MSU is located on the same runtime or a remote runtime.
Definition: dfg.h:196
struct routing_table ** routes
Definition: routing.h:57
int modify_route_endpoint(int route_id, int msu_id, uint32_t new_key)
Modifies key associated with MSU in route.
Definition: routing.c:434
struct msg_queue * queue
if msu_endpoint::locality == MSU_IS_LOCAL, the queue for the msu endpoint
Definition: routing.h:42
int type_id
The type-id associated with the destinations in this table.
Definition: routing.c:49
int get_shortest_queue_endpoint(struct routing_table *table, uint32_t key, struct msu_endpoint *endpoint)
Gets the local endpoint from a route with the shortest queue length.
Definition: routing.c:299
Structures and functions for enqueueing and dequeuing general-purpose messages from a queue...
enum msu_locality locality
Whether the endpoint is on the local machine or remote.
Definition: routing.h:36
struct routing_table * get_type_from_route_set(struct route_set *routes, int type_id)
Gets the route from the provided array of routes which has the correct type ID.
Definition: routing.c:399
int init_msu_endpoint(int msu_id, int runtime_id, struct msu_endpoint *endpoint)
Initializes an endpoint structure to point to the relevant msu.
Definition: routing.c:483
int add_route_endpoint(int route_id, struct msu_endpoint endpoint, uint32_t key)
Adds an endpoint to the route with the given ID.
Definition: routing.c:409
int init_route(int route_id, int type_id)
Initializes a new route with the given route_id and type_id.
Definition: routing.c:276
struct msu_endpoint endpoints[128]
The destinations themselves.
Definition: routing.c:54
int get_route_endpoint(struct routing_table *table, uint32_t key, struct msu_endpoint *endpoint)
Gets the endpoint associated with the given key in the provided route.
Definition: routing.c:385
int rm_route_from_set(struct route_set *set, int route_id)
Removes a route from a set of routes.
Definition: routing.c:465
Interfaces for the creation and modification of the data-flow-graph and and general description of th...
unsigned int route_id
The ID for the route used to get to the endpoint.
Definition: routing.h:38
static int runtime_id(int runtime_fd)
unsigned int uint32_t
Definition: uthash.h:96
int get_endpoint_by_id(struct routing_table *table, int msu_id, struct msu_endpoint *endpoint)
Gets endpoint with the given MSU ID in the provided route.
Definition: routing.c:344
An endpoint to which an msu_msg can be delivered.
Definition: routing.h:32
int n_routes
Definition: routing.h:56
int add_route_to_set(struct route_set *set, int route_id)
Adds a route to a set of routes.
Definition: routing.c:450