diff options
author | Carlos Garcia Campos <cgarcia@igalia.com> | 2020-10-09 11:29:11 +0200 |
---|---|---|
committer | Carlos Garcia Campos <cgarcia@igalia.com> | 2020-10-19 14:02:25 +0200 |
commit | 99c19cc27ae837e665ace3c1f0e99cd1088e6c24 (patch) | |
tree | bbb7f7a7a9c9544801c66cf3e543ee3ea93291be /libsoup/soup-message-io-data.h | |
parent | d5cd7249b20beee01dc26c09ec80f270ef8962fd (diff) | |
download | libsoup-carlosgc/split-io.tar.gz |
Split SoupMessage into client and server partscarlosgc/split-io
Add SoupServerMessage and move there all the server only functionality.
Diffstat (limited to 'libsoup/soup-message-io-data.h')
-rw-r--r-- | libsoup/soup-message-io-data.h | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/libsoup/soup-message-io-data.h b/libsoup/soup-message-io-data.h new file mode 100644 index 00000000..0476a425 --- /dev/null +++ b/libsoup/soup-message-io-data.h @@ -0,0 +1,99 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright (C) 2000-2003, Ximian, Inc. + */ + +#ifndef __SOUP_MESSAGE_IO_DATA_H__ +#define __SOUP_MESSAGE_IO_DATA_H__ 1 + +#include "soup-filter-input-stream.h" +#include "soup-message-headers.h" + +typedef enum { + SOUP_MESSAGE_IO_STATE_NOT_STARTED, + SOUP_MESSAGE_IO_STATE_ANY = SOUP_MESSAGE_IO_STATE_NOT_STARTED, + SOUP_MESSAGE_IO_STATE_HEADERS, + SOUP_MESSAGE_IO_STATE_BLOCKING, + SOUP_MESSAGE_IO_STATE_BODY_START, + SOUP_MESSAGE_IO_STATE_BODY, + SOUP_MESSAGE_IO_STATE_BODY_DATA, + SOUP_MESSAGE_IO_STATE_BODY_FLUSH, + SOUP_MESSAGE_IO_STATE_BODY_DONE, + SOUP_MESSAGE_IO_STATE_FINISHING, + SOUP_MESSAGE_IO_STATE_DONE +} SoupMessageIOState; + +#define SOUP_MESSAGE_IO_STATE_ACTIVE(state) \ + (state != SOUP_MESSAGE_IO_STATE_NOT_STARTED && \ + state != SOUP_MESSAGE_IO_STATE_BLOCKING && \ + state != SOUP_MESSAGE_IO_STATE_DONE) +#define SOUP_MESSAGE_IO_STATE_POLLABLE(state) \ + (SOUP_MESSAGE_IO_STATE_ACTIVE (state) && \ + state != SOUP_MESSAGE_IO_STATE_BODY_DONE) + +typedef enum { + SOUP_MESSAGE_IO_COMPLETE, + SOUP_MESSAGE_IO_INTERRUPTED, + SOUP_MESSAGE_IO_STOLEN +} SoupMessageIOCompletion; + +typedef void (*SoupMessageIOCompletionFn) (GObject *msg, + SoupMessageIOCompletion completion, + gpointer user_data); + +typedef struct { + GIOStream *iostream; + SoupFilterInputStream *istream; + GInputStream *body_istream; + GOutputStream *ostream; + GOutputStream *body_ostream; + GMainContext *async_context; + + SoupMessageIOState read_state; + SoupEncoding read_encoding; + GByteArray *read_header_buf; + goffset read_length; + + SoupMessageIOState write_state; + SoupEncoding write_encoding; + GString *write_buf; + GBytes *write_chunk; + goffset write_body_offset; + goffset write_length; + goffset written; + + GSource *io_source; + gboolean paused; + + GCancellable *async_wait; + GError *async_error; + + SoupMessageIOCompletionFn completion_cb; + gpointer completion_data; + +#ifdef HAVE_SYSPROF + gint64 begin_time_nsec; +#endif +} SoupMessageIOData; + +void soup_message_io_data_cleanup (SoupMessageIOData *io); + +gboolean soup_message_io_data_read_headers (SoupMessageIOData *io, + gboolean blocking, + GCancellable *cancellable, + GError **error); + +typedef gboolean (*SoupMessageIOSourceFunc) (GObject *msg, + gpointer user_data); + +GSource *soup_message_io_data_get_source (SoupMessageIOData *io, + GObject *msg, + GCancellable *cancellable, + SoupMessageIOSourceFunc callback, + gpointer user_data); + +void soup_message_io_data_pause (SoupMessageIOData *io); +void soup_message_io_data_unpause (SoupMessageIOData *io); + + +#endif /* __SOUP_MESSAGE_IO_DATA_H__ */ |