globus_connect_gridftp_server  15.79
/build/globus-connect-gridftp-server-15.79/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  */
240 typedef globus_gridftp_server_control_stat_t globus_gfs_stat_t;
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 
957 globus_result_t
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 
986 globus_result_t
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 
1029 globus_result_t
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 
1054 globus_result_t
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 */
1080 globus_result_t
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 
1097 globus_result_t
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 
1109 globus_result_t
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 Transfer task ID
1297  *
1298  * Returns the Transfer task ID associated with the current GridFTP session.
1299  * If a task id is not known, return NULL instead.
1300  */
1301 void
1302 globus_gridftp_server_get_task_id(
1303  globus_gfs_operation_t op,
1304  char ** task_id);
1305 
1306 /*
1307  * get read_range
1308  *
1309  * This should be called during send() in order to know the specific
1310  * offset and length of the file to read from the storage system
1311  * You should continue calling this and transferring the speficied data
1312  * until it returns a length of 0.
1313  */
1314 void
1315 globus_gridftp_server_get_read_range(
1316  globus_gfs_operation_t op,
1317  globus_off_t * offset,
1318  globus_off_t * length);
1319 
1320 
1321 /*
1322  * get write_range
1323  *
1324  * This could be called during recv() in order to get hints on the specific
1325  * offset and length that the data will be expected to come from
1326  * globus_gridftp_server_register_read() callbacks. Note that this is
1327  * only a hint, and not necessarily the exact data ranges that will come.
1328  * You would continue calling this until it returns a length of 0.
1329  */
1330 void
1331 globus_gridftp_server_get_write_range(
1332  globus_gfs_operation_t op,
1333  globus_off_t * offset,
1334  globus_off_t * length);
1335 
1336 
1337 /* END Storage Interface API */
1338 
1339 typedef enum
1340 {
1341  GLOBUS_GFS_LOG_ERR = 0x01,
1342  GLOBUS_GFS_LOG_WARN = 0x02,
1343  GLOBUS_GFS_LOG_TRANSFER = 0x04,
1344  GLOBUS_GFS_LOG_INFO = 0x08,
1345  GLOBUS_GFS_LOG_DUMP = 0x10,
1346  GLOBUS_GFS_LOG_ALL = 0xFF,
1347  GLOBUS_GFS_LOG_AUDIT = 0x100
1348 } globus_gfs_log_type_t;
1349 
1350 void
1351 globus_gfs_log_message(
1352  globus_gfs_log_type_t type,
1353  const char * format,
1354  ...);
1355 
1356 void
1357 globus_gfs_log_result(
1358  globus_gfs_log_type_t type,
1359  const char * lead,
1360  globus_result_t result);
1361 
1363 enum
1364 {
1365  GLOBUS_GFS_DEBUG_TRACE = 8,
1366  GLOBUS_GFS_DEBUG_INFO = 16,
1367  GLOBUS_GFS_DEBUG_STATE = 32
1368 };
1369 
1370 #ifdef __GNUC__
1371 #define GlobusGFSName(func) static const char * _gfs_name __attribute__((__unused__)) = #func
1372 #else
1373 #define GlobusGFSName(func) static const char * _gfs_name = #func
1374 #endif
1375 
1376 GlobusDebugDeclare(GLOBUS_GRIDFTP_SERVER);
1377 
1378 #define GlobusGFSDebugPrintf(level, message) \
1379  GlobusDebugPrintf(GLOBUS_GRIDFTP_SERVER, level, message)
1380 
1381 #define GlobusGFSDebugInfo(_msg) \
1382  GlobusGFSDebugPrintf( \
1383  GLOBUS_GFS_DEBUG_INFO, \
1384  ("[%s] %s\n", __func__, _msg))
1385 
1386 #define GlobusGFSDebugEnter() \
1387  GlobusGFSDebugPrintf( \
1388  GLOBUS_GFS_DEBUG_TRACE, \
1389  ("[%s] Entering\n", __func__))
1390 
1391 #define GlobusGFSDebugExitResult(res) \
1392  GlobusGFSDebugPrintf( \
1393  GLOBUS_GFS_DEBUG_TRACE, \
1394  ("[%s] Exiting%s\n", \
1395  __func__, \
1396  (res != GLOBUS_SUCCESS) ? " with error" : ""))
1397 
1398 #define GlobusGFSDebugExit() \
1399  GlobusGFSDebugPrintf( \
1400  GLOBUS_GFS_DEBUG_TRACE, \
1401  ("[%s] Exiting\n", __func__))
1402 
1403 #define GlobusGFSDebugState(_state) \
1404  GlobusGFSDebugPrintf( \
1405  GLOBUS_GFS_DEBUG_INFO, \
1406  ("[%s] State: %d\n", __func__, _state))
1407 
1408 #define GlobusGFSDebugExitWithError() \
1409  GlobusGFSDebugPrintf( \
1410  GLOBUS_GFS_DEBUG_TRACE, \
1411  ("[%s] Exiting with error\n", __func__))
1412 
1413 #define GlobusGFSErrorParameter(mem_name) \
1414  globus_error_put(GlobusGFSErrorObjParameter(mem_name))
1415 
1416 #define GlobusGFSErrorIPC() \
1417  globus_error_put(GlobusGFSErrorObjIPC())
1418 
1419 #define GlobusGFSErrorObjIPC() \
1420  globus_error_construct_error( \
1421  NULL, \
1422  NULL, \
1423  GLOBUS_GFS_ERROR_MEMORY, \
1424  __FILE__, \
1425  __func__, \
1426  __LINE__, \
1427  "IPC Communication error.")
1428 
1429 #define GlobusGFSErrorObjParameter(param_name) \
1430  globus_error_construct_error( \
1431  NULL, \
1432  NULL, \
1433  GLOBUS_GFS_ERROR_PARAMETER, \
1434  __FILE__, \
1435  __func__, \
1436  __LINE__, \
1437  "invalid parameter: %s", \
1438  (param_name))
1439 
1440 #define GlobusGFSErrorSystemError(system_func, system_errno) \
1441  globus_error_put(GlobusGFSErrorObjSystemError(\
1442  (system_func), (system_errno)))
1443 #define GlobusGFSErrorObjSystemError(system_func, system_errno) \
1444  globus_i_gfs_error_system( \
1445  0, (system_errno), \
1446  "System error%s%s", \
1447  (system_func) != NULL ? " in " : "", \
1448  (system_func) != NULL ? (system_func) : "")
1449 
1450 #define GlobusGFSErrorWrapFailed(failed_func, result) \
1451  globus_error_put(GlobusGFSErrorObjWrapFailed(failed_func, result))
1452 
1453 #define GlobusGFSErrorObjWrapFailed(failed_func, result) \
1454  globus_error_construct_error( \
1455  NULL, \
1456  globus_error_get((result)), \
1457  GLOBUS_GFS_ERROR_WRAPPED, \
1458  __FILE__, \
1459  __func__, \
1460  __LINE__, \
1461  "%s failed.", \
1462  (failed_func))
1463 
1464 #define GlobusGFSErrorData(reason) \
1465  globus_error_put(GlobusGFSErrorObjData(reason))
1466 
1467 #define GlobusGFSErrorObjData(reason) \
1468  globus_error_construct_error( \
1469  NULL, \
1470  NULL, \
1471  GLOBUS_GFS_ERROR_DATA, \
1472  __FILE__, \
1473  __func__, \
1474  __LINE__, \
1475  "%s", \
1476  (reason))
1477 
1478 #define GlobusGFSErrorGeneric(reason) \
1479  globus_error_put(GlobusGFSErrorObjGeneric(reason))
1480 
1481 #define GlobusGFSErrorObjGeneric(reason) \
1482  globus_error_construct_error( \
1483  NULL, \
1484  NULL, \
1485  GLOBUS_GFS_ERROR_GENERIC, \
1486  __FILE__, \
1487  __func__, \
1488  __LINE__, \
1489  "%s", \
1490  (reason))
1491 
1492 globus_object_t *
1494  globus_module_descriptor_t * base_source,
1495  globus_object_t * base_cause,
1496  int response_code,
1497  const char *response_error_code,
1498  const char *fmt,
1499  ...);
1500 
1501 globus_object_t *
1503  globus_object_t * error,
1504  globus_module_descriptor_t * base_source,
1505  globus_object_t * base_cause,
1506  int response_code,
1507  const char * response_error_code,
1508  const char * fmt,
1509  va_list ap);
1510 globus_object_t *
1512  globus_object_t * error,
1513  globus_module_descriptor_t * base_source,
1514  globus_object_t * base_cause,
1515  int response_code,
1516  const char * response_error_code,
1517  const char * fmt,
1518  ...);
1519 
1520 int
1522  globus_object_t * error);
1523 
1524 const char *
1526  globus_object_t * error);
1527 
1528 globus_bool_t
1530  globus_object_t * error,
1531  const char * response_error_code);
1532 
1533 extern const globus_object_type_t
1535 
1536 #define GLOBUS_GFS_ERROR_FTP_RESPONSE_TYPE \
1537  (&GLOBUS_GFS_ERROR_FTP_RESPONSE_TYPE_DEFINITION)
1538 
1539 
1540 #define GlobusGFSErrorFtpResponse(cause, code, response_error_code, ...) \
1541  globus_error_put(GlobusGFSErrorObjFtpResponse( \
1542  cause, code, response_error_code, __VA_ARGS__))
1543 
1544 #define GlobusGFSErrorObjFtpResponse(cause, code, response_error_code, ...) \
1545  globus_gfs_ftp_response_error_construct( \
1546  NULL, \
1547  cause, \
1548  code, \
1549  response_error_code, \
1550  __VA_ARGS__)
1551 
1552 globus_object_t *
1553 globus_i_gfs_error_system(int ftp_code, int system_errno, const char *fmt, ...);
1554 
1555 #define GlobusGFSErrorMemory(mem) \
1556  globus_error_put(GlobusGFSErrorObjMemory(mem))
1557 #define GlobusGFSErrorObjMemory(mem) \
1558  GlobusGFSErrorObjSystemError("malloc", errno)
1559 
1560 #define GlobusGFSErrorObj(cause, response_code, ...) \
1561  GlobusGFSErrorObjFtpResponse(cause, response_code, __VA_ARGS__)
1562 
1563 #define GlobusGFSErrorPathNotFound(p) \
1564  globus_error_put(GlobusGFSErrorObjPathNotFound(NULL, p))
1565 #define GlobusGFSErrorObjPathNotFound(cause, p) \
1566  GlobusGFSErrorObj((cause), 550, "PATH_NOT_FOUND", \
1567  "%s%s%s", \
1568  ((p) != NULL) ? "GridFTP-Path: \"" : "", \
1569  ((p) != NULL) ? (p) : "", \
1570  ((p) != NULL) ? "\"" : "")
1571 
1572 #define GlobusGFSErrorIncorrectChecksum(computed, expected) \
1573  globus_error_put(GlobusGFSErrorObjIncorrectChecksum( \
1574  NULL, computed, expected))
1575 #define GlobusGFSErrorObjIncorrectChecksum(cause, computed, expected) \
1576  GlobusGFSErrorObj( \
1577  (cause), \
1578  550, \
1579  "INCORRECT_CHECKSUM", \
1580  "GridFTP-Computed-Checksum: %s\n" \
1581  "GridFTP-Expected-Checksum: %s", (computed), (expected))
1582 
1583 #define GlobusGFSErrorMultipartUploadNotFound() \
1584  globus_error_put(GlobusGFSErrorObjMultipartUploadNotFound(NULL))
1585 #define GlobusGFSErrorObjMultipartUploadNotFound(cause) \
1586  GlobusGFSErrorObj(cause, 553, "MULTI_PART_UPLOAD_NOT_FOUND", NULL)
1587 
1588 #define GlobusGFSErrorAppendNotSupported() \
1589  globus_error_put(GlobusGFSErrorObjAppendNotSupported(NULL))
1590 #define GlobusGFSErrorObjAppendNotSupported(cause) \
1591  GlobusGFSErrorObj((cause), 553, "APPEND_NOT_SUPPORTED", NULL)
1592 
1593 #define GlobusGFSErrorAmbiguousPath(ambiguity) \
1594  globus_error_put(GlobusGFSErrorObjAmbiguousPath(NULL, ambiguity))
1595 #define GlobusGFSErrorObjAmbiguousPath(cause, ambiguity) \
1596  GlobusGFSErrorObj( \
1597  (cause), \
1598  553, \
1599  "AMBIGUOUS_PATH", \
1600  "GridFTP-Path: %s", \
1601  (ambiguity))
1602 
1603 #define GlobusGFSErrorTooBusy() \
1604  globus_error_put(GlobusGFSErrorObjTooBusy(NULL))
1605 #define GlobusGFSErrorObjTooBusy(cause) \
1606  GlobusGFSErrorObj((cause), 451, "TOO_BUSY", NULL)
1607 
1608 #define GlobusGFSErrorDataChannelAuthenticationFailure() \
1609  globus_error_put(GlobusGFSErrorObjDataChannelAuthenticationFailure( \
1610  NULL))
1611 #define GlobusGFSErrorObjDataChannelAuthenticationFailure(cause) \
1612  GlobusGFSErrorObj((cause), 425, \
1613  "DATA_CHANNEL_AUTHENTICATION_FAILURE", NULL)
1614 
1615 #define GlobusGFSErrorDataChannelCommunicationFailure() \
1616  globus_error_put(GlobusGFSErrorObjDataChannelCommunicationFailure( \
1617  NULL))
1618 #define GlobusGFSErrorObjDataChannelCommunicationFailure(cause) \
1619  GlobusGFSErrorObj((cause), 425, \
1620  "DATA_CHANNEL_COMMUNICATION_FAILURE", NULL)
1621 
1622 #define GlobusGFSErrorLoginDenied() \
1623  globus_error_put(GlobusGFSErrorObjLoginDenied(NULL))
1624 #define GlobusGFSErrorObjLoginDenied(cause) \
1625  GlobusGFSErrorObj((cause), 530, "LOGIN_DENIED", NULL)
1626 
1627 #define GlobusGFSErrorLoginDeniedJSON(message, json) \
1628  globus_error_put(GlobusGFSErrorObjLoginDeniedJSON(NULL, message, json))
1629 #define GlobusGFSErrorObjLoginDeniedJSON(cause, message, json) \
1630  GlobusGFSErrorObj((cause), 530, "LOGIN_DENIED", \
1631  "GridFTP-Message: %s\n" \
1632  "GridFTP-JSON-Result: %s", \
1633  (message) ? (message) : "Message not available", (json))
1634 
1635 #define GlobusGFSErrorPermissionDenied() \
1636  globus_error_put(GlobusGFSErrorObjPermissionDenied(NULL))
1637 #define GlobusGFSErrorObjPermissionDenied(cause) \
1638  GlobusGFSErrorObj((cause), 550, "PERMISSION_DENIED", NULL)
1639 
1640 #define GlobusGFSErrorQuotaExceeded() \
1641  globus_error_put(GlobusGFSErrorObjQuotaExceeded(NULL))
1642 #define GlobusGFSErrorObjQuotaExceeded(cause) \
1643  GlobusGFSErrorObj((cause), 451, "QUOTA_EXCEEDED", NULL)
1644 
1645 #define GlobusGFSErrorNoSpaceLeft() \
1646  globus_error_put(GlobusGFSErrorObjNoSpaceLeft(NULL))
1647 #define GlobusGFSErrorObjNoSpaceLeft(cause) \
1648  GlobusGFSErrorObj((cause), 451, "NO_SPACE_LEFT", NULL)
1649 
1650 #define GlobusGFSErrorInvalidPathName(name) \
1651  globus_error_put(GlobusGFSErrorObjInvalidPathName(NULL, name))
1652 #define GlobusGFSErrorObjInvalidPathName(cause, name) \
1653  GlobusGFSErrorObj((cause), 553, "INVALID_PATH_NAME", \
1654  "GridFTP-Path: %s", name)
1655 
1656 #define GlobusGFSErrorPathExists(name) \
1657  globus_error_put(GlobusGFSErrorObjPathExists(NULL, name))
1658 #define GlobusGFSErrorObjPathExists(cause, name) \
1659  GlobusGFSErrorObj((cause), 553, "PATH_EXISTS", \
1660  "GridFTP-Path: %s", name)
1661 
1662 #define GlobusGFSErrorIsADirectory(name) \
1663  globus_error_put(GlobusGFSErrorObjIsADirectory(NULL, name))
1664 #define GlobusGFSErrorObjIsADirectory(cause, name) \
1665  GlobusGFSErrorObj((cause), 553, "IS_A_DIRECTORY", \
1666  "GridFTP-Path: %s", name)
1667 
1668 #define GlobusGFSErrorNotADirectory(name) \
1669  globus_error_put(GlobusGFSErrorObjNotADirectory(NULL, name))
1670 #define GlobusGFSErrorObjNotADirectory(cause, name) \
1671  GlobusGFSErrorObj((cause), 553, "NOT_A_DIRECTORY", \
1672  "GridFTP-Path: %s", name)
1673 
1674 #define GlobusGFSErrorCRLError() \
1675  globus_error_put(GlobusGFSErrorObjCRLError(NULL))
1676 #define GlobusGFSErrorObjCRLError(cause) \
1677  GlobusGFSErrorObj((cause), 530, "CRL_ERROR", NULL)
1678 
1679 #define GlobusGFSErrorInternalError(generic_string) \
1680  globus_error_put(GlobusGFSErrorObjInternalError( \
1681  NULL, (generic_string)))
1682 #define GlobusGFSErrorObjInternalError(cause, generic_string) \
1683  GlobusGFSErrorObj((cause), 500, "INTERNAL_ERROR", \
1684  "%s%s", \
1685  ((generic_string) != NULL) ? "GridFTP-Error: " : "", \
1686  ((generic_string) != NULL) ? generic_string : "")
1687 
1688 #define GlobusGFSErrorNotImplemented() \
1689  globus_error_put(GlobusGFSErrorObjNotImplemented(NULL))
1690 #define GlobusGFSErrorObjNotImplemented(cause) \
1691  GlobusGFSErrorObj((cause), 500, "NOT_IMPLEMETED", NULL)
1692 
1693 #define GlobusGFSErrorNotImplementedFeature(feature) \
1694  globus_error_put(GlobusGFSErrorObjNotImplementedFeature(NULL, feature))
1695 #define GlobusGFSErrorObjNotImplementedFeature(cause, feature) \
1696  GlobusGFSErrorObj((cause), 500, \
1697  "NOT_IMPLEMETED", "GridFTP-Feature: %s", (feature))
1698 
1699 #define GlobusGFSErrorConfigurationError() \
1700  globus_error_put(GlobusGFSErrorObjConfigurationError(NULL))
1701 #define GlobusGFSErrorObjConfigurationError(cause) \
1702  GlobusGFSErrorObj((cause), 500, "CONFIGURATION_ERROR", NULL)
1703 /*
1704  *
1705  * IPC
1706  *
1707  */
1708 
1709 typedef struct globus_i_gfs_ipc_handle_s * globus_gfs_ipc_handle_t;
1710 
1711 /*
1712  * callbacks
1713  *
1714  * all functions have the same callback, they examine the
1715  * globus_gfs_finished_info_t() structure for their specific info
1716  *
1717  * error_cb
1718  * can be called at anytime. typically means the ipc connection broke
1719  * in an irrecoverable way. Even tho this is called all outstanding
1720  * callbacks will still be called (but with an error)
1721  */
1722 
1723  /*
1724  * replying
1725  *
1726  * every comman requires a reply and comes with a reply id. to reply
1727  * the requested side must fill in the globus_gfs_finished_info_t
1728  * structure and then pass it
1729  * to the function: globus_gfs_ipc_reply(); That call will result in
1730  * the ipc communication that will untilimately call the callback
1731  * on the callers side.
1732  */
1733 typedef void
1734 (*globus_gfs_ipc_callback_t)(
1735  globus_gfs_ipc_handle_t ipc_handle,
1736  globus_result_t result,
1737  globus_gfs_finished_info_t * reply,
1738  void * user_arg);
1739 
1740 typedef void
1741 (*globus_gfs_ipc_event_callback_t)(
1742  globus_gfs_ipc_handle_t ipc_handle,
1743  globus_result_t result,
1744  globus_gfs_event_info_t * reply,
1745  void * user_arg);
1746 
1747 typedef void
1748 (*globus_gfs_ipc_close_callback_t)(
1749  globus_gfs_ipc_handle_t ipc_handle,
1750  globus_result_t result,
1751  void * user_arg);
1752 
1753 typedef void
1754 (*globus_gfs_ipc_open_callback_t)(
1755  globus_gfs_ipc_handle_t ipc_handle,
1756  globus_result_t result,
1757  globus_gfs_finished_info_t * reply,
1758  void * user_arg);
1759 
1760 typedef void
1761 (*globus_gfs_ipc_error_callback_t)(
1762  globus_gfs_ipc_handle_t ipc_handle,
1763  globus_result_t result,
1764  void * user_arg);
1765 
1766 globus_result_t
1767 globus_gfs_ipc_reply_finished(
1768  globus_gfs_ipc_handle_t ipc_handle,
1769  globus_gfs_finished_info_t * reply);
1770 
1771 globus_result_t
1772 globus_gfs_ipc_reply_event(
1773  globus_gfs_ipc_handle_t ipc_handle,
1774  globus_gfs_event_info_t * reply);
1775 
1776 globus_result_t
1777 globus_gfs_ipc_reply_session(
1778  globus_gfs_ipc_handle_t ipc_handle,
1779  globus_gfs_finished_info_t * reply);
1780 
1781 /*
1782  * sending
1783  *
1784  * every command has a corresponding iface function. A call to a
1785  * command function results in a call to the correspoding iface
1786  * function on the other side of the channel.
1787  *
1788  * all parmeters are wrapped in a structure corresponding to
1789  * each function call type. those structures are defined below
1790  */
1791 
1792 typedef void
1793 (*globus_i_gfs_ipc_data_callback_t)(
1794  globus_gfs_finished_info_t * reply,
1795  void * user_arg);
1796 
1797 typedef void
1798 (*globus_i_gfs_ipc_data_event_callback_t)(
1799  globus_gfs_event_info_t * reply,
1800  void * user_arg);
1801 
1802 typedef void
1803 (*globus_i_gfs_ipc_done_callback_t)(
1804  void * user_arg,
1805  globus_result_t result);
1806 
1807 /*************************************************************************
1808  * interface function
1809  * ------------------
1810  *
1811  ************************************************************************/
1812 /* works with handle get */
1813 typedef void
1814 (*globus_gfs_ipc_iface_session_start_t)(
1815  globus_gfs_ipc_handle_t ipc_handle,
1816  const gss_ctx_id_t context,
1817  globus_gfs_session_info_t * session_info,
1818  globus_i_gfs_ipc_data_callback_t cb,
1819  void * user_arg);
1820 
1821 globus_result_t
1822 globus_gfs_ipc_start_session(
1823  globus_gfs_ipc_handle_t ipc_handle,
1824  globus_gfs_session_info_t * session_info,
1825  globus_gfs_ipc_callback_t cb,
1826  void * user_arg);
1827 
1828 /* works with release */
1829 typedef void
1830 (*globus_gfs_ipc_iface_session_stop_t)(
1831  globus_gfs_ipc_handle_t ipc_handle,
1832  void * session_handle);
1833 
1834 globus_result_t
1835 globus_gfs_ipc_iface_session_stop(
1836  globus_gfs_ipc_handle_t ipc_handle,
1837  void * session_handle);
1838 
1839 typedef void
1840 (*globus_gfs_ipc_iface_set_cred_t)(
1841  globus_gfs_ipc_handle_t ipc_handle,
1842  void * session_handle,
1843  gss_cred_id_t del_cred);
1844 
1845 globus_result_t
1846 globus_gfs_ipc_set_cred(
1847  globus_gfs_ipc_handle_t ipc_handle,
1848  gss_cred_id_t del_cred);
1849 
1850 typedef void
1851 (*globus_gfs_ipc_iface_buffer_send_t)(
1852  globus_gfs_ipc_handle_t ipc_handle,
1853  void * session_handle,
1854  globus_byte_t * buffer,
1855  int buffer_type,
1856  globus_size_t buffer_len);
1857 
1858 globus_result_t
1859 globus_gfs_ipc_request_buffer_send(
1860  globus_gfs_ipc_handle_t ipc_handle,
1861  globus_byte_t * buffer,
1862  int buffer_type,
1863  globus_size_t buffer_len);
1864 
1865 /*
1866  * receive
1867  *
1868  * tell the remote process to receive a file
1869  */
1870 typedef void
1871 (*globus_gfs_ipc_iface_recv_t)(
1872  globus_gfs_ipc_handle_t ipc_handle,
1873  void * session_handle,
1874  int id,
1875  globus_gfs_transfer_info_t * recv_info,
1876  globus_i_gfs_ipc_data_callback_t cb,
1877  globus_i_gfs_ipc_data_event_callback_t event_cb,
1878  void * user_arg);
1879 
1880 globus_result_t
1881 globus_gfs_ipc_request_recv(
1882  globus_gfs_ipc_handle_t ipc_handle,
1883  globus_gfs_transfer_info_t * recv_info,
1884  globus_gfs_ipc_callback_t cb,
1885  globus_gfs_ipc_event_callback_t event_cb,
1886  void * user_arg);
1887 
1888 /*
1889  * send
1890  *
1891  * tell remote process to send a file
1892  */
1893 typedef void
1894 (*globus_gfs_ipc_iface_send_t)(
1895  globus_gfs_ipc_handle_t ipc_handle,
1896  void * session_handle,
1897  int id,
1898  globus_gfs_transfer_info_t * send_info,
1899  globus_i_gfs_ipc_data_callback_t cb,
1900  globus_i_gfs_ipc_data_event_callback_t event_cb,
1901  void * user_arg);
1902 
1903 globus_result_t
1904 globus_gfs_ipc_request_send(
1905  globus_gfs_ipc_handle_t ipc_handle,
1906  globus_gfs_transfer_info_t * send_info,
1907  globus_gfs_ipc_callback_t cb,
1908  globus_gfs_ipc_event_callback_t event_cb,
1909  void * user_arg);
1910 
1911 typedef void
1912 (*globus_gfs_ipc_iface_list_t)(
1913  globus_gfs_ipc_handle_t ipc_handle,
1914  void * session_handle,
1915  int id,
1916  globus_gfs_transfer_info_t * list_info,
1917  globus_i_gfs_ipc_data_callback_t cb,
1918  globus_i_gfs_ipc_data_event_callback_t event_cb,
1919  void * user_arg);
1920 
1921 globus_result_t
1922 globus_gfs_ipc_request_list(
1923  globus_gfs_ipc_handle_t ipc_handle,
1924  globus_gfs_transfer_info_t * data_info,
1925  globus_gfs_ipc_callback_t cb,
1926  globus_gfs_ipc_event_callback_t event_cb,
1927  void * user_arg);
1928 
1929 /*
1930  * command
1931  *
1932  * tell remote side to execute the given command
1933  */
1934 typedef void
1935 (*globus_gfs_ipc_iface_command_t)(
1936  globus_gfs_ipc_handle_t ipc_handle,
1937  void * session_handle,
1938  int id,
1939  globus_gfs_command_info_t * cmd_info,
1940  globus_i_gfs_ipc_data_callback_t cb,
1941  void * user_arg);
1942 
1943 globus_result_t
1944 globus_gfs_ipc_request_command(
1945  globus_gfs_ipc_handle_t ipc_handle,
1946  globus_gfs_command_info_t * cmd_info,
1947  globus_gfs_ipc_callback_t cb,
1948  void * user_arg);
1949 
1950 /*
1951  * active data
1952  *
1953  * tell remote side to create an active data connection
1954  */
1955 typedef void
1956 (*globus_gfs_ipc_iface_active_data_t)(
1957  globus_gfs_ipc_handle_t ipc_handle,
1958  void * session_handle,
1959  int id,
1960  globus_gfs_data_info_t * data_info,
1961  globus_i_gfs_ipc_data_callback_t cb,
1962  void * user_arg);
1963 
1964 globus_result_t
1965 globus_gfs_ipc_request_active_data(
1966  globus_gfs_ipc_handle_t ipc_handle,
1967  globus_gfs_data_info_t * data_info,
1968  globus_gfs_ipc_callback_t cb,
1969  void * user_arg);
1970 
1971 /*
1972  * passive data
1973  *
1974  * tell remote side to do passive data connection
1975  */
1976 typedef void
1977 (*globus_gfs_ipc_iface_passive_data_t)(
1978  globus_gfs_ipc_handle_t ipc_handle,
1979  void * session_handle,
1980  int id,
1981  globus_gfs_data_info_t * data_info,
1982  globus_i_gfs_ipc_data_callback_t cb,
1983  void * user_arg);
1984 
1985 globus_result_t
1986 globus_gfs_ipc_request_passive_data(
1987  globus_gfs_ipc_handle_t ipc_handle,
1988  globus_gfs_data_info_t * data_info,
1989  globus_gfs_ipc_callback_t cb,
1990  void * user_arg);
1991 
1992 /*
1993  * send stat request
1994  */
1995 typedef void
1996 (*globus_gfs_ipc_iface_stat_t)(
1997  globus_gfs_ipc_handle_t ipc_handle,
1998  void * session_handle,
1999  int id,
2000  globus_gfs_stat_info_t * stat_info,
2001  globus_i_gfs_ipc_data_callback_t cb,
2002  void * user_arg);
2003 
2004 globus_result_t
2005 globus_gfs_ipc_request_stat(
2006  globus_gfs_ipc_handle_t ipc_handle,
2007  globus_gfs_stat_info_t * stat_info,
2008  globus_gfs_ipc_callback_t cb,
2009  void * user_arg);
2010 
2011 /*
2012  * poke transfer event request
2013  */
2014 typedef void
2015 (*globus_gfs_ipc_iface_transfer_event_t)(
2016  globus_gfs_ipc_handle_t ipc_handle,
2017  void * session_handle,
2018  globus_gfs_event_info_t * event_info);
2019 
2020 
2021 globus_result_t
2022 globus_gfs_ipc_request_transfer_event(
2023  globus_gfs_ipc_handle_t ipc_handle,
2024  globus_gfs_event_info_t * event_info);
2025 
2026 
2027 /*
2028  * destroy a data connection associated with the given ID
2029  */
2030 typedef void
2031 (*globus_gfs_ipc_iface_data_destroy_t)(
2032  globus_gfs_ipc_handle_t ipc_handle,
2033  void * session_handle,
2034  void * data_arg);
2035 
2036 globus_result_t
2037 globus_gfs_ipc_request_data_destroy(
2038  globus_gfs_ipc_handle_t ipc_handle,
2039  void * data_arg);
2040 
2041 typedef struct globus_i_gfs_ipc_iface_s
2042 {
2043  globus_gfs_ipc_iface_session_start_t session_start_func;
2044  globus_gfs_ipc_iface_session_stop_t session_stop_func;
2045  globus_gfs_ipc_iface_recv_t recv_func;
2046  globus_gfs_ipc_iface_send_t send_func;
2047  globus_gfs_ipc_iface_command_t command_func;
2048  globus_gfs_ipc_iface_active_data_t active_func;
2049  globus_gfs_ipc_iface_passive_data_t passive_func;
2050  globus_gfs_ipc_iface_data_destroy_t data_destroy_func;
2051  globus_gfs_ipc_iface_stat_t stat_func;
2052  globus_gfs_ipc_iface_list_t list_func;
2053  globus_gfs_ipc_iface_transfer_event_t transfer_event_func;
2054  globus_gfs_ipc_iface_set_cred_t set_cred;
2055  globus_gfs_ipc_iface_buffer_send_t buffer_send;
2056 } globus_gfs_ipc_iface_t;
2057 
2058 /*
2059  * getting an IPC handle
2060  */
2061 
2062 /*
2063  * create an IPC handle from a xio system handle, can be used
2064  * imediately, is not in handle table
2065  */
2066 globus_result_t
2067 globus_gfs_ipc_handle_create(
2068  globus_gfs_ipc_iface_t * iface,
2069  globus_xio_system_socket_t system_handle,
2070  globus_i_gfs_ipc_done_callback_t done_cb,
2071  void * user_arg);
2072 
2073 /*
2074  * actually close the handle
2075  */
2076 globus_result_t
2077 globus_gfs_ipc_close(
2078  globus_gfs_ipc_handle_t ipc_handle,
2079  globus_gfs_ipc_close_callback_t cb,
2080  void * user_arg);
2081 
2082 globus_result_t
2083 globus_gfs_ipc_reply_close(
2084  globus_gfs_ipc_handle_t ipc_handle);
2085 
2086 globus_result_t
2087 globus_gfs_ipc_session_stop(
2088  globus_gfs_ipc_handle_t ipc_handle);
2089 
2090 globus_result_t
2091 globus_gfs_ipc_handle_connect(
2092  globus_gfs_session_info_t * session_info,
2093  globus_gfs_ipc_open_callback_t cb,
2094  void * user_arg,
2095  globus_gfs_ipc_error_callback_t error_cb,
2096  void * error_user_arg);
2097 
2098 globus_result_t
2099 globus_gfs_ipc_handle_connect_ex(
2100  globus_gfs_session_info_t * session_info,
2101  globus_gfs_ipc_open_callback_t cb,
2102  void * user_arg,
2103  globus_gfs_ipc_error_callback_t error_cb,
2104  void * error_user_arg,
2105  globus_bool_t secure_ipc,
2106  gss_cred_id_t cred,
2107  const char *auth_mode,
2108  const char *subject,
2109  time_t connect_timeout,
2110  time_t idle_timeout,
2111  globus_bool_t inetd);
2112 
2113 globus_result_t
2114 globus_gfs_ipc_handle_obtain(
2115  globus_gfs_session_info_t * session_info,
2116  globus_gfs_ipc_iface_t * iface,
2117  globus_gfs_ipc_open_callback_t cb,
2118  void * user_arg,
2119  globus_gfs_ipc_error_callback_t error_cb,
2120  void * error_user_arg);
2121 
2122 /*
2123  * the brain bit
2124  */
2125 #define BRAIN_SYMBOL_NAME (void*)"gridftp_brain"
2126 extern globus_extension_registry_t brain_i_registry;
2127 
2128 typedef globus_result_t
2129 (*globus_i_gfs_brain_select_nodes_func_t)(
2130  globus_i_gfs_brain_node_t *** out_node_array,
2131  int * out_array_length,
2132  const char * repo_name,
2133  globus_off_t filesize,
2134  int min_count,
2135  int max_count);
2136 
2137 typedef globus_result_t
2138 (*globus_i_gfs_brain_release_node_func_t)(
2139  globus_i_gfs_brain_node_t * contact_node,
2140  globus_gfs_brain_reason_t reason);
2141 
2142 typedef globus_result_t
2143 (*globus_i_gfs_brain_init_func_t)();
2144 
2145 typedef void
2146 (*globus_i_gfs_brain_stop_func_t)();
2147 
2148 typedef globus_result_t
2149 (*globus_i_gfs_brain_get_available_func_t)(
2150  const char * user_id,
2151  const char * repo_name,
2152  int * count);
2153 
2154 
2155 typedef struct globus_i_gfs_brain_module_s
2156 {
2157  globus_i_gfs_brain_init_func_t init_func;
2158  globus_i_gfs_brain_stop_func_t stop_func;
2159  globus_i_gfs_brain_select_nodes_func_t select_func;
2160  globus_i_gfs_brain_release_node_func_t release_func;
2161  globus_i_gfs_brain_get_available_func_t available_func;
2162 } globus_i_gfs_brain_module_t;
2163 
2164 extern globus_i_gfs_brain_module_t globus_i_gfs_default_brain;
2165 
2166 globus_result_t
2167 globus_gfs_brain_select_nodes(
2168  globus_i_gfs_brain_node_t *** out_node_array,
2169  int * out_array_length,
2170  const char * repo_name,
2171  globus_off_t filesize,
2172  int min_count,
2173  int max_count);
2174 
2175 globus_result_t
2176 globus_gfs_brain_release_node(
2177  globus_i_gfs_brain_node_t * contact_node,
2178  globus_gfs_brain_reason_t reason);
2179 
2180 globus_result_t
2181 globus_gfs_brain_get_available(
2182  const char * user_id,
2183  const char * repo_name,
2184  int * count);
2185 
2186 globus_result_t
2187 globus_gfs_ipc_handle_get_contact_string(
2188  globus_gfs_ipc_handle_t ipc_handle,
2189  char ** contact_string);
2190 
2191 globus_result_t
2192 globus_gfs_ipc_init(
2193  globus_bool_t requester);
2194 
2195 /*
2196  *
2197  */
2198 void
2199 globus_gfs_ipc_add_server(
2200  globus_xio_server_t server_handle);
2201 
2202 extern globus_gfs_ipc_iface_t globus_gfs_ipc_default_iface;
2203 
2204 /* end IPC */
2205 
2206 /* ACL interface */
2207 
2208 /*
2209  * interface implementation functions
2210  * see the globus_gridftp_server_acl_example package at
2211  * gridftp/server/acl/example for an example implementation.
2212  */
2213 
2214 /* acl handle object. members are internal use only. */
2215 typedef struct globus_i_gfs_acl_handle_s * globus_gfs_acl_handle_t;
2216 
2217 /* supported actions, all authorization callouts will be of these types.
2218  * an authorization callout should return success for any actions that
2219  * are not interesting. */
2220 typedef enum globus_gfs_acl_action_e
2221 {
2222  /* internal use only */
2223  GFS_ACL_ACTION_INIT = 1,
2224  /* the named object. will be deleted. */
2225  GFS_ACL_ACTION_DELETE,
2226  /* write to an existing object */
2227  GFS_ACL_ACTION_WRITE,
2228  /* create and write to a non-existant object */
2229  GFS_ACL_ACTION_CREATE,
2230  /* read an object */
2231  GFS_ACL_ACTION_READ,
2232  /* query metadata of an object (i.e. list) */
2233  GFS_ACL_ACTION_LOOKUP,
2234  /* speficy an authorization assertion. client may submit data to
2235  * influence future authorization decisions. data is in an unspecified
2236  * format. */
2237  GFS_ACL_ACTION_AUTHZ_ASSERT,
2238  /* report data safely written to disk. failure means data written has
2239  * overrun acceptable limits. */
2240  GFS_ACL_ACTION_COMMIT,
2241  /* increase previously requested write limits for an object */
2242  GFS_ACL_ACTION_GROW
2243 } globus_gfs_acl_action_t;
2244 
2245 /* user connection descriptor. this provides info about the user
2246  * attempting the connection or action */
2247 typedef struct globus_gfs_acl_info_s
2248 {
2249  char * hostname;
2250  char * subject;
2251  char * username;
2252  char * password;
2253  char * ipaddr;
2254  gss_ctx_id_t context;
2255 } globus_gfs_acl_info_t;
2256 
2257 /* object descriptor. this provides various info about the object of the
2258  * action attempt. */
2259 typedef struct globus_gfs_acl_object_desc_s
2260 {
2261  /* ALL: name of the object. commonly a filename.
2262  * value is NULL when not known or not used. */
2263  char * name;
2264 
2265  /* WRITE/CREATE: size being requested to write.
2266  * COMMIT: amount of data already written safely.
2267  * GROW: new full size being requested to write.
2268  * value is 0 when not known or not used. */
2269  globus_off_t size;
2270 
2271  /* AUTHZ_ASSERT: assertion data from the client.
2272  * value is NULL when not known or not used. */
2273  char * data;
2274 
2275  /* COMMIT: all data has been safely written
2276  * value is FALSE when not known or not used. */
2277  globus_bool_t final;
2278 
2280  globus_gfs_op_info_t op_info;
2281 } globus_gfs_acl_object_desc_t;
2282 
2283 /* return values for authorization functions */
2284 typedef enum globus_gfs_acl_status_e
2285 {
2286  /* decision is complete */
2287  GLOBUS_GFS_ACL_COMPLETE = 1,
2288  /* decision will be made in a seperate call to
2289  globus_gfs_acl_authorized_finished() */
2290  GLOBUS_GFS_ACL_WOULD_BLOCK
2291 } globus_gfs_acl_status_t;
2292 
2293 /* initialization callout. this is ususally necessary. must be
2294  * implemented if:
2295  * 1) we need to set up some sort of internal state/handle that can be passed
2296  * back to us in all callouts
2297  * and/or
2298  * 2) we are interested in authorizing the gridftp session based on client
2299  * user information.
2300  *
2301  * must return GLOBUS_GFS_ACL_COMPLETE or GLOBUS_GFS_ACL_WOULD_BLOCK, and
2302  * store GLOBUS_SUCCESS or an error result_t in out_res. if returning
2303  * GLOBUS_GFS_ACL_WOULD_BLOCK, the result must be returned in a call to
2304  * globus_gfs_acl_authorized_finished(). optionally, a pointer may be stored
2305  * in out_handle. this pointer will then be passed back in later callouts.
2306  */
2307 typedef int
2308 (*globus_gfs_acl_init_t)(
2309  void ** out_handle,
2310  globus_gfs_acl_info_t * acl_info,
2311  globus_gfs_acl_handle_t acl_handle,
2312  globus_result_t * out_res);
2313 
2314 /* authorization callout. this is usually necessary. here we will
2315  * get called to authrorize all actions the client performs. see the
2316  * globus_gfs_acl_action_t declaration for all of the supported actions.
2317  *
2318  * must return GLOBUS_GFS_ACL_COMPLETE or GLOBUS_GFS_ACL_WOULD_BLOCK, and
2319  * store GLOBUS_SUCCESS or an error result_t in out_res. If returning
2320  * GLOBUS_GFS_ACL_WOULD_BLOCK, the result must be returned in a call to
2321  * globus_gfs_acl_authorized_finished().
2322  */
2323 typedef int
2324 (*globus_gfs_acl_authorize_t)(
2325  void * out_handle,
2326  globus_gfs_acl_action_t action,
2327  globus_gfs_acl_object_desc_t * object,
2328  globus_gfs_acl_info_t * acl_info,
2329  globus_gfs_acl_handle_t acl_handle,
2330  globus_result_t * out_res);
2331 
2332 /* destructor callout. clean up our session state if necessary */
2333 typedef void
2334 (*globus_gfs_acl_destroy_t)(
2335  void * out_handle);
2336 
2337 /* audit callout. informational callout only. implement this if you would
2338  * like to be notified of activities, but don't need to allow/deny them. */
2339 typedef void
2340 (*globus_gfs_acl_audit_t)(
2341  void * out_handle,
2342  globus_gfs_acl_action_t action,
2343  globus_gfs_acl_object_desc_t * object,
2344  const char * message);
2345 
2346 /* acl module descriptor.
2347  * Only define the functions you implement, otherwise NULL */
2348 typedef struct globus_gfs_acl_module_s
2349 {
2350  globus_gfs_acl_init_t init_func;
2351  globus_gfs_acl_authorize_t authorize_func;
2352  globus_gfs_acl_destroy_t destroy_func;
2353  globus_gfs_acl_audit_t audit_func;
2354 } globus_gfs_acl_module_t;
2355 
2356 /* authorization finalization function. this must be called when the
2357  * initialization or authorization callouts return GLOBUS_GFS_ACL_WOULD_BLOCK.
2358  */
2359 void
2360 globus_gfs_acl_authorized_finished(
2361  globus_gfs_acl_handle_t acl_handle,
2362  globus_result_t result);
2363 
2364 /* helper function to get strings from action types. useful for log/error
2365  * messages */
2366 const char *
2367 globus_gfs_acl_action_to_string(
2368  globus_gfs_acl_action_t action);
2369 
2370 
2371 /* end ACL */
2372 
2373 
2374 /* config locking functions */
2375 typedef
2376 void
2377 (*globus_i_gfs_config_set_string_cb_t)(
2378  const char * option_name,
2379  const char * val,
2380  void * user_arg);
2381 
2382 typedef
2383 void
2384 (*globus_i_gfs_config_set_int_cb_t)(
2385  const char * option_name,
2386  int val,
2387  void * user_arg);
2388 
2389 typedef struct
2390 {
2391  void * user_arg;
2392  globus_bool_t enabled;
2393  void * cb;
2394 } globus_i_gfs_config_option_cb_ent_t;
2395 
2396 void
2397 globus_gfs_config_enable_cb(
2398  globus_i_gfs_config_option_cb_ent_t * cb_handle,
2399  globus_bool_t enabled);
2400 
2401 int
2402 globus_gfs_config_add_cb(
2403  globus_i_gfs_config_option_cb_ent_t ** cb_handle,
2404  char * option_name,
2405  void * cb,
2406  void * user_arg);
2407 
2408 globus_bool_t
2409 globus_gfs_config_get_bool(
2410  const char * option_name);
2411 
2412 char *
2413 globus_gfs_config_get_string(
2414  const char * option_name);
2415 
2416 globus_list_t *
2417 globus_gfs_config_get_list(
2418  const char * option_name);
2419 
2420 void *
2421 globus_gfs_config_get(
2422  const char * option_name);
2423 
2424 int
2425 globus_gfs_config_get_int(
2426  const char * option_name);
2427 
2428 int
2429 globus_gfs_config_set_int(
2430  char * option_name,
2431  int int_value);
2432 
2433 int
2434 globus_gfs_config_set_bool(
2435  char * option_name,
2436  int int_value);
2437 
2438 int
2439 globus_gfs_config_set_ptr(
2440  char * option_name,
2441  void * ptr);
2442 
2443 int
2444 globus_gfs_config_inc_int(
2445  char * option_name,
2446  int inc_val);
2447 
2448 #endif
GLOBUS_GFS_EVENT_DISCONNECTED
@ GLOBUS_GFS_EVENT_DISCONNECTED
Definition: globus_gridftp_server.h:167
GLOBUS_GFS_EVENT_FINAL_EOF_COUNT
@ GLOBUS_GFS_EVENT_FINAL_EOF_COUNT
Definition: globus_gridftp_server.h:188
GLOBUS_GFS_EVENT_TRANSFER_COMPLETE
@ GLOBUS_GFS_EVENT_TRANSFER_COMPLETE
Definition: globus_gridftp_server.h:163
globus_gfs_event_type_t
enum globus_gfs_event_type_e globus_gfs_event_type_t
Event types.
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
@ 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_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
@ 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:14036
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_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:632
globus_gfs_event_type_e
globus_gfs_event_type_e
Event types.
Definition: globus_gridftp_server.h:152
GLOBUS_GFS_EVENT_PARTIAL_EOF_COUNT
@ 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:14666
globus_gfs_op_info_param_t
globus_gfs_op_info_param_t
Definition: globus_gridftp_server.h:1063
GLOBUS_GFS_EVENT_TRANSFER_CONNECTED
@ GLOBUS_GFS_EVENT_TRANSFER_CONNECTED
Definition: globus_gridftp_server.h:182
GLOBUS_GFS_EVENT_ALL
@ GLOBUS_GFS_EVENT_ALL
Definition: globus_gridftp_server.h:191
GLOBUS_GFS_EVENT_TRANSFER_ABORT
@ 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:950
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
@ GLOBUS_GFS_EVENT_TRANSFER_BEGIN
Definition: globus_gridftp_server.h:156