#include "squid.h"
#include "debug/Stream.h"
#include "helper/protocol_defines.h"
#include "sbuf/Stream.h"
#include <ctime>
![](ext__time__quota__acl_8cc__incl.png)
Go to the source code of this file.
Functions | |
static void | init_db (void) |
static void | shutdown_db (void) |
static SBuf | KeyString (const char *user_key, const char *sub_key) |
static void | writeTime (const char *user_key, const char *sub_key, time_t t) |
static time_t | readTime (const char *user_key, const char *sub_key) |
static void | parseTime (const char *s, time_t *secs, time_t *start) |
static void | readConfig (const char *filename) |
static void | processActivity (const char *user_key) |
static void | usage (void) |
int | main (int argc, char **argv) |
Variables | |
static const auto | MY_DEBUG_SECTION = 82 |
const char * | db_path = DEFAULT_QUOTA_DB |
const char * | program_name |
TDB_CONTEXT * | db = nullptr |
static const auto | KeyLastActivity = "last-activity" |
static const auto | KeyPeriodStart = "period-start" |
static const auto | KeyPeriodLengthConfigured = "period-length-configured" |
static const auto | KeyTimeBudgetLeft = "time-budget-left" |
static const auto | KeyTimeBudgetConfigured = "time-budget-configured" |
static const size_t | TQ_BUFFERSIZE = 1024 |
static int | pauseLength = 300 |
Function Documentation
◆ init_db()
|
static |
Definition at line 73 of file ext_time_quota_acl.cc.
References db, db_path, DBG_CRITICAL, debugs, and MY_DEBUG_SECTION.
Referenced by main().
◆ KeyString()
|
static |
Definition at line 91 of file ext_time_quota_acl.cc.
References ToSBuf().
Referenced by readTime(), and writeTime().
◆ main()
Definition at line 341 of file ext_time_quota_acl.cc.
References db_path, DBG_IMPORTANT, debugs, getopt(), HELPER_INPUT_BUFFER, HLP_MSG, init_db(), MY_DEBUG_SECTION, Debug::NameThisHelper(), optarg, optind, Debug::parseOptions(), pauseLength, processActivity(), program_name, readConfig(), SEND_BH, shutdown_db(), ToSBuf(), and usage().
◆ parseTime()
|
static |
Definition at line 140 of file ext_time_quota_acl.cc.
References DBG_IMPORTANT, debugs, MY_DEBUG_SECTION, and NULL.
Referenced by readConfig().
◆ processActivity()
|
static |
Definition at line 246 of file ext_time_quota_acl.cc.
References debugs, HLP_MSG, KeyLastActivity, KeyPeriodLengthConfigured, KeyPeriodStart, KeyTimeBudgetConfigured, KeyTimeBudgetLeft, MY_DEBUG_SECTION, NULL, pauseLength, readTime(), SEND_ERR, SEND_OK, ToSBuf(), and writeTime().
Referenced by main().
◆ readConfig()
|
static |
This function parses the time quota file and stores it in memory.
Definition at line 185 of file ext_time_quota_acl.cc.
References DBG_IMPORTANT, debugs, KeyPeriodLengthConfigured, KeyPeriodStart, KeyTimeBudgetConfigured, KeyTimeBudgetLeft, MY_DEBUG_SECTION, NULL, parseTime(), readTime(), TQ_BUFFERSIZE, and writeTime().
Referenced by main().
◆ readTime()
|
static |
Definition at line 112 of file ext_time_quota_acl.cc.
References db, DBG_IMPORTANT, debugs, KeyString(), and MY_DEBUG_SECTION.
Referenced by processActivity(), and readConfig().
◆ shutdown_db()
|
static |
◆ usage()
|
static |
Definition at line 326 of file ext_time_quota_acl.cc.
References DBG_CRITICAL, debugs, MY_DEBUG_SECTION, and program_name.
Referenced by main().
◆ writeTime()
|
static |
Definition at line 96 of file ext_time_quota_acl.cc.
References db, debugs, KeyString(), and MY_DEBUG_SECTION.
Referenced by processActivity(), and readConfig().
Variable Documentation
◆ db
TDB_CONTEXT* db = nullptr |
Definition at line 52 of file ext_time_quota_acl.cc.
Referenced by Ssl::CertificateDb::addCertAndPrivateKey(), Ssl::CertificateDb::Check(), Ssl::CertificateDb::Create(), Ssl::CertificateDb::deleteByKey(), deleteEntry(), Ssl::CertificateDb::deleteInvalidCertificate(), Ssl::CertificateDb::deleteOldestCertificate(), Ssl::CertificateDb::deleteRow(), fetchKey(), Ssl::CertificateDb::hasRows(), init_db(), Ssl::CertificateDb::load(), processNewRequest(), Ssl::CertificateDb::pure_find(), Ssl::CertificateDb::purgeCert(), readTime(), Ssl::CertificateDb::rebuildSize(), Ssl::CertificateDb::save(), session_login(), shutdown_db(), and writeTime().
◆ db_path
const char* db_path = DEFAULT_QUOTA_DB |
Definition at line 49 of file ext_time_quota_acl.cc.
◆ KeyLastActivity
|
static |
Definition at line 54 of file ext_time_quota_acl.cc.
Referenced by processActivity().
◆ KeyPeriodLengthConfigured
|
static |
Definition at line 56 of file ext_time_quota_acl.cc.
Referenced by processActivity(), and readConfig().
◆ KeyPeriodStart
|
static |
Definition at line 55 of file ext_time_quota_acl.cc.
Referenced by processActivity(), and readConfig().
◆ KeyTimeBudgetConfigured
|
static |
Definition at line 58 of file ext_time_quota_acl.cc.
Referenced by processActivity(), and readConfig().
◆ KeyTimeBudgetLeft
|
static |
Definition at line 57 of file ext_time_quota_acl.cc.
Referenced by processActivity(), and readConfig().
◆ MY_DEBUG_SECTION
|
static |
Definition at line 48 of file ext_time_quota_acl.cc.
Referenced by init_db(), main(), parseTime(), processActivity(), readConfig(), readTime(), usage(), and writeTime().
◆ pauseLength
|
static |
If there is more than this given number of seconds between two successive requests, than the second request will be treated as a new request and the time between first and seconds request will be treated as a activity pause.
Otherwise the following request will be treated as belonging to the same activity and the quota will be reduced.
Definition at line 71 of file ext_time_quota_acl.cc.
Referenced by main(), and processActivity().
◆ program_name
const char* program_name |
Definition at line 50 of file ext_time_quota_acl.cc.
◆ TQ_BUFFERSIZE
|
static |
Maximum size of buffers used to read or display lines.
Definition at line 61 of file ext_time_quota_acl.cc.
Referenced by readConfig().
Introduction
- About Squid
- Why Squid?
- Squid Developers
- How to Donate
- How to Help Out
- Getting Squid
- Squid Source Packages
- Squid Deployment Case-Studies
- Squid Software Foundation
Documentation
- Quick Setup
- Configuration:
- FAQ and Wiki
- Guide Books:
- Non-English
- More...
Support
- Security Advisories
- Bugzilla Database
- Mailing lists
- Contacting us
- Commercial services
- Project Sponsors
- Squid-based products