My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions | Variables
runtime_dfg.c File Reference

Interactions with the global dfg from an individual runtime's perspective. More...

#include "runtime_dfg.h"
#include "dfg_reader.h"
#include "logging.h"
#include "dfg_instantiation.h"
#include "msu_type.h"
#include <stdlib.h>

Go to the source code of this file.

Functions

void set_local_runtime (struct dfg_runtime *rt)
 Sets the local runtime to be equal to the provided rt. More...
 
int init_runtime_dfg (char *filename, int runtime_id)
 Initializes the DFG as loaded from a JSON file, and sets the global variables such that the DFG and runtime can be accessed. More...
 
int controller_address (struct sockaddr_in *addr)
 Gets the sockaddr associated with the global controller. More...
 
int local_runtime_id ()
 
int local_runtime_port ()
 
uint32_t local_runtime_ip ()
 
struct dedos_dfgget_dfg ()
 
void free_runtime_dfg ()
 Frees the runtime's static instance of the DFG. More...
 

Variables

static struct dedos_dfgDFG = NULL
 Static (global) variable for accessing a lodaed Dfg. More...
 
static struct dfg_runtimeLOCAL_RUNTIME = NULL
 Static (global) variable holding this runtime's dfg. More...
 

Detailed Description

Interactions with the global dfg from an individual runtime's perspective.

Definition in file runtime_dfg.c.

Function Documentation

int controller_address ( struct sockaddr_in *  addr)

Gets the sockaddr associated with the global controller.

Parameters
addrOutput parameter to be filled with controller's ip and port
Returns
0 on success, -1 on error

Definition at line 77 of file runtime_dfg.c.

void free_runtime_dfg ( )

Frees the runtime's static instance of the DFG.

Definition at line 119 of file runtime_dfg.c.

struct dedos_dfg* get_dfg ( )
Returns
the DFG with which this runtime was instantiated

Definition at line 115 of file runtime_dfg.c.

int init_runtime_dfg ( char *  filename,
int  runtime_id 
)

Initializes the DFG as loaded from a JSON file, and sets the global variables such that the DFG and runtime can be accessed.

Parameters
filenameFile from which to load the json DFG
runtime_idIdenitifer for this runtime
Returns
0 on success, -1 on error

Definition at line 41 of file runtime_dfg.c.

int local_runtime_id ( )
Returns
the ID of the local runtime

Definition at line 91 of file runtime_dfg.c.

uint32_t local_runtime_ip ( )

Definition at line 107 of file runtime_dfg.c.

int local_runtime_port ( )
Returns
the port on which the local runtime is listening

Definition at line 99 of file runtime_dfg.c.

void set_local_runtime ( struct dfg_runtime rt)

Sets the local runtime to be equal to the provided rt.

Really should only be used from testing. Use init_runtime_dfg instead

Definition at line 37 of file runtime_dfg.c.

Variable Documentation

struct dedos_dfg* DFG = NULL
static

Static (global) variable for accessing a lodaed Dfg.

Definition at line 33 of file runtime_dfg.c.

struct dfg_runtime* LOCAL_RUNTIME = NULL
static

Static (global) variable holding this runtime's dfg.

Definition at line 35 of file runtime_dfg.c.