Plugin session-2 Spec

 

Overview

This plugin covers the APIs in the following categories:

It does the following things:

  1. Create a thread and destroy it.
  2. Create three TSStat statistic variables transaction_count, session_count and avg_transactions and update them at every new session or transaction.
  3. Play with TSConfig family of functions to set and get config data.

Plugin Specification

In TSPluginInit(), the plugin creates a thread, waits for 5 seconds and destroys it. It creates three TSStat statistic variables: transaction_count, session_count and avg_transactions. It also creates a ConfigData with one element num_ssns and sets it to TSConfig. Then it registers a handler function for the global hook TS_HTTP_SSN_START_HOOK.

On TS_HTTP_SSN_START_HOOK, it increments the TSStat statistic variable session_count and num_ssns in TSConfig. Then it prints out both values. It adds a session hook TS_HTTP_TXN_START_HOOK.

The handler function on TS_HTTP_TXN_START_HOOK increments transaction_count and recalculates avg_transactions, then prints out both values.