// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> std::string generateEventID(int year, uint64_t x, const std::string &prefix, const string &pattern, std::string &textBlock, uint64_t *width) { string evtID; textBlock = ""; for ( size_t i = 0; i < pattern.size(); ++i ) { if ( pattern[i] != '%' ) evtID += pattern[i]; else { ++i; int len = 0; while ( i < pattern.size() ) { if ( pattern[i] >= '0' && pattern[i] <= '9' ) { len *= 10; len += int(pattern[i] - '0'); ++i; continue; } else if ( pattern[i] == '%' ) { evtID += pattern[i]; } else if ( pattern[i] == 'c' ) { textBlock = encodeChar(x, len, width); evtID += textBlock; } else if ( pattern[i] == 'C' ) { textBlock = makeUpper(encodeChar(x, len, width)); evtID += textBlock; } else if ( pattern[i] == 'd' ) { textBlock = encodeInt(x, len, width); evtID += textBlock; } else if ( pattern[i] == 'x' ) { textBlock = encodeHex(x, len, width); evtID += textBlock; } else if ( pattern[i] == 'X' ) { textBlock = makeUpper(encodeHex(x, len, width)); evtID += textBlock; } else if ( pattern[i] == 'Y' ) evtID += toString(year); else if ( pattern[i] == 'p' ) evtID += prefix; else return ""; break; } } } return evtID; }
extern void messageP2PHelloShow (const BREthereumP2PMessageHello *hello) { size_t nodeIdLen = 2 * sizeof (hello->nodeId.u8) + 1; char nodeId[nodeIdLen]; encodeHex(nodeId, nodeIdLen, hello->nodeId.u8, sizeof (hello->nodeId.u8)); eth_log (LES_LOG_TOPIC, "Hello%s", ""); eth_log (LES_LOG_TOPIC, " Version : %" PRIu64, hello->version); eth_log (LES_LOG_TOPIC, " ClientId : %s", hello->clientId); eth_log (LES_LOG_TOPIC, " ListenPort : %" PRIu64, hello->port); eth_log (LES_LOG_TOPIC, " NodeId : 0x%s", nodeId); eth_log (LES_LOG_TOPIC, " Capabilities:%s", ""); for (size_t index = 0; index < array_count(hello->capabilities); index++) eth_log (LES_LOG_TOPIC, " %s = %u", hello->capabilities[index].name, hello->capabilities[index].version); }