CBLNetworkConfigurationHelper

Objective-C


@interface CBLNetworkConfigurationHelper : NSObject

Swift

class NetworkConfigurationHelper : NSObject

Helper class for working with the local device’s network configuration.

  • Returns all of the active network interfaces for the machine.

    Declaration

    Objective-C

    + (NSArray<NSString *> *_Nonnull)allInterfaces;

    Swift

    class func allInterfaces() -> [String]
  • Returns the interface most likely to be used for camera communication.

    Declaration

    Objective-C

    + (NSString *_Nullable)suggestedInterfaceForCameraCommunication;

    Swift

    class func suggestedInterfaceForCameraCommunication() -> String?
  • Returns the interface for accessing the given IP.

    Equivalent to calling +[CBLNetworkConfigurationHelper interfaceForAccessingIPAddress:ip requiringLocalMatch:NO].

    Declaration

    Objective-C

    + (NSString *_Nullable)interfaceForAccessingIPAddress:(NSString *_Nonnull)ip;

    Swift

    class func interface(forAccessingIPAddress ip: String) -> String?

    Parameters

    ip

    The IP address to access.

  • Returns the interface for accessing the given IP, optionally requiring a local network match is found.

    Declaration

    Objective-C

    + (NSString *_Nullable)interfaceForAccessingIPAddress:(NSString *_Nonnull)ip
                                      requiringLocalMatch:(BOOL)mustBeSameSubnet;

    Swift

    class func interface(forAccessingIPAddress ip: String, requiringLocalMatch mustBeSameSubnet: Bool) -> String?

    Parameters

    ip

    The IP address to access.

    mustBeSameSubnet

    Pass YES to require that the returned interface directly matches against the given IP address, otherwise NO. If YES is passed and no local match is found, nil wil be returned. Otherwise, the default internet-accessing interface will be returned (which may still be nil.

  • Returns the gateway/router address for the given interface. For self-hosting cameras, this is where you’ll connect.

    Declaration

    Objective-C

    + (NSString *_Nullable)ipAddressOfGatewayForInterface:
        (NSString *_Nonnull)interface;

    Swift

    class func ipAddressOfGateway(forInterface interface: String) -> String?

    Parameters

    interface

    The interface (e.g. en0) for which to find the gateway address.

  • Returns the local host’s IP address on the given interface.

    Declaration

    Objective-C

    + (NSString *_Nullable)ipAddressOfInterface:(NSString *_Nonnull)interface;

    Swift

    class func ipAddress(ofInterface interface: String) -> String?

    Parameters

    interface

    The interface (e.g. en0) for which to find the IP address.

  • Returns the IPv4 address from the given address data.

    Declaration

    Objective-C

    + (NSString *_Nullable)ipv4AddressFromNetServiceData:
        (NSData *_Nonnull)addressData;

    Swift

    class func ipv4Address(fromNetServiceData addressData: Data) -> String?

    Parameters

    addressData

    The address data from which to find the IPv4 address.