File: sge_gdi_ctx.h

package info (click to toggle)
gridengine 6.2u5-7.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 57,216 kB
  • sloc: ansic: 438,030; java: 66,252; sh: 36,399; jsp: 7,757; xml: 5,850; makefile: 5,520; csh: 4,571; cpp: 2,848; perl: 2,401; tcl: 692; lisp: 669; yacc: 668; ruby: 642; lex: 344
file content (184 lines) | stat: -rw-r--r-- 8,735 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#ifndef __SGE_GDI_CTX_H
#define __SGE_GDI_CTX_H
/*___INFO__MARK_BEGIN__*/
/*************************************************************************
 * 
 *  The Contents of this file are made available subject to the terms of
 *  the Sun Industry Standards Source License Version 1.2
 * 
 *  Sun Microsystems Inc., March, 2001
 * 
 * 
 *  Sun Industry Standards Source License Version 1.2
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.2 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
 * 
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 * 
 *   The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 * 
 *   Copyright: 2001 by Sun Microsystems, Inc.
 * 
 *   All Rights Reserved.
 * 
 ************************************************************************/
/*___INFO__MARK_END__*/

#include "sge_env.h"
#include "sge_prog.h"
#include "setup_path.h"
#include "sge_bootstrap.h"
#include "sge_error_class.h"
#include "commlib.h"

typedef struct sge_gdi_ctx_class_str sge_gdi_ctx_class_t; 

/*
** TODO: this maps single thread clients, replace it with a better solution
*/
#include "sge.h"
#include "sge_gdi.h"
#include "sge_conf.h"
#include "sge_gdi2.h"
#include "sge_profiling.h"
#include "sge_uidgid.h"
#include "sge_gdi_packet.h"

int 
sge_gdi2_setup(sge_gdi_ctx_class_t **context, u_long32 progid, u_long32 thread_id, lList **alpp);

int 
sge_setup2(sge_gdi_ctx_class_t **context, u_long32 progid, u_long32 thread_id,
           lList **alpp, bool is_qmaster_intern_client);

struct sge_gdi_ctx_class_str {
   void *sge_gdi_ctx_handle;

   bool (*sge_gdi_packet_execute)        (sge_gdi_ctx_class_t* ctx, lList **answer_list,
                                          sge_gdi_packet_class_t *packet);
   bool (*sge_gdi_packet_wait_for_result)(sge_gdi_ctx_class_t* ctx, lList **answer_list,
                                          sge_gdi_packet_class_t **packet_handle, lList **malpp);
   bool (*gdi_wait)                      (sge_gdi_ctx_class_t* ctx, lList **alpp, lList **malpp,
                                          state_gdi_multi *state);
   lList* (*gdi)                         (sge_gdi_ctx_class_t *thiz, u_long32 target, 
                                          u_long32 cmd, lList **lp, lCondition *where, 
                                          lEnumeration *what);
   int (*gdi_multi)                      (sge_gdi_ctx_class_t* ctx, lList **alpp, int mode, 
                                          u_long32 target, u_long32 cmd, lList **lp, 
                                          lCondition *cp, lEnumeration *enp, 
                                          state_gdi_multi *state, bool do_copy);
  
   sge_env_state_class_t* (*get_sge_env_state)(sge_gdi_ctx_class_t *thiz);
   sge_prog_state_class_t* (*get_sge_prog_state)(sge_gdi_ctx_class_t *thiz);
   sge_path_state_class_t* (*get_sge_path_state)(sge_gdi_ctx_class_t *thiz);
   sge_bootstrap_state_class_t* (*get_sge_bootstrap_state)(sge_gdi_ctx_class_t *thiz);
   int (*reresolve_qualified_hostname)(sge_gdi_ctx_class_t *thiz);
   void (*get_errors)(sge_gdi_ctx_class_t *thiz, lList **alpp, bool clear_errors);
   
