[Xorp-cvs] SF.net SVN: xorp:[11666] trunk/xorp
bms_fbsd at users.sourceforge.net
bms_fbsd at users.sourceforge.net
Thu Dec 3 15:20:53 PST 2009
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 <stdio.h>
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#include <string.h>
-
-#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<Node>::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 <key,value> 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 <list>
-#include <map>
-
-
-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<Node> _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<string, string> _map;
- typedef map<string, string>::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 <stdio.h>
-#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 <map>
-
-#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 <map>
#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 <map>
-
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#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<uint32_t> 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<uint32_t, XrlPFInProcListener*> listeners;
-
-static XrlPFInProcListener*
-get_inproc_listener(uint32_t instance_no)
-{
- map<uint32_t, XrlPFInProcListener*>::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<uint32_t> _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 <sys/ioctl.h>
-#endif
-#ifdef HAVE_SYS_UIO_H
-#include <sys/uio.h>
-#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 <sys/ioctl.h>
-#endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#ifdef HAVE_SYS_UIO_H
-#include <sys/uio.h>
-#endif
-
-#include <errno.h>
-
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <string>
-
-#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<const XUID, Request> 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<XuidRequestMap::iterator, bool> 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<uint32_t>(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<const XUID, Request>::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<const XUID, Request>::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<uint32_t>(reply.size()));
-
- struct iovec v[2];
- v[0].iov_base = const_cast<char*>(header.c_str());
- v[0].iov_len = header.size();
- v[1].iov_base = const_cast<char*>(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.
More information about the Xorp-cvs
mailing list