2 Copyright (C) 2000-2003 SKYRIX Software AG
4 This file is part of OGo
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #ifndef __NGNet_NGSocketExceptions_H__
24 #define __NGNet_NGSocketExceptions_H__
26 #import <Foundation/NSException.h>
27 #include <NGStreams/NGStreamExceptions.h>
28 #include <NGStreams/NGSocketProtocols.h>
36 NGSocketAlreadyBoundException
37 NGCouldNotBindSocketException
38 NGSocketConnectionException
39 NGSocketNotConnectedException
40 NGSocketAlreadyConnectedException
41 NGCouldNotConnectException
42 NGSocketOptionException
43 NGCouldNotSetSocketOptionException
44 NGCouldNotGetSocketOptionException
45 NGCouldNotResolveHostNameException
46 NGDidNotFindServiceException
47 NGSocketIsAlreadyListeningException
48 NGCouldNotListenException
49 NGCouldNotAcceptException
50 NGInvalidSocketDomainException
51 NGCouldNotCreateSocketException
53 NGEndOfStreamException
54 NGSocketShutdownException
55 NGSocketShutdownDuringReadException
56 NGSocketShutdownDuringWriteException
57 NGSocketConnectionResetException
58 NGSocketTimedOutException
61 @interface NGSocketException : NGIOException
68 - (id)initWithReason:(NSString *)_reason;
69 - (id)initWithReason:(NSString *)_reason socket:(id<NGSocket>)_socket;
71 - (id<NGSocket>)socket;
75 @interface NGCouldNotResolveHostNameException : NGSocketException
81 - (id)initWithHostName:(NSString *)_name reason:(NSString *)_reason;
83 - (NSString *)hostName;
87 @interface NGDidNotFindServiceException : NGSocketException
90 NSString *serviceName;
94 - (id)initWithServiceName:(NSString *)_service;
96 - (NSString *)serviceName;
100 @interface NGInvalidSocketDomainException : NGSocketException
103 id<NGSocketDomain> domain;
106 - (id)initWithReason:(NSString *)_reason
107 socket:(id<NGSocket>)_socket domain:(id<NGSocketDomain>)_domain;
111 @interface NGCouldNotCreateSocketException : NGSocketException
114 id<NGSocketDomain> domain;
118 - (id)initWithReason:(NSString *)_reason domain:(id<NGSocketDomain>)_domain;
122 // ******************** bind ***********************
124 @interface NGSocketBindException : NGSocketException
127 @interface NGSocketAlreadyBoundException : NGSocketBindException
130 @interface NGCouldNotBindSocketException : NGSocketBindException
133 id<NGSocketAddress> address;
136 - (id)initWithReason:(NSString *)_reason
137 socket:(id<NGSocket>)_socket address:(id<NGSocketAddress>)address;
139 - (id<NGSocketAddress>)address;
143 // ******************** connect ********************
145 @interface NGSocketConnectException : NGSocketException
148 @interface NGSocketNotConnectedException : NGSocketConnectException
151 @interface NGSocketAlreadyConnectedException : NGSocketConnectException
154 @interface NGCouldNotConnectException : NGSocketConnectException
157 id<NGSocketAddress> address;
160 - (id)initWithReason:(NSString *)_reason
161 socket:(id<NGActiveSocket>)_socket
162 address:(id<NGSocketAddress>)address;
164 - (id<NGSocketAddress>)address;
168 // ******************** listen ********************
170 @interface NGSocketIsAlreadyListeningException : NGSocketException
173 @interface NGCouldNotListenException : NGSocketException
176 // ******************** accept ********************
178 @interface NGCouldNotAcceptException : NGSocketException
181 // ******************** options ********************
183 @interface NGSocketOptionException : NGSocketException
191 - (id)initWithReason:(NSString *)_reason option:(int)_option level:(int)_level;
195 @interface NGCouldNotSetSocketOptionException : NGSocketOptionException
198 @interface NGCouldNotGetSocketOptionException : NGSocketOptionException
201 // ******************** socket closed **************
203 @interface NGSocketShutdownException : NGEndOfStreamException
205 - (id)initWithReason:(NSString *)_reason;
206 - (id)initWithReason:(NSString *)_reason socket:(id<NGActiveSocket>)_socket;
207 - (id)initWithSocket:(id<NGActiveSocket>)_socket;
209 /* Note: this only returns a valid ptr, if the socket is still retained ! */
210 - (id<NGActiveSocket>)socket;
214 @interface NGSocketShutdownDuringReadException : NGSocketShutdownException
217 @interface NGSocketShutdownDuringWriteException : NGSocketShutdownException
220 @interface NGSocketTimedOutException : NGSocketShutdownException
223 @interface NGSocketConnectionResetException : NGSocketShutdownException
226 #endif /* __NGNet_NGSocketExceptions_H__ */