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