ObjFW
OFTCPSocketSOCKS5Connector.h
1 /*
2  * Copyright (c) 2008-2023 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This file is part of ObjFW. It may be distributed under the terms of the
7  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8  * the packaging of this file.
9  *
10  * Alternatively, it may be distributed under the terms of the GNU General
11  * Public License, either version 2 or 3, which can be found in the file
12  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13  * file.
14  */
15 
16 #import "OFTCPSocket.h"
17 
18 OF_ASSUME_NONNULL_BEGIN
19 
20 @class OFString;
21 
22 @interface OFTCPSocketSOCKS5Connector: OFObject <OFTCPSocketDelegate>
23 {
24  OFTCPSocket *_socket;
25  OFString *_host;
26  uint16_t _port;
27  id <OFTCPSocketDelegate> _Nullable _delegate;
28 #ifdef OF_HAVE_BLOCKS
29  OFTCPSocketAsyncConnectBlock _Nullable _block;
30 #endif
31  id _Nullable _exception;
32  uint_least8_t _SOCKS5State;
33  /* Longest read is domain name (max 255 bytes) + port */
34  unsigned char _buffer[257];
35  OFMutableData *_Nullable _request;
36 }
37 
38 - (instancetype)initWithSocket: (OFTCPSocket *)sock
39  host: (OFString *)host
40  port: (uint16_t)port
41  delegate: (nullable id <OFTCPSocketDelegate>)delegate
42 #ifdef OF_HAVE_BLOCKS
43  block: (nullable OFTCPSocketAsyncConnectBlock)block
44 #endif
45 ;
46 - (void)didConnect;
47 @end
48 
49 OF_ASSUME_NONNULL_END
void(^ OFTCPSocketAsyncConnectBlock)(id exception)
A block which is called when the socket connected.
Definition: OFTCPSocket.h:33
A class for storing and manipulating arbitrary data in an array.
Definition: OFMutableData.h:26
The root class for all other classes inside ObjFW.
Definition: OFObject.h:688
A class for handling strings.
Definition: OFString.h:135
A class which provides methods to create and use TCP sockets.
Definition: OFTCPSocket.h:67
Definition: OFTCPSocket.h:41