AI-generated Key Takeaways
-
GCKNetworkAddress is an immutable object representing a network IP address.
-
The class provides instance methods to initialize a network address with a type and either an IP address string or raw address data.
-
The default initializer for GCKNetworkAddress is not allowed.
-
Class methods are available to construct specific types of network addresses like wildcard, loopback, IPv4 broadcast, IPv4, IPv6, and IPC addresses.
-
Key properties of GCKNetworkAddress include its type, IP address string, and raw address data.
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
-
type The address type. ipAddress The IP address, in textual form. May be nilto 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
-
type The address type. addressData An 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
|
readnonatomicassign |
The address type.
|
readnonatomiccopy |
The IP address.
|
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.