MistServer  2.5.3-Pro-19-gf5e75b1 ( Generic_64)
Functions | Variables
Triggers Namespace Reference

Functions

bool doTrigger (const std::string type)
 handles triggers for a specific trigger event type, without a payload, server-wide More...
 
bool doTrigger (const std::string type, const std::string &payload)
 handles triggers for a specific trigger event type, with a payload, server-wide More...
 
bool doTrigger (const std::string type, const std::string &payload, const std::string &streamName)
 handles triggers for a specific trigger event type, with a payload, for a specified stream, and/or server-wide More...
 
bool doTrigger (const std::string type, const std::string &payload, const std::string &streamName, bool dryRun, std::string &response)
 
std::string handleTrigger (const std::string &trigger, const std::string &value, const std::string &payload, int sync)
 Handles a trigger by sending a payload to a destination. More...
 
bool shouldTrigger (const std::string type)
 Checks if one or more triggers are defined that should be handled for all streams (for a trigger event type) More...
 
bool shouldTrigger (const std::string type, const std::string &streamName)
 returns true if a trigger of the specified type should be handled for a specified stream (, or entire server) More...
 

Variables

static std::string empty
 

Function Documentation

bool Triggers::doTrigger ( const std::string  type)

handles triggers for a specific trigger event type, without a payload, server-wide

Parameters
typeTrigger event type.
Returns
Boolean, false if further processing should be aborted. calls doTrigger with dryRun set to false
bool Triggers::doTrigger ( const std::string  type,
const std::string &  payload 
)

handles triggers for a specific trigger event type, with a payload, server-wide

Parameters
typeTrigger event type.
payloadTrigger type-specific data
Returns
Boolean, false if further processing should be aborted. calls doTrigger with dryRun set to false
bool Triggers::doTrigger ( const std::string  type,
const std::string &  payload,
const std::string &  streamName 
)

handles triggers for a specific trigger event type, with a payload, for a specified stream, and/or server-wide

Parameters
typeTrigger event type.
payloadTrigger type-specific data
streamNameThe name of a stream.
Returns
Boolean, false if further processing should be aborted. calls doTrigger with dryRun set to false
bool Triggers::doTrigger ( const std::string  type,
const std::string &  payload,
const std::string &  streamName,
bool  dryRun,
std::string &  response 
)
Parameters
typeTrigger event type
payloadTrigger type-specific data
streamNameName of a stream to check for stream-specific triggers
dryRundetermines the mode of operation for this function
responseReturns the last received response by reference
Returns
Boolean, false if further processing should be aborted This function attempts to open and parse a shared memory page with the config for a trigger event type, in order to parse the triggers defined for that trigger event type. The function can be used for two separate purposes, determined by the value of dryRun -if this function is called with dryRun==true (for example, from a handleTrigger function), the return value will be true, if at least one trigger should be handled for the requested type/stream. this can be used to make sure a payload is only generated if at least one trigger should be handled. -if this function is called with dryRun==false (for example, from one of the overloaded doTrigger functions), handleTrigger is called for all configured triggers. In that case, the return value does not matter, it will probably be false in all cases.
std::string Triggers::handleTrigger ( const std::string &  trigger,
const std::string &  value,
const std::string &  payload,
int  sync 
)

Handles a trigger by sending a payload to a destination.

Parameters
triggerTrigger event type.
valueDestination. This can be an (HTTP)URL, or an absolute path to a binary/script
payloadThis data will be sent to the destionation URL/program
syncIf true, handler is executed blocking and uses the response data.
Returns
String, false if further processing should be aborted.
Todo:
Handle errors!
Todo:
Return true/false based on config here.
bool Triggers::shouldTrigger ( const std::string  type)

Checks if one or more triggers are defined that should be handled for all streams (for a trigger event type)

Parameters
typeTrigger event type.
Returns
returns true, if so calls doTrigger with dryRun set to true
bool Triggers::shouldTrigger ( const std::string  type,
const std::string &  streamName 
)

returns true if a trigger of the specified type should be handled for a specified stream (, or entire server)

Parameters
typeTrigger event type.
streamNamethe stream to be handled
Returns
returns true if so calls doTrigger with dryRun set to true

Variable Documentation

std::string Triggers::empty
static