[Xorp-cvs] SF.net SVN: xorp:[11660] trunk/xorp
bms_fbsd at users.sourceforge.net
bms_fbsd at users.sourceforge.net
Thu Dec 3 13:56:34 PST 2009
Revision: 11660
http://xorp.svn.sourceforge.net/xorp/?rev=11660&view=rev
Author: bms_fbsd
Date: 2009-12-03 21:56:33 +0000 (Thu, 03 Dec 2009)
Log Message:
-----------
De-orbit burn Windows support.
This has been scheduled for around 3 months, and no
3rd party maintainer has stepped forward.
Discussed on: xorp-hackers, xorp-users
Modified Paths:
--------------
trunk/xorp/bgp/crash_dump.cc
trunk/xorp/bgp/harness/peer.cc
trunk/xorp/bgp/iptuple.cc
trunk/xorp/bgp/peer.cc
trunk/xorp/bgp/socket.cc
trunk/xorp/bgp/tests/test_cache.cc
trunk/xorp/bgp/tests/test_decision.cc
trunk/xorp/bgp/tests/test_deletion.cc
trunk/xorp/bgp/tests/test_dump.cc
trunk/xorp/bgp/tests/test_fanout.cc
trunk/xorp/bgp/tests/test_filter.cc
trunk/xorp/bgp/tests/test_main.cc
trunk/xorp/bgp/tests/test_nhlookup.cc
trunk/xorp/bgp/tests/test_plumbing.cc
trunk/xorp/bgp/tests/test_policy.cc
trunk/xorp/bgp/tests/test_ribin.cc
trunk/xorp/bgp/tests/test_ribout.cc
trunk/xorp/cli/cli_client.cc
trunk/xorp/cli/cli_node_net.cc
trunk/xorp/fea/data_plane/control_socket/SConscript
trunk/xorp/fea/data_plane/control_socket/click_socket.cc
trunk/xorp/fea/data_plane/control_socket/routing_socket_utilities.cc
trunk/xorp/fea/data_plane/fibconfig/SConscript
trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_parse_routing_socket.cc
trunk/xorp/fea/data_plane/fibconfig/fibconfig_table_parse_routing_socket.cc
trunk/xorp/fea/data_plane/ifconfig/SConscript
trunk/xorp/fea/data_plane/ifconfig/ifconfig_parse_ioctl.cc
trunk/xorp/fea/data_plane/ifconfig/ifconfig_set_click.cc
trunk/xorp/fea/data_plane/io/io_ip_socket.cc
trunk/xorp/fea/data_plane/io/io_ip_socket.hh
trunk/xorp/fea/data_plane/io/io_tcpudp_socket.cc
trunk/xorp/fea/data_plane/io/io_tcpudp_socket.hh
trunk/xorp/fea/data_plane/managers/SConscript
trunk/xorp/fea/fea_node.cc
trunk/xorp/fea/mfea_mrouter.cc
trunk/xorp/libcomm/comm_sock.c
trunk/xorp/libcomm/comm_user.c
trunk/xorp/libcomm/tests/test_connect.cc
trunk/xorp/libxipc/sockutil.cc
trunk/xorp/libxipc/tests/test_finder_events.cc
trunk/xorp/libxipc/tests/test_stcp.cc
trunk/xorp/libxipc/xrl_atom.cc
trunk/xorp/libxipc/xrl_pf_inproc.cc
trunk/xorp/libxipc/xrl_pf_kill.cc
trunk/xorp/libxipc/xrl_pf_sudp.cc
trunk/xorp/libxipc/xrl_pf_unix.cc
trunk/xorp/libxipc/xrl_std_router.cc
trunk/xorp/libxorp/SConscript
trunk/xorp/libxorp/asyncio.cc
trunk/xorp/libxorp/asyncio.hh
trunk/xorp/libxorp/buffered_asyncio.cc
trunk/xorp/libxorp/c_format.cc
trunk/xorp/libxorp/clock.cc
trunk/xorp/libxorp/daemon.c
trunk/xorp/libxorp/eventloop.cc
trunk/xorp/libxorp/eventloop.hh
trunk/xorp/libxorp/inet_ntop.c
trunk/xorp/libxorp/inet_pton.c
trunk/xorp/libxorp/popen.cc
trunk/xorp/libxorp/popen.hh
trunk/xorp/libxorp/random.c
trunk/xorp/libxorp/run_command.cc
trunk/xorp/libxorp/run_command.hh
trunk/xorp/libxorp/selector.cc
trunk/xorp/libxorp/selector.hh
trunk/xorp/libxorp/strptime.c
trunk/xorp/libxorp/tests/test_asyncio.cc
trunk/xorp/libxorp/tests/test_observers.cc
trunk/xorp/libxorp/tests/test_run_command.cc
trunk/xorp/libxorp/tests/test_utils.cc
trunk/xorp/libxorp/timer.cc
trunk/xorp/libxorp/timer.hh
trunk/xorp/libxorp/timeval.hh
trunk/xorp/libxorp/utils.cc
trunk/xorp/libxorp/utils.hh
trunk/xorp/libxorp/xlog.c
trunk/xorp/libxorp/xorp_osdep_begin.h
trunk/xorp/libxorp/xorp_osdep_end.h
trunk/xorp/libxorp/xorp_osdep_mid.h
trunk/xorp/libxorp/xorpfd.hh
trunk/xorp/ospf/peer.cc
trunk/xorp/pim/pim_proto.h
trunk/xorp/pim/pim_vif.cc
trunk/xorp/rtrmgr/SConscript
trunk/xorp/rtrmgr/cli.cc
trunk/xorp/rtrmgr/main_rtrmgr.cc
trunk/xorp/rtrmgr/master_conf_tree.cc
trunk/xorp/rtrmgr/master_template_tree.cc
trunk/xorp/rtrmgr/master_template_tree_node.cc
trunk/xorp/rtrmgr/module_manager.cc
trunk/xorp/rtrmgr/op_commands.cc
trunk/xorp/rtrmgr/randomness.cc
trunk/xorp/rtrmgr/template_tree.cc
trunk/xorp/rtrmgr/template_tree_node.cc
trunk/xorp/rtrmgr/tests/test_templates.cc
trunk/xorp/rtrmgr/userdb.cc
trunk/xorp/rtrmgr/util.cc
trunk/xorp/rtrmgr/xorpsh_main.cc
trunk/xorp/rtrmgr/xorpsh_main.hh
trunk/xorp/rtrmgr/xrl_rtrmgr_interface.cc
trunk/xorp/rtrmgr/xrldb.cc
trunk/xorp/utils/runit.cc
Removed Paths:
-------------
trunk/xorp/fea/data_plane/control_socket/windows_routing_socket.h
trunk/xorp/fea/data_plane/control_socket/windows_rras_support.cc
trunk/xorp/fea/data_plane/control_socket/windows_rras_support.hh
trunk/xorp/fea/data_plane/control_socket/windows_rtm_pipe.cc
trunk/xorp/fea/data_plane/control_socket/windows_rtm_pipe.hh
trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_get_iphelper.cc
trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_get_iphelper.hh
trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_get_rtmv2.cc
trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_get_rtmv2.hh
trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_observer_iphelper.cc
trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_observer_iphelper.hh
trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_observer_rtmv2.cc
trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_observer_rtmv2.hh
trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_set_iphelper.cc
trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_set_iphelper.hh
trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_set_rtmv2.cc
trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_set_rtmv2.hh
trunk/xorp/fea/data_plane/fibconfig/fibconfig_forwarding_windows.cc
trunk/xorp/fea/data_plane/fibconfig/fibconfig_forwarding_windows.hh
trunk/xorp/fea/data_plane/fibconfig/fibconfig_table_get_iphelper.cc
trunk/xorp/fea/data_plane/fibconfig/fibconfig_table_get_iphelper.hh
trunk/xorp/fea/data_plane/fibconfig/fibconfig_table_observer_iphelper.cc
trunk/xorp/fea/data_plane/fibconfig/fibconfig_table_observer_iphelper.hh
trunk/xorp/fea/data_plane/fibconfig/fibconfig_table_observer_rtmv2.cc
trunk/xorp/fea/data_plane/fibconfig/fibconfig_table_observer_rtmv2.hh
trunk/xorp/fea/data_plane/fibconfig/fibconfig_table_set_iphelper.cc
trunk/xorp/fea/data_plane/fibconfig/fibconfig_table_set_iphelper.hh
trunk/xorp/fea/data_plane/fibconfig/fibconfig_table_set_rtmv2.cc
trunk/xorp/fea/data_plane/fibconfig/fibconfig_table_set_rtmv2.hh
trunk/xorp/fea/data_plane/ifconfig/ifconfig_get_iphelper.cc
trunk/xorp/fea/data_plane/ifconfig/ifconfig_get_iphelper.hh
trunk/xorp/fea/data_plane/ifconfig/ifconfig_observer_iphelper.cc
trunk/xorp/fea/data_plane/ifconfig/ifconfig_observer_iphelper.hh
trunk/xorp/fea/data_plane/ifconfig/ifconfig_property_windows.cc
trunk/xorp/fea/data_plane/ifconfig/ifconfig_property_windows.hh
trunk/xorp/fea/data_plane/ifconfig/ifconfig_set_iphelper.cc
trunk/xorp/fea/data_plane/ifconfig/ifconfig_set_iphelper.hh
trunk/xorp/fea/data_plane/managers/fea_data_plane_manager_windows.cc
trunk/xorp/fea/data_plane/managers/fea_data_plane_manager_windows.hh
trunk/xorp/libxorp/gai_strerror.c
trunk/xorp/libxorp/win_dispatcher.cc
trunk/xorp/libxorp/win_dispatcher.hh
trunk/xorp/libxorp/win_io.c
trunk/xorp/libxorp/win_io.h
trunk/xorp/rtrmgr/glob_win32.c
trunk/xorp/rtrmgr/glob_win32.h
Modified: trunk/xorp/bgp/crash_dump.cc
===================================================================
--- trunk/xorp/bgp/crash_dump.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/bgp/crash_dump.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -28,9 +28,7 @@
#include "crash_dump.hh"
-#ifndef HOST_OS_WINDOWS
#include <pwd.h>
-#endif
#define CRASHLOG_SIZE 100
@@ -67,16 +65,9 @@
{
FILE *dumpfile;
-#ifndef HOST_OS_WINDOWS
struct passwd *pwd = getpwuid(getuid());
string filename = "/tmp/bgp_dump.";
filename += pwd->pw_name;
-#else
- char *tmppath = (char *)malloc(256);
- GetTempPathA(256, tmppath);
- string filename = string(tmppath) + "bgp_dump";
- free(tmppath);
-#endif
dumpfile = fopen(filename.c_str(), "w");
if (dumpfile == NULL) {
Modified: trunk/xorp/bgp/harness/peer.cc
===================================================================
--- trunk/xorp/bgp/harness/peer.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/bgp/harness/peer.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -1263,25 +1263,6 @@
if(words.size() == 7)
filename = words[6];
-#ifdef HOST_OS_WINDOWS
- //
- // If run from an MSYS shell, we need to perform UNIX->NT path
- // conversion and expansion of /tmp by ourselves.
- //
- filename = unix_path_to_native(filename);
- static const char tmpdirprefix[] = "\\tmp\\";
- if (0 == _strnicmp(filename.c_str(), tmpdirprefix,
- strlen(tmpdirprefix))) {
- char tmpexp[MAXPATHLEN];
- size_t size = GetTempPathA(sizeof(tmpexp), tmpexp);
- if (size == 0 || size >= sizeof(tmpexp)) {
- xorp_throw(InvalidString,
- c_format("Internal error during tmpdir expansion"));
- }
- filename.replace(0, strlen(tmpdirprefix), string(tmpexp));
- }
-#endif
-
if("traffic" == words[5]) {
if("" == filename) {
dumper->release();
Modified: trunk/xorp/bgp/iptuple.cc
===================================================================
--- trunk/xorp/bgp/iptuple.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/bgp/iptuple.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -143,11 +143,7 @@
struct addrinfo hints, *res0;
// Need to provide a hint because we are providing a numeric port number.
memset(&hints, 0, sizeof(hints));
-#ifdef HOST_OS_WINDOWS
- hints.ai_family = PF_INET;
-#else
hints.ai_family = PF_UNSPEC;
-#endif
hints.ai_socktype = SOCK_STREAM;
if ((error = getaddrinfo(interface, servname, &hints, &res0))) {
const char *error_string = gai_strerror(error);
Modified: trunk/xorp/bgp/peer.cc
===================================================================
--- trunk/xorp/bgp/peer.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/bgp/peer.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -161,11 +161,7 @@
// 6) Keep the file open.
// 7) Don't call gettimeofday directly, get the time from the eventloop.
-#ifndef HOST_OS_WINDOWS
string fname = "/tmp/bgpin.mrtd";
-#else
- string fname = "C:\\BGPIN.MRTD";
-#endif
FILE *fp = fopen(fname.c_str(), "a");
if(0 == fp)
Modified: trunk/xorp/bgp/socket.cc
===================================================================
--- trunk/xorp/bgp/socket.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/bgp/socket.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -114,11 +114,7 @@
struct addrinfo hints, *res0;
// Need to provide a hint because we are providing a numeric port number.
memset(&hints, 0, sizeof(hints));
-#ifdef HOST_OS_WINDOWS
- hints.ai_family = PF_INET;
-#else
hints.ai_family = PF_UNSPEC;
-#endif
hints.ai_socktype = SOCK_STREAM;
// addr must be numeric so this can't fail.
if ((error = getaddrinfo(addr.c_str(), port.c_str(), &hints, &res0))) {
@@ -197,9 +193,6 @@
get_remote_host());
// Assert that socket doesn't already exist, as we are about to create it.
- // XXX: This paranoid assertion existed to catch socket recycling
- // issues on the Windows platform; commented out for now.
- //XLOG_ASSERT(!get_sock().is_valid());
size_t len;
create_socket(get_local_socket(len), COMM_SOCK_BLOCKING);
Modified: trunk/xorp/bgp/tests/test_cache.cc
===================================================================
--- trunk/xorp/bgp/tests/test_cache.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/bgp/tests/test_cache.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -43,16 +43,9 @@
bool
test_cache(TestInfo& /*info*/)
{
-#ifndef HOST_OS_WINDOWS
struct passwd *pwd = getpwuid(getuid());
string filename = "/tmp/test_cache.";
filename += pwd->pw_name;
-#else
- char *tmppath = (char *)malloc(256);
- GetTempPathA(256, tmppath);
- string filename = string(tmppath) + "test_cache";
- free(tmppath);
-#endif
EventLoop eventloop;
BGPMain bgpmain(eventloop);
@@ -432,11 +425,8 @@
return false;
}
-#ifndef HOST_OS_WINDOWS
+
unlink(filename.c_str());
-#else
- DeleteFileA(filename.c_str());
-#endif
return true;
}
Modified: trunk/xorp/bgp/tests/test_decision.cc
===================================================================
--- trunk/xorp/bgp/tests/test_decision.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/bgp/tests/test_decision.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -46,16 +46,9 @@
bool
test_decision(TestInfo& /*info*/)
{
-#ifndef HOST_OS_WINDOWS
struct passwd *pwd = getpwuid(getuid());
string filename = "/tmp/test_decision.";
filename += pwd->pw_name;
-#else
- char *tmppath = (char *)malloc(256);
- GetTempPathA(256, tmppath);
- string filename = string(tmppath) + "test_decision";
- free(tmppath);
-#endif
EventLoop eventloop;
BGPMain bgpmain(eventloop);
@@ -2082,11 +2075,8 @@
return false;
}
-#ifndef HOST_OS_WINDOWS
+
unlink(filename.c_str());
-#else
- DeleteFileA(filename.c_str());
-#endif
return true;
}
Modified: trunk/xorp/bgp/tests/test_deletion.cc
===================================================================
--- trunk/xorp/bgp/tests/test_deletion.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/bgp/tests/test_deletion.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -43,16 +43,9 @@
bool
test_deletion(TestInfo& /*info*/)
{
-#ifndef HOST_OS_WINDOWS
struct passwd *pwd = getpwuid(getuid());
string filename = "/tmp/test_deletion.";
filename += pwd->pw_name;
-#else
- char *tmppath = (char *)malloc(256);
- GetTempPathA(256, tmppath);
- string filename = string(tmppath) + "test_deletion";
- free(tmppath);
-#endif
EventLoop eventloop;
BGPMain bgpmain(eventloop);
@@ -650,11 +643,8 @@
return false;
}
-#ifndef HOST_OS_WINDOWS
+
unlink(filename.c_str());
-#else
- DeleteFileA(filename.c_str());
-#endif
return true;
}
Modified: trunk/xorp/bgp/tests/test_dump.cc
===================================================================
--- trunk/xorp/bgp/tests/test_dump.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/bgp/tests/test_dump.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -57,16 +57,9 @@
test_dump(TestInfo& /*info*/)
{
//stuff needed to create an eventloop
-#ifndef HOST_OS_WINDOWS
struct passwd *pwd = getpwuid(getuid());
string filename = "/tmp/test_dump.";
filename += pwd->pw_name;
-#else
- char *tmppath = (char *)malloc(256);
- GetTempPathA(256, tmppath);
- string filename = string(tmppath) + "test_dump";
- free(tmppath);
-#endif
EventLoop eventloop;
BGPMain bgpmain(eventloop);
@@ -1915,11 +1908,8 @@
return false;
}
-#ifndef HOST_OS_WINDOWS
+
unlink(filename.c_str());
-#else
- DeleteFileA(filename.c_str());
-#endif
return true;
}
Modified: trunk/xorp/bgp/tests/test_fanout.cc
===================================================================
--- trunk/xorp/bgp/tests/test_fanout.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/bgp/tests/test_fanout.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -44,16 +44,9 @@
bool
test_fanout(TestInfo& /*info*/)
{
-#ifndef HOST_OS_WINDOWS
struct passwd *pwd = getpwuid(getuid());
string filename = "/tmp/test_fanout.";
filename += pwd->pw_name;
-#else
- char *tmppath = (char *)malloc(256);
- GetTempPathA(256, tmppath);
- string filename = string(tmppath) + "test_fanout";
- free(tmppath);
-#endif
EventLoop eventloop;
BGPMain bgpmain(eventloop);
@@ -731,11 +724,8 @@
return false;
}
-#ifndef HOST_OS_WINDOWS
+
unlink(filename.c_str());
-#else
- DeleteFileA(filename.c_str());
-#endif
return true;
}
Modified: trunk/xorp/bgp/tests/test_filter.cc
===================================================================
--- trunk/xorp/bgp/tests/test_filter.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/bgp/tests/test_filter.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -45,16 +45,10 @@
bool
test_filter(TestInfo& /*info*/)
{
-#ifndef HOST_OS_WINDOWS
struct passwd *pwd = getpwuid(getuid());
string filename = "/tmp/test_filter.";
filename += pwd->pw_name;
-#else
- char *tmppath = (char *)malloc(256);
- GetTempPathA(256, tmppath);
- string filename = string(tmppath) + "test_filter";
- free(tmppath);
-#endif
+
EventLoop eventloop;
BGPMain bgpmain(eventloop);
LocalData localdata(bgpmain.eventloop());
@@ -555,11 +549,8 @@
return false;
}
-#ifndef HOST_OS_WINDOWS
+
unlink(filename.c_str());
-#else
- DeleteFileA(filename.c_str());
-#endif
return true;
}
Modified: trunk/xorp/bgp/tests/test_main.cc
===================================================================
--- trunk/xorp/bgp/tests/test_main.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/bgp/tests/test_main.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -100,12 +100,8 @@
return false;
}
-#ifdef HOST_OS_WINDOWS
- DeleteFileA(output_file.c_str());
-#else
- unlink(output_file.c_str());
-#endif
+ unlink(output_file.c_str());
return true;
}
Modified: trunk/xorp/bgp/tests/test_nhlookup.cc
===================================================================
--- trunk/xorp/bgp/tests/test_nhlookup.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/bgp/tests/test_nhlookup.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -70,16 +70,9 @@
bool
test_nhlookup(TestInfo& /*info*/)
{
-#ifndef HOST_OS_WINDOWS
struct passwd *pwd = getpwuid(getuid());
string filename = "/tmp/test_nhlookup.";
filename += pwd->pw_name;
-#else
- char *tmppath = (char *)malloc(256);
- GetTempPathA(256, tmppath);
- string filename = string(tmppath) + "test_nhlookup";
- free(tmppath);
-#endif
EventLoop eventloop;
BGPMain bgpmain(eventloop);
@@ -638,11 +631,8 @@
return false;
}
-#ifndef HOST_OS_WINDOWS
+
unlink(filename.c_str());
-#else
- DeleteFileA(filename.c_str());
-#endif
return true;
}
Modified: trunk/xorp/bgp/tests/test_plumbing.cc
===================================================================
--- trunk/xorp/bgp/tests/test_plumbing.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/bgp/tests/test_plumbing.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -358,7 +358,6 @@
try {
// The BGP constructor expects to use the finder, so start one.
-#ifndef HOST_OS_WINDOWS
pid_t pid;
switch(pid = fork()) {
@@ -370,17 +369,7 @@
default:
break;
}
-#else // HOST_OS_WINDOWS
- STARTUPINFOA si;
- PROCESS_INFORMATION pi;
- GetStartupInfoA(&si);
- if (CreateProcessA("..\\libxipc\\xorp_finder.exe", NULL, NULL,
- NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi) == 0) {
- XLOG_FATAL("unable to exec xorp_finder");
- }
-#endif // !HOST_OS_WINDOWS
-
EventLoop eventloop;
BGPMain bgpm(eventloop);
@@ -392,11 +381,7 @@
}
// Remember to kill the finder.
-#ifndef HOST_OS_WINDOWS
kill(pid, SIGTERM);
-#else
- TerminateProcess(pi.hProcess, 1);
-#endif
printf("Tests successful\n");
} catch(...) {
Modified: trunk/xorp/bgp/tests/test_policy.cc
===================================================================
--- trunk/xorp/bgp/tests/test_policy.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/bgp/tests/test_policy.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -46,16 +46,10 @@
bool
test_policy_export(TestInfo& /*info*/)
{
-#ifndef HOST_OS_WINDOWS
struct passwd *pwd = getpwuid(getuid());
string filename = "/tmp/test_policy_export.";
filename += pwd->pw_name;
-#else
- char *tmppath = (char *)malloc(256);
- GetTempPathA(256, tmppath);
- string filename = string(tmppath) + "test_policy_export";
- free(tmppath);
-#endif
+
EventLoop eventloop;
BGPMain bgpmain(eventloop);
LocalData localdata(bgpmain.eventloop());
@@ -272,11 +266,8 @@
return false;
}
-#ifndef HOST_OS_WINDOWS
+
unlink(filename.c_str());
-#else
- DeleteFileA(filename.c_str());
-#endif
return true;
}
@@ -284,16 +275,10 @@
bool
test_policy(TestInfo& /*info*/)
{
-#ifndef HOST_OS_WINDOWS
struct passwd *pwd = getpwuid(getuid());
string filename = "/tmp/test_policy.";
filename += pwd->pw_name;
-#else
- char *tmppath = (char *)malloc(256);
- GetTempPathA(256, tmppath);
- string filename = string(tmppath) + "test_policy";
- free(tmppath);
-#endif
+
EventLoop eventloop;
BGPMain bgpmain(eventloop);
LocalData localdata(bgpmain.eventloop());
@@ -570,11 +555,8 @@
return false;
}
-#ifndef HOST_OS_WINDOWS
+
unlink(filename.c_str());
-#else
- DeleteFileA(filename.c_str());
-#endif
return true;
}
@@ -582,16 +564,10 @@
bool
test_policy_dump(TestInfo& /*info*/)
{
-#ifndef HOST_OS_WINDOWS
struct passwd *pwd = getpwuid(getuid());
string filename = "/tmp/test_policy_dump.";
filename += pwd->pw_name;
-#else
- char *tmppath = (char *)malloc(256);
- GetTempPathA(256, tmppath);
- string filename = string(tmppath) + "test_policy_dump";
- free(tmppath);
-#endif
+
EventLoop eventloop;
BGPMain bgpmain(eventloop);
LocalData localdata(bgpmain.eventloop());
@@ -880,11 +856,8 @@
return false;
}
-#ifndef HOST_OS_WINDOWS
+
unlink(filename.c_str());
-#else
- DeleteFileA(filename.c_str());
-#endif
return true;
}
Modified: trunk/xorp/bgp/tests/test_ribin.cc
===================================================================
--- trunk/xorp/bgp/tests/test_ribin.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/bgp/tests/test_ribin.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -47,16 +47,9 @@
bool
test_ribin_dump(TestInfo& /*info*/)
{
-#ifndef HOST_OS_WINDOWS
struct passwd *pwd = getpwuid(getuid());
string filename = "/tmp/test_ribin_dump.";
filename += pwd->pw_name;
-#else
- char *tmppath = (char *)malloc(256);
- GetTempPathA(256, tmppath);
- string filename = string(tmppath) + "test_ribin_dump";
- free(tmppath);
-#endif
EventLoop eventloop;
BGPMain bgpmain(eventloop);
@@ -155,16 +148,9 @@
bool
test_ribin(TestInfo& /*info*/)
{
-#ifndef HOST_OS_WINDOWS
struct passwd *pwd = getpwuid(getuid());
string filename = "/tmp/test_ribin.";
filename += pwd->pw_name;
-#else
- char *tmppath = (char *)malloc(256);
- GetTempPathA(256, tmppath);
- string filename = string(tmppath) + "test_ribin";
- free(tmppath);
-#endif
EventLoop eventloop;
BGPMain bgpmain(eventloop);
Modified: trunk/xorp/bgp/tests/test_ribout.cc
===================================================================
--- trunk/xorp/bgp/tests/test_ribout.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/bgp/tests/test_ribout.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -45,16 +45,9 @@
bool
test_ribout(TestInfo& /*info*/)
{
-#ifndef HOST_OS_WINDOWS
struct passwd *pwd = getpwuid(getuid());
string filename = "/tmp/test_ribout.";
filename += pwd->pw_name;
-#else
- char *tmppath = (char *)malloc(256);
- GetTempPathA(256, tmppath);
- string filename = string(tmppath) + "test_ribout";
- free(tmppath);
-#endif
EventLoop eventloop;
BGPMain bgpmain(eventloop);
@@ -329,11 +322,8 @@
return false;
}
-#ifndef HOST_OS_WINDOWS
+
unlink(filename.c_str());
-#else
- DeleteFileA(filename.c_str());
-#endif
return true;
}
Modified: trunk/xorp/cli/cli_client.cc
===================================================================
--- trunk/xorp/cli/cli_client.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/cli/cli_client.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -40,10 +40,6 @@
#include "cli_command_pipe.hh"
#include "cli_private.hh"
-#ifdef HOST_OS_WINDOWS
-#define isatty(x) (x).is_console()
-#endif
-
//
// Exported variables
//
Modified: trunk/xorp/cli/cli_node_net.cc
===================================================================
--- trunk/xorp/cli/cli_node_net.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/cli/cli_node_net.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -59,16 +59,9 @@
#include <arpa/telnet.h>
#endif
-#ifdef HOST_OS_WINDOWS
-#include "libxorp/win_io.h"
-#define DEFAULT_TERM_TYPE "ansi-nt"
-#define FILENO(x) ((HANDLE)_get_osfhandle(_fileno(x)))
-#define FDOPEN(x,y) _fdopen(_open_osfhandle((x),_O_RDWR|_O_TEXT),(y))
-#else // ! HOST_OS_WINDOWS
#define DEFAULT_TERM_TYPE "vt100"
#define FILENO(x) fileno(x)
#define FDOPEN(x,y) fdopen((x), (y))
-#endif // HOST_OS_WINDOWS
//
// Exported variables
@@ -93,7 +86,6 @@
static set<CliClient *> local_cli_clients_;
-#ifndef HOST_OS_WINDOWS
static void
sigwinch_handler(int signo)
{
@@ -107,7 +99,6 @@
cli_client->terminal_resized();
}
}
-#endif // ! HOST_OS_WINDOWS
/**
* CliNode::sock_serv_open:
@@ -202,27 +193,6 @@
cli_client->set_network_client(is_network);
_client_list.push_back(cli_client);
-#ifdef HOST_OS_WINDOWS
- if (cli_client->is_interactive()) {
- BOOL retval;
-#if 0
- // XXX: This always fails, so it's commented out.
- retval = SetConsoleMode(input_fd,
-ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT);
- if (retval == 0) {
- XLOG_WARNING("SetConsoleMode(input) failed: %s",
- win_strerror(GetLastError()));
- }
-#endif
- retval = SetConsoleMode(output_fd,
-ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT);
- if (retval == 0) {
- XLOG_WARNING("SetConsoleMode(output) failed: %s",
- win_strerror(GetLastError()));
- }
- }
-#endif
-
//
// Set peer address (for network connection only)
//
@@ -416,11 +386,9 @@
}
#endif
-#ifndef HOST_OS_WINDOWS
if (! is_network()) {
signal(SIGWINCH, sigwinch_handler);
}
-#endif
#ifdef HAVE_TERMIOS_H
//
@@ -517,22 +485,9 @@
// Set the terminal
string term_name = DEFAULT_TERM_TYPE;
if (is_output_tty()) {
-#ifdef HOST_OS_WINDOWS
- //
- // Do not ask the environment what kind of terminal we use
- // under Windows, as MSYS is known to lie to us and say 'cygwin'
- // when in fact we're using an 'ansi-nt'. We've hard-coded
- // appropriate control sequences in our fork of libtecla to
- // reflect this fact.
- // XXX: We need a better way of figuring out when we're in
- // this situation.
-
- ; // do nothing
-#else
char *term = getenv("TERM");
if ((term != NULL) && (! string(term).empty()))
term_name = string(term);
-#endif
}
//
@@ -740,23 +695,7 @@
XLOG_ASSERT(type == IOT_READ);
-#ifdef HOST_OS_WINDOWS
- if (!is_interactive()) {
- n = recv(fd, buf, sizeof(buf), 0);
- } else {
- //
- // A 0-byte interactive read is not an error; it may simply
- // mean the read routine filtered out an event which we
- // weren't interested in.
- //
- n = win_con_read(fd, buf, sizeof(buf));
- if (n == 0) {
- return;
- }
- }
-#else /* !HOST_OS_WINDOWS */
n = read(fd, buf, sizeof(buf) - 1);
-#endif /* HOST_OS_WINDOWS */
debug_msg("client_read %d octet(s)\n", n);
if (n <= 0) {
@@ -961,11 +900,6 @@
int
CliClient::process_telnet_option(int val, bool& is_telnet_option)
{
-#ifdef HOST_OS_WINDOWS
- UNUSED(val);
- is_telnet_option = false;
- return (XORP_OK);
-#else
is_telnet_option = true;
if (val == IAC) {
// Probably a telnet command
@@ -1132,5 +1066,4 @@
is_telnet_option = false;
return (XORP_OK);
-#endif // HOST_OS_WINDOWS
}
Modified: trunk/xorp/fea/data_plane/control_socket/SConscript
===================================================================
--- trunk/xorp/fea/data_plane/control_socket/SConscript 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/fea/data_plane/control_socket/SConscript 2009-12-03 21:56:33 UTC (rev 11660)
@@ -36,8 +36,6 @@
'netlink_socket_utilities.cc',
'routing_socket.cc',
'routing_socket_utilities.cc',
- 'windows_rras_support.cc',
- 'windows_rtm_pipe.cc'
]
if is_shared:
Modified: trunk/xorp/fea/data_plane/control_socket/click_socket.cc
===================================================================
--- trunk/xorp/fea/data_plane/control_socket/click_socket.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/fea/data_plane/control_socket/click_socket.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -281,10 +281,6 @@
int
ClickSocket::stop(string& error_msg)
{
-#ifdef HOST_OS_WINDOWS
- UNUSED(error_msg)
- return (XORP_ERROR);
-#else /* !HOST_OS_WINDOWS */
//
// XXX: First we should stop user-level Click, and then kernel-level Click.
// Otherwise, the user-level Click process may block the unmounting
@@ -323,7 +319,6 @@
}
return (XORP_OK);
-#endif /* HOST_OS_WINDOWS */
}
int
@@ -673,12 +668,6 @@
int
ClickSocket::mount_click_file_system(string& error_msg)
{
-#if defined(HOST_OS_WINDOWS)
- // Whilst Cygwin has a mount(), it is very different.
- // Windows itself has no mount().
- UNUSED(error_msg);
- return (XORP_ERROR);
-#else
if (_kernel_click_mount_directory.empty()) {
error_msg = c_format("Kernel Click mount directory is empty");
return (XORP_ERROR);
@@ -752,16 +741,11 @@
_mounted_kernel_click_mount_directory = _kernel_click_mount_directory;
return (XORP_OK);
-#endif // HOST_OS_WINDOWS
}
int
ClickSocket::unmount_click_file_system(string& error_msg)
{
-#ifdef HOST_OS_WINDOWS
- UNUSED(error_msg);
- return (XORP_OK);
-#else
if (_mounted_kernel_click_mount_directory.empty())
return (XORP_OK); // Directory not mounted
@@ -787,7 +771,6 @@
_mounted_kernel_click_mount_directory.erase();
return (XORP_OK);
-#endif // HOST_OS_WINDOWS
}
int
@@ -864,16 +847,6 @@
bool has_user_config, const string& user_config,
string& error_msg)
{
-#ifdef HOST_OS_WINDOWS
- UNUSED(element);
- UNUSED(handler);
- UNUSED(has_kernel_config);
- UNUSED(kernel_config);
- UNUSED(has_user_config);
- UNUSED(user_config);
- UNUSED(error_msg);
- return (0);
-#else /* !HOST_OS_WINDOWS */
if (is_kernel_click() && has_kernel_config) {
//
// Prepare the output handler name
@@ -1003,21 +976,13 @@
}
return (XORP_OK);
-#endif /* HOST_OS_WINDOWS */
}
ssize_t
ClickSocket::write(XorpFd fd, const void* data, size_t nbytes)
{
-#ifdef HOST_OS_WINDOWS
- UNUSED(fd);
- UNUSED(data);
- UNUSED(nbytes);
- return (0);
-#else
_seqno++;
return ::write(fd, data, nbytes);
-#endif
}
int
@@ -1138,12 +1103,6 @@
ClickSocket::force_read_message(XorpFd fd, vector<uint8_t>& message,
string& error_msg)
{
-#ifdef HOST_OS_WINDOWS
- UNUSED(fd);
- UNUSED(message);
- UNUSED(error_msg);
- return (XORP_ERROR);
-#else /* !HOST_OS_WINDOWS */
vector<uint8_t> buffer(CLSOCK_BYTES);
for ( ; ; ) {
@@ -1177,7 +1136,6 @@
}
return (XORP_OK);
-#endif /* HOST_OS_WINDOWS */
}
void
Modified: trunk/xorp/fea/data_plane/control_socket/routing_socket_utilities.cc
===================================================================
--- trunk/xorp/fea/data_plane/control_socket/routing_socket_utilities.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/fea/data_plane/control_socket/routing_socket_utilities.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -50,10 +50,6 @@
#include <netinet6/in6_var.h>
#endif
-#ifdef HOST_OS_WINDOWS
-#include "windows_routing_socket.h"
-#endif
-
#include "system_utilities.hh"
#include "routing_socket_utilities.hh"
@@ -62,7 +58,7 @@
// (e.g., obtained by routing sockets or by sysctl(3) mechanism).
//
-#if defined(HOST_OS_WINDOWS) || defined(HAVE_ROUTING_SOCKETS)
+#if defined(HAVE_ROUTING_SOCKETS)
/**
* @param m message type from routing socket message
@@ -159,14 +155,6 @@
const size_t min_size = sizeof(u_long);
size_t sa_size = min_size;
-#ifdef HOST_OS_WINDOWS
- /*
- * XXX: XORP's modified BSD-style routing socket interface
- * to Router Manager V2 in Windows Longhorn always uses
- * a fixed sockaddr size of sockaddr_storage.
- */
- sa_size = sizeof(struct sockaddr_storage);
-#else // ! HOST_OS_WINDOWS
#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
sa_size = sa->sa_len ? round_up(sa->sa_len, min_size) : min_size;
#else // ! HAVE_STRUCT_SOCKADDR_SA_LEN
@@ -184,7 +172,6 @@
break;
}
#endif // ! HAVE_STRUCT_SOCKADDR_SA_LEN
-#endif // HOST_OS_WINDOWS
// XXX: the sa_size offset is aligned, hence we can use a void pointer
const void* p = reinterpret_cast<const uint8_t*>(sa) + sa_size;
@@ -231,7 +218,6 @@
IPv4 netmask(sin->sin_addr);
return (netmask.mask_len());
}
-#ifndef HOST_OS_WINDOWS // XXX not yet for windows
#ifdef HAVE_IPV6
case AF_INET6:
{
@@ -241,7 +227,6 @@
return (netmask.mask_len());
}
#endif // HAVE_IPV6
-#endif
default:
XLOG_FATAL("Invalid address family %d", family);
}
@@ -284,7 +269,6 @@
}
}
-#ifndef HOST_OS_WINDOWS // Not yet for Windows
#ifdef HAVE_IPV6
case AF_INET6:
{
@@ -302,7 +286,6 @@
return (netmask.mask_len());
}
#endif // HAVE_IPV6
-#endif
default:
XLOG_FATAL("Invalid address family %d", family);
@@ -399,7 +382,6 @@
//
// Get the next-hop router address
- // XXX: Windows does not include the 'gateway'.
//
if ( (sa = rti_info[RTAX_GATEWAY]) != NULL) {
if (sa->sa_family == family) {
@@ -441,7 +423,6 @@
//
// Test whether we installed this route
- // XXX: Windows does not set this flag currently.
//
if (rtm->rtm_flags & RTF_PROTO1)
xorp_route = true;
@@ -451,8 +432,6 @@
// Older BSD kernels do not implement a software discard interface,
// so map this back to a reference to the FEA's notion of one.
//
- // XXX: Windows does not currently support blackhole/reject routes.
- //
if (rtm->rtm_flags & RTF_BLACKHOLE) {
//
// Try to map discard routes back to the first software discard
@@ -487,8 +466,6 @@
// Older BSD kernels do not implement a software unreachable interface,
// so map this back to a reference to the FEA's notion of one.
//
- // XXX: Windows does not currently support blackhole/reject routes.
- //
if (rtm->rtm_flags & RTF_REJECT) {
//
// Try to map unreachable routes back to the first software
Deleted: trunk/xorp/fea/data_plane/control_socket/windows_routing_socket.h
===================================================================
--- trunk/xorp/fea/data_plane/control_socket/windows_routing_socket.h 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/fea/data_plane/control_socket/windows_routing_socket.h 2009-12-03 21:56:33 UTC (rev 11660)
@@ -1,322 +0,0 @@
-/* -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*- */
-/* vim:set sts=4 ts=8: */
-
-/*
- * Copyright (c) 2001-2009 XORP, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, Version 2, June
- * 1991 as published by the Free Software Foundation. Redistribution
- * and/or modification of this program under the terms of any other
- * version of the GNU General Public License is not permitted.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
- * see the GNU General Public License, Version 2, a copy of which can be
- * found in the XORP LICENSE.gpl file.
- *
- * XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
- * http://xorp.net
- */
-
-/*
- * $XORP: xorp/fea/data_plane/control_socket/windows_routing_socket.h,v 1.7 2008/10/02 21:56:54 bms Exp $
- */
-
-/*
- * This header contains definitions and structures for XORP's adapter
- * code for Microsoft's Router Manager V2 API. A pair of DLLs is installed
- * into the Routing and Remote Access Service by the FEA which communicate
- * Windows internal routing information to XORP using the BSD routing
- * socket message format over named pipes.
- */
-
-/*-
- * Copyright (c) 1980, 1986, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)route.h 8.4 (Berkeley) 1/9/95
- * $FreeBSD: src/sys/net/route.h,v 1.63.2.1 2006/04/04 20:07:23 andre Exp $
- */
-
-#ifndef __FEA_DATA_PLANE_CONTROL_SOCKET_WINDOWS_ROUTING_SOCKET_HH__
-#define __FEA_DATA_PLANE_CONTROL_SOCKET_WINDOWS_ROUTING_SOCKET_HH__
-
-#include "libxorp/xorp.h"
-
-#ifdef HOST_OS_WINDOWS
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define XORPRTM4_PIPENAME "\\\\.\\pipe\\XorpRtm4"
-#define XORPRTM4_LOGNAME "XORPRTM4"
-
-#define XORPRTM6_PIPENAME "\\\\.\\pipe\\XorpRtm6"
-#define XORPRTM6_LOGNAME "XORPRTM6"
-
-#ifdef IPV6_DLL
-#define XORPRTM_PIPENAME XORPRTM6_PIPENAME
-#define XORPRTM_LOGNAME XORPRTM6_LOGNAME
-#define XORPRTM_TRACENAME XORPRTM6_LOGNAME
-#else
-#define XORPRTM_PIPENAME XORPRTM4_PIPENAME
-#define XORPRTM_LOGNAME XORPRTM4_LOGNAME
-#define XORPRTM_TRACENAME XORPRTM4_LOGNAME
-#endif
-
-/*
- * Registry glue for Router Manager
- */
-#define HKLM_XORPRTM4_NAME \
-"SOFTWARE\\Microsoft\\Router\\CurrentVersion\\RouterManagers\\Ip\\XORPRTM4"
-#define HKLM_XORPRTM6_NAME \
-"SOFTWARE\\Microsoft\\Router\\CurrentVersion\\RouterManagers\\Ipv6\\XORPRTM6"
-#define HKLM_XORPRTM4_TRACING_NAME \
- "SOFTWARE\\Microsoft\\Tracing\\XORPRTM4"
-#define HKLM_XORPRTM6_TRACING_NAME \
- "SOFTWARE\\Microsoft\\Tracing\\XORPRTM6"
-
-#define RTMV2_CLSID_IPV4 "{C2FE450A-D6C2-11D0-A37B-00C04FC9DA04}"
-#define RTMV2_CLSID_IPV6 "{C2FE451A-D6C2-11D0-A37B-00C04FC9DA04}"
-
-#define XORPRTM_DLL_VENDOR "www.xorp.org"
-#define XORPRTM_DLL_FLAGS 0x00000002
-#define XORPRTM_CONFIG_DLL_NAME "nonexistent.dll"
-#define XORPRTM4_DLL_NAME "xorprtm4.dll"
-#define XORPRTM4_DLL_TITLE "Router Manager V2 adapter for XORP (IPv4)"
-#define XORPRTM6_DLL_NAME "xorprtm6.dll"
-#define XORPRTM6_DLL_TITLE "Router Manager V2 adapter for XORP (IPv6)"
-#define XORPRTM_TRACING_PATH "%windir%\\Tracing"
-
-/*
- * Router Manager V2 IDs for XORP
- */
-
-#define PROTO_IP_XORPRTM 7
-#define XORPRTM_PROTOCOL_ID \
- PROTOCOL_ID(PROTO_TYPE_UCAST, PROTO_VENDOR_MS0, PROTO_IP_XORPRTM)
-
-#define XORPRTM_GLOBAL_CONFIG_ID 1
-
-/*
- * MS Router Manager info structures
- */
-
-typedef struct _XORPRTM_GLOBAL_CONFIG {
- DWORD dummy;
-} XORPRTM_GLOBAL_CONFIG, *PXORPRTM_GLOBAL_CONFIG;
-
-typedef struct _XORPRTM_MIB_SET_INPUT_DATA {
- DWORD IMSID_TypeID;
- DWORD IMSID_IfIndex;
- DWORD IMSID_BufferSize;
- BYTE IMSID_Buffer[0];
-} XORPRTM_MIB_SET_INPUT_DATA, *PXORPRTM_MIB_SET_INPUT_DATA;
-
-typedef struct _XORPRTM_MIB_GET_INPUT_DATA {
- DWORD IMGID_TypeID;
- DWORD IMGID_IfIndex;
-} XORPRTM_MIB_GET_INPUT_DATA, *PXORPRTM_MIB_GET_INPUT_DATA;
-
-typedef struct _XORPRTM_MIB_GET_OUTPUT_DATA {
- DWORD IMGOD_TypeID;
- DWORD IMGOD_IfIndex;
- BYTE IMGOD_Buffer[0];
-} XORPRTM_MIB_GET_OUTPUT_DATA, *PXORPRTM_MIB_GET_OUTPUT_DATA;
-
-/*
- * BSD routing socket interface
- */
-
-#define RTF_UP 0x1 /* route usable */
-#define RTF_GATEWAY 0x2 /* destination is a gateway */
-#define RTF_HOST 0x4 /* host entry (net otherwise) */
-#define RTF_REJECT 0x8 /* host or net unreachable */
-#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */
-#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */
-#define RTF_DONE 0x40 /* message confirmed */
-/* 0x80 unused, was RTF_DELCLONE */
-#define RTF_CLONING 0x100 /* generate new routes on use */
-#define RTF_XRESOLVE 0x200 /* external daemon resolves name */
-#define RTF_LLINFO 0x400 /* generated by link layer (e.g. ARP) */
-#define RTF_STATIC 0x800 /* manually added */
-#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */
-#define RTF_PROTO2 0x4000 /* protocol specific routing flag */
-#define RTF_PROTO1 0x8000 /* protocol specific routing flag */
-
-#define RTF_WASCLONED 0x20000 /* route generated through cloning */
-#define RTF_PROTO3 0x40000 /* protocol specific routing flag */
-/* 0x80000 unused */
-#define RTF_PINNED 0x100000 /* future use */
-#define RTF_LOCAL 0x200000 /* route represents a local address */
-#define RTF_BROADCAST 0x400000 /* route represents a bcast address */
-#define RTF_MULTICAST 0x800000 /* route represents a mcast address */
- /* 0x1000000 and up unassigned */
-
-/* Mask of RTF flags that are allowed to be modified by RTM_CHANGE. */
-#define RTF_FMASK \
- (RTF_PROTO1 | RTF_PROTO2 | RTF_PROTO3 | RTF_BLACKHOLE | \
- RTF_REJECT | RTF_STATIC)
-
-struct rt_metrics {
- DWORD rmx_filler[14]; /* Ignore field names but pad in same way */
-};
-
-/*
- * Structures for routing messages.
- */
-struct rt_msghdr {
- USHORT rtm_msglen; /* to skip over non-understood messages */
- BYTE rtm_version; /* future binary compatibility */
- BYTE rtm_type; /* message type */
- USHORT rtm_index; /* index for associated ifp */
- DWORD rtm_flags; /* flags, incl. kern & message, e.g. DONE */
- DWORD rtm_addrs; /* bitmask identifying sockaddrs in msg */
- LONG rtm_pid; /* identify sender */
- LONG rtm_seq; /* for sender to identify action */
- DWORD rtm_errno; /* why failed */
- DWORD rtm_fmask; /* bitmask used in RTM_CHANGE message */
-#define rtm_use rtm_fmask /* deprecated, use rtm_rmx->rmx_pksent */
- DWORD rtm_inits; /* which metrics we are initializing */
- struct rt_metrics rtm_rmx; /* metrics themselves */
-};
-
-#define RTM_VERSION 66 /* Unique to XORP/Win32 */
-
-/*
- * Message types.
- * Only those supported by the Windows subsystem are provided.
- */
-#define RTM_ADD 0x1 /* Add Route */
-#define RTM_DELETE 0x2 /* Delete Route */
-#define RTM_CHANGE 0x3 /* Change Metrics or flags */
-#define RTM_NEWADDR 0xc /* address being added to iface */
-#define RTM_DELADDR 0xd /* address being removed from iface */
-#define RTM_IFINFO 0xe /* iface going up/down etc. */
-#define RTM_IFANNOUNCE 0x11 /* iface arrival/departure */
-
-/*
- * Bitmask values for rtm_addrs.
- */
-#define RTA_DST 0x1 /* destination sockaddr present */
-#define RTA_GATEWAY 0x2 /* gateway sockaddr present */
-#define RTA_NETMASK 0x4 /* netmask sockaddr present */
-#define RTA_GENMASK 0x8 /* cloning mask sockaddr present */
-#define RTA_IFP 0x10 /* interface name sockaddr present */
-#define RTA_IFA 0x20 /* interface addr sockaddr present */
-#define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */
-#define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */
-
-/*
- * Index offsets for sockaddr array for alternate internal encoding.
- */
-#define RTAX_DST 0 /* destination sockaddr present */
-#define RTAX_GATEWAY 1 /* gateway sockaddr present */
-#define RTAX_NETMASK 2 /* netmask sockaddr present */
-#define RTAX_GENMASK 3 /* cloning mask sockaddr present */
-#define RTAX_IFP 4 /* interface name sockaddr present */
-#define RTAX_IFA 5 /* interface addr sockaddr present */
-#define RTAX_AUTHOR 6 /* sockaddr for author of redirect */
-#define RTAX_BRD 7 /* for NEWADDR, broadcast or p-p dest addr */
-#define RTAX_MAX 8 /* size of array to allocate */
-
-/*
- * XXX: The Winsock definition of struct sockaddr does not have
- * a size value, therefore we use struct sockaddr_storage in its entirety.
- */
-#define SA_SIZE(sa) sizeof(struct sockaddr_storage)
-
-/*
- * XXX: The length of IFNAMSIZ must be consistent across the ABI.
- * It's different from BSDs to allow for arbitrary FriendlyNames,
- * up to a length of 256 bytes.
- */
-#ifdef IFNAMSIZ
-#undef IFNAMSIZ
-#endif
-#ifndef IFNAMSIZ
-#define IFNAMSIZ 256
-#endif
-
-#define IFAN_ARRIVAL 0 /* interface arrival */
-#define IFAN_DEPARTURE 1 /* interface departure */
-
-struct if_announcemsghdr {
- USHORT ifan_msglen;
- BYTE ifan_version;
- BYTE ifan_type;
- DWORD ifan_index; /* XXX: This is now 32-bits wide */
- BYTE ifan_name[IFNAMSIZ]; /* FriendlyName in ANSI text. */
- BYTE ifan_what;
-};
-
-/*
- * Values for if_link_state.
- */
-#define LINK_STATE_UNKNOWN 0 /* link invalid/unknown */
-#define LINK_STATE_DOWN 1 /* link is down */
-#define LINK_STATE_UP 2 /* link is up */
-
-/*
- * XXX: Most of the fields in the original BSD if_data
- * structure can't be obtained on Windows from the
- * RTMv2 interface status callback,
- */
-struct if_data {
- BYTE ifi_link_state;
-};
-
-struct if_msghdr {
- USHORT ifm_msglen;
- BYTE ifm_version;
- BYTE ifm_type;
- DWORD ifm_addrs;
- DWORD ifm_flags;
- DWORD ifm_index;
- struct if_data ifm_data;
-};
-
-struct ifa_msghdr {
- USHORT ifam_msglen;
- BYTE ifam_version;
- BYTE ifam_type;
- DWORD ifam_addrs;
- DWORD ifam_flags;
- DWORD ifam_index;
- DWORD ifam_metric;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // HOST_OS_WINDOWS
-
-#endif /* __FEA_DATA_PLANE_CONTROL_SOCKET_WINDOWS_ROUTING_SOCKET_HH__ */
Deleted: trunk/xorp/fea/data_plane/control_socket/windows_rras_support.cc
===================================================================
--- trunk/xorp/fea/data_plane/control_socket/windows_rras_support.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/fea/data_plane/control_socket/windows_rras_support.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -1,360 +0,0 @@
-// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
-// vim:set sts=4 ts=8:
-
-// Copyright (c) 2001-2009 XORP, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License, Version 2, June
-// 1991 as published by the Free Software Foundation. Redistribution
-// and/or modification of this program under the terms of any other
-// version of the GNU General Public License is not permitted.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
-// see the GNU General Public License, Version 2, a copy of which can be
-// found in the XORP LICENSE.gpl file.
-//
-// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
-// http://xorp.net
-
-
-
-#include "fea/fea_module.h"
-
-#include "libxorp/xorp.h"
-#include "libxorp/xlog.h"
-#include "libxorp/debug.h"
-
-#include "windows_rras_support.hh"
-
-#ifdef HOST_OS_WINDOWS
-
-#include "libxorp/win_io.h"
-#include "windows_routing_socket.h"
-
-#include <mprapi.h>
-#include <routprot.h>
-
-#ifndef RRAS_SERVICE_NAME
-#define RRAS_SERVICE_NAME TEXT("RemoteAccess")
-#endif
-
-//
-// Helper method to determine if the Routing and Remote Access Service
-// is installed and running.
-//
-bool
-WinSupport::is_rras_running()
-{
- bool is_installed = false;
- bool is_running = false;
-
- SC_HANDLE h_scm = OpenSCManager(NULL, NULL, GENERIC_READ);
- if (h_scm != NULL) {
- SC_HANDLE h_rras = OpenService(h_scm, RRAS_SERVICE_NAME, GENERIC_READ);
- if (h_rras != NULL) {
- is_installed = true;
- SERVICE_STATUS ss;
- if (0 != ControlService(h_rras, SERVICE_CONTROL_INTERROGATE, &ss)) {
- is_running = true;
- } else {
- DWORD result = GetLastError();
- if (result == ERROR_SERVICE_CANNOT_ACCEPT_CTRL) {
- is_running = true;
- } else if (result != ERROR_SERVICE_NOT_ACTIVE) {
- XLOG_WARNING("ControlService() failed: %s",
- win_strerror(result));
- }
- }
- CloseServiceHandle(h_rras);
- } else {
- DWORD result = GetLastError();
- if (result != ERROR_SERVICE_DOES_NOT_EXIST) {
- XLOG_WARNING("OpenService() failed: %s", win_strerror(result));
- }
- }
- CloseServiceHandle(h_scm);
- } else {
- XLOG_WARNING("OpenSCManager() failed: %s",
- win_strerror(GetLastError()));
- }
- return (is_running && is_installed);
-}
-
-int
-WinSupport::add_protocol_to_rras(int family)
-{
- SHORT XORPRTM_BLOCK_SIZE = 0x0004;
- XORPRTM_GLOBAL_CONFIG igc;
- HRESULT hr = S_OK;
- DWORD dwErr = ERROR_SUCCESS;
- DWORD dwErrT = ERROR_SUCCESS;
- MPR_SERVER_HANDLE hMprServer = NULL;
- HANDLE hMprConfig = NULL;
- LPBYTE pByte = NULL;
- LPVOID pHeader = NULL;
- LPVOID pNewHeader = NULL;
- DWORD dwSize = 0;
- HANDLE hTransport = NULL;
- LPWSTR pswzServerName = NULL;
- int pid;
-
- memset(&igc, 0, sizeof(igc));
-
-#if 0
- if (family == AF_INET) {
- pid = PID_IP;
- } else {
- pid = PID_IPV6;
- }
-#else
- pid = PID_IP;
- UNUSED(family); // XXX: No definition of PID_IPV6 yet.
-#endif
-
- dwErr = MprAdminServerConnect(pswzServerName, &hMprServer);
- if (dwErr == ERROR_SUCCESS) {
- dwErr = MprAdminTransportGetInfo(hMprServer, pid, &pByte, &dwSize,
- NULL, NULL);
- if (dwErr == ERROR_SUCCESS) {
- MprInfoDuplicate(pByte, &pHeader);
- MprAdminBufferFree(pByte);
- pByte = NULL;
- dwSize = 0;
- }
- }
-
- dwErrT = MprConfigServerConnect(pswzServerName, &hMprConfig);
- if (dwErrT == ERROR_SUCCESS) {
- dwErrT = MprConfigTransportGetHandle(hMprConfig, pid, &hTransport);
- }
-
- if (dwErr != ERROR_SUCCESS) {
- MprConfigTransportGetInfo(hMprConfig, hTransport, &pByte, &dwSize,
- NULL, NULL, NULL);
- MprInfoDuplicate(pByte, &pHeader);
- MprConfigBufferFree(pByte);
- pByte = NULL;
- dwSize = 0;
- }
-
- MprInfoBlockRemove(pHeader, PROTO_IP_XORPRTM, &pNewHeader);
- if (pNewHeader != NULL) {
- MprInfoDelete(pHeader);
- pHeader = pNewHeader;
- pNewHeader = NULL;
- }
-
- MprInfoBlockAdd(pHeader, PROTO_IP_XORPRTM, XORPRTM_BLOCK_SIZE, 1,
- (LPBYTE)&igc, &pNewHeader);
- MprInfoDelete(pHeader);
- pHeader = NULL;
-
- if (hMprServer) {
- MprAdminTransportSetInfo(hMprServer, pid, (BYTE*)pNewHeader,
- MprInfoBlockQuerySize(pNewHeader), NULL, 0);
- }
-
- if (hMprConfig && hTransport) {
- MprConfigTransportSetInfo(hMprConfig, hTransport, (BYTE*)pNewHeader,
- MprInfoBlockQuerySize(pNewHeader), NULL,
- 0, NULL);
- }
-
- if (pHeader)
- MprInfoDelete(pHeader);
- if (pNewHeader)
- MprInfoDelete(pNewHeader);
- if (hMprConfig)
- MprConfigServerDisconnect(hMprConfig);
- if (hMprServer)
- MprAdminServerDisconnect(hMprServer);
-
- return ((int)hr);
-}
-
-int
-WinSupport::restart_rras()
-{
- SERVICE_STATUS ss;
- SC_HANDLE h_scm;
- SC_HANDLE h_rras;
- DWORD result;
- int tries, fatal;
-
- h_scm = OpenSCManager(NULL, NULL, GENERIC_READ);
- if (h_scm == NULL) {
- return (-1);
- }
-
- h_rras = OpenService(h_scm, RRAS_SERVICE_NAME, GENERIC_READ);
- if (h_rras == NULL) {
- result = GetLastError();
- CloseServiceHandle(h_scm);
- return (-1);
- }
-
- fatal = 0;
-
- for (tries = 30; tries > 0; tries++) {
- // Check if the service is running, stopping, or stopped.
- result = ControlService(h_rras, SERVICE_CONTROL_INTERROGATE, &ss);
- if (result == NO_ERROR) {
- // Stopped; carry on
- if (ss.dwCurrentState == SERVICE_STOPPED)
- break;
- // Stopping; poll until it's done
- if (ss.dwCurrentState == SERVICE_STOP_PENDING) {
- Sleep(1000);
- continue;
- }
- } else if (result == ERROR_SERVICE_NOT_ACTIVE) {
- break;
- } else {
- fatal = 1;
- break;
- }
-
- result = ControlService(h_rras, SERVICE_CONTROL_STOP, &ss);
- if (result == ERROR_SERVICE_NOT_ACTIVE) {
- break;
- } else if (result != NO_ERROR) {
- fatal = 1;
- break;
- }
- }
-
- // XXX: error checking missing
- result = StartService(h_rras, 0, NULL);
-
- // XXX: We should check that the service started.
-
- CloseServiceHandle(h_rras);
- CloseServiceHandle(h_scm);
-
- return (0);
-}
-
-static const BYTE DLL_CLSID_IPV4[] = RTMV2_CLSID_IPV4;
-static const BYTE DLL_CLSID_IPV6[] = RTMV2_CLSID_IPV6;
-static const BYTE DLL_CONFIG_DLL[] = XORPRTM_CONFIG_DLL_NAME;
-static const BYTE DLL_NAME_IPV4[] = XORPRTM4_DLL_NAME;
-static const BYTE DLL_NAME_IPV6[] = XORPRTM6_DLL_NAME;
-static const DWORD DLL_FLAGS = 0x00000002;
-static const DWORD DLL_PROTO = PROTO_IP_XORPRTM;
-static const BYTE DLL_TITLE_IPV4[] = RTMV2_CLSID_IPV4;
-static const BYTE DLL_TITLE_IPV6[] = RTMV2_CLSID_IPV6;
-static const BYTE DLL_VENDOR[] = XORPRTM_DLL_VENDOR;
-static const BYTE TRACING_DIR[] = XORPRTM_TRACING_PATH;
-
-//
-// XXX: There is no error handling in this function whatsoever.
-//
-int
-WinSupport::add_protocol_to_registry(int family)
-{
- DWORD result;
- HKEY hKey;
-
- if (family != AF_INET && family != AF_INET6)
- return (-1);
-
- result = RegCreateKeyExA(
- HKEY_LOCAL_MACHINE,
- family == AF_INET ? HKLM_XORPRTM4_NAME : HKLM_XORPRTM6_NAME,
- 0,
- NULL,
- REG_OPTION_NON_VOLATILE,
- KEY_ALL_ACCESS,
- NULL,
- &hKey,
- NULL);
-
- RegSetValueExA(hKey, "ConfigDll", 0, REG_SZ, DLL_CONFIG_DLL,
- sizeof(DLL_CONFIG_DLL));
- if (family == AF_INET) {
- RegSetValueExA(hKey, "ConfigClsId", 0, REG_SZ, DLL_CLSID_IPV4,
- sizeof(DLL_CLSID_IPV4));
- RegSetValueExA(hKey, "Title", 0, REG_SZ, DLL_TITLE_IPV4,
- sizeof(DLL_TITLE_IPV4));
- RegSetValueExA(hKey, "DllName", 0, REG_SZ, DLL_NAME_IPV4,
- sizeof(DLL_NAME_IPV4));
- } else if (family == AF_INET6) {
- RegSetValueExA(hKey, "ConfigClsId", 0, REG_SZ, DLL_CLSID_IPV6,
- sizeof(DLL_CLSID_IPV6));
- RegSetValueExA(hKey, "Title", 0, REG_SZ, DLL_TITLE_IPV6,
- sizeof(DLL_TITLE_IPV6));
- RegSetValueExA(hKey, "DllName", 0, REG_SZ, DLL_NAME_IPV6,
- sizeof(DLL_NAME_IPV6));
- }
- RegSetValueExA(hKey, "Flags", 0, REG_DWORD, (const BYTE*)&DLL_FLAGS,
- sizeof(DLL_FLAGS));
- RegSetValueExA(hKey, "ProtocolId", 0, REG_DWORD, (const BYTE*)&DLL_PROTO,
- sizeof(DLL_PROTO));
- RegSetValueExA(hKey, "VendorName", 0, REG_SZ, DLL_VENDOR,
- sizeof(DLL_VENDOR));
- RegCloseKey(hKey);
-
-#if 1
- //
- // XXX: Enable console tracing for debugging.
- //
- result = RegCreateKeyExA(
- HKEY_LOCAL_MACHINE,
- family == AF_INET ? HKLM_XORPRTM4_TRACING_NAME : HKLM_XORPRTM6_TRACING_NAME,
- 0,
- NULL,
- REG_OPTION_NON_VOLATILE,
- KEY_ALL_ACCESS,
- NULL,
- &hKey,
- NULL);
-
- DWORD foo = 1;
- RegSetValueExA(hKey, "EnableConsoleTracing", 0, REG_DWORD, (BYTE*)&foo, sizeof(foo));
- RegSetValueExA(hKey, "EnableFileTracing", 0, REG_DWORD, (BYTE*)&foo, sizeof(foo));
- foo = 0xFFFF0000;
- RegSetValueExA(hKey, "ConsoleTracingMask", 0, REG_DWORD, (BYTE*)&foo, sizeof(foo));
- RegSetValueExA(hKey, "FileTracingMask", 0, REG_DWORD, (BYTE*)&foo, sizeof(foo));
- foo = 0x00100000;
- RegSetValueExA(hKey, "MaxFileSize", 0, REG_DWORD, (BYTE*)&foo, sizeof(foo));
-
- RegSetValueExA(hKey, "FileDirectory", 0, REG_EXPAND_SZ, TRACING_DIR, sizeof(TRACING_DIR));
-
- RegCloseKey(hKey);
-#endif // TRACING
-
- return (0);
-}
-
-#else // !HOST_OS_WINDOWS
-
-bool
-WinSupport::is_rras_running()
-{
- return (false);
-}
-
-
-int
-WinSupport::restart_rras()
-{
- return (0);
-}
-
-int
-WinSupport::add_protocol_to_rras(int family)
-{
- return (0);
- UNUSED(family);
-}
-
-int
-WinSupport::add_protocol_to_registry(int family)
-{
- return (0);
- UNUSED(family);
-}
-
-#endif // HOST_OS_WINDOWS
Deleted: trunk/xorp/fea/data_plane/control_socket/windows_rras_support.hh
===================================================================
--- trunk/xorp/fea/data_plane/control_socket/windows_rras_support.hh 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/fea/data_plane/control_socket/windows_rras_support.hh 2009-12-03 21:56:33 UTC (rev 11660)
@@ -1,35 +0,0 @@
-// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
-// vim:set sts=4 ts=8:
-
-// Copyright (c) 2001-2009 XORP, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License, Version 2, June
-// 1991 as published by the Free Software Foundation. Redistribution
-// and/or modification of this program under the terms of any other
-// version of the GNU General Public License is not permitted.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
-// see the GNU General Public License, Version 2, a copy of which can be
-// found in the XORP LICENSE.gpl file.
-//
-// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
-// http://xorp.net
-
-// $XORP: xorp/fea/data_plane/control_socket/windows_rras_support.hh,v 1.5 2008/10/02 21:56:54 bms Exp $
-
-#ifndef __FEA_DATA_PLANE_CONTROL_SOCKET_WINDOWS_RRAS_SUPPORT_HH__
-#define __FEA_DATA_PLANE_CONTROL_SOCKET_WINDOWS_RRAS_SUPPORT_HH__
-
-class WinSupport {
-public:
- static bool is_rras_running();
- static int restart_rras();
- static int add_protocol_to_rras(int family);
- static int add_protocol_to_registry(int family);
-private:
-};
-
-#endif // __FEA_DATA_PLANE_CONTROL_SOCKET_WINDOWS_RRAS_SUPPORT_HH__
Deleted: trunk/xorp/fea/data_plane/control_socket/windows_rtm_pipe.cc
===================================================================
--- trunk/xorp/fea/data_plane/control_socket/windows_rtm_pipe.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/fea/data_plane/control_socket/windows_rtm_pipe.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -1,332 +0,0 @@
-// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
-// vim:set sts=4 ts=8:
-
-// Copyright (c) 2001-2009 XORP, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License, Version 2, June
-// 1991 as published by the Free Software Foundation. Redistribution
-// and/or modification of this program under the terms of any other
-// version of the GNU General Public License is not permitted.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
-// see the GNU General Public License, Version 2, a copy of which can be
-// found in the XORP LICENSE.gpl file.
-//
-// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
-// http://xorp.net
-
-
-
-#include "fea/fea_module.h"
-
-#include "libxorp/xorp.h"
-#include "libxorp/xlog.h"
-#include "libxorp/debug.h"
-#include "libxorp/utils.hh"
-
-#include <algorithm>
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#include <errno.h>
-
-#ifdef HOST_OS_WINDOWS
-#include "libxorp/win_io.h"
-#include "windows_routing_socket.h"
-#endif
-
-#include "libcomm/comm_api.h"
-#include "windows_rtm_pipe.hh"
-
-uint16_t WinRtmPipe::_instance_cnt = 0;
-pid_t WinRtmPipe::_pid = getpid();
-
-//
-// Routing Sockets communication with the kernel
-//
-
-WinRtmPipe::WinRtmPipe(EventLoop& eventloop)
- : _eventloop(eventloop),
- _seqno(0),
- _instance_no(_instance_cnt++)
-{
-
-}
-
-WinRtmPipe::~WinRtmPipe()
-{
- string error_msg;
-
- if (stop(error_msg) != XORP_OK) {
- XLOG_ERROR("Cannot stop the RTMv2 pipe: %s", error_msg.c_str());
- }
-
- XLOG_ASSERT(_ol.empty());
-}
-
-#ifndef HOST_OS_WINDOWS
-
-int
-WinRtmPipe::start(int af, string& error_msg)
-{
- UNUSED(af);
-
- error_msg = c_format("The system does not support Router Manager V2");
- XLOG_UNREACHABLE();
- return (XORP_ERROR);
-}
-
-int
-WinRtmPipe::stop(string& error_msg)
-{
- UNUSED(error_msg);
-
- return (XORP_OK);
-}
-
-ssize_t
-WinRtmPipe::write(const void* data, size_t nbytes)
-{
- return (-1);
- UNUSED(data);
- UNUSED(nbytes);
-}
-
-int
-WinRtmPipe::force_read(string& error_msg)
-{
- XLOG_UNREACHABLE();
-
- error_msg = "method not supported";
-
- return (XORP_ERROR);
-}
-
-#else // HOST_OS_WINDOWS
-
-int
-WinRtmPipe::start(int af, string& error_msg)
-{
- string pipename;
- DWORD result;
-
- if (af == AF_INET) {
- pipename = XORPRTM4_PIPENAME;
- } else if (af == AF_INET6) {
- pipename = XORPRTM6_PIPENAME;
- } else {
- error_msg = c_format("Unknown address family %d.", af);
- return (XORP_ERROR);
- }
-
- if (!WaitNamedPipeA(pipename.c_str(), NMPWAIT_USE_DEFAULT_WAIT)) {
- error_msg = c_format("No RTMv2 pipes available.");
- return (XORP_ERROR);
- }
-
- _fd = CreateFileA(pipename.c_str(), GENERIC_READ|GENERIC_WRITE,
- 0, NULL, OPEN_EXISTING, 0, NULL);
- if (!_fd.is_valid()) {
- result = GetLastError();
- error_msg = c_format("Error opening RTMv2 pipe: %s.",
- win_strerror(result));
- return (XORP_ERROR);
- }
-
- if (_eventloop.add_ioevent_cb(_fd, IOT_READ,
- callback(this, &WinRtmPipe::io_event)) == false) {
- error_msg = c_format("Failed to add RTMv2 pipe read to EventLoop");
- CloseHandle(_fd);
- _fd.clear();
- return (XORP_ERROR);
- }
- if (_eventloop.add_ioevent_cb(_fd, IOT_DISCONNECT,
- callback(this, &WinRtmPipe::io_event)) == false) {
- error_msg = c_format("Failed to add RTMv2 pipe close to EventLoop");
- CloseHandle(_fd);
- _fd.clear();
- return (XORP_ERROR);
- }
-
- return (XORP_OK);
-}
-
-int
-WinRtmPipe::stop(string& error_msg)
-{
- UNUSED(error_msg);
-
- if (_fd.is_valid()) {
- _eventloop.remove_ioevent_cb(_fd, IOT_READ);
- _eventloop.remove_ioevent_cb(_fd, IOT_DISCONNECT);
- CloseHandle(_fd);
- _fd.clear();
- }
-
- return (XORP_OK);
-}
-
-ssize_t
-WinRtmPipe::write(const void* data, size_t nbytes)
-{
- DWORD byteswritten;
- DWORD result;
-
- if (!_fd.is_valid())
- return (-1);
-
- _seqno++;
- result = WriteFile(_fd, data, nbytes, &byteswritten, NULL);
-
- return ((size_t)byteswritten);
- UNUSED(result);
-}
-
-int
-WinRtmPipe::force_read(string& error_msg)
-{
- vector<uint8_t> message;
- vector<uint8_t> buffer(ROUTING_SOCKET_BYTES);
- size_t off = 0;
- size_t last_mh_off = 0;
- DWORD nbytes;
- DWORD result;
-
- if (!_fd.is_valid())
- return (XORP_ERROR);
-
- for (;;) {
- do {
- result = PeekNamedPipe(_fd, &buffer[0], buffer.size(), NULL,
- NULL, &nbytes);
- if (result == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
- buffer.resize(buffer.size() + ROUTING_SOCKET_BYTES);
- continue;
- } else {
- break;
- }
- } while (true);
-
- result = ReadFile(_fd, &buffer[0], buffer.size(), &nbytes, NULL);
- if (result == 0) {
- result = GetLastError();
- error_msg = c_format("Rtmv2 pipe read error: %s",
- win_strerror(result));
- return (XORP_ERROR);
- }
- message.resize(message.size() + nbytes);
- memcpy(&message[off], &buffer[0], nbytes);
- off += nbytes;
-
- if ((off - last_mh_off)
- < (ssize_t)(sizeof(u_short) + 2 * sizeof(u_char))) {
- error_msg = c_format("Rtmv2 pipe read failed: "
- "message truncated: "
- "received %d bytes instead of (at least) %u "
- "bytes",
- XORP_INT_CAST(nbytes),
- XORP_UINT_CAST(sizeof(u_short) + 2 * sizeof(u_char)));
- return (XORP_ERROR);
- }
-
- //
- // Received message (probably) OK
- //
- AlignData<struct if_msghdr> align_data(message);
- const struct if_msghdr* mh = align_data.payload();
- XLOG_ASSERT(mh->ifm_msglen == message.size());
- XLOG_ASSERT(mh->ifm_msglen == nbytes);
- last_mh_off = off;
- break;
- }
- XLOG_ASSERT(last_mh_off == message.size());
-
- //
- // Notify observers
- //
- for (ObserverList::iterator i = _ol.begin(); i != _ol.end(); i++) {
- (*i)->routing_socket_data(message);
- }
-
- return (XORP_OK);
-}
-
-void
-WinRtmPipe::io_event(XorpFd fd, IoEventType type)
-{
- string error_msg;
-
- XLOG_ASSERT(fd == _fd);
-
- if (!_fd.is_valid()) {
- XLOG_ERROR("Error: io_event called when file descriptor is dead");
- error_msg = "RTMv2 pipe disconnected";
- stop(error_msg);
- }
-
- if (type == IOT_READ) {
- if (force_read(error_msg) != XORP_OK) {
- XLOG_ERROR("Error force_read() from RTMv2 pipe: %s",
- error_msg.c_str());
- }
- } else if (type == IOT_DISCONNECT) {
- error_msg = "RTMv2 pipe disconnected";
- stop(error_msg);
- } else {
- XLOG_UNREACHABLE();
- }
-}
-
-#endif // !HOST_OS_WINDOWS
-
-//
-// Observe routing sockets activity
-//
-
-struct WinRtmPipePlumber {
- typedef WinRtmPipe::ObserverList ObserverList;
-
- static void
- plumb(WinRtmPipe& r, WinRtmPipeObserver* o)
- {
- ObserverList& ol = r._ol;
- ObserverList::iterator i = find(ol.begin(), ol.end(), o);
- debug_msg("Plumbing WinRtmPipeObserver %p to WinRtmPipe%p\n",
- o, &r);
- XLOG_ASSERT(i == ol.end());
- ol.push_back(o);
- }
- static void
- unplumb(WinRtmPipe& r, WinRtmPipeObserver* o)
- {
- ObserverList& ol = r._ol;
- debug_msg("Unplumbing WinRtmPipeObserver %p from "
- "WinRtmPipe %p\n", o, &r);
- ObserverList::iterator i = find(ol.begin(), ol.end(), o);
- XLOG_ASSERT(i != ol.end());
- ol.erase(i);
- }
-};
-
-WinRtmPipeObserver::WinRtmPipeObserver(WinRtmPipe& rs)
- : _rs(rs)
-{
- WinRtmPipePlumber::plumb(rs, this);
-}
-
-WinRtmPipeObserver::~WinRtmPipeObserver()
-{
- WinRtmPipePlumber::unplumb(_rs, this);
-}
-
-WinRtmPipe&
-WinRtmPipeObserver::routing_socket()
-{
- return _rs;
-}
-
Deleted: trunk/xorp/fea/data_plane/control_socket/windows_rtm_pipe.hh
===================================================================
--- trunk/xorp/fea/data_plane/control_socket/windows_rtm_pipe.hh 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/fea/data_plane/control_socket/windows_rtm_pipe.hh 2009-12-03 21:56:33 UTC (rev 11660)
@@ -1,167 +0,0 @@
-// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
-// vim:set sts=4 ts=8:
-
-// Copyright (c) 2001-2009 XORP, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License, Version 2, June
-// 1991 as published by the Free Software Foundation. Redistribution
-// and/or modification of this program under the terms of any other
-// version of the GNU General Public License is not permitted.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
-// see the GNU General Public License, Version 2, a copy of which can be
-// found in the XORP LICENSE.gpl file.
-//
-// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
-// http://xorp.net
-
-// $XORP: xorp/fea/data_plane/control_socket/windows_rtm_pipe.hh,v 1.7 2008/10/02 21:56:54 bms Exp $
-
-#ifndef __FEA_DATA_PLANE_CONTROL_SOCKET_WINDOWS_RTM_PIPE_HH__
-#define __FEA_DATA_PLANE_CONTROL_SOCKET_WINDOWS_RTM_PIPE_HH__
-
-#include <list>
-
-#include "libxorp/eventloop.hh"
-#include "libxorp/exceptions.hh"
-
-class WinRtmPipeObserver;
-struct WinRtmPipePlumber;
-
-/**
- * WinRtmPipe class opens a routing socket and forwards data arriving
- * on the socket to WinRtmPipeObservers. The WinRtmPipe hooks itself
- * into the EventLoop and activity usually happens asynchronously.
- */
-class WinRtmPipe {
-public:
- WinRtmPipe(EventLoop& eventloop);
- ~WinRtmPipe();
-
- /**
- * Start the routing socket operation for a given address family.
- *
- * @param af the address family.
- * @param error_msg the error message (if error).
- * @return XORP_OK on success, otherwise XORP_ERROR.
- */
- int start(int af, string& error_msg);
-
- /**
- * Stop the routing socket operation.
- *
- * @param error_msg the error message (if error).
- * @return XORP_OK on success, otherwise XORP_ERROR.
- */
- int stop(string& error_msg);
-
- /**
- * Test if the routing socket is open.
- *
- * This method is needed because WinRtmPipe may fail to open
- * routing socket during startup.
- *
- * @return true if the routing socket is open, otherwise false.
- */
- bool is_open() const { return _fd.is_valid(); }
-
- /**
- * Write data to routing socket.
- *
- * This method also updates the sequence number associated with
- * this routing socket.
- *
- * @return the number of bytes which were written, or -1 if error.
- */
- ssize_t write(const void* data, size_t nbytes);
-
- /**
- * Get the sequence number for next message written into the kernel.
- *
- * The sequence number is derived from the instance number of this routing
- * socket and a 16-bit counter.
- *
- * @return the sequence number for the next message written into the
- * kernel.
- */
- uint32_t seqno() const { return (_instance_no << 16 | _seqno); }
-
- /**
- * Get the cached process identifier value.
- *
- * @return the cached process identifier value.
- */
- pid_t pid() const { return _pid; }
-
- /**
- * Force socket to read data.
- *
- * This usually is performed after writing a request that the
- * kernel will answer (e.g., after writing a route lookup).
- * Use sparingly, with caution, and at your own risk.
- *
- * @param error_msg the error message (if error).
- * @return XORP_OK on success, otherwise XORP_ERROR.
- */
- int force_read(string& error_msg);
-
-private:
- typedef list<WinRtmPipeObserver*> ObserverList;
-
- /**
- * Read data available for WinRtmPipe and invoke
- * WinRtmPipeObserver::routing_socket_data() on all observers of routing
- * socket.
- */
- void io_event(XorpFd fd, IoEventType type);
-
- WinRtmPipe& operator=(const WinRtmPipe&); // Not implemented
- WinRtmPipe(const WinRtmPipe&); // Not implemented
-
-private:
- static const size_t ROUTING_SOCKET_BYTES = 8*1024; // Initial guess at msg size
-
-private:
- EventLoop& _eventloop;
- XorpFd _fd;
- ObserverList _ol;
-
- uint16_t _seqno; // Seqno of next write()
- uint16_t _instance_no; // Instance number of this routing socket
-
- static uint16_t _instance_cnt;
- static pid_t _pid;
-
- friend class WinRtmPipePlumber; // class that hooks observers in and out
-};
-
-class WinRtmPipeObserver {
-public:
- WinRtmPipeObserver(WinRtmPipe& rs);
-
- virtual ~WinRtmPipeObserver();
-
- /**
- * Receive data from the routing socket.
- *
- * Note that this method is called asynchronously when the routing socket
- * has data to receive, therefore it should never be called directly by
- * anything else except the routing socket facility itself.
- *
- * @param buffer the buffer with the received data.
- */
- virtual void routing_socket_data(const vector<uint8_t>& buffer) = 0;
-
- /**
- * Get WinRtmPipe associated with Observer.
- */
- WinRtmPipe& routing_socket();
-
-private:
- WinRtmPipe& _rs;
-};
-
-#endif // __FEA_DATA_PLANE_CONTROL_SOCKET_WINDOWS_RTM_PIPE_HH__
Modified: trunk/xorp/fea/data_plane/fibconfig/SConscript
===================================================================
--- trunk/xorp/fea/data_plane/fibconfig/SConscript 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/fea/data_plane/fibconfig/SConscript 2009-12-03 21:56:33 UTC (rev 11660)
@@ -33,46 +33,34 @@
# C++ files
'fibconfig_entry_get_click.cc',
'fibconfig_entry_get_dummy.cc',
- 'fibconfig_entry_get_iphelper.cc',
'fibconfig_entry_get_netlink_socket.cc',
'fibconfig_entry_get_routing_socket.cc',
- 'fibconfig_entry_get_rtmv2.cc',
'fibconfig_entry_observer_dummy.cc',
- 'fibconfig_entry_observer_iphelper.cc',
'fibconfig_entry_observer_netlink_socket.cc',
'fibconfig_entry_observer_routing_socket.cc',
- 'fibconfig_entry_observer_rtmv2.cc',
'fibconfig_entry_parse_netlink_socket.cc',
'fibconfig_entry_parse_routing_socket.cc',
'fibconfig_entry_set_click.cc',
'fibconfig_entry_set_dummy.cc',
- 'fibconfig_entry_set_iphelper.cc',
'fibconfig_entry_set_netlink_socket.cc',
'fibconfig_entry_set_routing_socket.cc',
- 'fibconfig_entry_set_rtmv2.cc',
'fibconfig_forwarding_dummy.cc',
'fibconfig_forwarding_proc_linux.cc',
'fibconfig_forwarding_solaris.cc',
'fibconfig_forwarding_sysctl.cc',
- 'fibconfig_forwarding_windows.cc',
'fibconfig_table_get_click.cc',
'fibconfig_table_get_dummy.cc',
- 'fibconfig_table_get_iphelper.cc',
'fibconfig_table_get_netlink_socket.cc',
'fibconfig_table_get_sysctl.cc',
'fibconfig_table_observer_dummy.cc',
- 'fibconfig_table_observer_iphelper.cc',
'fibconfig_table_observer_netlink_socket.cc',
'fibconfig_table_observer_routing_socket.cc',
- 'fibconfig_table_observer_rtmv2.cc',
'fibconfig_table_parse_netlink_socket.cc',
'fibconfig_table_parse_routing_socket.cc',
'fibconfig_table_set_click.cc',
'fibconfig_table_set_dummy.cc',
- 'fibconfig_table_set_iphelper.cc',
'fibconfig_table_set_netlink_socket.cc',
'fibconfig_table_set_routing_socket.cc',
- 'fibconfig_table_set_rtmv2.cc',
]
if is_shared:
Deleted: trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_get_iphelper.cc
===================================================================
--- trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_get_iphelper.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_get_iphelper.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -1,343 +0,0 @@
-// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
-
-// Copyright (c) 2001-2009 XORP, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License, Version 2, June
-// 1991 as published by the Free Software Foundation. Redistribution
-// and/or modification of this program under the terms of any other
-// version of the GNU General Public License is not permitted.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
-// see the GNU General Public License, Version 2, a copy of which can be
-// found in the XORP LICENSE.gpl file.
-//
-// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
-// http://xorp.net
-
-
-
-#include "fea/fea_module.h"
-
-#include "libxorp/xorp.h"
-#include "libxorp/xlog.h"
-#include "libxorp/debug.h"
-#include "libxorp/win_io.h"
-#include "libxorp/ipvxnet.hh"
-
-#ifdef HAVE_IPHLPAPI_H
-#include <iphlpapi.h>
-#endif
-#ifdef HAVE_ROUTPROT_H
-#include <routprot.h>
-#endif
-
-#include "fea/fibconfig.hh"
-
-#include "fibconfig_entry_get_iphelper.hh"
-
-
-//
-// Get single-entry information from the unicast forwarding table.
-//
-// The mechanism to obtain the information is the IP Helper API for
-// Windows (IPHLPAPI.DLL).
-//
-
-#ifdef HOST_OS_WINDOWS
-
-FibConfigEntryGetIPHelper::FibConfigEntryGetIPHelper(FeaDataPlaneManager& fea_data_plane_manager)
- : FibConfigEntryGet(fea_data_plane_manager)
-{
-}
-
-FibConfigEntryGetIPHelper::~FibConfigEntryGetIPHelper()
-{
- string error_msg;
-
- if (stop(error_msg) != XORP_OK) {
- XLOG_ERROR("Cannot stop the IP Helper mechanism to get "
- "information about forwarding table from the underlying "
- "system: %s",
- error_msg.c_str());
- }
-}
-
-int
-FibConfigEntryGetIPHelper::start(string& error_msg)
-{
- UNUSED(error_msg);
-
- if (_is_running)
- return (XORP_OK);
-
- _is_running = true;
-
- return (XORP_OK);
-}
-
-int
-FibConfigEntryGetIPHelper::stop(string& error_msg)
-{
- UNUSED(error_msg);
-
- if (! _is_running)
- return (XORP_OK);
-
- _is_running = false;
-
- return (XORP_OK);
-}
-
-int
-FibConfigEntryGetIPHelper::lookup_route_by_dest4(const IPv4& dst, Fte4& fte)
-{
- FteX ftex(dst.af());
- int ret_value = XORP_ERROR;
-
- ret_value = lookup_route_by_dest(IPvX(dst), ftex);
-
- fte = ftex.get_fte4();
-
- return (ret_value);
-}
-
-int
-FibConfigEntryGetIPHelper::lookup_route_by_network4(const IPv4Net& dst,
- Fte4& fte)
-{
- FteX ftex(dst.af());
- int ret_value = XORP_ERROR;
-
- ret_value = lookup_route_by_network(IPvXNet(dst), ftex);
-
- fte = ftex.get_fte4();
-
- return (ret_value);
-}
-
-int
-FibConfigEntryGetIPHelper::lookup_route_by_dest6(const IPv6& dst, Fte6& fte)
-{
- FteX ftex(dst.af());
- int ret_value = XORP_ERROR;
-
- ret_value = lookup_route_by_dest(IPvX(dst), ftex);
-
- fte = ftex.get_fte6();
-
- return (ret_value);
-}
-
-int
-FibConfigEntryGetIPHelper::lookup_route_by_network6(const IPv6Net& dst,
- Fte6& fte)
-{
- FteX ftex(dst.af());
- int ret_value = XORP_ERROR;
-
- ret_value = lookup_route_by_network(IPvXNet(dst), ftex);
-
- fte = ftex.get_fte6();
-
- return (ret_value);
-}
-
-int
-FibConfigEntryGetIPHelper::lookup_route_by_dest(const IPvX& dst, FteX& fte)
-{
- // Zero the return information
- fte.zero();
-
- // Check that the family is supported
- do {
- if (dst.is_ipv4()) {
- if (! fea_data_plane_manager().have_ipv4())
- return (XORP_ERROR);
- break;
- }
- if (dst.is_ipv6()) {
- if (! fea_data_plane_manager().have_ipv6())
- return (XORP_ERROR);
- break;
- }
- break;
- } while (false);
-
- // Check that the destination address is valid
- if (! dst.is_unicast()) {
- return (XORP_ERROR);
- }
-
- switch (dst.af()) {
- case AF_INET:
- break;
-#ifdef HAVE_IPV6
- case AF_INET6:
- return (XOPRP_ERROR);
- break;
-#endif // HAVE_IPV6
- default:
- XLOG_UNREACHABLE();
- break;
- }
-
- PMIB_IPFORWARDTABLE pfwdtable;
- DWORD result, tries;
- ULONG dwSize;
-
- tries = 0;
- result = ERROR_INSUFFICIENT_BUFFER;
- dwSize = sizeof(MIB_IPFORWARDTABLE);
-
- do {
- pfwdtable = (PMIB_IPFORWARDTABLE) ((tries == 0) ?
- malloc(dwSize) : realloc(pfwdtable, dwSize));
- if (pfwdtable == NULL)
- break;
- result = GetIpForwardTable(pfwdtable, &dwSize, TRUE);
- } while ((++tries < 3) || (result == ERROR_INSUFFICIENT_BUFFER));
-
- if (result != NO_ERROR) {
- XLOG_ERROR("GetIpForwardTable(): %s\n", win_strerror(result));
- if (pfwdtable != NULL)
- free(pfwdtable);
- return (XORP_ERROR);
- }
-
- IPv4 dest;
- IPv4 nexthop;
- IPv4 mask;
- IPv4Net destnet;
- bool found;
-
- for (uint32_t i = 0; i < pfwdtable->dwNumEntries; i++) {
- // XXX: Windows can have multiple routes to the same destination.
- // Here, we only return the first match.
- if (dst.get_ipv4().addr() == pfwdtable->table[i].dwForwardDest) {
- dest.copy_in(reinterpret_cast<uint8_t*>(
- &pfwdtable->table[i].dwForwardDest));
- mask.copy_in(reinterpret_cast<uint8_t*>(
- &pfwdtable->table[i].dwForwardMask));
- destnet = IPv4Net(dest, mask.mask_len());
- nexthop.copy_in(reinterpret_cast<uint8_t*>(
- &pfwdtable->table[i].dwForwardNextHop));
-
- uint32_t ifindex = static_cast<uint32_t>(
- pfwdtable->table[i].dwForwardIfIndex);
- const IfTree& iftree = fibconfig().system_config_iftree();
- const IfTreeVif* vifp = iftree.find_vif(ifindex);
- XLOG_ASSERT(vifp != NULL);
-
- //
- // XXX: The old test for a XORP route was:
- // pfwdtable->table[i].dwForwardType == PROTO_IP_NETMGMT
- // For now, just pass true; we will deal with this better
- // once RTMv2 is supported.
- //
- fte = FteX(destnet, nexthop, vifp->ifname(), vifp->vifname(),
- 0xffff, 0xffff, true);
- found = true;
- break;
- }
- }
-
- if (! found)
- return (XORP_ERROR);
- return (XORP_OK);
-}
-
-int
-FibConfigEntryGetIPHelper::lookup_route_by_network(const IPvXNet& dst,
- FteX& fte)
-{
- // Zero the return information
- fte.zero();
-
- // Check that the family is supported
- do {
- if (dst.is_ipv4()) {
- if (! fea_data_plane_manager().have_ipv4())
- return (XORP_ERROR);
- break;
- }
- if (dst.is_ipv6()) {
- if (! fea_data_plane_manager().have_ipv6())
- return (XORP_ERROR);
- break;
- }
- break;
- } while (false);
-
- switch (dst.af()) {
- case AF_INET:
- break;
-#ifdef HAVE_IPV6
- case AF_INET6:
- return (XORP_ERROR);
- break;
-#endif // HAVE_IPV6
- default:
- XLOG_UNREACHABLE();
- break;
- }
-
- PMIB_IPFORWARDTABLE pfwdtable;
- DWORD result, tries;
- ULONG dwSize;
-
- tries = 0;
- result = ERROR_INSUFFICIENT_BUFFER;
- dwSize = sizeof(MIB_IPFORWARDTABLE);
-
- do {
- pfwdtable = (PMIB_IPFORWARDTABLE) ((tries == 0) ?
- malloc(dwSize) : realloc(pfwdtable, dwSize));
- if (pfwdtable == NULL)
- break;
- result = GetIpForwardTable(pfwdtable, &dwSize, TRUE);
- } while ((++tries < 3) || (result == ERROR_INSUFFICIENT_BUFFER));
-
- if (result != NO_ERROR) {
- XLOG_ERROR("GetIpForwardTable(): %s\n", win_strerror(result));
- if (pfwdtable != NULL)
- free(pfwdtable);
- return (XORP_ERROR);
- }
-
- IPv4Net destnet;
- IPv4 nexthop, mask, dest;
- bool found;
-
- for (unsigned int i = 0; i < pfwdtable->dwNumEntries; i++) {
- // XXX: Windows can have multiple routes to the same destination.
- // Here, we only return the first match.
- if (dst.masked_addr().get_ipv4().addr() ==
- pfwdtable->table[i].dwForwardDest) {
- dest.copy_in((uint8_t*)&(pfwdtable->table[i].dwForwardDest));
- mask.copy_in((uint8_t*)&(pfwdtable->table[i].dwForwardMask));
- destnet = IPv4Net(dest, mask.mask_len());
- nexthop.copy_in((uint8_t*)&(pfwdtable->table[i].dwForwardNextHop));
-
- uint32_t ifindex = static_cast<uint32_t>(
- pfwdtable->table[i].dwForwardIfIndex);
- const IfTree& iftree = fibconfig().system_config_iftree();
- const IfTreeVif* vifp = iftree.find_vif(ifindex);
- XLOG_ASSERT(vifp != NULL);
-
- fte = FteX(destnet, nexthop, vifp->ifname(), vifp->vifname(),
- 0xffff, 0xffff, true);
-
- found = true;
- break;
- }
- }
-
- if (! found)
- return (XORP_ERROR);
- return (XORP_OK);
-}
-
-#endif // HOST_OS_WINDOWS
Deleted: trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_get_iphelper.hh
===================================================================
--- trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_get_iphelper.hh 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_get_iphelper.hh 2009-12-03 21:56:33 UTC (rev 11660)
@@ -1,115 +0,0 @@
-// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
-
-// Copyright (c) 2001-2009 XORP, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License, Version 2, June
-// 1991 as published by the Free Software Foundation. Redistribution
-// and/or modification of this program under the terms of any other
-// version of the GNU General Public License is not permitted.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
-// see the GNU General Public License, Version 2, a copy of which can be
-// found in the XORP LICENSE.gpl file.
-//
-// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
-// http://xorp.net
-
-// $XORP: xorp/fea/data_plane/fibconfig/fibconfig_entry_get_iphelper.hh,v 1.9 2008/10/02 21:56:55 bms Exp $
-
-#ifndef __FEA_DATA_PLANE_FIBCONFIG_FIBCONFIG_ENTRY_GET_IPHELPER_HH__
-#define __FEA_DATA_PLANE_FIBCONFIG_FIBCONFIG_ENTRY_GET_IPHELPER_HH__
-
-#include "fea/fibconfig_entry_get.hh"
-
-
-class FibConfigEntryGetIPHelper : public FibConfigEntryGet {
-public:
- /**
- * Constructor.
- *
- * @param fea_data_plane_manager the corresponding data plane manager
- * (@ref FeaDataPlaneManager).
- */
- FibConfigEntryGetIPHelper(FeaDataPlaneManager& fea_data_plane_manager);
-
- /**
- * Virtual destructor.
- */
- virtual ~FibConfigEntryGetIPHelper();
-
- /**
- * Start operation.
- *
- * @param error_msg the error message (if error).
- * @return XORP_OK on success, otherwise XORP_ERROR.
- */
- virtual int start(string& error_msg);
-
- /**
- * Stop operation.
- *
- * @param error_msg the error message (if error).
- * @return XORP_OK on success, otherwise XORP_ERROR.
- */
- virtual int stop(string& error_msg);
-
- /**
- * Lookup an IPv4 route by destination address.
- *
- * @param dst host address to resolve.
- * @param fte return-by-reference forwarding table entry.
- * @return XORP_OK on success, otherwise XORP_ERROR.
- */
- virtual int lookup_route_by_dest4(const IPv4& dst, Fte4& fte);
-
- /**
- * Lookup an IPv4 route by network address.
- *
- * @param dst network address to resolve.
- * @param fte return-by-reference forwarding table entry.
- * @return XORP_OK on success, otherwise XORP_ERROR.
- */
- virtual int lookup_route_by_network4(const IPv4Net& dst, Fte4& fte);
-
- /**
- * Lookup an IPv6 route by destination address.
- *
- * @param dst host address to resolve.
- * @param fte return-by-reference forwarding table entry.
- * @return XORP_OK on success, otherwise XORP_ERROR.
- */
- virtual int lookup_route_by_dest6(const IPv6& dst, Fte6& fte);
-
- /**
- * Lookup an IPv6 route by network address.
- *
- * @param dst network address to resolve.
- * @param fte return-by-reference forwarding table entry.
- * @return XORP_OK on success, otherwise XORP_ERROR.
- */
- virtual int lookup_route_by_network6(const IPv6Net& dst, Fte6& fte);
-
-private:
- /**
- * Lookup a route by destination address.
- *
- * @param dst host address to resolve.
- * @param fte return-by-reference forwarding table entry.
- * @return XORP_OK on success, otherwise XORP_ERROR.
- */
- virtual int lookup_route_by_dest(const IPvX& dst, FteX& fte);
-
- /**
- * Lookup a route by network address.
- *
- * @param dst network address to resolve.
- * @param fte return-by-reference forwarding table entry.
- * @return XORP_OK on success, otherwise XORP_ERROR.
- */
- virtual int lookup_route_by_network(const IPvXNet& dst, FteX& fte);
-};
-
-#endif // __FEA_DATA_PLANE_FIBCONFIG_FIBCONFIG_ENTRY_GET_IPHELPER_HH__
Deleted: trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_get_rtmv2.cc
===================================================================
--- trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_get_rtmv2.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_get_rtmv2.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -1,425 +0,0 @@
-// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
-
-// Copyright (c) 2001-2009 XORP, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License, Version 2, June
-// 1991 as published by the Free Software Foundation. Redistribution
-// and/or modification of this program under the terms of any other
-// version of the GNU General Public License is not permitted.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
-// see the GNU General Public License, Version 2, a copy of which can be
-// found in the XORP LICENSE.gpl file.
-//
-// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
-// http://xorp.net
-
-
-
-#include "fea/fea_module.h"
-
-#include "libxorp/xorp.h"
-#include "libxorp/xlog.h"
-#include "libxorp/debug.h"
-#include "libxorp/ipvxnet.hh"
-
-#include "fea/fibconfig.hh"
-#ifdef HOST_OS_WINDOWS
-#include "fea/data_plane/control_socket/windows_routing_socket.h"
-#endif
-
-#include "fibconfig_entry_get_rtmv2.hh"
-
-
-//
-// Get single-entry information from the unicast forwarding table.
-//
-// The mechanism to obtain the information is Router Manager V2.
-//
-
-#ifdef HOST_OS_WINDOWS
-
-FibConfigEntryGetRtmV2::FibConfigEntryGetRtmV2(FeaDataPlaneManager& fea_data_plane_manager)
- : FibConfigEntryGet(fea_data_plane_manager)
-{
-}
-
-FibConfigEntryGetRtmV2::~FibConfigEntryGetRtmV2()
-{
-#if 0
- string error_msg;
-
- if (stop(error_msg) != XORP_OK) {
- XLOG_ERROR("Cannot stop the Router Manager V2 mechanism to get "
- "information about forwarding table from the underlying "
- "system: %s",
- error_msg.c_str());
- }
-#endif
-}
-
-int
-FibConfigEntryGetRtmV2::start(string& error_msg)
-{
-#if 0
- if (_is_running)
- return (XORP_OK);
-
- if (WinRtmPipe::start(error_msg) != XORP_OK)
- return (XORP_ERROR);
-
- _is_running = true;
-
-#endif
- return (XORP_OK);
- UNUSED(error_msg);
-}
-
-int
-FibConfigEntryGetRtmV2::stop(string& error_msg)
-{
-#if 0
- if (! _is_running)
- return (XORP_OK);
-
- if (WinRtmPipe::stop(error_msg) != XORP_OK)
- return (XORP_ERROR);
-
- _is_running = false;
-#endif
-
- return (XORP_OK);
- UNUSED(error_msg);
-}
-
-int
-FibConfigEntryGetRtmV2::lookup_route_by_dest4(const IPv4& dst, Fte4& fte)
-{
- FteX ftex(dst.af());
- int ret_value = XORP_ERROR;
-
- ret_value = lookup_route_by_dest(IPvX(dst), ftex);
-
- fte = ftex.get_fte4();
-
- return (ret_value);
-}
-
-int
-FibConfigEntryGetRtmV2::lookup_route_by_network4(const IPv4Net& dst,
- Fte4& fte)
-{
- FteX ftex(dst.af());
- int ret_value = XORP_ERROR;
-
- ret_value = lookup_route_by_network(IPvXNet(dst), ftex);
-
- fte = ftex.get_fte4();
-
- return (ret_value);
-}
-
-int
-FibConfigEntryGetRtmV2::lookup_route_by_dest6(const IPv6& dst, Fte6& fte)
-{
- FteX ftex(dst.af());
- int ret_value = XORP_ERROR;
-
- ret_value = lookup_route_by_dest(IPvX(dst), ftex);
-
- fte = ftex.get_fte6();
-
- return (ret_value);
-}
-
-int
-FibConfigEntryGetRtmV2::lookup_route_by_network6(const IPv6Net& dst,
- Fte6& fte)
-{
- FteX ftex(dst.af());
- int ret_value = XORP_ERROR;
-
- ret_value = lookup_route_by_network(IPvXNet(dst), ftex);
-
- fte = ftex.get_fte6();
-
- return (ret_value);
-}
-
-int
-FibConfigEntryGetRtmV2::lookup_route_by_dest(const IPvX& dst, FteX& fte)
-{
-#if 1
- /*
- * XXX: The RTM_GET stuff isn't supported on Windows yet.
- */
- UNUSED(dst);
- UNUSED(fte);
- return (XORP_ERROR);
-#else
- static const size_t buffer_size = sizeof(struct rt_msghdr) + 512;
- union {
- uint8_t data[buffer_size];
- struct rt_msghdr rtm;
- } buffer;
- struct rt_msghdr* rtm = &buffer.rtm;
- struct sockaddr_in* sin;
- WinRtmPipe& rs = *this;
-
- // Zero the return information
- fte.zero();
-
- // Check that the family is supported
- do {
- if (dst.is_ipv4()) {
- if (! fea_data_plane_manager().have_ipv4())
- return (XORP_ERROR);
- break;
- }
- if (dst.is_ipv6()) {
- if (! fea_data_plane_manager().have_ipv6())
- return (XORP_ERROR);
- break;
- }
- break;
- } while (false);
-
- // Check that the destination address is valid
- if (! dst.is_unicast()) {
- return (XORP_ERROR);
- }
-
- //
- // Set the request
- //
- memset(&buffer, 0, sizeof(buffer));
- switch (dst.af()) {
- case AF_INET:
- rtm->rtm_msglen = sizeof(*rtm) + sizeof(struct sockaddr_in);
- break;
-#ifdef HAVE_IPV6
- case AF_INET6:
- rtm->rtm_msglen = sizeof(*rtm) + sizeof(struct sockaddr_in6);
- break;
-#endif // HAVE_IPV6
- default:
- XLOG_UNREACHABLE();
- break;
- }
- rtm->rtm_version = RTM_VERSION;
- rtm->rtm_type = RTM_GET;
- rtm->rtm_addrs = (RTA_DST | RTA_IFP);
- rtm->rtm_flags = RTF_UP;
- rtm->rtm_pid = rs.pid();
- rtm->rtm_seq = rs.seqno();
-
- // Copy the destination address
- sin = reinterpret_cast<struct sockaddr_in*>(rtm + 1);
- dst.copy_out(*sin);
-
- //
- // Add extra space for sockaddr_dl that corresponds to the RTA_IFP flag.
- // Required if the OS is very strict in the arguments checking
- // (e.g., NetBSD).
- //
-#ifdef AF_LINK
- do {
- // Set the data-link socket
- struct sockaddr_dl* sdl;
-
- rtm->rtm_msglen += sizeof(struct sockaddr_dl);
- switch (dst.af()) {
- case AF_INET:
- sdl = ADD_POINTER(sin, sizeof(struct sockaddr_in),
- struct sockaddr_dl*);
- break;
-#ifdef HAVE_IPV6
- case AF_INET6:
- sdl = ADD_POINTER(sin, sizeof(struct sockaddr_in6),
- struct sockaddr_dl*);
- break;
-#endif // HAVE_IPV6
- default:
- XLOG_UNREACHABLE();
- break;
- }
- sdl->sdl_family = AF_LINK;
-#ifdef HAVE_STRUCT_SOCKADDR_DL_SDL_LEN
- sdl->sdl_len = sizeof(struct sockaddr_dl);
-#endif
- } while (false);
-#endif // AF_LINK
-
- if (rs.write(rtm, rtm->rtm_msglen) != rtm->rtm_msglen) {
- XLOG_ERROR("Error writing to Rtmv2 pipe: %s", strerror(errno));
- return (XORP_ERROR);
- }
-
- //
- // Force to receive data from the kernel, and then parse it
- //
- string error_msg;
- if (_rs_reader.receive_data(rs, rtm->rtm_seq, error_msg) != XORP_OK) {
- XLOG_ERROR("Error reading from Rtmv2 pipe: %s", error_msg.c_str());
- return (XORP_ERROR);
- }
- if (parse_buffer_routing_socket(fibconfig().system_config_iftree(), fte,
- _rs_reader.buffer(), FibMsg::GETS)
- != XORP_OK) {
- return (XORP_ERROR);
- }
-
- return (XORP_OK);
-#endif // 0
-}
-
-int
-FibConfigEntryGetRtmV2::lookup_route_by_network(const IPvXNet& dst, FteX& fte)
-{
-#if 1
- /*
- * XXX: The RTM_GET stuff isn't supported on Windows yet.
- */
- UNUSED(dst);
- UNUSED(fte);
- return (XORP_ERROR);
-#else
- static const size_t buffer_size = sizeof(struct rt_msghdr) + 512;
- union {
- uint8_t data[buffer_size];
- struct rt_msghdr rtm;
- } buffer;
- struct rt_msghdr* rtm = &buffer.rtm;
- struct sockaddr_in* sin;
- WinRtmPipe& rs = *this;
-
- // Zero the return information
- fte.zero();
-
- // Check that the family is supported
- do {
- if (dst.is_ipv4()) {
- if (! fea_data_plane_manager().have_ipv4())
- return (XORP_ERROR);
- break;
- }
- if (dst.is_ipv6()) {
- if (! fea_data_plane_manager().have_ipv6())
- return (XORP_ERROR);
- break;
- }
- break;
- } while (false);
-
- // Check that the destination address is valid
- if (! dst.is_unicast()) {
- return (XORP_ERROR);
- }
-
- //
- // Set the request
- //
- memset(&buffer, 0, sizeof(buffer));
- switch (dst.af()) {
- case AF_INET:
- rtm->rtm_msglen = sizeof(*rtm) + 2 * sizeof(struct sockaddr_in);
- break;
-#ifdef HAVE_IPV6
- case AF_INET6:
- rtm->rtm_msglen = sizeof(*rtm) + 2 * sizeof(struct sockaddr_in6);
- break;
-#endif // HAVE_IPV6
- default:
- XLOG_UNREACHABLE();
- break;
- }
- rtm->rtm_version = RTM_VERSION;
- rtm->rtm_type = RTM_GET;
- rtm->rtm_addrs = (RTA_DST | RTA_NETMASK | RTA_IFP);
- rtm->rtm_flags = RTF_UP;
- rtm->rtm_pid = rs.pid();
- rtm->rtm_seq = rs.seqno();
-
- // Copy the destination address
- sin = reinterpret_cast<struct sockaddr_in*>(rtm + 1);
- dst.masked_addr().copy_out(*sin);
-
- // Copy the network mask
- switch (dst.af()) {
- case AF_INET:
- sin = ADD_POINTER(sin, sizeof(struct sockaddr_in),
- struct sockaddr_in*);
- break;
-#ifdef HAVE_IPV6
- case AF_INET6:
- sin = ADD_POINTER(sin, sizeof(struct sockaddr_in6),
- struct sockaddr_in*);
- break;
-#endif // HAVE_IPV6
- default:
- XLOG_UNREACHABLE();
- break;
- }
- IPvX netmask = IPvX::make_prefix(dst.af(), dst.prefix_len());
- netmask.copy_out(*sin);
-
- //
- // Add extra space for sockaddr_dl that corresponds to the RTA_IFP flag.
- // Required if the OS is very strict in the arguments checking
- // (e.g., NetBSD).
- //
-#ifdef AF_LINK
- do {
- // Set the data-link socket
- struct sockaddr_dl* sdl;
-
- rtm->rtm_msglen += sizeof(struct sockaddr_dl);
- switch (dst.af()) {
- case AF_INET:
- sdl = ADD_POINTER(sin, sizeof(struct sockaddr_in),
- struct sockaddr_dl*);
- break;
-#ifdef HAVE_IPV6
- case AF_INET6:
- sdl = ADD_POINTER(sin, sizeof(struct sockaddr_in6),
- struct sockaddr_dl*);
- break;
-#endif // HAVE_IPV6
- default:
- XLOG_UNREACHABLE();
- break;
- }
- sdl->sdl_family = AF_LINK;
-#ifdef HAVE_STRUCT_SOCKADDR_DL_SDL_LEN
- sdl->sdl_len = sizeof(struct sockaddr_dl);
-#endif
- } while (false);
-#endif // AF_LINK
-
- if (rs.write(rtm, rtm->rtm_msglen) != rtm->rtm_msglen) {
- XLOG_ERROR("Error writing to Rtmv2 pipe: %s", strerror(errno));
- return (XORP_ERROR);
- }
-
- //
- // Force to receive data from the kernel, and then parse it
- //
- string error_msg;
- if (_rs_reader.receive_data(rs, rtm->rtm_seq, error_msg) != XORP_OK) {
- XLOG_ERROR("Error reading from Rtmv2 pipe: %s", error_msg.c_str());
- return (XORP_ERROR);
- }
- if (parse_buffer_routing_socket(fibconfig().system_config_iftree(), fte,
- _rs_reader.buffer(), FibMsg::GETS)
- != XORP_OK) {
- return (XORP_ERROR);
- }
-
- return (XORP_OK);
-#endif // 0
-}
-
-#endif // HOST_OS_WINDOWS
Deleted: trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_get_rtmv2.hh
===================================================================
--- trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_get_rtmv2.hh 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_get_rtmv2.hh 2009-12-03 21:56:33 UTC (rev 11660)
@@ -1,115 +0,0 @@
-// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
-
-// Copyright (c) 2001-2009 XORP, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License, Version 2, June
-// 1991 as published by the Free Software Foundation. Redistribution
-// and/or modification of this program under the terms of any other
-// version of the GNU General Public License is not permitted.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
-// see the GNU General Public License, Version 2, a copy of which can be
-// found in the XORP LICENSE.gpl file.
-//
-// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
-// http://xorp.net
-
-// $XORP: xorp/fea/data_plane/fibconfig/fibconfig_entry_get_rtmv2.hh,v 1.9 2008/10/02 21:56:56 bms Exp $
-
-#ifndef __FEA_DATA_PLANE_FIBCONFIG_FIBCONFIG_ENTRY_GET_RTMV2_HH__
-#define __FEA_DATA_PLANE_FIBCONFIG_FIBCONFIG_ENTRY_GET_RTMV2_HH__
-
-#include "fea/fibconfig_entry_get.hh"
-
-
-class FibConfigEntryGetRtmV2 : public FibConfigEntryGet {
-public:
- /**
- * Constructor.
- *
- * @param fea_data_plane_manager the corresponding data plane manager
- * (ref FeaDataPlaneManager).
- */
- FibConfigEntryGetRtmV2(FeaDataPlaneManager& fea_data_plane_manager);
-
- /**
- * Virtual destructor.
- */
- virtual ~FibConfigEntryGetRtmV2();
-
- /**
- * Start operation.
- *
- * @param error_msg the error message (if error).
- * @return XORP_OK on success, otherwise XORP_ERROR.
- */
- virtual int start(string& error_msg);
-
- /**
- * Stop operation.
- *
- * @param error_msg the error message (if error).
- * @return XORP_OK on success, otherwise XORP_ERROR.
- */
- virtual int stop(string& error_msg);
-
- /**
- * Lookup an IPv4 route by destination address.
- *
- * @param dst host address to resolve.
- * @param fte return-by-reference forwarding table entry.
- * @return XORP_OK on success, otherwise XORP_ERROR.
- */
- virtual int lookup_route_by_dest4(const IPv4& dst, Fte4& fte);
-
- /**
- * Lookup an IPv4 route by network address.
- *
- * @param dst network address to resolve.
- * @param fte return-by-reference forwarding table entry.
- * @return XORP_OK on success, otherwise XORP_ERROR.
- */
- virtual int lookup_route_by_network4(const IPv4Net& dst, Fte4& fte);
-
- /**
- * Lookup an IPv6 route by destination address.
- *
- * @param dst host address to resolve.
- * @param fte return-by-reference forwarding table entry.
- * @return XORP_OK on success, otherwise XORP_ERROR.
- */
- virtual int lookup_route_by_dest6(const IPv6& dst, Fte6& fte);
-
- /**
- * Lookup an IPv6 route by network address.
- *
- * @param dst network address to resolve.
- * @param fte return-by-reference forwarding table entry.
- * @return XORP_OK on success, otherwise XORP_ERROR.
- */
- virtual int lookup_route_by_network6(const IPv6Net& dst, Fte6& fte);
-
-private:
- /**
- * Lookup a route by destination address.
- *
- * @param dst host address to resolve.
- * @param fte return-by-reference forwarding table entry.
- * @return XORP_OK on success, otherwise XORP_ERROR.
- */
- virtual int lookup_route_by_dest(const IPvX& dst, FteX& fte);
-
- /**
- * Lookup a route by network address.
- *
- * @param dst network address to resolve.
- * @param fte return-by-reference forwarding table entry.
- * @return XORP_OK on success, otherwise XORP_ERROR.
- */
- virtual int lookup_route_by_network(const IPvXNet& dst, FteX& fte);
-};
-
-#endif // __FEA_DATA_PLANE_FIBCONFIG_FIBCONFIG_ENTRY_GET_RTMV2_HH__
Deleted: trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_observer_iphelper.cc
===================================================================
--- trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_observer_iphelper.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_observer_iphelper.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -1,98 +0,0 @@
-// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
-
-// Copyright (c) 2001-2009 XORP, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License, Version 2, June
-// 1991 as published by the Free Software Foundation. Redistribution
-// and/or modification of this program under the terms of any other
-// version of the GNU General Public License is not permitted.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
-// see the GNU General Public License, Version 2, a copy of which can be
-// found in the XORP LICENSE.gpl file.
-//
-// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
-// http://xorp.net
-
-
-
-#include "fea/fea_module.h"
-
-#include "libxorp/xorp.h"
-#include "libxorp/xlog.h"
-#include "libxorp/debug.h"
-
-#include "fea/fibconfig.hh"
-
-#include "fibconfig_entry_observer_iphelper.hh"
-
-
-//
-// Observe single-entry information change about the unicast forwarding table.
-//
-// E.g., if the forwarding table has changed, then the information
-// received by the observer would specify the particular entry that
-// has changed.
-//
-// The mechanism to observe the information is the IP Helper API for
-// Windows (IPHLPAPI.DLL).
-//
-
-#ifdef HOST_OS_WINDOWS
-
-FibConfigEntryObserverIPHelper::FibConfigEntryObserverIPHelper(FeaDataPlaneManager& fea_data_plane_manager)
- : FibConfigEntryObserver(fea_data_plane_manager)
-{
-}
-
-FibConfigEntryObserverIPHelper::~FibConfigEntryObserverIPHelper()
-{
- string error_msg;
-
- if (stop(error_msg) != XORP_OK) {
- XLOG_ERROR("Cannot stop the IP Helper mechanism to observe "
- "information about forwarding table from the underlying "
- "system: %s",
- error_msg.c_str());
- }
-}
-
-int
-FibConfigEntryObserverIPHelper::start(string& error_msg)
-{
- UNUSED(error_msg);
-
- if (_is_running)
- return (XORP_OK);
-
- _is_running = true;
-
- return (XORP_OK);
-}
-
-int
-FibConfigEntryObserverIPHelper::stop(string& error_msg)
-{
- UNUSED(error_msg);
-
- if (! _is_running)
- return (XORP_OK);
-
- _is_running = false;
-
- return (XORP_OK);
-}
-
-void
-FibConfigEntryObserverIPHelper::receive_data(const vector<uint8_t>& buffer)
-{
- debug_msg("called\n");
-
- // Do nothing.
- UNUSED(buffer);
-}
-
-#endif // HOST_OS_WINDOWS
Deleted: trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_observer_iphelper.hh
===================================================================
--- trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_observer_iphelper.hh 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_observer_iphelper.hh 2009-12-03 21:56:33 UTC (rev 11660)
@@ -1,67 +0,0 @@
-// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
-
-// Copyright (c) 2001-2009 XORP, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License, Version 2, June
-// 1991 as published by the Free Software Foundation. Redistribution
-// and/or modification of this program under the terms of any other
-// version of the GNU General Public License is not permitted.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
-// see the GNU General Public License, Version 2, a copy of which can be
-// found in the XORP LICENSE.gpl file.
-//
-// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
-// http://xorp.net
-
-// $XORP: xorp/fea/data_plane/fibconfig/fibconfig_entry_observer_iphelper.hh,v 1.7 2008/10/02 21:56:56 bms Exp $
-
-#ifndef __FEA_DATA_PLANE_FIBCONFIG_FIBCONFIG_ENTRY_OBSERVER_IPHELPER_HH__
-#define __FEA_DATA_PLANE_FIBCONFIG_FIBCONFIG_ENTRY_OBSERVER_IPHELPER_HH__
-
-#include "fea/fibconfig_entry_observer.hh"
-
-
-class FibConfigEntryObserverIPHelper : public FibConfigEntryObserver {
-public:
- /**
- * Constructor.
- *
- * @param fea_data_plane_manager the corresponding data plane manager
- * (@ref FeaDataPlaneManager).
- */
- FibConfigEntryObserverIPHelper(FeaDataPlaneManager& fea_data_plane_manager);
-
- /**
- * Virtual destructor.
- */
- virtual ~FibConfigEntryObserverIPHelper();
-
- /**
- * Start operation.
- *
- * @param error_msg the error message (if error).
- * @return XORP_OK on success, otherwise XORP_ERROR.
- */
- virtual int start(string& error_msg);
-
- /**
- * Stop operation.
- *
- * @param error_msg the error message (if error).
- * @return XORP_OK on success, otherwise XORP_ERROR.
- */
- virtual int stop(string& error_msg);
-
- /**
- * Receive data from the underlying system.
- *
- * @param buffer the buffer with the received data.
- */
- virtual void receive_data(const vector<uint8_t>& buffer);
-};
-
-#endif // __FEA_DATA_PLANE_FIBCONFIG_FIBCONFIG_ENTRY_OBSERVER_IPHELPER_HH__
Deleted: trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_observer_rtmv2.cc
===================================================================
--- trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_observer_rtmv2.cc 2009-12-03 20:58:44 UTC (rev 11659)
+++ trunk/xorp/fea/data_plane/fibconfig/fibconfig_entry_observer_rtmv2.cc 2009-12-03 21:56:33 UTC (rev 11660)
@@ -1,114 +0,0 @@
-// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
-
-// Copyright (c) 2001-2009 XORP, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License, Version 2, June
-// 1991 as published by the Free Software Foundation. Redistribution
-// and/or modification of this program under the terms of any other
-// version of the GNU General Public License is not permitted.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
-// see the GNU General Public License, Version 2, a copy of which can be
-// found in the XORP LICENSE.gpl file.
-//
-// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
-// http://xorp.net
-
-
-
-#include "fea/fea_module.h"
-
-#include "libxorp/xorp.h"
-#include "libxorp/xlog.h"
-#include "libxorp/debug.h"
-
-#include "fea/fibconfig.hh"
-
-#include "fibconfig_entry_observer_rtmv2.hh"
-
-
-//
-// Observe single-entry information change about the unicast forwarding table.
-//
-// E.g., if the forwarding table has changed, then the information
-// received by the observer would specify the particular entry that
-// has changed.
-//
-// The mechanism to observe the information is Router Manager V2.
-//
-
-#ifdef HOST_OS_WINDOWS
-
-FibConfigEntryObserverRtmV2::FibConfigEntryObserverRtmV2(FeaDataPlaneManager& fea_data_plane_manager)
- : FibConfigEntryObserver(fea_data_plane_manager)
-#if 0
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Xorp-cvs
mailing list