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