0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 2000, 2001, 2004, 2005, 2007, 2016 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * file, You can obtain one at http://mozilla.org/MPL/2.0/.
70e5a7403f0e0a3bd292b8287c5fed5772c15270Automatic Updater/* $Id: quota.h,v 1.16 2007/06/19 23:47:18 tbox Exp $ */
5f2d1b96ac4bc3870423792520030a5ecabda925Andreas Gustafsson ***** Module Info
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * \brief The isc_quota_t object is a simple helper object for implementing
5f2d1b96ac4bc3870423792520030a5ecabda925Andreas Gustafsson * quotas on things like the number of simultaneous connections to
5f2d1b96ac4bc3870423792520030a5ecabda925Andreas Gustafsson * a server. It keeps track of the amount of quota in use, and
5f2d1b96ac4bc3870423792520030a5ecabda925Andreas Gustafsson * encapsulates the locking necessary to allow multiple tasks to
5f2d1b96ac4bc3870423792520030a5ecabda925Andreas Gustafsson * share a quota.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*% isc_quota structure */
5f2d1b96ac4bc3870423792520030a5ecabda925Andreas Gustafssonisc_quota_init(isc_quota_t *quota, int max);
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * Initialize a quota object.
5f2d1b96ac4bc3870423792520030a5ecabda925Andreas Gustafsson * ISC_R_SUCCESS
5f2d1b96ac4bc3870423792520030a5ecabda925Andreas Gustafsson * Other error Lock creation failed.
5f2d1b96ac4bc3870423792520030a5ecabda925Andreas Gustafsson * Destroy a quota object.
8abe06b25d245ab2955d81525bfe6bd29b80908eMark Andrews * Set a soft quota.
8abe06b25d245ab2955d81525bfe6bd29b80908eMark Andrews * Re-set a maximum quota.
5f2d1b96ac4bc3870423792520030a5ecabda925Andreas Gustafsson * Attempt to reserve one unit of 'quota'.
8abe06b25d245ab2955d81525bfe6bd29b80908eMark Andrews * \li #ISC_R_SUCCESS Success
8abe06b25d245ab2955d81525bfe6bd29b80908eMark Andrews * \li #ISC_R_SOFTQUOTA Success soft quota reached
8abe06b25d245ab2955d81525bfe6bd29b80908eMark Andrews * \li #ISC_R_QUOTA Quota is full
5f2d1b96ac4bc3870423792520030a5ecabda925Andreas Gustafsson * Release one unit of quota.
8c36d7eeb9e71676a6fa78fb5b51bf123c8cc614Andreas Gustafssonisc_quota_attach(isc_quota_t *quota, isc_quota_t **p);
8c36d7eeb9e71676a6fa78fb5b51bf123c8cc614Andreas Gustafsson * Like isc_quota_reserve, and also attaches '*p' to the
1255d388f034dc556d235a002527101781dbeb29Mark Andrews * quota if successful (ISC_R_SUCCESS or ISC_R_SOFTQUOTA).
8c36d7eeb9e71676a6fa78fb5b51bf123c8cc614Andreas Gustafsson * Like isc_quota_release, and also detaches '*p' from the
5f2d1b96ac4bc3870423792520030a5ecabda925Andreas Gustafsson#endif /* ISC_QUOTA_H */