#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h>
#include "MutableData.h"
#include "URLSessionDataTask.h"
Go to the source code of this file.
◆ _Class
◆ CURL_WRITEFUNC_ABORT
#define CURL_WRITEFUNC_ABORT 0 |
◆ _URLSessionDataTask()
Class * _URLSessionDataTask |
( |
void |
| ) |
|
Definition at line 99 of file URLSessionDataTask.c.
99 {
102
105 .name = "URLSessionDataTask",
109 .interfaceSize = sizeof(URLSessionDataTaskInterface),
111 });
112 });
113
114 return clazz;
115}
Class * _initialize(const ClassDef *def)
Initializes the given Class.
static void initialize(Class *clazz)
#define do_once(once, block)
Executes the given block at most one time.
ClassDefs are passed to _initialize via an archetype to initialize a Class.
The runtime representation of a Class.
Use data tasks to send and receive Data in-memory.
Class * _URLSessionTask(void)
The URLSessionTask archetype.
◆ dealloc()
static void dealloc |
( |
Object * |
self | ) |
|
|
static |
- See also
- Object::dealloc(Object *)
Definition at line 39 of file URLSessionDataTask.c.
39 {
40
42
44
46}
ident release(ident obj)
Atomically decrement the given Object's reference count. If the resulting reference count is 0,...
#define super(type, obj, method,...)
MutableData * data(void)
Returns a new MutableData.
Object is the root Class of The Objectively Class hierarchy.
void dealloc(Object *self)
Frees all resources held by this Object.
◆ initialize()
static void initialize |
( |
Class * |
clazz | ) |
|
|
static |
- See also
- Class::initialize(Class *)
Definition at line 88 of file URLSessionDataTask.c.
88 {
89
91
93}
ident interface
The interface of the Class.
void setup(URLSessionTask *)
Sets up this task.
◆ setup()
- See also
- URLSessionTask::setup(URLSessionTask *)
Definition at line 75 of file URLSessionDataTask.c.
75 {
76
78
80 curl_easy_setopt(self->locals.
handle, CURLOPT_WRITEDATA, self);
81}
static size_t writeFunction(char *data, size_t size, size_t count, ident self)
The CURLOPT_WRITEFUNCTION callback.
URL session tasks are handles to pending URL operations.
ident handle
The backing libcurl handle.
◆ writeFunction()
static size_t writeFunction |
( |
char * |
data, |
|
|
size_t |
size, |
|
|
size_t |
count, |
|
|
ident |
self |
|
) |
| |
|
static |
The CURLOPT_WRITEFUNCTION
callback.
Definition at line 55 of file URLSessionDataTask.c.
55 {
56
58
59 const uint8_t *bytes = (uint8_t *)
data;
60 const size_t bytesReceived = size * count;
61
62 if (this->
data == NULL) {
64 }
65
67
68 this->urlSessionTask.bytesReceived += bytesReceived;
69 return bytesReceived;
70}
#define alloc(type)
Allocate and initialize and instance of type.
Condition * init(Condition *self)
Initializes this Condition.
void appendBytes(MutableData *self, const uint8_t *bytes, size_t length)
Appends the given bytes to this Data.