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_NGSocketProtocols_H__
24 #define __NGNet_NGSocketProtocols_H__
26 #import <Foundation/NSObject.h>
27 #include <NGStreams/NGStreamProtocols.h>
33 @protocol NGSocketAddress < NSObject >
35 - (void *)internalAddressRepresentation;
36 - (int)addressRepresentationSize;
37 - (id)domain; // (a NGSocketDomain)
39 // needed by socket address factory:
40 - (id)initWithDomain:(id)_domain
41 internalRepresentation:(void *)_representation
48 @protocol NGSocket < NSObject >
50 - (id<NGSocketAddress>)localAddress;
51 - (BOOL)bindToAddress:(id<NGSocketAddress>)_localAddress;
54 - (NSException *)lastException;
60 @protocol NGSocketDomain < NSObject >
62 - (id<NGSocketAddress>)addressWithRepresentation:(void *)_data
63 size:(unsigned int)_size;
66 - (int)addressRepresentationSize;
69 // these two methods manage resources associated with addresses
70 // (primarily the files used for AF_LOCAL sockets)
71 - (BOOL)prepareAddress:(id<NGSocketAddress>)_address
72 forBindWithSocket:(id<NGSocket>)_socket;
73 - (BOOL)cleanupAddress:(id<NGSocketAddress>)_address
74 afterCloseOfSocket:(id<NGSocket>)_socket;
80 @protocol NGActiveSocket < NGSocket, NGStream, NGByteSequenceStream >
82 - (BOOL)connectToAddress:(id<NGSocketAddress>)_address;
87 - (id<NGSocketAddress>)remoteAddress;
91 @protocol NGPassiveSocket < NGSocket >
93 - (BOOL)listenWithBacklog:(int)_backlogSize;
94 - (id<NGActiveSocket>)accept;
100 @protocol NGDatagramPacket < NSObject >
102 - (void)setSender:(id<NGSocketAddress>)_address;
103 - (id<NGSocketAddress>)sender;
104 - (void)setReceiver:(id<NGSocketAddress>)_address;
105 - (id<NGSocketAddress>)receiver;
111 @protocol NGDatagramPacketFactory < NSObject >
113 - (id<NGDatagramPacket>)packetWithData:(NSData *)_data;
115 - (id<NGDatagramPacket>)
116 packetWithBytes:(const void *)_bytes
117 size:(int)_packetSize;
121 #endif /* __NGNet_NGSocketProtocols_H__ */