ObjFW
src/OFTCPSocket.h
00001 /*
00002  * Copyright (c) 2008, 2009, 2010, 2011, 2012
00003  *   Jonathan Schleifer <js@webkeks.org>
00004  *
00005  * All rights reserved.
00006  *
00007  * This file is part of ObjFW. It may be distributed under the terms of the
00008  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
00009  * the packaging of this file.
00010  *
00011  * Alternatively, it may be distributed under the terms of the GNU General
00012  * Public License, either version 2 or 3, which can be found in the file
00013  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
00014  * file.
00015  */
00016 
00017 #ifndef __STDC_LIMIT_MACROS
00018 # define __STDC_LIMIT_MACROS
00019 #endif
00020 #ifndef __STDC_CONSTANT_MACROS
00021 # define __STDC_CONSTANT_MACROS
00022 #endif
00023 
00024 #ifndef _WIN32
00025 # include <sys/types.h>
00026 # include <sys/socket.h>
00027 # include <netdb.h>
00028 #endif
00029 
00030 #import "OFStreamSocket.h"
00031 
00032 #ifdef _WIN32
00033 # include <ws2tcpip.h>
00034 #endif
00035 
00036 @class OFString;
00037 
00044 @interface OFTCPSocket: OFStreamSocket
00045 {
00046         BOOL                    listening;
00047         struct sockaddr_storage *sockAddr;
00048         socklen_t               sockAddrLen;
00049         OFString                *SOCKS5Host;
00050         uint16_t                SOCKS5Port;
00051 }
00052 
00053 #ifdef OF_HAVE_PROPERTIES
00054 @property (readonly, getter=isListening) BOOL listening;
00055 @property (copy) OFString *SOCKS5Host;
00056 @property uint16_t SOCKS5Port;
00057 #endif
00058 
00064 + (void)setSOCKS5Host: (OFString*)host;
00065 
00071 + (OFString*)SOCKS5Host;
00072 
00078 + (void)setSOCKS5Port: (uint16_t)port;
00079 
00085 + (uint16_t)SOCKS5Port;
00086 
00092 - (void)setSOCKS5Host: (OFString*)host;
00093 
00099 - (OFString*)SOCKS5Host;
00100 
00108 - (void)setSOCKS5Port: (uint16_t)port;
00109 
00115 - (uint16_t)SOCKS5Port;
00116 
00123 - (void)connectToHost: (OFString*)host
00124                  port: (uint16_t)port;
00125 
00135 - (uint16_t)bindToHost: (OFString*)host
00136                   port: (uint16_t)port;
00137 
00143 - (void)listenWithBackLog: (int)backLog;
00144 
00148 - (void)listen;
00149 
00155 - (OFTCPSocket*)accept;
00156 
00162 - (void)setKeepAlivesEnabled: (BOOL)enable;
00163 
00171 - (OFString*)remoteAddress;
00172 
00178 - (BOOL)isListening;
00179 @end
 All Classes Functions Variables Properties