FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
host.h
1 /* **************************************************************
2 Copyright (C) 2011, 2012 Hewlett-Packard Development Company, L.P.
3 
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 version 2 as published by the Free Software Foundation.
7 
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License along
14 with this program; if not, write to the Free Software Foundation, Inc.,
15 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 
17 ************************************************************** */
18 
19 #ifndef HOST_H_INCLUDE
20 #define HOST_H_INCLUDE
21 
22 /* scheduler includes */
23 #include <scheduler.h>
24 
25 /* std includes */
26 #include <stdio.h>
27 
28 /* other library includes */
29 #include <gio/gio.h>
30 
31 /* ************************************************************************** */
32 /* **** Data Types ********************************************************** */
33 /* ************************************************************************** */
34 
38 typedef struct {
39  char* name;
40  char* address;
41  char* agent_dir;
42  int max;
43  int running;
44 } host_t;
45 
46 /* ************************************************************************** */
47 /* **** Contructor Destructor *********************************************** */
48 /* ************************************************************************** */
49 
50 host_t* host_init(char* name, char* address, char* agent_dir, int max);
51 void host_destroy(host_t* h);
52 
53 /* ************************************************************************** */
54 /* **** Functions and events ************************************************ */
55 /* ************************************************************************** */
56 
57 void host_insert(host_t* host, scheduler_t* scheduler);
58 void host_increase_load(host_t* host);
59 void host_decrease_load(host_t* host);
60 void host_print(host_t* host, GOutputStream* ostr);
61 
62 host_t* get_host(GList** queue, uint8_t num);
63 void print_host_load(GTree* host_list, GOutputStream* ostr);
64 
65 #endif /* HOST_H_INCLUDE */
void host_print(host_t *host, GOutputStream *ostr)
Prints the information about a host to the output stream.
Definition: host.c:137
void host_destroy(host_t *host)
Frees and uninitializes any memory associated with the host struct.
Definition: host.c:78
int max
The max number of agents that can run on this host.
Definition: host.h:42
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:60
char * address
The address of the host, used by ssh when starting a new agent.
Definition: host.h:40
char * name
The name of the host, used to store host internally to scheduler.
Definition: host.h:39
void host_insert(host_t *host, scheduler_t *scheduler)
Inserts a new host into the scheduler structure.
Definition: host.c:103
void host_increase_load(host_t *host)
Increase the number of running agents on a host by 1.
Definition: host.c:114
FUNCTION int max(int permGroup, int permPublic)
Get the maximum group privilege.
Definition: libfossagent.c:309
void print_host_load(GTree *host_list, GOutputStream *ostr)
Prints the host information to ostr.
Definition: host.c:186
host_t * get_host(GList **queue, uint8_t num)
Definition: host.c:156
Definition: host.h:38
char * agent_dir
The location on the host machine where the executables are.
Definition: host.h:41
Header file for the scheduler.
void host_decrease_load(host_t *host)
Decrease the number of running agents on a host by 1.
Definition: host.c:125
int running
The number of agents currently running on this host.
Definition: host.h:43