1 /* |
|
2 * otr4j, the open source java otr library. |
|
3 * |
|
4 * Distributable under LGPL license. |
|
5 * See terms of license at gnu.org. |
|
6 */ |
|
7 package net.java.otr4j; |
|
8 |
|
9 /** |
|
10 * |
|
11 * @author George Politis |
|
12 * |
|
13 */ |
|
14 public interface OtrPolicy { |
|
15 |
|
16 public static final int ALLOW_V1 = 0x01; |
|
17 public static final int ALLOW_V2 = 0x02; |
|
18 public static final int REQUIRE_ENCRYPTION = 0x04; |
|
19 public static final int SEND_WHITESPACE_TAG = 0x08; |
|
20 public static final int WHITESPACE_START_AKE = 0x10; |
|
21 public static final int ERROR_START_AKE = 0x20; |
|
22 public static final int VERSION_MASK = (ALLOW_V1 | ALLOW_V2); |
|
23 |
|
24 // The four old version 1 policies correspond to the following combinations |
|
25 // of flags (adding an allowance for version 2 of the protocol): |
|
26 |
|
27 public static final int NEVER = 0x00; |
|
28 public static final int OPPORTUNISTIC = (ALLOW_V1 | ALLOW_V2 |
|
29 | SEND_WHITESPACE_TAG | WHITESPACE_START_AKE | ERROR_START_AKE); |
|
30 public static final int OTRL_POLICY_MANUAL = (ALLOW_V1 | ALLOW_V2); |
|
31 public static final int OTRL_POLICY_ALWAYS = (ALLOW_V1 | ALLOW_V2 |
|
32 | REQUIRE_ENCRYPTION | WHITESPACE_START_AKE | ERROR_START_AKE); |
|
33 public static final int OTRL_POLICY_DEFAULT = OPPORTUNISTIC; |
|
34 |
|
35 public abstract boolean getAllowV1(); |
|
36 |
|
37 public abstract boolean getAllowV2(); |
|
38 |
|
39 public abstract boolean getRequireEncryption(); |
|
40 |
|
41 public abstract boolean getSendWhitespaceTag(); |
|
42 |
|
43 public abstract boolean getWhitespaceStartAKE(); |
|
44 |
|
45 public abstract boolean getErrorStartAKE(); |
|
46 |
|
47 public abstract int getPolicy(); |
|
48 |
|
49 public abstract void setAllowV1(boolean value); |
|
50 |
|
51 public abstract void setAllowV2(boolean value); |
|
52 |
|
53 public abstract void setRequireEncryption(boolean value); |
|
54 |
|
55 public abstract void setSendWhitespaceTag(boolean value); |
|
56 |
|
57 public abstract void setWhitespaceStartAKE(boolean value); |
|
58 |
|
59 public abstract void setErrorStartAKE(boolean value); |
|
60 |
|
61 public abstract void setEnableAlways(boolean value); |
|
62 |
|
63 public abstract boolean getEnableAlways(); |
|
64 |
|
65 public abstract void setEnableManual(boolean value); |
|
66 |
|
67 public abstract boolean getEnableManual(); |
|
68 } |
|