22 #ifndef GLOBUS_GLOBUS_IO_H
23 #define GLOBUS_GLOBUS_IO_H
25 #include "globus_xio.h"
26 #include "globus_xio_tcp_driver.h"
27 #include "globus_xio_file_driver.h"
28 #include "globus_xio_gsi.h"
30 #define GLOBUS_IO_OVER_XIO 1
36 #define GLOBUS_IO_MODULE (&globus_l_io_module)
38 extern globus_module_descriptor_t globus_l_io_module;
40 #define _IOSL(s) globus_common_i18n_get_string( \
44 typedef struct globus_l_io_handle_s * globus_io_handle_t;
45 typedef struct globus_l_io_attr_s * globus_io_attr_t;
47 typedef struct blah_s * globus_netlogger_handle_t;
50 (*globus_io_callback_t)(
52 globus_io_handle_t * handle,
53 globus_result_t result);
56 (*globus_io_read_callback_t)(
58 globus_io_handle_t * handle,
59 globus_result_t result,
61 globus_size_t nbytes);
64 (*globus_io_write_callback_t)(
66 globus_io_handle_t * handle,
67 globus_result_t result,
69 globus_size_t nbytes);
72 (*globus_io_writev_callback_t)(
74 globus_io_handle_t * handle,
75 globus_result_t result,
78 globus_size_t nbytes);
82 GLOBUS_IO_HANDLE_TYPE_TCP_LISTENER,
83 GLOBUS_IO_HANDLE_TYPE_TCP_CONNECTED,
84 GLOBUS_IO_HANDLE_TYPE_UDSS_LISTENER,
85 GLOBUS_IO_HANDLE_TYPE_UDSS_CONNECTED,
86 GLOBUS_IO_HANDLE_TYPE_FILE,
87 GLOBUS_IO_HANDLE_TYPE_UDP_UNCONNECTED,
88 GLOBUS_IO_HANDLE_TYPE_UDP_CONNECTED,
89 GLOBUS_IO_HANDLE_TYPE_UDDS_UNCONNECTED,
90 GLOBUS_IO_HANDLE_TYPE_UDDS_CONNECTED,
91 GLOBUS_IO_HANDLE_TYPE_INTERNAL
92 } globus_io_handle_type_t;
96 GLOBUS_IO_FILE_CREAT = GLOBUS_XIO_FILE_CREAT,
97 GLOBUS_IO_FILE_EXCL = GLOBUS_XIO_FILE_EXCL,
98 GLOBUS_IO_FILE_RDONLY = GLOBUS_XIO_FILE_RDONLY,
99 GLOBUS_IO_FILE_WRONLY = GLOBUS_XIO_FILE_WRONLY,
100 GLOBUS_IO_FILE_RDWR = GLOBUS_XIO_FILE_RDWR,
101 GLOBUS_IO_FILE_TRUNC = GLOBUS_XIO_FILE_TRUNC,
102 GLOBUS_IO_FILE_APPEND = GLOBUS_XIO_FILE_APPEND
103 } globus_io_file_flag_t;
107 GLOBUS_IO_FILE_IRWXU = GLOBUS_XIO_FILE_IRWXU,
108 GLOBUS_IO_FILE_IRUSR = GLOBUS_XIO_FILE_IRUSR,
109 GLOBUS_IO_FILE_IWUSR = GLOBUS_XIO_FILE_IWUSR,
110 GLOBUS_IO_FILE_IXUSR = GLOBUS_XIO_FILE_IXUSR,
111 GLOBUS_IO_FILE_IRWXO = GLOBUS_XIO_FILE_IRWXO,
112 GLOBUS_IO_FILE_IROTH = GLOBUS_XIO_FILE_IROTH,
113 GLOBUS_IO_FILE_IWOTH = GLOBUS_XIO_FILE_IWOTH,
114 GLOBUS_IO_FILE_IXOTH = GLOBUS_XIO_FILE_IXOTH,
115 GLOBUS_IO_FILE_IRWXG = GLOBUS_XIO_FILE_IRWXG,
116 GLOBUS_IO_FILE_IRGRP = GLOBUS_XIO_FILE_IRGRP,
117 GLOBUS_IO_FILE_IWGRP = GLOBUS_XIO_FILE_IWGRP,
118 GLOBUS_IO_FILE_IXGRP = GLOBUS_XIO_FILE_IXGRP
119 } globus_io_file_create_mode_t;
123 GLOBUS_IO_SEEK_SET = GLOBUS_XIO_FILE_SEEK_SET,
124 GLOBUS_IO_SEEK_CUR = GLOBUS_XIO_FILE_SEEK_CUR,
125 GLOBUS_IO_SEEK_END = GLOBUS_XIO_FILE_SEEK_END
126 } globus_io_whence_t;
130 GLOBUS_IO_FILE_TYPE_TEXT = GLOBUS_XIO_FILE_TEXT,
131 GLOBUS_IO_FILE_TYPE_BINARY = GLOBUS_XIO_FILE_BINARY
132 } globus_io_file_type_t;
136 GLOBUS_IO_SEND_MSG_OOB = GLOBUS_XIO_TCP_SEND_OOB
137 } globus_io_send_flags_t;
140 globus_io_register_cancel(
141 globus_io_handle_t * handle,
142 globus_bool_t perform_callbacks,
143 globus_io_callback_t cancel_callback,
148 globus_io_handle_t * handle,
149 globus_bool_t perform_callbacks);
152 globus_io_register_close(
153 globus_io_handle_t * handle,
154 globus_io_callback_t callback,
155 void * callback_arg);
159 globus_io_handle_t * handle);
161 globus_io_handle_type_t
162 globus_io_get_handle_type(
163 globus_io_handle_t * handle);
166 globus_io_handle_get_user_pointer(
167 globus_io_handle_t * handle,
168 void ** user_pointer);
171 globus_io_handle_set_user_pointer(
172 globus_io_handle_t * handle,
173 void * user_pointer);
176 globus_io_register_read(
177 globus_io_handle_t * handle,
179 globus_size_t max_nbytes,
180 globus_size_t wait_for_nbytes,
181 globus_io_read_callback_t callback,
182 void * callback_arg);
186 globus_io_handle_t * handle,
188 globus_size_t max_nbytes,
189 globus_size_t * nbytes_read);
193 globus_io_handle_t * handle,
195 globus_size_t max_nbytes,
196 globus_size_t wait_for_nbytes,
197 globus_size_t * nbytes_read);
200 globus_io_register_write(
201 globus_io_handle_t * handle,
203 globus_size_t nbytes,
204 globus_io_write_callback_t write_callback,
205 void * callback_arg);
208 globus_io_register_send(
209 globus_io_handle_t * handle,
211 globus_size_t nbytes,
213 globus_io_write_callback_t write_callback,
214 void * callback_arg);
217 globus_io_register_writev(
218 globus_io_handle_t * handle,
220 globus_size_t iovcnt,
221 globus_io_writev_callback_t writev_callback,
222 void * callback_arg);
226 globus_io_handle_t * handle,
228 globus_size_t max_nbytes,
229 globus_size_t * nbytes_written);
233 globus_io_handle_t * handle,
235 globus_size_t nbytes,
237 globus_size_t * nbytes_sent);
241 globus_io_handle_t * handle,
243 globus_size_t nbytes,
244 globus_size_t * nbytes_written);
248 globus_io_handle_t * handle,
250 globus_size_t nbytes,
252 globus_size_t * nbytes_sent);
256 globus_io_handle_t * handle,
258 globus_size_t iovcnt,
259 globus_size_t * bytes_written);
262 globus_io_tcp_register_connect(
265 globus_io_attr_t * attr,
266 globus_io_callback_t callback,
268 globus_io_handle_t * handle);
271 globus_io_tcp_connect(
274 globus_io_attr_t * attr,
275 globus_io_handle_t * handle);
278 globus_io_tcp_create_listener(
279 unsigned short * port,
281 globus_io_attr_t * attr,
282 globus_io_handle_t * handle);
284 #define globus_io_register_listen globus_io_tcp_register_listen
285 #define globus_io_listen globus_io_tcp_listen
288 globus_io_tcp_register_listen(
289 globus_io_handle_t * handle,
290 globus_io_callback_t callback,
291 void * callback_arg);
294 globus_io_tcp_listen(
295 globus_io_handle_t * handle);
298 globus_io_tcp_register_accept(
299 globus_io_handle_t * listener_handle,
300 globus_io_attr_t * attr,
301 globus_io_handle_t * new_handle,
302 globus_io_callback_t callback,
303 void * callback_arg);
306 globus_io_tcp_accept(
307 globus_io_handle_t * listener_handle,
308 globus_io_attr_t * attr,
309 globus_io_handle_t * handle);
312 globus_io_register_select(
313 globus_io_handle_t * handle,
314 globus_io_callback_t read_callback_func,
315 void * read_callback_arg,
316 globus_io_callback_t write_callback_func,
317 void * write_callback_arg,
318 globus_io_callback_t except_callback_func,
319 void * except_callback_arg);
323 globus_io_tcp_get_local_address(
324 globus_io_handle_t * handle,
326 unsigned short * port);
329 globus_io_tcp_get_remote_address(
330 globus_io_handle_t * handle,
332 unsigned short * port);
338 globus_io_tcp_get_local_address_ex(
339 globus_io_handle_t * handle,
342 unsigned short * port);
345 globus_io_tcp_get_remote_address_ex(
346 globus_io_handle_t * handle,
349 unsigned short * port);
352 globus_io_tcp_posix_convert(
354 globus_io_attr_t * attributes,
355 globus_io_handle_t * handle);
358 globus_io_tcp_posix_convert_listener(
360 globus_io_attr_t * attributes,
361 globus_io_handle_t * handle);
364 globus_io_fileattr_init(
365 globus_io_attr_t * attr);
368 globus_io_fileattr_destroy(
369 globus_io_attr_t * attr);
372 globus_io_attr_set_file_type(
373 globus_io_attr_t * attr,
374 globus_io_file_type_t file_type);
377 globus_io_attr_get_file_type(
378 globus_io_attr_t * attr,
379 globus_io_file_type_t * file_type);
386 globus_io_attr_t * attr,
387 globus_io_handle_t * handle);
391 globus_io_handle_t * handle,
393 globus_io_whence_t whence);
396 globus_io_file_posix_convert(
398 globus_io_attr_t * attr,
399 globus_io_handle_t * handle);
402 globus_io_tcpattr_init(
403 globus_io_attr_t * attr);
406 globus_io_tcpattr_destroy(
407 globus_io_attr_t * attr);
410 globus_io_tcp_get_attr(
411 globus_io_handle_t * handle,
412 globus_io_attr_t * attr);
415 globus_io_attr_set_tcp_restrict_port(
416 globus_io_attr_t * attr,
417 globus_bool_t restrict_port);
420 globus_io_attr_get_tcp_restrict_port(
421 globus_io_attr_t * attr,
422 globus_bool_t * restrict_port);
425 globus_io_attr_set_socket_reuseaddr(
426 globus_io_attr_t * attr,
427 globus_bool_t reuseaddr);
430 globus_io_attr_get_socket_reuseaddr(
431 globus_io_attr_t * attr,
432 globus_bool_t * reuseaddr);
435 globus_io_attr_set_socket_keepalive(
436 globus_io_attr_t * attr,
437 globus_bool_t keepalive);
440 globus_io_attr_get_socket_keepalive(
441 globus_io_attr_t * attr,
442 globus_bool_t * keepalive);
445 globus_io_attr_set_socket_linger(
446 globus_io_attr_t * attr,
447 globus_bool_t linger,
451 globus_io_attr_get_socket_linger(
452 globus_io_attr_t * attr,
453 globus_bool_t * linger,
457 globus_io_attr_set_socket_oobinline(
458 globus_io_attr_t * attr,
459 globus_bool_t oobinline);
462 globus_io_attr_get_socket_oobinline(
463 globus_io_attr_t * attr,
464 globus_bool_t * oobinline);
467 globus_io_attr_set_socket_sndbuf(
468 globus_io_attr_t * attr,
472 globus_io_attr_get_socket_sndbuf(
473 globus_io_attr_t * attr,
477 globus_io_attr_set_socket_rcvbuf(
478 globus_io_attr_t * attr,
482 globus_io_attr_get_socket_rcvbuf(
483 globus_io_attr_t * attr,
487 globus_io_attr_set_tcp_nodelay(
488 globus_io_attr_t * attr,
489 globus_bool_t nodelay);
492 globus_io_attr_get_tcp_nodelay(
493 globus_io_attr_t * attr,
494 globus_bool_t * nodelay);
497 globus_io_attr_set_tcp_interface(
498 globus_io_attr_t * attr,
499 const char * interface_addr);
502 globus_io_attr_get_tcp_interface(
503 globus_io_attr_t * attr,
504 char ** interface_addr);
507 globus_io_attr_set_tcp_allow_ipv6(
508 globus_io_attr_t * attr,
509 globus_bool_t allow);
513 globus_object_t * eof);
516 globus_io_attr_set_callback_space(
517 globus_io_attr_t * attr,
518 globus_callback_space_t space);
521 globus_io_attr_get_callback_space(
522 globus_io_attr_t * attr,
523 globus_callback_space_t * space);
525 #include "globus_gss_assist.h"
527 #ifndef _HAVE_GSI_EXTENDED_GSSAPI
528 #include "globus_gss_ext_compat.h"
531 typedef struct globus_l_io_secure_authorization_data_s * globus_io_secure_authorization_data_t;
533 typedef globus_bool_t
534 (*globus_io_secure_authorization_callback_t)(
536 globus_io_handle_t * handle,
537 globus_result_t result,
539 gss_ctx_id_t context_handle);
542 (* globus_io_delegation_callback_t)(
544 globus_io_handle_t * handle,
545 globus_result_t result,
546 gss_cred_id_t delegated_cred,
551 GLOBUS_IO_SECURE_AUTHENTICATION_MODE_NONE,
552 GLOBUS_IO_SECURE_AUTHENTICATION_MODE_GSSAPI,
553 GLOBUS_IO_SECURE_AUTHENTICATION_MODE_MUTUAL,
554 GLOBUS_IO_SECURE_AUTHENTICATION_MODE_ANONYMOUS
555 } globus_io_secure_authentication_mode_t;
559 GLOBUS_IO_SECURE_AUTHORIZATION_MODE_NONE =
560 GLOBUS_XIO_GSI_NO_AUTHORIZATION,
561 GLOBUS_IO_SECURE_AUTHORIZATION_MODE_SELF =
562 GLOBUS_XIO_GSI_SELF_AUTHORIZATION,
563 GLOBUS_IO_SECURE_AUTHORIZATION_MODE_IDENTITY =
564 GLOBUS_XIO_GSI_IDENTITY_AUTHORIZATION,
565 GLOBUS_IO_SECURE_AUTHORIZATION_MODE_HOST =
566 GLOBUS_XIO_GSI_HOST_AUTHORIZATION,
567 GLOBUS_IO_SECURE_AUTHORIZATION_MODE_CALLBACK
568 } globus_io_secure_authorization_mode_t;
572 GLOBUS_IO_SECURE_PROTECTION_MODE_NONE =
573 GLOBUS_XIO_GSI_PROTECTION_LEVEL_NONE,
574 GLOBUS_IO_SECURE_PROTECTION_MODE_SAFE =
575 GLOBUS_XIO_GSI_PROTECTION_LEVEL_INTEGRITY,
576 GLOBUS_IO_SECURE_PROTECTION_MODE_PRIVATE =
577 GLOBUS_XIO_GSI_PROTECTION_LEVEL_PRIVACY
578 } globus_io_secure_protection_mode_t;
582 GLOBUS_IO_SECURE_DELEGATION_MODE_NONE =
583 GLOBUS_XIO_GSI_DELEGATION_MODE_NONE,
584 GLOBUS_IO_SECURE_DELEGATION_MODE_LIMITED_PROXY =
585 GLOBUS_XIO_GSI_DELEGATION_MODE_LIMITED,
586 GLOBUS_IO_SECURE_DELEGATION_MODE_FULL_PROXY =
587 GLOBUS_XIO_GSI_DELEGATION_MODE_FULL
588 } globus_io_secure_delegation_mode_t;
592 GLOBUS_IO_SECURE_PROXY_MODE_NONE =
593 GLOBUS_XIO_GSI_PROXY_MODE_LIMITED,
594 GLOBUS_IO_SECURE_PROXY_MODE_LIMITED =
595 GLOBUS_XIO_GSI_PROXY_MODE_FULL,
596 GLOBUS_IO_SECURE_PROXY_MODE_MANY =
597 GLOBUS_XIO_GSI_PROXY_MODE_MANY
598 } globus_io_secure_proxy_mode_t;
602 GLOBUS_IO_SECURE_CHANNEL_MODE_CLEAR = 0,
603 GLOBUS_IO_SECURE_CHANNEL_MODE_GSI_WRAP,
604 GLOBUS_IO_SECURE_CHANNEL_MODE_SSL_WRAP,
605 GLOBUS_IO_SECURE_CHANNEL_MODE_GSI_WRAP_SSL3
606 } globus_io_secure_channel_mode_t;
609 globus_io_tcp_get_security_context(
610 globus_io_handle_t * handle,
611 gss_ctx_id_t * context);
614 globus_io_tcp_get_delegated_credential(
615 globus_io_handle_t * handle,
616 gss_cred_id_t * cred);
620 globus_io_tcp_set_credential(
621 globus_io_handle_t * handle,
622 gss_cred_id_t credential);
625 globus_io_tcp_get_credential(
626 globus_io_handle_t * handle,
627 gss_cred_id_t * credential);
630 globus_io_register_init_delegation(
631 globus_io_handle_t * handle,
632 const gss_cred_id_t cred_handle,
633 const gss_OID_set restriction_oids,
634 const gss_buffer_set_t restriction_buffers,
636 globus_io_delegation_callback_t callback,
637 void * callback_arg);
640 globus_io_init_delegation(
641 globus_io_handle_t * handle,
642 const gss_cred_id_t cred_handle,
643 const gss_OID_set restriction_oids,
644 const gss_buffer_set_t restriction_buffers,
648 globus_io_register_accept_delegation(
649 globus_io_handle_t * handle,
650 const gss_OID_set restriction_oids,
651 const gss_buffer_set_t restriction_buffers,
653 globus_io_delegation_callback_t callback,
654 void * callback_arg);
657 globus_io_accept_delegation(
658 globus_io_handle_t * handle,
659 gss_cred_id_t * delegated_cred,
660 const gss_OID_set restriction_oids,
661 const gss_buffer_set_t restriction_buffers,
663 OM_uint32 * time_rec);
667 globus_io_attr_set_secure_authentication_mode(
668 globus_io_attr_t * attr,
669 globus_io_secure_authentication_mode_t
671 gss_cred_id_t credential);
674 globus_io_attr_get_secure_authentication_mode(
675 globus_io_attr_t * attr,
676 globus_io_secure_authentication_mode_t *
678 gss_cred_id_t * credential);
681 globus_io_attr_set_secure_authorization_mode(
682 globus_io_attr_t * attr,
683 globus_io_secure_authorization_mode_t
685 globus_io_secure_authorization_data_t *
689 globus_io_attr_get_secure_authorization_mode(
690 globus_io_attr_t * attr,
691 globus_io_secure_authorization_mode_t *
693 globus_io_secure_authorization_data_t *
696 globus_io_attr_set_secure_extension_oids(
697 globus_io_attr_t * attr,
698 gss_OID_set extension_oids);
701 globus_io_attr_get_secure_extension_oids(
702 globus_io_attr_t * attr,
703 gss_OID_set * extension_oids);
706 globus_io_secure_authorization_data_initialize(
707 globus_io_secure_authorization_data_t *
710 globus_io_secure_authorization_data_destroy(
711 globus_io_secure_authorization_data_t *
714 globus_io_secure_authorization_data_set_identity(
715 globus_io_secure_authorization_data_t *
720 globus_io_secure_authorization_data_get_identity(
721 globus_io_secure_authorization_data_t *
726 globus_io_secure_authorization_data_set_callback(
727 globus_io_secure_authorization_data_t *
729 globus_io_secure_authorization_callback_t
731 void * callback_arg);
734 globus_io_secure_authorization_data_get_callback(
735 globus_io_secure_authorization_data_t *
737 globus_io_secure_authorization_callback_t *
739 void ** callback_arg);
742 globus_io_attr_set_secure_channel_mode(
743 globus_io_attr_t * attr,
744 globus_io_secure_channel_mode_t mode);
747 globus_io_attr_get_secure_channel_mode(
748 globus_io_attr_t * attr,
749 globus_io_secure_channel_mode_t * mode);
752 globus_io_attr_set_secure_protection_mode(
753 globus_io_attr_t * attr,
754 globus_io_secure_protection_mode_t mode);
757 globus_io_attr_get_secure_protection_mode(
758 globus_io_attr_t * attr,
759 globus_io_secure_protection_mode_t *mode);
762 globus_io_attr_set_secure_delegation_mode(
763 globus_io_attr_t * attr,
764 globus_io_secure_delegation_mode_t mode);
767 globus_io_attr_get_secure_delegation_mode(
768 globus_io_attr_t * attr,
769 globus_io_secure_delegation_mode_t *
772 globus_io_attr_set_secure_proxy_mode(
773 globus_io_attr_t * attr,
774 globus_io_secure_proxy_mode_t mode);
777 globus_io_attr_get_secure_proxy_mode(
778 globus_io_attr_t * attr,
779 globus_io_secure_proxy_mode_t * mode);
785 globus_io_attr_netlogger_set_handle(
786 globus_io_attr_t * attr,
787 globus_netlogger_handle_t * nl_handle);
790 globus_io_attr_netlogger_copy_handle(
791 globus_netlogger_handle_t * src,
792 globus_netlogger_handle_t * dst);
795 globus_netlogger_write(
796 globus_netlogger_handle_t * nl_handle,
803 globus_netlogger_handle_init(
804 globus_netlogger_handle_t * gnl_handle,
805 const char * hostname,
806 const char * progname,
810 globus_netlogger_handle_destroy(
811 globus_netlogger_handle_t * nl_handle);
814 globus_netlogger_get_nlhandle(
815 globus_netlogger_handle_t * nl_handle,
819 globus_netlogger_set_desc(
820 globus_netlogger_handle_t * nl_handle,
824 globus_io_handle_get_socket_buf(
825 globus_io_handle_t * handle,
830 globus_io_compat_get_tcp_driver();
833 globus_io_compat_get_gsi_driver();
836 globus_io_compat_get_file_driver();
839 globus_io_attr_get_xio_attr(
840 globus_io_attr_t * attr,
841 globus_xio_attr_t * xio_attr);
844 globus_io_attr_set_stack(
845 globus_io_attr_t * attr,
846 globus_xio_stack_t stack);
852 #include "globus_io_error_hierarchy.h"