ib_parsed_name_value_pair_list_wrapper_t* make_pnv_list( Transaction transaction, Iterator begin, Iterator end ) { ib_parsed_name_value_pair_list_wrapper_t* ib_pnv_list; throw_if_error( ib_parsed_name_value_pair_list_wrapper_create( &ib_pnv_list, transaction.ib() ) ); BOOST_FOREACH( ParsedNameValue pnv, std::make_pair(begin, end) ) { // This will reconstruct the bytestrings but not copy the data. // The C API is currently asymmetric: named values are consumed as // structures but added to list as members. IronBee++ hides that // asymmetry. throw_if_error( ib_parsed_name_value_pair_list_add( ib_pnv_list, pnv.name().const_data(), pnv.name().length(), pnv.value().const_data(), pnv.value().length() ) ); }
void ConstTransformation::register_with(Engine engine) { throw_if_error(ib_tfn_register( engine.ib(), ib() )); }
HooksRegistrar& HooksRegistrar::transaction_data( Engine::state_event_e event, transaction_data_t f ) { if (f.empty()) { BOOST_THROW_EXCEPTION(einval() << errinfo_what( "Empty functional passed to hook registrarion." )); } throw_if_error( ib_hook_txdata_register( m_engine.ib(), static_cast<ib_state_event_type_t>(event), &Internal::Hooks::transaction_data, value_to_data<transaction_data_t>( f, m_engine.main_memory_pool().ib() ) ) ); return *this; }
int64_t ConstField::value_as_number() const { Internal::check_type(NUMBER, type()); int64_t v; throw_if_error(ib_field_value(ib(), ib_ftype_num_out(&v))); return v; }
uint64_t ConstField::value_as_time() const { Internal::check_type(TIME, type()); uint64_t v; throw_if_error(ib_field_value(ib(), ib_ftype_time_out(&v))); return v; }
/** * Create new hash with custom hash and equal functions. * * @param[in] memory_manager Memory manager to use. * @param[in] slots Initial size of hash. * @param[in] hash Function to use to hash keys. * @param[in] equal Function to use to compare keys. * @return Empty Hash. **/ static Hash create( MemoryManager memory_manager, size_t slots, key_hash_t hash, key_equal_t equal ) { std::pair<ib_hash_function_t, void*> hash_trampoline; std::pair<ib_hash_equal_t, void*> equal_trampoline; ib_hash_t* h; hash_trampoline = make_c_trampoline< uint32_t(const char*, size_t, uint32_t) >(hash); equal_trampoline = make_c_trampoline< int(const char*, size_t, const char*, size_t) >(equal); memory_manager.register_cleanup( boost::bind(delete_c_trampoline, hash_trampoline.second) ); memory_manager.register_cleanup( boost::bind(delete_c_trampoline, equal_trampoline.second) ); throw_if_error( ib_hash_create_ex( &h, memory_manager.ib(), slots, hash_trampoline.first, hash_trampoline.second, equal_trampoline.first, equal_trampoline.second ) ); return Hash(h); }
void lttng::Session::enable_event(const std::string& event) { auto cp = core::posix::exec( "/usr/bin/lttng", {"enable-event", event, "--" + boost::lexical_cast<std::string>(domain_), "-s", name_}, copy_env(), core::posix::StandardStream::empty); throw_if_error(cp.wait_for(core::posix::wait::Flags::untraced)); }
long double ConstField::value_as_float() const { Internal::check_type(FLOAT, type()); long double v; throw_if_error(ib_field_value(ib(), ib_ftype_float_out(&v))); return v; }
Field create_dynamic_field( MemoryPool pool, const char* name, size_t name_length, Field::type_e type, void* cbdata_get, void* cbdata_set ) { ib_field_t* f = NULL; ib_status_t rc = ib_field_create_dynamic( &f, pool.ib(), name, name_length, static_cast<ib_ftype_t>(type), Hooks::field_dynamic_get, cbdata_get, Hooks::field_dynamic_set, cbdata_set ); throw_if_error(rc); return Field(f); }
/** * Set a value in hash. * * @param[in] key Key. * @param[in] key_length Length of @a key. * @param[in] value Value. **/ void set(const char* key, size_t key_length, T value) const { throw_if_error(ib_hash_set_ex( ib(), key, key_length, Internal::value_as_void(value) )); }
void lttng::Session::stop() { auto cp = core::posix::exec( "/usr/bin/lttng", {"stop", name_}, copy_env(), core::posix::StandardStream::stdout); throw_if_error(cp.wait_for(core::posix::wait::Flags::untraced)); }
void lttng::Session::add_context(lttng::Context context) { auto cp = core::posix::exec( "/usr/bin/lttng", {"add-context", "-t", boost::lexical_cast<std::string>(context), "--" + boost::lexical_cast<std::string>(domain_), "-s", name_}, copy_env(), core::posix::StandardStream::empty); throw_if_error(cp.wait_for(core::posix::wait::Flags::untraced)); }
lttng::Session::~Session() { auto cp = core::posix::exec( "/usr/bin/lttng", {"destroy", name_}, copy_env(), core::posix::StandardStream::empty); throw_if_error(cp.wait_for(core::posix::wait::Flags::untraced)); }
ConstField get(ConstContext ctx, const char* key, size_t key_length) { const ib_field_t* result; throw_if_error(ib_module_constant_get(&result, ctx.ib(), key, key_length)); return ConstField(result); }
Value const &get() const #if SILICIUM_COMPILER_HAS_RVALUE_THIS_QUALIFIER & #endif { throw_if_error(); return *value_ptr(); }
ConfigurationParser ConfigurationParser::create(Engine engine) { ib_cfgparser_t* ib_cp = NULL; throw_if_error( ib_cfgparser_create(&ib_cp, engine.ib()) ); return ConfigurationParser(ib_cp); }
ConstByteString ConstField::value_as_byte_string() const { Internal::check_type(BYTE_STRING, type()); const ib_bytestr_t* v; throw_if_error(ib_field_value( ib(), ib_ftype_bytestr_out(&v) )); return ConstByteString(v); }
const char* ConstField::value_as_null_string() const { Internal::check_type(NULL_STRING, type()); const char* v; throw_if_error(ib_field_value( ib(), ib_ftype_nulstr_out(&v) )); return v; }
Transaction Transaction::create(Connection connection) { ib_tx_t* ib_tx; throw_if_error( ib_tx_create(&ib_tx, connection.ib(), NULL) ); return Transaction(ib_tx); }
ByteString Field::mutable_value_as_byte_string() const { Internal::check_type(BYTE_STRING, type()); ib_bytestr_t* bs; throw_if_error(ib_field_mutable_value(ib(), ib_ftype_bytestr_mutable_out(&bs) )); return ByteString(bs); }
char* Field::mutable_value_as_null_string() const { Internal::check_type(NULL_STRING, type()); char* cs; throw_if_error(ib_field_mutable_value(ib(), ib_ftype_nulstr_mutable_out(&cs) )); return cs; }
long double& Field::mutable_value_as_float() const { Internal::check_type(FLOAT, type()); ib_float_t* n; throw_if_error(ib_field_mutable_value(ib(), ib_ftype_float_mutable_out(&n) )); return *n; }
int64_t& Field::mutable_value_as_number() const { Internal::check_type(NUMBER, type()); ib_num_t* n; throw_if_error(ib_field_mutable_value(ib(), ib_ftype_num_mutable_out(&n) )); return *n; }
uint64_t& Field::mutable_value_as_time() const { Internal::check_type(TIME, type()); ib_time_t* n; throw_if_error(ib_field_mutable_value(ib(), ib_ftype_time_mutable_out(&n) )); return *n; }
Connection Connection::create(Engine engine) { ib_conn_t* ib_conn; throw_if_error( ib_conn_create(engine.ib(), &ib_conn, NULL) ); return Connection(ib_conn); }
void set_value( ib_field_t* f, void* in_value, const char* arg, size_t arg_length ) { ib_status_t rc = ib_field_setv_ex(f, in_value, arg, arg_length); throw_if_error(rc); }
Engine Engine::create(Server server) { ib_engine_t* ib_engine; throw_if_error( ib_engine_create( &ib_engine, server.ib() ) ); return Engine(ib_engine); }
lttng::Session::Session(lttng::Domain domain, const std::string& name, const std::shared_ptr<lttng::Consumer>& consumer) : domain_(domain), name_(name), consumer_(consumer) { auto cp = core::posix::exec( "/usr/bin/lttng", {"create", name_, "--set-url", consumer->to_url()}, copy_env(), core::posix::StandardStream::empty); throw_if_error(cp.wait_for(core::posix::wait::Flags::untraced)); }
/** * Remove a value from hash. * * @param[in] key Key. * @param[in] key_length Length of @a key. * * @return Value removed. * * @throw enoent if no such key. **/ T remove(const char* key, size_t key_length) const { void* ib_value; T value; throw_if_error(ib_hash_remove_ex(ib(), &ib_value, key, key_length)); Internal::void_as_value<T>( value, ib_value, boost::is_pointer<T>() ); return value; }
void ConstActionInstance::execute( const ib_rule_exec_t* rule_exec ) const { throw_if_error( ib_action_inst_execute( ib(), rule_exec ) ); }