1
#ifndef __CL_HOST_LIST_H
2
#define __CL_HOST_LIST_H
4
/*___INFO__MARK_BEGIN__*/
5
/*************************************************************************
7
* The Contents of this file are made available subject to the terms of
8
* the Sun Industry Standards Source License Version 1.2
10
* Sun Microsystems Inc., March, 2001
13
* Sun Industry Standards Source License Version 1.2
14
* =================================================
15
* The contents of this file are subject to the Sun Industry Standards
16
* Source License Version 1.2 (the "License"); You may not use this file
17
* except in compliance with the License. You may obtain a copy of the
18
* License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
20
* Software provided under this License is provided on an "AS IS" basis,
21
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
22
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
23
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
24
* See the License for the specific provisions governing your rights and
25
* obligations concerning the Software.
27
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
29
* Copyright: 2001 by Sun Microsystems, Inc.
31
* All Rights Reserved.
33
************************************************************************/
34
/*___INFO__MARK_END__*/
37
#include "cl_data_types.h"
38
#include "sge_htable.h"
40
#define CL_HOST_LIST_DEFAULT_RERESOLVE_TIME 1 * 60 /* 1 min */
41
#define CL_HOST_LIST_DEFAULT_UPDATE_TIME 2 * 60 /* 2 min */
42
#define CL_HOST_LIST_DEFAULT_LIFE_TIME 10 * 60 /* 10 min */
44
#define CL_HOST_LIST_MAX_RERESOLVE_TIME 10 * 60 /* 10 min */
45
#define CL_HOST_LIST_MAX_UPDATE_TIME 30 * 60 /* 30 min */
46
#define CL_HOST_LIST_MAX_LIFE_TIME 24 * 60 * 60 /* 1 day */
48
typedef struct cl_host_list_elem_t {
49
cl_com_host_spec_t* host_spec; /* data */
50
cl_raw_list_elem_t* raw_elem;
51
} cl_host_list_elem_t;
54
typedef struct cl_host_list_data_type { /* list specific data */
55
cl_host_resolve_method_t resolve_method;
56
char* host_alias_file;
57
int alias_file_changed; /* if set, alias file has changed */
58
char* local_domain_name;
59
cl_raw_list_t* host_alias_list;
60
unsigned long entry_life_time; /* max life time of an resolved host */
61
unsigned long entry_update_time; /* max valid time of entry before reresolving */
62
unsigned long entry_reresolve_time; /* time for reresolving if host is not resolvable */
63
long last_refresh_time; /* last refresh check */
64
htable ht; /* hashtable for host_list */
65
} cl_host_list_data_t;
69
int cl_host_list_setup(cl_raw_list_t** list_p,
71
cl_host_resolve_method_t method,
72
char* host_alias_file,
73
char* local_domain_name,
74
unsigned long entry_life_time, /* max life time of an resolved host */
75
unsigned long entry_update_time, /* max valid time of entry before reresolving */
76
unsigned long entry_reresolve_time, /* time for reresolving if host is not resolvable */
77
cl_bool_t create_hash); /* flag if list should create hash table */
78
int cl_host_list_cleanup(cl_raw_list_t** list_p);
80
int cl_host_list_copy(cl_raw_list_t** destination, cl_raw_list_t* source, cl_bool_t create_hash); /* make a copy of this list (will lock source) */
82
/* thread list functions that will lock the list */
83
int cl_host_list_append_host(cl_raw_list_t* list_p, cl_com_host_spec_t* newhost, int lock_list);
84
int cl_host_list_remove_host(cl_raw_list_t* list_p, cl_com_host_spec_t* delhost, int lock_list);
85
int cl_host_list_set_alias_file(cl_raw_list_t* list_p, const char *host_alias_file);
86
int cl_host_list_set_alias_file_dirty(cl_raw_list_t* list_p);
89
/* thread functions that will not lock the list */
90
cl_host_list_elem_t* cl_host_list_get_elem_host(cl_raw_list_t* list_p, const char *unresolved_hostname);
91
cl_host_list_data_t* cl_host_list_get_data(cl_raw_list_t* list_p);
92
cl_host_list_elem_t* cl_host_list_get_first_elem(cl_raw_list_t* list_p);
93
cl_host_list_elem_t* cl_host_list_get_least_elem(cl_raw_list_t* list_p);
94
cl_host_list_elem_t* cl_host_list_get_next_elem(cl_host_list_elem_t* elem);
95
cl_host_list_elem_t* cl_host_list_get_last_elem(cl_host_list_elem_t* elem);
98
#endif /* __CL_HOST_LIST_H */