Wired Networking  2.0
Wired Networking is an Objective-C implementation of the Wired protocol for Mac OS X
WIAddress.h
00001 /* $Id$ */
00002 
00003 /*
00004  *  Copyright (c) 2006-2009 Axel Andersson
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions
00009  *  are met:
00010  *  1. Redistributions of source code must retain the above copyright
00011  *     notice, this list of conditions and the following disclaimer.
00012  *  2. Redistributions in binary form must reproduce the above copyright
00013  *     notice, this list of conditions and the following disclaimer in the
00014  *     documentation and/or other materials provided with the distribution.
00015  *
00016  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00017  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00018  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
00020  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00021  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00022  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00023  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
00024  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00025  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00026  * POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00029 enum _WIAddressFamily {
00030         WIAddressNull                                   = WI_ADDRESS_NULL,
00031         WIAddressIPv4                                   = WI_ADDRESS_IPV4,
00032         WIAddressIPv6                                   = WI_ADDRESS_IPV6
00033 };
00034 typedef enum _WIAddressFamily           WIAddressFamily;
00035 
00036 
00037 @class WIError;
00038 
00039 @interface WIAddress : WIObject {
00040         wi_address_t                                    *_address;
00041         
00042         NSString                                                *_string;
00043 }
00044 
00045 + (WIAddress *)addressWildcardForFamily:(WIAddressFamily)family;
00046 + (WIAddress *)addressWithString:(NSString *)address error:(WIError **)error;
00047 + (WIAddress *)addressWithNetService:(NSNetService *)netService error:(WIError **)error;
00048 
00049 - (id)initWildcardForFamily:(WIAddressFamily)family;
00050 - (id)initWithString:(NSString *)address error:(WIError **)error;
00051 - (id)initWithNetService:(NSNetService *)netService error:(WIError **)error;
00052 
00053 - (void)setPort:(NSUInteger)port;
00054 - (NSUInteger)port;
00055 
00056 - (WIAddressFamily)family;
00057 - (NSString *)string;
00058 - (NSString *)hostname;
00059 - (struct sockaddr *)sockAddr;
00060 
00061 @end
00062 
00063 
00064 @interface WIAddress(WISocketAdditions)
00065 
00066 - (id)initWithAddress:(wi_address_t *)address;
00067 - (wi_address_t *)address;
00068 
00069 @end
 All Classes