NetSpec provides a template which can be used a starting point to build a custom test or measurement daemon. The template provides the skeleton of functions needed in the communication protocol used by the NetSpec controler. This document describe the step-by-step procedure of writing your own NetSpec daemon.
cp -R template foo
#define IDENT "@(#)NetSpec Version 3.0 FOO alpha 1"
#define DAEMONNAME "foo"
|
Phase |
Description |
| initialize | ?? |
| setup | Use this phase to initialize variables, set default values, or set up other resources needed |
| open | This phase is mainly used by test daemons to opens up the connections. |
| run | This is the main phase where the daemon performs the required task. |
| finish | Use this phase to clean up after performing the task, e.g. close all file descriptors, post-process the data, etc. |
| close | If you open any connections during the open phase, close them here. |
| report | Use this phase to generate report of the experiments. To send the report to the controller, enclose the report within calls to rcipsStartReport() and rcipsFinishReport(). Anything that you print to stdout will be written to the socket connected to the controller. |
| teardown | Frees up the resources allocated in the setup phase. |
| kill | The last chance to do anything before the daemon is killed by the controller. |
rcipAcknowledge("");
foo UserId /usr/local/bin/nsfoo nsfoo
nsfoo -f -s -p 42010 -d 5
cluster {
foo localhost:42010 {
...
}
}
Last modified: Tue Jul 29 17:27:50 CDT 1997