Case study:
EMG at Mblox (PDF)
Building and using a plugin in EMG 3 Print
Friday, 30 May 2014

The EMG Plugin API can be used to implement custom functionality in EMG with very little overhead. An EMG plugin can be called when a message is received and before and after it is sent by implementing different functions in the plugin.

The steps to build a plugin are:

  • Download plugin-3.0.tar.gz
  • Extract it:
    gzip -d plugin-3.0.tar.gz
    tar xvf plugin-3.0.tar
  • Change directory and build it:
    cd plugin-3.0
    ./ myplugin

The sample "myplugin.c" includes a skeleton for a plugin. In order for the plugin to do something code needs to be added to "myplugin.c".

To get EMG to use the plugin you need to install and configure it.

  • Create /etc/emg/plugins
    mkdir /etc/emg/plugins
  • Copy the plugin
    cp /etc/emg/plugins
    chmod 755 /etc/emg/plugins/
  • Add a PLUGIN section to server.cfg
    PLUGIN myplugin <
  • Define that the plugin should be used on a connector
    CONNECTOR xyz <
  • Restart emgd

More information

EMG Plugin API - Manual