From bms_fbsd at users.sourceforge.net Tue Dec 1 10:57:45 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Tue, 01 Dec 2009 18:57:45 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11640] trunk/xorp/libxipc/tests Message-ID: Revision: 11640 http://xorp.svn.sourceforge.net/xorp/?rev=11640&view=rev Author: bms_fbsd Date: 2009-12-01 18:57:45 +0000 (Tue, 01 Dec 2009) Log Message: ----------- Teach TestReceiver to accept a FILE* from its clients, and to explicitly set it to line-buffered mode, so we can actually get output from it before we kill it in test runs. Modified Paths: -------------- trunk/xorp/libxipc/tests/test_receiver.cc trunk/xorp/libxipc/tests/test_receiver.hh trunk/xorp/libxipc/tests/test_xrl_receiver.cc trunk/xorp/libxipc/tests/test_xrl_sender.cc Modified: trunk/xorp/libxipc/tests/test_receiver.cc =================================================================== --- trunk/xorp/libxipc/tests/test_receiver.cc 2009-11-29 06:20:09 UTC (rev 11639) +++ trunk/xorp/libxipc/tests/test_receiver.cc 2009-12-01 18:57:45 UTC (rev 11640) @@ -35,17 +35,22 @@ #include "xrl/targets/test_xrls_base.hh" #include "test_receiver.hh" +#include + #define TIMEOUT_EXIT_MS 20000 using namespace SP; -TestReceiver::TestReceiver(EventLoop& eventloop, XrlRouter* xrl_router) +TestReceiver::TestReceiver(EventLoop& eventloop, XrlRouter* xrl_router, + FILE* output) : XrlTestXrlsTargetBase(xrl_router), _eventloop(eventloop), + _output(output), _received_xrls(0), _done(false), _sample(false) { + setvbuf(_output, (char *)NULL, _IOLBF, 0); } TestReceiver::~TestReceiver() @@ -68,9 +73,9 @@ TestReceiver::print_xrl_received() const { #if PRINT_DEBUG - printf("."); + fprintf(_output, "."); if (! (_received_xrls % 10000)) - printf("Received %u\n", XORP_UINT_CAST(_received_xrls)); + fprintf(_output, "Received %u\n", XORP_UINT_CAST(_received_xrls)); #endif // PRINT_DEBUG } @@ -204,12 +209,12 @@ TimeVal delta_time = _end_time - _start_time; if (_received_xrls == 0) { - printf("No XRLs received\n"); + fprintf(_output, "No XRLs received\n"); return; } if (delta_time == TimeVal::ZERO()) { - printf("Received %u XRLs; delta-time = %s secs\n", - XORP_UINT_CAST(_received_xrls), delta_time.str().c_str()); + fprintf(_output, "Received %u XRLs; delta-time = %s secs\n", + XORP_UINT_CAST(_received_xrls), delta_time.str().c_str()); return; } @@ -217,7 +222,8 @@ double speed = _received_xrls; speed /= double_time; - printf("Received %u XRLs; delta_time = %s secs; speed = %f XRLs/s\n", + fprintf(_output, + "Received %u XRLs; delta_time = %s secs; speed = %f XRLs/s\n", XORP_UINT_CAST(_received_xrls), delta_time.str().c_str(), speed); Modified: trunk/xorp/libxipc/tests/test_receiver.hh =================================================================== --- trunk/xorp/libxipc/tests/test_receiver.hh 2009-11-29 06:20:09 UTC (rev 11639) +++ trunk/xorp/libxipc/tests/test_receiver.hh 2009-12-01 18:57:45 UTC (rev 11640) @@ -26,7 +26,8 @@ class TestReceiver : public XrlTestXrlsTargetBase { public: - TestReceiver(EventLoop& eventloop, XrlRouter* xrl_router); + TestReceiver(EventLoop& eventloop, XrlRouter* xrl_router, + FILE* output); ~TestReceiver(); bool done() const; @@ -82,6 +83,7 @@ void print_statistics(); EventLoop& _eventloop; + FILE* _output; TimeVal _start_time; TimeVal _end_time; size_t _received_xrls; Modified: trunk/xorp/libxipc/tests/test_xrl_receiver.cc =================================================================== --- trunk/xorp/libxipc/tests/test_xrl_receiver.cc 2009-11-29 06:20:09 UTC (rev 11639) +++ trunk/xorp/libxipc/tests/test_xrl_receiver.cc 2009-12-01 18:57:45 UTC (rev 11640) @@ -128,7 +128,8 @@ // XrlStdRouter xrl_std_router_test_receiver(eventloop, "test_xrl_receiver", finder_hostname, finder_port); - TestReceiver test_receiver(eventloop, &xrl_std_router_test_receiver); + TestReceiver test_receiver(eventloop, &xrl_std_router_test_receiver, + stdout); wait_until_xrl_router_is_ready(eventloop, xrl_std_router_test_receiver); // Modified: trunk/xorp/libxipc/tests/test_xrl_sender.cc =================================================================== --- trunk/xorp/libxipc/tests/test_xrl_sender.cc 2009-11-29 06:20:09 UTC (rev 11639) +++ trunk/xorp/libxipc/tests/test_xrl_sender.cc 2009-12-01 18:57:45 UTC (rev 11640) @@ -688,7 +688,8 @@ finder_hostname, finder_port); test_receiver = new TestReceiver(eventloop, - xrl_std_router_test_receiver); + xrl_std_router_test_receiver, + stdout); if (g_send_method == SEND_METHOD_SINGLE) test_receiver->enable_sampler(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Tue Dec 1 10:59:12 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Tue, 01 Dec 2009 18:59:12 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11641] trunk/xorp/libxipc/xrl_pf_unix.cc Message-ID: Revision: 11641 http://xorp.svn.sourceforge.net/xorp/?rev=11641&view=rev Author: bms_fbsd Date: 2009-12-01 18:59:11 +0000 (Tue, 01 Dec 2009) Log Message: ----------- Name AF_LOCAL sockets as /var/tmp/xrl.XXXXXX. This is a more reasonable default. Although we'd prefer /var/run, this is often off-limits for processes unless they are setuid 0. Modified Paths: -------------- trunk/xorp/libxipc/xrl_pf_unix.cc Modified: trunk/xorp/libxipc/xrl_pf_unix.cc =================================================================== --- trunk/xorp/libxipc/xrl_pf_unix.cc 2009-12-01 18:57:45 UTC (rev 11640) +++ trunk/xorp/libxipc/xrl_pf_unix.cc 2009-12-01 18:59:11 UTC (rev 11641) @@ -58,7 +58,7 @@ string path; string err; - FILE* f = xorp_make_temporary_file("/tmp", "unix", path, err); + FILE* f = xorp_make_temporary_file("/var/tmp", "xrl", path, err); if (!f) xorp_throw(XrlPFConstructorError, err); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Wed Dec 2 03:11:01 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Wed, 02 Dec 2009 11:11:01 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11642] trunk/xorp/libxipc/tests/bench_ipc.sh Message-ID: Revision: 11642 http://xorp.svn.sourceforge.net/xorp/?rev=11642&view=rev Author: bms_fbsd Date: 2009-12-02 11:11:00 +0000 (Wed, 02 Dec 2009) Log Message: ----------- Rephrase a few things in here, soon we won't need to embed path names in this file. Modified Paths: -------------- trunk/xorp/libxipc/tests/bench_ipc.sh Modified: trunk/xorp/libxipc/tests/bench_ipc.sh =================================================================== --- trunk/xorp/libxipc/tests/bench_ipc.sh 2009-12-01 18:59:11 UTC (rev 11641) +++ trunk/xorp/libxipc/tests/bench_ipc.sh 2009-12-02 11:11:00 UTC (rev 11642) @@ -11,8 +11,11 @@ # Conditionally set ${srcdir} if it wasn't assigned (e.g., by `gmake check`) if [ "X${srcdir}" = "X" ] ; then srcdir=`dirname $0` ; fi -BINDIR=. +# XXX +BINDIR=/tmp/xorp/libxipc +TBINDIR=/home/bms/svn/xorp/xorp/obj/x86_64-unknown-freebsd7.2/libxipc/tests +#${BINDIR}/xorp_finder & ${BINDIR}/xorp_finder & FINDER_PID=$! @@ -29,7 +32,7 @@ echo "-------------------------------------" for i in 0 1 2 3 4 5 6 7 8 9 10 12 15 18 20 25; do - XORP_PF=${pfenv} ${BINDIR}/test_xrl_sender ${pfcmd} -n $i + XORP_PF=${pfenv} ${TBINDIR}/test_xrl_sender ${pfcmd} -n $i done | tee ${rawfile} outfile=${pfname}.dat cat ${rawfile} | awk -f ${srcdir}/bench_ipc.awk > $outfile @@ -42,5 +45,6 @@ #test_pf "inproc" "i" "-m 0 -r" #test_pf "udp" "u" "-m 0 -r" test_pf "tcp" "t" "-m 0 -r" +test_pf "local" "x" "-m 0 -r" kill ${FINDER_PID} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Wed Dec 2 03:30:16 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Wed, 02 Dec 2009 11:30:16 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11643] trunk/xorp Message-ID: Revision: 11643 http://xorp.svn.sourceforge.net/xorp/?rev=11643&view=rev Author: bms_fbsd Date: 2009-12-02 11:30:15 +0000 (Wed, 02 Dec 2009) Log Message: ----------- Expand the use of $ORIGIN in the runtime ELF linker. Do not enable it by default yet. The trick here is to always use a relative RPATH of $ORIGIN/../lib, and to mimic the installed layout in $BUILDDIR using symlinks. NOTE WELL: This change is not complete; some binaries are installed further down in the target tree, so using a globally relative path will break. This change should, however, allow you to run most binaries from within BUILDDIR without installing during development. The conditional spamming in each SConscript can be toned down if we override the behaviour of the existing SharedLibrary builder in our SConsEnvironment to use our PostActions. For now, we make the creation of the symlink explicit where needed. Modified Paths: -------------- trunk/xorp/SConstruct trunk/xorp/fea/SConscript trunk/xorp/fib2mrib/SConscript trunk/xorp/libcomm/SConscript trunk/xorp/libfeaclient/SConscript trunk/xorp/libproto/SConscript trunk/xorp/libxipc/SConscript trunk/xorp/libxipc/xrl_std_router.cc trunk/xorp/libxipc/xrl_std_router.hh trunk/xorp/libxorp/SConscript trunk/xorp/mrt/SConscript trunk/xorp/ospf/SConscript trunk/xorp/pim/SConscript trunk/xorp/policy/SConscript trunk/xorp/policy/backend/SConscript trunk/xorp/policy/common/SConscript trunk/xorp/rib/SConscript trunk/xorp/rip/SConscript trunk/xorp/static_routes/SConscript trunk/xorp/vrrp/SConscript trunk/xorp/xrl/interfaces/SConscript trunk/xorp/xrl/targets/SConscript Modified: trunk/xorp/SConstruct =================================================================== --- trunk/xorp/SConstruct 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/SConstruct 2009-12-02 11:30:15 UTC (rev 11643) @@ -203,6 +203,15 @@ SConsEnvironment.Chmod = SCons.Action.ActionFactory(os.chmod, lambda dest, mode: 'Chmod("%s", 0%o)' % (dest, mode)) +def Symlink(src, link_name): + try: + os.unlink(link_name) + except OSError: + pass + os.symlink(src, link_name) +SConsEnvironment.Symlink = SCons.Action.ActionFactory(Symlink, + lambda src, link_name: 'Symlink("%s", "%s")' % (src, link_name)) + def InstallProgram(env, dest, files, perm = 0755): if env.has_key('DESTDIR'): # NB: use simple concatenation @@ -507,26 +516,38 @@ '-DDEBUG_CALLBACKS', ]) +# +# Fixup shared library paths. # Shared libraries are installed in $exec_prefix/lib by default. # -# Experimental feature: if rtld_origin is True, the linker will -# be passed a relative RPATH. The ORIGIN flag will be enabled for all -# dynamically linked binaries, instead of hardcoding an absolute RPATH. +# If rtld_origin is True, the linker will be passed a relative RPATH. +# This allows the package itself to be relocated in the filesystem +# as a whole. # -# XXX This may not be correct for all binaries. Some binaries still -# get installed in locations other than $bindir. if env.has_key('SHAREDLIBS'): if env['rtld_origin']: - # XXX Will this pass it to the linker correctly? - # In most cases the C++ compiler is used as the link tool. - #env.PrependUnique( LINKFLAGS = [ '-Wl,-z,origin' ] ) - env.PrependUnique( LINKFLAGS = Split('-z origin') ) - rellibdir = os.path.relpath(env.Dir('$libdir').abspath, - env.Dir('$bindir').abspath) + # Build a subdirectory for holding symlinks to libraries upfront, so + # that binaries about to be built can be run from inside the BUILDDIR. + Execute(Mkdir(builddir + '/lib')) + # Tell rtld to turn on $ORIGIN processing by default. + # NOTE: GNU ld specific flag. + env.PrependUnique( LINKFLAGS = [ '-Wl,-z,origin' ] ) + # + # Now fixup the RPATH. + # FIXME This is not correct for all binaries. Some + # get installed in locations other than $bindir. + # The RPATH actually needs to get re-evaluated on each + # binary target, depending on how far down they get installed. + # + #rellibdir = os.path.relpath(env.Dir('$libdir').abspath, + # env.Dir('$bindir').abspath) + rellibdir = '../lib' env.AppendUnique(RPATH = [ env.Literal(os.path.join('\\$$ORIGIN', rellibdir)) ]) else: + # Hardcode the RPATH to our final destination. + # Developers will need to set LD_LIBRARY_PATH until they install. env.AppendUnique(RPATH = [ '$libdir', ]) Modified: trunk/xorp/fea/SConscript =================================================================== --- trunk/xorp/fea/SConscript 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/fea/SConscript 2009-12-02 11:30:15 UTC (rev 11643) @@ -151,6 +151,10 @@ libxorp_fea_srcs += libxfdp_srcs libxorp_fea = env.SharedLibrary(target = 'libxorp_fea', source = libxorp_fea_srcs) + if env['rtld_origin']: + for obj in libxorp_fea: + env.AddPostAction(libxorp_fea, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) env.Alias('install', env.InstallLibrary('$libdir', libxorp_fea)) else: Modified: trunk/xorp/fib2mrib/SConscript =================================================================== --- trunk/xorp/fib2mrib/SConscript 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/fib2mrib/SConscript 2009-12-02 11:30:15 UTC (rev 11643) @@ -72,6 +72,10 @@ target = 'libxorp_fib2mrib', source = libxorp_fib2mrib_srcs, LIBS = '') + if env['rtld_origin']: + for obj in libxorp_fib2mrib: + env.AddPostAction(libxorp_fib2mrib, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) else: libxorp_fib2mrib = env.StaticLibrary( target = 'libxorp_fib2mrib', Modified: trunk/xorp/libcomm/SConscript =================================================================== --- trunk/xorp/libcomm/SConscript 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/libcomm/SConscript 2009-12-02 11:30:15 UTC (rev 11643) @@ -38,6 +38,11 @@ if is_shared: libxorp_comm = env.SharedLibrary(target = 'libxorp_comm', source = sources) + # build symlink for resolving links whilst in BUILDDIR + if env['rtld_origin']: + for obj in libxorp_comm: + env.AddPostAction(libxorp_comm, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) else: libxorp_comm = env.StaticLibrary(target = 'libxorp_comm', source = sources) Modified: trunk/xorp/libfeaclient/SConscript =================================================================== --- trunk/xorp/libfeaclient/SConscript 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/libfeaclient/SConscript 2009-12-02 11:30:15 UTC (rev 11643) @@ -44,6 +44,10 @@ if is_shared: libxorp_fea_client = env.SharedLibrary(target = 'libxorp_fea_client', source = libxorp_fea_client_srcs) + if env['rtld_origin']: + for obj in libxorp_fea_client: + env.AddPostAction(libxorp_fea_client, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) else: libxorp_fea_client = env.StaticLibrary(target = 'libxorp_fea_client', source = libxorp_fea_client_srcs) Modified: trunk/xorp/libproto/SConscript =================================================================== --- trunk/xorp/libproto/SConscript 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/libproto/SConscript 2009-12-02 11:30:15 UTC (rev 11643) @@ -43,6 +43,10 @@ if is_shared: libxorp_proto = env.SharedLibrary(target = 'libxorp_proto', source = sources) + if env['rtld_origin']: + for obj in libxorp_proto: + env.AddPostAction(libxorp_proto, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) else: libxorp_proto = env.StaticLibrary(target = 'libxorp_proto', source = sources) Modified: trunk/xorp/libxipc/SConscript =================================================================== --- trunk/xorp/libxipc/SConscript 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/libxipc/SConscript 2009-12-02 11:30:15 UTC (rev 11643) @@ -106,6 +106,11 @@ if is_shared: libxipc = libxipc_env.SharedLibrary(target = 'libxorp_ipc', source = libxipc_sources) + # build symlink for resolving links whilst in BUILDDIR + if env['rtld_origin']: + for obj in libxipc: + env.AddPostAction(libxipc, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) env.Alias('install', env.InstallLibrary('$libdir', libxipc)) else: @@ -164,6 +169,11 @@ if is_shared: libfinder = libfinder_env.SharedLibrary(target = 'libxorp_finder', source = libfinder_sources) + # build symlink for resolving links whilst in BUILDDIR + if env['rtld_origin']: + for obj in libfinder: + env.AddPostAction(libfinder, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) env.Alias('install', env.InstallLibrary('$libdir', libfinder)) else: Modified: trunk/xorp/libxipc/xrl_std_router.cc =================================================================== --- trunk/xorp/libxipc/xrl_std_router.cc 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/libxipc/xrl_std_router.cc 2009-12-02 11:30:15 UTC (rev 11643) @@ -23,42 +23,55 @@ #include "xrl_module.h" #include "xrl_std_router.hh" -//#include "xrl_pf_inproc.hh" +//#include "xrl_pf_inproc.hh" // Inproc is deprecated. #include "xrl_pf_stcp.hh" -//#include "xrl_pf_sudp.hh" +//#include "xrl_pf_sudp.hh" // UDP is deprecated. #include "xrl_pf_unix.hh" #include "libxorp/xlog.h" + // ---------------------------------------------------------------------------- // Helper methods +#if !defined(XRL_PF) +#error "A default transport for XRL must be defined using the preprocessor." +#endif + +static const char default_pf[] = { XRL_PF, '\0' }; + XrlPFListener* XrlStdRouter::create_listener() { const char* pf = getenv("XORP_PF"); + if (pf == NULL) + pf = default_pf; - if (pf != NULL) { - switch (pf[0]) { -#if 0 + switch (pf[0]) { +#if 0 // Inproc is deprecated. case 'i': return new XrlPFInProcListener(_e, this); - +#endif + // For the benefit of bench_ipc.sh. + case 't': + return new XrlPFSTCPListener(_e, this); + break; +#if 0 // UDP is deprecated. case 'u': return new XrlPFSUDPListener(_e, this); #endif - case 'x': +#if XRL_PF != 'x' XLOG_ASSERT(_unix == NULL); +#endif return new XrlPFUNIXListener(_e, this); - default: XLOG_ERROR("Unknown PF %s\n", pf); XLOG_ASSERT(false); break; - } } - return new XrlPFSTCPListener(_e, this); + XLOG_UNREACHABLE(); + return 0; } static void @@ -125,6 +138,14 @@ { _unix = _l = NULL; + // We need to check the environment otherwise + // we get the compiled-in default. + const char* pf = getenv("XORP_PF"); + if (pf == NULL) + pf = default_pf; + if (pf[0] != 'x') + unix_socket = false; + if (unix_socket) create_unix_listener(); Modified: trunk/xorp/libxipc/xrl_std_router.hh =================================================================== --- trunk/xorp/libxipc/xrl_std_router.hh 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/libxipc/xrl_std_router.hh 2009-12-02 11:30:15 UTC (rev 11643) @@ -27,7 +27,11 @@ #include "xrl_router.hh" #include "xrl_pf.hh" +#if !defined(XRL_PF) || (XRL_PF == 'x') +#define UNIX_SOCKET_DEFAULT true +#else #define UNIX_SOCKET_DEFAULT false +#endif /** * @short Standard XRL transmission and reception point. Modified: trunk/xorp/libxorp/SConscript =================================================================== --- trunk/xorp/libxorp/SConscript 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/libxorp/SConscript 2009-12-02 11:30:15 UTC (rev 11643) @@ -81,6 +81,17 @@ if is_shared: libxorp_core = env.SharedLibrary(target = 'libxorp_core', source = libxorp_core_srcs) + # Symlink the library into builddir's copy of lib, so that + # rtld $ORIGIN references will pick it up automatically without + # relinking. This syntax looks a little weird, as it makes the + # action of building the symlink a 'PostAction' in the SCons + # dependency graph. + # We basically do this for every SharedLibrary we potentially + # need to see for binaries not yet installed from the BUILDDIR. + if env['rtld_origin']: + for obj in libxorp_core: + env.AddPostAction(libxorp_core, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) else: libxorp_core = env.StaticLibrary(target = 'libxorp_core', source = libxorp_core_srcs) Modified: trunk/xorp/mrt/SConscript =================================================================== --- trunk/xorp/mrt/SConscript 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/mrt/SConscript 2009-12-02 11:30:15 UTC (rev 11643) @@ -36,6 +36,10 @@ if is_shared: libxorp_mrt = env.SharedLibrary(target = 'libxorp_mrt', source = sources) + if env['rtld_origin']: + for obj in libxorp_mrt: + env.AddPostAction(libxorp_mrt, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) else: libxorp_mrt = env.StaticLibrary(target = 'libxorp_mrt', source = sources) Modified: trunk/xorp/ospf/SConscript =================================================================== --- trunk/xorp/ospf/SConscript 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/ospf/SConscript 2009-12-02 11:30:15 UTC (rev 11643) @@ -91,6 +91,10 @@ libxorp_ospf = env.SharedLibrary(target = 'libxorp_ospf', source = libxorp_ospf_srcs, LIBS = '') + if env['rtld_origin']: + for obj in libxorp_ospf: + env.AddPostAction(libxorp_ospf, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) else: libxorp_ospf = env.StaticLibrary(target = 'libxorp_ospf', source = libxorp_ospf_srcs, Modified: trunk/xorp/pim/SConscript =================================================================== --- trunk/xorp/pim/SConscript 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/pim/SConscript 2009-12-02 11:30:15 UTC (rev 11643) @@ -102,6 +102,10 @@ if is_shared: libxorp_pim = env.SharedLibrary(target = 'libxorp_pim', source = libxorp_pim_srcs, LIBS = '') + if env['rtld_origin']: + for obj in libxorp_pim: + env.AddPostAction(libxorp_pim, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) env.Alias('install', env.InstallLibrary('$libdir', libxorp_pim)) else: Modified: trunk/xorp/policy/SConscript =================================================================== --- trunk/xorp/policy/SConscript 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/policy/SConscript 2009-12-02 11:30:15 UTC (rev 11643) @@ -97,6 +97,10 @@ libxorp_policy = env.SharedLibrary(target = 'libxorp_policy', source = libxorp_policy_srcs, LIBS = '') + if env['rtld_origin']: + for obj in libxorp_policy: + env.AddPostAction(libxorp_policy, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) env.Alias('install', env.InstallLibrary('$libdir', libxorp_policy)) else: libxorp_policy = env.StaticLibrary(target = 'libxorp_policy', Modified: trunk/xorp/policy/backend/SConscript =================================================================== --- trunk/xorp/policy/backend/SConscript 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/policy/backend/SConscript 2009-12-02 11:30:15 UTC (rev 11643) @@ -44,6 +44,10 @@ if is_shared: libpbe = env.SharedLibrary(target = 'libxorp_policy_backend', source = libpbesrcs) + if env['rtld_origin']: + for obj in libpbe: + env.AddPostAction(libpbe, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) env.Alias('install', env.InstallLibrary('$libdir', libpbe)) else: Modified: trunk/xorp/policy/common/SConscript =================================================================== --- trunk/xorp/policy/common/SConscript 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/policy/common/SConscript 2009-12-02 11:30:15 UTC (rev 11643) @@ -45,6 +45,10 @@ libpcmsrcs += [ '../../bgp/aspath.cc' ] libpcm = env.SharedLibrary(target = 'libxorp_policy_common', source = libpcmsrcs) + if env['rtld_origin']: + for obj in libpcm: + env.AddPostAction(libpcm, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) env.Alias('install', env.InstallLibrary('$libdir', libpcm)) else: obj_aspath = env.StaticObject(target = 'aspath', Modified: trunk/xorp/rib/SConscript =================================================================== --- trunk/xorp/rib/SConscript 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/rib/SConscript 2009-12-02 11:30:15 UTC (rev 11643) @@ -102,6 +102,10 @@ libxorp_rib = env.SharedLibrary(target = 'libxorp_rib', source = libxorp_rib_srcs, LIBS = '') + if env['rtld_origin']: + for obj in libxorp_rib: + env.AddPostAction(libxorp_rib, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) else: libxorp_rib = env.StaticLibrary(target = 'libxorp_rib', source = libxorp_rib_srcs, Modified: trunk/xorp/rip/SConscript =================================================================== --- trunk/xorp/rip/SConscript 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/rip/SConscript 2009-12-02 11:30:15 UTC (rev 11643) @@ -131,9 +131,17 @@ libxorp_rip = e.SharedLibrary(target = 'libxorp_rip', source = libxorp_rip_srcs, LIBS = '') + if env['rtld_origin']: + for obj in libxorp_rip: + env.AddPostAction(libxorp_rip, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) libxorp_rip_xrl = e.SharedLibrary(target = 'libxorp_rip_xrl', source = libxorp_rip_xrl_srcs, LIBS = '') + if env['rtld_origin']: + for obj in libxorp_rip_xrl: + env.AddPostAction(libxorp_rip_xrl, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) e.Alias('install', [ e.InstallLibrary('$libdir', libxorp_rip), e.InstallLibrary('$libdir', libxorp_rip_xrl) ]) @@ -201,9 +209,17 @@ libxorp_ripng = e.SharedLibrary(target = 'libxorp_ripng', source = libxorp_rip_srcs, LIBS = '') + if env['rtld_origin']: + for obj in libxorp_ripng: + env.AddPostAction(libxorp_ripng, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) libxorp_ripngxrl = e.SharedLibrary(target = 'libxorp_ripng_xrl', source = libxorp_rip_xrl_srcs, LIBS = '') + if env['rtld_origin']: + for obj in libxorp_ripngxrl: + env.AddPostAction(libxorp_ripngxrl, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) e.Alias('install', [ e.InstallLibrary('$libdir', libxorp_ripng), e.InstallLibrary('$libdir', libxorp_ripngxrl) ]) Modified: trunk/xorp/static_routes/SConscript =================================================================== --- trunk/xorp/static_routes/SConscript 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/static_routes/SConscript 2009-12-02 11:30:15 UTC (rev 11643) @@ -75,6 +75,10 @@ target = 'libxorp_static_routes', source = libxorp_static_routes_srcs, LIBS = '') + if env['rtld_origin']: + for obj in libxorp_static_routes: + env.AddPostAction(libxorp_static_routes, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) else: libxorp_static_routes = env.StaticLibrary( target = 'libxorp_static_routes', Modified: trunk/xorp/vrrp/SConscript =================================================================== --- trunk/xorp/vrrp/SConscript 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/vrrp/SConscript 2009-12-02 11:30:15 UTC (rev 11643) @@ -72,6 +72,10 @@ libxorp_vrrp = env.SharedLibrary(target = 'libxorp_vrrp', source = libxorp_vrrp_srcs, LIBS = '') + if env['rtld_origin']: + for obj in libxorp_vrrp: + env.AddPostAction(libxorp_vrrp, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) else: libxorp_vrrp = env.StaticLibrary(target = 'libxorp_vrrp', source = libxorp_vrrp_srcs, Modified: trunk/xorp/xrl/interfaces/SConscript =================================================================== --- trunk/xorp/xrl/interfaces/SConscript 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/xrl/interfaces/SConscript 2009-12-02 11:30:15 UTC (rev 11643) @@ -105,6 +105,12 @@ if is_shared: lib = env.SharedLibrary(tgt, src) + # symlink an alias for each library when $ORIGIN is in use. + if env['rtld_origin']: + for obj in lib: + env.AddPostAction(lib, + env.Symlink(obj.abspath, + env['BUILDDIR'] + '/lib/' + str(obj))) else: lib = env.StaticLibrary(tgt, src) Modified: trunk/xorp/xrl/targets/SConscript =================================================================== --- trunk/xorp/xrl/targets/SConscript 2009-12-02 11:11:00 UTC (rev 11642) +++ trunk/xorp/xrl/targets/SConscript 2009-12-02 11:30:15 UTC (rev 11643) @@ -91,6 +91,12 @@ if is_shared: lib = env.SharedLibrary(target, source) + # symlink an alias for each library when $ORIGIN is in use. + if env['rtld_origin']: + for obj in lib: + env.AddPostAction(lib, + env.Symlink(obj.abspath, + env['BUILDDIR'] + '/lib/' + str(obj))) else: lib = env.StaticLibrary(target, source) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Wed Dec 2 06:36:05 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Wed, 02 Dec 2009 14:36:05 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11644] trunk/xorp/libxipc Message-ID: Revision: 11644 http://xorp.svn.sourceforge.net/xorp/?rev=11644&view=rev Author: bms_fbsd Date: 2009-12-02 14:36:05 +0000 (Wed, 02 Dec 2009) Log Message: ----------- Backout r11643 on XrlStdRouter committed in error. This was part of a different change set. Modified Paths: -------------- trunk/xorp/libxipc/xrl_std_router.cc trunk/xorp/libxipc/xrl_std_router.hh Modified: trunk/xorp/libxipc/xrl_std_router.cc =================================================================== --- trunk/xorp/libxipc/xrl_std_router.cc 2009-12-02 11:30:15 UTC (rev 11643) +++ trunk/xorp/libxipc/xrl_std_router.cc 2009-12-02 14:36:05 UTC (rev 11644) @@ -23,55 +23,42 @@ #include "xrl_module.h" #include "xrl_std_router.hh" -//#include "xrl_pf_inproc.hh" // Inproc is deprecated. +//#include "xrl_pf_inproc.hh" #include "xrl_pf_stcp.hh" -//#include "xrl_pf_sudp.hh" // UDP is deprecated. +//#include "xrl_pf_sudp.hh" #include "xrl_pf_unix.hh" #include "libxorp/xlog.h" - // ---------------------------------------------------------------------------- // Helper methods -#if !defined(XRL_PF) -#error "A default transport for XRL must be defined using the preprocessor." -#endif - -static const char default_pf[] = { XRL_PF, '\0' }; - XrlPFListener* XrlStdRouter::create_listener() { const char* pf = getenv("XORP_PF"); - if (pf == NULL) - pf = default_pf; - switch (pf[0]) { -#if 0 // Inproc is deprecated. + if (pf != NULL) { + switch (pf[0]) { +#if 0 case 'i': return new XrlPFInProcListener(_e, this); -#endif - // For the benefit of bench_ipc.sh. - case 't': - return new XrlPFSTCPListener(_e, this); - break; -#if 0 // UDP is deprecated. + case 'u': return new XrlPFSUDPListener(_e, this); #endif + case 'x': -#if XRL_PF != 'x' XLOG_ASSERT(_unix == NULL); -#endif return new XrlPFUNIXListener(_e, this); + default: XLOG_ERROR("Unknown PF %s\n", pf); XLOG_ASSERT(false); break; + } } - XLOG_UNREACHABLE(); - return 0; + return new XrlPFSTCPListener(_e, this); } static void @@ -138,14 +125,6 @@ { _unix = _l = NULL; - // We need to check the environment otherwise - // we get the compiled-in default. - const char* pf = getenv("XORP_PF"); - if (pf == NULL) - pf = default_pf; - if (pf[0] != 'x') - unix_socket = false; - if (unix_socket) create_unix_listener(); Modified: trunk/xorp/libxipc/xrl_std_router.hh =================================================================== --- trunk/xorp/libxipc/xrl_std_router.hh 2009-12-02 11:30:15 UTC (rev 11643) +++ trunk/xorp/libxipc/xrl_std_router.hh 2009-12-02 14:36:05 UTC (rev 11644) @@ -27,11 +27,7 @@ #include "xrl_router.hh" #include "xrl_pf.hh" -#if !defined(XRL_PF) || (XRL_PF == 'x') -#define UNIX_SOCKET_DEFAULT true -#else #define UNIX_SOCKET_DEFAULT false -#endif /** * @short Standard XRL transmission and reception point. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Wed Dec 2 23:28:51 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 07:28:51 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11645] trunk/xorp/SConstruct Message-ID: Revision: 11645 http://xorp.svn.sourceforge.net/xorp/?rev=11645&view=rev Author: bms_fbsd Date: 2009-12-03 07:28:51 +0000 (Thu, 03 Dec 2009) Log Message: ----------- Make it a bit more obvious what Symlink() is doing, during a non-quiet build. It is very easy to confuse its arguments. Modified Paths: -------------- trunk/xorp/SConstruct Modified: trunk/xorp/SConstruct =================================================================== --- trunk/xorp/SConstruct 2009-12-02 14:36:05 UTC (rev 11644) +++ trunk/xorp/SConstruct 2009-12-03 07:28:51 UTC (rev 11645) @@ -210,7 +210,7 @@ pass os.symlink(src, link_name) SConsEnvironment.Symlink = SCons.Action.ActionFactory(Symlink, - lambda src, link_name: 'Symlink("%s", "%s")' % (src, link_name)) + lambda src, link_name: 'Symlink("%s", as "%s")' % (src, link_name)) def InstallProgram(env, dest, files, perm = 0755): if env.has_key('DESTDIR'): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 06:08:07 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 14:08:07 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11646] trunk/xorp/BUGS Message-ID: Revision: 11646 http://xorp.svn.sourceforge.net/xorp/?rev=11646&view=rev Author: bms_fbsd Date: 2009-12-03 14:08:07 +0000 (Thu, 03 Dec 2009) Log Message: ----------- Update bug database URL. Modified Paths: -------------- trunk/xorp/BUGS Modified: trunk/xorp/BUGS =================================================================== --- trunk/xorp/BUGS 2009-12-03 07:28:51 UTC (rev 11645) +++ trunk/xorp/BUGS 2009-12-03 14:08:07 UTC (rev 11646) @@ -2,7 +2,7 @@ # $XORP$ # -* Please report bugs using Bugzilla: http://www.xorp.org/bugzilla/index.cgi +* Please report bugs using Trac: http://sourceforge.net/apps/trac/xorp/ * Please use the guidelines described in "How to Report Bugs Effectively" http://www.chiark.greenend.org.uk/~sgtatham/bugs.html This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 07:05:32 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 15:05:32 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11647] trunk/xorp/SConstruct Message-ID: Revision: 11647 http://xorp.svn.sourceforge.net/xorp/?rev=11647&view=rev Author: bms_fbsd Date: 2009-12-03 15:05:32 +0000 (Thu, 03 Dec 2009) Log Message: ----------- Use PathVariable() to parse the 'prefix' argument. Start defining some general directory paths, which we'll use to implement a Filesystem Hierarchy Standard (FHS) 2.3 compliant layout for the XORP package image. Implement some more symlink machinery to let developers run the binaries from the $BUILDDIR during testing, once the FHS changes are completed. Modified Paths: -------------- trunk/xorp/SConstruct Modified: trunk/xorp/SConstruct =================================================================== --- trunk/xorp/SConstruct 2009-12-03 14:08:07 UTC (rev 11646) +++ trunk/xorp/SConstruct 2009-12-03 15:05:32 UTC (rev 11647) @@ -43,8 +43,6 @@ Help(""" builddir= to specify a different build directory. Default is "obj/--". - prefix= to specify a different install directory. - Default is "/usr/local/xorp". """) import sys @@ -79,6 +77,8 @@ EnumVariable('profile', 'Build with profiling', 'no', allowed_values=('no', 'gprof', 'pprof', 'override'), map={}, ignorecase=2), + PathVariable('prefix', 'Install prefix', + '/usr/local/xorp', PathVariable.PathAccept), ) def log_args(afname): @@ -122,14 +122,6 @@ log_args(builddir + '/.scons_build_args') -prefix = ARGUMENTS.get('prefix', '/usr/local/xorp') - -print 'Build System Type: ', build -print 'Host System Type: ', host -print 'Source path: ', sourcedir -print 'Build path: ', builddir -print 'Install prefix: ', prefix - env = Environment( TOOLS = ['default', 'autotest', 'clntgen', 'tgtgen', 'TOOL_SUBST'], @@ -139,6 +131,14 @@ LIBPATH=['/usr/sfw/lib', '/opt/local/lib', '/usr/local/lib'], variables = vars) +prefix = env['prefix'] + +print 'Build System Type: ', build +print 'Host System Type: ', host +print 'Source path: ', sourcedir +print 'Build path: ', builddir +print 'Install prefix: ', prefix + env['DESTDIR'] = ARGUMENTS.get('DESTDIR', '') # Provide mechanism to override CC, CXX, etc. @@ -256,33 +256,45 @@ return obj SConsEnvironment.InstallData = InstallData -# only bindir, libdir actually used just now. -# follow freebsd hier(5) unless we've got better suggestions- -# what is equivalent ref for red hat / debian based systems? - -env['prefix'] = prefix +# +# GNU-style package paths. +# +# These are not parsed using PathVariable() above, to avoid confusion +# on the part of the user, as their default values are derived +# from 'prefix'. +# Not all of them are used at the moment. +# exec_prefix = ARGUMENTS.get('exec_prefix', '$prefix') -env['exec_prefix'] = exec_prefix -env['bindir'] = ARGUMENTS.get('bindir', '$exec_prefix/bin') env['sbindir'] = ARGUMENTS.get('sbindir', '$exec_prefix/sbin') -# TODO the routing daemons themselves should go here (never executed -# directly by users) -env['libexecdir'] = ARGUMENTS.get('libexecdir', '$exec_prefix/libexec') -# TODO put templates and .xrl files here. +env['libexecdir'] = ARGUMENTS.get('libexecdir', '$exec_prefix/lib') env['datarootdir'] = ARGUMENTS.get('datarootdir', '$prefix/share') -# TODO ? -env['datadir'] = ARGUMENTS.get('datadir', '$datarootdir') -# TODO xorp.conf goes here. +env['datadir'] = ARGUMENTS.get('datadir', '$datarootdir/xorp') env['sysconfdir'] = ARGUMENTS.get('sysconfdir', '$prefix/etc') -# TODO we don't have this state yet, and we should use /var for it. env['localstatedir'] = ARGUMENTS.get('localstatedir', '$prefix/var') -# TODO libraries clearly go here. env['libdir'] = ARGUMENTS.get('libdir', '$exec_prefix/lib') -# TODO incorporate a man page. env['mandir'] = ARGUMENTS.get('mandir', '$datarootdir/man') +# +# XORP internal package paths. +# +# These are the paths actually used to build the package image +# when installed in its destination directory. +# Most of these paths are derived from the GNU-style variables above. +# +# The image layout is intended to be FHS 2.3 compliant, for the benefit +# of 3rd party packagers and distributors. +# +env['xorp_confdir'] = '$sysconfdir' # path to xorp.conf +env['xorp_libdir'] = '$libdir/xorp/lib' # Shared libraries +env['xorp_moduledir'] = '$libdir/xorp/sbin' # Protocol modules +env['xorp_sbindir'] = '$sbindir' # End-user binaries +env['xorp_templatedir'] = '$datadir/xorp/templates' # Router Manager .tp +env['xorp_tooldir'] = '$libdir/xorp/bin' # tools/* +env['xorp_xrlsdir'] = '$datadir/xorp/xrls' # *.xrls + # XXX needed by scons xrl idl wrappers # ...and rtrmgr/util.cc +# XXX Push this down... env['XORP_SOURCEDIR'] = sourcedir env['XORP_BUILDDIR'] = builddir @@ -518,7 +530,7 @@ # # Fixup shared library paths. -# Shared libraries are installed in $exec_prefix/lib by default. +# Shared libraries are installed in $xorp_libdir by default. # # If rtld_origin is True, the linker will be passed a relative RPATH. # This allows the package itself to be relocated in the filesystem @@ -528,10 +540,16 @@ if env['rtld_origin']: # Build a subdirectory for holding symlinks to libraries upfront, so # that binaries about to be built can be run from inside the BUILDDIR. + # Build a further alias for the benefit of entities installed + # in $xorp_sbindir. Execute(Mkdir(builddir + '/lib')) + Execute(Mkdir(builddir + '/lib/xorp')) + Execute(env.Symlink(builddir + '/lib', builddir + '/lib/xorp/lib')) + # Tell rtld to turn on $ORIGIN processing by default. # NOTE: GNU ld specific flag. env.PrependUnique( LINKFLAGS = [ '-Wl,-z,origin' ] ) + # # Now fixup the RPATH. # FIXME This is not correct for all binaries. Some @@ -549,6 +567,7 @@ # Hardcode the RPATH to our final destination. # Developers will need to set LD_LIBRARY_PATH until they install. env.AppendUnique(RPATH = [ + #'$xorp_libdir', '$libdir', ]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 08:46:36 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 16:46:36 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11648] trunk/xorp Message-ID: Revision: 11648 http://xorp.svn.sourceforge.net/xorp/?rev=11648&view=rev Author: bms_fbsd Date: 2009-12-03 16:46:35 +0000 (Thu, 03 Dec 2009) Log Message: ----------- Continue implementation of FHS style package layout for XORP. With this change, binaries are now installed as follows: $prefix/sbin xorpsh, router manager and profiler $prefix/lib/xorp/bin anything in */tools/* $prefix/lib/xorp/sbin all protocol modules $prefix/lib/xorp/lib all shared libraries $prefix/share/xorp/templates templates are arch independent data $prefix/share/xorp/xrls *.xrls if debug_xrldb is enabled Fix some fallout from the last commit, where exec_prefix was set as a local in SConstruct, but not added to the SCons environmnet. Use explicit env['foo'] references, rather than relying on '$foo', to catch this sort of thing sooner in the dependent SConscripts. NOTE WELL: Trunk at this revision will NOT run, until I've finished updating the Router Manager for the FHS style paths. This should happen within the next 24 hours. If you need a working checkout from trunk, use revision 11646. Revision Links: -------------- http://xorp.svn.sourceforge.net/xorp/?rev=11646&view=rev Modified Paths: -------------- trunk/xorp/SConstruct trunk/xorp/bgp/SConscript trunk/xorp/bgp/tools/SConscript trunk/xorp/cli/SConscript trunk/xorp/cli/libtecla/SConscript trunk/xorp/cli/tools/SConscript trunk/xorp/contrib/mld6igmp_lite/SConscript trunk/xorp/contrib/olsr/SConscript trunk/xorp/etc/templates/SConscript trunk/xorp/fea/SConscript trunk/xorp/fea/data_plane/control_socket/SConscript trunk/xorp/fea/data_plane/fibconfig/SConscript trunk/xorp/fea/data_plane/firewall/SConscript trunk/xorp/fea/data_plane/ifconfig/SConscript trunk/xorp/fea/data_plane/io/SConscript trunk/xorp/fea/data_plane/managers/SConscript trunk/xorp/fea/tools/SConscript trunk/xorp/fib2mrib/SConscript trunk/xorp/libcomm/SConscript trunk/xorp/libfeaclient/SConscript trunk/xorp/libproto/SConscript trunk/xorp/libxipc/SConscript trunk/xorp/libxorp/SConscript trunk/xorp/mld6igmp/SConscript trunk/xorp/mrt/SConscript trunk/xorp/ospf/SConscript trunk/xorp/ospf/tools/SConscript trunk/xorp/pim/SConscript trunk/xorp/policy/SConscript trunk/xorp/policy/backend/SConscript trunk/xorp/policy/common/SConscript trunk/xorp/rib/SConscript trunk/xorp/rib/tools/SConscript trunk/xorp/rip/SConscript trunk/xorp/rip/tools/SConscript trunk/xorp/rtrmgr/SConscript trunk/xorp/static_routes/SConscript trunk/xorp/vrrp/SConscript trunk/xorp/xrl/interfaces/SConscript trunk/xorp/xrl/targets/SConscript Modified: trunk/xorp/SConstruct =================================================================== --- trunk/xorp/SConstruct 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/SConstruct 2009-12-03 16:46:35 UTC (rev 11648) @@ -264,7 +264,7 @@ # from 'prefix'. # Not all of them are used at the moment. # -exec_prefix = ARGUMENTS.get('exec_prefix', '$prefix') +env['exec_prefix'] = ARGUMENTS.get('exec_prefix', '$prefix') env['sbindir'] = ARGUMENTS.get('sbindir', '$exec_prefix/sbin') env['libexecdir'] = ARGUMENTS.get('libexecdir', '$exec_prefix/lib') env['datarootdir'] = ARGUMENTS.get('datarootdir', '$prefix/share') @@ -284,13 +284,13 @@ # The image layout is intended to be FHS 2.3 compliant, for the benefit # of 3rd party packagers and distributors. # -env['xorp_confdir'] = '$sysconfdir' # path to xorp.conf -env['xorp_libdir'] = '$libdir/xorp/lib' # Shared libraries -env['xorp_moduledir'] = '$libdir/xorp/sbin' # Protocol modules -env['xorp_sbindir'] = '$sbindir' # End-user binaries -env['xorp_templatedir'] = '$datadir/xorp/templates' # Router Manager .tp -env['xorp_tooldir'] = '$libdir/xorp/bin' # tools/* -env['xorp_xrlsdir'] = '$datadir/xorp/xrls' # *.xrls +env['xorp_confdir'] = env['sysconfdir'] # path to xorp.conf +env['xorp_libdir'] = env['libdir'] + '/xorp/lib' # Shared libraries +env['xorp_moduledir'] = env['libdir'] + '/xorp/sbin' # Protocol modules +env['xorp_sbindir'] = env['sbindir'] # End-user binaries +env['xorp_templatedir'] = env['datadir'] + '/templates' +env['xorp_tooldir'] = env['libdir'] + '/xorp/bin' # tools/* +env['xorp_xrlsdir'] = env['datadir'] + '/xorp/xrls' # *.xrls # XXX needed by scons xrl idl wrappers # ...and rtrmgr/util.cc Modified: trunk/xorp/bgp/SConscript =================================================================== --- trunk/xorp/bgp/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/bgp/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -150,11 +150,6 @@ ] bgp = bgp_env.Program(target = 'xorp_bgp', source = bgpsrcs) +env.Alias('install', env.InstallProgram(env['xorp_moduledir'], bgp)) -bgppath = '$bindir' -bgppath = '$exec_prefix/bgp' - -env.Alias('install', - env.InstallProgram(bgppath, bgp)) - Default(libxorp_bgp, bgp) Modified: trunk/xorp/bgp/tools/SConscript =================================================================== --- trunk/xorp/bgp/tools/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/bgp/tools/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -45,10 +45,6 @@ 'xorp_comm', ]) - -#bgptoolpath = '$bindir' -bgptoolpath = '$exec_prefix/bgp/tools' - ### print_peers ppeers_srcs = [ @@ -60,7 +56,7 @@ # don't install -for debug only #env.Alias('install', -# env.InstallProgram(bgptoolpath, ppeers)) +# env.InstallProgram(env['xorp_tooldir'], ppeers)) ### print_routes @@ -73,7 +69,7 @@ # don't install -for debug only #env.Alias('install', -# env.InstallProgram(bgptoolpath, proutes)) +# env.InstallProgram(env['xorp_tooldir'], proutes)) ### xorpsh_print_peers @@ -82,9 +78,9 @@ 'xorpsh_print_peers.cc', ] -xppeers = env.Program(target = 'xorpsh_print_peers', source = xppeers_srcs) +xppeers = env.Program(target = 'bgp_print_peers', source = xppeers_srcs) env.Alias('install', - env.InstallProgram(bgptoolpath, xppeers)) + env.InstallProgram(env['xorp_tooldir'], xppeers)) ### xorpsh_print_routes @@ -93,8 +89,7 @@ 'xorpsh_print_routes.cc', ] -xproutes = env.Program(target = 'xorpsh_print_routes', source = xproutes_srcs) -env.Alias('install', - env.InstallProgram(bgptoolpath, xproutes)) +xproutes = env.Program(target = 'bgp_print_routes', source = xproutes_srcs) +env.Alias('install', env.InstallProgram(env['xorp_tooldir'], xproutes)) Default(xppeers, xproutes) Modified: trunk/xorp/cli/SConscript =================================================================== --- trunk/xorp/cli/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/cli/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -70,7 +70,7 @@ libxorp_cli = env.SharedLibrary(target = 'libxorp_cli', source = libxorp_cli_srcs) env.Alias('install', - env.InstallLibrary('$libdir', libxorp_cli)) + env.InstallLibrary(env['xorp_libdir'], libxorp_cli)) else: libxorp_cli = env.StaticLibrary(target = 'libxorp_cli', source = libxorp_cli_srcs) Modified: trunk/xorp/cli/libtecla/SConscript =================================================================== --- trunk/xorp/cli/libtecla/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/cli/libtecla/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -70,7 +70,7 @@ if is_shared: libxorp_tecla = env.SharedLibrary('libxorp_tecla', libtecla_srcs) env.Alias('install', - env.InstallLibrary('$libdir', libxorp_tecla)) + env.InstallLibrary(env['xorp_libdir'], libxorp_tecla)) else: libxorp_tecla = env.StaticLibrary('libxorp_tecla', libtecla_srcs) Modified: trunk/xorp/cli/tools/SConscript =================================================================== --- trunk/xorp/cli/tools/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/cli/tools/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -54,16 +54,9 @@ ] cligen = env.Program(target = 'cli_generic', source = cligensrcs) +sendcli = env.Program(target = 'cli_send_processor_xrl', source = sendclisrcs) -sendcli = env.Program(target = 'send_cli_processor_xrl', source = sendclisrcs) +env.Alias('install', env.InstallProgram(env['xorp_tooldir'], cligen)) +env.Alias('install', env.InstallProgram(env['xorp_tooldir'], sendcli)) -#clitoolpath = '$bindir' -clitoolpath = '$exec_prefix/cli/tools' - -env.Alias('install', - env.InstallProgram(clitoolpath, cligen)) - -env.Alias('install', - env.InstallProgram(clitoolpath, sendcli)) - Default(cligen, sendcli) Modified: trunk/xorp/contrib/mld6igmp_lite/SConscript =================================================================== --- trunk/xorp/contrib/mld6igmp_lite/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/contrib/mld6igmp_lite/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -78,7 +78,7 @@ if is_shared: libmld6igmplite = env.SharedLibrary(target = 'libmld6igmplite', source = libmld6igmplitesrcs, LIBS = '') env.Alias('install', - env.InstallLibrary('$libdir', libmld6igmplite)) + env.InstallLibrary(env['xorp_libdir'], libmld6igmplite)) else: libmld6igmplite = env.StaticLibrary(target = 'libmld6igmplite', source = libmld6igmplitesrcs, LIBS = '') @@ -96,10 +96,10 @@ mldlite = env.Program(target = 'xorp_mld_lite', source = mldlitesrcs) env.Alias('install', - env.InstallProgram('$bindir', igmplite)) + env.InstallProgram(env['xorp_moduledir'], igmplite)) env.Alias('install', - env.InstallProgram('$bindir', mldlite)) + env.InstallProgram(env['xorp_moduledir'], mldlite)) Default(libmld6igmplite, igmplite, mldlite) Modified: trunk/xorp/contrib/olsr/SConscript =================================================================== --- trunk/xorp/contrib/olsr/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/contrib/olsr/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -91,7 +91,7 @@ if is_shared: libolsr = env.SharedLibrary(target = 'libolsr', source = libolsrsrcs, LIBS = '') env.Alias('install', - env.InstallLibrary('$libdir', libolsr)) + env.InstallLibrary(env['xorp_libdir'], libolsr)) else: libolsr = env.StaticLibrary(target = 'libolsr', source = libolsrsrcs, LIBS = '') @@ -107,7 +107,7 @@ if is_shared: libolsrxrl = env.SharedLibrary(target = 'libolsrxrl', source = libolsrxrlsrcs, LIBS = '') env.Alias('install', - env.InstallLibrary('$libdir', libolsrxrl)) + env.InstallLibrary(env['xorp_libdir'], libolsrxrl)) else: libolsrxrl = env.StaticLibrary(target = 'libolsrxrl', source = libolsrxrlsrcs, LIBS = '') @@ -121,7 +121,6 @@ # XXX not ready for prime time. -env.Alias('install', - env.InstallProgram('$bindir', olsr4)) +env.Alias('install', env.InstallProgram(env['xorp_moduledir'], olsr4)) Default(libolsr, libolsrxrl, olsr4) Modified: trunk/xorp/etc/templates/SConscript =================================================================== --- trunk/xorp/etc/templates/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/etc/templates/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -22,9 +22,6 @@ e = env.Clone() -#etctemplatepath = '$datadir' -etctemplatepath = '$exec_prefix/etc/templates' - cmds = [ 'bgp', 'fea', @@ -73,6 +70,9 @@ 'vrrp', ] -e.Alias('install', - [ e.InstallData(etctemplatepath, [c.__add__('.cmds') for c in cmds]), - e.InstallData(etctemplatepath, [t.__add__('.tp') for t in tps]) ]) +e.Alias('install', [ + e.InstallData(env['xorp_templatedir'], + [c.__add__('.cmds') for c in cmds]), + e.InstallData(env['xorp_templatedir'], + [t.__add__('.tp') for t in tps]) +]) Modified: trunk/xorp/fea/SConscript =================================================================== --- trunk/xorp/fea/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/fea/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -156,7 +156,7 @@ env.AddPostAction(libxorp_fea, env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) env.Alias('install', - env.InstallLibrary('$libdir', libxorp_fea)) + env.InstallLibrary(env['xorp_libdir'], libxorp_fea)) else: # Use an intermediate static lib to deal with some dependencies. libxfdp = env.StaticLibrary(target = 'libxorp_fea_data_plane_base', @@ -190,8 +190,7 @@ fea = env.Program(target = 'xorp_fea', source = feasrcs) -env.Alias('install', - env.InstallProgram(feapath, fea)) +env.Alias('install', env.InstallProgram(env['xorp_moduledir'], fea)) ####################### @@ -206,17 +205,14 @@ ] feadummy = env.Program(target = 'xorp_fea_dummy', source = feadummysrcs) +env.Alias('install', env.InstallProgram(env['xorp_moduledir'], feadummy)) -env.Alias('install', - env.InstallProgram(feapath, feadummy)) - ####################### -clickgen = 'xorp_fea_click_config_generator' +# XXX conditional on click support, please. +clickgen = 'fea_click_config_generator' +env.Alias('install', env.InstallScript(env['xorp_tooldir'], clickgen)) -env.Alias('install', - env.InstallScript(feapath, clickgen)) - ####################### Default(libxorp_fea, fea, feadummy) Modified: trunk/xorp/fea/data_plane/control_socket/SConscript =================================================================== --- trunk/xorp/fea/data_plane/control_socket/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/fea/data_plane/control_socket/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -43,8 +43,7 @@ if is_shared: libxcs = env.SharedLibrary(target = 'libxorp_fea_control_socket', source = sources) - env.Alias('install', - env.InstallLibrary('$libdir', libxcs)) + env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libxcs)) else: libxcs = env.StaticLibrary(target = 'libxorp_fea_control_socket', source = sources) Modified: trunk/xorp/fea/data_plane/fibconfig/SConscript =================================================================== --- trunk/xorp/fea/data_plane/fibconfig/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/fea/data_plane/fibconfig/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -78,8 +78,7 @@ if is_shared: libxfc = env.SharedLibrary(target = 'libxorp_fea_fibconfig', source = sources) - env.Alias('install', - env.InstallLibrary('$libdir', libxfc)) + env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libxfc)) else: libxfc = env.StaticLibrary(target = 'libxorp_fea_fibconfig', source = sources) Modified: trunk/xorp/fea/data_plane/firewall/SConscript =================================================================== --- trunk/xorp/fea/data_plane/firewall/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/fea/data_plane/firewall/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -44,8 +44,7 @@ if is_shared: libxfw = env.SharedLibrary(target = 'libxorp_fea_firewall', source = sources) - env.Alias('install', - env.InstallLibrary('$libdir', libxfw)) + env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libxfw)) else: libxfw = env.StaticLibrary(target = 'libxorp_fea_firewall', source = sources) Modified: trunk/xorp/fea/data_plane/ifconfig/SConscript =================================================================== --- trunk/xorp/fea/data_plane/ifconfig/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/fea/data_plane/ifconfig/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -70,12 +70,12 @@ if is_shared: libxifc = env.SharedLibrary(target = 'libxorp_fea_ifconfig', source = sources) + # XXX missing RPATH. else: libxifc = env.StaticLibrary(target = 'libxorp_fea_ifconfig', source = sources) if is_shared: - env.Alias('install', - env.InstallLibrary('$libdir', libxifc)) + env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libxifc)) Default(libxifc) Modified: trunk/xorp/fea/data_plane/io/SConscript =================================================================== --- trunk/xorp/fea/data_plane/io/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/fea/data_plane/io/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -41,8 +41,7 @@ if is_shared: libxio = env.SharedLibrary(target = 'libxorp_fea_io', source = sources) - env.Alias('install', - env.InstallLibrary('$libdir', libxio)) + env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libxio)) else: libxio = env.StaticLibrary(target = 'libxorp_fea_io', source = sources) Modified: trunk/xorp/fea/data_plane/managers/SConscript =================================================================== --- trunk/xorp/fea/data_plane/managers/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/fea/data_plane/managers/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -46,7 +46,6 @@ source = sources) if is_shared: - env.Alias('install', - env.InstallLibrary('$libdir', libxdpm)) + env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libxdpm)) Default(libxdpm) Modified: trunk/xorp/fea/tools/SConscript =================================================================== --- trunk/xorp/fea/tools/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/fea/tools/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -53,12 +53,8 @@ 'show_interfaces.cc' ] -showif = env.Program(target = 'show_interfaces', source = showifsrcs) +showif = env.Program(target = 'fea_show_interfaces', source = showifsrcs) -#showifpath = '$bindir' -showifpath = '$exec_prefix/fea/tools' +env.Alias('install', env.InstallProgram(env['xorp_tooldir'], showif)) -env.Alias('install', - env.InstallProgram(showifpath, showif)) - Default(showif) Modified: trunk/xorp/fib2mrib/SConscript =================================================================== --- trunk/xorp/fib2mrib/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/fib2mrib/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -88,14 +88,9 @@ fib2mrib = env.Program(target = 'xorp_fib2mrib', source = fib2mribsrcs) -#fib2mrib_path = '$bindir' -fib2mrib_path = '$exec_prefix/fib2mrib' +env.Alias('install', env.InstallProgram(env['xorp_moduledir'], fib2mrib)) -env.Alias('install', - env.InstallProgram(fib2mrib_path, fib2mrib)) - if is_shared: - env.Alias('install', - env.InstallLibrary('$libdir', libxorp_fib2mrib)) + env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libxorp_fib2mrib)) Default(fib2mrib) Modified: trunk/xorp/libcomm/SConscript =================================================================== --- trunk/xorp/libcomm/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/libcomm/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -47,7 +47,6 @@ libxorp_comm = env.StaticLibrary(target = 'libxorp_comm', source = sources) if is_shared: - env.Alias("install", - env.InstallLibrary('$libdir', libxorp_comm)) + env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libxorp_comm)) Default(libxorp_comm) Modified: trunk/xorp/libfeaclient/SConscript =================================================================== --- trunk/xorp/libfeaclient/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/libfeaclient/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -54,6 +54,6 @@ if is_shared: env.Alias('install', - env.InstallLibrary('$libdir', libxorp_fea_client)) + env.InstallLibrary(env['xorp_libdir'], libxorp_fea_client)) Default(libxorp_fea_client) Modified: trunk/xorp/libproto/SConscript =================================================================== --- trunk/xorp/libproto/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/libproto/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -53,6 +53,6 @@ if is_shared: env.Alias("install", - env.InstallLibrary('$libdir', libxorp_proto)) + env.InstallLibrary(env['xorp_libdir'], libxorp_proto)) Default(libxorp_proto) Modified: trunk/xorp/libxipc/SConscript =================================================================== --- trunk/xorp/libxipc/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/libxipc/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -112,7 +112,7 @@ env.AddPostAction(libxipc, env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) env.Alias('install', - env.InstallLibrary('$libdir', libxipc)) + env.InstallLibrary(env['xorp_libdir'], libxipc)) else: libxipc = libxipc_env.StaticLibrary(target = 'libxorp_ipc', source = libxipc_sources) @@ -175,7 +175,7 @@ env.AddPostAction(libfinder, env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) env.Alias('install', - env.InstallLibrary('$libdir', libfinder)) + env.InstallLibrary(env['xorp_libdir'], libfinder)) else: libfinder = libfinder_env.StaticLibrary(target = 'libxorp_finder', source = libfinder_sources) @@ -209,14 +209,7 @@ call_xrl = env.Program(target = 'call_xrl', source = [ 'call_xrl.cc']) -# new directory structure -#env.Alias('install', -# env.InstallProgram('$bindir', xorp_finder)) -# old directory structure -env.Alias('install', - env.InstallProgram('$exec_prefix/libxipc', xorp_finder)) +# XXX The finder and call_xrl binaries are now no longer installed +# by default, as they are not used in deployment. -env.Alias('install', - env.InstallProgram('$bindir', call_xrl)) - -Default(libxipc, libfinder, xorp_finder, call_xrl) +Default(libxipc, libfinder) Modified: trunk/xorp/libxorp/SConscript =================================================================== --- trunk/xorp/libxorp/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/libxorp/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -98,6 +98,6 @@ if is_shared: env.Alias('install', - env.InstallLibrary('$libdir', libxorp_core)) + env.InstallLibrary(env['xorp_libdir'], libxorp_core)) Default(libxorp_core) Modified: trunk/xorp/mld6igmp/SConscript =================================================================== --- trunk/xorp/mld6igmp/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/mld6igmp/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -76,34 +76,21 @@ libxorp_mld6igmp = env.SharedLibrary(target = 'libxorp_mld6igmp', source = libxorp_mld6igmp_srcs, LIBS = '') + # XXX missing RPATH else: libxorp_mld6igmp = env.StaticLibrary(target = 'libxorp_mld6igmp', source = libxorp_mld6igmp_srcs, LIBS = '') -igmpsrcs = [ - 'xorp_igmp.cc', - ] - +igmpsrcs = [ 'xorp_igmp.cc', ] igmp = env.Program(target = 'xorp_igmp', source = igmpsrcs) -mldsrcs = [ - 'xorp_mld.cc', - ] - +mldsrcs = [ 'xorp_mld.cc', ] mld = env.Program(target = 'xorp_mld', source = mldsrcs) -#mldpath = '$bindir' -mldpath = '$exec_prefix' + '/' + 'mld6igmp' - -env.Alias('install', - env.InstallProgram(mldpath, igmp)) - -env.Alias('install', - env.InstallProgram(mldpath, mld)) - +env.Alias('install', env.InstallProgram(env['xorp_moduledir'], igmp)) +env.Alias('install', env.InstallProgram(env['xorp_moduledir'], mld)) if is_shared: - env.Alias('install', - env.InstallLibrary('$libdir', libxorp_mld6igmp)) + env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libxorp_mld6igmp)) Default(igmp, mld) Modified: trunk/xorp/mrt/SConscript =================================================================== --- trunk/xorp/mrt/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/mrt/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -44,7 +44,6 @@ libxorp_mrt = env.StaticLibrary(target = 'libxorp_mrt', source = sources) if is_shared: - env.Alias('install', - env.InstallLibrary('$libdir', libxorp_mrt)) + env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libxorp_mrt)) Default(libxorp_mrt) Modified: trunk/xorp/ospf/SConscript =================================================================== --- trunk/xorp/ospf/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/ospf/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -100,29 +100,15 @@ source = libxorp_ospf_srcs, LIBS = '') -ospfv2srcs = [ - 'xorp_ospfv2.cc', - ] - +ospfv2srcs = [ 'xorp_ospfv2.cc', ] ospfv2 = env.Program(target = 'xorp_ospfv2', source = ospfv2srcs) -ospfv3srcs = [ - 'xorp_ospfv3.cc', - ] - +ospfv3srcs = [ 'xorp_ospfv3.cc', ] ospfv3 = env.Program(target = 'xorp_ospfv3', source = ospfv3srcs) -#ospfpath = '$bindir' -ospfpath = '$exec_prefix/ospf' - -env.Alias('install', - env.InstallProgram(ospfpath, ospfv2)) - -env.Alias('install', - env.InstallProgram(ospfpath, ospfv3)) - +env.Alias('install', env.InstallProgram(env['xorp_moduledir'], ospfv2)) +env.Alias('install', env.InstallProgram(env['xorp_moduledir'], ospfv3)) if is_shared: - env.Alias('install', - env.InstallLibrary('$libdir', libxorp_ospf)) + env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libxorp_ospf)) Default(ospfv2, ospfv3) Modified: trunk/xorp/ospf/tools/SConscript =================================================================== --- trunk/xorp/ospf/tools/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/ospf/tools/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -69,22 +69,15 @@ 'print_neighbours.cc' ] -cleardb = env.Program(target = 'clear_database', source = cleardbsrcs) +cleardb = env.Program(target = 'ospf_clear_database', + source = cleardbsrcs) +printlsas = env.Program(target = 'ospf_print_lsas', + source = printlsassrcs) +printneighbors = env.Program(target = 'ospf_print_neighbours', + source = printneighborssrcs) -printlsas = env.Program(target = 'print_lsas', source = printlsassrcs) +env.Alias('install', env.InstallProgram(env['xorp_tooldir'], cleardb)) +env.Alias('install', env.InstallProgram(env['xorp_tooldir'], printlsas)) +env.Alias('install', env.InstallProgram(env['xorp_tooldir'], printneighbors)) -printneighbors = env.Program(target = 'print_neighbours', source = printneighborssrcs) - -#ospftoolpath = '$bindir' -ospftoolpath = '$exec_prefix/ospf/tools' - -env.Alias('install', - env.InstallProgram(ospftoolpath, cleardb)) - -env.Alias('install', - env.InstallProgram(ospftoolpath, printlsas)) - -env.Alias('install', - env.InstallProgram(ospftoolpath, printneighbors)) - Default(cleardb, printlsas, printneighbors) Modified: trunk/xorp/pim/SConscript =================================================================== --- trunk/xorp/pim/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/pim/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -107,7 +107,7 @@ env.AddPostAction(libxorp_pim, env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) env.Alias('install', - env.InstallLibrary('$libdir', libxorp_pim)) + env.InstallLibrary(env['xorp_libdir'], libxorp_pim)) else: libxorp_pim = env.StaticLibrary(target = 'libxorp_pim', source = libxorp_pim_srcs, LIBS = '') @@ -124,13 +124,8 @@ pim6 = env.Program(target = 'xorp_pimsm6', source = pim6srcs) -pimpath = '$bindir' -pimpath = '$exec_prefix/pim' +env.Alias('install', env.InstallProgram(env['xorp_moduledir'], pim4)) -env.Alias('install', - env.InstallProgram(pimpath, pim4)) +env.Alias('install', env.InstallProgram(env['xorp_moduledir'], pim6)) -env.Alias('install', - env.InstallProgram(pimpath, pim6)) - Default(pim4, pim6) Modified: trunk/xorp/policy/SConscript =================================================================== --- trunk/xorp/policy/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/policy/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -101,7 +101,7 @@ for obj in libxorp_policy: env.AddPostAction(libxorp_policy, env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) - env.Alias('install', env.InstallLibrary('$libdir', libxorp_policy)) + env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libxorp_policy)) else: libxorp_policy = env.StaticLibrary(target = 'libxorp_policy', source = libxorp_policy_srcs, @@ -111,9 +111,6 @@ policysrcs = [ 'xorp_policy.cc', ] policy = env.Program(target = 'xorp_policy', source = policysrcs) -#pcpath = '$bindir' -pcpath = '$exec_prefix/policy' -env.Alias('install', - env.InstallProgram(pcpath, policy)) +env.Alias('install', env.InstallProgram(env['xorp_moduledir'], policy)) Default(libxorp_policy, policy) Modified: trunk/xorp/policy/backend/SConscript =================================================================== --- trunk/xorp/policy/backend/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/policy/backend/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -49,7 +49,7 @@ env.AddPostAction(libpbe, env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) env.Alias('install', - env.InstallLibrary('$libdir', libpbe)) + env.InstallLibrary(env['xorp_libdir'], libpbe)) else: libpbe = env.StaticLibrary(target = 'libxorp_policy_backend', source = libpbesrcs) Modified: trunk/xorp/policy/common/SConscript =================================================================== --- trunk/xorp/policy/common/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/policy/common/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -49,7 +49,7 @@ for obj in libpcm: env.AddPostAction(libpcm, env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) - env.Alias('install', env.InstallLibrary('$libdir', libpcm)) + env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libpcm)) else: obj_aspath = env.StaticObject(target = 'aspath', source = '../../bgp/aspath.cc') Modified: trunk/xorp/rib/SConscript =================================================================== --- trunk/xorp/rib/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/rib/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -117,14 +117,9 @@ rib = env.Program(target = 'xorp_rib', source = ribsrcs) -#ribpath = '$bindir' -ribpath = '$exec_prefix/rib' +env.Alias('install', env.InstallProgram(env['xorp_moduledir'], rib)) -env.Alias('install', - env.InstallProgram(ribpath, rib)) - if is_shared: - env.Alias('install', - env.InstallLibrary('$libdir', libxorp_rib)) + env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libxorp_rib)) Default(rib) Modified: trunk/xorp/rib/tools/SConscript =================================================================== --- trunk/xorp/rib/tools/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/rib/tools/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -56,17 +56,10 @@ 'show_routes.cc' ] -shdist = env.Program(target = 'show_distances', source = shdistsrcs) +shdist = env.Program(target = 'rib_show_distances', source = shdistsrcs) +shrtes = env.Program(target = 'rib_show_routes', source = shrtessrcs) -shrtes = env.Program(target = 'show_routes', source = shrtessrcs) +env.Alias('install', env.InstallProgram(env['xorp_tooldir'], shdist)) +env.Alias('install', env.InstallProgram(env['xorp_tooldir'], shrtes)) -#ribtoolpath = '$bindir' -ribtoolpath = '$exec_prefix/rib/tools' - -env.Alias('install', - env.InstallProgram(ribtoolpath, shdist)) - -env.Alias('install', - env.InstallProgram(ribtoolpath, shrtes)) - Default(shdist, shrtes) Modified: trunk/xorp/rip/SConscript =================================================================== --- trunk/xorp/rip/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/rip/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -30,10 +30,6 @@ e = env.Clone() is_shared = env.has_key('SHAREDLIBS') -# XXX -#rippath = '$bindir' -rippath = '$exec_prefix/rip' - # # NB: The same sources are used for RIP and RIPng. We use separate # scons environments with different CPPDEFINES and SHOBJPREFIXES to @@ -143,8 +139,8 @@ env.AddPostAction(libxorp_rip_xrl, env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) e.Alias('install', - [ e.InstallLibrary('$libdir', libxorp_rip), - e.InstallLibrary('$libdir', libxorp_rip_xrl) ]) + [ e.InstallLibrary(env['xorp_libdir'], libxorp_rip), + e.InstallLibrary(env['xorp_libdir'], libxorp_rip_xrl) ]) else: libxorp_rip = e.StaticLibrary(target = 'libxorp_rip', source = libxorp_rip_srcs, @@ -154,7 +150,7 @@ LIBS = '') rip = e.Program(target = 'xorp_rip', source = ripsrcs) -e.Alias('install', e.InstallProgram(rippath, rip)) +e.Alias('install', e.InstallProgram(env['xorp_moduledir'], rip)) # # RIPng @@ -221,8 +217,8 @@ env.AddPostAction(libxorp_ripngxrl, env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) e.Alias('install', - [ e.InstallLibrary('$libdir', libxorp_ripng), - e.InstallLibrary('$libdir', libxorp_ripngxrl) ]) + [ e.InstallLibrary(env['xorp_libdir'], libxorp_ripng), + e.InstallLibrary(env['xorp_libdir'], libxorp_ripngxrl) ]) else: libxorp_ripng = e.StaticLibrary(target = 'libxorp_ripng', source = libxorp_rip_srcs, @@ -232,6 +228,6 @@ LIBS = '') ripng = e.Program(target = 'xorp_ripng', source = ripngsrcs) -e.Alias('install', e.InstallProgram(rippath, ripng)) +e.Alias('install', e.InstallProgram(env['xorp_moduledir'], ripng)) Default(rip, ripng) Modified: trunk/xorp/rip/tools/SConscript =================================================================== --- trunk/xorp/rip/tools/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/rip/tools/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -56,17 +56,10 @@ 'common.cc' ] -shpeer = env.Program(target = 'show_peer_stats', source = shpeersrcs) +shpeer = env.Program(target = 'rip_show_peer_stats', source = shpeersrcs) +shstats = env.Program(target = 'rip_show_stats', source = shstatssrcs) -shstats = env.Program(target = 'show_stats', source = shstatssrcs) +env.Alias('install', env.InstallProgram(env['xorp_tooldir'], shpeer)) +env.Alias('install', env.InstallProgram(env['xorp_tooldir'], shstats)) -#riptoolpath = '$bindir' -riptoolpath = '$exec_prefix/rip/tools' - -env.Alias('install', - env.InstallProgram(riptoolpath, shpeer)) - -env.Alias('install', - env.InstallProgram(riptoolpath, shstats)) - Default(shpeer, shstats) Modified: trunk/xorp/rtrmgr/SConscript =================================================================== --- trunk/xorp/rtrmgr/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/rtrmgr/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -152,7 +152,7 @@ rtrmgr = rtrmgr_env.Program(target = 'xorp_rtrmgr', source = rtrmgr_srcs) env.Alias('install', - env.InstallProgram('$bindir', rtrmgr)) + env.InstallProgram(env['xorp_sbindir'], rtrmgr)) ### xorpsh @@ -183,7 +183,7 @@ xorpsh = xorpsh_env.Program(target = 'xorpsh', source = xorpsh_srcs) env.Alias('install', - env.InstallProgram('$bindir', xorpsh)) + env.InstallProgram(env['xorp_sbindir'], xorpsh)) ### profiler @@ -206,7 +206,7 @@ source = profiler_srcs) env.Alias('install', - env.InstallProgram('$bindir', profiler)) + env.InstallProgram(env['xorp_sbindir'], profiler)) ### Modified: trunk/xorp/static_routes/SConscript =================================================================== --- trunk/xorp/static_routes/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/static_routes/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -87,15 +87,10 @@ xorp_static_routes = env.Program(target = 'xorp_static_routes', source = xorp_static_routes_srcs) +env.Alias('install', env.InstallProgram(env['xorp_moduledir'], xorp_static_routes)) -#srpath = '$bindir' -srpath = '$exec_prefix/static_routes' - -env.Alias('install', - env.InstallProgram(srpath, xorp_static_routes)) - if is_shared: env.Alias('install', - env.InstallLibrary('$libdir', libxorp_static_routes)) + env.InstallLibrary(env['xorp_libdir'], libxorp_static_routes)) Default(xorp_static_routes) Modified: trunk/xorp/vrrp/SConscript =================================================================== --- trunk/xorp/vrrp/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/vrrp/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -86,14 +86,8 @@ xorp_vrrp = env.Program(target = 'xorp_vrrp', source = vrrpsources) -#vrrppath = '$bindir' -vrrppath = '$exec_prefix' + '/' + 'vrrp' - -env.Alias('install', - env.InstallProgram(vrrppath, xorp_vrrp)) - +env.Alias('install', env.InstallProgram(env['xorp_moduledir'], xorp_vrrp)) if is_shared: - env.Alias('install', - env.InstallLibrary('$libdir', libxorp_vrrp)) + env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libxorp_vrrp)) Default(xorp_vrrp) Modified: trunk/xorp/xrl/interfaces/SConscript =================================================================== --- trunk/xorp/xrl/interfaces/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/xrl/interfaces/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -118,6 +118,6 @@ if base[:4] != "test": if is_shared: - env.Alias('install', env.InstallLibrary('$libdir', lib)) + env.Alias('install', env.InstallLibrary(env['xorp_libdir'], lib)) Default(all_xif_libs) Modified: trunk/xorp/xrl/targets/SConscript =================================================================== --- trunk/xorp/xrl/targets/SConscript 2009-12-03 15:05:32 UTC (rev 11647) +++ trunk/xorp/xrl/targets/SConscript 2009-12-03 16:46:35 UTC (rev 11648) @@ -104,9 +104,9 @@ if base[:4] != "test": if is_shared: - env.Alias('install', env.InstallLibrary('$libdir', lib)) + env.Alias('install', env.InstallLibrary(env['xorp_libdir'], lib)) if env['debug_xrldb']: - env.Alias('install', env.InstallData(xrlspath, xrls)) + env.Alias('install', env.InstallData(env['xorp_xrlsdir'], xrls)) return lib This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 08:48:08 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 16:48:08 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11649] trunk/xorp/etc/templates Message-ID: Revision: 11649 http://xorp.svn.sourceforge.net/xorp/?rev=11649&view=rev Author: bms_fbsd Date: 2009-12-03 16:48:08 +0000 (Thu, 03 Dec 2009) Log Message: ----------- Continue implementation of FHS style package layout for XORP. Update all Router Manager command and template files to use simple paths, and catch up with the renaming of various tool binaries. Forthcoming commits will update the Router Manager to use the new locations, as well as creating symlinks inside $BUILDDIR so that developers can run binaries during testing. Modified Paths: -------------- trunk/xorp/etc/templates/bgp.cmds trunk/xorp/etc/templates/fea.cmds trunk/xorp/etc/templates/fea.tp trunk/xorp/etc/templates/fib2mrib.tp trunk/xorp/etc/templates/firewall.tp trunk/xorp/etc/templates/igmp.cmds trunk/xorp/etc/templates/igmp.tp trunk/xorp/etc/templates/interfaces.tp trunk/xorp/etc/templates/mfea.cmds trunk/xorp/etc/templates/mfea4.tp trunk/xorp/etc/templates/mfea6.cmds trunk/xorp/etc/templates/mfea6.tp trunk/xorp/etc/templates/mld.cmds trunk/xorp/etc/templates/mld.tp trunk/xorp/etc/templates/olsr4.cmds trunk/xorp/etc/templates/olsr4.tp trunk/xorp/etc/templates/ospfv2.cmds trunk/xorp/etc/templates/ospfv2.tp trunk/xorp/etc/templates/ospfv3.cmds trunk/xorp/etc/templates/ospfv3.tp trunk/xorp/etc/templates/pim.cmds trunk/xorp/etc/templates/pim6.cmds trunk/xorp/etc/templates/pimsm4.tp trunk/xorp/etc/templates/pimsm6.tp trunk/xorp/etc/templates/policy.cmds trunk/xorp/etc/templates/policy.tp trunk/xorp/etc/templates/rib.cmds trunk/xorp/etc/templates/rib.tp trunk/xorp/etc/templates/rip.cmds trunk/xorp/etc/templates/rip.tp trunk/xorp/etc/templates/ripng.cmds trunk/xorp/etc/templates/ripng.tp trunk/xorp/etc/templates/static_routes.tp trunk/xorp/etc/templates/vrrp.cmds trunk/xorp/etc/templates/vrrp.tp Modified: trunk/xorp/etc/templates/bgp.cmds =================================================================== --- trunk/xorp/etc/templates/bgp.cmds 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/bgp.cmds 2009-12-03 16:48:08 UTC (rev 11649) @@ -7,139 +7,139 @@ } show bgp peers { - %command: "bgp/tools/xorpsh_print_peers $0" %help: HELP; + %command: "bgp_print_peers $0" %help: HELP; %module: bgp; %tag: HELP "Show BGP peers info"; } show bgp peers detail { - %command: "bgp/tools/xorpsh_print_peers $0" %help: HELP; + %command: "bgp_print_peers $0" %help: HELP; %module: bgp; %tag: HELP "Show detailed BGP peers info"; } show bgp routes { - %command: "bgp/tools/xorpsh_print_routes $0" %help: HELP; + %command: "bgp_print_routes $0" %help: HELP; %module: bgp; %tag: HELP "Print BGP routes"; } show bgp routes detail { - %command: "bgp/tools/xorpsh_print_routes $0" %help: HELP; + %command: "bgp_print_routes $0" %help: HELP; %module: bgp; %tag: HELP "Print detailed BGP routes"; } show bgp routes summary { - %command: "bgp/tools/xorpsh_print_routes $0" %help: HELP; + %command: "bgp_print_routes $0" %help: HELP; %module: bgp; %tag: HELP "Print summary of BGP routes"; } show bgp routes ipv4 { - %command: "bgp/tools/xorpsh_print_routes $0" %help: HELP; + %command: "bgp_print_routes $0" %help: HELP; %module: bgp; %tag: HELP "Print BGP IPv4 routes"; } show bgp routes ipv4 detail { - %command: "bgp/tools/xorpsh_print_routes $0" %help: HELP; + %command: "bgp_print_routes $0" %help: HELP; %module: bgp; %tag: HELP "Print detailed BGP IPv4 routes"; } show bgp routes ipv4 summary { - %command: "bgp/tools/xorpsh_print_routes $0" %help: HELP; + %command: "bgp_print_routes $0" %help: HELP; %module: bgp; %tag: HELP "Print summary of BGP IPv4 routes"; } show bgp routes ipv4 unicast { - %command: "bgp/tools/xorpsh_print_routes $0" %help: HELP; + %command: "bgp_print_routes $0" %help: HELP; %module: bgp; %tag: HELP "Print BGP IPv4 unicast routes"; } show bgp routes ipv4 unicast detail { - %command: "bgp/tools/xorpsh_print_routes $0" %help: HELP; + %command: "bgp_print_routes $0" %help: HELP; %module: bgp; %tag: HELP "Print detailed BGP IPv4 unicast routes"; } show bgp routes ipv4 unicast summary { - %command: "bgp/tools/xorpsh_print_routes $0" %help: HELP; + %command: "bgp_print_routes $0" %help: HELP; %module: bgp; %tag: HELP "Print summary of BGP IPv4 unicast routes"; } show bgp routes ipv4 multicast { - %command: "bgp/tools/xorpsh_print_routes $0" %help: HELP; + %command: "bgp_print_routes $0" %help: HELP; %module: bgp; %tag: HELP "Print BGP IPv4 multicast routes"; } show bgp routes ipv4 multicast detail { - %command: "bgp/tools/xorpsh_print_routes $0" %help: HELP; + %command: "bgp_print_routes $0" %help: HELP; %module: bgp; %tag: HELP "Print detailed BGP IPv4 multicast routes"; } show bgp routes ipv4 multicast summary { - %command: "bgp/tools/xorpsh_print_routes $0" %help: HELP; + %command: "bgp_print_routes $0" %help: HELP; %module: bgp; %tag: HELP "Print summary of BGP IPv4 multicast routes"; } show bgp routes ipv6 { - %command: "bgp/tools/xorpsh_print_routes $0" %help: HELP; + %command: "bgp_print_routes $0" %help: HELP; %module: bgp; %tag: HELP "Print BGP IPv6 routes"; } show bgp routes ipv6 detail { - %command: "bgp/tools/xorpsh_print_routes $0" %help: HELP; + %command: "bgp_print_routes $0" %help: HELP; %module: bgp; %tag: HELP "Print detailed BGP IPv6 routes"; } show bgp routes ipv6 summary { - %command: "bgp/tools/xorpsh_print_routes $0" %help: HELP; + %command: "bgp_print_routes $0" %help: HELP; %module: bgp; %tag: HELP "Print summary of BGP IPv6 routes"; } show bgp routes ipv6 unicast { - %command: "bgp/tools/xorpsh_print_routes $0" %help: HELP; + %command: "bgp_print_routes $0" %help: HELP; %module: bgp; %tag: HELP "Print BGP IPv6 unicast routes"; } show bgp routes ipv6 unicast detail { - %command: "bgp/tools/xorpsh_print_routes $0" %help: HELP; + %command: "bgp_print_routes $0" %help: HELP; %module: bgp; %tag: HELP "Print detailed BGP IPv6 unicast routes"; } show bgp routes ipv6 unicast summary { - %command: "bgp/tools/xorpsh_print_routes $0" %help: HELP; + %command: "bgp_print_routes $0" %help: HELP; %module: bgp; %tag: HELP "Print summary of BGP IPv6 unicast routes"; } show bgp routes ipv6 multicast { - %command: "bgp/tools/xorpsh_print_routes $0" %help: HELP; + %command: "bgp_print_routes $0" %help: HELP; %module: bgp; %tag: HELP "Print BGP IPv6 multicast routes"; } show bgp routes ipv6 multicast detail { - %command: "bgp/tools/xorpsh_print_routes $0" %help: HELP; + %command: "bgp_print_routes $0" %help: HELP; %module: bgp; %tag: HELP "Print detailed BGP IPv6 multicast routes"; } show bgp routes ipv6 multicast summary { - %command: "bgp/tools/xorpsh_print_routes $0" %help: HELP; + %command: "bgp_print_routes $0" %help: HELP; %module: bgp; %tag: HELP "Print summary of BGP IPv6 multicast routes"; } Modified: trunk/xorp/etc/templates/fea.cmds =================================================================== --- trunk/xorp/etc/templates/fea.cmds 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/fea.cmds 2009-12-03 16:48:08 UTC (rev 11649) @@ -1,13 +1,13 @@ /* $XORP: xorp/etc/templates/fea.cmds,v 1.8 2004/05/26 04:25:08 pavlin Exp $ */ show interfaces { - %command: "fea/tools/show_interfaces" %help: HELP; + %command: "fea_show_interfaces" %help: HELP; %module: interfaces; %tag: HELP "Show network interface information"; } show interfaces $(interfaces.interface.*) { - %command: "fea/tools/show_interfaces -i $3" %help: HELP; + %command: "fea_show_interfaces -i $3" %help: HELP; %module: interfaces; %tag: HELP "Show information about a single network interface"; } Modified: trunk/xorp/etc/templates/fea.tp =================================================================== --- trunk/xorp/etc/templates/fea.tp 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/fea.tp 2009-12-03 16:48:08 UTC (rev 11649) @@ -55,7 +55,7 @@ %help: short "Configure the Forwarding Engine Abstraction"; %modinfo: provides fea; %modinfo: depends firewall; - %modinfo: path "fea/xorp_fea"; + %modinfo: path "xorp_fea"; %modinfo: default_targetname "fea"; %mandatory: $(@.targetname); Modified: trunk/xorp/etc/templates/fib2mrib.tp =================================================================== --- trunk/xorp/etc/templates/fib2mrib.tp 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/fib2mrib.tp 2009-12-03 16:48:08 UTC (rev 11649) @@ -13,7 +13,7 @@ %help: short "Configure the FIB2MRIB module"; %modinfo: provides fib2mrib; %modinfo: depends rib; - %modinfo: path "fib2mrib/xorp_fib2mrib"; + %modinfo: path "xorp_fib2mrib"; %modinfo: default_targetname "fib2mrib"; %modinfo: status_method xrl "$(fib2mrib.targetname)/common/0.1/get_status->status:u32&reason:txt"; %modinfo: shutdown_method xrl "$(fib2mrib.targetname)/common/0.1/shutdown"; Modified: trunk/xorp/etc/templates/firewall.tp =================================================================== --- trunk/xorp/etc/templates/firewall.tp 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/firewall.tp 2009-12-03 16:48:08 UTC (rev 11649) @@ -46,7 +46,7 @@ %help: short "Configure the firewall"; %modinfo: provides firewall; %modinfo: depends interfaces; - %modinfo: path "fea/xorp_fea"; + %modinfo: path "xorp_fea"; %modinfo: default_targetname "fea"; %modinfo: start_commit xrl "$(interfaces.targetname)/fea_firewall/0.1/start_transaction->tid:u32=$(firewall.TID)"; %modinfo: end_commit xrl "$(interfaces.targetname)/fea_firewall/0.1/commit_transaction?tid:u32=$(firewall.TID)"; Modified: trunk/xorp/etc/templates/igmp.cmds =================================================================== --- trunk/xorp/etc/templates/igmp.cmds 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/igmp.cmds 2009-12-03 16:48:08 UTC (rev 11649) @@ -7,19 +7,19 @@ } show igmp group { - %command: "cli/tools/send_cli_processor_xrl -t IGMP $0" %help: HELP; + %command: "cli_send_processor_xrl -t IGMP $0" %help: HELP; %module: igmp; %tag: HELP "Display information about IGMP group membership"; } show igmp interface { - %command: "cli/tools/send_cli_processor_xrl -t IGMP $0" %help: HELP; + %command: "cli_send_processor_xrl -t IGMP $0" %help: HELP; %module: igmp; %tag: HELP "Display information about IGMP interfaces"; } show igmp interface address { - %command: "cli/tools/send_cli_processor_xrl -t IGMP $0" %help: HELP; + %command: "cli_send_processor_xrl -t IGMP $0" %help: HELP; %module: igmp; %tag: HELP "Display information about addresses of IGMP interfaces"; } Modified: trunk/xorp/etc/templates/igmp.tp =================================================================== --- trunk/xorp/etc/templates/igmp.tp 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/igmp.tp 2009-12-03 16:48:08 UTC (rev 11649) @@ -35,7 +35,7 @@ %help: short "Configure the IGMP protocol"; %modinfo: provides igmp; %modinfo: depends mfea4; - %modinfo: path "mld6igmp/xorp_igmp"; + %modinfo: path "xorp_igmp"; %modinfo: default_targetname "mld6igmp"; %modinfo: status_method xrl "$(igmp.targetname)/common/0.1/get_status->status:u32&reason:txt"; %modinfo: startup_method xrl "$(igmp.targetname)/mld6igmp/0.1/start_mld6igmp"; Modified: trunk/xorp/etc/templates/interfaces.tp =================================================================== --- trunk/xorp/etc/templates/interfaces.tp 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/interfaces.tp 2009-12-03 16:48:08 UTC (rev 11649) @@ -49,7 +49,7 @@ interfaces { %help: short "Configure network interfaces"; %modinfo: provides interfaces; - %modinfo: path "fea/xorp_fea"; + %modinfo: path "xorp_fea"; %modinfo: default_targetname "fea"; %modinfo: status_method xrl "$(interfaces.targetname)/common/0.1/get_status->status:u32&reason:txt"; %modinfo: shutdown_method xrl "$(interfaces.targetname)/common/0.1/shutdown"; Modified: trunk/xorp/etc/templates/mfea.cmds =================================================================== --- trunk/xorp/etc/templates/mfea.cmds 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/mfea.cmds 2009-12-03 16:48:08 UTC (rev 11649) @@ -7,19 +7,19 @@ } show mfea dataflow { - %command: "cli/tools/send_cli_processor_xrl -t MFEA_4 $0" %help: HELP; + %command: "cli_send_processor_xrl -t MFEA_4 $0" %help: HELP; %module: mfea4; %tag: HELP "Display information about MFEA IPv4 dataflow filters"; } show mfea interface { - %command: "cli/tools/send_cli_processor_xrl -t MFEA_4 $0" %help: HELP; + %command: "cli_send_processor_xrl -t MFEA_4 $0" %help: HELP; %module: mfea4; %tag: HELP "Display information about MFEA IPv4 interfaces"; } show mfea interface address { - %command: "cli/tools/send_cli_processor_xrl -t MFEA_4 $0" %help: HELP; + %command: "cli_send_processor_xrl -t MFEA_4 $0" %help: HELP; %module: mfea4; %tag: HELP "Display information about addresses of MFEA IPv4 interfaces"; } @@ -28,7 +28,7 @@ * Commented-out, because when we run everything through the rtrmgr, * the MFEA is not used to get the routes from the kernel. show mfea mrib { - %command: "cli/tools/send_cli_processor_xrl -t MFEA_4 $0" %help: HELP; + %command: "cli_send_processor_xrl -t MFEA_4 $0" %help: HELP; %module: mfea4; %tag: HELP "Display MRIB IPv4 information inside MFEA"; } Modified: trunk/xorp/etc/templates/mfea4.tp =================================================================== --- trunk/xorp/etc/templates/mfea4.tp 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/mfea4.tp 2009-12-03 16:48:08 UTC (rev 11649) @@ -29,7 +29,7 @@ %help: short "Configure the IPv4 Multicast Forwarding Engine Abstraction"; %modinfo: provides mfea4; %modinfo: depends fea; - %modinfo: path "fea/xorp_fea"; + %modinfo: path "xorp_fea"; %modinfo: default_targetname "mfea"; %modinfo: status_method xrl "$(mfea4.targetname)/common/0.1/get_status->status:u32&reason:txt"; %modinfo: startup_method xrl "$(mfea4.targetname)/mfea/0.1/start_mfea"; Modified: trunk/xorp/etc/templates/mfea6.cmds =================================================================== --- trunk/xorp/etc/templates/mfea6.cmds 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/mfea6.cmds 2009-12-03 16:48:08 UTC (rev 11649) @@ -7,19 +7,19 @@ } show mfea6 dataflow { - %command: "cli/tools/send_cli_processor_xrl -t MFEA_6 $0" %help: HELP; + %command: "cli_send_processor_xrl -t MFEA_6 $0" %help: HELP; %module: mfea6; %tag: HELP "Display information about MFEA IPv6 dataflow filters"; } show mfea6 interface { - %command: "cli/tools/send_cli_processor_xrl -t MFEA_6 $0" %help: HELP; + %command: "cli_send_processor_xrl -t MFEA_6 $0" %help: HELP; %module: mfea6; %tag: HELP "Display information about MFEA IPv6 interfaces"; } show mfea6 interface address { - %command: "cli/tools/send_cli_processor_xrl -t MFEA_6 $0" %help: HELP; + %command: "cli_send_processor_xrl -t MFEA_6 $0" %help: HELP; %module: mfea6; %tag: HELP "Display information about addresses of MFEA IPv6 interfaces"; } @@ -28,7 +28,7 @@ * Commented-out, because when we run everything through the rtrmgr, * the MFEA is not used to get the routes from the kernel. show mfea6 mrib { - %command: "cli/tools/send_cli_processor_xrl -t MFEA_6 $0" %help: HELP; + %command: "cli_send_processor_xrl -t MFEA_6 $0" %help: HELP; %module: mfea6; %tag: HELP "Display MRIB IPv6 information inside MFEA"; } Modified: trunk/xorp/etc/templates/mfea6.tp =================================================================== --- trunk/xorp/etc/templates/mfea6.tp 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/mfea6.tp 2009-12-03 16:48:08 UTC (rev 11649) @@ -29,7 +29,7 @@ %help: short "Configure the IPv6 Multicast Forwarding Engine Abstraction"; %modinfo: provides mfea6; %modinfo: depends fea; - %modinfo: path "fea/xorp_fea"; + %modinfo: path "xorp_fea"; %modinfo: default_targetname "mfea"; %modinfo: status_method xrl "$(mfea6.targetname)/common/0.1/get_status->status:u32&reason:txt"; %modinfo: startup_method xrl "$(mfea6.targetname)/mfea/0.1/start_mfea"; Modified: trunk/xorp/etc/templates/mld.cmds =================================================================== --- trunk/xorp/etc/templates/mld.cmds 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/mld.cmds 2009-12-03 16:48:08 UTC (rev 11649) @@ -7,19 +7,19 @@ } show mld group { - %command: "cli/tools/send_cli_processor_xrl -t MLD $0" %help: HELP; + %command: "cli_send_processor_xrl -t MLD $0" %help: HELP; %module: mld; %tag: HELP "Display information about MLD group membership"; } show mld interface { - %command: "cli/tools/send_cli_processor_xrl -t MLD $0" %help: HELP; + %command: "cli_send_processor_xrl -t MLD $0" %help: HELP; %module: mld; %tag: HELP "Display information about MLD interfaces"; } show mld interface address { - %command: "cli/tools/send_cli_processor_xrl -t MLD $0" %help: HELP; + %command: "cli_send_processor_xrl -t MLD $0" %help: HELP; %module: mld; %tag: HELP "Display information about addresses of MLD interfaces"; } Modified: trunk/xorp/etc/templates/mld.tp =================================================================== --- trunk/xorp/etc/templates/mld.tp 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/mld.tp 2009-12-03 16:48:08 UTC (rev 11649) @@ -35,7 +35,7 @@ %help: short "Configure the MLD protocol"; %modinfo: provides mld; %modinfo: depends mfea6; - %modinfo: path "mld6igmp/xorp_mld"; + %modinfo: path "xorp_mld"; %modinfo: default_targetname "mld6igmp"; %modinfo: status_method xrl "$(mld.targetname)/common/0.1/get_status->status:u32&reason:txt"; %modinfo: startup_method xrl "$(mld.targetname)/mld6igmp/0.1/start_mld6igmp"; Modified: trunk/xorp/etc/templates/olsr4.cmds =================================================================== --- trunk/xorp/etc/templates/olsr4.cmds 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/olsr4.cmds 2009-12-03 16:48:08 UTC (rev 11649) @@ -6,7 +6,7 @@ */ clear olsr4 database { - %command: "contrib/olsr/tools/clear_database" %help: HELP; + %command: "clear_database" %help: HELP; %module: olsr4; %tag: HELP "Clear OLSRv1 databases"; } @@ -22,7 +22,7 @@ */ show olsr4 interface { - %command: "contrib/olsr/tools/print_databases $3" %help: HELP; + %command: "olsr_print_databases $3" %help: HELP; %module: olsr4; %tag: HELP "Show OLSRv1 interface status"; } @@ -33,7 +33,7 @@ */ show olsr4 link { - %command: "contrib/olsr/tools/print_databases $3" %help: HELP; + %command: "olsr_print_databases $3" %help: HELP; %module: olsr4; %tag: HELP "Show OLSRv1 link status"; } @@ -44,7 +44,7 @@ */ show olsr4 neighbor { - %command: "contrib/olsr/tools/print_databases $3" %help: HELP; + %command: "olsr_print_databases $3" %help: HELP; %module: olsr4; %tag: HELP "Show OLSRv1 one-hop neighbor status"; } @@ -55,7 +55,7 @@ */ show olsr4 twohop-link { - %command: "contrib/olsr/tools/print_databases $3" %help: HELP; + %command: "olsr_print_databases $3" %help: HELP; %module: olsr4; %tag: HELP "Show OLSRv1 two-hop link status"; } @@ -66,7 +66,7 @@ */ show olsr4 twohop-neighbor { - %command: "contrib/olsr/tools/print_databases $3" %help: HELP; + %command: "olsr_print_databases $3" %help: HELP; %module: olsr4; %tag: HELP "Show OLSRv1 two-hop neighbor status"; } @@ -76,7 +76,7 @@ */ show olsr4 mid { - %command: "contrib/olsr/tools/print_databases $3" %help: HELP; + %command: "olsr_print_databases $3" %help: HELP; %module: olsr4; %tag: HELP "Show OLSRv1 Multiple Interface database"; } @@ -87,7 +87,7 @@ */ show olsr4 topology { - %command: "contrib/olsr/tools/print_databases $3" %help: HELP; + %command: "olsr_print_databases $3" %help: HELP; %module: olsr4; %tag: HELP "Show OLSRv1 Topology Control database"; } @@ -98,7 +98,7 @@ */ show olsr4 external { - %command: "contrib/olsr/tools/print_databases $3" %help: HELP; + %command: "olsr_print_databases $3" %help: HELP; %module: olsr4; %tag: HELP "Show OLSRv1 external routes"; } Modified: trunk/xorp/etc/templates/olsr4.tp =================================================================== --- trunk/xorp/etc/templates/olsr4.tp 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/olsr4.tp 2009-12-03 16:48:08 UTC (rev 11649) @@ -104,9 +104,7 @@ %modinfo: provides olsr4; %modinfo: depends rib; %modinfo: depends policy; - /* Valgrind debugging wrapper (comment out for production) */ - /*%modinfo: path "contrib/olsr/xorp_olsr4_wrapper.sh";*/ - %modinfo: path "contrib/olsr/xorp_olsr4"; + %modinfo: path "xorp_olsr4"; %modinfo: default_targetname "olsr4"; %modinfo: status_method xrl "$(olsr4.targetname)/common/0.1/get_status->status:u32&reason:txt"; %modinfo: shutdown_method xrl "$(olsr4.targetname)/common/0.1/shutdown"; Modified: trunk/xorp/etc/templates/ospfv2.cmds =================================================================== --- trunk/xorp/etc/templates/ospfv2.cmds 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/ospfv2.cmds 2009-12-03 16:48:08 UTC (rev 11649) @@ -1,7 +1,7 @@ /* $XORP: xorp/etc/templates/ospfv2.cmds,v 1.10 2006/04/27 20:01:32 pavlin Exp $ */ clear ospf4 database { - %command: "ospf/tools/clear_database -2" %help: HELP; + %command: "clear_database -2" %help: HELP; %module: ospf4; %tag: HELP "Clear LSA database"; } @@ -12,19 +12,19 @@ } show ospf4 database { - %command: "ospf/tools/print_lsas -b" %help: HELP; + %command: "ospf_print_lsas -b" %help: HELP; %module: ospf4; %tag: HELP "Show LSA database"; } show ospf4 database brief { - %command: "ospf/tools/print_lsas -b" %help: HELP; + %command: "ospf_print_lsas -b" %help: HELP; %module: ospf4; %tag: HELP "Display brief output (default)"; } show ospf4 database detail { - %command: "ospf/tools/print_lsas -d" %help: HELP; + %command: "ospf_print_lsas -d" %help: HELP; %module: ospf4; %tag: HELP "Display detailed output"; } @@ -32,19 +32,19 @@ /* Router-LSA */ show ospf4 database router { - %command: "ospf/tools/print_lsas -b -f 1" %help: HELP; + %command: "ospf_print_lsas -b -f 1" %help: HELP; %module: ospf4; %tag: HELP "Show Router-LSA database"; } show ospf4 database router brief { - %command: "ospf/tools/print_lsas -b -f 1" %help: HELP; + %command: "ospf_print_lsas -b -f 1" %help: HELP; %module: ospf4; %tag: HELP "Display brief output (default)"; } show ospf4 database router detail { - %command: "ospf/tools/print_lsas -d -f 1" %help: HELP; + %command: "ospf_print_lsas -d -f 1" %help: HELP; %module: ospf4; %tag: HELP "Display detailed output"; } @@ -52,19 +52,19 @@ /* Network-LSA */ show ospf4 database network { - %command: "ospf/tools/print_lsas -b -f 2" %help: HELP; + %command: "ospf_print_lsas -b -f 2" %help: HELP; %module: ospf4; %tag: HELP "Show Network-LSA database"; } show ospf4 database network brief { - %command: "ospf/tools/print_lsas -b -f 2" %help: HELP; + %command: "ospf_print_lsas -b -f 2" %help: HELP; %module: ospf4; %tag: HELP "Display brief output (default)"; } show ospf4 database network detail { - %command: "ospf/tools/print_lsas -d -f 2" %help: HELP; + %command: "ospf_print_lsas -d -f 2" %help: HELP; %module: ospf4; %tag: HELP "Display detailed output"; } @@ -72,19 +72,19 @@ /* Summary-LSA (network) */ show ospf4 database netsummary { - %command: "ospf/tools/print_lsas -b -f 3" %help: HELP; + %command: "ospf_print_lsas -b -f 3" %help: HELP; %module: ospf4; %tag: HELP "Show Summary-LSA (network) database"; } show ospf4 database netsummary brief { - %command: "ospf/tools/print_lsas -b -f 3" %help: HELP; + %command: "ospf_print_lsas -b -f 3" %help: HELP; %module: ospf4; %tag: HELP "Display brief output (default)"; } show ospf4 database netsummary detail { - %command: "ospf/tools/print_lsas -d -f 3" %help: HELP; + %command: "ospf_print_lsas -d -f 3" %help: HELP; %module: ospf4; %tag: HELP "Display detailed output"; } @@ -92,19 +92,19 @@ /* Summary-LSA (AS boundary router) */ show ospf4 database asbrsummary { - %command: "ospf/tools/print_lsas -b -f 4" %help: HELP; + %command: "ospf_print_lsas -b -f 4" %help: HELP; %module: ospf4; %tag: HELP "Show Summary-LSA (AS boundary router) database"; } show ospf4 database asbrsummary brief { - %command: "ospf/tools/print_lsas -b -f 4" %help: HELP; + %command: "ospf_print_lsas -b -f 4" %help: HELP; %module: ospf4; %tag: HELP "Display brief output (default)"; } show ospf4 database asbrsummary detail { - %command: "ospf/tools/print_lsas -d -f 4" %help: HELP; + %command: "ospf_print_lsas -d -f 4" %help: HELP; %module: ospf4; %tag: HELP "Display detailed output"; } @@ -112,19 +112,19 @@ /* AS-External-LSA */ show ospf4 database external { - %command: "ospf/tools/print_lsas -b -f 5" %help: HELP; + %command: "ospf_print_lsas -b -f 5" %help: HELP; %module: ospf4; %tag: HELP "Show External-LSA database"; } show ospf4 database external brief { - %command: "ospf/tools/print_lsas -b -f 5" %help: HELP; + %command: "ospf_print_lsas -b -f 5" %help: HELP; %module: ospf4; %tag: HELP "Display brief output (default)"; } show ospf4 database external detail { - %command: "ospf/tools/print_lsas -d -f 5" %help: HELP; + %command: "ospf_print_lsas -d -f 5" %help: HELP; %module: ospf4; %tag: HELP "Display detailed output"; } @@ -132,19 +132,19 @@ /* NSSA-LSA */ show ospf4 database nssa { - %command: "ospf/tools/print_lsas -b -f 7" %help: HELP; + %command: "ospf_print_lsas -b -f 7" %help: HELP; %module: ospf4; %tag: HELP "Show NSSA-LSA database"; } show ospf4 database nssa brief { - %command: "ospf/tools/print_lsas -b -f 7" %help: HELP; + %command: "ospf_print_lsas -b -f 7" %help: HELP; %module: ospf4; %tag: HELP "Display brief output (default)"; } show ospf4 database nssa detail { - %command: "ospf/tools/print_lsas -d -f 7" %help: HELP; + %command: "ospf_print_lsas -d -f 7" %help: HELP; %module: ospf4; %tag: HELP "Display detailed output"; } @@ -152,19 +152,19 @@ /* AREA */ show ospf4 database area $(protocols.ospf4.area.*) { - %command: "ospf/tools/print_lsas -a $5 -b" %help: HELP; + %command: "ospf_print_lsas -a $5 -b" %help: HELP; %module: ospf4; %tag: HELP "Show LSA database"; } show ospf4 database area $(protocols.ospf4.area.*) brief { - %command: "ospf/tools/print_lsas -a $5 -b" %help: HELP; + %command: "ospf_print_lsas -a $5 -b" %help: HELP; %module: ospf4; %tag: HELP "Display brief output (default)"; } show ospf4 database area $(protocols.ospf4.area.*) detail { - %command: "ospf/tools/print_lsas -a $5 -d" %help: HELP; + %command: "ospf_print_lsas -a $5 -d" %help: HELP; %module: ospf4; %tag: HELP "Display detailed output"; } @@ -172,19 +172,19 @@ /* Router-LSA */ show ospf4 database area $(protocols.ospf4.area.*) router { - %command: "ospf/tools/print_lsas -a $5 -b -f 1" %help: HELP; + %command: "ospf_print_lsas -a $5 -b -f 1" %help: HELP; %module: ospf4; %tag: HELP "Show Router-LSA database"; } show ospf4 database area $(protocols.ospf4.area.*) router brief { - %command: "ospf/tools/print_lsas -a $5 -b -f 1" %help: HELP; + %command: "ospf_print_lsas -a $5 -b -f 1" %help: HELP; %module: ospf4; %tag: HELP "Display brief output (default)"; } show ospf4 database area $(protocols.ospf4.area.*) router detail { - %command: "ospf/tools/print_lsas -a $5 -d -f 1" %help: HELP; + %command: "ospf_print_lsas -a $5 -d -f 1" %help: HELP; %module: ospf4; %tag: HELP "Display detailed output"; } @@ -192,19 +192,19 @@ /* Network-LSA */ show ospf4 database area $(protocols.ospf4.area.*) network { - %command: "ospf/tools/print_lsas -a $5 -b -f 2" %help: HELP; + %command: "ospf_print_lsas -a $5 -b -f 2" %help: HELP; %module: ospf4; %tag: HELP "Show Network-LSA database"; } show ospf4 database area $(protocols.ospf4.area.*) network brief { - %command: "ospf/tools/print_lsas -a $5 -b -f 2" %help: HELP; + %command: "ospf_print_lsas -a $5 -b -f 2" %help: HELP; %module: ospf4; %tag: HELP "Display brief output (default)"; } show ospf4 database area $(protocols.ospf4.area.*) network detail { - %command: "ospf/tools/print_lsas -a $5 -d -f 2" %help: HELP; + %command: "ospf_print_lsas -a $5 -d -f 2" %help: HELP; %module: ospf4; %tag: HELP "Display detailed output"; } @@ -212,19 +212,19 @@ /* Summary-LSA (network) */ show ospf4 database area $(protocols.ospf4.area.*) netsummary { - %command: "ospf/tools/print_lsas -a $5 -b -f 3" %help: HELP; + %command: "ospf_print_lsas -a $5 -b -f 3" %help: HELP; %module: ospf4; %tag: HELP "Show Summary-LSA (network) database"; } show ospf4 database area $(protocols.ospf4.area.*) netsummary brief { - %command: "ospf/tools/print_lsas -a $5 -b -f 3" %help: HELP; + %command: "ospf_print_lsas -a $5 -b -f 3" %help: HELP; %module: ospf4; %tag: HELP "Display brief output (default)"; } show ospf4 database area $(protocols.ospf4.area.*) netsummary detail { - %command: "ospf/tools/print_lsas -a $5 -d -f 3" %help: HELP; + %command: "ospf_print_lsas -a $5 -d -f 3" %help: HELP; %module: ospf4; %tag: HELP "Display detailed output"; } @@ -232,19 +232,19 @@ /* Summary-LSA (AS boundary router) */ show ospf4 database area $(protocols.ospf4.area.*) asbrsummary { - %command: "ospf/tools/print_lsas -a $5 -b -f 4" %help: HELP; + %command: "ospf_print_lsas -a $5 -b -f 4" %help: HELP; %module: ospf4; %tag: HELP "Show Summary-LSA (AS boundary router) database"; } show ospf4 database area $(protocols.ospf4.area.*) asbrsummary brief { - %command: "ospf/tools/print_lsas -a $5 -b -f 4" %help: HELP; + %command: "ospf_print_lsas -a $5 -b -f 4" %help: HELP; %module: ospf4; %tag: HELP "Display brief output (default)"; } show ospf4 database area $(protocols.ospf4.area.*) asbrsummary detail { - %command: "ospf/tools/print_lsas -a $5 -d -f 4" %help: HELP; + %command: "ospf_print_lsas -a $5 -d -f 4" %help: HELP; %module: ospf4; %tag: HELP "Display detailed output"; } @@ -252,19 +252,19 @@ /* AS-External-LSA */ show ospf4 database area $(protocols.ospf4.area.*) external { - %command: "ospf/tools/print_lsas -a $5 -b -f 5" %help: HELP; + %command: "ospf_print_lsas -a $5 -b -f 5" %help: HELP; %module: ospf4; %tag: HELP "Show External-LSA database"; } show ospf4 database area $(protocols.ospf4.area.*) external brief { - %command: "ospf/tools/print_lsas -a $5 -b -f 5" %help: HELP; + %command: "ospf_print_lsas -a $5 -b -f 5" %help: HELP; %module: ospf4; %tag: HELP "Display brief output (default)"; } show ospf4 database area $(protocols.ospf4.area.*) external detail { - %command: "ospf/tools/print_lsas -a $5 -d -f 5" %help: HELP; + %command: "ospf_print_lsas -a $5 -d -f 5" %help: HELP; %module: ospf4; %tag: HELP "Display detailed output"; } @@ -272,19 +272,19 @@ /* NSSA-LSA */ show ospf4 database area $(protocols.ospf4.area.*) nssa { - %command: "ospf/tools/print_lsas -a $5 -b -f 7" %help: HELP; + %command: "ospf_print_lsas -a $5 -b -f 7" %help: HELP; %module: ospf4; %tag: HELP "Show NSSA-LSA database"; } show ospf4 database area $(protocols.ospf4.area.*) nssa brief { - %command: "ospf/tools/print_lsas -a $5 -b -f 7" %help: HELP; + %command: "ospf_print_lsas -a $5 -b -f 7" %help: HELP; %module: ospf4; %tag: HELP "Display brief output (default)"; } show ospf4 database area $(protocols.ospf4.area.*) nssa detail { - %command: "ospf/tools/print_lsas -a $5 -d -f 7" %help: HELP; + %command: "ospf_print_lsas -a $5 -d -f 7" %help: HELP; %module: ospf4; %tag: HELP "Display detailed output"; } @@ -292,85 +292,85 @@ /* SUMMARY */ show ospf4 database summary { - %command: "ospf/tools/print_lsas -s" %help: HELP; + %command: "ospf_print_lsas -s" %help: HELP; %module: ospf4; %tag: HELP "Display summary output"; } show ospf4 database summary router { - %command: "ospf/tools/print_lsas -s -f 1" %help: HELP; + %command: "ospf_print_lsas -s -f 1" %help: HELP; %module: ospf4; %tag: HELP "Show Router-LSA database"; } show ospf4 database summary network { - %command: "ospf/tools/print_lsas -s -f 2" %help: HELP; + %command: "ospf_print_lsas -s -f 2" %help: HELP; %module: ospf4; %tag: HELP "Show Network-LSA database"; } show ospf4 database summary netsummary { - %command: "ospf/tools/print_lsas -s -f 3" %help: HELP; + %command: "ospf_print_lsas -s -f 3" %help: HELP; %module: ospf4; %tag: HELP "Show Summary-LSA (network) database"; } show ospf4 database summary asbrsummary { - %command: "ospf/tools/print_lsas -s -f 4" %help: HELP; + %command: "ospf_print_lsas -s -f 4" %help: HELP; %module: ospf4; %tag: HELP "Show Summary-LSA (AS boundary router) database"; } show ospf4 database summary external { - %command: "ospf/tools/print_lsas -s -f 5" %help: HELP; + %command: "ospf_print_lsas -s -f 5" %help: HELP; %module: ospf4; %tag: HELP "Show External-LSA database"; } show ospf4 database summary nssa { - %command: "ospf/tools/print_lsas -s -f 7" %help: HELP; + %command: "ospf_print_lsas -s -f 7" %help: HELP; %module: ospf4; %tag: HELP "Show NSSA-LSA database"; } show ospf4 database summary area $(protocols.ospf4.area.*) { - %command: "ospf/tools/print_lsas -a $6 -s" %help: HELP; + %command: "ospf_print_lsas -a $6 -s" %help: HELP; %module: ospf4; %tag: HELP "Display summary output"; } show ospf4 database summary area $(protocols.ospf4.area.*) router { - %command: "ospf/tools/print_lsas -a $6 -s -f 1" %help: HELP; + %command: "ospf_print_lsas -a $6 -s -f 1" %help: HELP; %module: ospf4; %tag: HELP "Show Router-LSA database"; } show ospf4 database summary area $(protocols.ospf4.area.*) network { - %command: "ospf/tools/print_lsas -a $6 -s -f 2" %help: HELP; + %command: "ospf_print_lsas -a $6 -s -f 2" %help: HELP; %module: ospf4; %tag: HELP "Show Network-LSA database"; } show ospf4 database summary area $(protocols.ospf4.area.*) netsummary { - %command: "ospf/tools/print_lsas -a $6 -s -f 3" %help: HELP; + %command: "ospf_print_lsas -a $6 -s -f 3" %help: HELP; %module: ospf4; %tag: HELP "Show Summary-LSA (network) database"; } show ospf4 database summary area $(protocols.ospf4.area.*) asbrsummary { - %command: "ospf/tools/print_lsas -a $6 -s -f 4" %help: HELP; + %command: "ospf_print_lsas -a $6 -s -f 4" %help: HELP; %module: ospf4; %tag: HELP "Show Summary-LSA (AS boundary router) database"; } show ospf4 database summary area $(protocols.ospf4.area.*) external { - %command: "ospf/tools/print_lsas -a $6 -s -f 5" %help: HELP; + %command: "ospf_print_lsas -a $6 -s -f 5" %help: HELP; %module: ospf4; %tag: HELP "Show External-LSA database"; } show ospf4 database summary area $(protocols.ospf4.area.*) nssa { - %command: "ospf/tools/print_lsas -a $6 -s -f 7" %help: HELP; + %command: "ospf_print_lsas -a $6 -s -f 7" %help: HELP; %module: ospf4; %tag: HELP "Show NSSA-LSA database"; } @@ -378,37 +378,37 @@ /* Neighbor commands */ show ospf4 neighbor { - %command: "ospf/tools/print_neighbours" %help: HELP; + %command: "ospf_print_neighbours" %help: HELP; %module: ospf4; %tag: HELP "Show Neighbors"; } show ospf4 neighbor brief { - %command: "ospf/tools/print_neighbours -b" %help: HELP; + %command: "ospf_print_neighbours -b" %help: HELP; %module: ospf4; %tag: HELP "Show Neighbors"; } show ospf4 neighbor detail { - %command: "ospf/tools/print_neighbours -d" %help: HELP; + %command: "ospf_print_neighbours -d" %help: HELP; %module: ospf4; %tag: HELP "Show Neighbors"; } show ospf4 neighbor { - %command: "ospf/tools/print_neighbours -f $4" %help: HELP; + %command: "ospf_print_neighbours -f $4" %help: HELP; %module: ospf4; %tag: HELP "Show Neighbors"; } show ospf4 neighbor brief { - %command: "ospf/tools/print_neighbours -b -f $4" %help: HELP; + %command: "ospf_print_neighbours -b -f $4" %help: HELP; %module: ospf4; %tag: HELP "Show Neighbors"; } show ospf4 neighbor detail { - %command: "ospf/tools/print_neighbours -d -f $4" %help: HELP; + %command: "ospf_print_neighbours -d -f $4" %help: HELP; %module: ospf4; %tag: HELP "Show Neighbors"; } Modified: trunk/xorp/etc/templates/ospfv2.tp =================================================================== --- trunk/xorp/etc/templates/ospfv2.tp 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/ospfv2.tp 2009-12-03 16:48:08 UTC (rev 11649) @@ -121,7 +121,7 @@ %modinfo: provides ospf4; %modinfo: depends rib; %modinfo: depends policy; - %modinfo: path "ospf/xorp_ospfv2"; + %modinfo: path "xorp_ospfv2"; %modinfo: default_targetname "ospfv2"; %modinfo: status_method xrl "$(ospf4.targetname)/common/0.1/get_status->status:u32&reason:txt"; %modinfo: shutdown_method xrl "$(ospf4.targetname)/common/0.1/shutdown"; Modified: trunk/xorp/etc/templates/ospfv3.cmds =================================================================== --- trunk/xorp/etc/templates/ospfv3.cmds 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/ospfv3.cmds 2009-12-03 16:48:08 UTC (rev 11649) @@ -1,7 +1,7 @@ /* $XORP: xorp/etc/templates/ospfv3.cmds,v 1.6 2007/02/26 11:08:37 atanu Exp $ */ clear ospf6 database { - %command: "ospf/tools/clear_database -3" %help: HELP; + %command: "clear_database -3" %help: HELP; %module: ospf6; %tag: HELP "Clear LSA database"; } @@ -12,19 +12,19 @@ } show ospf6 database { - %command: "ospf/tools/print_lsas -3 -b" %help: HELP; + %command: "ospf_print_lsas -3 -b" %help: HELP; %module: ospf6; %tag: HELP "Show LSA database"; } show ospf6 database brief { - %command: "ospf/tools/print_lsas -3 -b" %help: HELP; + %command: "ospf_print_lsas -3 -b" %help: HELP; %module: ospf6; %tag: HELP "Display brief output (default)"; } show ospf6 database detail { - %command: "ospf/tools/print_lsas -3 -d" %help: HELP; + %command: "ospf_print_lsas -3 -d" %help: HELP; %module: ospf6; %tag: HELP "Display detailed output"; } @@ -32,19 +32,19 @@ /* Router-LSA */ show ospf6 database router { - %command: "ospf/tools/print_lsas -3 -b -f 0x2001" %help: HELP; + %command: "ospf_print_lsas -3 -b -f 0x2001" %help: HELP; %module: ospf6; %tag: HELP "Show Router-LSA database"; } show ospf6 database router brief { - %command: "ospf/tools/print_lsas -3 -b -f 0x2001" %help: HELP; + %command: "ospf_print_lsas -3 -b -f 0x2001" %help: HELP; %module: ospf6; %tag: HELP "Display brief output (default)"; } show ospf6 database router detail { - %command: "ospf/tools/print_lsas -3 -d -f 0x2001" %help: HELP; + %command: "ospf_print_lsas -3 -d -f 0x2001" %help: HELP; %module: ospf6; %tag: HELP "Display detailed output"; } @@ -52,19 +52,19 @@ /* Network-LSA */ show ospf6 database network { - %command: "ospf/tools/print_lsas -3 -b -f 0x2002" %help: HELP; + %command: "ospf_print_lsas -3 -b -f 0x2002" %help: HELP; %module: ospf6; %tag: HELP "Show Network-LSA database"; } show ospf6 database network brief { - %command: "ospf/tools/print_lsas -3 -b -f 0x2002" %help: HELP; + %command: "ospf_print_lsas -3 -b -f 0x2002" %help: HELP; %module: ospf6; %tag: HELP "Display brief output (default)"; } show ospf6 database network detail { - %command: "ospf/tools/print_lsas -3 -d -f 0x2002" %help: HELP; + %command: "ospf_print_lsas -3 -d -f 0x2002" %help: HELP; %module: ospf6; %tag: HELP "Display detailed output"; } @@ -72,19 +72,19 @@ /* Summary-LSA (network) */ show ospf6 database netsummary { - %command: "ospf/tools/print_lsas -3 -b -f 0x2003" %help: HELP; + %command: "ospf_print_lsas -3 -b -f 0x2003" %help: HELP; %module: ospf6; %tag: HELP "Show Summary-LSA (network) database"; } show ospf6 database netsummary brief { - %command: "ospf/tools/print_lsas -3 -b -f 0x2003" %help: HELP; + %command: "ospf_print_lsas -3 -b -f 0x2003" %help: HELP; %module: ospf6; %tag: HELP "Display brief output (default)"; } show ospf6 database netsummary detail { - %command: "ospf/tools/print_lsas -3 -d -f 0x2003" %help: HELP; + %command: "ospf_print_lsas -3 -d -f 0x2003" %help: HELP; %module: ospf6; %tag: HELP "Display detailed output"; } @@ -92,19 +92,19 @@ /* Summary-LSA (AS boundary router) */ show ospf6 database asbrsummary { - %command: "ospf/tools/print_lsas -3 -b -f 0x2004" %help: HELP; + %command: "ospf_print_lsas -3 -b -f 0x2004" %help: HELP; %module: ospf6; %tag: HELP "Show Summary-LSA (AS boundary router) database"; } show ospf6 database asbrsummary brief { - %command: "ospf/tools/print_lsas -3 -b -f 0x2004" %help: HELP; + %command: "ospf_print_lsas -3 -b -f 0x2004" %help: HELP; %module: ospf6; %tag: HELP "Display brief output (default)"; } show ospf6 database asbrsummary detail { - %command: "ospf/tools/print_lsas -3 -d -f 0x2004" %help: HELP; + %command: "ospf_print_lsas -3 -d -f 0x2004" %help: HELP; %module: ospf6; %tag: HELP "Display detailed output"; } @@ -112,19 +112,19 @@ /* AS-External-LSA */ show ospf6 database external { - %command: "ospf/tools/print_lsas -3 -b -f 0x4005" %help: HELP; + %command: "ospf_print_lsas -3 -b -f 0x4005" %help: HELP; %module: ospf6; %tag: HELP "Show External-LSA database"; } show ospf6 database external brief { - %command: "ospf/tools/print_lsas -3 -b -f 0x4005" %help: HELP; + %command: "ospf_print_lsas -3 -b -f 0x4005" %help: HELP; %module: ospf6; %tag: HELP "Display brief output (default)"; } show ospf6 database external detail { - %command: "ospf/tools/print_lsas -3 -d -f 0x4005" %help: HELP; + %command: "ospf_print_lsas -3 -d -f 0x4005" %help: HELP; %module: ospf6; %tag: HELP "Display detailed output"; } @@ -132,19 +132,19 @@ /* NSSA-LSA */ show ospf6 database nssa { - %command: "ospf/tools/print_lsas -3 -b -f 0x2007" %help: HELP; + %command: "ospf_print_lsas -3 -b -f 0x2007" %help: HELP; %module: ospf6; %tag: HELP "Show NSSA-LSA database"; } show ospf6 database nssa brief { - %command: "ospf/tools/print_lsas -3 -b -f 0x2007" %help: HELP; + %command: "ospf_print_lsas -3 -b -f 0x2007" %help: HELP; %module: ospf6; %tag: HELP "Display brief output (default)"; } show ospf6 database nssa detail { - %command: "ospf/tools/print_lsas -3 -d -f 0x2007" %help: HELP; + %command: "ospf_print_lsas -3 -d -f 0x2007" %help: HELP; %module: ospf6; %tag: HELP "Display detailed output"; } @@ -152,19 +152,19 @@ /* Link-LSA */ show ospf6 database link { - %command: "ospf/tools/print_lsas -3 -b -f 0x0008" %help: HELP; + %command: "ospf_print_lsas -3 -b -f 0x0008" %help: HELP; %module: ospf6; %tag: HELP "Show Link-LSA database"; } show ospf6 database link brief { - %command: "ospf/tools/print_lsas -3 -b -f 0x0008" %help: HELP; + %command: "ospf_print_lsas -3 -b -f 0x0008" %help: HELP; %module: ospf6; %tag: HELP "Display brief output (default)"; } show ospf6 database link detail { - %command: "ospf/tools/print_lsas -3 -d -f 0x0008" %help: HELP; + %command: "ospf_print_lsas -3 -d -f 0x0008" %help: HELP; %module: ospf6; %tag: HELP "Display detailed output"; } @@ -172,19 +172,19 @@ /* Intra-Area-Prefix-LSA */ show ospf6 database intra-area-prefix { - %command: "ospf/tools/print_lsas -3 -b -f 0x2009" %help: HELP; + %command: "ospf_print_lsas -3 -b -f 0x2009" %help: HELP; %module: ospf6; %tag: HELP "Show Intra-Area-Prefix-LSA database"; } show ospf6 database intra-area-prefix brief { - %command: "ospf/tools/print_lsas -3 -b -f 0x2009" %help: HELP; + %command: "ospf_print_lsas -3 -b -f 0x2009" %help: HELP; %module: ospf6; %tag: HELP "Display brief output (default)"; } show ospf6 database intra-area-prefix detail { - %command: "ospf/tools/print_lsas -3 -d -f 0x2009" %help: HELP; + %command: "ospf_print_lsas -3 -d -f 0x2009" %help: HELP; %module: ospf6; %tag: HELP "Display detailed output"; } @@ -192,19 +192,19 @@ /* AREA */ show ospf6 database area $(protocols.ospf6.*.area.*) { - %command: "ospf/tools/print_lsas -3 -a $5 -b" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -b" %help: HELP; %module: ospf6; %tag: HELP "Show LSA database"; } show ospf6 database area $(protocols.ospf6.*.area.*) brief { - %command: "ospf/tools/print_lsas -3 -a $5 -b" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -b" %help: HELP; %module: ospf6; %tag: HELP "Display brief output (default)"; } show ospf6 database area $(protocols.ospf6.*.area.*) detail { - %command: "ospf/tools/print_lsas -3 -a $5 -d" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -d" %help: HELP; %module: ospf6; %tag: HELP "Display detailed output"; } @@ -212,19 +212,19 @@ /* Router-LSA */ show ospf6 database area $(protocols.ospf6.*.area.*) router { - %command: "ospf/tools/print_lsas -3 -a $5 -b -f 0x2001" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -b -f 0x2001" %help: HELP; %module: ospf6; %tag: HELP "Show Router-LSA database"; } show ospf6 database area $(protocols.ospf6.*.area.*) router brief { - %command: "ospf/tools/print_lsas -3 -a $5 -b -f 0x2001" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -b -f 0x2001" %help: HELP; %module: ospf6; %tag: HELP "Display brief output (default)"; } show ospf6 database area $(protocols.ospf6.*.area.*) router detail { - %command: "ospf/tools/print_lsas -3 -a $5 -d -f 0x2001" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -d -f 0x2001" %help: HELP; %module: ospf6; %tag: HELP "Display detailed output"; } @@ -232,19 +232,19 @@ /* Network-LSA */ show ospf6 database area $(protocols.ospf6.*.area.*) network { - %command: "ospf/tools/print_lsas -3 -a $5 -b -f 0x2002" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -b -f 0x2002" %help: HELP; %module: ospf6; %tag: HELP "Show Network-LSA database"; } show ospf6 database area $(protocols.ospf6.*.area.*) network brief { - %command: "ospf/tools/print_lsas -3 -a $5 -b -f 0x2002" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -b -f 0x2002" %help: HELP; %module: ospf6; %tag: HELP "Display brief output (default)"; } show ospf6 database area $(protocols.ospf6.*.area.*) network detail { - %command: "ospf/tools/print_lsas -3 -a $5 -d -f 0x2002" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -d -f 0x2002" %help: HELP; %module: ospf6; %tag: HELP "Display detailed output"; } @@ -252,19 +252,19 @@ /* Summary-LSA (network) */ show ospf6 database area $(protocols.ospf6.*.area.*) netsummary { - %command: "ospf/tools/print_lsas -3 -a $5 -b -f 0x2003" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -b -f 0x2003" %help: HELP; %module: ospf6; %tag: HELP "Show Summary-LSA (network) database"; } show ospf6 database area $(protocols.ospf6.*.area.*) netsummary brief { - %command: "ospf/tools/print_lsas -3 -a $5 -b -f 0x2003" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -b -f 0x2003" %help: HELP; %module: ospf6; %tag: HELP "Display brief output (default)"; } show ospf6 database area $(protocols.ospf6.*.area.*) netsummary detail { - %command: "ospf/tools/print_lsas -3 -a $5 -d -f 0x2003" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -d -f 0x2003" %help: HELP; %module: ospf6; %tag: HELP "Display detailed output"; } @@ -272,19 +272,19 @@ /* Summary-LSA (AS boundary router) */ show ospf6 database area $(protocols.ospf6.*.area.*) asbrsummary { - %command: "ospf/tools/print_lsas -3 -a $5 -b -f 0x2004" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -b -f 0x2004" %help: HELP; %module: ospf6; %tag: HELP "Show Summary-LSA (AS boundary router) database"; } show ospf6 database area $(protocols.ospf6.*.area.*) asbrsummary brief { - %command: "ospf/tools/print_lsas -3 -a $5 -b -f 0x2004" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -b -f 0x2004" %help: HELP; %module: ospf6; %tag: HELP "Display brief output (default)"; } show ospf6 database area $(protocols.ospf6.*.area.*) asbrsummary detail { - %command: "ospf/tools/print_lsas -3 -a $5 -d -f 0x2004" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -d -f 0x2004" %help: HELP; %module: ospf6; %tag: HELP "Display detailed output"; } @@ -292,19 +292,19 @@ /* AS-External-LSA */ show ospf6 database area $(protocols.ospf6.*.area.*) external { - %command: "ospf/tools/print_lsas -3 -a $5 -b -f 0x4005" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -b -f 0x4005" %help: HELP; %module: ospf6; %tag: HELP "Show External-LSA database"; } show ospf6 database area $(protocols.ospf6.*.area.*) external brief { - %command: "ospf/tools/print_lsas -3 -a $5 -b -f 0x4005" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -b -f 0x4005" %help: HELP; %module: ospf6; %tag: HELP "Display brief output (default)"; } show ospf6 database area $(protocols.ospf6.*.area.*) external detail { - %command: "ospf/tools/print_lsas -3 -a $5 -d -f 0x4005" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -d -f 0x4005" %help: HELP; %module: ospf6; %tag: HELP "Display detailed output"; } @@ -312,19 +312,19 @@ /* NSSA-LSA */ show ospf6 database area $(protocols.ospf6.*.area.*) nssa { - %command: "ospf/tools/print_lsas -3 -a $5 -b -f 0x2007" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -b -f 0x2007" %help: HELP; %module: ospf6; %tag: HELP "Show NSSA-LSA database"; } show ospf6 database area $(protocols.ospf6.*.area.*) nssa brief { - %command: "ospf/tools/print_lsas -3 -a $5 -b -f 0x2007" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -b -f 0x2007" %help: HELP; %module: ospf6; %tag: HELP "Display brief output (default)"; } show ospf6 database area $(protocols.ospf6.*.area.*) nssa detail { - %command: "ospf/tools/print_lsas -3 -a $5 -d -f 0x2007" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -d -f 0x2007" %help: HELP; %module: ospf6; %tag: HELP "Display detailed output"; } @@ -332,19 +332,19 @@ /* Link-LSA */ show ospf6 database area $(protocols.ospf6.*.area.*) link { - %command: "ospf/tools/print_lsas -3 -a $5 -b -f 0x0008" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -b -f 0x0008" %help: HELP; %module: ospf6; %tag: HELP "Show Link-LSA database"; } show ospf6 database area $(protocols.ospf6.*.area.*) link brief { - %command: "ospf/tools/print_lsas -3 -a $5 -b -f 0x0008" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -b -f 0x0008" %help: HELP; %module: ospf6; %tag: HELP "Display brief output (default)"; } show ospf6 database area $(protocols.ospf6.*.area.*) link detail { - %command: "ospf/tools/print_lsas -3 -a $5 -d -f 0x0008" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -d -f 0x0008" %help: HELP; %module: ospf6; %tag: HELP "Display detailed output"; } @@ -352,19 +352,19 @@ /* Intra-Area-Prefix-LSA */ show ospf6 database area $(protocols.ospf6.*.area.*) intra-area-prefix { - %command: "ospf/tools/print_lsas -3 -a $5 -b -f 0x2009" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -b -f 0x2009" %help: HELP; %module: ospf6; %tag: HELP "Show Intra-Area-Prefix-LSA database"; } show ospf6 database area $(protocols.ospf6.*.area.*) intra-area-prefix brief { - %command: "ospf/tools/print_lsas -3 -a $5 -b -f 0x2009" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -b -f 0x2009" %help: HELP; %module: ospf6; %tag: HELP "Display brief output (default)"; } show ospf6 database area $(protocols.ospf6.*.area.*) intra-area-prefix detail { - %command: "ospf/tools/print_lsas -3 -a $5 -d -f 0x2009" %help: HELP; + %command: "ospf_print_lsas -3 -a $5 -d -f 0x2009" %help: HELP; %module: ospf6; %tag: HELP "Display detailed output"; } @@ -372,109 +372,109 @@ /* SUMMARY */ show ospf6 database summary { - %command: "ospf/tools/print_lsas -3 -s" %help: HELP; + %command: "ospf_print_lsas -3 -s" %help: HELP; %module: ospf6; %tag: HELP "Display summary output"; } show ospf6 database summary router { - %command: "ospf/tools/print_lsas -3 -s -f 0x2001" %help: HELP; + %command: "ospf_print_lsas -3 -s -f 0x2001" %help: HELP; %module: ospf6; %tag: HELP "Show Router-LSA database"; } show ospf6 database summary network { - %command: "ospf/tools/print_lsas -3 -s -f 0x2002" %help: HELP; + %command: "ospf_print_lsas -3 -s -f 0x2002" %help: HELP; %module: ospf6; %tag: HELP "Show Network-LSA database"; } show ospf6 database summary netsummary { - %command: "ospf/tools/print_lsas -3 -s -f 0x2003" %help: HELP; + %command: "ospf_print_lsas -3 -s -f 0x2003" %help: HELP; %module: ospf6; %tag: HELP "Show Summary-LSA (network) database"; } show ospf6 database summary asbrsummary { - %command: "ospf/tools/print_lsas -3 -s -f 0x2004" %help: HELP; + %command: "ospf_print_lsas -3 -s -f 0x2004" %help: HELP; %module: ospf6; %tag: HELP "Show Summary-LSA (AS boundary router) database"; } show ospf6 database summary external { - %command: "ospf/tools/print_lsas -3 -s -f 0x4005" %help: HELP; + %command: "ospf_print_lsas -3 -s -f 0x4005" %help: HELP; %module: ospf6; %tag: HELP "Show External-LSA database"; } show ospf6 database summary nssa { - %command: "ospf/tools/print_lsas -3 -s -f 0x2007" %help: HELP; + %command: "ospf_print_lsas -3 -s -f 0x2007" %help: HELP; %module: ospf6; %tag: HELP "Show NSSA-LSA database"; } show ospf6 database summary link { - %command: "ospf/tools/print_lsas -3 -s -f 0x0008" %help: HELP; + %command: "ospf_print_lsas -3 -s -f 0x0008" %help: HELP; %module: ospf6; %tag: HELP "Show Link-LSA database"; } show ospf6 database summary intra-area-prefix { - %command: "ospf/tools/print_lsas -3 -s -f 0x2009" %help: HELP; + %command: "ospf_print_lsas -3 -s -f 0x2009" %help: HELP; %module: ospf6; %tag: HELP "Show Intra-Area-Prefix-LSA database"; } show ospf6 database summary area $(protocols.ospf6.*.area.*) { - %command: "ospf/tools/print_lsas -3 -a $6 -s" %help: HELP; + %command: "ospf_print_lsas -3 -a $6 -s" %help: HELP; %module: ospf6; %tag: HELP "Display summary output"; } show ospf6 database summary area $(protocols.ospf6.*.area.*) router { - %command: "ospf/tools/print_lsas -3 -a $6 -s -f 0x2001" %help: HELP; + %command: "ospf_print_lsas -3 -a $6 -s -f 0x2001" %help: HELP; %module: ospf6; %tag: HELP "Show Router-LSA database"; } show ospf6 database summary area $(protocols.ospf6.*.area.*) network { - %command: "ospf/tools/print_lsas -3 -a $6 -s -f 0x2002" %help: HELP; + %command: "ospf_print_lsas -3 -a $6 -s -f 0x2002" %help: HELP; %module: ospf6; %tag: HELP "Show Network-LSA database"; } show ospf6 database summary area $(protocols.ospf6.*.area.*) netsummary { - %command: "ospf/tools/print_lsas -3 -a $6 -s -f 0x2003" %help: HELP; + %command: "ospf_print_lsas -3 -a $6 -s -f 0x2003" %help: HELP; %module: ospf6; %tag: HELP "Show Summary-LSA (network) database"; } show ospf6 database summary area $(protocols.ospf6.*.area.*) asbrsummary { - %command: "ospf/tools/print_lsas -3 -a $6 -s -f 0x2004" %help: HELP; + %command: "ospf_print_lsas -3 -a $6 -s -f 0x2004" %help: HELP; %module: ospf6; %tag: HELP "Show Summary-LSA (AS boundary router) database"; } show ospf6 database summary area $(protocols.ospf6.*.area.*) external { - %command: "ospf/tools/print_lsas -3 -a $6 -s -f 0x4005" %help: HELP; + %command: "ospf_print_lsas -3 -a $6 -s -f 0x4005" %help: HELP; %module: ospf6; %tag: HELP "Show External-LSA database"; } show ospf6 database summary area $(protocols.ospf6.*.area.*) nssa { - %command: "ospf/tools/print_lsas -3 -a $6 -s -f 0x2007" %help: HELP; + %command: "ospf_print_lsas -3 -a $6 -s -f 0x2007" %help: HELP; %module: ospf6; %tag: HELP "Show NSSA-LSA database"; } show ospf6 database summary area $(protocols.ospf6.*.area.*) link { - %command: "ospf/tools/print_lsas -3 -a $6 -s -f 0x0008" %help: HELP; + %command: "ospf_print_lsas -3 -a $6 -s -f 0x0008" %help: HELP; %module: ospf6; %tag: HELP "Show Link-LSA database"; } show ospf6 database summary area $(protocols.ospf6.*.area.*) intra-area-prefix{ - %command: "ospf/tools/print_lsas -3 -a $6 -s -f 0x2009" %help: HELP; + %command: "ospf_print_lsas -3 -a $6 -s -f 0x2009" %help: HELP; %module: ospf6; %tag: HELP "Show Intra-Area-Prefix-LSA database"; } @@ -482,37 +482,37 @@ /* Neighbor commands */ show ospf6 neighbor { - %command: "ospf/tools/print_neighbours -3" %help: HELP; + %command: "ospf_print_neighbours -3" %help: HELP; %module: ospf6; %tag: HELP "Show Neighbors"; } show ospf6 neighbor brief { - %command: "ospf/tools/print_neighbours -3 -b" %help: HELP; + %command: "ospf_print_neighbours -3 -b" %help: HELP; %module: ospf6; %tag: HELP "Show Neighbors"; } show ospf6 neighbor detail { - %command: "ospf/tools/print_neighbours -3 -d" %help: HELP; + %command: "ospf_print_neighbours -3 -d" %help: HELP; %module: ospf6; %tag: HELP "Show Neighbors"; } show ospf6 neighbor { - %command: "ospf/tools/print_neighbours -3 -f $4" %help: HELP; + %command: "ospf_print_neighbours -3 -f $4" %help: HELP; %module: ospf6; %tag: HELP "Show Neighbors"; } show ospf6 neighbor brief { - %command: "ospf/tools/print_neighbours -3 -b -f $4" %help: HELP; + %command: "ospf_print_neighbours -3 -b -f $4" %help: HELP; %module: ospf6; %tag: HELP "Show Neighbors"; } show ospf6 neighbor detail { - %command: "ospf/tools/print_neighbours -3 -d -f $4" %help: HELP; + %command: "ospf_print_neighbours -3 -d -f $4" %help: HELP; %module: ospf6; %tag: HELP "Show Neighbors"; } Modified: trunk/xorp/etc/templates/ospfv3.tp =================================================================== --- trunk/xorp/etc/templates/ospfv3.tp 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/ospfv3.tp 2009-12-03 16:48:08 UTC (rev 11649) @@ -93,7 +93,7 @@ %modinfo: provides ospf6; %modinfo: depends rib; %modinfo: depends policy; - %modinfo: path "ospf/xorp_ospfv3"; + %modinfo: path "xorp_ospfv3"; %modinfo: default_targetname "ospfv3"; %modinfo: status_method xrl "$(ospf6. at .targetname)/common/0.1/get_status->status:u32&reason:txt"; %modinfo: shutdown_method xrl "$(ospf6. at .targetname)/common/0.1/shutdown"; Modified: trunk/xorp/etc/templates/pim.cmds =================================================================== --- trunk/xorp/etc/templates/pim.cmds 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/pim.cmds 2009-12-03 16:48:08 UTC (rev 11649) @@ -7,67 +7,67 @@ } show pim bootstrap { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_4 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_4 $0" %help: HELP; %module: pimsm4; %tag: HELP "Display information about PIM IPv4 bootstrap routers"; } show pim bootstrap rps { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_4 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_4 $0" %help: HELP; %module: pimsm4; %tag: HELP "Display information about PIM IPv4 bootstrap RPs"; } show pim interface { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_4 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_4 $0" %help: HELP; %module: pimsm4; %tag: HELP "Display information about PIM IPv4 interfaces"; } show pim interface address { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_4 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_4 $0" %help: HELP; %module: pimsm4; %tag: HELP "Display information about addresses of PIM IPv4 interfaces"; } show pim join { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_4 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_4 $0" %help: HELP; %module: pimsm4; %tag: HELP "Display information about PIM IPv4 groups"; } show pim join all { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_4 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_4 $0" %help: HELP; %module: pimsm4; %tag: HELP "Display information about all PIM IPv4 groups"; } show pim mfc { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_4 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_4 $0" %help: HELP; %module: pimsm4; %tag: HELP "Display information about PIM Multicast Forwarding Cache"; } show pim mrib { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_4 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_4 $0" %help: HELP; %module: pimsm4; %tag: HELP "Display MRIB IPv4 information inside PIM"; } show pim neighbors { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_4 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_4 $0" %help: HELP; %module: pimsm4; %tag: HELP "Display information about PIM IPv4 neighbors"; } show pim rps { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_4 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_4 $0" %help: HELP; %module: pimsm4; %tag: HELP "Display information about PIM IPv4 RPs"; } show pim scope { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_4 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_4 $0" %help: HELP; %module: pimsm4; %tag: HELP "Display information about PIM IPv4 scope zones"; } Modified: trunk/xorp/etc/templates/pim6.cmds =================================================================== --- trunk/xorp/etc/templates/pim6.cmds 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/pim6.cmds 2009-12-03 16:48:08 UTC (rev 11649) @@ -7,67 +7,67 @@ } show pim6 bootstrap { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_6 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_6 $0" %help: HELP; %module: pimsm6; %tag: HELP "Display information about PIM IPv6 bootstrap routers"; } show pim6 bootstrap rps { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_6 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_6 $0" %help: HELP; %module: pimsm6; %tag: HELP "Display information about PIM IPv6 bootstrap RPs"; } show pim6 interface { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_6 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_6 $0" %help: HELP; %module: pimsm6; %tag: HELP "Display information about PIM IPv6 interfaces"; } show pim6 interface address { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_6 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_6 $0" %help: HELP; %module: pimsm6; %tag: HELP "Display information about addresses of PIM IPv6 interfaces"; } show pim6 join { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_6 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_6 $0" %help: HELP; %module: pimsm6; %tag: HELP "Display information about PIM IPv6 groups"; } show pim6 join all { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_6 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_6 $0" %help: HELP; %module: pimsm6; %tag: HELP "Display information about all PIM IPv6 groups"; } show pim6 mfc { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_6 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_6 $0" %help: HELP; %module: pimsm6; %tag: HELP "Display information about PIM Multicast Forwarding Cache"; } show pim6 mrib { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_6 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_6 $0" %help: HELP; %module: pimsm6; %tag: HELP "Display MRIB IPv6 information inside PIM"; } show pim6 neighbors { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_6 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_6 $0" %help: HELP; %module: pimsm6; %tag: HELP "Display information about PIM IPv6 neighbors"; } show pim6 rps { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_6 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_6 $0" %help: HELP; %module: pimsm6; %tag: HELP "Display information about PIM IPv6 RPs"; } show pim6 scope { - %command: "cli/tools/send_cli_processor_xrl -t PIMSM_6 $0" %help: HELP; + %command: "cli_send_processor_xrl -t PIMSM_6 $0" %help: HELP; %module: pimsm6; %tag: HELP "Display information about PIM IPv6 scope zones"; } Modified: trunk/xorp/etc/templates/pimsm4.tp =================================================================== --- trunk/xorp/etc/templates/pimsm4.tp 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/pimsm4.tp 2009-12-03 16:48:08 UTC (rev 11649) @@ -78,7 +78,7 @@ %modinfo: depends mfea4; %modinfo: depends igmp; %modinfo: depends rib; - %modinfo: path "pim/xorp_pimsm4"; + %modinfo: path "xorp_pimsm4"; %modinfo: default_targetname "pim"; %modinfo: status_method xrl "$(pimsm4.targetname)/common/0.1/get_status->status:u32&reason:txt"; %modinfo: startup_method xrl "$(pimsm4.targetname)/pim/0.1/start_pim"; Modified: trunk/xorp/etc/templates/pimsm6.tp =================================================================== --- trunk/xorp/etc/templates/pimsm6.tp 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/pimsm6.tp 2009-12-03 16:48:08 UTC (rev 11649) @@ -78,7 +78,7 @@ %modinfo: depends mfea6; %modinfo: depends mld; %modinfo: depends rib; - %modinfo: path "pim/xorp_pimsm6"; + %modinfo: path "xorp_pimsm6"; %modinfo: default_targetname "pim"; %modinfo: status_method xrl "$(pimsm6.targetname)/common/0.1/get_status->status:u32&reason:txt"; %modinfo: startup_method xrl "$(pimsm6.targetname)/pim/0.1/start_pim"; Modified: trunk/xorp/etc/templates/policy.cmds =================================================================== --- trunk/xorp/etc/templates/policy.cmds 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/policy.cmds 2009-12-03 16:48:08 UTC (rev 11649) @@ -23,13 +23,13 @@ } test policy $(policy.policy-statement.*) { - %command: "cli/tools/send_cli_processor_xrl -t policy -- test $3 $4" %help: HELP; + %command: "cli_send_processor_xrl -t policy -- test $3 $4" %help: HELP; %module: policy; %tag: HELP "Test a routing policy on a prefix"; } test policy $(policy.policy-statement.*) { - %command: "cli/tools/send_cli_processor_xrl -t policy -- test $3 $4 $5" %help: HELP; + %command: "cli_send_processor_xrl -t policy -- test $3 $4 $5" %help: HELP; %module: policy; %tag: HELP "Test a routing policy on a prefix and route attribute"; } @@ -41,61 +41,61 @@ } show policy network4-list { - %command: "cli/tools/send_cli_processor_xrl -t policy -- show set_ipv4net" %help: HELP; + %command: "cli_send_processor_xrl -t policy -- show set_ipv4net" %help: HELP; %module: policy; %tag: HELP "Show policy network4 lists"; } show policy network4-list $(policy.network4-list.*) { - %command: "cli/tools/send_cli_processor_xrl -t policy -- show set_ipv4net $4" %help: HELP; + %command: "cli_send_processor_xrl -t policy -- show set_ipv4net $4" %help: HELP; %module: policy; %tag: HELP "Show policy network4 list"; } show policy network6-list { - %command: "cli/tools/send_cli_processor_xrl -t policy -- show set_ipv6net" %help: HELP; + %command: "cli_send_processor_xrl -t policy -- show set_ipv6net" %help: HELP; %module: policy; %tag: HELP "Show policy network6 lists"; } show policy network6-list $(policy.network6-list.*) { - %command: "cli/tools/send_cli_processor_xrl -t policy -- show set_ipv6net $4" %help: HELP; + %command: "cli_send_processor_xrl -t policy -- show set_ipv6net $4" %help: HELP; %module: policy; %tag: HELP "Show policy network6 list"; } show policy community-list { - %command: "cli/tools/send_cli_processor_xrl -t policy -- show set_com32" %help: HELP; + %command: "cli_send_processor_xrl -t policy -- show set_com32" %help: HELP; %module: policy; %tag: HELP "Show policy community lists"; } show policy community-list $(policy.community-list.*) { - %command: "cli/tools/send_cli_processor_xrl -t policy -- show set_com32 $4" %help: HELP; + %command: "cli_send_processor_xrl -t policy -- show set_com32 $4" %help: HELP; %module: policy; %tag: HELP "Show policy community list"; } show policy as-path-list { - %command: "cli/tools/send_cli_processor_xrl -t policy -- show set_str" %help: HELP; + %command: "cli_send_processor_xrl -t policy -- show set_str" %help: HELP; %module: policy; %tag: HELP "Show policy AS path lists"; } show policy as-path-list $(policy.as-path-list.*) { - %command: "cli/tools/send_cli_processor_xrl -t policy -- show set_str $4" %help: HELP; + %command: "cli_send_processor_xrl -t policy -- show set_str $4" %help: HELP; %module: policy; %tag: HELP "Show policy AS path list"; } show policy policy-statement { - %command: "cli/tools/send_cli_processor_xrl -t policy -- show policy-statement" %help: HELP; + %command: "cli_send_processor_xrl -t policy -- show policy-statement" %help: HELP; %module: policy; %tag: HELP "Show policy statements"; } show policy policy-statement $(policy.policy-statement.*) { - %command: "cli/tools/send_cli_processor_xrl -t policy -- show policy-statement $4" %help: HELP; + %command: "cli_send_processor_xrl -t policy -- show policy-statement $4" %help: HELP; %module: policy; %tag: HELP "Show policy statement"; } Modified: trunk/xorp/etc/templates/policy.tp =================================================================== --- trunk/xorp/etc/templates/policy.tp 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/policy.tp 2009-12-03 16:48:08 UTC (rev 11649) @@ -66,7 +66,7 @@ %help: short "Configure routing policies"; %modinfo: provides policy; %modinfo: depends rib; - %modinfo: path "policy/xorp_policy"; + %modinfo: path "xorp_policy"; %modinfo: default_targetname "policy"; %modinfo: status_method xrl "$(policy.targetname)/common/0.1/get_status->status:u32&reason:txt"; %modinfo: shutdown_method xrl "$(policy.targetname)/common/0.1/shutdown"; Modified: trunk/xorp/etc/templates/rib.cmds =================================================================== --- trunk/xorp/etc/templates/rib.cmds 2009-12-03 16:46:35 UTC (rev 11648) +++ trunk/xorp/etc/templates/rib.cmds 2009-12-03 16:48:08 UTC (rev 11649) @@ -86,25 +86,25 @@ } show route admin distance ipv4 unicast { - %command: "rib/tools/show_distances ribin $5 $6" %help: HELP; + %command: "rib_show_distances ribin $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 unicast protocol administrative distances"; } show route admin distance ipv6 unicast { - %command: "rib/tools/show_distances ribin $5 $6" %help: HELP; + %command: "rib_show_distances ribin $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 unicast protocol administrative distances"; } show route admin distance ipv4 multicast { - %command: "rib/tools/show_distances ribin $5 $6" %help: HELP; + %command: "rib_show_distances ribin $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 multicast protocol administrative distances"; } show route admin distance ipv6 multicast { - %command: "rib/tools/show_distances ribin $5 $6" %help: HELP; + %command: "rib_show_distances ribin $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 multicast protocol administrative distances"; } @@ -114,49 +114,49 @@ * Connected show route table commands */ show route table ipv4 unicast connected { - %command: "rib/tools/show_routes ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 routes from connected interfaces"; } show route table ipv6 unicast connected { - %command: "rib/tools/show_routes ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 routes from connected interfaces"; } show route table ipv4 unicast connected brief { - %command: "rib/tools/show_routes -b ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 routes from connected interfaces (brief format)"; } show route table ipv6 unicast connected brief { - %command: "rib/tools/show_routes -b ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 routes from connected interfaces (brief format)"; } show route table ipv4 unicast connected detail { - %command: "rib/tools/show_routes -d ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 routes from connected interfaces (detailed format)"; } show route table ipv6 unicast connected detail { - %command: "rib/tools/show_routes -d ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 routes from connected interfaces (detailed format)"; } show route table ipv4 unicast connected terse { - %command: "rib/tools/show_routes -t ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 routes from connected interfaces (terse format)"; } show route table ipv6 unicast connected terse { - %command: "rib/tools/show_routes -t ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 routes from connected interfaces (terse format)"; } @@ -167,97 +167,97 @@ * Static show route table commands */ show route table ipv4 unicast static { - %command: "rib/tools/show_routes ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 static routes"; } show route table ipv6 unicast static { - %command: "rib/tools/show_routes ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 static routes"; } show route table ipv4 multicast static { - %command: "rib/tools/show_routes ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 MRIB static routes"; } show route table ipv6 multicast static { - %command: "rib/tools/show_routes ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 MRIB static routes"; } show route table ipv4 unicast static brief { - %command: "rib/tools/show_routes -b ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 static routes (brief format)"; } show route table ipv6 unicast static brief { - %command: "rib/tools/show_routes -b ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 static routes (brief format)"; } show route table ipv4 multicast static brief { - %command: "rib/tools/show_routes -b ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 MRIB static routes (brief format)"; } show route table ipv6 multicast static brief { - %command: "rib/tools/show_routes -b ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 MRIB static routes (brief format)"; } show route table ipv4 unicast static detail { - %command: "rib/tools/show_routes -d ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 static routes (detailed format)"; } show route table ipv6 unicast static detail { - %command: "rib/tools/show_routes -d ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 static routes (detailed format)"; } show route table ipv4 multicast static detail { - %command: "rib/tools/show_routes -d ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 MRIB static routes (detailed format)"; } show route table ipv6 multicast static detail { - %command: "rib/tools/show_routes -d ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 MRIB static routes (detailed format)"; } show route table ipv4 unicast static terse { - %command: "rib/tools/show_routes -t ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 static routes (terse format)"; } show route table ipv6 unicast static terse { - %command: "rib/tools/show_routes -t ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 static routes (terse format)"; } show route table ipv4 multicast static terse { - %command: "rib/tools/show_routes -t ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 MRIB static routes (terse format)"; } show route table ipv6 multicast static terse { - %command: "rib/tools/show_routes -t ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 MRIB static routes (terse format)"; } @@ -268,49 +268,49 @@ * fib2mrib */ show route table ipv4 multicast fib2mrib { - %command: "rib/tools/show_routes ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 unicast routes for multicast extracted from kernel"; } show route table ipv6 multicast fib2mrib { - %command: "rib/tools/show_routes ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 unicast routes for multicast extracted from kernel"; } show route table ipv4 multicast fib2mrib brief { - %command: "rib/tools/show_routes -b ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 unicast routes for multicast extracted from kernel (brief format)"; } show route table ipv6 multicast fib2mrib brief { - %command: "rib/tools/show_routes -b ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 unicast routes for multicast extracted from kernel (brief format)"; } show route table ipv4 multicast fib2mrib detail { - %command: "rib/tools/show_routes -d ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 unicast routes for multicast extracted from kernel (detailed format)"; } show route table ipv6 multicast fib2mrib detail { - %command: "rib/tools/show_routes -d ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 unicast routes for multicast extracted from kernel (detailed format)"; } show route table ipv4 multicast fib2mrib terse { - %command: "rib/tools/show_routes -t ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 unicast routes for multicast extracted from kernel (terse format)"; } show route table ipv6 multicast fib2mrib terse { - %command: "rib/tools/show_routes -t ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 unicast routes for multicast extracted from kernel (terse format)"; } @@ -321,193 +321,193 @@ * BGP */ show route table ipv4 unicast ibgp { - %command: "rib/tools/show_routes ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 iBGP routes"; } show route table ipv4 unicast ebgp { - %command: "rib/tools/show_routes ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 eBGP routes"; } show route table ipv4 multicast ibgp { - %command: "rib/tools/show_routes ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 iBGP MBGP routes"; } show route table ipv4 multicast ebgp { - %command: "rib/tools/show_routes ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 eBGP MBGP routes"; } show route table ipv6 unicast ibgp { - %command: "rib/tools/show_routes ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 iBGP routes"; } show route table ipv6 unicast ebgp { - %command: "rib/tools/show_routes ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 eBGP routes"; } show route table ipv6 multicast ibgp { - %command: "rib/tools/show_routes ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 iBGP MBGP routes"; } show route table ipv6 multicast ebgp { - %command: "rib/tools/show_routes ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 eBGP MBGP routes"; } show route table ipv4 unicast ibgp brief { - %command: "rib/tools/show_routes -b ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 iBGP routes (brief format)"; } show route table ipv4 unicast ebgp brief { - %command: "rib/tools/show_routes -b ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 eBGP routes (brief format)"; } show route table ipv4 multicast ibgp brief { - %command: "rib/tools/show_routes -b ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 iBGP MBGP routes (brief format)"; } show route table ipv4 multicast ebgp brief { - %command: "rib/tools/show_routes -b ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 eBGP MBGP routes (brief format)"; } show route table ipv6 unicast ibgp brief { - %command: "rib/tools/show_routes -b ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 iBGP routes (brief format)"; } show route table ipv6 unicast ebgp brief { - %command: "rib/tools/show_routes -b ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 eBGP routes (brief format)"; } show route table ipv6 multicast ibgp brief { - %command: "rib/tools/show_routes -b ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 iBGP MBGP routes (brief format)"; } show route table ipv6 multicast ebgp brief { - %command: "rib/tools/show_routes -b ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 eBGP MBGP routes (brief format)"; } show route table ipv4 unicast ibgp detail { - %command: "rib/tools/show_routes -d ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 iBGP routes (detailed format)"; } show route table ipv4 unicast ebgp detail { - %command: "rib/tools/show_routes -d ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 eBGP routes (detailed format)"; } show route table ipv4 multicast ibgp detail { - %command: "rib/tools/show_routes -d ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 iBGP MBGP routes (detailed format)"; } show route table ipv4 multicast ebgp detail { - %command: "rib/tools/show_routes -d ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 eBGP MBGP routes (detailed format)"; } show route table ipv6 unicast ibgp detail { - %command: "rib/tools/show_routes -d ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 iBGP routes (detailed format)"; } show route table ipv6 unicast ebgp detail { - %command: "rib/tools/show_routes -d ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 eBGP routes (detailed format)"; } show route table ipv6 multicast ibgp detail { - %command: "rib/tools/show_routes -d ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 iBGP MBGP routes (detailed format)"; } show route table ipv6 multicast ebgp detail { - %command: "rib/tools/show_routes -d ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 eBGP MBGP routes (detailed format)"; } show route table ipv4 unicast ibgp terse { - %command: "rib/tools/show_routes -t ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 iBGP routes (terse format)"; } show route table ipv4 unicast ebgp terse { - %command: "rib/tools/show_routes -t ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 eBGP routes (terse format)"; } show route table ipv4 multicast ibgp terse { - %command: "rib/tools/show_routes -t ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 iBGP MBGP routes (terse format)"; } show route table ipv4 multicast ebgp terse { - %command: "rib/tools/show_routes -t ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv4 eBGP MBGP routes (terse format)"; } show route table ipv6 unicast ibgp terse { - %command: "rib/tools/show_routes -t ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 iBGP routes (terse format)"; } show route table ipv6 unicast ebgp terse { - %command: "rib/tools/show_routes -t ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 eBGP routes (terse format)"; } show route table ipv6 multicast ibgp terse { - %command: "rib/tools/show_routes -t ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 iBGP MBGP routes (terse format)"; } show route table ipv6 multicast ebgp terse { - %command: "rib/tools/show_routes -t ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show IPv6 eBGP MBGP routes (terse format)"; } @@ -518,49 +518,49 @@ * RIP show route commands */ show route table ipv4 unicast rip { - %command: "rib/tools/show_routes ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show routes from RIP"; } show route table ipv4 unicast rip winners { - %command: "rib/tools/show_routes ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show RIP that reach forwarding engine"; } show route table ipv4 unicast rip brief { - %command: "rib/tools/show_routes -b ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show routes from RIP (brief format)"; } show route table ipv4 unicast rip winners brief { - %command: "rib/tools/show_routes -b ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show RIP that reach forwarding engine (brief format)"; } show route table ipv4 unicast rip detail { - %command: "rib/tools/show_routes -d ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show routes from RIP (detailed format)"; } show route table ipv4 unicast rip winners detail { - %command: "rib/tools/show_routes -d ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show RIP that reach forwarding engine (detailed format)"; } show route table ipv4 unicast rip terse { - %command: "rib/tools/show_routes -t ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show routes from RIP (terse format)"; } show route table ipv4 unicast rip winners terse { - %command: "rib/tools/show_routes -t ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show RIP that reach forwarding engine (terse format)"; } @@ -571,49 +571,49 @@ * RIPng show route commands */ show route table ipv6 unicast ripng { - %command: "rib/tools/show_routes ribin $4 $5 rip" %help: HELP; + %command: "rib_show_routes ribin $4 $5 rip" %help: HELP; %module: rib; %tag: HELP "Show routes from RIPng"; } show route table ipv6 unicast ripng winners { - %command: "rib/tools/show_routes ribout $4 $5 rip" %help: HELP; + %command: "rib_show_routes ribout $4 $5 rip" %help: HELP; %module: rib; %tag: HELP "Show RIPng that reach forwarding engine"; } show route table ipv6 unicast ripng brief { - %command: "rib/tools/show_routes -b ribin $4 $5 rip" %help: HELP; + %command: "rib_show_routes -b ribin $4 $5 rip" %help: HELP; %module: rib; %tag: HELP "Show routes from RIPng (brief format)"; } show route table ipv6 unicast ripng winners brief { - %command: "rib/tools/show_routes -b ribout $4 $5 rip" %help: HELP; + %command: "rib_show_routes -b ribout $4 $5 rip" %help: HELP; %module: rib; %tag: HELP "Show RIPng that reach forwarding engine (brief format)"; } show route table ipv6 unicast ripng detail { - %command: "rib/tools/show_routes -d ribin $4 $5 rip" %help: HELP; + %command: "rib_show_routes -d ribin $4 $5 rip" %help: HELP; %module: rib; %tag: HELP "Show routes from RIPng (detailed format)"; } show route table ipv6 unicast ripng winners detail { - %command: "rib/tools/show_routes -d ribout $4 $5 rip" %help: HELP; + %command: "rib_show_routes -d ribout $4 $5 rip" %help: HELP; %module: rib; %tag: HELP "Show RIPng that reach forwarding engine (detailed format)"; } show route table ipv6 unicast ripng terse { - %command: "rib/tools/show_routes -t ribin $4 $5 rip" %help: HELP; + %command: "rib_show_routes -t ribin $4 $5 rip" %help: HELP; %module: rib; %tag: HELP "Show routes from RIPng (terse format)"; } show route table ipv6 unicast ripng winners terse { - %command: "rib/tools/show_routes -t ribout $4 $5 rip" %help: HELP; + %command: "rib_show_routes -t ribout $4 $5 rip" %help: HELP; %module: rib; %tag: HELP "Show RIPng that reach forwarding engine (terse format)"; } @@ -624,49 +624,49 @@ * OSPFv2 show route commands */ show route table ipv4 unicast ospf { - %command: "rib/tools/show_routes ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show routes from OSPFv2"; } show route table ipv4 unicast ospf winners { - %command: "rib/tools/show_routes ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show OSPFv2 that reach forwarding engine"; } show route table ipv4 unicast ospf brief { - %command: "rib/tools/show_routes -b ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show routes from OSPFv2 (brief format)"; } show route table ipv4 unicast ospf winners brief { - %command: "rib/tools/show_routes -b ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show OSPFv2 that reach forwarding engine (brief format)"; } show route table ipv4 unicast ospf detail { - %command: "rib/tools/show_routes -d ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show routes from OSPFv2 (detailed format)"; } show route table ipv4 unicast ospf winners detail { - %command: "rib/tools/show_routes -d ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show OSPFv2 that reach forwarding engine (detailed format)"; } show route table ipv4 unicast ospf terse { - %command: "rib/tools/show_routes -t ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show routes from OSPFv2 (terse format)"; } show route table ipv4 unicast ospf winners terse { - %command: "rib/tools/show_routes -t ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show OSPFv2 that reach forwarding engine (terse format)"; } @@ -675,49 +675,49 @@ * OSPFv3 show route commands */ show route table ipv6 unicast ospf { - %command: "rib/tools/show_routes ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show routes from OSPFv3"; } show route table ipv6 unicast ospf winners { - %command: "rib/tools/show_routes ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show OSPFv3 that reach forwarding engine"; } show route table ipv6 unicast ospf brief { - %command: "rib/tools/show_routes -b ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show routes from OSPFv3 (brief format)"; } show route table ipv6 unicast ospf winners brief { - %command: "rib/tools/show_routes -b ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show OSPFv3 that reach forwarding engine (brief format)"; } show route table ipv6 unicast ospf detail { - %command: "rib/tools/show_routes -d ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show routes from OSPFv3 (detailed format)"; } show route table ipv6 unicast ospf winners detail { - %command: "rib/tools/show_routes -d ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show OSPFv3 that reach forwarding engine (detailed format)"; } show route table ipv6 unicast ospf terse { - %command: "rib/tools/show_routes -t ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show routes from OSPFv3 (terse format)"; } show route table ipv6 unicast ospf winners terse { - %command: "rib/tools/show_routes -t ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show OSPFv3 that reach forwarding engine (terse format)"; } @@ -727,49 +727,49 @@ * OLSRv1 IPv4 show route commands */ show route table ipv4 unicast olsr { - %command: "rib/tools/show_routes ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show routes from OLSRv1"; } show route table ipv4 unicast olsr winners { - %command: "rib/tools/show_routes ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show OLSRv1 that reach forwarding engine"; } show route table ipv4 unicast olsr brief { - %command: "rib/tools/show_routes -b ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show routes from OLSRv1 (brief format)"; } show route table ipv4 unicast olsr winners brief { - %command: "rib/tools/show_routes -b ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -b ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show OLSRv1 that reach forwarding engine (brief format)"; } show route table ipv4 unicast olsr detail { - %command: "rib/tools/show_routes -d ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show routes from OLSRv1 (detailed format)"; } show route table ipv4 unicast olsr winners detail { - %command: "rib/tools/show_routes -d ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -d ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show OLSRv1 that reach forwarding engine (detailed format)"; } show route table ipv4 unicast olsr terse { - %command: "rib/tools/show_routes -t ribin $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribin $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show routes from OLSRv1 (terse format)"; } show route table ipv4 unicast olsr winners terse { - %command: "rib/tools/show_routes -t ribout $4 $5 $6" %help: HELP; + %command: "rib_show_routes -t ribout $4 $5 $6" %help: HELP; %module: rib; %tag: HELP "Show OLSRv1 that reach forwarding engine (terse format)"; } @@ -779,97 +779,97 @@ * Show winning routes (unfiltered output from "all" routing table). */ show route table ipv4 unicast final { - %command: "rib/tools/show_routes ribout $4 $5 all" %help: HELP; + %command: "rib_show_routes ribout $4 $5 all" %help: HELP; %module: rib; %tag: HELP "Show IPv4 winning routes"; } show route table ipv6 unicast final { - %command: "rib/tools/show_routes ribin $4 $5 all" %help: HELP; + %command: "rib_show_routes ribin $4 $5 all" %help: HELP; %module: rib; %tag: HELP "Show IPv6 winning routes"; } show route table ipv4 multicast final { - %command: "rib/tools/show_routes ribin $4 $5 all" %help: HELP; + %command: "rib_show_routes ribin $4 $5 all" %help: HELP; %module: rib; %tag: HELP "Show IPv4 MRIB winning routes"; } show route table ipv6 multicast final { - %command: "rib/tools/show_routes ribin $4 $5 all" %help: HELP; + %command: "rib_show_routes ribin $4 $5 all" %help: HELP; %module: rib; %tag: HELP "Show IPv6 MRIB winning routes"; } show route table ipv4 unicast final brief { - %command: "rib/tools/show_routes -b ribout $4 $5 all" %help: HELP; + %command: "rib_show_routes -b ribout $4 $5 all" %help: HELP; %module: rib; %tag: HELP "Show IPv4 winning routes (brief format)"; } show route table ipv6 unicast final brief { - %command: "rib/tools/show_routes -b ribout $4 $5 all" %help: HELP; + %command: "rib_show_routes -b ribout $4 $5 all" %help: HELP; %module: rib; %tag: HELP "Show IPv6 winning routes (brief format)"; } show route table ipv4 multicast final brief { - %command: "rib/tools/show_routes -b ribin $4 $5 all" %help: HELP; + %command: "rib_show_routes -b ribin $4 $5 all" %help: HELP; %module: rib; @@ Diff output truncated at 100000 characters. @@ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 08:49:11 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 16:49:11 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11650] trunk/xorp/mld6igmp/SConscript Message-ID: Revision: 11650 http://xorp.svn.sourceforge.net/xorp/?rev=11650&view=rev Author: bms_fbsd Date: 2009-12-03 16:49:11 +0000 (Thu, 03 Dec 2009) Log Message: ----------- Add missing RPATH symlink. Modified Paths: -------------- trunk/xorp/mld6igmp/SConscript Modified: trunk/xorp/mld6igmp/SConscript =================================================================== --- trunk/xorp/mld6igmp/SConscript 2009-12-03 16:48:08 UTC (rev 11649) +++ trunk/xorp/mld6igmp/SConscript 2009-12-03 16:49:11 UTC (rev 11650) @@ -76,7 +76,10 @@ libxorp_mld6igmp = env.SharedLibrary(target = 'libxorp_mld6igmp', source = libxorp_mld6igmp_srcs, LIBS = '') - # XXX missing RPATH + if env['rtld_origin']: + for obj in libxorp_mld6igmp: + env.AddPostAction(libxorp_mld6igmp, + env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) else: libxorp_mld6igmp = env.StaticLibrary(target = 'libxorp_mld6igmp', source = libxorp_mld6igmp_srcs, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 09:00:45 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 17:00:45 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11651] trunk/xorp/fea/fea_click_config_generator Message-ID: Revision: 11651 http://xorp.svn.sourceforge.net/xorp/?rev=11651&view=rev Author: bms_fbsd Date: 2009-12-03 17:00:44 +0000 (Thu, 03 Dec 2009) Log Message: ----------- forcibly re-add. Added Paths: ----------- trunk/xorp/fea/fea_click_config_generator Added: trunk/xorp/fea/fea_click_config_generator =================================================================== --- trunk/xorp/fea/fea_click_config_generator (rev 0) +++ trunk/xorp/fea/fea_click_config_generator 2009-12-03 17:00:44 UTC (rev 11651) @@ -0,0 +1,1151 @@ +#!/usr/bin/awk -f +# +# $XORP: xorp/fea/xorp_fea_click_config_generator,v 1.13 2007/09/27 00:33:34 pavlin Exp $ +# + +# +# A sample script to generate Click configuration from XORP configuration. +# The first argument is the XORP configuration file name. +# +# Currently, the script is called on-demand by the FEA whenever +# the network interface information changes. +# +# Requirements: +# 1. The Click lookup element names must be "_xorp_rt4" for IPv4 and +# "_xorp_rt6" for IPv6. Those elements must support handler interface +# compatible to elements LinearIPLookup() and LookupIP6Route() +# respectively for adding and removing forwarding entries. +# 2. The first network interface/vif must be connected to _xorp_rt4[0] and +# _xorp_rt6[0], the second network interface/vif must be connected to +# _xorp_rt4[1] and _xorp_rt6[1], and so-on. +# The last port in _xorp_rt{4,6} is reserved for local delivery. +# Note that the interfaces/vifs are ordered lexigraphically by their names. +# +# Note that if both kernel-level and user-level Click are enabled +# (which is allowed), this script will print the kernel-level Click +# configuration. +# +# TODO: for now the IPv6 path generation is disabled by default, because: +# - There are few incomplete IPv6-related pieces (search for the "TODO" +# marker in the code below). +# - Currently the lastest Click release (1.4.3) does not support an +# IPv6 lookup element that has "add" and "delete" handlers to +# add/delete routing entries. +# Note that the lastest implementation of the LookupIP6Route() +# in the CVS tree supports those two handlers. +# +# To enable IPv6 path generation, modify below: +# enable_ipv6 = 0; +# to +# enable_ipv6 = 1; +# + +BEGIN { + # XXX: for now IPv6 generation is disabled + enable_ipv6 = 0; + + # Lookup element flavor selection + # IPv4: LinearIPLookup, DirectIPLookup and TrieIPLookup should work + ipv4_lookup_element = "LinearIPLookup"; + # IPv6: LookupIP6Route is the only option at the moment + ipv6_lookup_element = "LookupIP6Route"; + + # Various constants + ipv4_addr_bitlen = 32; # IPv4 address bitmask length + ipv6_addr_bitlen = 128; # IPv6 address bitmask length + + iftree_interfaces_max = 0; + iftree_vifs_max = 0; + is_click_enabled = 0; + is_kernel_click = 0; + is_user_click = 0; + is_debug = 0; + + xorp_ip4 = "_xorp_ip4"; + xorp_rt4 = "_xorp_rt4"; + xorp_ip6 = "_xorp_ip6"; + xorp_rt6 = "_xorp_rt6"; + xorp_arpt = "_xorp_arpt"; + xorp_toh = "_xorp_toh"; + # TODO: XXX: fix ether_encap if necessary + ether_encap4 = "EtherEncap(0x0800, 1:1:1:1:1:1, 2:2:2:2:2:2)"; + ether_encap6 = "EtherEncap(0x86dd, 1:1:1:1:1:1, 2:2:2:2:2:2)"; + + statement = ""; + in_comment = 0; + is_syntax_error = 0; + is_internal_error = 0; + config_level = 0; + ignore_level[0] = 1; + is_level0_interfaces = 0; + is_level0_fea = 0; + is_level0_fea_level1_click = 0; + is_level0_fea_level1_click_level2_kernel_click = 0; + is_level0_fea_level1_click_level2_user_click = 0; + is_ipv4_address = 0; + is_ipv6_address = 0; + max_xorp_rt_port = 0; + iftree_interfaces_targetname = "fea"; + fea_targetname = "fea"; +} + +function calculate_state() +{ + iftree_vifs_max = 0; + xorp_rt_port = 0; + + # + # Clear-up some temporary state + # At the same time, compute the value of iftree_vifs_max + # + for (ii = 0; ii < iftree_interfaces_max; ii++) { + ifaces_chosen[ii] = 0; + for (vi = 0; vi < iftree_interfaces_vifs_max[ii]; vi++) { + ifaces_vifs_chosen[ii,vi] = 0; + iftree_vifs_max++; + } + } + + # + # Select the interfaces and vifs by using string comparison: + # the "smaller" name first. + # + for (ci = 0; ci < iftree_interfaces_max; ci++) { + best_ii = -1; + for (ii = 0; ii < iftree_interfaces_max; ii++) { + if (ifaces_chosen[ii]) + continue; + if (best_ii == -1) { + best_ii = ii; + continue; + } + best_ifname = iftree_interfaces_ifname[best_ii]; + if (iftree_interfaces_ifname[ii] < best_ifname) { + best_ii = ii; + } + } + if (best_ii < 0) { + internal_error("Internal error: cannot sort the interface names\n"); + } + ifaces_chosen[best_ii] = 1; + + for (cv = 0; cv < iftree_interfaces_vifs_max[best_ii]; cv++) { + best_vi = -1; + for (vi = 0; vi < iftree_interfaces_vifs_max[best_ii]; vi++) { + if (ifaces_vifs_chosen[best_ii,vi]) + continue; + if (best_vi == -1) { + best_vi = vi; + continue; + } + best_vifname = iftree_interfaces_vifs_vifname[best_ii,best_vi]; + if (iftree_interfaces_vifs_vifname[best_ii,vi] < best_vifname) { + best_vi = vi; + } + } + if (best_vi < 0) { + internal_error("Internal error: cannot sort the vif names\n"); + } + ifaces_vifs_chosen[best_ii,best_vi] = 1; + + iftree_interfaces_vifs_port[best_ii,best_vi] = xorp_rt_port++; + } + } + + max_xorp_rt_port = xorp_rt_port; +} + +function check_state() +{ + for (ii = 0; ii < iftree_interfaces_max; ii++) { + ifname = iftree_interfaces_ifname[ii]; + if (iftree_interfaces_has_mac[ii] != 1) { + message = "Missing MAC address configuration for interface " ifname; + syntax_error(message); + } + if (iftree_interfaces_has_mtu[ii] != 1) { + message = "Missing MTU configuration for interface " ifname; + syntax_error(message); + } + } +} + + +function generate_click_config_header() +{ + printf("//\n"); + printf("// Generated by XORP FEA\n"); + printf("//\n"); +} + +function generate_click_shared_ip_input() +{ + check_ipv4_header = "CheckIPHeader(INTERFACES"; + local_ipv4_routes = ""; + check_ipv6_header = "CheckIP6Header("; # TODO: is this enough? + local_ipv6_routes = ""; + is_first_address4 = 1; + is_first_address6 = 1; + + for (ii = 0; ii < iftree_interfaces_max; ii++) { + for (vi = 0; vi < iftree_interfaces_vifs_max[ii]; vi++) { + for (ai4 = 0; ai4 < iftree_interfaces_vifs_addresses4_max[ii,vi]; ai4++) { + addr4 = iftree_interfaces_vifs_addresses4_addr[ii,vi,ai4]; + prefix4 = iftree_interfaces_vifs_addresses4_prefix[ii,vi,ai4]; + check_ipv4_header = check_ipv4_header " " addr4 "/" prefix4; + route = addr4 "/" ipv4_addr_bitlen " " max_xorp_rt_port; + if (is_first_address4) { + local_ipv4_routes = route; + is_first_address4 = 0; + } else { + local_ipv4_routes = local_ipv4_routes ", " route; + } + } + for (ai6 = 0; ai6 < iftree_interfaces_vifs_addresses6_max[ii,vi]; ai6++) { + addr6 = iftree_interfaces_vifs_addresses6_addr[ii,vi,ai6]; + prefix6 = iftree_interfaces_vifs_addresses6_prefix[ii,vi,ai6]; + # + # XXX: unlike the CheckIPHeader() element, the + # CheckIP6Header() element arguments are the list of + # bad addresses instead of our addresses. + # + #check_ipv6_header = check_ipv6_header " " addr6 "/" prefix6; + route = addr6 "/" ipv6_addr_bitlen " " max_xorp_rt_port; + if (is_first_address6) { + local_ipv6_routes = route; + is_first_address6 = 0; + } else { + local_ipv6_routes = local_ipv6_routes ", " route; + } + } + } + } + check_ipv4_header = check_ipv4_header ")"; + check_ipv6_header = check_ipv6_header ")"; + + printf("\n\n"); + printf("// Shared IPv4 input path and routing table\n"); + printf("\n"); + printf(" %s :: Strip(14)\n", xorp_ip4); + printf(" -> %s\n", check_ipv4_header); + printf(" -> %s :: %s(%s);\n", xorp_rt4, ipv4_lookup_element, + local_ipv4_routes); + + if (enable_ipv6) { + printf("\n\n"); + printf("// Shared IPv6 input path and routing table\n"); + printf("\n"); + printf(" %s :: Strip(14)\n", xorp_ip6); + printf(" -> %s\n", check_ipv6_header); + printf(" -> GetIP6Address(24)\n"); # XXX: need this in IPv6! + printf(" -> %s :: %s(%s)\n", xorp_rt6, ipv6_lookup_element, + local_ipv6_routes); + } +} + +function generate_click_arp_responses() +{ + printf("\n\n"); + printf("// ARP responses are copied to each ARPQuerier and the host.\n"); + printf("\n"); + printf(" %s :: Tee(%u);\n", xorp_arpt, iftree_vifs_max + 1); +} + +function generate_click_input_output_paths() +{ + port = 0; + + for (ii = 0; ii < iftree_interfaces_max; ii++) { + for (vi = 0; vi < iftree_interfaces_vifs_max[ii]; vi++) { + xorp_c = "_xorp_c" port; + xorp_out = "_xorp_out" port; + xorp_to_device = "_xorp_to_device" port; + xorp_ar = "_xorp_ar" port; + xorp_arpq = "_xorp_arpq" port; + xorp_nda = "_xorp_nda" port; + xorp_nds = "_xorp_nds" port; + + if (! iftree_interfaces_vifs_enabled[ii,vi]) { + from_device = "NullDevice"; + } else { + # + # TODO: XXX: we should find a way to configure polling + # devices. Such devices should use "PollDevice" instead + # of "FromDevice". + # + from_device = "FromDevice(" iftree_interfaces_vifs_vifname[ii,vi] ")"; + } + + if (! iftree_interfaces_vifs_enabled[ii,vi]) { + to_device = "Discard"; + } else { + to_device = "ToDevice(" iftree_interfaces_vifs_vifname[ii,vi] ")"; + } + + // IPv4 ARP + arp_responder = "ARPResponder("; + mac = iftree_interfaces_mac[ii]; + is_begin = 1; + for (ai4 = 0; ai4 < iftree_interfaces_vifs_addresses4_max[ii,vi]; ai4++) { + addr4 = iftree_interfaces_vifs_addresses4_addr[ii,vi,ai4]; + if (is_begin) + arp_responder = arp_responder addr4; + else + arp_responder = arp_responder " " addr4; + is_begin = 0; + } + arp_responder = arp_responder " " mac ")"; + + first_addr4 = "0.0.0.0"; + if (iftree_interfaces_vifs_addresses4_max[ii,vi] > 0) { + first_addr4 = iftree_interfaces_vifs_addresses4_addr[ii,vi,0]; + } + arp_querier = "ARPQuerier(" first_addr4 ", " mac ")"; + + # IPv6 Neighbor Discovery + ip6_ndadvertiser = "IP6NDAdvertiser("; + is_begin = 1; + for (ai6 = 0; ai6 < iftree_interfaces_vifs_addresses6_max[ii,vi]; ai6++) { + if (is_begin) + is_begin = 0; + else + ip6_ndadvertiser = ip6_ndadvertiser ", "; + addr6 = iftree_interfaces_vifs_addresses6_addr[ii,vi,ai6]; + # TODO: fix prefix length fetching!!! + ip6_ndadvertiser = ip6_ndadvertiser addr6 "/64 " mac; + } + ip6_ndadvertiser = ip6_ndadvertiser ")"; + + first_addr6 = "0::0"; + if (iftree_interfaces_vifs_addresses6_max[ii,vi] > 0) { + first_addr6 = iftree_interfaces_vifs_addresses6_addr[ii,vi,0]; + } + ip6_ndsolicitor = "IP6NDSolicitor(" first_addr6 ", " mac ")"; + + paint = "Paint(" port + 1 ")"; + print_unknown = "Print(\"" iftree_interfaces_vifs_vifname[ii,vi] " unknown protocol\")"; + + printf("\n\n"); + printf("// Input and output paths for %s\n", + iftree_interfaces_vifs_vifname[ii,vi]); + printf("\n"); + printf(" %s -> %s :: Classifier(\n", + from_device, + xorp_c); + printf(" 12/0800, // [0] IPv4 packet\n"); + printf(" 12/0806 20/0001, // [1] ARP request\n"); + printf(" 12/0806 20/0002, // [2] ARP reply\n"); + printf(" 12/86dd 20/3aff 54/87, // [3] IPv6 ICMP ND solicitation\n"); + printf(" 12/86dd 20/3aff 54/88, // [4] IPv6 ICMP ND advertisment\n"); + printf(" 12/86dd, // [5] IPv6 packet\n"); + printf(" -) // [6] Unsupported protocol;\n"); + printf(" %s :: Queue(200) -> %s :: %s;\n", + xorp_out, + xorp_to_device, + to_device); + + # IPv4 + printf("\n"); + printf(" // IPv4\n"); + # Plain IPv4 packets + printf(" %s[0] -> %s -> %s;\n", + xorp_c, + paint, + xorp_ip4); + # ARP request + printf(" %s[1] -> %s -> %s;\n", + xorp_c, + arp_responder, + xorp_out); + # ARP reply + printf(" %s :: %s -> %s;\n", + xorp_arpq, + arp_querier, + xorp_out); + printf(" %s[2] -> %s;\n", + xorp_c, + xorp_arpt); + printf(" %s[%u] -> [1]%s;\n", + xorp_arpt, + port, + xorp_arpq); + + # IPv6 + if (enable_ipv6) { + printf("\n"); + printf(" // IPv6\n"); + # Plain IPv6 packets + printf(" %s[5] -> %s -> %s;\n", + xorp_c, + paint, + xorp_ip6); + # ICMP Neighbor Discovery Solicitation + printf(" %s[3] -> %s -> %s;\n", + xorp_c, + ip6_ndadvertiser, + xorp_out); + # ICMP Neighbor Discovery Advertisment + printf(" %s :: %s -> %s;\n", + xorp_nds, + ip6_ndsolicitor, + xorp_out); + printf(" %s[4] -> [1]%s;\n", + xorp_c, + xorp_nds); + } else { + printf("\n"); + printf(" // Discard IPv6\n"); + # Plain IPv6 packets + printf(" %s[5] -> Discard;\n", + xorp_c); + # ICMP Neighbor Discovery Solicitation + printf(" %s[3] -> Discard;\n", + xorp_c); + printf(" %s[4] -> Discard;\n", + xorp_c); + } + + # Unknown protocol + printf("\n"); + printf(" // Unknown protocol\n"); + printf(" %s[6] -> %s -> Discard;\n", + xorp_c, + print_unknown); + + port++; + } + } +} + +function generate_click_send_packets_to_host() +{ + printf("\n\n"); + printf("// Local delivery\n"); + # TODO: XXX: Fix the Local delivery for *BSD and/or user-level Click + printf("\n"); + if (is_kernel_click) { + # + # XXX: Note that if both kernel-level and user-level Click are enabled + # (which is allowed), this script will print the kernel-level Click + # configuration. + # + printf(" %s :: ToHost;\n", xorp_toh); + } else { + printf(" %s :: Discard;\n", xorp_toh); + } + + # XXX: last port in xorp_rt{4,6} is reserved for local delivery + printf("\n"); + printf(" // IPv4\n"); + printf(" %s[%u] -> %s -> %s;\n", + xorp_rt4, + max_xorp_rt_port, + ether_encap4, + xorp_toh); + printf(" %s[%u] -> %s;\n", + xorp_arpt, + iftree_vifs_max, + xorp_toh); + + if (enable_ipv6) { + printf("\n"); + printf(" // IPv6\n"); + printf(" %s[%u] -> %s -> %s;\n", + xorp_rt6, + max_xorp_rt_port, + ether_encap6, + xorp_toh); + } +} + +function generate_click_forwarding_paths() +{ + # + # Forwarding paths for each interface + # + port = 0; + for (ii = 0; ii < iftree_interfaces_max; ii++) { + for (vi = 0; vi < iftree_interfaces_vifs_max[ii]; vi++) { + xorp_cp = "_xorp_cp" port; + paint_tee = "PaintTee(" port + 1 ")"; + xorp_gio = "_xorp_gio" port; + xorp_dt = "_xorp_dt" port; + xorp_fr = "_xorp_fr" port; + xorp_arpq = "_xorp_arpq" port; + xorp_nds = "_xorp_nds" port; + + ipgw_options = "IPGWOptions("; + is_begin = 1; + for (ai4 = 0; ai4 < iftree_interfaces_vifs_addresses4_max[ii,vi]; ai4++) { + addr4 = iftree_interfaces_vifs_addresses4_addr[ii,vi,ai4]; + if (is_begin) + ipgw_options = ipgw_options addr4; + else + ipgw_options = ipgw_options ", " addr4; + is_begin = 0; + } + ipgw_options = ipgw_options ")"; + + first_addr4 = "0.0.0.0"; + if (iftree_interfaces_vifs_addresses4_max[ii,vi] > 0) { + first_addr4 = iftree_interfaces_vifs_addresses4_addr[ii,vi,0]; + } + fix_ip_src = "FixIPSrc(" first_addr4 ")"; + mtu = iftree_interfaces_mtu[ii]; + ip_fragmenter = "IPFragmenter(" mtu ")"; + + printf("\n\n"); + printf("// Forwarding path for %s\n", + iftree_interfaces_vifs_vifname[ii,vi]); + xorp_rt_port = iftree_interfaces_vifs_port[ii,vi]; + + printf("\n"); + printf(" // IPv4\n"); + printf(" %s[%u] -> DropBroadcasts\n", + xorp_rt4, + xorp_rt_port); + printf(" -> %s :: %s\n", + xorp_cp, + paint_tee); + printf(" -> %s :: %s\n", + xorp_gio, + ipgw_options); + printf(" -> %s\n", + fix_ip_src); + printf(" -> %s :: DecIPTTL\n", + xorp_dt); + printf(" -> %s :: %s\n", + xorp_fr, + ip_fragmenter); + printf(" -> [0]%s;\n", + xorp_arpq); + + printf(" %s[1] -> ICMPError(%s, timeexceeded) -> %s;\n", + xorp_dt, + first_addr4, + xorp_rt4); + printf(" %s[1] -> ICMPError(%s, unreachable, needfrag) -> %s;\n", + xorp_fr, + first_addr4, + xorp_rt4); + printf(" %s[1] -> ICMPError(%s, parameterproblem) -> %s;\n", + xorp_gio, + first_addr4, + xorp_rt4); + printf(" %s[1] -> ICMPError(%s, redirect, host) -> %s;\n", + xorp_cp, + first_addr4, + xorp_rt4); + + if (enable_ipv6) { + printf("\n"); + printf(" // IPv6\n"); + # TODO: Must fix this bellow!!! + printf(" %s[%u] -> DropBroadcasts\n", + xorp_rt6, + xorp_rt_port); + printf(" -> DecIP6HLIM\n"); + printf(" -> [0]%s\n", + xorp_nds); + } + + port++; + } + } +} + +function is_end_of_statement(token) +{ + # Get the last character + l = length(token); + s = substr(token, l, 1); + if (s == ";") + return 1; + else + return 0; +} + +function is_end_of_string(token) +{ + # Get the last character + l = length(token); + s = substr(token, l, 1); + if (s == "\"") + return 1; + else + return 0; +} + +function is_begin_of_comment(token) +{ + # Get the first two characters + l = length(token); + if (l < 2) + return 0; + s = substr(token, 1, 2); + if (s == "/*") + return 1; + else + return 0; +} + +function is_end_of_comment(token) +{ + # Get the last two characters + l = length(token); + if (l < 2) + return 0; + s = substr(token, l-1, 2); + if (s == "*/") + return 1; + else + return 0; +} + +function process_statement(statement) +{ + if (is_debug) + printf("Statement: %s\n", statement); + + tokens_n = split(statement, tokens); + for (i = 1; i <= tokens_n; i++) { + # printf("Token: %s\n", tokens[i]); + } + # TODO: need to deal with strings + + for (i = 1; i <= tokens_n; i++) { + if (tokens[i] == "{") { + config_level++; + continue; + } + if (tokens[i] == "}") { + config_level--; + if (config_level < 0) + syntax_error("Too many }"); + continue; + } + + if (config_level == 0) { + ignore_level[0] = 1; + is_level0_interfaces = 0; + is_level0_fea = 0; + is_level0_fea_level1_click = 0; + is_level0_fea_level1_click_level2_kernel_click = 0; + is_level0_fea_level1_click_level2_user_click = 0; + if (tokens[i] == "interfaces") { + ignore_level[0] = 0; + is_level0_interfaces = 1; + } + if (tokens[i] == "fea") { + ignore_level[0] = 0; + is_level0_fea = 1; + is_level0_fea_level1_click = 0; + is_level0_fea_level1_click_level2_kernel_click = 0; + is_level0_fea_level1_click_level2_user_click = 0; + } + } + if (ignore_level[0]) + continue; + + # + # Configuration section: "interfaces {}" + # + if (is_level0_interfaces && (config_level == 1)) { + if (tokens[i] == "targetname:") { + if (i == tokens_n) + syntax_error("Missing target name"); + i++; + v = tokens[i]; + iftree_interfaces_targetname = v; + continue; + } + + if (tokens[i] == "interface") { + if (i == tokens_n) + syntax_error("Missing interface name"); + i++; + # TODO: check that the interface name is valid + v = tokens[i]; + iftree_interfaces_max++; + p = iftree_interfaces_max - 1; + iftree_interfaces_ifname[p] = v; + # XXX: by default each interface is enabled + iftree_interfaces_enabled[p] = 1; + continue; + } + syntax_error("Invalid keyword"); + } + + + if (is_level0_interfaces && (config_level == 2)) { + if (tokens[i] == "disable:") { + if (i == tokens_n) + syntax_error("Missing value"); + i++; + v = tokens[i]; + p = iftree_interfaces_max - 1; + if (v == "true") + iftree_interfaces_enabled[p] = 0; + else + iftree_interfaces_enabled[p] = 1; + continue; + } + + if (tokens[i] == "description:") { + if (i == tokens_n) + syntax_error("Missing value"); + i++; + v = tokens[i]; + p = iftree_interfaces_max - 1; + while (! is_end_of_string(v)) { + if (i == tokens_n) + syntax_error("Missing end-of-string"); + i++; + v = v " " tokens[i]; + } + iftree_interfaces_description[p] = v; + continue; + } + + if (tokens[i] == "discard:") { + if (i == tokens_n) + syntax_error("Missing value"); + i++; + v = tokens[i]; + p = iftree_interfaces_max - 1; + iftree_interfaces_discard[p] = v; + continue; + } + + if (tokens[i] == "unreachable:") { + if (i == tokens_n) + syntax_error("Missing value"); + i++; + v = tokens[i]; + p = iftree_interfaces_max - 1; + iftree_interfaces_unreachable[p] = v; + continue; + } + + if (tokens[i] == "management:") { + if (i == tokens_n) + syntax_error("Missing value"); + i++; + v = tokens[i]; + p = iftree_interfaces_max - 1; + iftree_interfaces_management[p] = v; + continue; + } + + if (tokens[i] == "mac:") { + if (i == tokens_n) + syntax_error("Missing value"); + i++; + v = tokens[i]; + p = iftree_interfaces_max - 1; + iftree_interfaces_mac[p] = v; + iftree_interfaces_has_mac[p] = 1; + continue; + } + + if (tokens[i] == "mtu:") { + if (i == tokens_n) + syntax_error("Missing value"); + i++; + v = tokens[i]; + p = iftree_interfaces_max - 1; + iftree_interfaces_mtu[p] = v; + iftree_interfaces_has_mtu[p] = 1; + continue; + } + + if (tokens[i] == "vif") { + if (i == tokens_n) + syntax_error("Missing vif name"); + i++; + # TODO: check that the vif name is valid + v = tokens[i]; + p = iftree_interfaces_max - 1; + iftree_interfaces_vifs_max[p]++; + q = iftree_interfaces_vifs_max[p] - 1; + iftree_interfaces_vifs_vifname[p,q] = v; + # XXX: by default each vif is enabled + iftree_interfaces_vifs_enabled[p,q] = 1; + continue; + } + syntax_error("Invalid keyword"); + } + + if (is_level0_interfaces && (config_level == 3)) { + if (tokens[i] == "disable:") { + if (i == tokens_n) + syntax_error("Missing value"); + i++; + v = tokens[i]; + p = iftree_interfaces_max - 1; + q = iftree_interfaces_vifs_max[p] - 1; + if (v == "true") + iftree_interfaces_vifs_enabled[p,q] = 0; + else + iftree_interfaces_vifs_enabled[p,q] = 1; + continue; + } + + if (tokens[i] == "address") { + if (i == tokens_n) + syntax_error("Missing address value"); + i++; + # TODO: check that the address value is valid + v = tokens[i]; + p = iftree_interfaces_max - 1; + q = iftree_interfaces_vifs_max[p] - 1; + is_ipv4_address = 0; + is_ipv6_address = 0; + if (split(v, tmp_array, ".") == 4) + is_ipv4_address = 1; + if (split(v, tmp_array, ":") > 1) + is_ipv6_address = 1; + if (!( is_ipv4_address || is_ipv6_address)) + syntax_error("Invalid address value"); + if (is_ipv4_address) { + iftree_interfaces_vifs_addresses4_max[p,q]++; + r = iftree_interfaces_vifs_addresses4_max[p,q] - 1; + iftree_interfaces_vifs_addresses4_addr[p,q,r] = v; + # XXX: by default each address is enabled + iftree_interfaces_vifs_addresses4_enabled[p,q,r] = 1; + } + if (is_ipv6_address) { + iftree_interfaces_vifs_addresses6_max[p,q]++; + r = iftree_interfaces_vifs_addresses6_max[p,q] - 1; + iftree_interfaces_vifs_addresses6_addr[p,q,r] = v; + # XXX: by default each address is enabled + iftree_interfaces_vifs_addresses6_enabled[p,q,r] = 1; + } + continue; + } + syntax_error("Invalid keyword"); + } + + if (is_level0_interfaces && (config_level == 4)) { + if (tokens[i] == "prefix-length:") { + if (i == tokens_n) + syntax_error("Missing value"); + i++; + v = tokens[i]; + p = iftree_interfaces_max - 1; + q = iftree_interfaces_vifs_max[p] - 1; + if (is_ipv4_address) { + r = iftree_interfaces_vifs_addresses4_max[p,q] - 1; + iftree_interfaces_vifs_addresses4_prefix[p,q,r] = v; + } + if (is_ipv6_address) { + r = iftree_interfaces_vifs_addresses6_max[p,q] - 1; + iftree_interfaces_vifs_addresses6_prefix[p,q,r] = v; + } + continue; + } + + if (tokens[i] == "broadcast:") { + if (i == tokens_n) + syntax_error("Missing value"); + i++; + v = tokens[i]; + p = iftree_interfaces_max - 1; + q = iftree_interfaces_vifs_max[p] - 1; + if (is_ipv4_address) { + r = iftree_interfaces_vifs_addresses4_max[p,q] - 1; + iftree_interfaces_vifs_addresses4_destination[p,q,r] = v; + } + if (is_ipv6_address) { + syntax_error("Invalid keyword"); + } + continue; + } + + if (tokens[i] == "destination:") { + if (i == tokens_n) + syntax_error("Missing value"); + i++; + v = tokens[i]; + p = iftree_interfaces_max - 1; + q = iftree_interfaces_vifs_max[p] - 1; + if (is_ipv4_address) { + r = iftree_interfaces_vifs_addresses4_max[p,q] - 1; + iftree_interfaces_vifs_addresses4_destination[p,q,r] = v; + } + if (is_ipv6_address) { + r = iftree_interfaces_vifs_addresses6_max[p,q] - 1; + iftree_interfaces_vifs_addresses6_destination[p,q,r] = v; + } + continue; + } + + if (tokens[i] == "multicast-capable:") { + if (i == tokens_n) + syntax_error("Missing value"); + i++; + v = tokens[i]; + p = iftree_interfaces_max - 1; + q = iftree_interfaces_vifs_max[p] - 1; + if (is_ipv4_address) { + r = iftree_interfaces_vifs_addresses4_max[p,q] - 1; + iftree_interfaces_vifs_addresses4_multicast[p,q,r] = v; + } + if (is_ipv6_address) { + r = iftree_interfaces_vifs_addresses6_max[p,q] - 1; + iftree_interfaces_vifs_addresses6_multicast[p,q,r] = v; + } + continue; + } + + if (tokens[i] == "point-to-point:") { + if (i == tokens_n) + syntax_error("Missing value"); + i++; + v = tokens[i]; + p = iftree_interfaces_max - 1; + q = iftree_interfaces_vifs_max[p] - 1; + if (is_ipv4_address) { + r = iftree_interfaces_vifs_addresses4_max[p,q] - 1; + iftree_interfaces_vifs_addresses4_p2p[p,q,r] = v; + } + if (is_ipv6_address) { + r = iftree_interfaces_vifs_addresses6_max[p,q] - 1; + iftree_interfaces_vifs_addresses6_p2p[p,q,r] = v; + } + continue; + } + + if (tokens[i] == "loopback:") { + if (i == tokens_n) + syntax_error("Missing value"); + i++; + v = tokens[i]; + p = iftree_interfaces_max - 1; + q = iftree_interfaces_vifs_max[p] - 1; + if (is_ipv4_address) { + r = iftree_interfaces_vifs_addresses4_max[p,q] - 1; + iftree_interfaces_vifs_addresses4_loopback[p,q,r] = v; + } + if (is_ipv6_address) { + r = iftree_interfaces_vifs_addresses6_max[p,q] - 1; + iftree_interfaces_vifs_addresses6_loopback[p,q,r] = v; + } + continue; + } + + if (tokens[i] == "disable:") { + if (i == tokens_n) + syntax_error("Missing value"); + i++; + v = tokens[i]; + p = iftree_interfaces_max - 1; + q = iftree_interfaces_vifs_max[p] - 1; + if (is_ipv4_address) { + r = iftree_interfaces_vifs_addresses4_max[p,q] - 1; + if (v == "true") + iftree_interfaces_vifs_addresses4_enabled[p,q,r] = 0; + else + iftree_interfaces_vifs_addresses4_enabled[p,q,r] = 1; + } + if (is_ipv6_address) { + r = iftree_interfaces_vifs_addresses6_max[p,q] - 1; + if (v == "true") + iftree_interfaces_vifs_addresses6_enabled[p,q,r] = 0; + else + iftree_interfaces_vifs_addresses6_enabled[p,q,r] = 1; + } + continue; + } + + syntax_error("Invalid keyword"); + } + + # + # Configuration section: "fea {}" + # + if (is_level0_fea && (config_level == 1)) { + if (tokens[i] == "targetname:") { + if (i == tokens_n) + syntax_error("Missing target name"); + i++; + v = tokens[i]; + fea_targetname = v; + continue; + } + + if (tokens[i] == "click") { + is_level0_fea_level1_click = 1; + is_level0_fea_level1_click_level2_kernel_click = 0; + is_level0_fea_level1_click_level2_user_click = 0; + # XXX: by default Click is enabled + is_click_enabled = 1; + continue; + } + + # XXX: ignore the rest of the configuration + continue; + } + + if (is_level0_fea && is_level0_fea_level1_click && + (config_level == 2)) { + + if (tokens[i] == "disable:") { + if (i == tokens_n) + syntax_error("Missing value"); + i++; + v = tokens[i]; + if (v == "true") + is_click_enabled = 0; + else + is_click_enabled = 1; + continue; + } + + if (tokens[i] == "kernel-click") { + is_level0_fea_level1_click_level2_kernel_click = 1; + is_level0_fea_level1_click_level2_user_click = 0; + # XXX: by default kernel-level Click is enabled + is_kernel_click = 1; + continue; + } + + if (tokens[i] == "user-click") { + is_level0_fea_level1_click_level2_kernel_click = 0; + is_level0_fea_level1_click_level2_user_click = 1; + # XXX: by default user-level Click is enabled + is_user_click = 1; + continue; + } + + # XXX: ignore the rest of the configuration + continue; + } + + if (is_level0_fea && is_level0_fea_level1_click && + is_level0_fea_level1_click_level2_kernel_click && + (config_level == 3)) { + if (tokens[i] == "disable:") { + if (i == tokens_n) + syntax_error("Missing value"); + i++; + v = tokens[i]; + if (v == "true") { + is_kernel_click = 0; + } else { + is_kernel_click = 1; + } + continue; + } + + # XXX: ignore the rest of the configuration + continue; + } + + if (is_level0_fea && is_level0_fea_level1_click && + is_level0_fea_level1_click_level2_user_click && + (config_level == 3)) { + if (tokens[i] == "disable:") { + if (i == tokens_n) + syntax_error("Missing value"); + i++; + v = tokens[i]; + if (v == "true") { + is_user_click = 0; + } else { + is_user_click = 1; + } + continue; + } + + # XXX: ignore the rest of the configuration + continue; + } + } +} + +function syntax_error(message) +{ + is_syntax_error = 1; + printf("Syntax error (file %s line %d): %s\n", FILENAME, FNR, + message) > "/dev/stderr"; + exit(1); +} + +function internal_error(message) +{ + is_internal_error = 1; + printf("Internal error (file %s): %s\n", FILENAME, + message) > "/dev/stderr"; + exit(1); +} + +{ + for (i = 1; i <= NF; i++) { + token = $i; + + # Filter-out the comments + if (is_begin_of_comment(token)) { + if (in_comment) + syntax_error("Nested comments"); + in_comment = 1; + } + if (in_comment) { + if (is_end_of_comment(token)) + in_comment = 0; + continue; + } + if (is_end_of_comment(token)) + syntax_error("Missing begin-of-comment"); + + statement = statement " " token; + if (is_end_of_statement(token)) { + process_statement(statement); + statement = ""; + } + } + process_statement(statement); + statement = ""; +} + +END { + # + # Initialize internal state + # + calculate_state(); + check_state(); + + # + # Check for syntax and internal errors + # + if (is_syntax_error || is_internal_error) + exit(1); + + # + # Check if Click is enabled and whether it is user-level or kernel Click + # + if (! is_click_enabled) + exit(0); # XXX: don't print any Click configuration + if ((! is_user_click) && (! is_kernel_click)) + exit(0); # XXX: don't print any Click configuration + + generate_click_config_header(); + generate_click_shared_ip_input(); + generate_click_arp_responses(); + generate_click_input_output_paths(); + generate_click_send_packets_to_host(); + generate_click_forwarding_paths(); + + # + # Check again for syntax and internal errors + # + if (is_syntax_error || is_internal_error) + exit(1); + + exit(0); +} + +# Local Variables: +# mode: AWK +# sh-indentation: 4 +# End: Property changes on: trunk/xorp/fea/fea_click_config_generator ___________________________________________________________________ Added: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 09:01:03 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 17:01:03 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11652] trunk/xorp/fea/xorp_fea_click_config_generator Message-ID: Revision: 11652 http://xorp.svn.sourceforge.net/xorp/?rev=11652&view=rev Author: bms_fbsd Date: 2009-12-03 17:01:03 +0000 (Thu, 03 Dec 2009) Log Message: ----------- Forcibly remove. Removed Paths: ------------- trunk/xorp/fea/xorp_fea_click_config_generator Deleted: trunk/xorp/fea/xorp_fea_click_config_generator =================================================================== --- trunk/xorp/fea/xorp_fea_click_config_generator 2009-12-03 17:00:44 UTC (rev 11651) +++ trunk/xorp/fea/xorp_fea_click_config_generator 2009-12-03 17:01:03 UTC (rev 11652) @@ -1,1151 +0,0 @@ -#!/usr/bin/awk -f -# -# $XORP: xorp/fea/xorp_fea_click_config_generator,v 1.13 2007/09/27 00:33:34 pavlin Exp $ -# - -# -# A sample script to generate Click configuration from XORP configuration. -# The first argument is the XORP configuration file name. -# -# Currently, the script is called on-demand by the FEA whenever -# the network interface information changes. -# -# Requirements: -# 1. The Click lookup element names must be "_xorp_rt4" for IPv4 and -# "_xorp_rt6" for IPv6. Those elements must support handler interface -# compatible to elements LinearIPLookup() and LookupIP6Route() -# respectively for adding and removing forwarding entries. -# 2. The first network interface/vif must be connected to _xorp_rt4[0] and -# _xorp_rt6[0], the second network interface/vif must be connected to -# _xorp_rt4[1] and _xorp_rt6[1], and so-on. -# The last port in _xorp_rt{4,6} is reserved for local delivery. -# Note that the interfaces/vifs are ordered lexigraphically by their names. -# -# Note that if both kernel-level and user-level Click are enabled -# (which is allowed), this script will print the kernel-level Click -# configuration. -# -# TODO: for now the IPv6 path generation is disabled by default, because: -# - There are few incomplete IPv6-related pieces (search for the "TODO" -# marker in the code below). -# - Currently the lastest Click release (1.4.3) does not support an -# IPv6 lookup element that has "add" and "delete" handlers to -# add/delete routing entries. -# Note that the lastest implementation of the LookupIP6Route() -# in the CVS tree supports those two handlers. -# -# To enable IPv6 path generation, modify below: -# enable_ipv6 = 0; -# to -# enable_ipv6 = 1; -# - -BEGIN { - # XXX: for now IPv6 generation is disabled - enable_ipv6 = 0; - - # Lookup element flavor selection - # IPv4: LinearIPLookup, DirectIPLookup and TrieIPLookup should work - ipv4_lookup_element = "LinearIPLookup"; - # IPv6: LookupIP6Route is the only option at the moment - ipv6_lookup_element = "LookupIP6Route"; - - # Various constants - ipv4_addr_bitlen = 32; # IPv4 address bitmask length - ipv6_addr_bitlen = 128; # IPv6 address bitmask length - - iftree_interfaces_max = 0; - iftree_vifs_max = 0; - is_click_enabled = 0; - is_kernel_click = 0; - is_user_click = 0; - is_debug = 0; - - xorp_ip4 = "_xorp_ip4"; - xorp_rt4 = "_xorp_rt4"; - xorp_ip6 = "_xorp_ip6"; - xorp_rt6 = "_xorp_rt6"; - xorp_arpt = "_xorp_arpt"; - xorp_toh = "_xorp_toh"; - # TODO: XXX: fix ether_encap if necessary - ether_encap4 = "EtherEncap(0x0800, 1:1:1:1:1:1, 2:2:2:2:2:2)"; - ether_encap6 = "EtherEncap(0x86dd, 1:1:1:1:1:1, 2:2:2:2:2:2)"; - - statement = ""; - in_comment = 0; - is_syntax_error = 0; - is_internal_error = 0; - config_level = 0; - ignore_level[0] = 1; - is_level0_interfaces = 0; - is_level0_fea = 0; - is_level0_fea_level1_click = 0; - is_level0_fea_level1_click_level2_kernel_click = 0; - is_level0_fea_level1_click_level2_user_click = 0; - is_ipv4_address = 0; - is_ipv6_address = 0; - max_xorp_rt_port = 0; - iftree_interfaces_targetname = "fea"; - fea_targetname = "fea"; -} - -function calculate_state() -{ - iftree_vifs_max = 0; - xorp_rt_port = 0; - - # - # Clear-up some temporary state - # At the same time, compute the value of iftree_vifs_max - # - for (ii = 0; ii < iftree_interfaces_max; ii++) { - ifaces_chosen[ii] = 0; - for (vi = 0; vi < iftree_interfaces_vifs_max[ii]; vi++) { - ifaces_vifs_chosen[ii,vi] = 0; - iftree_vifs_max++; - } - } - - # - # Select the interfaces and vifs by using string comparison: - # the "smaller" name first. - # - for (ci = 0; ci < iftree_interfaces_max; ci++) { - best_ii = -1; - for (ii = 0; ii < iftree_interfaces_max; ii++) { - if (ifaces_chosen[ii]) - continue; - if (best_ii == -1) { - best_ii = ii; - continue; - } - best_ifname = iftree_interfaces_ifname[best_ii]; - if (iftree_interfaces_ifname[ii] < best_ifname) { - best_ii = ii; - } - } - if (best_ii < 0) { - internal_error("Internal error: cannot sort the interface names\n"); - } - ifaces_chosen[best_ii] = 1; - - for (cv = 0; cv < iftree_interfaces_vifs_max[best_ii]; cv++) { - best_vi = -1; - for (vi = 0; vi < iftree_interfaces_vifs_max[best_ii]; vi++) { - if (ifaces_vifs_chosen[best_ii,vi]) - continue; - if (best_vi == -1) { - best_vi = vi; - continue; - } - best_vifname = iftree_interfaces_vifs_vifname[best_ii,best_vi]; - if (iftree_interfaces_vifs_vifname[best_ii,vi] < best_vifname) { - best_vi = vi; - } - } - if (best_vi < 0) { - internal_error("Internal error: cannot sort the vif names\n"); - } - ifaces_vifs_chosen[best_ii,best_vi] = 1; - - iftree_interfaces_vifs_port[best_ii,best_vi] = xorp_rt_port++; - } - } - - max_xorp_rt_port = xorp_rt_port; -} - -function check_state() -{ - for (ii = 0; ii < iftree_interfaces_max; ii++) { - ifname = iftree_interfaces_ifname[ii]; - if (iftree_interfaces_has_mac[ii] != 1) { - message = "Missing MAC address configuration for interface " ifname; - syntax_error(message); - } - if (iftree_interfaces_has_mtu[ii] != 1) { - message = "Missing MTU configuration for interface " ifname; - syntax_error(message); - } - } -} - - -function generate_click_config_header() -{ - printf("//\n"); - printf("// Generated by XORP FEA\n"); - printf("//\n"); -} - -function generate_click_shared_ip_input() -{ - check_ipv4_header = "CheckIPHeader(INTERFACES"; - local_ipv4_routes = ""; - check_ipv6_header = "CheckIP6Header("; # TODO: is this enough? - local_ipv6_routes = ""; - is_first_address4 = 1; - is_first_address6 = 1; - - for (ii = 0; ii < iftree_interfaces_max; ii++) { - for (vi = 0; vi < iftree_interfaces_vifs_max[ii]; vi++) { - for (ai4 = 0; ai4 < iftree_interfaces_vifs_addresses4_max[ii,vi]; ai4++) { - addr4 = iftree_interfaces_vifs_addresses4_addr[ii,vi,ai4]; - prefix4 = iftree_interfaces_vifs_addresses4_prefix[ii,vi,ai4]; - check_ipv4_header = check_ipv4_header " " addr4 "/" prefix4; - route = addr4 "/" ipv4_addr_bitlen " " max_xorp_rt_port; - if (is_first_address4) { - local_ipv4_routes = route; - is_first_address4 = 0; - } else { - local_ipv4_routes = local_ipv4_routes ", " route; - } - } - for (ai6 = 0; ai6 < iftree_interfaces_vifs_addresses6_max[ii,vi]; ai6++) { - addr6 = iftree_interfaces_vifs_addresses6_addr[ii,vi,ai6]; - prefix6 = iftree_interfaces_vifs_addresses6_prefix[ii,vi,ai6]; - # - # XXX: unlike the CheckIPHeader() element, the - # CheckIP6Header() element arguments are the list of - # bad addresses instead of our addresses. - # - #check_ipv6_header = check_ipv6_header " " addr6 "/" prefix6; - route = addr6 "/" ipv6_addr_bitlen " " max_xorp_rt_port; - if (is_first_address6) { - local_ipv6_routes = route; - is_first_address6 = 0; - } else { - local_ipv6_routes = local_ipv6_routes ", " route; - } - } - } - } - check_ipv4_header = check_ipv4_header ")"; - check_ipv6_header = check_ipv6_header ")"; - - printf("\n\n"); - printf("// Shared IPv4 input path and routing table\n"); - printf("\n"); - printf(" %s :: Strip(14)\n", xorp_ip4); - printf(" -> %s\n", check_ipv4_header); - printf(" -> %s :: %s(%s);\n", xorp_rt4, ipv4_lookup_element, - local_ipv4_routes); - - if (enable_ipv6) { - printf("\n\n"); - printf("// Shared IPv6 input path and routing table\n"); - printf("\n"); - printf(" %s :: Strip(14)\n", xorp_ip6); - printf(" -> %s\n", check_ipv6_header); - printf(" -> GetIP6Address(24)\n"); # XXX: need this in IPv6! - printf(" -> %s :: %s(%s)\n", xorp_rt6, ipv6_lookup_element, - local_ipv6_routes); - } -} - -function generate_click_arp_responses() -{ - printf("\n\n"); - printf("// ARP responses are copied to each ARPQuerier and the host.\n"); - printf("\n"); - printf(" %s :: Tee(%u);\n", xorp_arpt, iftree_vifs_max + 1); -} - -function generate_click_input_output_paths() -{ - port = 0; - - for (ii = 0; ii < iftree_interfaces_max; ii++) { - for (vi = 0; vi < iftree_interfaces_vifs_max[ii]; vi++) { - xorp_c = "_xorp_c" port; - xorp_out = "_xorp_out" port; - xorp_to_device = "_xorp_to_device" port; - xorp_ar = "_xorp_ar" port; - xorp_arpq = "_xorp_arpq" port; - xorp_nda = "_xorp_nda" port; - xorp_nds = "_xorp_nds" port; - - if (! iftree_interfaces_vifs_enabled[ii,vi]) { - from_device = "NullDevice"; - } else { - # - # TODO: XXX: we should find a way to configure polling - # devices. Such devices should use "PollDevice" instead - # of "FromDevice". - # - from_device = "FromDevice(" iftree_interfaces_vifs_vifname[ii,vi] ")"; - } - - if (! iftree_interfaces_vifs_enabled[ii,vi]) { - to_device = "Discard"; - } else { - to_device = "ToDevice(" iftree_interfaces_vifs_vifname[ii,vi] ")"; - } - - // IPv4 ARP - arp_responder = "ARPResponder("; - mac = iftree_interfaces_mac[ii]; - is_begin = 1; - for (ai4 = 0; ai4 < iftree_interfaces_vifs_addresses4_max[ii,vi]; ai4++) { - addr4 = iftree_interfaces_vifs_addresses4_addr[ii,vi,ai4]; - if (is_begin) - arp_responder = arp_responder addr4; - else - arp_responder = arp_responder " " addr4; - is_begin = 0; - } - arp_responder = arp_responder " " mac ")"; - - first_addr4 = "0.0.0.0"; - if (iftree_interfaces_vifs_addresses4_max[ii,vi] > 0) { - first_addr4 = iftree_interfaces_vifs_addresses4_addr[ii,vi,0]; - } - arp_querier = "ARPQuerier(" first_addr4 ", " mac ")"; - - # IPv6 Neighbor Discovery - ip6_ndadvertiser = "IP6NDAdvertiser("; - is_begin = 1; - for (ai6 = 0; ai6 < iftree_interfaces_vifs_addresses6_max[ii,vi]; ai6++) { - if (is_begin) - is_begin = 0; - else - ip6_ndadvertiser = ip6_ndadvertiser ", "; - addr6 = iftree_interfaces_vifs_addresses6_addr[ii,vi,ai6]; - # TODO: fix prefix length fetching!!! - ip6_ndadvertiser = ip6_ndadvertiser addr6 "/64 " mac; - } - ip6_ndadvertiser = ip6_ndadvertiser ")"; - - first_addr6 = "0::0"; - if (iftree_interfaces_vifs_addresses6_max[ii,vi] > 0) { - first_addr6 = iftree_interfaces_vifs_addresses6_addr[ii,vi,0]; - } - ip6_ndsolicitor = "IP6NDSolicitor(" first_addr6 ", " mac ")"; - - paint = "Paint(" port + 1 ")"; - print_unknown = "Print(\"" iftree_interfaces_vifs_vifname[ii,vi] " unknown protocol\")"; - - printf("\n\n"); - printf("// Input and output paths for %s\n", - iftree_interfaces_vifs_vifname[ii,vi]); - printf("\n"); - printf(" %s -> %s :: Classifier(\n", - from_device, - xorp_c); - printf(" 12/0800, // [0] IPv4 packet\n"); - printf(" 12/0806 20/0001, // [1] ARP request\n"); - printf(" 12/0806 20/0002, // [2] ARP reply\n"); - printf(" 12/86dd 20/3aff 54/87, // [3] IPv6 ICMP ND solicitation\n"); - printf(" 12/86dd 20/3aff 54/88, // [4] IPv6 ICMP ND advertisment\n"); - printf(" 12/86dd, // [5] IPv6 packet\n"); - printf(" -) // [6] Unsupported protocol;\n"); - printf(" %s :: Queue(200) -> %s :: %s;\n", - xorp_out, - xorp_to_device, - to_device); - - # IPv4 - printf("\n"); - printf(" // IPv4\n"); - # Plain IPv4 packets - printf(" %s[0] -> %s -> %s;\n", - xorp_c, - paint, - xorp_ip4); - # ARP request - printf(" %s[1] -> %s -> %s;\n", - xorp_c, - arp_responder, - xorp_out); - # ARP reply - printf(" %s :: %s -> %s;\n", - xorp_arpq, - arp_querier, - xorp_out); - printf(" %s[2] -> %s;\n", - xorp_c, - xorp_arpt); - printf(" %s[%u] -> [1]%s;\n", - xorp_arpt, - port, - xorp_arpq); - - # IPv6 - if (enable_ipv6) { - printf("\n"); - printf(" // IPv6\n"); - # Plain IPv6 packets - printf(" %s[5] -> %s -> %s;\n", - xorp_c, - paint, - xorp_ip6); - # ICMP Neighbor Discovery Solicitation - printf(" %s[3] -> %s -> %s;\n", - xorp_c, - ip6_ndadvertiser, - xorp_out); - # ICMP Neighbor Discovery Advertisment - printf(" %s :: %s -> %s;\n", - xorp_nds, - ip6_ndsolicitor, - xorp_out); - printf(" %s[4] -> [1]%s;\n", - xorp_c, - xorp_nds); - } else { - printf("\n"); - printf(" // Discard IPv6\n"); - # Plain IPv6 packets - printf(" %s[5] -> Discard;\n", - xorp_c); - # ICMP Neighbor Discovery Solicitation - printf(" %s[3] -> Discard;\n", - xorp_c); - printf(" %s[4] -> Discard;\n", - xorp_c); - } - - # Unknown protocol - printf("\n"); - printf(" // Unknown protocol\n"); - printf(" %s[6] -> %s -> Discard;\n", - xorp_c, - print_unknown); - - port++; - } - } -} - -function generate_click_send_packets_to_host() -{ - printf("\n\n"); - printf("// Local delivery\n"); - # TODO: XXX: Fix the Local delivery for *BSD and/or user-level Click - printf("\n"); - if (is_kernel_click) { - # - # XXX: Note that if both kernel-level and user-level Click are enabled - # (which is allowed), this script will print the kernel-level Click - # configuration. - # - printf(" %s :: ToHost;\n", xorp_toh); - } else { - printf(" %s :: Discard;\n", xorp_toh); - } - - # XXX: last port in xorp_rt{4,6} is reserved for local delivery - printf("\n"); - printf(" // IPv4\n"); - printf(" %s[%u] -> %s -> %s;\n", - xorp_rt4, - max_xorp_rt_port, - ether_encap4, - xorp_toh); - printf(" %s[%u] -> %s;\n", - xorp_arpt, - iftree_vifs_max, - xorp_toh); - - if (enable_ipv6) { - printf("\n"); - printf(" // IPv6\n"); - printf(" %s[%u] -> %s -> %s;\n", - xorp_rt6, - max_xorp_rt_port, - ether_encap6, - xorp_toh); - } -} - -function generate_click_forwarding_paths() -{ - # - # Forwarding paths for each interface - # - port = 0; - for (ii = 0; ii < iftree_interfaces_max; ii++) { - for (vi = 0; vi < iftree_interfaces_vifs_max[ii]; vi++) { - xorp_cp = "_xorp_cp" port; - paint_tee = "PaintTee(" port + 1 ")"; - xorp_gio = "_xorp_gio" port; - xorp_dt = "_xorp_dt" port; - xorp_fr = "_xorp_fr" port; - xorp_arpq = "_xorp_arpq" port; - xorp_nds = "_xorp_nds" port; - - ipgw_options = "IPGWOptions("; - is_begin = 1; - for (ai4 = 0; ai4 < iftree_interfaces_vifs_addresses4_max[ii,vi]; ai4++) { - addr4 = iftree_interfaces_vifs_addresses4_addr[ii,vi,ai4]; - if (is_begin) - ipgw_options = ipgw_options addr4; - else - ipgw_options = ipgw_options ", " addr4; - is_begin = 0; - } - ipgw_options = ipgw_options ")"; - - first_addr4 = "0.0.0.0"; - if (iftree_interfaces_vifs_addresses4_max[ii,vi] > 0) { - first_addr4 = iftree_interfaces_vifs_addresses4_addr[ii,vi,0]; - } - fix_ip_src = "FixIPSrc(" first_addr4 ")"; - mtu = iftree_interfaces_mtu[ii]; - ip_fragmenter = "IPFragmenter(" mtu ")"; - - printf("\n\n"); - printf("// Forwarding path for %s\n", - iftree_interfaces_vifs_vifname[ii,vi]); - xorp_rt_port = iftree_interfaces_vifs_port[ii,vi]; - - printf("\n"); - printf(" // IPv4\n"); - printf(" %s[%u] -> DropBroadcasts\n", - xorp_rt4, - xorp_rt_port); - printf(" -> %s :: %s\n", - xorp_cp, - paint_tee); - printf(" -> %s :: %s\n", - xorp_gio, - ipgw_options); - printf(" -> %s\n", - fix_ip_src); - printf(" -> %s :: DecIPTTL\n", - xorp_dt); - printf(" -> %s :: %s\n", - xorp_fr, - ip_fragmenter); - printf(" -> [0]%s;\n", - xorp_arpq); - - printf(" %s[1] -> ICMPError(%s, timeexceeded) -> %s;\n", - xorp_dt, - first_addr4, - xorp_rt4); - printf(" %s[1] -> ICMPError(%s, unreachable, needfrag) -> %s;\n", - xorp_fr, - first_addr4, - xorp_rt4); - printf(" %s[1] -> ICMPError(%s, parameterproblem) -> %s;\n", - xorp_gio, - first_addr4, - xorp_rt4); - printf(" %s[1] -> ICMPError(%s, redirect, host) -> %s;\n", - xorp_cp, - first_addr4, - xorp_rt4); - - if (enable_ipv6) { - printf("\n"); - printf(" // IPv6\n"); - # TODO: Must fix this bellow!!! - printf(" %s[%u] -> DropBroadcasts\n", - xorp_rt6, - xorp_rt_port); - printf(" -> DecIP6HLIM\n"); - printf(" -> [0]%s\n", - xorp_nds); - } - - port++; - } - } -} - -function is_end_of_statement(token) -{ - # Get the last character - l = length(token); - s = substr(token, l, 1); - if (s == ";") - return 1; - else - return 0; -} - -function is_end_of_string(token) -{ - # Get the last character - l = length(token); - s = substr(token, l, 1); - if (s == "\"") - return 1; - else - return 0; -} - -function is_begin_of_comment(token) -{ - # Get the first two characters - l = length(token); - if (l < 2) - return 0; - s = substr(token, 1, 2); - if (s == "/*") - return 1; - else - return 0; -} - -function is_end_of_comment(token) -{ - # Get the last two characters - l = length(token); - if (l < 2) - return 0; - s = substr(token, l-1, 2); - if (s == "*/") - return 1; - else - return 0; -} - -function process_statement(statement) -{ - if (is_debug) - printf("Statement: %s\n", statement); - - tokens_n = split(statement, tokens); - for (i = 1; i <= tokens_n; i++) { - # printf("Token: %s\n", tokens[i]); - } - # TODO: need to deal with strings - - for (i = 1; i <= tokens_n; i++) { - if (tokens[i] == "{") { - config_level++; - continue; - } - if (tokens[i] == "}") { - config_level--; - if (config_level < 0) - syntax_error("Too many }"); - continue; - } - - if (config_level == 0) { - ignore_level[0] = 1; - is_level0_interfaces = 0; - is_level0_fea = 0; - is_level0_fea_level1_click = 0; - is_level0_fea_level1_click_level2_kernel_click = 0; - is_level0_fea_level1_click_level2_user_click = 0; - if (tokens[i] == "interfaces") { - ignore_level[0] = 0; - is_level0_interfaces = 1; - } - if (tokens[i] == "fea") { - ignore_level[0] = 0; - is_level0_fea = 1; - is_level0_fea_level1_click = 0; - is_level0_fea_level1_click_level2_kernel_click = 0; - is_level0_fea_level1_click_level2_user_click = 0; - } - } - if (ignore_level[0]) - continue; - - # - # Configuration section: "interfaces {}" - # - if (is_level0_interfaces && (config_level == 1)) { - if (tokens[i] == "targetname:") { - if (i == tokens_n) - syntax_error("Missing target name"); - i++; - v = tokens[i]; - iftree_interfaces_targetname = v; - continue; - } - - if (tokens[i] == "interface") { - if (i == tokens_n) - syntax_error("Missing interface name"); - i++; - # TODO: check that the interface name is valid - v = tokens[i]; - iftree_interfaces_max++; - p = iftree_interfaces_max - 1; - iftree_interfaces_ifname[p] = v; - # XXX: by default each interface is enabled - iftree_interfaces_enabled[p] = 1; - continue; - } - syntax_error("Invalid keyword"); - } - - - if (is_level0_interfaces && (config_level == 2)) { - if (tokens[i] == "disable:") { - if (i == tokens_n) - syntax_error("Missing value"); - i++; - v = tokens[i]; - p = iftree_interfaces_max - 1; - if (v == "true") - iftree_interfaces_enabled[p] = 0; - else - iftree_interfaces_enabled[p] = 1; - continue; - } - - if (tokens[i] == "description:") { - if (i == tokens_n) - syntax_error("Missing value"); - i++; - v = tokens[i]; - p = iftree_interfaces_max - 1; - while (! is_end_of_string(v)) { - if (i == tokens_n) - syntax_error("Missing end-of-string"); - i++; - v = v " " tokens[i]; - } - iftree_interfaces_description[p] = v; - continue; - } - - if (tokens[i] == "discard:") { - if (i == tokens_n) - syntax_error("Missing value"); - i++; - v = tokens[i]; - p = iftree_interfaces_max - 1; - iftree_interfaces_discard[p] = v; - continue; - } - - if (tokens[i] == "unreachable:") { - if (i == tokens_n) - syntax_error("Missing value"); - i++; - v = tokens[i]; - p = iftree_interfaces_max - 1; - iftree_interfaces_unreachable[p] = v; - continue; - } - - if (tokens[i] == "management:") { - if (i == tokens_n) - syntax_error("Missing value"); - i++; - v = tokens[i]; - p = iftree_interfaces_max - 1; - iftree_interfaces_management[p] = v; - continue; - } - - if (tokens[i] == "mac:") { - if (i == tokens_n) - syntax_error("Missing value"); - i++; - v = tokens[i]; - p = iftree_interfaces_max - 1; - iftree_interfaces_mac[p] = v; - iftree_interfaces_has_mac[p] = 1; - continue; - } - - if (tokens[i] == "mtu:") { - if (i == tokens_n) - syntax_error("Missing value"); - i++; - v = tokens[i]; - p = iftree_interfaces_max - 1; - iftree_interfaces_mtu[p] = v; - iftree_interfaces_has_mtu[p] = 1; - continue; - } - - if (tokens[i] == "vif") { - if (i == tokens_n) - syntax_error("Missing vif name"); - i++; - # TODO: check that the vif name is valid - v = tokens[i]; - p = iftree_interfaces_max - 1; - iftree_interfaces_vifs_max[p]++; - q = iftree_interfaces_vifs_max[p] - 1; - iftree_interfaces_vifs_vifname[p,q] = v; - # XXX: by default each vif is enabled - iftree_interfaces_vifs_enabled[p,q] = 1; - continue; - } - syntax_error("Invalid keyword"); - } - - if (is_level0_interfaces && (config_level == 3)) { - if (tokens[i] == "disable:") { - if (i == tokens_n) - syntax_error("Missing value"); - i++; - v = tokens[i]; - p = iftree_interfaces_max - 1; - q = iftree_interfaces_vifs_max[p] - 1; - if (v == "true") - iftree_interfaces_vifs_enabled[p,q] = 0; - else - iftree_interfaces_vifs_enabled[p,q] = 1; - continue; - } - - if (tokens[i] == "address") { - if (i == tokens_n) - syntax_error("Missing address value"); - i++; - # TODO: check that the address value is valid - v = tokens[i]; - p = iftree_interfaces_max - 1; - q = iftree_interfaces_vifs_max[p] - 1; - is_ipv4_address = 0; - is_ipv6_address = 0; - if (split(v, tmp_array, ".") == 4) - is_ipv4_address = 1; - if (split(v, tmp_array, ":") > 1) - is_ipv6_address = 1; - if (!( is_ipv4_address || is_ipv6_address)) - syntax_error("Invalid address value"); - if (is_ipv4_address) { - iftree_interfaces_vifs_addresses4_max[p,q]++; - r = iftree_interfaces_vifs_addresses4_max[p,q] - 1; - iftree_interfaces_vifs_addresses4_addr[p,q,r] = v; - # XXX: by default each address is enabled - iftree_interfaces_vifs_addresses4_enabled[p,q,r] = 1; - } - if (is_ipv6_address) { - iftree_interfaces_vifs_addresses6_max[p,q]++; - r = iftree_interfaces_vifs_addresses6_max[p,q] - 1; - iftree_interfaces_vifs_addresses6_addr[p,q,r] = v; - # XXX: by default each address is enabled - iftree_interfaces_vifs_addresses6_enabled[p,q,r] = 1; - } - continue; - } - syntax_error("Invalid keyword"); - } - - if (is_level0_interfaces && (config_level == 4)) { - if (tokens[i] == "prefix-length:") { - if (i == tokens_n) - syntax_error("Missing value"); - i++; - v = tokens[i]; - p = iftree_interfaces_max - 1; - q = iftree_interfaces_vifs_max[p] - 1; - if (is_ipv4_address) { - r = iftree_interfaces_vifs_addresses4_max[p,q] - 1; - iftree_interfaces_vifs_addresses4_prefix[p,q,r] = v; - } - if (is_ipv6_address) { - r = iftree_interfaces_vifs_addresses6_max[p,q] - 1; - iftree_interfaces_vifs_addresses6_prefix[p,q,r] = v; - } - continue; - } - - if (tokens[i] == "broadcast:") { - if (i == tokens_n) - syntax_error("Missing value"); - i++; - v = tokens[i]; - p = iftree_interfaces_max - 1; - q = iftree_interfaces_vifs_max[p] - 1; - if (is_ipv4_address) { - r = iftree_interfaces_vifs_addresses4_max[p,q] - 1; - iftree_interfaces_vifs_addresses4_destination[p,q,r] = v; - } - if (is_ipv6_address) { - syntax_error("Invalid keyword"); - } - continue; - } - - if (tokens[i] == "destination:") { - if (i == tokens_n) - syntax_error("Missing value"); - i++; - v = tokens[i]; - p = iftree_interfaces_max - 1; - q = iftree_interfaces_vifs_max[p] - 1; - if (is_ipv4_address) { - r = iftree_interfaces_vifs_addresses4_max[p,q] - 1; - iftree_interfaces_vifs_addresses4_destination[p,q,r] = v; - } - if (is_ipv6_address) { - r = iftree_interfaces_vifs_addresses6_max[p,q] - 1; - iftree_interfaces_vifs_addresses6_destination[p,q,r] = v; - } - continue; - } - - if (tokens[i] == "multicast-capable:") { - if (i == tokens_n) - syntax_error("Missing value"); - i++; - v = tokens[i]; - p = iftree_interfaces_max - 1; - q = iftree_interfaces_vifs_max[p] - 1; - if (is_ipv4_address) { - r = iftree_interfaces_vifs_addresses4_max[p,q] - 1; - iftree_interfaces_vifs_addresses4_multicast[p,q,r] = v; - } - if (is_ipv6_address) { - r = iftree_interfaces_vifs_addresses6_max[p,q] - 1; - iftree_interfaces_vifs_addresses6_multicast[p,q,r] = v; - } - continue; - } - - if (tokens[i] == "point-to-point:") { - if (i == tokens_n) - syntax_error("Missing value"); - i++; - v = tokens[i]; - p = iftree_interfaces_max - 1; - q = iftree_interfaces_vifs_max[p] - 1; - if (is_ipv4_address) { - r = iftree_interfaces_vifs_addresses4_max[p,q] - 1; - iftree_interfaces_vifs_addresses4_p2p[p,q,r] = v; - } - if (is_ipv6_address) { - r = iftree_interfaces_vifs_addresses6_max[p,q] - 1; - iftree_interfaces_vifs_addresses6_p2p[p,q,r] = v; - } - continue; - } - - if (tokens[i] == "loopback:") { - if (i == tokens_n) - syntax_error("Missing value"); - i++; - v = tokens[i]; - p = iftree_interfaces_max - 1; - q = iftree_interfaces_vifs_max[p] - 1; - if (is_ipv4_address) { - r = iftree_interfaces_vifs_addresses4_max[p,q] - 1; - iftree_interfaces_vifs_addresses4_loopback[p,q,r] = v; - } - if (is_ipv6_address) { - r = iftree_interfaces_vifs_addresses6_max[p,q] - 1; - iftree_interfaces_vifs_addresses6_loopback[p,q,r] = v; - } - continue; - } - - if (tokens[i] == "disable:") { - if (i == tokens_n) - syntax_error("Missing value"); - i++; - v = tokens[i]; - p = iftree_interfaces_max - 1; - q = iftree_interfaces_vifs_max[p] - 1; - if (is_ipv4_address) { - r = iftree_interfaces_vifs_addresses4_max[p,q] - 1; - if (v == "true") - iftree_interfaces_vifs_addresses4_enabled[p,q,r] = 0; - else - iftree_interfaces_vifs_addresses4_enabled[p,q,r] = 1; - } - if (is_ipv6_address) { - r = iftree_interfaces_vifs_addresses6_max[p,q] - 1; - if (v == "true") - iftree_interfaces_vifs_addresses6_enabled[p,q,r] = 0; - else - iftree_interfaces_vifs_addresses6_enabled[p,q,r] = 1; - } - continue; - } - - syntax_error("Invalid keyword"); - } - - # - # Configuration section: "fea {}" - # - if (is_level0_fea && (config_level == 1)) { - if (tokens[i] == "targetname:") { - if (i == tokens_n) - syntax_error("Missing target name"); - i++; - v = tokens[i]; - fea_targetname = v; - continue; - } - - if (tokens[i] == "click") { - is_level0_fea_level1_click = 1; - is_level0_fea_level1_click_level2_kernel_click = 0; - is_level0_fea_level1_click_level2_user_click = 0; - # XXX: by default Click is enabled - is_click_enabled = 1; - continue; - } - - # XXX: ignore the rest of the configuration - continue; - } - - if (is_level0_fea && is_level0_fea_level1_click && - (config_level == 2)) { - - if (tokens[i] == "disable:") { - if (i == tokens_n) - syntax_error("Missing value"); - i++; - v = tokens[i]; - if (v == "true") - is_click_enabled = 0; - else - is_click_enabled = 1; - continue; - } - - if (tokens[i] == "kernel-click") { - is_level0_fea_level1_click_level2_kernel_click = 1; - is_level0_fea_level1_click_level2_user_click = 0; - # XXX: by default kernel-level Click is enabled - is_kernel_click = 1; - continue; - } - - if (tokens[i] == "user-click") { - is_level0_fea_level1_click_level2_kernel_click = 0; - is_level0_fea_level1_click_level2_user_click = 1; - # XXX: by default user-level Click is enabled - is_user_click = 1; - continue; - } - - # XXX: ignore the rest of the configuration - continue; - } - - if (is_level0_fea && is_level0_fea_level1_click && - is_level0_fea_level1_click_level2_kernel_click && - (config_level == 3)) { - if (tokens[i] == "disable:") { - if (i == tokens_n) - syntax_error("Missing value"); - i++; - v = tokens[i]; - if (v == "true") { - is_kernel_click = 0; - } else { - is_kernel_click = 1; - } - continue; - } - - # XXX: ignore the rest of the configuration - continue; - } - - if (is_level0_fea && is_level0_fea_level1_click && - is_level0_fea_level1_click_level2_user_click && - (config_level == 3)) { - if (tokens[i] == "disable:") { - if (i == tokens_n) - syntax_error("Missing value"); - i++; - v = tokens[i]; - if (v == "true") { - is_user_click = 0; - } else { - is_user_click = 1; - } - continue; - } - - # XXX: ignore the rest of the configuration - continue; - } - } -} - -function syntax_error(message) -{ - is_syntax_error = 1; - printf("Syntax error (file %s line %d): %s\n", FILENAME, FNR, - message) > "/dev/stderr"; - exit(1); -} - -function internal_error(message) -{ - is_internal_error = 1; - printf("Internal error (file %s): %s\n", FILENAME, - message) > "/dev/stderr"; - exit(1); -} - -{ - for (i = 1; i <= NF; i++) { - token = $i; - - # Filter-out the comments - if (is_begin_of_comment(token)) { - if (in_comment) - syntax_error("Nested comments"); - in_comment = 1; - } - if (in_comment) { - if (is_end_of_comment(token)) - in_comment = 0; - continue; - } - if (is_end_of_comment(token)) - syntax_error("Missing begin-of-comment"); - - statement = statement " " token; - if (is_end_of_statement(token)) { - process_statement(statement); - statement = ""; - } - } - process_statement(statement); - statement = ""; -} - -END { - # - # Initialize internal state - # - calculate_state(); - check_state(); - - # - # Check for syntax and internal errors - # - if (is_syntax_error || is_internal_error) - exit(1); - - # - # Check if Click is enabled and whether it is user-level or kernel Click - # - if (! is_click_enabled) - exit(0); # XXX: don't print any Click configuration - if ((! is_user_click) && (! is_kernel_click)) - exit(0); # XXX: don't print any Click configuration - - generate_click_config_header(); - generate_click_shared_ip_input(); - generate_click_arp_responses(); - generate_click_input_output_paths(); - generate_click_send_packets_to_host(); - generate_click_forwarding_paths(); - - # - # Check again for syntax and internal errors - # - if (is_syntax_error || is_internal_error) - exit(1); - - exit(0); -} - -# Local Variables: -# mode: AWK -# sh-indentation: 4 -# End: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 09:04:59 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 17:04:59 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11653] trunk/xorp Message-ID: Revision: 11653 http://xorp.svn.sourceforge.net/xorp/?rev=11653&view=rev Author: bms_fbsd Date: 2009-12-03 17:04:58 +0000 (Thu, 03 Dec 2009) Log Message: ----------- Minor variable renaming. Modified Paths: -------------- trunk/xorp/SConstruct trunk/xorp/rtrmgr/SConscript trunk/xorp/site_scons/site_tools/clntgen.py trunk/xorp/site_scons/site_tools/tgtgen.py Modified: trunk/xorp/SConstruct =================================================================== --- trunk/xorp/SConstruct 2009-12-03 17:01:03 UTC (rev 11652) +++ trunk/xorp/SConstruct 2009-12-03 17:04:58 UTC (rev 11653) @@ -291,13 +291,8 @@ env['xorp_templatedir'] = env['datadir'] + '/templates' env['xorp_tooldir'] = env['libdir'] + '/xorp/bin' # tools/* env['xorp_xrlsdir'] = env['datadir'] + '/xorp/xrls' # *.xrls +env['xorp_sourcedir'] = sourcedir # rtrmgr/util.cc and xif need this -# XXX needed by scons xrl idl wrappers -# ...and rtrmgr/util.cc -# XXX Push this down... -env['XORP_SOURCEDIR'] = sourcedir -env['XORP_BUILDDIR'] = builddir - # turnoff bgp, olsr for now. # XXX bgp is always built, olsr never built. env['WITH_BGP'] = ARGUMENTS.get('enable-bgp', False) Modified: trunk/xorp/rtrmgr/SConscript =================================================================== --- trunk/xorp/rtrmgr/SConscript 2009-12-03 17:01:03 UTC (rev 11652) +++ trunk/xorp/rtrmgr/SConscript 2009-12-03 17:04:58 UTC (rev 11653) @@ -110,8 +110,8 @@ # Pushdown for static paths in util.cc. xorp_paths = { "XORP_INSTALL_ROOT" : '\\"' + str(env['prefix']) + '\\"', - "XORP_BUILD_ROOT" : '\\"' + str(env['XORP_BUILDDIR']) + '\\"', - "XORP_SRC_ROOT" : '\\"' + str(env['XORP_SOURCEDIR']) + '\\"', + "XORP_BUILD_ROOT" : '\\"' + str(env['BUILDDIR']) + '\\"', + "XORP_SRC_ROOT" : '\\"' + str(env['xorp_sourcedir']) + '\\"', } util_cc_env = env.Clone() Modified: trunk/xorp/site_scons/site_tools/clntgen.py =================================================================== --- trunk/xorp/site_scons/site_tools/clntgen.py 2009-12-03 17:01:03 UTC (rev 11652) +++ trunk/xorp/site_scons/site_tools/clntgen.py 2009-12-03 17:04:58 UTC (rev 11653) @@ -20,7 +20,7 @@ """Add Builder for XRL interfaces to the Environment ...""" env['BUILDERS']['CLNTGEN'] = clntgen_builder - env['CLNTGEN'] = "$XORP_SOURCEDIR/xrl/scripts/clnt-gen" + env['CLNTGEN'] = "$xorp_sourcedir/xrl/scripts/clnt-gen" def exists(env): return True Modified: trunk/xorp/site_scons/site_tools/tgtgen.py =================================================================== --- trunk/xorp/site_scons/site_tools/tgtgen.py 2009-12-03 17:01:03 UTC (rev 11652) +++ trunk/xorp/site_scons/site_tools/tgtgen.py 2009-12-03 17:04:58 UTC (rev 11653) @@ -29,7 +29,7 @@ env['BUILDERS']['TGTGEN'] = tgtgen_builder - env['TGTGEN'] = "$XORP_SOURCEDIR/xrl/scripts/tgt-gen" + env['TGTGEN'] = "$xorp_sourcedir/xrl/scripts/tgt-gen" env['TGTGEN_CPPPATH'] = [] env['_TGTGEN_INCFLAGS'] = '$( ${_concat(INCPREFIX, TGTGEN_CPPPATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 09:09:29 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 17:09:29 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11654] trunk/xorp/rtrmgr/util.cc Message-ID: Revision: 11654 http://xorp.svn.sourceforge.net/xorp/?rev=11654&view=rev Author: bms_fbsd Date: 2009-12-03 17:09:29 +0000 (Thu, 03 Dec 2009) Log Message: ----------- Change default configuration filename from 'config.boot' to 'xorp.conf'. Modified Paths: -------------- trunk/xorp/rtrmgr/util.cc Modified: trunk/xorp/rtrmgr/util.cc =================================================================== --- trunk/xorp/rtrmgr/util.cc 2009-12-03 17:04:58 UTC (rev 11653) +++ trunk/xorp/rtrmgr/util.cc 2009-12-03 17:09:29 UTC (rev 11654) @@ -134,7 +134,7 @@ if (xr != NULL) { s_bin_root = xr; s_cfg_root = xr; - s_boot_file = s_cfg_root + "/rtrmgr/config.boot"; + s_boot_file = s_cfg_root + "/rtrmgr/xorp.conf"; return; } @@ -150,7 +150,7 @@ if (current_root == build_root) { s_bin_root = build_root; s_cfg_root = xorp_real_path(XORP_SRC_ROOT); - s_boot_file = s_cfg_root + "/rtrmgr/config.boot"; + s_boot_file = s_cfg_root + "/rtrmgr/xorp.conf"; debug_msg("s_bin_root: %s\n", s_bin_root.c_str()); debug_msg("s_cfg_root: %s\n", s_cfg_root.c_str()); @@ -162,7 +162,7 @@ string install_root = xorp_real_path(XORP_INSTALL_ROOT); s_bin_root = install_root; s_cfg_root = install_root; - s_boot_file = s_cfg_root + "/config.boot"; + s_boot_file = s_cfg_root + "/xorp.conf"; debug_msg("s_bin_root: %s\n", s_bin_root.c_str()); debug_msg("s_cfg_root: %s\n", s_cfg_root.c_str()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 12:36:30 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 20:36:30 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11655] trunk/xorp Message-ID: Revision: 11655 http://xorp.svn.sourceforge.net/xorp/?rev=11655&view=rev Author: bms_fbsd Date: 2009-12-03 20:36:29 +0000 (Thu, 03 Dec 2009) Log Message: ----------- FHS mega-commit. Most of these changes affect run-time linkage only. * Trim CPPPATH/LIBPATH defaults to BSD defaults only. * Trim libproto's link line. * Print libraries detected during the configure stage. * Push use of 3rd party libraries down to each individual XORP component. * Comment the fact that SCons's autoconf-like configuration support makes this more of a hassle than it should be. * Add support for optimize=minimal (-O1, and disable other optimizations). * Determine the RPATH for each class of XORP component at the top-level SConstruct. * Set the RPATH, using env.Replace(), in each SConscript, so we have fine-grained control. * The use of os.path.relpath() here now requires Python 2.6. * Add an additional symlink for the benefit of those components which will be installed under $prefix/sbin. * Do not install call_xrl/xorp_finder, they are not required in deployment. Most, but not all, XORP binaries will now have resolved dynamic links before 'scons install', due to the use of the rtld $ORIGIN feature. All are confirmed to have no unresolved DT_NEEDED entries after 'scons install', using ldd(1); however a router has not yet been run. Modified Paths: -------------- trunk/xorp/SConstruct trunk/xorp/bgp/SConscript trunk/xorp/bgp/tools/SConscript trunk/xorp/cli/SConscript trunk/xorp/cli/libtecla/SConscript trunk/xorp/cli/tools/SConscript trunk/xorp/contrib/mld6igmp_lite/SConscript trunk/xorp/contrib/olsr/SConscript trunk/xorp/fea/SConscript trunk/xorp/fea/tools/SConscript trunk/xorp/fib2mrib/SConscript trunk/xorp/libcomm/SConscript trunk/xorp/libfeaclient/SConscript trunk/xorp/libproto/SConscript trunk/xorp/libxipc/SConscript trunk/xorp/libxipc/tests/SConscript trunk/xorp/libxorp/SConscript trunk/xorp/mld6igmp/SConscript trunk/xorp/mrt/SConscript trunk/xorp/ospf/SConscript trunk/xorp/ospf/tools/SConscript trunk/xorp/pim/SConscript trunk/xorp/policy/SConscript trunk/xorp/policy/backend/SConscript trunk/xorp/policy/common/SConscript trunk/xorp/rib/SConscript trunk/xorp/rib/tools/SConscript trunk/xorp/rip/SConscript trunk/xorp/rip/tools/SConscript trunk/xorp/rtrmgr/SConscript trunk/xorp/static_routes/SConscript trunk/xorp/vrrp/SConscript trunk/xorp/xrl/interfaces/SConscript trunk/xorp/xrl/targets/SConscript Modified: trunk/xorp/SConstruct =================================================================== --- trunk/xorp/SConstruct 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/SConstruct 2009-12-03 20:36:29 UTC (rev 11655) @@ -17,13 +17,9 @@ # $ID$ -# TODO tone down linker line spamming, -lpcre etc; stage use of LIBS please. # TODO cross compiles. -# TODO Add separate toolchain test for C99 varargs macros. -# TODO Add separate toolchain test for GNU varargs macros. # TODO Fix default include/lib paths, pass in from environment. # TODO Merge scons-unfamiliar syntactic sugar from YHC's sconsfiles. -# TODO conditionalize new directory layout here gnutoolwarning = """ WARNING: The GNU %s was not detected on your system. @@ -32,8 +28,8 @@ """ # The XRL tgt-gen and clnt-gen scripts use Python 2.3+'s optparse -# class. -EnsurePythonVersion(2, 3) +# class. However, os.path.relpath() requires Python 2.6. +EnsurePythonVersion(2, 6) # SCons 0.98.4 is the earliest release that we have tested. Earlier # ones may work. If so, please submit a Trac issue so the check can @@ -72,7 +68,8 @@ allowed_values=('no', 'yes', 'full', 'override'), map={}, ignorecase=2), EnumVariable('optimize', 'Build with optimization', 'yes', - allowed_values=('no', 'yes', 'full', 'size', 'override'), + allowed_values=('no', 'minimal', 'yes', 'full', + 'size', 'override'), map={}, ignorecase=2), EnumVariable('profile', 'Build with profiling', 'no', allowed_values=('no', 'gprof', 'pprof', 'override'), @@ -122,13 +119,15 @@ log_args(builddir + '/.scons_build_args') +# XXX TODO: Make initial CPPPATH/LIBPATH derive from +# autodetected host system *or* command line. env = Environment( TOOLS = ['default', 'autotest', 'clntgen', 'tgtgen', 'TOOL_SUBST'], ENV = os.environ, BUILDDIR = builddir, - CPPPATH=['/usr/sfw/include', '/opt/local/include', '/usr/local/include', '$BUILDDIR'], - LIBPATH=['/usr/sfw/lib', '/opt/local/lib', '/usr/local/lib'], + CPPPATH=['/usr/local/include', '$BUILDDIR'], + LIBPATH=['/usr/local/lib'], variables = vars) prefix = env['prefix'] @@ -284,8 +283,9 @@ # The image layout is intended to be FHS 2.3 compliant, for the benefit # of 3rd party packagers and distributors. # +env['xorp_rootdir'] = env['exec_prefix'] # used to determine RPATH env['xorp_confdir'] = env['sysconfdir'] # path to xorp.conf -env['xorp_libdir'] = env['libdir'] + '/xorp/lib' # Shared libraries +env['xorp_libdir'] = env['libdir'] + '/xorp/lib' env['xorp_moduledir'] = env['libdir'] + '/xorp/sbin' # Protocol modules env['xorp_sbindir'] = env['sbindir'] # End-user binaries env['xorp_templatedir'] = env['datadir'] + '/templates' @@ -300,8 +300,14 @@ ########## start configure magic -if not env.GetOption('clean') and not env.GetOption('help'): +if env.has_key('LIBS'): + pre_LIBS = env['LIBS'] +else: + pre_LIBS = [] +if not env.GetOption('clean') and \ + not env.GetOption('help'): + env['MISSING_DEPS'] = [] env['SKIPPED_DEPS'] = [] @@ -381,8 +387,27 @@ if env['SKIPPED_DEPS']: print 'Optional dependencies not found:\n - %s' % '\n - '.join(env['SKIPPED_DEPS']) - conf.Finish() + newenv = conf.Finish() + # + # Configure will put all libraries in global link line, during checks. + # This is not what we want, as it means all binaries get these LIBS. + # We should be able to check, for libraries, at SCons level, + # by looking in conf.havedict, but that isn't exported. + # + # It seems we'd be best off defining a class of our own, containing + # things we want to see, and passing that in and out of the + # config tests when we split up allconfig.py. + # For now, let's assume that libraries are present, and link against + # them on a piecemeal basis. + # + post_LIBS = env['LIBS'] + env['LIBS'] = pre_LIBS + print 'Detected libraries:', + for x in post_LIBS: + print x, + print + ########## end configure magic if SCons.Tool.FindTool(['gcc'], env) is None or \ @@ -401,7 +426,19 @@ Split(env['CFLAGS']))) env.Replace( CXXFLAGS = filter(lambda s: not s.startswith('-O'), Split(env['CXXFLAGS']))) - bigodict = { 'no': '-O0', 'yes': '-O1', 'full': '-O2', 'size': '-Os' } + bigodict = { 'no': '-O0', + # 'minimal' denotes only those optimizations + # necessary to force gcc to perform the tree_sink + # pass, to elide most STL template instantiations. + 'minimal': "-O1 -fno-defer-pop -fno-delayed-branch \ +-fno-guess-branch-probability -fno-cprop-registers -fno-if-conversion \ +-fno-if-conversion2 -fno-tree-ccp -fno-tree-dce -fno-tree-dominator-opts \ +-fno-tree-dse -fno-tree-ter -fno-tree-lrs -fno-tree-sra \ +-fno-tree-copyrename -fno-tree-fre -fno-tree-ch -fno-unit-at-a-time \ +-fno-merge-constants", + 'yes': '-O1', + 'full': '-O2', + 'size': '-Os' } bigoflag = bigodict[env['optimize']] if not env['optimize'] == 'no': env.AppendUnique(CFLAGS = [ bigoflag ]) @@ -529,42 +566,56 @@ # # If rtld_origin is True, the linker will be passed a relative RPATH. # This allows the package itself to be relocated in the filesystem -# as a whole. +# as a whole. This also allows us to run binaries before we ship them. # if env.has_key('SHAREDLIBS'): if env['rtld_origin']: + # # Build a subdirectory for holding symlinks to libraries upfront, so # that binaries about to be built can be run from inside the BUILDDIR. - # Build a further alias for the benefit of entities installed - # in $xorp_sbindir. - Execute(Mkdir(builddir + '/lib')) - Execute(Mkdir(builddir + '/lib/xorp')) - Execute(env.Symlink(builddir + '/lib', builddir + '/lib/xorp/lib')) + # + # XXX Assumes that $libdir is below $exec_prefix. If the + # user changes this, results are undefined. + # + # $BUILDIR/lib will contain .so symlinks + # + xorp_alias_libdir = os.path.join(builddir, 'lib') + Execute(Mkdir(xorp_alias_libdir)) + env['xorp_alias_libdir'] = xorp_alias_libdir + # + # Build a further alias for the benefit of entities which + # will be later installed in $xorp_sbindir. + # + # $BUILDIR/lib/xorp/lib will point to $BUILDIR/lib + # + xorp_alias_subdir = os.path.join(xorp_alias_libdir, 'xorp') + Execute(Mkdir(xorp_alias_subdir)) + # + xorp_module_alias_libdir = os.path.join(xorp_alias_subdir, 'lib') + Execute(env.Symlink(xorp_alias_libdir, xorp_module_alias_libdir)) + env['xorp_module_alias_libdir'] = xorp_module_alias_libdir # Tell rtld to turn on $ORIGIN processing by default. # NOTE: GNU ld specific flag. env.PrependUnique( LINKFLAGS = [ '-Wl,-z,origin' ] ) - # - # Now fixup the RPATH. - # FIXME This is not correct for all binaries. Some - # get installed in locations other than $bindir. - # The RPATH actually needs to get re-evaluated on each - # binary target, depending on how far down they get installed. - # - #rellibdir = os.path.relpath(env.Dir('$libdir').abspath, - # env.Dir('$bindir').abspath) - rellibdir = '../lib' - env.AppendUnique(RPATH = [ - env.Literal(os.path.join('\\$$ORIGIN', rellibdir)) - ]) + # Set relative RPATH for each kind of installed XORP component. + env['xorp_sbin_rpath'] = os.path.join('\\$$ORIGIN', + os.path.relpath(env.Dir('$xorp_libdir').abspath, + env.Dir('$xorp_sbindir').abspath)) + env['xorp_tool_rpath'] = os.path.join('\\$$ORIGIN', + os.path.relpath(env.Dir('$xorp_libdir').abspath, + env.Dir('$xorp_tooldir').abspath)) + env['xorp_module_rpath'] = os.path.join('\\$$ORIGIN', + os.path.relpath(env.Dir('$xorp_libdir').abspath, + env.Dir('$xorp_moduledir').abspath)) else: # Hardcode the RPATH to our final destination. - # Developers will need to set LD_LIBRARY_PATH until they install. - env.AppendUnique(RPATH = [ - #'$xorp_libdir', - '$libdir', - ]) + # Developers will need to set LD_LIBRARY_PATH until they install + # binaries from the BUILDDIR. + env['xorp_sbin_rpath'] = env['xorp_libdir'] + env['xorp_tool_rpath'] = env['xorp_libdir'] + env['xorp_module_rpath'] = env['xorp_libdir'] # Export global symbols as dynamic in executables for runtime backtraces # w/o GDB or corefiles in production deployments. @@ -573,6 +624,7 @@ '-rdynamic', ]) -env.SConscript(['SConscript'], variant_dir='$BUILDDIR', exports='env', duplicate=0) +env.SConscript(['SConscript'], variant_dir='$BUILDDIR', + exports='env', duplicate=0) env.Help(vars.GenerateHelpText(env)) Modified: trunk/xorp/bgp/SConscript =================================================================== --- trunk/xorp/bgp/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/bgp/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -67,15 +67,14 @@ 'xorp_comm', ]) +env.Replace(RPATH = [ + env.Literal(env['xorp_module_rpath']) +]) + ### libxorp_bgp libxorp_bgp_env = env.Clone() -#if is_shared: -# libxorp_bgp_env.AppendUnique(LINKFLAGS = [ -# '-Wl,-z,defs', -# ]) - libxorp_bgp_srcs = [ 'aspath.cc', 'attribute_manager.cc', Modified: trunk/xorp/bgp/tools/SConscript =================================================================== --- trunk/xorp/bgp/tools/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/bgp/tools/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -45,6 +45,10 @@ 'xorp_comm', ]) +env.Replace(RPATH = [ + env.Literal(env['xorp_tool_rpath']) +]) + ### print_peers ppeers_srcs = [ Modified: trunk/xorp/cli/SConscript =================================================================== --- trunk/xorp/cli/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/cli/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -46,6 +46,7 @@ '$BUILDDIR/cli/libtecla', ]) +# Internal libraries. env.AppendUnique(LIBS = [ 'xif_cli_processor', 'xst_cli', @@ -56,6 +57,15 @@ 'xorp_core', ]) +# External libraries. +env.AppendUnique(LIBS = [ + 'pcreposix' +]) + +env.Replace(RPATH = [ + env.Literal(env['xorp_tool_rpath']) +]) + libxorp_cli_srcs = [ 'cli_client.cc', 'cli_command.cc', Modified: trunk/xorp/cli/libtecla/SConscript =================================================================== --- trunk/xorp/cli/libtecla/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/cli/libtecla/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -66,6 +66,10 @@ 'version.c' ] +# External libraries +env.AppendUnique(LIBS = [ + 'curses' +]) if is_shared: libxorp_tecla = env.SharedLibrary('libxorp_tecla', libtecla_srcs) Modified: trunk/xorp/cli/tools/SConscript =================================================================== --- trunk/xorp/cli/tools/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/cli/tools/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -45,6 +45,10 @@ 'xorp_comm', ]) +env.Replace(RPATH = [ + env.Literal(env['xorp_tool_rpath']) +]) + cligensrcs = [ 'cli_generic.cc' ] Modified: trunk/xorp/contrib/mld6igmp_lite/SConscript =================================================================== --- trunk/xorp/contrib/mld6igmp_lite/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/contrib/mld6igmp_lite/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -62,6 +62,10 @@ 'xorp_comm' ]) +env.Replace(RPATH = [ + env.Literal(env['xorp_module_rpath']) +]) + libmld6igmplitesrcs = [ 'mld6igmp_config.cc', 'mld6igmp_group_record.cc', Modified: trunk/xorp/contrib/olsr/SConscript =================================================================== --- trunk/xorp/contrib/olsr/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/contrib/olsr/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -69,6 +69,10 @@ 'xorp_comm', ]) +env.Replace(RPATH = [ + env.Literal(env['xorp_module_rpath']) +]) + ### libolsr libolsrsrcs = [ Modified: trunk/xorp/fea/SConscript =================================================================== --- trunk/xorp/fea/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/fea/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -108,8 +108,15 @@ 'xorp_core' ] +# Internal libraries. +# Note special use of conditional above. env.PrependUnique(LIBS = libxorp_fea_linkorder) +# External libraries. +env.AppendUnique(LIBS = [ + 'pcap' +]) + # Report unresolved symbol references when building the FEA. if is_shared: env.AppendUnique(LINKFLAGS = [ '-Wl,-z,defs', ]) @@ -147,6 +154,10 @@ 'xrl_mfea_node.cc' ] +env.Replace(RPATH = [ + env.Literal(env['xorp_module_rpath']) +]) + if is_shared: libxorp_fea_srcs += libxfdp_srcs libxorp_fea = env.SharedLibrary(target = 'libxorp_fea', @@ -154,7 +165,8 @@ if env['rtld_origin']: for obj in libxorp_fea: env.AddPostAction(libxorp_fea, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + env.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libxorp_fea)) else: @@ -167,14 +179,6 @@ ####################### -# new path -#feapath = '$bindir' - -# old path -feapath = '$exec_prefix/fea' - -####################### - env = env.Clone() if is_shared: Modified: trunk/xorp/fea/tools/SConscript =================================================================== --- trunk/xorp/fea/tools/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/fea/tools/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -49,6 +49,10 @@ 'xorp_comm', ]) +env.Replace(RPATH = [ + env.Literal(env['xorp_tool_rpath']) +]) + showifsrcs = [ 'show_interfaces.cc' ] Modified: trunk/xorp/fib2mrib/SConscript =================================================================== --- trunk/xorp/fib2mrib/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/fib2mrib/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -61,6 +61,10 @@ 'xorp_comm' ]) +env.Replace(RPATH = [ + env.Literal(env['xorp_module_rpath']) +]) + libxorp_fib2mrib_srcs = [ 'fib2mrib_node.cc', 'fib2mrib_varrw.cc', @@ -75,7 +79,8 @@ if env['rtld_origin']: for obj in libxorp_fib2mrib: env.AddPostAction(libxorp_fib2mrib, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + env.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) else: libxorp_fib2mrib = env.StaticLibrary( target = 'libxorp_fib2mrib', Modified: trunk/xorp/libcomm/SConscript =================================================================== --- trunk/xorp/libcomm/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/libcomm/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -42,7 +42,8 @@ if env['rtld_origin']: for obj in libxorp_comm: env.AddPostAction(libxorp_comm, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + env.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) else: libxorp_comm = env.StaticLibrary(target = 'libxorp_comm', source = sources) Modified: trunk/xorp/libfeaclient/SConscript =================================================================== --- trunk/xorp/libfeaclient/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/libfeaclient/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -47,7 +47,8 @@ if env['rtld_origin']: for obj in libxorp_fea_client: env.AddPostAction(libxorp_fea_client, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + env.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) else: libxorp_fea_client = env.StaticLibrary(target = 'libxorp_fea_client', source = libxorp_fea_client_srcs) Modified: trunk/xorp/libproto/SConscript =================================================================== --- trunk/xorp/libproto/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/libproto/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -28,9 +28,11 @@ env.AppendUnique(CPPPATH = [ "#" ]) env.PrependUnique(LIBPATH = [ '$BUILDDIR/libxorp'] ) -# XXX 'crypto' is a base system prerequisite; use LINKFLAGS? -env.AppendUnique(LIBS = ['xorp_core', 'crypto']) +env.AppendUnique(LIBS = [ + 'xorp_core' +]) + sources = [ 'checksum.c', 'packet.cc', @@ -46,7 +48,8 @@ if env['rtld_origin']: for obj in libxorp_proto: env.AddPostAction(libxorp_proto, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + env.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) else: libxorp_proto = env.StaticLibrary(target = 'libxorp_proto', source = sources) Modified: trunk/xorp/libxipc/SConscript =================================================================== --- trunk/xorp/libxipc/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/libxipc/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -41,11 +41,17 @@ '$BUILDDIR/libxorp' ]) +# Internal libraries libxipc_env.AppendUnique(LIBS = [ 'xorp_comm', 'xorp_core' ]) +# External libraries +libxipc_env.AppendUnique(LIBS = [ + 'crypto' + ]) + libxipc_sources = [ 'finder_client.cc', 'finder_client_observer.cc', @@ -110,7 +116,8 @@ if env['rtld_origin']: for obj in libxipc: env.AddPostAction(libxipc, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + env.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libxipc)) else: @@ -173,7 +180,8 @@ if env['rtld_origin']: for obj in libfinder: env.AddPostAction(libfinder, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + env.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libfinder)) else: @@ -203,6 +211,10 @@ 'xorp_core' ]) +env.Replace(RPATH = [ + env.Literal(env['xorp_sbin_rpath']) +]) + xorp_finder = env.Program(target = 'xorp_finder', source = [ 'finder_main.cc' ]) Modified: trunk/xorp/libxipc/tests/SConscript =================================================================== --- trunk/xorp/libxipc/tests/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/libxipc/tests/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -87,7 +87,7 @@ return [ x.replace('$BUILDDIR', Dir(tenv['BUILDDIR']).abspath) \ for x in tenv['LIBPATH'] ] -env['RPATH'] += local_rpath(env) +env.AppendUnique(RPATH = local_rpath(env) ) env.PrependUnique(LIBS = [ 'xif_test_xrls', Modified: trunk/xorp/libxorp/SConscript =================================================================== --- trunk/xorp/libxorp/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/libxorp/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -28,6 +28,10 @@ env.AppendUnique(CPPPATH = [ '#' ]) +# External libraries. +# On BSD, and others, we need -lrt for clock_gettime(). +env.AppendUnique(LIBS = [ 'rt' ]) + libxorp_core_srcs = [ # C files 'daemon.c', @@ -91,7 +95,8 @@ if env['rtld_origin']: for obj in libxorp_core: env.AddPostAction(libxorp_core, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + env.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) else: libxorp_core = env.StaticLibrary(target = 'libxorp_core', source = libxorp_core_srcs) Modified: trunk/xorp/mld6igmp/SConscript =================================================================== --- trunk/xorp/mld6igmp/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/mld6igmp/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -72,6 +72,10 @@ 'xrl_mld6igmp_node.cc' ] +env.Replace(RPATH = [ + env.Literal(env['xorp_module_rpath']) +]) + if is_shared: libxorp_mld6igmp = env.SharedLibrary(target = 'libxorp_mld6igmp', source = libxorp_mld6igmp_srcs, @@ -79,7 +83,8 @@ if env['rtld_origin']: for obj in libxorp_mld6igmp: env.AddPostAction(libxorp_mld6igmp, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + env.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) else: libxorp_mld6igmp = env.StaticLibrary(target = 'libxorp_mld6igmp', source = libxorp_mld6igmp_srcs, Modified: trunk/xorp/mrt/SConscript =================================================================== --- trunk/xorp/mrt/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/mrt/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -39,7 +39,8 @@ if env['rtld_origin']: for obj in libxorp_mrt: env.AddPostAction(libxorp_mrt, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + env.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) else: libxorp_mrt = env.StaticLibrary(target = 'libxorp_mrt', source = sources) Modified: trunk/xorp/ospf/SConscript =================================================================== --- trunk/xorp/ospf/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/ospf/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -70,6 +70,10 @@ 'xorp_comm', ]) +env.Replace(RPATH = [ + env.Literal(env['xorp_module_rpath']) +]) + libxorp_ospf_srcs = [ 'auth.cc', 'area_router.cc', @@ -94,7 +98,8 @@ if env['rtld_origin']: for obj in libxorp_ospf: env.AddPostAction(libxorp_ospf, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + env.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) else: libxorp_ospf = env.StaticLibrary(target = 'libxorp_ospf', source = libxorp_ospf_srcs, Modified: trunk/xorp/ospf/tools/SConscript =================================================================== --- trunk/xorp/ospf/tools/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/ospf/tools/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -48,6 +48,10 @@ 'xorp_comm', ]) +env.Replace(RPATH = [ + env.Literal(env['xorp_tool_rpath']) +]) + cleardbsrcs = [ 'clear_database.cc' ] Modified: trunk/xorp/pim/SConscript =================================================================== --- trunk/xorp/pim/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/pim/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -64,6 +64,10 @@ 'xorp_comm' ]) +env.Replace(RPATH = [ + env.Literal(env['xorp_module_rpath']) +]) + libxorp_pim_srcs = [ 'pim_bsr.cc', 'pim_config.cc', @@ -105,7 +109,8 @@ if env['rtld_origin']: for obj in libxorp_pim: env.AddPostAction(libxorp_pim, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + env.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libxorp_pim)) else: Modified: trunk/xorp/policy/SConscript =================================================================== --- trunk/xorp/policy/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/policy/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -61,6 +61,10 @@ 'xorp_comm' ]) +env.Replace(RPATH = [ + env.Literal(env['xorp_module_rpath']) +]) + libxorp_policy_srcs = [ 'code.cc', 'code_generator.cc', @@ -100,7 +104,8 @@ if env['rtld_origin']: for obj in libxorp_policy: env.AddPostAction(libxorp_policy, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + env.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libxorp_policy)) else: libxorp_policy = env.StaticLibrary(target = 'libxorp_policy', Modified: trunk/xorp/policy/backend/SConscript =================================================================== --- trunk/xorp/policy/backend/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/policy/backend/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -47,7 +47,8 @@ if env['rtld_origin']: for obj in libpbe: env.AddPostAction(libpbe, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + env.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libpbe)) else: Modified: trunk/xorp/policy/common/SConscript =================================================================== --- trunk/xorp/policy/common/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/policy/common/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -38,6 +38,11 @@ 'varrw.cc' ] +# External libraries +env.AppendUnique(LIBS = [ + 'pcreposix' +]) + is_shared = env.has_key('SHAREDLIBS') # deal with bgp aspath shared code @@ -48,7 +53,8 @@ if env['rtld_origin']: for obj in libpcm: env.AddPostAction(libpcm, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + env.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) env.Alias('install', env.InstallLibrary(env['xorp_libdir'], libpcm)) else: obj_aspath = env.StaticObject(target = 'aspath', Modified: trunk/xorp/rib/SConscript =================================================================== --- trunk/xorp/rib/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/rib/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -75,6 +75,10 @@ 'xorp_comm' ]) +env.Replace(RPATH = [ + env.Literal(env['xorp_module_rpath']) +]) + libxorp_rib_srcs = [ 'profile_vars.cc', 'protocol.cc', @@ -105,7 +109,8 @@ if env['rtld_origin']: for obj in libxorp_rib: env.AddPostAction(libxorp_rib, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + env.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) else: libxorp_rib = env.StaticLibrary(target = 'libxorp_rib', source = libxorp_rib_srcs, Modified: trunk/xorp/rib/tools/SConscript =================================================================== --- trunk/xorp/rib/tools/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/rib/tools/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -48,6 +48,10 @@ 'xorp_comm', ]) +env.Replace(RPATH = [ + env.Literal(env['xorp_tool_rpath']) +]) + shdistsrcs = [ 'show_distances.cc' ] Modified: trunk/xorp/rip/SConscript =================================================================== --- trunk/xorp/rip/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/rip/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -28,7 +28,7 @@ SConscript(dirs = subdirs, exports='env') e = env.Clone() -is_shared = env.has_key('SHAREDLIBS') +is_shared = e.has_key('SHAREDLIBS') # # NB: The same sources are used for RIP and RIPng. We use separate @@ -123,24 +123,30 @@ 'xorp_core', ]) +e.Replace(RPATH = [ + e.Literal(e['xorp_module_rpath']) +]) + if is_shared: libxorp_rip = e.SharedLibrary(target = 'libxorp_rip', source = libxorp_rip_srcs, LIBS = '') - if env['rtld_origin']: + if e['rtld_origin']: for obj in libxorp_rip: - env.AddPostAction(libxorp_rip, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + e.AddPostAction(libxorp_rip, + e.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) libxorp_rip_xrl = e.SharedLibrary(target = 'libxorp_rip_xrl', source = libxorp_rip_xrl_srcs, LIBS = '') - if env['rtld_origin']: + if e['rtld_origin']: for obj in libxorp_rip_xrl: - env.AddPostAction(libxorp_rip_xrl, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + e.AddPostAction(libxorp_rip_xrl, + e.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) e.Alias('install', - [ e.InstallLibrary(env['xorp_libdir'], libxorp_rip), - e.InstallLibrary(env['xorp_libdir'], libxorp_rip_xrl) ]) + [ e.InstallLibrary(e['xorp_libdir'], libxorp_rip), + e.InstallLibrary(e['xorp_libdir'], libxorp_rip_xrl) ]) else: libxorp_rip = e.StaticLibrary(target = 'libxorp_rip', source = libxorp_rip_srcs, @@ -150,7 +156,7 @@ LIBS = '') rip = e.Program(target = 'xorp_rip', source = ripsrcs) -e.Alias('install', e.InstallProgram(env['xorp_moduledir'], rip)) +e.Alias('install', e.InstallProgram(e['xorp_moduledir'], rip)) # # RIPng @@ -201,24 +207,30 @@ 'xorp_core', ]) +e.Replace(RPATH = [ + e.Literal(e['xorp_module_rpath']) +]) + if is_shared: libxorp_ripng = e.SharedLibrary(target = 'libxorp_ripng', source = libxorp_rip_srcs, LIBS = '') - if env['rtld_origin']: + if e['rtld_origin']: for obj in libxorp_ripng: - env.AddPostAction(libxorp_ripng, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + e.AddPostAction(libxorp_ripng, + e.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) libxorp_ripngxrl = e.SharedLibrary(target = 'libxorp_ripng_xrl', source = libxorp_rip_xrl_srcs, LIBS = '') - if env['rtld_origin']: + if e['rtld_origin']: for obj in libxorp_ripngxrl: - env.AddPostAction(libxorp_ripngxrl, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + e.AddPostAction(libxorp_ripngxrl, + e.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) e.Alias('install', - [ e.InstallLibrary(env['xorp_libdir'], libxorp_ripng), - e.InstallLibrary(env['xorp_libdir'], libxorp_ripngxrl) ]) + [ e.InstallLibrary(e['xorp_libdir'], libxorp_ripng), + e.InstallLibrary(e['xorp_libdir'], libxorp_ripngxrl) ]) else: libxorp_ripng = e.StaticLibrary(target = 'libxorp_ripng', source = libxorp_rip_srcs, @@ -228,6 +240,6 @@ LIBS = '') ripng = e.Program(target = 'xorp_ripng', source = ripngsrcs) -e.Alias('install', e.InstallProgram(env['xorp_moduledir'], ripng)) +e.Alias('install', e.InstallProgram(e['xorp_moduledir'], ripng)) Default(rip, ripng) Modified: trunk/xorp/rip/tools/SConscript =================================================================== --- trunk/xorp/rip/tools/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/rip/tools/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -46,6 +46,10 @@ 'xorp_comm', ]) +env.Replace(RPATH = [ + env.Literal(env['xorp_tool_rpath']) +]) + shpeersrcs = [ 'show_peer_stats.cc', 'common.cc' Modified: trunk/xorp/rtrmgr/SConscript =================================================================== --- trunk/xorp/rtrmgr/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/rtrmgr/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -122,6 +122,13 @@ libxorp_rtrmgr = libxorp_rtrmgr_env.StaticLibrary(target = 'libxorp_rtrmgr', source = libxorp_rtrmgr_srcs) +# +# Common RPATH. +# +env.Replace(RPATH = [ + env.Literal(env['xorp_sbin_rpath']) +]) + ### rtrmgr rtrmgr_env = env.Clone() Modified: trunk/xorp/static_routes/SConscript =================================================================== --- trunk/xorp/static_routes/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/static_routes/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -60,6 +60,10 @@ 'xorp_comm', ]) +env.Replace(RPATH = [ + env.Literal(env['xorp_module_rpath']) +]) + libxorp_static_routes_srcs = [ 'static_routes_node.cc', 'static_routes_varrw.cc', @@ -78,7 +82,8 @@ if env['rtld_origin']: for obj in libxorp_static_routes: env.AddPostAction(libxorp_static_routes, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + env.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) else: libxorp_static_routes = env.StaticLibrary( target = 'libxorp_static_routes', Modified: trunk/xorp/vrrp/SConscript =================================================================== --- trunk/xorp/vrrp/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/vrrp/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -68,6 +68,10 @@ 'vrrp_vif.cc' ] +env.Replace(RPATH = [ + env.Literal(env['xorp_module_rpath']) +]) + if is_shared: libxorp_vrrp = env.SharedLibrary(target = 'libxorp_vrrp', source = libxorp_vrrp_srcs, @@ -75,7 +79,8 @@ if env['rtld_origin']: for obj in libxorp_vrrp: env.AddPostAction(libxorp_vrrp, - env.Symlink(obj.abspath, env['BUILDDIR'] + '/lib/' + str(obj))) + env.Symlink(obj.abspath, + os.path.join(env['xorp_alias_libdir'], str(obj)))) else: libxorp_vrrp = env.StaticLibrary(target = 'libxorp_vrrp', source = libxorp_vrrp_srcs, Modified: trunk/xorp/xrl/interfaces/SConscript =================================================================== --- trunk/xorp/xrl/interfaces/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/xrl/interfaces/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -110,7 +110,7 @@ for obj in lib: env.AddPostAction(lib, env.Symlink(obj.abspath, - env['BUILDDIR'] + '/lib/' + str(obj))) + os.path.join(env['xorp_alias_libdir'], str(obj)))) else: lib = env.StaticLibrary(tgt, src) Modified: trunk/xorp/xrl/targets/SConscript =================================================================== --- trunk/xorp/xrl/targets/SConscript 2009-12-03 17:09:29 UTC (rev 11654) +++ trunk/xorp/xrl/targets/SConscript 2009-12-03 20:36:29 UTC (rev 11655) @@ -96,7 +96,7 @@ for obj in lib: env.AddPostAction(lib, env.Symlink(obj.abspath, - env['BUILDDIR'] + '/lib/' + str(obj))) + os.path.join(env['xorp_alias_libdir'], str(obj)))) else: lib = env.StaticLibrary(target, source) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 12:37:54 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 20:37:54 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11656] trunk/xorp/SConstruct Message-ID: Revision: 11656 http://xorp.svn.sourceforge.net/xorp/?rev=11656&view=rev Author: bms_fbsd Date: 2009-12-03 20:37:54 +0000 (Thu, 03 Dec 2009) Log Message: ----------- Enable the rtld $ORIGIN feature by default Modified Paths: -------------- trunk/xorp/SConstruct Modified: trunk/xorp/SConstruct =================================================================== --- trunk/xorp/SConstruct 2009-12-03 20:36:29 UTC (rev 11655) +++ trunk/xorp/SConstruct 2009-12-03 20:37:54 UTC (rev 11656) @@ -57,7 +57,7 @@ vars.AddVariables( BoolVariable('shared', 'build with shared libraries', True), BoolVariable('strip', 'strip executables and libraries when installed', False), - BoolVariable('rtld_origin', 'Use ORIGIN in dynamically linked programs', False), + BoolVariable('rtld_origin', 'Use ORIGIN in dynamically linked programs', True), BoolVariable('ignore_check_errors', 'Ignore errors when building tests', False), BoolVariable('debug_stl', 'Build with checked STL operations', False), BoolVariable('debug_msg', 'Build with debug messages', False), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 12:41:25 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 20:41:25 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11657] trunk/xorp/SConstruct Message-ID: Revision: 11657 http://xorp.svn.sourceforge.net/xorp/?rev=11657&view=rev Author: bms_fbsd Date: 2009-12-03 20:41:25 +0000 (Thu, 03 Dec 2009) Log Message: ----------- Capitalize help messages. Modified Paths: -------------- trunk/xorp/SConstruct Modified: trunk/xorp/SConstruct =================================================================== --- trunk/xorp/SConstruct 2009-12-03 20:37:54 UTC (rev 11656) +++ trunk/xorp/SConstruct 2009-12-03 20:41:25 UTC (rev 11657) @@ -55,8 +55,8 @@ vars = Variables() vars.AddVariables( - BoolVariable('shared', 'build with shared libraries', True), - BoolVariable('strip', 'strip executables and libraries when installed', False), + BoolVariable('shared', 'Build with shared libraries', True), + BoolVariable('strip', 'Strip all installed binaries', False), BoolVariable('rtld_origin', 'Use ORIGIN in dynamically linked programs', True), BoolVariable('ignore_check_errors', 'Ignore errors when building tests', False), BoolVariable('debug_stl', 'Build with checked STL operations', False), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 12:58:08 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 20:58:08 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11658] trunk/xorp/etc/templates Message-ID: Revision: 11658 http://xorp.svn.sourceforge.net/xorp/?rev=11658&view=rev Author: bms_fbsd Date: 2009-12-03 20:58:08 +0000 (Thu, 03 Dec 2009) Log Message: ----------- In r11530, a change was introduced to the PIM template files which was commented out. This change causes the Router Manager to use a new RPC method in the XORP PIM target, apply_bsr_changes, to apply a change in the PIM bootstrap router configuration, without blowing away the Elected-BSR router state. Activate this change unconditionally. Modified Paths: -------------- trunk/xorp/etc/templates/pimsm4.tp trunk/xorp/etc/templates/pimsm6.tp Modified: trunk/xorp/etc/templates/pimsm4.tp =================================================================== --- trunk/xorp/etc/templates/pimsm4.tp 2009-12-03 20:41:25 UTC (rev 11657) +++ trunk/xorp/etc/templates/pimsm4.tp 2009-12-03 20:58:08 UTC (rev 11658) @@ -209,15 +209,7 @@ %help: short "Configure the IPv4 Bootstrap mechanism"; %activate: xrl "$(pimsm4.targetname)/pim/0.1/stop_bsr"; %activate: xrl "$(pimsm4.targetname)/pim/0.1/start_bsr"; - /* - * To test runtime BSR reconfiguration, comment out the two - * lines below, and uncomment the apply_bsr_changes line. - */ - %update: xrl "$(pimsm4.targetname)/pim/0.1/stop_bsr"; - %update: xrl "$(pimsm4.targetname)/pim/0.1/start_bsr"; - /* %update: xrl "$(pimsm4.targetname)/pim/0.1/apply_bsr_changes"; - */ %delete: xrl "$(pimsm4.targetname)/pim/0.1/stop_bsr"; disable { Modified: trunk/xorp/etc/templates/pimsm6.tp =================================================================== --- trunk/xorp/etc/templates/pimsm6.tp 2009-12-03 20:41:25 UTC (rev 11657) +++ trunk/xorp/etc/templates/pimsm6.tp 2009-12-03 20:58:08 UTC (rev 11658) @@ -209,15 +209,7 @@ %help: short "Configure the IPv6 Bootstrap mechanism"; %activate: xrl "$(pimsm6.targetname)/pim/0.1/stop_bsr"; %activate: xrl "$(pimsm6.targetname)/pim/0.1/start_bsr"; - /* - * To test runtime BSR reconfiguration, comment out the two - * lines below, and uncomment the apply_bsr_changes line. - */ - %update: xrl "$(pimsm6.targetname)/pim/0.1/stop_bsr"; - %update: xrl "$(pimsm6.targetname)/pim/0.1/start_bsr"; - /* %update: xrl "$(pimsm6.targetname)/pim/0.1/apply_bsr_changes"; - */ %delete: xrl "$(pimsm6.targetname)/pim/0.1/stop_bsr"; disable { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 12:58:44 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 20:58:44 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11659] trunk/xorp/SConstruct Message-ID: Revision: 11659 http://xorp.svn.sourceforge.net/xorp/?rev=11659&view=rev Author: bms_fbsd Date: 2009-12-03 20:58:44 +0000 (Thu, 03 Dec 2009) Log Message: ----------- Add support for optimize=highest. This will pass '-O3' to gcc. Modified Paths: -------------- trunk/xorp/SConstruct Modified: trunk/xorp/SConstruct =================================================================== --- trunk/xorp/SConstruct 2009-12-03 20:58:08 UTC (rev 11658) +++ trunk/xorp/SConstruct 2009-12-03 20:58:44 UTC (rev 11659) @@ -68,7 +68,7 @@ allowed_values=('no', 'yes', 'full', 'override'), map={}, ignorecase=2), EnumVariable('optimize', 'Build with optimization', 'yes', - allowed_values=('no', 'minimal', 'yes', 'full', + allowed_values=('no', 'minimal', 'yes', 'full', 'highest', 'size', 'override'), map={}, ignorecase=2), EnumVariable('profile', 'Build with profiling', 'no', @@ -438,6 +438,7 @@ -fno-merge-constants", 'yes': '-O1', 'full': '-O2', + 'highest': '-O3', 'size': '-Os' } bigoflag = bigodict[env['optimize']] if not env['optimize'] == 'no': This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 13:56:34 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 21:56:34 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11660] trunk/xorp Message-ID: 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 -#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 #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 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& message, string& error_msg) { -#ifdef HOST_OS_WINDOWS - UNUSED(fd); - UNUSED(message); - UNUSED(error_msg); - return (XORP_ERROR); -#else /* !HOST_OS_WINDOWS */ vector 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 #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(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 -#include - -#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 - -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -#include - -#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 message; - vector 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 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 - -#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 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& 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 -#endif -#ifdef HAVE_ROUTPROT_H -#include -#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( - &pfwdtable->table[i].dwForwardDest)); - mask.copy_in(reinterpret_cast( - &pfwdtable->table[i].dwForwardMask)); - destnet = IPv4Net(dest, mask.mask_len()); - nexthop.copy_in(reinterpret_cast( - &pfwdtable->table[i].dwForwardNextHop)); - - uint32_t ifindex = static_cast( - 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( - 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(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(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& 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& 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. From bms_fbsd at users.sourceforge.net Thu Dec 3 13:58:20 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 21:58:20 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11661] trunk/xorp/SConstruct Message-ID: Revision: 11661 http://xorp.svn.sourceforge.net/xorp/?rev=11661&view=rev Author: bms_fbsd Date: 2009-12-03 21:58:20 +0000 (Thu, 03 Dec 2009) Log Message: ----------- Activate Boost 1.39 check. Boost is now required to build XORP. Modified Paths: -------------- trunk/xorp/SConstruct Modified: trunk/xorp/SConstruct =================================================================== --- trunk/xorp/SConstruct 2009-12-03 21:56:33 UTC (rev 11660) +++ trunk/xorp/SConstruct 2009-12-03 21:58:20 UTC (rev 11661) @@ -359,7 +359,7 @@ # Boost #env['boost_suffix'] = "-mt" # Not for FreeBSD - #conf.CheckBoost(require_version='1.39') + conf.CheckBoost(require_version='1.39') #conf.CheckBoostLibrary('system') #conf.CheckBoostLibrary('date_time') #conf.CheckBoostLibrary('iostreams') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 14:10:52 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 22:10:52 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11662] trunk/xorp Message-ID: Revision: 11662 http://xorp.svn.sourceforge.net/xorp/?rev=11662&view=rev Author: bms_fbsd Date: 2009-12-03 22:10:51 +0000 (Thu, 03 Dec 2009) Log Message: ----------- First Boost refactoring pass. Use boost::noncopyable across the tree, instead of declaring copy and assignment operations as private. No functional changes. Modified Paths: -------------- trunk/xorp/bgp/bgp_varrw.hh trunk/xorp/bgp/path_attribute.hh trunk/xorp/bgp/subnet_route.hh trunk/xorp/fea/data_plane/control_socket/click_socket.hh trunk/xorp/fea/data_plane/control_socket/netlink_socket.hh trunk/xorp/fea/data_plane/control_socket/routing_socket.hh trunk/xorp/fea/iftree.hh trunk/xorp/fea/io_ip_manager.hh trunk/xorp/fea/io_link_manager.hh trunk/xorp/fea/io_tcpudp_manager.hh trunk/xorp/libxipc/finder.hh trunk/xorp/libxipc/finder_client.cc trunk/xorp/libxipc/finder_tcp.hh trunk/xorp/libxipc/xrl_cmd_map.hh trunk/xorp/libxipc/xrl_pf.hh trunk/xorp/libxipc/xrl_pf_stcp.cc trunk/xorp/libxorp/asyncio.hh trunk/xorp/libxorp/buffered_asyncio.hh trunk/xorp/libxorp/eventloop.hh trunk/xorp/libxorp/safe_callback_obj.hh trunk/xorp/libxorp/selector.hh trunk/xorp/libxorp/task.hh trunk/xorp/libxorp/timer.hh trunk/xorp/policy/backend/instruction.hh trunk/xorp/policy/backend/iv_exec.hh trunk/xorp/policy/backend/policy_filter.hh trunk/xorp/policy/backend/policy_filters.hh trunk/xorp/policy/backend/policy_instr.hh trunk/xorp/policy/backend/policy_redist_map.hh trunk/xorp/policy/backend/set_manager.hh trunk/xorp/policy/backend/single_varrw.hh trunk/xorp/policy/backend/term_instr.hh trunk/xorp/policy/code_list.hh trunk/xorp/policy/common/element.hh trunk/xorp/policy/configuration.hh trunk/xorp/policy/dependency.hh trunk/xorp/policy/node.hh trunk/xorp/policy/policy_list.hh trunk/xorp/policy/policy_statement.hh trunk/xorp/policy/protocol_map.hh trunk/xorp/policy/semantic_varrw.hh trunk/xorp/policy/source_match_code_generator.hh trunk/xorp/policy/term.hh trunk/xorp/policy/var_map.hh trunk/xorp/policy/visitor_semantic.hh trunk/xorp/rib/redist_policy.hh trunk/xorp/rib/rib.hh trunk/xorp/rib/rt_tab_redist.hh trunk/xorp/rip/output.hh trunk/xorp/rip/output_table.hh trunk/xorp/rip/output_updates.hh trunk/xorp/rip/redist.hh trunk/xorp/rip/route_db.hh trunk/xorp/rip/route_entry.hh trunk/xorp/rip/system.hh trunk/xorp/rip/tools/common.hh trunk/xorp/rip/xrl_port_manager.hh trunk/xorp/rtrmgr/op_commands.hh Modified: trunk/xorp/bgp/bgp_varrw.hh =================================================================== --- trunk/xorp/bgp/bgp_varrw.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/bgp/bgp_varrw.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -35,9 +35,13 @@ * * If the route is modified, the user is responsible for retrieving the * filtered message and deleting it. + * + * Non-copyable due to inheritance from VarRW. */ template -class BGPVarRW : public SingleVarRW { +class BGPVarRW : + public SingleVarRW +{ public: enum { VAR_NETWORK4 = VAR_PROTOCOL, Modified: trunk/xorp/bgp/path_attribute.hh =================================================================== --- trunk/xorp/bgp/path_attribute.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/bgp/path_attribute.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -33,6 +33,8 @@ #include #include +#include + #include #include "exceptions.hh" // for CorruptMessage exception @@ -96,7 +98,9 @@ // MAX_ATTRIBUTE must contain the largest attribute number from the enum above #define MAX_ATTRIBUTE 20 -class PathAttribute { +class PathAttribute : + public boost::noncopyable +{ public: enum Flags { Optional = 0x80, @@ -253,9 +257,7 @@ uint8_t _type; private: - PathAttribute(); // forbidden - PathAttribute(const PathAttribute &); // forbidden - PathAttribute& operator=(const PathAttribute &); // forbidden + PathAttribute(); // Not directly constructible. }; @@ -283,8 +285,6 @@ bool encode(uint8_t* buf, size_t &wire_size, const BGPPeerData* peerdata) const; - -protected: private: OriginType _origin; }; @@ -312,8 +312,6 @@ bool encode(uint8_t* buf, size_t &wire_size, const BGPPeerData* peerdata) const; - -protected: private: ASPath *_as_path; }; @@ -340,7 +338,6 @@ bool encode(uint8_t* buf, size_t &wire_size, const BGPPeerData* peerdata) const; -protected: private: AS4Path *_as_path; }; @@ -366,7 +363,6 @@ bool encode(uint8_t* buf, size_t &wire_size, const BGPPeerData* peerdata) const; -protected: private: A _next_hop; }; @@ -391,7 +387,6 @@ bool encode(uint8_t* buf, size_t &wire_size, const BGPPeerData* peerdata) const; -protected: private: uint32_t _med; // XXX stored in host format! }; @@ -418,7 +413,6 @@ bool encode(uint8_t* buf, size_t &wire_size, const BGPPeerData* peerdata) const; -protected: private: uint32_t _localpref; @@ -437,7 +431,6 @@ bool encode(uint8_t* buf, size_t &wire_size, const BGPPeerData* peerdata) const; -protected: private: }; @@ -455,7 +448,6 @@ bool encode(uint8_t* buf, size_t &wire_size, const BGPPeerData* peerdata) const; -protected: private: IPv4 _speaker; AsNum _as; @@ -475,7 +467,6 @@ bool encode(uint8_t* buf, size_t &wire_size, const BGPPeerData* peerdata) const; -protected: private: IPv4 _speaker; AsNum _as; @@ -501,7 +492,6 @@ bool encode(uint8_t* buf, size_t &wire_size, const BGPPeerData* peerdata) const; -protected: private: set _communities; }; @@ -522,7 +512,6 @@ bool encode(uint8_t* buf, size_t &wire_size, const BGPPeerData* peerdata) const; -protected: private: IPv4 _originator_id; }; @@ -543,7 +532,6 @@ bool encode(uint8_t* buf, size_t &wire_size, const BGPPeerData* peerdata) const; -protected: private: list _cluster_list; }; @@ -581,7 +569,6 @@ bool encode(uint8_t* buf, size_t &wire_size, const BGPPeerData* peerdata) const; -protected: private: Afi _afi; // Address Family Identifier. @@ -617,7 +604,6 @@ bool encode(uint8_t* buf, size_t &wire_size, const BGPPeerData* peerdata) const; -protected: private: Afi _afi; // Address Family Identifier. @@ -638,7 +624,6 @@ bool encode(uint8_t* buf, size_t &wire_size, const BGPPeerData* peerdata) const; -protected: private: // storage for information in the attribute. Modified: trunk/xorp/bgp/subnet_route.hh =================================================================== --- trunk/xorp/bgp/subnet_route.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/bgp/subnet_route.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -625,10 +625,10 @@ if (_metadata.bump_refcount(delta)) delete this; } - //prevent accidental use of default assignment operator + + // Copyable, but not assignable. const SubnetRoute& operator=(const SubnetRoute&); - /** * _net is the subnet (address and prefix) for this route. */ Modified: trunk/xorp/fea/data_plane/control_socket/click_socket.hh =================================================================== --- trunk/xorp/fea/data_plane/control_socket/click_socket.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/fea/data_plane/control_socket/click_socket.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -28,6 +28,8 @@ #include "libxorp/exceptions.hh" #include "libxorp/ipvx.hh" +#include + class ClickSocketObserver; struct ClickSocketPlumber; class RunCommand; @@ -37,7 +39,9 @@ * on the socket to ClickSocketObservers. The ClickSocket hooks itself * into the EventLoop and activity usually happens asynchronously. */ -class ClickSocket { +class ClickSocket : + public boost::noncopyable +{ public: ClickSocket(EventLoop& eventloop); ~ClickSocket(); @@ -490,9 +494,6 @@ void user_click_command_done_cb(RunCommand* run_command, bool success, const string& error_msg); - ClickSocket& operator=(const ClickSocket&); // Not implemented - ClickSocket(const ClickSocket&); // Not implemented - private: static const size_t CLSOCK_BYTES = 8*1024; // Initial guess at msg size Modified: trunk/xorp/fea/data_plane/control_socket/netlink_socket.hh =================================================================== --- trunk/xorp/fea/data_plane/control_socket/netlink_socket.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/fea/data_plane/control_socket/netlink_socket.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -27,6 +27,8 @@ #include "libxorp/eventloop.hh" #include "libxorp/exceptions.hh" +#include + class NetlinkSocketObserver; struct NetlinkSocketPlumber; @@ -35,7 +37,9 @@ * on the socket to NetlinkSocketObservers. The NetlinkSocket hooks itself * into the EventLoop and activity usually happens asynchronously. */ -class NetlinkSocket { +class NetlinkSocket : + public boost::noncopyable +{ public: NetlinkSocket(EventLoop& eventloop); ~NetlinkSocket(); @@ -190,9 +194,6 @@ */ void io_event(XorpFd fd, IoEventType sm); - NetlinkSocket& operator=(const NetlinkSocket&); // Not implemented - NetlinkSocket(const NetlinkSocket&); // Not implemented - static const size_t NETLINK_SOCKET_BYTES = 8*1024; // Initial guess at msg size EventLoop& _eventloop; Modified: trunk/xorp/fea/data_plane/control_socket/routing_socket.hh =================================================================== --- trunk/xorp/fea/data_plane/control_socket/routing_socket.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/fea/data_plane/control_socket/routing_socket.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -27,6 +27,8 @@ #include "libxorp/eventloop.hh" #include "libxorp/exceptions.hh" +#include + class RoutingSocketObserver; struct RoutingSocketPlumber; @@ -35,7 +37,9 @@ * on the socket to RoutingSocketObservers. The RoutingSocket hooks itself * into the EventLoop and activity usually happens asynchronously. */ -class RoutingSocket { +class RoutingSocket : + public boost::noncopyable +{ public: RoutingSocket(EventLoop& eventloop); ~RoutingSocket(); @@ -125,9 +129,6 @@ */ void io_event(XorpFd fd, IoEventType type); - RoutingSocket& operator=(const RoutingSocket&); // Not implemented - RoutingSocket(const RoutingSocket&); // Not implemented - private: static const size_t ROUTING_SOCKET_BYTES = 8*1024; // Initial guess at msg size Modified: trunk/xorp/fea/iftree.hh =================================================================== --- trunk/xorp/fea/iftree.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/fea/iftree.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -27,19 +27,22 @@ #include #include +#include + #include "libxorp/ipv4.hh" #include "libxorp/ipv6.hh" #include "libxorp/mac.hh" class IPvX; - /** * Base class for FEA configurable items where the modifications need * to be held over and propagated later, ie changes happen during a * transaction but are propagated during the commit. */ -class IfTreeItem { +class IfTreeItem : + public boost::noncopyable +{ public: IfTreeItem() : _st(CREATED), _soft(false) {} virtual ~IfTreeItem() {} @@ -534,7 +537,9 @@ /** * FEA class for holding physical interface state. */ -class IfTreeInterface : public IfTreeItem { +class IfTreeInterface : + public IfTreeItem +{ public: typedef map VifMap; typedef set MacSet; @@ -765,9 +770,6 @@ string str() const; private: - IfTreeInterface(const IfTreeInterface&); // Not implemented - IfTreeInterface& operator=(const IfTreeInterface&); // Not implemented - IfTree& _iftree; const string _ifname; uint32_t _pif_index; @@ -789,7 +791,9 @@ /** * FEA class for virtual (logical) interface state. */ -class IfTreeVif : public IfTreeItem { +class IfTreeVif : + public IfTreeItem +{ public: typedef map IPv4Map; typedef map IPv6Map; @@ -999,9 +1003,6 @@ string str() const; private: - IfTreeVif(const IfTreeVif&); // Not implemented - IfTreeVif& operator=(const IfTreeVif&); // Not implemented - IfTreeInterface& _iface; const string _vifname; @@ -1025,7 +1026,9 @@ /** * Class for holding an IPv4 interface address and address related items. */ -class IfTreeAddr4 : public IfTreeItem { +class IfTreeAddr4 : + public IfTreeItem +{ public: IfTreeAddr4(const IPv4& addr) : IfTreeItem(), @@ -1129,9 +1132,6 @@ string str() const; private: - IfTreeAddr4(const IfTreeAddr4&); // Not implemented - IfTreeAddr4& operator=(const IfTreeAddr4&); // Not implemented - IPv4 _addr; bool _enabled; @@ -1148,7 +1148,8 @@ /** * Class for holding an IPv6 interface address and address related items. */ -class IfTreeAddr6 : public IfTreeItem +class IfTreeAddr6 : + public IfTreeItem { public: IfTreeAddr6(const IPv6& addr) @@ -1222,9 +1223,6 @@ string str() const; private: - IfTreeAddr6(const IfTreeAddr6&); // Not implemented - IfTreeAddr6& operator=(const IfTreeAddr6&); // Not implemented - IPv6 _addr; bool _enabled; Modified: trunk/xorp/fea/io_ip_manager.hh =================================================================== --- trunk/xorp/fea/io_ip_manager.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/fea/io_ip_manager.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -26,6 +26,7 @@ #include #include #include +#include #include "libxorp/callback.hh" #include "libxorp/ipvx.hh" @@ -62,7 +63,10 @@ * It also allows arbitrary filters to receive the raw IP data for that * protocol. */ -class IoIpComm : public IoIpReceiver { +class IoIpComm : + public boost::noncopyable, + public IoIpReceiver +{ public: /** * Filter class. Modified: trunk/xorp/fea/io_link_manager.hh =================================================================== --- trunk/xorp/fea/io_link_manager.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/fea/io_link_manager.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -27,6 +27,7 @@ #include #include #include +#include #include "libxorp/callback.hh" #include "libxorp/mac.hh" @@ -56,7 +57,10 @@ * It also allows arbitrary filters to receive the raw link-level data for that * protocol. */ -class IoLinkComm : public IoLinkReceiver { +class IoLinkComm : + public boost::noncopyable, + public IoLinkReceiver +{ public: /** * Filter class. Modified: trunk/xorp/fea/io_tcpudp_manager.hh =================================================================== --- trunk/xorp/fea/io_tcpudp_manager.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/fea/io_tcpudp_manager.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -24,6 +24,7 @@ #include #include +#include #include "libxorp/ipvx.hh" @@ -37,7 +38,10 @@ /** * A class that handles I/O TCP/UDP communication. */ -class IoTcpUdpComm : public IoTcpUdpReceiver { +class IoTcpUdpComm : + public boost::noncopyable, + public IoTcpUdpReceiver +{ public: /** * Joined multicast group class. Modified: trunk/xorp/libxipc/finder.hh =================================================================== --- trunk/xorp/libxipc/finder.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/libxipc/finder.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -34,12 +34,15 @@ #include "finder_messenger.hh" #include "finder_xrl_queue.hh" +#include class FinderTarget; class FinderClass; class FinderEvent; -class Finder : public FinderMessengerManager +class Finder : + public boost::noncopyable, + public FinderMessengerManager { public: typedef list FinderMessengerList; @@ -154,9 +157,6 @@ EventLoop& eventloop() const { return _e; } - Finder(const Finder&); // Not implemented - Finder& operator=(const Finder&); // Not implemented - protected: EventLoop& _e; XrlCmdMap _cmds; Modified: trunk/xorp/libxipc/finder_client.cc =================================================================== --- trunk/xorp/libxipc/finder_client.cc 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/libxipc/finder_client.cc 2009-12-03 22:10:51 UTC (rev 11662) @@ -19,11 +19,11 @@ // XORP, Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA; // http://xorp.net - - #include #include +#include + #include "finder_module.h" #include "libxorp/callback.hh" @@ -192,16 +192,16 @@ * Class that handles resolutions for FinderClient, and puts results * into FinderClient's resolved table and notifies the client. */ -class FinderClientQuery : public FinderClientOneOffOp +class FinderClientQuery : + public boost::noncopyable, + public FinderClientOneOffOp { public: typedef FinderClient::QueryCallback QueryCallback; typedef FinderClient::ResolvedTable ResolvedTable; private: - FinderClientQuery(); // Not Impl. - FinderClientQuery(const FinderClientQuery&); // Not Impl. - FinderClientQuery& operator=(const FinderClientQuery&); // Not Impl. + FinderClientQuery(); // Not directly constructible. public: FinderClientQuery(EventLoop& eventloop, Modified: trunk/xorp/libxipc/finder_tcp.hh =================================================================== --- trunk/xorp/libxipc/finder_tcp.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/libxipc/finder_tcp.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -34,6 +34,8 @@ #include +#include + #ifdef HAVE_SYS_UIO_H #include #endif @@ -42,7 +44,9 @@ #define MAX_XRL_INPUT_SIZE 65536 // maximum total XRL input buffer // size on the network. -class FinderTcpBase { +class FinderTcpBase : + public boost::noncopyable +{ public: FinderTcpBase(EventLoop& e, XorpFd fd); @@ -111,9 +115,6 @@ bool closed() const; protected: - FinderTcpBase(const FinderTcpBase&); // Not implemented - FinderTcpBase& operator=(const FinderTcpBase&); // Not implemented - void read_callback(AsyncFileOperator::Event, const uint8_t*, size_t, size_t); void write_callback(AsyncFileOperator::Event, @@ -130,7 +131,9 @@ uint32_t _osize; // output buffer size as advertised. }; -class FinderTcpListenerBase { +class FinderTcpListenerBase : + public boost::noncopyable +{ public: typedef vector AddrList; typedef vector NetList; @@ -182,9 +185,6 @@ */ void connect_hook(XorpFd fd, IoEventType type); - FinderTcpListenerBase(const FinderTcpListenerBase&); // Not impl - FinderTcpListenerBase& operator=(const FinderTcpListenerBase&); // Not impl - EventLoop& eventloop() const { return _e; } protected: Modified: trunk/xorp/libxipc/xrl_cmd_map.hh =================================================================== --- trunk/xorp/libxipc/xrl_cmd_map.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/libxipc/xrl_cmd_map.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -27,6 +27,8 @@ #include #include +#include + #include "libxorp/callback.hh" #include "xrl.hh" #include "xrl_error.hh" @@ -49,7 +51,9 @@ XrlRecvCallback _cb; }; -class XrlCmdMap { +class XrlCmdMap : + public boost::noncopyable +{ public: typedef map CmdMap; @@ -79,9 +83,6 @@ protected: bool add_handler (const XrlCmdEntry& c); - XrlCmdMap(const XrlCmdMap&); // not implemented - XrlCmdMap& operator=(const XrlCmdMap&); // not implemented - protected: const string _name; Modified: trunk/xorp/libxipc/xrl_pf.hh =================================================================== --- trunk/xorp/libxipc/xrl_pf.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/libxipc/xrl_pf.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -32,6 +32,8 @@ #include "libxorp/timer.hh" #include "libxorp/exceptions.hh" +#include + class Xrl; class XrlError; class XrlArgs; @@ -72,6 +74,7 @@ // XrlPFSender class XrlPFSender + : public boost::noncopyable { public: typedef @@ -109,10 +112,6 @@ const string& address() const { return _address; } EventLoop& eventloop() const { return _eventloop; } -private: - XrlPFSender(const XrlPFSender&); // Not implemented - XrlPFSender& operator=(const XrlPFSender&); // Not implemented - protected: EventLoop& _eventloop; string _address; Modified: trunk/xorp/libxipc/xrl_pf_stcp.cc =================================================================== --- trunk/xorp/libxipc/xrl_pf_stcp.cc 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/libxipc/xrl_pf_stcp.cc 2009-12-03 22:10:51 UTC (rev 11662) @@ -40,6 +40,8 @@ #include #include +#include + #include "libxorp/debug.h" #include "libxipc/xrl_module.h" #include "libxorp/xlog.h" @@ -517,7 +519,9 @@ * in wire format rather than as an Xrl since the existing scheme * requires additional copy operations. */ -class RequestState { +class RequestState : + public boost::noncopyable +{ public: typedef XrlPFSender::SendCallback Callback; @@ -594,10 +598,6 @@ } private: - RequestState(const RequestState&); // Not implemented - RequestState& operator=(const RequestState&); // Not implemented - -private: XrlPFSTCPSender* _p; // parent uint32_t _sn; // sequence number uint8_t* _b; Modified: trunk/xorp/libxorp/asyncio.hh =================================================================== --- trunk/xorp/libxorp/asyncio.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/libxorp/asyncio.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -33,6 +33,8 @@ #include #endif +#include + #include "libxorp/xorpfd.hh" #include "libxorp/callback.hh" #include "libxorp/eventloop.hh" @@ -211,7 +213,9 @@ void flush_buffers(); protected: - class BufferInfo { + class BufferInfo : + public boost::noncopyable + { public: BufferInfo(uint8_t* b, size_t bb, Callback cb) : _buffer(b), _buffer_bytes(bb), _offset(0), _cb(cb) {} @@ -228,9 +232,7 @@ void incr_offset(size_t done) { _offset += done; } private: - BufferInfo(); // Not implemented - BufferInfo(const BufferInfo&); // Not implemented - BufferInfo& operator=(const BufferInfo&); // Not implemented + BufferInfo(); // Not directly constructible uint8_t* _buffer; size_t _buffer_bytes; @@ -248,7 +250,10 @@ /** * @short Write asynchronously to non-blocking file. */ -class AsyncFileWriter : public AsyncFileOperator { +class AsyncFileWriter : + public boost::noncopyable, + public AsyncFileOperator +{ public: /** * @param e EventLoop that object should associate itself with. @@ -358,12 +363,12 @@ void flush_buffers(); private: - AsyncFileWriter(); // Not implemented - AsyncFileWriter(const AsyncFileWriter&); // Not implemented - AsyncFileWriter& operator=(const AsyncFileWriter&); // Not implemented + AsyncFileWriter(); // Not directly constructible protected: - class BufferInfo { + class BufferInfo : + public boost::noncopyable + { public: BufferInfo(const uint8_t* b, size_t bb, const Callback& cb) : _buffer(b), _buffer_bytes(bb), _offset(0), _dst_port(0), @@ -398,9 +403,7 @@ bool is_sendto() const { return (_is_sendto); } private: - BufferInfo(); // Not implemented - BufferInfo(const BufferInfo&); // Not implemented - BufferInfo& operator=(const BufferInfo&); // Not implemented + BufferInfo(); // Not directly constructible const vector _data; // Local copy of the data const uint8_t* _buffer; Modified: trunk/xorp/libxorp/buffered_asyncio.hh =================================================================== --- trunk/xorp/libxorp/buffered_asyncio.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/libxorp/buffered_asyncio.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -32,10 +32,14 @@ #include #endif +#include + #include "libxorp/callback.hh" #include "libxorp/eventloop.hh" -class BufferedAsyncReader { +class BufferedAsyncReader : + public boost::noncopyable +{ public: enum Event { DATA = 1, @@ -144,9 +148,7 @@ void stop(); private: - BufferedAsyncReader(); // Not implemented - BufferedAsyncReader(const BufferedAsyncReader&); // Not implemented - BufferedAsyncReader& operator=(const BufferedAsyncReader&); // Not implemented + BufferedAsyncReader(); // Not directly constructible private: void io_event(XorpFd fd, IoEventType type); Modified: trunk/xorp/libxorp/eventloop.hh =================================================================== --- trunk/xorp/libxorp/eventloop.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/libxorp/eventloop.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -37,6 +37,8 @@ #include "selector.hh" +#include + /** * @short Event Loop. * @@ -44,7 +46,9 @@ * for Xorp processes. All XorpTimer and select operations should be * co-ordinated through this interface. */ -class EventLoop { +class EventLoop : + public boost::noncopyable +{ public: /** * Constructor @@ -341,9 +345,6 @@ void set_aggressiveness(int num); private: - EventLoop(const EventLoop&); // not implemented - EventLoop& operator=(const EventLoop&); // not implemented - bool do_work(bool can_block); private: Modified: trunk/xorp/libxorp/safe_callback_obj.hh =================================================================== --- trunk/xorp/libxorp/safe_callback_obj.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/libxorp/safe_callback_obj.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -26,6 +26,7 @@ #include #include +#include struct SafeCallbackBase; @@ -38,8 +39,14 @@ * a CallbackSafeObject is destructed it informs all the callbacks that * refer to it that this is the case and invalidates (sets to null) * the object they point to. + * + * Copy operations are not supported. It's hard to know what the + * correct thing to do on assignment or copy, so best bet is not + * to do anything. */ -class CallbackSafeObject { +class CallbackSafeObject : + public boost::noncopyable +{ public: CallbackSafeObject() {} virtual ~CallbackSafeObject(); @@ -48,13 +55,6 @@ void unref_cb(SafeCallbackBase* scb); protected: - // Copy operations are not supported. It's hard to know what the - // correct thing to do on assignment or copy, so best bet is not - // to do anything. - CallbackSafeObject(const CallbackSafeObject&); // Not implemented - CallbackSafeObject& operator=(const CallbackSafeObject&); // Not implemented - -protected: std::vector _cbs; }; @@ -64,7 +64,9 @@ * These are object callbacks that are only dispatched if target of * callback is non-null. */ -class SafeCallbackBase { +class SafeCallbackBase : + public boost::noncopyable +{ public: /** * Constructor. @@ -86,10 +88,9 @@ bool valid() const; protected: - SafeCallbackBase(); // Not implemented - SafeCallbackBase(const SafeCallbackBase&); // Not implemented - SafeCallbackBase& operator=(const SafeCallbackBase&); // Not implemented + SafeCallbackBase(); // Not directly constructible +protected: CallbackSafeObject* _cso; }; Modified: trunk/xorp/libxorp/selector.hh =================================================================== --- trunk/xorp/libxorp/selector.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/libxorp/selector.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -36,6 +36,8 @@ #include +#include + #include "callback.hh" #include "ioevents.hh" #include "task.hh" @@ -97,7 +99,9 @@ * are invoked when one of the @ref wait_and_dispatch methods is called * and I/O is pending on the particular descriptors. */ -class SelectorList { +class SelectorList : + public boost::noncopyable +{ public: /** @@ -229,9 +233,6 @@ private: int do_select(struct timeval* to, bool force); - SelectorList(const SelectorList&); // not implemented - SelectorList& operator=(const SelectorList&); // not implemented - private: enum { // correspond to SelectorMask; correspondence checked with Modified: trunk/xorp/libxorp/task.hh =================================================================== --- trunk/xorp/libxorp/task.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/libxorp/task.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -30,6 +30,7 @@ #include "round_robin.hh" #include "callback.hh" +#include class TaskList; class TaskNode; @@ -40,7 +41,10 @@ typedef XorpCallback1::RefPtr BasicTaskCallback; -class TaskNode : public RoundRobinObjBase { +class TaskNode : + public boost::noncopyable, + public RoundRobinObjBase +{ public: TaskNode(TaskList* task_list, BasicTaskCallback cb); virtual ~TaskNode(); @@ -58,9 +62,6 @@ virtual void run(XorpTask &) {}; // Implemented by children private: - TaskNode(const TaskNode&); // not implemented - TaskNode& operator=(const TaskNode&); // not implemented - TaskList* _task_list; // TaskList this node is associated with BasicTaskCallback _cb; int _ref_cnt; // Number of referring XorpTask objects Modified: trunk/xorp/libxorp/timer.hh =================================================================== --- trunk/xorp/libxorp/timer.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/libxorp/timer.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -33,6 +33,8 @@ #include #endif +#include + #include "timeval.hh" #include "heap.hh" #include "callback.hh" @@ -420,8 +422,9 @@ bool expire_one(int worst_priority); private: - TimerList(const TimerList&); // not implemented - TimerList& operator=(const TimerList&); // not implemented + // The following is not a noncopyable candidate. + TimerList(const TimerList&); // Not copyable. + TimerList& operator=(const TimerList&); // Assignable only by self. private: // we need one heap for each priority level @@ -434,8 +437,10 @@ friend class TimerListObserverBase; }; - -class TimerNode : public HeapBase { +class TimerNode : + public boost::noncopyable, + public HeapBase +{ protected: TimerNode(TimerList*, BasicTimerCallback); virtual ~TimerNode(); Modified: trunk/xorp/policy/backend/instruction.hh =================================================================== --- trunk/xorp/policy/backend/instruction.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/backend/instruction.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -46,7 +46,10 @@ * * The Push instruction owns the element. */ -class Push : public Instruction { +class Push : + public boost::noncopyable, + public Instruction +{ public: /** * Element is owned by Push. @@ -67,10 +70,6 @@ private: Element* _elem; - - // not implemented - Push(const Push&); - Push& operator=(const Push&); }; /** @@ -214,7 +213,10 @@ * * Operation will pop N elements from the stack. */ -class NaryInstr : public Instruction { +class NaryInstr : + public boost::noncopyable, + public Instruction +{ public: /** * Caller must not delete / modify operation. @@ -234,10 +236,6 @@ private: Oper* _op; - - // not impl - NaryInstr(const NaryInstr&); - NaryInstr& operator=(const NaryInstr&); }; #endif // __POLICY_BACKEND_INSTRUCTION_HH__ Modified: trunk/xorp/policy/backend/iv_exec.hh =================================================================== --- trunk/xorp/policy/backend/iv_exec.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/backend/iv_exec.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -25,11 +25,15 @@ #include +#include + #include "libxorp/xorp.h" + #include "policy/common/dispatcher.hh" #include "policy/common/varrw.hh" #include "policy/common/policy_exception.hh" #include "policy_profiler.hh" + #include "instruction.hh" #include "set_manager.hh" #include "term_instr.hh" @@ -42,7 +46,10 @@ * The execution process may be optimized by not using visitors. Having * instructions implement a method that returns a flow action directly. */ -class IvExec : public InstrVisitor { +class IvExec : + public boost::noncopyable, + public InstrVisitor +{ public: /** * A FlowAction is what has to be done with the route. DEFAULT is the @@ -170,10 +177,6 @@ bool _did_trace; Next::Flow _ctr_flow; SUBR* _subr; - - // not impelmented - IvExec(const IvExec&); - IvExec& operator=(const IvExec&); }; #endif // __POLICY_BACKEND_IV_EXEC_HH__ Modified: trunk/xorp/policy/backend/policy_filter.hh =================================================================== --- trunk/xorp/policy/backend/policy_filter.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/backend/policy_filter.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -26,6 +26,8 @@ #include #include +#include + #include "policy/common/varrw.hh" #include "policy/common/policy_exception.hh" #include "policy_instr.hh" @@ -39,7 +41,10 @@ * * It may accept/reject/modify any route which supports VarRW. */ -class PolicyFilter : public FilterBase { +class PolicyFilter : + public boost::noncopyable, + public FilterBase +{ public: /** * @short Exception thrown on configuration error. @@ -85,10 +90,6 @@ IvExec _exec; PolicyProfiler* _profiler_exec; SUBR* _subr; - - // not impl - PolicyFilter(const PolicyFilter&); - PolicyFilter& operator=(const PolicyFilter&); }; typedef ref_ptr RefPf; Modified: trunk/xorp/policy/backend/policy_filters.hh =================================================================== --- trunk/xorp/policy/backend/policy_filters.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/backend/policy_filters.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -23,6 +23,8 @@ #ifndef __POLICY_BACKEND_POLICY_FILTERS_HH__ #define __POLICY_BACKEND_POLICY_FILTERS_HH__ +#include + #include "policy_filter.hh" #include "policy/common/filter.hh" #include "policy/common/varrw.hh" @@ -35,7 +37,9 @@ * future an option to disable a filter should be added. Although, not running a * filter is harmless for now [if configured however, state consumes memory]. */ -class PolicyFilters { +class PolicyFilters : + public boost::noncopyable +{ public: class PolicyFiltersErr : public PolicyException { public: @@ -87,13 +91,10 @@ */ FilterBase& whichFilter(const uint32_t& ftype); +private: FilterBase* _import_filter; FilterBase* _export_sm_filter; FilterBase* _export_filter; - - // not impl - PolicyFilters(const PolicyFilters&); - PolicyFilters& operator=(const PolicyFilters&); }; #endif // __POLICY_BACKEND_POLICY_FILTERS_HH__ Modified: trunk/xorp/policy/backend/policy_instr.hh =================================================================== --- trunk/xorp/policy/backend/policy_instr.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/backend/policy_instr.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -23,17 +23,21 @@ #ifndef __POLICY_BACKEND_POLICY_INSTR_HH__ #define __POLICY_BACKEND_POLICY_INSTR_HH__ -#include "term_instr.hh" #include #include +#include +#include "term_instr.hh" + /** * @short Container for terms instructions. * * A policy instruction is a list of term instructions. */ -class PolicyInstr { +class PolicyInstr : + public boost::noncopyable +{ public: /** * @param name name of the policy. @@ -83,10 +87,6 @@ TermInstr** _terms; int _termc; bool _trace; - - // not impl - PolicyInstr(const PolicyInstr&); - PolicyInstr& operator=(const PolicyInstr&); }; #endif // __POLICY_BACKEND_POLICY_INSTR_HH__ Modified: trunk/xorp/policy/backend/policy_redist_map.hh =================================================================== --- trunk/xorp/policy/backend/policy_redist_map.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/backend/policy_redist_map.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -23,10 +23,13 @@ #ifndef __POLICY_BACKEND_POLICY_REDIST_MAP_HH__ #define __POLICY_BACKEND_POLICY_REDIST_MAP_HH__ -#include "policytags.hh" #include #include +#include + +#include "policytags.hh" + /** * @short A Map between policytags and where the route should be redistributed. * @@ -34,7 +37,9 @@ * policytags need to be analyzed. According to these tags, the route must be * sent to various routing protocols to enable export policies. */ -class PolicyRedistMap { +class PolicyRedistMap : + public boost::noncopyable +{ public: PolicyRedistMap(); ~PolicyRedistMap(); @@ -63,13 +68,7 @@ private: // XXX: this should be the other way around for faster lookups typedef map Map; - Map _map; - - - // not impl - PolicyRedistMap(const PolicyRedistMap&); - PolicyRedistMap& operator=(const PolicyRedistMap&); }; #endif // __POLICY_BACKEND_POLICY_REDIST_MAP_HH__ Modified: trunk/xorp/policy/backend/set_manager.hh =================================================================== --- trunk/xorp/policy/backend/set_manager.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/backend/set_manager.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -23,12 +23,14 @@ #ifndef __POLICY_BACKEND_SET_MANAGER_HH__ #define __POLICY_BACKEND_SET_MANAGER_HH__ -#include "policy/common/element_base.hh" -#include "policy/common/policy_exception.hh" #include #include +#include +#include "policy/common/element_base.hh" +#include "policy/common/policy_exception.hh" + /** * @short Class that owns all sets. It resolves set names to ElemSet's. * @@ -36,7 +38,9 @@ * reconfigured, but only the sets. This is currently not the case, but there is * enough structure to allow it. */ -class SetManager { +class SetManager : + public boost::noncopyable +{ public: typedef map SetMap; @@ -72,13 +76,9 @@ * Zap all sets. */ void clear(); + private: - SetMap* _sets; - - // not impl - SetManager(const SetManager&); - SetManager& operator=(const SetManager&); }; #endif // __POLICY_BACKEND_SET_MANAGER_HH__ Modified: trunk/xorp/policy/backend/single_varrw.hh =================================================================== --- trunk/xorp/policy/backend/single_varrw.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/backend/single_varrw.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -25,6 +25,8 @@ #include +#include + #include "policy/common/varrw.hh" #include "policy/common/policy_utils.hh" #include "policy/common/element_base.hh" @@ -39,7 +41,10 @@ * Because of this caching, the SingleVarRW is usuable only once. After it has * done its work once, it has to be re-created. */ -class SingleVarRW : public VarRW { +class SingleVarRW : + public boost::noncopyable, + public VarRW +{ public: /** * @short Exception thrown on error, such as reading unsupported variable. @@ -141,10 +146,6 @@ bool _modified[VAR_MAX]; // variable id's that changed bool _did_first_read; PolicyTags* _pt; - - // not impl - SingleVarRW(const SingleVarRW&); - SingleVarRW& operator=(const SingleVarRW&); }; #endif // __POLICY_BACKEND_SINGLE_VARRW_HH__ Modified: trunk/xorp/policy/backend/term_instr.hh =================================================================== --- trunk/xorp/policy/backend/term_instr.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/backend/term_instr.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -25,16 +25,20 @@ #include #include + +#include + #include "instruction.hh" #include "policy/common/policy_utils.hh" - /** * @short Container of instructions. * * A term is an atomic policy unit which may be executed. */ -class TermInstr { +class TermInstr : + public boost::noncopyable +{ public: /** * @param name term name. @@ -79,10 +83,6 @@ string _name; Instruction** _instructions; int _instrc; - - // not impl - TermInstr(const TermInstr&); - TermInstr& operator=(const TermInstr&); }; #endif // __POLICY_BACKEND_TERM_INSTR_HH__ Modified: trunk/xorp/policy/code_list.hh =================================================================== --- trunk/xorp/policy/code_list.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/code_list.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -23,17 +23,19 @@ #ifndef __POLICY_CODE_LIST_HH__ #define __POLICY_CODE_LIST_HH__ - #include #include +#include + #include "code.hh" - /** * @short A collection of code fragments. */ -class CodeList { +class CodeList : + public boost::noncopyable +{ public: /** * Initialize codelist. @@ -98,10 +100,6 @@ typedef list ListCode; ListCode _codes; - - // not impl - CodeList(const CodeList&); - CodeList& operator=(const CodeList&); }; #endif // __POLICY_CODE_LIST_HH__ Modified: trunk/xorp/policy/common/element.hh =================================================================== --- trunk/xorp/policy/common/element.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/common/element.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -451,7 +451,7 @@ ElemNet(); ElemNet(const char*); ElemNet(const A&); - ElemNet(const ElemNet&); + ElemNet(const ElemNet&); // copyable ~ElemNet(); string str() const; @@ -465,8 +465,7 @@ bool operator==(const ElemNet& rhs) const; private: - // not implemented - ElemNet& operator=(const ElemNet&); + ElemNet& operator=(const ElemNet&); // not assignable const A* _net; Mod _mod; Modified: trunk/xorp/policy/configuration.hh =================================================================== --- trunk/xorp/policy/configuration.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/configuration.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -23,7 +23,10 @@ #ifndef __POLICY_CONFIGURATION_HH__ #define __POLICY_CONFIGURATION_HH__ +#include + #include "policy/common/policy_exception.hh" + #include "process_watch_base.hh" #include "set_map.hh" #include "policy_map.hh" @@ -81,7 +84,9 @@ * checking by (dis)allowing the user to do certain actions [such as delete sets * which are referenced in policies]. */ -class Configuration { +class Configuration : + public boost::noncopyable +{ public: typedef map CodeMap; typedef map TagMap; @@ -397,10 +402,6 @@ TagMap _tagmap; VarMap _varmap; FilterManagerBase* _filter_manager; // do not delete - - // not impl - Configuration(const Configuration&); - Configuration& operator=(const Configuration&); }; #endif // __POLICY_CONFIGURATION_HH__ Modified: trunk/xorp/policy/dependency.hh =================================================================== --- trunk/xorp/policy/dependency.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/dependency.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -29,6 +29,8 @@ #include #include +#include + #include "policy/common/policy_exception.hh" /** @@ -46,7 +48,9 @@ * Having a consistent dependency list allows objects to be deleted correctly. */ template -class Dependency { +class Dependency : + public boost::noncopyable +{ public: // things that depend on object typedef list DependencyList; @@ -204,10 +208,6 @@ Map _map; Pair* findDepend(const string& objectname) const; - - // not impl - Dependency(const Dependency&); - Dependency& operator=(const Dependency&); }; #endif // __POLICY_DEPENDENCY_HH__ Modified: trunk/xorp/policy/node.hh =================================================================== --- trunk/xorp/policy/node.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/node.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -23,17 +23,23 @@ #ifndef __POLICY_NODE_HH__ #define __POLICY_NODE_HH__ +#include + +#include + #include "policy/common/operator_base.hh" #include "policy/common/varrw.hh" + #include "node_base.hh" #include "visitor.hh" -#include /** * @short A generic node wrapper. */ template -class NodeAny : public Node { +class NodeAny : + public Node +{ public: /** * @param val the value of the node. @@ -63,7 +69,10 @@ * * Such as an IP address. */ -class NodeElem : public Node { +class NodeElem : + public boost::noncopyable, + public Node +{ public: /** * The node owns the element. Caller must not modify / delete. @@ -83,10 +92,6 @@ private: Element* _elem; - - // not impl - NodeElem(const NodeElem&); - NodeElem& operator=(const NodeElem&); }; /** @@ -119,7 +124,10 @@ * The node will thus have two children. It owns both of them. * */ -class NodeBin : public Node { +class NodeBin : + public boost::noncopyable, + public Node +{ public: /** * Caller must not delete / modify pointers. @@ -158,10 +166,6 @@ BinOper* _op; Node *_left; Node *_right; - - // not impl - NodeBin(const NodeBin&); - NodeBin& operator=(const NodeBin&); }; /** @@ -169,7 +173,10 @@ * * The node will have one child. It owns it. */ -class NodeUn : public Node { +class NodeUn : + public boost::noncopyable, + public Node +{ public: /** * Caller must not delete / modify pointers. @@ -199,17 +206,16 @@ private: UnOper* _op; Node* _node; - - // not impl - NodeUn(const NodeUn&); - NodeUn& operator=(const NodeUn&); }; /** * @short An assignment operation. */ -class NodeAssign : public Node { +class NodeAssign : + public boost::noncopyable, + public Node +{ public: /** * Caller must not delete / modify pointer. @@ -241,10 +247,6 @@ string _varid; BinOper* _mod; Node* _rvalue; - - // not impl - NodeAssign(const NodeAssign&); - NodeAssign& operator=(const NodeAssign&); }; /** Modified: trunk/xorp/policy/policy_list.hh =================================================================== --- trunk/xorp/policy/policy_list.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/policy_list.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -23,6 +23,8 @@ #ifndef __POLICY_POLICY_LIST_HH__ #define __POLICY_POLICY_LIST_HH__ +#include + #include "code_list.hh" #include "set_map.hh" #include "var_map.hh" @@ -40,7 +42,9 @@ * Each policy list is an instantiation of a policy, and thus it hold the * specific code for this instantiation. */ -class PolicyList { +class PolicyList : + public boost::noncopyable +{ public: typedef set TagSet; typedef map TagMap; @@ -175,10 +179,6 @@ Term* _mod_term_export; static uint32_t _pe; POLICIES _pe_policies; - - // not impl - PolicyList(const PolicyList&); - PolicyList& operator=(const PolicyList&); }; #endif // __POLICY_POLICY_LIST_HH__ Modified: trunk/xorp/policy/policy_statement.hh =================================================================== --- trunk/xorp/policy/policy_statement.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/policy_statement.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -27,20 +27,24 @@ #include #include +#include + #include "libproto/config_node_id.hh" + #include "policy/common/policy_exception.hh" + #include "set_map.hh" #include "term.hh" class PolicyMap; - typedef set DEPS; /** * @short A policy statement is a collection of terms. */ -class PolicyStatement { - +class PolicyStatement : + public boost::noncopyable +{ public: /** * @short Exception thrown on error such as when no term is found. @@ -167,10 +171,6 @@ DEPS _policies; SetMap& _smap; PolicyMap& _pmap; - - // not impl - PolicyStatement(const PolicyStatement&); - PolicyStatement& operator=(const PolicyStatement&); }; #endif // __POLICY_POLICY_STATEMENT_HH__ Modified: trunk/xorp/policy/protocol_map.hh =================================================================== --- trunk/xorp/policy/protocol_map.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/protocol_map.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -26,6 +26,8 @@ #include #include +#include + /** * @short Maps protocols to the XORP process name. * @@ -33,7 +35,9 @@ * explicitly added. This class is used to map user configuration directives * regarding protocols to the actual name of the XORP process for that protocol. */ -class ProtocolMap { +class ProtocolMap : + public boost::noncopyable +{ public: ProtocolMap(); @@ -64,9 +68,6 @@ private: typedef map Map; - ProtocolMap(const ProtocolMap&); // not impl - ProtocolMap& operator=(const ProtocolMap&); // not impl - Map _map; }; Modified: trunk/xorp/policy/semantic_varrw.hh =================================================================== --- trunk/xorp/policy/semantic_varrw.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/semantic_varrw.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -23,12 +23,16 @@ #ifndef __POLICY_SEMANTIC_VARRW_HH__ #define __POLICY_SEMANTIC_VARRW_HH__ +#include + +#include + #include "policy/common/varrw.hh" #include "policy/common/element_base.hh" #include "policy/common/element_factory.hh" #include "policy/common/policy_exception.hh" + #include "var_map.hh" -#include /** * @short A VarRW used for semantic checking. @@ -41,7 +45,10 @@ * The SemanticVarRW will create dummy elements which are initialized to a * default value. This may not be optimal for semantic checking. */ -class SemanticVarRW : public VarRW { +class SemanticVarRW : + public boost::noncopyable, + public VarRW +{ public: /** * @short Exception thrown on illegal variable use. @@ -103,10 +110,6 @@ ElementFactory _ef; set _trash; - - // not implemented. - SemanticVarRW(const SemanticVarRW&); - SemanticVarRW& operator=(const SemanticVarRW&); }; #endif // __POLICY_SEMANTIC_VARRW_HH__ Modified: trunk/xorp/policy/source_match_code_generator.hh =================================================================== --- trunk/xorp/policy/source_match_code_generator.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/source_match_code_generator.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -26,7 +26,10 @@ #include #include +#include + #include "policy/common/policy_exception.hh" + #include "code_generator.hh" /** @@ -37,7 +40,10 @@ * It skips dest and action blocks in policies. * The action block is replaced with the actual policy tagging. */ -class SourceMatchCodeGenerator : public CodeGenerator { +class SourceMatchCodeGenerator : + public boost::noncopyable, + public CodeGenerator +{ public: // bool == tag used // uint32_t actual tag @@ -119,10 +125,6 @@ map > _protocol_tags; bool _protocol_statement; string _policy; - - // not impl - SourceMatchCodeGenerator(const SourceMatchCodeGenerator&); - SourceMatchCodeGenerator& operator=(const SourceMatchCodeGenerator&); }; #endif // __POLICY_SOURCE_MATCH_CODE_GENERATOR_HH__ Modified: trunk/xorp/policy/term.hh =================================================================== --- trunk/xorp/policy/term.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/term.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -23,21 +23,26 @@ #ifndef __POLICY_TERM_HH__ #define __POLICY_TERM_HH__ +#include +#include + +#include + #include "libproto/config_node_id.hh" + #include "policy/common/policy_exception.hh" -#include -#include #include "node_base.hh" - /** * @short A term is an atomic policy unit. * * It is a complete specification of how a route needs to be matched, and what * actions must be taken. */ -class Term { +class Term : + public boost::noncopyable +{ public: enum BLOCKS { SOURCE = 0, @@ -165,10 +170,6 @@ Nodes*& _action_nodes; string _from_protocol; // The protocol (in the "from" block) - - // not impl - Term(const Term&); - Term& operator=(const Term&); }; #endif // __POLICY_TERM_HH__ Modified: trunk/xorp/policy/var_map.hh =================================================================== --- trunk/xorp/policy/var_map.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/var_map.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -23,11 +23,15 @@ #ifndef __POLICY_VAR_MAP_HH__ #define __POLICY_VAR_MAP_HH__ +#include +#include + +#include + #include "policy/common/policy_exception.hh" #include "policy/common/varrw.hh" + #include "process_watch.hh" -#include -#include /** * @short A VarMap contains all information for legal protocol variables. @@ -38,7 +42,9 @@ * * This is crutial for semantic checking. */ -class VarMap { +class VarMap : + public boost::noncopyable +{ public: /** * @short Exception thrown on VarMap errors such as on unknown variables. @@ -177,10 +183,6 @@ typedef VariableMap MetaVarContainer; MetaVarContainer _metavars; - - // not impl - VarMap(const VarMap&); - VarMap& operator=(const VarMap&); }; #endif // __POLICY_VAR_MAP_HH__ Modified: trunk/xorp/policy/visitor_semantic.hh =================================================================== --- trunk/xorp/policy/visitor_semantic.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/policy/visitor_semantic.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -23,9 +23,13 @@ #ifndef __POLICY_VISITOR_SEMANTIC_HH__ #define __POLICY_VISITOR_SEMANTIC_HH__ +#include + #include "libxorp/xorp.h" + #include "policy/common/varrw.hh" #include "policy/common/dispatcher.hh" + #include "visitor.hh" #include "semantic_varrw.hh" #include "set_map.hh" @@ -39,7 +43,10 @@ * checking must be performed realtive to the instantiation. [Generic semantic * checking may be accomplished too, but it is not done.] */ -class VisitorSemantic : public Visitor { +class VisitorSemantic : + public boost::noncopyable, + public Visitor +{ public: enum PolicyType { IMPORT, @@ -107,10 +114,6 @@ PolicyType _ptype; set _trash; bool _reject; - - // not impl - VisitorSemantic(const VisitorSemantic&); - VisitorSemantic& operator=(const VisitorSemantic&); }; #endif // __POLICY_VISITOR_SEMANTIC_HH__ Modified: trunk/xorp/rib/redist_policy.hh =================================================================== --- trunk/xorp/rib/redist_policy.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/rib/redist_policy.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -22,6 +22,8 @@ #ifndef __RIB_REDIST_POLICY_HH__ #define __RIB_REDIST_POLICY_HH__ +#include + /** * @short Base class for Redistribution Policy objects. * @@ -48,7 +50,9 @@ * @short Base class for Unary Redistribution Policy objects. */ template -class RedistUnaryOp { +class RedistUnaryOp : + public boost::noncopyable +{ public: /** * Constructor. @@ -61,8 +65,6 @@ private: // The following are not implemented RedistUnaryOp(); - RedistUnaryOp(const RedistUnaryOp&); - RedistUnaryOp& operator=(const RedistUnaryOp&); protected: const RedistPolicy* _p1; @@ -72,7 +74,10 @@ * @short Base class for Binary Redistribution Policy objects. */ template -class RedistBinaryOp : public RedistPolicy { +class RedistBinaryOp : + public boost::noncopyable, + public RedistPolicy +{ public: /** * Constructor. @@ -89,8 +94,6 @@ private: // The following are not implemented RedistBinaryOp(); - RedistBinaryOp(const RedistBinaryOp&); - RedistBinaryOp& operator=(const RedistBinaryOp&); protected: const RedistPolicy* _p1; Modified: trunk/xorp/rib/rib.hh =================================================================== --- trunk/xorp/rib/rib.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/rib/rib.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -25,6 +25,8 @@ #include +#include + #include "libxorp/xorp.h" #include "libxorp/ipv4.hh" #include "libxorp/ipv6.hh" @@ -73,7 +75,9 @@ * taken place to route to command to the right RIB. */ template -class RIB { +class RIB : + public boost::noncopyable +{ public: /** * RIB Constructor. @@ -696,21 +700,10 @@ IPPeerNextHop* find_or_create_peer_nexthop(const A& addr); /** - * not implemented - force use of default copy constuctor to fail. - */ - RIB(const RIB& ); - - /** - * not implemented - force use of default assignment operator to fail. - */ - RIB& operator=(const RIB& ); - - /** * Flush out routing table changes to other processes. */ void flush(); - protected: RibManager& _rib_manager; EventLoop& _eventloop; Modified: trunk/xorp/rib/rt_tab_redist.hh =================================================================== --- trunk/xorp/rib/rt_tab_redist.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/rib/rt_tab_redist.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -22,6 +22,8 @@ #ifndef __RIB_RT_TAB_REDIST_HH__ #define __RIB_RT_TAB_REDIST_HH__ +#include + #include "rt_tab_base.hh" template @@ -141,7 +143,8 @@ * associated with it. */ template -class Redistributor +class Redistributor : + public boost::noncopyable { public: class RedistEventInterface { @@ -249,10 +252,6 @@ RedistOutput* output() { return _output; } private: - // The following are not implemented - Redistributor(const Redistributor&); - Redistributor& operator=(const Redistributor&); - // These are nested classes and need to be friends to invoke methods in // enclosing class. friend class RedistEventInterface; @@ -282,7 +281,8 @@ * Base class for propagaing output of route add and delete messages. */ template -class RedistOutput +class RedistOutput : + public boost::noncopyable { public: RedistOutput(Redistributor* r); @@ -311,11 +311,6 @@ void announce_fatal_error() { _r->output_event().fatal_error(); } private: - // The following are not implemented - RedistOutput(const RedistOutput&); - RedistOutput& operator=(const RedistOutput&); - -private: Redistributor* _r; }; Modified: trunk/xorp/rip/output.hh =================================================================== --- trunk/xorp/rip/output.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/rip/output.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -30,6 +30,8 @@ #include "libxorp/debug.h" #include "libxorp/eventloop.hh" +#include + #include "policy/backend/policy_filters.hh" #include "port.hh" @@ -49,7 +51,9 @@ * packets. Timers elsewhere schedule the start of each packet train. */ template -class OutputBase { +class OutputBase : + public boost::noncopyable +{ public: typedef A Addr; typedef IPNet Net; @@ -133,10 +137,6 @@ */ bool do_filtering(RouteEntry* r); -private: - OutputBase(const OutputBase& o); // Not implemented - OutputBase& operator=(const OutputBase& o); // Not implemented - protected: EventLoop& _e; Port& _port; // Port associated with output Modified: trunk/xorp/rip/output_table.hh =================================================================== --- trunk/xorp/rip/output_table.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/rip/output_table.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -35,9 +35,11 @@ * intended use is for solicited and unsolicited routing table. * * Specialized implementations exist for IPv4 and IPv6. + * Non-copyable due to inheritance from OutputBase. */ template -class OutputTable : public OutputBase +class OutputTable : + public OutputBase { public: OutputTable(EventLoop& e, @@ -52,16 +54,10 @@ protected: void output_packet(); - void start_output_processing(); - void stop_output_processing(); private: - OutputTable(const OutputTable& o); // Not implemented - OutputTable& operator=(const OutputTable& o); // Not implemented - -private: RouteWalker _rw; // RouteWalker bool _rw_valid; // RouteWalker is valid (no reset req). }; Modified: trunk/xorp/rip/output_updates.hh =================================================================== --- trunk/xorp/rip/output_updates.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/rip/output_updates.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -36,9 +36,11 @@ * triggered update packets. * * Specialized implementations exist for IPv4 and IPv6. + * Non-copyable due to inheritance from OutputBase. */ template -class OutputUpdates : public OutputBase +class OutputUpdates : + public OutputBase { public: OutputUpdates(EventLoop& e, @@ -68,10 +70,6 @@ void stop_output_processing(); private: - OutputUpdates(const OutputUpdates& o); // Not implemented - OutputUpdates& operator=(const OutputUpdates& o); // Not implemented - -private: UpdateQueue& _uq; typename UpdateQueue::ReadIterator _uq_iter; }; Modified: trunk/xorp/rip/redist.hh =================================================================== --- trunk/xorp/rip/redist.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/rip/redist.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -41,9 +41,12 @@ * associated with them. set_allow_timers() is called when the * RedistTable is going to be withdrawn. This allows routes to be * advertised as unreachable via host before they are deleted. + * + * Non-copyable due to inheritance from RouteEntryOrigin. */ template -class RedistRouteOrigin : public RouteEntryOrigin +class RedistRouteOrigin : + public RouteEntryOrigin { public: RedistRouteOrigin() : RouteEntryOrigin(true) {} @@ -61,10 +64,6 @@ * expiry. */ uint32_t deletion_secs() const; - -private: - RedistRouteOrigin(const RedistRouteOrigin&); // not impl - RedistRouteOrigin& operator=(const RedistRouteOrigin&); // not impl }; @@ -72,7 +71,9 @@ * @short Store for redistributed routes. */ template -class RouteRedistributor { +class RouteRedistributor : + public boost::noncopyable +{ public: typedef A Addr; typedef IPNet Net; @@ -137,9 +138,6 @@ bool withdrawing_routes() const; private: - RouteRedistributor(const RouteRedistributor& ); // not impl - RouteRedistributor& operator=(const RouteRedistributor& ); // not impl - /** * Periodic timer callback for withdrawing a batch of routes. The timer * is triggered by @ref withdraw_routes(). Modified: trunk/xorp/rip/route_db.hh =================================================================== --- trunk/xorp/rip/route_db.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/rip/route_db.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -27,6 +27,7 @@ #include "libxorp/ref_ptr.hh" #include +#include #include "policy/backend/policy_filters.hh" @@ -69,7 +70,9 @@ * The @ref RouteWalker class provides a way to walk the routes held. */ template -class RouteDB { +class RouteDB : + public boost::noncopyable +{ public: typedef A Addr; typedef IPNet Net; @@ -215,9 +218,6 @@ Trace& trace() { return _trace; } protected: - RouteDB(const RouteDB&); // not implemented - RouteDB& operator=(const RouteDB&); // not implemented - void expire_route(Route* r); void set_expiry_timer(Route* r); @@ -262,7 +262,8 @@ * expensive. */ template -class RouteWalker +class RouteWalker : + public boost::noncopyable { public: typedef A Addr; @@ -326,10 +327,6 @@ */ void reset(); -protected: - RouteWalker(const RouteWalker&); // Not impl - RouteWalker& operator=(const RouteWalker&); // Not impl - private: static const Net NO_NET; Modified: trunk/xorp/rip/route_entry.hh =================================================================== --- trunk/xorp/rip/route_entry.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/rip/route_entry.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -27,11 +27,11 @@ #include "libxorp/ipnet.hh" #include "libxorp/timer.hh" +#include + #include "policy/backend/policytags.hh" - template class RouteEntryOrigin; - template class RouteEntryRef; /** @@ -42,7 +42,9 @@ * Only IPv4 and IPv6 types may be supplied. */ template -class RouteEntry { +class RouteEntry : + public boost::noncopyable +{ public: typedef A Addr; typedef IPNet Net; @@ -231,13 +233,9 @@ uint16_t ref_cnt() const { return _ref_cnt; } protected: - RouteEntry(const RouteEntry&); // Not implemented. - RouteEntry& operator=(const RouteEntry&); // Not implemented. - void dissociate(); void associate(Origin* o); - protected: Net _net; Addr _nh; @@ -308,7 +306,9 @@ * Only IPv4 and IPv6 types may be supplied. */ template -class RouteEntryOrigin { +class RouteEntryOrigin : + public boost::noncopyable +{ public: typedef RouteEntry Route; typedef IPNet Net; @@ -374,10 +374,6 @@ */ virtual uint32_t deletion_secs() const = 0; -private: - RouteEntryOrigin(const RouteEntryOrigin& reo); // Not impl - RouteEntryOrigin& operator=(const RouteEntryOrigin&); // Not impl - protected: struct RouteEntryStore* _rtstore; Modified: trunk/xorp/rip/system.hh =================================================================== --- trunk/xorp/rip/system.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/rip/system.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -24,6 +24,8 @@ #define __RIP_SYSTEM_HH__ #include +#include + #include "trace.hh" #include "route_db.hh" #include "port_manager.hh" @@ -34,7 +36,9 @@ * @short Top Level container for XORP RIP implementation. */ template -class System { +class System : + public boost::noncopyable +{ public: typedef RouteDB RouteDatabase; typedef PortManagerBase PortManager; @@ -121,10 +125,6 @@ Trace& route_trace() { return _rtdb.trace(); } protected: - System(const System&); // Not implemented - System& operator=(const System&); // Not implemented - -protected: EventLoop& _e; // Modified: trunk/xorp/rip/tools/common.hh =================================================================== --- trunk/xorp/rip/tools/common.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/rip/tools/common.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -114,8 +114,11 @@ /** * Base class for Xrl Jobs that are invoked by classes derived * from XrlJobQueue. + * Non-copyable due to inheriting from CallbackSafeObject. */ -class XrlJobBase : public CallbackSafeObject { +class XrlJobBase : + public CallbackSafeObject +{ public: XrlJobBase(XrlJobQueue& q) : _q(q) {} @@ -126,10 +129,6 @@ XrlJobQueue& queue() { return _q; } private: - XrlJobBase(const XrlJobBase&); // Not implemented - XrlJobBase& operator=(const XrlJobBase&); // Not implemented - -private: XrlJobQueue& _q; }; Modified: trunk/xorp/rip/xrl_port_manager.hh =================================================================== --- trunk/xorp/rip/xrl_port_manager.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/rip/xrl_port_manager.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -22,6 +22,8 @@ #ifndef __RIP_XRL_PORT_MANAGER_HH__ #define __RIP_XRL_PORT_MANAGER_HH__ +#include + #include "libxorp/service.hh" #include "libfeaclient/ifmgr_xrl_mirror.hh" #include "port_manager.hh" @@ -43,11 +45,12 @@ * appropriate @ref XrlPortIO object. */ template -class XrlPortManager - : public PortManagerBase, - public IfMgrHintObserver, - public ServiceBase, - public ServiceChangeObserverBase +class XrlPortManager : + public boost::noncopyable, + public PortManagerBase, + public IfMgrHintObserver, + public ServiceBase, + public ServiceChangeObserverBase { public: XrlPortManager(System& system, @@ -196,10 +199,6 @@ // void try_start_next_io_handler(); -private: - XrlPortManager(const XrlPortManager&); // not implemented - XrlPortManager& operator=(const XrlPortManager&); // not implemented - protected: XrlRouter& _xr; // XrlRouter IfMgrXrlMirror& _ifm; // Interface Mirror Modified: trunk/xorp/rtrmgr/op_commands.hh =================================================================== --- trunk/xorp/rtrmgr/op_commands.hh 2009-12-03 21:58:20 UTC (rev 11661) +++ trunk/xorp/rtrmgr/op_commands.hh 2009-12-03 22:10:51 UTC (rev 11662) @@ -31,6 +31,7 @@ #include "cli.hh" #include "rtrmgr_error.hh" +#include class ConfigTree; class OpCommand; @@ -38,7 +39,9 @@ class TemplateTree; class SlaveModuleManager; -class OpInstance { +class OpInstance : + public boost::noncopyable +{ public: OpInstance(EventLoop& eventloop, OpCommand& op_command, @@ -59,9 +62,6 @@ void terminate_with_prejudice(); private: - OpInstance(const OpInstance&); // Not implemented - OpInstance& operator=(const OpInstance&); // Not implemented - void stdout_cb(RunCommand* run_command, const string& output); void stderr_cb(RunCommand* run_command, const string& output); void done_cb(RunCommand* run_command, bool success, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 14:42:24 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 22:42:24 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11663] trunk/xorp Message-ID: Revision: 11663 http://xorp.svn.sourceforge.net/xorp/?rev=11663&view=rev Author: bms_fbsd Date: 2009-12-03 22:42:23 +0000 (Thu, 03 Dec 2009) Log Message: ----------- Second Boost refactoring pass. Use Boost's C-compatible regex library, in preference to pcreposix. Given we've started using Boost, this reduces our third-party dependency count. No functional changes. Modified Paths: -------------- trunk/xorp/SConstruct trunk/xorp/cli/SConscript trunk/xorp/cli/cli_command_pipe.hh trunk/xorp/policy/backend/instruction.hh trunk/xorp/policy/common/SConscript trunk/xorp/policy/common/policy_utils.cc trunk/xorp/site_scons/config/allconfig.py Modified: trunk/xorp/SConstruct =================================================================== --- trunk/xorp/SConstruct 2009-12-03 22:10:51 UTC (rev 11662) +++ trunk/xorp/SConstruct 2009-12-03 22:42:23 UTC (rev 11663) @@ -367,7 +367,7 @@ # Additional Boost libraries #conf.CheckBoostLibrary('filesystem') #conf.CheckBoostLibrary('program_options') - #conf.CheckBoostLibrary('regex') + conf.CheckBoostLibrary('regex') #conf.CheckBoostLibrary('signals') #conf.CheckBoostLibrary('thread') Modified: trunk/xorp/cli/SConscript =================================================================== --- trunk/xorp/cli/SConscript 2009-12-03 22:10:51 UTC (rev 11662) +++ trunk/xorp/cli/SConscript 2009-12-03 22:42:23 UTC (rev 11663) @@ -59,7 +59,7 @@ # External libraries. env.AppendUnique(LIBS = [ - 'pcreposix' + 'boost_regex' ]) env.Replace(RPATH = [ Modified: trunk/xorp/cli/cli_command_pipe.hh =================================================================== --- trunk/xorp/cli/cli_command_pipe.hh 2009-12-03 22:10:51 UTC (rev 11662) +++ trunk/xorp/cli/cli_command_pipe.hh 2009-12-03 22:42:23 UTC (rev 11663) @@ -34,19 +34,8 @@ #include #include -#ifdef HAVE_REGEX_H -#include -#else // ! HAVE_REGEX_H +#include -#ifdef HAVE_PCRE_H -#include -#endif -#ifdef HAVE_PCREPOSIX_H -#include -#endif - -#endif // ! HAVE_REGEX_H - #include "cli_command.hh" Modified: trunk/xorp/policy/backend/instruction.hh =================================================================== --- trunk/xorp/policy/backend/instruction.hh 2009-12-03 22:10:51 UTC (rev 11662) +++ trunk/xorp/policy/backend/instruction.hh 2009-12-03 22:42:23 UTC (rev 11663) @@ -25,12 +25,7 @@ #include "libxorp/xorp.h" -#if defined(HAVE_REGEX_H) -#include -#elif defined(HAVE_PCREPOSIX_H) -#include -#include -#endif +#include #include "policy/common/element_base.hh" #include "policy/common/operator_base.hh" Modified: trunk/xorp/policy/common/SConscript =================================================================== --- trunk/xorp/policy/common/SConscript 2009-12-03 22:10:51 UTC (rev 11662) +++ trunk/xorp/policy/common/SConscript 2009-12-03 22:42:23 UTC (rev 11663) @@ -40,7 +40,7 @@ # External libraries env.AppendUnique(LIBS = [ - 'pcreposix' + 'boost_regex' ]) is_shared = env.has_key('SHAREDLIBS') Modified: trunk/xorp/policy/common/policy_utils.cc =================================================================== --- trunk/xorp/policy/common/policy_utils.cc 2009-12-03 22:10:51 UTC (rev 11662) +++ trunk/xorp/policy/common/policy_utils.cc 2009-12-03 22:42:23 UTC (rev 11663) @@ -22,14 +22,7 @@ #include "libxorp/xorp.h" -#if defined(HAVE_REGEX_H) -#include -#elif defined(HAVE_PCREPOSIX_H) -#include -#include -#else -#error "No header defining regex_t is present." -#endif +#include #include "policy_utils.hh" Modified: trunk/xorp/site_scons/config/allconfig.py =================================================================== --- trunk/xorp/site_scons/config/allconfig.py 2009-12-03 22:10:51 UTC (rev 11662) +++ trunk/xorp/site_scons/config/allconfig.py 2009-12-03 22:42:23 UTC (rev 11663) @@ -83,10 +83,10 @@ has_pwd_h = conf.CheckHeader('pwd.h') has_mqueue_h = conf.CheckHeader('mqueue.h') - prereq_regex_h = [] - if has_sys_types_h: - prereq_regex_h.append('sys/types.h') - has_regex_h = conf.CheckHeader(prereq_regex_h + ['regex.h']) + #prereq_regex_h = [] + #if has_sys_types_h: + # prereq_regex_h.append('sys/types.h') + #has_regex_h = conf.CheckHeader(prereq_regex_h + ['regex.h']) has_syslog_h = conf.CheckHeader('syslog.h') has_termios_h = conf.CheckHeader('termios.h') @@ -660,10 +660,10 @@ ########## # pcre posix regexp emulation # used by policy for regexps. - has_pcre_h = conf.CheckHeader('pcre.h') - has_pcreposix_h = conf.CheckHeader('pcreposix.h') - has_libpcre = conf.CheckLib('pcre') - has_libpcreposix = conf.CheckLib('pcreposix') + #has_pcre_h = conf.CheckHeader('pcre.h') + #has_pcreposix_h = conf.CheckHeader('pcreposix.h') + #has_libpcre = conf.CheckLib('pcre') + #has_libpcreposix = conf.CheckLib('pcreposix') ########## # openssl for md5 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 14:54:21 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 22:54:21 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11664] trunk/xorp Message-ID: Revision: 11664 http://xorp.svn.sourceforge.net/xorp/?rev=11664&view=rev Author: bms_fbsd Date: 2009-12-03 22:54:21 +0000 (Thu, 03 Dec 2009) Log Message: ----------- Third Boost refactoring pass. Use Boost's polymorphic casts for clearer error checking of C++ runtime casts. No functional changes. For more detailed information on what these casts do, look here: http://www.boost.org/doc/libs/1_41_0/libs/conversion/cast.htm Discussed on: xorp-hackers@ Modified Paths: -------------- trunk/xorp/bgp/next_hop_resolver.cc trunk/xorp/bgp/plumbing.cc trunk/xorp/cli/cli_node.cc trunk/xorp/fea/fibconfig_transaction.cc trunk/xorp/fea/firewall_transaction.cc trunk/xorp/libfeaclient/ifmgr_cmd_queue.cc trunk/xorp/libxorp/timer.cc trunk/xorp/ospf/area_router.cc trunk/xorp/ospf/auth.cc trunk/xorp/ospf/external.cc trunk/xorp/ospf/peer.cc trunk/xorp/pim/xrl_pim_node.cc trunk/xorp/rib/rib.cc trunk/xorp/rip/rip_varrw.cc trunk/xorp/rip/xrl_port_manager.cc trunk/xorp/rtrmgr/master_conf_tree.cc trunk/xorp/rtrmgr/master_conf_tree_node.cc trunk/xorp/rtrmgr/master_template_tree_node.cc trunk/xorp/rtrmgr/module_manager.cc trunk/xorp/rtrmgr/slave_conf_tree_node.cc Modified: trunk/xorp/bgp/next_hop_resolver.cc =================================================================== --- trunk/xorp/bgp/next_hop_resolver.cc 2009-12-03 22:42:23 UTC (rev 11663) +++ trunk/xorp/bgp/next_hop_resolver.cc 2009-12-03 22:54:21 UTC (rev 11664) @@ -38,7 +38,10 @@ #include "route_table_decision.hh" #include "profile_vars.hh" +#include +using boost::polymorphic_cast; + template NextHopResolver::NextHopResolver(XrlStdRouter *xrl_router, EventLoop& eventloop, @@ -1329,8 +1332,7 @@ //Check that this answer is for the question on the front of the queue XLOG_ASSERT(!_queue.empty()); RibDeregisterQueueEntry *rd = - dynamic_cast *>(_queue.front()); - XLOG_ASSERT(rd != NULL); + polymorphic_cast *>(_queue.front()); XLOG_ASSERT(addr == rd->base_addr()); XLOG_ASSERT(prefix_len == rd->prefix_len()); Modified: trunk/xorp/bgp/plumbing.cc =================================================================== --- trunk/xorp/bgp/plumbing.cc 2009-12-03 22:42:23 UTC (rev 11663) +++ trunk/xorp/bgp/plumbing.cc 2009-12-03 22:54:21 UTC (rev 11664) @@ -38,7 +38,10 @@ #include "profile_vars.hh" #include "dump_iterators.hh" +#include +using boost::polymorphic_cast; + BGPPlumbing::BGPPlumbing(const Safi safi, RibIpcHandler* ribhandler, AggregationHandler* aggrhandler, @@ -933,8 +936,7 @@ } debug_msg("type = %d", prevrt->type()); - FilterTable *filter_out = dynamic_cast *>(prevrt); - XLOG_ASSERT(filter_out != NULL); + FilterTable *filter_out = polymorphic_cast *>(prevrt); filter_out->set_parent(_fanout_table); _fanout_table->add_next_table(filter_out, peer_handler, rib_in->genid()); @@ -1031,8 +1033,7 @@ _fanout_table->dump_entire_table(filter_out, _master.safi(), ribname); DumpTable *dump_table = - dynamic_cast *>(filter_out->parent()); - XLOG_ASSERT(dump_table); + polymorphic_cast *>(filter_out->parent()); /* ** It is possible that another peer was in the middle of going Modified: trunk/xorp/cli/cli_node.cc =================================================================== --- trunk/xorp/cli/cli_node.cc 2009-12-03 22:42:23 UTC (rev 11663) +++ trunk/xorp/cli/cli_node.cc 2009-12-03 22:54:21 UTC (rev 11664) @@ -435,6 +435,7 @@ int CliNode::xlog_output(void *obj, xlog_level_t level, const char *msg) { + // XXX: Unchecked runtime cast of void pointer. CliClient *cli_client = static_cast(obj); int ret_value = cli_client->cli_print(msg); Modified: trunk/xorp/fea/fibconfig_transaction.cc =================================================================== --- trunk/xorp/fea/fibconfig_transaction.cc 2009-12-03 22:42:23 UTC (rev 11663) +++ trunk/xorp/fea/fibconfig_transaction.cc 2009-12-03 22:54:21 UTC (rev 11664) @@ -27,7 +27,10 @@ #include "fibconfig_transaction.hh" +#include +using boost::polymorphic_cast; + int FibConfigTransactionManager::set_error(const string& error) { @@ -70,8 +73,7 @@ return; const FibConfigTransactionOperation* fto; - fto = dynamic_cast(&op); - XLOG_ASSERT(fto != NULL); + fto = polymorphic_cast(&op); // // Record error and xlog first error only Modified: trunk/xorp/fea/firewall_transaction.cc =================================================================== --- trunk/xorp/fea/firewall_transaction.cc 2009-12-03 22:42:23 UTC (rev 11663) +++ trunk/xorp/fea/firewall_transaction.cc 2009-12-03 22:54:21 UTC (rev 11664) @@ -27,6 +27,10 @@ #include "firewall_transaction.hh" +#include + +using boost::polymorphic_cast; + void FirewallTransactionManager::pre_commit(uint32_t tid) { @@ -42,8 +46,7 @@ return; const FirewallTransactionOperation* fto; - fto = dynamic_cast(&op); - XLOG_ASSERT(fto != NULL); + fto = polymorphic_cast(&op); if (_first_error.empty()) { _first_error = c_format("Failed executing: \"%s\": %s", Modified: trunk/xorp/libfeaclient/ifmgr_cmd_queue.cc =================================================================== --- trunk/xorp/libfeaclient/ifmgr_cmd_queue.cc 2009-12-03 22:42:23 UTC (rev 11663) +++ trunk/xorp/libfeaclient/ifmgr_cmd_queue.cc 2009-12-03 22:54:21 UTC (rev 11664) @@ -31,6 +31,10 @@ #include "ifmgr_cmds.hh" #include "ifmgr_cmd_queue.hh" +#include + +using boost::polymorphic_cast; + // ---------------------------------------------------------------------------- // IfMgrCommandSinkBase @@ -127,8 +131,8 @@ void IfMgrCommandIfClusteringQueue::push(const Cmd& cmd) { - IfMgrIfCommandBase* ifcmd = dynamic_cast(cmd.get()); - XLOG_ASSERT(ifcmd != NULL); + IfMgrIfCommandBase* ifcmd = + polymorphic_cast(cmd.get()); if (ifcmd->ifname() == _current_ifname) { _current_cmds.push_back(cmd); } else { @@ -164,8 +168,7 @@ if (_current_cmds.empty() == false) { Cmd& c = _current_cmds.front(); IfMgrIfCommandBase* ifcmd = - dynamic_cast(c.get()); - XLOG_ASSERT(ifcmd != NULL); + polymorphic_cast(c.get()); _current_ifname = ifcmd->ifname(); _current_cmds.pop_front(); } @@ -186,8 +189,8 @@ {} bool operator() (IfMgrCommandIfClusteringQueue::Cmd c) { - IfMgrIfCommandBase* ifcmd = dynamic_cast(c.get()); - XLOG_ASSERT(ifcmd != NULL); + IfMgrIfCommandBase* ifcmd = + polymorphic_cast(c.get()); return ifcmd->ifname() == _ifname; } protected: @@ -206,8 +209,7 @@ // as new current interface. Cmd& c = _future_cmds.front(); IfMgrIfCommandBase* ifcmd = - dynamic_cast(c.get()); - XLOG_ASSERT(ifcmd != NULL); + polymorphic_cast(c.get()); _current_ifname = ifcmd->ifname(); back_insert_iterator bi(_current_cmds); remove_copy_if(_future_cmds.begin(), _future_cmds.end(), bi, Modified: trunk/xorp/libxorp/timer.cc =================================================================== --- trunk/xorp/libxorp/timer.cc 2009-12-03 22:42:23 UTC (rev 11663) +++ trunk/xorp/libxorp/timer.cc 2009-12-03 22:54:21 UTC (rev 11664) @@ -25,9 +25,6 @@ // // Copyright (c) 1999-2000 Massachusetts Institute of Technology - - - #include "libxorp_module.h" #include "xorp.h" @@ -35,6 +32,8 @@ #include "timer.hh" #include "clock.hh" +#include + // Implementation Notes: // // Event scheduling happens through the TimerList. The TimerList is @@ -408,7 +407,7 @@ tardiness.str().c_str()); } - TimerNode *t = static_cast(n->object); + TimerNode *t = boost::polymorphic_downcast(n->object); heap->pop(); // _hook() requires a XorpTimer as first argument, we have // only a timernode, so we have to create a temporary Modified: trunk/xorp/ospf/area_router.cc =================================================================== --- trunk/xorp/ospf/area_router.cc 2009-12-03 22:42:23 UTC (rev 11663) +++ trunk/xorp/ospf/area_router.cc 2009-12-03 22:54:21 UTC (rev 11664) @@ -41,6 +41,8 @@ #include #include +#include + #include "libproto/spt.hh" #include "ospf.hh" @@ -48,6 +50,8 @@ #include "vertex.hh" #include "area_router.hh" +using boost::polymorphic_cast; + template AreaRouter::AreaRouter(Ospf& ospf, OspfTypes::AreaID area, OspfTypes::AreaType area_type) @@ -370,8 +374,7 @@ { Vertex node = rc.node(); Lsa::LsaRef lsar = node.get_lsa(); - RouterLsa *rlsa = dynamic_cast(lsar.get()); - XLOG_ASSERT(rlsa); + RouterLsa *rlsa = polymorphic_cast(lsar.get()); OspfTypes::RouterID rid = rlsa->get_header().get_link_state_id(); // If this router ID is in the tmp set then it is already up, just @@ -431,8 +434,7 @@ list::iterator l = lsars.begin(); XLOG_ASSERT(l != lsars.end()); Lsa::LsaRef lsar = *l++; - RouterLsa *rlsa = dynamic_cast(lsar.get()); - XLOG_ASSERT(rlsa); + RouterLsa *rlsa = polymorphic_cast(lsar.get()); OspfTypes::RouterID rid = rlsa->get_header().get_advertising_router(); // If this router ID is in the tmp set then it is already up, just @@ -505,6 +507,8 @@ "Find interface address \nsrc:\n%s\ndst:\n%s\n", cstring(*src), cstring(*dst)); + // XXX: Candidates for polymorphic_cast, but used within + // logic below. RouterLsa *rlsa = dynamic_cast(src.get()); NetworkLsa *nlsa = dynamic_cast(src.get()); @@ -621,8 +625,7 @@ cstring(*lsa)); return false; } - LinkLsa *llsa = dynamic_cast(lsa.get()); - XLOG_ASSERT(llsa); + LinkLsa *llsa = polymorphic_cast(lsa.get()); interface = llsa->get_link_local_address(); return true; } @@ -1427,8 +1430,7 @@ Lsa::LsaRef AreaRouter::external_generate_type7(Lsa::LsaRef lsar, bool& indb) { - ASExternalLsa *aselsa = dynamic_cast(lsar.get()); - XLOG_ASSERT(aselsa); + ASExternalLsa *aselsa = polymorphic_cast(lsar.get()); OspfTypes::Version version = _ospf.get_version(); Type7Lsa *type7= new Type7Lsa(version); @@ -1487,8 +1489,7 @@ Lsa::LsaRef AreaRouter::external_generate_external(Lsa::LsaRef lsar) { - Type7Lsa *type7 = dynamic_cast(lsar.get()); - XLOG_ASSERT(type7); + Type7Lsa *type7 = polymorphic_cast(lsar.get()); OspfTypes::Version version = _ospf.get_version(); ASExternalLsa *aselsa= new ASExternalLsa(version); @@ -1816,8 +1817,7 @@ return false; } - NetworkLsa *nlsa = dynamic_cast(_db[index].get()); - XLOG_ASSERT(nlsa); + NetworkLsa *nlsa = polymorphic_cast(_db[index].get()); // If routers is empty this is a refresh. if (!routers.empty()) { @@ -1900,8 +1900,7 @@ AreaRouter::refresh_network_lsa(OspfTypes::PeerID peerid, Lsa::LsaRef lsar, bool timer) { - NetworkLsa *nlsa = dynamic_cast(lsar.get()); - XLOG_ASSERT(nlsa); + NetworkLsa *nlsa = polymorphic_cast(lsar.get()); XLOG_ASSERT(nlsa->valid()); uint32_t network_mask = 0; @@ -2127,8 +2126,7 @@ } IntraAreaPrefixLsa *iaplsa = - dynamic_cast(_db[index].get()); - XLOG_ASSERT(iaplsa); + polymorphic_cast(_db[index].get()); // If attached_routers is empty this is a refresh. if (!attached_routers.empty()) { @@ -3504,8 +3502,7 @@ Lsa::LsaRef lsar = _db[index]; IntraAreaPrefixLsa *iaplsa = - dynamic_cast(lsar.get()); - XLOG_ASSERT(iaplsa); + polymorphic_cast(lsar.get()); list& nprefixes = iaplsa->get_prefixes(); nprefixes.insert(nprefixes.begin(), prefixes.begin(), prefixes.end()); @@ -3523,8 +3520,7 @@ // the newly computed one then update the old one and publish. Lsa::LsaRef lsar = _db[index]; IntraAreaPrefixLsa *iaplsa = - dynamic_cast(lsar.get()); - XLOG_ASSERT(iaplsa); + polymorphic_cast(lsar.get()); list& oprefixes = iaplsa->get_prefixes(); list::iterator j, k; @@ -4043,8 +4039,7 @@ route_entry.set_area_border_router(rlsa->get_b_bit()); route_entry.set_as_boundary_router(rlsa->get_e_bit()); } else { - nlsa = dynamic_cast(lsar.get()); - XLOG_ASSERT(nlsa); + nlsa = polymorphic_cast(lsar.get()); // route_entry.set_router_id(nlsa->get_header(). // get_advertising_router()); route_entry.set_address(nlsa->get_header().get_link_state_id()); @@ -4345,8 +4340,7 @@ // route_entry); } } else { - NetworkLsa *nlsa = dynamic_cast(lsar.get()); - XLOG_ASSERT(nlsa); + NetworkLsa *nlsa = polymorphic_cast(lsar.get()); const list& lsai = lsa_temp_store.get_intra_area_prefix_lsas(node.get_nodeid()); if (!lsai.empty()) { Modified: trunk/xorp/ospf/auth.cc =================================================================== --- trunk/xorp/ospf/auth.cc 2009-12-03 22:42:23 UTC (rev 11663) +++ trunk/xorp/ospf/auth.cc 2009-12-03 22:54:21 UTC (rev 11664) @@ -36,6 +36,8 @@ #include "libxorp/eventloop.hh" #include "libproto/packet.hh" +#include + #include "ospf.hh" #include "auth.hh" @@ -801,8 +803,8 @@ if (plaintext_ah == NULL) { set_method(PlaintextAuthHandler::auth_type_name()); } - plaintext_ah = dynamic_cast(_auth_handler); - XLOG_ASSERT(plaintext_ah != NULL); + plaintext_ah = + boost::polymorphic_cast(_auth_handler); plaintext_ah->set_key(password); error_msg = ""; Modified: trunk/xorp/ospf/external.cc =================================================================== --- trunk/xorp/ospf/external.cc 2009-12-03 22:42:23 UTC (rev 11663) +++ trunk/xorp/ospf/external.cc 2009-12-03 22:54:21 UTC (rev 11664) @@ -38,6 +38,8 @@ #include #include +#include + #include "libproto/spt.hh" #include "ospf.hh" @@ -47,6 +49,8 @@ #include "external.hh" #include "policy_varrw.hh" +using boost::polymorphic_cast; + template External::External(Ospf& ospf, map *>& areas) @@ -126,11 +130,9 @@ Lsa::LsaRef lsar_in_db = *i; XLOG_ASSERT(lsar_in_db->get_self_originating()); - ASExternalLsa *aselsa = dynamic_cast(lsar.get()); - XLOG_ASSERT(aselsa); + ASExternalLsa *aselsa = polymorphic_cast(lsar.get()); ASExternalLsa *aselsa_in_db = - dynamic_cast(lsar_in_db.get()); - XLOG_ASSERT(aselsa_in_db); + polymorphic_cast(lsar_in_db.get()); if (aselsa->get_network_mask() == aselsa_in_db->get_network_mask()) return; @@ -181,8 +183,7 @@ Lsa::LsaRef lsar_in_db = *i; XLOG_ASSERT(lsar_in_db->get_self_originating()); ASExternalLsa *aselsa_in_db = - dynamic_cast(lsar_in_db.get()); - XLOG_ASSERT(aselsa_in_db); + polymorphic_cast(lsar_in_db.get()); IPv4 mask_in_db = IPv4(htonl(aselsa_in_db->get_network_mask())); // If the mask/prefix lengths match then the LSA has been found. if (mask_in_db.mask_len() == net.prefix_len()) @@ -455,8 +456,7 @@ RouteEntry rte; list::iterator i; for (i = _suppress_temp.begin(); i != _suppress_temp.end(); i++) { - ASExternalLsa *aselsa = dynamic_cast((*i).get()); - XLOG_ASSERT(aselsa); + ASExternalLsa *aselsa = polymorphic_cast((*i).get()); Lsa::LsaRef olsar = aselsa->get_suppressed_lsa(); aselsa->release_suppressed_lsa(); if (!rt.lookup_entry_by_advertising_router(area, @@ -523,8 +523,7 @@ { XLOG_ASSERT(olsar->get_self_originating()); - ASExternalLsa *olsa = dynamic_cast(olsar.get()); - XLOG_ASSERT(olsa); + ASExternalLsa *olsa = polymorphic_cast(olsar.get()); OspfTypes::Version version = _ospf.version(); ASExternalLsa *nlsa = new ASExternalLsa(version); @@ -641,8 +640,7 @@ void External::suppress_self(Lsa::LsaRef lsar) { - ASExternalLsa *aselsa = dynamic_cast(lsar.get()); - XLOG_ASSERT(aselsa); + ASExternalLsa *aselsa = polymorphic_cast(lsar.get()); // This may be a refresh of previously announce AS-external-LSA. bool suppressed = false; @@ -689,8 +687,7 @@ XLOG_ASSERT(lsar->external()); XLOG_ASSERT(!lsar->get_self_originating()); - ASExternalLsa *aselsa = dynamic_cast(lsar.get()); - XLOG_ASSERT(aselsa); + ASExternalLsa *aselsa = polymorphic_cast(lsar.get()); OspfTypes::Version version = _ospf.version(); @@ -713,8 +710,7 @@ if (0 == olsar.get()) return false; - ASExternalLsa *olsa = dynamic_cast(olsar.get()); - XLOG_ASSERT(olsa); + ASExternalLsa *olsa = polymorphic_cast(olsar.get()); switch(version) { case OspfTypes::V2: Modified: trunk/xorp/ospf/peer.cc =================================================================== --- trunk/xorp/ospf/peer.cc 2009-12-03 22:42:23 UTC (rev 11663) +++ trunk/xorp/ospf/peer.cc 2009-12-03 22:54:21 UTC (rev 11664) @@ -1221,6 +1221,7 @@ LinkStateUpdatePacket *lsup; LinkStateAcknowledgementPacket *lsap; + // XXX: Candidate for a packet_type() template function. if (0 != (hello = dynamic_cast(packet))) { return process_hello_packet(dst, src, hello); } else if(0 != (dd = dynamic_cast(packet))) { Modified: trunk/xorp/pim/xrl_pim_node.cc =================================================================== --- trunk/xorp/pim/xrl_pim_node.cc 2009-12-03 22:42:23 UTC (rev 11663) +++ trunk/xorp/pim/xrl_pim_node.cc 2009-12-03 22:54:21 UTC (rev 11664) @@ -34,6 +34,10 @@ #include "pim_vif.hh" #include "xrl_pim_node.hh" +#include + +using boost::polymorphic_cast; + const TimeVal XrlPimNode::RETRY_TIMEVAL = TimeVal(1, 0); // @@ -411,8 +415,7 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); RegisterUnregisterInterest* entry; - entry = dynamic_cast(xrl_task_base); - XLOG_ASSERT(entry != NULL); + entry = polymorphic_cast(xrl_task_base); if (entry->is_register()) { // Register interest @@ -446,8 +449,7 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); RegisterUnregisterInterest* entry; - entry = dynamic_cast(xrl_task_base); - XLOG_ASSERT(entry != NULL); + entry = polymorphic_cast(xrl_task_base); switch (xrl_error.error_code()) { case OKAY: @@ -1028,8 +1030,7 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); RegisterUnregisterReceiver* entry; - entry = dynamic_cast(xrl_task_base); - XLOG_ASSERT(entry != NULL); + entry = polymorphic_cast(xrl_task_base); // // Check whether we have already registered with the FEA @@ -1117,8 +1118,7 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); RegisterUnregisterReceiver* entry; - entry = dynamic_cast(xrl_task_base); - XLOG_ASSERT(entry != NULL); + entry = polymorphic_cast(xrl_task_base); switch (xrl_error.error_code()) { case OKAY: @@ -1222,8 +1222,7 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); RegisterUnregisterProtocol* entry; - entry = dynamic_cast(xrl_task_base); - XLOG_ASSERT(entry != NULL); + entry = polymorphic_cast(xrl_task_base); // // Check whether we have already registered with the MFEA @@ -1307,8 +1306,7 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); RegisterUnregisterProtocol* entry; - entry = dynamic_cast(xrl_task_base); - XLOG_ASSERT(entry != NULL); + entry = polymorphic_cast(xrl_task_base); switch (xrl_error.error_code()) { case OKAY: @@ -1412,8 +1410,7 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); JoinLeaveMulticastGroup* entry; - entry = dynamic_cast(xrl_task_base); - XLOG_ASSERT(entry != NULL); + entry = polymorphic_cast(xrl_task_base); // // Check whether we have already registered with the FEA @@ -1502,8 +1499,7 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); JoinLeaveMulticastGroup* entry; - entry = dynamic_cast(xrl_task_base); - XLOG_ASSERT(entry != NULL); + entry = polymorphic_cast(xrl_task_base); switch (xrl_error.error_code()) { case OKAY: @@ -1603,8 +1599,7 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); AddDeleteMfc* entry; - entry = dynamic_cast(xrl_task_base); - XLOG_ASSERT(entry != NULL); + entry = polymorphic_cast(xrl_task_base); size_t max_vifs_oiflist = entry->olist().size(); const IPvX& source_addr = entry->source_addr(); @@ -1705,8 +1700,7 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); AddDeleteMfc* entry; - entry = dynamic_cast(xrl_task_base); - XLOG_ASSERT(entry != NULL); + entry = polymorphic_cast(xrl_task_base); switch (xrl_error.error_code()) { case OKAY: @@ -1843,8 +1837,7 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); AddDeleteDataflowMonitor* entry; - entry = dynamic_cast(xrl_task_base); - XLOG_ASSERT(entry != NULL); + entry = polymorphic_cast(xrl_task_base); // // Check whether we have already registered with the MFEA @@ -1981,8 +1974,7 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); AddDeleteDataflowMonitor* entry; - entry = dynamic_cast(xrl_task_base); - XLOG_ASSERT(entry != NULL); + entry = polymorphic_cast(xrl_task_base); switch (xrl_error.error_code()) { case OKAY: @@ -2350,8 +2342,7 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); SendProtocolMessage* entry; - entry = dynamic_cast(xrl_task_base); - XLOG_ASSERT(entry != NULL); + entry = polymorphic_cast(xrl_task_base); // // Check whether we have already registered with the FEA @@ -2432,8 +2423,7 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); SendProtocolMessage* entry; - entry = dynamic_cast(xrl_task_base); - XLOG_ASSERT(entry != NULL); + entry = polymorphic_cast(xrl_task_base); switch (xrl_error.error_code()) { case OKAY: Modified: trunk/xorp/rib/rib.cc =================================================================== --- trunk/xorp/rib/rib.cc 2009-12-03 22:42:23 UTC (rev 11663) +++ trunk/xorp/rib/rib.cc 2009-12-03 22:54:21 UTC (rev 11664) @@ -31,7 +31,9 @@ #include "rib_manager.hh" #include "rib.hh" +#include + // ---------------------------------------------------------------------------- // Inline table utility methods @@ -45,6 +47,7 @@ const string& _n; }; +// XXX: Unused template function. template struct table_has_name_and_type { table_has_name_and_type(const string& name) : _n(name) {} @@ -134,6 +137,7 @@ { map::iterator mi = _admin_distances.find(protocol_name); if (mi != _admin_distances.end()) { + // XXX: Candidate for a table_has_type() template function. OriginTable* ot = dynamic_cast* >(find_table(protocol_name)); if (NULL != ot) { @@ -772,6 +776,7 @@ } } + // XXX: Candidate for a table_has_type() template function. OriginTable* ot = dynamic_cast* >(rt); if (ot == NULL) { if (_errors_are_fatal) { @@ -885,6 +890,7 @@ if (NULL == rt) return XORP_ERROR; // Table does not exist + // XXX: Candidate for a table_has_type() template function. OriginTable* ot = dynamic_cast* >(rt); if (NULL == ot) return XORP_ERROR; // Table is not an origin table @@ -909,6 +915,7 @@ if (NULL == rt) return XORP_ERROR; // Table does not exist + // XXX: Candidate for a table_has_type() template function. OriginTable* ot = dynamic_cast* >(rt); if (NULL == ot) return XORP_ERROR; // Table is not an origin table @@ -1053,7 +1060,8 @@ return A::ZERO(); #else // Default: Assume the route points to a resolved IPNextHop. - IPNextHop* route_nexthop = static_cast* >(re->nexthop()); + IPNextHop* route_nexthop = + boost::polymorphic_downcast* >(re->nexthop()); return route_nexthop->addr(); #endif } @@ -1085,6 +1093,8 @@ RedistTable* RIB::protocol_redist_table(const string& protocol) { + // XXX: Candidate for a polymorphic_cast, but our callers check + // for the 0 return value. RouteTable* rt = find_table(redist_tablename(protocol)); if (rt != NULL) { return dynamic_cast*>(rt); @@ -1232,6 +1242,7 @@ // Check if table exists and check type if so RouteTable* rt = find_table(tablename); if (rt != NULL) { + // XXX: Candidate for a table_has_type() template function. OriginTable* ot = dynamic_cast* >(rt); if (ot == NULL) { XLOG_ERROR("add_origin_table: table \"%s\" already exists, but is " @@ -1264,7 +1275,10 @@ return XORP_ERROR; } - OriginTable* new_table = static_cast* >(find_table(tablename)); + // XXX: Unchecked upcast from RouteTable to OriginTable. + OriginTable* new_table = + boost::polymorphic_downcast* >(find_table(tablename)); + // XXX: the table was created by new_origin_table() above, so it must exist XLOG_ASSERT(new_table != NULL); if (_final_table == new_table) { @@ -1305,6 +1319,7 @@ continue; } + // XXX: Candidate for a table_has_type() template function. OriginTable* ot = dynamic_cast* >(current); if (ot != NULL) { if (ot->protocol_type() == IGP) { @@ -1459,6 +1474,7 @@ const string& target_class, const string& target_instance) { + // XXX: Candidate for a table_has_type() template function. OriginTable* ot = dynamic_cast* >(find_table(tablename)); if (NULL == ot) return XORP_ERROR; @@ -1596,8 +1612,8 @@ RouteTable* rt = find_table(PolicyConnectedTable::table_name); XLOG_ASSERT(rt != NULL); - PolicyConnectedTable* pct = dynamic_cast*>(rt); - XLOG_ASSERT(pct != NULL); + PolicyConnectedTable* pct = + boost::polymorphic_cast*>(rt); pct->push_routes(); } Modified: trunk/xorp/rip/rip_varrw.cc =================================================================== --- trunk/xorp/rip/rip_varrw.cc 2009-12-03 22:42:23 UTC (rev 11663) +++ trunk/xorp/rip/rip_varrw.cc 2009-12-03 22:54:21 UTC (rev 11664) @@ -26,6 +26,8 @@ #include "policy/common/policy_utils.hh" #include "rip_varrw.hh" +#include + template RIPVarRW::RIPVarRW(RouteEntry& route) : _route(route) @@ -44,6 +46,7 @@ // XXX which tag wins? Element* element = _route.policytags().element_tag(); + ElemU32* e = dynamic_cast(element); if (e != NULL && e->val()) _route.set_tag(e->val()); @@ -74,21 +77,17 @@ if (write_nexthop(id, e)) return; - const ElemU32* u32 = NULL; + const ElemU32* u32 = 0; if (e.type() == ElemU32::id) { - u32 = dynamic_cast(&e); - XLOG_ASSERT(u32 != NULL); + u32 = boost::polymorphic_cast(&e); } if (id == VAR_METRIC) { - XLOG_ASSERT(u32 != NULL); - _route.set_cost(u32->val()); return; } - if (id == VAR_TAG) { - XLOG_ASSERT(u32 != NULL); + if (id == VAR_TAG) { _route.set_tag(u32->val()); _route.policytags().set_tag(e); return; @@ -102,10 +101,9 @@ RIPVarRW::write_nexthop(const Id& id, const Element& e) { if (id == VAR_NEXTHOP4 && e.type() == ElemIPv4NextHop::id) { - const ElemIPv4NextHop* v4 = dynamic_cast(&e); + const ElemIPv4NextHop* v4 = + boost::polymorphic_cast(&e); - XLOG_ASSERT(v4 != NULL); - IPv4 nh(v4->val()); _route.set_nexthop(nh); @@ -134,10 +132,9 @@ RIPVarRW::write_nexthop(const Id& id, const Element& e) { if (id == VAR_NEXTHOP6 && e.type() == ElemIPv6NextHop::id) { - const ElemIPv6NextHop* v6 = dynamic_cast(&e); + const ElemIPv6NextHop* v6 = + boost::polymorphic_cast(&e); - XLOG_ASSERT(v6 != NULL); - IPv6 nh(v6->val()); _route.set_nexthop(nh); Modified: trunk/xorp/rip/xrl_port_manager.cc =================================================================== --- trunk/xorp/rip/xrl_port_manager.cc 2009-12-03 22:42:23 UTC (rev 11663) +++ trunk/xorp/rip/xrl_port_manager.cc 2009-12-03 22:54:21 UTC (rev 11664) @@ -548,6 +548,7 @@ return; } Port* p = (*pi); + // XXX: Downcast result used as a loop control variable. xio = dynamic_cast*>(p->io_handler()); pi++; } Modified: trunk/xorp/rtrmgr/master_conf_tree.cc =================================================================== --- trunk/xorp/rtrmgr/master_conf_tree.cc 2009-12-03 22:42:23 UTC (rev 11663) +++ trunk/xorp/rtrmgr/master_conf_tree.cc 2009-12-03 22:54:21 UTC (rev 11664) @@ -275,6 +275,8 @@ uid_t user_id, bool verbose) { MasterConfigTreeNode *ctn, *parent; + + // BOOST: Conditional downcast means polymorphic casts can't be used. parent = dynamic_cast(parent_node); if (parent_node != NULL) XLOG_ASSERT(parent != NULL); Modified: trunk/xorp/rtrmgr/master_conf_tree_node.cc =================================================================== --- trunk/xorp/rtrmgr/master_conf_tree_node.cc 2009-12-03 22:42:23 UTC (rev 11663) +++ trunk/xorp/rtrmgr/master_conf_tree_node.cc 2009-12-03 22:54:21 UTC (rev 11664) @@ -26,6 +26,8 @@ #include "libxorp/xlog.h" #include "libxorp/debug.h" +#include + #include "command_tree.hh" #include "master_conf_tree_node.hh" #include "module_command.hh" @@ -79,9 +81,10 @@ { UNUSED(clientid); MasterConfigTreeNode *new_node, *parent; - parent = dynamic_cast(parent_node); // sanity check - all nodes in this tree should be Master nodes + // BOOST: Conditional downcast means polymorphic casts can't be used. + parent = dynamic_cast(parent_node); if (parent_node != NULL) XLOG_ASSERT(parent != NULL); @@ -96,8 +99,7 @@ const MasterConfigTreeNode *orig; // sanity check - all nodes in this tree should be Master nodes - orig = dynamic_cast(&ctn); - XLOG_ASSERT(orig != NULL); + orig = boost::polymorphic_cast(&ctn); new_node = new MasterConfigTreeNode(*orig); return new_node; @@ -449,8 +451,8 @@ const AllowCommand* allow_cmd; debug_msg("found ALLOW command: %s\n", cmd->str().c_str()); - allow_cmd = dynamic_cast(base_cmd); - XLOG_ASSERT(allow_cmd != NULL); + allow_cmd = + boost::polymorphic_cast(base_cmd); if (allow_cmd->verify_variables(*this, error_msg) != true) { // @@ -488,8 +490,8 @@ const AllowCommand* allow_cmd; debug_msg("found ALLOW command: %s\n", cmd->str().c_str()); - allow_cmd = dynamic_cast(base_cmd); - XLOG_ASSERT(allow_cmd != NULL); + allow_cmd = + boost::polymorphic_cast(base_cmd); if (allow_cmd->verify_variables(*this, error_msg) != true) { error_msg = c_format("Bad operator for \"%s\": %s; ", Modified: trunk/xorp/rtrmgr/master_template_tree_node.cc =================================================================== --- trunk/xorp/rtrmgr/master_template_tree_node.cc 2009-12-03 22:42:23 UTC (rev 11663) +++ trunk/xorp/rtrmgr/master_template_tree_node.cc 2009-12-03 22:54:21 UTC (rev 11664) @@ -37,7 +37,10 @@ #include "master_template_tree_node.hh" #include "util.hh" +#include +using boost::polymorphic_cast; + void MasterTemplateTreeNode::add_cmd(const string& cmd, TemplateTree& tt) throw (ParseError) @@ -83,8 +86,8 @@ iter = _cmd_map.find("%modinfo"); XLOG_ASSERT(iter != _cmd_map.end()); command = iter->second; - ModuleCommand* module_command = dynamic_cast(command); - XLOG_ASSERT(module_command != NULL); + ModuleCommand* module_command = + polymorphic_cast(command); module_command->add_action(action_list, xrldb); } else if ((cmd == "%create") || (cmd == "%activate") @@ -116,8 +119,8 @@ cmd_iter = _cmd_map.find("%modinfo"); if (cmd_iter != _cmd_map.end()) { BaseCommand* command = cmd_iter->second; - ModuleCommand* module_command = dynamic_cast(command); - XLOG_ASSERT(module_command != NULL); + ModuleCommand* module_command = + polymorphic_cast(command); if (module_command->expand_actions(error_msg) != true) return (false); } @@ -140,7 +143,7 @@ list::iterator iter2; for (iter2 = _children.begin(); iter2 != _children.end(); ++iter2) { MasterTemplateTreeNode* mttn; - mttn = static_cast(*iter2); + mttn = polymorphic_cast(*iter2); if (mttn->expand_master_template_tree(error_msg) != true) return false; } @@ -160,8 +163,7 @@ if (cmd_iter != _cmd_map.end()) { const BaseCommand* command = cmd_iter->second; const ModuleCommand* module_command; - module_command = dynamic_cast(command); - XLOG_ASSERT(module_command != NULL); + module_command = polymorphic_cast(command); if (module_command->check_referred_variables(error_msg) != true) return (false); } @@ -172,7 +174,7 @@ list::const_iterator iter2; for (iter2 = _children.begin(); iter2 != _children.end(); ++iter2) { const MasterTemplateTreeNode* mttn; - mttn = static_cast(*iter2); + mttn = polymorphic_cast(*iter2); if (mttn->check_master_template_tree(error_msg) != true) return false; } Modified: trunk/xorp/rtrmgr/module_manager.cc =================================================================== --- trunk/xorp/rtrmgr/module_manager.cc 2009-12-03 22:42:23 UTC (rev 11663) +++ trunk/xorp/rtrmgr/module_manager.cc 2009-12-03 22:54:21 UTC (rev 11664) @@ -18,7 +18,10 @@ // http://xorp.net +#include +using boost::polymorphic_cast; + #include "rtrmgr_module.h" #include "libxorp/xorp.h" @@ -439,8 +442,7 @@ { Module* module; - module = dynamic_cast(find_module(module_name)); - XLOG_ASSERT(module != NULL); + module = polymorphic_cast(find_module(module_name)); return (module->execute(do_exec, is_verification, cb)); } @@ -451,8 +453,7 @@ { Module* module; - module = dynamic_cast(find_module(module_name)); - XLOG_ASSERT(module != NULL); + module = polymorphic_cast(find_module(module_name)); module->terminate(cb); return XORP_OK; @@ -487,8 +488,7 @@ map::iterator iter; for (iter = _modules.begin(); iter != _modules.end(); ++iter) { - Module *module = dynamic_cast(iter->second); - XLOG_ASSERT(module != NULL); + Module *module = polymorphic_cast(iter->second); module->terminate(callback(this, &ModuleManager::module_shutdown_cb, module->name())); } @@ -546,8 +546,7 @@ map::const_iterator iter; for (iter = _modules.begin(); iter != _modules.end(); ++iter) { - Module* module = dynamic_cast(iter->second); - XLOG_ASSERT(module != NULL); + Module* module = polymorphic_cast(iter->second); if (module->expath() != expath) continue; switch (module->status()) { Modified: trunk/xorp/rtrmgr/slave_conf_tree_node.cc =================================================================== --- trunk/xorp/rtrmgr/slave_conf_tree_node.cc 2009-12-03 22:42:23 UTC (rev 11663) +++ trunk/xorp/rtrmgr/slave_conf_tree_node.cc 2009-12-03 22:54:21 UTC (rev 11664) @@ -33,7 +33,10 @@ #include "template_tree_node.hh" #include "util.hh" +#include +using boost::polymorphic_cast; + extern int booterror(const char *s); SlaveConfigTreeNode::SlaveConfigTreeNode(bool verbose) @@ -65,9 +68,11 @@ bool verbose) { SlaveConfigTreeNode *new_node, *parent; - parent = dynamic_cast(parent_node); // sanity check - all nodes in this tree should be Slave nodes + // BOOST: This is a conditional downcast, so polymorphic casts + // can't be applied. + parent = dynamic_cast(parent_node); if (parent_node != NULL) XLOG_ASSERT(parent != NULL); @@ -85,8 +90,7 @@ debug_msg("SlaveConfigTreeNode::create_node\n"); // sanity check - all nodes in this tree should be Slave nodes - orig = dynamic_cast(&ctn); - XLOG_ASSERT(orig != NULL); + orig = polymorphic_cast(&ctn); new_node = new SlaveConfigTreeNode(*orig); return new_node; @@ -296,9 +300,8 @@ iter != master_node.const_children().end(); ++iter) { SlaveConfigTreeNode* new_node; - const SlaveConfigTreeNode* my_child - = dynamic_cast(*iter); - XLOG_ASSERT(my_child != NULL); + const SlaveConfigTreeNode* my_child = + polymorphic_cast(*iter); new_node = new SlaveConfigTreeNode(*my_child); new_node->set_parent(this); @@ -330,9 +333,9 @@ iter != master_node.const_children().end(); ++iter) { SlaveConfigTreeNode* new_node; - const SlaveConfigTreeNode* my_child - = dynamic_cast(*iter); - XLOG_ASSERT(my_child != NULL); + const SlaveConfigTreeNode* my_child = + polymorphic_cast(*iter); + new_node = new SlaveConfigTreeNode(*my_child); new_node->set_parent(this); new_node->undelete(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 15:10:07 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 23:10:07 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11665] trunk/xorp Message-ID: Revision: 11665 http://xorp.svn.sourceforge.net/xorp/?rev=11665&view=rev Author: bms_fbsd Date: 2009-12-03 23:10:07 +0000 (Thu, 03 Dec 2009) Log Message: ----------- Add option 'transport' to control which protocol libxipc will chose for inter-process communication by default. The default, 'transport=local', causes UNIX domain stream sockets to be used. Users who need to be able to distribute XORP components across multiple IP addresses should choose 'transport=tcp' when compiling, or else set XORP_PF=t in the environment when running XORP components. Implementation note: The XRL_PF preprocessor macro is passed as an ordinal character constant, to avoid shell quoting issues, as it is specified by 1 character. It needs to be passed from the top level to make sure the option is propagated correctly, because anything which includes will be affected by this option. Discussed on: xorp-hackers@ Modified Paths: -------------- trunk/xorp/SConstruct trunk/xorp/libxipc/xrl_std_router.cc trunk/xorp/libxipc/xrl_std_router.hh Modified: trunk/xorp/SConstruct =================================================================== --- trunk/xorp/SConstruct 2009-12-03 22:54:21 UTC (rev 11664) +++ trunk/xorp/SConstruct 2009-12-03 23:10:07 UTC (rev 11665) @@ -74,6 +74,9 @@ EnumVariable('profile', 'Build with profiling', 'no', allowed_values=('no', 'gprof', 'pprof', 'override'), map={}, ignorecase=2), + EnumVariable('transport', 'Set default XRL transport protocol', 'local', + allowed_values=('tcp', 'local'), + map={}, ignorecase=2), PathVariable('prefix', 'Install prefix', '/usr/local/xorp', PathVariable.PathAccept), ) @@ -170,6 +173,9 @@ # Default to disable; wrapper for compiler profiling support. print 'Profile code: ', env['profile'] +# Default to local (UNIX domain sockets). +print 'Default XRL transport:', env['transport'] + # Most of our shared library tweaks are specific to GNU ld. # Check if the GNU linker is available, and print a warning if not. if env['shared']: @@ -495,7 +501,25 @@ env.AppendUnique( LIBS = [ 'profiler' ] ) #env.AppendUnique( CPPDEFINES = [ 'WITH_PPROF' ] ) +# +# Apply top-level 'transport' protocol option, which controls the +# default transport protocol chosen by libxipc. +# +# We pass it as an ordinal character constant to avoid shell +# quoting issues, as it is specified by 1 character. +# +# Note: We need to do this at top level to make sure the option +# is propagated correctly, because anything which includes +# will be affected by this option. +# +xrl_pf_dict = { 'tcp': 't', 'local': 'x' } env.AppendUnique(CPPDEFINES = [ + ( 'XRL_PF', ord(xrl_pf_dict[env['transport']]) ), + ]) + +# Forcibly disable GCC's SSP support., as it may be incompatible +# with the XORP code base. +env.AppendUnique(CPPDEFINES = [ ( '_FORTIFY_SOURCE', 0 ), ]) Modified: trunk/xorp/libxipc/xrl_std_router.cc =================================================================== --- trunk/xorp/libxipc/xrl_std_router.cc 2009-12-03 22:54:21 UTC (rev 11664) +++ trunk/xorp/libxipc/xrl_std_router.cc 2009-12-03 23:10:07 UTC (rev 11665) @@ -23,42 +23,55 @@ #include "xrl_module.h" #include "xrl_std_router.hh" -//#include "xrl_pf_inproc.hh" +//#include "xrl_pf_inproc.hh" // Inproc is deprecated. #include "xrl_pf_stcp.hh" -//#include "xrl_pf_sudp.hh" +//#include "xrl_pf_sudp.hh" // UDP is deprecated. #include "xrl_pf_unix.hh" #include "libxorp/xlog.h" + // ---------------------------------------------------------------------------- // Helper methods +#if !defined(XRL_PF) +#error "A default transport for XRL must be defined using the preprocessor." +#endif + +static const char default_pf[] = { XRL_PF, '\0' }; + XrlPFListener* XrlStdRouter::create_listener() { const char* pf = getenv("XORP_PF"); + if (pf == NULL) + pf = default_pf; - if (pf != NULL) { - switch (pf[0]) { -#if 0 + switch (pf[0]) { +#if 0 // Inproc is deprecated. case 'i': return new XrlPFInProcListener(_e, this); - +#endif + // For the benefit of bench_ipc.sh. + case 't': + return new XrlPFSTCPListener(_e, this); + break; +#if 0 // UDP is deprecated. case 'u': return new XrlPFSUDPListener(_e, this); #endif - case 'x': +#if XRL_PF != 'x' XLOG_ASSERT(_unix == NULL); +#endif return new XrlPFUNIXListener(_e, this); - default: XLOG_ERROR("Unknown PF %s\n", pf); XLOG_ASSERT(false); break; - } } - return new XrlPFSTCPListener(_e, this); + XLOG_UNREACHABLE(); + return 0; } static void @@ -125,6 +138,14 @@ { _unix = _l = NULL; + // We need to check the environment otherwise + // we get the compiled-in default. + const char* pf = getenv("XORP_PF"); + if (pf == NULL) + pf = default_pf; + if (pf[0] != 'x') + unix_socket = false; + if (unix_socket) create_unix_listener(); Modified: trunk/xorp/libxipc/xrl_std_router.hh =================================================================== --- trunk/xorp/libxipc/xrl_std_router.hh 2009-12-03 22:54:21 UTC (rev 11664) +++ trunk/xorp/libxipc/xrl_std_router.hh 2009-12-03 23:10:07 UTC (rev 11665) @@ -27,7 +27,11 @@ #include "xrl_router.hh" #include "xrl_pf.hh" +#if !defined(XRL_PF) || (XRL_PF == 'x') +#define UNIX_SOCKET_DEFAULT true +#else #define UNIX_SOCKET_DEFAULT false +#endif /** * @short Standard XRL transmission and reception point. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 15:20:53 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 23:20:53 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11666] trunk/xorp Message-ID: Revision: 11666 http://xorp.svn.sourceforge.net/xorp/?rev=11666&view=rev Author: bms_fbsd Date: 2009-12-03 23:20:53 +0000 (Thu, 03 Dec 2009) Log Message: ----------- De-orbit burn KILL, UDP and INPROC transports from XRL. They are unreliable IPC transports, not used anywhere, and aren't needed by any of the production code. Modified Paths: -------------- trunk/xorp/libxipc/SConscript trunk/xorp/libxipc/tests/SConscript trunk/xorp/libxipc/tests/bench_ipc.sh trunk/xorp/libxipc/tests/bench_ipc_gnuplot.sh trunk/xorp/libxipc/xrl_pf_factory.cc trunk/xorp/libxipc/xrl_std_router.cc trunk/xorp/rtrmgr/unexpanded_xrl.hh Removed Paths: ------------- trunk/xorp/libxipc/header.cc trunk/xorp/libxipc/header.hh trunk/xorp/libxipc/tests/test_header.cc trunk/xorp/libxipc/tests/test_inproc.cc trunk/xorp/libxipc/tests/test_sudp.cc trunk/xorp/libxipc/xrl_pf_inproc.cc trunk/xorp/libxipc/xrl_pf_inproc.hh trunk/xorp/libxipc/xrl_pf_kill.cc trunk/xorp/libxipc/xrl_pf_kill.hh trunk/xorp/libxipc/xrl_pf_sudp.cc trunk/xorp/libxipc/xrl_pf_sudp.hh Modified: trunk/xorp/libxipc/SConscript =================================================================== --- trunk/xorp/libxipc/SConscript 2009-12-03 23:10:07 UTC (rev 11665) +++ trunk/xorp/libxipc/SConscript 2009-12-03 23:20:53 UTC (rev 11666) @@ -60,7 +60,6 @@ 'finder_msgs.cc', 'finder_tcp.cc', 'finder_tcp_messenger.cc', - #'header.cc', # only for udp 'hmac.cc', 'hmac_md5.c', 'permits.cc', @@ -77,11 +76,8 @@ 'xrl_parser_input.cc', 'xrl_pf.cc', 'xrl_pf_factory.cc', - #'xrl_pf_inproc.cc', # not used in production build - #'xrl_pf_kill.cc', # not used in production build 'xrl_pf_stcp.cc', 'xrl_pf_stcp_ph.cc', - #'xrl_pf_sudp.cc', # not used in production build 'xrl_pf_unix.cc', 'xrl_router.cc', 'xrl_std_router.cc', Deleted: trunk/xorp/libxipc/header.cc =================================================================== --- trunk/xorp/libxipc/header.cc 2009-12-03 23:10:07 UTC (rev 11665) +++ trunk/xorp/libxipc/header.cc 2009-12-03 23:20:53 UTC (rev 11666) @@ -1,197 +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 Lesser General Public License, Version -// 2.1, June 1999 as published by the Free Software Foundation. -// Redistribution and/or modification of this program under the terms of -// any other version of the GNU Lesser 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 Lesser General Public License, Version 2.1, a copy of -// which can be found in the XORP LICENSE.lgpl file. -// -// XORP, Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA; -// http://xorp.net - - - -#include "libxorp/xorp.h" -#include -#ifdef HAVE_STDLIB_H -#include -#endif -#include - -#include "xrl_module.h" -//#include "libxorp/debug.h" -#include "header.hh" - -static const string HEADER_SEP(":\t"); -static const string HEADER_EOL("\r\n"); - -bool -HeaderWriter::name_valid(const string &name) -{ - return (name.find(HEADER_SEP) == string::npos); -} - -HeaderWriter& -HeaderWriter::add(const string& name, - const string& value) throw (InvalidName) { - if (name_valid(name) == false) throw InvalidName(); - - _list.push_back(Node(name, value)); - - return *this; -} - -HeaderWriter& -HeaderWriter::add(const string& name, int32_t value) throw (InvalidName) -{ - if (name_valid(name) == false) throw InvalidName(); - - char buffer[32]; - snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "%d", - XORP_UINT_CAST(value)); - _list.push_back(Node(name, buffer)); - - return *this; -} - -HeaderWriter& -HeaderWriter::add(const string& name, uint32_t value) throw (InvalidName) -{ - if (name_valid(name) == false) throw InvalidName(); - - char buffer[32]; - snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "%u", - XORP_UINT_CAST(value)); - _list.push_back(Node(name, buffer)); - - return *this; -} - -HeaderWriter& -HeaderWriter::add(const string& name, - const double& value) throw (InvalidName) { - if (name_valid(name) == false) throw InvalidName(); - - char buffer[32]; - snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "%f", value); - _list.push_back(Node(name, buffer)); - - return *this; -} - -string -HeaderWriter::str() const -{ - list::const_iterator ci; - - string r; - for (ci = _list.begin(); ci != _list.end(); ci++) { - r += ci->key + HEADER_SEP + ci->value + HEADER_EOL; - } - r += HEADER_EOL; - return r; -} - -#if 0 -static string::size_type -skip(const string& buf, const string& skip, string::size_type pos) -{ - if (buf.size() - pos < skip.size()) - return string::npos; - - string::size_t i = 0; - while (i != skip.size()) { - if (buf[pos + i] != skip[i]) - return string::npos; - i++; - } - return i; -} -#endif /* 0 */ - -HeaderReader::HeaderReader(const string& serialized) throw (InvalidString) - : _bytes_consumed(0) -{ - if (serialized.find(HEADER_EOL + HEADER_EOL) == string::npos) - throw InvalidString(); - - string::size_type start = 0; - while (start < serialized.size()) { - - // Extract key - string::size_type sep = serialized.find(HEADER_SEP, start); - if (sep == string::npos) break; - - string key(serialized, start, sep - start); - - // Skip key:value separator - start = sep + HEADER_SEP.size(); - - // Find to end of value - sep = serialized.find(HEADER_EOL, start); - if (sep == string::npos) break; - - string value(serialized, start, sep - start); - - // Skip over end of line - start = sep + HEADER_EOL.size(); - - // Insert into map - _map[key] = value; - - if (string(serialized, start, HEADER_EOL.size()) == HEADER_EOL) { - _bytes_consumed = start + HEADER_EOL.size(); - return; - } // else start == start of new entry, we go around again - } - - throw InvalidString(); -} - -HeaderReader& -HeaderReader::get(const string& name, string& value) throw (NotFound) -{ - CMI m = _map.find(name); - if (m == _map.end()) - throw NotFound(); - value = m->second; - return *this; -} - -HeaderReader& -HeaderReader::get(const string& name, int32_t& value) throw (NotFound) -{ - string tmp; - get(name, tmp); - value = strtol(tmp.c_str(), 0, 10); - return *this; -} - -HeaderReader& -HeaderReader::get(const string& name, uint32_t& value) throw (NotFound) -{ - string tmp; - get(name, tmp); - value = strtoul(tmp.c_str(), 0, 10); - return *this; -} - -HeaderReader& -HeaderReader::get(const string& name, double& value) throw (NotFound) -{ - string tmp; - get(name, tmp); - value = strtod(tmp.c_str(), 0); - return *this; -} - Deleted: trunk/xorp/libxipc/header.hh =================================================================== --- trunk/xorp/libxipc/header.hh 2009-12-03 23:10:07 UTC (rev 11665) +++ trunk/xorp/libxipc/header.hh 2009-12-03 23:20:53 UTC (rev 11666) @@ -1,72 +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 Lesser General Public License, Version -// 2.1, June 1999 as published by the Free Software Foundation. -// Redistribution and/or modification of this program under the terms of -// any other version of the GNU Lesser 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 Lesser General Public License, Version 2.1, a copy of -// which can be found in the XORP LICENSE.lgpl file. -// -// XORP, Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA; -// http://xorp.net - -// $XORP: xorp/libxipc/header.hh,v 1.16 2008/10/02 21:57:21 bms Exp $ - -#ifndef __LIBXIPC_HEADER_HH__ -#define __LIBXIPC_HEADER_HH__ - -#include "libxorp/xorp.h" - -#include -#include - - -class HeaderWriter { -public: - class InvalidName {}; - HeaderWriter& add(const string& name, const string& value) - throw (InvalidName); - HeaderWriter& add(const string& name, int32_t value) - throw (InvalidName); - HeaderWriter& add(const string& name, uint32_t value) - throw (InvalidName); - HeaderWriter& add(const string& name, const double& value) - throw (InvalidName); - string str() const; -private: - static bool name_valid(const string &s); - struct Node { - string key; - string value; - Node(const string& k, const string& v) : key(k), value(v) {} - }; - list _list; -}; - -class HeaderReader { -public: - class InvalidString {}; - HeaderReader(const string& serialized) throw (InvalidString); - - class NotFound {}; - HeaderReader& get(const string& name, string& val) throw (NotFound); - HeaderReader& get(const string& name, int32_t& val) throw (NotFound); - HeaderReader& get(const string& name, uint32_t& val) throw (NotFound); - HeaderReader& get(const string& name, double& val) throw (NotFound); - size_t bytes_consumed() const { return _bytes_consumed; } -private: - size_t _bytes_consumed; - map _map; - typedef map::iterator CMI; -}; - -#endif // __LIBXIPC_HEADER_HH__ Modified: trunk/xorp/libxipc/tests/SConscript =================================================================== --- trunk/xorp/libxipc/tests/SConscript 2009-12-03 23:10:07 UTC (rev 11665) +++ trunk/xorp/libxipc/tests/SConscript 2009-12-03 23:20:53 UTC (rev 11666) @@ -55,13 +55,10 @@ #'finder_msgs', #'finder_tcp', #'finder_to', - #'header', # no longer used in shipping libxipc - #'inproc', # no longer used in shipping libxipc 'lemming', #'receiver', # compound 'stcp', 'stcppf', - #'sudp', # no longer used in shipping libxipc 'xrl', 'xrl_args', 'xrl_atom', Modified: trunk/xorp/libxipc/tests/bench_ipc.sh =================================================================== --- trunk/xorp/libxipc/tests/bench_ipc.sh 2009-12-03 23:10:07 UTC (rev 11665) +++ trunk/xorp/libxipc/tests/bench_ipc.sh 2009-12-03 23:20:53 UTC (rev 11666) @@ -42,8 +42,6 @@ echo " Processed data file = ${outfile}" } -#test_pf "inproc" "i" "-m 0 -r" -#test_pf "udp" "u" "-m 0 -r" test_pf "tcp" "t" "-m 0 -r" test_pf "local" "x" "-m 0 -r" Modified: trunk/xorp/libxipc/tests/bench_ipc_gnuplot.sh =================================================================== --- trunk/xorp/libxipc/tests/bench_ipc_gnuplot.sh 2009-12-03 23:10:07 UTC (rev 11665) +++ trunk/xorp/libxipc/tests/bench_ipc_gnuplot.sh 2009-12-03 23:20:53 UTC (rev 11666) @@ -52,21 +52,13 @@ # Setup various parameters setup_vars() { -filter_input $stat1.dat $stat1.dat.gnuplot filter_input $stat2.dat $stat2.dat.gnuplot -filter_input $stat3.dat $stat3.dat.gnuplot -IFILE1="$stat1.dat.gnuplot" IFILE2="$stat2.dat.gnuplot" -IFILE3="$stat3.dat.gnuplot" # Parameters -PAR_AVE1="using 1:2 t \"$NAME1\" w lp lt 1 lw 2 pt 2" -PAR_BAR1="t \"\" w yerrorbars lt 1 lw 2 pt 2" PAR_AVE2="using 1:2 t \"$NAME2\" w lp lt 1 lw 2 pt 4" PAR_BAR2="t \"\" w yerrorbars lt 1 lw 2 pt 4" -PAR_AVE3="using 1:2 t \"$NAME3\" w lp lt 1 lw 2 pt 6" -PAR_BAR3="t \"\" w yerrorbars lt 1 lw 2 pt 6" } @@ -77,21 +69,15 @@ XRANGE="[*:*]" YRANGE="[*:*]" #SET_KEY="set key top right" -PLOT="plot \"$IFILE1\" $PAR_AVE1, \"$IFILE1\" $PAR_BAR1, \"$IFILE2\" $PAR_AVE2, \"$IFILE2\" $PAR_BAR2, \"$IFILE3\" $PAR_AVE3, \"$IFILE3\" $PAR_BAR3" +PLOT="plot \"$IFILE2\" $PAR_AVE2, \"$IFILE2\" $PAR_BAR2," -stat1="inproc" stat2="tcp" -stat3="udp" -NAME1="In-Process" NAME2="TCP" -NAME3="UDP" YLABEL="Performance (XRLs/sec)" TITLE="XRL performance for various communication families" setup_vars OFILE="xrl_performance.eps" -# Select with or without std. deviation -#PLOT="plot \"$IFILE1\" $PAR_AVE1, \"$IFILE2\" $PAR_AVE2, \"$IFILE3\" $PAR_AVE3" -PLOT="plot \"$IFILE1\" $PAR_AVE1, \"$IFILE1\" $PAR_BAR1, \"$IFILE2\" $PAR_AVE2, \"$IFILE2\" $PAR_BAR2, \"$IFILE3\" $PAR_AVE3, \"$IFILE3\" $PAR_BAR3" +PLOT="plot \"$IFILE2\" $PAR_AVE2, \"$IFILE2\" $PAR_BAR2" plot_eps exit 0 Deleted: trunk/xorp/libxipc/tests/test_header.cc =================================================================== --- trunk/xorp/libxipc/tests/test_header.cc 2009-12-03 23:10:07 UTC (rev 11665) +++ trunk/xorp/libxipc/tests/test_header.cc 2009-12-03 23:20:53 UTC (rev 11666) @@ -1,116 +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 Lesser General Public License, Version -// 2.1, June 1999 as published by the Free Software Foundation. -// Redistribution and/or modification of this program under the terms of -// any other version of the GNU Lesser 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 Lesser General Public License, Version 2.1, a copy of -// which can be found in the XORP LICENSE.lgpl file. -// -// XORP, Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA; -// http://xorp.net - - - -#include "xrl_module.h" -#include "libxorp/xorp.h" - -#include "libxorp/xlog.h" - -#include "header.hh" - -void -run_test() -{ - HeaderWriter w; - - const string src_text = "containing some text"; - w.add("a string", src_text); - - const int32_t src_int = 3; - w.add("an int", src_int); - - const double src_double = 4.33; - w.add("a double", src_double); - - string wsrep = w.str(); - { - HeaderReader r(wsrep); - string s; - int32_t i; - double d; - - r.get("a string", s).get("an int", i).get("a double", d); - - if (s != src_text) { - fprintf(stderr, "failed string %s != %s", - s.c_str(), src_text.c_str()); - exit(-1); - } else if (i != src_int) { - fprintf(stderr, "failed int %d != %d", i, src_int); - exit(-1); - } else if (d != src_double) { - fprintf(stderr, "failed double %f != %f", d, src_double); - exit(-1); - } - - try { - r.get("foo", s); - printf("failed: incorrect match\n"); - exit(-1); - } catch (const HeaderReader::NotFound& e) { - // printf("okay\n"); - } - } - - try { - wsrep += "XXXXXX"; - HeaderReader r(wsrep); - // printf("okay\n"); - } catch (const HeaderReader::InvalidString &e) { - printf("failed: junk stopped operation\n."); - exit(-1); - } - - try { - wsrep.resize(10); - HeaderReader r(wsrep); - printf("failed: accepted incomplete string\n"); - exit(-1); - } catch (const HeaderReader::InvalidString &e) { - // printf("okay\n"); - } -} - -int -main(int /* argc */, char *argv[]) -{ - // - // Initialize and start xlog - // - xlog_init(argv[0], NULL); - xlog_set_verbose(XLOG_VERBOSE_LOW); // Least verbose messages - // XXX: verbosity of the error messages temporary increased - xlog_level_set_verbose(XLOG_LEVEL_ERROR, XLOG_VERBOSE_HIGH); - xlog_add_default_output(); - xlog_start(); - - run_test(); - - // - // Gracefully stop and exit xlog - // - xlog_stop(); - xlog_exit(); - - return 0; -} Deleted: trunk/xorp/libxipc/tests/test_inproc.cc =================================================================== --- trunk/xorp/libxipc/tests/test_inproc.cc 2009-12-03 23:10:07 UTC (rev 11665) +++ trunk/xorp/libxipc/tests/test_inproc.cc 2009-12-03 23:20:53 UTC (rev 11666) @@ -1,195 +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 Lesser General Public License, Version -// 2.1, June 1999 as published by the Free Software Foundation. -// Redistribution and/or modification of this program under the terms of -// any other version of the GNU Lesser 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 Lesser General Public License, Version 2.1, a copy of -// which can be found in the XORP LICENSE.lgpl file. -// -// XORP, Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA; -// http://xorp.net - - - -// #define DEBUG_LOGGING - -#include -#include "xrl_module.h" -#include "libxorp/xlog.h" -#include "libxorp/debug.h" -#include "libxorp/callback.hh" - -#include "xrl_error.hh" -#include "xrl_pf_inproc.hh" -#include "xrl_router.hh" - -static const bool g_show_trace = false; -#define trace(args...) if (g_show_trace) printf(args) - -// ---------------------------------------------------------------------------- -// Hello message handlers (zero arguments to Xrl) - -static bool hello_done = false; - -static const XrlCmdError -hello_recv_handler(const XrlArgs& inputs, - XrlArgs* response) -{ - trace("hello_recv_handler: inputs %s response %p\n", - inputs.str().c_str(), response); - return XrlCmdError::OKAY(); -} - -static void -hello_reply_handler(const XrlError& e, - XrlArgs* response, - Xrl request) -{ - if (e == XrlError::OKAY()) { - trace("hello_reply_handler: request %s response %p\n", - request.str().c_str(), response); - } else { - trace("hello failed: %s\n", e.str().c_str()); - } - hello_done = true; -} - -static void -test_hello(EventLoop& e, XrlPFInProcSender &s) -{ - Xrl x("anywhere", "hello"); - - debug_msg("test_hello\n"); - s.send(x, false, callback(hello_reply_handler, x)); - - while (hello_done == 0) { - e.run(); - } - hello_done = false; -} - -// ---------------------------------------------------------------------------- -// Hello message handlers (zero arguments to Xrl) - -static bool int32_done = false; - -static const XrlCmdError -int32_recv_handler(const XrlArgs& inputs, - XrlArgs* outputs) -{ - trace("int32_recv_handler: inputs %s response %p\n", - inputs.str().c_str(), outputs); - if (outputs) - outputs->add_int32("an_int32", 123456); - return XrlCmdError::OKAY(); -} - -static void -int32_reply_handler(const XrlError& e, - XrlArgs* response, - Xrl request) -{ - if (e == XrlError::OKAY()) { - trace("int32_reply_handler: request %s response %p\n", - request.str().c_str(), response); - trace("int32 -> %s\n", response->str().c_str()); - } else { - fprintf(stderr, "get_int32 failed: %s\n", e.str().c_str()); - exit(-1); - } - - int32_done = true; -} - -static void -test_int32(EventLoop& e, XrlPFInProcSender& s) -{ - Xrl x("anywhere", "get_int32"); - - debug_msg("test_int32\n"); - - s.send(x, false, callback(int32_reply_handler, x)); - while (int32_done == 0) - e.run(); - - int32_done = 0; -} - -static bool -print_twirl() -{ - static const char t[] = { '\\', '|', '/', '-' }; - static const size_t nt = sizeof(t) / sizeof(t[0]); - static size_t n = 0; - static char erase = '\0'; - - printf("%c%c", erase, t[n % nt]); fflush(stdout); - n++; - erase = '\b'; - return true; -} - -static void -run_test() -{ - EventLoop eventloop; - XrlDispatcher cmd_dispatcher("tester"); - - cmd_dispatcher.add_handler("hello", callback(hello_recv_handler)); - cmd_dispatcher.add_handler("get_int32", callback(int32_recv_handler)); - - XrlPFInProcListener listener(eventloop, &cmd_dispatcher); - XrlPFInProcSender s(eventloop, listener.address()); - - trace("listener address: %s\n", listener.address()); - - XorpTimer dp = eventloop.new_periodic_ms(500, callback(&print_twirl)); - assert(dp.scheduled()); - - trace("Testing XRLPFInProc\n"); - for (int i = 0; i < 100000; i++) { - test_hello(eventloop, s); - test_int32(eventloop, s); - // Can't call eventloop.run() because it blocks and inproc - // send/recv stuff happens instantaneously. - eventloop.timer_list().run(); - } - assert(dp.scheduled()); - printf("\n"); -} - -// ---------------------------------------------------------------------------- -// Main - -int main(int /* argc */, char *argv[]) -{ - // - // Initialize and start xlog - // - xlog_init(argv[0], NULL); - xlog_set_verbose(XLOG_VERBOSE_LOW); // Least verbose messages - // XXX: verbosity of the error messages temporary increased - xlog_level_set_verbose(XLOG_LEVEL_ERROR, XLOG_VERBOSE_HIGH); - xlog_add_default_output(); - xlog_start(); - - run_test(); - - // - // Gracefully stop and exit xlog - // - xlog_stop(); - xlog_exit(); - - return 0; -} Deleted: trunk/xorp/libxipc/tests/test_sudp.cc =================================================================== --- trunk/xorp/libxipc/tests/test_sudp.cc 2009-12-03 23:10:07 UTC (rev 11665) +++ trunk/xorp/libxipc/tests/test_sudp.cc 2009-12-03 23:20:53 UTC (rev 11666) @@ -1,208 +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 Lesser General Public License, Version -// 2.1, June 1999 as published by the Free Software Foundation. -// Redistribution and/or modification of this program under the terms of -// any other version of the GNU Lesser 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 Lesser General Public License, Version 2.1, a copy of -// which can be found in the XORP LICENSE.lgpl file. -// -// XORP, Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA; -// http://xorp.net - - - -#include - -#include "xrl_module.h" -#include "libxorp/xlog.h" - -#include "xrl_error.hh" -#include "xrl_pf_sudp.hh" -#include "xrl_router.hh" - -static bool g_trace = false; -#define trace(args...) if (g_trace) printf(args) - -// ---------------------------------------------------------------------------- -// Hello message handlers (zero arguments to Xrl) - -static bool hello_done = false; - -static const XrlCmdError -hello_recv_handler(const XrlArgs& inputs, XrlArgs* outputs) -{ - trace("hello_recv_handler: inputs %s outputs %p\n", - inputs.str().c_str(), outputs); - return XrlCmdError::OKAY(); -} - -static void -hello_reply_handler(const XrlError& e, - XrlArgs* response, - Xrl request) -{ - if (e != XrlError::OKAY()) { - fprintf(stderr, "hello failed: %s\n", e.str().c_str()); - exit(-1); - } - trace("hello_reply_handler: request %s response %p\n", - request.str().c_str(), response); - hello_done = true; -} - -static void -test_hello(EventLoop& e, XrlPFSUDPListener &l) -{ - Xrl x("anywhere", "hello"); - - XrlPFSUDPSender s(e, l.address()); - s.send(x, false, callback(hello_reply_handler, x)); - - while (hello_done == 0) { - e.run(); - } -} - -// ---------------------------------------------------------------------------- -// Hello message handlers (zero arguments to Xrl) - -static bool int32_done = false; - -static const XrlCmdError -int32_recv_handler(const XrlArgs& inputs, XrlArgs* outputs) -{ - trace("int32_recv_handler: inputs %s outputs %p\n", - inputs.str().c_str(), outputs); - if (outputs) { - outputs->add_int32("an_int32", 123456); - } - return XrlCmdError::OKAY(); -} - -static void -int32_reply_handler(const XrlError& e, - XrlArgs* response, - Xrl request) -{ - if (e != XrlError::OKAY()) { - fprintf(stderr, "get_int32 failed: %s\n", e.str().c_str()); - exit(-1); - } - trace("int32_reply_handler: request %s response %p\n", - request.str().c_str(), response); - trace("int32 -> %s\n", response->str().c_str()); - int32_done = true; -} - -static void -test_int32(EventLoop& e, XrlPFSUDPListener& l) -{ - Xrl x("anywhere", "get_int32"); - - XrlPFSUDPSender s(e, l.address()); - s.send(x, false, callback(int32_reply_handler, x)); - - while (int32_done == 0) { - e.run(); - } -} - -static const char* NOISE = "Random arbitrary noise"; - -static const XrlCmdError -no_execute_recv_handler(const XrlArgs& /* inputs */, - XrlArgs* /* outputs */, - const char* noise) -{ - return XrlCmdError::COMMAND_FAILED(noise); -} - -static void -no_execute_reply_handler(const XrlError& e, - XrlArgs* /* response */, - bool* done) -{ - if (e != XrlError::COMMAND_FAILED()) { - fprintf(stderr, "no_execute_handler failed: %s\n", e.str().c_str()); - exit(-1); - } - if (e.note() != string(NOISE)) { - fprintf(stderr, "no_execute_handler failed different reasons:" - "expected:\t%s\ngot:\t\t%s\n", NOISE, e.note().c_str()); - exit(-1); - } - *done = true; -} - -static void -test_xrlerror_note(EventLoop&e, XrlPFSUDPListener& l) -{ - Xrl x("anywhere", "no_execute"); - - XrlPFSUDPSender s(e, l.address()); - - bool done = false; - s.send(x, false, callback(no_execute_reply_handler, &done)); - - while (done == false) { - e.run(); - } -} - -static void -run_test() -{ - EventLoop eventloop; - - XrlDispatcher cmd_dispatcher("tester"); - cmd_dispatcher.add_handler("hello", callback(hello_recv_handler)); - cmd_dispatcher.add_handler("get_int32", callback(int32_recv_handler)); - cmd_dispatcher.add_handler("no_execute", - callback(no_execute_recv_handler, NOISE)); - - XrlPFSUDPListener listener(eventloop, &cmd_dispatcher); - - trace("listener address: %s\n", listener.address()); - - test_hello(eventloop, listener); - test_int32(eventloop, listener); - test_xrlerror_note(eventloop, listener); -} - -// ---------------------------------------------------------------------------- -// Main - -int main(int /* argc */, char* argv[]) -{ - - - // - // Initialize and start xlog - // - xlog_init(argv[0], NULL); - xlog_set_verbose(XLOG_VERBOSE_LOW); // Least verbose messages - // XXX: verbosity of the error messages temporary increased - xlog_level_set_verbose(XLOG_LEVEL_ERROR, XLOG_VERBOSE_HIGH); - xlog_add_default_output(); - xlog_start(); - - run_test(); - - // - // Gracefully stop and exit xlog - // - xlog_stop(); - xlog_exit(); - - return 0; -} Modified: trunk/xorp/libxipc/xrl_pf_factory.cc =================================================================== --- trunk/xorp/libxipc/xrl_pf_factory.cc 2009-12-03 23:10:07 UTC (rev 11665) +++ trunk/xorp/libxipc/xrl_pf_factory.cc 2009-12-03 23:20:53 UTC (rev 11666) @@ -30,10 +30,7 @@ #include #include "xrl_pf_factory.hh" -//#include "xrl_pf_inproc.hh" -//#include "xrl_pf_sudp.hh" #include "xrl_pf_stcp.hh" -//#include "xrl_pf_kill.hh" #include "xrl_pf_unix.hh" @@ -49,23 +46,12 @@ debug_msg("instantiating sender pf = \"%s\", addr = \"%s\"\n", protocol, address); try { -#if 0 - if (strcmp(XrlPFSUDPSender::protocol_name(), protocol) == 0) { - return new XrlPFSUDPSender(eventloop, address); - } else -#endif if (strcmp(XrlPFSTCPSender::protocol_name(), protocol) == 0) { return new XrlPFSTCPSender(eventloop, address); } -#if 0 - else if (strcmp(XrlPFInProcSender::protocol_name(), protocol) == 0) { - return new XrlPFInProcSender(eventloop, address); - } else if (strcmp(XrlPFKillSender::protocol_name(), protocol) == 0) { - return new XrlPFKillSender(eventloop, address); - } else -#endif - if (strcmp(XrlPFUNIXSender::protocol_name(), protocol) == 0) + if (strcmp(XrlPFUNIXSender::protocol_name(), protocol) == 0) { return new XrlPFUNIXSender(eventloop, address); + } } catch (XorpException& e) { XLOG_ERROR("XrlPFSenderFactory::create failed: %s\n", e.str().c_str()); } Deleted: trunk/xorp/libxipc/xrl_pf_inproc.cc =================================================================== --- trunk/xorp/libxipc/xrl_pf_inproc.cc 2009-12-03 23:10:07 UTC (rev 11665) +++ trunk/xorp/libxipc/xrl_pf_inproc.cc 2009-12-03 23:20:53 UTC (rev 11666) @@ -1,275 +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 Lesser General Public License, Version -// 2.1, June 1999 as published by the Free Software Foundation. -// Redistribution and/or modification of this program under the terms of -// any other version of the GNU Lesser 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 Lesser General Public License, Version 2.1, a copy of -// which can be found in the XORP LICENSE.lgpl file. -// -// XORP, Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA; -// http://xorp.net - - - -#include "xrl_module.h" - -#include "libxorp/xorp.h" -#include "libxorp/debug.h" -#include "libxorp/xlog.h" -#include "libxorp/c_format.hh" - -#include - -#ifdef HAVE_NETDB_H -#include -#endif - -#include "xrl_error.hh" -#include "xrl_pf_inproc.hh" -#include "xrl_dispatcher.hh" - - -// ---------------------------------------------------------------------------- -// InProc is "intra-process" - a minimalist and simple direct call transport -// mechanism for XRLs. -// -// Resolved names have protocol name "inproc" and specify addresses as -// "host/pid.iid" where pid is process id and iid is instance id (number). -// The latter being used to differentiate when multiple listeners exist -// within a single process. -// - -// ---------------------------------------------------------------------------- -// Constants - -static char INPROC_PROTOCOL_NAME[] = "inproc"; - -const char* XrlPFInProcSender::_protocol = INPROC_PROTOCOL_NAME; -const char* XrlPFInProcListener::_protocol = INPROC_PROTOCOL_NAME; - -// Glue for Sender and Listener rendez-vous -static XrlPFInProcListener* get_inproc_listener(uint32_t instance_no); - -// ---------------------------------------------------------------------------- -// Utility Functions - -static const string -this_host() -{ - char buffer[MAXHOSTNAMELEN + 1]; - buffer[MAXHOSTNAMELEN] ='\0'; - gethostname(buffer, MAXHOSTNAMELEN); - return string(buffer); -} - -bool -split_inproc_address(const char* address, - string& host, uint32_t& pid, uint32_t& iid) -{ - const char *p; - - p = address; - for (;;) { - if (*p == '\0') { - // unexpected end of input - return false; - } else if (*p == ':') { - break; - } - p++; - } - host = string(address, p - address); - p++; - - pid = 0; - while (xorp_isdigit(*p)) { - pid *= 10; - pid += *p - '0'; - p++; - } - - if (*p != '.') - return false; - p++; - - iid = 0; - while (xorp_isdigit(*p)) { - iid *= 10; - iid += *p - '0'; - p++; - } - return (*p == '\0'); -} - -// ---------------------------------------------------------------------------- -// XrlPFInProcSender - -XrlPFInProcSender::XrlPFInProcSender(EventLoop& e, const char* address) - throw (XrlPFConstructorError) - : XrlPFSender(e, address) -{ - string hname; - uint32_t pid, iid; - - if (split_inproc_address(address, hname, pid, iid) == false) { - xorp_throw(XrlPFConstructorError, - c_format("Invalid address: %s", address)); - } else if (hname != this_host()) { - xorp_throw(XrlPFConstructorError, - c_format("Wrong host: %s != %s", - hname.c_str(), this_host().c_str())); - } else if (pid != (uint32_t)getpid()) { - xorp_throw(XrlPFConstructorError, "Bad process id"); - } - _listener_no = iid; - _depth = new uint32_t(0); -} - -XrlPFInProcSender::~XrlPFInProcSender() -{} - -bool -XrlPFInProcSender::send(const Xrl& x, - bool direct_call, - const SendCallback& cb) -{ - XrlPFInProcListener *l = get_inproc_listener(_listener_no); - - // Check stack depth. This is a bit adhoc, but the issue is that - // the inproc makes the dispatch and invokes the callback in this - // send function. There is zero delay. So code that sends one - // XRL from the callback of another in a long chains may end up - // exhausting the stack. We use depth as a counter. And there's - // the final subtlety that one of those callback may delete the - // sender so we can't access member variables directly after the - // callback returns, but we can access a reference pointer if we - // have a reference!!! - ref_ptr depth = _depth; - - *depth = *depth + 1; - if (*depth > 1) { - if (direct_call == true) { - *depth = *depth - 1; - return false; - } else { - cb->dispatch(XrlError(SEND_FAILED, "RESOURCES!"), 0); - *depth = *depth - 1; - return true; - } - } - - if (l == NULL) { - if (direct_call) { - *depth = *depth - 1; - return false; - } else { - debug_msg("XrlPFInProcSender::send() no listener (id %d)\n", - XORP_INT_CAST(_listener_no)); - cb->dispatch(XrlError::SEND_FAILED(), 0); - *depth = *depth - 1; - return true; - } - } - - const XrlDispatcher *d = l->dispatcher(); - if (d == NULL) { - if (direct_call) { - *depth = *depth - 1; - return false; - } else { - debug_msg("XrlPFInProcSender::send() no dispatcher (id %d)\n", - XORP_INT_CAST(_listener_no)); - cb->dispatch(XrlError::SEND_FAILED(), 0); - } - *depth = *depth - 1; - return true; - } - - XrlArgs reply; - const XrlError e = d->dispatch_xrl(x.command(), x.args(), reply); - cb->dispatch(e, (e == XrlError::OKAY()) ? &reply : 0); - - *depth = *depth - 1; - return true; -} - -const char* -XrlPFInProcSender::protocol() const -{ - return _protocol; -} - -bool -XrlPFInProcSender::alive() const -{ - return true; -} - -// ---------------------------------------------------------------------------- -// XrlPFInProcListener instance management - -static map listeners; - -static XrlPFInProcListener* -get_inproc_listener(uint32_t instance_no) -{ - map::iterator i; - debug_msg("getting -> size %u\n", XORP_UINT_CAST(listeners.size())); - i = listeners.find(instance_no); - return (i == listeners.end()) ? 0 : i->second; -} - -static void -add_inproc_listener(uint32_t instance_no, XrlPFInProcListener* l) -{ - assert(get_inproc_listener(instance_no) == 0); - debug_msg("adding no %d size %u\n", XORP_INT_CAST(instance_no), - XORP_UINT_CAST(listeners.size())); - listeners[instance_no] = l; -} - -static void -remove_inproc_listener(uint32_t instance_no) -{ - assert(get_inproc_listener(instance_no) != 0); - listeners.erase(instance_no); - debug_msg("Removing listener %d\n", XORP_INT_CAST(instance_no)); -} - -// ---------------------------------------------------------------------------- -// XrlPFInProcListener - -uint32_t XrlPFInProcListener::_next_instance_no; - -XrlPFInProcListener::XrlPFInProcListener(EventLoop& e, XrlDispatcher* xr) - throw (XrlPFConstructorError) - : XrlPFListener(e, xr) -{ - _instance_no = _next_instance_no ++; - - _address = this_host() + c_format(":%d.%d", XORP_INT_CAST(getpid()), - XORP_INT_CAST(_instance_no)); - add_inproc_listener(_instance_no, this); -} - -XrlPFInProcListener::~XrlPFInProcListener() -{ - remove_inproc_listener(_instance_no); -} - -bool -XrlPFInProcListener::response_pending() const -{ - // Responses are immediate for InProc - return false; -} Deleted: trunk/xorp/libxipc/xrl_pf_inproc.hh =================================================================== --- trunk/xorp/libxipc/xrl_pf_inproc.hh 2009-12-03 23:10:07 UTC (rev 11665) +++ trunk/xorp/libxipc/xrl_pf_inproc.hh 2009-12-03 23:20:53 UTC (rev 11666) @@ -1,76 +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 Lesser General Public License, Version -// 2.1, June 1999 as published by the Free Software Foundation. -// Redistribution and/or modification of this program under the terms of -// any other version of the GNU Lesser 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 Lesser General Public License, Version 2.1, a copy of -// which can be found in the XORP LICENSE.lgpl file. -// -// XORP, Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA; -// http://xorp.net - -// $XORP: xorp/libxipc/xrl_pf_inproc.hh,v 1.22 2008/10/02 21:57:25 bms Exp $ - -#ifndef __LIBXIPC_XRL_PF_INPROC_HH__ -#define __LIBXIPC_XRL_PF_INPROC_HH__ - -#include "xrl_pf.hh" - -// ---------------------------------------------------------------------------- -// XRL Protocol Family : Intra Process communication - -class XrlPFInProcListener : public XrlPFListener { -public: - XrlPFInProcListener(EventLoop& e, XrlDispatcher* xr = 0) - throw (XrlPFConstructorError); - ~XrlPFInProcListener(); - - const char* address() const { return _address.c_str(); } - const char* protocol() const { return _protocol; } - - bool response_pending() const; - -private: - string _address; - uint32_t _instance_no; - - static const char* _protocol; - static uint32_t _next_instance_no; -}; - -class XrlPFInProcSender : public XrlPFSender { -public: - XrlPFInProcSender(EventLoop& e, const char* address = NULL) - throw (XrlPFConstructorError); - - ~XrlPFInProcSender(); - - bool send(const Xrl& x, - bool direct_call, - const XrlPFSender::SendCallback& cb); - - bool sends_pending() const { return false; } - - const char* protocol() const; - - static const char* protocol_name() { return _protocol; } - - bool alive() const; - -private: - static const char* _protocol; - uint32_t _listener_no; - ref_ptr _depth; -}; - -#endif // __LIBXIPC_XRL_PF_INPROC_HH__ Deleted: trunk/xorp/libxipc/xrl_pf_kill.cc =================================================================== --- trunk/xorp/libxipc/xrl_pf_kill.cc 2009-12-03 23:10:07 UTC (rev 11665) +++ trunk/xorp/libxipc/xrl_pf_kill.cc 2009-12-03 23:20:53 UTC (rev 11666) @@ -1,127 +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 Lesser General Public License, Version -// 2.1, June 1999 as published by the Free Software Foundation. -// Redistribution and/or modification of this program under the terms of -// any other version of the GNU Lesser 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 Lesser General Public License, Version 2.1, a copy of -// which can be found in the XORP LICENSE.lgpl file. -// -// XORP, Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA; -// http://xorp.net - - - -// #define DEBUG_LOGGING -// #define DEBUG_PRINT_FUNCTION_NAME - -#include "xrl_module.h" - -#include "libxorp/xorp.h" -#include "libxorp/debug.h" -#include "libxorp/xlog.h" -#include "libxorp/callback.hh" -#include "libxorp/exceptions.hh" - -#ifdef HAVE_SYS_IOCTL_H -#include -#endif -#ifdef HAVE_SYS_UIO_H -#include -#endif - -#include "xrl_error.hh" -#include "xrl_pf_kill.hh" -#include "xrl_dispatcher.hh" -#include "xuid.hh" -#include "sockutil.hh" - - -// ---------------------------------------------------------------------------- -// SUDP is "simple udp" - a minimalist and simple udp transport -// mechanism for XRLs. It is intended as a placeholder to allow -// modules to start using XRL whilst we develop other mechanisms. -// -// Resolved names have protocol name "sudp" and specify addresses as -// "host/port" -// - -// ---------------------------------------------------------------------------- -// Constants - -const char XrlPFKillSender::_protocol[] = "kill"; - -// ---------------------------------------------------------------------------- -// XrlPFKillSender - -XrlPFKillSender::XrlPFKillSender(EventLoop& e, const char* pid_str) - throw (XrlPFConstructorError) - : XrlPFSender(e, pid_str) -{ - char* end_ptr; - long l = strtol(pid_str, &end_ptr, 0); - if (!*pid_str || *end_ptr || ((l == LONG_MIN || l == LONG_MAX) && errno == ERANGE)) - xorp_throw(XrlPFConstructorError, - c_format("Bad process ID: %s\n", pid_str)); - - _pid = l; -} - -XrlPFKillSender::~XrlPFKillSender() -{ -} - -bool -XrlPFKillSender::send(const Xrl& x, - bool direct_call, - const XrlPFSender::SendCallback& cb) -{ - try { - int32_t sig = x.args().get_int32("signal"); - int err = ::kill(_pid, sig); - if (direct_call) { - return false; - } else { - if (err < 0) - cb->dispatch(XrlError(COMMAND_FAILED, strerror(errno)), 0); - else - cb->dispatch(XrlError::OKAY(), 0); - return true; - } - } catch (XrlArgs::BadArgs) { - } - - if (direct_call) { - return false; - } else { - cb->dispatch(XrlError(SEND_FAILED, "Bad XRL format"), 0); - return true; - } -} - -bool -XrlPFKillSender::sends_pending() const -{ - return false; -} - -bool -XrlPFKillSender::alive() const -{ - return true; -} - -const char* -XrlPFKillSender::protocol() const -{ - return _protocol; -} Deleted: trunk/xorp/libxipc/xrl_pf_kill.hh =================================================================== --- trunk/xorp/libxipc/xrl_pf_kill.hh 2009-12-03 23:10:07 UTC (rev 11665) +++ trunk/xorp/libxipc/xrl_pf_kill.hh 2009-12-03 23:20:53 UTC (rev 11666) @@ -1,54 +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 Lesser General Public License, Version -// 2.1, June 1999 as published by the Free Software Foundation. -// Redistribution and/or modification of this program under the terms of -// any other version of the GNU Lesser 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 Lesser General Public License, Version 2.1, a copy of -// which can be found in the XORP LICENSE.lgpl file. -// -// XORP, Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA; -// http://xorp.net - -// $XORP: xorp/libxipc/xrl_pf_kill.hh,v 1.10 2008/10/02 21:57:25 bms Exp $ - -#ifndef __LIBXIPC_XRL_PF_KILL_HH__ -#define __LIBXIPC_XRL_PF_KILL_HH__ - -#include "xrl_pf.hh" - -class XUID; - -class XrlPFKillSender : public XrlPFSender { -public: - XrlPFKillSender(EventLoop& e, const char* pid_str) throw (XrlPFConstructorError); - virtual ~XrlPFKillSender(); - - bool send(const Xrl& x, - bool direct_call, - const XrlPFSender::SendCallback& cb); - - bool sends_pending() const; - - bool alive() const; - - const char* protocol() const; - - static const char* protocol_name() { return _protocol; } - -protected: - int _pid; - - static const char _protocol[]; -}; - -#endif // __LIBXIPC_XRL_PF_KILL_HH__ Deleted: trunk/xorp/libxipc/xrl_pf_sudp.cc =================================================================== --- trunk/xorp/libxipc/xrl_pf_sudp.cc 2009-12-03 23:10:07 UTC (rev 11665) +++ trunk/xorp/libxipc/xrl_pf_sudp.cc 2009-12-03 23:20:53 UTC (rev 11666) @@ -1,634 +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 Lesser General Public License, Version -// 2.1, June 1999 as published by the Free Software Foundation. -// Redistribution and/or modification of this program under the terms of -// any other version of the GNU Lesser 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 Lesser General Public License, Version 2.1, a copy of -// which can be found in the XORP LICENSE.lgpl file. -// -// XORP, Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA; -// http://xorp.net - - - -// #define DEBUG_LOGGING -// #define DEBUG_PRINT_FUNCTION_NAME - -#include "xrl_module.h" - -#include "libxorp/xorp.h" -#include "libxorp/debug.h" -#include "libxorp/xlog.h" -#include "libxorp/callback.hh" -#include "libxorp/exceptions.hh" - -#include "libcomm/comm_api.h" - -#ifdef HAVE_SYS_IOCTL_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_PARAM_H -#include -#endif -#ifdef HAVE_SYS_UIO_H -#include -#endif - -#include - -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif - -#include - -#include "header.hh" -#include "xrl_error.hh" -#include "xrl_pf_sudp.hh" -#include "xrl_dispatcher.hh" -#include "xuid.hh" -#include "sockutil.hh" - -// ---------------------------------------------------------------------------- -// SUDP is "simple udp" - a minimalist and simple udp transport -// mechanism for XRLs. It is intended as a placeholder to allow -// modules to start using XRL whilst we develop other mechanisms. -// -// Resolved names have protocol name "sudp" and specify addresses as -// "host/port" -// - -// ---------------------------------------------------------------------------- -// Constants - -static char SUDP_PROTOCOL_NAME[] = "sudp"; -static string SUDP_PROTOCOL = "sudp/1.0"; - -static const int SUDP_REPLY_TIMEOUT_MS = 3000; -static const ssize_t SUDP_RECV_BUFFER_BYTES = 32 * 1024; -static const ssize_t SUDP_SEND_BUFFER_BYTES = SUDP_RECV_BUFFER_BYTES / 4; - -const char* XrlPFSUDPSender::_protocol = SUDP_PROTOCOL_NAME; -const char* XrlPFSUDPListener::_protocol = SUDP_PROTOCOL_NAME; - -struct Request { - XrlPFSender* parent; // Request creator - XrlPFSender::SendCallback cb; // User Callback - XUID xuid; // Unique Request ID - XorpTimer timeout; // Timeout timer - - Request(XrlPFSender* p, const XrlPFSender::SendCallback& scb) - : parent(p), cb(scb) {} - bool operator==(const XUID& x) const { return xuid == x; } -}; - -// ---------------------------------------------------------------------------- -// Utility Functions - -static string -render_dispatch_header(const XUID& id, uint32_t content_bytes) -{ - HeaderWriter h; - h.add("Protocol", SUDP_PROTOCOL); - h.add("XUID", id.str()); - h.add("Content-Length", content_bytes); - return h.str(); -} - -static bool -parse_dispatch_header(string hdr, XUID& id, uint32_t& content_bytes) -{ - try { - HeaderReader h(hdr); - string protocol, sid; - h.get("Protocol", protocol); - h.get("XUID", sid); - h.get("Content-Length", content_bytes); - id = XUID(sid); - return (protocol == SUDP_PROTOCOL); - } catch (const HeaderReader::InvalidString&) { - debug_msg("header invalid\n"); - } catch (const HeaderReader::NotFound&) { - debug_msg("header missing fields\n"); - } - return false; -} - -static string -xrlerror_to_status(const XrlError& e) -{ - string r = c_format("%d", e.error_code()); - if (e.note().size()) { - r += " " + e.note(); - } - return r; -} - -static XrlError -status_to_xrlerror(const string& status) -{ - uint32_t error_code = 0; - - string::const_iterator si = status.begin(); - while (si != status.end()) { - if (xorp_isdigit(*si) == false) - break; - error_code *= 10; - error_code += *si - '0'; - si++; - } - - if (si == status.begin()) { - XLOG_ERROR("Missing XrlError::errorcode value"); - return XrlError(INTERNAL_ERROR, "corrupt xrl response"); - } - - if (si == status.end()) - return XrlErrorCode(error_code); - - si++; - return XrlError(XrlErrorCode(error_code), string(si, status.end())); -} - -static string -render_response(const XrlError& e, const XUID& id, uint32_t content_bytes) -{ - HeaderWriter h; - h.add("Protocol", SUDP_PROTOCOL); - h.add("XUID", id.str()); - h.add("Status", xrlerror_to_status(e)); - h.add("Content-Length", content_bytes); - return h.str(); -} - -static bool -parse_response(const char* buf, - XrlError& e, - XUID& xuid, - uint32_t& header_bytes, - uint32_t& content_bytes) { - try { - HeaderReader h(buf); - - string protocol; - h.get("Protocol", protocol); - if (protocol != SUDP_PROTOCOL) return false; - - string status; - h.get("Status", status); - e = status_to_xrlerror(status); - - string xuid_str; - h.get("XUID", xuid_str); - xuid = XUID(xuid_str); - h.get("Content-Length", content_bytes); - header_bytes = h.bytes_consumed(); - - return true; - } catch (const HeaderReader::InvalidString&) { - debug_msg("Invalid string"); - } catch (const HeaderReader::NotFound&) { - debug_msg("Not found"); - } catch (const XUID::InvalidString&) { - debug_msg("Failed to restore XUID from string"); - } - return false; -} - -// ---------------------------------------------------------------------------- -// XrlPFUDPSender - -XorpFd XrlPFSUDPSender::sender_sock; -int XrlPFSUDPSender::instance_count; - -typedef map XuidRequestMap; -static XuidRequestMap requests_pending; - -XrlPFSUDPSender::XrlPFSUDPSender(EventLoop& e, const char* address_slash_port) - throw (XrlPFConstructorError) - : XrlPFSender(e, address_slash_port) -{ - string addr; - uint16_t port; - - if (split_address_slash_port(address_slash_port, addr, port) != true || - address_lookup(addr, _destination.sin_addr) != true) { - xorp_throw(XrlPFConstructorError, - c_format("Bad destination: %s\n", address_slash_port)); - } -#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN - _destination.sin_len = sizeof(struct sockaddr_in); -#endif - _destination.sin_family = AF_INET; - _destination.sin_port = htons(port); - - if (!sender_sock.is_valid()) { - debug_msg("Creating master socket\n"); - sender_sock = comm_open_udp(AF_INET, COMM_SOCK_NONBLOCKING); - if (sender_sock.is_valid()) { - if (comm_sock_set_sndbuf(sender_sock, SUDP_SEND_BUFFER_BYTES, - SUDP_SEND_BUFFER_BYTES) < SUDP_SEND_BUFFER_BYTES) - { - comm_close(sender_sock); - sender_sock.clear(); - xorp_throw(XrlPFConstructorError, - c_format("Could not create master socket: " - "cannot set socket sending buffer to %d\n", - XORP_INT_CAST(SUDP_SEND_BUFFER_BYTES))); - } - _eventloop.add_ioevent_cb(sender_sock, IOT_READ, - callback(&XrlPFSUDPSender::recv)); - } else { - xorp_throw(XrlPFConstructorError, - c_format("Could not create master socket: %s.\n", - comm_get_last_error_str())); - } - } - instance_count++; - debug_msg("Created XrlPFSUDPSender %s instance count %d sender_sock %s\n", - address_slash_port, instance_count, sender_sock.str().c_str()); -} - -XrlPFSUDPSender::~XrlPFSUDPSender() -{ - instance_count--; - debug_msg("~XrlPFSUDPSender %p- instance count %d\n", - this, instance_count); - - if (instance_count == 0) { - _eventloop.remove_ioevent_cb(sender_sock, IOT_READ); - comm_close(sender_sock); - sender_sock.clear(); - } - - // Delete requests associated with us, they cannot possibly be valid - XuidRequestMap::iterator i = requests_pending.begin(); - while (i != requests_pending.end()) { - if (i->second.parent == this) { - requests_pending.erase(i++); - } else { - i++; - } - } -} - -bool -XrlPFSUDPSender::send(const Xrl& x, - bool direct_call, - const XrlPFSender::SendCallback& cb) -{ - // Map request id to current object instance - Request request(this, cb); - assert(requests_pending.find(request.xuid) == requests_pending.end()); - - pair p = - requests_pending.insert(XuidRequestMap::value_type(request.xuid, - request)); - if (p.second == false) { - if (direct_call) { - return false; - } else { - cb->dispatch(XrlError(SEND_FAILED, "Insufficient memory"), 0); - return true; - } - } - - // Prepare data - string xrl = x.str(); - string header = render_dispatch_header(request.xuid, - static_cast(xrl.size())); - string msg = header + xrl; - - ssize_t msg_bytes = msg.size(); - if (msg_bytes > SUDP_SEND_BUFFER_BYTES) { - debug_msg("Message sent larger than transport method designed"); - } else if (::sendto(sender_sock, msg.data(), msg.size(), 0, - (sockaddr*)&_destination, -#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN - _destination.sin_len -#else - sizeof(_destination) -#endif - ) != msg_bytes) { - debug_msg("Write failed: %s\n", comm_get_last_error_str()); - requests_pending.erase(p.first); - - if (direct_call) { - return false; - } else { - cb->dispatch(XrlError::SEND_FAILED(), 0); - return true; - } - } - - XuidRequestMap::iterator& xi = p.first; - - xi->second.timeout = - _eventloop.new_oneoff_after_ms(SUDP_REPLY_TIMEOUT_MS, - callback(this, &XrlPFSUDPSender::timeout_hook, request.xuid)); - debug_msg("XrlPFSUDPSender::send (qsize %u)\n", - XORP_UINT_CAST(requests_pending.size())); - return true; -} - -bool -XrlPFSUDPSender::sends_pending() const -{ - XuidRequestMap::const_iterator i = requests_pending.begin(); - while (i != requests_pending.end()) { - const XrlPFSender* parent = i->second.parent; - if (parent == this) - return true; - ++i; - } - return false; -} - -bool -XrlPFSUDPSender::alive() const -{ - return true; -} - -const char* -XrlPFSUDPSender::protocol() const -{ - return _protocol; -} - -void -XrlPFSUDPSender::timeout_hook(XUID xuid) -{ - map::iterator i = requests_pending.find(xuid); - assert (i != requests_pending.end()); - - Request& r = i->second; - SendCallback cb = r.cb; - - debug_msg("%p Erasing state for %s (timeout)\n", - this, r.xuid.str().c_str()); - - requests_pending.erase(i); - cb->dispatch(XrlError::REPLY_TIMED_OUT(), 0); -} - -// ---------------------------------------------------------------------------- -// XrlPFSUDPSender timer and io event hooks - -void -XrlPFSUDPSender::recv(XorpFd fd, IoEventType type) -{ - assert(fd == sender_sock); - assert(type == IOT_READ); - - char buf[SUDP_RECV_BUFFER_BYTES + 1]; - - ssize_t read_bytes = ::recvfrom(sender_sock, buf, SUDP_RECV_BUFFER_BYTES, - 0, NULL, NULL); - - if (read_bytes < 0) { - debug_msg("recvfrom failed: %s\n", comm_get_last_error_str()); - return; - } - buf[read_bytes] = '\0'; - - XrlError err; - XUID xuid; - uint32_t content_bytes = 0; - uint32_t header_bytes = 0; - - if (parse_response(buf, err, xuid, header_bytes, content_bytes) != true) { - debug_msg("response header parsing failed\n"); - return; - } else if (content_bytes + header_bytes != (uint32_t)read_bytes) { - debug_msg("header and data bytes != read_bytes (%u + %u != %d\n", - XORP_UINT_CAST(header_bytes), - XORP_UINT_CAST(content_bytes), - XORP_INT_CAST(read_bytes)); - } - - debug_msg("Received %s\n", xuid.str().c_str()); - map::iterator i = requests_pending.find(xuid); - if (i == requests_pending.end()) { - XLOG_WARNING("XRL Protocol Family SUDP: response arrived for XRL " - "that appears to have timed out."); - return; - } - - // Unschedule timer - i->second.timeout.unschedule(); - - // Copy out state we'd like to use from request before deleting it. - SendCallback cb = i->second.cb; - - debug_msg("Erasing state for %s (answered)\n", - i->second.xuid.str().c_str()); - requests_pending.erase(i); - - try { - XrlArgs response(buf + header_bytes); - cb->dispatch(err, &response); - } catch (const InvalidString&) { - debug_msg("Corrupt response: " - "header_bytes %u content_bytes %u\n\t\"%s\"\n", - XORP_UINT_CAST(header_bytes), - XORP_UINT_CAST(content_bytes), - buf + header_bytes); - XrlError xe(INTERNAL_ERROR, "corrupt xrl response"); - cb->dispatch(xe, 0); - return; - } -} - -// ---------------------------------------------------------------------------- -// XrlPFUDPListener - -XrlPFSUDPListener::XrlPFSUDPListener(EventLoop& e, XrlDispatcher* xr) - throw (XrlPFConstructorError) - : XrlPFListener(e, xr) -{ - debug_msg("XrlPFSUDPListener\n"); - - in_addr myaddr = get_preferred_ipv4_addr(); - - _sock = comm_bind_udp4(&myaddr, 0, COMM_SOCK_NONBLOCKING); - if (!_sock.is_valid()) { - xorp_throw(XrlPFConstructorError, - c_format("Could not allocate listening IP socket: %s.", - comm_get_last_error_str())); - } - - // XXX: We don't check return values here. - (void)comm_sock_set_sndbuf(_sock, SO_SND_BUF_SIZE_MAX, - SO_SND_BUF_SIZE_MIN); - (void)comm_sock_set_rcvbuf(_sock, SO_RCV_BUF_SIZE_MAX, - SO_RCV_BUF_SIZE_MIN); - - string addr; - uint16_t port; - if (get_local_socket_details(_sock, addr, port) == false) { - comm_close(_sock); - xorp_throw(XrlPFConstructorError, - c_format("Could not get local socket details.")); - } - _addr = address_slash_port(addr, port); - - _eventloop.add_ioevent_cb(_sock, IOT_READ, - callback(this, &XrlPFSUDPListener::recv)); -} - -XrlPFSUDPListener::~XrlPFSUDPListener() -{ - _eventloop.remove_ioevent_cb(_sock, IOT_READ); - comm_close(_sock); -} - -void -XrlPFSUDPListener::recv(XorpFd fd, IoEventType type) -{ - static char rbuf[SUDP_RECV_BUFFER_BYTES + 1]; - - assert(fd == _sock); - assert(type == IOT_READ); - - debug_msg("recv()\n"); - - struct sockaddr_storage sockfrom; - socklen_t sockfrom_bytes = sizeof(sockfrom); - - ssize_t rbuf_bytes = ::recvfrom(_sock, rbuf, sizeof(rbuf) / sizeof(rbuf[0]), - 0, (sockaddr*)&sockfrom, &sockfrom_bytes); - if (rbuf_bytes < 0) { - int err = comm_get_last_error(); - if (err == EWOULDBLOCK) { - return; - } else { - debug_msg("recvfrom failed: %s\n", comm_get_error_str(err)); - return; - } - } - - if (rbuf_bytes > SUDP_RECV_BUFFER_BYTES) { - debug_msg("Packet too large (%d > %d) bytes\n", - XORP_INT_CAST(rbuf_bytes), - XORP_INT_CAST(SUDP_RECV_BUFFER_BYTES)); - return; - } - rbuf[rbuf_bytes] = '\0'; - - debug_msg("XXX %s\n", rbuf); - - uint32_t content_bytes; - XrlArgs response; - XrlError e; - XUID xuid; - if (parse_dispatch_header(rbuf, xuid, content_bytes) == true) { - e = dispatch_command(rbuf + rbuf_bytes - content_bytes, response); - debug_msg("response \"%s\"\n", response.str().c_str()); - send_reply(&sockfrom, sockfrom_bytes, e, xuid, &response); - } else { - // XXX log busted header. - } -} - -const XrlError -XrlPFSUDPListener::dispatch_command(const char* rbuf, XrlArgs& reply) -{ - const XrlDispatcher* d = dispatcher(); - assert(d != 0); - - try { - Xrl xrl(rbuf); - const string& command = xrl.command(); - const XrlArgs& args = xrl.args(); - return d->dispatch_xrl(command, args, reply); - } catch (InvalidString& e) { - debug_msg("Invalid string - failed to dispatch %s\n", rbuf); - } - return XrlError(INTERNAL_ERROR, "corrupt xrl"); -} - -void -XrlPFSUDPListener::send_reply(struct sockaddr_storage* ss, - socklen_t ss_len, - const XrlError& e, - const XUID& xuid, - const XrlArgs* reply_args) -{ -#ifdef XRLPFSUDPPARANOIA - static XUID last("00000000-00000000-00000000-00000000"); - assert(last != xuid); - assert(last < xuid); - last = xuid; -#endif - - UNUSED(ss_len); // XXX: ss_len is used only under certain conditions - - string reply; - if (reply_args != 0) { - reply = reply_args->str(); - } - const string header = render_response(e, xuid, - static_cast(reply.size())); - - struct iovec v[2]; - v[0].iov_base = const_cast(header.c_str()); - v[0].iov_len = header.size(); - v[1].iov_base = const_cast(reply.c_str()); - v[1].iov_len = reply.size(); - - ssize_t v_bytes = v[0].iov_len + v[1].iov_len; - - if (v_bytes > SUDP_SEND_BUFFER_BYTES) { - XLOG_ERROR("Failed to send reply: message too large %d (max %d)", - XORP_INT_CAST(v_bytes), - XORP_INT_CAST(SUDP_SEND_BUFFER_BYTES)); - return; - } - - int err = 0; - bool is_error = false; - msghdr m; - memset(&m, 0, sizeof(m)); - m.msg_name = (caddr_t)ss; -#ifdef HAVE_STRUCT_SOCKADDR_STORAGE_SS_LEN - m.msg_namelen = ss->ss_len; -#else - m.msg_namelen = ss_len; -#endif - m.msg_iov = v; - m.msg_iovlen = sizeof(v) / sizeof(v[0]); - - if (v_bytes != sendmsg(_sock, &m, 0)) { - err = errno; - is_error = true; - } - - if (is_error) { - XLOG_ERROR("Failed to send reply (%d): %s", - err, comm_get_error_str(err)); - } -} - -bool -XrlPFSUDPListener::response_pending() const -{ - // Responses are immediate for UDP - return false; -} Deleted: trunk/xorp/libxipc/xrl_pf_sudp.hh =================================================================== --- trunk/xorp/libxipc/xrl_pf_sudp.hh 2009-12-03 23:10:07 UTC (rev 11665) +++ trunk/xorp/libxipc/xrl_pf_sudp.hh 2009-12-03 23:20:53 UTC (rev 11666) @@ -1,91 +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 Lesser General Public License, Version -// 2.1, June 1999 as published by the Free Software Foundation. -// Redistribution and/or modification of this program under the terms of -// any other version of the GNU Lesser 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 Lesser General Public License, Version 2.1, a copy of -// which can be found in the XORP LICENSE.lgpl file. -// -// XORP, Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA; -// http://xorp.net - -// $XORP: xorp/libxipc/xrl_pf_sudp.hh,v 1.26 2008/10/02 21:57:25 bms Exp $ - -#ifndef __LIBXIPC_XRL_PF_SUDP_HH__ -#define __LIBXIPC_XRL_PF_SUDP_HH__ - -#include "xrl_pf.hh" - -class XUID; - -// ---------------------------------------------------------------------------- -// XRL Protocol Family : Simplest UDP - -class XrlPFSUDPListener : public XrlPFListener { -public: - XrlPFSUDPListener(EventLoop& e, XrlDispatcher* xr = 0) - throw (XrlPFConstructorError); - ~XrlPFSUDPListener(); - - const char* address() const { return _addr.c_str(); } - const char* protocol() const { return _protocol; } - - bool response_pending() const; - -private: - const XrlError dispatch_command(const char* buf, XrlArgs& response); - - void send_reply(struct sockaddr_storage* ss, - socklen_t ss_len, - const XrlError& e, - const XUID& xuid, - const XrlArgs* response); - - void recv(XorpFd fd, IoEventType type); - - XorpFd _sock; - string _addr; - static const char* _protocol; -}; - -class XrlPFSUDPSender : public XrlPFSender { -public: - XrlPFSUDPSender(EventLoop& e, const char* address = NULL) - throw (XrlPFConstructorError); - virtual ~XrlPFSUDPSender(); - - bool send(const Xrl& x, - bool direct_call, - const XrlPFSender::SendCallback& cb); - - bool sends_pending() const; - - bool alive() const; - - const char* protocol() const; - - static const char* protocol_name() { return _protocol; } - -protected: - static void recv(XorpFd fd, IoEventType type); - void timeout_hook(XUID x); - -private: - struct sockaddr_in _destination; - - static const char* _protocol; - static XorpFd sender_sock; // shared fd between all senders - static int instance_count; -}; - -#endif // __LIBXIPC_XRL_PF_SUDP_HH__ Modified: trunk/xorp/libxipc/xrl_std_router.cc =================================================================== --- trunk/xorp/libxipc/xrl_std_router.cc 2009-12-03 23:10:07 UTC (rev 11665) +++ trunk/xorp/libxipc/xrl_std_router.cc 2009-12-03 23:20:53 UTC (rev 11666) @@ -23,9 +23,7 @@ #include "xrl_module.h" #include "xrl_std_router.hh" -//#include "xrl_pf_inproc.hh" // Inproc is deprecated. #include "xrl_pf_stcp.hh" -//#include "xrl_pf_sudp.hh" // UDP is deprecated. #include "xrl_pf_unix.hh" #include "libxorp/xlog.h" @@ -47,18 +45,10 @@ pf = default_pf; switch (pf[0]) { -#if 0 // Inproc is deprecated. - case 'i': - return new XrlPFInProcListener(_e, this); -#endif // For the benefit of bench_ipc.sh. case 't': return new XrlPFSTCPListener(_e, this); break; -#if 0 // UDP is deprecated. - case 'u': - return new XrlPFSUDPListener(_e, this); -#endif case 'x': #if XRL_PF != 'x' XLOG_ASSERT(_unix == NULL); Modified: trunk/xorp/rtrmgr/unexpanded_xrl.hh =================================================================== --- trunk/xorp/rtrmgr/unexpanded_xrl.hh 2009-12-03 23:10:07 UTC (rev 11665) +++ trunk/xorp/rtrmgr/unexpanded_xrl.hh 2009-12-03 23:20:53 UTC (rev 11666) @@ -24,7 +24,6 @@ #include "libxipc/xrl_router.hh" -#include "libxipc/xrl_pf_sudp.hh" class MasterConfigTreeNode; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 15:22:37 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 23:22:37 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11667] trunk/xorp/xrl/scripts/Xif Message-ID: Revision: 11667 http://xorp.svn.sourceforge.net/xorp/?rev=11667&view=rev Author: bms_fbsd Date: 2009-12-03 23:22:37 +0000 (Thu, 03 Dec 2009) Log Message: ----------- Add support for optional list<> type specifications to the syntax of the XIF IDL format. Obtained from: xorp-thrift branch Modified Paths: -------------- trunk/xorp/xrl/scripts/Xif/parse.py trunk/xorp/xrl/scripts/Xif/util.py trunk/xorp/xrl/scripts/Xif/xiftypes.py Modified: trunk/xorp/xrl/scripts/Xif/parse.py =================================================================== --- trunk/xorp/xrl/scripts/Xif/parse.py 2009-12-03 23:20:53 UTC (rev 11666) +++ trunk/xorp/xrl/scripts/Xif/parse.py 2009-12-03 23:22:37 UTC (rev 11667) @@ -1,7 +1,7 @@ # Python imports import string, re, sys from xiftypes import * -from util import quit +from util import quit, warn # XIF specific imports @@ -91,6 +91,7 @@ # arg format is [] # ^ ^ + # list types may *optionally* carry a member type hint. xrl_args = [] for t in toks: @@ -104,11 +105,27 @@ validate_name(file, lineno, "Atom", name, '_-') + lab = string.find(type, "<") + member_type = None + if lab != -1: + rab = string.find(type, ">") + if rab == -1: + quit(file, lineno, "Invalid type spec \"%s\"" % type) + member_type = type[lab + 1:rab] + type = type[:lab] + if xrl_atom_type.has_key(type) == 0: quit(file, lineno, "Atom type \"%s\" not amongst those known %s" % (type, xrl_atom_type.keys())) - xrl_args.append(XrlArg(name, type)) + xa = XrlArg(name, type) + if type == 'list': + # TODO: Force syntax check that member_type is present. + if xrl_atom_type.has_key(member_type) == 0: + warn(file, lineno, "Member atom type \"%s\" not amongst those known %s" % (member_type, xrl_atom_type.keys())) + xa.set_member_type(member_type) + + xrl_args.append(xa) return xrl_args """ Fill in any missing separators in Xrl to make parsing trivial""" Modified: trunk/xorp/xrl/scripts/Xif/util.py =================================================================== --- trunk/xorp/xrl/scripts/Xif/util.py 2009-12-03 23:20:53 UTC (rev 11666) +++ trunk/xorp/xrl/scripts/Xif/util.py 2009-12-03 23:22:37 UTC (rev 11667) @@ -4,9 +4,12 @@ # ----------------------------------------------------------------------------- # Utility methods and structures -def quit(file, lineno, reason): +def warn(file, lineno, reason): print "In Xrl starting at line %d in %s:" % (lineno, file) print "\t", reason + +def quit(file, lineno, reason): + warn(file, lineno, reason) sys.exit(1) def file_write_string(fname, data): Modified: trunk/xorp/xrl/scripts/Xif/xiftypes.py =================================================================== --- trunk/xorp/xrl/scripts/Xif/xiftypes.py 2009-12-03 23:20:53 UTC (rev 11666) +++ trunk/xorp/xrl/scripts/Xif/xiftypes.py 2009-12-03 23:22:37 UTC (rev 11667) @@ -20,6 +20,7 @@ self._name = name self._type = type self._note = annotation + self._member_type = None def name(self): return self._name def type(self): @@ -27,6 +28,11 @@ def cpp_type(self): tuple = xrl_atom_type[self._type] return tuple[0] + def set_member_type(self, member_type): + self._member_type = member_type + def member_type(self): + """If type is list, the type of the members embedded within.""" + return self._member_type def accessor(self): tuple = xrl_atom_type[self._type] return tuple[1] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 15:39:30 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 23:39:30 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11668] trunk/xorp/xrl/interfaces Message-ID: Revision: 11668 http://xorp.svn.sourceforge.net/xorp/?rev=11668&view=rev Author: bms_fbsd Date: 2009-12-03 23:39:30 +0000 (Thu, 03 Dec 2009) Log Message: ----------- Add explicit member type specifiers to all 'list' arguments/return values in XORP's XIF IDL definitions. This will later be used by Thrifted stub generation and translations. Implementation note: XrlAtomList is NOT a variant collection. It just happens to allow those semantics in certain circumstances. The XORP code base actually requires it holds a single type. Thrift collections are not variant containers, and require that their type be known upfront, therefore to make interworking possible, we need to make this explicit in XIF IDL. Obtained from: xorp-thrift branch Modified Paths: -------------- trunk/xorp/xrl/interfaces/fea_ifmgr.xif trunk/xorp/xrl/interfaces/fea_rawpkt6.xif trunk/xorp/xrl/interfaces/fea_rawpkt6_client.xif trunk/xorp/xrl/interfaces/finder.xif trunk/xorp/xrl/interfaces/olsr4.xif trunk/xorp/xrl/interfaces/ospfv2.xif trunk/xorp/xrl/interfaces/ospfv3.xif trunk/xorp/xrl/interfaces/pim.xif trunk/xorp/xrl/interfaces/policy_redist4.xif trunk/xorp/xrl/interfaces/policy_redist6.xif trunk/xorp/xrl/interfaces/rib.xif trunk/xorp/xrl/interfaces/rip.xif trunk/xorp/xrl/interfaces/ripng.xif trunk/xorp/xrl/interfaces/rtrmgr.xif trunk/xorp/xrl/interfaces/test_xrls.xif trunk/xorp/xrl/interfaces/vrrp.xif Modified: trunk/xorp/xrl/interfaces/fea_ifmgr.xif =================================================================== --- trunk/xorp/xrl/interfaces/fea_ifmgr.xif 2009-12-03 23:22:37 UTC (rev 11667) +++ trunk/xorp/xrl/interfaces/fea_ifmgr.xif 2009-12-03 23:39:30 UTC (rev 11668) @@ -7,9 +7,9 @@ interface ifmgr/0.1 { set_restore_original_config_on_shutdown ? enable:bool - get_configured_interface_names -> ifnames:list + get_configured_interface_names -> ifnames:list - get_configured_vif_names ? ifname:txt -> vifs:list + get_configured_vif_names ? ifname:txt -> vifs:list get_configured_vif_flags ? ifname:txt \ & vif:txt \ @@ -23,9 +23,11 @@ & vif:txt \ -> pif_index:u32 - get_configured_vif_addresses4 ? ifname:txt & vif:txt -> addresses:list + get_configured_vif_addresses4 ? ifname:txt & vif:txt \ + -> addresses:list - get_configured_vif_addresses6 ? ifname:txt & vif:txt -> addresses:list + get_configured_vif_addresses6 ? ifname:txt & vif:txt \ + -> addresses:list get_configured_address_flags4 ? ifname:txt \ & vif:txt \ Modified: trunk/xorp/xrl/interfaces/fea_rawpkt6.xif =================================================================== --- trunk/xorp/xrl/interfaces/fea_rawpkt6.xif 2009-12-03 23:22:37 UTC (rev 11667) +++ trunk/xorp/xrl/interfaces/fea_rawpkt6.xif 2009-12-03 23:39:30 UTC (rev 11668) @@ -42,8 +42,8 @@ & ip_tos:i32 \ & ip_router_alert:bool \ & ip_internet_control:bool \ - & ext_headers_type:list \ - & ext_headers_payload:list \ + & ext_headers_type:list \ + & ext_headers_payload:list \ & payload:binary /** Modified: trunk/xorp/xrl/interfaces/fea_rawpkt6_client.xif =================================================================== --- trunk/xorp/xrl/interfaces/fea_rawpkt6_client.xif 2009-12-03 23:22:37 UTC (rev 11667) +++ trunk/xorp/xrl/interfaces/fea_rawpkt6_client.xif 2009-12-03 23:39:30 UTC (rev 11668) @@ -38,7 +38,7 @@ & ip_tos:i32 \ & ip_router_alert:bool \ & ip_internet_control:bool \ - & ext_headers_type:list \ - & ext_headers_payload:list \ + & ext_headers_type:list \ + & ext_headers_payload:list \ & payload:binary } Modified: trunk/xorp/xrl/interfaces/finder.xif =================================================================== --- trunk/xorp/xrl/interfaces/finder.xif 2009-12-03 23:22:37 UTC (rev 11667) +++ trunk/xorp/xrl/interfaces/finder.xif 2009-12-03 23:39:30 UTC (rev 11668) @@ -52,39 +52,39 @@ /** * Resolve Xrl */ - resolve_xrl ? xrl:txt -> resolutions:list + resolve_xrl ? xrl:txt -> resolutions:list /** * Get list of registered Xrl targets */ - get_xrl_targets -> target_names:list + get_xrl_targets -> target_names:list /** * Get list of Xrls registered by target */ - get_xrls_registered_by ? target_name:txt -> xrls:list + get_xrls_registered_by ? target_name:txt -> xrls:list /** * Get list of IPv4 hosts that clients should accept IPC requests * from. */ - get_ipv4_permitted_hosts -> ipv4s:list + get_ipv4_permitted_hosts -> ipv4s:list /** * Get list of IPv4 nets that clients should accept IPC requests * from. */ - get_ipv4_permitted_nets -> ipv4nets:list + get_ipv4_permitted_nets -> ipv4nets:list /** * Get list of IPv6 hosts that clients should accept IPC requests * from. */ - get_ipv6_permitted_hosts -> ipv6s:list + get_ipv6_permitted_hosts -> ipv6s:list /** * Get list of IPv6 nets that clients should accept IPC requests * from. */ - get_ipv6_permitted_nets -> ipv6nets:list + get_ipv6_permitted_nets -> ipv6nets:list } Modified: trunk/xorp/xrl/interfaces/olsr4.xif =================================================================== --- trunk/xorp/xrl/interfaces/olsr4.xif 2009-12-03 23:22:37 UTC (rev 11667) +++ trunk/xorp/xrl/interfaces/olsr4.xif 2009-12-03 23:39:30 UTC (rev 11668) @@ -298,7 +298,7 @@ * Return a list of u32 type values. Each value is an internal * ID that can be used with the get_interface_info XRL. */ - get_interface_list -> interfaces:list + get_interface_list -> interfaces:list /** * Get the per-interface information for the given interface. @@ -369,7 +369,7 @@ * Return a list of u32 type values. Each value is an internal * ID that can be used with the get_link_info XRL. */ - get_link_list -> links:list + get_link_list -> links:list /** * Get the information for a one-hop link. @@ -405,7 +405,7 @@ * Return a list of u32 type values. Each value is an internal * ID that can be used with the get_neighbor_info XRL. */ - get_neighbor_list -> neighbors:list + get_neighbor_list -> neighbors:list /** * Get the information for a one-hop neighbor. @@ -444,7 +444,7 @@ * Return a list of u32 type values. Each value is an internal * ID that can be used with the get_twohop_link_info XRL. */ - get_twohop_link_list -> twohop_links:list + get_twohop_link_list -> twohop_links:list /** * Get the information for a two-hop link. @@ -472,7 +472,7 @@ * Return a list of u32 type values. Each value is an internal * ID that can be used with the get_twohop_neighbor_info XRL. */ - get_twohop_neighbor_list -> twohop_neighbors:list + get_twohop_neighbor_list -> twohop_neighbors:list /** * Get the information for a two-hop neighbor. @@ -503,7 +503,7 @@ * Return a list of u32 type values. Each value is an internal * ID that can be used with the get_mid_entry XRL. */ - get_mid_entry_list -> mid_entries:list + get_mid_entry_list -> mid_entries:list /** * Get the information contained in a MID entry. @@ -528,7 +528,7 @@ * Return a list of u32 type values. Each value is an internal * ID that can be used with the get_tc_entry XRL. */ - get_tc_entry_list -> tc_entries:list + get_tc_entry_list -> tc_entries:list /** * Get the information contained in a TC entry. @@ -555,7 +555,7 @@ * Return a list of u32 type values. Each value is an internal * ID that can be used with the get_hna_entry XRL. */ - get_hna_entry_list -> hna_entries:list + get_hna_entry_list -> hna_entries:list /** * Get the information contained in a HNA entry. Modified: trunk/xorp/xrl/interfaces/ospfv2.xif =================================================================== --- trunk/xorp/xrl/interfaces/ospfv2.xif 2009-12-03 23:22:37 UTC (rev 11667) +++ trunk/xorp/xrl/interfaces/ospfv2.xif 2009-12-03 23:39:30 UTC (rev 11668) @@ -328,7 +328,7 @@ * * Return a list of u32 type values. Each value is an area ID. */ - get_area_list -> areas:list + get_area_list -> areas:list /** * Get the list of neighbours. @@ -336,7 +336,7 @@ * Return a list of u32 type values. Each value is an internal * identifier that can be used with the get_neighbour_info XRL. */ - get_neighbour_list -> areas:list + get_neighbour_list -> areas:list /** * Get information on a neighbour. Modified: trunk/xorp/xrl/interfaces/ospfv3.xif =================================================================== --- trunk/xorp/xrl/interfaces/ospfv3.xif 2009-12-03 23:22:37 UTC (rev 11667) +++ trunk/xorp/xrl/interfaces/ospfv3.xif 2009-12-03 23:39:30 UTC (rev 11668) @@ -305,7 +305,7 @@ * * Return a list of u32 type values. Each value is an area ID. */ - get_area_list -> areas:list + get_area_list -> areas:list /** * Get the list of neighbours. @@ -313,7 +313,7 @@ * Return a list of u32 type values. Each value is an internal * identifier that can be used with the get_neighbour_info XRL. */ - get_neighbour_list -> areas:list + get_neighbour_list -> areas:list /** * Get information on a neighbour. Modified: trunk/xorp/xrl/interfaces/pim.xif =================================================================== --- trunk/xorp/xrl/interfaces/pim.xif 2009-12-03 23:22:37 UTC (rev 11667) +++ trunk/xorp/xrl/interfaces/pim.xif 2009-12-03 23:39:30 UTC (rev 11668) @@ -435,21 +435,21 @@ * of all neighbors (one number per neighbor). */ pimstat_neighbors4 -> nbrs_number:u32 \ - & vifs:list \ - & addresses:list \ - & pim_versions:list \ - & dr_priorities:list \ - & holdtimes:list \ - & timeouts:list \ - & uptimes:list + & vifs:list \ + & addresses:list \ + & pim_versions:list \ + & dr_priorities:list \ + & holdtimes:list \ + & timeouts:list \ + & uptimes:list pimstat_neighbors6 -> nbrs_number:u32 \ - & vifs:list \ - & addresses:list \ - & pim_versions:list \ - & dr_priorities:list \ - & holdtimes:list \ - & timeouts:list \ - & uptimes:list + & vifs:list \ + & addresses:list \ + & pim_versions:list \ + & dr_priorities:list \ + & holdtimes:list \ + & timeouts:list \ + & uptimes:list /** * Retrieve information about PIM interfaces. @@ -497,20 +497,20 @@ * there will be a number of entries for that RP: one per group prefix. */ pimstat_rps4 -> rps_number:u32 \ - & addresses:list \ - & types:list \ - & priorities:list \ - & holdtimes:list \ - & timeouts:list \ - & group_prefixes:list + & addresses:list \ + & types:list \ + & priorities:list \ + & holdtimes:list \ + & timeouts:list \ + & group_prefixes:list pimstat_rps6 -> rps_number:u32 \ - & addresses:list \ - & types:list \ - & priorities:list \ - & holdtimes:list \ - & timeouts:list \ - & group_prefixes:list + & addresses:list \ + & types:list \ + & priorities:list \ + & holdtimes:list \ + & timeouts:list \ + & group_prefixes:list /** * Clear all statistics Modified: trunk/xorp/xrl/interfaces/policy_redist4.xif =================================================================== --- trunk/xorp/xrl/interfaces/policy_redist4.xif 2009-12-03 23:22:37 UTC (rev 11667) +++ trunk/xorp/xrl/interfaces/policy_redist4.xif 2009-12-03 23:39:30 UTC (rev 11668) @@ -18,7 +18,7 @@ * @param policytags the set of policy-tags associated with the route. */ add_route4 ? network:ipv4net & unicast:bool & multicast:bool \ - & nexthop:ipv4 & metric:u32 & policytags:list + & nexthop:ipv4 & metric:u32 & policytags:list /** * Terminate route redistribution for an IPv4 route. Modified: trunk/xorp/xrl/interfaces/policy_redist6.xif =================================================================== --- trunk/xorp/xrl/interfaces/policy_redist6.xif 2009-12-03 23:22:37 UTC (rev 11667) +++ trunk/xorp/xrl/interfaces/policy_redist6.xif 2009-12-03 23:39:30 UTC (rev 11668) @@ -18,7 +18,7 @@ * @param policytags the set of policy-tags associated with the route. */ add_route6 ? network:ipv6net & unicast:bool & multicast:bool \ - & nexthop:ipv6 & metric:u32 & policytags:list + & nexthop:ipv6 & metric:u32 & policytags:list /** * Terminate route redistribution for an IPv6 route. Modified: trunk/xorp/xrl/interfaces/rib.xif =================================================================== --- trunk/xorp/xrl/interfaces/rib.xif 2009-12-03 23:22:37 UTC (rev 11667) +++ trunk/xorp/xrl/interfaces/rib.xif 2009-12-03 23:39:30 UTC (rev 11668) @@ -38,10 +38,10 @@ */ get_registered_protocols ? ipv4:bool & ipv6:bool \ & unicast:bool & multicast:bool \ - -> ipv4_unicast_protocols:list \ - & ipv6_unicast_protocols:list \ - & ipv4_multicast_protocols:list \ - & ipv6_multicast_protocols:list + -> ipv4_unicast_protocols:list \ + & ipv6_unicast_protocols:list \ + & ipv4_multicast_protocols:list \ + & ipv6_multicast_protocols:list /** * Add/delete an IGP or EGP table. @@ -98,19 +98,19 @@ */ add_route4 ? protocol:txt & unicast:bool & multicast:bool \ & network:ipv4net & nexthop:ipv4 & metric:u32 \ - & policytags:list + & policytags:list add_route6 ? protocol:txt & unicast:bool & multicast:bool \ & network:ipv6net & nexthop:ipv6 & metric:u32 \ - & policytags:list + & policytags:list replace_route4 ? protocol:txt & unicast:bool & multicast:bool \ & network:ipv4net & nexthop:ipv4 & metric:u32 \ - & policytags:list + & policytags:list replace_route6 ? protocol:txt & unicast:bool & multicast:bool \ & network:ipv6net & nexthop:ipv6 & metric:u32 \ - & policytags:list + & policytags:list delete_route4 ? protocol:txt & unicast:bool & multicast:bool \ & network:ipv4net @@ -139,25 +139,25 @@ & unicast:bool & multicast:bool \ & network:ipv4net & nexthop:ipv4 \ & ifname:txt & vifname:txt & metric:u32 \ - & policytags:list + & policytags:list add_interface_route6 ? protocol:txt \ & unicast:bool & multicast:bool \ & network:ipv6net & nexthop:ipv6 \ & ifname:txt & vifname:txt & metric:u32 \ - & policytags:list + & policytags:list replace_interface_route4 ? protocol:txt \ & unicast:bool & multicast:bool \ & network:ipv4net & nexthop:ipv4 \ & ifname:txt & vifname:txt & metric:u32 \ - & policytags:list + & policytags:list replace_interface_route6 ? protocol:txt \ & unicast:bool & multicast:bool \ & network:ipv6net & nexthop:ipv6 \ & ifname:txt & vifname:txt & metric:u32 \ - & policytags:list + & policytags:list /** * Lookup nexthop. @@ -539,7 +539,7 @@ * @param policytags The set of policytags of interest for the protocol. * */ - insert_policy_redist_tags ? protocol:txt & policytags:list + insert_policy_redist_tags ? protocol:txt & policytags:list /** * Reset the policy redistribution map. @@ -564,8 +564,8 @@ */ get_protocol_admin_distances ? ipv4:bool \ & unicast:bool \ - -> protocols:list \ - & admin_distances:list + -> protocols:list \ + & admin_distances:list /** * Get administrative distance for an individual protocol in Modified: trunk/xorp/xrl/interfaces/rip.xif =================================================================== --- trunk/xorp/xrl/interfaces/rip.xif 2009-12-03 23:22:37 UTC (rev 11667) +++ trunk/xorp/xrl/interfaces/rip.xif 2009-12-03 23:39:30 UTC (rev 11668) @@ -349,9 +349,9 @@ /** * Get addresses running RIP. */ - get_all_addresses -> ifnames:list \ - & vifnames:list \ - & addrs:list + get_all_addresses -> ifnames:list \ + & vifnames:list \ + & addrs:list /** * Get counters associated with interface / vif /address. @@ -359,8 +359,8 @@ get_counters ? ifname:txt \ & vifname:txt \ & addr:ipv4 \ - -> counter_descriptions:list \ - & counter_values:list + -> counter_descriptions:list \ + & counter_values:list /** * Get the list of peers associated with interface / vif / address. @@ -368,16 +368,16 @@ get_peers ? ifname:txt \ & vifname:txt \ & addr:ipv4 \ - -> peers:list + -> peers:list /** * Get list of all peers known to RIP. There is a 1-to-1 correspondence * between the items in the lists of peers, ifnames, vifnames, addrs. */ - get_all_peers -> peers:list \ - & ifnames:list \ - & vifnames:list \ - & addrs:list + get_all_peers -> peers:list \ + & ifnames:list \ + & vifnames:list \ + & addrs:list /** * Get counters associated with peer of interface / vif /address. @@ -390,8 +390,8 @@ & vifname:txt \ & addr:ipv4 \ & peer:ipv4 \ - -> counter_descriptions:list \ - & counter_values:list \ + -> counter_descriptions:list \ + & counter_values:list \ & peer_last_active:u32 /** Modified: trunk/xorp/xrl/interfaces/ripng.xif =================================================================== --- trunk/xorp/xrl/interfaces/ripng.xif 2009-12-03 23:22:37 UTC (rev 11667) +++ trunk/xorp/xrl/interfaces/ripng.xif 2009-12-03 23:39:30 UTC (rev 11668) @@ -294,9 +294,9 @@ /** * Get addresses running RIP. */ - get_all_addresses -> ifnames:list \ - & vifnames:list \ - & addrs:list + get_all_addresses -> ifnames:list \ + & vifnames:list \ + & addrs:list /** * Get counters associated with interface / vif /address. @@ -304,8 +304,8 @@ get_counters ? ifname:txt \ & vifname:txt \ & addr:ipv6 \ - -> counter_descriptions:list \ - & counter_values:list + -> counter_descriptions:list \ + & counter_values:list /** * Get the list of peers associated with interface / vif / address. @@ -313,16 +313,16 @@ get_peers ? ifname:txt \ & vifname:txt \ & addr:ipv6 \ - -> peers:list + -> peers:list /** * Get list of all peers known to RIP. There is a 1-to-1 correspondence * between the items in the lists of peers, ifnames, vifnames, addrs. */ - get_all_peers -> peers:list \ - & ifnames:list \ - & vifnames:list \ - & addrs:list + get_all_peers -> peers:list \ + & ifnames:list \ + & vifnames:list \ + & addrs:list /** * Get counters associated with peer of interface / vif /address. @@ -335,8 +335,8 @@ & vifname:txt \ & addr:ipv6 \ & peer:ipv6 \ - -> counter_descriptions:list \ - & counter_values:list \ + -> counter_descriptions:list \ + & counter_values:list \ & peer_last_active:u32 /** Modified: trunk/xorp/xrl/interfaces/rtrmgr.xif =================================================================== --- trunk/xorp/xrl/interfaces/rtrmgr.xif 2009-12-03 23:22:37 UTC (rev 11667) +++ trunk/xorp/xrl/interfaces/rtrmgr.xif 2009-12-03 23:39:30 UTC (rev 11668) @@ -23,7 +23,7 @@ leave_config_mode ? token:txt - get_config_users ? token:txt -> users:list + get_config_users ? token:txt -> users:list get_running_config ? token:txt -> ready:bool & config:txt Modified: trunk/xorp/xrl/interfaces/test_xrls.xif =================================================================== --- trunk/xorp/xrl/interfaces/test_xrls.xif 2009-12-03 23:22:37 UTC (rev 11667) +++ trunk/xorp/xrl/interfaces/test_xrls.xif 2009-12-03 23:39:30 UTC (rev 11668) @@ -27,5 +27,6 @@ & data8:txt \ & data9:binary - add_xrlX ? data:list + /* XXX: the list member type doesn't matter for this test. */ + add_xrlX ? data:list } Modified: trunk/xorp/xrl/interfaces/vrrp.xif =================================================================== --- trunk/xorp/xrl/interfaces/vrrp.xif 2009-12-03 23:22:37 UTC (rev 11667) +++ trunk/xorp/xrl/interfaces/vrrp.xif 2009-12-03 23:39:30 UTC (rev 11668) @@ -107,7 +107,7 @@ * * @param ifs a list of interface names (strings). */ - get_ifs -> ifs:list + get_ifs -> ifs:list /** * For a given physical interface, get the virtual interfaces on which VRRP @@ -117,7 +117,7 @@ * @param vifs a list of virtual interface names (strings). */ get_vifs ? ifname:txt \ - -> vifs:list + -> vifs:list /** * Get the virtual router IDs of all the VRRP instances running on a network @@ -129,7 +129,7 @@ */ get_vrids ? ifname:txt \ & vifname:txt \ - -> vrids:list + -> vrids:list /** * Get state information from a particular VRRP instance. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 15:45:55 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Thu, 03 Dec 2009 23:45:55 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11669] trunk/xorp/xrl/scripts/Xif/parse.py Message-ID: Revision: 11669 http://xorp.svn.sourceforge.net/xorp/?rev=11669&view=rev Author: bms_fbsd Date: 2009-12-03 23:45:55 +0000 (Thu, 03 Dec 2009) Log Message: ----------- Make the use of the name:list syntax mandatory in the XIF parser. XIF files must now fully declare the types embedded in any XrlAtomLists they instantiate. Obtained from: xorp-thrift branch Modified Paths: -------------- trunk/xorp/xrl/scripts/Xif/parse.py Modified: trunk/xorp/xrl/scripts/Xif/parse.py =================================================================== --- trunk/xorp/xrl/scripts/Xif/parse.py 2009-12-03 23:39:30 UTC (rev 11668) +++ trunk/xorp/xrl/scripts/Xif/parse.py 2009-12-03 23:45:55 UTC (rev 11669) @@ -105,6 +105,7 @@ validate_name(file, lineno, "Atom", name, '_-') + # Parse \<\> (\<\> are literal angle brackets). lab = string.find(type, "<") member_type = None if lab != -1: @@ -117,12 +118,12 @@ if xrl_atom_type.has_key(type) == 0: quit(file, lineno, "Atom type \"%s\" not amongst those known %s" % (type, xrl_atom_type.keys())) - xa = XrlArg(name, type) if type == 'list': - # TODO: Force syntax check that member_type is present. + # Deal with type of members embedded in the container. These + # are now mandatory for XIF in this branch. if xrl_atom_type.has_key(member_type) == 0: - warn(file, lineno, "Member atom type \"%s\" not amongst those known %s" % (member_type, xrl_atom_type.keys())) + quit(file, lineno, "Member atom type \"%s\" not amongst those known %s" % (member_type, xrl_atom_type.keys())) xa.set_member_type(member_type) xrl_args.append(xa) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 16:03:20 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Fri, 04 Dec 2009 00:03:20 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11670] trunk/xorp/xrl/scripts Message-ID: Revision: 11670 http://xorp.svn.sourceforge.net/xorp/?rev=11670&view=rev Author: bms_fbsd Date: 2009-12-04 00:03:20 +0000 (Fri, 04 Dec 2009) Log Message: ----------- Import the Thrift IDL translator. This script is able to parse XIF IDL files and generate an equivalent Thrift IDL file, which can later be used to communicate with XORP components using any language which Thrift supports. Note: This does not yet generate working Thrift code; this commit only imports the translator. Obtained from: xorp-thrift Modified Paths: -------------- trunk/xorp/xrl/scripts/Xif/parse.py trunk/xorp/xrl/scripts/Xif/util.py trunk/xorp/xrl/scripts/Xif/xiftypes.py Added Paths: ----------- trunk/xorp/xrl/scripts/Xif/thrifttypes.py trunk/xorp/xrl/scripts/thrift-gen Modified: trunk/xorp/xrl/scripts/Xif/parse.py =================================================================== --- trunk/xorp/xrl/scripts/Xif/parse.py 2009-12-03 23:45:55 UTC (rev 11669) +++ trunk/xorp/xrl/scripts/Xif/parse.py 2009-12-04 00:03:20 UTC (rev 11670) @@ -91,7 +91,7 @@ # arg format is [] # ^ ^ - # list types may *optionally* carry a member type hint. + # list types now *require* a member type hint list. xrl_args = [] for t in toks: Added: trunk/xorp/xrl/scripts/Xif/thrifttypes.py =================================================================== --- trunk/xorp/xrl/scripts/Xif/thrifttypes.py (rev 0) +++ trunk/xorp/xrl/scripts/Xif/thrifttypes.py 2009-12-04 00:03:20 UTC (rev 11670) @@ -0,0 +1,345 @@ +# vim:set sts=4 ts=8 sw=4: + +# in this namespace +from util import xorp_indent + +# ----------------------------------------------------------------------------- +# XIF to Thrift output generation functions +# ----------------------------------------------------------------------------- + +def send_bool(fname): + lines = [] + lines.append("nout += outp->writeBool(%s);" % fname) + return lines + +def send_i32(fname): + lines = [] + lines.append("nout += outp->writeI32(%s);" % fname) + return lines + +def send_u32(fname): + lines = [] + lines.append("nout += outp->writeI32(static_cast(%s));" % fname) + return lines + +def send_i64(fname): + lines = [] + lines.append("nout += outp->writeI64(%s);" % fname) + return lines + +def send_u64(fname): + lines = [] + lines.append("nout += outp->writeI64(static_cast(%s));" % fname) + return lines + +# XXX We need to preserve network endianness. Class IPv4 holds addr +# internally in network byte order, so we need to tell send_ipv4() +# to convert it to host-endian BEFORE passing it to Thrift, which +# will automatically convert it. +# The alternative is to marshal as a byte array, but I'd rather not +# do that because of buffer games. + +def send_ipv4(fname): + lines = [] + lines.append("nout += outp->writeI32(") + lines.append(" static_cast(ntohl(%s.addr())));" % fname) + return lines + +def send_ipv4net(fname, sname='ipv4net'): + lines = [] + lines.append("nout += outp->writeStructBegin(\"%s\");" % sname) + lines.append("nout += outp->writeFieldBegin(\"network\", T_I32, 1);") + lines.append("nout += outp->writeI32(ntohl(%s.masked_addr().addr()));" % \ + fname) + lines.append("nout += outp->writeFieldEnd();") + lines.append("nout += outp->writeFieldBegin(\"prefix\", T_BYTE, 2);") + lines.append("nout += outp->writeByte(%s.prefix_len());" % fname) + lines.append("nout += outp->writeFieldEnd();") + lines.append("nout += outp->writeFieldStop();") + lines.append("nout += outp->writeStructEnd();") + return lines + +def send_ipv6(fname, sname='ipv6', addrmethod='addr()'): + lines = [] + lines.append("nout += outp->writeStructBegin(\"%s\");" % sname) + lines.append("const uint32_t* pa_%s = %s.%s;" % \ + (fname, fname, addrmethod)) + for i in xrange(1,5): + lines.append(\ + "nout += outp->writeFieldBegin(\"addr32_%d\", T_I32, %d);" % \ + (i, i)) + lines.append("nout += outp->writeI32(pa_%s[%d]);" % \ + (fname, (i-1))) + lines.append("nout += outp->writeFieldEnd();") + lines.append("nout += outp->writeFieldStop();") + lines.append("nout += outp->writeStructEnd();") + return lines + +# struct of structs +def send_ipv6net(fname, sname='ipv6net'): + lines = [] + lines.append("nout += outp->writeStructBegin(\"%s\");" % sname) + lines.append("nout += outp->writeFieldBegin(\"network\", T_STRUCT, 1);") + tmp = send_ipv6(fname, addrmethod="masked_addr().addr()") + lines += tmp + lines.append("nout += outp->writeFieldEnd();") + lines.append("nout += outp->writeFieldBegin(\"prefix\", T_BYTE, 2);") + lines.append("nout += outp->writeByte(%s.prefix_len());" % fname) + lines.append("nout += outp->writeFieldEnd();") + lines.append("nout += outp->writeFieldStop();") + lines.append("nout += outp->writeStructEnd();") + return lines + +# Use the Mac::addr() accessor to marshal out the MAC address directly +# as binary. We need to cast to string(%s.addr(), %s.addr_bytelen()) +# before marshaling as Thrift T_STRING with writeBinary(), so another +# cast is needed. +# FIXME Eliminate string() temporary by overloading TProtocol::writeBinary(). +def send_mac(fname): + lines = [] + lines.append("nout += outp->writeBinary(string(reinterpret_cast(%s.addr()), Mac::ADDR_BYTELEN));" % fname) + return lines + +def send_txt(fname): + lines = [] + lines.append("nout += outp->writeString(%s);" % fname) + return lines + +# XXX: Thrift on-wire protocol uses T_STRING for binary data, +# however we need to call the writeBinary() method on the +# TProtocol instance. We don't use this as the default +# Thrift mapping, as 'binary' is a distinct type in the .thrift +# IDL syntax. +# FIXME Eliminate string() temporary by overloading TProtocol::writeBinary(). +def send_binary(fname): + lines = [] + lines.append("nout += outp->writeBinary(string(reinterpret_cast(&%s[0]), %s.size()));" % tuple([fname] * 2)) + return lines + +# ----------------------------------------------------------------------------- +# XIF to Thrift input generation functions +# ----------------------------------------------------------------------------- + +def recv_bool(fname): + lines = [] + lines.append("nin += inp->readBool(%s);" % fname) + return lines + +def recv_i32(fname): + lines = [] + lines.append("nin += inp->readI32(%s);" % fname) + return lines + +def recv_u32(fname): + lines = [] + lines.append("int32_t i32_%s;" % fname) + lines.append("nin += inp->readI32(i32_%s);" % fname) + lines.append("%s = static_cast(i32_%s);" % (fname, fname)) + return lines + +def recv_i64(fname): + lines = [] + lines.append("nin += inp->readI64(%s);" % fname) + return lines + +def recv_u64(fname): + lines = [] + lines.append("int64_t i64_%s;" % fname) + lines.append("nin += inp->readI64(i64_%s);" % fname) + lines.append("%s = static_cast(i64_%s);" % (fname, fname)) + return lines + +def recv_ipv4(fname): + lines = [] + lines.append("int32_t i32_%s;" % fname) + lines.append("nin += inp->readI32(i32_%s);" % fname) + lines.append("%s = IPv4(htonl(static_cast(i32_%s)));" % \ + (fname, fname)) + return lines + +# Shim these to support functions to handle embedded struct. + +def recv_ipv4net(fname): + lines = [] + lines.append("nin += xif_read_ipv4net(%s, inp);" % fname) + return lines + +def recv_ipv6(fname): + lines = [] + lines.append("nin += xif_read_ipv6(%s, inp);" % fname) + return lines + +def recv_ipv6net(fname): + lines = [] + lines.append("nin += xif_read_ipv6net(%s, inp);" % fname) + return lines + +# This is slightly inefficient as a bounce buffer is involved. +# Thrift binary reads expect to put input into a std::string, so +# rejig accordingly and do a temporary copy into our Mac class. +# Not much to do -- 6 bytes on stack. Nothing to worry about. Better +# than making Mac aware of Thrift. +def recv_mac(fname): + lines = [] + lines.append("string tmp_%s;" % fname) + lines.append("nin += inp->readBinary(tmp_%s);" % fname) + # XXX: We should sanity check the length of the binary data once read. + lines.append("//assert(tmp_%s.size() == Mac::ADDR_BYTELEN);" % fname) + lines.append("%s.copy_in(\n" % fname) + lines.append(" reinterpret_cast(tmp_%s.data()));" % \ + fname) + return lines + +def recv_txt(fname): + lines = [] + lines.append("nin += inp->readString(%s);" % fname) + return lines + +# XXX This is slightly inefficient as a bounce buffer is involved. +# Thrift readBinary() returns string; we end up bouncing a buffer +# by copying it here, which is likely inefficient. +# +# Future: As the XRL callbacks only see this as a const vector*, +# we can get away with using an adaptor of some kind on top of +# the string which Thrift expects. Either that or we modify TProtocol... +# Don't worry about this for now -- getting it all up is more important. +def recv_binary(fname): + lines = [] + lines.append("string tmp_%s;" % fname) + lines.append("nin += inp->readBinary(tmp_%s);" % fname) + lines.append("%s.resize(tmp_%s.size());" % (fname, fname)) + lines.append("memcpy(&%s[0], tmp_%s.data(), tmp_%s.size());" % \ + (fname, fname, fname)) + return lines + +# ----------------------------------------------------------------------------- + +xiftothrift = { + # atom_type: (thrift_wire_type, send_gen_fn, recv_gen_fn) + 'bool': ('T_BOOL', send_bool, recv_bool), + 'i32': ('T_I32', send_i32, recv_i32), + 'u32': ('T_I32', send_u32, recv_u32), + 'ipv4': ('T_I32', send_ipv4, recv_ipv4), + 'ipv4net': ('T_STRUCT', send_ipv4net, recv_ipv4net), + 'ipv6': ('T_STRUCT', send_ipv6, recv_ipv6), + 'ipv6net': ('T_STRUCT', send_ipv6net, recv_ipv6net), + 'mac': ('T_STRING', send_mac, recv_mac), + 'txt': ('T_STRING', send_txt, recv_txt), + 'list': ('T_LIST', None, None), # XXX recursive. + 'binary': ('T_STRING', send_binary, recv_binary), + 'i64': ('T_I64', send_i64, recv_i64), + 'u64': ('T_I64', send_u64, recv_u64), +} + +def wire_type(a): + return xiftothrift[a.type()][0] + +# ----------------------------------------------------------------------------- + +def send_arg(a, fname=None): + lines = [] + if fname is None: + fname = a.name() + if a.is_list(): + lines += send_list(a) + else: + lines += (xiftothrift[a.type()][1])(fname) + return lines + +def recv_arg(a, fname=None): + lines = [] + if fname is None: + fname = a.name() + if a.is_list(): + lines += recv_list(a, fname) + else: + lines += (xiftothrift[a.type()][2])(fname) + return lines + +# ----------------------------------------------------------------------------- + +# +# Marshal a Thrift list in as an XrlAtomList. +# TODO: sanity check mt_%s vs m.type()? +# +def recv_list(a, fname): + lines = [] + m = a.member() + + if a.member().is_list(): + print "Lists-of-lists are currently not implemented, sorry." + sys.exit(1) + + tab = xorp_indent(1) + lines.append("uint32_t sz_%s;" % fname) + lines.append("TType mt_%s;" % fname) + lines.append("nin += inp->readListBegin(mt_%s, sz_%s);" % \ + tuple([fname] * 2)) + lines.append("for (uint32_t i_%s = 0; i_%s < sz_%s; i_%s++) {" % \ + tuple([fname] * 4)) + + # Now read in base type. + mfname = "tmp_%s" % fname + lines.append(tab + "%s %s;" % (m.cpp_type(), mfname)) + + for l in recv_arg(m, mfname): + lines.append(tab + l) + + # now convert to XrlAtom and append to our collection in local scope. + lines.append(tab + ("%s.append(XrlAtom(tmp_%s));" % \ + tuple([fname] * 2))) + lines.append("}") + lines.append("nin += inp->readListEnd();") + return lines + +# +# Marshal an XrlAtomList out as a Thrift list. +# +# Earlier in this branch, we forced XrlAtomLists in XIF to have +# known member types -- this is how the code behaves, and we need +# the hint anyway to map Thrift types back between XIF types. +# +# XrlAtomLists are numbered [1..size()], not [0..size()). +# Thrift collection members are written out individually. +# If no elements are present, just write no members. +# Indent the if() / for() block marshal-out code. +# We'll assume the code has filled out the list w/o introducing +# any heterogenous members. If not, this generated shim will +# throw a WrongType exception in the XrlAtom code. +# +# XXX Special case. This requires the arg object as a parameter. +# +def send_list(a): + lines = [] + fname = a.name() + m = a.member() + + if a.member().is_list(): + print "Lists-of-lists are currently not implemented, sorry." + sys.exit(1) + + tab = xorp_indent(1) + tab2 = xorp_indent(2) + + lines.append("size_t sz_%s = %s.size();" % (fname, fname)) + lines.append("nout += outp->writeListBegin(%s, sz_%s);" % \ + (wire_type(m), fname)) + + lines.append("if (sz_%s > 0) {" % fname) + lines.append(tab + "for (size_t i_%s = 1; i_%s <= sz_%s; i_%s++) {" % \ + (fname, fname, fname, fname)) + lines.append(tab2 + "const XrlAtom& xa = %s.get(i_%s);" % \ + (fname, fname)) + mfname = "xa_%s" % m.type() # member field name with XIF type + lines.append(tab2 + "const %s& %s = xa.%s();" % \ + (m.cpp_type(), mfname, m.accessor())) + + # now marshal out the member type, indented at this level correctly. + for l in send_arg(m, mfname): + lines.append(tab2 + l) + + lines.append(tab + "}") # close for + lines.append("}") # close if + lines.append("nout += outp->writeListEnd();") # close thrift list + return lines + Modified: trunk/xorp/xrl/scripts/Xif/util.py =================================================================== --- trunk/xorp/xrl/scripts/Xif/util.py 2009-12-03 23:45:55 UTC (rev 11669) +++ trunk/xorp/xrl/scripts/Xif/util.py 2009-12-04 00:03:20 UTC (rev 11670) @@ -58,6 +58,18 @@ new_name += c return new_name +# Return service name given fully-qualified XRL name +def service_name_of_xrl(xrl_name): + lfs = xrl_name.find('/') + s = xrl_name[:lfs] + return s + +# Return method name given fully-qualified XRL name +def method_name_of_xrl(xrl_name): + rfs = xrl_name.rfind('/') + m = xrl_name[rfs+1:] + return m + # Capitalize proper names def proper(n): l = ' ' @@ -135,9 +147,11 @@ # Generate standard header gubbins def standard_preamble(is_header, filename): global g_source_files - s = \ """/* + * %s + * vim:set sts=4 ts=8 ft=cpp: + * * Copyright (c) 2001-2009 XORP, Inc. * See the XORP LICENSE.lgpl file for licensing, conditions, and warranties * on use. @@ -145,13 +159,12 @@ * DO NOT EDIT THIS FILE - IT IS PROGRAMMATICALLY GENERATED * * Generated by '%s'. -""" % sys.argv[0][sys.argv[0].rfind("/") + 1:] +""" % (filename, sys.argv[0][sys.argv[0].rfind("/") + 1:]) - xorp_cvs_id = get_xorp_cvs_id(filename) + #xorp_cvs_id = get_xorp_cvs_id(filename) + #if is_header: + # s += " *\n * %s\n" % xorp_cvs_id - if is_header: - s += " *\n * %s\n" % xorp_cvs_id - s += " */\n\n" #if is_header == 0: # s += "#ident \"%s\"\n\n" % xorp_cvs_id Modified: trunk/xorp/xrl/scripts/Xif/xiftypes.py =================================================================== --- trunk/xorp/xrl/scripts/Xif/xiftypes.py 2009-12-03 23:45:55 UTC (rev 11669) +++ trunk/xorp/xrl/scripts/Xif/xiftypes.py 2009-12-04 00:03:20 UTC (rev 11670) @@ -1,18 +1,18 @@ xrl_atom_type = { -# : (, ) - 'bool' : ('bool', 'boolean'), - 'i32' : ('int32_t', 'int32'), - 'u32' : ('uint32_t', 'uint32'), - 'ipv4' : ('IPv4', 'ipv4'), - 'ipv4net' : ('IPv4Net', 'ipv4net'), - 'ipv6' : ('IPv6', 'ipv6'), - 'ipv6net' : ('IPv6Net', 'ipv6net'), - 'mac' : ('Mac', 'mac'), - 'txt' : ('string', 'text'), - 'list' : ('XrlAtomList', 'list'), - 'binary' : ('vector', 'binary'), - 'i64' : ('int64_t', 'int64'), - 'u64' : ('uint64_t', 'uint64') +# : (, , ) + 'bool' : ('bool', 'boolean', 'bool'), + 'i32' : ('int32_t', 'int32', 'i32'), + 'u32' : ('uint32_t', 'uint32', 'i32'), + 'ipv4' : ('IPv4', 'ipv4', 'xorp.ipv4'), + 'ipv4net' : ('IPv4Net', 'ipv4net', 'xorp.ipv4net'), + 'ipv6' : ('IPv6', 'ipv6', 'xorp.ipv6'), + 'ipv6net' : ('IPv6Net', 'ipv6net', 'xorp.ipv6net'), + 'mac' : ('Mac', 'mac', 'binary'), + 'txt' : ('string', 'text', 'string'), + 'list' : ('XrlAtomList', 'list', 'list'), + 'binary' : ('vector', 'binary', 'binary'), + 'i64' : ('int64_t', 'int64', 'i64'), + 'u64' : ('uint64_t', 'uint64', 'i64') } class XrlArg: @@ -20,22 +20,37 @@ self._name = name self._type = type self._note = annotation - self._member_type = None + self._member_type = None # XXX THRIFT- + self._member = None # XXX THRIFT+ def name(self): return self._name def type(self): return self._type def cpp_type(self): - tuple = xrl_atom_type[self._type] + tuple = xrl_atom_type[self._type] return tuple[0] def set_member_type(self, member_type): - self._member_type = member_type + self._member_type = member_type # XXX THRIFT- + # XXX THRIFT+ + self._member = None + if member_type != None: + self._member = XrlArg("member", member_type) + # XXX THRIFT- def member_type(self): """If type is list, the type of the members embedded within.""" return self._member_type + # XXX THRIFT+ + def member(self): + return self._member + def is_list(self): + return self._type == 'list' def accessor(self): - tuple = xrl_atom_type[self._type] + tuple = xrl_atom_type[self._type] return tuple[1] + def thrift_idl_type(self): + """The type as expressed in the IDL.""" + tuple = xrl_atom_type[self._type] + return tuple[2] def set_annotation(self, annotation): self._note = annotation def annotation(self): @@ -77,6 +92,8 @@ def add_method(self, m): self._methods.append(m) +# XXX NOTE WELL: 'interfaces' is a list of string tuples, +# NOT a collection of XrlInterface objects. class XrlTarget: def __init__(self, name, version, sourcefile): self._name = name Added: trunk/xorp/xrl/scripts/thrift-gen =================================================================== --- trunk/xorp/xrl/scripts/thrift-gen (rev 0) +++ trunk/xorp/xrl/scripts/thrift-gen 2009-12-04 00:03:20 UTC (rev 11670) @@ -0,0 +1,160 @@ +#! /usr/bin/env python +# vim:set sts=4 ts=8 sw=4: + +"""Program to generate compatible Thrift service defintions from a Xif spec""" + +# +# XIF to Thrift Translator +# +# The XRL wrapper generators have been refactored to generate +# Thrift transport/protocol calls. They try to use the equivalent +# wire protocol generated by native Thrift stubs wherever possible. +# +# E.g. Thrift will always try to marshal an empty T_STRUCT even for +# methods declared void. It's up to the TProtocol implementation to +# marshal these more efficiently, or not. This exists so wire-level +# protocols which use textual marshaling (e.g. non-binary JSON, etc) +# can be supported using the same API layer cake. +# +# However, in order to call XORP processes natively from Thrift, +# we need to generate wrappers which match these semantics. This means +# bundling XIF return types (after the -> symbol) for each method into +# a Thrift struct {} declaration, and using that as the return type. +# +# As XORP code is refactored, or new XORP code is written to use emerging +# native Thrift async APIs, we can use these directly. Existing code which +# is synchronous can use the Thrift declarations produced by this generator. +# + +from optparse import OptionParser +import os, sys + +import Xif.util +from Xif.util import csv +from Xif.parse import XifParser + +# ----------------------------------------------------------------------------- +# Thrift IDL file output related +# ----------------------------------------------------------------------------- + +def prepare_thrift_file(thrift_file): + s = Xif.util.standard_preamble(1, thrift_file) + s += "namespace cpp xorp.ipc\n\n" + s += "include \"xorp.thrift\"\n\n" + return s + +def finish_thrift_file(thrift_file): + s = "" + return s + +def generate_result_structs(service_name, methods): + s = "" + for m in methods: + if len(m.rargs()) == 0: + continue + s += "struct %s_result {\n" % m.name() + i = 1 + m_rargs_list = [] + for a in m.rargs(): + t_idl_type = a.thrift_idl_type() + if a.is_list(): + t_idl_type += "<%s>" % a.member().thrift_idl_type() + m_rargs_list.append(" %d: %s %s" % (i, t_idl_type, a.name())) + i += 1 + s += csv(m_rargs_list, comma=',\n') + s += "\n}\n\n" + return s + +def generate_service(service_name, service_version, methods): + s = "/*\n * Based on Xif: %s/%s\n */\n" % (service_name, service_version) + s += "service %s {\n" % service_name + for m in methods: + m_ret = "void" + m_args = "" + if len(m.rargs()) > 0: + m_ret = "%s_result" % m.name() + if len(m.args()) > 0: + i = 1 + m_args_list = [] + for a in m.args(): + t_idl_type = a.thrift_idl_type() + if a.is_list(): + t_idl_type += "<%s>" % a.member().thrift_idl_type() + m_args_list.append("%d: %s %s" % (i, t_idl_type, a.name())) + i += 1 + m_args = csv(m_args_list, comma=', ') + s += " %s %s(%s),\n" % (m_ret, m.name(), m_args) + s += "}\n" + return s + +def main(): + usage = "usage: %prog [options] arg" + parser = OptionParser(usage) + parser.add_option("-o", "--output-dir", + action="store", + type="string", + dest="output_dir", + metavar="DIR") + parser.add_option("-I", + action="append", + type="string", + dest="includes", + metavar="DIR") + (options,args) = parser.parse_args() + + if len(args) != 1: + parser_error("incorrect number of arguments") + + # Command line arguments passed on to cpp + pipe_string = "cpp -C " + if options.includes: + for a in options.includes: + pipe_string += "-I%s " % a + pipe_string += args[0] + + cpp_pipe = os.popen(pipe_string, 'r') + + xp = XifParser(cpp_pipe) + + if len(xp.targets()): + print "Found targets (used a .ent rather than .xif input?)" + sys.exit(1) + + xifs = xp.interfaces() + if len(xifs) == 0: + print "No interface definitions provided" + sys.exit(1) + + # Check all interface definitions come from same source file. + # Although we've done the hard part (parsing), generating from + # here is still painful if we have to output multiple interface files. + sourcefile = xifs[0].sourcefile() + for xif in xifs: + if (xif.sourcefile() != sourcefile): + print "Multiple .xif files presented, expected one." + sys.exit(1) + + # basename transformation - this is a lame test + if sourcefile[-4:] != ".xif": + print "Source file does not end in .xif suffix - basename transform failure." + sys.exit(1) + + basename = sourcefile[:-4] + basename = basename[basename.rfind("/") + 1:] + + thrift_file = "%s.thrift" % basename + + if options.output_dir: + thrift_file = os.path.join(options.output_dir, thrift_file) + + thrift_txt = prepare_thrift_file(thrift_file) + for xif in xifs: + thrift_txt += generate_result_structs(xif.name(), xif.methods()) + for xif in xifs: + thrift_txt += generate_service(xif.name(), xif.version(), xif.methods()) + + thrift_txt += finish_thrift_file(thrift_file) + Xif.util.file_write_string(thrift_file, thrift_txt) + +if __name__ == '__main__': + main() Property changes on: trunk/xorp/xrl/scripts/thrift-gen ___________________________________________________________________ Added: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 16:04:53 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Fri, 04 Dec 2009 00:04:53 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11671] trunk/xorp/libxorp/mac.hh Message-ID: Revision: 11671 http://xorp.svn.sourceforge.net/xorp/?rev=11671&view=rev Author: bms_fbsd Date: 2009-12-04 00:04:53 +0000 (Fri, 04 Dec 2009) Log Message: ----------- Add a Mac::addr() accessor. Like IPv6::addr(), this allows direct access to Mac's internal representation. This change is required to marshal class Mac efficiently with Thrift. Obtained from: xorp-thrift Modified Paths: -------------- trunk/xorp/libxorp/mac.hh Modified: trunk/xorp/libxorp/mac.hh =================================================================== --- trunk/xorp/libxorp/mac.hh 2009-12-04 00:03:20 UTC (rev 11670) +++ trunk/xorp/libxorp/mac.hh 2009-12-04 00:04:53 UTC (rev 11671) @@ -166,6 +166,14 @@ string str() const; /** + * Get the raw value of this address. + * + * @return the value of this MAC address as a pointer to an array + * of unsigned bytes. + */ + const uint8_t* addr() const { return _addr; } + + /** * Get the size of the raw Mac address (in octets). * * @return the size of the raw Mac address (in octets). This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 16:46:18 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Fri, 04 Dec 2009 00:46:18 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11672] trunk/xorp/libxorp/backtrace.cc Message-ID: Revision: 11672 http://xorp.svn.sourceforge.net/xorp/?rev=11672&view=rev Author: bms_fbsd Date: 2009-12-04 00:46:18 +0000 (Fri, 04 Dec 2009) Log Message: ----------- Partially check in what I have for runtime backtrace support, but do not connect it to the build. Added Paths: ----------- trunk/xorp/libxorp/backtrace.cc Added: trunk/xorp/libxorp/backtrace.cc =================================================================== --- trunk/xorp/libxorp/backtrace.cc (rev 0) +++ trunk/xorp/libxorp/backtrace.cc 2009-12-04 00:46:18 UTC (rev 11672) @@ -0,0 +1,203 @@ +/* -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*- */ +/* vim:set sts=4 ts=8: */ + +/* + * Copyright (c) 2009 XORP, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License, Version + * 2.1, June 1999 as published by the Free Software Foundation. + * Redistribution and/or modification of this program under the terms of + * any other version of the GNU Lesser 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 Lesser General Public License, Version 2.1, a copy of + * which can be found in the XORP LICENSE.lgpl file. + * + * XORP, Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA; + * http://xorp.net + */ + +#include "xorp_config.h" + +#include "libxorp/xorp.h" +//#include "libxorp/debug.h" + +#include +#include + +#ifdef HAVE_EXECINFO_H +#include +#endif +#ifdef HAVE_CXXABI_H +#include +#endif + +/* + * Support for C/C++ symbolic backtraces, for runtime diagnostics. + * Intended for use in both debug and production builds. + */ +#ifdef DEBUG_BACKTRACE +static const char **_xorp_backtrace_alloc(); +static _xorp_backtrace_free(const char **data); +#endif + +/** + * @short Wrapper function for the platform's backtrace facilities, + * if present. + * @return pointer to an array of char*, allocated with malloc(). + */ +extern "C" +const char ** +xorp_backtrace_alloc() +{ +#ifdef DEBUG_BACKTRACE + return (_xorp_backtrace_alloc()); +#else + return (NULL); +#endif +} + +extern "C" +void +xorp_backtrace_free(const char **data) +{ +#ifdef DEBUG_BACKTRACE + return (_xorp_backtrace_free()); +#else + return (NULL); +#endif +} + +/** + * Back-end implementation of runtime backtrace facility. + * + * @return pointer to an array of char* containing each backtrace line. The + * storage must be freed with xorp_backtrace_free(). + * + * XXX MUST be exception safe, apart from std::bad_alloc. + * + * Implementation notes: + * Currently it is implemented using the GLIBC-compatible backtrace() + * and backtrace_symbols() functions. On GLIBC systems, these are part + * of the libc library. On BSD systems, these are part of libexecinfo, + * a third-party implementation. + * + * It is not guaranteed to produce correct results when the C/C++ runtime + * heap is corrupt, or when the stack is corrupt. + * + * The output of backtrace() is an array of C strings containing + * function names and offsets. It will try to resolve the return addresses + * on the stack to symbols, using dladdr(), which is arch-independent. + * In some situations this might require building all executables with + * '-rdynamic', to get meaningful backtraces from stripped binaries. + * + * It knows nothing about arguments or other stack frame entities. + * As most of the code here is C++, we need to post-process this output. + * This involves string processing, which in turn needs a working heap + * to store temporary allocations. + * + * FUTURE: This could be implemented using e.g. libunwind, libdwarf + * to produce richer output (e.g. using separate symbol files + * from the production shipping binaries, much like Microsoft's PDB format), + * and this might insulate us from heap corruption. + * + * The approach taken really needs to be similar to that of a last-change + * exception handler, to be useful in situations of catastrophic heap + * corruption. + * + * XXX use of vector or array is a boost::scoped_array candidate. + * But we're in C and ABI land here, so stick to C. + * One malloc here is bad enough if the heap is toasted. + * + */ +#ifdef DEBUG_BACKTRACE +static const int BACKTRACE_MAX = 128; + +static const char ** +_xorp_backtrace_alloc() +{ +#if defined(HAVE_BACKTRACE) && defined(HAVE_BACKTRACE_SYMBOLS) + int i, nentries; + void **entries, **final; + char **syms, **cp, **np; + + entries = calloc(BACKTRACE_MAX, sizeof(void *)); + assert(entries != NULL); + + nentries = backtrace(entries, BACKTRACE_MAX); + if (nentries == 0) { + free(entries); + return (NULL); + } + + // TODO skip first entry (it's this function). + // We'll probably get inlined, so don't skip both. + + syms = backtrace_symbols(entries, nentries); + assert(syms != NULL); + + /* Dispose of now-unused raw backtrace. */ + free(entries); + + /* + * The C string vector returned by backtrace_symbols() is + * allocated with malloc(), however, the symbol names themselves + * are usually owned by the dynamic linker, and SHOULD NOT be freed. + * + * However, as we need to rewrite these names for C++ demangling, + * and we'll be passing them around, we need to copy them. We also + * need to delimit the array, as the caller doesn't see 'nentries'. + * This allows us to have + * + * If the demangler is available from the C++ ABI, we do this + * piecemeal. Otherwise, we reallocate upfront. + * + * XXX The libexecinfo implementation produces different output + * than that of GLIBC. For now, let's produce consistent output, + * and parse what we get. + */ + final = calloc(nentries+1, sizeof(char *)); + assert(final != NULL); + +#ifdef HAVE___CXA_DEMANGLE + + for (i = 0; i < ) { + + } + +#else /* !HAVE___CXA_DEMANGLE */ + + // TODO: munge the args in each line. + for (i = 0, cp = syms, np = final; i < nentries; i++, cp++, final++) + final = strdup(*cp); + /* If out of heap space, all bets are off. */ + assert(*final != NULL); + } + *cp = NULL; + +#endif /* HAVE___CXA_DEMANGLE */ + + return (final); +#else /* ! (defined(HAVE_BACKTRACE) && defined(HAVE_BACKTRACE_SYMBOLS)) */ + + return (NULL); +#endif /* defined(HAVE_BACKTRACE) && defined(HAVE_BACKTRACE_SYMBOLS) */ +} + +// XXX: CONSTIFY + +static void +_xorp_backtrace_free(const char **data) +{ + char **cp; + + for (cp = (char **)data; cp != NULL; cp++) + free(*cp); + + free(data); +} +#endif /* DEBUG_BACKTRACE */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Thu Dec 3 16:51:04 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Fri, 04 Dec 2009 00:51:04 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11673] trunk/xorp/SConstruct Message-ID: Revision: 11673 http://xorp.svn.sourceforge.net/xorp/?rev=11673&view=rev Author: bms_fbsd Date: 2009-12-04 00:51:04 +0000 (Fri, 04 Dec 2009) Log Message: ----------- whitespace Modified Paths: -------------- trunk/xorp/SConstruct Modified: trunk/xorp/SConstruct =================================================================== --- trunk/xorp/SConstruct 2009-12-04 00:46:18 UTC (rev 11672) +++ trunk/xorp/SConstruct 2009-12-04 00:51:04 UTC (rev 11673) @@ -74,7 +74,7 @@ EnumVariable('profile', 'Build with profiling', 'no', allowed_values=('no', 'gprof', 'pprof', 'override'), map={}, ignorecase=2), - EnumVariable('transport', 'Set default XRL transport protocol', 'local', + EnumVariable('transport', 'Set default XRL transport protocol', 'local', allowed_values=('tcp', 'local'), map={}, ignorecase=2), PathVariable('prefix', 'Install prefix', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Fri Dec 4 04:37:11 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Fri, 04 Dec 2009 12:37:11 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11674] trunk/xorp/SConstruct Message-ID: Revision: 11674 http://xorp.svn.sourceforge.net/xorp/?rev=11674&view=rev Author: bms_fbsd Date: 2009-12-04 12:37:11 +0000 (Fri, 04 Dec 2009) Log Message: ----------- Check in a temporary workaround for pre-existing directories when building our RPATH symlink farm. The root cause of the error isn't certain as I have not been able to reproduce it with SCons 1.2.0_20090223 on FreeBSD 7.2. Requested by: Ben Greear Modified Paths: -------------- trunk/xorp/SConstruct Modified: trunk/xorp/SConstruct =================================================================== --- trunk/xorp/SConstruct 2009-12-04 00:51:04 UTC (rev 11673) +++ trunk/xorp/SConstruct 2009-12-04 12:37:11 UTC (rev 11674) @@ -208,6 +208,14 @@ SConsEnvironment.Chmod = SCons.Action.ActionFactory(os.chmod, lambda dest, mode: 'Chmod("%s", 0%o)' % (dest, mode)) +# XXX Temporary workaround. Ben Greear reports a problem with +# Mkdir() on Linux when the directory already exists. +def XMkdir(path): + if not os.access(path, os.F_OK): + os.makedirs(path) +SConsEnvironment.XMkdir = SCons.Action.ActionFactory(XMkdir, + lambda path: 'XMkdir("%s")' % (path)) + def Symlink(src, link_name): try: os.unlink(link_name) @@ -605,7 +613,7 @@ # $BUILDIR/lib will contain .so symlinks # xorp_alias_libdir = os.path.join(builddir, 'lib') - Execute(Mkdir(xorp_alias_libdir)) + Execute(XMkdir(xorp_alias_libdir)) env['xorp_alias_libdir'] = xorp_alias_libdir # # Build a further alias for the benefit of entities which @@ -614,7 +622,7 @@ # $BUILDIR/lib/xorp/lib will point to $BUILDIR/lib # xorp_alias_subdir = os.path.join(xorp_alias_libdir, 'xorp') - Execute(Mkdir(xorp_alias_subdir)) + Execute(XMkdir(xorp_alias_subdir)) # xorp_module_alias_libdir = os.path.join(xorp_alias_subdir, 'lib') Execute(env.Symlink(xorp_alias_libdir, xorp_module_alias_libdir)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Fri Dec 4 06:26:50 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Fri, 04 Dec 2009 14:26:50 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11675] trunk/xorp/SConstruct Message-ID: Revision: 11675 http://xorp.svn.sourceforge.net/xorp/?rev=11675&view=rev Author: bms_fbsd Date: 2009-12-04 14:26:50 +0000 (Fri, 04 Dec 2009) Log Message: ----------- Backout 11674, this seems to break my build: the XMkdir() wrapper complains about xorp_alias_libdir having NoneType. This makes no sense, because it's defined. Modified Paths: -------------- trunk/xorp/SConstruct Modified: trunk/xorp/SConstruct =================================================================== --- trunk/xorp/SConstruct 2009-12-04 12:37:11 UTC (rev 11674) +++ trunk/xorp/SConstruct 2009-12-04 14:26:50 UTC (rev 11675) @@ -208,14 +208,6 @@ SConsEnvironment.Chmod = SCons.Action.ActionFactory(os.chmod, lambda dest, mode: 'Chmod("%s", 0%o)' % (dest, mode)) -# XXX Temporary workaround. Ben Greear reports a problem with -# Mkdir() on Linux when the directory already exists. -def XMkdir(path): - if not os.access(path, os.F_OK): - os.makedirs(path) -SConsEnvironment.XMkdir = SCons.Action.ActionFactory(XMkdir, - lambda path: 'XMkdir("%s")' % (path)) - def Symlink(src, link_name): try: os.unlink(link_name) @@ -613,7 +605,7 @@ # $BUILDIR/lib will contain .so symlinks # xorp_alias_libdir = os.path.join(builddir, 'lib') - Execute(XMkdir(xorp_alias_libdir)) + Execute(Mkdir(xorp_alias_libdir)) env['xorp_alias_libdir'] = xorp_alias_libdir # # Build a further alias for the benefit of entities which @@ -622,7 +614,7 @@ # $BUILDIR/lib/xorp/lib will point to $BUILDIR/lib # xorp_alias_subdir = os.path.join(xorp_alias_libdir, 'xorp') - Execute(XMkdir(xorp_alias_subdir)) + Execute(Mkdir(xorp_alias_subdir)) # xorp_module_alias_libdir = os.path.join(xorp_alias_subdir, 'lib') Execute(env.Symlink(xorp_alias_libdir, xorp_module_alias_libdir)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Fri Dec 4 07:19:46 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Fri, 04 Dec 2009 15:19:46 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11676] trunk/xorp/rtrmgr/util.cc Message-ID: Revision: 11676 http://xorp.svn.sourceforge.net/xorp/?rev=11676&view=rev Author: bms_fbsd Date: 2009-12-04 15:19:46 +0000 (Fri, 04 Dec 2009) Log Message: ----------- Adjust router manager default paths to match FHS layout. Modified Paths: -------------- trunk/xorp/rtrmgr/util.cc Modified: trunk/xorp/rtrmgr/util.cc =================================================================== --- trunk/xorp/rtrmgr/util.cc 2009-12-04 14:26:50 UTC (rev 11675) +++ trunk/xorp/rtrmgr/util.cc 2009-12-04 15:19:46 UTC (rev 11676) @@ -117,7 +117,7 @@ if (xr != NULL) { s_bin_root = xr; s_cfg_root = xr; - s_boot_file = s_cfg_root + "/rtrmgr/xorp.conf"; + s_boot_file = s_cfg_root + "/etc/xorp.conf"; return; } @@ -145,7 +145,7 @@ string install_root = xorp_real_path(XORP_INSTALL_ROOT); s_bin_root = install_root; s_cfg_root = install_root; - s_boot_file = s_cfg_root + "/xorp.conf"; + s_boot_file = s_cfg_root + "/etc/xorp.conf"; debug_msg("s_bin_root: %s\n", s_bin_root.c_str()); debug_msg("s_cfg_root: %s\n", s_cfg_root.c_str()); @@ -167,13 +167,13 @@ string xorp_template_dir() { - return s_cfg_root + string("/etc/templates"); + return s_cfg_root + string("/share/xorp/templates"); } string xorp_xrl_targets_dir() { - return s_cfg_root + string("/xrl/targets"); + return s_cfg_root + string("/share/xorp/xrl/targets"); } string This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Fri Dec 4 07:27:20 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Fri, 04 Dec 2009 15:27:20 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11677] trunk/xorp Message-ID: Revision: 11677 http://xorp.svn.sourceforge.net/xorp/?rev=11677&view=rev Author: bms_fbsd Date: 2009-12-04 15:27:20 +0000 (Fri, 04 Dec 2009) Log Message: ----------- Backout r11664. The polymorphic_cast<> can fail on Router Manager startup, especially if we don't have a config yet. Introducing the casts needs piecemeal review. Modified Paths: -------------- trunk/xorp/bgp/next_hop_resolver.cc trunk/xorp/bgp/plumbing.cc trunk/xorp/cli/cli_node.cc trunk/xorp/fea/fibconfig_transaction.cc trunk/xorp/fea/firewall_transaction.cc trunk/xorp/libfeaclient/ifmgr_cmd_queue.cc trunk/xorp/libxorp/timer.cc trunk/xorp/ospf/area_router.cc trunk/xorp/ospf/auth.cc trunk/xorp/ospf/external.cc trunk/xorp/ospf/peer.cc trunk/xorp/pim/xrl_pim_node.cc trunk/xorp/rib/rib.cc trunk/xorp/rip/rip_varrw.cc trunk/xorp/rip/xrl_port_manager.cc trunk/xorp/rtrmgr/master_conf_tree.cc trunk/xorp/rtrmgr/master_conf_tree_node.cc trunk/xorp/rtrmgr/master_template_tree_node.cc trunk/xorp/rtrmgr/module_manager.cc trunk/xorp/rtrmgr/slave_conf_tree_node.cc Modified: trunk/xorp/bgp/next_hop_resolver.cc =================================================================== --- trunk/xorp/bgp/next_hop_resolver.cc 2009-12-04 15:19:46 UTC (rev 11676) +++ trunk/xorp/bgp/next_hop_resolver.cc 2009-12-04 15:27:20 UTC (rev 11677) @@ -38,10 +38,7 @@ #include "route_table_decision.hh" #include "profile_vars.hh" -#include -using boost::polymorphic_cast; - template NextHopResolver::NextHopResolver(XrlStdRouter *xrl_router, EventLoop& eventloop, @@ -1332,7 +1329,8 @@ //Check that this answer is for the question on the front of the queue XLOG_ASSERT(!_queue.empty()); RibDeregisterQueueEntry *rd = - polymorphic_cast *>(_queue.front()); + dynamic_cast *>(_queue.front()); + XLOG_ASSERT(rd != NULL); XLOG_ASSERT(addr == rd->base_addr()); XLOG_ASSERT(prefix_len == rd->prefix_len()); Modified: trunk/xorp/bgp/plumbing.cc =================================================================== --- trunk/xorp/bgp/plumbing.cc 2009-12-04 15:19:46 UTC (rev 11676) +++ trunk/xorp/bgp/plumbing.cc 2009-12-04 15:27:20 UTC (rev 11677) @@ -38,10 +38,7 @@ #include "profile_vars.hh" #include "dump_iterators.hh" -#include -using boost::polymorphic_cast; - BGPPlumbing::BGPPlumbing(const Safi safi, RibIpcHandler* ribhandler, AggregationHandler* aggrhandler, @@ -936,7 +933,8 @@ } debug_msg("type = %d", prevrt->type()); - FilterTable *filter_out = polymorphic_cast *>(prevrt); + FilterTable *filter_out = dynamic_cast *>(prevrt); + XLOG_ASSERT(filter_out != NULL); filter_out->set_parent(_fanout_table); _fanout_table->add_next_table(filter_out, peer_handler, rib_in->genid()); @@ -1033,7 +1031,8 @@ _fanout_table->dump_entire_table(filter_out, _master.safi(), ribname); DumpTable *dump_table = - polymorphic_cast *>(filter_out->parent()); + dynamic_cast *>(filter_out->parent()); + XLOG_ASSERT(dump_table); /* ** It is possible that another peer was in the middle of going Modified: trunk/xorp/cli/cli_node.cc =================================================================== --- trunk/xorp/cli/cli_node.cc 2009-12-04 15:19:46 UTC (rev 11676) +++ trunk/xorp/cli/cli_node.cc 2009-12-04 15:27:20 UTC (rev 11677) @@ -435,7 +435,6 @@ int CliNode::xlog_output(void *obj, xlog_level_t level, const char *msg) { - // XXX: Unchecked runtime cast of void pointer. CliClient *cli_client = static_cast(obj); int ret_value = cli_client->cli_print(msg); Modified: trunk/xorp/fea/fibconfig_transaction.cc =================================================================== --- trunk/xorp/fea/fibconfig_transaction.cc 2009-12-04 15:19:46 UTC (rev 11676) +++ trunk/xorp/fea/fibconfig_transaction.cc 2009-12-04 15:27:20 UTC (rev 11677) @@ -27,10 +27,7 @@ #include "fibconfig_transaction.hh" -#include -using boost::polymorphic_cast; - int FibConfigTransactionManager::set_error(const string& error) { @@ -73,7 +70,8 @@ return; const FibConfigTransactionOperation* fto; - fto = polymorphic_cast(&op); + fto = dynamic_cast(&op); + XLOG_ASSERT(fto != NULL); // // Record error and xlog first error only Modified: trunk/xorp/fea/firewall_transaction.cc =================================================================== --- trunk/xorp/fea/firewall_transaction.cc 2009-12-04 15:19:46 UTC (rev 11676) +++ trunk/xorp/fea/firewall_transaction.cc 2009-12-04 15:27:20 UTC (rev 11677) @@ -27,10 +27,6 @@ #include "firewall_transaction.hh" -#include - -using boost::polymorphic_cast; - void FirewallTransactionManager::pre_commit(uint32_t tid) { @@ -46,7 +42,8 @@ return; const FirewallTransactionOperation* fto; - fto = polymorphic_cast(&op); + fto = dynamic_cast(&op); + XLOG_ASSERT(fto != NULL); if (_first_error.empty()) { _first_error = c_format("Failed executing: \"%s\": %s", Modified: trunk/xorp/libfeaclient/ifmgr_cmd_queue.cc =================================================================== --- trunk/xorp/libfeaclient/ifmgr_cmd_queue.cc 2009-12-04 15:19:46 UTC (rev 11676) +++ trunk/xorp/libfeaclient/ifmgr_cmd_queue.cc 2009-12-04 15:27:20 UTC (rev 11677) @@ -31,10 +31,6 @@ #include "ifmgr_cmds.hh" #include "ifmgr_cmd_queue.hh" -#include - -using boost::polymorphic_cast; - // ---------------------------------------------------------------------------- // IfMgrCommandSinkBase @@ -131,8 +127,8 @@ void IfMgrCommandIfClusteringQueue::push(const Cmd& cmd) { - IfMgrIfCommandBase* ifcmd = - polymorphic_cast(cmd.get()); + IfMgrIfCommandBase* ifcmd = dynamic_cast(cmd.get()); + XLOG_ASSERT(ifcmd != NULL); if (ifcmd->ifname() == _current_ifname) { _current_cmds.push_back(cmd); } else { @@ -168,7 +164,8 @@ if (_current_cmds.empty() == false) { Cmd& c = _current_cmds.front(); IfMgrIfCommandBase* ifcmd = - polymorphic_cast(c.get()); + dynamic_cast(c.get()); + XLOG_ASSERT(ifcmd != NULL); _current_ifname = ifcmd->ifname(); _current_cmds.pop_front(); } @@ -189,8 +186,8 @@ {} bool operator() (IfMgrCommandIfClusteringQueue::Cmd c) { - IfMgrIfCommandBase* ifcmd = - polymorphic_cast(c.get()); + IfMgrIfCommandBase* ifcmd = dynamic_cast(c.get()); + XLOG_ASSERT(ifcmd != NULL); return ifcmd->ifname() == _ifname; } protected: @@ -209,7 +206,8 @@ // as new current interface. Cmd& c = _future_cmds.front(); IfMgrIfCommandBase* ifcmd = - polymorphic_cast(c.get()); + dynamic_cast(c.get()); + XLOG_ASSERT(ifcmd != NULL); _current_ifname = ifcmd->ifname(); back_insert_iterator bi(_current_cmds); remove_copy_if(_future_cmds.begin(), _future_cmds.end(), bi, Modified: trunk/xorp/libxorp/timer.cc =================================================================== --- trunk/xorp/libxorp/timer.cc 2009-12-04 15:19:46 UTC (rev 11676) +++ trunk/xorp/libxorp/timer.cc 2009-12-04 15:27:20 UTC (rev 11677) @@ -25,6 +25,9 @@ // // Copyright (c) 1999-2000 Massachusetts Institute of Technology + + + #include "libxorp_module.h" #include "xorp.h" @@ -32,8 +35,6 @@ #include "timer.hh" #include "clock.hh" -#include - // Implementation Notes: // // Event scheduling happens through the TimerList. The TimerList is @@ -407,7 +408,7 @@ tardiness.str().c_str()); } - TimerNode *t = boost::polymorphic_downcast(n->object); + TimerNode *t = static_cast(n->object); heap->pop(); // _hook() requires a XorpTimer as first argument, we have // only a timernode, so we have to create a temporary Modified: trunk/xorp/ospf/area_router.cc =================================================================== --- trunk/xorp/ospf/area_router.cc 2009-12-04 15:19:46 UTC (rev 11676) +++ trunk/xorp/ospf/area_router.cc 2009-12-04 15:27:20 UTC (rev 11677) @@ -41,8 +41,6 @@ #include #include -#include - #include "libproto/spt.hh" #include "ospf.hh" @@ -50,8 +48,6 @@ #include "vertex.hh" #include "area_router.hh" -using boost::polymorphic_cast; - template AreaRouter::AreaRouter(Ospf& ospf, OspfTypes::AreaID area, OspfTypes::AreaType area_type) @@ -374,7 +370,8 @@ { Vertex node = rc.node(); Lsa::LsaRef lsar = node.get_lsa(); - RouterLsa *rlsa = polymorphic_cast(lsar.get()); + RouterLsa *rlsa = dynamic_cast(lsar.get()); + XLOG_ASSERT(rlsa); OspfTypes::RouterID rid = rlsa->get_header().get_link_state_id(); // If this router ID is in the tmp set then it is already up, just @@ -434,7 +431,8 @@ list::iterator l = lsars.begin(); XLOG_ASSERT(l != lsars.end()); Lsa::LsaRef lsar = *l++; - RouterLsa *rlsa = polymorphic_cast(lsar.get()); + RouterLsa *rlsa = dynamic_cast(lsar.get()); + XLOG_ASSERT(rlsa); OspfTypes::RouterID rid = rlsa->get_header().get_advertising_router(); // If this router ID is in the tmp set then it is already up, just @@ -507,8 +505,6 @@ "Find interface address \nsrc:\n%s\ndst:\n%s\n", cstring(*src), cstring(*dst)); - // XXX: Candidates for polymorphic_cast, but used within - // logic below. RouterLsa *rlsa = dynamic_cast(src.get()); NetworkLsa *nlsa = dynamic_cast(src.get()); @@ -625,7 +621,8 @@ cstring(*lsa)); return false; } - LinkLsa *llsa = polymorphic_cast(lsa.get()); + LinkLsa *llsa = dynamic_cast(lsa.get()); + XLOG_ASSERT(llsa); interface = llsa->get_link_local_address(); return true; } @@ -1430,7 +1427,8 @@ Lsa::LsaRef AreaRouter::external_generate_type7(Lsa::LsaRef lsar, bool& indb) { - ASExternalLsa *aselsa = polymorphic_cast(lsar.get()); + ASExternalLsa *aselsa = dynamic_cast(lsar.get()); + XLOG_ASSERT(aselsa); OspfTypes::Version version = _ospf.get_version(); Type7Lsa *type7= new Type7Lsa(version); @@ -1489,7 +1487,8 @@ Lsa::LsaRef AreaRouter::external_generate_external(Lsa::LsaRef lsar) { - Type7Lsa *type7 = polymorphic_cast(lsar.get()); + Type7Lsa *type7 = dynamic_cast(lsar.get()); + XLOG_ASSERT(type7); OspfTypes::Version version = _ospf.get_version(); ASExternalLsa *aselsa= new ASExternalLsa(version); @@ -1817,7 +1816,8 @@ return false; } - NetworkLsa *nlsa = polymorphic_cast(_db[index].get()); + NetworkLsa *nlsa = dynamic_cast(_db[index].get()); + XLOG_ASSERT(nlsa); // If routers is empty this is a refresh. if (!routers.empty()) { @@ -1900,7 +1900,8 @@ AreaRouter::refresh_network_lsa(OspfTypes::PeerID peerid, Lsa::LsaRef lsar, bool timer) { - NetworkLsa *nlsa = polymorphic_cast(lsar.get()); + NetworkLsa *nlsa = dynamic_cast(lsar.get()); + XLOG_ASSERT(nlsa); XLOG_ASSERT(nlsa->valid()); uint32_t network_mask = 0; @@ -2126,7 +2127,8 @@ } IntraAreaPrefixLsa *iaplsa = - polymorphic_cast(_db[index].get()); + dynamic_cast(_db[index].get()); + XLOG_ASSERT(iaplsa); // If attached_routers is empty this is a refresh. if (!attached_routers.empty()) { @@ -3502,7 +3504,8 @@ Lsa::LsaRef lsar = _db[index]; IntraAreaPrefixLsa *iaplsa = - polymorphic_cast(lsar.get()); + dynamic_cast(lsar.get()); + XLOG_ASSERT(iaplsa); list& nprefixes = iaplsa->get_prefixes(); nprefixes.insert(nprefixes.begin(), prefixes.begin(), prefixes.end()); @@ -3520,7 +3523,8 @@ // the newly computed one then update the old one and publish. Lsa::LsaRef lsar = _db[index]; IntraAreaPrefixLsa *iaplsa = - polymorphic_cast(lsar.get()); + dynamic_cast(lsar.get()); + XLOG_ASSERT(iaplsa); list& oprefixes = iaplsa->get_prefixes(); list::iterator j, k; @@ -4039,7 +4043,8 @@ route_entry.set_area_border_router(rlsa->get_b_bit()); route_entry.set_as_boundary_router(rlsa->get_e_bit()); } else { - nlsa = polymorphic_cast(lsar.get()); + nlsa = dynamic_cast(lsar.get()); + XLOG_ASSERT(nlsa); // route_entry.set_router_id(nlsa->get_header(). // get_advertising_router()); route_entry.set_address(nlsa->get_header().get_link_state_id()); @@ -4340,7 +4345,8 @@ // route_entry); } } else { - NetworkLsa *nlsa = polymorphic_cast(lsar.get()); + NetworkLsa *nlsa = dynamic_cast(lsar.get()); + XLOG_ASSERT(nlsa); const list& lsai = lsa_temp_store.get_intra_area_prefix_lsas(node.get_nodeid()); if (!lsai.empty()) { Modified: trunk/xorp/ospf/auth.cc =================================================================== --- trunk/xorp/ospf/auth.cc 2009-12-04 15:19:46 UTC (rev 11676) +++ trunk/xorp/ospf/auth.cc 2009-12-04 15:27:20 UTC (rev 11677) @@ -36,8 +36,6 @@ #include "libxorp/eventloop.hh" #include "libproto/packet.hh" -#include - #include "ospf.hh" #include "auth.hh" @@ -803,8 +801,8 @@ if (plaintext_ah == NULL) { set_method(PlaintextAuthHandler::auth_type_name()); } - plaintext_ah = - boost::polymorphic_cast(_auth_handler); + plaintext_ah = dynamic_cast(_auth_handler); + XLOG_ASSERT(plaintext_ah != NULL); plaintext_ah->set_key(password); error_msg = ""; Modified: trunk/xorp/ospf/external.cc =================================================================== --- trunk/xorp/ospf/external.cc 2009-12-04 15:19:46 UTC (rev 11676) +++ trunk/xorp/ospf/external.cc 2009-12-04 15:27:20 UTC (rev 11677) @@ -38,8 +38,6 @@ #include #include -#include - #include "libproto/spt.hh" #include "ospf.hh" @@ -49,8 +47,6 @@ #include "external.hh" #include "policy_varrw.hh" -using boost::polymorphic_cast; - template External::External(Ospf& ospf, map *>& areas) @@ -130,9 +126,11 @@ Lsa::LsaRef lsar_in_db = *i; XLOG_ASSERT(lsar_in_db->get_self_originating()); - ASExternalLsa *aselsa = polymorphic_cast(lsar.get()); + ASExternalLsa *aselsa = dynamic_cast(lsar.get()); + XLOG_ASSERT(aselsa); ASExternalLsa *aselsa_in_db = - polymorphic_cast(lsar_in_db.get()); + dynamic_cast(lsar_in_db.get()); + XLOG_ASSERT(aselsa_in_db); if (aselsa->get_network_mask() == aselsa_in_db->get_network_mask()) return; @@ -183,7 +181,8 @@ Lsa::LsaRef lsar_in_db = *i; XLOG_ASSERT(lsar_in_db->get_self_originating()); ASExternalLsa *aselsa_in_db = - polymorphic_cast(lsar_in_db.get()); + dynamic_cast(lsar_in_db.get()); + XLOG_ASSERT(aselsa_in_db); IPv4 mask_in_db = IPv4(htonl(aselsa_in_db->get_network_mask())); // If the mask/prefix lengths match then the LSA has been found. if (mask_in_db.mask_len() == net.prefix_len()) @@ -456,7 +455,8 @@ RouteEntry rte; list::iterator i; for (i = _suppress_temp.begin(); i != _suppress_temp.end(); i++) { - ASExternalLsa *aselsa = polymorphic_cast((*i).get()); + ASExternalLsa *aselsa = dynamic_cast((*i).get()); + XLOG_ASSERT(aselsa); Lsa::LsaRef olsar = aselsa->get_suppressed_lsa(); aselsa->release_suppressed_lsa(); if (!rt.lookup_entry_by_advertising_router(area, @@ -523,7 +523,8 @@ { XLOG_ASSERT(olsar->get_self_originating()); - ASExternalLsa *olsa = polymorphic_cast(olsar.get()); + ASExternalLsa *olsa = dynamic_cast(olsar.get()); + XLOG_ASSERT(olsa); OspfTypes::Version version = _ospf.version(); ASExternalLsa *nlsa = new ASExternalLsa(version); @@ -640,7 +641,8 @@ void External::suppress_self(Lsa::LsaRef lsar) { - ASExternalLsa *aselsa = polymorphic_cast(lsar.get()); + ASExternalLsa *aselsa = dynamic_cast(lsar.get()); + XLOG_ASSERT(aselsa); // This may be a refresh of previously announce AS-external-LSA. bool suppressed = false; @@ -687,7 +689,8 @@ XLOG_ASSERT(lsar->external()); XLOG_ASSERT(!lsar->get_self_originating()); - ASExternalLsa *aselsa = polymorphic_cast(lsar.get()); + ASExternalLsa *aselsa = dynamic_cast(lsar.get()); + XLOG_ASSERT(aselsa); OspfTypes::Version version = _ospf.version(); @@ -710,7 +713,8 @@ if (0 == olsar.get()) return false; - ASExternalLsa *olsa = polymorphic_cast(olsar.get()); + ASExternalLsa *olsa = dynamic_cast(olsar.get()); + XLOG_ASSERT(olsa); switch(version) { case OspfTypes::V2: Modified: trunk/xorp/ospf/peer.cc =================================================================== --- trunk/xorp/ospf/peer.cc 2009-12-04 15:19:46 UTC (rev 11676) +++ trunk/xorp/ospf/peer.cc 2009-12-04 15:27:20 UTC (rev 11677) @@ -1221,7 +1221,6 @@ LinkStateUpdatePacket *lsup; LinkStateAcknowledgementPacket *lsap; - // XXX: Candidate for a packet_type() template function. if (0 != (hello = dynamic_cast(packet))) { return process_hello_packet(dst, src, hello); } else if(0 != (dd = dynamic_cast(packet))) { Modified: trunk/xorp/pim/xrl_pim_node.cc =================================================================== --- trunk/xorp/pim/xrl_pim_node.cc 2009-12-04 15:19:46 UTC (rev 11676) +++ trunk/xorp/pim/xrl_pim_node.cc 2009-12-04 15:27:20 UTC (rev 11677) @@ -34,10 +34,6 @@ #include "pim_vif.hh" #include "xrl_pim_node.hh" -#include - -using boost::polymorphic_cast; - const TimeVal XrlPimNode::RETRY_TIMEVAL = TimeVal(1, 0); // @@ -415,7 +411,8 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); RegisterUnregisterInterest* entry; - entry = polymorphic_cast(xrl_task_base); + entry = dynamic_cast(xrl_task_base); + XLOG_ASSERT(entry != NULL); if (entry->is_register()) { // Register interest @@ -449,7 +446,8 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); RegisterUnregisterInterest* entry; - entry = polymorphic_cast(xrl_task_base); + entry = dynamic_cast(xrl_task_base); + XLOG_ASSERT(entry != NULL); switch (xrl_error.error_code()) { case OKAY: @@ -1030,7 +1028,8 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); RegisterUnregisterReceiver* entry; - entry = polymorphic_cast(xrl_task_base); + entry = dynamic_cast(xrl_task_base); + XLOG_ASSERT(entry != NULL); // // Check whether we have already registered with the FEA @@ -1118,7 +1117,8 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); RegisterUnregisterReceiver* entry; - entry = polymorphic_cast(xrl_task_base); + entry = dynamic_cast(xrl_task_base); + XLOG_ASSERT(entry != NULL); switch (xrl_error.error_code()) { case OKAY: @@ -1222,7 +1222,8 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); RegisterUnregisterProtocol* entry; - entry = polymorphic_cast(xrl_task_base); + entry = dynamic_cast(xrl_task_base); + XLOG_ASSERT(entry != NULL); // // Check whether we have already registered with the MFEA @@ -1306,7 +1307,8 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); RegisterUnregisterProtocol* entry; - entry = polymorphic_cast(xrl_task_base); + entry = dynamic_cast(xrl_task_base); + XLOG_ASSERT(entry != NULL); switch (xrl_error.error_code()) { case OKAY: @@ -1410,7 +1412,8 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); JoinLeaveMulticastGroup* entry; - entry = polymorphic_cast(xrl_task_base); + entry = dynamic_cast(xrl_task_base); + XLOG_ASSERT(entry != NULL); // // Check whether we have already registered with the FEA @@ -1499,7 +1502,8 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); JoinLeaveMulticastGroup* entry; - entry = polymorphic_cast(xrl_task_base); + entry = dynamic_cast(xrl_task_base); + XLOG_ASSERT(entry != NULL); switch (xrl_error.error_code()) { case OKAY: @@ -1599,7 +1603,8 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); AddDeleteMfc* entry; - entry = polymorphic_cast(xrl_task_base); + entry = dynamic_cast(xrl_task_base); + XLOG_ASSERT(entry != NULL); size_t max_vifs_oiflist = entry->olist().size(); const IPvX& source_addr = entry->source_addr(); @@ -1700,7 +1705,8 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); AddDeleteMfc* entry; - entry = polymorphic_cast(xrl_task_base); + entry = dynamic_cast(xrl_task_base); + XLOG_ASSERT(entry != NULL); switch (xrl_error.error_code()) { case OKAY: @@ -1837,7 +1843,8 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); AddDeleteDataflowMonitor* entry; - entry = polymorphic_cast(xrl_task_base); + entry = dynamic_cast(xrl_task_base); + XLOG_ASSERT(entry != NULL); // // Check whether we have already registered with the MFEA @@ -1974,7 +1981,8 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); AddDeleteDataflowMonitor* entry; - entry = polymorphic_cast(xrl_task_base); + entry = dynamic_cast(xrl_task_base); + XLOG_ASSERT(entry != NULL); switch (xrl_error.error_code()) { case OKAY: @@ -2342,7 +2350,8 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); SendProtocolMessage* entry; - entry = polymorphic_cast(xrl_task_base); + entry = dynamic_cast(xrl_task_base); + XLOG_ASSERT(entry != NULL); // // Check whether we have already registered with the FEA @@ -2423,7 +2432,8 @@ XrlTaskBase* xrl_task_base = _xrl_tasks_queue.front(); SendProtocolMessage* entry; - entry = polymorphic_cast(xrl_task_base); + entry = dynamic_cast(xrl_task_base); + XLOG_ASSERT(entry != NULL); switch (xrl_error.error_code()) { case OKAY: Modified: trunk/xorp/rib/rib.cc =================================================================== --- trunk/xorp/rib/rib.cc 2009-12-04 15:19:46 UTC (rev 11676) +++ trunk/xorp/rib/rib.cc 2009-12-04 15:27:20 UTC (rev 11677) @@ -31,9 +31,7 @@ #include "rib_manager.hh" #include "rib.hh" -#include - // ---------------------------------------------------------------------------- // Inline table utility methods @@ -47,7 +45,6 @@ const string& _n; }; -// XXX: Unused template function. template struct table_has_name_and_type { table_has_name_and_type(const string& name) : _n(name) {} @@ -137,7 +134,6 @@ { map::iterator mi = _admin_distances.find(protocol_name); if (mi != _admin_distances.end()) { - // XXX: Candidate for a table_has_type() template function. OriginTable* ot = dynamic_cast* >(find_table(protocol_name)); if (NULL != ot) { @@ -776,7 +772,6 @@ } } - // XXX: Candidate for a table_has_type() template function. OriginTable* ot = dynamic_cast* >(rt); if (ot == NULL) { if (_errors_are_fatal) { @@ -890,7 +885,6 @@ if (NULL == rt) return XORP_ERROR; // Table does not exist - // XXX: Candidate for a table_has_type() template function. OriginTable* ot = dynamic_cast* >(rt); if (NULL == ot) return XORP_ERROR; // Table is not an origin table @@ -915,7 +909,6 @@ if (NULL == rt) return XORP_ERROR; // Table does not exist - // XXX: Candidate for a table_has_type() template function. OriginTable* ot = dynamic_cast* >(rt); if (NULL == ot) return XORP_ERROR; // Table is not an origin table @@ -1060,8 +1053,7 @@ return A::ZERO(); #else // Default: Assume the route points to a resolved IPNextHop. - IPNextHop* route_nexthop = - boost::polymorphic_downcast* >(re->nexthop()); + IPNextHop* route_nexthop = static_cast* >(re->nexthop()); return route_nexthop->addr(); #endif } @@ -1093,8 +1085,6 @@ RedistTable* RIB::protocol_redist_table(const string& protocol) { - // XXX: Candidate for a polymorphic_cast, but our callers check - // for the 0 return value. RouteTable* rt = find_table(redist_tablename(protocol)); if (rt != NULL) { return dynamic_cast*>(rt); @@ -1242,7 +1232,6 @@ // Check if table exists and check type if so RouteTable* rt = find_table(tablename); if (rt != NULL) { - // XXX: Candidate for a table_has_type() template function. OriginTable* ot = dynamic_cast* >(rt); if (ot == NULL) { XLOG_ERROR("add_origin_table: table \"%s\" already exists, but is " @@ -1275,10 +1264,7 @@ return XORP_ERROR; } - // XXX: Unchecked upcast from RouteTable to OriginTable. - OriginTable* new_table = - boost::polymorphic_downcast* >(find_table(tablename)); - + OriginTable* new_table = static_cast* >(find_table(tablename)); // XXX: the table was created by new_origin_table() above, so it must exist XLOG_ASSERT(new_table != NULL); if (_final_table == new_table) { @@ -1319,7 +1305,6 @@ continue; } - // XXX: Candidate for a table_has_type() template function. OriginTable* ot = dynamic_cast* >(current); if (ot != NULL) { if (ot->protocol_type() == IGP) { @@ -1474,7 +1459,6 @@ const string& target_class, const string& target_instance) { - // XXX: Candidate for a table_has_type() template function. OriginTable* ot = dynamic_cast* >(find_table(tablename)); if (NULL == ot) return XORP_ERROR; @@ -1612,8 +1596,8 @@ RouteTable* rt = find_table(PolicyConnectedTable::table_name); XLOG_ASSERT(rt != NULL); - PolicyConnectedTable* pct = - boost::polymorphic_cast*>(rt); + PolicyConnectedTable* pct = dynamic_cast*>(rt); + XLOG_ASSERT(pct != NULL); pct->push_routes(); } Modified: trunk/xorp/rip/rip_varrw.cc =================================================================== --- trunk/xorp/rip/rip_varrw.cc 2009-12-04 15:19:46 UTC (rev 11676) +++ trunk/xorp/rip/rip_varrw.cc 2009-12-04 15:27:20 UTC (rev 11677) @@ -26,8 +26,6 @@ #include "policy/common/policy_utils.hh" #include "rip_varrw.hh" -#include - template RIPVarRW::RIPVarRW(RouteEntry& route) : _route(route) @@ -46,7 +44,6 @@ // XXX which tag wins? Element* element = _route.policytags().element_tag(); - ElemU32* e = dynamic_cast(element); if (e != NULL && e->val()) _route.set_tag(e->val()); @@ -77,17 +74,21 @@ if (write_nexthop(id, e)) return; - const ElemU32* u32 = 0; + const ElemU32* u32 = NULL; if (e.type() == ElemU32::id) { - u32 = boost::polymorphic_cast(&e); + u32 = dynamic_cast(&e); + XLOG_ASSERT(u32 != NULL); } if (id == VAR_METRIC) { + XLOG_ASSERT(u32 != NULL); + _route.set_cost(u32->val()); return; } + if (id == VAR_TAG) { + XLOG_ASSERT(u32 != NULL); - if (id == VAR_TAG) { _route.set_tag(u32->val()); _route.policytags().set_tag(e); return; @@ -101,9 +102,10 @@ RIPVarRW::write_nexthop(const Id& id, const Element& e) { if (id == VAR_NEXTHOP4 && e.type() == ElemIPv4NextHop::id) { - const ElemIPv4NextHop* v4 = - boost::polymorphic_cast(&e); + const ElemIPv4NextHop* v4 = dynamic_cast(&e); + XLOG_ASSERT(v4 != NULL); + IPv4 nh(v4->val()); _route.set_nexthop(nh); @@ -132,9 +134,10 @@ RIPVarRW::write_nexthop(const Id& id, const Element& e) { if (id == VAR_NEXTHOP6 && e.type() == ElemIPv6NextHop::id) { - const ElemIPv6NextHop* v6 = - boost::polymorphic_cast(&e); + const ElemIPv6NextHop* v6 = dynamic_cast(&e); + XLOG_ASSERT(v6 != NULL); + IPv6 nh(v6->val()); _route.set_nexthop(nh); Modified: trunk/xorp/rip/xrl_port_manager.cc =================================================================== --- trunk/xorp/rip/xrl_port_manager.cc 2009-12-04 15:19:46 UTC (rev 11676) +++ trunk/xorp/rip/xrl_port_manager.cc 2009-12-04 15:27:20 UTC (rev 11677) @@ -548,7 +548,6 @@ return; } Port* p = (*pi); - // XXX: Downcast result used as a loop control variable. xio = dynamic_cast*>(p->io_handler()); pi++; } Modified: trunk/xorp/rtrmgr/master_conf_tree.cc =================================================================== --- trunk/xorp/rtrmgr/master_conf_tree.cc 2009-12-04 15:19:46 UTC (rev 11676) +++ trunk/xorp/rtrmgr/master_conf_tree.cc 2009-12-04 15:27:20 UTC (rev 11677) @@ -275,8 +275,6 @@ uid_t user_id, bool verbose) { MasterConfigTreeNode *ctn, *parent; - - // BOOST: Conditional downcast means polymorphic casts can't be used. parent = dynamic_cast(parent_node); if (parent_node != NULL) XLOG_ASSERT(parent != NULL); Modified: trunk/xorp/rtrmgr/master_conf_tree_node.cc =================================================================== --- trunk/xorp/rtrmgr/master_conf_tree_node.cc 2009-12-04 15:19:46 UTC (rev 11676) +++ trunk/xorp/rtrmgr/master_conf_tree_node.cc 2009-12-04 15:27:20 UTC (rev 11677) @@ -26,8 +26,6 @@ #include "libxorp/xlog.h" #include "libxorp/debug.h" -#include - #include "command_tree.hh" #include "master_conf_tree_node.hh" #include "module_command.hh" @@ -81,10 +79,9 @@ { UNUSED(clientid); MasterConfigTreeNode *new_node, *parent; + parent = dynamic_cast(parent_node); // sanity check - all nodes in this tree should be Master nodes - // BOOST: Conditional downcast means polymorphic casts can't be used. - parent = dynamic_cast(parent_node); if (parent_node != NULL) XLOG_ASSERT(parent != NULL); @@ -99,7 +96,8 @@ const MasterConfigTreeNode *orig; // sanity check - all nodes in this tree should be Master nodes - orig = boost::polymorphic_cast(&ctn); + orig = dynamic_cast(&ctn); + XLOG_ASSERT(orig != NULL); new_node = new MasterConfigTreeNode(*orig); return new_node; @@ -451,8 +449,8 @@ const AllowCommand* allow_cmd; debug_msg("found ALLOW command: %s\n", cmd->str().c_str()); - allow_cmd = - boost::polymorphic_cast(base_cmd); + allow_cmd = dynamic_cast(base_cmd); + XLOG_ASSERT(allow_cmd != NULL); if (allow_cmd->verify_variables(*this, error_msg) != true) { // @@ -490,8 +488,8 @@ const AllowCommand* allow_cmd; debug_msg("found ALLOW command: %s\n", cmd->str().c_str()); - allow_cmd = - boost::polymorphic_cast(base_cmd); + allow_cmd = dynamic_cast(base_cmd); + XLOG_ASSERT(allow_cmd != NULL); if (allow_cmd->verify_variables(*this, error_msg) != true) { error_msg = c_format("Bad operator for \"%s\": %s; ", Modified: trunk/xorp/rtrmgr/master_template_tree_node.cc =================================================================== --- trunk/xorp/rtrmgr/master_template_tree_node.cc 2009-12-04 15:19:46 UTC (rev 11676) +++ trunk/xorp/rtrmgr/master_template_tree_node.cc 2009-12-04 15:27:20 UTC (rev 11677) @@ -37,10 +37,7 @@ #include "master_template_tree_node.hh" #include "util.hh" -#include -using boost::polymorphic_cast; - void MasterTemplateTreeNode::add_cmd(const string& cmd, TemplateTree& tt) throw (ParseError) @@ -86,8 +83,8 @@ iter = _cmd_map.find("%modinfo"); XLOG_ASSERT(iter != _cmd_map.end()); command = iter->second; - ModuleCommand* module_command = - polymorphic_cast(command); + ModuleCommand* module_command = dynamic_cast(command); + XLOG_ASSERT(module_command != NULL); module_command->add_action(action_list, xrldb); } else if ((cmd == "%create") || (cmd == "%activate") @@ -119,8 +116,8 @@ cmd_iter = _cmd_map.find("%modinfo"); if (cmd_iter != _cmd_map.end()) { BaseCommand* command = cmd_iter->second; - ModuleCommand* module_command = - polymorphic_cast(command); + ModuleCommand* module_command = dynamic_cast(command); + XLOG_ASSERT(module_command != NULL); if (module_command->expand_actions(error_msg) != true) return (false); } @@ -143,7 +140,7 @@ list::iterator iter2; for (iter2 = _children.begin(); iter2 != _children.end(); ++iter2) { MasterTemplateTreeNode* mttn; - mttn = polymorphic_cast(*iter2); + mttn = static_cast(*iter2); if (mttn->expand_master_template_tree(error_msg) != true) return false; } @@ -163,7 +160,8 @@ if (cmd_iter != _cmd_map.end()) { const BaseCommand* command = cmd_iter->second; const ModuleCommand* module_command; - module_command = polymorphic_cast(command); + module_command = dynamic_cast(command); + XLOG_ASSERT(module_command != NULL); if (module_command->check_referred_variables(error_msg) != true) return (false); } @@ -174,7 +172,7 @@ list::const_iterator iter2; for (iter2 = _children.begin(); iter2 != _children.end(); ++iter2) { const MasterTemplateTreeNode* mttn; - mttn = polymorphic_cast(*iter2); + mttn = static_cast(*iter2); if (mttn->check_master_template_tree(error_msg) != true) return false; } Modified: trunk/xorp/rtrmgr/module_manager.cc =================================================================== --- trunk/xorp/rtrmgr/module_manager.cc 2009-12-04 15:19:46 UTC (rev 11676) +++ trunk/xorp/rtrmgr/module_manager.cc 2009-12-04 15:27:20 UTC (rev 11677) @@ -18,10 +18,7 @@ // http://xorp.net -#include -using boost::polymorphic_cast; - #include "rtrmgr_module.h" #include "libxorp/xorp.h" @@ -442,7 +439,8 @@ { Module* module; - module = polymorphic_cast(find_module(module_name)); + module = dynamic_cast(find_module(module_name)); + XLOG_ASSERT(module != NULL); return (module->execute(do_exec, is_verification, cb)); } @@ -453,7 +451,8 @@ { Module* module; - module = polymorphic_cast(find_module(module_name)); + module = dynamic_cast(find_module(module_name)); + XLOG_ASSERT(module != NULL); module->terminate(cb); return XORP_OK; @@ -488,7 +487,8 @@ map::iterator iter; for (iter = _modules.begin(); iter != _modules.end(); ++iter) { - Module *module = polymorphic_cast(iter->second); + Module *module = dynamic_cast(iter->second); + XLOG_ASSERT(module != NULL); module->terminate(callback(this, &ModuleManager::module_shutdown_cb, module->name())); } @@ -546,7 +546,8 @@ map::const_iterator iter; for (iter = _modules.begin(); iter != _modules.end(); ++iter) { - Module* module = polymorphic_cast(iter->second); + Module* module = dynamic_cast(iter->second); + XLOG_ASSERT(module != NULL); if (module->expath() != expath) continue; switch (module->status()) { Modified: trunk/xorp/rtrmgr/slave_conf_tree_node.cc =================================================================== --- trunk/xorp/rtrmgr/slave_conf_tree_node.cc 2009-12-04 15:19:46 UTC (rev 11676) +++ trunk/xorp/rtrmgr/slave_conf_tree_node.cc 2009-12-04 15:27:20 UTC (rev 11677) @@ -33,10 +33,7 @@ #include "template_tree_node.hh" #include "util.hh" -#include -using boost::polymorphic_cast; - extern int booterror(const char *s); SlaveConfigTreeNode::SlaveConfigTreeNode(bool verbose) @@ -68,11 +65,9 @@ bool verbose) { SlaveConfigTreeNode *new_node, *parent; + parent = dynamic_cast(parent_node); // sanity check - all nodes in this tree should be Slave nodes - // BOOST: This is a conditional downcast, so polymorphic casts - // can't be applied. - parent = dynamic_cast(parent_node); if (parent_node != NULL) XLOG_ASSERT(parent != NULL); @@ -90,7 +85,8 @@ debug_msg("SlaveConfigTreeNode::create_node\n"); // sanity check - all nodes in this tree should be Slave nodes - orig = polymorphic_cast(&ctn); + orig = dynamic_cast(&ctn); + XLOG_ASSERT(orig != NULL); new_node = new SlaveConfigTreeNode(*orig); return new_node; @@ -300,8 +296,9 @@ iter != master_node.const_children().end(); ++iter) { SlaveConfigTreeNode* new_node; - const SlaveConfigTreeNode* my_child = - polymorphic_cast(*iter); + const SlaveConfigTreeNode* my_child + = dynamic_cast(*iter); + XLOG_ASSERT(my_child != NULL); new_node = new SlaveConfigTreeNode(*my_child); new_node->set_parent(this); @@ -333,9 +330,9 @@ iter != master_node.const_children().end(); ++iter) { SlaveConfigTreeNode* new_node; - const SlaveConfigTreeNode* my_child = - polymorphic_cast(*iter); - + const SlaveConfigTreeNode* my_child + = dynamic_cast(*iter); + XLOG_ASSERT(my_child != NULL); new_node = new SlaveConfigTreeNode(*my_child); new_node->set_parent(this); new_node->undelete(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Fri Dec 4 08:19:59 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Fri, 04 Dec 2009 16:19:59 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11678] trunk/xorp/rtrmgr Message-ID: Revision: 11678 http://xorp.svn.sourceforge.net/xorp/?rev=11678&view=rev Author: bms_fbsd Date: 2009-12-04 16:19:58 +0000 (Fri, 04 Dec 2009) Log Message: ----------- Allow the Router Manager's paths to the modules and operational mode commands to be re-targeted, to enable operation when the FHS compliant directory layout is used. * Add util.cc helper functions xorp_module_dir() and xorp_command_dir() to facilitate this. * Pass module path down to ModuleManager. * Add xorp_rtrmgr command line options: * -c is the new name for -b, to allow the path to the configuration file to be overridden, and to bring it into line with the usual expected options for most UNIX daemons. * -b is still accepted as an alias for this option, for now. * -m allows the path to the modules directory to be overridden. * -C allows the path to the operational commands to be overridden. * Sort xorp_rtrmgr -h options text alphabetically. * Sort getopt() parameters. * Add clint FALLTHROUGH to switch cases. * s/boot_file/config_file/ Modified Paths: -------------- trunk/xorp/rtrmgr/main_rtrmgr.cc trunk/xorp/rtrmgr/main_rtrmgr.hh trunk/xorp/rtrmgr/module_manager.cc trunk/xorp/rtrmgr/module_manager.hh trunk/xorp/rtrmgr/util.cc trunk/xorp/rtrmgr/util.hh Modified: trunk/xorp/rtrmgr/main_rtrmgr.cc =================================================================== --- trunk/xorp/rtrmgr/main_rtrmgr.cc 2009-12-04 15:27:20 UTC (rev 11677) +++ trunk/xorp/rtrmgr/main_rtrmgr.cc 2009-12-04 16:19:58 UTC (rev 11678) @@ -77,22 +77,29 @@ // Local state // static volatile bool running = false; + +static string module_dir; +static string command_dir; static string template_dir; -static string boot_file; +static string config_file; +static string xrl_targets_dir; // for DEBUG_XRLDB + static bool do_logfile = false; static bool do_pidfile = false; static bool do_syslog = false; static bool do_exec = default_do_exec; static bool do_restart = default_do_restart; static bool verbose = default_verbose; + list bind_addrs; uint16_t bind_port = FinderConstants::FINDER_DEFAULT_PORT(); + static string syslogspec; static string logfilename; static string pidfilename; + int32_t quit_time = -1; static bool daemon_mode = false; -static string xrl_targets_dir; // for DEBUG_XRLDB static void cleanup_and_exit(int errcode); @@ -108,20 +115,25 @@ fprintf(stderr, "Usage: %s [options]\n", xorp_basename(argv0)); fprintf(stderr, "Options:\n"); fprintf(stderr, " -a Host allowed by the finder\n"); + fprintf(stderr, " -b|-c Specify configuration file\n"); + fprintf(stderr, " -C Specify operational commands directory\n"); fprintf(stderr, " -d Run in daemon mode in background\n"); + fprintf(stderr, " -h Display this information\n"); + fprintf(stderr, " -i Set or add an interface run Finder on\n"); + fprintf(stderr, " -L Log to syslog facility\n"); fprintf(stderr, " -l Log to file \n"); - fprintf(stderr, " -L Log to syslog facility\n"); + fprintf(stderr, " -m Specify protocol modules directory\n"); + // This option is only for testing + fprintf(stderr, " -N Do not execute XRLs and do not start processes\n"); fprintf(stderr, " -n Subnet allowed by the finder\n"); fprintf(stderr, " -P Write process ID to file \n"); - fprintf(stderr, " -h Display this information\n"); - fprintf(stderr, " -v Print verbose information\n"); - fprintf(stderr, " -b Specify boot file\n"); - fprintf(stderr, " -N Do not execute XRLs and do not start processes\n"); - fprintf(stderr, " -r Restart failed processes (not implemented yet)\n"); - fprintf(stderr, " -i Set or add an interface run Finder on\n"); fprintf(stderr, " -p Set port to run Finder on\n"); + // This option is only for testing fprintf(stderr, " -q Set forced quit period\n"); + fprintf(stderr, " -r Restart failed processes (not implemented yet)\n"); fprintf(stderr, " -t Specify templates directory\n"); + fprintf(stderr, " -v Print verbose information\n"); + // This option is only for testing #ifdef DEBUG_XRLDB fprintf(stderr, " -x Specify Xrl targets directory (debug_xrldb)\n"); @@ -132,8 +144,12 @@ display_defaults() { fprintf(stderr, "Defaults:\n"); - fprintf(stderr, " Boot file := %s\n", - xorp_boot_file().c_str()); + fprintf(stderr, " Configuration file := %s\n", + xorp_config_file().c_str()); + fprintf(stderr, " Module directory := %s\n", + xorp_module_dir().c_str()); + fprintf(stderr, " Command directory := %s\n", + xorp_command_dir().c_str()); fprintf(stderr, " Templates directory := %s\n", xorp_template_dir().c_str()); #ifdef DEBUG_XRLDB @@ -165,10 +181,11 @@ ((MasterTemplateTree*)tt)->add_cmd_action(cmd, action); } - -Rtrmgr::Rtrmgr(const string& template_dir, +Rtrmgr::Rtrmgr(const string& module_dir, + const string& command_dir, + const string& template_dir, const string& xrl_targets_dir, - const string& boot_file, + const string& config_file, const list& bind_addrs, uint16_t bind_port, bool do_exec, @@ -176,9 +193,11 @@ bool verbose, int32_t quit_time, bool daemon_mode) - : _template_dir(template_dir), + : _module_dir(module_dir), + _command_dir(command_dir), + _template_dir(template_dir), _xrl_targets_dir(xrl_targets_dir), - _boot_file(boot_file), + _config_file(config_file), _bind_addrs(bind_addrs), _bind_port(bind_port), _do_exec(do_exec), @@ -229,8 +248,12 @@ // // Print various information // - XLOG_TRACE(_verbose, "Boot file := %s\n", - boot_file.c_str()); + XLOG_TRACE(_verbose, "Configuration fil := %s\n", + config_file.c_str()); + XLOG_TRACE(_verbose, "Module directory := %s\n", + module_dir.c_str()); + XLOG_TRACE(_verbose, "Command directory := %s\n", + command_dir.c_str()); XLOG_TRACE(_verbose, "Templates directory := %s\n", template_dir.c_str()); XLOG_TRACE(_verbose, "Execute Xrls := %s\n", @@ -307,7 +330,7 @@ // Start the module manager // ModuleManager mmgr(eventloop, *this, _do_restart, _verbose, - xorp_binary_root_dir()); + xorp_binary_root_dir(), module_dir); try { // @@ -328,7 +351,7 @@ mmgr.set_xrl_interface(_xrt); #endif - _mct = new MasterConfigTree(boot_file, tt, mmgr, xclient, _do_exec, + _mct = new MasterConfigTree(config_file, tt, mmgr, xclient, _do_exec, _verbose); if (_daemon_mode) { _mct->set_task_completed(callback(this, &Rtrmgr::daemonize)); @@ -530,8 +553,10 @@ // Expand the default variables to include the XORP root path // xorp_path_init(argv[0]); + module_dir = xorp_module_dir(); + command_dir = xorp_command_dir(); template_dir = xorp_template_dir(); - boot_file = xorp_boot_file(); + config_file = xorp_config_file(); xrl_targets_dir = xorp_xrl_targets_dir(); #ifdef DEBUG_XRLDB @@ -541,12 +566,12 @@ #endif static const char* optstring = - "da:l:L:n:t:b:" RTRMGR_X_OPT "i:P:p:q:Nrvh"; + "a:b:c:C:dhi:L:l:m:P:p:q:Nn:rt:v" RTRMGR_X_OPT; int c; while ((c = getopt(argc, argv, optstring)) != EOF) { switch(c) { case 'd': - daemon_mode = true; + daemon_mode = true; // XXX must come before other options? break; case 'a': // @@ -561,6 +586,9 @@ cleanup_and_exit(1); } break; + case 'C': + command_dir = optarg; + break; case 'l': do_logfile = true; logfilename = optarg; @@ -569,6 +597,9 @@ do_syslog = true; syslogspec = optarg; break; + case 'm': + module_dir = optarg; + break; case 'n': // // User is specifying a network address to accept finder @@ -586,7 +617,9 @@ template_dir = optarg; break; case 'b': - boot_file = optarg; + /* FALLTHROUGH */ + case 'c': + config_file = optarg; break; #ifdef DEBUG_XRLDB case 'x': @@ -645,7 +678,9 @@ } break; case 'h': + /* FALLTHROUGH */ case '?': + /* FALLTHROUGH */ default: usage(argv[0]); display_defaults(); @@ -671,7 +706,8 @@ // // The main procedure // - Rtrmgr rtrmgr(template_dir, xrl_targets_dir, boot_file, bind_addrs, + Rtrmgr rtrmgr(module_dir, command_dir, template_dir, xrl_targets_dir, + config_file, bind_addrs, bind_port, do_exec, do_restart, verbose, quit_time, daemon_mode); errcode = rtrmgr.run(); Modified: trunk/xorp/rtrmgr/main_rtrmgr.hh =================================================================== --- trunk/xorp/rtrmgr/main_rtrmgr.hh 2009-12-04 15:27:20 UTC (rev 11677) +++ trunk/xorp/rtrmgr/main_rtrmgr.hh 2009-12-04 16:19:58 UTC (rev 11678) @@ -34,9 +34,11 @@ class Rtrmgr { public: - Rtrmgr(const string& template_dir, + Rtrmgr(const string& module_dir, + const string& command_dir, + const string& template_dir, const string& xrl_targets_dir, - const string& boot_file, + const string& config_file, const list& bind_addrs, uint16_t bind_port, bool do_exec, @@ -54,9 +56,11 @@ bool verbose() const { return _verbose; } private: + string _module_dir; + string _command_dir; string _template_dir; - string _xrl_targets_dir; - string _boot_file; + string _xrl_targets_dir; // Only used by DEBUG_XRLDB. + string _config_file; list _bind_addrs; uint16_t _bind_port; Modified: trunk/xorp/rtrmgr/module_manager.cc =================================================================== --- trunk/xorp/rtrmgr/module_manager.cc 2009-12-04 15:27:20 UTC (rev 11677) +++ trunk/xorp/rtrmgr/module_manager.cc 2009-12-04 16:19:58 UTC (rev 11678) @@ -329,13 +329,15 @@ ModuleManager::ModuleManager(EventLoop& eventloop, Rtrmgr& rtrmgr, bool do_restart, bool verbose, - const string& xorp_root_dir) + const string& xorp_root_dir, + const string& xorp_module_dir) : GenericModuleManager(eventloop, verbose), _rtrmgr(rtrmgr), _master_config_tree(NULL), _do_restart(do_restart), _verbose(verbose), - _xorp_root_dir(xorp_root_dir) + _xorp_root_dir(xorp_root_dir), + _xorp_module_dir(xorp_module_dir) { } @@ -359,8 +361,8 @@ // The path to the module doesn't starts from the user home directory // and is not an absolute path (in UNIX, DOS or NT UNC form). // - // Add the XORP root path to the front - expath = xorp_root_dir() + PATH_DELIMITER_STRING + path; + // Add the XORP module path to the front + expath = xorp_module_dir() + PATH_DELIMITER_STRING + path; } if (! is_absolute_path(expath, false)) { Modified: trunk/xorp/rtrmgr/module_manager.hh =================================================================== --- trunk/xorp/rtrmgr/module_manager.hh 2009-12-04 15:27:20 UTC (rev 11677) +++ trunk/xorp/rtrmgr/module_manager.hh 2009-12-04 16:19:58 UTC (rev 11678) @@ -166,10 +166,12 @@ * @param do_restart if true, then restart a module if it failed. * @param verbose if true, then output trace messages. * @param xorp_root_dir the XORP root directory. + * @param xorp_module_dir the XORP module directory. */ ModuleManager(EventLoop& eventloop, Rtrmgr& rtrmgr, bool do_restart, bool verbose, - const string& xorp_root_dir); + const string& xorp_root_dir, + const string& xorp_module_dir); /** * The default destructor. @@ -316,6 +318,13 @@ const string& xorp_root_dir() const { return _xorp_root_dir; } /** + * Get the XORP module directory. + * + * @return the XORP module directory. + */ + const string& xorp_module_dir() const { return _xorp_module_dir; } + + /** * Get the master configuration tree. * * @return the master configuration tree. @@ -392,6 +401,7 @@ bool _do_restart; // Set to true to enable module restart bool _verbose; // Set to true if output is verbose string _xorp_root_dir; // The root of the XORP tree + string _xorp_module_dir; // Module directory }; #endif // __RTRMGR_MODULE_MANAGER_HH__ Modified: trunk/xorp/rtrmgr/util.cc =================================================================== --- trunk/xorp/rtrmgr/util.cc 2009-12-04 15:27:20 UTC (rev 11677) +++ trunk/xorp/rtrmgr/util.cc 2009-12-04 16:19:58 UTC (rev 11678) @@ -33,7 +33,7 @@ static string s_cfg_root; static string s_bin_root; -static string s_boot_file; +static string s_config_file; /** * Find the directory of executable program. @@ -117,7 +117,7 @@ if (xr != NULL) { s_bin_root = xr; s_cfg_root = xr; - s_boot_file = s_cfg_root + "/etc/xorp.conf"; + s_config_file = s_cfg_root + "/etc/xorp.conf"; return; } @@ -133,11 +133,11 @@ if (current_root == build_root) { s_bin_root = build_root; s_cfg_root = xorp_real_path(XORP_SRC_ROOT); - s_boot_file = s_cfg_root + "/rtrmgr/xorp.conf"; + s_config_file = s_cfg_root + "/rtrmgr/xorp.conf"; debug_msg("s_bin_root: %s\n", s_bin_root.c_str()); debug_msg("s_cfg_root: %s\n", s_cfg_root.c_str()); - debug_msg("s_boot_file: %s\n", s_boot_file.c_str()); + debug_msg("s_config_file: %s\n", s_config_file.c_str()); return; } @@ -145,11 +145,11 @@ string install_root = xorp_real_path(XORP_INSTALL_ROOT); s_bin_root = install_root; s_cfg_root = install_root; - s_boot_file = s_cfg_root + "/etc/xorp.conf"; + s_config_file = s_cfg_root + "/etc/xorp.conf"; debug_msg("s_bin_root: %s\n", s_bin_root.c_str()); debug_msg("s_cfg_root: %s\n", s_cfg_root.c_str()); - debug_msg("s_boot_file: %s\n", s_boot_file.c_str()); + debug_msg("s_config_file: %s\n", s_config_file.c_str()); } const string& @@ -165,6 +165,18 @@ } string +xorp_module_dir() +{ + return s_cfg_root + string("/lib/xorp/sbin"); +} + +string +xorp_command_dir() +{ + return s_cfg_root + string("/lib/xorp/bin"); +} + +string xorp_template_dir() { return s_cfg_root + string("/share/xorp/templates"); @@ -177,9 +189,9 @@ } string -xorp_boot_file() +xorp_config_file() { - return s_boot_file; + return s_config_file; } string& Modified: trunk/xorp/rtrmgr/util.hh =================================================================== --- trunk/xorp/rtrmgr/util.hh 2009-12-04 15:27:20 UTC (rev 11677) +++ trunk/xorp/rtrmgr/util.hh 2009-12-04 16:19:58 UTC (rev 11678) @@ -34,9 +34,11 @@ * * @li @ref xorp_binary_root_dir() * @li @ref xorp_config_root_dir() + * @li @ref xorp_module_dir() + * @li @ref xorp_command_dir() * @li @ref xorp_template_dir() * @li @ref xorp_xrl_targets_dir() - * @li @ref xorp_boot_file() + * @li @ref xorp_config_file() * * @param argv0 the argv[0] supplied to main(). */ @@ -59,6 +61,24 @@ const string& xorp_config_root_dir(); /** + * Return the path of the xorp module directory given the xorp_root + * path. + * + * @ref xorp_path_init() must be called before this method will return a sane + * value. + */ +string xorp_module_dir(); + +/** + * Return the path of the xorp command directory given the xorp_root + * path. + * + * @ref xorp_path_init() must be called before this method will return a sane + * value. + */ +string xorp_command_dir(); + +/** * Return the path of the xorp templates directory given the xorp_root * path. * @@ -82,7 +102,7 @@ * @ref xorp_path_init() must be called before this method will return a sane * value. */ -string xorp_boot_file(); +string xorp_config_file(); /** * Remove enclosing quotes from string. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Fri Dec 4 09:06:32 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Fri, 04 Dec 2009 17:06:32 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11679] trunk/xorp/rtrmgr Message-ID: Revision: 11679 http://xorp.svn.sourceforge.net/xorp/?rev=11679&view=rev Author: bms_fbsd Date: 2009-12-04 17:06:32 +0000 (Fri, 04 Dec 2009) Log Message: ----------- The xorpsh doesn't ever need to see the *.xrls files, so remove any code which references them. Modified Paths: -------------- trunk/xorp/rtrmgr/xorpsh_main.cc trunk/xorp/rtrmgr/xorpsh_main.hh Modified: trunk/xorp/rtrmgr/xorpsh_main.cc =================================================================== --- trunk/xorp/rtrmgr/xorpsh_main.cc 2009-12-04 16:19:58 UTC (rev 11678) +++ trunk/xorp/rtrmgr/xorpsh_main.cc 2009-12-04 17:06:32 UTC (rev 11679) @@ -121,7 +121,6 @@ const string& IPCname, const string& xorp_root_dir, const string& config_template_dir, - const string& xrl_targets_dir, bool verbose) throw (InitError) : XrlStdRouter(eventloop, IPCname.c_str()), _eventloop(eventloop), @@ -152,8 +151,6 @@ xorp_root_dir.c_str()); XLOG_TRACE(_verbose, "Templates directory := %s\n", config_template_dir.c_str()); - XLOG_TRACE(_verbose, "Xrl targets directory := %s\n", - xrl_targets_dir.c_str()); XLOG_TRACE(_verbose, "Print verbose information := %s\n", bool_c_str(_verbose)); @@ -771,7 +768,6 @@ fprintf(stderr, " -h Display this information\n"); fprintf(stderr, " -v Print verbose information\n"); fprintf(stderr, " -t Specify templates directory\n"); - fprintf(stderr, " -x Specify Xrl targets directory\n"); } static void @@ -780,8 +776,6 @@ fprintf(stderr, "Defaults:\n"); fprintf(stderr, " Templates directory := %s\n", xorp_template_dir().c_str()); - fprintf(stderr, " Xrl targets directory := %s\n", - xorp_xrl_targets_dir().c_str()); fprintf(stderr, " Print verbose information := %s\n", bool_c_str(default_verbose)); } @@ -817,10 +811,11 @@ // xorp_path_init(argv[0]); string template_dir = xorp_template_dir(); - string xrl_targets_dir = xorp_xrl_targets_dir(); + static const char optstring[] = "c:et:vh"; + int c; - while ((c = getopt(argc, argv, "c:et:x:vh")) != EOF) { + while ((c = getopt(argc, argv, optstring)) != EOF) { switch(c) { case 'c': // XXX: Append the arguments to allow multiple "-c cmd" commands @@ -833,9 +828,6 @@ case 't': template_dir = optarg; break; - case 'x': - xrl_targets_dir = optarg; - break; case 'v': verbose = true; break; @@ -864,7 +856,7 @@ string xname = "xorpsh" + c_format("-%d-%s", XORP_INT_CAST(getpid()), hostname); XorpShell xorpsh(eventloop, xname, xorp_binary_root_dir(), - template_dir, xrl_targets_dir, verbose); + template_dir, verbose); xorpsh.run(commands, exit_on_error); } catch (const InitError& e) { XLOG_ERROR("xorpsh exiting due to an init error: %s", e.why().c_str()); Modified: trunk/xorp/rtrmgr/xorpsh_main.hh =================================================================== --- trunk/xorp/rtrmgr/xorpsh_main.hh 2009-12-04 16:19:58 UTC (rev 11678) +++ trunk/xorp/rtrmgr/xorpsh_main.hh 2009-12-04 17:06:32 UTC (rev 11679) @@ -48,7 +48,6 @@ const string& IPCname, const string& xorp_root_dir, const string& config_template_dir, - const string& xrl_targets_dir, bool verbose) throw (InitError); ~XorpShell(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Fri Dec 4 09:15:02 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Fri, 04 Dec 2009 17:15:02 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11680] trunk/xorp/etc/templates Message-ID: Revision: 11680 http://xorp.svn.sourceforge.net/xorp/?rev=11680&view=rev Author: bms_fbsd Date: 2009-12-04 17:14:59 +0000 (Fri, 04 Dec 2009) Log Message: ----------- Catchup with operational command rename for FHS compliance. Modified Paths: -------------- trunk/xorp/etc/templates/ospfv2.cmds trunk/xorp/etc/templates/ospfv3.cmds Modified: trunk/xorp/etc/templates/ospfv2.cmds =================================================================== --- trunk/xorp/etc/templates/ospfv2.cmds 2009-12-04 17:06:32 UTC (rev 11679) +++ trunk/xorp/etc/templates/ospfv2.cmds 2009-12-04 17:14:59 UTC (rev 11680) @@ -1,7 +1,7 @@ /* $XORP: xorp/etc/templates/ospfv2.cmds,v 1.10 2006/04/27 20:01:32 pavlin Exp $ */ clear ospf4 database { - %command: "clear_database -2" %help: HELP; + %command: "ospf_clear_database -2" %help: HELP; %module: ospf4; %tag: HELP "Clear LSA database"; } Modified: trunk/xorp/etc/templates/ospfv3.cmds =================================================================== --- trunk/xorp/etc/templates/ospfv3.cmds 2009-12-04 17:06:32 UTC (rev 11679) +++ trunk/xorp/etc/templates/ospfv3.cmds 2009-12-04 17:14:59 UTC (rev 11680) @@ -1,7 +1,7 @@ /* $XORP: xorp/etc/templates/ospfv3.cmds,v 1.6 2007/02/26 11:08:37 atanu Exp $ */ clear ospf6 database { - %command: "clear_database -3" %help: HELP; + %command: "ospf_clear_database -3" %help: HELP; %module: ospf6; %tag: HELP "Clear LSA database"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Fri Dec 4 09:15:57 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Fri, 04 Dec 2009 17:15:57 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11681] trunk/xorp/rtrmgr/util.cc Message-ID: Revision: 11681 http://xorp.svn.sourceforge.net/xorp/?rev=11681&view=rev Author: bms_fbsd Date: 2009-12-04 17:15:52 +0000 (Fri, 04 Dec 2009) Log Message: ----------- Ensure that the xorp_command_dir() is searched for when evaluating paths to operational commands in the xorpsh. Modified Paths: -------------- trunk/xorp/rtrmgr/util.cc Modified: trunk/xorp/rtrmgr/util.cc =================================================================== --- trunk/xorp/rtrmgr/util.cc 2009-12-04 17:14:59 UTC (rev 11680) +++ trunk/xorp/rtrmgr/util.cc 2009-12-04 17:15:52 UTC (rev 11681) @@ -261,6 +261,7 @@ string xorp_root_dir = xorp_binary_root_dir(); list path; + path.push_back(xorp_command_dir()); // XXX FHS path.push_back(xorp_root_dir); // Expand path This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Fri Dec 4 10:07:54 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Fri, 04 Dec 2009 18:07:54 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11682] trunk/xorp/relpath.py Message-ID: Revision: 11682 http://xorp.svn.sourceforge.net/xorp/?rev=11682&view=rev Author: bms_fbsd Date: 2009-12-04 18:07:53 +0000 (Fri, 04 Dec 2009) Log Message: ----------- The use of os.path.relpath() is Python 2.6 specific, however we really depend on this function to work out relative paths in the installation image. Check in a Python 'monkey patch', but do not yet connect it to the SConstruct. Added Paths: ----------- trunk/xorp/relpath.py Added: trunk/xorp/relpath.py =================================================================== --- trunk/xorp/relpath.py (rev 0) +++ trunk/xorp/relpath.py 2009-12-04 18:07:53 UTC (rev 11682) @@ -0,0 +1,19 @@ +# +# Monkey patch for os.path to include relpath if python version is < 2.6. +# +# Obtained from: http://code.activestate.com/recipes/302594/ +# + +import os + +if not hasattr(os.path, "relpath"): + def relpath(target, base=os.curdir): + base_list = (os.path.abspath(base)).split(os.sep) + target_list = (os.path.abspath(target)).split(os.sep) + for i in range(min(len(base_list), len(target_list))): + if base_list[i] <> target_list[i]: break + else: + i += 1 + rel_list = [os.pardir] * (len(base_list)-i) + target_list[i:] + return os.path.join(*rel_list) + os.path.relpath = relpath This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Fri Dec 4 10:50:55 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Fri, 04 Dec 2009 18:50:55 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11683] trunk/xorp/SConstruct Message-ID: Revision: 11683 http://xorp.svn.sourceforge.net/xorp/?rev=11683&view=rev Author: bms_fbsd Date: 2009-12-04 18:50:55 +0000 (Fri, 04 Dec 2009) Log Message: ----------- Hook up relpath to the SConstruct, so we can monkey-patch os.path.relpath() for Python versions older than 2.6. Drop Python requirement back to 2.3. Tested by: Ben Greear Modified Paths: -------------- trunk/xorp/SConstruct Modified: trunk/xorp/SConstruct =================================================================== --- trunk/xorp/SConstruct 2009-12-04 18:07:53 UTC (rev 11682) +++ trunk/xorp/SConstruct 2009-12-04 18:50:55 UTC (rev 11683) @@ -21,6 +21,8 @@ # TODO Fix default include/lib paths, pass in from environment. # TODO Merge scons-unfamiliar syntactic sugar from YHC's sconsfiles. +import relpath + gnutoolwarning = """ WARNING: The GNU %s was not detected on your system. Some combinations of linker or compiler flags, specific to building XORP, @@ -29,7 +31,7 @@ # The XRL tgt-gen and clnt-gen scripts use Python 2.3+'s optparse # class. However, os.path.relpath() requires Python 2.6. -EnsurePythonVersion(2, 6) +EnsurePythonVersion(2, 3) # SCons 0.98.4 is the earliest release that we have tested. Earlier # ones may work. If so, please submit a Trac issue so the check can This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Fri Dec 4 11:16:08 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Fri, 04 Dec 2009 19:16:08 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11684] trunk/xorp/SConstruct Message-ID: Revision: 11684 http://xorp.svn.sourceforge.net/xorp/?rev=11684&view=rev Author: bms_fbsd Date: 2009-12-04 19:16:08 +0000 (Fri, 04 Dec 2009) Log Message: ----------- Wrap Mkdir() in a try..except block to workaround an issue with SCons versions prior to the r20090223 checkpoint release. Tested by: Ben Greear Modified Paths: -------------- trunk/xorp/SConstruct Modified: trunk/xorp/SConstruct =================================================================== --- trunk/xorp/SConstruct 2009-12-04 18:50:55 UTC (rev 11683) +++ trunk/xorp/SConstruct 2009-12-04 19:16:08 UTC (rev 11684) @@ -607,7 +607,11 @@ # $BUILDIR/lib will contain .so symlinks # xorp_alias_libdir = os.path.join(builddir, 'lib') - Execute(Mkdir(xorp_alias_libdir)) + # XXX workaround Mkdir() failure on EEXIST, SCons < 20090223. + try: + Execute(Mkdir(xorp_alias_libdir)) + except: + pass env['xorp_alias_libdir'] = xorp_alias_libdir # # Build a further alias for the benefit of entities which @@ -616,9 +620,13 @@ # $BUILDIR/lib/xorp/lib will point to $BUILDIR/lib # xorp_alias_subdir = os.path.join(xorp_alias_libdir, 'xorp') - Execute(Mkdir(xorp_alias_subdir)) # + # XXX workaround Mkdir() failure on EEXIST, SCons < 20090223. xorp_module_alias_libdir = os.path.join(xorp_alias_subdir, 'lib') + try: + Execute(Mkdir(xorp_alias_subdir)) + except: + pass Execute(env.Symlink(xorp_alias_libdir, xorp_module_alias_libdir)) env['xorp_module_alias_libdir'] = xorp_module_alias_libdir This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Mon Dec 7 11:22:56 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Mon, 07 Dec 2009 19:22:56 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11685] trunk/xorp/xrl/scripts Message-ID: Revision: 11685 http://xorp.svn.sourceforge.net/xorp/?rev=11685&view=rev Author: bms_fbsd Date: 2009-12-07 19:22:56 +0000 (Mon, 07 Dec 2009) Log Message: ----------- Import the Thrift versions of the clnt-gen and tgt-gen stub generators for XRL, but do not yet connect to the build. They are intended to be invoked in exactly the same way, and turn XRL stub/proxy methods into calls into the Thrift libraries (and the XORP specific XRL bits), which are not yet implemented. Added Paths: ----------- trunk/xorp/xrl/scripts/thrift-clnt-gen trunk/xorp/xrl/scripts/thrift-tgt-gen Added: trunk/xorp/xrl/scripts/thrift-clnt-gen =================================================================== --- trunk/xorp/xrl/scripts/thrift-clnt-gen (rev 0) +++ trunk/xorp/xrl/scripts/thrift-clnt-gen 2009-12-07 19:22:56 UTC (rev 11685) @@ -0,0 +1,445 @@ +#! /usr/bin/env python +# vim:set sts=4 ts=8 sw=4: + +"""Program to generate Xrl Interface Client related files""" + +from optparse import OptionParser +import os, sys + +# This is a bit of mess as this code was split into separate files +import Xif.util + +from Xif.util import \ + joining_csv, csv, cpp_name, cpp_classname, caps_cpp_classname, \ + cpp_version, xorp_indent_string, xorp_indent + +from Xif.xiftypes import \ + XrlArg, XrlMethod, XrlInterface, XrlTarget + +from Xif.parse import \ + XifParser + +from Xif.thrifttypes import \ + wire_type, send_arg, recv_arg + +# ----------------------------------------------------------------------------- +# Client Interface file output related +# ----------------------------------------------------------------------------- + +def declare_send_xrl(method_no, method): + rtypes = [] + for r in method.rargs(): + rtypes.append("const " + r.cpp_type() + "*") + cb_name = "%sCB" % (caps_cpp_classname(method.name())) + s = " typedef XorpCallback%s::RefPtr %s;\n" \ + % (1 + len(rtypes), joining_csv(rtypes), cb_name) + + atypes = ["\n\tconst char*\tdst_xrl_target_name"] + for a in method.args(): + atypes.append("\n\tconst %s&\t%s" % (a.cpp_type(), a.name())) + atypes.append("\n\tconst %s&\tcb" % cb_name) + s += " bool send_%s(%s\n );\n\n" \ + % (cpp_name(method.name()), csv(atypes)) + return s + +def implement_send_argument(a, fid): + lines = [] + lines.append("nout += outp->writeFieldBegin(\"%s\", %s, %d);" % \ + (a.name(), wire_type(a), fid)) + lines += send_arg(a) + lines.append("nout += outp->writeFieldEnd();") + return lines + +def implement_send_xrl(cls, method_no, method, ifqname): + cpp_method_name = cpp_name(method.name()) + cb_name = "%sCB" % (caps_cpp_classname(method.name())) + atypes = ["\n\tconst char*\tdst_xrl_target_name"] + for a in method.args(): + atypes.append("\n\tconst %s&\t%s" % (a.cpp_type(), a.name())) + atypes.append("\n\tconst %s&\tcb" % cb_name) + s = "\nbool\n%s::send_%s(%s\n)\n" \ + % (cls, cpp_method_name, csv(atypes)) + # TODO: call TMessenger interface which bumps cseqid for outgoing. + s += "{\n" + s += " using namespace apache::thrift::protocol;\n" + s += "\n" + s += " TProtocol *outp = 0;\n" + s += " uint32_t nout = 0;\n" + s += " int32_t cseqid = 0;\n" + s += "\n" + s += " // Begin Thrift RPC message\n" + s += " nout += outp->writeMessageBegin(\"%s\", T_CALL, cseqid);\n" % \ + (cpp_method_name) + # + # Generate the marshal-out code for each argument as a list of strings; + # collate them, and append to the output file with correct indentation. + # + # Stay compatible with Thrift generated stubs; always write + # passed arguments out as a struct, even if we don't use them. + # This exists mainly to allow us to later change the protocol + # using field IDs. + # XifMethod.args() are inputs, XifMethod.rargs() are outputs. + # + s += " // Begin arguments\n" + s += " nout += outp->writeStructBegin(\"%s\");\n" % \ + (cpp_method_name + "_args") + fid = 0 + for a in method.args(): + fid += 1 + lines = implement_send_argument(a, fid) + for l in lines: + s += xorp_indent(1) + l + "\n" + s += " nout += outp->writeFieldStop();\n" + s += " nout += outp->writeStructEnd();\n" + s += " // End arguments\n" + + s += " nout += outp->writeMessageEnd();\n" + s += " // End Thrift RPC message\n" + s += "\n" + s += " // Flush transport and mark end of message\n" + s += " outp->getTransport()->flush();\n" + s += " outp->getTransport()->writeEnd();\n" + s += "\n" + # TODO: Mark as sent with TMessenger. + s += " return true;\n" + # XXX + s += " UNUSED(dst_xrl_target_name);\n" + s += " UNUSED(cb);\n" + # end function + s += "}\n\n" + # nout now contains # of bytes in transport buffer for this IPC + return s + +# ----------------------------------------------------------------------------- +# Unmarshalling callbacks +# ----------------------------------------------------------------------------- + +# XXX XrlError is preserved and should be passed in from +# the libxipc thrifted transport to record any transport error +# whilst remaining compatible with legacy XORP code base +# XXX ctx will change to be TMessenger or similar. + +def declare_unmarshall(method_name): + s = xorp_indent_string(1, "static void ") + s += "unmarshall_%s(" % method_name + cb_name = "%sCB" % (caps_cpp_classname(method_name)) + args = [ "const XrlError&\te", "void\t*ctx", "%s\t\tcb" % cb_name] + for i in range(0, len(args)): + args[i] = "\n\t" + args[i] + s += csv(args) + s += "\n%s);\n\n" % xorp_indent(1) + return s + +# Generate code intended to: +# Transform an incoming Thrift RPC T_REPLY message into an XRL method +# return callback at the client. +# +# When this routine is called, the T_REPLY/T_EXCEPTION part of +# the message has already been parsed. We will only need to parse +# the return value if it's a T_REPLY. If it is a T_EXCEPTION, then +# this function will be called to ensure the client's callback is +# invoked with an appropriate XrlError. +# +# XRL callbacks must always be invoked, with XrlError set to an +# appropriate value, to indicate an error. Otherwise, they should +# eventually time out (we have yet to implement that part). +# +# Implementation note: +# +# Thrift RPC methods always return their results in a struct, usually +# named "success", although this is never exposed to the stubs -- +# except when declared 'oneway'. +# +# Now, in XIF, we always expect a reply to an RPC; there is no +# equivalent of Thrift's 'oneway' method. In this case, the +# structure returned (according to the XIF) should be empty. +# We can skip this, or attempt to parse it. +# +# However, to facilitate interworking between XIF code and Thrift code, +# the thrift-gen translator will define another struct to be returned +# as the real return value; so we need to unmarshall 2 layers of struct. +# +# TODO: Handle T_EXCEPTION passed to this function further up. +# +def implement_unmarshall(cls, method_no, method): + s = "" + arg_checks_enabled = True + + nargs = [] + for r in method.rargs(): + nargs.append("0") + fail_args = joining_csv(nargs) + + s += "void\n%s::unmarshall_%s(" % (cls, method.name()) + cb_name = "%sCB" % (caps_cpp_classname(method.name())) + args = [ "const XrlError&\te", "void\t*ctx", "%s\t\tcb" % cb_name] + for i in range(0, len(args)): + args[i] = "\n\t" + args[i] + s += csv(args) + s += "\n)\n" + s += "{\n" + s += " using namespace apache::thrift::protocol;\n" + s += "\n" + s += " if (e != XrlError::OKAY()) {\n" + s += " cb->dispatch(e%s);\n" % fail_args + s += " return;\n" + s += " }\n" + s += "\n" + s += " TProtocol *inp = 0;\n" + s += " uint32_t nin = 0;\n" + s += "\n" + + if len(method.rargs()) == 0: + s += " /* Ignore void result for XIF method call.*/\n" + s += " nin += inp->skip(T_STRUCT);\n" + else: + if arg_checks_enabled: + s += "#ifndef XIF_DISABLE_CLIENT_INPUT_CHECKS\n" + s += " bitset<%d> argf;\n" % len(method.rargs()) + s += "#endif\n" + s += " /* Return value declarations */\n" + for r in method.rargs(): + s += " %s %s;\n" % (r.cpp_type(), cpp_name(r.name())) + s += "\n" + s += " /* Begin parsing outer \"success\" struct. */\n" + s += " string fname;\n" + s += " TType ftype;\n" + s += " int16_t fid;\n" + s += "\n" + s += " nin += inp->readStructBegin(fname);\n" + s += " for (;;) {\n" + s += " nin += inp->readFieldBegin(fname, ftype, fid);\n" + s += " if (ftype == T_STOP) {\n" + s += " break;\n" + s += " } else if (fid == 0 && ftype == T_STRUCT) {\n" + s += " /* Begin parsing inner method_result struct. */\n" + s += " nin += inp->readStructBegin(fname);\n" + s += " for (;;) {\n" + s += " nin += inp->readFieldBegin(fname, ftype, fid);\n" + s += " if (ftype == T_STOP)\n" + s += " break;\n" + s += " switch (fid) {\n" + # Parse each field expected in this struct. + rfid = 0 + for r in method.rargs(): + rfid += 1 + s += " case %d:\n" % rfid + s += " if (ftype == %s) {\n" % wire_type(r) + for l in recv_arg(r): + s += xorp_indent(6) + l + "\n" + if arg_checks_enabled: + s += "#ifndef XIF_DISABLE_CLIENT_INPUT_CHECKS\n" + s += xorp_indent(6) + "argf.set(%d);\n" % (rfid - 1) + s += "#endif\n" + s += " }\n" + s += " break;\n" + s += " default:\n" + s += " nin += inp->skip(ftype);\n" + s += " break;\n" + s += " }\n" + s += " nin += inp->readFieldEnd();\n" + s += " }\n" + s += " nin += inp->readStructEnd();\n" + s += " /* End parsing inner method_result struct. */\n" + s += " } else {\n" + s += " nin += inp->skip(ftype);\n" + s += " }\n" + s += " }\n" + s += " nin += inp->readStructEnd();\n" + s += " /* End parsing outer \"success\" struct. */\n" + # end of return argument parsing + s += " nin += inp->readMessageEnd();\n" + s += "\n" + s += " inp->getTransport()->readEnd();\n" + s += "\n" + + # final argument count check. + if len(method.rargs()) > 0 and arg_checks_enabled: + s += "#ifndef XIF_DISABLE_CLIENT_INPUT_CHECKS\n" + s += " if (argf.count() != %d) {\n" % len(method.rargs()) + s += "#if 0\n" + s += " XLOG_ERROR(\"Wrong number of arguments (%%u != %%u)\",\n" + s += " XORP_UINT_CAST(argf.count()),\n" + s += " XORP_UINT_CAST(%d));\n" % len(method.rargs()) + s += "#endif // no XLOG in here just yet.\n" + s += " cb->dispatch(XrlError::BAD_ARGS()%s);\n" % fail_args + s += " }\n" + s += "#endif\n" + s += "\n" + + # now dispatch a successful XRL return. + v = [] + for r in method.rargs(): + v.append("&%s" % cpp_name(r.name())) + s += " cb->dispatch(e%s);\n" % (joining_csv(v)) + + s += " UNUSED(ctx);\n" # XXX + s += "}\n" + + return s + +# ----------------------------------------------------------------------------- +# Boilerplate code +# ----------------------------------------------------------------------------- + +def protect(file): + # remove direcory component + r = file.rfind("/") + 1 + return "__XRL_INTERFACES_%s__" % file[r:].upper().replace(".", "_") + +def prepare_client_if_hh(modulename, hh_file): + + s = Xif.util.standard_preamble(1, hh_file) + s += \ +"""#ifndef %s +#define %s + +#undef XORP_LIBRARY_NAME +#define XORP_LIBRARY_NAME "%s" + +#include "libxorp/xlog.h" +#include "libxorp/callback.hh" + +#include "libxipc/xrl_error.hh" +#include "libxipc/xrl_atom.hh" +#include "libxipc/xrl_atom_list.hh" +#include "libxipc/xrl_sender.hh" + +#include +#include +#include + +#include + +#include + +#include +#include + +#include "libxipc/xif_thrift.hh" // XXX for xif_read_*() + +#include // for argument checks + +""" % (protect(hh_file), protect(hh_file), modulename) + return s + +def client_if_hh(cls, methods): + s = """ +class %s { +public: + %s(XrlSender* s) : _sender(s) {} + virtual ~%s() {} + +""" % (cls, cls, cls) + for i in range(0, len(methods)): + s += declare_send_xrl(i, methods[i]) + + s += """protected: + XrlSender* _sender; + +private: +""" + for i in range(0, len(methods)): + s += declare_unmarshall(methods[i].name()) + s += "};\n" + return s + +def finish_client_if_hh(hh_file): + return "\n#endif /* %s */\n" % protect(hh_file) + +def prepare_client_if_cc(hh_file, cc_file): + s = Xif.util.standard_preamble(0, cc_file) + s += "#include \"%s\"\n" % hh_file + return s + +def client_if_cc(cls, ifname, ifversion, methods): + s = "" + for i in range(0, len(methods)): + # Interface qualified name + ifqname = "%s/%s/%s" % (ifname, ifversion, methods[i].name()) + s += implement_send_xrl(cls, i, methods[i], ifqname) + s += implement_unmarshall(cls, i, methods[i]) + return s + +def main(): + usage = "usage: %prog [options] arg" + parser = OptionParser(usage) + parser.add_option("-o", "--output-dir", + action="store", + type="string", + dest="output_dir", + metavar="DIR") + parser.add_option("-I", + action="append", + type="string", + dest="includes", + metavar="DIR") + (options,args) = parser.parse_args() + + if len(args) != 1: + parser_error("incorrect number of arguments") + + # Command line arguments passed on to cpp + pipe_string = "cpp -C " + if options.includes: + for a in options.includes: + pipe_string += "-I%s " % a + pipe_string += args[0] + + cpp_pipe = os.popen(pipe_string, 'r') + + xp = XifParser(cpp_pipe) + + if len(xp.targets()): + print "Found targets (used a .ent rather than .xif input?)" + sys.exit(1) + + xifs = xp.interfaces() + if len(xifs) == 0: + print "No interface definitions provided" + sys.exit(1) + + # Check all interface definitions come from same source file. + # Although we've done the hard part (parsing), generating from + # here is still painful if we have to output multiple interface files. + sourcefile = xifs[0].sourcefile() + for xif in xifs: + if (xif.sourcefile() != sourcefile): + print "Multiple .xif files presented, expected one." + sys.exit(1) + + # basename transformation - this is a lame test + if sourcefile[-4:] != ".xif": + print "Source file does not end in .xif suffix - basename transform failure." + sys.exit(1) + + basename = sourcefile[:-4] + basename = basename[basename.rfind("/") + 1:] + + modulename = "Xif%s" % cpp_classname(basename) + hh_file = "%s_xif.hh" % basename + cc_file = "%s_xif.cc" % basename + + if options.output_dir: + hh_file = os.path.join(options.output_dir, hh_file) + cc_file = os.path.join(options.output_dir, cc_file) + + # Generate header file + hh_txt = prepare_client_if_hh(modulename, hh_file) + for xif in xifs: + cls = "Xrl%s%sClient" % (cpp_classname(xif.name()), \ + cpp_version(xif.version())) + hh_txt += client_if_hh(cls, xif.methods()) + hh_txt += finish_client_if_hh(hh_file) + Xif.util.file_write_string(hh_file, hh_txt) + + # Generate implementation file + cc_txt = prepare_client_if_cc(hh_file[hh_file.rfind("/") + 1 : ], cc_file) + for xif in xifs: + cls = "Xrl%s%sClient" % (cpp_classname(xif.name()), \ + cpp_version(xif.version())) + cc_txt += client_if_cc(cls, xif.name(), xif.version(), xif.methods()) + Xif.util.file_write_string(cc_file, cc_txt) + +if __name__ == '__main__': + main() Property changes on: trunk/xorp/xrl/scripts/thrift-clnt-gen ___________________________________________________________________ Added: svn:executable + * Added: trunk/xorp/xrl/scripts/thrift-tgt-gen =================================================================== --- trunk/xorp/xrl/scripts/thrift-tgt-gen (rev 0) +++ trunk/xorp/xrl/scripts/thrift-tgt-gen 2009-12-07 19:22:56 UTC (rev 11685) @@ -0,0 +1,525 @@ +#! /usr/bin/env python +# vim:set sts=4 ts=8 sw=4: + +"""Program to generate Xrl Target related files""" + +from optparse import OptionParser +import os, sys + +# This is a bit of mess as this code was split into separate files +import Xif.util + +from Xif.util import \ + joining_csv, csv, cpp_name, cpp_classname, xorp_indent_string, \ + xorp_indent, method_name_of_xrl, service_name_of_xrl, \ + xrl_method_name + +from Xif.xiftypes import \ + XrlArg, XrlMethod, XrlInterface, XrlTarget + +from Xif.parse import \ + XifParser + +from Xif.thrifttypes import \ + wire_type, send_arg, recv_arg + +# ----------------------------------------------------------------------------- +# Target file output related +# ----------------------------------------------------------------------------- + +def target_declare_service_tables(cls, interfaces): + s = """ + // Thrift method table for each service in this XRL target + struct method_entry { + const char *name; + const XrlCmdError (%s::*method)(const int32_t); + }; + +""" % cls + + for i in interfaces.itervalues(): + s += " static const struct method_entry %s_methods[];\n" % i.name() + + s += """ + // Thrift service table for this XRL target + struct service_entry { + const char *name; + const struct method_entry * const methods; + }; + + static const struct service_entry services[]; +""" + s += "\n" + return s + +def target_define_method_table(cls, interface): + s = "" + s += "const struct %s::method_entry\n" % cls + s += "%s::%s_methods[] = {\n" % (cls, interface.name()) + for m in interface.methods(): + s += " { \"%s\",\n" % m.name() + s += " &%s::handle_%s_%s },\n" % \ + (cls, interface.name(), cpp_name(m.name())) + s += " { 0, 0 }\n" + s += "};\n\n" + return s + +# thrift tables are used by per-endpoint dispatch, in place +# of the centralized XrlDispatcher (service dispatch is now local to +# the endpoint and doesn't cross endpoint boundaries). + +def target_define_service_tables(cls, interfaces): + s = "" + s += "// Thrift method tables\n" + for i in interfaces.itervalues(): + s += target_define_method_table(cls, i) + # Define service table containing all service interfaces. + s += "\n" + s += "// Thrift service tables\n" + s += "const struct %s::service_entry\n" % cls + s += "%s::services[] = {\n" % cls + for i in interfaces.itervalues(): + s += " { \"%s\",\n" % i.name() + s += " %s::%s_methods },\n" % (cls, i.name()) + s += " { 0, 0 }\n" + s += "};\n\n" + return s + +def target_declare_virtual_fns(tgt, interfaces): + r = "" + for i in interfaces.itervalues(): + for m in i.methods(): + # Use fully-qualified XRL-style method name to avoid + # rewriting legacy code which uses these RPC stubs. + fqm = xrl_method_name(i.name(), i.version(), m.name()) + r += " virtual XrlCmdError %s("% cpp_name(fqm) + # input args + args = [] + if len(m.args()): + args.append("\n%s// Input values" % xorp_indent(2)) + for a in m.args(): + cpa = "\n%sconst %s&\t%s" % \ + (xorp_indent(2), a.cpp_type(), cpp_name(a.name())) + args.append(cpa) + # output args + if len(m.rargs()): + args.append("\n%s// Output values" % xorp_indent(2)) + for a in m.rargs(): + cpa = "\n%s%s&\t%s" % \ + (xorp_indent(2), a.cpp_type(), cpp_name(a.name())) + args.append(cpa) + r += csv(args) + r += ") = 0;\n\n" + # next method in interface + # next interface in target + return r + +def target_declare_services(interfaces): + s = "" + for i in interfaces.itervalues(): + for m in i.methods(): + s += " const XrlCmdError handle_%s_%s(" % \ + (i.name(), cpp_name(m.name())) + args = [ "const int32_t\trseqid" ] + for n in range(0, len(args)): + args[n] = "\n\t" + args[n] + s += csv(args) + s += ");\n\n" + return s; + +def target_declare_service_hooks(): + s = "" + s += " void add_services();\n" + s += " void remove_services();\n" + return s + +def target_define_service_hooks(cls, service_name): + s = "void\n%s::add_services()\n{\n" % cls + s += " for (const service_entry * sp = &services[0]; sp != 0; sp++) {\n" + s += " MethodTable* mt = _st->add_service(sp->name);\n" + s += " if (0 == mt) {\n" + s += " // raise an exception\n" + s += " }\n" + s += " for (const method_entry * mp = sp->methods; mp != 0; mp++) {\n" + s += " if (! mt->add_method(mp->name,\n" + s += " callback(this, mp->method))) {\n" + s += " // raise an exception\n" + s += " }\n" + s += " }\n" + s += " //_st->finalize();\n" + s += " }\n" + s += "}\n" + s += "\n" + s += "void\n%s::remove_services()\n{\n" % cls + s += " for (const service_entry * sp = &services[0]; sp != 0; sp++) {\n" + s += " MethodTable* mt = _st->method_table(sp->name);\n" + s += " for (const method_entry * mp = sp->methods; mp != 0; mp++) {\n" + s += " if (! mt->remove_method(mp->name)) {\n" + s += " // raise an exception\n" + s += " }\n" + s += " }\n" + s += " if (! _st->remove_service(sp->name)) {\n" + s += " // raise an exception\n" + s += " }\n" + s += " }\n" + s += "}\n" + return s; + +# +# Generate Thrift input code for XRL target method. +# Assumes message header for a T_CALL was read on inp already. +# +# TODO: Check for duplicate field IDs. +# +def service_method_input(cls, service_name, method): + s = "" + arg_checks_enabled = True + if len(method.args()) == 0: + s += " /* This method has no input arguments, skip input. */\n" + s += " nin += inp->skip(T_STRUCT);\n" + else: + if arg_checks_enabled: + s += "#ifndef XIF_DISABLE_TARGET_INPUT_CHECKS\n" + s += " bitset<%d> argf;\n" % len(method.args()) + s += "#endif\n" + s += "\n" + s += " /* Input value declarations */\n" + for a in method.args(): + s += " %s %s;\n" % (a.cpp_type(), cpp_name(a.name())) + s += "\n" + s += " /* Begin parsing method input struct */\n" + s += " string fname;\n" + s += " TType ftype;\n" + s += " int16_t fid;\n" + s += "\n" + s += " nin += inp->readStructBegin(fname);\n" + s += " for (;;) {\n" + s += " nin += inp->readFieldBegin(fname, ftype, fid);\n" + s += " if (ftype == T_STOP)\n" + s += " break;\n" + s += " switch (fid) {\n" + # Parse each field expected in this struct. + rfid = 0 + for a in method.args(): + rfid += 1 + s += " case %d:\n" % rfid + s += " if (ftype == %s) {\n" % wire_type(a) + for l in recv_arg(a): + s += xorp_indent(4) + l + "\n" + if arg_checks_enabled: + s += "#ifndef XIF_DISABLE_TARGET_INPUT_CHECKS\n" + s += " argf.set(%d);\n" % (rfid - 1) + s += "#endif\n" + s += " }\n" + s += " break;\n" + # Default is to skip unknown fields. + s += " default:\n" + s += " nin += inp->skip(ftype);\n" + s += " break;\n" + s += " }\n" + s += " nin += inp->readFieldEnd();\n" + s += " }\n" + s += " /* End parsing method input struct */\n" + s += "\n" + s += " nin += inp->readStructEnd();\n" + # end of return argument parsing + s += " nin += inp->readMessageEnd();\n" + s += " inp->getTransport()->readEnd();\n" + s += "\n" + # final argument count check + if len(method.args()) > 0 and arg_checks_enabled: + s += "#ifndef XIF_DISABLE_TARGET_INPUT_CHECKS\n" + s += " if (argf.count() != %d) {\n" % len(method.args()) + s += " return XrlCmdError::BAD_ARGS();\n" + s += " }\n" + s += "#endif\n" + s += "\n" + return s + +def service_method_dispatch(cls, interface, method): + s = "" + fqm = xrl_method_name(interface.name(), interface.version(), method.name()) + tab = xorp_indent(1) + s += tab + "/* Return value declarations */\n" + for r in method.rargs(): + s += tab + "%s %s;\n" % (r.cpp_type(), cpp_name(r.name())) + s += tab + "XrlCmdError e = %s(" % cpp_name(fqm) + params = [] + for a in method.args(): + params.append(a.name()) + for r in method.rargs(): + params.append(r.name()) + s += csv(params, ", ") + ");\n" + s += "\n" + s += tab + "if (e != XrlCmdError::OKAY()) {\n" + s += tab + " //XLOG_WARNING(\"Handling method for %%s failed: %%s\",\n" + s += tab + " // \"%s\", e.str().c_str());\n" % method.name() + s += tab + " return e;\n" + s += tab + "}\n" + s += "\n" + return s + +# +# Generate return value generator for Thrifted XIF method. +# These are always wrapped up as a struct, implicitly. We go one +# step further and we always wrap up the result in *another* +# struct if there are any return values. +# +def service_method_output(cls, service_name, method): + s = "" + tab = xorp_indent(1) + mname = method_name_of_xrl(method.name()) + rname = mname + "_result" + srname = service_name_of_xrl(method.name()) + "_" + rname + s += tab + "/* Marshall return values */\n" + s += tab + "nout += outp->writeMessageBegin(\"%s\", T_REPLY, rseqid);\n" % \ + (mname) + s += tab + "nout += outp->writeStructBegin(\"%s\");\n" % srname + if len(method.rargs()) > 0: + s += tab + "nout += outp->writeFieldBegin(\"success\", T_STRUCT, 0);\n" + # At this point, we start spoofing up a struct. This could in + # fact be a single field, but we force XIF->Thrift translated IDL + # to always wrap return values in a real struct. + s += tab + "nout += outp->writeStructBegin(\"%s\");\n" % rname + fid = 0 + for r in method.rargs(): + fid += 1 + lines = [] + lines.append("nout += outp->writeFieldBegin(\"%s\", %s, %d);" % \ + (r.name(), wire_type(r), fid)) + lines += send_arg(r) + lines.append("nout += outp->writeFieldEnd();") + for l in lines: + s += tab + l + "\n" + s += tab + "nout += outp->writeFieldStop();\n" + s += tab + "nout += outp->writeStructEnd();\n" + s += tab + "nout += outp->writeFieldStop();\n" + s += tab + "nout += outp->writeStructEnd();\n" + s += tab + "nout += outp->writeMessageEnd();\n" + s += "\n" + s += tab + "outp->getTransport()->flush();\n" + s += tab + "outp->getTransport()->writeEnd();\n" + s += "\n" + return s + +# +# Generate a Thrift-based target method from XIF method definition. +# +def service_method(cls, interface, method): + s = "" + s += "const XrlCmdError\n%s::handle_%s_%s(" % \ + (cls, interface.name(), cpp_name(method.name())) + args = [ "const int32_t\trseqid" ] + for i in range(0, len(args)): + args[i] = "\n\t" + args[i] + s += csv(args) + s += "\n)\n" + s += "{\n" + s += " using namespace apache::thrift::protocol;\n" + s += "\n" + s += " TProtocol *inp = 0;\n" + s += " TProtocol *outp = 0;\n" + s += " uint32_t nin = 0;\n" + s += " uint32_t nout = 0;\n" + s += "\n" + s += service_method_input(cls, interface.name(), method) + s += service_method_dispatch(cls, interface, method) + s += service_method_output(cls, interface.name(), method) + s += " return XrlCmdError::OKAY();\n" + s += "}\n\n" + return s + +def target_define_service_methods(cls, interfaces): + s = "" + for i in interfaces.itervalues(): + for m in i.methods(): + s += service_method(cls, i, m) + return s + +def protect(file): + # remove direcory component + r = file.rfind("/") + 1 + return "__XRL_TARGETS_%s__" % file[r:].upper().replace(".", "_") + +def prepare_target_hh(modulename, hh_file): + s = Xif.util.standard_preamble(1, hh_file) + s += \ +""" +#ifndef %s +#define %s + +#undef XORP_LIBRARY_NAME +#define XORP_LIBRARY_NAME "%s" + +//#include "libxorp/xlog.h" + +class XrlRouter; +class ServiceTable; + +""" % (protect(hh_file), protect(hh_file), modulename) + return s + +def output_target_hh(cls, tgt, interfaces): + s = """ +class %s { +private: + ServiceTable* _st; + string _name; + +public: + %s(ServiceTable* st = 0); + + virtual ~%s(); + + const string& name() const { return _name; } + const char* version() const { return "%s/%s"; } + +protected: +""" % (cls, cls, cls, tgt.name(), tgt.version()) + + s += target_declare_virtual_fns(tgt, interfaces) + s += "private:\n" + s += target_declare_services(interfaces) + s += target_declare_service_hooks() + s += target_declare_service_tables(cls, interfaces) + s += "};\n" + return s + +def finish_target_hh(hh_file): + return "\n#endif // %s\n" % protect(hh_file) + +def prepare_target_cc(target_hh, target_cc): + r = target_hh.rfind("/") + 1 + s = Xif.util.standard_preamble(0, target_cc) + s += \ +""" + +//#include "libxorp/xlog.h" +#include "libxorp/callback.hh" + +#include "libxipc/xrl_error.hh" +#include "libxipc/xrl_atom.hh" +#include "libxipc/xrl_atom_list.hh" +#include "libxipc/xrl_router.hh" +#include "libxipc/xrl_sender.hh" // XXX needed? + +#include "libxipc/service_table.hh" + +#include +#include +#include + +#include +#include +#include +#include + +#include "libxipc/xif_thrift.hh" // XXX for xif_read_*() + +#include // for argument counts + +""" + s += "\n#include \"%s\"\n\n" % target_hh[r:] + return s + +def output_target_cc(cls, tgt, interfaces): + s = target_define_service_tables(cls, interfaces) + s += """ +// Begin class definitions + +%s::%s(ServiceTable* st) + : _st(st), _name(\"%s\") +{ + if (_st) + add_services(); +} + +%s::~%s() +{ + if (_st) + remove_services(); +} + +""" % (cls, cls, tgt.name(), cls, cls) + s += target_define_service_methods(cls, interfaces) + s += target_define_service_hooks(cls, tgt) + + return s + +def main(): + usage = "usage: %prog [options] arg" + parser = OptionParser(usage) + parser.add_option("-o", "--output-dir", + action="store", + type="string", + dest="output_dir", + metavar="DIR") + parser.add_option("-I", + action="append", + type="string", + dest="includes", + metavar="DIR") + (options,args) = parser.parse_args() + + if len(args) != 1: + parser_error("incorrect number of arguments") + + # Command line arguments passed on to cpp + pipe_string = "cpp -C " + if options.includes: + for a in options.includes: + pipe_string += "-I%s " % a + pipe_string += args[0] + + cpp_pipe = os.popen(pipe_string, 'r') + + xp = XifParser(cpp_pipe) + + tgts = xp.targets() + if len(tgts) == 0: + print "Not targets found in input files." + sys.exit(1) + + sourcefile = tgts[0].sourcefile() + for tgt in tgts: + if (tgt.sourcefile() != sourcefile): + print "Multiple .tgt files presented, expected just one." + sys.exit(1) + + # basename transformation - this is a lame test + if sourcefile[-4:] != ".tgt": + print "Source file does not end in .tgt suffix - basename transform failure." + sys.exit(1) + + basename = sourcefile[:-4] + basename = basename[basename.rfind("/") + 1:] + + modulename = "Xrl%sTarget" % cpp_classname(basename) + hh_file = "%s_base.hh" % basename + cc_file = "%s_base.cc" % basename + + if options.output_dir: + hh_file = os.path.join(options.output_dir, hh_file) + cc_file = os.path.join(options.output_dir, cc_file) + + hh_txt = prepare_target_hh(modulename, hh_file) + cc_txt = prepare_target_cc(hh_file, cc_file) + + for tgt in xp.targets(): + # Because interfaces are loaded and parsed separately from targets, + # XrlTarget.interfaces is a list of tuples ("interface_name", + # "interface_version"). + # Produce a dictionary of interfaces actually referenced by this + # XRL target, from everything that has been parsed. + interfaces = dict((i.name(), i) for i in filter(lambda i: i.name() in \ + map(lambda x: x[0], tgt.interfaces()), xp.interfaces())) + cls = "Xrl%sTargetBase" % cpp_classname(tgt.name()) + hh_txt += output_target_hh(cls, tgt, interfaces) + hh_txt += finish_target_hh(hh_file) + cc_txt += output_target_cc(cls, tgt, interfaces) + + Xif.util.file_write_string(hh_file, hh_txt) + Xif.util.file_write_string(cc_file, cc_txt) + +if __name__ == '__main__': + main() Property changes on: trunk/xorp/xrl/scripts/thrift-tgt-gen ___________________________________________________________________ Added: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Fri Dec 11 02:18:39 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Fri, 11 Dec 2009 10:18:39 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11686] trunk/xorp/SConstruct Message-ID: Revision: 11686 http://xorp.svn.sourceforge.net/xorp/?rev=11686&view=rev Author: bms_fbsd Date: 2009-12-11 10:18:38 +0000 (Fri, 11 Dec 2009) Log Message: ----------- Ensure the builddir is explicitly created before referencing it. I couldn't reproduce this condition with a current SCons snapshot, which suggests the issue may only affect earlier SCons versions. Submitted by: Ben Greear Modified Paths: -------------- trunk/xorp/SConstruct Modified: trunk/xorp/SConstruct =================================================================== --- trunk/xorp/SConstruct 2009-12-07 19:22:56 UTC (rev 11685) +++ trunk/xorp/SConstruct 2009-12-11 10:18:38 UTC (rev 11686) @@ -122,6 +122,10 @@ SConsignFile(builddir + '/.sconsign') +try: + Execute(Mkdir(builddir)) +except: + pass log_args(builddir + '/.scons_build_args') # XXX TODO: Make initial CPPPATH/LIBPATH derive from This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. From bms_fbsd at users.sourceforge.net Tue Dec 15 05:41:53 2009 From: bms_fbsd at users.sourceforge.net (bms_fbsd at users.sourceforge.net) Date: Tue, 15 Dec 2009 13:41:53 +0000 Subject: [Xorp-cvs] SF.net SVN: xorp:[11687] trunk/xorp/SConstruct Message-ID: Revision: 11687 http://xorp.svn.sourceforge.net/xorp/?rev=11687&view=rev Author: bms_fbsd Date: 2009-12-15 13:41:53 +0000 (Tue, 15 Dec 2009) Log Message: ----------- Forcibly disable Boost's thread support; the XORP code base is not yet threaded. This is mostly to mitigate the performance effects of introducing smart_ptr/weak_ptr. It will try to use arch-dependent atomic instructions in sp_counted_base where possible; it falls back to spinlocks if the inline assembly is not available. Modified Paths: -------------- trunk/xorp/SConstruct Modified: trunk/xorp/SConstruct =================================================================== --- trunk/xorp/SConstruct 2009-12-11 10:18:38 UTC (rev 11686) +++ trunk/xorp/SConstruct 2009-12-15 13:41:53 UTC (rev 11687) @@ -529,6 +529,12 @@ ( '_FORTIFY_SOURCE', 0 ), ]) +# Forcibly disable Boost's thread support; the XORP code base is +# not yet threaded. +env.AppendUnique(CPPDEFINES = [ + ( 'BOOST_DISABLE_THREADS' ), + ]) + # NOTE: gcc specific flags. env.AppendUnique(CFLAGS = [ '-Werror', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.