ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/vpn.C
(Generate patch)

Comparing gvpe/src/vpn.C (file contents):
Revision 1.38 by pcg, Tue Apr 26 00:55:56 2005 UTC vs.
Revision 1.39 by pcg, Sat Nov 10 05:14:22 2007 UTC

128 { 128 {
129 slog (L_ERR, _("can't bind ipv4 socket on %s: %s"), (const char *)si, strerror (errno)); 129 slog (L_ERR, _("can't bind ipv4 socket on %s: %s"), (const char *)si, strerror (errno));
130 exit (EXIT_FAILURE); 130 exit (EXIT_FAILURE);
131 } 131 }
132 132
133 ipv4_ev_watcher.start (ipv4_fd, EVENT_READ); 133 ipv4_ev_watcher.start (ipv4_fd, EV_READ);
134 } 134 }
135 135
136 udpv4_fd = -1; 136 udpv4_fd = -1;
137 137
138 if (THISNODE->protocols & PROT_UDPv4 && THISNODE->udp_port) 138 if (THISNODE->protocols & PROT_UDPv4 && THISNODE->udp_port)
167 { 167 {
168 slog (L_ERR, _("can't bind udpv4 on %s: %s"), (const char *)si, strerror (errno)); 168 slog (L_ERR, _("can't bind udpv4 on %s: %s"), (const char *)si, strerror (errno));
169 exit (EXIT_FAILURE); 169 exit (EXIT_FAILURE);
170 } 170 }
171 171
172 udpv4_ev_watcher.start (udpv4_fd, EVENT_READ); 172 udpv4_ev_watcher.start (udpv4_fd, EV_READ);
173 } 173 }
174 174
175 icmpv4_fd = -1; 175 icmpv4_fd = -1;
176 176
177#if ENABLE_ICMP 177#if ENABLE_ICMP
212 { 212 {
213 slog (L_ERR, _("can't bind icmpv4 on %s: %s"), (const char *)si, strerror (errno)); 213 slog (L_ERR, _("can't bind icmpv4 on %s: %s"), (const char *)si, strerror (errno));
214 exit (EXIT_FAILURE); 214 exit (EXIT_FAILURE);
215 } 215 }
216 216
217 icmpv4_ev_watcher.start (icmpv4_fd, EVENT_READ); 217 icmpv4_ev_watcher.start (icmpv4_fd, EV_READ);
218 } 218 }
219#endif 219#endif
220 220
221 tcpv4_fd = -1; 221 tcpv4_fd = -1;
222 222
249 { 249 {
250 slog (L_ERR, _("can't listen tcpv4 on %s: %s"), (const char *)si, strerror (errno)); 250 slog (L_ERR, _("can't listen tcpv4 on %s: %s"), (const char *)si, strerror (errno));
251 exit (EXIT_FAILURE); 251 exit (EXIT_FAILURE);
252 } 252 }
253 253
254 tcpv4_ev_watcher.start (tcpv4_fd, EVENT_READ); 254 tcpv4_ev_watcher.start (tcpv4_fd, EV_READ);
255 } 255 }
256#endif 256#endif
257 257
258#if ENABLE_DNS 258#if ENABLE_DNS
259 if (THISNODE->protocols & PROT_DNSv4) 259 if (THISNODE->protocols & PROT_DNSv4)
292 { 292 {
293 slog (L_ERR, _("can't bind dnsv4 on %s: %s"), (const char *)si, strerror (errno)); 293 slog (L_ERR, _("can't bind dnsv4 on %s: %s"), (const char *)si, strerror (errno));
294 exit (EXIT_FAILURE); 294 exit (EXIT_FAILURE);
295 } 295 }
296 296
297 dnsv4_ev_watcher.start (dnsv4_fd, EVENT_READ); 297 dnsv4_ev_watcher.start (dnsv4_fd, EV_READ);
298 } 298 }
299#endif 299#endif
300 300
301 ///////////////////////////////////////////////////////////////////////////// 301 /////////////////////////////////////////////////////////////////////////////
302 302
325 { 325 {
326 slog (L_ERR, _("if-up command execution failed, exiting.")); 326 slog (L_ERR, _("if-up command execution failed, exiting."));
327 exit (EXIT_FAILURE); 327 exit (EXIT_FAILURE);
328 } 328 }
329 329
330 tap_ev_watcher.start (tap->fd, EVENT_READ); 330 tap_ev_watcher.start (tap->fd, EV_READ);
331 331
332 return 0; 332 return 0;
333} 333}
334 334
335bool 335bool
486 486
487 return false; 487 return false;
488} 488}
489 489
490void 490void
491vpn::ipv4_ev (io_watcher &w, short revents) 491vpn::ipv4_ev (ev::io &w, int revents)
492{ 492{
493 if (revents & EVENT_READ) 493 if (revents & EV_READ)
494 { 494 {
495 vpn_packet *pkt = new vpn_packet; 495 vpn_packet *pkt = new vpn_packet;
496 struct sockaddr_in sa; 496 struct sockaddr_in sa;
497 socklen_t sa_len = sizeof (sa); 497 socklen_t sa_len = sizeof (sa);
498 int len; 498 int len;
527 } 527 }
528} 528}
529 529
530#if ENABLE_ICMP 530#if ENABLE_ICMP
531void 531void
532vpn::icmpv4_ev (io_watcher &w, short revents) 532vpn::icmpv4_ev (ev::io &w, int revents)
533{ 533{
534 if (revents & EVENT_READ) 534 if (revents & EV_READ)
535 { 535 {
536 vpn_packet *pkt = new vpn_packet; 536 vpn_packet *pkt = new vpn_packet;
537 struct sockaddr_in sa; 537 struct sockaddr_in sa;
538 socklen_t sa_len = sizeof (sa); 538 socklen_t sa_len = sizeof (sa);
539 int len; 539 int len;
575 } 575 }
576} 576}
577#endif 577#endif
578 578
579void 579void
580vpn::udpv4_ev (io_watcher &w, short revents) 580vpn::udpv4_ev (ev::io &w, int revents)
581{ 581{
582 if (revents & EVENT_READ) 582 if (revents & EV_READ)
583 { 583 {
584 vpn_packet *pkt = new vpn_packet; 584 vpn_packet *pkt = new vpn_packet;
585 struct sockaddr_in sa; 585 struct sockaddr_in sa;
586 socklen_t sa_len = sizeof (sa); 586 socklen_t sa_len = sizeof (sa);
587 int len; 587 int len;
612 exit (EXIT_FAILURE); 612 exit (EXIT_FAILURE);
613 } 613 }
614} 614}
615 615
616void 616void
617vpn::tap_ev (io_watcher &w, short revents) 617vpn::tap_ev (ev::io &w, int revents)
618{ 618{
619 if (revents & EVENT_READ) 619 if (revents & EV_READ)
620 { 620 {
621 /* process data */ 621 /* process data */
622 tap_packet *pkt; 622 tap_packet *pkt;
623 623
624 pkt = tap->recv (); 624 pkt = tap->recv ();
654 else 654 else
655 abort (); 655 abort ();
656} 656}
657 657
658void 658void
659vpn::event_cb (time_watcher &w) 659vpn::event_cb (ev::timer &w, int)
660{ 660{
661 if (events) 661 if (events)
662 { 662 {
663 if (events & EVENT_SHUTDOWN) 663 if (events & EVENT_SHUTDOWN)
664 { 664 {
755} 755}
756 756
757void 757void
758vpn::dump_status () 758vpn::dump_status ()
759{ 759{
760 slog (L_NOTICE, _("BEGIN status dump (%ld)"), (long)NOW); 760 slog (L_NOTICE, _("BEGIN status dump (%ld)"), (long)ev::ev_now ());
761 761
762 for (conns_vector::iterator c = conns.begin (); c != conns.end (); ++c) 762 for (conns_vector::iterator c = conns.begin (); c != conns.end (); ++c)
763 (*c)->dump_status (); 763 (*c)->dump_status ();
764 764
765 slog (L_NOTICE, _("END status dump")); 765 slog (L_NOTICE, _("END status dump"));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines