1 /* 2 * Copyright (c) 2020 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 OHOS_DISTRIBUTEDSCHEDULE_MSGPACK_H 17 #define OHOS_DISTRIBUTEDSCHEDULE_MSGPACK_H 18 19 #include "dmslite_tlv_common.h" 20 #include <stdint.h> 21 #include <stdbool.h> 22 23 #ifdef __cplusplus 24 #if __cplusplus 25 extern "C" { 26 #endif 27 #endif 28 29 bool PreprareBuild(); 30 bool MarshallUint8(uint8_t field, FieldType fieldType); 31 bool MarshallUint16(uint16_t field, FieldType fieldType); 32 bool MarshallUint32(uint32_t field, FieldType fieldType); 33 bool MarshallUint64(uint64_t field, FieldType fieldType); 34 bool MarshallInt8(int8_t field, FieldType fieldType); 35 bool MarshallInt16(int16_t field, FieldType fieldType); 36 bool MarshallInt32(int32_t field, FieldType fieldType); 37 bool MarshallInt64(int64_t field, FieldType fieldType); 38 bool MarshallString(const char* field, uint8_t type); 39 bool MarshallRawData(const void *field, uint8_t type, uint16_t length); 40 uint16_t GetPacketSize(); 41 const char* GetPacketBufPtr(); 42 void CleanBuild(); 43 44 #ifdef __cplusplus 45 #if __cplusplus 46 } 47 #endif 48 #endif 49 50 #endif /* OHOS_DISTRIBUTEDSCHEDULE_MSGPACK_H */ 51