FOSSology  4.4.0
Open Source License Compliance by Open Source Software
host.h
1 /*
2  SPDX-FileCopyrightText: © 2011, 2012 Hewlett-Packard Development Company, L.P.
3 
4  SPDX-License-Identifier: GPL-2.0-only
5 */
6 
7 #ifndef HOST_H_INCLUDE
8 #define HOST_H_INCLUDE
9 
10 /* scheduler includes */
11 #include <scheduler.h>
12 
13 /* std includes */
14 #include <stdio.h>
15 
16 /* other library includes */
17 #include <gio/gio.h>
18 
19 /* ************************************************************************** */
20 /* **** Data Types ********************************************************** */
21 /* ************************************************************************** */
22 
26 typedef struct {
27  char* name;
28  char* address;
29  char* agent_dir;
30  int max;
31  int running;
32 } host_t;
33 
34 /* ************************************************************************** */
35 /* **** Contructor Destructor *********************************************** */
36 /* ************************************************************************** */
37 
38 host_t* host_init(char* name, char* address, char* agent_dir, int max);
39 void host_destroy(host_t* h);
40 
41 /* ************************************************************************** */
42 /* **** Functions and events ************************************************ */
43 /* ************************************************************************** */
44 
45 void host_insert(host_t* host, scheduler_t* scheduler);
46 void host_increase_load(host_t* host);
47 void host_decrease_load(host_t* host);
48 void host_print(host_t* host, GOutputStream* ostr);
49 
50 host_t* get_host(GList** queue, uint8_t num);
51 void print_host_load(GTree* host_list, GOutputStream* ostr);
52 
53 #endif /* HOST_H_INCLUDE */
void host_insert(host_t *host, scheduler_t *scheduler)
Inserts a new host into the scheduler structure.
Definition: host.c:91
host_t * host_init(char *name, char *address, char *agent_dir, int max)
Creates a new host, and adds it to the host list.
Definition: host.c:48
void host_decrease_load(host_t *host)
Decrease the number of running agents on a host by 1.
Definition: host.c:113
void print_host_load(GTree *host_list, GOutputStream *ostr)
Prints the host information to ostr.
Definition: host.c:174
void host_destroy(host_t *host)
Frees and uninitializes any memory associated with the host struct.
Definition: host.c:66
host_t * get_host(GList **queue, uint8_t num)
Definition: host.c:144
void host_increase_load(host_t *host)
Increase the number of running agents on a host by 1.
Definition: host.c:102
void host_print(host_t *host, GOutputStream *ostr)
Prints the information about a host to the output stream.
Definition: host.c:125
FUNCTION int max(int permGroup, int permPublic)
Get the maximum group privilege.
Definition: libfossagent.c:295
Header file for the scheduler.
Definition: host.h:26
char * agent_dir
The location on the host machine where the executables are.
Definition: host.h:29
int running
The number of agents currently running on this host.
Definition: host.h:31
char * address
The address of the host, used by ssh when starting a new agent.
Definition: host.h:28
char * name
The name of the host, used to store host internally to scheduler.
Definition: host.h:27
int max
The max number of agents that can run on this host.
Definition: host.h:30