forked from microsoft/cpp_client_telemetry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPayloadDecoder.hpp
55 lines (43 loc) · 1.6 KB
/
PayloadDecoder.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
//
#ifndef PAYLOADDECODER_HPP
#define PAYLOADDECODER_HPP
//
// Advanced functionality for Diagnostic Data Viewer and internal Unit Tests.
// Payload decoder implementation allows to transform the Bond binary-serialized
// payload data or Common Schema protocol struct into JSON format.
//
#include "ctmacros.hpp"
#include <vector>
#include <cinttypes>
#include <iostream>
namespace CsProtocol
{
struct Record;
};
namespace MAT_NS_BEGIN {
namespace exporters {
/// <summary>
/// Decode SDK transport layer and version-specific record struct into JSON format.
/// <param name="in">Common Schema Protocol record</param>
/// <param name="out">Record in JSON format</param>
/// <returns>
/// Returns true on success.
/// </returns>
/// </summary>
bool DecodeRecord(const CsProtocol::Record& in, std::string& out);
/// <summary>
/// Decode SDK transport layer and version-specific request structure into human-readable format.
/// <param name="in">Payload data, e.g. HTTPS POST request body</param>
/// <param name="out">Record(s) in JSON format</param>
/// <param name="compressed">Parameter that specifies that the payload data is compressed (optional, default true)</param>
/// </summary>
/// <returns>
/// Returns true on success.
/// </returns>
bool DecodeRequest(const std::vector<uint8_t>& in, std::string& out, bool compressed = true);
};
} MAT_NS_END
#endif