The install-dir/samples/nsapi directory contains examples of source code for SAFs.
You can use the example.mak (Windows) or Makefile (UNIX) makefile in the same directory to compile the examples and create shared libraries containing the functions in all of the example files.
To test an example, load the examples shared library into the server by adding the following directive in the Init section of magnus.conf:
Init fn=load-modules shlib=examples.so/dll funcs=function1,...,functionN
The shlib parameter specifies the path to the shared library, for example, ../../samples/nsapi/examples.so, and the funcs parameter specifies the functions to load from the shared library.
If the example uses an initialization function, be sure to specify the initialization function in the funcs argument to load-modules. Also, add an Init directive to call the initialization function.
For example, the PathCheck example implements the restrict-by-acf function, which is initialized by the acf-init function. The following directive loads both these functions:
Init fn=load-modules shlib="path" funcs=acf-init,restrict-by-acf
The following directive calls the acf-init function during server initialization:
Init fn=acf-init file=extra-arg
To invoke the new SAF at the appropriate step in the response handling process, add an appropriate directive in the object to which it applies, for example:
After adding new Init directives to magnus.conf, restart the Web Server to load the changes. Init directives are only applied during server initialization.