#include <policy.h>
Public Types | |
| Accept | |
| Reject | |
| AcceptAll | |
| RejectAll | |
| enum | Action { Accept, Reject } |
| enum | SpecialPolicy { AcceptAll, RejectAll } |
Public Member Functions | |
| Policy () | |
| Policy (QString policy) | |
| Policy (QString action, QString address, QString ports) | |
| Policy (SpecialPolicy policy) | |
| Policy (Action action, QHostAddress addr, uchar mask, quint16 fromPort, quint16 toPort=0) | |
| bool | matches (const Policy &policy) const |
| bool | operator== (const Policy &policy) const |
| void | fromString (QString policy) |
| QString | toString () const |
| QString | action () const |
| QString | address () const |
| QString | ports () const |
Static Public Member Functions | |
| static Action | toAction (QString action) |
Private Attributes | |
| Action | _action |
| QHostAddress | _address |
| quint16 | _fromPort |
| quint16 | _toPort |
| uchar | _mask |
Definition at line 25 of file policy.h.
| enum Policy::Action |
| Policy::Policy | ( | ) |
| Policy::Policy | ( | QString | policy | ) |
Parses the given policy, represented as a string.
Definition at line 32 of file policy.cpp.
References _action, _address, _fromPort, _mask, _toPort, Accept, and fromString().
| Policy::Policy | ( | QString | action, | |
| QString | address, | |||
| QString | ports | |||
| ) |
Parses the given portions of a policy string.
Definition at line 45 of file policy.cpp.
References _action, _address, _fromPort, _mask, _toPort, Accept, and fromString().
| Policy::Policy | ( | SpecialPolicy | policy | ) |
| Policy::Policy | ( | Action | action, | |
| QHostAddress | addr, | |||
| uchar | mask, | |||
| quint16 | fromPort, | |||
| quint16 | toPort = 0 | |||
| ) |
| QString Policy::action | ( | ) | const |
Returns the action taken when this policy matches an address.
Definition at line 165 of file policy.cpp.
| QString Policy::address | ( | ) | const |
Returns the host address (including mask, if set) for this policy.
Definition at line 172 of file policy.cpp.
References _address, and _mask.
Referenced by toString().
| void Policy::fromString | ( | QString | policy | ) |
Parses the given policy string.
Definition at line 104 of file policy.cpp.
References _action, _address, _fromPort, _mask, _toPort, ports(), and toAction().
Referenced by Policy().
| bool Policy::matches | ( | const Policy & | policy | ) | const |
| bool Policy::operator== | ( | const Policy & | policy | ) | const |
| QString Policy::ports | ( | ) | const |
Returns the port or port range for this policy.
Definition at line 188 of file policy.cpp.
References _fromPort, and _toPort.
Referenced by fromString(), and toString().
| Policy::Action Policy::toAction | ( | QString | action | ) | [static] |
Converts a string action to an Action enum value.
Definition at line 153 of file policy.cpp.
References Accept, and Reject.
Referenced by fromString().
| QString Policy::toString | ( | ) | const |
Converts this policy to a format Tor understands.
Definition at line 144 of file policy.cpp.
References _action, Accept, address(), and ports().
Referenced by ExitPolicy::toString().
Action Policy::_action [private] |
The action to take for this policy.
Definition at line 73 of file policy.h.
Referenced by action(), fromString(), matches(), operator==(), Policy(), and toString().
QHostAddress Policy::_address [private] |
Addresses to which this policy applies.
Definition at line 74 of file policy.h.
Referenced by address(), fromString(), matches(), operator==(), and Policy().
quint16 Policy::_fromPort [private] |
Start of a port range.
Definition at line 75 of file policy.h.
Referenced by fromString(), matches(), operator==(), Policy(), and ports().
uchar Policy::_mask [private] |
Address mask.
Definition at line 77 of file policy.h.
Referenced by address(), fromString(), matches(), operator==(), and Policy().
quint16 Policy::_toPort [private] |
End of a port range.
Definition at line 76 of file policy.h.
Referenced by fromString(), matches(), operator==(), Policy(), and ports().
1.4.7