/Volumes/Plantain/MyDocuments/Projects/MacTrek/MacTrek/FrameWorks/OmniNetworking.framework/Headers/ONPortAddress.h

00001 // Copyright 1997-2005 Omni Development, Inc.  All rights reserved.
00002 //
00003 // This software may only be used and reproduced according to the
00004 // terms in the file OmniSourceLicense.html, which should be
00005 // distributed with this project and can also be found at
00006 // <http://www.omnigroup.com/developer/sourcecode/sourcelicense/>.
00007 //
00008 // $Header: svn+ssh://source.omnigroup.com/Source/svn/Omni/tags/SourceRelease_2005-11-18/OmniGroup/Frameworks/OmniNetworking/ONPortAddress.h 68913 2005-10-03 19:36:19Z kc $
00009 
00010 //
00011 // This class was not part of the original design, and it clearly suffers as a result.  For example, it doesn't handle multiple host addresses at all.  I'm tempted to remove it altogether, but it does serve a useful purpose and while I don't have time to fix it right now it might be useful to some.
00012 //
00013 // But it does really bug me in that it duplicates some of the logic from ONInternetSocket, and in a less robust manner.
00014 // 
00015 // Right now, the only time you would want to use this class is when sending lots of messages to lots of differing hosts via an unconnected ONUDPSocket (for example, if you were talking to lots of Quake servers via a single socket).
00016 //
00017 // Eventually, I think I'd like to replace this with an object that stores an ONHost and a port number, has some mechanism for  looping through addresses (or selecting a preferred one), and perhaps caches the socketaddr_in structure for each.
00018 // 
00019 
00020 #import <OmniBase/OBObject.h>
00021 
00022 @class ONHostAddress;
00023 @class ONHost;
00024 
00025 @interface ONPortAddress : OBObject <NSCoding, NSCopying>
00026 {
00027     struct sockaddr *portAddress;
00028 }
00029 
00030 - initWithHost:(ONHost *)aHost portNumber:(unsigned short int)port;
00031 - initWithHostAddress:(ONHostAddress *)hostAddress portNumber:(unsigned short int)port;
00032 - initWithSocketAddress:(const struct sockaddr *)newPortAddress;
00033 
00034 - (int)addressFamily;
00035 - (const struct sockaddr *)portAddress;
00036 - (ONHostAddress *)hostAddress;
00037 - (unsigned short int)portNumber;
00038 - (BOOL)isMulticastAddress;
00039 
00040 // - (BOOL)hasSameHostAddressAsHostAddress: (ONHostAddress *)hostAddress;
00041 - (BOOL)isEqualToSocketAddress:(const struct sockaddr *)otherPortAddress;
00042 
00043 @end
00044 
00045 #import "FrameworkDefines.h"
00046 
00047 // Exceptions which may be raised by this class
00048 OmniNetworking_EXTERN NSString *ONInternetSocketConnectFailedExceptionName;

Generated on Fri Jul 28 19:15:20 2006 for MacTrek by  doxygen 1.4.7