DTNMA Reference Tools v2.4.0 - 0.g737f35c
Delay-Tolerant Networking Management Architecture (DTNMA) Tool Suite
Loading...
Searching...
No Matches
mgr.h File Reference

DM state keeping declarations. More...

#include "agents.h"
#include "instr.h"
#include "refdm/config.h"
#include "cace/amm/msg_if.h"
#include "cace/util/daemon_run.h"
#include "cace/util/threadset.h"
#include <m-dict.h>
#include <m-string.h>
#include <stdio.h>
+ Include dependency graph for mgr.h:
+ This graph shows which files directly or indirectly include this file:

Data Structures

struct  refdm_db_t
 
struct  refdm_mgr_t
 State of a DTNMA Manager. More...
 

Macros

#define UI_SQL_SERVERLEN   (80)
 
#define UI_SQL_ACCTLEN   (20)
 
#define UI_SQL_DBLEN   (20)
 
#define UI_SQL_TOTLEN   (UI_SQL_SERVERLEN + UI_SQL_ACCTLEN + UI_SQL_ACCTLEN + UI_SQL_DBLEN)
 
#define MGR_UI_DEFAULT   MGR_UI_NCURSES
 

Enumerations

enum  mgr_ui_mode_enum { MGR_UI_STANDARD , MGR_UI_NCURSES , MGR_UI_AUTOMATOR }
 

Functions

void refdm_mgr_init (refdm_mgr_t *mgr)
 Initialize a new manager state with default config.
 
void refdm_mgr_deinit (refdm_mgr_t *mgr)
 Deinitialize the state.
 
int refdm_mgr_start (refdm_mgr_t *mgr)
 Begin the REFDM daemon operation.
 
int refdm_mgr_stop (refdm_mgr_t *mgr)
 End daemon operation.
 
refdm_agent_t * refdm_mgr_agent_add (refdm_mgr_t *mgr, const char *agent_eid, bool *is_new)
 Add a new known agent by its EID URI.
 
refdm_agent_t * refdm_mgr_agent_get_eid (refdm_mgr_t *mgr, const char *agent_eid)
 
refdm_agent_t * refdm_mgr_agent_get_index (refdm_mgr_t *mgr, size_t index)
 
void refdm_mgr_clear_reports (refdm_mgr_t *mgr, refdm_agent_t *agent)
 Clear reports for a specific agent.
 

Detailed Description

DM state keeping declarations.

Macro Definition Documentation

◆ MGR_UI_DEFAULT

#define MGR_UI_DEFAULT   MGR_UI_NCURSES

◆ UI_SQL_ACCTLEN

#define UI_SQL_ACCTLEN   (20)

◆ UI_SQL_DBLEN

#define UI_SQL_DBLEN   (20)

◆ UI_SQL_SERVERLEN

#define UI_SQL_SERVERLEN   (80)

◆ UI_SQL_TOTLEN

#define UI_SQL_TOTLEN   (UI_SQL_SERVERLEN + UI_SQL_ACCTLEN + UI_SQL_ACCTLEN + UI_SQL_DBLEN)

Enumeration Type Documentation

◆ mgr_ui_mode_enum

Enumerator
MGR_UI_STANDARD 
MGR_UI_NCURSES 
MGR_UI_AUTOMATOR 

Function Documentation

◆ refdm_mgr_agent_add()

refdm_agent_t * refdm_mgr_agent_add ( refdm_mgr_t *  mgr,
const char *  agent_eid,
bool *  is_new 
)

Add a new known agent by its EID URI.

Parameters
[in]mgrThe manager to update.
[in]agent_eidThe unique agent EID. Adding short-circuit if the EID already exists in the agent list.
[out]is_newIf provided, will be set to false if the agent was already present and true if it was newly added.
Returns
The new manager, or NULL if adding failed.

References agent, refdm_mgr_t::agent_dict, refdm_mgr_t::agent_list, refdm_mgr_t::agent_log_cfg, refdm_mgr_t::agent_mutex, CACE_LOG_INFO, CACE_MALLOC, CACE_MUTEX_LOCK, CACE_MUTEX_UNLOCK, CHKNULL, mgr, refdm_agent_init(), refdm_agent_rotate_log(), and refdm_db_insert_agent().

Referenced by agentsPostHandler(), refdm_db_load_agents(), and refdm_ingress_worker().

◆ refdm_mgr_agent_get_eid()

refdm_agent_t * refdm_mgr_agent_get_eid ( refdm_mgr_t *  mgr,
const char *  agent_eid 
)

◆ refdm_mgr_agent_get_index()

refdm_agent_t * refdm_mgr_agent_get_index ( refdm_mgr_t *  mgr,
size_t  index 
)

◆ refdm_mgr_clear_reports()

void refdm_mgr_clear_reports ( refdm_mgr_t *  mgr,
refdm_agent_t *  agent 
)

Clear reports for a specific agent.

References agent, refdm_db_clear_rptset(), and refdm_db_fetch_agent_idx().

Referenced by agentEidClearReportsHandler(), and agentIdxClearReportsHandler().

◆ refdm_mgr_deinit()

◆ refdm_mgr_init()

◆ refdm_mgr_start()

int refdm_mgr_start ( refdm_mgr_t *  mgr)

Begin the REFDM daemon operation.

This includes making connection to persistent storage database if compiled with POSTGRESQL_FOUND.

Precondition
The manager must have set values for:
Parameters
[in]mgrThe manager to start.
See also
refdm_mgr_stop()

References CACE_LOG_INFO, cace_threadset_start(), mgr, refdm_db_load_agents(), refdm_db_mgt_init(), refdm_ingress_worker(), refdm_nm_rest_start(), refdm_mgr_t::rest, refdm_mgr_t::sql_info, and refdm_mgr_t::threads.

Referenced by main().

◆ refdm_mgr_stop()

int refdm_mgr_stop ( refdm_mgr_t *  mgr)

End daemon operation.

Precondition
The manager must have been successfully started with refdm_mgr_start().
Parameters
[in]mgrThe manager to stop.

References cace_daemon_run_stop(), cace_threadset_join(), mgr, refdm_nm_rest_stop(), refdm_mgr_t::rest, refdm_mgr_t::running, and refdm_mgr_t::threads.

Referenced by main().