1 /* 2 im_encryption_engine.h 3 Copyright (C) 2016 Belledonne Communications SARL 4 5 This program is free software; you can redistribute it and/or 6 modify it under the terms of the GNU General Public License 7 as published by the Free Software Foundation; either version 2 8 of the License, or (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef LINPHONE_IM_ENCRYPTION_ENGINE_H 21 #define LINPHONE_IM_ENCRYPTION_ENGINE_H 22 23 #include "linphone/types.h" 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif 28 29 /** 30 * @addtogroup misc 31 * @{ 32 */ 33 34 /** 35 * Acquire a reference to the LinphoneImEncryptionEngineCbs. 36 * @param[in] cbs LinphoneImEncryptionEngineCbs object. 37 * @return The same LinphoneImEncryptionEngineCbs object. 38 **/ 39 LinphoneImEncryptionEngineCbs * linphone_im_encryption_engine_cbs_ref(LinphoneImEncryptionEngineCbs *cbs); 40 41 /** 42 * Release reference to the LinphoneImEncryptionEngineCbs. 43 * @param[in] cbs LinphoneImEncryptionEngineCbs object. 44 **/ 45 void linphone_im_encryption_engine_cbs_unref(LinphoneImEncryptionEngineCbs *cbs); 46 47 /** 48 * Gets the user data in the LinphoneImEncryptionEngineCbs object 49 * @param[in] cbs the LinphoneImEncryptionEngineCbs 50 * @return the user data 51 */ 52 LINPHONE_PUBLIC void *linphone_im_encryption_engine_cbs_get_user_data(const LinphoneImEncryptionEngineCbs *cbs); 53 54 /** 55 * Sets the user data in the LinphoneImEncryptionEngineCbs object 56 * @param[in] cbs the LinphoneImEncryptionEngineCbs object 57 * @param[in] data the user data 58 */ 59 LINPHONE_PUBLIC void linphone_im_encryption_engine_cbs_set_user_data(LinphoneImEncryptionEngineCbs *cbs, void *data); 60 61 /** 62 * Acquire a reference to the LinphoneImEncryptionEngine. 63 * @param[in] imee LinphoneImEncryptionEngine object. 64 * @return The same LinphoneImEncryptionEngine object. 65 **/ 66 LINPHONE_PUBLIC LinphoneImEncryptionEngine * linphone_im_encryption_engine_ref(LinphoneImEncryptionEngine *imee); 67 68 /** 69 * Release reference to the LinphoneImEncryptionEngine. 70 * @param[in] imee LinphoneImEncryptionEngine object. 71 **/ 72 LINPHONE_PUBLIC void linphone_im_encryption_engine_unref(LinphoneImEncryptionEngine *imee); 73 74 /** 75 * Gets the user data in the LinphoneImEncryptionEngine object 76 * @param[in] imee the LinphoneImEncryptionEngine 77 * @return the user data 78 */ 79 LINPHONE_PUBLIC void *linphone_im_encryption_engine_get_user_data(const LinphoneImEncryptionEngine *imee); 80 81 /** 82 * Sets the user data in the LinphoneImEncryptionEngine object 83 * @param[in] imee the LinphoneImEncryptionEngine object 84 * @param[in] data the user data 85 */ 86 LINPHONE_PUBLIC void linphone_im_encryption_engine_set_user_data(LinphoneImEncryptionEngine *imee, void *data); 87 88 /** 89 * Gets the LinphoneCore object that created the IM encryption engine 90 * @param[in] imee LinphoneImEncryptionEngine object 91 * @return The LinphoneCore object that created the IM encryption engine 92 */ 93 LINPHONE_PUBLIC LinphoneCore * linphone_im_encryption_engine_get_core(LinphoneImEncryptionEngine *imee); 94 95 /** 96 * Gets the LinphoneImEncryptionEngineCbs object that holds the callbacks 97 * @param[in] imee the LinphoneImEncryptionEngine object 98 * @return the LinphoneImEncryptionEngineCbs object 99 */ 100 LINPHONE_PUBLIC LinphoneImEncryptionEngineCbs* linphone_im_encryption_engine_get_callbacks(const LinphoneImEncryptionEngine *imee); 101 102 /** 103 * Gets the callback that will decrypt the chat messages upon reception 104 * @param[in] cbs the LinphoneImEncryptionEngineCbs object 105 * @return the callback 106 */ 107 LINPHONE_PUBLIC LinphoneImEncryptionEngineCbsIncomingMessageCb linphone_im_encryption_engine_cbs_get_process_incoming_message(LinphoneImEncryptionEngineCbs *cbs); 108 109 /** 110 * Sets the callback that will decrypt the chat messages upon reception 111 * @param[in] cbs the LinphoneImEncryptionEngineCbs object 112 * @param[in] cb the callback to call 113 */ 114 LINPHONE_PUBLIC void linphone_im_encryption_engine_cbs_set_process_incoming_message(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineCbsIncomingMessageCb cb); 115 116 /** 117 * Gets the callback that will encrypt the chat messages before sending them 118 * @param[in] cbs the LinphoneImEncryptionEngineCbs object 119 * @return the callback 120 */ 121 LINPHONE_PUBLIC LinphoneImEncryptionEngineCbsOutgoingMessageCb linphone_im_encryption_engine_cbs_get_process_outgoing_message(LinphoneImEncryptionEngineCbs *cbs); 122 123 /** 124 * Sets the callback that will encrypt the chat messages before sending them 125 * @param[in] cbs the LinphoneImEncryptionEngineCbs object 126 * @param[in] cb the callback to call 127 */ 128 LINPHONE_PUBLIC void linphone_im_encryption_engine_cbs_set_process_outgoing_message(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineCbsOutgoingMessageCb cb); 129 130 /** 131 * Gets the callback that will decrypt the files while downloading them 132 * @param[in] cbs the LinphoneImEncryptionEngineCbs object 133 * @return the callback 134 */ 135 LINPHONE_PUBLIC LinphoneImEncryptionEngineCbsDownloadingFileCb linphone_im_encryption_engine_cbs_get_process_downloading_file(LinphoneImEncryptionEngineCbs *cbs); 136 137 /** 138 * Sets the callback that will decrypt the files while downloading them 139 * @param[in] cbs the LinphoneImEncryptionEngineCbs object 140 * @param[in] cb the callback to call 141 */ 142 LINPHONE_PUBLIC void linphone_im_encryption_engine_cbs_set_process_downloading_file(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineCbsDownloadingFileCb cb); 143 144 /** 145 * Gets the callback that will will encrypt the files while uploading them 146 * @param[in] cbs the LinphoneImEncryptionEngineCbs object 147 * @return the callback 148 */ 149 LINPHONE_PUBLIC LinphoneImEncryptionEngineCbsUploadingFileCb linphone_im_encryption_engine_cbs_get_process_uploading_file(LinphoneImEncryptionEngineCbs *cbs); 150 151 /** 152 * Sets the callback that will encrypt the files while uploading them 153 * @param[in] cbs the LinphoneImEncryptionEngineCbs object 154 * @param[in] cb the callback to call 155 */ 156 LINPHONE_PUBLIC void linphone_im_encryption_engine_cbs_set_process_uploading_file(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineCbsUploadingFileCb cb); 157 158 /** 159 * Gets the callback telling wheter or not to encrypt the files 160 * @param[in] cbs the LinphoneImEncryptionEngineCbs object 161 * @return the callback 162 */ 163 LINPHONE_PUBLIC LinphoneImEncryptionEngineCbsIsEncryptionEnabledForFileTransferCb linphone_im_encryption_engine_cbs_get_is_encryption_enabled_for_file_transfer(LinphoneImEncryptionEngineCbs *cbs); 164 165 /** 166 * Sets the callback telling wheter or not to encrypt the files 167 * @param[in] cbs the LinphoneImEncryptionEngineCbs object 168 * @param[in] cb the callback to call 169 */ 170 LINPHONE_PUBLIC void linphone_im_encryption_engine_cbs_set_is_encryption_enabled_for_file_transfer(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineCbsIsEncryptionEnabledForFileTransferCb cb); 171 172 /** 173 * Gets the callback that will generate the key to encrypt the file before uploading it 174 * @param[in] cbs the LinphoneImEncryptionEngineCbs object 175 * @return the callback 176 */ 177 LINPHONE_PUBLIC LinphoneImEncryptionEngineCbsGenerateFileTransferKeyCb linphone_im_encryption_engine_cbs_get_generate_file_transfer_key(LinphoneImEncryptionEngineCbs *cbs); 178 179 /** 180 * Sets the callback that will generate the key to encrypt the file before uploading it 181 * @param[in] cbs the LinphoneImEncryptionEngineCbs object 182 * @param[in] cb the callback to call 183 */ 184 LINPHONE_PUBLIC void linphone_im_encryption_engine_cbs_set_generate_file_transfer_key(LinphoneImEncryptionEngineCbs *cbs, LinphoneImEncryptionEngineCbsGenerateFileTransferKeyCb cb); 185 186 /** Set a chat message text to be sent by #linphone_chat_room_send_message 187 * @param[in] msg LinphoneChatMessage 188 * @param[in] text Const char * 189 * @returns 0 if succeed. 190 */ 191 LINPHONE_PUBLIC int linphone_chat_message_set_text(LinphoneChatMessage *msg, const char* text); 192 193 /** 194 * Create the IM encryption engine 195 * @return The created the IM encryption engine 196 */ 197 LINPHONE_PUBLIC LinphoneImEncryptionEngine *linphone_im_encryption_engine_new(void); 198 199 /** 200 * @} 201 */ 202 203 #ifdef __cplusplus 204 } 205 #endif 206 207 #endif /* LINPHONE_IM_ENCRYPTION_ENGINE_H */ 208