kea-custom-hooks
FeM custom hooks libraries for Kea DHCP
Typedefs | Functions
util Namespace Reference

Typedefs

using byte_string = std::basic_string< std::byte >
 
using byte_string_view = std::basic_string_view< std::byte >
 

Functions

byte_string to_bytestr (const std::vector< uint8_t > &bytea)
 Convert a byte array to a byte string. More...
 
std::vector< uint8_t > to_bytea (byte_string_view bytestr)
 Convert a byte string to a byte array. More...
 
pqxx::binarystring to_binstr (const std::vector< std::uint8_t > &barr)
 Convert a byte array to a binary string. More...
 
std::vector< std::uint8_t > to_bytea (const pqxx::binarystring &bstr)
 Convert a binary string to a byte array. More...
 

Typedef Documentation

◆ byte_string

using util::byte_string = typedef std::basic_string<std::byte>

Definition at line 17 of file bytea_utils.hpp.

◆ byte_string_view

using util::byte_string_view = typedef std::basic_string_view<std::byte>

Definition at line 18 of file bytea_utils.hpp.

Function Documentation

◆ to_binstr()

pqxx::binarystring util::to_binstr ( const std::vector< std::uint8_t > &  barr)

Convert a byte array to a binary string.

This is the inverse of util::to_bytea(), converting a byte array to the type libpqxx 6 uses for the BYTEA Postgres data type. This is the libpqxx 6 equivalent to util::to_bytestr().

Definition at line 8 of file pqxx_compat.cpp.

◆ to_bytea() [1/2]

std::vector< uint8_t > util::to_bytea ( byte_string_view  str)

Convert a byte string to a byte array.

Definition at line 18 of file bytea_utils.cpp.

◆ to_bytea() [2/2]

std::vector< std::uint8_t > util::to_bytea ( const pqxx::binarystring &  bstr)

Convert a binary string to a byte array.

Binary strings are the libpqxx 6 type for the BYTEA Postgres data type. This is the libpqxx 6 equivalent to the util::to_bytea() overload which takes a util::byte_string.

Definition at line 13 of file pqxx_compat.cpp.

◆ to_bytestr()

byte_string util::to_bytestr ( const std::vector< uint8_t > &  bytea)

Convert a byte array to a byte string.

The input byte array is a vector of uint8_t like found in isc::dhcp::HWAddr.

Definition at line 7 of file bytea_utils.cpp.