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