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