Grid Community Toolkit  6.2.1629922860 (tag: v6.2.20210826)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
globus_gridftp_server.h
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2006 University of Chicago
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
30 #ifndef GLOBUS_GRIDFTP_SERVER_H
31 #define GLOBUS_GRIDFTP_SERVER_H
32 
33 #include "globus_common.h"
34 #include "globus_gridftp_server_control.h"
35 
36 #ifdef TARGET_ARCH_WIN32
37 #ifdef interface
38 #undef interface
39 #endif
40 #endif
41 
42 #ifndef TARGET_ARCH_WIN32
43 #include <grp.h>
44 #endif
45 
46 #define GLOBUS_MAPPING_STRING ":globus-mapping:"
47 
48 extern globus_module_descriptor_t globus_i_gfs_module;
49 #define GLOBUS_GRIDFTP_SERVER_MODULE (&globus_i_gfs_module)
50 
51 extern globus_extension_registry_t globus_i_gfs_dsi_registry;
52 #define GLOBUS_GFS_DSI_REGISTRY &globus_i_gfs_dsi_registry
53 
54 extern globus_extension_registry_t globus_i_gfs_acl_registry;
55 #define GLOBUS_GFS_ACL_REGISTRY &globus_i_gfs_acl_registry
56 
57 /*
58  * globus_gfs_error_type_t
59  *
60  */
61 typedef enum globus_gfs_error_type_e
62 {
63  GLOBUS_GFS_ERROR_MEMORY = 1,
64  GLOBUS_GFS_ERROR_PARAMETER,
65  GLOBUS_GFS_ERROR_SYSTEM_ERROR,
66  GLOBUS_GFS_ERROR_WRAPPED,
67  GLOBUS_GFS_ERROR_DATA,
68  GLOBUS_GFS_ERROR_GENERIC
69 } globus_gfs_error_type_t;
70 
71 /*
72  * globus_gfs_operation_type_t
73  *
74  * Server operations.
75  */
76 typedef enum globus_gfs_operation_type_e
77 {
78  GLOBUS_GFS_OP_FINAL_REPLY = 1,
79  GLOBUS_GFS_OP_EVENT_REPLY,
80  GLOBUS_GFS_OP_EVENT,
81  GLOBUS_GFS_OP_SESSION_START,
82  GLOBUS_GFS_OP_SESSION_STOP,
83  GLOBUS_GFS_OP_RECV,
84  GLOBUS_GFS_OP_SEND,
85  GLOBUS_GFS_OP_LIST,
86  GLOBUS_GFS_OP_COMMAND,
87  GLOBUS_GFS_OP_PASSIVE,
88  GLOBUS_GFS_OP_ACTIVE,
89  GLOBUS_GFS_OP_DESTROY,
90  GLOBUS_GFS_OP_TRANSFER,
91  GLOBUS_GFS_OP_STAT,
92  GLOBUS_GFS_OP_BUFFER_SEND,
93  GLOBUS_GFS_OP_HANDSHAKE,
94  GLOBUS_GFS_OP_SESSION_START_REPLY,
95  GLOBUS_GFS_OP_INTERMEDIATE_REPLY
96 } globus_gfs_operation_type_t;
97 
98 #define GLOBUS_GFS_OP_STAT_PARTIAL GLOBUS_GFS_OP_INTERMEDIATE_REPLY
99 
100 /*
101  * globus_gfs_command_type_t
102  *
103  * Command types. Commands are generally simple filesystem operations
104  * that only return success/failure and at most a single string.
105  */
106 typedef enum globus_gfs_command_type_e
107 {
108  GLOBUS_GFS_CMD_MKD = 1,
109  GLOBUS_GFS_CMD_RMD,
110  GLOBUS_GFS_CMD_DELE,
111  GLOBUS_GFS_CMD_SITE_AUTHZ_ASSERT,
112  GLOBUS_GFS_CMD_SITE_RDEL,
113  GLOBUS_GFS_CMD_RNTO,
114  GLOBUS_GFS_CMD_RNFR,
115  GLOBUS_GFS_CMD_CKSM,
116  GLOBUS_GFS_CMD_SITE_CHMOD,
117  GLOBUS_GFS_CMD_SITE_DSI,
118  GLOBUS_GFS_CMD_SITE_SETNETSTACK,
119  GLOBUS_GFS_CMD_SITE_SETDISKSTACK,
120  GLOBUS_GFS_CMD_SITE_CLIENTINFO,
121  GLOBUS_GFS_CMD_DCSC,
122  GLOBUS_GFS_CMD_SITE_CHGRP,
123  GLOBUS_GFS_CMD_SITE_UTIME,
124  GLOBUS_GFS_CMD_SITE_SYMLINKFROM,
125  GLOBUS_GFS_CMD_SITE_SYMLINK,
126  GLOBUS_GFS_CMD_HTTP_PUT,
127  GLOBUS_GFS_CMD_HTTP_GET,
128  GLOBUS_GFS_CMD_HTTP_CONFIG,
129  GLOBUS_GFS_CMD_TRNC,
130  GLOBUS_GFS_CMD_SITE_TASKID,
131 
132  /* handled internally */
133  GLOBUS_GFS_CMD_SITE_RESTRICT = 3072,
134  GLOBUS_GFS_CMD_SITE_CHROOT,
135  GLOBUS_GFS_CMD_SITE_SHARING,
136  GLOBUS_GFS_CMD_UPAS,
137  GLOBUS_GFS_CMD_UPRT,
138  GLOBUS_GFS_CMD_STORATTR,
139  GLOBUS_GFS_CMD_WHOAMI,
140 
141  GLOBUS_GFS_MIN_CUSTOM_CMD = 4096
142 } globus_gfs_command_type_t;
143 
164 {
168 
171 
175 
179 
184 
189 
194 
197 
200 
204 
205 /*
206  * globus_gfs_buffer_type_t
207  *
208  */
209 typedef enum globus_gfs_buffer_type_e
210 {
211  GLOBUS_GFS_BUFFER_EOF_INFO = 0x0001,
212  GLOBUS_GFS_BUFFER_SERVER_DEFINED = 0xFFFF
213  /* user defined types will start at 0x00010000 */
214 } globus_gfs_buffer_type_t;
215 
216 /*
217  * globus_gfs_layout_type_t
218  *
219  * Striped layout types.
220  */
221 typedef enum globus_gfs_layout_type_e
222 {
223  GLOBUS_GFS_LAYOUT_PARTITIONED = 1,
224  GLOBUS_GFS_LAYOUT_BLOCKED
225 } globus_gfs_layout_type_t;
226 
227 /*
228  * globus_gfs_stat_t
229  *
230  * Similar to a posix struct stat. Defined in the server-lib.
231  *
232  * (this comment should not be relied upon, so check the
233  * definition in globus_gridftp_server_control.h to be sure)
234  *
235  * typedef struct globus_gridftp_server_control_stat_s
236  * {
237  * int mode;
238  * int nlink;
239  * char * name;
240  * char * symlink_target;
241  * uid_t uid;
242  * gid_t gid;
243  * globus_off_t size;
244  * globus_time_t atime;
245  * globus_time_t ctime;
246  * globus_time_t mtime;
247  * int dev;
248  * int ino;
249  * } globus_gridftp_server_control_stat_t;
250  */
252 
253 
254 /*
255  * globus_gfs_operation_info_t
256  *
257  * Internal operation info. This handle is passed with the info structs
258  * Its data should not be accessed.
259  */
260 typedef struct globus_i_gfs_op_info_s * globus_gfs_op_info_t;
261 
262 /*
263  * globus_gfs_data_finished_info_t
264  *
265  * Contains specific result info for an active or passive data connection.
266  * Note that in most cases this info will simply be passed.
267  */
268 typedef struct globus_gfs_data_finished_info_s
269 {
271  void * data_arg;
273  globus_bool_t bi_directional;
275  globus_bool_t ipv6;
277  int cs_count;
279  const char ** contact_strings;
280 } globus_gfs_data_finished_info_t;
281 
282 /*
283  * globus_gfs_cmd_finshed_info_t
284  *
285  * Contains specific result info for commands.
286  */
287 typedef struct globus_gfs_cmd_finshed_info_s
288 {
290  globus_gfs_command_type_t command;
292  char * checksum;
294  char * created_dir;
295 } globus_gfs_cmd_finshed_info_t;
296 
297 /*
298  * globus_gfs_stat_finished_info_t
299  *
300  * Contains specific result info for a stat.
301  */
302 typedef struct globus_gfs_stat_finished_info_s
303 {
305  int uid;
307  int gid_count;
309  int * gid_array;
311  int stat_count;
313  globus_gfs_stat_t * stat_array;
314 } globus_gfs_stat_finished_info_t;
315 
316 /*
317  * globus_gfs_session_finished_info_t
318  *
319  * Contains specific result info for a stat.
320  */
321 typedef struct globus_gfs_session_finished_info_s
322 {
324  void * session_arg;
326  char * username;
328  char * home_dir;
329 } globus_gfs_session_finished_info_t;
330 
331 /*
332  * globus_gfs_session_finished_info_t
333  *
334  * Contains specific result info for a stat.
335  */
336 typedef struct globus_gfs_transfer_finished_info_s
337 {
338  /* total bytes transferred for this operation */
339  globus_off_t bytes_transferred;
340 
341 } globus_gfs_transfer_finished_info_t;
342 
343 /*
344  * globus_gfs_finished_info_t
345  *
346  * Final result info for an operation.
347  */
348 typedef struct globus_gfs_finished_info_s
349 {
351  globus_gfs_operation_type_t type;
353  int id;
355  int code;
358  char * msg;
360  globus_result_t result;
361 
362  union
363  {
364  globus_gfs_session_finished_info_t session;
365  globus_gfs_data_finished_info_t data;
366  globus_gfs_cmd_finshed_info_t command;
367  globus_gfs_stat_finished_info_t stat;
368  globus_gfs_transfer_finished_info_t transfer;
369  } info;
370 
372  globus_gfs_op_info_t op_info;
373 } globus_gfs_finished_info_t;
374 
375 /*
376  * globus_gfs_event_info_t
377  *
378  * Event info.
379  */
380 typedef struct globus_gfs_event_info_s
381 {
384 
387  void * event_arg;
388 
389  /* reply data */
391  int node_ndx;
393  int id;
395  int event_mask;
397  globus_off_t recvd_bytes;
399  globus_range_list_t recvd_ranges;
401  void * data_arg;
402 
403  /* request data */
405  int * eof_count;
407  int node_count;
408 
410  globus_gfs_op_info_t op_info;
411 } globus_gfs_event_info_t;
412 
413 /*
414  * globus_gfs_transfer_info_t
415  *
416  * Info needed for transfer operations (list, send, recv).
417  */
418 typedef struct globus_gfs_transfer_info_s
419 {
421  char * pathname;
423  char * module_name;
424  char * module_args;
426  char * list_type;
427 
429  globus_off_t partial_offset;
431  globus_off_t partial_length;
433  globus_range_list_t range_list;
435  globus_bool_t truncate;
436 
438  void * data_arg;
440  int eof_count;
442  int stripe_count;
444  int node_count;
446  int node_ndx;
447 
449  globus_off_t alloc_size;
450 
452  char * expected_checksum;
454  char * expected_checksum_alg;
455 
457  int list_depth;
459  int traversal_options;
460 
462  globus_gfs_op_info_t op_info;
463 } globus_gfs_transfer_info_t;
464 
465 
466 /*
467 * maintain backward source compatibility after member rename
468 */
469 #define rnfr_pathname from_pathname
470 
471 /*
472  * globus_gfs_command_info_t
473  *
474  * Info needed for a command operation.
475  */
476 typedef struct globus_gfs_command_info_s
477 {
479  globus_gfs_command_type_t command;
481  char * pathname;
482 
484  globus_off_t cksm_offset;
486  globus_off_t cksm_length;
488  char * cksm_alg;
489 
491  int chmod_mode;
492 
495  char * from_pathname;
496 
498  char * authz_assert;
499 
501  char * chgrp_group;
502 
504  time_t utime_time;
505 
507  globus_gfs_op_info_t op_info;
508 } globus_gfs_command_info_t;
509 
510 /*
511  * globus_gfs_data_info_t
512  *
513  * Info needed for data operations (active, passive).
514  */
515 typedef struct globus_gfs_data_info_s
516 {
518  globus_bool_t ipv6;
520  int nstreams;
522  char mode;
524  char type;
526  globus_size_t tcp_bufsize;
528  globus_size_t blocksize;
530  globus_size_t stripe_blocksize;
532  int stripe_layout;
533 
535  char prot;
537  char dcau;
539  char * subject;
541  char * pathname;
542 
544  int max_cs;
546  int cs_count;
548  const char ** contact_strings;
550  char * interface;
551 
552  /* if this is set, the data channel will use it instead
553  of the default session credential */
554  gss_cred_id_t del_cred;
555 
557  globus_gfs_op_info_t op_info;
558 } globus_gfs_data_info_t;
559 
560 /*
561  * globus_gfs_stat_info_t
562  *
563  * Info needed for a stat operation.
564  */
565 typedef struct globus_gfs_stat_info_s
566 {
568  globus_bool_t file_only;
570  globus_bool_t internal;
572  char * pathname;
574  globus_bool_t use_symlink_info;
576  globus_bool_t include_path_stat;
577 
579  globus_gfs_op_info_t op_info;
580 } globus_gfs_stat_info_t;
581 
582 typedef struct globus_gfs_session_info_s
583 {
584  gss_cred_id_t del_cred;
585  globus_bool_t free_cred;
586  globus_bool_t map_user;
587  char * username;
588  char * password;
589  char * subject;
590  char * cookie;
591  char * host_id;
592 
594  globus_gfs_op_info_t op_info;
595 } globus_gfs_session_info_t;
596 
597 typedef enum globus_gfs_brain_reason_e
598 {
599  GLOBUS_GFS_BRAIN_REASON_ERROR = 1,
600  GLOBUS_GFS_BRAIN_REASON_COMPLETE
601 } globus_gfs_brain_reason_t;
602 
603 typedef struct globus_i_gfs_brain_node_s
604 {
605  char * host_id;
606  char * repo_name;
607  void * brain_arg;
608  int max_connection;
609  int current_connection;
610  float load;
611 } globus_i_gfs_brain_node_t;
612 
613 /**************************************************************************
614  * Storage Module API
615  *
616  * The storage module API is made up of the interface definition,
617  * notification functions, and helper functions below.
618  *************************************************************************/
619 
620 /*
621  * globus_gfs_operation_t
622  *
623  * Operation handle. This handle is passed to and from the storage
624  * module. Its internal data should not be used.
625  */
626 typedef struct globus_l_gfs_data_operation_s * globus_gfs_operation_t;
627 
628 
633 /*
634  * init/destroy
635  *
636  * This will be called upon a new client session. Any persistent
637  * data that will be needed should be initialized and stored in a
638  * user-defined object which should be assigned to out_user_arg. This
639  * object pointer will then be passed back to the module with any other
640  * interface call.
641  */
642 typedef void
644  globus_gfs_operation_t op,
645  globus_gfs_session_info_t * session_info);
646 
647 /*
648  * This will be called when the client session ends. Final cleanup
649  * should be done here.
650  */
651 typedef void
652 (*globus_gfs_storage_destroy_t)(
653  void * user_arg);
654 
655 /*
656  * transfer
657  *
658  * This defines the functions that will be called for list, send, and recv.
659  */
660 typedef void
661 (*globus_gfs_storage_transfer_t)(
662  globus_gfs_operation_t op,
663  globus_gfs_transfer_info_t * transfer_info,
664  void * user_arg);
665 
666 /*
667  * command
668  *
669  * This defines the function that will be called for commands. The type
670  * member of command_info specifies which command to carry out.
671  */
672 typedef void
673 (*globus_gfs_storage_command_t)(
674  globus_gfs_operation_t op,
675  globus_gfs_command_info_t * command_info,
676  void * user_arg);
677 
678 /*
679  * stat
680  *
681  * This defines the function that will be called for a stat lookup.
682  */
683 typedef void
684 (*globus_gfs_storage_stat_t)(
685  globus_gfs_operation_t op,
686  globus_gfs_stat_info_t * stat_info,
687  void * user_arg);
688 
689 /*
690  * data connection
691  *
692  * This defines the functions that will be called for active and passive
693  * data connection creation.
694  */
695 typedef void
696 (*globus_gfs_storage_data_t)(
697  globus_gfs_operation_t op,
698  globus_gfs_data_info_t * data_info,
699  void * user_arg);
700 
701 /*
702  * data_destroy
703  *
704  * This defines the function that will be called to signal that a data
705  * connection should be destroyed. Note that there is no corresponding
706  * finished notification for data destroy requests.
707  */
708 typedef void
709 (*globus_gfs_storage_data_destroy_t)(
710  void * data_arg,
711  void * user_arg);
712 
713 /*
714  * data_destroy
715  *
716  * This defines the function that will be called to signal that a transfer
717  * event should occur. Note that there is no corresponding finished
718  * notification for transfer event requests.
719  */
720 typedef void
721 (*globus_gfs_storage_trev_t)(
722  globus_gfs_event_info_t * event_info,
723  void * user_arg);
724 
725 /*
726  * set cred
727  *
728  * This defines the function that will be called to pass delegated credentials.
729  * XXX more here later XXX
730  */
731 typedef void
732 (*globus_gfs_storage_set_cred_t)(
733  gss_cred_id_t del_cred,
734  void * user_arg);
735 
736 /*
737  * send user buffer
738  *
739  * This defines the function that will be called to send a user defined buffer.
740  * XXX more here later XXX
741  */
742 typedef void
743 (*globus_gfs_storage_buffer_send_t)(
744  int buffer_type,
745  globus_byte_t * buffer,
746  globus_size_t buffer_len,
747  void * user_arg);
748 
749 
750 /*
751  * realpath
752  *
753  * This defines the function that will be called to determine a true path
754  * free of symlinks or other obsfucation.
755  * if you implement this, add GLOBUS_GFS_DSI_DESCRIPTOR_HAS_REALPATH to your
756  * globus_gfs_storage_iface_t interface definition.
757  */
758 
759 typedef globus_result_t
760 (*globus_gfs_storage_realpath_t)(
761  const char * in_path,
762  char ** out_realpath,
763  void * user_arg);
764 
765 
766 #define GLOBUS_GFS_DSI_DESCRIPTOR_SENDER (1 << 0)
767 #define GLOBUS_GFS_DSI_DESCRIPTOR_BLOCKING (1 << 1)
768 #define GLOBUS_GFS_DSI_DESCRIPTOR_HAS_REALPATH (1 << 2)
769 #define GLOBUS_GFS_DSI_DESCRIPTOR_REQUIRES_ORDERED_DATA (1 << 3)
770 #define GLOBUS_GFS_DSI_DESCRIPTOR_SETS_ERROR_RESPONSES (1 << 4)
771 #define GLOBUS_GFS_DSI_DESCRIPTOR_SAFE_RDEL (1 << 5)
772 
773 /*
774  * globus_gfs_storage_iface_t
775  *
776  * Storage interface function pointers. Only define functions that are
777  * implemented. If a function is not defined, the server will either fail
778  * for that particular operation, or in the case of list, data, cred, and
779  * trev funcs, the server will act on those operations itself.
780  */
781 typedef struct globus_gfs_storage_iface_s
782 {
783  int descriptor;
784 
785  /* session initiating functions */
786  globus_gfs_storage_init_t init_func;
787  globus_gfs_storage_destroy_t destroy_func;
788 
789  /* transfer functions */
790  globus_gfs_storage_transfer_t list_func;
791  globus_gfs_storage_transfer_t send_func;
792  globus_gfs_storage_transfer_t recv_func;
793  globus_gfs_storage_trev_t trev_func;
794 
795  /* data conn funcs */
796  globus_gfs_storage_data_t active_func;
797  globus_gfs_storage_data_t passive_func;
798  globus_gfs_storage_data_destroy_t data_destroy_func;
799 
800  globus_gfs_storage_command_t command_func;
801  globus_gfs_storage_stat_t stat_func;
802 
803  globus_gfs_storage_set_cred_t set_cred_func;
804  globus_gfs_storage_buffer_send_t buffer_send_func;
805  globus_gfs_storage_realpath_t realpath_func;
806 } globus_gfs_storage_iface_t;
807 
812 /*
813  * operation finished
814  *
815  * This is a generic finished notification function. Either this *or* a
816  * specific finished function below must be called upon completion of an
817  * operation with the appropriate data set in the finished_info struct,
818  * including error info if the operation failed.
819  */
820 void
822  globus_gfs_operation_t op,
823  globus_result_t result,
824  globus_gfs_finished_info_t * finished_info);
825 
826 /*
827  * operation event
828  *
829  * This is a generic event notification function. Either this *or* a
830  * specific event function below must be called upon completion of an
831  * operation with the appropriate event data set in the event_info struct.
832  */
833 void
834 globus_gridftp_server_operation_event(
835  globus_gfs_operation_t op,
836  globus_result_t result,
837  globus_gfs_event_info_t * event_info);
838 
839 /*
840  * begin transfer event
841  *
842  * Speficic event notification for the start of a transfer.
843  */
844 void
845 globus_gridftp_server_begin_transfer(
846  globus_gfs_operation_t op,
847  int event_mask,
848  void * event_arg);
849 
850 /*
851  * finished transfer
852  *
853  * Speficic finished notification for completion of a transfer.
854  */
855 void
856 globus_gridftp_server_finished_transfer(
857  globus_gfs_operation_t op,
858  globus_result_t result);
859 
860 /*
861  * finished session_start
862  *
863  * Specific finished notification for session start completion.
864  *
865  */
866 void
867 globus_gridftp_server_finished_session_start(
868  globus_gfs_operation_t op,
869  globus_result_t result,
870  void * session_arg,
871  char * username,
872  char * home_dir);
873 
874 /*
875  * finished command
876  *
877  * Speficic finished notification for completion of a command.
878  * command_response should be NULL if not used (currently only
879  * used in MKD and CKSM)
880  */
881 void
882 globus_gridftp_server_finished_command(
883  globus_gfs_operation_t op,
884  globus_result_t result,
885  char * command_response);
886 void
887 globus_gridftp_server_intermediate_command(
888  globus_gfs_operation_t op,
889  globus_result_t result,
890  char * command_response);
891 
892 /*
893  * finished stat
894  *
895  * Speficic finished notification for completion of a stat.
896  */
897 void
898 globus_gridftp_server_finished_stat(
899  globus_gfs_operation_t op,
900  globus_result_t result,
901  globus_gfs_stat_t * stat_array,
902  int stat_count);
903 
904 void
905 globus_gridftp_server_finished_stat_partial(
906  globus_gfs_operation_t op,
907  globus_result_t result,
908  globus_gfs_stat_t * stat_array,
909  int stat_count);
910 
911 void
912 globus_gridftp_server_finished_stat_custom_list(
913  globus_gfs_operation_t op,
914  globus_result_t result,
915  globus_byte_t * list_response,
916  globus_size_t list_response_len,
917  globus_bool_t free_buffer);
918 
919 /*
920  * finished active data
921  *
922  * Speficic finished notification for completion of a active data creation.
923  */
924 void
925 globus_gridftp_server_finished_active_data(
926  globus_gfs_operation_t op,
927  globus_result_t result,
928  void * data_arg,
929  globus_bool_t bi_directional);
930 
931 /*
932  * finished passive data
933  *
934  * Speficic finished notification for completion of a passive data creation.
935  */
936 void
937 globus_gridftp_server_finished_passive_data(
938  globus_gfs_operation_t op,
939  globus_result_t result,
940  void * data_arg,
941  globus_bool_t bi_directional,
942  const char ** contact_strings,
943  int cs_count);
944 
945 
946 
951 /*
952  * write
953  *
954  * Register a write of specified buffer to the server. You should use
955  * globus_gridftp_server_get_block_size()
956  * and globus_gridftp_server_get_optimal_concurrency() to determine the
957  * buffer size of each write and the number of writes you should have
958  * pending at all times. (pending meaning you are waiting for the callback).
959  */
960 typedef void
962  globus_gfs_operation_t op,
963  globus_result_t result,
964  globus_byte_t * buffer,
965  globus_size_t nbytes,
966  void * user_arg);
967 
969 globus_gridftp_server_register_write(
970  globus_gfs_operation_t op,
971  globus_byte_t * buffer,
972  globus_size_t length,
973  globus_off_t offset,
974  int stripe_ndx,
976  void * user_arg);
977 
978 /*
979  * read
980  *
981  * Register a read of data from the server. You should use
982  * globus_gridftp_server_get_block_size()
983  * and globus_gridftp_server_get_optimal_concurrency() to determine the
984  * buffer size you should use and the number of reads you should have
985  * pending at all times. (pending meaning you are waiting for the callback).
986  */
987 typedef void
988 (*globus_gridftp_server_read_cb_t)(
989  globus_gfs_operation_t op,
990  globus_result_t result,
991  globus_byte_t * buffer,
992  globus_size_t nbytes,
993  globus_off_t offset,
994  globus_bool_t eof,
995  void * user_arg);
996 
998 globus_gridftp_server_register_read(
999  globus_gfs_operation_t op,
1000  globus_byte_t * buffer,
1001  globus_size_t length,
1002  globus_gridftp_server_read_cb_t callback,
1003  void * user_arg);
1004 
1005 
1006 /*
1007  * register a custom command
1008  *
1009  * This must be called during the DSI session_start_func() function.
1010  * When a command is triggered, command_func() will be called with a
1011  * command_info->command equal to cmd_id. Responses are handled as with
1012  * any other command. Call globus_gridftp_server_finished_command() with
1013  * a valid FTP response string in 'command_response' to customize your response
1014  * i.e. "250 The command was successful\r\n"
1015  *
1016  * cmd_id must be >= GLOBUS_GFS_MIN_CUSTOM_CMD.
1017  *
1018  * If a command takes a pathname, it must be the final argument, and has_pathname
1019  * must be set to GLOBUS_TRUE. commands should not take multiple pathnames.
1020  *
1021  * If the command takes a pathname, set access_type to an globus_gfs_acl_action_t
1022  * like one of: GFS_ACL_ACTION_READ, GFS_ACL_ACTION_WRITE,
1023  * GFS_ACL_ACTION_CREATE, GFS_ACL_ACTION_DELETE, GFS_ACL_ACTION_LOOKUP.
1024  *
1025  * The last argument will always be passed in command_info->pathname, whether
1026  * it is a pathname or not.
1027  * Other args can be obtained by querying command_info->op_info for
1028  * GLOBUS_GFS_OP_INFO_CMD_ARGS. See globus_gridftp_server_query_op_info().
1029  *
1030  * Note for min_args and max_args, that the command itself counts as a argument
1031  * (or 2, in the case of SITE commands).
1032  *
1033  * A non-SITE command name must be exactly 4 characters long,
1034  * A SITE command (command name = "SITE SOMETHING") can be any length
1035  *
1036  * help_string should be of the form "COMMAND <sp> arg1 <sp> arg2 <sp> pathname"
1037  *
1038  */
1039 
1041 globus_gridftp_server_add_command(
1042  globus_gfs_operation_t op,
1043  const char * command_name,
1044  int cmd_id,
1045  int min_args,
1046  int max_args,
1047  const char * help_string,
1048  globus_bool_t has_pathname,
1049  int access_type);
1050 
1067  globus_gfs_operation_t op,
1068  const char * cksm_str);
1069 
1074 typedef enum
1075 {
1076  /* return argv and argc for the current command. usually called when
1077  * handling custom commands.
1078  *
1079  * char *** argv,
1080  * int * argc
1081  */
1082  GLOBUS_GFS_OP_INFO_CMD_ARGS = 1
1084 
1085 /* query op_info for parameters
1086  * query parameters listed in the globus_gfs_op_info_param_t enum.
1087  * the varargs should be populated with variables of the correct type to hold
1088  * the returning parameters for the requested param type.
1089  *
1090 */
1092 globus_gridftp_server_query_op_info(
1093  globus_gfs_operation_t op,
1094  globus_gfs_op_info_t op_info,
1096  ...);
1097 
1098 /* check for attributes applicable to the current recv operation.
1099  * requested_attr is a case-insensitive string indicating the attribute
1100  * whose value will returned in out_value. requested_attr may be NULL, in
1101  * which case the full attr string will be returned in out_value.
1102  *
1103  * the format of the full attr string is attr1=value;attr2=value;...
1104  *
1105  * it is the caller's responsibility to free() out_value after a succesful return.
1106 */
1107 
1109 globus_gridftp_server_get_recv_attr_string(
1110  globus_gfs_operation_t op,
1111  const char * requested_attr,
1112  char ** out_value);
1113 
1114 /* get intended modification time for the file being received. out_time
1115  * will be the same as if a UTIME/MDTM command had been issued. if the modify
1116  * time has not been requested by the client, this will return GLOBUS_SUCCESS
1117  * but out_time will be -1.
1118  */
1119 
1121 globus_gridftp_server_get_recv_modification_time(
1122  globus_gfs_operation_t op,
1123  time_t * out_time);
1124 
1125 /*
1126  * update bytes written to storage
1127  *
1128  * This should be called during a recv(), after each successful write
1129  * to the storage system.
1130  *
1131  * Use EITHER globus_gridftp_server_update_bytes_written() OR
1132  * both globus_gridftp_server_update_bytes_recvd() and
1133  * globus_gridftp_server_update_range_recvd() for a given range.
1134  */
1135 void
1136 globus_gridftp_server_update_bytes_written(
1137  globus_gfs_operation_t op,
1138  globus_off_t offset,
1139  globus_off_t length);
1140 
1141 /*
1142  * update bytes recieved, but not yet written to storage
1143  * use this when there may be a delay between reciving data
1144  * and writing to storage. this will ensure accurate performance
1145  * markers, but will not cause range/restart markers to be sent.
1146  *
1147  * Use EITHER globus_gridftp_server_update_bytes_written() OR
1148  * both globus_gridftp_server_update_bytes_recvd() and
1149  * globus_gridftp_server_update_range_recvd() for a given range.
1150  */
1151 void
1152 globus_gridftp_server_update_bytes_recvd(
1153  globus_gfs_operation_t op,
1154  globus_off_t length);
1155 
1156 /*
1157  * update bytes written to storage
1158  * use this when there may be a delay between reciving data
1159  * and writing to storage. this will cause range/restart markers
1160  * to be sent.
1161  *
1162  * Use EITHER globus_gridftp_server_update_bytes_written() OR
1163  * both globus_gridftp_server_update_bytes_recvd() and
1164  * globus_gridftp_server_update_range_recvd() for a given range.
1165  */
1166 void
1167 globus_gridftp_server_update_range_recvd(
1168  globus_gfs_operation_t op,
1169  globus_off_t offset,
1170  globus_off_t length);
1171 
1172 /*
1173  * get concurrency
1174  *
1175  * This should be called during a recv() and send() in order to know the
1176  * number of pending reads or writes you should have at once.
1177  */
1178 void
1179 globus_gridftp_server_get_optimal_concurrency(
1180  globus_gfs_operation_t op,
1181  int * count);
1182 
1183 /*
1184  * get blocksize
1185  *
1186  * This should be called during a recv() and send() in order to know the
1187  * size of buffers that you should be passing to the server for reads and
1188  * writes.
1189  */
1190 void
1191 globus_gridftp_server_get_block_size(
1192  globus_gfs_operation_t op,
1193  globus_size_t * block_size);
1194 
1195 /*
1196  * get stripe blocksize
1197  *
1198  * This can be called during a recv() and send() in modules that wish to
1199  * deal with striping.
1200  */
1201 void
1202 globus_gridftp_server_get_stripe_block_size(
1203  globus_gfs_operation_t op,
1204  globus_size_t * stripe_block_size);
1205 
1206 /*
1207  * get session username
1208  *
1209  * This should can be called to get the username that the process is running
1210  * under, which may be different from the username supplied in the
1211  * session_start call in some cases.
1212  */
1213 void
1214 globus_gridftp_server_get_session_username(
1215  globus_gfs_operation_t op,
1216  char ** username);
1217 
1218 /*
1219  * get delegated cred
1220  *
1221  * This can can be called to get the delegated credential. This may be called
1222  * with any op after session_start() and and the credential pointer will be
1223  * valid until at least session_stop. del_cred will be NULL if it is not
1224  * available.
1225  */
1226 void
1227 globus_gridftp_server_get_delegated_cred(
1228  globus_gfs_operation_t op,
1229  gss_cred_id_t * del_cred);
1230 
1231 /*
1232  * get security context (unsupported)
1233  *
1234  * This can can be called to get the gssapi security context of the client
1235  * connection. This may be called with any op after session_start() and
1236  * the context pointer will be valid until at least session_stop. context
1237  * will be NULL if it is not available. This is needed for accessing proxy
1238  * extensions or other gssapi operations where the delegated credential is
1239  * not sufficient. The caller should not attempt operations that modify the
1240  * context without fully understanding the effects.
1241  */
1242 void
1243 globus_gridftp_server_get_sec_context(
1244  globus_gfs_operation_t op,
1245  gss_ctx_id_t * context);
1246 
1247 
1248 /*
1249  * get/set ordered data requirement
1250  *
1251  * The DSI must call this before globus_gridftp_server_begin_transfer()
1252  * to set the ordered_data flag. This will ensure that the offsets read
1253  * in each data callback are in order, even when multiple streams are used.
1254  * This will result in the transfer slowing down to match the speed of the
1255  * slowest stream. Note: in cases where the data source intentionally sends
1256  * data out of order, this will result in an aborted transfer. However,
1257  * a DSI that needs ordered data would probably fail in such a scenario anyway.
1258  *
1259  * Instead of calling these functions, you can enable this setting for all
1260  * transfers by setting GLOBUS_GFS_DSI_DESCRIPTOR_REQUIRES_ORDERED_DATA
1261  * in the globus_gfs_storage_iface_t interface definition.
1262  */
1263 void
1264 globus_gridftp_server_set_ordered_data(
1265  globus_gfs_operation_t op,
1266  globus_bool_t ordered_data);
1267 
1268 void
1269 globus_gridftp_server_get_ordered_data(
1270  globus_gfs_operation_t op,
1271  globus_bool_t * ordered_data);
1272 
1273 /*
1274  * get config string
1275  *
1276  * This can be called to get the dsi specific configuration string
1277  * that is defined in the global configuration.
1278  */
1279 void
1280 globus_gridftp_server_get_config_string(
1281  globus_gfs_operation_t op,
1282  char ** config_string);
1283 
1284 /*
1285  * get config data
1286  *
1287  * This can be called to get the configuration data managed by the server.
1288  * data_id can be NULL, or can be used to specify a specific set of data.
1289  * config_data will always return NULL.
1290  */
1291 void
1292 globus_gridftp_server_get_config_data(
1293  globus_gfs_operation_t op,
1294  char * data_id,
1295  char ** config_data);
1296 
1297 void
1298 globus_gfs_data_get_file_stack_list(
1299  globus_gfs_operation_t in_op,
1300  globus_list_t ** out_list);
1301 
1302 char *
1303 globus_gfs_data_get_cmd_string(
1304  globus_gfs_operation_t op);
1305 
1306 void
1307 globus_gridftp_server_get_update_interval(
1308  globus_gfs_operation_t op,
1309  int * interval);
1310 
1311 /*
1312  * get read_range
1313  *
1314  * This should be called during send() in order to know the specific
1315  * offset and length of the file to read from the storage system
1316  * You should continue calling this and transferring the speficied data
1317  * until it returns a length of 0.
1318  */
1319 void
1320 globus_gridftp_server_get_read_range(
1321  globus_gfs_operation_t op,
1322  globus_off_t * offset,
1323  globus_off_t * length);
1324 
1325 
1326 /*
1327  * get write_range
1328  *
1329  * This could be called during recv() in order to get hints on the specific
1330  * offset and length that the data will be expected to come from
1331  * globus_gridftp_server_register_read() callbacks. Note that this is
1332  * only a hint, and not necessarily the exact data ranges that will come.
1333  * You would continue calling this until it returns a length of 0.
1334  */
1335 void
1336 globus_gridftp_server_get_write_range(
1337  globus_gfs_operation_t op,
1338  globus_off_t * offset,
1339  globus_off_t * length);
1340 
1341 
1342 /* END Storage Interface API */
1343 
1344 typedef enum
1345 {
1346  GLOBUS_GFS_LOG_ERR = 0x01,
1347  GLOBUS_GFS_LOG_WARN = 0x02,
1348  GLOBUS_GFS_LOG_TRANSFER = 0x04,
1349  GLOBUS_GFS_LOG_INFO = 0x08,
1350  GLOBUS_GFS_LOG_DUMP = 0x10,
1351 
1352  GLOBUS_GFS_LOG_ALL = 0xFF
1353 } globus_gfs_log_type_t;
1354 
1355 void
1356 globus_gfs_log_message(
1357  globus_gfs_log_type_t type,
1358  const char * format,
1359  ...);
1360 
1361 void
1362 globus_gfs_log_result(
1363  globus_gfs_log_type_t type,
1364  const char * lead,
1365  globus_result_t result);
1366 
1368 enum
1369 {
1370  GLOBUS_GFS_DEBUG_TRACE = 8,
1371  GLOBUS_GFS_DEBUG_INFO = 16,
1372  GLOBUS_GFS_DEBUG_STATE = 32
1373 };
1374 
1375 #ifdef __GNUC__
1376 #define GlobusGFSName(func) static const char * _gfs_name __attribute__((__unused__)) = #func
1377 #else
1378 #define GlobusGFSName(func) static const char * _gfs_name = #func
1379 #endif
1380 
1381 GlobusDebugDeclare(GLOBUS_GRIDFTP_SERVER);
1382 
1383 #define GlobusGFSDebugPrintf(level, message) \
1384  GlobusDebugPrintf(GLOBUS_GRIDFTP_SERVER, level, message)
1385 
1386 #define GlobusGFSDebugInfo(_msg) \
1387  GlobusGFSDebugPrintf( \
1388  GLOBUS_GFS_DEBUG_INFO, \
1389  ("[%s] %s\n", __func__, _msg))
1390 
1391 #define GlobusGFSDebugEnter() \
1392  GlobusGFSDebugPrintf( \
1393  GLOBUS_GFS_DEBUG_TRACE, \
1394  ("[%s] Entering\n", __func__))
1395 
1396 #define GlobusGFSDebugExit() \
1397  GlobusGFSDebugPrintf( \
1398  GLOBUS_GFS_DEBUG_TRACE, \
1399  ("[%s] Exiting\n", __func__))
1400 
1401 #define GlobusGFSDebugState(_state) \
1402  GlobusGFSDebugPrintf( \
1403  GLOBUS_GFS_DEBUG_INFO, \
1404  ("[%s] State: %d\n", __func__, _state))
1405 
1406 #define GlobusGFSDebugExitWithError() \
1407  GlobusGFSDebugPrintf( \
1408  GLOBUS_GFS_DEBUG_TRACE, \
1409  ("[%s] Exiting with error\n", __func__))
1410 
1411 #define GlobusGFSErrorParameter(mem_name) \
1412  globus_error_put(GlobusGFSErrorObjParameter(mem_name))
1413 
1414 #define GlobusGFSErrorIPC() \
1415  globus_error_put(GlobusGFSErrorObjIPC())
1416 
1417 #define GlobusGFSErrorObjIPC() \
1418  globus_error_construct_error( \
1419  NULL, \
1420  NULL, \
1421  GLOBUS_GFS_ERROR_MEMORY, \
1422  __FILE__, \
1423  __func__, \
1424  __LINE__, \
1425  "IPC Communication error.")
1426 
1427 #define GlobusGFSErrorObjParameter(param_name) \
1428  globus_error_construct_error( \
1429  NULL, \
1430  NULL, \
1431  GLOBUS_GFS_ERROR_PARAMETER, \
1432  __FILE__, \
1433  __func__, \
1434  __LINE__, \
1435  "invalid parameter: %s", \
1436  (param_name))
1437 
1438 #define GlobusGFSErrorSystemError(system_func, system_errno) \
1439  globus_error_put(GlobusGFSErrorObjSystemError(\
1440  (system_func), (system_errno)))
1441 #define GlobusGFSErrorObjSystemError(system_func, system_errno) \
1442  globus_i_gfs_error_system( \
1443  0, (system_errno), \
1444  "System error%s%s", \
1445  (system_func) != NULL ? " in " : "", \
1446  (system_func) != NULL ? (system_func) : "")
1447 
1448 #define GlobusGFSErrorWrapFailed(failed_func, result) \
1449  globus_error_put(GlobusGFSErrorObjWrapFailed(failed_func, result))
1450 
1451 #define GlobusGFSErrorObjWrapFailed(failed_func, result) \
1452  globus_error_construct_error( \
1453  NULL, \
1454  globus_error_get((result)), \
1455  GLOBUS_GFS_ERROR_WRAPPED, \
1456  __FILE__, \
1457  __func__, \
1458  __LINE__, \
1459  "%s failed.", \
1460  (failed_func))
1461 
1462 #define GlobusGFSErrorData(reason) \
1463  globus_error_put(GlobusGFSErrorObjData(reason))
1464 
1465 #define GlobusGFSErrorObjData(reason) \
1466  globus_error_construct_error( \
1467  NULL, \
1468  NULL, \
1469  GLOBUS_GFS_ERROR_DATA, \
1470  __FILE__, \
1471  __func__, \
1472  __LINE__, \
1473  "%s", \
1474  (reason))
1475 
1476 #define GlobusGFSErrorGeneric(reason) \
1477  globus_error_put(GlobusGFSErrorObjGeneric(reason))
1478 
1479 #define GlobusGFSErrorObjGeneric(reason) \
1480  globus_error_construct_error( \
1481  NULL, \
1482  NULL, \
1483  GLOBUS_GFS_ERROR_GENERIC, \
1484  __FILE__, \
1485  __func__, \
1486  __LINE__, \
1487  "%s", \
1488  (reason))
1489 
1490 globus_object_t *
1492  globus_module_descriptor_t * base_source,
1493  globus_object_t * base_cause,
1494  int response_code,
1495  const char *response_error_code,
1496  const char *fmt,
1497  ...);
1498 
1499 globus_object_t *
1501  globus_object_t * error,
1502  globus_module_descriptor_t * base_source,
1503  globus_object_t * base_cause,
1504  int response_code,
1505  const char * response_error_code,
1506  const char * fmt,
1507  va_list ap);
1508 globus_object_t *
1510  globus_object_t * error,
1511  globus_module_descriptor_t * base_source,
1512  globus_object_t * base_cause,
1513  int response_code,
1514  const char * response_error_code,
1515  const char * fmt,
1516  ...);
1517 
1518 int
1520  globus_object_t * error);
1521 
1522 const char *
1524  globus_object_t * error);
1525 
1528  globus_object_t * error,
1529  const char * response_error_code);
1530 
1531 extern const globus_object_type_t
1533 
1534 #define GLOBUS_GFS_ERROR_FTP_RESPONSE_TYPE \
1535  (&GLOBUS_GFS_ERROR_FTP_RESPONSE_TYPE_DEFINITION)
1536 
1537 
1538 #define GlobusGFSErrorFtpResponse(cause, code, response_error_code, ...) \
1539  globus_error_put(GlobusGFSErrorObjFtpResponse( \
1540  cause, code, response_error_code, __VA_ARGS__))
1541 
1542 #define GlobusGFSErrorObjFtpResponse(cause, code, response_error_code, ...) \
1543  globus_gfs_ftp_response_error_construct( \
1544  NULL, \
1545  cause, \
1546  code, \
1547  response_error_code, \
1548  __VA_ARGS__)
1549 
1550 globus_object_t *
1551 globus_i_gfs_error_system(int ftp_code, int system_errno, const char *fmt, ...);
1552 
1553 #define GlobusGFSErrorMemory(mem) \
1554  globus_error_put(GlobusGFSErrorObjMemory(mem))
1555 #define GlobusGFSErrorObjMemory(mem) \
1556  GlobusGFSErrorObjSystemError("malloc", errno)
1557 
1558 #define GlobusGFSErrorObj(cause, response_code, ...) \
1559  GlobusGFSErrorObjFtpResponse(cause, response_code, __VA_ARGS__)
1560 
1561 #define GlobusGFSErrorPathNotFound(p) \
1562  globus_error_put(GlobusGFSErrorObjPathNotFound(NULL, p))
1563 #define GlobusGFSErrorObjPathNotFound(cause, p) \
1564  GlobusGFSErrorObj((cause), 550, "PATH_NOT_FOUND", \
1565  "%s%s%s", \
1566  ((p) != NULL) ? "GridFTP-Path: \"" : "", \
1567  ((p) != NULL) ? (p) : "", \
1568  ((p) != NULL) ? "\"" : "")
1569 
1570 #define GlobusGFSErrorIncorrectChecksum(computed, expected) \
1571  globus_error_put(GlobusGFSErrorObjIncorrectChecksum( \
1572  NULL, computed, expected))
1573 #define GlobusGFSErrorObjIncorrectChecksum(cause, computed, expected) \
1574  GlobusGFSErrorObj( \
1575  (cause), \
1576  550, \
1577  "INCORRECT_CHECKSUM", \
1578  "GridFTP-Computed-Checksum: %s\n" \
1579  "GridFTP-Expected-Checksum: %s", (computed), (expected))
1580 
1581 #define GlobusGFSErrorMultipartUploadNotFound() \
1582  globus_error_put(GlobusGFSErrorObjMultipartUploadNotFound(NULL))
1583 #define GlobusGFSErrorObjMultipartUploadNotFound(cause) \
1584  GlobusGFSErrorObj(cause, 553, "MULTI_PART_UPLOAD_NOT_FOUND", NULL)
1585 
1586 #define GlobusGFSErrorAppendNotSupported() \
1587  globus_error_put(GlobusGFSErrorObjAppendNotSupported(NULL))
1588 #define GlobusGFSErrorObjAppendNotSupported(cause) \
1589  GlobusGFSErrorObj((cause), 553, "APPEND_NOT_SUPPORTED", NULL)
1590 
1591 #define GlobusGFSErrorAmbiguousPath(ambiguity) \
1592  globus_error_put(GlobusGFSErrorObjAmbiguousPath(NULL, ambiguity))
1593 #define GlobusGFSErrorObjAmbiguousPath(cause, ambiguity) \
1594  GlobusGFSErrorObj( \
1595  (cause), \
1596  553, \
1597  "AMBIGUOUS_PATH", \
1598  "GridFTP-Path: %s", \
1599  (ambiguity))
1600 
1601 #define GlobusGFSErrorTooBusy() \
1602  globus_error_put(GlobusGFSErrorObjTooBusy(NULL))
1603 #define GlobusGFSErrorObjTooBusy(cause) \
1604  GlobusGFSErrorObj((cause), 451, "TOO_BUSY", NULL)
1605 
1606 #define GlobusGFSErrorDataChannelAuthenticationFailure() \
1607  globus_error_put(GlobusGFSErrorObjDataChannelAuthenticationFailure( \
1608  NULL))
1609 #define GlobusGFSErrorObjDataChannelAuthenticationFailure(cause) \
1610  GlobusGFSErrorObj((cause), 425, \
1611  "DATA_CHANNEL_AUTHENTICATION_FAILURE", NULL)
1612 
1613 #define GlobusGFSErrorDataChannelCommunicationFailure() \
1614  globus_error_put(GlobusGFSErrorObjDataChannelCommunicationFailure( \
1615  NULL))
1616 #define GlobusGFSErrorObjDataChannelCommunicationFailure(cause) \
1617  GlobusGFSErrorObj((cause), 425, \
1618  "DATA_CHANNEL_COMMUNICATION_FAILURE", NULL)
1619 
1620 #define GlobusGFSErrorLoginDenied() \
1621  globus_error_put(GlobusGFSErrorObjLoginDenied(NULL))
1622 #define GlobusGFSErrorObjLoginDenied(cause) \
1623  GlobusGFSErrorObj((cause), 530, "LOGIN_DENIED", NULL)
1624 
1625 #define GlobusGFSErrorPermissionDenied() \
1626  globus_error_put(GlobusGFSErrorObjPermissionDenied(NULL))
1627 #define GlobusGFSErrorObjPermissionDenied(cause) \
1628  GlobusGFSErrorObj((cause), 550, "PERMISSION_DENIED", NULL)
1629 
1630 #define GlobusGFSErrorQuotaExceeded() \
1631  globus_error_put(GlobusGFSErrorObjQuotaExceeded(NULL))
1632 #define GlobusGFSErrorObjQuotaExceeded(cause) \
1633  GlobusGFSErrorObj((cause), 451, "QUOTA_EXCEEDED", NULL)
1634 
1635 #define GlobusGFSErrorNoSpaceLeft() \
1636  globus_error_put(GlobusGFSErrorObjNoSpaceLeft(NULL))
1637 #define GlobusGFSErrorObjNoSpaceLeft(cause) \
1638  GlobusGFSErrorObj((cause), 451, "NO_SPACE_LEFT", NULL)
1639 
1640 #define GlobusGFSErrorInvalidPathName(name) \
1641  globus_error_put(GlobusGFSErrorObjInvalidPathName(NULL, name))
1642 #define GlobusGFSErrorObjInvalidPathName(cause, name) \
1643  GlobusGFSErrorObj((cause), 553, "INVALID_PATH_NAME", \
1644  "GridFTP-Path: %s", name)
1645 
1646 #define GlobusGFSErrorPathExists(name) \
1647  globus_error_put(GlobusGFSErrorObjPathExists(NULL, name))
1648 #define GlobusGFSErrorObjPathExists(cause, name) \
1649  GlobusGFSErrorObj((cause), 553, "PATH_EXISTS", \
1650  "GridFTP-Path: %s", name)
1651 
1652 #define GlobusGFSErrorIsADirectory(name) \
1653  globus_error_put(GlobusGFSErrorObjIsADirectory(NULL, name))
1654 #define GlobusGFSErrorObjIsADirectory(cause, name) \
1655  GlobusGFSErrorObj((cause), 553, "IS_A_DIRECTORY", \
1656  "GridFTP-Path: %s", name)
1657 
1658 #define GlobusGFSErrorNotADirectory(name) \
1659  globus_error_put(GlobusGFSErrorObjNotADirectory(NULL, name))
1660 #define GlobusGFSErrorObjNotADirectory(cause, name) \
1661  GlobusGFSErrorObj((cause), 553, "NOT_A_DIRECTORY", \
1662  "GridFTP-Path: %s", name)
1663 
1664 #define GlobusGFSErrorCRLError() \
1665  globus_error_put(GlobusGFSErrorObjCRLError(NULL))
1666 #define GlobusGFSErrorObjCRLError(cause) \
1667  GlobusGFSErrorObj((cause), 530, "CRL_ERROR", NULL)
1668 
1669 #define GlobusGFSErrorInternalError(generic_string) \
1670  globus_error_put(GlobusGFSErrorObjInternalError( \
1671  NULL, (generic_string)))
1672 #define GlobusGFSErrorObjInternalError(cause, generic_string) \
1673  GlobusGFSErrorObj((cause), 500, "INTERNAL_ERROR", \
1674  "%s%s", \
1675  ((generic_string) != NULL) ? "GridFTP-Error: " : "", \
1676  ((generic_string) != NULL) ? generic_string : "")
1677 
1678 #define GlobusGFSErrorNotImplemented() \
1679  globus_error_put(GlobusGFSErrorObjNotImplemented(NULL))
1680 #define GlobusGFSErrorObjNotImplemented(cause) \
1681  GlobusGFSErrorObj((cause), 500, "NOT_IMPLEMETED", NULL)
1682 
1683 #define GlobusGFSErrorNotImplementedFeature(feature) \
1684  globus_error_put(GlobusGFSErrorObjNotImplementedFeature(NULL, feature))
1685 #define GlobusGFSErrorObjNotImplementedFeature(cause, feature) \
1686  GlobusGFSErrorObj((cause), 500, \
1687  "NOT_IMPLEMETED", "GridFTP-Feature: %s", (feature))
1688 
1689 #define GlobusGFSErrorConfigurationError() \
1690  globus_error_put(GlobusGFSErrorObjConfigurationError(NULL))
1691 #define GlobusGFSErrorObjConfigurationError(cause) \
1692  GlobusGFSErrorObj((cause), 500, "CONFIGURATION_ERROR", NULL)
1693 /*
1694  *
1695  * IPC
1696  *
1697  */
1698 
1699 typedef struct globus_i_gfs_ipc_handle_s * globus_gfs_ipc_handle_t;
1700 
1701 /*
1702  * callbacks
1703  *
1704  * all functions have the same callback, they examine the
1705  * globus_gfs_finished_info_t() structure for their specific info
1706  *
1707  * error_cb
1708  * can be called at anytime. typically means the ipc connection broke
1709  * in an irrecoverable way. Even tho this is called all outstanding
1710  * callbacks will still be called (but with an error)
1711  */
1712 
1713  /*
1714  * replying
1715  *
1716  * every comman requires a reply and comes with a reply id. to reply
1717  * the requested side must fill in the globus_gfs_finished_info_t
1718  * structure and then pass it
1719  * to the function: globus_gfs_ipc_reply(); That call will result in
1720  * the ipc communication that will untilimately call the callback
1721  * on the callers side.
1722  */
1723 typedef void
1724 (*globus_gfs_ipc_callback_t)(
1725  globus_gfs_ipc_handle_t ipc_handle,
1726  globus_result_t result,
1727  globus_gfs_finished_info_t * reply,
1728  void * user_arg);
1729 
1730 typedef void
1731 (*globus_gfs_ipc_event_callback_t)(
1732  globus_gfs_ipc_handle_t ipc_handle,
1733  globus_result_t result,
1734  globus_gfs_event_info_t * reply,
1735  void * user_arg);
1736 
1737 typedef void
1738 (*globus_gfs_ipc_close_callback_t)(
1739  globus_gfs_ipc_handle_t ipc_handle,
1740  globus_result_t result,
1741  void * user_arg);
1742 
1743 typedef void
1744 (*globus_gfs_ipc_open_callback_t)(
1745  globus_gfs_ipc_handle_t ipc_handle,
1746  globus_result_t result,
1747  globus_gfs_finished_info_t * reply,
1748  void * user_arg);
1749 
1750 typedef void
1751 (*globus_gfs_ipc_error_callback_t)(
1752  globus_gfs_ipc_handle_t ipc_handle,
1753  globus_result_t result,
1754  void * user_arg);
1755 
1757 globus_gfs_ipc_reply_finished(
1758  globus_gfs_ipc_handle_t ipc_handle,
1759  globus_gfs_finished_info_t * reply);
1760 
1762 globus_gfs_ipc_reply_event(
1763  globus_gfs_ipc_handle_t ipc_handle,
1764  globus_gfs_event_info_t * reply);
1765 
1767 globus_gfs_ipc_reply_session(
1768  globus_gfs_ipc_handle_t ipc_handle,
1769  globus_gfs_finished_info_t * reply);
1770 
1771 /*
1772  * sending
1773  *
1774  * every command has a corresponding iface function. A call to a
1775  * command function results in a call to the correspoding iface
1776  * function on the other side of the channel.
1777  *
1778  * all parmeters are wrapped in a structure corresponding to
1779  * each function call type. those structures are defined below
1780  */
1781 
1782 typedef void
1783 (*globus_i_gfs_ipc_data_callback_t)(
1784  globus_gfs_finished_info_t * reply,
1785  void * user_arg);
1786 
1787 typedef void
1788 (*globus_i_gfs_ipc_data_event_callback_t)(
1789  globus_gfs_event_info_t * reply,
1790  void * user_arg);
1791 
1792 typedef void
1793 (*globus_i_gfs_ipc_done_callback_t)(
1794  void * user_arg,
1795  globus_result_t result);
1796 
1797 /*************************************************************************
1798  * interface function
1799  * ------------------
1800  *
1801  ************************************************************************/
1802 /* works with handle get */
1803 typedef void
1804 (*globus_gfs_ipc_iface_session_start_t)(
1805  globus_gfs_ipc_handle_t ipc_handle,
1806  const gss_ctx_id_t context,
1807  globus_gfs_session_info_t * session_info,
1808  globus_i_gfs_ipc_data_callback_t cb,
1809  void * user_arg);
1810 
1812 globus_gfs_ipc_start_session(
1813  globus_gfs_ipc_handle_t ipc_handle,
1814  globus_gfs_session_info_t * session_info,
1815  globus_gfs_ipc_callback_t cb,
1816  void * user_arg);
1817 
1818 /* works with release */
1819 typedef void
1820 (*globus_gfs_ipc_iface_session_stop_t)(
1821  globus_gfs_ipc_handle_t ipc_handle,
1822  void * session_handle);
1823 
1825 globus_gfs_ipc_iface_session_stop(
1826  globus_gfs_ipc_handle_t ipc_handle,
1827  void * session_handle);
1828 
1829 typedef void
1830 (*globus_gfs_ipc_iface_set_cred_t)(
1831  globus_gfs_ipc_handle_t ipc_handle,
1832  void * session_handle,
1833  gss_cred_id_t del_cred);
1834 
1836 globus_gfs_ipc_set_cred(
1837  globus_gfs_ipc_handle_t ipc_handle,
1838  gss_cred_id_t del_cred);
1839 
1840 typedef void
1841 (*globus_gfs_ipc_iface_buffer_send_t)(
1842  globus_gfs_ipc_handle_t ipc_handle,
1843  void * session_handle,
1844  globus_byte_t * buffer,
1845  int buffer_type,
1846  globus_size_t buffer_len);
1847 
1849 globus_gfs_ipc_request_buffer_send(
1850  globus_gfs_ipc_handle_t ipc_handle,
1851  globus_byte_t * buffer,
1852  int buffer_type,
1853  globus_size_t buffer_len);
1854 
1855 /*
1856  * receive
1857  *
1858  * tell the remote process to receive a file
1859  */
1860 typedef void
1861 (*globus_gfs_ipc_iface_recv_t)(
1862  globus_gfs_ipc_handle_t ipc_handle,
1863  void * session_handle,
1864  int id,
1865  globus_gfs_transfer_info_t * recv_info,
1866  globus_i_gfs_ipc_data_callback_t cb,
1867  globus_i_gfs_ipc_data_event_callback_t event_cb,
1868  void * user_arg);
1869 
1871 globus_gfs_ipc_request_recv(
1872  globus_gfs_ipc_handle_t ipc_handle,
1873  globus_gfs_transfer_info_t * recv_info,
1874  globus_gfs_ipc_callback_t cb,
1875  globus_gfs_ipc_event_callback_t event_cb,
1876  void * user_arg);
1877 
1878 /*
1879  * send
1880  *
1881  * tell remote process to send a file
1882  */
1883 typedef void
1884 (*globus_gfs_ipc_iface_send_t)(
1885  globus_gfs_ipc_handle_t ipc_handle,
1886  void * session_handle,
1887  int id,
1888  globus_gfs_transfer_info_t * send_info,
1889  globus_i_gfs_ipc_data_callback_t cb,
1890  globus_i_gfs_ipc_data_event_callback_t event_cb,
1891  void * user_arg);
1892 
1894 globus_gfs_ipc_request_send(
1895  globus_gfs_ipc_handle_t ipc_handle,
1896  globus_gfs_transfer_info_t * send_info,
1897  globus_gfs_ipc_callback_t cb,
1898  globus_gfs_ipc_event_callback_t event_cb,
1899  void * user_arg);
1900 
1901 typedef void
1902 (*globus_gfs_ipc_iface_list_t)(
1903  globus_gfs_ipc_handle_t ipc_handle,
1904  void * session_handle,
1905  int id,
1906  globus_gfs_transfer_info_t * list_info,
1907  globus_i_gfs_ipc_data_callback_t cb,
1908  globus_i_gfs_ipc_data_event_callback_t event_cb,
1909  void * user_arg);
1910 
1912 globus_gfs_ipc_request_list(
1913  globus_gfs_ipc_handle_t ipc_handle,
1914  globus_gfs_transfer_info_t * data_info,
1915  globus_gfs_ipc_callback_t cb,
1916  globus_gfs_ipc_event_callback_t event_cb,
1917  void * user_arg);
1918 
1919 /*
1920  * command
1921  *
1922  * tell remote side to execute the given command
1923  */
1924 typedef void
1925 (*globus_gfs_ipc_iface_command_t)(
1926  globus_gfs_ipc_handle_t ipc_handle,
1927  void * session_handle,
1928  int id,
1929  globus_gfs_command_info_t * cmd_info,
1930  globus_i_gfs_ipc_data_callback_t cb,
1931  void * user_arg);
1932 
1934 globus_gfs_ipc_request_command(
1935  globus_gfs_ipc_handle_t ipc_handle,
1936  globus_gfs_command_info_t * cmd_info,
1937  globus_gfs_ipc_callback_t cb,
1938  void * user_arg);
1939 
1940 /*
1941  * active data
1942  *
1943  * tell remote side to create an active data connection
1944  */
1945 typedef void
1946 (*globus_gfs_ipc_iface_active_data_t)(
1947  globus_gfs_ipc_handle_t ipc_handle,
1948  void * session_handle,
1949  int id,
1950  globus_gfs_data_info_t * data_info,
1951  globus_i_gfs_ipc_data_callback_t cb,
1952  void * user_arg);
1953 
1955 globus_gfs_ipc_request_active_data(
1956  globus_gfs_ipc_handle_t ipc_handle,
1957  globus_gfs_data_info_t * data_info,
1958  globus_gfs_ipc_callback_t cb,
1959  void * user_arg);
1960 
1961 /*
1962  * passive data
1963  *
1964  * tell remote side to do passive data connection
1965  */
1966 typedef void
1967 (*globus_gfs_ipc_iface_passive_data_t)(
1968  globus_gfs_ipc_handle_t ipc_handle,
1969  void * session_handle,
1970  int id,
1971  globus_gfs_data_info_t * data_info,
1972  globus_i_gfs_ipc_data_callback_t cb,
1973  void * user_arg);
1974 
1976 globus_gfs_ipc_request_passive_data(
1977  globus_gfs_ipc_handle_t ipc_handle,
1978  globus_gfs_data_info_t * data_info,
1979  globus_gfs_ipc_callback_t cb,
1980  void * user_arg);
1981 
1982 /*
1983  * send stat request
1984  */
1985 typedef void
1986 (*globus_gfs_ipc_iface_stat_t)(
1987  globus_gfs_ipc_handle_t ipc_handle,
1988  void * session_handle,
1989  int id,
1990  globus_gfs_stat_info_t * stat_info,
1991  globus_i_gfs_ipc_data_callback_t cb,
1992  void * user_arg);
1993 
1995 globus_gfs_ipc_request_stat(
1996  globus_gfs_ipc_handle_t ipc_handle,
1997  globus_gfs_stat_info_t * stat_info,
1998  globus_gfs_ipc_callback_t cb,
1999  void * user_arg);
2000 
2001 /*
2002  * poke transfer event request
2003  */
2004 typedef void
2005 (*globus_gfs_ipc_iface_transfer_event_t)(
2006  globus_gfs_ipc_handle_t ipc_handle,
2007  void * session_handle,
2008  globus_gfs_event_info_t * event_info);
2009 
2010 
2012 globus_gfs_ipc_request_transfer_event(
2013  globus_gfs_ipc_handle_t ipc_handle,
2014  globus_gfs_event_info_t * event_info);
2015 
2016 
2017 /*
2018  * destroy a data connection associated with the given ID
2019  */
2020 typedef void
2021 (*globus_gfs_ipc_iface_data_destroy_t)(
2022  globus_gfs_ipc_handle_t ipc_handle,
2023  void * session_handle,
2024  void * data_arg);
2025 
2027 globus_gfs_ipc_request_data_destroy(
2028  globus_gfs_ipc_handle_t ipc_handle,
2029  void * data_arg);
2030 
2031 typedef struct globus_i_gfs_ipc_iface_s
2032 {
2033  globus_gfs_ipc_iface_session_start_t session_start_func;
2034  globus_gfs_ipc_iface_session_stop_t session_stop_func;
2035  globus_gfs_ipc_iface_recv_t recv_func;
2036  globus_gfs_ipc_iface_send_t send_func;
2037  globus_gfs_ipc_iface_command_t command_func;
2038  globus_gfs_ipc_iface_active_data_t active_func;
2039  globus_gfs_ipc_iface_passive_data_t passive_func;
2040  globus_gfs_ipc_iface_data_destroy_t data_destroy_func;
2041  globus_gfs_ipc_iface_stat_t stat_func;
2042  globus_gfs_ipc_iface_list_t list_func;
2043  globus_gfs_ipc_iface_transfer_event_t transfer_event_func;
2044  globus_gfs_ipc_iface_set_cred_t set_cred;
2045  globus_gfs_ipc_iface_buffer_send_t buffer_send;
2046 } globus_gfs_ipc_iface_t;
2047 
2048 /*
2049  * getting an IPC handle
2050  */
2051 
2052 /*
2053  * create an IPC handle from a xio system handle, can be used
2054  * imediately, is not in handle table
2055  */
2057 globus_gfs_ipc_handle_create(
2058  globus_gfs_ipc_iface_t * iface,
2059  globus_xio_system_socket_t system_handle,
2060  globus_i_gfs_ipc_done_callback_t done_cb,
2061  void * user_arg);
2062 
2063 /*
2064  * actually close the handle
2065  */
2067 globus_gfs_ipc_close(
2068  globus_gfs_ipc_handle_t ipc_handle,
2069  globus_gfs_ipc_close_callback_t cb,
2070  void * user_arg);
2071 
2073 globus_gfs_ipc_reply_close(
2074  globus_gfs_ipc_handle_t ipc_handle);
2075 
2077 globus_gfs_ipc_session_stop(
2078  globus_gfs_ipc_handle_t ipc_handle);
2079 
2081 globus_gfs_ipc_handle_connect(
2082  globus_gfs_session_info_t * session_info,
2083  globus_gfs_ipc_open_callback_t cb,
2084  void * user_arg,
2085  globus_gfs_ipc_error_callback_t error_cb,
2086  void * error_user_arg);
2087 
2089 globus_gfs_ipc_handle_connect_ex(
2090  globus_gfs_session_info_t * session_info,
2091  globus_gfs_ipc_open_callback_t cb,
2092  void * user_arg,
2093  globus_gfs_ipc_error_callback_t error_cb,
2094  void * error_user_arg,
2095  globus_bool_t secure_ipc,
2096  gss_cred_id_t cred,
2097  const char *auth_mode,
2098  const char *subject,
2099  time_t connect_timeout,
2100  time_t idle_timeout,
2101  globus_bool_t inetd);
2102 
2104 globus_gfs_ipc_handle_obtain(
2105  globus_gfs_session_info_t * session_info,
2106  globus_gfs_ipc_iface_t * iface,
2107  globus_gfs_ipc_open_callback_t cb,
2108  void * user_arg,
2109  globus_gfs_ipc_error_callback_t error_cb,
2110  void * error_user_arg);
2111 
2112 /*
2113  * the brain bit
2114  */
2115 #define BRAIN_SYMBOL_NAME (void*)"gridftp_brain"
2116 extern globus_extension_registry_t brain_i_registry;
2117 
2118 typedef globus_result_t
2119 (*globus_i_gfs_brain_select_nodes_func_t)(
2120  globus_i_gfs_brain_node_t *** out_node_array,
2121  int * out_array_length,
2122  const char * repo_name,
2123  globus_off_t filesize,
2124  int min_count,
2125  int max_count);
2126 
2127 typedef globus_result_t
2128 (*globus_i_gfs_brain_release_node_func_t)(
2129  globus_i_gfs_brain_node_t * contact_node,
2130  globus_gfs_brain_reason_t reason);
2131 
2132 typedef globus_result_t
2133 (*globus_i_gfs_brain_init_func_t)();
2134 
2135 typedef void
2136 (*globus_i_gfs_brain_stop_func_t)();
2137 
2138 typedef globus_result_t
2139 (*globus_i_gfs_brain_get_available_func_t)(
2140  const char * user_id,
2141  const char * repo_name,
2142  int * count);
2143 
2144 
2145 typedef struct globus_i_gfs_brain_module_s
2146 {
2147  globus_i_gfs_brain_init_func_t init_func;
2148  globus_i_gfs_brain_stop_func_t stop_func;
2149  globus_i_gfs_brain_select_nodes_func_t select_func;
2150  globus_i_gfs_brain_release_node_func_t release_func;
2151  globus_i_gfs_brain_get_available_func_t available_func;
2152 } globus_i_gfs_brain_module_t;
2153 
2154 extern globus_i_gfs_brain_module_t globus_i_gfs_default_brain;
2155 
2157 globus_gfs_brain_select_nodes(
2158  globus_i_gfs_brain_node_t *** out_node_array,
2159  int * out_array_length,
2160  const char * repo_name,
2161  globus_off_t filesize,
2162  int min_count,
2163  int max_count);
2164 
2166 globus_gfs_brain_release_node(
2167  globus_i_gfs_brain_node_t * contact_node,
2168  globus_gfs_brain_reason_t reason);
2169 
2171 globus_gfs_brain_get_available(
2172  const char * user_id,
2173  const char * repo_name,
2174  int * count);
2175 
2177 globus_gfs_ipc_handle_get_contact_string(
2178  globus_gfs_ipc_handle_t ipc_handle,
2179  char ** contact_string);
2180 
2182 globus_gfs_ipc_init(
2183  globus_bool_t requester);
2184 
2185 /*
2186  *
2187  */
2188 void
2189 globus_gfs_ipc_add_server(
2190  globus_xio_server_t server_handle);
2191 
2192 extern globus_gfs_ipc_iface_t globus_gfs_ipc_default_iface;
2193 
2194 /* end IPC */
2195 
2196 /* ACL interface */
2197 
2198 /*
2199  * interface implementation functions
2200  * see the globus_gridftp_server_acl_example package at
2201  * gridftp/server/acl/example for an example implementation.
2202  */
2203 
2204 /* acl handle object. members are internal use only. */
2205 typedef struct globus_i_gfs_acl_handle_s * globus_gfs_acl_handle_t;
2206 
2207 /* supported actions, all authorization callouts will be of these types.
2208  * an authorization callout should return success for any actions that
2209  * are not interesting. */
2210 typedef enum globus_gfs_acl_action_e
2211 {
2212  /* internal use only */
2213  GFS_ACL_ACTION_INIT = 1,
2214  /* the named object. will be deleted. */
2215  GFS_ACL_ACTION_DELETE,
2216  /* write to an existing object */
2217  GFS_ACL_ACTION_WRITE,
2218  /* create and write to a non-existant object */
2219  GFS_ACL_ACTION_CREATE,
2220  /* read an object */
2221  GFS_ACL_ACTION_READ,
2222  /* query metadata of an object (i.e. list) */
2223  GFS_ACL_ACTION_LOOKUP,
2224  /* speficy an authorization assertion. client may submit data to
2225  * influence future authorization decisions. data is in an unspecified
2226  * format. */
2227  GFS_ACL_ACTION_AUTHZ_ASSERT,
2228  /* report data safely written to disk. failure means data written has
2229  * overrun acceptable limits. */
2230  GFS_ACL_ACTION_COMMIT,
2231  /* increase previously requested write limits for an object */
2232  GFS_ACL_ACTION_GROW
2233 } globus_gfs_acl_action_t;
2234 
2235 /* user connection descriptor. this provides info about the user
2236  * attempting the connection or action */
2237 typedef struct globus_gfs_acl_info_s
2238 {
2239  char * hostname;
2240  char * subject;
2241  char * username;
2242  char * password;
2243  char * ipaddr;
2244  gss_ctx_id_t context;
2245 } globus_gfs_acl_info_t;
2246 
2247 /* object descriptor. this provides various info about the object of the
2248  * action attempt. */
2249 typedef struct globus_gfs_acl_object_desc_s
2250 {
2251  /* ALL: name of the object. commonly a filename.
2252  * value is NULL when not known or not used. */
2253  char * name;
2254 
2255  /* WRITE/CREATE: size being requested to write.
2256  * COMMIT: amount of data already written safely.
2257  * GROW: new full size being requested to write.
2258  * value is 0 when not known or not used. */
2259  globus_off_t size;
2260 
2261  /* AUTHZ_ASSERT: assertion data from the client.
2262  * value is NULL when not known or not used. */
2263  char * data;
2264 
2265  /* COMMIT: all data has been safely written
2266  * value is FALSE when not known or not used. */
2267  globus_bool_t final;
2268 
2270  globus_gfs_op_info_t op_info;
2271 } globus_gfs_acl_object_desc_t;
2272 
2273 /* return values for authorization functions */
2274 typedef enum globus_gfs_acl_status_e
2275 {
2276  /* decision is complete */
2277  GLOBUS_GFS_ACL_COMPLETE = 1,
2278  /* decision will be made in a seperate call to
2279  globus_gfs_acl_authorized_finished() */
2280  GLOBUS_GFS_ACL_WOULD_BLOCK
2281 } globus_gfs_acl_status_t;
2282 
2283 /* initialization callout. this is ususally necessary. must be
2284  * implemented if:
2285  * 1) we need to set up some sort of internal state/handle that can be passed
2286  * back to us in all callouts
2287  * and/or
2288  * 2) we are interested in authorizing the gridftp session based on client
2289  * user information.
2290  *
2291  * must return GLOBUS_GFS_ACL_COMPLETE or GLOBUS_GFS_ACL_WOULD_BLOCK, and
2292  * store GLOBUS_SUCCESS or an error result_t in out_res. if returning
2293  * GLOBUS_GFS_ACL_WOULD_BLOCK, the result must be returned in a call to
2294  * globus_gfs_acl_authorized_finished(). optionally, a pointer may be stored
2295  * in out_handle. this pointer will then be passed back in later callouts.
2296  */
2297 typedef int
2298 (*globus_gfs_acl_init_t)(
2299  void ** out_handle,
2300  globus_gfs_acl_info_t * acl_info,
2301  globus_gfs_acl_handle_t acl_handle,
2302  globus_result_t * out_res);
2303 
2304 /* authorization callout. this is usually necessary. here we will
2305  * get called to authrorize all actions the client performs. see the
2306  * globus_gfs_acl_action_t declaration for all of the supported actions.
2307  *
2308  * must return GLOBUS_GFS_ACL_COMPLETE or GLOBUS_GFS_ACL_WOULD_BLOCK, and
2309  * store GLOBUS_SUCCESS or an error result_t in out_res. If returning
2310  * GLOBUS_GFS_ACL_WOULD_BLOCK, the result must be returned in a call to
2311  * globus_gfs_acl_authorized_finished().
2312  */
2313 typedef int
2314 (*globus_gfs_acl_authorize_t)(
2315  void * out_handle,
2316  globus_gfs_acl_action_t action,
2317  globus_gfs_acl_object_desc_t * object,
2318  globus_gfs_acl_info_t * acl_info,
2319  globus_gfs_acl_handle_t acl_handle,
2320  globus_result_t * out_res);
2321 
2322 /* destructor callout. clean up our session state if necessary */
2323 typedef void
2324 (*globus_gfs_acl_destroy_t)(
2325  void * out_handle);
2326 
2327 /* audit callout. informational callout only. implement this if you would
2328  * like to be notified of activities, but don't need to allow/deny them. */
2329 typedef void
2330 (*globus_gfs_acl_audit_t)(
2331  void * out_handle,
2332  globus_gfs_acl_action_t action,
2333  globus_gfs_acl_object_desc_t * object,
2334  const char * message);
2335 
2336 /* acl module descriptor.
2337  * Only define the functions you implement, otherwise NULL */
2338 typedef struct globus_gfs_acl_module_s
2339 {
2340  globus_gfs_acl_init_t init_func;
2341  globus_gfs_acl_authorize_t authorize_func;
2342  globus_gfs_acl_destroy_t destroy_func;
2343  globus_gfs_acl_audit_t audit_func;
2344 } globus_gfs_acl_module_t;
2345 
2346 /* authorization finalization function. this must be called when the
2347  * initialization or authorization callouts return GLOBUS_GFS_ACL_WOULD_BLOCK.
2348  */
2349 void
2350 globus_gfs_acl_authorized_finished(
2351  globus_gfs_acl_handle_t acl_handle,
2352  globus_result_t result);
2353 
2354 /* helper function to get strings from action types. useful for log/error
2355  * messages */
2356 const char *
2357 globus_gfs_acl_action_to_string(
2358  globus_gfs_acl_action_t action);
2359 
2360 
2361 /* end ACL */
2362 
2363 
2364 /* config locking functions */
2365 typedef
2366 void
2367 (*globus_i_gfs_config_set_string_cb_t)(
2368  const char * option_name,
2369  const char * val,
2370  void * user_arg);
2371 
2372 typedef
2373 void
2374 (*globus_i_gfs_config_set_int_cb_t)(
2375  const char * option_name,
2376  int val,
2377  void * user_arg);
2378 
2379 typedef struct
2380 {
2381  void * user_arg;
2382  globus_bool_t enabled;
2383  void * cb;
2384 } globus_i_gfs_config_option_cb_ent_t;
2385 
2386 void
2387 globus_gfs_config_enable_cb(
2388  globus_i_gfs_config_option_cb_ent_t * cb_handle,
2389  globus_bool_t enabled);
2390 
2391 int
2392 globus_gfs_config_add_cb(
2393  globus_i_gfs_config_option_cb_ent_t ** cb_handle,
2394  char * option_name,
2395  void * cb,
2396  void * user_arg);
2397 
2399 globus_gfs_config_get_bool(
2400  const char * option_name);
2401 
2402 char *
2403 globus_gfs_config_get_string(
2404  const char * option_name);
2405 
2406 globus_list_t *
2407 globus_gfs_config_get_list(
2408  const char * option_name);
2409 
2410 void *
2411 globus_gfs_config_get(
2412  const char * option_name);
2413 
2414 int
2415 globus_gfs_config_get_int(
2416  const char * option_name);
2417 
2418 int
2419 globus_gfs_config_set_int(
2420  char * option_name,
2421  int int_value);
2422 
2423 int
2424 globus_gfs_config_set_bool(
2425  char * option_name,
2426  int int_value);
2427 
2428 int
2429 globus_gfs_config_set_ptr(
2430  char * option_name,
2431  void * ptr);
2432 
2433 int
2434 globus_gfs_config_inc_int(
2435  char * option_name,
2436  int inc_val);
2437 
2438 #endif
Definition: globus_gridftp_server.h:196
globus_bool_t globus_gfs_error_match_response_error_code(globus_object_t *error, const char *response_error_code)
Definition: globus_i_gfs_ftp_response_error.c:326
Definition: globus_gridftp_server.h:202
Definition: globus_gridftp_server.h:167
void globus_gridftp_server_operation_finished(globus_gfs_operation_t op, globus_result_t result, globus_gfs_finished_info_t *finished_info)
Definition: globus_i_gfs_data.c:12898
Definition: globus_gridftp_server.h:170
globus_result_t globus_gridftp_server_set_checksum_support(globus_gfs_operation_t op, const char *cksm_str)
Definition: globus_i_gfs_data.c:13464
void(* globus_gfs_storage_init_t)(globus_gfs_operation_t op, globus_gfs_session_info_t *session_info)
Definition: globus_gridftp_server.h:643
int globus_bool_t
Boolean type.
Definition: globus_types.h:93
globus_object_t * globus_gfs_ftp_response_error_construct(globus_module_descriptor_t *base_source, globus_object_t *base_cause, int response_code, const char *response_error_code, const char *fmt,...)
Definition: globus_i_gfs_ftp_response_error.c:67
Definition: globus_gridftp_server.h:193
globus_object_t * globus_gfs_ftp_response_error_v_initialize(globus_object_t *error, globus_module_descriptor_t *base_source, globus_object_t *base_cause, int response_code, const char *response_error_code, const char *fmt, va_list ap)
Definition: globus_i_gfs_ftp_response_error.c:185
globus_gfs_op_info_param_t
Definition: globus_gridftp_server.h:1074
Definition: globus_gridftp_server.h:188
List data type.
Definition: globus_list.h:44
void(* globus_gridftp_server_write_cb_t)(globus_gfs_operation_t op, globus_result_t result, globus_byte_t *buffer, globus_size_t nbytes, void *user_arg)
Definition: globus_gridftp_server.h:961
Definition: globus_gridftp_server_control.h:209
Definition: globus_gridftp_server.h:174
size_t globus_size_t
Standard size of memory objectThe globus_size_t is the size of a memory object. It is identical to si...
Definition: globus_types.h:48
globus_gfs_event_type_e
Event types.
Definition: globus_gridftp_server.h:163
enum globus_gfs_event_type_e globus_gfs_event_type_t
Event types.
unsigned char globus_byte_t
Unsigned byte datatypeThis is used for byte-addressable arrays of arbitrary data which is not subject...
Definition: globus_types.h:85
Definition: globus_gridftp_server.h:183
Headers common to all of Globus.
globus_object_t * globus_gfs_ftp_response_error_initialize(globus_object_t *error, globus_module_descriptor_t *base_source, globus_object_t *base_cause, int response_code, const char *response_error_code, const char *fmt,...)
Definition: globus_i_gfs_ftp_response_error.c:132
uint32_t globus_result_t
Definition: globus_types.h:99
Definition: globus_gridftp_server.h:199
globus_object_t * globus_i_gfs_error_system(int ftp_code, int system_errno, const char *fmt,...)
Definition: globus_i_gfs_ftp_response_error.c:473
int globus_gfs_error_get_ftp_response_code(globus_object_t *error)
Definition: globus_i_gfs_ftp_response_error.c:261
Definition: globus_gridftp_server.h:178
const char * globus_gfs_error_get_ftp_response_error_code(globus_object_t *error)
Definition: globus_i_gfs_ftp_response_error.c:293
const globus_object_type_t GLOBUS_GFS_ERROR_FTP_RESPONSE_TYPE_DEFINITION
Definition: globus_i_gfs_ftp_response_error.c:618
Module Descriptor.
Definition: globus_module.h:71