Grid Community Toolkit  6.2.1550507116
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 
1055 typedef enum
1056 {
1057  /* return argv and argc for the current command. usually called when
1058  * handling custom commands.
1059  *
1060  * char *** argv,
1061  * int * argc
1062  */
1063  GLOBUS_GFS_OP_INFO_CMD_ARGS = 1
1065 
1066 /* query op_info for parameters
1067  * query parameters listed in the globus_gfs_op_info_param_t enum.
1068  * the varargs should be populated with variables of the correct type to hold
1069  * the returning parameters for the requested param type.
1070  *
1071 */
1073 globus_gridftp_server_query_op_info(
1074  globus_gfs_operation_t op,
1075  globus_gfs_op_info_t op_info,
1077  ...);
1078 
1079 /* check for attributes applicable to the current recv operation.
1080  * requested_attr is a case-insensitive string indicating the attribute
1081  * whose value will returned in out_value. requested_attr may be NULL, in
1082  * which case the full attr string will be returned in out_value.
1083  *
1084  * the format of the full attr string is attr1=value;attr2=value;...
1085  *
1086  * it is the caller's responsibility to free() out_value after a succesful return.
1087 */
1088 
1090 globus_gridftp_server_get_recv_attr_string(
1091  globus_gfs_operation_t op,
1092  const char * requested_attr,
1093  char ** out_value);
1094 
1095 /* get intended modification time for the file being received. out_time
1096  * will be the same as if a UTIME/MDTM command had been issued. if the modify
1097  * time has not been requested by the client, this will return GLOBUS_SUCCESS
1098  * but out_time will be -1.
1099  */
1100 
1102 globus_gridftp_server_get_recv_modification_time(
1103  globus_gfs_operation_t op,
1104  time_t * out_time);
1105 
1106 /*
1107  * update bytes written to storage
1108  *
1109  * This should be called during a recv(), after each successful write
1110  * to the storage system.
1111  *
1112  * Use EITHER globus_gridftp_server_update_bytes_written() OR
1113  * both globus_gridftp_server_update_bytes_recvd() and
1114  * globus_gridftp_server_update_range_recvd() for a given range.
1115  */
1116 void
1117 globus_gridftp_server_update_bytes_written(
1118  globus_gfs_operation_t op,
1119  globus_off_t offset,
1120  globus_off_t length);
1121 
1122 /*
1123  * update bytes recieved, but not yet written to storage
1124  * use this when there may be a delay between reciving data
1125  * and writing to storage. this will ensure accurate performance
1126  * markers, but will not cause range/restart markers to be sent.
1127  *
1128  * Use EITHER globus_gridftp_server_update_bytes_written() OR
1129  * both globus_gridftp_server_update_bytes_recvd() and
1130  * globus_gridftp_server_update_range_recvd() for a given range.
1131  */
1132 void
1133 globus_gridftp_server_update_bytes_recvd(
1134  globus_gfs_operation_t op,
1135  globus_off_t length);
1136 
1137 /*
1138  * update bytes written to storage
1139  * use this when there may be a delay between reciving data
1140  * and writing to storage. this will cause range/restart markers
1141  * to be sent.
1142  *
1143  * Use EITHER globus_gridftp_server_update_bytes_written() OR
1144  * both globus_gridftp_server_update_bytes_recvd() and
1145  * globus_gridftp_server_update_range_recvd() for a given range.
1146  */
1147 void
1148 globus_gridftp_server_update_range_recvd(
1149  globus_gfs_operation_t op,
1150  globus_off_t offset,
1151  globus_off_t length);
1152 
1153 /*
1154  * get concurrency
1155  *
1156  * This should be called during a recv() and send() in order to know the
1157  * number of pending reads or writes you should have at once.
1158  */
1159 void
1160 globus_gridftp_server_get_optimal_concurrency(
1161  globus_gfs_operation_t op,
1162  int * count);
1163 
1164 /*
1165  * get blocksize
1166  *
1167  * This should be called during a recv() and send() in order to know the
1168  * size of buffers that you should be passing to the server for reads and
1169  * writes.
1170  */
1171 void
1172 globus_gridftp_server_get_block_size(
1173  globus_gfs_operation_t op,
1174  globus_size_t * block_size);
1175 
1176 /*
1177  * get stripe blocksize
1178  *
1179  * This can be called during a recv() and send() in modules that wish to
1180  * deal with striping.
1181  */
1182 void
1183 globus_gridftp_server_get_stripe_block_size(
1184  globus_gfs_operation_t op,
1185  globus_size_t * stripe_block_size);
1186 
1187 /*
1188  * get session username
1189  *
1190  * This should can be called to get the username that the process is running
1191  * under, which may be different from the username supplied in the
1192  * session_start call in some cases.
1193  */
1194 void
1195 globus_gridftp_server_get_session_username(
1196  globus_gfs_operation_t op,
1197  char ** username);
1198 
1199 /*
1200  * get delegated cred
1201  *
1202  * This can can be called to get the delegated credential. This may be called
1203  * with any op after session_start() and and the credential pointer will be
1204  * valid until at least session_stop. del_cred will be NULL if it is not
1205  * available.
1206  */
1207 void
1208 globus_gridftp_server_get_delegated_cred(
1209  globus_gfs_operation_t op,
1210  gss_cred_id_t * del_cred);
1211 
1212 /*
1213  * get security context (unsupported)
1214  *
1215  * This can can be called to get the gssapi security context of the client
1216  * connection. This may be called with any op after session_start() and
1217  * the context pointer will be valid until at least session_stop. context
1218  * will be NULL if it is not available. This is needed for accessing proxy
1219  * extensions or other gssapi operations where the delegated credential is
1220  * not sufficient. The caller should not attempt operations that modify the
1221  * context without fully understanding the effects.
1222  */
1223 void
1224 globus_gridftp_server_get_sec_context(
1225  globus_gfs_operation_t op,
1226  gss_ctx_id_t * context);
1227 
1228 
1229 /*
1230  * get/set ordered data requirement
1231  *
1232  * The DSI must call this before globus_gridftp_server_begin_transfer()
1233  * to set the ordered_data flag. This will ensure that the offsets read
1234  * in each data callback are in order, even when multiple streams are used.
1235  * This will result in the transfer slowing down to match the speed of the
1236  * slowest stream. Note: in cases where the data source intentionally sends
1237  * data out of order, this will result in an aborted transfer. However,
1238  * a DSI that needs ordered data would probably fail in such a scenario anyway.
1239  *
1240  * Instead of calling these functions, you can enable this setting for all
1241  * transfers by setting GLOBUS_GFS_DSI_DESCRIPTOR_REQUIRES_ORDERED_DATA
1242  * in the globus_gfs_storage_iface_t interface definition.
1243  */
1244 void
1245 globus_gridftp_server_set_ordered_data(
1246  globus_gfs_operation_t op,
1247  globus_bool_t ordered_data);
1248 
1249 void
1250 globus_gridftp_server_get_ordered_data(
1251  globus_gfs_operation_t op,
1252  globus_bool_t * ordered_data);
1253 
1254 /*
1255  * get config string
1256  *
1257  * This can be called to get the dsi specific configuration string
1258  * that is defined in the global configuration.
1259  */
1260 void
1261 globus_gridftp_server_get_config_string(
1262  globus_gfs_operation_t op,
1263  char ** config_string);
1264 
1265 /*
1266  * get config data
1267  *
1268  * This can be called to get the configuration data managed by the server.
1269  * data_id can be NULL, or can be used to specify a specific set of data.
1270  * config_data will always return NULL.
1271  */
1272 void
1273 globus_gridftp_server_get_config_data(
1274  globus_gfs_operation_t op,
1275  char * data_id,
1276  char ** config_data);
1277 
1278 void
1279 globus_gfs_data_get_file_stack_list(
1280  globus_gfs_operation_t in_op,
1281  globus_list_t ** out_list);
1282 
1283 char *
1284 globus_gfs_data_get_cmd_string(
1285  globus_gfs_operation_t op);
1286 
1287 void
1288 globus_gridftp_server_get_update_interval(
1289  globus_gfs_operation_t op,
1290  int * interval);
1291 
1292 /*
1293  * get read_range
1294  *
1295  * This should be called during send() in order to know the specific
1296  * offset and length of the file to read from the storage system
1297  * You should continue calling this and transferring the speficied data
1298  * until it returns a length of 0.
1299  */
1300 void
1301 globus_gridftp_server_get_read_range(
1302  globus_gfs_operation_t op,
1303  globus_off_t * offset,
1304  globus_off_t * length);
1305 
1306 
1307 /*
1308  * get write_range
1309  *
1310  * This could be called during recv() in order to get hints on the specific
1311  * offset and length that the data will be expected to come from
1312  * globus_gridftp_server_register_read() callbacks. Note that this is
1313  * only a hint, and not necessarily the exact data ranges that will come.
1314  * You would continue calling this until it returns a length of 0.
1315  */
1316 void
1317 globus_gridftp_server_get_write_range(
1318  globus_gfs_operation_t op,
1319  globus_off_t * offset,
1320  globus_off_t * length);
1321 
1322 
1323 /* END Storage Interface API */
1324 
1325 typedef enum
1326 {
1327  GLOBUS_GFS_LOG_ERR = 0x01,
1328  GLOBUS_GFS_LOG_WARN = 0x02,
1329  GLOBUS_GFS_LOG_TRANSFER = 0x04,
1330  GLOBUS_GFS_LOG_INFO = 0x08,
1331  GLOBUS_GFS_LOG_DUMP = 0x10,
1332 
1333  GLOBUS_GFS_LOG_ALL = 0xFF
1334 } globus_gfs_log_type_t;
1335 
1336 void
1337 globus_gfs_log_message(
1338  globus_gfs_log_type_t type,
1339  const char * format,
1340  ...);
1341 
1342 void
1343 globus_gfs_log_result(
1344  globus_gfs_log_type_t type,
1345  const char * lead,
1346  globus_result_t result);
1347 
1349 enum
1350 {
1351  GLOBUS_GFS_DEBUG_TRACE = 8,
1352  GLOBUS_GFS_DEBUG_INFO = 16,
1353  GLOBUS_GFS_DEBUG_STATE = 32
1354 };
1355 
1356 #ifdef __GNUC__
1357 #define GlobusGFSName(func) static const char * _gfs_name __attribute__((__unused__)) = #func
1358 #else
1359 #define GlobusGFSName(func) static const char * _gfs_name = #func
1360 #endif
1361 
1362 GlobusDebugDeclare(GLOBUS_GRIDFTP_SERVER);
1363 
1364 #define GlobusGFSDebugPrintf(level, message) \
1365  GlobusDebugPrintf(GLOBUS_GRIDFTP_SERVER, level, message)
1366 
1367 #define GlobusGFSDebugInfo(_msg) \
1368  GlobusGFSDebugPrintf( \
1369  GLOBUS_GFS_DEBUG_INFO, \
1370  ("[%s] %s\n", __func__, _msg))
1371 
1372 #define GlobusGFSDebugEnter() \
1373  GlobusGFSDebugPrintf( \
1374  GLOBUS_GFS_DEBUG_TRACE, \
1375  ("[%s] Entering\n", __func__))
1376 
1377 #define GlobusGFSDebugExit() \
1378  GlobusGFSDebugPrintf( \
1379  GLOBUS_GFS_DEBUG_TRACE, \
1380  ("[%s] Exiting\n", __func__))
1381 
1382 #define GlobusGFSDebugState(_state) \
1383  GlobusGFSDebugPrintf( \
1384  GLOBUS_GFS_DEBUG_INFO, \
1385  ("[%s] State: %d\n", __func__, _state))
1386 
1387 #define GlobusGFSDebugExitWithError() \
1388  GlobusGFSDebugPrintf( \
1389  GLOBUS_GFS_DEBUG_TRACE, \
1390  ("[%s] Exiting with error\n", __func__))
1391 
1392 #define GlobusGFSErrorParameter(mem_name) \
1393  globus_error_put(GlobusGFSErrorObjParameter(mem_name))
1394 
1395 #define GlobusGFSErrorIPC() \
1396  globus_error_put(GlobusGFSErrorObjIPC())
1397 
1398 #define GlobusGFSErrorObjIPC() \
1399  globus_error_construct_error( \
1400  NULL, \
1401  NULL, \
1402  GLOBUS_GFS_ERROR_MEMORY, \
1403  __FILE__, \
1404  __func__, \
1405  __LINE__, \
1406  "IPC Communication error.")
1407 
1408 #define GlobusGFSErrorObjParameter(param_name) \
1409  globus_error_construct_error( \
1410  NULL, \
1411  NULL, \
1412  GLOBUS_GFS_ERROR_PARAMETER, \
1413  __FILE__, \
1414  __func__, \
1415  __LINE__, \
1416  "invalid parameter: %s", \
1417  (param_name))
1418 
1419 #define GlobusGFSErrorSystemError(system_func, system_errno) \
1420  globus_error_put(GlobusGFSErrorObjSystemError(\
1421  (system_func), (system_errno)))
1422 #define GlobusGFSErrorObjSystemError(system_func, system_errno) \
1423  globus_i_gfs_error_system( \
1424  0, (system_errno), \
1425  "System error%s%s", \
1426  (system_func) != NULL ? " in " : "", \
1427  (system_func) != NULL ? (system_func) : "")
1428 
1429 #define GlobusGFSErrorWrapFailed(failed_func, result) \
1430  globus_error_put(GlobusGFSErrorObjWrapFailed(failed_func, result))
1431 
1432 #define GlobusGFSErrorObjWrapFailed(failed_func, result) \
1433  globus_error_construct_error( \
1434  NULL, \
1435  globus_error_get((result)), \
1436  GLOBUS_GFS_ERROR_WRAPPED, \
1437  __FILE__, \
1438  __func__, \
1439  __LINE__, \
1440  "%s failed.", \
1441  (failed_func))
1442 
1443 #define GlobusGFSErrorData(reason) \
1444  globus_error_put(GlobusGFSErrorObjData(reason))
1445 
1446 #define GlobusGFSErrorObjData(reason) \
1447  globus_error_construct_error( \
1448  NULL, \
1449  NULL, \
1450  GLOBUS_GFS_ERROR_DATA, \
1451  __FILE__, \
1452  __func__, \
1453  __LINE__, \
1454  "%s", \
1455  (reason))
1456 
1457 #define GlobusGFSErrorGeneric(reason) \
1458  globus_error_put(GlobusGFSErrorObjGeneric(reason))
1459 
1460 #define GlobusGFSErrorObjGeneric(reason) \
1461  globus_error_construct_error( \
1462  NULL, \
1463  NULL, \
1464  GLOBUS_GFS_ERROR_GENERIC, \
1465  __FILE__, \
1466  __func__, \
1467  __LINE__, \
1468  "%s", \
1469  (reason))
1470 
1471 globus_object_t *
1473  globus_module_descriptor_t * base_source,
1474  globus_object_t * base_cause,
1475  int response_code,
1476  const char *response_error_code,
1477  const char *fmt,
1478  ...);
1479 
1480 globus_object_t *
1482  globus_object_t * error,
1483  globus_module_descriptor_t * base_source,
1484  globus_object_t * base_cause,
1485  int response_code,
1486  const char * response_error_code,
1487  const char * fmt,
1488  va_list ap);
1489 globus_object_t *
1491  globus_object_t * error,
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 int
1501  globus_object_t * error);
1502 
1503 const char *
1505  globus_object_t * error);
1506 
1509  globus_object_t * error,
1510  const char * response_error_code);
1511 
1512 extern const globus_object_type_t
1514 
1515 #define GLOBUS_GFS_ERROR_FTP_RESPONSE_TYPE \
1516  (&GLOBUS_GFS_ERROR_FTP_RESPONSE_TYPE_DEFINITION)
1517 
1518 
1519 #define GlobusGFSErrorFtpResponse(cause, code, response_error_code, ...) \
1520  globus_error_put(GlobusGFSErrorObjFtpResponse( \
1521  cause, code, response_error_code, __VA_ARGS__))
1522 
1523 #define GlobusGFSErrorObjFtpResponse(cause, code, response_error_code, ...) \
1524  globus_gfs_ftp_response_error_construct( \
1525  NULL, \
1526  cause, \
1527  code, \
1528  response_error_code, \
1529  __VA_ARGS__)
1530 
1531 globus_object_t *
1532 globus_i_gfs_error_system(int ftp_code, int system_errno, const char *fmt, ...);
1533 
1534 #define GlobusGFSErrorMemory(mem) \
1535  globus_error_put(GlobusGFSErrorObjMemory(mem))
1536 #define GlobusGFSErrorObjMemory(mem) \
1537  GlobusGFSErrorObjSystemError("malloc", errno)
1538 
1539 #define GlobusGFSErrorObj(cause, response_code, ...) \
1540  GlobusGFSErrorObjFtpResponse(cause, response_code, __VA_ARGS__)
1541 
1542 #define GlobusGFSErrorPathNotFound(p) \
1543  globus_error_put(GlobusGFSErrorObjPathNotFound(NULL, p))
1544 #define GlobusGFSErrorObjPathNotFound(cause, p) \
1545  GlobusGFSErrorObj((cause), 550, "PATH_NOT_FOUND", \
1546  "%s%s%s", \
1547  ((p) != NULL) ? "GridFTP-Path: \"" : "", \
1548  ((p) != NULL) ? (p) : "", \
1549  ((p) != NULL) ? "\"" : "")
1550 
1551 #define GlobusGFSErrorIncorrectChecksum(computed, expected) \
1552  globus_error_put(GlobusGFSErrorObjIncorrectChecksum( \
1553  NULL, computed, expected))
1554 #define GlobusGFSErrorObjIncorrectChecksum(cause, computed, expected) \
1555  GlobusGFSErrorObj( \
1556  (cause), \
1557  550, \
1558  "INCORRECT_CHECKSUM", \
1559  "GridFTP-Computed-Checksum: %s\n" \
1560  "GridFTP-Expected-Checksum: %s", (computed), (expected))
1561 
1562 #define GlobusGFSErrorMultipartUploadNotFound() \
1563  globus_error_put(GlobusGFSErrorObjMultipartUploadNotFound(NULL))
1564 #define GlobusGFSErrorObjMultipartUploadNotFound(cause) \
1565  GlobusGFSErrorObj(cause, 553, "MULTI_PART_UPLOAD_NOT_FOUND", NULL)
1566 
1567 #define GlobusGFSErrorAppendNotSupported() \
1568  globus_error_put(GlobusGFSErrorObjAppendNotSupported(NULL))
1569 #define GlobusGFSErrorObjAppendNotSupported(cause) \
1570  GlobusGFSErrorObj((cause), 553, "APPEND_NOT_SUPPORTED", NULL)
1571 
1572 #define GlobusGFSErrorAmbiguousPath(ambiguity) \
1573  globus_error_put(GlobusGFSErrorObjAmbiguousPath(NULL, ambiguity))
1574 #define GlobusGFSErrorObjAmbiguousPath(cause, ambiguity) \
1575  GlobusGFSErrorObj( \
1576  (cause), \
1577  553, \
1578  "AMBIGUOUS_PATH", \
1579  "GridFTP-Path: %s", \
1580  (ambiguity))
1581 
1582 #define GlobusGFSErrorTooBusy() \
1583  globus_error_put(GlobusGFSErrorObjTooBusy(NULL))
1584 #define GlobusGFSErrorObjTooBusy(cause) \
1585  GlobusGFSErrorObj((cause), 451, "TOO_BUSY", NULL)
1586 
1587 #define GlobusGFSErrorDataChannelAuthenticationFailure() \
1588  globus_error_put(GlobusGFSErrorObjDataChannelAuthenticationFailure( \
1589  NULL))
1590 #define GlobusGFSErrorObjDataChannelAuthenticationFailure(cause) \
1591  GlobusGFSErrorObj((cause), 425, \
1592  "DATA_CHANNEL_AUTHENTICATION_FAILURE", NULL)
1593 
1594 #define GlobusGFSErrorDataChannelCommunicationFailure() \
1595  globus_error_put(GlobusGFSErrorObjDataChannelCommunicationFailure( \
1596  NULL))
1597 #define GlobusGFSErrorObjDataChannelCommunicationFailure(cause) \
1598  GlobusGFSErrorObj((cause), 425, \
1599  "DATA_CHANNEL_COMMUNICATION_FAILURE", NULL)
1600 
1601 #define GlobusGFSErrorLoginDenied() \
1602  globus_error_put(GlobusGFSErrorObjLoginDenied(NULL))
1603 #define GlobusGFSErrorObjLoginDenied(cause) \
1604  GlobusGFSErrorObj((cause), 530, "LOGIN_DENIED", NULL)
1605 
1606 #define GlobusGFSErrorPermissionDenied() \
1607  globus_error_put(GlobusGFSErrorObjPermissionDenied(NULL))
1608 #define GlobusGFSErrorObjPermissionDenied(cause) \
1609  GlobusGFSErrorObj((cause), 550, "PERMISSION_DENIED", NULL)
1610 
1611 #define GlobusGFSErrorQuotaExceeded() \
1612  globus_error_put(GlobusGFSErrorObjQuotaExceeded(NULL))
1613 #define GlobusGFSErrorObjQuotaExceeded(cause) \
1614  GlobusGFSErrorObj((cause), 451, "QUOTA_EXCEEDED", NULL)
1615 
1616 #define GlobusGFSErrorNoSpaceLeft() \
1617  globus_error_put(GlobusGFSErrorObjNoSpaceLeft(NULL))
1618 #define GlobusGFSErrorObjNoSpaceLeft(cause) \
1619  GlobusGFSErrorObj((cause), 451, "NO_SPACE_LEFT", NULL)
1620 
1621 #define GlobusGFSErrorInvalidPathName(name) \
1622  globus_error_put(GlobusGFSErrorObjInvalidPathName(NULL, name))
1623 #define GlobusGFSErrorObjInvalidPathName(cause, name) \
1624  GlobusGFSErrorObj((cause), 553, "INVALID_PATH_NAME", \
1625  "GridFTP-Path: %s", name)
1626 
1627 #define GlobusGFSErrorPathExists(name) \
1628  globus_error_put(GlobusGFSErrorObjPathExists(NULL, name))
1629 #define GlobusGFSErrorObjPathExists(cause, name) \
1630  GlobusGFSErrorObj((cause), 553, "PATH_EXISTS", \
1631  "GridFTP-Path: %s", name)
1632 
1633 #define GlobusGFSErrorIsADirectory(name) \
1634  globus_error_put(GlobusGFSErrorObjIsADirectory(NULL, name))
1635 #define GlobusGFSErrorObjIsADirectory(cause, name) \
1636  GlobusGFSErrorObj((cause), 553, "IS_A_DIRECTORY", \
1637  "GridFTP-Path: %s", name)
1638 
1639 #define GlobusGFSErrorNotADirectory(name) \
1640  globus_error_put(GlobusGFSErrorObjNotADirectory(NULL, name))
1641 #define GlobusGFSErrorObjNotADirectory(cause, name) \
1642  GlobusGFSErrorObj((cause), 553, "NOT_A_DIRECTORY", \
1643  "GridFTP-Path: %s", name)
1644 
1645 #define GlobusGFSErrorCRLError() \
1646  globus_error_put(GlobusGFSErrorObjCRLError(NULL))
1647 #define GlobusGFSErrorObjCRLError(cause) \
1648  GlobusGFSErrorObj((cause), 530, "CRL_ERROR", NULL)
1649 
1650 #define GlobusGFSErrorInternalError(generic_string) \
1651  globus_error_put(GlobusGFSErrorObjInternalError( \
1652  NULL, (generic_string)))
1653 #define GlobusGFSErrorObjInternalError(cause, generic_string) \
1654  GlobusGFSErrorObj((cause), 500, "INTERNAL_ERROR", \
1655  "%s%s", \
1656  ((generic_string) != NULL) ? "GridFTP-Error: " : "", \
1657  ((generic_string) != NULL) ? generic_string : "")
1658 
1659 #define GlobusGFSErrorNotImplemented() \
1660  globus_error_put(GlobusGFSErrorObjNotImplemented(NULL))
1661 #define GlobusGFSErrorObjNotImplemented(cause) \
1662  GlobusGFSErrorObj((cause), 500, "NOT_IMPLEMETED", NULL)
1663 
1664 #define GlobusGFSErrorNotImplementedFeature(feature) \
1665  globus_error_put(GlobusGFSErrorObjNotImplementedFeature(NULL, feature))
1666 #define GlobusGFSErrorObjNotImplementedFeature(cause, feature) \
1667  GlobusGFSErrorObj((cause), 500, \
1668  "NOT_IMPLEMETED", "GridFTP-Feature: %s", (feature))
1669 
1670 #define GlobusGFSErrorConfigurationError() \
1671  globus_error_put(GlobusGFSErrorObjConfigurationError(NULL))
1672 #define GlobusGFSErrorObjConfigurationError(cause) \
1673  GlobusGFSErrorObj((cause), 500, "CONFIGURATION_ERROR", NULL)
1674 /*
1675  *
1676  * IPC
1677  *
1678  */
1679 
1680 typedef struct globus_i_gfs_ipc_handle_s * globus_gfs_ipc_handle_t;
1681 
1682 /*
1683  * callbacks
1684  *
1685  * all functions have the same callback, they examine the
1686  * globus_gfs_finished_info_t() structure for their specific info
1687  *
1688  * error_cb
1689  * can be called at anytime. typically means the ipc connection broke
1690  * in an irrecoverable way. Even tho this is called all outstanding
1691  * callbacks will still be called (but with an error)
1692  */
1693 
1694  /*
1695  * replying
1696  *
1697  * every comman requires a reply and comes with a reply id. to reply
1698  * the requested side must fill in the globus_gfs_finished_info_t
1699  * structure and then pass it
1700  * to the function: globus_gfs_ipc_reply(); That call will result in
1701  * the ipc communication that will untilimately call the callback
1702  * on the callers side.
1703  */
1704 typedef void
1705 (*globus_gfs_ipc_callback_t)(
1706  globus_gfs_ipc_handle_t ipc_handle,
1707  globus_result_t result,
1708  globus_gfs_finished_info_t * reply,
1709  void * user_arg);
1710 
1711 typedef void
1712 (*globus_gfs_ipc_event_callback_t)(
1713  globus_gfs_ipc_handle_t ipc_handle,
1714  globus_result_t result,
1715  globus_gfs_event_info_t * reply,
1716  void * user_arg);
1717 
1718 typedef void
1719 (*globus_gfs_ipc_close_callback_t)(
1720  globus_gfs_ipc_handle_t ipc_handle,
1721  globus_result_t result,
1722  void * user_arg);
1723 
1724 typedef void
1725 (*globus_gfs_ipc_open_callback_t)(
1726  globus_gfs_ipc_handle_t ipc_handle,
1727  globus_result_t result,
1728  globus_gfs_finished_info_t * reply,
1729  void * user_arg);
1730 
1731 typedef void
1732 (*globus_gfs_ipc_error_callback_t)(
1733  globus_gfs_ipc_handle_t ipc_handle,
1734  globus_result_t result,
1735  void * user_arg);
1736 
1738 globus_gfs_ipc_reply_finished(
1739  globus_gfs_ipc_handle_t ipc_handle,
1740  globus_gfs_finished_info_t * reply);
1741 
1743 globus_gfs_ipc_reply_event(
1744  globus_gfs_ipc_handle_t ipc_handle,
1745  globus_gfs_event_info_t * reply);
1746 
1748 globus_gfs_ipc_reply_session(
1749  globus_gfs_ipc_handle_t ipc_handle,
1750  globus_gfs_finished_info_t * reply);
1751 
1752 /*
1753  * sending
1754  *
1755  * every command has a corresponding iface function. A call to a
1756  * command function results in a call to the correspoding iface
1757  * function on the other side of the channel.
1758  *
1759  * all parmeters are wrapped in a structure corresponding to
1760  * each function call type. those structures are defined below
1761  */
1762 
1763 typedef void
1764 (*globus_i_gfs_ipc_data_callback_t)(
1765  globus_gfs_finished_info_t * reply,
1766  void * user_arg);
1767 
1768 typedef void
1769 (*globus_i_gfs_ipc_data_event_callback_t)(
1770  globus_gfs_event_info_t * reply,
1771  void * user_arg);
1772 
1773 typedef void
1774 (*globus_i_gfs_ipc_done_callback_t)(
1775  void * user_arg,
1776  globus_result_t result);
1777 
1778 /*************************************************************************
1779  * interface function
1780  * ------------------
1781  *
1782  ************************************************************************/
1783 /* works with handle get */
1784 typedef void
1785 (*globus_gfs_ipc_iface_session_start_t)(
1786  globus_gfs_ipc_handle_t ipc_handle,
1787  const gss_ctx_id_t context,
1788  globus_gfs_session_info_t * session_info,
1789  globus_i_gfs_ipc_data_callback_t cb,
1790  void * user_arg);
1791 
1793 globus_gfs_ipc_start_session(
1794  globus_gfs_ipc_handle_t ipc_handle,
1795  globus_gfs_session_info_t * session_info,
1796  globus_gfs_ipc_callback_t cb,
1797  void * user_arg);
1798 
1799 /* works with release */
1800 typedef void
1801 (*globus_gfs_ipc_iface_session_stop_t)(
1802  globus_gfs_ipc_handle_t ipc_handle,
1803  void * session_handle);
1804 
1806 globus_gfs_ipc_iface_session_stop(
1807  globus_gfs_ipc_handle_t ipc_handle,
1808  void * session_handle);
1809 
1810 typedef void
1811 (*globus_gfs_ipc_iface_set_cred_t)(
1812  globus_gfs_ipc_handle_t ipc_handle,
1813  void * session_handle,
1814  gss_cred_id_t del_cred);
1815 
1817 globus_gfs_ipc_set_cred(
1818  globus_gfs_ipc_handle_t ipc_handle,
1819  gss_cred_id_t del_cred);
1820 
1821 typedef void
1822 (*globus_gfs_ipc_iface_buffer_send_t)(
1823  globus_gfs_ipc_handle_t ipc_handle,
1824  void * session_handle,
1825  globus_byte_t * buffer,
1826  int buffer_type,
1827  globus_size_t buffer_len);
1828 
1830 globus_gfs_ipc_request_buffer_send(
1831  globus_gfs_ipc_handle_t ipc_handle,
1832  globus_byte_t * buffer,
1833  int buffer_type,
1834  globus_size_t buffer_len);
1835 
1836 /*
1837  * receive
1838  *
1839  * tell the remote process to receive a file
1840  */
1841 typedef void
1842 (*globus_gfs_ipc_iface_recv_t)(
1843  globus_gfs_ipc_handle_t ipc_handle,
1844  void * session_handle,
1845  int id,
1846  globus_gfs_transfer_info_t * recv_info,
1847  globus_i_gfs_ipc_data_callback_t cb,
1848  globus_i_gfs_ipc_data_event_callback_t event_cb,
1849  void * user_arg);
1850 
1852 globus_gfs_ipc_request_recv(
1853  globus_gfs_ipc_handle_t ipc_handle,
1854  globus_gfs_transfer_info_t * recv_info,
1855  globus_gfs_ipc_callback_t cb,
1856  globus_gfs_ipc_event_callback_t event_cb,
1857  void * user_arg);
1858 
1859 /*
1860  * send
1861  *
1862  * tell remote process to send a file
1863  */
1864 typedef void
1865 (*globus_gfs_ipc_iface_send_t)(
1866  globus_gfs_ipc_handle_t ipc_handle,
1867  void * session_handle,
1868  int id,
1869  globus_gfs_transfer_info_t * send_info,
1870  globus_i_gfs_ipc_data_callback_t cb,
1871  globus_i_gfs_ipc_data_event_callback_t event_cb,
1872  void * user_arg);
1873 
1875 globus_gfs_ipc_request_send(
1876  globus_gfs_ipc_handle_t ipc_handle,
1877  globus_gfs_transfer_info_t * send_info,
1878  globus_gfs_ipc_callback_t cb,
1879  globus_gfs_ipc_event_callback_t event_cb,
1880  void * user_arg);
1881 
1882 typedef void
1883 (*globus_gfs_ipc_iface_list_t)(
1884  globus_gfs_ipc_handle_t ipc_handle,
1885  void * session_handle,
1886  int id,
1887  globus_gfs_transfer_info_t * list_info,
1888  globus_i_gfs_ipc_data_callback_t cb,
1889  globus_i_gfs_ipc_data_event_callback_t event_cb,
1890  void * user_arg);
1891 
1893 globus_gfs_ipc_request_list(
1894  globus_gfs_ipc_handle_t ipc_handle,
1895  globus_gfs_transfer_info_t * data_info,
1896  globus_gfs_ipc_callback_t cb,
1897  globus_gfs_ipc_event_callback_t event_cb,
1898  void * user_arg);
1899 
1900 /*
1901  * command
1902  *
1903  * tell remote side to execute the given command
1904  */
1905 typedef void
1906 (*globus_gfs_ipc_iface_command_t)(
1907  globus_gfs_ipc_handle_t ipc_handle,
1908  void * session_handle,
1909  int id,
1910  globus_gfs_command_info_t * cmd_info,
1911  globus_i_gfs_ipc_data_callback_t cb,
1912  void * user_arg);
1913 
1915 globus_gfs_ipc_request_command(
1916  globus_gfs_ipc_handle_t ipc_handle,
1917  globus_gfs_command_info_t * cmd_info,
1918  globus_gfs_ipc_callback_t cb,
1919  void * user_arg);
1920 
1921 /*
1922  * active data
1923  *
1924  * tell remote side to create an active data connection
1925  */
1926 typedef void
1927 (*globus_gfs_ipc_iface_active_data_t)(
1928  globus_gfs_ipc_handle_t ipc_handle,
1929  void * session_handle,
1930  int id,
1931  globus_gfs_data_info_t * data_info,
1932  globus_i_gfs_ipc_data_callback_t cb,
1933  void * user_arg);
1934 
1936 globus_gfs_ipc_request_active_data(
1937  globus_gfs_ipc_handle_t ipc_handle,
1938  globus_gfs_data_info_t * data_info,
1939  globus_gfs_ipc_callback_t cb,
1940  void * user_arg);
1941 
1942 /*
1943  * passive data
1944  *
1945  * tell remote side to do passive data connection
1946  */
1947 typedef void
1948 (*globus_gfs_ipc_iface_passive_data_t)(
1949  globus_gfs_ipc_handle_t ipc_handle,
1950  void * session_handle,
1951  int id,
1952  globus_gfs_data_info_t * data_info,
1953  globus_i_gfs_ipc_data_callback_t cb,
1954  void * user_arg);
1955 
1957 globus_gfs_ipc_request_passive_data(
1958  globus_gfs_ipc_handle_t ipc_handle,
1959  globus_gfs_data_info_t * data_info,
1960  globus_gfs_ipc_callback_t cb,
1961  void * user_arg);
1962 
1963 /*
1964  * send stat request
1965  */
1966 typedef void
1967 (*globus_gfs_ipc_iface_stat_t)(
1968  globus_gfs_ipc_handle_t ipc_handle,
1969  void * session_handle,
1970  int id,
1971  globus_gfs_stat_info_t * stat_info,
1972  globus_i_gfs_ipc_data_callback_t cb,
1973  void * user_arg);
1974 
1976 globus_gfs_ipc_request_stat(
1977  globus_gfs_ipc_handle_t ipc_handle,
1978  globus_gfs_stat_info_t * stat_info,
1979  globus_gfs_ipc_callback_t cb,
1980  void * user_arg);
1981 
1982 /*
1983  * poke transfer event request
1984  */
1985 typedef void
1986 (*globus_gfs_ipc_iface_transfer_event_t)(
1987  globus_gfs_ipc_handle_t ipc_handle,
1988  void * session_handle,
1989  globus_gfs_event_info_t * event_info);
1990 
1991 
1993 globus_gfs_ipc_request_transfer_event(
1994  globus_gfs_ipc_handle_t ipc_handle,
1995  globus_gfs_event_info_t * event_info);
1996 
1997 
1998 /*
1999  * destroy a data connection associated with the given ID
2000  */
2001 typedef void
2002 (*globus_gfs_ipc_iface_data_destroy_t)(
2003  globus_gfs_ipc_handle_t ipc_handle,
2004  void * session_handle,
2005  void * data_arg);
2006 
2008 globus_gfs_ipc_request_data_destroy(
2009  globus_gfs_ipc_handle_t ipc_handle,
2010  void * data_arg);
2011 
2012 typedef struct globus_i_gfs_ipc_iface_s
2013 {
2014  globus_gfs_ipc_iface_session_start_t session_start_func;
2015  globus_gfs_ipc_iface_session_stop_t session_stop_func;
2016  globus_gfs_ipc_iface_recv_t recv_func;
2017  globus_gfs_ipc_iface_send_t send_func;
2018  globus_gfs_ipc_iface_command_t command_func;
2019  globus_gfs_ipc_iface_active_data_t active_func;
2020  globus_gfs_ipc_iface_passive_data_t passive_func;
2021  globus_gfs_ipc_iface_data_destroy_t data_destroy_func;
2022  globus_gfs_ipc_iface_stat_t stat_func;
2023  globus_gfs_ipc_iface_list_t list_func;
2024  globus_gfs_ipc_iface_transfer_event_t transfer_event_func;
2025  globus_gfs_ipc_iface_set_cred_t set_cred;
2026  globus_gfs_ipc_iface_buffer_send_t buffer_send;
2027 } globus_gfs_ipc_iface_t;
2028 
2029 /*
2030  * getting an IPC handle
2031  */
2032 
2033 /*
2034  * create an IPC handle from a xio system handle, can be used
2035  * imediately, is not in handle table
2036  */
2038 globus_gfs_ipc_handle_create(
2039  globus_gfs_ipc_iface_t * iface,
2040  globus_xio_system_socket_t system_handle,
2041  globus_i_gfs_ipc_done_callback_t done_cb,
2042  void * user_arg);
2043 
2044 /*
2045  * actually close the handle
2046  */
2048 globus_gfs_ipc_close(
2049  globus_gfs_ipc_handle_t ipc_handle,
2050  globus_gfs_ipc_close_callback_t cb,
2051  void * user_arg);
2052 
2054 globus_gfs_ipc_reply_close(
2055  globus_gfs_ipc_handle_t ipc_handle);
2056 
2058 globus_gfs_ipc_session_stop(
2059  globus_gfs_ipc_handle_t ipc_handle);
2060 
2062 globus_gfs_ipc_handle_connect(
2063  globus_gfs_session_info_t * session_info,
2064  globus_gfs_ipc_open_callback_t cb,
2065  void * user_arg,
2066  globus_gfs_ipc_error_callback_t error_cb,
2067  void * error_user_arg);
2068 
2070 globus_gfs_ipc_handle_connect_ex(
2071  globus_gfs_session_info_t * session_info,
2072  globus_gfs_ipc_open_callback_t cb,
2073  void * user_arg,
2074  globus_gfs_ipc_error_callback_t error_cb,
2075  void * error_user_arg,
2076  globus_bool_t secure_ipc,
2077  gss_cred_id_t cred,
2078  const char *auth_mode,
2079  const char *subject,
2080  time_t connect_timeout,
2081  time_t idle_timeout,
2082  globus_bool_t inetd);
2083 
2085 globus_gfs_ipc_handle_obtain(
2086  globus_gfs_session_info_t * session_info,
2087  globus_gfs_ipc_iface_t * iface,
2088  globus_gfs_ipc_open_callback_t cb,
2089  void * user_arg,
2090  globus_gfs_ipc_error_callback_t error_cb,
2091  void * error_user_arg);
2092 
2093 /*
2094  * the brain bit
2095  */
2096 #define BRAIN_SYMBOL_NAME (void*)"gridftp_brain"
2097 extern globus_extension_registry_t brain_i_registry;
2098 
2099 typedef globus_result_t
2100 (*globus_i_gfs_brain_select_nodes_func_t)(
2101  globus_i_gfs_brain_node_t *** out_node_array,
2102  int * out_array_length,
2103  const char * repo_name,
2104  globus_off_t filesize,
2105  int min_count,
2106  int max_count);
2107 
2108 typedef globus_result_t
2109 (*globus_i_gfs_brain_release_node_func_t)(
2110  globus_i_gfs_brain_node_t * contact_node,
2111  globus_gfs_brain_reason_t reason);
2112 
2113 typedef globus_result_t
2114 (*globus_i_gfs_brain_init_func_t)();
2115 
2116 typedef void
2117 (*globus_i_gfs_brain_stop_func_t)();
2118 
2119 typedef globus_result_t
2120 (*globus_i_gfs_brain_get_available_func_t)(
2121  const char * user_id,
2122  const char * repo_name,
2123  int * count);
2124 
2125 
2126 typedef struct globus_i_gfs_brain_module_s
2127 {
2128  globus_i_gfs_brain_init_func_t init_func;
2129  globus_i_gfs_brain_stop_func_t stop_func;
2130  globus_i_gfs_brain_select_nodes_func_t select_func;
2131  globus_i_gfs_brain_release_node_func_t release_func;
2132  globus_i_gfs_brain_get_available_func_t available_func;
2133 } globus_i_gfs_brain_module_t;
2134 
2135 extern globus_i_gfs_brain_module_t globus_i_gfs_default_brain;
2136 
2138 globus_gfs_brain_select_nodes(
2139  globus_i_gfs_brain_node_t *** out_node_array,
2140  int * out_array_length,
2141  const char * repo_name,
2142  globus_off_t filesize,
2143  int min_count,
2144  int max_count);
2145 
2147 globus_gfs_brain_release_node(
2148  globus_i_gfs_brain_node_t * contact_node,
2149  globus_gfs_brain_reason_t reason);
2150 
2152 globus_gfs_brain_get_available(
2153  const char * user_id,
2154  const char * repo_name,
2155  int * count);
2156 
2158 globus_gfs_ipc_handle_get_contact_string(
2159  globus_gfs_ipc_handle_t ipc_handle,
2160  char ** contact_string);
2161 
2163 globus_gfs_ipc_init(
2164  globus_bool_t requester);
2165 
2166 /*
2167  *
2168  */
2169 void
2170 globus_gfs_ipc_add_server(
2171  globus_xio_server_t server_handle);
2172 
2173 extern globus_gfs_ipc_iface_t globus_gfs_ipc_default_iface;
2174 
2175 /* end IPC */
2176 
2177 /* ACL interface */
2178 
2179 /*
2180  * interface implementation functions
2181  * see the globus_gridftp_server_acl_example package at
2182  * gridftp/server/acl/example for an example implementation.
2183  */
2184 
2185 /* acl handle object. members are internal use only. */
2186 typedef struct globus_i_gfs_acl_handle_s * globus_gfs_acl_handle_t;
2187 
2188 /* supported actions, all authorization callouts will be of these types.
2189  * an authorization callout should return success for any actions that
2190  * are not interesting. */
2191 typedef enum globus_gfs_acl_action_e
2192 {
2193  /* internal use only */
2194  GFS_ACL_ACTION_INIT = 1,
2195  /* the named object. will be deleted. */
2196  GFS_ACL_ACTION_DELETE,
2197  /* write to an existing object */
2198  GFS_ACL_ACTION_WRITE,
2199  /* create and write to a non-existant object */
2200  GFS_ACL_ACTION_CREATE,
2201  /* read an object */
2202  GFS_ACL_ACTION_READ,
2203  /* query metadata of an object (i.e. list) */
2204  GFS_ACL_ACTION_LOOKUP,
2205  /* speficy an authorization assertion. client may submit data to
2206  * influence future authorization decisions. data is in an unspecified
2207  * format. */
2208  GFS_ACL_ACTION_AUTHZ_ASSERT,
2209  /* report data safely written to disk. failure means data written has
2210  * overrun acceptable limits. */
2211  GFS_ACL_ACTION_COMMIT,
2212  /* increase previously requested write limits for an object */
2213  GFS_ACL_ACTION_GROW
2214 } globus_gfs_acl_action_t;
2215 
2216 /* user connection descriptor. this provides info about the user
2217  * attempting the connection or action */
2218 typedef struct globus_gfs_acl_info_s
2219 {
2220  char * hostname;
2221  char * subject;
2222  char * username;
2223  char * password;
2224  char * ipaddr;
2225  gss_ctx_id_t context;
2226 } globus_gfs_acl_info_t;
2227 
2228 /* object descriptor. this provides various info about the object of the
2229  * action attempt. */
2230 typedef struct globus_gfs_acl_object_desc_s
2231 {
2232  /* ALL: name of the object. commonly a filename.
2233  * value is NULL when not known or not used. */
2234  char * name;
2235 
2236  /* WRITE/CREATE: size being requested to write.
2237  * COMMIT: amount of data already written safely.
2238  * GROW: new full size being requested to write.
2239  * value is 0 when not known or not used. */
2240  globus_off_t size;
2241 
2242  /* AUTHZ_ASSERT: assertion data from the client.
2243  * value is NULL when not known or not used. */
2244  char * data;
2245 
2246  /* COMMIT: all data has been safely written
2247  * value is FALSE when not known or not used. */
2248  globus_bool_t final;
2249 
2251  globus_gfs_op_info_t op_info;
2252 } globus_gfs_acl_object_desc_t;
2253 
2254 /* return values for authorization functions */
2255 typedef enum globus_gfs_acl_status_e
2256 {
2257  /* decision is complete */
2258  GLOBUS_GFS_ACL_COMPLETE = 1,
2259  /* decision will be made in a seperate call to
2260  globus_gfs_acl_authorized_finished() */
2261  GLOBUS_GFS_ACL_WOULD_BLOCK
2262 } globus_gfs_acl_status_t;
2263 
2264 /* initialization callout. this is ususally necessary. must be
2265  * implemented if:
2266  * 1) we need to set up some sort of internal state/handle that can be passed
2267  * back to us in all callouts
2268  * and/or
2269  * 2) we are interested in authorizing the gridftp session based on client
2270  * user information.
2271  *
2272  * must return GLOBUS_GFS_ACL_COMPLETE or GLOBUS_GFS_ACL_WOULD_BLOCK, and
2273  * store GLOBUS_SUCCESS or an error result_t in out_res. if returning
2274  * GLOBUS_GFS_ACL_WOULD_BLOCK, the result must be returned in a call to
2275  * globus_gfs_acl_authorized_finished(). optionally, a pointer may be stored
2276  * in out_handle. this pointer will then be passed back in later callouts.
2277  */
2278 typedef int
2279 (*globus_gfs_acl_init_t)(
2280  void ** out_handle,
2281  globus_gfs_acl_info_t * acl_info,
2282  globus_gfs_acl_handle_t acl_handle,
2283  globus_result_t * out_res);
2284 
2285 /* authorization callout. this is usually necessary. here we will
2286  * get called to authrorize all actions the client performs. see the
2287  * globus_gfs_acl_action_t declaration for all of the supported actions.
2288  *
2289  * must return GLOBUS_GFS_ACL_COMPLETE or GLOBUS_GFS_ACL_WOULD_BLOCK, and
2290  * store GLOBUS_SUCCESS or an error result_t in out_res. If returning
2291  * GLOBUS_GFS_ACL_WOULD_BLOCK, the result must be returned in a call to
2292  * globus_gfs_acl_authorized_finished().
2293  */
2294 typedef int
2295 (*globus_gfs_acl_authorize_t)(
2296  void * out_handle,
2297  globus_gfs_acl_action_t action,
2298  globus_gfs_acl_object_desc_t * object,
2299  globus_gfs_acl_info_t * acl_info,
2300  globus_gfs_acl_handle_t acl_handle,
2301  globus_result_t * out_res);
2302 
2303 /* destructor callout. clean up our session state if necessary */
2304 typedef void
2305 (*globus_gfs_acl_destroy_t)(
2306  void * out_handle);
2307 
2308 /* audit callout. informational callout only. implement this if you would
2309  * like to be notified of activities, but don't need to allow/deny them. */
2310 typedef void
2311 (*globus_gfs_acl_audit_t)(
2312  void * out_handle,
2313  globus_gfs_acl_action_t action,
2314  globus_gfs_acl_object_desc_t * object,
2315  const char * message);
2316 
2317 /* acl module descriptor.
2318  * Only define the functions you implement, otherwise NULL */
2319 typedef struct globus_gfs_acl_module_s
2320 {
2321  globus_gfs_acl_init_t init_func;
2322  globus_gfs_acl_authorize_t authorize_func;
2323  globus_gfs_acl_destroy_t destroy_func;
2324  globus_gfs_acl_audit_t audit_func;
2325 } globus_gfs_acl_module_t;
2326 
2327 /* authorization finalization function. this must be called when the
2328  * initialization or authorization callouts return GLOBUS_GFS_ACL_WOULD_BLOCK.
2329  */
2330 void
2331 globus_gfs_acl_authorized_finished(
2332  globus_gfs_acl_handle_t acl_handle,
2333  globus_result_t result);
2334 
2335 /* helper function to get strings from action types. useful for log/error
2336  * messages */
2337 const char *
2338 globus_gfs_acl_action_to_string(
2339  globus_gfs_acl_action_t action);
2340 
2341 
2342 /* end ACL */
2343 
2344 
2345 /* config locking functions */
2346 typedef
2347 void
2348 (*globus_i_gfs_config_set_string_cb_t)(
2349  const char * option_name,
2350  const char * val,
2351  void * user_arg);
2352 
2353 typedef
2354 void
2355 (*globus_i_gfs_config_set_int_cb_t)(
2356  const char * option_name,
2357  int val,
2358  void * user_arg);
2359 
2360 typedef struct
2361 {
2362  void * user_arg;
2363  globus_bool_t enabled;
2364  void * cb;
2365 } globus_i_gfs_config_option_cb_ent_t;
2366 
2367 void
2368 globus_gfs_config_enable_cb(
2369  globus_i_gfs_config_option_cb_ent_t * cb_handle,
2370  globus_bool_t enabled);
2371 
2372 int
2373 globus_gfs_config_add_cb(
2374  globus_i_gfs_config_option_cb_ent_t ** cb_handle,
2375  char * option_name,
2376  void * cb,
2377  void * user_arg);
2378 
2380 globus_gfs_config_get_bool(
2381  const char * option_name);
2382 
2383 char *
2384 globus_gfs_config_get_string(
2385  const char * option_name);
2386 
2387 globus_list_t *
2388 globus_gfs_config_get_list(
2389  const char * option_name);
2390 
2391 void *
2392 globus_gfs_config_get(
2393  const char * option_name);
2394 
2395 int
2396 globus_gfs_config_get_int(
2397  const char * option_name);
2398 
2399 int
2400 globus_gfs_config_set_int(
2401  char * option_name,
2402  int int_value);
2403 
2404 int
2405 globus_gfs_config_set_bool(
2406  char * option_name,
2407  int int_value);
2408 
2409 int
2410 globus_gfs_config_set_ptr(
2411  char * option_name,
2412  void * ptr);
2413 
2414 int
2415 globus_gfs_config_inc_int(
2416  char * option_name,
2417  int inc_val);
2418 
2419 #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:12801
Definition: globus_gridftp_server.h:170
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:1055
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
void(* globus_gfs_storage_init_t)(globus_gfs_operation_t op, globus_gfs_session_info_t *session_info)
Definition: globus_gridftp_server.h:643
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