static VALUE bdb_env_log_get(VALUE obj, VALUE a) { bdb_ENV *envst; DBT data; struct dblsnst *lsnst; VALUE res, lsn; int ret, flag; GetEnvDB(obj, envst); flag = NUM2INT(a); MEMZERO(&data, DBT, 1); data.flags |= DB_DBT_MALLOC; lsn = bdb_makelsn(obj); Data_Get_Struct(lsn, struct dblsnst, lsnst); #if HAVE_ST_DB_ENV_LG_INFO if (!envst->envp->lg_info) { rb_raise(bdb_eFatal, "log region not open"); } ret = bdb_test_error(log_get(envst->envp->lg_info, lsnst->lsn, &data, flag)); #else ret = bdb_test_error(log_get(envst->envp, lsnst->lsn, &data, flag)); #endif if (ret == DB_NOTFOUND) { return Qnil; } res = rb_tainted_str_new(data.data, data.size); free(data.data); return rb_assoc_new(res, lsn); }
int rnc_sendlogs(BIO *ssl) { RncProtoHeader pheader; RncProtoLog plog; u_int count = 0; /* header parameters */ pheader.code = RNC_PROTO_LOG; pheader.size = sizeof(plog); /* send logs until there are any in the cache */ while (log_get(&plog)) { /* send header for the log */ if (ssl_proto_write(ssl, &pheader, sizeof(pheader)) <= 0) return -1; /* send the log */ if (ssl_proto_write(ssl, &plog, sizeof(plog)) <= 0) return -1; // DEBUG_MSG(D_VERBOSE, "rnc_sendlogs - [%s]", plog.desc); count++; } DEBUG_MSG(D_DEBUG, "%d log sent to RNC", count); return count; }
// We read maximum possible data chunk each call uint16_t log_http_read( char *dest, uint16_t dest_sz ) { //uint16_t rlen = 0; if( http_get_pos == logbuf ) return 0; char *copy = http_get_pos; // don't update http_get_pos, put will push it around return log_get( dest, dest_sz, © ); }
static VALUE bdb_lsn_log_get(int argc, VALUE *argv, VALUE obj) { struct dblsnst *lsnst; DBT data; VALUE res, a; int ret, flags; bdb_ENV *envst; #if HAVE_ST_DB_ENV_LOG_CURSOR DB_LOGC *cursor; #endif flags = DB_SET; if (rb_scan_args(argc, argv, "01", &a) == 1) { flags = NUM2INT(a); } GetLsn(obj, lsnst, envst); #if HAVE_ST_DB_ENV_LOG_CURSOR bdb_test_error(envst->envp->log_cursor(envst->envp, &cursor, 0)); #endif MEMZERO(&data, DBT, 1); data.flags |= DB_DBT_MALLOC; #if HAVE_ST_DB_ENV_LG_INFO if (!envst->envp->lg_info) { rb_raise(bdb_eFatal, "log region not open"); } ret = bdb_test_error(log_get(envst->envp->lg_info, lsnst->lsn, &data, flags)); #elif HAVE_ST_DB_ENV_LOG_CURSOR ret = cursor->get(cursor, lsnst->lsn, &data, flags); cursor->close(cursor, 0); ret = bdb_test_error(ret); #else ret = bdb_test_error(log_get(envst->envp, lsnst->lsn, &data, flags)); #endif if (ret == DB_NOTFOUND) { return Qnil; } res = rb_tainted_str_new(data.data, data.size); free(data.data); return res; }
//============================================================================== static void init_log(int argc, char *argv[], String &log_file) { if (log_file.empty()) log_file = String(MODULE_NAME) + ".log"; log_get().set_log_file(log_file); log_info("main, %s %u.%u", MODULE_NAME, VERSION_MAJOR, VERSION_MINOR); String command_line; while (argc--) command_line += String(*argv++) + " "; log_info("main, command line: %s", command_line.c_str()); }
void set_log(void *bp) { button b = bp; (void)b; main_console->tb_out->data = log_get(); textbox_clear_text(main_console->tb_in); set_input(NULL, 0); main_console->tb_in->active = 0; //main_console->in_bar->active = 0; main_console->tb_out->lines = 18; textbox_find_lines(main_console->tb_out); }
static VALUE bdb_i_each_log_get(VALUE obj, int flag) { #if ! HAVE_ST_DB_ENV_LOG_CURSOR bdb_ENV *envst; #endif struct dblsnst *lsnst, *lsnst1; DBT data; VALUE lsn, lsn1; VALUE res; int ret, init, flags; init = BDB_LOG_INIT; #if ! HAVE_ST_DB_ENV_LOG_CURSOR GetEnvDB(obj, envst); #else lsn = obj; Data_Get_Struct(obj, struct dblsnst, lsnst); flag = lsnst->flags; if (lsnst->cursor == 0) { DB_LSN *lsn1; init = BDB_LOG_SET; lsn1 = lsnst->lsn; lsn = bdb_makelsn(lsnst->env); Data_Get_Struct(lsn, struct dblsnst, lsnst); MEMCPY(lsnst->lsn, lsn1, DB_LSN, 1); bdb_log_cursor(lsn); } #endif do { #if ! HAVE_ST_DB_ENV_LOG_CURSOR lsn = bdb_makelsn(obj); Data_Get_Struct(lsn, struct dblsnst, lsnst); #endif MEMZERO(&data, DBT, 1); data.flags |= DB_DBT_MALLOC; switch (init) { case BDB_LOG_INIT: flags = (flag == DB_NEXT)?DB_FIRST:DB_LAST; break; case BDB_LOG_SET: flags = DB_SET; break; default: flags = flag; break; } init = BDB_LOG_NEXT; #if HAVE_ST_DB_ENV_LG_INFO if (!envst->envp->lg_info) { rb_raise(bdb_eFatal, "log region not open"); } ret = bdb_test_error(log_get(envst->envp->lg_info, lsnst->lsn, &data, flags)); #elif HAVE_ST_DB_ENV_LOG_CURSOR ret = bdb_test_error(lsnst->cursor->get(lsnst->cursor, lsnst->lsn, &data, flags)); lsn1 = bdb_makelsn(lsnst->env); Data_Get_Struct(lsn1, struct dblsnst, lsnst1); MEMCPY(lsnst1->lsn, lsnst->lsn, DB_LSN, 1); #else ret = bdb_test_error(log_get(envst->envp, lsnst->lsn, &data, flags)); lsn1 = lsn; #endif if (ret == DB_NOTFOUND) { return Qnil; } res = rb_tainted_str_new(data.data, data.size); free(data.data); rb_yield(rb_assoc_new(res, lsn)); } while (1); return Qnil; }
int32 rf_log_get(int32 last_count, int8 *data) { return log_get(rf_evt_log_handler, last_count, data); }