1 /* 2 * Copyright (c) 2024 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 #ifndef WIFI_DIRECT_SERIALIZATION_H 16 #define WIFI_DIRECT_SERIALIZATION_H 17 18 #include <any> 19 #include <string> 20 #include <vector> 21 22 namespace OHOS::SoftBus { 23 class WifiDirectProtocol; 24 class Serializable { 25 public: 26 enum class ValueType { 27 BOOL = 0, 28 INT = 1, 29 UINT = 2, 30 STRING = 3, 31 BYTE_ARRAY = 4, 32 INT_ARRAY = 5, 33 IPV4_INFO = 6, 34 IPV4_INFO_ARRAY = 7, 35 INTERFACE_INFO_ARRAY = 8, 36 LINK_INFO = 9, 37 INNER_LINK = 10, 38 BYTE = 11, 39 }; 40 41 virtual int Marshalling(WifiDirectProtocol &protocol, std::vector<uint8_t> &output) const = 0; 42 virtual int Unmarshalling(WifiDirectProtocol &protocol, const std::vector<uint8_t> &input) = 0; 43 virtual ~Serializable() = default; 44 }; 45 } 46 #endif 47