Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 1 | /** |
| 2 | * Copyright (C) 2004-2012 Savoir-Faire Linux Inc. |
| 3 | * |
| 4 | * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> |
| 5 | * |
| 6 | * This program is free software: you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation, either version 3 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * If you own a pjsip commercial license you can also redistribute it |
| 11 | * and/or modify it under the terms of the GNU Lesser General Public License |
| 12 | * as an android library. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 21 | */ |
| 22 | package com.savoirfairelinux.sflphone.utils; |
| 23 | |
| 24 | import com.savoirfairelinux.sflphone.R; |
| 25 | import com.savoirfairelinux.sflphone.utils.AccountDetail; |
| 26 | |
| 27 | import java.util.Collection; |
| 28 | import java.util.Set; |
| 29 | import java.util.HashMap; |
| 30 | |
| 31 | public class AccountDetailSrtp implements AccountDetail{ |
| 32 | |
| 33 | public static final String CONFIG_SRTP_ENABLE = "SRTP.enable"; |
| 34 | public static final String CONFIG_SRTP_KEY_EXCHANGE = "SRTP.keyExchange"; |
| 35 | public static final String CONFIG_SRTP_ENCRYPTION_ALGO = "SRTP.encryptionAlgorithm"; // Provided by ccRTP,0=NULL,1=AESCM,2=AESF8 |
| 36 | public static final String CONFIG_SRTP_RTP_FALLBACK = "SRTP.rtpFallback"; |
| 37 | public static final String CONFIG_ZRTP_HELLO_HASH = "ZRTP.helloHashEnable"; |
| 38 | public static final String CONFIG_ZRTP_DISPLAY_SAS = "ZRTP.displaySAS"; |
| 39 | public static final String CONFIG_ZRTP_NOT_SUPP_WARNING = "ZRTP.notSuppWarning"; |
| 40 | public static final String CONFIG_ZRTP_DISPLAY_SAS_ONCE = "ZRTP.displaySasOnce"; |
| 41 | |
| 42 | private HashMap<String, AccountDetail.PreferenceEntry> privateMap; |
| 43 | |
| 44 | public AccountDetailSrtp() |
| 45 | { |
| 46 | privateMap = new HashMap<String, AccountDetail.PreferenceEntry>(); |
| 47 | |
| 48 | privateMap.put(CONFIG_SRTP_ENABLE, |
Alexandre Savard | 20d0de0 | 2012-10-16 14:05:44 -0400 | [diff] [blame] | 49 | new PreferenceEntry(CONFIG_SRTP_ENABLE, R.string.account_srtp_enabled_label, true)); |
Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 50 | privateMap.put(CONFIG_SRTP_KEY_EXCHANGE, |
Alexandre Savard | 20d0de0 | 2012-10-16 14:05:44 -0400 | [diff] [blame] | 51 | new PreferenceEntry(CONFIG_SRTP_KEY_EXCHANGE, R.string.account_srtp_exchange_label, true)); |
Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 52 | privateMap.put(CONFIG_SRTP_ENCRYPTION_ALGO, |
Alexandre Savard | 20d0de0 | 2012-10-16 14:05:44 -0400 | [diff] [blame] | 53 | new PreferenceEntry(CONFIG_SRTP_ENCRYPTION_ALGO, R.string.account_encryption_algo_label, true)); |
Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 54 | privateMap.put(CONFIG_SRTP_RTP_FALLBACK, |
Alexandre Savard | 20d0de0 | 2012-10-16 14:05:44 -0400 | [diff] [blame] | 55 | new PreferenceEntry(CONFIG_SRTP_RTP_FALLBACK, R.string.account_srtp_fallback_label, true)); |
Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 56 | privateMap.put(CONFIG_ZRTP_HELLO_HASH, |
Alexandre Savard | 20d0de0 | 2012-10-16 14:05:44 -0400 | [diff] [blame] | 57 | new PreferenceEntry(CONFIG_ZRTP_HELLO_HASH, R.string.account_hello_hash_enable_label, true)); |
Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 58 | privateMap.put(CONFIG_ZRTP_DISPLAY_SAS, |
Alexandre Savard | 20d0de0 | 2012-10-16 14:05:44 -0400 | [diff] [blame] | 59 | new PreferenceEntry(CONFIG_ZRTP_DISPLAY_SAS, R.string.account_display_sas_label, true)); |
Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 60 | privateMap.put(CONFIG_ZRTP_NOT_SUPP_WARNING, |
Alexandre Savard | 20d0de0 | 2012-10-16 14:05:44 -0400 | [diff] [blame] | 61 | new PreferenceEntry(CONFIG_ZRTP_NOT_SUPP_WARNING, R.string.account_not_supported_warning_label, true)); |
Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 62 | privateMap.put(CONFIG_ZRTP_DISPLAY_SAS_ONCE, |
Alexandre Savard | 20d0de0 | 2012-10-16 14:05:44 -0400 | [diff] [blame] | 63 | new PreferenceEntry(CONFIG_ZRTP_DISPLAY_SAS_ONCE, R.string.account_display_sas_once_label, true)); |
Alexandre Savard | f7f9e0b | 2012-10-15 17:24:07 -0400 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | public Set<String> getDetailKeys() |
| 67 | { |
| 68 | return privateMap.keySet(); |
| 69 | } |
| 70 | |
| 71 | public Collection<AccountDetail.PreferenceEntry> getDetailValues() |
| 72 | { |
| 73 | return privateMap.values(); |
| 74 | } |
| 75 | } |