   int (*prepare_enroll)(sge_gdi_ctx_class_t *thiz);
   int (*connect)(sge_gdi_ctx_class_t *thiz);
   int (*is_alive)(sge_gdi_ctx_class_t *thiz);
   lList* (*tsm)(sge_gdi_ctx_class_t *thiz, const char *schedd_name, const char *cell);
   lList* (*kill)(sge_gdi_ctx_class_t *thiz, lList *id_list, const char *cell, u_long32 option_flags, u_long32 action_flag);
   bool (*gdi_check_permission)(sge_gdi_ctx_class_t *thiz, lList **alpp, int option);
   bool (*gdi_get_mapping_name)(sge_gdi_ctx_class_t *thiz, const char *requestedHost, char *buf, int buflen);
   const char* (*get_master)(sge_gdi_ctx_class_t *thiz, bool reread);
   u_long32 (*get_sge_qmaster_port)(sge_gdi_ctx_class_t *thiz);
   u_long32 (*get_sge_execd_port)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_component_name)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_thread_name)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_progname)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_qualified_hostname)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_unqualified_hostname)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_default_cell)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_admin_user)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_binary_path)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_qmaster_spool_dir)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_bootstrap_file)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_act_qmaster_file)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_shadow_master_file)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_acct_file)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_reporting_file)(sge_gdi_ctx_class_t *thiz);
   u_long32 (*get_who)(sge_gdi_ctx_class_t *thiz);
   bool (*is_daemonized)(sge_gdi_ctx_class_t *thiz);
   void (*set_daemonized)(sge_gdi_ctx_class_t *thiz, bool daemonized);
   sge_exit_func_t (*get_exit_func)(sge_gdi_ctx_class_t *thiz);
   void (*set_exit_func)(sge_gdi_ctx_class_t *thiz, sge_exit_func_t exit_func);
   const char* (*get_cell_root)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_sge_root)(sge_gdi_ctx_class_t *thiz);
   bool (*get_job_spooling)(sge_gdi_ctx_class_t *thiz);
   void (*set_job_spooling)(sge_gdi_ctx_class_t *thiz, bool job_spooling);
   u_long32 (*get_listener_thread_count)(sge_gdi_ctx_class_t *thiz);
   u_long32 (*get_worker_thread_count)(sge_gdi_ctx_class_t *thiz);
   u_long32 (*get_scheduler_thread_count)(sge_gdi_ctx_class_t *thiz);
   u_long32 (*get_jvm_thread_count)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_spooling_method)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_spooling_lib)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_spooling_params)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_username)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_groupname)(sge_gdi_ctx_class_t *thiz);
   uid_t (*get_uid)(sge_gdi_ctx_class_t *thiz);
   gid_t (*get_gid)(sge_gdi_ctx_class_t *thiz);
   bool (*is_qmaster_internal_client)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_ca_root)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_ca_local_root)(sge_gdi_ctx_class_t *thiz);

   /* credentials */
   void (*set_private_key)(sge_gdi_ctx_class_t *thiz, const char* pkey);
   void (*set_certificate)(sge_gdi_ctx_class_t *thiz, const char* cert);
   const char* (*get_private_key)(sge_gdi_ctx_class_t *thiz);
   const char* (*get_certificate)(sge_gdi_ctx_class_t *thiz);

   /* commlib */
   cl_com_handle_t* (*get_com_handle)(sge_gdi_ctx_class_t *thiz);
   
   /* dump current settings */
   void (*dprintf)(sge_gdi_ctx_class_t *thiz);
};

sge_gdi_ctx_class_t *
sge_gdi_ctx_class_create(int prog_number, const char *component_name,
                         int thread_number, const char *thread_name,
                         const char* username, const char* groupname, 
                         const char* sge_root, const char* sge_cell, 
                         int sge_qmaster_port, int sge_execd_port,
                         bool from_services, bool is_qmaster_intern_client,
                         lList **alpp);



/*
   create an instance of sge_gdi_ctx_class_t and initialize it
   with the information of the bootstrap file

   @param prog_number  number of the program which uses the context
   @param url          url to the bootstrap file
   @param username     name of the user which uses the context
   @param alpp         answer list reference
   @return the gdi context

   TODO we need a answer list to transport error messages to the caller
*/
sge_gdi_ctx_class_t *
sge_gdi_ctx_class_create_from_bootstrap(int prog_number, const char* component_name,
                                        int thread_number, const char *thread_name,
                                        const char* url, const char* username, lList **alpp);

void sge_gdi_ctx_class_destroy(sge_gdi_ctx_class_t **pst);

sge_gdi_ctx_class_t* sge_gdi_get_thread_local_ctx(void);
void sge_gdi_set_thread_local_ctx(sge_gdi_ctx_class_t* ctx);

void gdi_mt_init(void);

#endif /* __SGE_GDI_CTX_H */