(This is a merge of http://go/wvgerrit/13761 from the Widevine repository.) This cleans up our includes to be in Google Style Guide order and in alphabetic order, for the parts of the code that are expected to follow Google Style. This also converts places in our code that were including C headers in the C++ style (i.e. <cstring> instead of <string.h>) to use C style instead. This is because, although it was not causing problems for us yet, on Android these actually include different headers. (<cstring> is provided by libcxx, while <string.h> is provided by Bionic) Lastly, this change puts all headers that do not come from within our project in <brackets> instead of "quotes," which was not being done consistently. This change is explicitly NOT trying to standardize the spacing of our header includes. I have tried to respect, in each file, the spacing style already present. Change-Id: If3dc06532ab9b68010285d64518ef21dce3d6354
66 lines
2.1 KiB
C++
66 lines
2.1 KiB
C++
// Copyright 2014 Google Inc. All Rights Reserved.
|
|
|
|
#ifndef WVOEC_OEMCRYPTO_LOGGING_H_
|
|
#define WVOEC_OEMCRYPTO_LOGGING_H_
|
|
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
#include "log.h"
|
|
#include "OEMCryptoCENC.h"
|
|
|
|
namespace wvoec_mock {
|
|
|
|
// The constants below represent integers with a single "on" bit that
|
|
// represents categories of logging This allows users to specify with
|
|
// more precision what they want to log. LogCategoryEnabled(category)
|
|
// is used to see if the category passed in the parameters is to
|
|
// be logged based on the current settings. Categories can be combines
|
|
// using the | (or) bitwise operator. For example
|
|
// LogCategoryEnabled(category1 | category2) will return true if
|
|
// category1 and/or category2 are set to logging.
|
|
|
|
const int kLoggingTraceOEMCryptoCalls = 0x01;
|
|
const int kLoggingDumpContentKeys = 0x02;
|
|
const int kLoggingDumpKeyControlBlocks = 0x04;
|
|
const int kLoggingDumpDerivedKeys = 0x08;
|
|
const int kLoggingTraceNonce = 0x10;
|
|
const int kLoggingTraceDecryption = 0x20;
|
|
const int kLoggingTraceUsageTable = 0x40;
|
|
const int kLoggingDumpTraceAll = 0xFF;
|
|
|
|
void SetLoggingSettings(int level, int categories);
|
|
|
|
// set level of logging
|
|
void SetLoggingLevel(int level);
|
|
|
|
void TurnOffLoggingForAllCategories();
|
|
|
|
// Returns true if the category passed is set to logging.
|
|
// Returns false otherwise. The category constant declared
|
|
// above are passed.
|
|
bool LogCategoryEnabled(int category);
|
|
|
|
// Turn on logging for the categories passed.
|
|
void AddLoggingForCategories(int categories);
|
|
|
|
// Turn off logging for the categories passed.
|
|
void RemoveLoggingForCategories(int categories);
|
|
|
|
void dump_hex_helper(std::string& buffer, std::string name,
|
|
const uint8_t* vector, size_t length);
|
|
|
|
void dump_hex(std::string name, const uint8_t* vector, size_t length);
|
|
|
|
void dump_array_part_helper(std::string& buffer, std::string array,
|
|
size_t index, std::string name,
|
|
const uint8_t* vector, size_t length);
|
|
|
|
void dump_array_part(std::string array, size_t index,
|
|
std::string name, const uint8_t* vector, size_t length);
|
|
|
|
} // namespace wvoec_mock
|
|
|
|
#endif
|
|
|