17 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
24 #ifndef GLOBUS_I_XIO_HTTP_H
25 #define GLOBUS_I_XIO_HTTP_H 1
27 #include "globus_xio.h"
28 #include "globus_xio_driver.h"
31 enum { GLOBUS_XIO_HTTP_CHUNK_SIZE = 4000 };
35 GLOBUS_XIO_HTTP_TRANSFER_ENCODING_DEFAULT,
36 GLOBUS_XIO_HTTP_TRANSFER_ENCODING_IDENTITY,
37 GLOBUS_XIO_HTTP_TRANSFER_ENCODING_CHUNKED
39 globus_i_xio_http_transfer_encoding_t;
43 GLOBUS_XIO_HTTP_PRE_REQUEST_LINE,
44 GLOBUS_XIO_HTTP_REQUEST_LINE,
45 GLOBUS_XIO_HTTP_STATUS_LINE,
46 GLOBUS_XIO_HTTP_HEADERS,
47 GLOBUS_XIO_HTTP_CHUNK_CRLF,
48 GLOBUS_XIO_HTTP_CHUNK_LINE,
49 GLOBUS_XIO_HTTP_CHUNK_FOOTERS,
50 GLOBUS_XIO_HTTP_CHUNK_BODY,
51 GLOBUS_XIO_HTTP_IDENTITY_BODY,
55 globus_i_xio_http_parse_state_t;
59 struct globus_i_xio_http_handle_s * http_handle;
60 globus_xio_operation_t user_read_op;
61 globus_xio_operation_t internal_op;
62 globus_xio_driver_handle_t driver_handle;
64 globus_i_xio_http_cancellation_t;
66 #define GLOBUS_XIO_HTTP_COPY_BLOB(fifo, blob, len, label) \
68 result = globus_i_xio_http_copy_blob(fifo, blob, len); \
69 if (result != GLOBUS_SUCCESS) \
80 globus_xio_iovec_t * iov;
88 globus_xio_operation_t operation;
92 globus_xio_driver_handle_t driver_handle;
107 globus_i_xio_http_operation_info_t;
109 #define GLOBUS_XIO_ARRAY_LENGTH(x) (sizeof(x)/sizeof(x[0]))
112 #define GLOBUS_XIO_HTTP_TODO(msg) \
114 globus_libc_fprintf(stderr, "TODO: %s\n", msg); \
117 #define GLOBUS_XIO_HTTP_TODO(msg) \
119 globus_libc_fprintf(stderr, "TODO: %s\n", msg); \
148 globus_i_xio_http_target_t;
161 GLOBUS_I_XIO_HTTP_HEADER_ENTITY_NEEDED = 1 << 0,
165 GLOBUS_I_XIO_HTTP_HEADER_CONTENT_LENGTH_SET = 1 << 1,
169 GLOBUS_I_XIO_HTTP_HEADER_CONNECTION_CLOSE = 1 << 2
171 globus_i_xio_http_header_flags_t;
175 #define GLOBUS_I_XIO_HTTP_HEADER_IS_ENTITY_NEEDED(header) \
176 ((header)->flags & GLOBUS_I_XIO_HTTP_HEADER_ENTITY_NEEDED)
177 #define GLOBUS_I_XIO_HTTP_HEADER_IS_CONTENT_LENGTH_SET(header) \
178 ((header)->flags & GLOBUS_I_XIO_HTTP_HEADER_CONTENT_LENGTH_SET)
179 #define GLOBUS_I_XIO_HTTP_HEADER_IS_CONNECTION_CLOSE(header) \
180 ((header)->flags & GLOBUS_I_XIO_HTTP_HEADER_CONNECTION_CLOSE)
195 globus_hashtable_t headers;
199 globus_off_t content_length;
203 globus_i_xio_http_transfer_encoding_t
208 globus_i_xio_http_header_flags_t flags;
210 globus_i_xio_http_header_info_t;
248 globus_i_xio_http_header_info_t headers;
250 globus_i_xio_http_request_t;
272 char * reason_phrase;
284 globus_i_xio_http_header_info_t headers;
286 globus_i_xio_http_response_t;
288 typedef struct globus_i_xio_http_handle_s
293 globus_i_xio_http_target_t target_info;
297 globus_i_xio_http_request_t request_info;
302 globus_i_xio_http_response_t response_info;
306 globus_xio_driver_handle_t handle;
311 globus_xio_iovec_t * header_iovec;
320 globus_xio_iovec_t read_buffer;
326 globus_xio_iovec_t read_iovec;
342 globus_xio_operation_t close_operation;
355 const globus_xio_iovec_t * first_write_iovec;
359 int first_write_iovec_count;
363 globus_i_xio_http_parse_state_t parse_state;
367 globus_i_xio_http_parse_state_t send_state;
373 globus_xio_operation_t response_read_operation;
376 globus_i_xio_http_operation_info_t read_operation;
377 globus_i_xio_http_operation_info_t write_operation;
398 globus_i_xio_http_cancellation_t * cancellation;
409 globus_object_t * pending_error;
411 globus_i_xio_http_handle_t;
421 globus_i_xio_http_request_t request;
425 globus_i_xio_http_response_t response;
427 globus_i_xio_http_attr_t;
432 globus_i_xio_http_copy_blob(
439 globus_i_xio_http_find_eol(
445 globus_i_xio_http_method_requires_entity(
446 const char * method);
450 globus_i_xio_http_guess_version(
456 globus_i_xio_http_clean_read_buffer(
457 globus_i_xio_http_handle_t * http_handle);
462 globus_i_xio_http_attr_init(
467 globus_i_xio_http_attr_cntl(
474 globus_i_xio_http_attr_copy(
480 globus_i_xio_http_attr_destroy(
486 globus_i_xio_http_client_write_request(
487 globus_xio_operation_t op,
488 globus_i_xio_http_handle_t * http_handle);
492 globus_i_xio_http_client_open_callback(
493 globus_xio_operation_t op,
500 globus_i_xio_http_handle_init(
501 globus_i_xio_http_handle_t * http_handle,
502 globus_i_xio_http_attr_t * attr,
503 globus_i_xio_http_target_t * target);
507 globus_i_xio_http_handle_reinit(
508 globus_i_xio_http_handle_t * http_handle,
509 globus_i_xio_http_attr_t * http_attr,
510 globus_i_xio_http_target_t * http_target);
514 globus_i_xio_http_handle_destroy(
515 globus_i_xio_http_handle_t * http_handle);
519 globus_i_xio_http_handle_cntl(
526 globus_i_xio_http_set_end_of_entity(
527 globus_i_xio_http_handle_t * http_handle);
532 globus_i_xio_http_header_copy(
540 globus_i_xio_http_header_destroy(
545 globus_i_xio_http_header_parse(
546 globus_i_xio_http_handle_t * handle,
552 globus_i_xio_http_header_info_init(
553 globus_i_xio_http_header_info_t * headers);
557 globus_i_xio_http_header_info_destroy(
558 globus_i_xio_http_header_info_t * headers);
562 globus_i_xio_http_header_info_copy(
563 globus_i_xio_http_header_info_t * dest,
564 const globus_i_xio_http_header_info_t *
568 globus_i_xio_http_header_info_set_header(
569 globus_i_xio_http_header_info_t * headers,
570 const char * header_name,
571 const char * header_value,
577 globus_i_xio_http_lookup_reason(
582 globus_i_xio_http_target_t *
583 globus_i_xio_http_target_new(
void);
587 globus_i_xio_http_target_destroy(
588 void * driver_target);
592 globus_i_xio_http_target_destroy_internal(
593 globus_i_xio_http_target_t * target);
598 globus_i_xio_http_request_init(
599 globus_i_xio_http_request_t * request);
603 globus_i_xio_http_request_copy(
604 globus_i_xio_http_request_t * dest,
605 const globus_i_xio_http_request_t * src);
609 globus_i_xio_http_request_destroy(
610 globus_i_xio_http_request_t * request);
615 globus_i_xio_http_response_init(
616 globus_i_xio_http_response_t * response);
620 globus_i_xio_http_response_copy(
621 globus_i_xio_http_response_t * dest,
622 const globus_i_xio_http_response_t *src);
626 globus_i_xio_http_response_destroy(
627 globus_i_xio_http_response_t * response);
633 globus_i_xio_http_server_read_request_callback(
634 globus_xio_operation_t op,
641 globus_i_xio_http_accept(
642 void * driver_server,
643 globus_xio_operation_t accept_op);
647 globus_i_xio_http_server_open_callback(
648 globus_xio_operation_t op,
654 globus_i_xio_http_server_write_response(
655 globus_i_xio_http_handle_t * http_handle,
656 const globus_xio_iovec_t * iovec,
658 globus_xio_operation_t op);
662 globus_i_xio_http_server_read_next_request(
663 globus_i_xio_http_handle_t * http_handle);
668 globus_i_xio_http_target_init(
669 globus_i_xio_http_target_t ** out_target,
670 const globus_xio_contact_t * contact_info);
674 globus_i_xio_http_target_copy(
675 globus_i_xio_http_target_t * dest,
676 const globus_i_xio_http_target_t * src);
681 extern globus_list_t * globus_i_xio_http_cancellable_handles;
686 globus_i_xio_http_open(
687 const globus_xio_contact_t * contact_info,
690 globus_xio_operation_t op);
694 globus_i_xio_http_read(
696 const globus_xio_iovec_t * iovec,
698 globus_xio_operation_t op);
702 globus_i_xio_http_write(
704 const globus_xio_iovec_t * iovec,
706 globus_xio_operation_t op);
711 globus_l_xio_http_client_parse_response(
712 globus_i_xio_http_handle_t * http_handle,
716 globus_l_xio_http_client_read_response_callback(
717 globus_xio_operation_t op,
724 globus_i_xio_http_parse_residue(
725 globus_i_xio_http_handle_t * handle,
730 globus_i_xio_http_write_chunk(
731 globus_i_xio_http_handle_t * http_handle,
732 const globus_xio_iovec_t * iovec,
734 globus_xio_operation_t op);
738 globus_i_xio_http_write_callback(
739 globus_xio_operation_t op,
746 globus_i_xio_http_close(
749 globus_xio_operation_t op);
753 globus_i_xio_http_close_internal(
754 globus_i_xio_http_handle_t * http_handle);
758 globus_i_xio_http_close_callback(
759 globus_xio_operation_t operation,
763 GlobusXIODeclareModule(http);
764 #define GLOBUS_XIO_HTTP_MODULE GlobusXIOMyModule(http)
766 #define GlobusXIOHttpErrorObjParse(token, context) \
767 globus_error_construct_error( \
768 GLOBUS_XIO_HTTP_MODULE, \
770 GLOBUS_XIO_HTTP_ERROR_PARSE, \
774 "Error parsing %s token at %s", \
777 #define GlobusXIOHttpErrorParse(token, context) \
779 GlobusXIOHttpErrorObjParse(token, context))
781 #define GlobusXIOHttpErrorObjInvalidHeader(name, value) \
782 globus_error_construct_error( \
783 GLOBUS_XIO_HTTP_MODULE, \
785 GLOBUS_XIO_HTTP_ERROR_INVALID_HEADER, \
789 "Invalid %s header value %s", \
792 #define GlobusXIOHttpErrorInvalidHeader(name, value) \
794 GlobusXIOHttpErrorObjInvalidHeader(name, value))
796 #define GlobusXIOHttpErrorObjNoEntity() \
797 globus_error_construct_error( \
798 GLOBUS_XIO_HTTP_MODULE, \
800 GLOBUS_XIO_HTTP_ERROR_NO_ENTITY, \
804 "No entity to read or write")
806 #define GlobusXIOHttpErrorNoEntity() \
808 GlobusXIOHttpErrorObjNoEntity())
810 #define GlobusXIOHttpErrorObjEOF() \
811 globus_error_construct_error( \
812 GLOBUS_XIO_HTTP_MODULE, \
814 GLOBUS_XIO_HTTP_ERROR_EOF, \
820 #define GlobusXIOHttpErrorEOF() \
822 GlobusXIOHttpErrorObjEOF())
824 #define GlobusXIOHttpErrorPersistentConnectionDropped(cause) \
826 GlobusXIOHTTPErrorObjPersistentConnectionDropped(cause))
828 #define GlobusXIOHTTPErrorObjPersistentConnectionDropped(cause) \
829 globus_error_construct_error( \
830 GLOBUS_XIO_HTTP_MODULE, \
832 GLOBUS_XIO_HTTP_ERROR_PERSISTENT_CONNECTION_DROPPED, \
836 "Persistent connection dropped")
int globus_bool_t
Boolean type.
Definition: globus_types.h:93
struct globus_fifo_s * globus_fifo_t
Definition: globus_fifo.h:48
List data type.
Definition: globus_list.h:44
Globus XIO HTTP Driver Header.
Mutex.
Definition: globus_thread.h:107
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
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
uint32_t globus_result_t
Definition: globus_types.h:99
globus_xio_http_version_t
Definition: globus_xio_http.h:231