Framer Protocol Options

Create custom protocols to frame applications messages over a connection.

Topics

Adding Framers to Connections

nw_framer_create_definition

Initializes a new protocol definition based on your protocol implementation.

nw_framer_start_handler_t

A handler that represents the entry point into your custom protocol.

nw_framer_t

An object that represents a single instance of your custom protocol running in a connection.

nw_framer_start_result_t

Results that you send to indicate the disposition of your protocol after the start handler is invoked.

NW_FRAMER_CREATE_FLAGS_DEFAULT

A constant flag value that indicates that the default framer protocol behavior should be used.

nw_framer_create_options

Initializes a set of protocol options with a custom framer definition.

Handling Output Data

nw_framer_set_output_handler

Sets a block to handle new outbound messages.

nw_framer_output_handler_t

A handler that notifies your protocol about a new outbound message.

nw_framer_parse_output

Examines the content of output data while inside your output handler.

nw_framer_parse_completion_t

A handler that examines a range of data being sent or received.

nw_framer_write_output

Sends arbitrary output data in a buffer from your protocol to the next protocol.

nw_framer_write_output_data

Sends arbitrary output data from your protocol to the next protocol.

nw_framer_write_output_no_copy

Sends a specific number of bytes from a message while inside your output handler.

nw_framer_pass_through_output

Indicates that your protocol no longer needs to handle output data.

Handling Input Data

nw_framer_set_input_handler

Sets a block to handle new inbound data.

nw_framer_input_handler_t

A handler that notifies your protocol that new inbound data is available to parse.

nw_framer_parse_input

Examines the content of input data while inside your input handler block.

nw_framer_parse_completion_t

A handler that examines a range of data being sent or received.

nw_framer_deliver_input

Delivers an inbound message containing arbitrary data from your protocol to the application.

nw_framer_deliver_input_no_copy

Delivers an inbound message containing a specific number of next received bytes.

nw_framer_pass_through_input

Indicates that your protocol no longer needs to handle input data.

Customizing Framer Messages

nw_framer_message_t

A message for a custom protocol, in which you can store arbitrary key-value pairs.

nw_protocol_metadata_is_framer_message

Checks if a metadata object represents a custom framer protocol message.

nw_framer_protocol_create_message

Initializes an empty message for a custom framer definition.

nw_framer_message_create

Initializes an empty message from within a framer implementation.

nw_framer_message_set_value

Sets a value to be stored in a framer message, with a completion to call to disposed the stored value when the message is released.

nw_framer_message_dispose_value_t

A handler that's invoked when your custom value needs to be released due to a message being released or the value being replaced.

nw_framer_message_set_object_value

Sets an NSObject value to be stored in a framer message.

nw_framer_message_access_value

Accesses a custom value stored in a framer message.

nw_framer_message_copy_object_value

Accesses an NSObject value stored in a framer message.

Managing Instance Lifetime

nw_framer_mark_ready

Indicates to a connection that your protocol's handshake is complete.

nw_framer_mark_failed_with_error

Indicates to a connection that your protocol has encountered an error, or has gracefully closed.

nw_framer_prepend_application_protocol

Dynamically adds another protocol that will run above your protocol after your protocol calls nw_framer_mark_ready.

nw_framer_set_stop_handler

Sets a block to handle when the connection is being closed.

nw_framer_stop_handler_t

A handler that requests that your protocol send any final messages to close the connection.

nw_framer_set_cleanup_handler

Sets a block to handle the final cleanup of allocations made by your protocol instance.

nw_framer_cleanup_handler_t

A handler that tells your protocol to clean up all allocations before being deallocated.

Inspecting Instance Properties

nw_framer_copy_remote_endpoint

Accesses the remote endpoint of the connection in which your protocol is running.

nw_framer_copy_local_endpoint

Accesses the local endpoint of the connection in which your protocol is running.

nw_framer_copy_parameters

Accesses the parameters of the connection in which your protocol is running.

Handling Asynchronous Events

nw_framer_schedule_wakeup

Requests that the nw_framer_wakeup_handler_t be called on your protocol at a specific time in the future.

NW_FRAMER_WAKEUP_TIME_FOREVER

A sentinel value that indicates that no wakeup should be delivered.

nw_framer_set_wakeup_handler

Sets a handler to receive scheduled wakeup events.

nw_framer_wakeup_handler_t

A handler that delivers a scheduled wakeup event.

nw_framer_async

Requests that a block be executed on the connection's internal scheduling context.

nw_framer_block_t

A block to be invoked asynchronously on your framer protocol's scheduling context.

See Also

Network Protocols

TCP Options

Configure options for connections that use the Transmission Control Protocol.

TLS Options

Configure options for connections that use Transport Layer Security.

UDP Options

Configure options for connections that use the User Datagram Protocol.

IP Options

Configure Internet Protocol options on connections.

WebSocket Options

Configure options for connections that use WebSocket.