#include <exitpolicy.h>
Public Types | |
enum | SpecialExitPolicy { Default, Middleman } |
Public Member Functions | |
ExitPolicy () | |
ExitPolicy (SpecialExitPolicy exitPolicy) | |
ExitPolicy (QString exitPolicy) | |
void | addAcceptedPorts (QStringList portList) |
bool | acceptsPorts (QStringList portList) |
void | addRejectedPorts (QStringList portList) |
bool | rejectsPorts (QStringList portList) |
void | addPolicy (Policy policy) |
void | removePolicy (Policy policy) |
bool | contains (Policy policy) |
QList< Policy > | policyList () |
QString | toString () |
Private Attributes | |
QList< Policy > | _exitPolicy |
Definition at line 38 of file exitpolicy.h.
Special exit policy types.
Default | Specifies the default exit policy. |
Middleman | Specifies a middleman-only exit policy. |
Definition at line 42 of file exitpolicy.h.
ExitPolicy::ExitPolicy | ( | ) |
ExitPolicy::ExitPolicy | ( | SpecialExitPolicy | exitPolicy | ) |
Creates an exit policy of the given special type.
Constructor. Creates an exit policy based on the given type.
Definition at line 39 of file exitpolicy.cpp.
References _exitPolicy, Default, Middleman, and Policy::RejectAll.
ExitPolicy::ExitPolicy | ( | QString | exitPolicy | ) |
Creates an exit policy from the given comma-delimited list of policies.
Parses the given string for a comma-delimited list of policies and adds them to this this policy.
Definition at line 61 of file exitpolicy.cpp.
References addPolicy(), and policyList().
void ExitPolicy::addAcceptedPorts | ( | QStringList | portList | ) |
Adds the ports specified in portList to a list of ports accepted by this exit policy. Ports may be given either individually or as ranges.
Definition at line 95 of file exitpolicy.cpp.
References addPolicy().
Referenced by ServerPage::saveExitPolicies().
bool ExitPolicy::acceptsPorts | ( | QStringList | portList | ) |
Returns true if this exit policy accepts all ports specified in portList. Ports in portList may be given either individually or as ranges.
Returns true if this exit policy accepts all ports specified in portList. Ports in portList may be given either individually or in ranges (e.g., "6660-6669").
Definition at line 106 of file exitpolicy.cpp.
References contains().
Referenced by ServerPage::loadExitPolicies().
void ExitPolicy::addRejectedPorts | ( | QStringList | portList | ) |
Adds the ports specified in portList to a list of ports rejected by this exit policy. Ports may be given either individually or as ranges.
Definition at line 119 of file exitpolicy.cpp.
References addPolicy().
Referenced by ServerPage::saveExitPolicies().
bool ExitPolicy::rejectsPorts | ( | QStringList | portList | ) |
Returns true if this exit policy rejects all ports specified in portList. Ports in portList may be given either individually or as ranges.
Returns true if this exit policy rejects all ports specified in portList. Ports in portList may be given either individually or in ranges (e.g., "6660-6669").
Definition at line 130 of file exitpolicy.cpp.
References contains().
Referenced by ServerPage::loadExitPolicies().
void ExitPolicy::addPolicy | ( | Policy | policy | ) |
Adds a rule to the exit policy.
Adds a policy to this exit policy.
Definition at line 73 of file exitpolicy.cpp.
References _exitPolicy, and contains().
Referenced by addAcceptedPorts(), addRejectedPorts(), ExitPolicy(), and ServerPage::saveExitPolicies().
void ExitPolicy::removePolicy | ( | Policy | policy | ) |
Removes a rule from the exit policy.
Removes a policy from this exit policy.
Definition at line 82 of file exitpolicy.cpp.
References _exitPolicy, and i().
bool ExitPolicy::contains | ( | Policy | policy | ) |
Checks if the current exit policy contains the given rule.
Returns true if this exit policy contains the given policy.
Definition at line 142 of file exitpolicy.cpp.
References _exitPolicy, Policy::AcceptAll, Default, ExitPolicy(), Policy::matches(), p(), and Policy::RejectAll.
Referenced by acceptsPorts(), addPolicy(), ServerPage::loadExitPolicies(), and rejectsPorts().
QList<Policy> ExitPolicy::policyList | ( | ) | [inline] |
Returns the list of policies for this exit policy.
Definition at line 77 of file exitpolicy.h.
References _exitPolicy.
Referenced by ExitPolicy(), and toString().
QString ExitPolicy::toString | ( | ) |
Converts the exit policy to a format Tor understands.
Definition at line 168 of file exitpolicy.cpp.
References _exitPolicy, policyList(), and Policy::toString().
Referenced by ServerSettings::setExitPolicy().
QList<Policy> ExitPolicy::_exitPolicy [private] |
A collection of policies forming the exit policy.
Definition at line 84 of file exitpolicy.h.
Referenced by addPolicy(), contains(), ExitPolicy(), policyList(), removePolicy(), and toString().