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/ONMulticastSocket.h 68913 2005-10-03 19:36:19Z kc $ 00009 00010 #import "ONUDPSocket.h" 00011 #import "FrameworkDefines.h" 00012 00013 // 00014 // Much of the information in this header was taken from: 00015 // 00016 // IP Multicast Extensions 00017 // for 4.3BSD UNIX and related systems 00018 // (MULTICAST 1.2 Release) 00019 // 00020 // June 24, 1989 00021 // 00022 // Steve Deering 00023 // Stanford University 00024 // <deering@pescadero.Stanford.EDU> 00025 // 00026 00027 @interface ONMulticastSocket : ONUDPSocket 00028 { 00029 int mcastTTL; // Requested TTL for multicast packets, or -1 if not specified by caller 00030 struct { 00031 unsigned int shouldLoop: 2; 00032 } mcastFlags; 00033 } 00034 00035 + (unsigned int)maximumGroupMemberships; 00036 // Returns the maximum number of groups of which a single socket may be made a member. 00037 00038 - (void)setSendTimeToLive:(unsigned char)ttl; 00039 // multicast datagrams with initial TTL of: 00040 // 0 are restricted to the same host 00041 // 1 are restricted to the same subnet 00042 // 32 are restricted to the same site 00043 // 64 are restricted to the same region 00044 // 128 are restricted to the same continent 00045 // 255 are unrestricted in scope 00046 00047 - (void)joinReceiveGroup:(ONHostAddress *)groupAddress localInterface:(ONInterface *)localInterface; 00048 // Before a host can receive IP multicast datagrams, it must become a member of one or more IP multicast groups. This call attempts to join the specified group on the specified local interface. Messages to this group received on other interfaces will not be delivered to the socket. Valid addresses are those between 224.0.0.0 and 239.255.255.255. 00049 00050 - (void)leaveReceiveGroup:(ONHostAddress *)groupAddress localInterface:(ONInterface *)localInterface; 00051 // Removes the socket from the specified group on the localInterface. 00052 00053 - (void)joinReceiveGroup:(ONHostAddress *)groupAddress; 00054 // Joins the specified group on the default local interface. 00055 00056 - (void)leaveReceiveGroup:(ONHostAddress *)groupAddress; 00057 // Leaves the specified group on the default local interface. 00058 00059 #if 0 00060 - (void)setSendMulticastInterface:(ONHostAddress *)interfaceAddress; 00061 // If the local host has multiple interfaces that support multicast, this specifies which interface will be used to send outgoing datagrams. If interfaceAddress is nil, the default interface will be used. 00062 #endif 00063 00064 - (void)setShouldLoopMessagesToMemberGroups:(BOOL)shouldLoop; 00065 // If a message is set to a group to which the sending host itself belongs, by default a coup of the datagram is looped back by the IP layer for local delivery. This allows this looping behaviour to be configured. 00066 // 00067 // A multicast datagram sent with an initial TTL greater than 1 may be delivered to the sending host on a different interface from that on which it was sent, if the host belongs to the destination group on that other interface. The loopback control option has no effect on such delivery. 00068 00069 #if 0 00070 // Potential additions to the API 00071 00072 - (NSArray *)currentMemberships; 00073 // Returns an array of ONHostAddresses for which the receiver is a member. This is sort of ugly though since it wouldn't specify which interface the receiver was joined on. 00074 00075 #endif 00076 00077 @end 00078 00079 // Exceptions which may be raised by this class 00080 OmniNetworking_EXTERN NSString *ONMulticastSocketNonMulticastAddress; 00081 OmniNetworking_EXTERN NSString *ONMulticastSocketSetTimeToLiveFailed; 00082 OmniNetworking_EXTERN NSString *ONMulticastSocketGroupMembershipOperationFailed; 00083 OmniNetworking_EXTERN NSString *ONMulticastSocketSendInterfaceSelectionFailed; 00084 OmniNetworking_EXTERN NSString *ONMulticastSocketFailedToSelectLooping;