--- gvpe/src/vpn.C 2007/12/02 00:54:52 1.42 +++ gvpe/src/vpn.C 2007/12/06 00:35:29 1.45 @@ -89,14 +89,16 @@ } } -const char *vpn::script_if_init () +inline const char * +vpn::script_if_init () { script_init_env (); return tap->if_up (); } -const char *vpn::script_if_up () +inline const char * +vpn::script_if_up () { script_init_env (); @@ -331,15 +333,19 @@ fcntl (tap->fd, F_SETFD, FD_CLOEXEC); + run_script_cb cb; + cb.set (this); + if (tap->if_up () && - !run_script (run_script_cb (this, &vpn::script_if_init), true)) + !run_script (cb, true)) { slog (L_ERR, _("interface initialization command '%s' failed, exiting."), tap->if_up ()); exit (EXIT_FAILURE); } - if (!run_script (run_script_cb (this, &vpn::script_if_up), true)) + cb.set (this); + if (!run_script (cb, true)) { slog (L_ERR, _("if-up command execution failed, exiting.")); exit (EXIT_FAILURE); @@ -499,7 +505,7 @@ return false; } -void +inline void vpn::ipv4_ev (ev::io &w, int revents) { if (revents & EV_READ) @@ -540,7 +546,7 @@ } #if ENABLE_ICMP -void +inline void vpn::icmpv4_ev (ev::io &w, int revents) { if (revents & EV_READ) @@ -588,7 +594,7 @@ } #endif -void +inline void vpn::udpv4_ev (ev::io &w, int revents) { if (revents & EV_READ) @@ -625,7 +631,7 @@ } } -void +inline void vpn::tap_ev (ev::io &w, int revents) { if (revents & EV_READ) @@ -667,7 +673,7 @@ abort (); } -void +inline void vpn::event_cb (ev::timer &w, int) { if (events) @@ -778,20 +784,20 @@ } vpn::vpn (void) -: event (this, &vpn::event_cb) -, udpv4_ev_watcher (this, &vpn::udpv4_ev) -, ipv4_ev_watcher (this, &vpn::ipv4_ev) +{ + event .set (this); + udpv4_ev_watcher .set (this); + ipv4_ev_watcher .set (this); #if ENABLE_TCP -, tcpv4_ev_watcher (this, &vpn::tcpv4_ev) + tcpv4_ev_watcher .set (this); #endif #if ENABLE_ICMP -, icmpv4_ev_watcher(this, &vpn::icmpv4_ev) + icmpv4_ev_watcher.set (this); #endif #if ENABLE_DNS -, dnsv4_ev_watcher (this, &vpn::dnsv4_ev) + dnsv4_ev_watcher .set (this); #endif -, tap_ev_watcher (this, &vpn::tap_ev) -{ + tap_ev_watcher .set (this); } vpn::~vpn ()