Objectively
Ultra-lightweight object oriented framework for GNU C.
Loading...
Searching...
No Matches
URLSession.h
Go to the documentation of this file.
1/*
2 * Objectively: Ultra-lightweight object oriented framework for GNU C.
3 * Copyright (C) 2014 Jay Dolan <jay@jaydolan.com>
4 *
5 * This software is provided 'as-is', without any express or implied
6 * warranty. In no event will the authors be held liable for any damages
7 * arising from the use of this software.
8 *
9 * Permission is granted to anyone to use this software for any purpose,
10 * including commercial applications, and to alter it and redistribute it
11 * freely, subject to the following restrictions:
12 *
13 * 1. The origin of this software must not be misrepresented; you must not
14 * claim that you wrote the original software. If you use this software
15 * in a product, an acknowledgment in the product documentation would be
16 * appreciated but is not required.
17 *
18 * 2. Altered source versions must be plainly marked as such, and must not be
19 * misrepresented as being the original software.
20 *
21 * 3. This notice may not be removed or altered from any source distribution.
22 */
23
24#pragma once
25
36typedef struct URLSession URLSession;
37typedef struct URLSessionInterface URLSessionInterface;
38
40#include <Objectively/Lock.h>
41#include <Objectively/Array.h>
42#include <Objectively/Object.h>
43#include <Objectively/Thread.h>
51
57struct URLSession {
58
63
68 URLSessionInterface *interface;
69
73 struct {
78
83
88
93 } locals;
94
99};
100
104struct URLSessionInterface {
105
109 ObjectInterface objectInterface;
110
120 URLSessionDataTask *(*dataTaskWithRequest)(URLSession *self, URLRequest *request,
121 URLSessionTaskCompletion completion);
122
132 URLSessionDataTask *(*dataTaskWithURL)(URLSession *self, URL *url,
133 URLSessionTaskCompletion completion);
134
144 URLSessionDownloadTask *(*downloadTaskWithRequest)(URLSession *self, URLRequest *request,
145 URLSessionTaskCompletion completion);
146
156 URLSessionDownloadTask *(*downloadTaskWithURL)(URLSession *self, URL *url,
157 URLSessionTaskCompletion completion);
158
166 URLSession *(*init)(URLSession *self);
167
176 URLSession *(*initWithConfiguration)(URLSession *self, URLSessionConfiguration *configuration);
177
184 void (*invalidateAndCancel)(URLSession *self);
185
192 URLSession *(*sharedInstance)(void);
193
200 Array *(*tasks)(const URLSession *self);
201
211 URLSessionUploadTask *(*uploadTaskWithRequest)(URLSession *self, URLRequest *request,
212 URLSessionTaskCompletion completion);
213};
214
Arrays.
POSIX Threads conditional variables.
POSIX Threads locks.
Object is the root Class of The Objectively Class hierarchy.
static int request(RESTClient *self, HTTPMethod method, const char *url_string, const Data *body, Data **out_data)
Definition RESTClient.c:57
POSIX Threads.
void * ident
The identity type, similar to Objective-C id.
Definition Types.h:49
#define OBJECTIVELY_EXPORT
Definition Types.h:36
A protocol-agnostic abstraction for requesting resources via URLs.
A protocol-agnostic abstraction for receiving resources via URLs.
OBJECTIVELY_EXPORT Class * _URLSession(void)
Definition URLSession.c:414
Configuration bundle for URLSession.
Use data tasks to send and receive Data in-memory.
Use download tasks to save remote resources to file.
URL session tasks are handles to pending URL operations.
void(* URLSessionTaskCompletion)(URLSessionTask *task, bool success)
A function pointer for URLSessionTask completion.
Use upload tasks to send files directly from disk.
Arrays.
Definition Array.h:56
The runtime representation of a Class.
Definition Class.h:95
POSIX Threads conditional variables.
Definition Condition.h:44
Object is the root Class of The Objectively Class hierarchy.
Definition Object.h:46
POSIX Threads.
Definition Thread.h:53
Uniform Resource Locators (RFC 3986).
Definition URL.h:44
A protocol-agnostic abstraction for requesting resources via URLs.
Definition URLRequest.h:58
Configuration bundle for URLSession.
Use data tasks to send and receive Data in-memory.
Use download tasks to save remote resources to file.
A management context for loading resources via URLs.
Definition URLSession.h:57
Object object
The superclass.
Definition URLSession.h:62
Array * tasks
The URLSessionTasks.
Definition URLSession.h:87
Condition * condition
The condition, and the Lock guarding access to tasks.
Definition URLSession.h:77
URLSessionConfiguration * configuration
The session configuration.
Definition URLSession.h:98
Thread * thread
The backing Thread.
Definition URLSession.h:92
URLSessionInterface * interface
The interface.
Definition URLSession.h:68
ident handle
The libcurl handle.
Definition URLSession.h:82
Use upload tasks to send files directly from disk.