PMDF popstore & MessageStore Manager's Guide


Previous Next Contents Index


POPSTORE_user_billing_d

Perform billing operations on an account.
FORMAT


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; 


Arguments

domain

Name of the user domain to use. Supply a value of NULL to indicate the default domain. Used for input only.

domain_len

Length in bytes of the user domain name, domain. Supply a value of zero to indicate the default domain. Used for input only.

user

Name of the user to perform billing operations for. Used for input only.

user_len

Length in bytes of the username string, user. Used for input only.

last_billing

End time to use for this billing cycle. Used for input only.

user_data

User profile information containing the generated billing information. Used for output only.

Description

Programs wanting to perform billing operations should use the POPSTORE_user_billing_d subroutine in conjunction with the POPSTORE_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, invoke POPSTORE_user_billing_d to perform billing operations for that account. The POPSTORE_user_billing_d subroutine performs "atomic" billing operations. Specifically, POPSTORE_user_billing_d does the following:
  1. Locks the user profile file.
  2. Reads the profile file into memory and copies it to the structure pointed at with the user_data argument.
  3. Computes the accumulated block days used for the currently stored message and copies this information to user_data->past_block_days.
  4. 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.
  5. Writes the updated user profile to disk.
  6. Unlocks the profile file.
  7. Returns the profile data including the total connect time and computed block days in the structure pointed at by the user_data argument.
In the returned profile data, 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.

Return Values

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