Class Network


  • public final class Network
    extends java.lang.Object
    • Method Detail

      • nw_txt_record_create_with_bytes

        public static NSObject nw_txt_record_create_with_bytes​(java.lang.String txt_bytes,
                                                               long txt_len)
        [@function] nw_txt_record_create_with_bytes Create a new TXT record object from a buffer of bytes. If the buffer follows the key-value pair format as defined in RFC 1464, the TXT record object will be created as a dictionary. Otherwise, it is created as a TXT record buffer.
        Parameters:
        txt_bytes - The pointer to the buffer.
        txt_len - The length of the buffer.
        Returns:
        An instantiated TXT record object. Callers are responsible for deallocating using nw_release(obj) or [obj release]. These objects support ARC. Returns NULL on failure. Fails if txt_bytes is NULL or if txt_len is 0.
      • nw_txt_record_create_dictionary

        public static NSObject nw_txt_record_create_dictionary()
        [@function] nw_txt_record_create_dictionary Create an empty TXT record dictionary.
        Returns:
        An empty TXT record dictionary. Callers are responsible for deallocating using nw_release(obj) or [obj release]. These objects support ARC.
      • nw_txt_record_copy

        public static NSObject nw_txt_record_copy​(NSObject txt_record)
        [@function] nw_txt_record_copy Create a deep copy of an existing TXT record object.
        Parameters:
        txt_record - The TXT record object to be copied.
        Returns:
        A deep copy of the TXT record object. Callers are responsible for deallocating using nw_release(obj) or [obj release]. These objects support ARC.
      • nw_txt_record_find_key

        public static int nw_txt_record_find_key​(NSObject txt_record,
                                                 java.lang.String key)
        [@function] nw_txt_record_find_key Find a key-value pair in the TXT record object.
        Parameters:
        txt_record - The TXT record object.
        key - The key of the key-value pair.
        Returns:
        An nw_txt_record_find_key_t representing the type of the key-value pair found. The key may be invalid, may not exist, have no associated value, have an empty associated value, or have a non-empty associated value.
      • nw_txt_record_access_key

        public static boolean nw_txt_record_access_key​(NSObject txt_record,
                                                       java.lang.String key,
                                                       Network.Block_nw_txt_record_access_key access_value)
        [@function] nw_txt_record_access_key Access a value in the TXT record object with its key. Attempts to access or modify the TXT record object from within the block are prohibited.
        Parameters:
        txt_record - The TXT record object.
        access_value - The block that will be used to access the value of the given key.
        Returns:
        The return value of the access_value block. This is an arbitrary return value defined by the user.
      • nw_txt_record_set_key

        public static boolean nw_txt_record_set_key​(NSObject txt_record,
                                                    java.lang.String key,
                                                    java.lang.String value,
                                                    long value_len)
        [@function] nw_txt_record_set_key Set a key-value pair on the TXT record object.
        Parameters:
        txt_record - The TXT record object.
        key - The key that will be inserted. If the key already exists in the TXT record object, the existing key-value pair will be replaced.
        value - The value that will be inserted. If value is set to NULL, then the key will be inserted with no value.
        value_len - The length of the value will be inserted. If value is set to zero, then the key will be inserted with a zero-length value. Inserting a NULL value with a non-zero length will fail.
        Returns:
        A boolean indicating if the key-value pair was inserted successfully. Returns false if the key is invalid. A key is invalid if it is an empty string, contains non-ASCII characters, or has length greater than UINT8_MAX.
      • nw_txt_record_remove_key

        public static boolean nw_txt_record_remove_key​(NSObject txt_record,
                                                       java.lang.String key)
        [@function] nw_txt_record_remove_key Removes a key-value pair in the TXT record object given its key.
        Parameters:
        txt_record - The TXT record object.
        key - The key corresponding to the key-value pair.
        Returns:
        A boolean indicating if the key-value pair specified by the given key was removed. Returns false if the key is invalid or not present in the TXT dictionary. A key is invalid if it is an empty string, contains non-ASCII characters, or has length greater than UINT8_MAX.
      • nw_txt_record_get_key_count

        public static long nw_txt_record_get_key_count​(NSObject txt_record)
        [@function] nw_txt_record_get_key_count Count the number of keys in the TXT record object.
        Parameters:
        txt_record - A TXT record object.
        Returns:
        The number of keys in the TXT record object.
      • nw_txt_record_access_bytes

        public static boolean nw_txt_record_access_bytes​(NSObject txt_record,
                                                         Network.Block_nw_txt_record_access_bytes access_bytes)
        [@function] nw_txt_record_access_bytes Access the raw TXT record inside the TXT record object.
        Parameters:
        txt_record - The TXT record object.
        access_bytes - The block that will be used to access the raw TXT record inside the TXT record object.
        Returns:
        The return value of the access_bytes block, which is defined by the user. For example, the user may want to return a boolean indicating if the operation succeeds.
      • nw_txt_record_apply

        public static boolean nw_txt_record_apply​(NSObject txt_record,
                                                  Network.Block_nw_txt_record_apply applier)
        [@function] nw_txt_record_apply Apply the block to every key-value pair in the TXT record object.
        Parameters:
        txt_record - The TXT record object.
        applier - The block that will be applied to the entire TXT record object.
        Returns:
        A boolean indicating whether iteration of the TXT record object completed successfully. Iteration will only fail if the applier block returns false.
      • nw_txt_record_is_equal

        public static boolean nw_txt_record_is_equal​(NSObject left,
                                                     NSObject right)
        [@function] nw_txt_record_is_equal Check if the two TXT record objects are equal.
        Parameters:
        left - The first TXT record object to be compared.
        right - The second TXT record object to be compared.
        Returns:
        A boolean indicating if the two TXT record objects are equal. Two TXT record objects are equal if they contain the same set of key-value pairs, where keys are compared case-insensitively. For example, "ABC=1" and "abc=1" are identical key-value pairs. The ordering of the key-value pairs does not matter.
      • nw_txt_record_is_dictionary

        public static boolean nw_txt_record_is_dictionary​(NSObject txt_record)
        [@function] nw_txt_record_is_dictionary Check whether the TXT record is a dictionary or a buffer.
        Parameters:
        txt_record - The TXT record object.
        Returns:
        A boolean indicating whether the TXT record is a dictionary or a buffer. If true, the TXT record is a dictionary. If false, the TXT record is a buffer.
      • nw_advertise_descriptor_create_bonjour_service

        public static NSObject nw_advertise_descriptor_create_bonjour_service​(java.lang.String name,
                                                                              java.lang.String type,
                                                                              java.lang.String domain)
        [@function] nw_advertise_descriptor_create_bonjour_service Creates a new advertise descriptor object based on a Bonjour service type and optional domain. This object can be used with listener objects to specify the service the listener should advertise. If the name is unspecified, the default name for the device will be used. If the domain is unspecified, the default domains for registration will be used. If the listener is local only, the domain 'local.' will be used regardless of the parameter passed to domain.
        Parameters:
        name - An optional Bonjour service name.
        type - A Bonjour service type.
        domain - An optional Bonjour service domain.
        Returns:
        An instantiated browse descriptor object.
      • nw_advertise_descriptor_set_txt_record

        public static void nw_advertise_descriptor_set_txt_record​(NSObject advertise_descriptor,
                                                                  org.moe.natj.general.ptr.ConstVoidPtr txt_record,
                                                                  long txt_length)
        [@function] nw_advertise_descriptor_set_txt_record Set the TXT record for the advertise descriptor's service. You must call nw_listener_set_advertise_descriptor to update the listener's advertising afterwards in order for these changes to take effect.
        Parameters:
        advertise_descriptor - The advertise descriptor to modify.
        txt_record - A pointer to the TXT record.
        txt_length - The length of the TXT record. The total size of a typical DNS-SD TXT record is intended to be small - 200 bytes or less. Using TXT records larger than 1300 bytes is not recommended at this time.
      • nw_advertise_descriptor_set_no_auto_rename

        public static void nw_advertise_descriptor_set_no_auto_rename​(NSObject advertise_descriptor,
                                                                      boolean no_auto_rename)
        [@function] nw_advertise_descriptor_set_no_auto_rename Disable auto-rename for the Bonjour service registration. Auto-rename is enabled by default.
        Parameters:
        advertise_descriptor - The advertise descriptor to modify.
        no_auto_rename - A boolean indicating if auto-rename should be disabled.
      • nw_advertise_descriptor_get_no_auto_rename

        public static boolean nw_advertise_descriptor_get_no_auto_rename​(NSObject advertise_descriptor)
        [@function] nw_advertise_descriptor_get_no_auto_rename Check if auto-rename has been disabled for the Bonjour service registration.
        Parameters:
        advertise_descriptor - The advertise descriptor object.
        Returns:
        A boolean indicating if auto-rename is disabled.
      • nw_advertise_descriptor_set_txt_record_object

        public static void nw_advertise_descriptor_set_txt_record_object​(NSObject advertise_descriptor,
                                                                         NSObject txt_record)
        [@function] nw_advertise_descriptor_set_txt_record_object Set the TXT record object on the advertise descriptor.
        Parameters:
        advertise_descriptor - The advertise descriptor object.
        txt_record - The TXT record object. If txt_record is NULL, the advertise_descriptor's current TXT record object will be removed.
      • nw_advertise_descriptor_copy_txt_record_object

        public static NSObject nw_advertise_descriptor_copy_txt_record_object​(NSObject advertise_descriptor)
        [@function] nw_advertise_descriptor_copy_txt_record_object Copies the TXT record object from the advertise descriptor.
        Parameters:
        advertise_descriptor - The advertise descriptor object.
        Returns:
        A copy of the TXT record object, or NULL if the advertise descriptor does not have an associated TXT record.
      • nw_protocol_definition_is_equal

        public static boolean nw_protocol_definition_is_equal​(NSObject definition1,
                                                              NSObject definition2)
        [@function] nw_protocol_definition_is_equal Compare two protocol definitions to check if they represent the same protocol.
        Parameters:
        definition1 - The first definition to compare
        definition2 - The second definition to compare
        Returns:
        Returns true if the definitions represent the same protocol, false otherwise.
      • nw_protocol_options_copy_definition

        public static NSObject nw_protocol_options_copy_definition​(NSObject options)
        [@function] nw_protocol_options_copy_definition Retrieve the protocol definition for a given options object.
        Parameters:
        options - The protocol options to check
        Returns:
        Returns a reference-counted protocol definition object.
      • nw_protocol_metadata_copy_definition

        public static NSObject nw_protocol_metadata_copy_definition​(NSObject metadata)
        [@function] nw_protocol_metadata_copy_definition Retrieve the protocol definition for a given metadata object.
        Parameters:
        metadata - The protocol metadata to check
        Returns:
        Returns a reference-counted protocol definition object.
      • nw_interface_get_type

        public static int nw_interface_get_type​(NSObject interface_)
        [@function] nw_interface_get_type Retrieves the type of an interface. This only accesses the type of the specific interface being queried, and will not take into account types used by interfaces that traffic will eventually be routed through. That is, if the interface is a virtual interface (such as a VPN) that eventually forwards traffic through Wi-Fi, the type will be nw_interface_type_other, not nw_interface_type_wifi.
        Parameters:
        interface - The interface object to check.
        Returns:
        Returns the type of the interface.
      • nw_interface_get_name

        public static java.lang.String nw_interface_get_name​(NSObject interface_)
        [@function] nw_interface_get_name Retrieves the name of an interface, to be used for reference or logging purposes.
        Parameters:
        interface - The interface object to check.
        Returns:
        Returns the name of the interface as a NULL-terminated C string, or NULL if the interface is NULL.
      • nw_interface_get_index

        public static int nw_interface_get_index​(NSObject interface_)
        [@function] nw_interface_get_index Retrieves the index of an interface, to be used for reference or logging purposes. This is the same value as provided by if_nametoindex.
        Parameters:
        interface - The interface object to check.
        Returns:
        Returns the index of the interface, or 0 if the interface is NULL.
      • nw_endpoint_get_type

        public static int nw_endpoint_get_type​(NSObject endpoint)
        [@function] nw_endpoint_get_type Retrieves the type of a network endpoint.
        Parameters:
        endpoint - The endpoint object for which to get the type.
        Returns:
        Returns the type of the network endpoint.
      • nw_endpoint_create_host

        public static NSObject nw_endpoint_create_host​(java.lang.String hostname,
                                                       java.lang.String port)
        [@function] nw_endpoint_create_host Creates a network endpoint with a hostname and port. The hostname may be a string-encoding of an IP address, in which case the the endpoint will be treated as an endpoint with the type nw_endpoint_type_address. Otherwise, the endpoint will have the type nw_endpoint_type_host.
        Parameters:
        hostname - A hostname, such as "www.example.com", or "2607:ffff::1234:abcd".
        port - A port number as a C string, such as "443", or a service name, such as "https".
        Returns:
        Returns an allocated nw_endpoint_t object on success. Callers are responsible for deallocating using nw_release(obj) or [obj release]. These objects support ARC. Returns NULL on failure. Fails due to invalid parameters.
      • nw_endpoint_get_hostname

        public static java.lang.String nw_endpoint_get_hostname​(NSObject endpoint)
        [@function] nw_endpoint_get_hostname Retrieves the hostname string for a network endpoint with the type nw_endpoint_type_host or nw_endpoint_type_url.
        Parameters:
        endpoint - The endpoint object.
        Returns:
        Returns the hostname string for the endpoint, or NULL if the endpoint is not of type nw_endpoint_type_host.
      • nw_endpoint_copy_port_string

        public static org.moe.natj.general.ptr.BytePtr nw_endpoint_copy_port_string​(NSObject endpoint)
        [@function] nw_endpoint_copy_port_string Returns an allocated port string for a network endpoint with the type nw_endpoint_type_host or nw_endpoint_type_address.
        Parameters:
        endpoint - The endpoint object.
        Returns:
        Returns the port string for the endpoint, or NULL if the endpoint is not of type nw_endpoint_type_host or nw_endpoint_type_address. This string must be freed with free().
      • nw_endpoint_get_port

        public static char nw_endpoint_get_port​(NSObject endpoint)
        [@function] nw_endpoint_get_port Retrieves the port for a network endpoint with the type nw_endpoint_type_url, nw_endpoint_type_host, or nw_endpoint_type_address. The port will be returned in Host Byte Order.
        Parameters:
        endpoint - The endpoint object.
        Returns:
        Returns the port for the endpoint, or 0 if the endpoint is not of type nw_endpoint_type_host or nw_endpoint_type_address. The port will be returned in Host Byte Order.
      • nw_endpoint_create_address

        public static NSObject nw_endpoint_create_address​(sockaddr address)
        [@function] nw_endpoint_create_address Creates a network endpoint with a sockaddr struct. The endpoint will have the type nw_endpoint_type_address.
        Parameters:
        address - An address stored as a sockaddr.
        Returns:
        Returns an allocated nw_endpoint_t object on success. Callers are responsible for deallocating using nw_release(obj) or [obj release]. These objects support ARC. Returns NULL on failure. Fails due to invalid parameters.
      • nw_endpoint_copy_address_string

        public static org.moe.natj.general.ptr.BytePtr nw_endpoint_copy_address_string​(NSObject endpoint)
        [@function] nw_endpoint_copy_address_string Returns an allocated IP address string for a network endpoint with the type nw_endpoint_type_address.
        Parameters:
        endpoint - The endpoint object.
        Returns:
        Returns the IP address string for the endpoint, or NULL if the endpoint is not of type nw_endpoint_type_address. This string must be freed with free().
      • nw_endpoint_get_address

        public static sockaddr nw_endpoint_get_address​(NSObject endpoint)
        [@function] nw_endpoint_get_address Retrieves the sockaddr struct for a network endpoint with the type nw_endpoint_type_address.
        Parameters:
        endpoint - The endpoint object.
        Returns:
        Returns the sockaddr struct for the endpoint, or NULL if the endpoint is not of type nw_endpoint_type_address.
      • nw_endpoint_create_bonjour_service

        public static NSObject nw_endpoint_create_bonjour_service​(java.lang.String name,
                                                                  java.lang.String type,
                                                                  java.lang.String domain)
        [@function] nw_endpoint_create_bonjour_service Creates a network endpoint for a Bonjour Service name, type, and domain. The endpoint will have the type nw_endpoint_type_bonjour_service.
        Parameters:
        name - The Bonjour Service name, such as "example".
        type - The Bonjour Service type, such as "_http._tcp".
        domain - The Bonjour Service domain, such as "local".
        Returns:
        Returns an allocated nw_endpoint_t object on success. Callers are responsible for deallocating using nw_release(obj) or [obj release]. These objects support ARC. Returns NULL on failure. Fails due to invalid parameters.
      • nw_endpoint_get_bonjour_service_name

        public static java.lang.String nw_endpoint_get_bonjour_service_name​(NSObject endpoint)
        [@function] nw_endpoint_get_bonjour_service_name Retrieves the Bonjour Service name string for a network endpoint with the type nw_endpoint_type_bonjour_service.
        Parameters:
        endpoint - The endpoint object.
        Returns:
        Returns the Bonjour Service name string for the endpoint, or NULL if the endpoint is not of type nw_endpoint_type_bonjour_service.
      • nw_endpoint_get_bonjour_service_type

        public static java.lang.String nw_endpoint_get_bonjour_service_type​(NSObject endpoint)
        [@function] nw_endpoint_get_bonjour_service_type Retrieves the Bonjour Service type string for a network endpoint with the type nw_endpoint_type_bonjour_service.
        Parameters:
        endpoint - The endpoint object.
        Returns:
        Returns the Bonjour Service type string for the endpoint, or NULL if the endpoint is not of type nw_endpoint_type_bonjour_service.
      • nw_endpoint_get_bonjour_service_domain

        public static java.lang.String nw_endpoint_get_bonjour_service_domain​(NSObject endpoint)
        [@function] nw_endpoint_get_bonjour_service_domain Retrieves the Bonjour Service domain string for a network endpoint with the type nw_endpoint_type_bonjour_service.
        Parameters:
        endpoint - The endpoint object.
        Returns:
        Returns the Bonjour Service domain string for the endpoint, or NULL if the endpoint is not of type nw_endpoint_type_bonjour_service.
      • nw_endpoint_create_url

        public static NSObject nw_endpoint_create_url​(java.lang.String url)
        [@function] nw_endpoint_create_url Creates a network endpoint with a URL. The endpoint will have the type nw_endpoint_type_url.
        Parameters:
        url - The URL string.
        Returns:
        Returns an allocated nw_endpoint_t object on success. Callers are responsible for deallocating using nw_release(obj) or [obj release]. These objects support ARC. Returns NULL on failure. Fails due to invalid parameters, or due to URL parsing failure.
      • nw_endpoint_get_url

        public static java.lang.String nw_endpoint_get_url​(NSObject endpoint)
        [@function] nw_endpoint_get_url Retrieves the URL string from a network endpoint of type nw_endpoint_type_url.
        Parameters:
        endpoint - The endpoint object.
        Returns:
        The URL string, or NULL if the endpoint is not of type nw_endpoint_type_url.
      • nw_parameters_create_secure_tcp

        public static NSObject nw_parameters_create_secure_tcp​(Network.Block_nw_parameters_create_secure_tcp_0 configure_tls,
                                                               Network.Block_nw_parameters_create_secure_tcp_1 configure_tcp)
        [@function] nw_parameters_create_secure_tcp Creates a parameters object that is configured for TLS and TCP. The caller can use the default configuration for TLS and TCP, or set specific options for each protocol, or disable TLS.
        Parameters:
        configure_tls - A block to configure TLS. To use the default TLS configuration, pass NW_PARAMETERS_DEFAULT_CONFIGURATION. To configure specific options, pass a custom block and operate on the nw_protocol_options_t object. To disable TLS, pass NW_PARAMETERS_DISABLE_PROTOCOL.
        configure_tcp - A block to configure TCP. To use the default TCP configuration, pass NW_PARAMETERS_DEFAULT_CONFIGURATION. To configure specific options, pass a custom block and operate on the nw_protocol_options_t object. It is invalid to try to disable TCP using NW_PARAMETERS_DISABLE_PROTOCOL.
        Returns:
        Returns an allocated nw_parameters_t object on success. Callers are responsible for deallocating using nw_release(obj) or [obj release]. These objects support ARC. Returns NULL on failure. Fails due to invalid parameters.
      • nw_parameters_create_secure_udp

        public static NSObject nw_parameters_create_secure_udp​(Network.Block_nw_parameters_create_secure_udp_0 configure_dtls,
                                                               Network.Block_nw_parameters_create_secure_udp_1 configure_udp)
        [@function] nw_parameters_create_secure_udp Creates a parameters object that is configured for DTLS and UDP. The caller can use the default configuration for DTLS and UDP, or set specific options for each protocol, or disable DTLS.
        Parameters:
        configure_dtls - A block to configure DTLS. To use the default DTLS configuration, pass NW_PARAMETERS_DEFAULT_CONFIGURATION. To configure specific options, pass a custom block and operate on the nw_protocol_options_t object. To disable DTLS, pass NW_PARAMETERS_DISABLE_PROTOCOL.
        configure_udp - A block to configure UDP. To use the default UDP configuration, pass NW_PARAMETERS_DEFAULT_CONFIGURATION. To configure specific options, pass a custom block and operate on the nw_protocol_options_t object. It is invalid to try to disable UDP using NW_PARAMETERS_DISABLE_PROTOCOL.
        Returns:
        Returns an allocated nw_parameters_t object on success. Callers are responsible for deallocating using nw_release(obj) or [obj release]. These objects support ARC. Returns NULL on failure. Fails due to invalid parameters.
      • nw_parameters_create

        public static NSObject nw_parameters_create()
        [@function] nw_parameters_create Creates a generic parameters object. Note that in order to use parameters with an nw_connection_t or an nw_listener_t, the parameters must have protocols added into the default nw_protocol_stack_t. Clients using standard protocol configurations should use nw_parameters_create_secure_tcp() or nw_parameters_create_secure_udp().
        Returns:
        Returns an allocated nw_parameters_t object on success. Callers are responsible for deallocating using nw_release(obj) or [obj release]. These objects support ARC.
      • nw_parameters_copy

        public static NSObject nw_parameters_copy​(NSObject parameters)
        [@function] nw_parameters_copy Creates a deep copy of a parameters object that can be modified.
        Parameters:
        parameters - The existing parameters object to copy
        Returns:
        Returns a newly allocated nw_parameters_t object on success. Callers are responsible for deallocating using nw_release(obj) or [obj release]. These objects support ARC. Returns NULL on failure. Fails due to invalid parameters.
      • nw_parameters_require_interface

        public static void nw_parameters_require_interface​(NSObject parameters,
                                                           NSObject interface_)
        [@function] nw_parameters_require_interface Require any connections or listeners using these parameters to use the provided network interface, or none if NULL is passed.
        Parameters:
        parameters - The parameters object to configure
        interface - The interface to require for connections or listeners, or NULL to allow any interface.
      • nw_parameters_copy_required_interface

        public static NSObject nw_parameters_copy_required_interface​(NSObject parameters)
        [@function] nw_parameters_copy_required_interface Access the required network interface set on the parameters.
        Parameters:
        parameters - The parameters object to check
        Returns:
        Returns the interface that is required by the parameters, or NULL if no interface is required.
      • nw_parameters_prohibit_interface

        public static void nw_parameters_prohibit_interface​(NSObject parameters,
                                                            NSObject interface_)
        [@function] nw_parameters_prohibit_interface Prohibit any connections or listeners using these parameters from using the provided network interface.
        Parameters:
        parameters - The parameters object to configure
        interface - The interface to prohibit for connections or listeners.
      • nw_parameters_clear_prohibited_interfaces

        public static void nw_parameters_clear_prohibited_interfaces​(NSObject parameters)
        [@function] nw_parameters_clear_prohibited_interfaces Clear any interfaces that had been prohibited.
        Parameters:
        parameters - The parameters object to modify
      • nw_parameters_iterate_prohibited_interfaces

        public static void nw_parameters_iterate_prohibited_interfaces​(NSObject parameters,
                                                                       Network.Block_nw_parameters_iterate_prohibited_interfaces iterate_block)
        [@function] nw_parameters_iterate_prohibited_interfaces List all prohibited network interfaces.
        Parameters:
        parameters - The parameters object to check
        iterate_block - A block that will return the interfaces prohibited by the parameters. Returning true from the block will continue to iterate, and returning false will stop iterating.
      • nw_parameters_set_required_interface_type

        public static void nw_parameters_set_required_interface_type​(NSObject parameters,
                                                                     int interface_type)
        [@function] nw_parameters_set_required_interface_type Require any connections or listeners using these parameters to use the provided network interface type.
        Parameters:
        parameters - The parameters object to configure
        interface_type - The interface type to require for connections or listeners.
      • nw_parameters_get_required_interface_type

        public static int nw_parameters_get_required_interface_type​(NSObject parameters)
        [@function] nw_parameters_get_required_interface_type Access the required network interface type set on the parameters.
        Parameters:
        parameters - The parameters object to check
        Returns:
        Returns the interface type that is required by the parameters, or nw_interface_type_other_t if no interface type is required.
      • nw_parameters_prohibit_interface_type

        public static void nw_parameters_prohibit_interface_type​(NSObject parameters,
                                                                 int interface_type)
        [@function] nw_parameters_prohibit_interface_type Prohibit any connections or listeners using these parameters from using the provided network interface type.
        Parameters:
        parameters - The parameters object to configure
        interface_type - The interface type to prohibit for connections or listeners.
      • nw_parameters_clear_prohibited_interface_types

        public static void nw_parameters_clear_prohibited_interface_types​(NSObject parameters)
        [@function] nw_parameters_clear_prohibited_interface_types Clear any interface types that had been prohibited.
        Parameters:
        parameters - The parameters object to modify
      • nw_parameters_iterate_prohibited_interface_types

        public static void nw_parameters_iterate_prohibited_interface_types​(NSObject parameters,
                                                                            Network.Block_nw_parameters_iterate_prohibited_interface_types iterate_block)
        [@function] nw_parameters_iterate_prohibited_interface_types List all prohibited network interface types.
        Parameters:
        parameters - The parameters object to check
        iterate_block - A block that will return the interface types prohibited by the parameters. Returning true from the block will continue to iterate, and returning false will stop iterating.
      • nw_parameters_set_prohibit_expensive

        public static void nw_parameters_set_prohibit_expensive​(NSObject parameters,
                                                                boolean prohibit_expensive)
        [@function] nw_parameters_set_prohibit_expensive Prohibit any connections or listeners using these parameters from using a network interface that is considered expensive by the system.
        Parameters:
        parameters - The parameters object to configure
        prohibit_expensive - If true, prohibit the use of any expensive interfaces. If false, allow expensive interfaces. Defaults to false.
      • nw_parameters_get_prohibit_expensive

        public static boolean nw_parameters_get_prohibit_expensive​(NSObject parameters)
        [@function] nw_parameters_get_prohibit_expensive Check if the parameters prohibit expensive interfaces.
        Parameters:
        parameters - The parameters object to check
        Returns:
        Returns true if expensive interfaces are prohibited, or false otherwise.
      • nw_parameters_set_prohibit_constrained

        public static void nw_parameters_set_prohibit_constrained​(NSObject parameters,
                                                                  boolean prohibit_constrained)
        [@function] nw_parameters_set_prohibit_constrained Prohibit any connections or listeners using these parameters from using a network interface that is considered constrained by the system.
        Parameters:
        parameters - The parameters object to configure
        prohibit_constrained - If true, prohibit the use of any constrained interfaces. If false, allow constrained interfaces. Defaults to false.
      • nw_parameters_get_prohibit_constrained

        public static boolean nw_parameters_get_prohibit_constrained​(NSObject parameters)
        [@function] nw_parameters_get_prohibit_constrained Check if the parameters prohibit constrained interfaces.
        Parameters:
        parameters - The parameters object to check
        Returns:
        Returns true if constrained interfaces are prohibited, or false otherwise.
      • nw_parameters_set_reuse_local_address

        public static void nw_parameters_set_reuse_local_address​(NSObject parameters,
                                                                 boolean reuse_local_address)
        [@function] nw_parameters_set_reuse_local_address Allow any connections using these parameters to reuse local addresses already in use by other connections.
        Parameters:
        parameters - The parameters object to configure
        reuse_local_address - If true, allow the reuse of local addresses. If false, disallow the reuse of local addresses. Defaults to false.
      • nw_parameters_get_reuse_local_address

        public static boolean nw_parameters_get_reuse_local_address​(NSObject parameters)
        [@function] nw_parameters_get_reuse_local_address Check if the parameters allow local address reuse.
        Parameters:
        parameters - The parameters object to check
        Returns:
        Returns true if local address reuse is allowed, or false otherwise.
      • nw_parameters_set_local_endpoint

        public static void nw_parameters_set_local_endpoint​(NSObject parameters,
                                                            NSObject local_endpoint)
        [@function] nw_parameters_set_local_endpoint Specify a specific endpoint to use as the local endpoint. For connections, this will be used to initiate traffic; for listeners, this will be used for receiving incoming connections.
        Parameters:
        parameters - The parameters object to configure
        local_endpoint - The endpoint to set as the local endpoint. Pass NULL to clear the local endpoint.
      • nw_parameters_copy_local_endpoint

        public static NSObject nw_parameters_copy_local_endpoint​(NSObject parameters)
        [@function] nw_parameters_copy_local_endpoint Extract the local endpoint set on the connection.
        Parameters:
        parameters - The parameters object to configure
        Returns:
        Returns the endpoint that is set in the parameters, or NULL if no local endpoint is set.
      • nw_parameters_set_include_peer_to_peer

        public static void nw_parameters_set_include_peer_to_peer​(NSObject parameters,
                                                                  boolean include_peer_to_peer)
        [@function] nw_parameters_set_include_peer_to_peer Allow the inclusion of peer-to-peer interfaces when listening or establishing outbound connections. This parameter will not take effect if a specific interface is required. This parameter is applicable when advertising a Bonjour service on a listener, or connecting to a Bonjour service.
        Parameters:
        parameters - The parameters object to configure
        include_peer_to_peer - If true, allow advertising, resolving, and connecting over peer-to-peer interfaces. Defaults to false.
      • nw_parameters_get_include_peer_to_peer

        public static boolean nw_parameters_get_include_peer_to_peer​(NSObject parameters)
        [@function] nw_parameters_get_include_peer_to_peer Check if the parameters allow the inclusion of peer-to-peer interfaces.
        Parameters:
        parameters - The parameters object to check
        Returns:
        Returns true if peer-to-peer interfaces are allowed, or false otherwise.
      • nw_parameters_set_fast_open_enabled

        public static void nw_parameters_set_fast_open_enabled​(NSObject parameters,
                                                               boolean fast_open_enabled)
        [@function] nw_parameters_set_fast_open_enabled Use fast open for an outbound connection, which may be done at any protocol level. Use of fast open requires that the caller send idempotent data on the connection before the connection may move into the ready state. As a side effect, this may implicitly enable fast open or early data for protocols in the stack, even if they did not have fast open explicitly enabled on them (such as the option to enable TCP Fast Open). NOTE: Use of this API may have security implications for application data. In particular, TLS early data is replayable by a network attacker. Callers must account for this when sending data before the handshake is confirmed. See RFC 8446 for more information. Callers MUST NOT enable fast open without a specific application profile that defines its use.
        Parameters:
        parameters - The parameters object to configure
        fast_open_enabled - If true, indicate that fast open is requested and that idempotent data MUST be sent by the caller on the connection. If false, disallow the fast open at the top level protocol. Defaults to false.
      • nw_parameters_get_fast_open_enabled

        public static boolean nw_parameters_get_fast_open_enabled​(NSObject parameters)
        [@function] nw_parameters_get_fast_open_enabled Check if the parameters allow the use of fast open for the top level protocol.
        Parameters:
        parameters - The parameters object to check
        Returns:
        Returns true if fast open is allowed for the top level protocol, or false otherwise.
      • nw_parameters_set_service_class

        public static void nw_parameters_set_service_class​(NSObject parameters,
                                                           int service_class)
        [@function] nw_parameters_set_service_class Set the data service class to use for connections.
        Parameters:
        parameters - The parameters object to configure
        service_class - The service class value to use for connections. Defaults to nw_service_class_best_effort.
      • nw_parameters_get_service_class

        public static int nw_parameters_get_service_class​(NSObject parameters)
        [@function] nw_parameters_get_service_class Check the service class configured on the parameters.
        Parameters:
        parameters - The parameters object to check
        Returns:
        Returns the effective service class configured on the parameters.
      • nw_parameters_set_multipath_service

        public static void nw_parameters_set_multipath_service​(NSObject parameters,
                                                               int multipath_service)
        [@function] nw_parameters_set_multipath_service Set the multipath service to use for connections.
        Parameters:
        parameters - The parameters object to configure
        multipath_service - The multipath service value to use for connections. Defaults to nw_multipath_service_disabled.
      • nw_parameters_get_multipath_service

        public static int nw_parameters_get_multipath_service​(NSObject parameters)
        [@function] nw_parameters_get_multipath_service Check the multipath service mode configured on the parameters.
        Parameters:
        parameters - The parameters object to check
        Returns:
        Returns the multipath service configured on the parameters.
      • nw_parameters_copy_default_protocol_stack

        public static NSObject nw_parameters_copy_default_protocol_stack​(NSObject parameters)
        [@function] nw_parameters_copy_default_protocol_stack Retrieve the default protocol stack from a parameters object. Every parameters object will have a default protocol stack. For parameters created with a convenience initializer, this protocol stack will be pre-populated. For parameters created with the generic initializers, the stack will be empty.
        Parameters:
        parameters - The parameters object to check
        Returns:
        Returns an nw_protocol_stack_t object that can be inspected and modified.
      • nw_protocol_stack_prepend_application_protocol

        public static void nw_protocol_stack_prepend_application_protocol​(NSObject stack,
                                                                          NSObject protocol)
        [@function] nw_protocol_stack_prepend_application_protocol Prepend an application-layer protocol onto the top of a protocol stack.
        Parameters:
        stack - The protocol stack to modify
        protocol - The protocol options to add to the stack, which contain the definition of the protocol to add.
      • nw_protocol_stack_clear_application_protocols

        public static void nw_protocol_stack_clear_application_protocols​(NSObject stack)
        [@function] nw_protocol_stack_clear_application_protocols Remove all application-layer protocols from a protocol stack.
        Parameters:
        stack - The protocol stack to modify
      • nw_protocol_stack_iterate_application_protocols

        public static void nw_protocol_stack_iterate_application_protocols​(NSObject stack,
                                                                           Network.Block_nw_protocol_stack_iterate_application_protocols iterate_block)
        [@function] nw_protocol_stack_iterate_application_protocols List all application protocols attached to a protocol stack.
        Parameters:
        stack - The protocol stack to check
        iterate_block - A block that will return the protocols attached to the stack.
      • nw_protocol_stack_copy_transport_protocol

        public static NSObject nw_protocol_stack_copy_transport_protocol​(NSObject stack)
        [@function] nw_protocol_stack_copy_transport_protocol Access the transport-layer protocol used in a protocol stack.
        Parameters:
        stack - The protocol stack to check
        Returns:
        Returns the transport protocol currently set in the protocol stack, or NULL if no transport protocol is set.
      • nw_protocol_stack_set_transport_protocol

        public static void nw_protocol_stack_set_transport_protocol​(NSObject stack,
                                                                    NSObject protocol)
        [@function] nw_protocol_stack_set_transport_protocol Set the transport-layer protocol to use for a protocol stack.
        Parameters:
        stack - The protocol stack to modify
        protocol - The protocol options to set into the stack, which contain the definition of the protocol.
      • nw_protocol_stack_copy_internet_protocol

        public static NSObject nw_protocol_stack_copy_internet_protocol​(NSObject stack)
        [@function] nw_protocol_stack_copy_internet_protocol Access the internet-layer protocol used in a protocol stack.
        Parameters:
        stack - The protocol stack to check
        Returns:
        Returns the internet protocol currently set in the protocol stack, or NULL if no internet protocol is set. Note that this will generally be NULL, unless a specific IP family is being selected.
      • nw_parameters_set_local_only

        public static void nw_parameters_set_local_only​(NSObject parameters,
                                                        boolean local_only)
        [@function] nw_parameters_set_local_only Set to true to limit inbound connections to peers attached to the local link only. Defaults to false.
        Parameters:
        parameters - The parameters object to configure
        local_only - True to limit connections to the local link only.
      • nw_parameters_get_local_only

        public static boolean nw_parameters_get_local_only​(NSObject parameters)
        [@function] nw_parameters_get_local_only Indicates whether or not the parameters limit connections to the local link only.
        Parameters:
        parameters - The parameters object to check
        Returns:
        Returns true if the parameters limit inbound connections to the local link.
      • nw_parameters_set_prefer_no_proxy

        public static void nw_parameters_set_prefer_no_proxy​(NSObject parameters,
                                                             boolean prefer_no_proxy)
        [@function] nw_parameters_set_prefer_no_proxy Set to true to attempt connections without using proxies, only using any configured proxies if the connections cannot otherwise be completed. Defaults to false.
        Parameters:
        parameters - The parameters to modify.
        prefer_no_proxy - True to cause connections to be attempted without proxies.
      • nw_parameters_get_prefer_no_proxy

        public static boolean nw_parameters_get_prefer_no_proxy​(NSObject parameters)
        [@function] nw_parameters_get_prefer_no_proxy Indicates whether or not the parameters cause connections to be attempted without proxies, only using proxies if connections cannot otherwise be completed.
        Parameters:
        parameters - The parameters to get the property from.
        Returns:
        Returns true if the parameters cause connections to be attempted without proxies, only using proxies if connections cannot otherwise be completed.
      • nw_parameters_set_expired_dns_behavior

        public static void nw_parameters_set_expired_dns_behavior​(NSObject parameters,
                                                                  int expired_dns_behavior)
        [@function] nw_parameters_set_expired_dns_behavior Allow or prohibit the use of expired DNS answers during connection establishment. If allowed, a DNS answer that was previously returned may be re-used for new connections even after the answers are considered expired. A query for fresh answers will be sent in parallel, and the fresh answers will be used as alternate addresses in case the expired answers do not result in successful connections. By default, this value is nw_parameters_expired_dns_behavior_default, which allows the system to determine if it is appropriate to use expired answers.
        Parameters:
        parameters - The parameters to modify.
        expired_dns_behavior - Allow, prohibit, or use system default behavior for expired DNS answers.
      • nw_parameters_get_expired_dns_behavior

        public static int nw_parameters_get_expired_dns_behavior​(NSObject parameters)
        [@function] nw_parameters_get_expired_dns_behavior Check the effective expired DNS behavior of a connection. See nw_parameters_set_expired_dns_behavior() for a discussion on the use of expired DNS answers.
        Parameters:
        parameters - The parameters to check.
        Returns:
        Returns the current effective expired DNS answer behavior.
      • nw_browse_descriptor_create_bonjour_service

        public static NSObject nw_browse_descriptor_create_bonjour_service​(java.lang.String type,
                                                                           java.lang.String domain)
        [@function] nw_browse_descriptor_create_bonjour_service Creates a new browse descriptor object on a Bonjour service type and domain.
        Parameters:
        type - A Bonjour service type.
        domain - An optional Bonjour service domain. If the domain is unspecified, the default domains for browsing will be used.
        Returns:
        An instantiated browse descriptor object.
      • nw_browse_descriptor_get_bonjour_service_type

        public static java.lang.String nw_browse_descriptor_get_bonjour_service_type​(NSObject descriptor)
        [@function] nw_browse_descriptor_get_bonjour_service_type Returns the service type of a browse descriptor.
        Parameters:
        descriptor - A browse descriptor object.
        Returns:
        The service type.
      • nw_browse_descriptor_get_bonjour_service_domain

        public static java.lang.String nw_browse_descriptor_get_bonjour_service_domain​(NSObject descriptor)
        [@function] nw_browse_descriptor_get_bonjour_service_domain Returns the service domain of a browse descriptor, or NULL if NULL was provided while creating the descriptor.
        Parameters:
        descriptor - A browse descriptor object.
        Returns:
        The service domain.
      • nw_browse_descriptor_set_include_txt_record

        public static void nw_browse_descriptor_set_include_txt_record​(NSObject descriptor,
                                                                       boolean include_txt_record)
        [@function] nw_browse_descriptor_set_include_txt_record Set a flag to allow or prohibit the browser from querying for TXT records while browsing. This flag should only be set if the client needs information from the TXT record during browsing, and may increase network traffic. By default, the browser will not automatically query for TXT records.
        Parameters:
        descriptor - The browse descriptor object.
        include_txt_record - A flag indicating whether results should include a TXT record. If true, the browser will query for TXT records. If false, the browser will not query for TXT records.
      • nw_browse_descriptor_get_include_txt_record

        public static boolean nw_browse_descriptor_get_include_txt_record​(NSObject descriptor)
        [@function] nw_browse_descriptor_get_include_txt_record Check whether the browser is allowed to query for TXT records.
        Parameters:
        descriptor - The browse descriptor to check.
        Returns:
        Whether the browser is allowed to query for TXT records.
      • nw_browse_result_copy_endpoint

        public static NSObject nw_browse_result_copy_endpoint​(NSObject result)
        [@function] nw_browse_result_copy_endpoint Copies the endpoint associated with the browse result object.
        Parameters:
        result - The browse result object.
        Returns:
        The associated endpoint.
      • nw_browse_result_get_changes

        public static long nw_browse_result_get_changes​(NSObject old_result,
                                                        NSObject new_result)
        [@function] nw_browse_result_get_changes Determines the set of all changes that occurred between an old and a new browse result. For example, if the return value of this function matches with nw_browse_result_change_interface_added and nw_browse_result_change_txt_record_changed, the caller can expect new_result to include a new interface and an updated txt record that was not present in old_result.
        Parameters:
        old_result - The old result.
        new_result - The new result.
        Returns:
        A nw_browse_result_change_t describing all changes that occurred.
      • nw_browse_result_get_interfaces_count

        public static long nw_browse_result_get_interfaces_count​(NSObject result)
        [@function] nw_browse_result_get_interfaces_count Returns the number of interfaces on this browse result.
        Parameters:
        result - The browse result object.
        Returns:
        The number of interfaces available.
      • nw_browse_result_copy_txt_record_object

        public static NSObject nw_browse_result_copy_txt_record_object​(NSObject result)
        [@function] nw_browse_result_copy_txt_record_object Copies the TXT record object from the browse result.
        Parameters:
        result - The browse result object.
        Returns:
        A copy of the TXT record object, or NULL if the browse result does not have an associated TXT record.
      • nw_browse_result_enumerate_interfaces

        public static void nw_browse_result_enumerate_interfaces​(NSObject result,
                                                                 Network.Block_nw_browse_result_enumerate_interfaces enumerator)
        [@function] nw_browse_result_enumerate_interfaces Enumerates the list of interfaces on this browse result.
        Parameters:
        result - The browse result object.
        enumerator - The enumerator block.
      • nw_error_get_error_domain

        public static int nw_error_get_error_domain​(NSObject error)
        [@function] nw_error_get_error_domain Given a reference to a nw_error, returns the error domain. [@returns] The error domain.
        Parameters:
        error - A reference to the nw_error.
      • nw_error_get_error_code

        public static int nw_error_get_error_code​(NSObject error)
        [@function] nw_error_get_error_code Given a reference to a nw_error, returns the error code. [@returns] The error code.
        Parameters:
        error - A reference to the nw_error.
      • nw_error_copy_cf_error

        public static CFErrorRef nw_error_copy_cf_error​(NSObject error)
        [@function] nw_error_copy_cf_error Given a reference to nw_error, returns a CFErrorRef representing the same error. [@returns] The CFErrorRef. The caller is responsible for calling CFRelease on the returned value.
        Parameters:
        error - A reference to the nw_error.
      • nw_browser_create

        public static NSObject nw_browser_create​(NSObject descriptor,
                                                 NSObject parameters)
        [@function] nw_browser_create Creates a new browser object, which can be used to browse for results matching a browse descriptor.
        Parameters:
        descriptor - A browse descriptor object that describes the type of service for which to browse.
        parameters - Optional parameters to use for the new browser. If NULL, an empty parameters object is created internally.
        Returns:
        An instantiated browser object.
      • nw_browser_set_queue

        public static void nw_browser_set_queue​(NSObject browser,
                                                NSObject queue)
        [@function] nw_browser_set_queue Sets the client callback queue, on which blocks for events will be scheduled. This must be done before calling nw_browser_start().
        Parameters:
        browser - The browser object.
        queue - The client's callback queue.
      • nw_browser_set_browse_results_changed_handler

        public static void nw_browser_set_browse_results_changed_handler​(NSObject browser,
                                                                         Network.Block_nw_browser_set_browse_results_changed_handler handler)
        [@function] nw_browser_set_browse_results_changed_handler Sets a callback handler to be invoked when the browser gets an update for changed browse results. This function must be called before starting the browser and must not be called after starting the browser.
        Parameters:
        browser - The browser object.
        handler - The callback handler that fires when the browser gets an update for a changed browse result.
      • nw_browser_set_state_changed_handler

        public static void nw_browser_set_state_changed_handler​(NSObject browser,
                                                                Network.Block_nw_browser_set_state_changed_handler state_changed_handler)
        [@function] nw_browser_set_state_changed_handler Sets the state changed handler. For clients that need to perform cleanup when the browser has been cancelled, the nw_browser_state_cancelled state will be delivered last. This function must be called before starting the browser and must not be called after starting the browser.
        Parameters:
        browser - The browser object.
        state_changed_handler - The state changed handler to call when the browser state changes. Pass NULL to remove the event handler.
      • nw_browser_start

        public static void nw_browser_start​(NSObject browser)
        [@function] nw_browser_start Starts the browser, which begins browsing for available endpoints. You must call nw_browser_set_queue() before starting the browser.
        Parameters:
        browser - The browser object.
      • nw_browser_cancel

        public static void nw_browser_cancel​(NSObject browser)
        [@function] nw_browser_cancel Cancels the browser. The process of cancellation will be completed asynchronously, and the final callback event delivered to the caller will be a state update with a value of nw_browser_state_cancelled. Once this update is delivered, the caller may clean up any associated memory or objects.
        Parameters:
        browser - The browser object.
      • nw_browser_copy_parameters

        public static NSObject nw_browser_copy_parameters​(NSObject browser)
        [@function] nw_browser_copy_parameters Returns a copy of the parameters passed to nw_browser_create().
        Parameters:
        browser - The browser object.
        Returns:
        Returns an nw_parameters_t object.
      • nw_browser_copy_browse_descriptor

        public static NSObject nw_browser_copy_browse_descriptor​(NSObject browser)
        [@function] nw_browser_copy_browse_descriptor Returns a copy of the browse_descriptor passed to nw_browser_create().
        Parameters:
        browser - The browser object.
        Returns:
        Returns a copy of the browse_descriptor passed to nw_browser_create().
      • nw_path_get_status

        public static int nw_path_get_status​(NSObject path)
        [@function] nw_path_get_status Retrieves the status of a path. The status of a specific path object will never change, as the path object itself is static. If there is a network change, the object that generated the path object will generate a new path object.
        Parameters:
        path - The path object to check.
        Returns:
        Returns the status of the path, or nw_path_status_invalid if the object is NULL.
      • nw_path_enumerate_interfaces

        public static void nw_path_enumerate_interfaces​(NSObject path,
                                                        Network.Block_nw_path_enumerate_interfaces enumerate_block)
        [@function] nw_path_enumerate_interfaces List all interfaces associated with the path.
        Parameters:
        path - The path object to check.
        enumerate_block - A block that will return the interfaces associated with the path. Returning true from the block will continue to enumerate, and returning false will stop enumerating.
      • nw_path_is_equal

        public static boolean nw_path_is_equal​(NSObject path,
                                               NSObject other_path)
        [@function] nw_path_is_equal Compares two network path objects and checks if their content is equal. If they are not equal, they represent two different network states.
        Parameters:
        path - The first path object to compare.
        other_path - The second path object to compare.
        Returns:
        Returns true if the paths are equivalent, or false if there is any difference between the paths.
      • nw_path_is_expensive

        public static boolean nw_path_is_expensive​(NSObject path)
        [@function] nw_path_is_expensive Checks if the path uses any network interfaces that are considered expensive to the user, such as, but not limited to, a cellular network.
        Parameters:
        path - The path object to check.
        Returns:
        Returns true if the path uses any network interface that is considered expensive, false otherwise.
      • nw_path_is_constrained

        public static boolean nw_path_is_constrained​(NSObject path)
        [@function] nw_path_is_constrained Checks if the path uses any network interfaces that are considered constrained to the user.
        Parameters:
        path - The path object to check.
        Returns:
        Returns true if the path uses any network interface that is considered constrained, false otherwise.
      • nw_path_has_ipv4

        public static boolean nw_path_has_ipv4​(NSObject path)
        [@function] nw_path_has_ipv4 Checks if the path uses a network interface that supports IPv4 connectivity.
        Parameters:
        path - The path object to check.
        Returns:
        Returns true if the path uses a network interface that supports IPv4, false otherwise.
      • nw_path_has_ipv6

        public static boolean nw_path_has_ipv6​(NSObject path)
        [@function] nw_path_has_ipv6 Checks if the path uses a network interface that supports IPv6 connectivity.
        Parameters:
        path - The path object to check.
        Returns:
        Returns true if the path uses a network interface that supports IPv6, false otherwise.
      • nw_path_has_dns

        public static boolean nw_path_has_dns​(NSObject path)
        [@function] nw_path_has_dns Checks if the path has a DNS server configuration set.
        Parameters:
        path - The path object to check.
        Returns:
        Returns true if the path has a DNS server configuration set, false otherwise.
      • nw_path_uses_interface_type

        public static boolean nw_path_uses_interface_type​(NSObject path,
                                                          int interface_type)
        [@function] nw_path_uses_interface_type Checks if the path uses a network interface with the specified type.
        Parameters:
        path - The path object to check.
        Returns:
        Returns true if the path uses any network interface with the specified type, false otherwise.
      • nw_path_copy_effective_local_endpoint

        public static NSObject nw_path_copy_effective_local_endpoint​(NSObject path)
        [@function] nw_path_copy_effective_local_endpoint Retrieve the local endpoint that is being used, if present. If this path is the path from an nw_connection_t, it represents the address that data is sent from.
        Parameters:
        path - The path object to check.
        Returns:
        Returns an endpoint that is assigned as the local endpoint for this path, or NULL if the path does not have a fixed local endpoint.
      • nw_path_copy_effective_remote_endpoint

        public static NSObject nw_path_copy_effective_remote_endpoint​(NSObject path)
        [@function] nw_path_copy_effective_remote_endpoint Retrieve the remote endpoint that is being used, if present. If this path is the path from an nw_connection_t, it represents the address that data is sent to.
        Parameters:
        path - The path object to check.
        Returns:
        Returns an endpoint that is assigned as the remote endpoint for this path, or NULL if the path does not have a fixed remote endpoint.
      • nw_path_enumerate_gateways

        public static void nw_path_enumerate_gateways​(NSObject path,
                                                      Network.Block_nw_path_enumerate_gateways enumerate_block)
        [@function] nw_path_enumerate_gateways List the IP addresses of the routers acting as the gateways for the path.
        Parameters:
        path - The path object to check.
        enumerate_block - A block that will return the gateways associated with the path. Returning true from the block will continue to enumerate, and returning false will stop enumerating.
      • nw_content_context_create

        public static NSObject nw_content_context_create​(java.lang.String context_identifier)
        [@function] nw_content_context_create Create a context object to represent properties associated with networking content. If the same context object is associated with multiple content blobs, then those pieces of content will be considered to be continuations of the same message.
        Parameters:
        context_identifier - A string description of the context
        Returns:
        Returns a new context context object
      • nw_content_context_get_identifier

        public static java.lang.String nw_content_context_get_identifier​(NSObject context)
        [@function] nw_content_context_get_identifier Access the identifier description.
        Returns:
        Returns the context's identifier string.
      • nw_content_context_get_is_final

        public static boolean nw_content_context_get_is_final​(NSObject context)
        [@function] nw_content_context_get_is_final Check if this is the final context for a connection. When receiving, once a final context is complete, the connection is "read closed" and will not receive more content. See nw_content_context_set_is_final() for a description of how to set is_final for sending contexts.
        Parameters:
        context - The context object
        Returns:
        Returns true if the context is the final context for a connection.
      • nw_content_context_set_is_final

        public static void nw_content_context_set_is_final​(NSObject context,
                                                           boolean is_final)
        [@function] nw_content_context_set_is_final Mark whether or not this context is the final context for a connection. When sending, marking a context as final will perform a "write close" once the context is complete, indicating that no more content will be sent. As a convenience for sending a final context, use NW_CONNECTION_FINAL_MESSAGE_CONTEXT.
        Parameters:
        context - The context object
        is_final - If set to true, mark the context as the final context to send on a connection.
      • nw_content_context_get_expiration_milliseconds

        public static long nw_content_context_get_expiration_milliseconds​(NSObject context)
        [@function] nw_content_context_get_expiration_milliseconds Retrieve the number of milliseconds after which the content will expire. See nw_content_context_set_expiration_milliseconds for futher discussion.
        Parameters:
        context - The context object
        Returns:
        Returns content expiration, or 0 if not set.
      • nw_content_context_set_expiration_milliseconds

        public static void nw_content_context_set_expiration_milliseconds​(NSObject context,
                                                                          long expiration_milliseconds)
        [@function] nw_content_context_set_expiration_milliseconds Set an expiration (in milliseconds) after which content may be dropped. If the expiration time is reached, the content may not be sent. If the value is 0, there is no expiration for the content. The expiration timer starts when the content is enqueued using nw_connection_send().
        Parameters:
        context - The context object
        expiration_milliseconds - The number of milliseconds after which content will expire
      • nw_content_context_get_relative_priority

        public static double nw_content_context_get_relative_priority​(NSObject context)
        [@function] nw_content_context_get_relative_priority Get the relative priority for the content. See nw_content_context_set_relative_priority for futher discussion.
        Parameters:
        context - The context object
        Returns:
        Returns the relative priority, between 0.0 (lowest priority) to 1.0 (highest priority). The default value is 0.5.
      • nw_content_context_set_relative_priority

        public static void nw_content_context_set_relative_priority​(NSObject context,
                                                                    double relative_priority)
        [@function] nw_content_context_set_relative_priority Set A relative priority of the content, compared to other content on the same connection. Priorities range from 0.0 (lowest priority) to 1.0 (highest priority), where content with higher priority will scheduled first if all else is equal. The default value is 0.5.
        Parameters:
        context - The context object
        relative_priority - The relative priority of the content, between 0.0 (lowest priority) to 1.0 (highest priority).
      • nw_content_context_set_antecedent

        public static void nw_content_context_set_antecedent​(NSObject context,
                                                             NSObject antecendent_context)
        [@function] nw_content_context_set_antecedent Set a context as an antecedent to this content context. The associated content will not be sent until all of its antecedents have been completed. If any of the antecedents fail with an error, this content will fail as well.
        Parameters:
        context - The context object
        antecendent_context - A context associated with content that should precede this content.
      • nw_content_context_copy_antecedent

        public static NSObject nw_content_context_copy_antecedent​(NSObject context)
        [@function] nw_content_context_copy_antecedent Copy the optional content context that must be sent prior to this content. See nw_content_context_set_antecedent for further discussion.
        Parameters:
        context - The context object
        Returns:
        Returns a context object set as the antecedent, or NULL.
      • nw_content_context_set_metadata_for_protocol

        public static void nw_content_context_set_metadata_for_protocol​(NSObject context,
                                                                        NSObject protocol_metadata)
        [@function] nw_content_context_set_metadata_for_protocol Set protocol-specific metadata to a parent content context. If metadata for the same protocol is set multiple times, the most recently set metadata will be applied.
        Parameters:
        context - The context context parent object
        protocol_metadata - The per-protocol metadata context object to set
      • nw_content_context_copy_protocol_metadata

        public static NSObject nw_content_context_copy_protocol_metadata​(NSObject context,
                                                                         NSObject protocol)
        [@function] nw_content_context_copy_protocol_metadata Copy the per-protocol metadata from a parent content context
        Parameters:
        context - The context context parent object
        protocol - The definition identifier of the protocol to retrieve metadata for
        Returns:
        Returns the metadata registered for the protocol, or NULL if there is none
      • nw_content_context_foreach_protocol_metadata

        public static void nw_content_context_foreach_protocol_metadata​(NSObject context,
                                                                        Network.Block_nw_content_context_foreach_protocol_metadata foreach_block)
        [@function] nw_content_context_foreach_protocol_metadata Access all per-protocol metadata objects from a parent content context
        Parameters:
        context - The context context parent object
        foreach_block - A block in which protocol definition and metadata will be sent
      • nw_connection_create

        public static NSObject nw_connection_create​(NSObject endpoint,
                                                    NSObject parameters)
        [@function] nw_connection_create Creates a networking connection to an endpoint.
        Parameters:
        endpoint - The remote endpoint to connect to.
        parameters - The parameters to use for the connection. The data mode, either datagram or stream, must be set.
        Returns:
        Returns an allocated nw_connection_t object on success. Callers are responsible for deallocating using nw_release(obj) or [obj release]. These objects support ARC. Returns NULL on failure. Fails due to invalid parameters.
      • nw_connection_copy_endpoint

        public static NSObject nw_connection_copy_endpoint​(NSObject connection)
        [@function] nw_connection_copy_endpoint Retrieves the remote endpoint for a connection.
        Parameters:
        connection - The connection object.
        Returns:
        Returns an nw_endpoint_t object on success. Returns NULL on failure. Fails due to invalid parameters.
      • nw_connection_copy_parameters

        public static NSObject nw_connection_copy_parameters​(NSObject connection)
        [@function] nw_connection_copy_parameters Retrieves the parameters for a connection.
        Parameters:
        connection - The connection object.
        Returns:
        Returns an nw_parameters_t object on success. Returns NULL on failure. Fails due to invalid parameters.
      • nw_connection_set_state_changed_handler

        public static void nw_connection_set_state_changed_handler​(NSObject connection,
                                                                   Network.Block_nw_connection_set_state_changed_handler handler)
        [@function] nw_connection_set_state_changed_handler Sets the state change handler. For clients that need to perform cleanup when the connection has been cancelled, the nw_connection_state_cancelled state will be delivered last.
        Parameters:
        connection - The connection object.
        handler - The state changed handler to call when the connection state changes. Pass NULL to remove the state changed handler.
      • nw_connection_set_viability_changed_handler

        public static void nw_connection_set_viability_changed_handler​(NSObject connection,
                                                                       Network.Block_nw_connection_set_viability_changed_handler handler)
        [@function] nw_connection_set_viability_changed_handler Define a callback to be fired when the viability of the connection changes. This indicates whether or not read and write calls will succeed on a ready connection.
        Parameters:
        connection - The connection object.
        handler - The event handler to call when the connection viability changes. The value will be true when the connection is viable, and false otherwise. Pass NULL to remove the event handler.
      • nw_connection_set_better_path_available_handler

        public static void nw_connection_set_better_path_available_handler​(NSObject connection,
                                                                           Network.Block_nw_connection_set_better_path_available_handler handler)
        [@function] nw_connection_set_better_path_available_handler Define a callback to be fired when a better path is available or not. This indicates whether or not a preferred path is available for the connection.
        Parameters:
        connection - The connection object.
        handler - The event handler to call when the better path availability changes. The value will be true when a better path is available, and false otherwise. Pass NULL to remove the event handler.
      • nw_connection_set_path_changed_handler

        public static void nw_connection_set_path_changed_handler​(NSObject connection,
                                                                  Network.Block_nw_connection_set_path_changed_handler handler)
        [@function] nw_connection_set_path_changed_handler Define a callback to be fired when the connection's path changes.
        Parameters:
        connection - The connection object.
        handler - The event handler to call when the connection's path changes. Pass NULL to remove the event handler.
      • nw_connection_set_queue

        public static void nw_connection_set_queue​(NSObject connection,
                                                   NSObject queue)
        [@function] nw_connection_set_queue Sets the client callback queue, on which blocks for events will be scheduled. This must be done before calling nw_connection_start().
        Parameters:
        connection - The connection object.
        queue - The client's dispatch queue.
      • nw_connection_start

        public static void nw_connection_start​(NSObject connection)
        [@function] nw_connection_start Starts the connection, which will cause the connection to evaluate its path, do resolution, and try to become readable and writable.
        Parameters:
        connection - The connection object.
      • nw_connection_restart

        public static void nw_connection_restart​(NSObject connection)
        [@function] nw_connection_restart Connections in the waiting state will normally re-attempt on network changes. Call nw_connection_restart() to force a connection in the waiting state to retry connection establishment even without a network change. Calls to restart for connections that are not in the waiting state will be ignored.
        Parameters:
        connection - The connection object.
      • nw_connection_cancel

        public static void nw_connection_cancel​(NSObject connection)
        [@function] nw_connection_cancel Cancel the connection. This will close the connection, and negotiate over the network if applicable for the protocol. The process of cancellation will be completed asynchronously, and the final callback event delivered to the caller will be a state update with a value of nw_connection_state_cancelled. Once this update is delivered, the caller may clean up any associated memory or objects. Outstanding sends and receives will receive errors before the state changes to cancelled. There is no guarantee that any outstanding sends that have not yet delivered send completion handlers will send data before the connection is closed.
        Parameters:
        connection - The connection object.
      • nw_connection_force_cancel

        public static void nw_connection_force_cancel​(NSObject connection)
        [@function] nw_connection_force_cancel A variant of nw_connection_cancel() that indicates that the protocol stack should not close gracefully, but close as quickly as possible without negotiation. For example, a force close would lead to TCP RST packets being sent, as opposed to negotiating with FIN packets.
        Parameters:
        connection - The connection object.
      • nw_connection_cancel_current_endpoint

        public static void nw_connection_cancel_current_endpoint​(NSObject connection)
        [@function] nw_connection_cancel_current_endpoint Cancel the currently connected endpoint, causing the connection to fall through to the next endpoint if available, or fail if no more endpoints are available. This is primarily useful for connections which do not have reliable handshakes, such as UDP. If data is sent on the connection with no response, canceling the current endpoint will allow another address or interface to be attempted.
        Parameters:
        connection - The connection object.
      • nw_connection_receive

        public static void nw_connection_receive​(NSObject connection,
                                                 int minimum_incomplete_length,
                                                 int maximum_length,
                                                 Network.Block_nw_connection_receive completion)
        [@function] nw_connection_receive Receive data from a connection. This may be called before the connection is ready, in which case the receive request will be queued until the connection is ready. The completion handler will be invoked exactly once for each call, so the client must call this function multiple times to receive multiple chunks of data. For protocols that support flow control, such as TCP, calling receive opens the receive window. If the client stops calling receive, the receive window will fill up and the remote peer will stop sending.
        Parameters:
        connection - The connection object on which to receive data. The connection should be in the ready state.
        minimum_incomplete_length - The minimum length to receive from the connection, until the content is complete. Content will be delivered when at least the minimum is available, or the content is complete, whichever comes first.
        maximum_length - The maximum length to receive from the connection.
        completion - A callback to be called when content has been received.
      • nw_connection_receive_message

        public static void nw_connection_receive_message​(NSObject connection,
                                                         Network.Block_nw_connection_receive_message completion)
        [@function] nw_connection_receive_message Receive a single atomic message from a connection. The completion handler will be invoked exactly once for each call, so the client must call this function multiple times to receive multiple messages.
        Parameters:
        connection - The connection object on which to receive the message. The connection should be in the ready state.
        completion - A callback to be called when the message has been received, or an error has occurred.
      • nw_connection_send

        public static void nw_connection_send​(NSObject connection,
                                              NSObject content,
                                              NSObject context,
                                              boolean is_complete,
                                              Network.Block_nw_connection_send completion)
        [@function] nw_connection_send Send data on a connection. This may be called before the connection is ready, in which case the send will be enqueued until the connection is ready to send. This is an asynchronous send and the completion block can be used to determine when the send is complete. There is nothing preventing a client from issuing an excessive number of outstanding sends. To minmize memory footprint and excessive latency as a consequence of buffer bloat, it is advisable to keep a low number of outstanding sends. The completion block can be used to pace subsequent sends.
        Parameters:
        connection - The connection object on which to send data.
        content - A data object to send. This may be NULL only if this send is marking a context (a message or complete connection) as complete in the sending direction.
        context - The context associated with the content, which represents a logical message to be sent on the connection. All content sent within a single context will be sent as an in-order unit, up until the point that the context is marked complete (see is_complete). Once a context is marked complete, it may be re-used as a new logical message. Protocols like TCP that cannot send multiple independent messages at once (serial streams) will only start processing a new context once the prior context has been marked complete. The context can hold protocol metadata to define how to send content, such as flags for IP packets. The context also can define properties that allow a message to ordered relative to other messages if multiple messages are queued. These properties include relative priority, expiration, and antecedent relationships. Some protocols support re-ordering messages within a single connection. For other protocols that do not, like TCP, these properties still take effect when enqueuing data into the stream's send buffer. The ordering of messages applies to the first calls to send on a given context. In order to close a connection on the sending side (a "write close"), send a context that is marked as "final" and mark is_complete. The convenience definition NW_CONNECTION_FINAL_MESSAGE_CONTEXT may be used to define the default final context for a connection. If the caller wants to treat the entire connection as a single stream, with only one context, set NW_CONNECTION_FINAL_MESSAGE_CONTEXT for all sends; marking is_complete on the final send call will send a "write close". Using NW_CONNECTION_DEFAULT_STREAM_CONTEXT has the same behavior as sending NW_CONNECTION_FINAL_MESSAGE_CONTEXT. To send basic datagrams on a connection, use NW_CONNECTION_DEFAULT_MESSAGE_CONTEXT and pass is_complete as true for each datagram. To send data as a single stream on a connection, use NW_CONNECTION_DEFAULT_STREAM_CONTEXT and pass is_complete as true only to mark the end of the stream.
        is_complete - A flag indicating if the caller's sending context (logical message) is now complete. Until a context is marked complete, content sent for other contexts may not be sent immediately (if the protocol requires sending bytes serially, like TCP). For datagram protocols, like UDP, is_complete indicates that the content represents a complete datagram. When sending directly on streaming protocols like TCP, is_complete can be used to indicate that the connection should send a "write close" (a TCP FIN) if the sending context is the final context on the connection. Specifically, to send a "write close", pass NW_CONNECTION_FINAL_MESSAGE_CONTEXT or NW_CONNECTION_DEFAULT_STREAM_CONTEXT for the context (or create a custom context and set nw_content_context_set_is_final()), and pass true for is_complete.
        completion - A callback to be called when the data has been sent, or an error has occurred. This callback does not indicate that the remote side has acknowledged the data. This callback does indicate that the data has either been sent or it has been enqueued to be sent.
      • nw_connection_batch

        public static void nw_connection_batch​(NSObject connection,
                                               Network.Block_nw_connection_batch batch_block)
        [@function] nw_connection_batch Batch several send and/or receive operations together, to hint to the connection that multiple send or recieve operations are expected in quick succession.
        Parameters:
        connection - The connection object.
        batch_block - The batch block will be invoked immediately upon calling this function. The client may call nw_connection_send() or nw_connection_receive() multiple times within the block, and the connection will attempt to batch these operations when the block returns.
      • nw_connection_copy_description

        public static org.moe.natj.general.ptr.BytePtr nw_connection_copy_description​(NSObject connection)
        [@function] nw_connection_copy_description Copy a human-readable description of the connection.
        Parameters:
        connection - The connection object.
        Returns:
        Returns a human-readable string description of the connection. The caller must call free() on the string.
      • nw_connection_copy_current_path

        public static NSObject nw_connection_copy_current_path​(NSObject connection)
        [@function] nw_connection_copy_current_path Copy the current path for a connection. If a connection is established, this will reflect the connected path.
        Parameters:
        connection - The connection object.
        Returns:
        Returns a retained path object, or NULL if the connection has not been started or has been cancelled.
      • nw_connection_copy_protocol_metadata

        public static NSObject nw_connection_copy_protocol_metadata​(NSObject connection,
                                                                    NSObject definition)
        [@function] nw_connection_copy_protocol_metadata Copy the connection-wide metadata for a specific protocol. This allows the caller to introspect per-protocol state, only once the connection has been established. This metadata is also available when receiving data through the content context.
        Parameters:
        connection - The connection object.
        definition - The protocol definition for which metadata will be returned.
        Returns:
        Returns a retained protocol metadata object, or NULL if the connection has not been established yet, or is cancelled.
      • nw_connection_get_maximum_datagram_size

        public static int nw_connection_get_maximum_datagram_size​(NSObject connection)
        [@function] nw_connection_get_maximum_datagram_size Check for the maximum datagram size that can be written on the connection. Any datagrams written should be less than or equal to this size.
        Parameters:
        connection - The connection object.
        Returns:
        Returns a datagram size based on the current MTU and the overhead of the protocols being used.
      • nw_connection_access_establishment_report

        public static void nw_connection_access_establishment_report​(NSObject connection,
                                                                     NSObject queue,
                                                                     Network.Block_nw_connection_access_establishment_report access_block)
        [@function] nw_connection_access_establishment_report Access the establishment report for a connection. The report will be NULL until the connection is in the "ready" state. The callback block will be invoked exactly once on the provided queue.
        Parameters:
        connection - An established connection.
        queue - The dispatch queue on which to call the access_block.
        access_block - A block to invoke with the establishment report, which may be NULL if the connection not ready.
      • nw_establishment_report_get_duration_milliseconds

        public static long nw_establishment_report_get_duration_milliseconds​(NSObject report)
        [@function] nw_establishment_report_get_duration_milliseconds Retrieve the duration of the connection's establishment. This is the total time in milliseconds from when the connection attempt began until the connection becomes ready, including resolution, proxy evaluation, and protocol handshakes.
        Parameters:
        report - An establishment report.
        Returns:
        Returns the number of milliseconds the connection took to establish.
      • nw_establishment_report_get_attempt_started_after_milliseconds

        public static long nw_establishment_report_get_attempt_started_after_milliseconds​(NSObject report)
        [@function] nw_establishment_report_get_attempt_started_after_milliseconds Retrieve the delay from calling start() after which the successful connection attempt began. For connections that succeed on the first attempt, this value will be 0. For connections that move into the "waiting" state, this value will be greater than 0.
        Parameters:
        report - An establishment report.
        Returns:
        Returns the number of milliseconds from connection start to the beginning of the successful connection attempt.
      • nw_establishment_report_get_previous_attempt_count

        public static int nw_establishment_report_get_previous_attempt_count​(NSObject report)
        [@function] nw_establishment_report_get_previous_attempt_count Retrieve the number of connection attempts made before the successful attempt. For connections that succeed on the first attempt, this value will be 0. For connections that move into the "waiting" state, this value will be greater than 0.
        Parameters:
        report - An establishment report.
        Returns:
        Returns the number of connection attempts made before the successful attempt.
      • nw_establishment_report_get_used_proxy

        public static boolean nw_establishment_report_get_used_proxy​(NSObject report)
        [@function] nw_establishment_report_get_used_proxy Check if the connection used a proxy during establishment.
        Parameters:
        report - An establishment report.
        Returns:
        Returns true if the connection used a proxy, false otherwise.
      • nw_establishment_report_get_proxy_configured

        public static boolean nw_establishment_report_get_proxy_configured​(NSObject report)
        [@function] nw_establishment_report_get_proxy_configured Check if a proxy configuration applied to the connection, even if the connection did not end up using a proxy for the successful attempt.
        Parameters:
        report - An establishment report.
        Returns:
        Returns true if a proxy configuration applied to the connection, false otherwise.
      • nw_establishment_report_copy_proxy_endpoint

        public static NSObject nw_establishment_report_copy_proxy_endpoint​(NSObject report)
        [@function] nw_establishment_report_copy_proxy_endpoint Access the endpoint of the proxy used by a connection, if applicable.
        Parameters:
        report - An establishment report.
        Returns:
        Returns an allocated endpoint object if a proxy was used by the connection, or NULL if no proxy was used. Callers are responsible for deallocating using nw_release(obj) or [obj release]. These objects support ARC.
      • nw_establishment_report_enumerate_resolutions

        public static void nw_establishment_report_enumerate_resolutions​(NSObject report,
                                                                         Network.Block_nw_establishment_report_enumerate_resolutions enumerate_block)
        [@function] nw_establishment_report_enumerate_resolutions Enumerate the steps of connection establishment that involved endpoint resolution, such as DNS hostname resolution and Bonjour service resolution. The provided block will be called inline zero or more times.
        Parameters:
        report - An establishment report.
        enumerate_block - A block to be invoked zero or more times, once for each step of resolution used during connection establishment. The values passed to the enumerator are: - source: The source of the resolution (query or cache). - milliseconds: The number of milliseconds spent on this resolution step. - endpoint_count: The number of resolved endpoints discovered by the resolution step. - successful_endpoint: The resolved endpoint that led to a successful connection. - preferred_endpoint: The first resolved endpoint attempted, which may be the same as the successful_endpoint. Returning true from the block indicates that the enumeration should continue. Returning false indicates that the enumeration should stop.
      • nw_establishment_report_enumerate_protocols

        public static void nw_establishment_report_enumerate_protocols​(NSObject report,
                                                                       Network.Block_nw_establishment_report_enumerate_protocols enumerate_block)
        [@function] nw_establishment_report_enumerate_protocols Enumerate the protocols used in the established connection. The provided block will be called inline zero or more times.
        Parameters:
        report - An establishment report.
        enumerate_block - A block to be invoked zero or more times, once for each protocol used in the established connection. The values passed to the enumerator are: - protocol: The protocol definition. - handshake_milliseconds: The number of milliseconds spent on the protocol's handshake. - handshake_rtt_milliseconds: The round trip time in milliseconds measured by the protocol's handshake. Returning true from the block indicates that the enumeration should continue. Returning false indicates that the enumeration should stop.
      • nw_connection_create_new_data_transfer_report

        public static NSObject nw_connection_create_new_data_transfer_report​(NSObject connection)
        [@function] nw_connection_create_new_data_transfer_report Create a new data transfer report on a connection. Multiple reports may be created for a single connection. The report begins capturing data when the connection becomes ready, or when the report is created (whichever occurs last). Call nw_data_transfer_report_collect() to complete collection of report, after which point the details of the report will be available.
        Parameters:
        connection - A connection object, in or before the ready state.
        Returns:
        Returns an allocated nw_data_transfer_report_t object on success. Callers are responsible for deallocating using nw_release(obj) or [obj release]. These objects support ARC. Returns NULL on failure. Fails due to invalid parameters.
      • nw_data_transfer_report_get_state

        public static int nw_data_transfer_report_get_state​(NSObject report)
        [@function] nw_data_transfer_report_get_state Access the state of a data transfer report. Once a report is "collected", individual fields may be read.
        Parameters:
        report - A data transfer report to check.
        Returns:
        Returns the current state of the data transfer report.
      • nw_data_transfer_report_collect

        public static void nw_data_transfer_report_collect​(NSObject report,
                                                           NSObject queue,
                                                           Network.Block_nw_data_transfer_report_collect collect_block)
        [@function] nw_data_transfer_report_collect Mark a data transfer report as complete, and request collection of values. Once the report has been collected, the callback block will be invoked exactly once on the provided dispatch queue. If a connection is cancelled or fails prior to the report being collected, the report will automatically be collected. Calling nw_data_transfer_report_collect() will be redundant but not harmful.
        Parameters:
        report - A data transfer report to check.
        queue - The dispatch queue on which to call the collect_block.
        collect_block - A block to invoke once the report has been collected.
      • nw_data_transfer_report_get_duration_milliseconds

        public static long nw_data_transfer_report_get_duration_milliseconds​(NSObject report)
        [@function] nw_data_transfer_report_get_duration_milliseconds Retrieve the duration of the data transfer report. This is a length of time in milliseconds which can be used to calculate throughput when compared to application and transport byte counts. The start time is calculated from when the report was created, or the connection became ready if the connection was not ready when the report was created. The duration ends when the report is collected, or the connection fails or is cancelled.
        Parameters:
        report - A data transfer report in the "collected" state.
        Returns:
        Returns the duration of the data transport report in milliseconds, or 0 if the report is not in the "collected" state.
      • nw_data_transfer_report_get_path_count

        public static int nw_data_transfer_report_get_path_count​(NSObject report)
        [@function] nw_data_transfer_report_get_path_count Retrieve the number of paths used by the connection for the duration of the report. Any value greater than or equal to 0 and less than this count may be used as a "path_index" for retrieving specific details from the report.
        Parameters:
        report - A data transfer report in the "collected" state.
        Returns:
        Returns the number of paths used by the connection, which limits the value of the "path_index" parameter used in other report functions. Returns 0 if the report is not in the "collected" state.
      • nw_data_transfer_report_get_received_ip_packet_count

        public static long nw_data_transfer_report_get_received_ip_packet_count​(NSObject report,
                                                                                int path_index)
        [@function] nw_data_transfer_report_get_received_ip_packet_count Retrieve the number of IP packets received on a given path for the duration of the report.
        Parameters:
        report - A data transfer report in the "collected" state.
        path_index - The index for the path over which data is transferred. For non-multipath connections, pass 0 as the path index to access the single path. Passing NW_ALL_PATHS for this function returns the sum of all paths.
        Returns:
        Returns the number of IP packets received, or 0 if the report is not in the "collected" state.
      • nw_data_transfer_report_get_sent_ip_packet_count

        public static long nw_data_transfer_report_get_sent_ip_packet_count​(NSObject report,
                                                                            int path_index)
        [@function] nw_data_transfer_report_get_sent_ip_packet_count Retrieve the number of IP packets sent on a given path for the duration of the report.
        Parameters:
        report - A data transfer report in the "collected" state.
        path_index - The index for the path over which data is transferred. For non-multipath connections, pass 0 as the path index to access the single path. Passing NW_ALL_PATHS for this function returns the sum of all paths.
        Returns:
        Returns the number of IP packets sent, or 0 if the report is not in the "collected" state.
      • nw_data_transfer_report_get_received_transport_byte_count

        public static long nw_data_transfer_report_get_received_transport_byte_count​(NSObject report,
                                                                                     int path_index)
        [@function] nw_data_transfer_report_get_received_transport_byte_count Retrieve the number of transport protocol bytes (such as TCP stream bytes) received on a given path for the duration of the report.
        Parameters:
        report - A data transfer report in the "collected" state.
        path_index - The index for the path over which data is transferred. For non-multipath connections, pass 0 as the path index to access the single path. Passing NW_ALL_PATHS for this function returns the sum of all paths.
        Returns:
        Returns the number of transport protocol bytes received, or 0 if the report is not in the "collected" state.
      • nw_data_transfer_report_get_received_transport_duplicate_byte_count

        public static long nw_data_transfer_report_get_received_transport_duplicate_byte_count​(NSObject report,
                                                                                               int path_index)
        [@function] nw_data_transfer_report_get_received_transport_duplicate_byte_count Retrieve the number of duplicate transport protocol bytes (such as duplicate TCP bytes) received on a given path for the duration of the report.
        Parameters:
        report - A data transfer report in the "collected" state.
        path_index - The index for the path over which data is transferred. For non-multipath connections, pass 0 as the path index to access the single path. Passing NW_ALL_PATHS for this function returns the sum of all paths.
        Returns:
        Returns the number of duplicate transport protocol bytes received, or 0 if the report is not in the "collected" state.
      • nw_data_transfer_report_get_received_transport_out_of_order_byte_count

        public static long nw_data_transfer_report_get_received_transport_out_of_order_byte_count​(NSObject report,
                                                                                                  int path_index)
        [@function] nw_data_transfer_report_get_received_transport_out_of_order_byte_count Retrieve the number of out-of-order transport protocol bytes (such as out-of-order TCP bytes) received on a given path for the duration of the report.
        Parameters:
        report - A data transfer report in the "collected" state.
        path_index - The index for the path over which data is transferred. For non-multipath connections, pass 0 as the path index to access the single path. Passing NW_ALL_PATHS for this function returns the sum of all paths.
        Returns:
        Returns the number of out-of-order transport protocol bytes received, or 0 if the report is not in the "collected" state.
      • nw_data_transfer_report_get_sent_transport_byte_count

        public static long nw_data_transfer_report_get_sent_transport_byte_count​(NSObject report,
                                                                                 int path_index)
        [@function] nw_data_transfer_report_get_sent_transport_byte_count Retrieve the number of transport protocol bytes (such as TCP stream bytes) sent on a given path for the duration of the report.
        Parameters:
        report - A data transfer report in the "collected" state.
        path_index - The index for the path over which data is transferred. For non-multipath connections, pass 0 as the path index to access the single path. Passing NW_ALL_PATHS for this function returns the sum of all paths.
        Returns:
        Returns the number of transport protocol bytes sent, or 0 if the report is not in the "collected" state.
      • nw_data_transfer_report_get_sent_transport_retransmitted_byte_count

        public static long nw_data_transfer_report_get_sent_transport_retransmitted_byte_count​(NSObject report,
                                                                                               int path_index)
        [@function] nw_data_transfer_report_get_sent_transport_retransmitted_byte_count Retrieve the number of retransmitted transport protocol bytes (such as retransmitted TCP bytes) sent on a given path for the duration of the report.
        Parameters:
        report - A data transfer report in the "collected" state.
        path_index - The index for the path over which data is transferred. For non-multipath connections, pass 0 as the path index to access the single path. Passing NW_ALL_PATHS for this function returns the sum of all paths.
        Returns:
        Returns the number of retransmitted transport protocol bytes sent, or 0 if the report is not in the "collected" state.
      • nw_data_transfer_report_get_transport_smoothed_rtt_milliseconds

        public static long nw_data_transfer_report_get_transport_smoothed_rtt_milliseconds​(NSObject report,
                                                                                           int path_index)
        [@function] nw_data_transfer_report_get_transport_smoothed_rtt_milliseconds Retrieve the smoothed average for the transport protocol's round trip time (RTT) on a given path for the duration of the report, measured in milliseconds.
        Parameters:
        report - A data transfer report in the "collected" state.
        path_index - The index for the path over which data is transferred. For non-multipath connections, pass 0 as the path index to access the single path. Passing NW_ALL_PATHS for this function is equivalent to passing 0.
        Returns:
        Returns the smoothed RTT as measured by the transport protocol, or 0 if the report is not in the "collected" state.
      • nw_data_transfer_report_get_transport_minimum_rtt_milliseconds

        public static long nw_data_transfer_report_get_transport_minimum_rtt_milliseconds​(NSObject report,
                                                                                          int path_index)
        [@function] nw_data_transfer_report_get_transport_minimum_rtt_milliseconds Retrieve the minimum (best) round trip time (RTT) on a given path for the duration of the report, measured in milliseconds.
        Parameters:
        report - A data transfer report in the "collected" state.
        path_index - The index for the path over which data is transferred. For non-multipath connections, pass 0 as the path index to access the single path. Passing NW_ALL_PATHS for this function is equivalent to passing 0.
        Returns:
        Returns the minimum RTT as measured by the transport protocol, or 0 if the report is not in the "collected" state.
      • nw_data_transfer_report_get_transport_rtt_variance

        public static long nw_data_transfer_report_get_transport_rtt_variance​(NSObject report,
                                                                              int path_index)
        [@function] nw_data_transfer_report_get_transport_rtt_variance Retrieve the variance of the round trip time (RTT) on a given path for the duration of the report.
        Parameters:
        report - A data transfer report in the "collected" state.
        path_index - The index for the path over which data is transferred. For non-multipath connections, pass 0 as the path index to access the single path. Passing NW_ALL_PATHS for this function is equivalent to passing 0.
        Returns:
        Returns the RTT variance as measured by the transport protocol, or 0 if the report is not in the "collected" state.
      • nw_data_transfer_report_get_received_application_byte_count

        public static long nw_data_transfer_report_get_received_application_byte_count​(NSObject report,
                                                                                       int path_index)
        [@function] nw_data_transfer_report_get_received_application_byte_count Retrieve the number of application bytes received on a given path for the duration of the report.
        Parameters:
        report - A data transfer report in the "collected" state.
        path_index - The index for the path over which data is transferred. For non-multipath connections, pass 0 as the path index to access the single path. Passing NW_ALL_PATHS for this function returns the sum of all paths.
        Returns:
        Returns the number of application bytes received, or 0 if the report is not in the "collected" state.
      • nw_data_transfer_report_get_sent_application_byte_count

        public static long nw_data_transfer_report_get_sent_application_byte_count​(NSObject report,
                                                                                   int path_index)
        [@function] nw_data_transfer_report_get_sent_application_byte_count Retrieve the number of application bytes sent on a given path for the duration of the report.
        Parameters:
        report - A data transfer report in the "collected" state.
        path_index - The index for the path over which data is transferred. For non-multipath connections, pass 0 as the path index to access the single path. Passing NW_ALL_PATHS for this function returns the sum of all paths.
        Returns:
        Returns the number of application bytes sent, or 0 if the report is not in the "collected" state.
      • nw_data_transfer_report_copy_path_interface

        public static NSObject nw_data_transfer_report_copy_path_interface​(NSObject report,
                                                                           int path_index)
        [@function] nw_data_transfer_report_copy_path_interface Retrieve the interface used for data transfer for a given path used by a connection.
        Parameters:
        report - A data transfer report in the "collected" state.
        path_index - The index for the path over which data is transferred. For non-multipath connections, pass 0 as the path index to access the single path. Passing NW_ALL_PATHS for this function is equivalent to passing 0.
        Returns:
        Returns a retained nw_interface_t object on success. Callers are responsible for deallocating using nw_release(obj) or [obj release]. These objects support ARC. Returns NULL on failure. Fails if the report is not yet collected.
      • nw_framer_protocol_create_message

        public static NSObject nw_framer_protocol_create_message​(NSObject definition)
        [@function] nw_framer_protocol_create_message Create an instance of a framer message on which per- message options can be configured when sending data on a connection. This is intended to be used by the application above the connection to send message data down to the framer protocol instance.
        Parameters:
        definition - The framer protocol definition, as retrieved from nw_protocol_options_copy_definition() on the framer options.
        Returns:
        Returns a retained protocol metadata object.
      • nw_protocol_metadata_is_framer_message

        public static boolean nw_protocol_metadata_is_framer_message​(NSObject metadata)
        [@function] nw_protocol_metadata_is_framer_message Checks if a protocol metadata object is a framer protocol message. This indicates whether or not it is compatible with the framer message setters and accessors.
        Parameters:
        metadata - The protocol metadata to check.
        Returns:
        Returns true if the metadata is associated with a framer protocol definition, false otherwise.
      • nw_framer_message_create

        public static NSObject nw_framer_message_create​(NSObject framer)
        [@function] nw_framer_message_create Create a framer message, given a framer instance. This is intended to be used within the implementation of the framer protocol to create messages that are delivered as input to the application.
        Parameters:
        framer - The framer instance object.
        Returns:
        Returns a retained framer message object.
      • nw_framer_message_set_value

        public static void nw_framer_message_set_value​(NSObject message,
                                                       java.lang.String key,
                                                       org.moe.natj.general.ptr.VoidPtr value,
                                                       Network.Block_nw_framer_message_set_value dispose_value)
        [@function] nw_framer_message_set_value Set a key-value pair on a framer message, with a custom dispose function for the value.
        Parameters:
        message - The framer message object.
        key - The string key to identify the value.
        value - A pointer to the value to store.
        dispose_value - A block to invoke to dispose the stored value.
      • nw_framer_message_access_value

        public static boolean nw_framer_message_access_value​(NSObject message,
                                                             java.lang.String key,
                                                             Network.Block_nw_framer_message_access_value access_value)
        [@function] nw_framer_message_access_value Access the value with a key on a framer message.
        Parameters:
        message - The framer message object.
        key - The string key to identify the value.
        access_value - A block to invoke inline with the pointer to the stored value. This pointer may be NULL if no value is stored for the key.
        Returns:
        Returns the boolean value returned by the access_value block, or else false if the parameters were invalid.
      • nw_framer_message_set_object_value

        public static void nw_framer_message_set_object_value​(NSObject message,
                                                              java.lang.String key,
                                                              java.lang.Object value)
        [@function] nw_framer_message_set_object_value Set a key-value pair on a framer message, where the value is a reference-counted object.
        Parameters:
        message - The framer message object.
        key - The string key to identify the value.
        value - A reference counted object to store.
      • nw_framer_message_copy_object_value

        public static java.lang.Object nw_framer_message_copy_object_value​(NSObject message,
                                                                           java.lang.String key)
        [@function] nw_framer_message_copy_object_value Copy the stored object value using a key on a framer message.
        Parameters:
        message - The framer message object.
        key - The string key to identify the value.
        Returns:
        Returns a reference counted object with a +1 reference count, or NULL if no value was found for the specified key.
      • nw_framer_create_definition

        public static NSObject nw_framer_create_definition​(java.lang.String identifier,
                                                           int flags,
                                                           Network.Block_nw_framer_create_definition start_handler)
        [@function] nw_framer_create_definition Create a protocol definition for a custom framer protocol.
        Parameters:
        identifier - A string identifier used to name this framer protocol. This does not define uniqueness, and is primarily used for logging and debugging.
        flags - Flags to describe extended options on framer protocol behavior, all prefixed with "NW_FRAMER_CREATE_FLAGS_".
        start_handler - A block to be invoked when starting a new instance of the framer protocol. This may occur more than once for a single nw_connection.
        Returns:
        Returns a retained protocol definition that can be used with protocol options and metadata.
      • nw_framer_create_options

        public static NSObject nw_framer_create_options​(NSObject framer_definition)
        [@function] nw_framer_create_options Create protocol options from a framer definition. This object can be added to an nw_protocol_stack_t to be used in an nw_connection_t or an nw_listener_t.
        Parameters:
        framer_definition - A protocol definition created with nw_framer_create_definition().
        Returns:
        Returns a retained protocol options object to add into a protocol stack.
      • nw_framer_set_input_handler

        public static void nw_framer_set_input_handler​(NSObject framer,
                                                       Network.Block_nw_framer_set_input_handler input_handler)
        [@function] nw_framer_set_input_handler Set a handler block to be invoked whenever new input data is available to be parsed. When this block is run, the implementation should call functions like nw_framer_parse_input() and nw_framer_deliver_input(). This setter is required, and must only be set from within the invocation of a nw_framer_start_handler_t.
        Parameters:
        framer - The framer instance object, passed via the nw_framer_start_handler_t block.
        input_handler - The block to invoke whenever new input data is available.
      • nw_framer_set_output_handler

        public static void nw_framer_set_output_handler​(NSObject framer,
                                                        Network.Block_nw_framer_set_output_handler output_handler)
        [@function] nw_framer_set_output_handler Set a handler block to be invoked whenever an output message is ready to be sent. When this block is run, the implementation should call functions like nw_framer_parse_output() and nw_framer_write_output(). This setter is required, and must only be set from within the invocation of a nw_framer_start_handler_t.
        Parameters:
        framer - The framer instance object, passed via the nw_framer_start_handler_t block.
        output_handler - The block to invoke whenever a new output message is ready to be sent.
      • nw_framer_set_wakeup_handler

        public static void nw_framer_set_wakeup_handler​(NSObject framer,
                                                        Network.Block_nw_framer_set_wakeup_handler wakeup_handler)
        [@function] nw_framer_set_wakeup_handler Set a handler block to be invoked whenever the wakeup timer set via nw_framer_schedule_wakeup() fires. This is intended to be used for sending keepalives or other control traffic. This setter is optional, and must only be set from within the invocation of a nw_framer_start_handler_t.
        Parameters:
        framer - The framer instance object, passed via the nw_framer_start_handler_t block.
        wakeup_handler - The block to invoke whenever the timeout set by nw_framer_schedule_wakeup() is reached.
      • nw_framer_set_stop_handler

        public static void nw_framer_set_stop_handler​(NSObject framer,
                                                      Network.Block_nw_framer_set_stop_handler stop_handler)
        [@function] nw_framer_set_stop_handler Set a handler block to be invoked when the connection is being disconnected, to allow the framer implementation a chance to send any final data. This setter is optional, and must only be set from within the invocation of a nw_framer_start_handler_t.
        Parameters:
        framer - The framer instance object, passed via the nw_framer_start_handler_t block.
        stop_handler - The block to invoke when the connection is disconnected.
      • nw_framer_set_cleanup_handler

        public static void nw_framer_set_cleanup_handler​(NSObject framer,
                                                         Network.Block_nw_framer_set_cleanup_handler cleanup_handler)
        [@function] nw_framer_set_cleanup_handler Set a handler block to be invoked when the protocol stack is being torn down and deallocated. This is the opportunity for the framer implementation to release any state it may have saved. This setter is optional, and must only be set from within the invocation of a nw_framer_start_handler_t.
        Parameters:
        framer - The framer instance object, passed via the nw_framer_start_handler_t block.
        cleanup_handler - The block to invoke when the protocol stack is being deallocated.
      • nw_framer_mark_ready

        public static void nw_framer_mark_ready​(NSObject framer)
        [@function] nw_framer_mark_ready Mark the connection associated with the framer instance as ready (see nw_connection_state_ready). This is intended to be used by protocols that require a handshake before being able to send application data. This should only be called if the return value to the nw_framer_start_handler_t block was nw_framer_start_result_will_call_ready. To ensure thread safety, this function can only be called in one of the callback blocks invoked on the framer, or in a block passed to nw_framer_async().
        Parameters:
        framer - The framer instance object.
      • nw_framer_prepend_application_protocol

        public static boolean nw_framer_prepend_application_protocol​(NSObject framer,
                                                                     NSObject protocol_options)
        [@function] nw_framer_prepend_application_protocol Dynamically add a protocol to a connection establishment attempt "above" the framer protocol. This means that the protocol above will start running once the framer becomes ready by calling nw_framer_mark_ready(). This can only be used with framers that return a value of nw_framer_start_result_will_call_ready to their start handlers. An example of using this functionality is adding a security protocol, like TLS, above a framer once that framer completes its initial handshake. To ensure thread safety, this function can only be called in one of the callback blocks invoked on the framer, or in a block passed to nw_framer_async().
        Parameters:
        framer - The framer instance object.
        protocol_options - Protocol options for an application protocol to dynamically add "above" the framer.
        Returns:
        Returns true if the protocol was successfully added, or false it it could not be added. This will fail if the framer is already marked ready.
      • nw_framer_mark_failed_with_error

        public static void nw_framer_mark_failed_with_error​(NSObject framer,
                                                            int error_code)
        [@function] nw_framer_mark_failed_with_error Mark the connection associated with the framer instance as failed (see nw_connection_state_failed). To ensure thread safety, this function can only be called in one of the callback blocks invoked on the framer, or in a block passed to nw_framer_async().
        Parameters:
        framer - The framer instance object.
        error_code - An error code to describe why the connection failed.
      • nw_framer_parse_input

        public static boolean nw_framer_parse_input​(NSObject framer,
                                                    long minimum_incomplete_length,
                                                    long maximum_length,
                                                    org.moe.natj.general.ptr.BytePtr temp_buffer,
                                                    Network.Block_nw_framer_parse_input parse)
        [@function] nw_framer_parse_input Parse currently available input from the location of the input cursor in the stream or message being parsed. The parse completion block will always be invoked inline exactly once. To ensure thread safety, this function can only be called in one of the callback blocks invoked on the framer, or in a block passed to nw_framer_async().
        Parameters:
        framer - The framer instance object.
        minimum_incomplete_length - The minimum number of bytes to parse. If this amount is not available, the parse completion block will be invoked with 0 bytes.
        maximum_length - The maximum number of bytes to parse as a contiguous buffer. If temp_buffer is not NULL, then this represents the length of valid bytes in temp_buffer.
        temp_buffer - A buffer provided by the caller to copy parse bytes into. If it is not NULL, it must have at least maximum_length bytes available, and any parsed bytes will be copied into the buffer. Any data stored in temp_buffer will be overwritten. If it is NULL, the buffer provided in the completion will not copy unless a copy is required to provide the minimum bytes as a contiguous buffer. The temp_buffer allows the caller to guarantee alignment properties of the buffer it parses.
        parse - The completion that provides the bytes to parse, which will be called exactly once.
        Returns:
        Returns true if the parse succeeded, or false if not enough bytes were available.
      • nw_framer_deliver_input

        public static void nw_framer_deliver_input​(NSObject framer,
                                                   java.lang.String input_buffer,
                                                   long input_length,
                                                   NSObject message,
                                                   boolean is_complete)
        [@function] nw_framer_deliver_input Deliver arbitrary data to the application. This is intended to deliver any data that is generated or transformed by the protocol instance. It will incur a copy of bytes. To ensure thread safety, this function can only be called in one of the callback blocks invoked on the framer, or in a block passed to nw_framer_async().
        Parameters:
        framer - The framer instance object.
        input_buffer - The bytes to deliver to the application. This must be non-NULL. If an empty message needs to be delivered, use nw_framer_deliver_input_no_copy().
        input_length - The length of input_buffer. This must be non-zero.
        message - The message to associate with the received data.
        is_complete - A boolean indicating whether or not this data represents the end of the message.
      • nw_framer_deliver_input_no_copy

        public static boolean nw_framer_deliver_input_no_copy​(NSObject framer,
                                                              long input_length,
                                                              NSObject message,
                                                              boolean is_complete)
        [@function] nw_framer_deliver_input_no_copy Deliver bytes directly to the application without any transformation or copy. The bytes will start at the current input cursor used for parsing, and will implicitly advance the cursor by the length being delivered. To ensure thread safety, this function can only be called in one of the callback blocks invoked on the framer, or in a block passed to nw_framer_async().
        Parameters:
        framer - The framer instance object.
        input_length - The number of input bytes to deliver. This will advance the parsing cursor by the specified number of bytes. The length may be 0, which can be used to indicate the end of the message if is_complete is set.
        message - The message to associate with the received data.
        is_complete - A boolean indicating whether or not this data represents the end of the message.
        Returns:
        Returns true if the input was delivered immediately, or false if it will be delivered once more bytes become available.
      • nw_framer_pass_through_input

        public static void nw_framer_pass_through_input​(NSObject framer)
        [@function] nw_framer_pass_through_input Mark the input side of the framer as a pass-through, which means the framer will not be notified of any further input data. To ensure thread safety, this function can only be called in one of the callback blocks invoked on the framer, or in a block passed to nw_framer_async().
        Parameters:
        framer - The framer instance object.
      • nw_framer_parse_output

        public static boolean nw_framer_parse_output​(NSObject framer,
                                                     long minimum_incomplete_length,
                                                     long maximum_length,
                                                     org.moe.natj.general.ptr.BytePtr temp_buffer,
                                                     Network.Block_nw_framer_parse_output parse)
        [@function] nw_framer_parse_output Parse currently available output from a message from the location of the output cursor in the message being parsed. The parse completion block will always be invoked inline exactly once. This function must only be called from within the output handler set with nw_framer_set_output_handler().
        Parameters:
        framer - The framer instance object.
        minimum_incomplete_length - The minimum number of bytes to parse. If this amount is not available, the parse completion block will be invoked with 0 bytes.
        maximum_length - The maximum number of bytes to parse as a contiguous buffer. If temp_buffer is not NULL, then this represents the length of valid bytes in temp_buffer.
        temp_buffer - A buffer provided by the caller to copy parse bytes into. If it is not NULL, it must have at least maximum_length bytes available, and any parsed bytes will be copied into the buffer. Any data stored in temp_buffer will be overwritten. If it is NULL, the buffer provided in the completion will not copy unless a copy is required to provide the minimum bytes as a contiguous buffer. The temp_buffer allows the caller to guarantee alignment properties of the buffer it parses.
        parse - The completion that provides the bytes to parse, which will be called exactly once.
        Returns:
        Returns true if the parse succeeded, or false if not enough bytes were available.
      • nw_framer_write_output

        public static void nw_framer_write_output​(NSObject framer,
                                                  java.lang.String output_buffer,
                                                  long output_length)
        [@function] nw_framer_write_output Write arbitrary bytes as part of an outbound message. This is intended to be used for adding headers around application data, or writing any other data that is generated or transformed by the protocol instance. It does not pass along data directly from the application. This variant will copy bytes. This function may be called as part of any framer callback, not just the output handler. To ensure thread safety, this function can only be called in one of the callback blocks invoked on the framer, or in a block passed to nw_framer_async().
        Parameters:
        framer - The framer instance object.
        output_buffer - The bytes to write.
        output_length - The length of output_buffer.
      • nw_framer_write_output_data

        public static void nw_framer_write_output_data​(NSObject framer,
                                                       NSObject output_data)
        [@function] nw_framer_write_output_data Write arbitrary bytes as part of an outbound message. This is intended to be used for adding headers around application data, or writing any other data that is generated or transformed by the protocol instance. It does not pass along data directly from the application. This variant is the same as nw_framer_write_output(), but allows the implementation to pass its buffer as a dispatch_data_t to avoid a copy. This function may be called as part of any framer callback, not just the output handler. To ensure thread safety, this function can only be called in one of the callback blocks invoked on the framer, or in a block passed to nw_framer_async().
        Parameters:
        framer - The framer instance object.
        output_data - A dispatch_data_t to write.
      • nw_framer_write_output_no_copy

        public static boolean nw_framer_write_output_no_copy​(NSObject framer,
                                                             long output_length)
        [@function] nw_framer_write_output_no_copy Write bytes directly from the application without any transformation or copy. The bytes will start at the current output cursor used for parsing, and will implicitly advance the cursor by the length being written. This function must only be called from within the output handler set with nw_framer_set_output_handler(). To ensure thread safety, this function can only be called in one of the callback blocks invoked on the framer, or in a block passed to nw_framer_async().
        Parameters:
        framer - The framer instance object.
        output_length - The number of application bytes to write. This will advance the parsing cursor by the specified number of bytes.
        Returns:
        Returns true if the write could be completed, otherwise false if the call was made from an invalid context or with an invalid number of bytes.
      • nw_framer_pass_through_output

        public static void nw_framer_pass_through_output​(NSObject framer)
        [@function] nw_framer_pass_through_output Mark the output side of the framer as a pass-through, which means the framer will not be notified of any further output data. To ensure thread safety, this function can only be called in one of the callback blocks invoked on the framer, or in a block passed to nw_framer_async().
        Parameters:
        framer - The framer instance object.
      • nw_framer_schedule_wakeup

        public static void nw_framer_schedule_wakeup​(NSObject framer,
                                                     long milliseconds)
        [@function] nw_framer_schedule_wakeup Schedule a wakeup on the framer instance for a number of milliseconds into the future. If this is called multiple times before the timeout is reached, the new value replaces the previous value. To ensure thread safety, this function can only be called in one of the callback blocks invoked on the framer, or in a block passed to nw_framer_async().
        Parameters:
        framer - The framer instance object.
        milliseconds - The number of milliseconds into the future at which to invoke the wakeup handler. Pass the reserved value NW_FRAMER_WAKEUP_TIME_FOREVER to push the wakeup timer out to "forever", effectively unscheduling the timer.
      • nw_framer_async

        public static void nw_framer_async​(NSObject framer,
                                           Network.Block_nw_framer_async async_block)
        [@function] nw_framer_async Schedule a block asynchronously on the framer instance. This must be used anytime the caller wants to perform any other action on the framer instance while not directly in the callstack of a callback from the framer.
        Parameters:
        framer - The framer instance object.
        async_block - A block to execute on the correct scheduling context for the framer instance.
      • nw_framer_copy_remote_endpoint

        public static NSObject nw_framer_copy_remote_endpoint​(NSObject framer)
        [@function] nw_framer_copy_remote_endpoint Access the remote endpoint being used for a given instance of a framer. To ensure thread safety, this function can only be called in one of the callback blocks invoked on the framer, or in a block passed to nw_framer_async().
        Parameters:
        framer - The framer instance.
        Returns:
        Returns a retained endpoint object representing the remote side of a connection.
      • nw_framer_copy_local_endpoint

        public static NSObject nw_framer_copy_local_endpoint​(NSObject framer)
        [@function] nw_framer_copy_local_endpoint Access the local endpoint being used for a given instance of a framer. To ensure thread safety, this function can only be called in one of the callback blocks invoked on the framer, or in a block passed to nw_framer_async().
        Parameters:
        framer - The framer instance.
        Returns:
        Returns a retained endpoint object representing the local side of a connection.
      • nw_framer_copy_parameters

        public static NSObject nw_framer_copy_parameters​(NSObject framer)
        [@function] nw_framer_copy_parameters Access the parameters being used for a given instance of a framer. To ensure thread safety, this function can only be called in one of the callback blocks invoked on the framer, or in a block passed to nw_framer_async().
        Parameters:
        framer - The framer instance.
        Returns:
        Returns a retained parameters object.
      • nw_protocol_copy_ip_definition

        public static NSObject nw_protocol_copy_ip_definition()
        [@function] nw_protocol_copy_ip_definition Access the definition of the default system protocol implementation of IP (Internet Protocol). This protocol can be used as part of a connection's protocol stack as the internet protocol.
        Returns:
        Returns a retained protocol definition object.
      • nw_ip_options_set_version

        public static void nw_ip_options_set_version​(NSObject options,
                                                     int version)
        [@function] nw_ip_options_set_version Specify a single version of the Internet Protocol to allow. Setting this value will constrain which address endpoints can be used, and will filter DNS results during connection establishment.
        Parameters:
        options - An IP protocol options object.
        version - A specific, restricted IP version.
      • nw_ip_options_set_hop_limit

        public static void nw_ip_options_set_hop_limit​(NSObject options,
                                                       byte hop_limit)
        [@function] nw_ip_options_set_hop_limit Configure the IP hop limit (or 'TTL' for IPv4).
        Parameters:
        options - An IP protocol options object.
        hop_limit - The hop limit to set on outgoing IP packets.
      • nw_ip_options_set_use_minimum_mtu

        public static void nw_ip_options_set_use_minimum_mtu​(NSObject options,
                                                             boolean use_minimum_mtu)
        [@function] nw_ip_options_set_use_minimum_mtu Configure IP to use the minimum MTU value, which is 1280 bytes for IPv6. This value has no effect for IPv4.
        Parameters:
        options - An IP protocol options object.
        use_minimum_mtu - A boolean indicating that the IP should use its minimum MTU value.
      • nw_ip_options_set_disable_fragmentation

        public static void nw_ip_options_set_disable_fragmentation​(NSObject options,
                                                                   boolean disable_fragmentation)
        [@function] nw_ip_options_set_disable_fragmentation Configure IP to disable fragmentation on outgoing packets.
        Parameters:
        options - An IP protocol options object.
        disable_fragmentation - A boolean indicating that the IP should use disable fragmentation on outgoing packets.
      • nw_ip_options_set_calculate_receive_time

        public static void nw_ip_options_set_calculate_receive_time​(NSObject options,
                                                                    boolean calculate_receive_time)
        [@function] nw_ip_options_set_calculate_receive_time Configure IP to calculate receive time for inbound packets.
        Parameters:
        options - An IP protocol options object.
        calculate_receive_time - A boolean indicating that the IP packets should mark their receive time in IP metadata.
      • nw_ip_options_set_local_address_preference

        public static void nw_ip_options_set_local_address_preference​(NSObject options,
                                                                      int preference)
        [@function] nw_ip_options_set_local_address_preference Specify a preference for how to select local addresses for outbound connections.
        Parameters:
        options - An IP protocol options object.
        preference - Preference for how to select local addresses.
      • nw_ip_create_metadata

        public static NSObject nw_ip_create_metadata()
        [@function] nw_ip_create_metadata Create an instance of IP metadata that can be used to configure per-packet options when sending data on a connection.
        Returns:
        Returns a retained protocol metadata object.
      • nw_protocol_metadata_is_ip

        public static boolean nw_protocol_metadata_is_ip​(NSObject metadata)
        [@function] nw_protocol_metadata_is_ip Checks if a protocol metadata object is compatible with the accessors defined in this file for the default system implementation of IP.
        Returns:
        Returns true if the metadata is for the default system IP, false otherwise.
      • nw_ip_metadata_set_ecn_flag

        public static void nw_ip_metadata_set_ecn_flag​(NSObject metadata,
                                                       int ecn_flag)
        [@function] nw_ip_metadata_set_ecn_flag Sets ECN flags on IP metadata. This will take effect if applied to any sent content.
        Parameters:
        metadata - An IP metadata object.
        ecn_flag - The ECN flag to apply to packets.
      • nw_ip_metadata_get_ecn_flag

        public static int nw_ip_metadata_get_ecn_flag​(NSObject metadata)
        [@function] nw_ip_metadata_get_ecn_flag Gets ECN flags from IP metadata. This will be set only for metadata associated with received content.
        Parameters:
        metadata - An IP metadata object.
        Returns:
        Returns the ECN flag received from a packet.
      • nw_ip_metadata_set_service_class

        public static void nw_ip_metadata_set_service_class​(NSObject metadata,
                                                            int service_class)
        [@function] nw_ip_metadata_set_service_class Sets service class on IP metadata. This will not generally translate into TOS or Traffic Class bits unless the network explictly supports it, but it will impact local queuing of packets.
        Parameters:
        metadata - An IP metadata object.
        service_class - The service class to apply to packets.
      • nw_ip_metadata_get_service_class

        public static int nw_ip_metadata_get_service_class​(NSObject metadata)
        [@function] nw_ip_metadata_get_service_class Gets service class from IP metadata. This reflects the value set using nw_ip_metadata_set_service_class. It will not be received from the network.
        Parameters:
        metadata - An IP metadata object.
        Returns:
        Returns the service class set on a packet.
      • nw_ip_metadata_get_receive_time

        public static long nw_ip_metadata_get_receive_time​(NSObject metadata)
        [@function] nw_ip_metadata_get_receive_time Access the time at which a packet was received. This is useful for calculating precise timing for round-trip-time estimates. Same as clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW). The receive time will be 0 unless timestamps have been enabled using nw_ip_options_set_calculate_receive_time().
        Parameters:
        metadata - An IP metadata object.
        Returns:
        Returns the time that the packet was received.
      • nw_listener_create_with_port

        public static NSObject nw_listener_create_with_port​(java.lang.String port,
                                                            NSObject parameters)
        [@function] nw_listener_create_with_port Creates a networking listener bound to a specified local port.
        Parameters:
        port - A port number as a C string, such as "443", or a service name, such as "https".
        parameters - The parameters to use for the listener. These include the protocols to be used for the listener.
        Returns:
        Returns an allocated nw_listener_t object on success. Callers are responsible for deallocating using nw_release(obj) or [obj release]. These objects support ARC. Returns NULL on failure. Fails due to invalid parameters.
      • nw_listener_create

        public static NSObject nw_listener_create​(NSObject parameters)
        [@function] nw_listener_create Creates a networking listener. The listener will be assigned a random port upon which to listen unless otherwise specified by the parameters.
        Parameters:
        parameters - The parameters to use for the listener. These include the protocols to be used for the listener.
        Returns:
        Returns an allocated nw_listener_t object on success. Callers are responsible for deallocating using nw_release(obj) or [obj release]. These objects support ARC. Returns NULL on failure. Fails due to invalid parameters.
      • nw_listener_create_with_connection

        public static NSObject nw_listener_create_with_connection​(NSObject connection,
                                                                  NSObject parameters)
        [@function] nw_listener_create_with_connection Creates a networking listener based on an existing multiplexing connection. If there are multiple protocols in the connection that support listening for incoming flows, the listener will be hooked up the highest in the stack (the closest to the reading and writing of the client data).
        Parameters:
        connection - An existing connection that has a multiplexing protocol that supports receiving new connections.
        parameters - The parameters to use for the listener. The protocol stack defined in the parameters must be able to join a protocol in the connection that supports listening protocols.
        Returns:
        Returns an allocated nw_listener_t object on success. Use nw_release() to deallocate. Returns NULL on failure. Fails due to invalid parameters.
      • nw_listener_set_queue

        public static void nw_listener_set_queue​(NSObject listener,
                                                 NSObject queue)
        [@function] nw_listener_set_queue Sets the client callback queue, on which blocks for events will be scheduled. This must be done before calling nw_listener_start().
        Parameters:
        listener - The listener object.
        queue - The client's dispatch queue.
      • nw_listener_set_state_changed_handler

        public static void nw_listener_set_state_changed_handler​(NSObject listener,
                                                                 Network.Block_nw_listener_set_state_changed_handler handler)
        [@function] nw_listener_set_state_changed_handler Sets the state change handler. For clients that need to perform cleanup when the connection has been cancelled, the nw_listener_state_cancelled state will be delivered last.
        Parameters:
        listener - The listener object.
        handler - The state changed handler to call when the listener state changes. Pass NULL to remove the event handler.
      • nw_listener_set_new_connection_handler

        public static void nw_listener_set_new_connection_handler​(NSObject listener,
                                                                  Network.Block_nw_listener_set_new_connection_handler handler)
        [@function] nw_listener_set_new_connection_handler Sets the client new connection handler. Must be called before nw_listener_start.
        Parameters:
        listener - The listener object.
        handler - The event handler to call when the listener receives a new connection. Pass NULL to remove the new connection handler.
      • nw_listener_get_new_connection_limit

        public static int nw_listener_get_new_connection_limit​(NSObject listener)
        [@function] nw_listener_get_new_connection_limit Gets the listener new connection limit. The default value is NW_LISTENER_INFINITE_CONNECTION_LIMIT which indicates that the listener should not limit incoming connections. If the value is not NW_LISTENER_INFINITE_CONNECTION_LIMIT, it will be decremented by 1 every time a new connection is created. When the value becomes 0, new connection handlers will no longer be invoked until nw_listener_set_new_connection_limit() is invoked with a value that is greater than 0. Incoming connections will eventually be rejected if nw_listener_set_new_connection_limit() is not called after the connection limit reaches 0.
        Parameters:
        listener - The listener object.
        Returns:
        Returns current new connection limit
      • nw_listener_set_new_connection_limit

        public static void nw_listener_set_new_connection_limit​(NSObject listener,
                                                                int new_connection_limit)
        [@function] nw_listener_set_new_connection_limit Sets the listener new connection limit. Use the value NW_LISTENER_INFINITE_CONNECTION_LIMIT to disable connection limits. If the value is not NW_LISTENER_INFINITE_CONNECTION_LIMIT, it will be decremented by 1 every time a new connection is created. When the value becomes 0, new connection handlers will no longer be invoked until nw_listener_set_new_connection_limit() is invoked with a value that is greater than 0. Incoming connections will eventually be rejected if nw_listener_set_new_connection_limit() is not called after the connection limit reaches 0.
        Parameters:
        listener - The listener object.
        new_connection_limit - The new connection limit. Pass NW_LISTENER_INFINITE_CONNECTION_LIMIT to disable new connection limiting.
      • nw_listener_set_advertise_descriptor

        public static void nw_listener_set_advertise_descriptor​(NSObject listener,
                                                                NSObject advertise_descriptor)
        [@function] nw_listener_set_advertise_descriptor Describes the bonjour service the listener should register. Setting the advertise descriptor more than once may be used to update the TXT record.
        Parameters:
        listener - The listener object.
        advertise_descriptor - The advertise_descriptor or NULL to prevent or remove registration of a service.
      • nw_listener_set_advertised_endpoint_changed_handler

        public static void nw_listener_set_advertised_endpoint_changed_handler​(NSObject listener,
                                                                               Network.Block_nw_listener_set_advertised_endpoint_changed_handler handler)
        [@function] nw_listener_set_advertised_endpoint_changed_handler Sets the client advertised endpoint changed handler. The handler will be invoked for listeners which have called nw_listener_set_advertise_descriptor().
        Parameters:
        listener - The listener object.
        handler - The event handler to call when the listener adds or removes an advertised endpoint. Pass NULL to remove the handler.
      • nw_listener_get_port

        public static char nw_listener_get_port​(NSObject listener)
        [@function] nw_listener_get_port Gets the local port as a number in host byte order. If the listener was created with a port of 0 (let the system assign a port), nw_listener_get_port will return 0 until the listener is in the ready state.
        Parameters:
        listener - The listener to get the local port of.
        Returns:
        Returns a port in host byte order.
      • nw_listener_start

        public static void nw_listener_start​(NSObject listener)
        [@function] nw_listener_start Starts the listener, which will cause the listener to start listening for inbound connections.
        Parameters:
        listener - The listener object.
      • nw_listener_cancel

        public static void nw_listener_cancel​(NSObject listener)
        [@function] nw_listener_cancel Cancel the listener. This will de-register the listener from the system. The process of cancellation will be completed asynchronously, and the final callback event delivered to the caller will be a state update with a value of nw_listener_state_cancelled. Once this update is delivered, the caller may clean up any associated memory or objects.
        Parameters:
        listener - The listener object.
      • nw_path_monitor_create

        public static NSObject nw_path_monitor_create()
        [@function] nw_path_monitor_create Create a default path monitor, that will allow the enumeration of all available interfaces on the system.
        Returns:
        Returns an allocated nw_path_monitor_t object on success. Callers are responsible for deallocating using nw_release(obj) or [obj release]. These objects support ARC. Returns NULL on failure. Fails due to invalid parameters.
      • nw_path_monitor_create_with_type

        public static NSObject nw_path_monitor_create_with_type​(int required_interface_type)
        [@function] nw_path_monitor_create_with_type Create a path monitor specific to an interface type, that will allow the enumeration of any interface that matches the type on the system.
        Parameters:
        required_interface_type - An interface type that will filter any results that the path monitor returns.
        Returns:
        Returns an allocated nw_path_monitor_t object on success. Callers are responsible for deallocating using nw_release(obj) or [obj release]. These objects support ARC. Returns NULL on failure. Fails due to invalid parameters.
      • nw_path_monitor_set_cancel_handler

        public static void nw_path_monitor_set_cancel_handler​(NSObject monitor,
                                                              Network.Block_nw_path_monitor_set_cancel_handler cancel_handler)
        [@function] nw_path_monitor_set_cancel_handler Set a handler to be called on the queue provided to nw_path_monitor_set_queue once cancellation has completed. Once the cancel handler has been called, the update handler will not fire again.
        Parameters:
        monitor - The path monitor object.
        cancel_handler - The block to call upon cancellation. Pass NULL to remove the cancel handler.
      • nw_path_monitor_set_update_handler

        public static void nw_path_monitor_set_update_handler​(NSObject monitor,
                                                              Network.Block_nw_path_monitor_set_update_handler update_handler)
        [@function] nw_path_monitor_set_update_handler Sets the client update handler. This block will be called with the current path when start is called and any time the path changes.
        Parameters:
        monitor - The path monitor object.
        update_handler - The block to call when the path changes.
      • nw_path_monitor_set_queue

        public static void nw_path_monitor_set_queue​(NSObject monitor,
                                                     NSObject queue)
        [@function] nw_path_monitor_set_queue Sets the client update queue. All blocks will be scheduled on this queue. Call before calling nw_path_monitor_start.
        Parameters:
        monitor - The path monitor object.
        queue - The dispatch queue on which to call the update and cancel handlers.
      • nw_path_monitor_start

        public static void nw_path_monitor_start​(NSObject monitor)
        [@function] nw_path_monitor_start Starts the path monitor.
        Parameters:
        monitor - The path monitor object.
      • nw_path_monitor_cancel

        public static void nw_path_monitor_cancel​(NSObject monitor)
        [@function] nw_path_monitor_cancel Cancel the path monitor.
        Parameters:
        monitor - The path monitor object.
      • nw_protocol_copy_tcp_definition

        public static NSObject nw_protocol_copy_tcp_definition()
        [@function] nw_protocol_copy_tcp_definition Access the definition of the default system protocol implementation of TCP (Transmission Control Protocol). This protocol can be used as part of a connection's protocol stack as the transport protocol.
        Returns:
        Returns a retained protocol definition object.
      • nw_tcp_create_options

        public static NSObject nw_tcp_create_options()
        [@function] nw_tcp_create_options Create an instance of TCP protocol options. This object can be added to an nw_protocol_stack_t to be used in an nw_connection_t or an nw_listener_t.
        Returns:
        Returns a retained protocol options object.
      • nw_tcp_options_set_no_delay

        public static void nw_tcp_options_set_no_delay​(NSObject options,
                                                       boolean no_delay)
        [@function] nw_tcp_options_set_no_delay Configure TCP to disable Nagle's algorithm, which will delay sending packets to coalesce sending.
        Parameters:
        options - A TCP protocol options object.
        no_delay - A boolean indicating that TCP should disable Nagle's algorithm.
      • nw_tcp_options_set_no_push

        public static void nw_tcp_options_set_no_push​(NSObject options,
                                                      boolean no_push)
        [@function] nw_tcp_options_set_no_push Wait to send TCP data until the connection has finished writing, or else the TCP send buffer is full.
        Parameters:
        options - A TCP protocol options object.
        no_push - A boolean indicating that TCP should be set into no-push mode.
      • nw_tcp_options_set_no_options

        public static void nw_tcp_options_set_no_options​(NSObject options,
                                                         boolean no_options)
        [@function] nw_tcp_options_set_no_options Disable sending TCP options and extensions.
        Parameters:
        options - A TCP protocol options object.
        no_options - A boolean indicating that TCP should be set into no-options mode.
      • nw_tcp_options_set_enable_keepalive

        public static void nw_tcp_options_set_enable_keepalive​(NSObject options,
                                                               boolean enable_keepalive)
        [@function] nw_tcp_options_set_enable_keepalive Enable sending TCP keepalive probes.
        Parameters:
        options - A TCP protocol options object.
        enable_keepalive - A boolean indicating that TCP should send keepalives.
      • nw_tcp_options_set_keepalive_count

        public static void nw_tcp_options_set_keepalive_count​(NSObject options,
                                                              int keepalive_count)
        [@function] nw_tcp_options_set_keepalive_count Configure the number of times TCP keepalive probes should be sent without reply before terminating the connection.
        Parameters:
        options - A TCP protocol options object.
        keepalive_count - The number of keepalive probes to send before terminating the connection.
      • nw_tcp_options_set_keepalive_idle_time

        public static void nw_tcp_options_set_keepalive_idle_time​(NSObject options,
                                                                  int keepalive_idle_time)
        [@function] nw_tcp_options_set_keepalive_idle_time Configure the amount of time that a connection must be idle before TCP should start sending keepalive probes.
        Parameters:
        options - A TCP protocol options object.
        keepalive_idle_time - The number of seconds of idleness to wait before keepalive probes are sent by TCP.
      • nw_tcp_options_set_keepalive_interval

        public static void nw_tcp_options_set_keepalive_interval​(NSObject options,
                                                                 int keepalive_interval)
        [@function] nw_tcp_options_set_keepalive_interval Configure the amount of time between sending TCP keepalive probes when the peer is not responding.
        Parameters:
        options - A TCP protocol options object.
        keepalive_interval - The number of seconds of to wait before resending TCP keepalive probes.
      • nw_tcp_options_set_maximum_segment_size

        public static void nw_tcp_options_set_maximum_segment_size​(NSObject options,
                                                                   int maximum_segment_size)
        [@function] nw_tcp_options_set_maximum_segment_size Directly configure the maximum segment size (MSS) TCP will use.
        Parameters:
        options - A TCP protocol options object.
        maximum_segment_size - The maximum segment size in bytes.
      • nw_tcp_options_set_connection_timeout

        public static void nw_tcp_options_set_connection_timeout​(NSObject options,
                                                                 int connection_timeout)
        [@function] nw_tcp_options_set_connection_timeout Define a timeout value after which TCP connection establishment will give up.
        Parameters:
        options - A TCP protocol options object.
        connection_timeout - A timeout for TCP connection establishment, in seconds.
      • nw_tcp_options_set_persist_timeout

        public static void nw_tcp_options_set_persist_timeout​(NSObject options,
                                                              int persist_timeout)
        [@function] nw_tcp_options_set_persist_timeout Define a timeout value after which TCP connections in the persist state will terminate. See RFC 6429.
        Parameters:
        options - A TCP protocol options object.
        persist_timeout - The TCP persist timeout, in seconds.
      • nw_tcp_options_set_retransmit_connection_drop_time

        public static void nw_tcp_options_set_retransmit_connection_drop_time​(NSObject options,
                                                                              int retransmit_connection_drop_time)
        [@function] nw_tcp_options_set_retransmit_connection_drop_time Define a timeout value after which TCP will drop a connection with unacknowledged retransmissions.
        Parameters:
        options - A TCP protocol options object.
        retransmit_connection_drop_time - A timeout for TCP retransmission attempts, in seconds.
      • nw_tcp_options_set_retransmit_fin_drop

        public static void nw_tcp_options_set_retransmit_fin_drop​(NSObject options,
                                                                  boolean retransmit_fin_drop)
        [@function] nw_tcp_options_set_retransmit_fin_drop Cause TCP to drop connections after not receiving an ACK multiple times after a FIN, currently set at three.
        Parameters:
        options - A TCP protocol options object.
        retransmit_fin_drop - A boolean to cause TCP to drop its connection after not receiving an ACK after a FIN.
      • nw_tcp_options_set_disable_ack_stretching

        public static void nw_tcp_options_set_disable_ack_stretching​(NSObject options,
                                                                     boolean disable_ack_stretching)
        [@function] nw_tcp_options_set_disable_ack_stretching Configure TCP to disable ACK stretching. ACKs will be sent for every other data packet.
        Parameters:
        options - A TCP protocol options object.
        disable_ack_stretching - A boolean to cause TCP to disable ACK stretching.
      • nw_tcp_options_set_enable_fast_open

        public static void nw_tcp_options_set_enable_fast_open​(NSObject options,
                                                               boolean enable_fast_open)
        [@function] nw_tcp_options_set_enable_fast_open Configure TCP to enable TCP Fast Open (TFO). This may take effect even when TCP is not the top-level protocol in the protocol stack. For example, if TLS is running over TCP, the Client Hello message may be sent as fast open data. If TCP is the top-level protocol in the stack (the one the application directly interacts with), TFO will be disabled unless the application indicated that it will provide its own fast open data by calling nw_parameters_set_fast_open_enabled().
        Parameters:
        options - A TCP protocol options object.
        enable_fast_open - A boolean to enable TFO.
      • nw_tcp_options_set_disable_ecn

        public static void nw_tcp_options_set_disable_ecn​(NSObject options,
                                                          boolean disable_ecn)
        [@function] nw_tcp_options_set_disable_ecn Configure TCP to disable default Explicit Congestion Notification (ECN) behavior.
        Parameters:
        options - A TCP protocol options object.
        disable_ecn - A boolean to disable ECN support in TCP.
      • nw_protocol_metadata_is_tcp

        public static boolean nw_protocol_metadata_is_tcp​(NSObject metadata)
        [@function] nw_protocol_metadata_is_tcp Checks if a protocol metadata object is compatible with the accessors defined in this file for the default system implementation of TCP.
        Returns:
        Returns true if the metadata is for the default system TCP, false otherwise.
      • nw_tcp_get_available_receive_buffer

        public static int nw_tcp_get_available_receive_buffer​(NSObject metadata)
        [@function] nw_tcp_get_available_receive_buffer Fetch the number of bytes waiting to be read from the receive buffer.
        Returns:
        The number of bytes available in the receive buffer.
      • nw_tcp_get_available_send_buffer

        public static int nw_tcp_get_available_send_buffer​(NSObject metadata)
        [@function] nw_tcp_get_available_send_buffer Fetch the number of bytes waiting to be acknowledged in the send buffer.
        Returns:
        The number of bytes waiting to be acknowledged.
      • nw_protocol_copy_tls_definition

        public static NSObject nw_protocol_copy_tls_definition()
        [@function] nw_protocol_copy_tls_definition Access the definition of the default system protocol implementation of TLS (Transport Layer Security). This protocol can be used as part of a connection's protocol stack as an application protocol.
        Returns:
        Returns a retained protocol definition object.
      • nw_tls_create_options

        public static NSObject nw_tls_create_options()
        [@function] nw_tls_create_options Create an instance of TLS protocol options. This object can be added to an nw_protocol_stack_t to be used in an nw_connection_t or an nw_listener_t.
        Returns:
        Returns a retained protocol options object.
      • nw_tls_copy_sec_protocol_options

        public static NSObject nw_tls_copy_sec_protocol_options​(NSObject options)
        [@function] nw_tls_copy_sec_protocol_options Access the sec_protocol_options_t for a given network protocol options instance. See for functions to futher configure security options.
        Parameters:
        options - An nw_protocol_options_t that has been created for TLS.
        Returns:
        Returns a retained sec_protocol_options_t object.
      • nw_protocol_metadata_is_tls

        public static boolean nw_protocol_metadata_is_tls​(NSObject metadata)
        [@function] nw_protocol_metadata_is_tls Checks if a protocol metadata object is compatible with the accessors defined in this file for the default system implementation of TLS.
        Returns:
        Returns true if the metadata is for the default system TLS, false otherwise.
      • nw_tls_copy_sec_protocol_metadata

        public static NSObject nw_tls_copy_sec_protocol_metadata​(NSObject metadata)
        [@function] nw_tls_copy_sec_protocol_metadata Access the sec_protocol_metadata_t for a given network protocol metadata instance. See for functions to access security properties.
        Parameters:
        metadata - An nw_protocol_metadata_t for the TLS protocol.
        Returns:
        Returns a retained sec_protocol_metadata_t object.
      • nw_protocol_copy_udp_definition

        public static NSObject nw_protocol_copy_udp_definition()
        [@function] nw_protocol_copy_udp_definition Access the definition of the default system protocol implementation of UDP (User Datagram Protocol). This protocol can be used as part of a connection's protocol stack as the transport protocol.
        Returns:
        Returns a retained protocol definition object.
      • nw_udp_create_options

        public static NSObject nw_udp_create_options()
        [@function] nw_udp_create_options Create an instance of UDP protocol options. This object can be added to an nw_protocol_stack_t to be used in an nw_connection_t or an nw_listener_t.
        Returns:
        Returns a retained protocol options object.
      • nw_udp_options_set_prefer_no_checksum

        public static void nw_udp_options_set_prefer_no_checksum​(NSObject options,
                                                                 boolean prefer_no_checksum)
        [@function] nw_udp_options_set_prefer_no_checksum Configure UDP to skip computing checksums when sending. This will only take effect when running over IPv4.
        Parameters:
        options - A UDP protocol options object.
        prefer_no_checksum - A boolean that indicates if UDP is allowed to skip computing its checksum.
      • nw_udp_create_metadata

        public static NSObject nw_udp_create_metadata()
        [@function] nw_udp_create_metadata Create an instance of UDP metadata that can be used to configure per-datagram options when sending data on a connection.
        Returns:
        Returns a retained protocol metadata object.
      • nw_protocol_metadata_is_udp

        public static boolean nw_protocol_metadata_is_udp​(NSObject metadata)
        [@function] nw_protocol_metadata_is_udp Checks if a protocol metadata object is compatible with the accessors defined in this file for the default system implementation of UDP.
        Returns:
        Returns true if the metadata is for the default system UDP, false otherwise.
      • nw_protocol_copy_ws_definition

        public static NSObject nw_protocol_copy_ws_definition()
        [@function] nw_protocol_copy_ws_definition Access the definition of the default system implementation of the WebSocket protocol. This protocol can be appended to a connection's protocol stack.
        Returns:
        Returns a retained protocol definition object.
      • nw_ws_create_options

        public static NSObject nw_ws_create_options​(int version)
        [@function] nw_ws_create_options Create an instance of WebSocket protocol options. This object can be added to an nw_protocol_stack_t to be used in an nw_connection_t or an nw_listener_t.
        Returns:
        Returns a retained protocol options object.
      • nw_ws_options_add_additional_header

        public static void nw_ws_options_add_additional_header​(NSObject options,
                                                               java.lang.String name,
                                                               java.lang.String value)
        [@function] nw_ws_options_add_additional_header Set additional HTTP headers to be sent by the client during the WebSocket handshake.
        Parameters:
        options - The WebSocket protocol options object.
        name - The HTTP header name.
        value - The HTTP header value.
      • nw_ws_options_add_subprotocol

        public static void nw_ws_options_add_subprotocol​(NSObject options,
                                                         java.lang.String subprotocol)
        [@function] nw_ws_options_add_subprotocol Add to the list of subprotocols that will be presented to a WebSocket server during connection establishment.
        Parameters:
        options - The WebSocket protocol options object.
        subprotocol - The subprotocol supported by the client.
      • nw_ws_options_set_auto_reply_ping

        public static void nw_ws_options_set_auto_reply_ping​(NSObject options,
                                                             boolean auto_reply_ping)
        [@function] nw_ws_options_set_auto_reply_ping Set whether the WebSocket connection should automatically reply to all incoming pings.
        Parameters:
        options - The WebSocket protocol options object.
        auto_reply_ping - Whether the WebSocket connection should automatically reply to all incoming pings.
      • nw_ws_options_set_skip_handshake

        public static void nw_ws_options_set_skip_handshake​(NSObject options,
                                                            boolean skip_handshake)
        [@function] nw_ws_options_set_skip_handshake Set whether the WebSocket protocol should skip the opening handshake and begin framing data as soon as a connection is established.
        Parameters:
        options - The WebSocket protocol options object.
        skip_handshake - Whether the WebSocket connection should skip the opening handshake.
      • nw_ws_options_set_maximum_message_size

        public static void nw_ws_options_set_maximum_message_size​(NSObject options,
                                                                  long maximum_message_size)
        [@function] nw_ws_options_set_maximum_message_size Set the maximum allowed message size to be received by the WebSocket connection. This does not limit the sending message size.
        Parameters:
        options - The WebSocket protocol options object.
        maximum_message_size - The maximum message size in bytes. A maximum message size of 0 means there is no receive limit. The default maximum message size is 0.
      • nw_protocol_metadata_is_ws

        public static boolean nw_protocol_metadata_is_ws​(NSObject metadata)
        [@function] nw_protocol_metadata_is_ws Checks if a protocol metadata object is compatible with the accessors defined in this file for the default system implementation of WebSocket.
        Returns:
        Returns true if the metadata is for the default system implementation of WebSocket, false otherwise.
      • nw_ws_create_metadata

        public static NSObject nw_ws_create_metadata​(int opcode)
        [@function] nw_ws_create_metadata Creates a protocol metadata object that can be used to define the content context of messages sent over a WebSocket connection.
        Parameters:
        opcode - Set the opcode on a WebSocket frame. This must be defined on create.
        Returns:
        Returns a retained metadata object representing the WebSocket frame.
      • nw_ws_metadata_get_opcode

        public static int nw_ws_metadata_get_opcode​(NSObject metadata)
        [@function] nw_ws_metadata_get_opcode Get the opcode on a WebSocket frame.
        Parameters:
        metadata - The metadata object representing the WebSocket frame.
        Returns:
        The opcode on the WebSocket frame.
      • nw_ws_metadata_set_close_code

        public static void nw_ws_metadata_set_close_code​(NSObject metadata,
                                                         int close_code)
        [@function] nw_ws_metadata_set_close_code Set the close code on a WebSocket frame. The WebSocket frame's opcode should be nw_ws_opcode_close.
        Parameters:
        metadata - The metadata object representing the WebSocket frame.
        close_code - The close code on the WebSocket frame.
      • nw_ws_metadata_get_close_code

        public static int nw_ws_metadata_get_close_code​(NSObject metadata)
        [@function] nw_ws_metadata_get_close_code Get the close code from a WebSocket frame. If the close code is equal to nw_ws_close_code_no_status_received, it means that a close code was not actually present in the WebSocket frame.
        Parameters:
        metadata - The metadata object representing the WebSocket frame.
        Returns:
        The close code on the WebSocket frame.
      • nw_ws_metadata_set_pong_handler

        public static void nw_ws_metadata_set_pong_handler​(NSObject metadata,
                                                           NSObject client_queue,
                                                           Network.Block_nw_ws_metadata_set_pong_handler pong_handler)
        [@function] nw_ws_metadata_set_pong_handler Set a callback that will notify the client when a pong message has been received for a ping message sent. The metadata object's associated opcode should be nw_ws_opcode_ping.
        Parameters:
        metadata - The WebSocket metadata object.
        client_queue - The queue on which the pong handler will be delivered.
        pong_handler - The handler that gets called when a pong reply is received.
      • nw_ws_request_enumerate_subprotocols

        public static boolean nw_ws_request_enumerate_subprotocols​(NSObject request,
                                                                   Network.Block_nw_ws_request_enumerate_subprotocols enumerator)
        [@function] nw_ws_request_enumerate_subprotocols Enumerates the list of subprotocols on the client's request.
        Parameters:
        request - The client request.
        enumerator - The enumerator block.
        Returns:
        Whether the enumeration completed.
      • nw_ws_request_enumerate_additional_headers

        public static boolean nw_ws_request_enumerate_additional_headers​(NSObject request,
                                                                         Network.Block_nw_ws_request_enumerate_additional_headers enumerator)
        [@function] nw_ws_request_enumerate_additional_headers Enumerates the list of additional headers on the client's request.
        Parameters:
        request - The client request.
        enumerator - The enumerator block.
        Returns:
        Whether the enumeration completed.
      • nw_ws_response_create

        public static NSObject nw_ws_response_create​(int status,
                                                     java.lang.String selected_subprotocol)
        [@function] nw_ws_response_create Create a server response to a WebSocket client's opening handshake.
        Parameters:
        status - The status of the response. If the status is nw_ws_response_status_accept, the server will accept the handshake and open the WebSocket connection. If the status is nw_ws_response_status_reject, the server will reject the handshake and respond with the HTTP error 400 Bad Request.
        selected_subprotocol - The server's selected protocol from the client's list of proposed subprotocols. If the status of this response is nw_ws_response_status_reject, this parameter is ignored. Pass NULL to indicate the server did not find a suitable subprotocol, but has accepted the handshake anyways. Passing an empty string is prohibited by the WebSocket protocol.
        Returns:
        An instantiated WebSocket server response object.
      • nw_ws_response_get_status

        public static int nw_ws_response_get_status​(NSObject response)
        [@function] nw_ws_response_get_status Get the status from a WebSocket server's response. If the response is nil, the return value will be nw_ws_response_status_invalid.
        Parameters:
        response - The server response.
        Returns:
        The status of the server's response.
      • nw_ws_response_get_selected_subprotocol

        public static java.lang.String nw_ws_response_get_selected_subprotocol​(NSObject response)
        [@function] nw_ws_response_get_selected_subprotocol Get the selected subprotocol from a WebSocket server's response.
        Parameters:
        response - The server response.
        Returns:
        The status of the server's response.
      • nw_ws_response_add_additional_header

        public static void nw_ws_response_add_additional_header​(NSObject response,
                                                                java.lang.String name,
                                                                java.lang.String value)
        [@function] nw_ws_response_add_additional_header Add additional HTTP headers to be sent back to the WebSocket client in the server's response.
        Parameters:
        response - The server response.
        name - The HTTP name.
        value - The HTTP value.
      • nw_ws_metadata_copy_server_response

        public static NSObject nw_ws_metadata_copy_server_response​(NSObject metadata)
        [@function] nw_ws_metadata_copy_server_response Copy the WebSocket server's response to a client's request to connect. If this is called on a WebSocket server, the response object will contain the server's own response to the client.
        Parameters:
        metadata - The metadata object representing the WebSocket connection.
        Returns:
        The server response.
      • nw_ws_response_enumerate_additional_headers

        public static boolean nw_ws_response_enumerate_additional_headers​(NSObject response,
                                                                          Network.Block_nw_ws_response_enumerate_additional_headers enumerator)
        [@function] nw_ws_response_enumerate_additional_headers Enumerates the list of additional headers on the server's response.
        Parameters:
        response - The server response.
        enumerator - The enumerator block.
        Returns:
        Whether the enumeration completed.
      • nw_ws_options_set_client_request_handler

        public static void nw_ws_options_set_client_request_handler​(NSObject options,
                                                                    NSObject client_queue,
                                                                    Network.Block_nw_ws_options_set_client_request_handler handler)
        [@typedef] nw_ws_options_set_client_request_handler Set callback handler to be invoked when a WebSocket server receives a WebSocket client's request to connect.
        Parameters:
        options - The protocol options object.
        client_queue - The queue on which the client request handler will be delivered.
        handler - The callback handler.
      • kNWErrorDomainPOSIX

        public static CFStringRef kNWErrorDomainPOSIX()
        Values will be POSIX errors
      • kNWErrorDomainDNS

        public static CFStringRef kNWErrorDomainDNS()
        Values will be DNSServiceErrorType errors
      • kNWErrorDomainTLS

        public static CFStringRef kNWErrorDomainTLS()
        Values will be errSSL* errors
      • _nw_content_context_default_message

        public static NSObject _nw_content_context_default_message()
      • _nw_content_context_final_send

        public static NSObject _nw_content_context_final_send()
      • _nw_content_context_default_stream

        public static NSObject _nw_content_context_default_stream()
      • _nw_data_transfer_report_all_paths

        public static int _nw_data_transfer_report_all_paths()
        [@const] NW_ALL_PATHS Pass NW_ALL_PATHS to data transfer report accessors to sum values across paths where applicable. For values that cannot sum, the value of the primary path is used.
      • nw_resolver_config_create_https

        public static NSObject nw_resolver_config_create_https​(NSObject url_endpoint)
        [@function] nw_resolver_config_create_https Creates a DNS-over-HTTPS (DoH) resolver configuration. The provided URL describes the location of the DNS server, such as "https://dnsserver.example.net/dns-query". See RFC 8484.
        Parameters:
        url_endpoint - The URL template of the DoH server as an endpoint.
        Returns:
        Returns an allocated nw_resolver_config_t object on success.
      • nw_resolver_config_create_tls

        public static NSObject nw_resolver_config_create_tls​(NSObject server_endpoint)
        [@function] nw_resolver_config_create_tls Creates a DNS-over-TLS (DoT) resolver configuration. The hostname of the provided endpoint will be used to validate the TLS certificate of the server. See RFC 7858.
        Parameters:
        server_endpoint - A host endpoint identifying the DoT server.
        Returns:
        Returns an allocated nw_resolver_config_t object on success.
      • nw_resolver_config_add_server_address

        public static void nw_resolver_config_add_server_address​(NSObject config,
                                                                 NSObject server_address)
        [@function] nw_resolver_config_add_name_server Modifies the resolver configuration by adding a DNS server address as an endpoint.
        Parameters:
        config - A resolver config object.
        server_address - A server address to assign to the configuration, as an endpoint.
      • nw_privacy_context_create

        public static NSObject nw_privacy_context_create​(java.lang.String description)
        [@function] nw_privacy_context_create Create a new privacy context. This object can be added to connections and listeners by setting the privacy context on the nw_parameters_t. Each privacy context can have unique settings for logging and resolution, and implicitly has an isolated cache for items like TLS sessions.
        Parameters:
        description - A string description used for logging.
        Returns:
        Returns an allocated nw_privacy_context_t object on success.
      • nw_privacy_context_flush_cache

        public static void nw_privacy_context_flush_cache​(NSObject privacy_context)
        [@function] nw_privacy_context_flush_cache Flush any cached state stored in this privacy context. The act of flushing the cache may be asynchronous, which means that it will take effect shortly after the function is invoked.
        Parameters:
        privacy_context - A privacy context to flush.
      • nw_privacy_context_disable_logging

        public static void nw_privacy_context_disable_logging​(NSObject privacy_context)
        [@function] nw_privacy_context_disable_logging Disable logging for connections and listeners associated with this context. Logging may not be disabled on the default privacy context.
        Parameters:
        privacy_context - A privacy context on which to disable logging.
      • nw_privacy_context_require_encrypted_name_resolution

        public static void nw_privacy_context_require_encrypted_name_resolution​(NSObject privacy_context,
                                                                                boolean require_encrypted_name_resolution,
                                                                                NSObject fallback_resolver_config)
        [@function] nw_privacy_context_require_encrypted_name_resolution Require that any DNS name resolution occurring for connections associated with this context use encrypted transports, such as TLS or HTTPS. Any unencrypted queries will be blocked if require_encrypted_name_resolution is set to true. Optionally, a fallback resolver config can be provided to use instead of blocking queries when require_encrypted_name_resolution is set to true.
        Parameters:
        privacy_context - A privacy context to modify. This can include the default privacy context.
        require_encrypted_name_resolution - If true, require that any name resolution using DNS is performed with encryption. If false, allow cleartext resolution. Defaults to false.
        fallback_resolver_config - An optional resolver configuration to use if no other encrypted DNS resolver is already configured for the query. This will only take effect if require_encrypted_name_resolution is set to true. If this configuration is NULL and require_encrypted_name_resolution is set to true, all cleartext name resolution will be blocked.
      • nw_parameters_set_privacy_context

        public static void nw_parameters_set_privacy_context​(NSObject parameters,
                                                             NSObject privacy_context)
        [@function] nw_parameters_set_privacy_context Set a privacy context on the parameters, which will be associated with connections and listeners. The privacy context allows using separate caches for different sets of connections, as well as restricting how connection-specific information is logged and shared on the network.
        Parameters:
        parameters - The parameters object to configure
        privacy_context - The privacy context to associate with connections and listeners that use these parameters.
      • nw_group_descriptor_create_multicast

        public static NSObject nw_group_descriptor_create_multicast​(NSObject multicast_group)
        [@function] nw_group_descriptor_create_multicast Creates a new group descriptor object based on a multicast group, represented as an address endpoint.
        Parameters:
        multicast_group - An address endpoint that contains a multicast group to join.
        Returns:
        An instantiated group descriptor object or nil if the specified endpoint is not an address endpoint representing a valid multicast group.
      • nw_group_descriptor_add_endpoint

        public static boolean nw_group_descriptor_add_endpoint​(NSObject descriptor,
                                                               NSObject endpoint)
        [@function] nw_group_descriptor_add_endpoint Add an additional endpoint to a given group descriptor.
        Parameters:
        descriptor - A group descriptor.
        endpoint - An endpoint to add to the group.
        Returns:
        Returns true if the endpoint was added, false if the endpoint was not of a valid type and therefore not added.
      • nw_group_descriptor_enumerate_endpoints

        public static void nw_group_descriptor_enumerate_endpoints​(NSObject descriptor,
                                                                   Network.Block_nw_group_descriptor_enumerate_endpoints enumerate_block)
        [@function] nw_group_descriptor_enumerate_endpoints List all endpoints associated with the group descriptor.
        Parameters:
        descriptor - The group descriptor object to check.
        enumerate_block - A block to which the endpoints associated with the descriptor will be passed. Returning true from the block will continue to enumerate, and returning false will stop enumerating.
      • nw_multicast_group_descriptor_set_specific_source

        public static void nw_multicast_group_descriptor_set_specific_source​(NSObject multicast_descriptor,
                                                                             NSObject source)
        [@function] nw_multicast_group_descriptor_set_specific_source Require a particular source for this multicast group descriptor.
        Parameters:
        multicast_descriptor - The multicast group descriptor to modify.
        source - An endpoint describing the source for this descriptor.
      • nw_multicast_group_descriptor_set_disable_unicast_traffic

        public static void nw_multicast_group_descriptor_set_disable_unicast_traffic​(NSObject multicast_descriptor,
                                                                                     boolean disable_unicast_traffic)
        [@function] nw_multicast_group_descriptor_set_disable_unicast_traffic Disable receiving unicast traffic for a connection group that is also receiving multicast traffic.
        Parameters:
        multicast_descriptor - The multicast group descriptor to modify.
        disable_unicast_traffic - A boolean indicating if receiving unicast traffic should be disabled.
      • nw_multicast_group_descriptor_get_disable_unicast_traffic

        public static boolean nw_multicast_group_descriptor_get_disable_unicast_traffic​(NSObject multicast_descriptor)
        [@function] nw_multicast_group_descriptor_get_disable_unicast_traffic Check if receiving unicast traffic has been disabled for a multicast connection group.
        Parameters:
        multicast_descriptor - The multicast group descriptor to check.
        Returns:
        A boolean indicating if receiving unicast traffic should be disabled.
      • nw_connection_group_create

        public static NSObject nw_connection_group_create​(NSObject group_descriptor,
                                                          NSObject parameters)
        [@function] nw_connection_group_create Creates a new connection group object to use for communication with a group descriptor using protocols described by parameters.
        Parameters:
        group_descriptor - A group descriptor. For example, a descriptor of type nw_group_type_multicast defines one or more multicast groups to automatically join.
        parameters - Parameters to use for the new connection group. This includes the protocols that will be used to delineate complete messages for processing. For multicast joining, all available interfaces will be joined as prohibited or required.
        Returns:
        Returns an allocated nw_connection_group_t object on success. Callers are responsible for deallocating using nw_release(obj) or [obj release]. These objects support ARC. Returns NULL on failure. Fails due to invalid parameters.
      • nw_connection_group_copy_descriptor

        public static NSObject nw_connection_group_copy_descriptor​(NSObject group)
        [@function] nw_connection_group_copy_descriptor Gets the group descriptor with which the connection group was created.
        Parameters:
        group - The connection group to check.
        Returns:
        Returns the descriptor with which the connection group was created.
      • nw_connection_group_copy_parameters

        public static NSObject nw_connection_group_copy_parameters​(NSObject group)
        [@function] nw_connection_group_copy_parameters Returns a copy of the parameters passed to nw_connection_group_create.
        Parameters:
        group - The connection group object.
        Returns:
        Returns an nw_parameters_t object.
      • nw_connection_group_set_queue

        public static void nw_connection_group_set_queue​(NSObject group,
                                                         NSObject queue)
        [@function] nw_connection_group_set_queue Sets the client callback queue, on which blocks for events will be scheduled. This must be done before calling nw_connection_group_start().
        Parameters:
        group - The connection group object.
        queue - The client's callback queue.
      • nw_connection_group_set_state_changed_handler

        public static void nw_connection_group_set_state_changed_handler​(NSObject group,
                                                                         Network.Block_nw_connection_group_set_state_changed_handler state_changed_handler)
        [@function] nw_connection_group_set_state_changed_handler Sets the state changed handler. For clients that need to perform cleanup when the connection group has been cancelled, the nw_connection_group_state_cancelled state will be delivered last. This function must not be called after starting the connection group.
        Parameters:
        group - The connection group object.
        state_changed_handler - The state changed handler to call when the connection group state changes. Pass NULL to remove the event handler.
      • nw_connection_group_set_receive_handler

        public static void nw_connection_group_set_receive_handler​(NSObject group,
                                                                   int maximum_message_size,
                                                                   boolean reject_oversized_messages,
                                                                   Network.Block_nw_connection_group_set_receive_handler receive_handler)
        [@function] nw_connection_group_set_receive_handler Sets the handler to be invoked whenever a new inbound message arrives at the connection group. This function must not be called after starting the connection group.
        Parameters:
        group - The connection group object.
        maximum_message_size - The maximum message size that should be delivered as a complete message. Any inbound messages larger than this size will be delivered as a partial message and an application may convert the inbound message to an `nw_connection` to read any remaining data for that message until it is complete.
        reject_oversized_messages - True if messages larger than maximum_message_size should be treated as errors and the connection group should automatically reply to such messages. False if the connection group should deliver such messages as incomplete and allow the application to inspect the message prior to accepting or rejecting it.
        receive_handler - The handler to call upon arrival of a new inbound message. Pass NULL to remove the handler.
      • nw_connection_group_start

        public static void nw_connection_group_start​(NSObject group)
        [@function] nw_connection_group_start Starts the connection group, which begins listening for and processing incoming messages. You must call nw_connection_group_set_queue() and set a receive handler with nw_connection_group_set_receive_handler() before starting the connection group.
        Parameters:
        group - The connection group object.
      • nw_connection_group_cancel

        public static void nw_connection_group_cancel​(NSObject group)
        [@function] nw_connection_group_cancel Cancels the connection group. The process of cancellation will be completed asynchronously, and the final callback event delivered to the caller will be a state update with a value of nw_connection_group_state_cancelled. Once this update is delivered, the caller may clean up any associated memory or objects.
        Parameters:
        group - The connection group object.
      • nw_connection_group_copy_remote_endpoint_for_message

        public static NSObject nw_connection_group_copy_remote_endpoint_for_message​(NSObject group,
                                                                                    NSObject context)
        [@function] nw_connection_group_copy_remote_endpoint_for_message Copy the remote endpoint corresponding to a given inbound connection group message.
        Parameters:
        group - The connection group object.
        context - A content context representing an inbound message received from this connection group.
        Returns:
        Returns the remote endpoint, or nil if the context is not a valid inbound message received from this connection group.
      • nw_connection_group_copy_local_endpoint_for_message

        public static NSObject nw_connection_group_copy_local_endpoint_for_message​(NSObject group,
                                                                                   NSObject context)
        [@function] nw_connection_group_copy_local_endpoint_for_message Copy the local endpoint corresponding to a given inbound connection group message.
        Parameters:
        group - The connection group object.
        context - A content context representing an inbound message received from this connection group.
        Returns:
        Returns the local endpoint, or nil if the context is not a valid inbound message received from this connection group.
      • nw_connection_group_copy_path_for_message

        public static NSObject nw_connection_group_copy_path_for_message​(NSObject group,
                                                                         NSObject context)
        [@function] nw_connection_group_copy_path_for_message Copy the path associated with a given inbound connection group message.
        Parameters:
        group - The connection group object.
        context - A content context representing an inbound message received from this connection group.
        Returns:
        Returns the path associated with the provided message, or nil if the context is not a valid inbound message received from this connection group.
      • nw_connection_group_reply

        public static void nw_connection_group_reply​(NSObject group,
                                                     NSObject inbound_message,
                                                     NSObject outbound_message,
                                                     NSObject content)
        [@function] nw_connection_group_reply Send data in response to an inbound message received by a connection group.
        Parameters:
        group - The connection group object from which the reply_context was received.
        inbound_message - The inbound message received by the connection group for which this is a response. An inbound message may be replied to exactly once.
        outbound_message - The outbound message to send in response to the message received by the connection group. The response context can also hold protocol metadata to define how to send content, such as flags for IP packets. If the context is marked as "final", the connection group will expect that no further communication is expected during this connection with the peer and may close the underlying transport. Subsequent connection attempts from the peer will continue to be delivered as incoming messages.
        content - A data object to send as the message body. This may be NULL if the outgoing context represents a metadata only message that contains no body data.
      • nw_connection_group_extract_connection_for_message

        public static NSObject nw_connection_group_extract_connection_for_message​(NSObject group,
                                                                                  NSObject context)
        [@function] nw_connection_group_extract_connection_for_message Extract a connection corresponding to an inbound message from the connection group. Once extracted, subsequent messages from this remote endpoint on this connection will no longer be handled by the connection group. The connection may be used to read the remainder of a partial message or to send a large response with support for partial messages and backpressure. Any incoming messages from this remote endpoint which were saved from the receive handler may no longer be valid after a connection is returned.
        Parameters:
        group - The connection group object from which the context was received. If the context was not received from this connection group, the extraction will fail.
        context - A content context representing an inbound message received from this connection group.
        Returns:
        Returns the connection associated with the provided message, or nil if the extraction fails. Extraction will fail if the provided message is not an inbound message from this connection group.
      • nw_connection_group_send_message

        public static void nw_connection_group_send_message​(NSObject group,
                                                            NSObject content,
                                                            NSObject endpoint,
                                                            NSObject context,
                                                            Network.Block_nw_connection_group_send_message completion)
        [@function] nw_connection_group_send_message Send data that is not in response to an inbound message. This outgoing message will be sent from the local endpoint on which the connection group is listening for incoming messages. This is an asynchronous send and the completion block can be used to determine when the send is complete. There is nothing preventing a client from issuing an excessive number of outstanding sends. To minimize memory footprint and excessive latency as a consequence of buffer bloat, it is advisable to keep a low number of outstanding sends. The completion block can be used to pace subsequent sends.
        Parameters:
        group - The connection group object from which to send the outbound data.
        content - A data object to send as the message body. This may be NULL if the outgoing context represents a metadata only message that contains no body data.
        endpoint - The destination endpoint to which the outbound message should be sent. If the endpoint is NULL, the message will be sent to all members of the group.
        context - An outbound message to send from the connection group. The context can also hold protocol metadata to define how to send content, such as flags for IP packets. If the context is marked as "final", the connection group will expect that no further communication is expected during this connection with the peer and may close the underlying transport. Subsequent connection attempts from the peer will be delivered as incoming messages.
        completion - A callback to be called when the message has been sent, or an error has occurred. This callback does not indicate that the remote side has acknowledged the data. This callback does indicate that the data has either been sent or it has been enqueued to be sent.
      • nw_resolution_report_get_source

        public static int nw_resolution_report_get_source​(NSObject resolution_report)
        [@function] nw_resolution_report_get_source Check the source of a resolution, such as query or cache.
        Parameters:
        resolution_report - A resolution report.
        Returns:
        The source of the resolution (query or cache).
      • nw_resolution_report_get_milliseconds

        public static long nw_resolution_report_get_milliseconds​(NSObject resolution_report)
        [@function] nw_resolution_report_get_milliseconds Get the number of milliseconds spent on this resolution step.
        Parameters:
        resolution_report - A resolution report.
        Returns:
        The number of milliseconds spent on this resolution step.
      • nw_resolution_report_get_endpoint_count

        public static int nw_resolution_report_get_endpoint_count​(NSObject resolution_report)
        [@function] nw_resolution_report_get_endpoint_count Get the number of resolved endpoints discovered by the resolution step.
        Parameters:
        resolution_report - A resolution report.
        Returns:
        The number of resolved endpoints discovered by the resolution step.
      • nw_resolution_report_copy_successful_endpoint

        public static NSObject nw_resolution_report_copy_successful_endpoint​(NSObject resolution_report)
        [@function] nw_resolution_report_copy_successful_endpoint Copy the resolved endpoint that led to a successful connection.
        Parameters:
        resolution_report - A resolution report.
        Returns:
        The resolved endpoint that led to a successful connection.
      • nw_resolution_report_copy_preferred_endpoint

        public static NSObject nw_resolution_report_copy_preferred_endpoint​(NSObject resolution_report)
        [@function] nw_resolution_report_copy_preferred_endpoint Copy first resolved endpoint attempted, which may be the same as the successful endpoint.
        Parameters:
        resolution_report - A resolution report.
        Returns:
        The first resolved endpoint attempted.
      • nw_resolution_report_get_protocol

        public static int nw_resolution_report_get_protocol​(NSObject resolution_report)
        [@function] nw_resolution_report_get_protocol Check the protocol used for endpoint resolution.
        Parameters:
        resolution_report - A resolution report.
        Returns:
        The protocol used for endpoint resolution.
      • nw_establishment_report_enumerate_resolution_reports

        public static void nw_establishment_report_enumerate_resolution_reports​(NSObject report,
                                                                                Network.Block_nw_establishment_report_enumerate_resolution_reports enumerate_block)
        [@function] nw_establishment_report_enumerate_resolution_reports Enumerate the steps of connection establishment that involved endpoint resolution, such as DNS hostname resolution and Bonjour service resolution. This variant provides resolution report objects, which allow more detailed access to information. The provided block will be called inline zero or more times.
        Parameters:
        report - An establishment report.
        enumerate_block - A block to be invoked zero or more times, once for each step of resolution used during connection establishment. Each block contains a nw_resolution_report_t. Returning true from the block indicates that the enumeration should continue. Returning false indicates that the enumeration should stop.
      • nw_ip_options_set_disable_multicast_loopback

        public static void nw_ip_options_set_disable_multicast_loopback​(NSObject options,
                                                                        boolean disable_multicast_loopback)
        [@function] nw_ip_options_set_disable_multicast_loopback If a multicast packet is sent to a group to which the sending host itself belongs (on the outgoing interface), a copy of the datagram is, by default, looped back by the IP layer for local delivery. Setting the disable_multicast_loopback option disables this behavior and, if set, multicast packets will not be looped back to the sender. Only applies to multicast packets.
        Parameters:
        options - An IP protocol options object.
        disable_multicast_loopback - If multicast loopback should be disabled.
      • nw_path_monitor_prohibit_interface_type

        public static void nw_path_monitor_prohibit_interface_type​(NSObject monitor,
                                                                   int interface_type)
        [@function] nw_path_monitor_prohibit_interface_type Prohibit this path monitor from using the provided network interface type. Call before calling nw_path_monitor_start.
        Parameters:
        monitor - The path monitor object.
        interface_type - The interface type to prohibit for the path monitor.
      • _nw_privacy_context_default_context

        public static NSObject _nw_privacy_context_default_context()
      • nw_path_get_unsatisfied_reason

        public static int nw_path_get_unsatisfied_reason​(NSObject path)
        [@function] nw_path_get_unsatisfied_reason Retrieves a reason the path is not satisfied. In some cases, the reason helps to determine why the path is not satisfied. While the path may be unsatisfied for more than one reason, only the first reason will be given. In many cases, the path may be unsatisfied with no reason available.
        Parameters:
        path - The path object to check.
        Returns:
        Returns a reason the path is unsatisfied or nw_path_unsatisfied_reason_not_available if a reason is not available.