FOSSology  4.4.0
Open Source License Compliance by Open Source Software
host.c File Reference

Host related operations. More...

#include <host.h>
#include <logging.h>
#include <scheduler.h>
Include dependency graph for host.c:

Go to the source code of this file.

Functions

static int print_host_all (gchar *host_name, host_t *host, GOutputStream *ostr)
 GTraversFunction that allows the information for all hosts to be printed. More...
 
host_thost_init (char *name, char *address, char *agent_dir, int max)
 Creates a new host, and adds it to the host list. More...
 
void host_destroy (host_t *host)
 Frees and uninitializes any memory associated with the host struct. More...
 
void host_insert (host_t *host, scheduler_t *scheduler)
 Inserts a new host into the scheduler structure. More...
 
void host_increase_load (host_t *host)
 Increase the number of running agents on a host by 1. More...
 
void host_decrease_load (host_t *host)
 Decrease the number of running agents on a host by 1. More...
 
void host_print (host_t *host, GOutputStream *ostr)
 Prints the information about a host to the output stream. More...
 
host_tget_host (GList **queue, uint8_t num)
 
void print_host_load (GTree *host_list, GOutputStream *ostr)
 Prints the host information to ostr. More...
 

Detailed Description

Host related operations.

Definition in file host.c.

Function Documentation

◆ get_host()

host_t* get_host ( GList **  queue,
uint8_t  num 
)

Gets a host for which there are at least num agents available to start new agents on.

Parameters
queueGList of available hosts
numthe number of agents to start on the host
Returns
the host with that number of available slots, NULL if none exist

Definition at line 144 of file host.c.

◆ host_decrease_load()

void host_decrease_load ( host_t host)

Decrease the number of running agents on a host by 1.

Parameters
hostthe relevant host

Definition at line 113 of file host.c.

◆ host_destroy()

void host_destroy ( host_t host)

Frees and uninitializes any memory associated with the host struct.

Parameters
hostThe host to free the memory for.

Definition at line 66 of file host.c.

◆ host_increase_load()

void host_increase_load ( host_t host)

Increase the number of running agents on a host by 1.

Parameters
hostThe relevant host

Definition at line 102 of file host.c.

◆ host_init()

host_t* host_init ( char *  name,
char *  address,
char *  agent_dir,
int  max 
)

Creates a new host, and adds it to the host list.

Parameters
nameThe name of the host
addressAddress that can be passed to ssh when starting agent on host
agent_dirThe location of agent binaries on the host
maxThe max number of agent that can run on this host
Returns
New host

Definition at line 48 of file host.c.

◆ host_insert()

void host_insert ( host_t host,
scheduler_t scheduler 
)

Inserts a new host into the scheduler structure.

Parameters
hostthe host that will be added to the scheduler
schedulerthe relevant scheduler struct

Definition at line 91 of file host.c.

◆ host_print()

void host_print ( host_t host,
GOutputStream *  ostr 
)

Prints the information about a host to the output stream.

Parameters
hostthe relevant host
ostrthe output stream to write to

Definition at line 125 of file host.c.

◆ print_host_all()

static int print_host_all ( gchar *  host_name,
host_t host,
GOutputStream *  ostr 
)
static

GTraversFunction that allows the information for all hosts to be printed.

Parameters
host_namethe string name of the host
hostthe host struct paired with the name
ostrthe output stream that the info will be printed to
Returns
0 to cause the traversal to continue
See also
host_print()

Definition at line 29 of file host.c.

◆ print_host_load()

void print_host_load ( GTree *  host_list,
GOutputStream *  ostr 
)

Prints the host information to ostr.

Parameters
host_list
ostr
See also
print_host_all()

Definition at line 174 of file host.c.