2 Copyright (C) 2000-2004 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
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
22 #include "NGInternetSocketDomain.h"
23 #include "NGInternetSocketAddress.h"
27 # include <netinet/in.h>
30 @implementation NGInternetSocketDomain
32 static NGInternetSocketDomain *domain = nil;
38 if (domain == nil) domain = [[NGInternetSocketDomain alloc] init];
46 - (id<NGSocketAddress>)addressWithRepresentation:(void *)_data
47 size:(unsigned int)_size
49 NGInternetSocketAddress *address = nil;
51 if ((unsigned int)[self addressRepresentationSize] != _size) {
52 NSLog(@"%@: invalid address size %i ..", NSStringFromSelector(_cmd), _size);
56 address = [[NGInternetSocketAddress allocWithZone:[self zone]]
58 internalRepresentation:_data
60 return [address autorelease];
63 - (BOOL)prepareAddress:(id<NGSocketAddress>)_address
64 forBindWithSocket:(id<NGSocket>)_socket
69 - (BOOL)cleanupAddress:(id<NGSocketAddress>)_address
70 afterCloseOfSocket:(id<NGSocket>)_socket
80 - (int)addressRepresentationSize {
81 return sizeof(struct sockaddr_in);
90 - (id)copyWithZone:(NSZone *)_zone {
91 /* domain objects are immutable, just retain on copy */
97 - (void)encodeWithCoder:(NSCoder *)_encoder {
99 - (id)initWithCoder:(NSCoder *)_decoder {
100 [self release]; self = nil;
101 return [domain retain];
104 - (id)awakeAfterUsingCoder:(NSCoder *)_decoder {
105 if (self != domain) {
106 [self release]; self = nil;
107 return [domain retain];
115 - (NSString *)description {
116 return [NSString stringWithFormat:@"<InternetDomain[0x%08X]>", (unsigned)self];
119 @end /* NGInternetSocketDomain */