Objectively 1.0.0
Ultra-lightweight object oriented framework for GNU C.
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>
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
98 } locals;
99
104};
105
109struct URLSessionInterface {
110
114 ObjectInterface objectInterface;
115
125 URLSessionDataTask *(*dataTaskWithRequest)(URLSession *self, URLRequest *request,
126 URLSessionTaskCompletion completion);
127
137 URLSessionDataTask *(*dataTaskWithURL)(URLSession *self, URL *url,
138 URLSessionTaskCompletion completion);
139
149 URLSessionDownloadTask *(*downloadTaskWithRequest)(URLSession *self, URLRequest *request,
150 URLSessionTaskCompletion completion);
151
161 URLSessionDownloadTask *(*downloadTaskWithURL)(URLSession *self, URL *url,
162 URLSessionTaskCompletion completion);
163
171 URLSession *(*init)(URLSession *self);
172
181 URLSession *(*initWithConfiguration)(URLSession *self, URLSessionConfiguration *configuration);
182
189 void (*invalidateAndCancel)(URLSession *self);
190
197 URLSession *(*sharedInstance)(void);
198
205 Array *(*tasks)(const URLSession *self);
206
216 URLSessionUploadTask *(*uploadTaskWithRequest)(URLSession *self, URLRequest *request,
217 URLSessionTaskCompletion completion);
218};
219
POSIX Threads conditional variables.
POSIX Threads locks.
Mutable arrays.
Object is the root Class of The Objectively Class hierarchy.
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.
static void invalidateAndCancel(URLSession *self)
Definition: URLSession.c:290
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.
Immutable arrays.
Definition: Array.h:56
The runtime representation of a Class.
Definition: Class.h:95
POSIX Threads conditional variables.
Definition: Condition.h:44
POSIX Threads locks.
Definition: Lock.h:42
Mutable arrays.
Definition: MutableArray.h:40
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:56
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
Lock * lock
The Lock guarding access to tasks.
Definition: URLSession.h:87
Condition * condition
The condition.
Definition: URLSession.h:77
URLSessionConfiguration * configuration
The session configuration.
Definition: URLSession.h:103
Class * _URLSession(void)
The URLSession archetype.
Definition: URLSession.c:389
Thread * thread
The backing Thread.
Definition: URLSession.h:97
MutableArray * tasks
The URLSessionTasks.
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.