man3rmt/dbmod_processor2

Table of Contents

Name

dbmod_processor2 - process a list of database commands

Description

dbmod_processor2 reads from a file descriptor to obtain strings containing a list of updates. Each string is parsed and an update request is formulated and sent to dbman.

The application using this function may define a list of keywords. When dbmod_processor2 sees one of the keywords it calls a callback function to process it.

This function is part of librmt.

Syntax

int dbmod_processor2(
FILE *in,

int DBsock

char *tlist[],

int tlist_cnt,

int (*tlist_callback)(

char *token[],

int tcnt,

int Line,

char *terminator

),

char *terminator,

int *ans_mode,

int send_verbosity,

int recv_verbosity

);

Arguments

in

The file descriptor to read from.

DBsock

The file descriptor for the connection to dbman.

tlist

A list of keyword strings. When a match is found in this list tlist_callback() is called to process the line.

tlist_cnt

The number of items in the tlist array.

tlist_callback

This function is called when a match is found in the tlist.
token

The input string is broken into tokens. This is the token array.
tcnt

The number of tokens in the token array.
Line

The line number. This is more or less useless since this function usually won’t be reading from a file.
terminator

The terminator parameter from the function call is passed here. The callback should be written to behave in the same way as the function.

terminator


A pointer to a string to use as a line terminator. If the pointer is NULL a LF is used as the terminator, otherwise the contents of the string is used as the terminator.

ans_mode

If this parameter is zero an update is performed.

If the value of this parameter is one an update is performed and the new database value is requested.

send_verbosity

Defines the amount of messages to print. This value is passed on to SendRec as needed. A value of 0 produces no messages. See the SendRec manpage for full details on available values.

recv_verbosity

Defines the amount of messages to print. This value is passed on to RecvRec as needed. A value of 0 produces no messages. See the RecvRec manpage for full details on available values.

Return Values

If all operations succeed ERRok is returned. If there is a communications failure the error code from the update is returned.

Notes

ans_mode is useless in cases where the parameter is involved in indirect update because the new value is forwarded to another program which will not have enough time to process and update the parameter before the value is returned.

This function was written for use with inet_dbmod(1) . It’s in this library (rmtlib) but one has to wonder if it’s a bit too specialized to be here. rlk12-7-04

See Also

librmt(3rmt)

Manual page revision

$Id: dbmod_processor2.3,v 1.2 2008/08/22 16:21:09 mcnamer Exp $


Table of Contents