diff options
| author | Sebastien Bacher <seb128@ubuntu.com> | 2020-01-13 16:10:30 +0100 |
|---|---|---|
| committer | Sebastien Bacher <seb128@ubuntu.com> | 2020-01-13 16:31:40 +0100 |
| commit | 5a09f7759860f4f2a9bb01471ca8099cd705bc10 (patch) | |
| tree | 3a9cffc9622d53c9196771a1c7924bceb754f118 /clients/cloud-setup/nm-http-client.h | |
| parent | 25691220fd27093630cf244e219b2f4f1f4e749e (diff) | |
| parent | ca847639aab94434daed120c874e1100c3d75dcf (diff) | |
Merge remote-tracking branch 'salsa/debian/master'
Diffstat (limited to 'clients/cloud-setup/nm-http-client.h')
| -rw-r--r-- | clients/cloud-setup/nm-http-client.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/clients/cloud-setup/nm-http-client.h b/clients/cloud-setup/nm-http-client.h new file mode 100644 index 00000000..86ee938e --- /dev/null +++ b/clients/cloud-setup/nm-http-client.h @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: LGPL-2.1+ + +#ifndef __NM_HTTP_CLIENT_C__ +#define __NM_HTTP_CLIENT_C__ + +/*****************************************************************************/ + +typedef struct _NMHttpClient NMHttpClient; +typedef struct _NMHttpClientClass NMHttpClientClass; + +#define NM_TYPE_HTTP_CLIENT (nm_http_client_get_type ()) +#define NM_HTTP_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_HTTP_CLIENT, NMHttpClient)) +#define NM_HTTP_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_HTTP_CLIENT, NMHttpClientClass)) +#define NM_IS_HTTP_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_HTTP_CLIENT)) +#define NM_IS_HTTP_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_HTTP_CLIENT)) +#define NM_HTTP_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_HTTP_CLIENT, NMHttpClientClass)) + +GType nm_http_client_get_type (void); + +NMHttpClient *nm_http_client_new (void); + +/*****************************************************************************/ + +GMainContext *nm_http_client_get_main_context (NMHttpClient *self); + +/*****************************************************************************/ + +void nm_http_client_get (NMHttpClient *self, + const char *uri, + int timeout_msec, + gssize max_data, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean nm_http_client_get_finish (NMHttpClient *self, + GAsyncResult *result, + long *out_response_code, + GBytes **out_response_data, + GError **error); + +typedef gboolean (*NMHttpClientPollGetCheckFcn) (long response_code, + GBytes *response_data, + gpointer check_user_data, + GError **error); + +void nm_http_client_poll_get (NMHttpClient *self, + const char *uri, + int request_timeout_ms, + gssize request_max_data, + int poll_timeout_ms, + int ratelimit_timeout_ms, + GCancellable *cancellable, + NMHttpClientPollGetCheckFcn check_fcn, + gpointer check_user_data, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean nm_http_client_poll_get_finish (NMHttpClient *self, + GAsyncResult *result, + long *out_response_code, + GBytes **out_response_data, + GError **error); + +/*****************************************************************************/ + +#endif /* __NM_HTTP_CLIENT_C__ */ |