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.26 by pcg, Sun Jul 25 18:11:54 2004 UTC vs.
Revision 1.27 by pcg, Tue Mar 1 06:27:20 2005 UTC

265 reconnect_all (); 265 reconnect_all ();
266 266
267 return 0; 267 return 0;
268} 268}
269 269
270// send a vpn packet out to other hosts
271bool
272vpn::send_vpn_packet (vpn_packet *pkt, const sockinfo &si, int tos)
273{
274 switch (si.prot)
275 {
276 case PROT_IPv4:
277 return send_ipv4_packet (pkt, si, tos);
278
279 case PROT_UDPv4:
280 return send_udpv4_packet (pkt, si, tos);
281
282#if ENABLE_TCP
283 case PROT_TCPv4:
284 return send_tcpv4_packet (pkt, si, tos);
285#endif
286
287#if ENABLE_ICMP
288 case PROT_ICMPv4:
289 return send_icmpv4_packet (pkt, si, tos);
290#endif
291
292#if ENABLE_DNS
293 case PROT_DNSv4:
294 return send_dnsv4_packet (pkt, si, tos);
295#endif
296
297 default:
298 slog (L_CRIT, _("%s: FATAL: trying to send packet with unsupported protocol"), (const char *)si);
299 return false;
300 }
301}
302
303bool 270bool
304vpn::send_ipv4_packet (vpn_packet *pkt, const sockinfo &si, int tos) 271vpn::send_ipv4_packet (vpn_packet *pkt, const sockinfo &si, int tos)
305{ 272{
306#if defined(SOL_IP) && defined(IP_TOS) 273#if defined(SOL_IP) && defined(IP_TOS)
307 setsockopt (ipv4_fd, SOL_IP, IP_TOS, &tos, sizeof tos); 274 setsockopt (ipv4_fd, SOL_IP, IP_TOS, &tos, sizeof tos);
639 connection_init (); 606 connection_init ();
640 607
641 for (configuration::node_vector::iterator i = conf.nodes.begin (); 608 for (configuration::node_vector::iterator i = conf.nodes.begin ();
642 i != conf.nodes.end (); ++i) 609 i != conf.nodes.end (); ++i)
643 { 610 {
644 connection *conn = new connection (this); 611 connection *conn = new connection (this, *i);
645
646 conn->conf = *i;
647 conns.push_back (conn); 612 conns.push_back (conn);
648
649 conn->establish_connection (); 613 conn->establish_connection ();
650 } 614 }
651} 615}
652 616
653connection *vpn::find_router () 617connection *vpn::find_router ()

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines