Protocol extensions - architecture

To achieve traffic-level extensibility, the traffic processing on a Citrix ADC appliance is exposed as a pipeline of separate processing modules. Traffic flows through them as it processes it from ingress to egress. These modules in the pipeline follow a shared nothing model. Message passing is used to send the traffic data from one module in the pipeline to the next module.

Certain points in the traffic processing pipeline are made extensible, so that you can add code to customize the Citrix ADC behavior.

localized image

By default, the traffic bypasses a programmable module to which you do not add any code.

localized image

Behaviors

The programmable interfaces for customizing the traffic handling are called behaviors. Behaviors are basically a formalization of common programmable patterns that are available on a Citrix ADC appliance. The behaviors consist of a pre-defined set of event callback functions. You can implement a behavior by providing callback functions conforming to the behavior.

For example, the TCP client behavior consists of a callback function (on_data) that processes TCP client data stream events. To implement Message Based Load Balancing (MBLB) for a TCP based protocol, you can add code for this callback function to process the TCP data stream from the client and parse the byte stream into protocol messages.

Context:

The callback functions in a behavior are called with a context, which is the processing module state. The context is the instance of the processing module. For example, the TCP client behavior callbacks are called with different contexts for different client TCP connections.

Payload:

In addition to the context, the behavior callbacks can have other arguments. Usually the rest of the arguments are passed as payload, which is the collection of all the arguments.

So, the programmable processing module instances can be seen as a combination of instance state plus event callback functions, that is, the context plus behavior. And the traffic flows through the pipeline as event payload.

For Citrix ADC API extensions, see Citrix ADC extension API reference.

The following code snippet shows a user defined function to handle TCP client data stream events. The context and payload are passed to the function by Citrix ADC code. This code simply forwards the TCP data received in every call to the next processing module context in the pipeline. In this case, the next module is the load balancing (LB) context, which is a Citrix ADC native module.

function client.on_data(ctxt, payload)
    ns.send(ctxt.output, "DATA", {data = payload.data})
end
<!--NeedCopy-->
Protocol extensions - architecture