globus_connect_gridftp_server  17.0~rc3
/home/rocky/workspace/us-connect-gridftp-server_master/gridftp/server/src/globus_i_gridftp_server.h
1 /*
2  * Copyright The University of Chicago
3  *
4  * All Rights Reserved.
5  */
6 
7 #ifndef GLOBUS_I_GRIDFTP_SERVER_H
8 #define GLOBUS_I_GRIDFTP_SERVER_H
9 
10 
11 #include "globus_i_gridftp_server_config.h"
12 #include "globus_gridftp_server.h"
13 #include "globus_gridftp_server_control.h"
14 #include "globus_i_gfs_acl.h"
15 #include "globus_xio.h"
16 #include "globus_xio_system.h"
17 #include "globus_xio_tcp_driver.h"
18 #include "globus_xio_gsi.h"
19 #include "globus_ftp_control.h"
20 
21 
22 /* This is insures that both of these macros are not defined in the same build
23  GRIDFTP_TEST_BUILD is strictly for testing and opens up security holes
24  GLOBUS_GRIDFTP_PRODUCTION is set when rpms and debs are built */
25 #if defined(GLOBUS_GRIDFTP_PRODUCTION) && defined(GRIDFTP_TEST_BUILD)
26  Do not set GRIDFTP_TEST_BUILD on production builds!
27 #endif
28 
29 
30 #define _GSSL(s) globus_common_i18n_get_string_by_key(\
31  NULL, \
32  "globus_gridftp_server", \
33  s)
34 
35 #define _FSSL(s,p) globus_common_i18n_get_string_by_key(\
36  p, \
37  "globus_gridftp_server", \
38  s)
39 
40 typedef void
41 (*globus_i_gfs_server_close_cb_t)(
42  void * user_arg,
43  globus_object_t * error);
44 
45 typedef struct globus_i_gfs_monitor_s
46 {
47  globus_bool_t done;
48  globus_cond_t cond;
49  globus_mutex_t mutex;
50 } globus_i_gfs_monitor_t;
51 
52 typedef struct gfs_i_stack_entry_s
53 {
54  globus_xio_driver_t driver;
55  char * driver_name;
56  char * opts;
57 } gfs_i_stack_entry_t;
58 
59 typedef struct
60 {
61  int cmd_id;
62  char * cmd_name;
63  char * help_str;
64  int max_argc;
65  int min_argc;
66  globus_bool_t has_pathname;
67  int access_type;
68 } globus_i_gfs_cmd_ent_t;
69 
70 typedef struct globus_i_gfs_op_info_s
71 {
72  int id;
73  globus_hashtable_t custom_command_table;
74 
75  char ** argv;
76  int argc;
77  globus_i_gfs_cmd_ent_t * cmd_ent;
78 
79  char * remote_ip;
80 
81  /* Stat replies only: NULL, or info.stat.stat_count extra-fact strings
82  * (entries may be NULL), from
83  * globus_gridftp_server_finished_stat_ext(). */
84  char ** stat_facts;
85  /* Stat requests only: the extra facts the client asked for
86  * (GLOBUS_GFS_OP_INFO_REQUESTED_FACTS) */
87  char * requested_facts;
88 } globus_i_gfs_op_info_t;
89 
90 /* Gives stat_info an op_info holding requested_facts (taking ownership),
91  * or does nothing if requested_facts is NULL. */
92 void
93 globus_i_gfs_stat_info_set_requested_facts(
94  globus_gfs_stat_info_t * stat_info,
95  char * requested_facts);
96 
97 /* Frees what globus_i_gfs_stat_info_set_requested_facts() added. */
98 void
99 globus_i_gfs_stat_info_free_op_info(
100  globus_gfs_stat_info_t * stat_info);
101 
102 void
103 globus_i_gfs_monitor_init(
104  globus_i_gfs_monitor_t * monitor);
105 
106 void
107 globus_i_gfs_monitor_destroy(
108  globus_i_gfs_monitor_t * monitor);
109 
110 void
111 globus_i_gfs_monitor_wait(
112  globus_i_gfs_monitor_t * monitor);
113 
114 void
115 globus_i_gfs_monitor_signal(
116  globus_i_gfs_monitor_t * monitor);
117 
118 void
119 globus_i_gfs_ipc_stop();
120 
121 void
122 globus_i_gfs_control_stop();
123 
124 void
125 globus_i_gfs_control_init();
126 
127 globus_result_t
128 globus_i_gfs_brain_init(
129  globus_callback_func_t ready_cb,
130  void * ready_cb_arg);
131 
132 void
133 globus_i_gfs_control_end_421(
134  const char * msg);
135 
136 void
137 globus_l_gfs_data_brain_ready(
138  void * user_arg);
139 
140 globus_result_t
141 globus_i_gfs_get_full_path(
142  const char * home_dir,
143  const char * server_cwd,
144  void * session_arg,
145  const char * in_path,
146  char ** ret_path,
147  int access_type);
148 
149 #define GlobusGFSErrorGenericStr(_res, _fmt) \
150 do \
151 { \
152  char * _tmp_str; \
153  _tmp_str = globus_common_create_string _fmt; \
154  _res = globus_error_put( \
155  globus_error_construct_error( \
156  GLOBUS_NULL, \
157  GLOBUS_NULL, \
158  GLOBUS_GFS_ERROR_GENERIC, \
159  __FILE__, \
160  _gfs_name, \
161  __LINE__, \
162  "%s", \
163  _tmp_str)); \
164  globus_free(_tmp_str); \
165  \
166 } while(0)
167 
168 extern globus_gfs_acl_module_t globus_gfs_acl_cas_module;
169 extern globus_gfs_acl_module_t globus_gfs_acl_test_module;
170 
171 typedef enum globus_l_gfs_auth_level_e
172 {
173  GLOBUS_L_GFS_AUTH_NONE = 0x00,
174  GLOBUS_L_GFS_AUTH_IDENTIFY = 0x01,
175  GLOBUS_L_GFS_AUTH_ACTION = 0x02,
176  GLOBUS_L_GFS_AUTH_NOSETUID = 0x04,
177  GLOBUS_L_GFS_AUTH_NOGRIDMAP = 0x08,
178  GLOBUS_L_GFS_AUTH_DATA_NODE_PATH = 0x10,
179  GLOBUS_L_GFS_AUTH_ALL = 0xFF
180 } globus_l_gfs_auth_level_t;
181 
182 #define GFS_L_AUTHTYPE_FTP 1<<0
183 #define GFS_L_AUTHTYPE_IPC 1<<1
184 #define GFS_L_AUTHTYPE_HTTP 1<<2
185 #define GFS_L_AUTHTYPE_GSI 1<<3
186 #define GFS_L_AUTHTYPE_TLS 1<<4
187 #define GFS_L_AUTHTYPE_SHARING 1<<5
188 
189 #define GLOBUS_GCP_PREFIX ":globus-gcp:"
190 #define GLOBUS_MAPPED_PREFIX ":globus-mapped-collection:"
191 
192 globus_result_t
193 globus_i_gfs_data_parse_mapped_login_username(
194  const char * prefix,
195  const char * login_username,
196  char ** collection_idp,
197  char ** identity_idsp,
198  char ** identity_namesp,
199  char ** desired_userp,
200  int * high_assurance);
201 
202 #define GLOBUS_SHARING_PREFIX ":globus-sharing:"
203 
204 globus_result_t
205 globus_i_gfs_data_parse_sharing_login_username(
206  const char * login_username,
207  char ** usernamep,
208  char ** collection_idp,
209  char ** shareep,
210  char ** sharee_idp,
211  int * high_assurance);
212 
213 #define GLOBUS_TUNNEL_PREFIX ":globus-tunnel:"
214 
215 globus_result_t
216 globus_i_gfs_data_parse_tunnel_login_username(
217  const char * login_username,
218  char ** stream_ap_idp,
219  char ** tunnel_idp,
220  char ** identity_idsp,
221  char ** identity_namesp,
222  char ** desired_userp);
223 
224 
225 globus_result_t
226 globus_gfs_base64_encode(
227  const unsigned char * inbuf,
228  globus_size_t in_len,
229  globus_byte_t * outbuf,
230  globus_size_t * out_len);
231 
232 
233 #include "globus_i_gfs_log.h"
234 #include "globus_i_gfs_control.h"
235 #include "globus_i_gfs_ipc.h"
236 #include "globus_i_gfs_data.h"
237 #include "globus_i_gfs_config.h"
238 #include "globus_i_gfs_gcs_db.h"
239 #include "gfs_i_recv_cache.h"
240 #include "gfs_i_openssl.h"
241 
242 #endif