Other modules may wish to obtain from and make use of the quota information,
both of limits and current tallies, from the mod_quotatab
module. There are three main functions available for such uses, detailed
below. These functions are declared in mod_quotatab.h
.
To look up a quota entry from either a limit or tally table, use the following function:
unsigned char quotatab_lookup(quota_tabtype_t tab_type, const char *name, quota_type_t quota_type);This will search the configured table of the given type tab_type for a quota entry that matches both the given name and quota_type. Note, though, that it will only find the first occurrence of a matching entry in the table. This means that if there is a malformed quota table, with duplicate name/type pairs, the duplicates will be ignored. If
TRUE
returned, a match was found and the information was
read from the table and stored into the appropriate structure (i.e.
into quotatab_limit if tab_type indicated a limit table, into
quotatab_tally if tab_type signalled a tally table).
Otherwise, a return value of FALSE
indicates that no matching
entry was found in the table.
For obtaining the current quota tallies for a session, use this function:
int quotatab_read(void);
This function automatically reads the configured tally table for the
quota tallies of the current client. On success, a value of 0
will be returned and the requested data will be stored in the
quotatab_tally
quota_tally_t
structure. If an error occurred during the read, -1
will
be returned, with errno
set appropriately.
For writing out the quota information currently stored in the
quotatab_tally
quota_tally_t
structure:
int quotatab_write(double bytes_in, double bytes_out, double bytes_xfer,
unsigned long files_in, unsigned long files_out, unsigned long files_xfer);
The parameters indicate the change in tallies due to the most recent data
input/output command (e.g.
APPE, RETR, STOR, or STOU). Writes
performed via this function are only ever done on the tally table. It will
return a value of 0
if the tally table was updated without
incident, or -1
(with errno
set appropriately)
if there was an error.
Table of Contents
Author: $Author: castaglia $
Last Updated: $Date: 2002/04/23 02:11:58 $
© Copyright 2000-2002 TJ Saunders
All Rights Reserved