Previous | Contents | Index |
Perform billing operations on an account.
int POPSTORE_user_billing_d (domain, domain_len, user, user_len, last_billing, user_data) char *domain; int domain_len; char *user; int user_len; time_t last_billing; POPSTORE_user_data *user_data;
Name of the user domain to use. Supply a value of NULL to indicate the
domain
default
domain. Used for input only.Length in bytes of the user domain name,
domain_len
domain
. Supply a value of zero to indicate thedefault
domain. Used for input only.Name of the user to perform billing operations for. Used for input only.
user
Length in bytes of the username string,
user_len
user
. Used for input only.End time to use for this billing cycle. Used for input only.
last_billing
User profile information containing the generated billing information. Used for output only.
user_data
Programs wanting to perform billing operations should use thePOPSTORE_user_billing_d
subroutine in conjunction with thePOPSTORE_user_list_d
subroutine. That latter subroutine provides a convenient way to obtain the name of each popstore account and, with the name in hand, invokePOPSTORE_user_billing_d
to perform billing operations for that account. ThePOPSTORE_user_billing_d
subroutine performs "atomic" billing operations. Specifically,POPSTORE_user_billing_d
does the following:In the returned profile data,
- Locks the user profile file.
- Reads the profile file into memory and copies it to the structure pointed at with the
user_data
argument.- Computes the accumulated block days used for the currently stored message and copies this information to
user_data->past_block_days
.- Clears the total connect and past block days profile fields, and sets the last billing profile and message list fields to the value of the
last_billing
argument.- Writes the updated user profile to disk.
- Unlocks the profile file.
- Returns the profile data including the total connect time and computed block days in the structure pointed at by the
user_data
argument.Note that the roundoff associated with computing the past block days is kept in the user profile file. The returned profile data has the roundoff field set to zero.
- The value of the last billing field,
user_data->last_billing
, will be the time of the prior billing, not this current billing.- The value of the total connect time field,
user_data->total_connect
, will be the total connect time accumulated between the timesuser_data->last_billing
andlast_billing
.- The value of the past block days,
user_data->past_block_days
, will be that accumulated between the timesuser_data->last_billing
andlast_billing
. This includes the storage used for any messages deleted or returned during that time as well as the storage used for any messages presently being stored.
POPSTORE_SUCCESS Normal, successful completion. POPSTORE_FILOPNERR Unable to open the profile file for reading. POPSTORE_INSUFPRIV Insufficient privileges to access the profile file, or, on OpenVMS, the process lacks SYSLCK privilege. POPSTORE_LCKOPNERR Unable to obtain lock information for the profile file. POPSTORE_LOCKERROR Unable to obtain a lock for the profile file. POPSTORE_NOSUCHUSR No such user account. POPSTORE_READERROR An error while attempting to read data from the profile file. POPSTORE_TOOLONG The resulting profile file name is too long. POPSTORE_VMERROR Insufficient virtual memory.
Previous | Next | Contents | Index |