00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #if !defined(SOCKET_OL_GUARD)
00044 #define SOCKET_OL_GUARD
00045
00057 #include <ObjectiveLib/SocketAddress.h>
00058
00059 @class OLInStream;
00060 @class OLOutStream;
00061
00070 @interface OLSocket :
00071 #if defined(OL_NO_OPENSTEP)
00072 Object
00073 #else
00074 NSObject
00075 #endif
00076 {
00077 @protected
00081 OLInStream* inStream;
00082
00086 OLOutStream* outStream;
00087
00091 int fd;
00092 }
00093
00097
00101 #if defined(OL_NO_OPENSTEP)
00102 - (id) free;
00103 #else
00104 - (void) dealloc;
00105 #endif
00106
00107
00117 - (BOOL) allowsBroadcast;
00118
00125 - (void) close;
00126
00136 - (BOOL) dontRoute;
00137
00151 - (BOOL) hasReusePortSupport;
00152
00163 - (OLInStream*) inStream;
00164
00175 - (BOOL) keepAlive;
00176
00190 - (unsigned) linger;
00191
00201 - (OLSocketAddress*) localAddress;
00202
00213 - (BOOL) outOfBandInline;
00214
00225 - (OLOutStream*) outStream;
00226
00236 - (unsigned) receiveBufferSize;
00237
00247 - (unsigned) receiveLowWaterMark;
00248
00258 - (unsigned) receiveTimeOut;
00259
00269 - (OLSocketAddress*) remoteAddress;
00270
00280 - (BOOL) reuseAddress;
00281
00295 - (BOOL) reusePort;
00296
00306 - (unsigned) sendBufferSize;
00307
00317 - (unsigned) sendLowWaterMark;
00318
00328 - (unsigned) sendTimeOut;
00329
00339 - (void) setAllowsBroadcast: (BOOL)state;
00340
00350 - (void) setDontRoute: (BOOL)state;
00351
00362 - (void) setKeepAlive: (BOOL)state;
00363
00379 - (void) setLinger: (unsigned)value;
00380
00391 - (void) setOutOfBandInline: (BOOL)state;
00392
00401 - (void) setReceiveBufferSize: (unsigned)size;
00402
00412 - (void) setReceiveLowWaterMark: (unsigned)value;
00413
00423 - (void) setReceiveTimeOut: (unsigned)value;
00424
00434 - (void) setReuseAddress: (BOOL)state;
00435
00449 - (void) setReusePort: (BOOL)state;
00450
00459 - (void) setSendBufferSize: (unsigned)size;
00460
00470 - (void) setSendLowWaterMark: (unsigned)value;
00471
00481 - (void) setSendTimeOut: (unsigned)value;
00482
00489 - (void) shutdownRead;
00490
00497 - (void) shutdownWrite;
00498
00507 - (int) socketType;
00508
00509 @end
00510
00518 @interface OLBindableSocket : OLSocket
00519 {
00520 }
00521
00529 - (void) bindToAddress: (OLSocketAddress*)address;
00530
00531 @end
00532
00547 @interface OLServerSocket : OLBindableSocket
00548 {
00549 @protected
00553 unsigned queueLength;
00554 }
00555
00559
00567 - (id) init;
00568
00577 - (id) initWithLocalAddress: (OLSocketAddress*)address;
00578
00588 - (id) initWithLocalAddress: (OLSocketAddress*)address queueLength: (unsigned)qLen;
00589
00598 - (id) initWithQueueLength: (unsigned)qLen;
00599
00600
00608 - (OLSocket*) acceptConnection;
00609 - (void) bindToAddress: (OLSocketAddress*)address;
00610
00617 - (unsigned) queueLength;
00618
00619 @end
00620
00637 @interface OLClientSocket : OLBindableSocket
00638 {
00639 }
00640
00644
00651 - (id) init;
00652
00661 - (id) initWithRemoteAddress: (OLSocketAddress*)remote;
00662
00672 - (id) initWithRemoteAddress: (OLSocketAddress*)remote localAddress: (OLSocketAddress*)local;
00673
00674
00681 - (void) connectToAddress: (OLSocketAddress*)address;
00682
00683 @end
00684
00697 @interface OLInternetServerSocket : OLServerSocket
00698 {
00699 }
00700
00705 #if defined(OL_NO_OPENSTEP)
00706 + (id) initialize;
00707 #else
00708 + (void) initialize;
00709 #endif
00710
00718 + (id) socket;
00719
00728 + (id) socketWithLocalInternetAddress: (OLInternetAddress*)address;
00729
00739 + (id) socketWithLocalInternetAddress: (OLInternetAddress*)address queueLength: (unsigned)qLen;
00740
00749 + (id) socketWithQueueLength: (unsigned)qLen;
00750
00751 @end
00752
00765 @interface OLInternetClientSocket : OLClientSocket
00766 {
00767 }
00768
00773 #if defined(OL_NO_OPENSTEP)
00774 + (id) initialize;
00775 #else
00776 + (void) initialize;
00777 #endif
00778
00785 + (id) socket;
00786
00795 + (id) socketWithRemoteInternetAddress: (OLInternetAddress*)remote;
00796
00806 + (id) socketWithRemoteInternetAddress: (OLInternetAddress*)remote localAddress: (OLInternetAddress*)local;
00807
00808 @end
00809
00810 #if defined(OL_HAVE_UNIX_SOCKETS)
00811
00822 @interface OLUnixServerSocket : OLServerSocket
00823 {
00824 @protected
00828 OLUnixAddress* localAddress;
00829 }
00830
00835 + (id) socket;
00836
00841 + (id) socketWithLocalUnixAddress: (OLUnixAddress*)address;
00842
00847 + (id) socketWithLocalUnixAddress: (OLUnixAddress*)address queueLength: (unsigned)qLen;
00848
00853 + (id) socketWithQueueLength: (unsigned)qLen;
00854
00855 - (void) bindToAddress: (OLSocketAddress*)address;
00856 - (void) close;
00857 - (OLSocketAddress*) localAddress;
00858
00859 @end
00860
00873 @interface OLUnixClientSocket : OLClientSocket
00874 {
00875 }
00876
00881 + (id) socket;
00882
00887 + (id) socketWithRemoteUnixAddress: (OLUnixAddress*)remote;
00888
00893 + (id) socketWithRemoteUnixAddress: (OLUnixAddress*)remote localAddress: (OLUnixAddress*)local;
00894
00895 - (void) bindToAddress: (OLSocketAddress*)address;
00896
00897 @end
00898
00899 #endif
00900
00901 #endif