summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrazb <razb@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-04-01 21:14:46 +0000
committerrazb <razb@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-04-01 21:14:46 +0000
commit8e3487ac18ee569b74fb542137b77cd6064f5ed9 (patch)
tree968ce0534f52b0f5bcf087e2db4987033d1d1e62
parentbabc813b7952ecd36dac219e49d8fdb6bd405b6e (diff)
downloadATCD-8e3487ac18ee569b74fb542137b77cd6064f5ed9.tar.gz
*** empty log message ***
-rw-r--r--examples/netlink_pingpong/netlink_pingpong.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/examples/netlink_pingpong/netlink_pingpong.cpp b/examples/netlink_pingpong/netlink_pingpong.cpp
new file mode 100644
index 00000000000..9a4883f9e76
--- /dev/null
+++ b/examples/netlink_pingpong/netlink_pingpong.cpp
@@ -0,0 +1,38 @@
+// $Id$
+
+/*! \file netlink_pingpong.cpp
+ \brief a ping pong netlink tester
+
+ Why use netlink sockets as a communication facilty bettwen kernel to user space application ?
+
+ 1. netlink sockets are used all over the kernel which means that this technology is tested.
+ 2. easy to use.
+ 3. The netlink is non-reliable protocol. Though it seems funny, the last thing you need when your system
+ is under heavy load is retransmission and new allocations.
+ 4. The socket and the socket buffer ( sk_buff ) interfaces supply you a handfull of utilties. ( enquee,dequeu..).
+ 5. As fat as i know, the user space interface remained unchanged from 2.4 to 2.6 .
+
+ One bad thing I've noticed about it is that the buffers are reallocted in the kernel in sending.
+ look at line 670 in lxr at af_netlink.c in kernel 2.6.5.
+
+*/
+
+#include <iostream>
+#include <cstdlib>
+#include "netlinkgateway.h"
+
+using namespace std;
+
+int main(int argc, char *argv[])
+{
+ cout << "Hello, world! for netlink ping pong reactor " << endl;
+ if ( 0>CNetlinkGateway::instance()->open() ){
+ cout << "failed to open netlinkgateway" << endl;
+ return -1;
+ }
+
+ CNetlinkGateway::instance()->reactor(ACE_Reactor::instance ());
+ CNetlinkGateway::instance()->Start();
+ ACE_Reactor::instance ()->run_reactor_event_loop ();
+ return 0;
+}