void plugin_init(void) { dbglog("pybackend plugin: plugin_init()"); Py_Initialize(); add_options(pybackend_options); // // Only support one type of auth for now. // chap_mdtype_all &= MDTYPE_MICROSOFT_V2; chap_check_hook = pybackend_chap_check; chap_verify_hook = pybackend_chap_verify; ip_choose_hook = pybackend_ip_choose; allowed_address_hook = pybackend_allowed_address; add_notifier(&ip_up_notifier, pybackend_notifier, "ip_up_notifier"); add_notifier(&ip_down_notifier, pybackend_notifier, "ip_down_notifier"); add_notifier(&auth_up_notifier, pybackend_notifier, "auth_up_notifier"); add_notifier(&link_down_notifier, pybackend_notifier, "link_down_notifier"); info("pybackend plugin: initialized"); }
int plugin_init (void) { GDBusConnection *bus; GError *error = NULL; const char *bus_name; nm_g_type_init (); g_return_val_if_fail (!gl.proxy, -1); bus_name = getenv ("NM_DBUS_SERVICE_L2TP"); if (!bus_name) bus_name = NM_DBUS_SERVICE_L2TP; gl.log_level = _nm_utils_ascii_str_to_int64 (getenv ("NM_VPN_LOG_LEVEL"), 10, 0, LOG_DEBUG, LOG_NOTICE); gl.log_prefix_token = getenv ("NM_VPN_LOG_PREFIX_TOKEN") ?: "???"; _LOGI ("initializing"); bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error); if (!bus) { _LOGE ("couldn't connect to system bus: %s", error->message); g_error_free (error); return -1; } gl.proxy = g_dbus_proxy_new_sync (bus, G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, NULL, bus_name, NM_DBUS_PATH_L2TP_PPP, NM_DBUS_INTERFACE_L2TP_PPP, NULL, &error); g_object_unref (bus); if (!gl.proxy) { _LOGE ("couldn't create D-Bus proxy: %s", error->message); g_error_free (error); return -1; } chap_passwd_hook = get_credentials; chap_check_hook = get_chap_check; pap_passwd_hook = get_credentials; pap_check_hook = get_pap_check; #ifdef USE_EAPTLS eaptls_passwd_hook = get_credentials; #endif add_notifier (&phasechange, nm_phasechange, NULL); add_notifier (&ip_up_notifier, nm_ip_up, NULL); add_notifier (&exitnotify, nm_exit_notify, NULL); return 0; }
void plugin_init(void) { add_options(options); add_notifier(&ip_up_notifier, ip_up, NULL); add_notifier(&ip_down_notifier, ip_down, NULL); if (debug) notice("pptpd-logwtmp: $Version$"); }
/* ----------------------------------------------------------------------------- plugin entry point, called by pppd ----------------------------------------------------------------------------- */ int start(CFBundleRef ref) { CFStringRef strref; CFURLRef urlref; bundle = ref; CFRetain(bundle); url = CFBundleCopyBundleURL(bundle); // hookup our handlers old_check_options = the_channel->check_options; the_channel->check_options = serial_check_options; old_connect = the_channel->connect; the_channel->connect = serial_connect; old_process_extra_options = the_channel->process_extra_options; the_channel->process_extra_options = serial_process_extra_options; add_notifier(&connect_fail_notify, serial_connect_notifier, 0); add_notifier(&lcp_lowerdown_notify, serial_lcpdown_notifier, 0); cancelstrref = CFBundleCopyLocalizedString(bundle, CFSTR("Cancel"), CFSTR("Cancel"), NULL); if (cancelstrref == 0) return 1; CFStringGetCString(cancelstrref, (char*)cancelstr, sizeof(cancelstr), kCFStringEncodingUTF8); icstrref = CFBundleCopyLocalizedString(bundle, CFSTR("Network Connection"), CFSTR("Network Connection"), NULL); if (icstrref == 0) return 1; CFStringGetCString(icstrref, (char*)icstr, sizeof(icstr), kCFStringEncodingUTF8); urlref = CFBundleCopyResourceURL(bundle, CFSTR("NetworkConnect.icns"), NULL, NULL); if (urlref == 0 || ((strref = CFURLGetString(urlref)) == 0)) { if (urlref) CFRelease(urlref); return 1; } CFStringGetCString(strref, (char*)iconstr, sizeof(iconstr), kCFStringEncodingUTF8); iconstrref = CFStringCreateCopy(NULL, strref); CFRelease(urlref); urlref = CFBundleCopyBuiltInPlugInsURL(bundle); if (urlref == 0 || ((CFURLGetFileSystemRepresentation(urlref, TRUE, pathccl, sizeof(pathccl))) == FALSE)) { if (urlref) CFRelease(urlref); return 1; } strlcat((char*)pathccl, SUFFIX_CCLENGINE, sizeof(pathccl)); CFRelease(urlref); // add the socket specific options add_options(serial_options); return 0; }
/********************************************************************** * %FUNCTION: plugin_init * %ARGUMENTS: * None * %RETURNS: * Nothing * %DESCRIPTION: * Initializes radattr plugin. ***********************************************************************/ void plugin_init(void) { radius_attributes_hook = print_attributes; add_notifier(&link_down_notifier, cleanup, NULL); /* Just in case... */ add_notifier(&exitnotify, cleanup, NULL); info("RADATTR plugin initialized."); }
int plugin_init (void) { GDBusConnection *bus; GError *err = NULL; const char *bus_name; #if !GLIB_CHECK_VERSION (2, 35, 0) g_type_init (); #endif bus_name = getenv ("NM_DBUS_SERVICE_SSTP"); if (!bus_name) bus_name = NM_DBUS_SERVICE_SSTP; g_message ("nm-sstp-ppp-plugin: (%s): initializing", __func__); bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &err); if (!bus) { g_warning ("nm-sstp-pppd-plugin: (%s): couldn't connect to system bus: (%d) %s", __func__, err ? err->code : -1, err && err->message ? err->message : "(unknown)"); g_error_free (err); return -1; } proxy = g_dbus_proxy_new_sync (bus, G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, NULL, bus_name, NM_DBUS_PATH_SSTP_PPP, NM_DBUS_INTERFACE_SSTP_PPP, NULL, &err); g_object_unref (bus); if (!proxy) { g_warning ("nm-sstp-pppd-plugin: (%s): couldn't create D-Bus proxy: %s", __func__, err->message); g_error_free (err); return -1; } chap_passwd_hook = get_credentials; chap_check_hook = get_chap_check; pap_passwd_hook = get_credentials; pap_check_hook = get_pap_check; snoop_send_hook = nm_snoop_send; add_notifier (&phasechange, nm_phasechange, NULL); add_notifier (&ip_up_notifier, nm_ip_up, NULL); add_notifier (&exitnotify, nm_exit_notify, proxy); return 0; }
int plugin_init() { add_options(ldap_options); pap_check_hook = ldap_pap_check; pap_auth_hook = ldap_pap_auth; chap_verify_hook = ldap_chap_verify; ip_choose_hook = ldap_ip_choose; allowed_address_hook = ldap_address_allowed; add_notifier(&ip_down_notifier, ldap_ip_down, NULL); add_notifier(&ip_up_notifier, ldap_ip_up, NULL); info("LDAP: plugin initialized."); }
void plugin_init(void) { #if !defined(__linux__) fatal("No PPPoL2TP support on this OS"); #endif add_options(pppol2tp_options); /* Hook up ip up/down notifiers to send indicator to openl2tpd * that the link is up */ add_notifier(&ip_up_notifier, pppol2tp_ip_up, NULL); add_notifier(&ip_down_notifier, pppol2tp_ip_down, NULL); add_notifier(&ipv6_up_notifier, pppol2tp_ip_up, NULL); add_notifier(&ipv6_down_notifier, pppol2tp_ip_down, NULL); }
int plugin_init(void) { #if 0 path_ipup[0] = '\0'; path_ipdown[0] = '\0'; #endif add_notifier(&phasechange, notifier_phasechange, NULL); add_notifier(&exitnotify, notifier_exit, NULL); add_notifier(&ip_up_notifier, notifier_ipup, NULL); add_notifier(&ip_down_notifier, notifier_ipdown, NULL); return 0; }
void plugin_init(void) { #if defined(__linux__) extern int new_style_driver; /* From sys-linux.c */ if (!ppp_available() && !new_style_driver) fatal("Kernel doesn't support ppp_generic - " "needed for Ippool"); #else fatal("No IP pool support on this OS"); #endif add_options(ippool_options); memset(&ippool_addr, 0, sizeof(ippool_addr)); /* * Store the previously assigned hooks: * this allows us to co-exist with radius module. */ old_allowed_address_hook = allowed_address_hook; old_ip_choose_hook = ip_choose_hook; old_ip_down_hook = ip_down_hook; allowed_address_hook = ippool_allowed_address; ip_choose_hook = ippool_choose_ip; ip_down_hook = ippool_release_ip; /* brute force, just in case ip_down_hook doesn't get called */ add_notifier(&exitnotify, ippool_cleanup, 0); }
/********************************************************************** * %FUNCTION: plugin_init * %ARGUMENTS: * None * %RETURNS: * Nothing * %DESCRIPTION: * Initializes radattr plugin. ***********************************************************************/ void plugin_init(void) { radius_attributes_hook = print_attributes; #if 0 /* calling cleanup() on link down is problematic because print_attributes() is called only after PAP or CHAP authentication, but not when the link should go up again for any other reason */ add_notifier(&link_down_notifier, cleanup, NULL); #endif /* Just in case... */ add_notifier(&exitnotify, cleanup, NULL); info("RADATTR plugin initialized."); }
/* ----------------------------------------------------------------------------- plugin entry point, called by pppd ----------------------------------------------------------------------------- */ int start(CFBundleRef ref) { bundle = ref; CFRetain(bundle); // hookup our socket handlers bzero(the_channel, sizeof(struct channel)); the_channel->options = pppoe_options; the_channel->process_extra_options = pppoe_process_extra_options; the_channel->wait_input = pppoe_wait_input; the_channel->check_options = pppoe_check_options; the_channel->connect = pppoe_connect; the_channel->disconnect = pppoe_disconnect; the_channel->cleanup = pppoe_cleanup; the_channel->close = pppoe_close; the_channel->establish_ppp = pppoe_establish_ppp; the_channel->disestablish_ppp = pppoe_disestablish_ppp; // use the default config functions the_channel->send_config = generic_send_config; the_channel->recv_config = generic_recv_config; add_notifier(&link_down_notifier, pppoe_link_down, 0); return 0; }
/* * acsp_check_options */ static void acscp_check_options(void) { if (acscp_protent.enabled_flag || acsp_use_dhcp || acsp_intercept_dhcp) add_notifier(&phasechange, acsp_init_plugins, 0); // to setup plugins if (acsp_intercept_dhcp) ip_src_address_filter |= NPAFMODE_DHCP_INTERCEPT_SERVER; if (acsp_use_dhcp) ip_src_address_filter |= NPAFMODE_DHCP_INTERCEPT_CLIENT; }
int plugin_init (void) { DBusGConnection *bus; GError *err = NULL; #if !GLIB_CHECK_VERSION (2, 35, 0) g_type_init (); #endif g_message ("nm-sstp-ppp-plugin: (%s): initializing", __func__); bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &err); if (!bus) { g_warning ("nm-sstp-pppd-plugin: (%s): couldn't connect to system bus: (%d) %s", __func__, err ? err->code : -1, err && err->message ? err->message : "(unknown)"); g_error_free (err); return -1; } proxy = dbus_g_proxy_new_for_name (bus, NM_DBUS_SERVICE_SSTP_PPP, NM_DBUS_PATH_SSTP_PPP, NM_DBUS_INTERFACE_SSTP_PPP); dbus_g_connection_unref (bus); chap_passwd_hook = get_credentials; chap_check_hook = get_chap_check; pap_passwd_hook = get_credentials; pap_check_hook = get_pap_check; snoop_send_hook = nm_snoop_send; add_notifier (&phasechange, nm_phasechange, NULL); add_notifier (&ip_up_notifier, nm_ip_up, NULL); add_notifier (&exitnotify, nm_exit_notify, proxy); return 0; }
/* allocate and initialize new builtin class */ class_t *new_builtin_class(class_t *super) { class_t *cl = mm_alloc(mt_class); add_notifier(cl, dbg_notify, NULL); class_init(cl); if (super) { cl->super = super; cl->atsuper = super->backptr; } assert(class_class); cl->backptr = new_at(class_class, cl); return cl; }
/* plugin initilization routine. */ void plugin_init(void) { /* show initialization information. */ info("Plugin %s: pppd-sql-%s initialized, compiled pppd-%s, linked mysql-%s\n", PLUGIN_NAME_MYSQL, PACKAGE_VERSION, pppd_version, PLUGIN_VERSION_MYSQL); /* add hook for chap authentication. */ chap_check_hook = pppd__chap_check; chap_verify_hook = pppd__chap_verify_mysql; /* add hook for pap authentication. */ pap_check_hook = pppd__pap_check; pap_auth_hook = pppd__pap_auth_mysql; /* plugin is aware of assigning ip addresses on IPCP negotiation. */ ip_choose_hook = pppd__ip_choose; allowed_address_hook = pppd__allowed_address; /* add ip notifiers. */ add_notifier(&ip_up_notifier, pppd__mysql_up, NULL); add_notifier(&ip_down_notifier, pppd__mysql_down, NULL); /* point extra options to our array. */ add_options(options); }
storage_t *new_storage_mmap(storage_type_t t, FILE *f, size_t offs, bool ro) { storage_t *st = mm_allocv(mt_storage, sizeof(storage_t)); errno = 0; #if HAVE_FSEEKO if (fseeko(f,(off_t)0,SEEK_END)==-1) test_file_error(NULL, errno); #else if (fseek(f,0,SEEK_END)==-1) test_file_error(NULL, errno); #endif #if HAVE_FTELLO size_t len = (size_t)ftello(f); #else size_t len = (size_t)ftell(f); #endif rewind(f); if (t==ST_MPTR || t==ST_GPTR) RAISEF("cannot mmap a pointer storage", st->backptr); if (t==ST_AT) RAISEF("cannot mmap an atom-storage", st->backptr); #ifdef UNIX errno = 0; gptr addr = mmap(0,len,(ro ? PROT_READ : PROT_WRITE),MAP_SHARED,fileno(f),0); if (addr == (void*)-1L) test_file_error(NULL, errno); #endif #ifdef WIN32 gptr xtra, addr; if (! (xtra = (gptr)CreateFileMapping((HANDLE)(_get_osfhandle(fd)), NULL, PAGE_READONLY, 0, len, NULL))) RAISEF("cannot create file mapping",NIL); if (! (addr = (gptr)MapViewOfFile((HANDLE)(xtra), FILE_MAP_READ, 0, 0, size + pos))) RAISEF("cannot create view on mapped file",NIL); st->mmap_xtra = xtra; #endif st->type = t; st->kind = STS_MMAP; st->isreadonly = ro; st->mmap_len = len; st->mmap_addr = addr; st->size = (len - offs) / storage_sizeof[st->type]; st->data = (char *)(st->mmap_addr)+offs; st->backptr = new_at(storage_class[st->type], st); add_notifier(st, (wr_notify_func_t *)storage_notify, NULL); return st; }
static void *timer_add_sub(at *handler, int sec, int msec, int period) { if (handler) { add_notifier(handler, (wr_notify_func_t *)ti_notify, 0); event_timer_t *et = mm_alloc(mt_event_timer); assert(et); et->date.sec = sec; et->date.msec = msec; et->period.sec = period/1000; et->period.msec = period%1000; et->handler = handler; et->next = 0; ti_insert(et); return et; } return 0; }
void ev_add(at *handler, at *event, const char *desc, int mods) { MM_ENTER; if (handler && event) { at *d = NIL; if (mods == (unsigned char)mods) d = NEW_NUMBER(mods); if (desc && d) { gptr p = (gptr)desc; d = new_cons(NEW_GPTR(p), d); } else if (desc) { gptr p = (gptr)desc; d = NEW_GPTR(p); } at *p = new_cons(NEW_GPTR(handler), new_cons(d, event)); add_notifier(handler, (wr_notify_func_t *)ev_notify, 0); Cdr(tail) = new_cons(p,NIL); tail = Cdr(tail); } MM_EXIT; }
string pipe_link_rep::start () { #ifndef OS_MINGW if (alive) return "busy"; if (DEBUG_AUTO) debug_io << "Launching '" << cmd << "'\n"; int e1= pipe (pp_in ); (void) e1; int e2= pipe (pp_out); (void) e2; int e3= pipe (pp_err); (void) e3; pid= fork (); if (pid==0) { // the child setsid(); close (pp_in [OUT]); close (pp_out [IN ]); close (pp_err [IN ]); dup2 (pp_in [IN ], STDIN ); close (pp_in [IN ]); dup2 (pp_out [OUT], STDOUT); close (pp_out [OUT]); dup2 (pp_err [OUT], STDERR); close (pp_err [OUT]); execute_shell (cmd); exit (127); // exit (system (cmd) != 0); } else { // the main process in = pp_in [OUT]; close (pp_in [IN]); out= pp_out [IN ]; close (pp_out [OUT]); err= pp_err [IN ]; close (pp_err [OUT]); alive= true; snout = socket_notifier (out, &pipe_callback, this, NULL); snerr = socket_notifier (err, &pipe_callback, this, NULL); add_notifier (snout); add_notifier (snerr); if (/* !banner */ true) return "ok"; else { int r; char outbuf[1024]; r= ::read (out, outbuf, 1024); if (r == 1 && outbuf[0] == TERMCHAR) return "ok"; alive= false; if (-1 != killpg(pid,SIGTERM)) { sleep(2); killpg(pid,SIGKILL); } wait (NULL); if (r == -1) return "Error: the application does not reply"; else return "Error: the application did not send its usual startup banner"; } } #else return "Error: pipes not implemented"; #endif }
void running_machine::start() { // initialize basic can't-fail systems here config_init(*this); m_input = auto_alloc(*this, input_manager(*this)); output_init(*this); palette_init(*this); m_render = auto_alloc(*this, render_manager(*this)); generic_machine_init(*this); // allocate a soft_reset timer m_soft_reset_timer = m_scheduler.timer_alloc(timer_expired_delegate(FUNC(running_machine::soft_reset), this)); // init the osd layer m_osd.init(*this); // create the video manager m_video = auto_alloc(*this, video_manager(*this)); ui_init(*this); // initialize the base time (needed for doing record/playback) ::time(&m_base_time); // initialize the input system and input ports for the game // this must be done before memory_init in order to allow specifying // callbacks based on input port tags time_t newbase = m_ioport.initialize(); if (newbase != 0) m_base_time = newbase; // intialize UI input ui_input_init(*this); // initialize the streams engine before the sound devices start m_sound = auto_alloc(*this, sound_manager(*this)); // first load ROMs, then populate memory, and finally initialize CPUs // these operations must proceed in this order rom_init(*this); m_memory.initialize(); // initialize the watchdog m_watchdog_timer = m_scheduler.timer_alloc(timer_expired_delegate(FUNC(running_machine::watchdog_fired), this)); if (config().m_watchdog_vblank_count != 0 && primary_screen != NULL) primary_screen->register_vblank_callback(vblank_state_delegate(FUNC(running_machine::watchdog_vblank), this)); save().save_item(NAME(m_watchdog_enabled)); save().save_item(NAME(m_watchdog_counter)); // allocate the gfx elements prior to device initialization gfx_init(*this); // initialize image devices image_init(*this); m_tilemap = auto_alloc(*this, tilemap_manager(*this)); crosshair_init(*this); network_init(*this); // initialize the debugger if ((debug_flags & DEBUG_FLAG_ENABLED) != 0) debugger_init(*this); // call the game driver's init function // this is where decryption is done and memory maps are altered // so this location in the init order is important ui_set_startup_text(*this, "Initializing...", true); // register callbacks for the devices, then start them add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(running_machine::reset_all_devices), this)); add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(running_machine::stop_all_devices), this)); save().register_presave(save_prepost_delegate(FUNC(running_machine::presave_all_devices), this)); start_all_devices(); save().register_postload(save_prepost_delegate(FUNC(running_machine::postload_all_devices), this)); // if we're coming in with a savegame request, process it now const char *savegame = options().state(); if (savegame[0] != 0) schedule_load(savegame); // if we're in autosave mode, schedule a load else if (options().autosave() && (m_system.flags & GAME_SUPPORTS_SAVE) != 0) schedule_load("auto"); // set up the cheat engine m_cheat = auto_alloc(*this, cheat_manager(*this)); // allocate autoboot timer m_autoboot_timer = scheduler().timer_alloc(timer_expired_delegate(FUNC(running_machine::autoboot_callback), this)); // initialize lua m_lua_engine.initialize(); // disallow save state registrations starting here m_save.allow_registration(false); }