/* Daemon init sequence */ static void start_check(void) { /* Initialize sub-system */ ipvs_start(); init_checkers_queue(); #ifdef _WITH_VRRP_ init_interface_queue(); kernel_netlink_init(); #endif /* Parse configuration file */ data = alloc_global_data(); check_data = alloc_check_data(); init_data(conf_file, check_init_keywords); if (!check_data) { stop_check(); return; } /* Post initializations */ log_message(LOG_INFO, "Configuration is using : %lu Bytes", mem_allocated); /* SSL load static data & initialize common ctx context */ if (!init_ssl_ctx()) { stop_check(); return; } /* Processing differential configuration parsing */ if (reload){ clear_diff_services(); clear_diff_zones(); } /* Initialize ZONE topology */ if (!init_zones()) { stop_check(); return; } /* Initialize IPVS topology */ if (!init_services()) { stop_check(); return; } /* Dump configuration */ if (debug & 4) { dump_global_data(data); dump_check_data(check_data); } #ifdef _WITH_VRRP_ /* Initialize linkbeat */ init_interface_linkbeat(); #endif /* Register checkers thread */ register_checkers_thread(); }
int main(int argc, char** argv) { pgcolor color; struct pgmodeinfo mi; int i; pghandle ttl_box; /* init PicoGUI client */ pgInit(argc,argv); pgRegisterApp(PG_APP_NORMAL, argv[0], 0); /* create the title */ ttl_box = pgNewWidget(PG_WIDGET_BOX,0,0); ttl_text = pgNewWidget(PG_WIDGET_LABEL, PG_DERIVE_INSIDE, ttl_box); pgSetWidget (PGDEFAULT, PG_WP_TEXT, pgNewString("wclock"), 0); pgNewWidget(PG_WIDGET_BUTTON, PG_DERIVE_INSIDE, ttl_box); pgSetWidget (PGDEFAULT, PG_WP_SIDE, PG_S_RIGHT, PG_WP_TEXT, pgNewString("?"), PG_WP_EXTDEVENTS, PG_EXEV_PNTR_DOWN, 0); pgBind (PGDEFAULT, PG_WE_PNTR_DOWN, &btn_handler, (void*)btnid_set); pgNewWidget(PG_WIDGET_BUTTON, PG_DERIVE_INSIDE, ttl_box); pgSetWidget (PGDEFAULT, PG_WP_SIDE, PG_S_LEFT, PG_WP_TEXT, pgNewString(">"), PG_WP_EXTDEVENTS, PG_EXEV_PNTR_DOWN, 0); pgBind (PGDEFAULT, PG_WE_PNTR_DOWN, &btn_handler, (void*)btnid_right); pgNewWidget(PG_WIDGET_BUTTON, PG_DERIVE_INSIDE, ttl_box); pgSetWidget (PGDEFAULT, PG_WP_SIDE, PG_S_LEFT, PG_WP_TEXT, pgNewString("<"), PG_WP_EXTDEVENTS, PG_EXEV_PNTR_DOWN, 0); pgBind (PGDEFAULT, PG_WE_PNTR_DOWN, &btn_handler, (void*)btnid_left); /* create the main context */ main_window = pgNewWidget(PG_WIDGET_CANVAS, PG_DERIVE_AFTER, ttl_box); pgBind(PGDEFAULT, PGBIND_ANY, &canvas_handler, NULL); /* init time zones */ init_zones(); /* activate mouse move, keyboard and focus events */ pgSetWidget(main_window, PG_WP_TRIGGERMASK, pgGetWidget(main_window, PG_WP_TRIGGERMASK) | PG_TRIGGER_MOVE | PG_TRIGGER_CHAR | PG_TRIGGER_KEYDOWN | PG_TRIGGER_KEYUP /* | PG_TRIGGER_ACTIVATE | PG_TRIGGER_DEACTIVATE */, 0); mi = *pgGetVideoMode(); width = mi.lxres; height = mi.lyres; /* Make a backbuffer bitmap */ world_bitmap = create_world_bitmap(); width = get_world_width(); height = get_world_height(); /* Set the clipping rectangle */ pgWriteCmd(main_window, PGCANVAS_GROP, 5, PG_GROP_SETCLIP, 0, 0, width, height + TIMEBAR_HEIGHT); /* Set to be always rendered */ pgWriteCmd(main_window, PGCANVAS_GROPFLAGS, 1, PG_GROPF_UNIVERSAL); /* Create contexts for the canvas itself and the back-buffer */ gfx_context = pgNewCanvasContext(main_window, PGFX_IMMEDIATE ); /* run all */ DPRINTF(">>> entering loop\n"); pgEventLoop(); return 0; }