Sun Java System Portal Server 7.1 Developer's Guide

Passing Parameters to Robot Application Functions

You must use parameter blocks (pblocks) to pass arguments into Robot Application Functions and to extract data from them. For example, the following directive (in the filter.conf file) invokes the filter-by-exact function.

Data fn=filter-by-exact src=type deny=text/plain

The fn parameter indicates the function to invoke, which in this case is filter-by-exact. The src and deny arguments are parameters used with the function. They will be passed to the function in a parameter block, and the function should be defined to extract its parameters and their values from the parameter block.

The three structures that are used to hold parameters are libcs_pb_param, libcs_pb_entry, and libcs_pblock. These structures are defined in the header file PortalServer-base/sdk/robot/include/libcs/pblock.h file.

libcs_pb_param

This structure holds a single parameter. It records the name and value of the parameter:


typedef struct {
    char *name,*value;
} libcs_pb_param;
libcs_pb_entry

This structure creates linked lists of libcs_parameter structures:


struct libcs_pb_entry {
    libcs_pb_param *param;
    struct libcs_pb_entry *next;
};
libcs_pblock

This structure is a hash-table containing an array of libcs_pb_entry structures:


typedef struct {
    int hsize;
    struct libcs_pb_entry **ht;
} libcs_pblock;