1 /* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef MMS_CONTENT_PARAM_H 17 #define MMS_CONTENT_PARAM_H 18 19 #include <map> 20 21 #include "mms_decode_buffer.h" 22 #include "mms_encode_buffer.h" 23 24 namespace OHOS { 25 namespace Telephony { 26 /** 27 * wap-230-wsp-20010705-a section:Table 38. Well-Known Parameter Assignments 28 */ 29 enum class ContentParam { 30 // Encoding Version 1.1 31 CT_P_Q = 0x80, /* Q */ 32 CT_P_CHARSET = 0x81, /* Charset */ 33 CT_P_LEVEL = 0x82, /* Level */ 34 CT_P_TYPE = 0x83, /* Type */ 35 CT_P_NAME = 0x85, /* Name */ 36 CT_P_FILENAME = 0x86, /* Filename */ 37 CT_P_DIFFERENCES = 0x87, /* Differences */ 38 CT_P_PADDING = 0x88, /* Padding */ 39 // Encoding Version 1.2 40 CT_P_TYPE_STRING = 0x89, /* Type */ 41 CT_P_START = 0x8A, /* Start Text-string */ 42 CT_P_START_INFO = 0x8B, /* Start-info Text-string */ 43 // Encoding Version 1.3 44 CT_P_COMMENT = 0x8C, /* Comment */ 45 CT_P_DOMAIN = 0x8D, /* Domain */ 46 CT_P_MAX_AGE = 0x8E, /* Max-Age */ 47 CT_P_PATH = 0x8F, /* Path */ 48 CT_P_SECURE = 0x90, /* Secure */ 49 // Encoding Version 1.4 50 CT_P_SEC = 0x91, /* SEC */ 51 CT_P_MAC = 0x92, /* MAC */ 52 CT_P_CREATION_DATE = 0x93, /* Creation-date */ 53 CT_P_MODIFICATION_DATE = 0x94, /* Modification-date */ 54 CT_P_READ_DATE = 0x95, /* Read-date */ 55 CT_P_SIZE = 0x96, /* Size */ 56 CT_P_NAME_VALUE = 0x97, /* Name */ 57 CT_P_FILENAME_VALUE = 0x98, /* Filename */ 58 CT_P_START_VALUE = 0x99, /* Start Text-value */ 59 CT_P_START_INFO_VALUE = 0x9A, /* Start-info Text-value */ 60 CT_P_COMMENT_VALUE = 0x9B, /* Comment */ 61 CT_P_DOMAIN_VALUE = 0x9C, /* Domain */ 62 CT_P_PATH_VALUE = 0x9D, /* Path */ 63 }; 64 65 class MmsContentParam { 66 public: 67 MmsContentParam() = default; 68 ~MmsContentParam() = default; 69 void DumpContentParam(); 70 MmsContentParam& operator=(const MmsContentParam &srcContentParam); 71 uint32_t GetCharSet(); 72 void SetCharSet(uint32_t charset); 73 std::string GetType(); 74 void SetType(std::string type); 75 void GetFileName(std::string &fileName); 76 void SetFileName(std::string fileName); 77 void GetStart(std::string &start); 78 void SetStart(std::string start); 79 bool AddNormalField(uint8_t field, std::string value); 80 bool GetNormalField(uint8_t field, std::string &value); 81 std::map<uint8_t, std::string> &GetParamMap(); 82 private: 83 uint32_t charset_ = 0; 84 std::string type_ = ""; 85 std::map<uint8_t, std::string> textMap_; 86 }; 87 } // namespace Telephony 88 } // namespace OHOS 89 #endif 90