ExitPolicy Class Reference

#include <exitpolicy.h>

List of all members.

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< PolicypolicyList ()
QString toString ()

Private Attributes

QList< Policy_exitPolicy


Detailed Description

Definition at line 27 of file exitpolicy.h.


Member Enumeration Documentation

Special exit policy types.

Enumerator:
Default  Specifies the default exit policy.
Middleman  Specifies a middleman-only exit policy.

Definition at line 31 of file exitpolicy.h.


Constructor & Destructor Documentation

ExitPolicy::ExitPolicy (  ) 

Default constructor.

Definition at line 23 of file exitpolicy.cpp.

Referenced by contains().

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 28 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 50 of file exitpolicy.cpp.

References addPolicy(), and policyList().


Member Function Documentation

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 84 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 95 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 108 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 119 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 62 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 71 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 131 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 66 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 157 of file exitpolicy.cpp.

References _exitPolicy, policyList(), and Policy::toString().

Referenced by ServerSettings::setExitPolicy().


Member Data Documentation

QList<Policy> ExitPolicy::_exitPolicy [private]

A collection of policies forming the exit policy.

Definition at line 73 of file exitpolicy.h.

Referenced by addPolicy(), contains(), ExitPolicy(), policyList(), removePolicy(), and toString().


The documentation for this class was generated from the following files:

Generated on Wed Nov 26 21:03:59 2008 for Vidalia by  doxygen 1.5.6