GCKNetworkAddress Class

GCKNetworkAddress Class Reference

Overview

An object that represents a network IP address.

This object is immutable.

Since
4.2

Inherits NSObject, <NSCopying>, and <NSSecureCoding>.

Instance Method Summary

(instancetype) - init
 Using the default initializer is not allowed. More...
 
(instancetype) - initWithType:ipAddress:
 Constructs a GCKNetworkAddress with the given address type and IP address. More...
 
(instancetype) - initWithType:addressData:
 Constructs a GCKNetworkAddress with the given address type and raw address. More...
 

Class Method Summary

(GCKNetworkAddress *) + wildcardAddressOfType:
 Constructs a wildcard address of the given type. More...
 
(GCKNetworkAddress *) + loopbackAddressOfType:
 Constructs a loopback address of the given type. More...
 
(GCKNetworkAddress *) + IPv4BroadcastAddress
 Constructs an IPv4 broadcast address. More...
 
(GCKNetworkAddress *) + addressWithIPv4Address:
 Constructs an IPv4 address. More...
 
(GCKNetworkAddress *) + addressWithIPv6Address:
 Constructs an IPv6 address. More...
 
(GCKNetworkAddress *) + addressWithIPCPath:
 Constructs an IPC address. More...
 

Property Summary

GCKNetworkAddressType type
 The address type. More...
 
NSString * ipAddress
 The IP address. More...
 
NSData * addressData
 The network address as an NSData containing the appropriate address structure (e.g., struct in_addr or struct in6_addr). More...
 

Method Detail

- (instancetype) init

Using the default initializer is not allowed.

- (instancetype) initWithType: (GCKNetworkAddressType)  type
ipAddress: (nullable NSString *)  ipAddress 

Constructs a GCKNetworkAddress with the given address type and IP address.

Parameters
typeThe address type.
ipAddressThe IP address, in textual form. May be nil to indicate the wildcard ("any") address.
- (instancetype) initWithType: (GCKNetworkAddressType)  type
addressData: (nullable NSData *)  addressData 

Constructs a GCKNetworkAddress with the given address type and raw address.

Parameters
typeThe address type.
addressDataAn NSData object containing the appropriate address structure (e.g., struct in_addr or struct in6_addr). For the GCKNNetworkAddressTypeIPC, the data is expected to be a UTF8 encoding.
+ (GCKNetworkAddress *) wildcardAddressOfType: (GCKNetworkAddressType)  type

Constructs a wildcard address of the given type.

+ (GCKNetworkAddress *) loopbackAddressOfType: (GCKNetworkAddressType)  type

Constructs a loopback address of the given type.

+ (GCKNetworkAddress *) IPv4BroadcastAddress

Constructs an IPv4 broadcast address.

+ (GCKNetworkAddress *) addressWithIPv4Address: (NSString *)  ipAddress

Constructs an IPv4 address.

+ (GCKNetworkAddress *) addressWithIPv6Address: (NSString *)  ipAddress

Constructs an IPv6 address.

+ (GCKNetworkAddress *) addressWithIPCPath: (NSString *)  path

Constructs an IPC address.

Property Detail

- (GCKNetworkAddressType) type
readnonatomicassign

The address type.

- (NSString*) ipAddress
readnonatomiccopy

The IP address.

- (NSData*) addressData
readnonatomiccopy

The network address as an NSData containing the appropriate address structure (e.g., struct in_addr or struct in6_addr).

For the address type IPC, this field is a UTF8 encoding.