My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Classes | Functions
routing.h File Reference

Functions for routing MSU messages between MSUs. More...

#include <inttypes.h>
#include "dfg.h"
#include "message_queue.h"

Go to the source code of this file.

Classes

struct  msu_endpoint
 An endpoint to which an msu_msg can be delivered. More...
 
struct  route_set
 The publicly accessible copy of the routing table. More...
 

Functions

int init_route (int route_id, int type_id)
 Initializes a new route with the given route_id and type_id. More...
 
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. More...
 
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. More...
 
int get_endpoint_by_index (struct routing_table *table, int index, struct msu_endpoint *endpoint)
 Gets endpoint witih given index in route set. More...
 
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. More...
 
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. More...
 
struct routing_tableget_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. More...
 
int get_n_endpoints (struct routing_table *table)
 
int add_route_endpoint (int route_id, struct msu_endpoint endpoint, uint32_t key)
 Adds an endpoint to the route with the given ID. More...
 
int remove_route_endpoint (int route_id, int msu_id)
 Removes destination from route with given ID. More...
 
int modify_route_endpoint (int route_id, int msu_id, uint32_t new_key)
 Modifies key associated with MSU in route. More...
 
int add_route_to_set (struct route_set *set, int route_id)
 Adds a route to a set of routes. More...
 
int rm_route_from_set (struct route_set *set, int route_id)
 Removes a route from a set of routes. More...
 
int init_msu_endpoint (int msu_id, int runtime_id, struct msu_endpoint *endpoint)
 Initializes an endpoint structure to point to the relevant msu. More...
 

Detailed Description

Functions for routing MSU messages between MSUs.

Definition in file routing.h.

Function Documentation

int add_route_endpoint ( int  route_id,
struct msu_endpoint  endpoint,
uint32_t  key 
)

Adds an endpoint to the route with the given ID.

Parameters
route_idID of the route to which the endpoint is added
endpointthe endpoint to be added
keyKey to associate with endpoint
Returns
0 on success, -1 on error

Definition at line 409 of file routing.c.

int add_route_to_set ( struct route_set set,
int  route_id 
)

Adds a route to a set of routes.

Parameters
route_setSet to add the route to
route_idID of the route to add
Returns
0 on success, -1 on error

Definition at line 450 of file routing.c.

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.

Parameters
tableRoute to get the endpoint from
msu_idMSU ID to search for in the route set
endpointPoints to appropriate endpoint on success
Returns
0 on success, -1 on error

Definition at line 344 of file routing.c.

int get_endpoint_by_index ( struct routing_table table,
int  index,
struct msu_endpoint endpoint 
)

Gets endpoint witih given index in route set.

Parameters
tablethe route to get the endpoint from
indexIndex of the endpoint to retrieve
endpointPoints to appropriate endpoint on success
Returns
0 on success, -1 on error

Definition at line 332 of file routing.c.

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.

Parameters
tableThe table to search for endpoints
runtime_idThe ID of the runtime on which endpoints must reside
endpointsAn array of endpoints to be filled.
n_endpointsThe amount of endpoints allocated in endpoints
Returns
The number of endpoints stored in endpoints, or -1 if n_endpoints is too low

Definition at line 359 of file routing.c.

int get_n_endpoints ( struct routing_table table)

Definition at line 378 of file routing.c.

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.

Parameters
routeRoute to search for key
keyThe key with which to search the route set endpoint Points to the appropraite endpoint on success
Returns
0 on success, -1 on error

Definition at line 385 of file routing.c.

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.

Ignores enpoints on remote runtimes.

Parameters
tableThe route to search for the shortest queue length
keyUsed as a tiebreaker in the case of multiple MSUs with same queue length
endpointPoints to appropriate endpoint on success
Returns
0 on success, -1 on error

Definition at line 299 of file routing.c.

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.

Parameters
routesPointer to array of routes to search
n_routesNumber of routes in route array
type_idType ID to search for
Returns
pointer to the routing table with correct type ID on success, else NULL

Definition at line 399 of file routing.c.

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 at line 483 of file routing.c.

int init_route ( int  route_id,
int  type_id 
)

Initializes a new route with the given route_id and type_id.

Parameters
route_idThe ID to assign to the new route
type_idThe Type ID to assign to the new route
Returns
0 on success, -1 on error

Definition at line 276 of file routing.c.

int modify_route_endpoint ( int  route_id,
int  msu_id,
uint32_t  new_key 
)

Modifies key associated with MSU in route.

Parameters
route_idThe ID of the route to modify
msu_idID of MSU to modify
new_keyNew key to associate with MSU in route
Returns
0 on success, -1 on error

Definition at line 434 of file routing.c.

int remove_route_endpoint ( int  route_id,
int  msu_id 
)

Removes destination from route with given ID.

Parameters
route_idID of the route from which the endpoint is removed
msu_idID of the msu to remove
Returns
0 on success, -1 on error

Definition at line 419 of file routing.c.

int rm_route_from_set ( struct route_set set,
int  route_id 
)

Removes a route from a set of routes.

Parameters
route_setSet to remove the route from
route_idID of the route to remove
Returns
0 on success, -1 on error

Definition at line 465 of file routing.c.