ObjFW
OFRunLoop+Private.h
1 /*
2  * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015
3  * Jonathan Schleifer <js@webkeks.org>
4  *
5  * All rights reserved.
6  *
7  * This file is part of ObjFW. It may be distributed under the terms of the
8  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
9  * the packaging of this file.
10  *
11  * Alternatively, it may be distributed under the terms of the GNU General
12  * Public License, either version 2 or 3, which can be found in the file
13  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
14  * file.
15  */
16 
17 #import "OFRunLoop.h"
18 #import "OFStream.h"
19 #ifdef OF_HAVE_SOCKETS
20 # import "OFUDPSocket.h"
21 #endif
22 
23 OF_ASSUME_NONNULL_BEGIN
24 
25 @interface OFRunLoop (OF_PRIVATE_CATEGORY)
26 + (void)OF_setMainRunLoop: (OFRunLoop*)runLoop;
27 #ifdef OF_HAVE_SOCKETS
28 + (void)OF_addAsyncReadForStream: (OFStream*)stream
29  buffer: (void*)buffer
30  length: (size_t)length
31  target: (id)target
32  selector: (SEL)selector;
33 + (void)OF_addAsyncReadForStream: (OFStream*)stream
34  buffer: (void*)buffer
35  exactLength: (size_t)length
36  target: (id)target
37  selector: (SEL)selector;
38 + (void)OF_addAsyncReadLineForStream: (OFStream*)stream
39  encoding: (of_string_encoding_t)encoding
40  target: (id)target
41  selector: (SEL)selector;
42 + (void)OF_addAsyncAcceptForTCPSocket: (OFTCPSocket*)socket
43  target: (id)target
44  selector: (SEL)selector;
45 + (void)OF_addAsyncReceiveForUDPSocket: (OFUDPSocket*)socket
46  buffer: (void*)buffer
47  length: (size_t)length
48  target: (id)target
49  selector: (SEL)selector;
50 # ifdef OF_HAVE_BLOCKS
51 + (void)OF_addAsyncReadForStream: (OFStream*)stream
52  buffer: (void*)buffer
53  length: (size_t)length
54  block: (of_stream_async_read_block_t)block;
55 + (void)OF_addAsyncReadForStream: (OFStream*)stream
56  buffer: (void*)buffer
57  exactLength: (size_t)length
58  block: (of_stream_async_read_block_t)block;
59 + (void)OF_addAsyncReadLineForStream: (OFStream*)stream
60  encoding: (of_string_encoding_t)encoding
62 + (void)OF_addAsyncAcceptForTCPSocket: (OFTCPSocket*)socket
64  block;
65 + (void)OF_addAsyncReceiveForUDPSocket: (OFUDPSocket*)socket
66  buffer: (void*)buffer
67  length: (size_t)length
69  block;
70 # endif
71 + (void)OF_cancelAsyncRequestsForObject: (id)object;
72 #endif
73 - (void)OF_removeTimer: (OFTimer*)timer;
74 @end
75 
76 OF_ASSUME_NONNULL_END
A class which provides functions to create and use UDP sockets.
Definition: OFUDPSocket.h:89
of_string_encoding_t
The encoding of a string.
Definition: OFString.h:50
bool(^ of_stream_async_read_block_t)(OFStream *stream, void *buffer, size_t length, OFException *OF_NULLABLE exception)
A block which is called when data was read from the stream.
Definition: OFStream.h:50
A base class for different types of streams.
Definition: OFStream.h:86
bool(^ of_stream_async_read_line_block_t)(OFStream *stream, OFString *OF_NULLABLE line, OFException *OF_NULLABLE exception)
A block which is called when a line was read from the stream.
Definition: OFStream.h:62
A class which provides functions to create and use TCP sockets.
Definition: OFTCPSocket.h:61
A class for creating and firing timers.
Definition: OFTimer.h:44
bool(^ of_tcp_socket_async_accept_block_t)(OFTCPSocket *socket, OFTCPSocket *acceptedSocket, OFException *OF_NULLABLE exception)
A block which is called when the socket accepted a connection.
Definition: OFTCPSocket.h:49
A class providing a run loop for the application and its processes.
Definition: OFRunLoop.h:40
bool(^ of_udp_socket_async_receive_block_t)(OFUDPSocket *socket, void *buffer, size_t length, of_udp_socket_address_t sender, OFException *OF_NULLABLE exception)
A block which is called when a packet has been received.
Definition: OFUDPSocket.h:65