int main(int argc, char **argv) { int ret; settings_init(); if (set_signal_handler(signals) == -1) { return -1; } tc_time_init(); if (read_args(argc, argv) == -1) { return -1; } if (srv_settings.log_path == NULL) { srv_settings.log_path = "error_intercept.log"; } if (tc_log_init(srv_settings.log_path) == -1) { return -1; } ret = tc_event_loop_init(&s_event_loop, MAX_FD_NUM); if (ret == TC_EVENT_ERROR) { tc_log_info(LOG_ERR, 0, "event loop init failed"); return -1; } /* output debug info */ output_for_debug(); if (set_details() == -1) { return -1; } if (interception_init(&s_event_loop, srv_settings.binded_ip, srv_settings.port) == TC_ERROR) { return -1; } if (set_timer() == -1) { return -1; } #if (INTERCEPT_COMBINED) tc_event_timer_add(&s_event_loop, CHECK_INTERVAL, interception_push); #endif tc_event_timer_add(&s_event_loop, OUTPUT_INTERVAL, interception_output_stat); /* run now */ tc_event_process_cycle(&s_event_loop); server_release_resources(); return 0; }
/* * Main entry point */ int main(int argc ,char **argv) { int ret; /* first, init time */ tc_time_update(); /* Set defaults */ settings_init(); read_args(argc, argv); /* Init log for outputing debug info */ log_init(clt_settings.log_path); /* Output debug info */ output_for_debug(argc, argv); /* Set details for running */ set_details(); ret = tc_event_loop_init(&event_loop, MAX_FD_NUM); if (ret == TC_EVENT_ERROR) { log_info(LOG_ERR, "event loop init failed"); return -1; } /* Initiate tcpcopy client*/ ret = tcp_copy_init(&event_loop); if (SUCCESS != ret) { exit(EXIT_FAILURE); } /* Run now */ tc_event_process_cycle(&event_loop); return 0; }
/* * main entry point */ int main(int argc, char **argv) { int ret; settings_init(); tc_time_init(); if (read_args(argc, argv) == -1) { return -1; } if (clt_settings.log_path == NULL) { clt_settings.log_path = "error_tcpcopy.log"; } if (tc_log_init(clt_settings.log_path) == -1) { return -1; } /* output debug info */ output_for_debug(argc, argv); /* set details for running */ if (set_details() == -1) { return -1; } ret = tc_event_loop_init(&event_loop, MAX_FD_NUM); if (ret == TC_EVENT_ERROR) { tc_log_info(LOG_ERR, 0, "event loop init failed"); return -1; } ret = tcp_copy_init(&event_loop); if (ret == TC_ERROR) { exit(EXIT_FAILURE); } /* run now */ tc_event_process_cycle(&event_loop); tcp_copy_release_resources(); return 0; }
int main(int argc, char **argv) { int ret; settings_init(); tc_time_init(); if (read_args(argc, argv) == -1) { return -1; } if (tc_log_init(srv_settings.log_path) == -1) { return -1; } ret = tc_event_loop_init(&s_event_loop, MAX_FD_NUM); if (ret == TC_EVENT_ERROR) { tc_log_info(LOG_ERR, 0, "event loop init failed"); return -1; } /* output debug info */ output_for_debug(); if (set_details() == -1) { return -1; } if (interception_init(&s_event_loop, srv_settings.binded_ip, srv_settings.port) == TC_ERROR) { return -1; } /* run now */ tc_event_process_cycle(&s_event_loop); return 0; }
/* * main entry point */ int main(int argc, char **argv) { int ret; settings_init(); #if (TCPCOPY_SIGACTION) if (set_signal_handler(signals) == -1) { return -1; } #else signal(SIGALRM, tc_time_sig_alarm); signal(SIGINT, tcp_copy_over); signal(SIGPIPE, tcp_copy_over); signal(SIGHUP, tcp_copy_over); signal(SIGTERM, tcp_copy_over); #endif tc_time_init(); if (read_args(argc, argv) == -1) { return -1; } if (clt_settings.log_path == NULL) { clt_settings.log_path = "error_tcpcopy.log"; } if (tc_log_init(clt_settings.log_path) == -1) { return -1; } /* output debug info */ output_for_debug(argc, argv); /* set details for running */ if (set_details() == -1) { return -1; } #if (TCPCOPY_MYSQL_ADVANCED) tc_init_digests(); if (!tc_init_sha1()) { return -1; } #endif ret = tc_event_loop_init(&event_loop, MAX_FD_NUM); if (ret == TC_EVENT_ERROR) { tc_log_info(LOG_ERR, 0, "event loop init failed"); return -1; } ret = tcp_copy_init(&event_loop); if (ret == TC_ERROR) { exit(EXIT_FAILURE); } if (set_timer() == -1) { return -1; } /* run now */ tc_event_process_cycle(&event_loop); tcp_copy_release_resources(); return 0; }
/* * main entry point */ int main(int argc, char **argv) { int ret, is_continue = 1; settings_init(); #if (GRYPHON_SIGACTION) if (set_signal_handler(signals) == -1) { return -1; } #else signal(SIGALRM, tc_time_sig_alarm); signal(SIGINT, gryphon_over); signal(SIGPIPE, gryphon_over); signal(SIGHUP, gryphon_over); signal(SIGTERM, gryphon_over); #endif tc_time_init(); if (read_args(argc, argv) == -1) { return -1; } if (clt_settings.log_path == NULL) { clt_settings.log_path = "error_gryphon.log"; } if (tc_log_init(clt_settings.log_path) == -1) { return -1; } /* output debug info */ output_for_debug(argc, argv); /* set details for running */ if (set_details() == -1) { return -1; } if (set_timer() == -1) { return -1; } ret = tc_event_loop_init(&event_loop, MAX_FD_NUM); if (ret == TC_EVENT_ERROR) { tc_log_info(LOG_ERR, 0, "event loop init failed"); is_continue = 0; } if (is_continue) { ret = tc_build_session_table(65536); if (ret == TC_ERROR) { is_continue = 0; } else { ret = gryphon_init(&event_loop); if (ret == TC_ERROR) { is_continue = 0; } else { if (!tc_build_users(clt_settings.client_mode, clt_settings.users, clt_settings.valid_ips, clt_settings.valid_ip_num)) { is_continue = 0; } } } } if (is_continue) { if (set_timer() == -1) { is_continue = 0; } } if (is_continue) { /* run now */ tc_event_process_cycle(&event_loop); } gryphon_release_resources(); return 0; }