cleanup patch
authorHajime Tazaki <tazaki@nict.go.jp>
Wed, 04 Jul 2012 17:06:26 +0900
changeset 2402787e1dfd96
parent 23 7f0e375f8523
child 25 7d5166e0dc25
cleanup patch
120410-dce-umip-support.patch
dce_test_improve.patch
dns_bind9.patch
dns_unbound.patch
hana-dce.patch
himalis.patch
series
     1.1 --- a/120410-dce-umip-support.patch	Thu Jun 21 17:26:37 2012 +0900
     1.2 +++ b/120410-dce-umip-support.patch	Wed Jul 04 17:06:26 2012 +0900
     1.3 @@ -1,8 +1,8 @@
     1.4  support umip(mip6d) with ns-3-linux for NEMO/MIP6
     1.5  
     1.6 -diff -r 056220694d84 model/dce-fd.cc
     1.7 ---- a/model/dce-fd.cc	Sat Jun 02 00:22:49 2012 +0900
     1.8 -+++ b/model/dce-fd.cc	Sat Jun 02 00:27:53 2012 +0900
     1.9 +diff -r d540b4660837 model/dce-fd.cc
    1.10 +--- a/model/dce-fd.cc	Fri Jun 29 14:47:27 2012 +0900
    1.11 ++++ b/model/dce-fd.cc	Fri Jun 29 18:26:32 2012 +0900
    1.12  @@ -367,11 +367,30 @@
    1.13       }
    1.14   
    1.15 @@ -34,9 +34,9 @@
    1.16   int dce_bind (int fd, const struct sockaddr *my_addr, socklen_t addrlen)
    1.17   {
    1.18     Thread *current = Current ();
    1.19 -diff -r 056220694d84 model/dce-manager.cc
    1.20 ---- a/model/dce-manager.cc	Sat Jun 02 00:22:49 2012 +0900
    1.21 -+++ b/model/dce-manager.cc	Sat Jun 02 00:27:53 2012 +0900
    1.22 +diff -r d540b4660837 model/dce-manager.cc
    1.23 +--- a/model/dce-manager.cc	Fri Jun 29 14:47:27 2012 +0900
    1.24 ++++ b/model/dce-manager.cc	Fri Jun 29 18:26:32 2012 +0900
    1.25  @@ -1096,6 +1096,22 @@
    1.26             libpthread_setup = (void (*)(const struct Libc *))(symbol);
    1.27             libpthread_setup (libc);
    1.28 @@ -60,9 +60,9 @@
    1.29             // finally, call into 'main'.
    1.30             h = ld->Load (filename, RTLD_GLOBAL);
    1.31   
    1.32 -diff -r 056220694d84 model/dce-poll.cc
    1.33 ---- a/model/dce-poll.cc	Sat Jun 02 00:22:49 2012 +0900
    1.34 -+++ b/model/dce-poll.cc	Sat Jun 02 00:27:53 2012 +0900
    1.35 +diff -r d540b4660837 model/dce-poll.cc
    1.36 +--- a/model/dce-poll.cc	Fri Jun 29 14:47:27 2012 +0900
    1.37 ++++ b/model/dce-poll.cc	Fri Jun 29 18:26:32 2012 +0900
    1.38  @@ -180,7 +180,12 @@
    1.39           }
    1.40       }
    1.41 @@ -77,9 +77,9 @@
    1.42       {
    1.43         current->err = EINVAL;
    1.44         return -1;
    1.45 -diff -r 056220694d84 model/dce-signal.cc
    1.46 ---- a/model/dce-signal.cc	Sat Jun 02 00:22:49 2012 +0900
    1.47 -+++ b/model/dce-signal.cc	Sat Jun 02 00:27:53 2012 +0900
    1.48 +diff -r d540b4660837 model/dce-signal.cc
    1.49 +--- a/model/dce-signal.cc	Fri Jun 29 14:47:27 2012 +0900
    1.50 ++++ b/model/dce-signal.cc	Fri Jun 29 18:26:32 2012 +0900
    1.51  @@ -3,6 +3,7 @@
    1.52   #include "process.h"
    1.53   #include "ns3/log.h"
    1.54 @@ -106,9 +106,9 @@
    1.55   int dce_sigprocmask(int how, const sigset_t *set, sigset_t *oldset)
    1.56   {
    1.57     Thread *current = Current ();
    1.58 -diff -r 056220694d84 model/dce-signal.h
    1.59 ---- a/model/dce-signal.h	Sat Jun 02 00:22:49 2012 +0900
    1.60 -+++ b/model/dce-signal.h	Sat Jun 02 00:27:53 2012 +0900
    1.61 +diff -r d540b4660837 model/dce-signal.h
    1.62 +--- a/model/dce-signal.h	Fri Jun 29 14:47:27 2012 +0900
    1.63 ++++ b/model/dce-signal.h	Fri Jun 29 18:26:32 2012 +0900
    1.64  @@ -17,6 +17,7 @@
    1.65   int dce_pthread_kill (pthread_t thread, int sig);
    1.66   void dce_abort ();
    1.67 @@ -117,9 +117,9 @@
    1.68   
    1.69   #ifdef __cplusplus
    1.70   }
    1.71 -diff -r 056220694d84 model/dce-string.cc
    1.72 ---- a/model/dce-string.cc	Sat Jun 02 00:22:49 2012 +0900
    1.73 -+++ b/model/dce-string.cc	Sat Jun 02 00:27:53 2012 +0900
    1.74 +diff -r d540b4660837 model/dce-string.cc
    1.75 +--- a/model/dce-string.cc	Fri Jun 29 14:47:27 2012 +0900
    1.76 ++++ b/model/dce-string.cc	Fri Jun 29 18:26:32 2012 +0900
    1.77  @@ -26,3 +26,9 @@
    1.78     /// \todo Do actual checking
    1.79     strcpy (__dest, __src); 
    1.80 @@ -130,9 +130,9 @@
    1.81  +  return strrchr (s, c);
    1.82  +}
    1.83  +
    1.84 -diff -r 056220694d84 model/dce-string.h
    1.85 ---- a/model/dce-string.h	Sat Jun 02 00:22:49 2012 +0900
    1.86 -+++ b/model/dce-string.h	Sat Jun 02 00:27:53 2012 +0900
    1.87 +diff -r d540b4660837 model/dce-string.h
    1.88 +--- a/model/dce-string.h	Fri Jun 29 14:47:27 2012 +0900
    1.89 ++++ b/model/dce-string.h	Fri Jun 29 18:26:32 2012 +0900
    1.90  @@ -12,6 +12,7 @@
    1.91   char *dce___strcpy_chk (char *__restrict __dest,
    1.92   						const char *__restrict __src,
    1.93 @@ -141,9 +141,9 @@
    1.94   
    1.95   #ifdef __cplusplus
    1.96   }
    1.97 -diff -r 056220694d84 model/dce-time.cc
    1.98 ---- a/model/dce-time.cc	Sat Jun 02 00:22:49 2012 +0900
    1.99 -+++ b/model/dce-time.cc	Sat Jun 02 00:27:53 2012 +0900
   1.100 +diff -r d540b4660837 model/dce-time.cc
   1.101 +--- a/model/dce-time.cc	Fri Jun 29 14:47:27 2012 +0900
   1.102 ++++ b/model/dce-time.cc	Fri Jun 29 18:26:32 2012 +0900
   1.103  @@ -54,3 +54,12 @@
   1.104   
   1.105     return asctime_r (tm, Current ()->process->asctime_result);
   1.106 @@ -157,9 +157,9 @@
   1.107  +  *tp = UtilsTimeToTimespec (UtilsSimulationTimeToTime (Now ()));
   1.108  +  return 0;
   1.109  +}
   1.110 -diff -r 056220694d84 model/dce-time.h
   1.111 ---- a/model/dce-time.h	Sat Jun 02 00:22:49 2012 +0900
   1.112 -+++ b/model/dce-time.h	Sat Jun 02 00:27:53 2012 +0900
   1.113 +diff -r d540b4660837 model/dce-time.h
   1.114 +--- a/model/dce-time.h	Fri Jun 29 14:47:27 2012 +0900
   1.115 ++++ b/model/dce-time.h	Fri Jun 29 18:26:32 2012 +0900
   1.116  @@ -3,6 +3,7 @@
   1.117   
   1.118   #include "sys/dce-time.h"
   1.119 @@ -177,9 +177,9 @@
   1.120   	
   1.121   #ifdef __cplusplus
   1.122   }
   1.123 -diff -r 056220694d84 model/dce.cc
   1.124 ---- a/model/dce.cc	Sat Jun 02 00:22:49 2012 +0900
   1.125 -+++ b/model/dce.cc	Sat Jun 02 00:27:53 2012 +0900
   1.126 +diff -r d540b4660837 model/dce.cc
   1.127 +--- a/model/dce.cc	Fri Jun 29 14:47:27 2012 +0900
   1.128 ++++ b/model/dce.cc	Fri Jun 29 18:26:32 2012 +0900
   1.129  @@ -22,6 +22,8 @@
   1.130   #include <getopt.h>
   1.131   #include <limits.h>
   1.132 @@ -289,9 +289,9 @@
   1.133   #ifdef HAVE_GETCPUFEATURES
   1.134   extern "C"
   1.135   {
   1.136 -diff -r 056220694d84 model/elf-cache.cc
   1.137 ---- a/model/elf-cache.cc	Sat Jun 02 00:22:49 2012 +0900
   1.138 -+++ b/model/elf-cache.cc	Sat Jun 02 00:27:53 2012 +0900
   1.139 +diff -r d540b4660837 model/elf-cache.cc
   1.140 +--- a/model/elf-cache.cc	Fri Jun 29 14:47:27 2012 +0900
   1.141 ++++ b/model/elf-cache.cc	Fri Jun 29 18:26:32 2012 +0900
   1.142  @@ -26,6 +26,9 @@
   1.143     overriden.from = "libpthread.so.0";
   1.144     overriden.to = "libpthread-ns3.so";
   1.145 @@ -302,9 +302,9 @@
   1.146   }
   1.147   
   1.148   std::string
   1.149 -diff -r 056220694d84 model/libc-ns3.h
   1.150 ---- a/model/libc-ns3.h	Sat Jun 02 00:22:49 2012 +0900
   1.151 -+++ b/model/libc-ns3.h	Sat Jun 02 00:27:53 2012 +0900
   1.152 +diff -r d540b4660837 model/libc-ns3.h
   1.153 +--- a/model/libc-ns3.h	Fri Jun 29 14:47:27 2012 +0900
   1.154 ++++ b/model/libc-ns3.h	Fri Jun 29 18:26:32 2012 +0900
   1.155  @@ -124,7 +124,8 @@
   1.156   NATIVE (strcspn)
   1.157   NATIVE (strspn)
   1.158 @@ -335,16 +335,17 @@
   1.159   DCE (getsockname)
   1.160   DCE (getpeername)
   1.161   DCE (bind)
   1.162 -@@ -312,7 +316,7 @@
   1.163 +@@ -312,7 +316,8 @@
   1.164   NATIVE_WITH_ALIAS2 (gmtime_r, localtime_r)
   1.165   NATIVE (mktime)
   1.166   NATIVE (strftime)
   1.167  -NATIVE_WITH_ALIAS2 (clock_gettime, __vdso_clock_gettime) // this is wrong. clock should be changed to DCE implementation
   1.168 -+DCE_WITH_ALIAS2 (clock_gettime, __vdso_clock_gettime)
   1.169 ++//DCE_WITH_ALIAS2 (clock_gettime, __vdso_clock_gettime)
   1.170 ++DCE (clock_gettime)
   1.171   
   1.172   // SYS/TIME.H
   1.173   DCE (gettimeofday)
   1.174 -@@ -320,6 +324,8 @@
   1.175 +@@ -320,6 +325,8 @@
   1.176   DCE (setitimer)
   1.177   DCE (getitimer)
   1.178   
   1.179 @@ -353,7 +354,7 @@
   1.180   // SYS/MAP.H
   1.181   DCE (mmap)
   1.182   DCE (mmap64)
   1.183 -@@ -347,6 +353,7 @@
   1.184 +@@ -347,6 +354,7 @@
   1.185   NATIVE (sigdelset)
   1.186   NATIVE (sigismember)
   1.187   DCE (sigprocmask)
   1.188 @@ -361,7 +362,7 @@
   1.189   
   1.190   // PTHREAD.H
   1.191   DCE (pthread_create)
   1.192 -@@ -377,6 +384,13 @@
   1.193 +@@ -377,6 +385,13 @@
   1.194   DCE (pthread_cond_wait)
   1.195   DCE (pthread_condattr_destroy)
   1.196   DCE (pthread_condattr_init)
   1.197 @@ -375,7 +376,7 @@
   1.198   
   1.199   // SEMAPHORE.H
   1.200   DCE (sem_init)
   1.201 -@@ -420,6 +434,7 @@
   1.202 +@@ -420,6 +435,7 @@
   1.203   
   1.204   // NET/IF.H
   1.205   DCE (if_nametoindex)
   1.206 @@ -383,7 +384,7 @@
   1.207   
   1.208   // DIRENT.H
   1.209   DCE (opendir)
   1.210 -@@ -479,6 +494,7 @@
   1.211 +@@ -479,6 +495,7 @@
   1.212   
   1.213   // NETINET/ETHER.H
   1.214   NATIVE (ether_aton_r)
   1.215 @@ -391,18 +392,18 @@
   1.216   
   1.217   ///////////////////// END OF INVENTAIRE //////////////////////////////////////////////////
   1.218   
   1.219 -diff -r 056220694d84 model/librt-ns3.version
   1.220 +diff -r d540b4660837 model/librt-ns3.version
   1.221  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   1.222 -+++ b/model/librt-ns3.version	Sat Jun 02 00:27:53 2012 +0900
   1.223 ++++ b/model/librt-ns3.version	Fri Jun 29 18:26:32 2012 +0900
   1.224  @@ -0,0 +1,4 @@
   1.225  +NS3 {
   1.226  +global:
   1.227  +	librt_setup;
   1.228  +};
   1.229 -diff -r 056220694d84 model/linux-socket-fd-factory.cc
   1.230 ---- a/model/linux-socket-fd-factory.cc	Sat Jun 02 00:22:49 2012 +0900
   1.231 -+++ b/model/linux-socket-fd-factory.cc	Sat Jun 02 00:27:53 2012 +0900
   1.232 -@@ -464,6 +464,7 @@
   1.233 +diff -r d540b4660837 model/linux-socket-fd-factory.cc
   1.234 +--- a/model/linux-socket-fd-factory.cc	Fri Jun 29 14:47:27 2012 +0900
   1.235 ++++ b/model/linux-socket-fd-factory.cc	Fri Jun 29 18:26:32 2012 +0900
   1.236 +@@ -466,6 +466,7 @@
   1.237   void
   1.238   LinuxSocketFdFactory::SetTask (std::string path, std::string value)
   1.239   {
   1.240 @@ -410,7 +411,7 @@
   1.241     std::vector<std::pair<std::string,struct SimSysFile *> > files = GetSysFileList ();
   1.242     for (uint32_t i = 0; i < files.size (); i++)
   1.243       {
   1.244 -@@ -537,6 +538,7 @@
   1.245 +@@ -539,6 +540,7 @@
   1.246                                                         this));
   1.247     Set (".net.ipv4.conf.all.forwarding", "1");
   1.248     Set (".net.ipv4.conf.all.log_martians", "1");
   1.249 @@ -418,9 +419,9 @@
   1.250   
   1.251     while (!m_earlySysfs.empty ())
   1.252       {
   1.253 -diff -r 056220694d84 model/net/dce-if.h
   1.254 ---- a/model/net/dce-if.h	Sat Jun 02 00:22:49 2012 +0900
   1.255 -+++ b/model/net/dce-if.h	Sat Jun 02 00:27:53 2012 +0900
   1.256 +diff -r d540b4660837 model/net/dce-if.h
   1.257 +--- a/model/net/dce-if.h	Fri Jun 29 14:47:27 2012 +0900
   1.258 ++++ b/model/net/dce-if.h	Fri Jun 29 18:26:32 2012 +0900
   1.259  @@ -7,6 +7,7 @@
   1.260   #endif
   1.261   
   1.262 @@ -429,9 +430,9 @@
   1.263   
   1.264   
   1.265   #ifdef __cplusplus
   1.266 -diff -r 056220694d84 model/ns3-socket-fd-factory.cc
   1.267 ---- a/model/ns3-socket-fd-factory.cc	Sat Jun 02 00:22:49 2012 +0900
   1.268 -+++ b/model/ns3-socket-fd-factory.cc	Sat Jun 02 00:27:53 2012 +0900
   1.269 +diff -r d540b4660837 model/ns3-socket-fd-factory.cc
   1.270 +--- a/model/ns3-socket-fd-factory.cc	Fri Jun 29 14:47:27 2012 +0900
   1.271 ++++ b/model/ns3-socket-fd-factory.cc	Fri Jun 29 18:26:32 2012 +0900
   1.272  @@ -166,6 +166,7 @@
   1.273     else
   1.274       {
   1.275 @@ -440,9 +441,9 @@
   1.276       }
   1.277   
   1.278     return socket;
   1.279 -diff -r 056220694d84 model/sys/dce-socket.h
   1.280 ---- a/model/sys/dce-socket.h	Sat Jun 02 00:22:49 2012 +0900
   1.281 -+++ b/model/sys/dce-socket.h	Sat Jun 02 00:27:53 2012 +0900
   1.282 +diff -r d540b4660837 model/sys/dce-socket.h
   1.283 +--- a/model/sys/dce-socket.h	Fri Jun 29 14:47:27 2012 +0900
   1.284 ++++ b/model/sys/dce-socket.h	Fri Jun 29 18:26:32 2012 +0900
   1.285  @@ -28,6 +28,7 @@
   1.286   ssize_t dce_sendmsg(int s, const struct msghdr *msg, int flags);
   1.287   int dce_getsockname(int s, struct sockaddr *name, socklen_t *namelen);
   1.288 @@ -451,9 +452,9 @@
   1.289   
   1.290   #ifdef __cplusplus
   1.291   }
   1.292 -diff -r 056220694d84 test/test-select.cc
   1.293 ---- a/test/test-select.cc	Sat Jun 02 00:22:49 2012 +0900
   1.294 -+++ b/test/test-select.cc	Sat Jun 02 00:27:53 2012 +0900
   1.295 +diff -r d540b4660837 test/test-select.cc
   1.296 +--- a/test/test-select.cc	Fri Jun 29 14:47:27 2012 +0900
   1.297 ++++ b/test/test-select.cc	Fri Jun 29 18:26:32 2012 +0900
   1.298  @@ -43,9 +43,20 @@
   1.299     struct timeval timeout =
   1.300     { 0, 0 };
   1.301 @@ -476,10 +477,10 @@
   1.302   }
   1.303   
   1.304   static bool
   1.305 -diff -r 056220694d84 wscript
   1.306 ---- a/wscript	Sat Jun 02 00:22:49 2012 +0900
   1.307 -+++ b/wscript	Sat Jun 02 00:27:53 2012 +0900
   1.308 -@@ -71,6 +71,17 @@
   1.309 +diff -r d540b4660837 wscript
   1.310 +--- a/wscript	Fri Jun 29 14:47:27 2012 +0900
   1.311 ++++ b/wscript	Fri Jun 29 18:26:32 2012 +0900
   1.312 +@@ -74,6 +74,17 @@
   1.313           conf.end_msg(libpthread, True)
   1.314       conf.env['LIBPTHREAD_FILE'] = libpthread
   1.315   
   1.316 @@ -497,7 +498,7 @@
   1.317       conf.find_program('readversiondef', var='READVERSIONDEF', mandatory=True)
   1.318   
   1.319       if Options.options.kernel_stack is not None and os.path.isdir(Options.options.kernel_stack):
   1.320 -@@ -429,6 +440,11 @@
   1.321 +@@ -441,6 +452,11 @@
   1.322           rule='%s %s | cat ${SRC[0].abspath()} - > ${TGT}' %
   1.323           (bld.env['READVERSIONDEF'], bld.env['LIBPTHREAD_FILE']))
   1.324   
   1.325 @@ -509,7 +510,7 @@
   1.326       bld.add_group('dce_use_version_files')
   1.327   
   1.328       # The very small libc used to replace the glibc
   1.329 -@@ -448,3 +464,13 @@
   1.330 +@@ -460,5 +476,15 @@
   1.331                 linkflags=['-nostdlib', '-lc',
   1.332                            '-Wl,--version-script=' + os.path.join('model', 'libpthread.version'),
   1.333                            '-Wl,-soname=libpthread.so.0'])
   1.334 @@ -523,3 +524,5 @@
   1.335  +                         '-Wl,--version-script=' + os.path.join('model', 'librt.version'),
   1.336  +                         '-Wl,-soname=librt.so.1'])
   1.337  +
   1.338 +     if bld.env['ENABLE_VDL']:                     
   1.339 +         bld.add_subdirs(['utils'])
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/dce_test_improve.patch	Wed Jul 04 17:06:26 2012 +0900
     2.3 @@ -0,0 +1,36 @@
     2.4 +diff -r 79c17eb3f698 -r 27bc248c09ff utils/dce-runner.c
     2.5 +--- a/utils/dce-runner.c	Mon Jun 25 14:31:51 2012 +0900
     2.6 ++++ b/utils/dce-runner.c	Wed Jun 27 11:22:47 2012 +0900
     2.7 +@@ -57,9 +57,30 @@
     2.8 +       return 1;
     2.9 +     }
    2.10 +   void *entry = lookup_entry_point (h);
    2.11 +-  argv[-1] = (char*)((long)argc);
    2.12 ++  argv[-1] = (char*)((long)3);
    2.13 +   argv[0] = argv[1];
    2.14 +-  argv[1] = "--ns3::DceManagerHelper::LoaderFactory=ns3::DlmLoaderFactory[]";
    2.15 ++
    2.16 ++  /* Default is DlmLoader */
    2.17 ++  if (argc > 2 &&
    2.18 ++      strncmp (argv[2], "--cooja", 4) == 0)
    2.19 ++    {
    2.20 ++      argv[1] = "--ns3::DceManagerHelper::LoaderFactory=ns3::CoojaLoaderFactory[]";
    2.21 ++    }
    2.22 ++  else
    2.23 ++    {
    2.24 ++      argv[1] = "--ns3::DceManagerHelper::LoaderFactory=ns3::DlmLoaderFactory[]";
    2.25 ++    }
    2.26 ++
    2.27 ++  /* Default is PthreadFiber */
    2.28 ++  if (argc > 3 &&
    2.29 ++      strncmp (argv[3], "--ucontext", 4) == 0)
    2.30 ++    {
    2.31 ++      argv[2] = "--ns3::TaskManager::FiberManagerType=UcontextFiberManager";
    2.32 ++    }
    2.33 ++  else
    2.34 ++    {
    2.35 ++      argv[2] = "--ns3::TaskManager::FiberManagerType=PthreadFiberManager";
    2.36 ++    }
    2.37 + #if defined (__x86_64__)
    2.38 +   __asm__ ("\txor %%rbp,%%rbp\n"
    2.39 + 	   "\txor %%rdx,%%rdx\n"
     3.1 --- a/dns_bind9.patch	Thu Jun 21 17:26:37 2012 +0900
     3.2 +++ b/dns_bind9.patch	Wed Jul 04 17:06:26 2012 +0900
     3.3 @@ -1,6 +1,6 @@
     3.4 -diff -r 7d0d6d7cda40 example/dce-unbound.cc
     3.5 ---- a/example/dce-unbound.cc	Thu Apr 26 11:21:55 2012 +0900
     3.6 -+++ b/example/dce-unbound.cc	Fri Apr 27 19:40:18 2012 +0900
     3.7 +diff -r 47d46e790e10 example/dce-unbound.cc
     3.8 +--- a/example/dce-unbound.cc	Wed Jul 04 16:59:42 2012 +0900
     3.9 ++++ b/example/dce-unbound.cc	Wed Jul 04 17:00:29 2012 +0900
    3.10  @@ -47,8 +47,8 @@
    3.11   
    3.12     DceManagerHelper processManager;
    3.13 @@ -38,9 +38,9 @@
    3.14   
    3.15     for (int i = 0; i < 20; i++)
    3.16       {
    3.17 -diff -r 7d0d6d7cda40 model/dce-netdb.cc
    3.18 ---- a/model/dce-netdb.cc	Thu Apr 26 11:21:55 2012 +0900
    3.19 -+++ b/model/dce-netdb.cc	Fri Apr 27 19:40:18 2012 +0900
    3.20 +diff -r 47d46e790e10 model/dce-netdb.cc
    3.21 +--- a/model/dce-netdb.cc	Wed Jul 04 16:59:42 2012 +0900
    3.22 ++++ b/model/dce-netdb.cc	Wed Jul 04 17:00:29 2012 +0900
    3.23  @@ -8,6 +8,15 @@
    3.24   #include <string.h>
    3.25   #include "process.h"
    3.26 @@ -777,9 +777,9 @@
    3.27  +
    3.28  +  return 0;
    3.29  +}
    3.30 -diff -r 7d0d6d7cda40 model/dce-netdb.h
    3.31 ---- a/model/dce-netdb.h	Thu Apr 26 11:21:55 2012 +0900
    3.32 -+++ b/model/dce-netdb.h	Fri Apr 27 19:40:18 2012 +0900
    3.33 +diff -r 47d46e790e10 model/dce-netdb.h
    3.34 +--- a/model/dce-netdb.h	Wed Jul 04 16:59:42 2012 +0900
    3.35 ++++ b/model/dce-netdb.h	Wed Jul 04 17:00:29 2012 +0900
    3.36  @@ -18,6 +18,7 @@
    3.37                          socklen_t hostlen, char *serv, socklen_t servlen, unsigned int flags);
    3.38   
    3.39 @@ -788,9 +788,9 @@
    3.40   
    3.41   #ifdef __cplusplus
    3.42   }
    3.43 -diff -r 7d0d6d7cda40 model/dce-syslog.cc
    3.44 ---- a/model/dce-syslog.cc	Thu Apr 26 11:21:55 2012 +0900
    3.45 -+++ b/model/dce-syslog.cc	Fri Apr 27 19:40:18 2012 +0900
    3.46 +diff -r 47d46e790e10 model/dce-syslog.cc
    3.47 +--- a/model/dce-syslog.cc	Wed Jul 04 16:59:42 2012 +0900
    3.48 ++++ b/model/dce-syslog.cc	Wed Jul 04 17:00:29 2012 +0900
    3.49  @@ -66,6 +66,7 @@
    3.50     Process *process = Current ()->process;
    3.51   
    3.52 @@ -799,9 +799,9 @@
    3.53   }
    3.54   
    3.55   void
    3.56 -diff -r 7d0d6d7cda40 model/libc-dce.cc
    3.57 ---- a/model/libc-dce.cc	Thu Apr 26 11:21:55 2012 +0900
    3.58 -+++ b/model/libc-dce.cc	Fri Apr 27 19:40:18 2012 +0900
    3.59 +diff -r 47d46e790e10 model/libc-dce.cc
    3.60 +--- a/model/libc-dce.cc	Wed Jul 04 16:59:42 2012 +0900
    3.61 ++++ b/model/libc-dce.cc	Wed Jul 04 17:00:29 2012 +0900
    3.62  @@ -89,6 +89,7 @@
    3.63   #include <inttypes.h>
    3.64   #include <error.h>
    3.65 @@ -810,42 +810,44 @@
    3.66   
    3.67   extern void __cxa_finalize (void *d);
    3.68   extern int __cxa_atexit (void (*func) (void *), void *arg, void *d);
    3.69 -diff -r 7d0d6d7cda40 model/libc-ns3.h
    3.70 ---- a/model/libc-ns3.h	Thu Apr 26 11:21:55 2012 +0900
    3.71 -+++ b/model/libc-ns3.h	Fri Apr 27 19:40:18 2012 +0900
    3.72 -@@ -167,6 +167,8 @@
    3.73 - DCE_WITH_ALIAS2 (fileno,fileno_unlocked)
    3.74 - 
    3.75 - DCE    (perror)
    3.76 +diff -r 47d46e790e10 model/libc-ns3.h
    3.77 +--- a/model/libc-ns3.h	Wed Jul 04 16:59:42 2012 +0900
    3.78 ++++ b/model/libc-ns3.h	Wed Jul 04 17:00:29 2012 +0900
    3.79 +@@ -297,6 +297,10 @@
    3.80 + DCE (remove)
    3.81 + //NATIVE (sscanf)
    3.82 + NATIVE_WITH_ALIAS2 (sscanf, __isoc99_sscanf)
    3.83  +NATIVE (flockfile)
    3.84  +NATIVE (funlockfile)
    3.85 ++ 
    3.86 ++
    3.87   
    3.88 - // stdarg
    3.89 - DCE    (vprintf)
    3.90 -@@ -369,6 +371,8 @@
    3.91 - DCE    (gethostbyname)
    3.92 - DCE    (gethostbyname2)
    3.93 - DCE    (getaddrinfo)
    3.94 + // STDARG.H
    3.95 + DCE (vprintf)
    3.96 +@@ -415,6 +419,8 @@
    3.97 + DCE (gethostbyname2)
    3.98 + DCE (getaddrinfo)
    3.99 + DCE (freeaddrinfo)
   3.100  +DCE    (getifaddrs)
   3.101  +NATIVE (freeifaddrs)
   3.102 - // these three calls will effectively use /etc/passwd on the base system 
   3.103 + DCE (gai_strerror)
   3.104   NATIVE (gethostent)
   3.105   NATIVE (sethostent)
   3.106 -@@ -440,6 +444,8 @@
   3.107 +@@ -475,6 +481,8 @@
   3.108   
   3.109 - // sys/resource.h
   3.110 + // SYS/RESOURCE.H
   3.111   NATIVE (getrusage) // not sure if native call will give stats about the requested process..
   3.112  +NATIVE (getrlimit)
   3.113  +NATIVE (setrlimit)
   3.114   
   3.115 - // syslog.h
   3.116 - DCE    (openlog)
   3.117 -@@ -478,6 +484,8 @@
   3.118 + // SYSLOG.H
   3.119 + DCE (openlog)
   3.120 +@@ -494,6 +502,8 @@
   3.121   NATIVE (bindtextdomain)
   3.122   NATIVE (textdomain)
   3.123   NATIVE (gettext)
   3.124  +NATIVE (catopen)
   3.125  +NATIVE (catgets)
   3.126   
   3.127 - // signal.h
   3.128 - DCE (sigprocmask)
   3.129 + // PWD.H
   3.130 + NATIVE (getpwnam)
     4.1 --- a/dns_unbound.patch	Thu Jun 21 17:26:37 2012 +0900
     4.2 +++ b/dns_unbound.patch	Wed Jul 04 17:06:26 2012 +0900
     4.3 @@ -1,6 +1,6 @@
     4.4 -diff -r 6a5297994128 example/dce-unbound.cc
     4.5 +diff -r 70496fb51ab2 example/dce-unbound.cc
     4.6  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.7 -+++ b/example/dce-unbound.cc	Thu Apr 26 11:21:55 2012 +0900
     4.8 ++++ b/example/dce-unbound.cc	Wed Jul 04 16:59:42 2012 +0900
     4.9  @@ -0,0 +1,98 @@
    4.10  +#include "ns3/core-module.h"
    4.11  +#include "ns3/network-module.h"
    4.12 @@ -100,9 +100,9 @@
    4.13  +
    4.14  +  return 0;
    4.15  +}
    4.16 -diff -r 6a5297994128 model/dce-credentials.cc
    4.17 ---- a/model/dce-credentials.cc	Thu Apr 26 09:56:01 2012 +0900
    4.18 -+++ b/model/dce-credentials.cc	Thu Apr 26 11:21:55 2012 +0900
    4.19 +diff -r 70496fb51ab2 model/dce-credentials.cc
    4.20 +--- a/model/dce-credentials.cc	Wed Jul 04 16:58:26 2012 +0900
    4.21 ++++ b/model/dce-credentials.cc	Wed Jul 04 16:59:42 2012 +0900
    4.22  @@ -53,3 +53,15 @@
    4.23     int ret = eaccess (rPath.c_str (), mode);
    4.24     return ret;
    4.25 @@ -119,9 +119,9 @@
    4.26  +  // XXX
    4.27  +  return 0;
    4.28  +}
    4.29 -diff -r 6a5297994128 model/dce-stdio.cc
    4.30 ---- a/model/dce-stdio.cc	Thu Apr 26 09:56:01 2012 +0900
    4.31 -+++ b/model/dce-stdio.cc	Thu Apr 26 11:21:55 2012 +0900
    4.32 +diff -r 70496fb51ab2 model/dce-stdio.cc
    4.33 +--- a/model/dce-stdio.cc	Wed Jul 04 16:58:26 2012 +0900
    4.34 ++++ b/model/dce-stdio.cc	Wed Jul 04 16:59:42 2012 +0900
    4.35  @@ -722,6 +722,16 @@
    4.36     va_end (ap);
    4.37     return retval;
    4.38 @@ -139,9 +139,9 @@
    4.39   void dce___fpurge (FILE *stream)
    4.40   {
    4.41     NS_LOG_FUNCTION (Current () << UtilsGetNodeId () << stream);
    4.42 -diff -r 6a5297994128 model/dce-stdio.h
    4.43 ---- a/model/dce-stdio.h	Thu Apr 26 09:56:01 2012 +0900
    4.44 -+++ b/model/dce-stdio.h	Thu Apr 26 11:21:55 2012 +0900
    4.45 +diff -r 70496fb51ab2 model/dce-stdio.h
    4.46 +--- a/model/dce-stdio.h	Wed Jul 04 16:58:26 2012 +0900
    4.47 ++++ b/model/dce-stdio.h	Wed Jul 04 16:59:42 2012 +0900
    4.48  @@ -62,6 +62,9 @@
    4.49   					   __const char *__restrict __format, ...);
    4.50   int dce___snprintf_chk (char *__restrict __s, size_t __n, int __flag,
    4.51 @@ -152,9 +152,9 @@
    4.52   
    4.53   void dce___fpurge (FILE *stream);
    4.54   size_t dce___fpending(FILE *stream);
    4.55 -diff -r 6a5297994128 model/dce-syslog.cc
    4.56 ---- a/model/dce-syslog.cc	Thu Apr 26 09:56:01 2012 +0900
    4.57 -+++ b/model/dce-syslog.cc	Thu Apr 26 11:21:55 2012 +0900
    4.58 +diff -r 70496fb51ab2 model/dce-syslog.cc
    4.59 +--- a/model/dce-syslog.cc	Wed Jul 04 16:58:26 2012 +0900
    4.60 ++++ b/model/dce-syslog.cc	Wed Jul 04 16:59:42 2012 +0900
    4.61  @@ -67,3 +67,14 @@
    4.62   
    4.63     vfprintf (process->syslog, message, args);
    4.64 @@ -170,9 +170,9 @@
    4.65  +  dce_vsyslog (__pri, __fmt, ap);
    4.66  +  va_end (ap);
    4.67  +}
    4.68 -diff -r 6a5297994128 model/dce-syslog.h
    4.69 ---- a/model/dce-syslog.h	Thu Apr 26 09:56:01 2012 +0900
    4.70 -+++ b/model/dce-syslog.h	Thu Apr 26 11:21:55 2012 +0900
    4.71 +diff -r 70496fb51ab2 model/dce-syslog.h
    4.72 +--- a/model/dce-syslog.h	Wed Jul 04 16:58:26 2012 +0900
    4.73 ++++ b/model/dce-syslog.h	Wed Jul 04 16:59:42 2012 +0900
    4.74  @@ -19,4 +19,7 @@
    4.75   void
    4.76   dce_vsyslog (int priority, const char *message, va_list args);
    4.77 @@ -181,9 +181,9 @@
    4.78  +dce___syslog_chk (int __pri, int __flag, __const char *__fmt, ...);
    4.79  +
    4.80   #endif // DCE_SYSLOG_H
    4.81 -diff -r 6a5297994128 model/dce-unistd.h
    4.82 ---- a/model/dce-unistd.h	Thu Apr 26 09:56:01 2012 +0900
    4.83 -+++ b/model/dce-unistd.h	Thu Apr 26 11:21:55 2012 +0900
    4.84 +diff -r 70496fb51ab2 model/dce-unistd.h
    4.85 +--- a/model/dce-unistd.h	Wed Jul 04 16:58:26 2012 +0900
    4.86 ++++ b/model/dce-unistd.h	Wed Jul 04 16:59:42 2012 +0900
    4.87  @@ -74,6 +74,8 @@
    4.88   
    4.89   ssize_t dce_pread(int fd, void *buf, size_t count, off_t offset);
    4.90 @@ -193,9 +193,9 @@
    4.91   
    4.92   #ifdef __cplusplus
    4.93   }
    4.94 -diff -r 6a5297994128 model/dce.cc
    4.95 ---- a/model/dce.cc	Thu Apr 26 09:56:01 2012 +0900
    4.96 -+++ b/model/dce.cc	Thu Apr 26 11:21:55 2012 +0900
    4.97 +diff -r 70496fb51ab2 model/dce.cc
    4.98 +--- a/model/dce.cc	Wed Jul 04 16:58:26 2012 +0900
    4.99 ++++ b/model/dce.cc	Wed Jul 04 16:59:42 2012 +0900
   4.100  @@ -141,7 +141,7 @@
   4.101         current->err = EPERM;
   4.102         return -1;
   4.103 @@ -205,9 +205,9 @@
   4.104         !is_set_ucapable (sgid))
   4.105       {
   4.106         current->err = EPERM;
   4.107 -diff -r 6a5297994128 model/dlm-loader-factory.cc
   4.108 ---- a/model/dlm-loader-factory.cc	Thu Apr 26 09:56:01 2012 +0900
   4.109 -+++ b/model/dlm-loader-factory.cc	Thu Apr 26 11:21:55 2012 +0900
   4.110 +diff -r 70496fb51ab2 model/dlm-loader-factory.cc
   4.111 +--- a/model/dlm-loader-factory.cc	Wed Jul 04 16:58:26 2012 +0900
   4.112 ++++ b/model/dlm-loader-factory.cc	Wed Jul 04 16:59:42 2012 +0900
   4.113  @@ -3,6 +3,7 @@
   4.114   #include "ns3/fatal-error.h"
   4.115   #include <list>
   4.116 @@ -327,10 +327,10 @@
   4.117     m_loaded.push_back (module);
   4.118     return module;
   4.119   }
   4.120 -diff -r 6a5297994128 model/libc-dce.cc
   4.121 ---- a/model/libc-dce.cc	Thu Apr 26 09:56:01 2012 +0900
   4.122 -+++ b/model/libc-dce.cc	Thu Apr 26 11:21:55 2012 +0900
   4.123 -@@ -129,11 +129,13 @@
   4.124 +diff -r 70496fb51ab2 model/libc-dce.cc
   4.125 +--- a/model/libc-dce.cc	Wed Jul 04 16:58:26 2012 +0900
   4.126 ++++ b/model/libc-dce.cc	Wed Jul 04 16:59:42 2012 +0900
   4.127 +@@ -132,11 +132,13 @@
   4.128        __THROW;
   4.129   extern int __obstack_vprintf_chk (struct obstack *, int, const char *,
   4.130                     _G_va_list) __THROW;
   4.131 @@ -344,34 +344,27 @@
   4.132   void libc_dce (struct Libc **libc)
   4.133   {
   4.134     *libc = new Libc;
   4.135 -diff -r 6a5297994128 model/libc-ns3.h
   4.136 ---- a/model/libc-ns3.h	Thu Apr 26 09:56:01 2012 +0900
   4.137 -+++ b/model/libc-ns3.h	Thu Apr 26 11:21:55 2012 +0900
   4.138 -@@ -83,6 +83,7 @@
   4.139 - DCE    (writev)
   4.140 - NATIVE (memset)
   4.141 - NATIVE (memcpy)
   4.142 -+NATIVE (__memcpy_chk)
   4.143 - NATIVE (bcopy)
   4.144 - NATIVE (memcmp)
   4.145 - NATIVE (memmove)
   4.146 -@@ -102,6 +103,7 @@
   4.147 +diff -r 70496fb51ab2 model/libc-ns3.h
   4.148 +--- a/model/libc-ns3.h	Wed Jul 04 16:58:26 2012 +0900
   4.149 ++++ b/model/libc-ns3.h	Wed Jul 04 16:59:42 2012 +0900
   4.150 +@@ -127,6 +127,7 @@
   4.151   NATIVE_EXPLICIT (strchr, char* (*) (char *, int))
   4.152   NATIVE_EXPLICIT (strrchr, const char * (*) (const char *, int))
   4.153   //DCE (strrchr)
   4.154  +NATIVE_EXPLICIT (strstr, const char * (*) (const char *, const char *))
   4.155   NATIVE (strcasecmp)
   4.156   NATIVE (strncasecmp)
   4.157 + DCE_WITH_ALIAS (strdup) // because C++ defines both const and non-const functions
   4.158 +@@ -241,6 +242,8 @@
   4.159 + NATIVE (getdtablesize)
   4.160 + DCE (pread)
   4.161 + DCE (pwrite)
   4.162 ++DCE (chown)
   4.163 ++DCE (initgroups)
   4.164   
   4.165 -@@ -129,6 +131,7 @@
   4.166 - DCE    (__vfprintf_chk)
   4.167 - DCE    (__fprintf_chk)
   4.168 - DCE    (__snprintf_chk)
   4.169 -+DCE    (__vsnprintf_chk)
   4.170 - 
   4.171 - DCE_WITH_ALIAS2 (fgetc,fgetc_unlocked)
   4.172 - NATIVE (getc)
   4.173 -@@ -357,6 +360,10 @@
   4.174 + // SYS/UIO.H
   4.175 + DCE (writev)
   4.176 +@@ -393,6 +396,10 @@
   4.177   NATIVE (pthread_rwlock_destroy)
   4.178   NATIVE (pthread_setcancelstate)
   4.179   NATIVE (pthread_sigmask)
   4.180 @@ -380,29 +373,22 @@
   4.181  +NATIVE (pthread_spin_unlock)
   4.182  +NATIVE (pthread_spin_destroy)
   4.183   
   4.184 - // netdb.h
   4.185 - DCE    (gethostbyname)
   4.186 -@@ -440,6 +447,7 @@
   4.187 - DCE    (setlogmask)
   4.188 - DCE    (syslog)
   4.189 - DCE    (vsyslog)
   4.190 + // SEMAPHORE.H
   4.191 + DCE (sem_init)
   4.192 +@@ -475,6 +482,9 @@
   4.193 + DCE (setlogmask)
   4.194 + DCE (syslog)
   4.195 + DCE (vsyslog)
   4.196  +DCE    (__syslog_chk)
   4.197 ++ 
   4.198 ++
   4.199   
   4.200 - // unistd.h
   4.201 - NATIVE (sysconf)
   4.202 -@@ -455,6 +463,8 @@
   4.203 - DCE (eaccess)
   4.204 - DCE (pipe)
   4.205 - NATIVE (pathconf)
   4.206 -+DCE (chown)
   4.207 -+DCE (initgroups)
   4.208 - 
   4.209 - // this is wrong. clock should be changed to DCE implementation
   4.210 - DCE_WITH_ALIAS2 (clock_gettime, __vdso_clock_gettime)
   4.211 -diff -r 6a5297994128 wscript
   4.212 ---- a/wscript	Thu Apr 26 09:56:01 2012 +0900
   4.213 -+++ b/wscript	Thu Apr 26 11:21:55 2012 +0900
   4.214 -@@ -37,6 +37,8 @@
   4.215 + // SETJMP.H
   4.216 + NATIVE (__sigsetjmp)
   4.217 +diff -r 70496fb51ab2 wscript
   4.218 +--- a/wscript	Wed Jul 04 16:58:26 2012 +0900
   4.219 ++++ b/wscript	Wed Jul 04 16:59:42 2012 +0900
   4.220 +@@ -40,6 +40,8 @@
   4.221   
   4.222       conf.env.prepend_value('LINKFLAGS', '-Wl,--no-as-needed')
   4.223       conf.env.append_value('LINKFLAGS', '-pthread')
   4.224 @@ -411,7 +397,7 @@
   4.225       conf.check (lib='dl', mandatory = True)
   4.226       conf.check_cc(fragment='int main() {__get_cpu_features();}\n', msg='Checking for glibc get_cpu_features', define_name='HAVE_GETCPUFEATURES', mandatory=False)
   4.227        
   4.228 -@@ -277,6 +279,10 @@
   4.229 +@@ -288,6 +290,10 @@
   4.230                          target='bin/dce-linux',
   4.231                          source=['example/dce-linux.cc'])
   4.232   
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/hana-dce.patch	Wed Jul 04 17:06:26 2012 +0900
     5.3 @@ -0,0 +1,83 @@
     5.4 +diff -r 42feac0c6693 model/dce-string.cc
     5.5 +--- a/model/dce-string.cc	Fri Jun 29 18:26:32 2012 +0900
     5.6 ++++ b/model/dce-string.cc	Tue Jul 03 12:09:55 2012 +0900
     5.7 +@@ -32,3 +32,11 @@
     5.8 +   return strrchr (s, c);
     5.9 + }
    5.10 + 
    5.11 ++char *dce___memcpy_chk (char *__restrict __dest,
    5.12 ++                        const char *__restrict __src,
    5.13 ++                        size_t __len,
    5.14 ++                        size_t __destlen)
    5.15 ++{
    5.16 ++  /// \todo Do actual checking
    5.17 ++  memcpy (__dest, __src, __len); 
    5.18 ++}
    5.19 +diff -r 42feac0c6693 model/dce-string.h
    5.20 +--- a/model/dce-string.h	Fri Jun 29 18:26:32 2012 +0900
    5.21 ++++ b/model/dce-string.h	Tue Jul 03 12:09:55 2012 +0900
    5.22 +@@ -13,6 +13,10 @@
    5.23 + 						const char *__restrict __src,
    5.24 + 						size_t __destlen);
    5.25 + char *dce_strrchr(char *s, int c);
    5.26 ++char *dce___memcpy_chk (char *__restrict __dest,
    5.27 ++                        const char *__restrict __src,
    5.28 ++                        size_t __len,
    5.29 ++                        size_t __destlen);
    5.30 + 
    5.31 + #ifdef __cplusplus
    5.32 + }
    5.33 +diff -r 42feac0c6693 model/libc-dce.cc
    5.34 +--- a/model/libc-dce.cc	Fri Jun 29 18:26:32 2012 +0900
    5.35 ++++ b/model/libc-dce.cc	Tue Jul 03 12:09:55 2012 +0900
    5.36 +@@ -107,6 +107,9 @@
    5.37 + extern char *__strcpy_chk (char *__restrict __dest,
    5.38 +                const char *__restrict __src,
    5.39 +                size_t __destlen);
    5.40 ++extern void *__memcpy_chk (void *__restrict __dest,
    5.41 ++                           const void *__restrict __src, size_t __len,
    5.42 ++                           size_t __destlen);
    5.43 + // from glibc's stdio.h
    5.44 + extern int __sprintf_chk (char *, int, size_t, const char *, ...) __THROW;
    5.45 + extern int __snprintf_chk (char *, size_t, int, size_t, const char *, ...)
    5.46 +diff -r 42feac0c6693 model/libc-ns3.h
    5.47 +--- a/model/libc-ns3.h	Fri Jun 29 18:26:32 2012 +0900
    5.48 ++++ b/model/libc-ns3.h	Tue Jul 03 12:09:55 2012 +0900
    5.49 +@@ -109,6 +109,7 @@
    5.50 + NATIVE (strcoll)
    5.51 + NATIVE (memset)
    5.52 + NATIVE (memcpy)
    5.53 ++DCE (__memcpy_chk)
    5.54 + NATIVE (bcopy)
    5.55 + NATIVE (memcmp)
    5.56 + NATIVE (memmove)
    5.57 +diff -r 42feac0c6693 model/linux-socket-fd.cc
    5.58 +--- a/model/linux-socket-fd.cc	Fri Jun 29 18:26:32 2012 +0900
    5.59 ++++ b/model/linux-socket-fd.cc	Tue Jul 03 12:09:55 2012 +0900
    5.60 +@@ -178,8 +178,9 @@
    5.61 +       break;
    5.62 +     default:
    5.63 +       //XXX commands missing
    5.64 +-      NS_FATAL_ERROR ("fcntl not implemented on socket");
    5.65 +-      return -1;
    5.66 ++      // NS_FATAL_ERROR ("fcntl not implemented on socket");
    5.67 ++      // return -1;
    5.68 ++      return 0;
    5.69 +     }
    5.70 + }
    5.71 + int 
    5.72 +diff -r 42feac0c6693 model/local-socket-fd.cc
    5.73 +--- a/model/local-socket-fd.cc	Fri Jun 29 18:26:32 2012 +0900
    5.74 ++++ b/model/local-socket-fd.cc	Tue Jul 03 12:09:55 2012 +0900
    5.75 +@@ -202,8 +202,9 @@
    5.76 +       break;
    5.77 +     default:
    5.78 +       //XXX commands missing
    5.79 +-      NS_FATAL_ERROR ("fcntl not implemented on socket");
    5.80 +-      return -1;
    5.81 ++      // NS_FATAL_ERROR ("fcntl not implemented on socket");
    5.82 ++      // return -1;
    5.83 ++      return 0;
    5.84 +     }
    5.85 + }
    5.86 + int
     6.1 --- a/himalis.patch	Thu Jun 21 17:26:37 2012 +0900
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,1950 +0,0 @@
     6.4 -diff -r 9f12d65beb55 example/dce-himalis-handoff.cc
     6.5 ---- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.6 -+++ b/example/dce-himalis-handoff.cc	Thu Mar 29 13:58:16 2012 +0900
     6.7 -@@ -0,0 +1,296 @@
     6.8 -+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
     6.9 -+/*
    6.10 -+ * Copyright (c) 2012 NICT
    6.11 -+ *
    6.12 -+ * This program is free software; you can redistribute it and/or modify
    6.13 -+ * it under the terms of the GNU General Public License version 2 as
    6.14 -+ * published by the Free Software Foundation;
    6.15 -+ *
    6.16 -+ * This program is distributed in the hope that it will be useful,
    6.17 -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.18 -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6.19 -+ * GNU General Public License for more details.
    6.20 -+ *
    6.21 -+ * You should have received a copy of the GNU General Public License
    6.22 -+ * along with this program; if not, write to the Free Software
    6.23 -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    6.24 -+ *
    6.25 -+ * Author: Hajime Tazaki <tazaki@nict.go.jp>
    6.26 -+ */
    6.27 -+
    6.28 -+#include "ns3/network-module.h"
    6.29 -+#include "ns3/core-module.h"
    6.30 -+#include "ns3/internet-module.h"
    6.31 -+#include "ns3/csma-helper.h"
    6.32 -+#include "ns3/point-to-point-helper.h"
    6.33 -+#include "ns3/dce-module.h"
    6.34 -+#include "ns3/himalis-helper.h"
    6.35 -+#include "ns3/mobility-module.h"
    6.36 -+#include "ns3/wifi-module.h"
    6.37 -+#include "visual-simulator-impl.h"
    6.38 -+
    6.39 -+using namespace ns3;
    6.40 -+
    6.41 -+NS_LOG_COMPONENT_DEFINE ("HimalisHandoff");
    6.42 -+
    6.43 -+// Parameters
    6.44 -+uint32_t stopTime = 120;
    6.45 -+bool noMobility = false;
    6.46 -+
    6.47 -+std::string host0_srcid = "2001-200-0-e101-0-0-0-beaf";
    6.48 -+std::string host1_srcid = "2001-200-0-e101-0-0-0-3939";
    6.49 -+std::string gw0_sim0 = "2001:3939:0:1::1";
    6.50 -+std::string host0_gw0_sim0 = "2001:3939:0:1::2";
    6.51 -+std::string gw1_sim0 = "2001:5959:0:1::1";
    6.52 -+std::string host0_gw1_sim0 = "2001:5959:0:1::2";
    6.53 -+
    6.54 -+std::string gw0_sim1 = "2002:4949:0:1::1";
    6.55 -+std::string host1_sim0 = "2002:4949:0:1::2";
    6.56 -+
    6.57 -+std::string gw1_sim1 = "2002:6969:0:1::1";
    6.58 -+std::string host1_sim1 = "2002:6969:0:1::2";
    6.59 -+
    6.60 -+NodeContainer hosts, gw;
    6.61 -+
    6.62 -+static void RunIp (Ptr<Node> node, Time at, std::string str)
    6.63 -+{
    6.64 -+  DceApplicationHelper process;
    6.65 -+  ApplicationContainer apps;
    6.66 -+  process.SetBinary ("ip");
    6.67 -+  process.SetStackSize (1<<31);
    6.68 -+  process.ResetArguments();
    6.69 -+  process.ParseArguments(str.c_str ());
    6.70 -+  apps = process.Install (node);
    6.71 -+  apps.Start (at);
    6.72 -+}
    6.73 -+
    6.74 -+static void
    6.75 -+AssocCallback (Ptr<HimalisHelper> himalis, std::string path, Mac48Address bssid)
    6.76 -+{
    6.77 -+  uint8_t gw0[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x02};
    6.78 -+  uint8_t gw1[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x03};
    6.79 -+  uint8_t cur[6];
    6.80 -+
    6.81 -+  bssid.CopyTo (cur);
    6.82 -+
    6.83 -+  std::cout << Simulator::Now ().GetSeconds () << " " << path << " with " << bssid;
    6.84 -+  // in case gw0
    6.85 -+  if (memcmp (cur, gw0, 6) == 0)
    6.86 -+    {
    6.87 -+      std::cout << " gw0 " << std::endl;
    6.88 -+      RunIp (hosts.Get (0), Simulator::Now (), "-f inet6 addr del " + host0_gw1_sim0 + "/64 dev sim0");
    6.89 -+      RunIp (hosts.Get (0), Simulator::Now (), "-f inet6 route del default via "+ gw1_sim0);
    6.90 -+      RunIp (hosts.Get (0), Simulator::Now (), "-f inet6 addr add " + host0_gw0_sim0 + "/64 dev sim0");
    6.91 -+      RunIp (hosts.Get (0), Simulator::Now (), "-f inet6 route add default via "+ gw0_sim0);
    6.92 -+#if 1
    6.93 -+      himalis->DelIdlRoute (hosts.Get (0), Simulator::Now (),
    6.94 -+                           host0_srcid.c_str (), host1_srcid.c_str ());
    6.95 -+      himalis->AddIdlRoute (hosts.Get (0), Simulator::Now (),
    6.96 -+                           "host", host0_srcid.c_str (), host1_srcid.c_str (),
    6.97 -+                           host0_gw0_sim0.c_str (), gw0_sim0.c_str (), "sim0");
    6.98 -+
    6.99 -+      himalis->DelIdlRoute (hosts.Get (1), Simulator::Now (),
   6.100 -+                           host1_srcid.c_str (), host0_srcid.c_str ());
   6.101 -+      himalis->AddIdlRoute (hosts.Get (1), Simulator::Now (),
   6.102 -+                           "host", host1_srcid.c_str (), host0_srcid.c_str (),
   6.103 -+                           host1_sim0.c_str (), gw0_sim1.c_str (), "sim0");
   6.104 -+#endif
   6.105 -+    }
   6.106 -+  // in case gw1
   6.107 -+  else if (memcmp (cur, gw1, 6) == 0)
   6.108 -+    {
   6.109 -+      std::cout << " gw1 " << std::endl;
   6.110 -+      RunIp (hosts.Get (0), Simulator::Now (), "-f inet6 addr del " + host0_gw0_sim0 + "/64 dev sim0");
   6.111 -+      RunIp (hosts.Get (0), Simulator::Now (), "-f inet6 route del default via "+ gw0_sim0);
   6.112 -+      RunIp (hosts.Get (0), Simulator::Now (), "-f inet6 addr add " + host0_gw1_sim0 + "/64 dev sim0");
   6.113 -+      RunIp (hosts.Get (0), Simulator::Now (), "-f inet6 route add default via "+ gw1_sim0);
   6.114 -+#if 1
   6.115 -+      himalis->DelIdlRoute (hosts.Get (0), Simulator::Now (),
   6.116 -+                           host0_srcid.c_str (), host1_srcid.c_str ());
   6.117 -+      himalis->AddIdlRoute (hosts.Get (0), Simulator::Now (),
   6.118 -+                           "host", host0_srcid.c_str (), host1_srcid.c_str (),
   6.119 -+                           host0_gw1_sim0.c_str (), gw1_sim0.c_str (), "sim0");
   6.120 -+
   6.121 -+      himalis->DelIdlRoute (hosts.Get (1), Simulator::Now (),
   6.122 -+                           host1_srcid.c_str (), host0_srcid.c_str ());
   6.123 -+      himalis->AddIdlRoute (hosts.Get (1), Simulator::Now (),
   6.124 -+                           "host", host1_srcid.c_str (), host0_srcid.c_str (),
   6.125 -+                           host1_sim1.c_str (), gw1_sim1.c_str (), "sim1");
   6.126 -+      himalis->ShowIdlRoute (hosts.Get (1), Simulator::Now ());
   6.127 -+#endif
   6.128 -+    }
   6.129 -+
   6.130 -+}
   6.131 -+
   6.132 -+
   6.133 -+int main (int argc, char *argv[])
   6.134 -+{
   6.135 -+  CommandLine cmd;
   6.136 -+  cmd.AddValue ("stopTime", "Time to stop(seconds)", stopTime);
   6.137 -+  cmd.AddValue ("noMobility", "Without movement", noMobility);
   6.138 -+  cmd.Parse (argc, argv);
   6.139 -+
   6.140 -+  // nodes
   6.141 -+  gw.Create (2);
   6.142 -+  hosts.Create (2);
   6.143 -+
   6.144 -+  // movement
   6.145 -+  NetDeviceContainer devices;
   6.146 -+  MobilityHelper mobility;
   6.147 -+  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
   6.148 -+  positionAlloc->Add (Vector (0.0, 10.0, 0.0)); // GW0
   6.149 -+  positionAlloc->Add (Vector (150.0, 10.0, 0.0)); // GW1
   6.150 -+  positionAlloc->Add (Vector (75.0, -50.0, 0.0)); // CN
   6.151 -+  mobility.SetPositionAllocator (positionAlloc);
   6.152 -+  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
   6.153 -+  mobility.Install (gw);
   6.154 -+  mobility.Install (hosts.Get (1));
   6.155 -+
   6.156 -+  Ptr<ns3::RandomDiscPositionAllocator> r_position =
   6.157 -+    CreateObject<RandomDiscPositionAllocator> ();
   6.158 -+  r_position->SetX (100);
   6.159 -+  r_position->SetY (50);
   6.160 -+  r_position->SetRho (UniformVariable (200, 0));
   6.161 -+  mobility.SetPositionAllocator (r_position);
   6.162 -+  mobility.SetMobilityModel ("ns3::RandomDirection2dMobilityModel",
   6.163 -+                             "Bounds", RectangleValue (Rectangle (0, 200, 30, 60)),
   6.164 -+                             "Speed", RandomVariableValue (ConstantVariable (10)),
   6.165 -+                             "Pause", RandomVariableValue (ConstantVariable (0.2)));
   6.166 -+  if (noMobility)
   6.167 -+    {  
   6.168 -+      mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
   6.169 -+    }
   6.170 -+  mobility.Install (hosts.Get (0));
   6.171 -+
   6.172 -+  // net devices
   6.173 -+  // wifi
   6.174 -+  WifiHelper wifi = WifiHelper::Default ();
   6.175 -+  YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
   6.176 -+  YansWifiChannelHelper phyChannel = YansWifiChannelHelper::Default ();
   6.177 -+  Ssid ssid = Ssid ("ns-3-ssid");
   6.178 -+  NqosWifiMacHelper mac;
   6.179 -+  wifi.SetStandard (WIFI_PHY_STANDARD_80211a);
   6.180 -+
   6.181 -+  phy.SetChannel (phyChannel.Create ());
   6.182 -+  mac.SetType ("ns3::StaWifiMac",
   6.183 -+               "Ssid", SsidValue (ssid),
   6.184 -+               "ActiveProbing", BooleanValue (false));
   6.185 -+  wifi.Install (phy, mac, hosts.Get (0));
   6.186 -+  mac.SetType ("ns3::ApWifiMac",
   6.187 -+               "Ssid", SsidValue (ssid));
   6.188 -+  wifi.Install (phy, mac, gw);
   6.189 -+  // ptp netdev
   6.190 -+  PointToPointHelper p2p;
   6.191 -+  p2p.Install (NodeContainer (gw.Get (0), hosts.Get (1))); // CN - GW0
   6.192 -+  p2p.Install (NodeContainer (gw.Get (1), hosts.Get (1))); // CN - GW1
   6.193 -+
   6.194 -+
   6.195 -+
   6.196 -+  // addresses (locators)
   6.197 -+  DceManagerHelper dceManager;
   6.198 -+  HimalisHelper himalis;
   6.199 -+  dceManager.SetTaskManagerAttribute ("FiberManagerType", 
   6.200 -+                                          EnumValue (0));
   6.201 -+  dceManager.SetLoader ("ns3::DlmLoaderFactory");
   6.202 -+  dceManager.SetNetworkStack("ns3::LinuxSocketFdFactory",
   6.203 -+                             "Library", StringValue ("liblinux-2.6.32.27-tpidl.so"));
   6.204 -+  dceManager.Install (NodeContainer (hosts, gw));
   6.205 -+  himalis.Install (NodeContainer (hosts, gw));
   6.206 -+
   6.207 -+  // GW0
   6.208 -+  RunIp (gw.Get (0), Seconds (0.1), "link set lo up");
   6.209 -+  RunIp (gw.Get (0), Seconds (0.1), "link set sim0 up");
   6.210 -+  RunIp (gw.Get (0), Seconds (0.1), "link set sim1 up");
   6.211 -+  RunIp (gw.Get (0), Seconds (0.2), "-f inet6 addr add " + gw0_sim0 + "/64 dev sim0");
   6.212 -+  RunIp (gw.Get (0), Seconds (0.15), "-f inet6 addr add " + gw0_sim1 + "/64 dev sim1");
   6.213 -+  // HIMALIS configuration
   6.214 -+#if 1
   6.215 -+  himalis.AddIdlRoute (gw.Get (0), Seconds (0.2), "forward", host0_srcid.c_str (), host1_srcid.c_str (),
   6.216 -+                       gw0_sim1.c_str (), host1_sim0.c_str (), "sim1");
   6.217 -+  himalis.AddIdlRoute (gw.Get (0), Seconds (0.2), "forward", host1_srcid.c_str (), host0_srcid.c_str (),
   6.218 -+                       gw0_sim0.c_str (), host0_gw0_sim0.c_str (), "sim0");
   6.219 -+#endif
   6.220 -+#if 0
   6.221 -+  himalis.ShowIdlRoute (gw.Get (0), Seconds (0.2));
   6.222 -+#endif
   6.223 -+  RunIp (gw.Get (0), Seconds (1.0), "addr list");
   6.224 -+
   6.225 -+  // GW1
   6.226 -+  RunIp (gw.Get (1), Seconds (0.1), "link set lo up");
   6.227 -+  RunIp (gw.Get (1), Seconds (0.1), "link set sim0 up");
   6.228 -+  RunIp (gw.Get (1), Seconds (0.1), "link set sim1 up");
   6.229 -+  RunIp (gw.Get (1), Seconds (0.2), "-f inet6 addr add " + gw1_sim0 + "/64 dev sim0");
   6.230 -+  RunIp (gw.Get (1), Seconds (0.2), "-f inet6 addr add " + gw1_sim1 + "/64 dev sim1");
   6.231 -+  // HIMALIS configuration
   6.232 -+#if 1
   6.233 -+  himalis.AddIdlRoute (gw.Get (1), Seconds (0.2), "forward", host0_srcid.c_str (), host1_srcid.c_str (),
   6.234 -+                       gw1_sim1.c_str (), host1_sim1.c_str (), "sim1");
   6.235 -+  himalis.AddIdlRoute (gw.Get (1), Seconds (0.2), "forward", host1_srcid.c_str (), host0_srcid.c_str (),
   6.236 -+                       gw1_sim0.c_str (), host0_gw1_sim0.c_str (), "sim0");
   6.237 -+#endif
   6.238 -+#if 0
   6.239 -+  himalis.ShowIdlRoute (gw.Get (1), Seconds (0.2));
   6.240 -+#endif
   6.241 -+  RunIp (gw.Get (1), Seconds (1.0), "addr list");
   6.242 -+
   6.243 -+  // Host0 (MN)
   6.244 -+  RunIp (hosts.Get (0), Seconds (0.1), "link set lo up");
   6.245 -+  RunIp (hosts.Get (0), Seconds (0.1), "link set sim0 up");
   6.246 -+  RunIp (hosts.Get (0), Seconds (1.0), "addr list");
   6.247 -+#if 0
   6.248 -+  RunIp (hosts.Get (0), Seconds (0.2), "-f inet6 addr add " + host0_gw1_sim0 + "/64 dev sim0");
   6.249 -+  RunIp (hosts.Get (0), Seconds (0.2), "-f inet6 route add default via "+ gw1_sim0);
   6.250 -+  himalis.AddIdlRoute (hosts.Get (0), Seconds (0.2), "host", host0_srcid.c_str (), host1_srcid.c_str (),
   6.251 -+                       host0_gw1_sim0.c_str (), gw1_sim0.c_str (), "sim0");
   6.252 -+#endif
   6.253 -+
   6.254 -+  // Host1 (CN)
   6.255 -+  RunIp (hosts.Get (1), Seconds (0.1), "link set lo up");
   6.256 -+  RunIp (hosts.Get (1), Seconds (0.1), "link set sim0 up");
   6.257 -+  RunIp (hosts.Get (1), Seconds (0.1), "link set sim1 up");
   6.258 -+  RunIp (hosts.Get (1), Seconds (0.3), "-f inet6 addr add " + host1_sim0 + "/64 dev sim0");
   6.259 -+  RunIp (hosts.Get (1), Seconds (0.3), "-f inet6 route add default via " + gw0_sim1);
   6.260 -+  RunIp (hosts.Get (1), Seconds (0.2), "-f inet6 addr add " + host1_sim1 + "/64 dev sim1");
   6.261 -+  RunIp (hosts.Get (1), Seconds (0.2), "-f inet6 route add default via " + gw1_sim1);
   6.262 -+  RunIp (hosts.Get (1), Seconds (1.0), "addr list");
   6.263 -+#if 0
   6.264 -+  himalis.AddIdlRoute (hosts.Get (1), Seconds (0.2), "host", host1_srcid.c_str (), host0_srcid.c_str (),
   6.265 -+                       host1_sim0.c_str (), gw0_sim1.c_str (), "sim0");
   6.266 -+#endif
   6.267 -+
   6.268 -+  // Applications
   6.269 -+  DceApplicationHelper process;
   6.270 -+  ApplicationContainer apps;
   6.271 -+#if 1
   6.272 -+  // server install to host1
   6.273 -+  process.SetBinary ("idecho-s");
   6.274 -+  process.ResetArguments ();
   6.275 -+  process.ParseArguments ("-s " + host1_srcid);
   6.276 -+  process.SetStackSize (1<<16);
   6.277 -+  apps = process.Install (hosts.Get (1));
   6.278 -+  apps.Start (Seconds (4.0));
   6.279 -+#endif
   6.280 -+
   6.281 -+  // client install to host0
   6.282 -+  process.SetBinary ("idecho-c");
   6.283 -+  process.ResetArguments ();
   6.284 -+  process.ParseArguments ("-s " + host0_srcid);
   6.285 -+  process.ParseArguments ("-d " + host1_srcid);
   6.286 -+  process.SetStackSize (1<<16);
   6.287 -+  apps = process.Install (hosts.Get (0));
   6.288 -+  apps.Start (Seconds (5.0));
   6.289 -+
   6.290 -+  p2p.EnablePcapAll ("dce-himalis");
   6.291 -+  phy.EnablePcapAll ("dce-himalis");
   6.292 -+
   6.293 -+  Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::StaWifiMac/Assoc", 
   6.294 -+                   MakeBoundCallback (&AssocCallback, &himalis));
   6.295 -+
   6.296 -+  Simulator::Stop (Seconds (stopTime));
   6.297 -+  Simulator::Run ();
   6.298 -+  Simulator::Destroy ();
   6.299 -+
   6.300 -+  NS_LOG_INFO ("End of experiment");
   6.301 -+
   6.302 -+  return 0;
   6.303 -+}
   6.304 -diff -r 9f12d65beb55 example/dce-himalis-simple.cc
   6.305 ---- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   6.306 -+++ b/example/dce-himalis-simple.cc	Thu Mar 29 13:58:16 2012 +0900
   6.307 -@@ -0,0 +1,156 @@
   6.308 -+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
   6.309 -+/*
   6.310 -+ * Copyright (c) 2012 NICT
   6.311 -+ *
   6.312 -+ * This program is free software; you can redistribute it and/or modify
   6.313 -+ * it under the terms of the GNU General Public License version 2 as
   6.314 -+ * published by the Free Software Foundation;
   6.315 -+ *
   6.316 -+ * This program is distributed in the hope that it will be useful,
   6.317 -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
   6.318 -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   6.319 -+ * GNU General Public License for more details.
   6.320 -+ *
   6.321 -+ * You should have received a copy of the GNU General Public License
   6.322 -+ * along with this program; if not, write to the Free Software
   6.323 -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   6.324 -+ *
   6.325 -+ * Author: Hajime Tazaki <tazaki@nict.go.jp>
   6.326 -+ */
   6.327 -+
   6.328 -+#include "ns3/network-module.h"
   6.329 -+#include "ns3/core-module.h"
   6.330 -+#include "ns3/internet-module.h"
   6.331 -+#include "ns3/csma-helper.h"
   6.332 -+#include "ns3/point-to-point-helper.h"
   6.333 -+#include "ns3/dce-module.h"
   6.334 -+#include "ns3/himalis-helper.h"
   6.335 -+
   6.336 -+using namespace ns3;
   6.337 -+
   6.338 -+NS_LOG_COMPONENT_DEFINE ("HimalisSimple");
   6.339 -+
   6.340 -+// Parameters
   6.341 -+uint32_t stopTime = 60;
   6.342 -+
   6.343 -+static void RunIp (Ptr<Node> node, Time at, std::string str)
   6.344 -+{
   6.345 -+  DceApplicationHelper process;
   6.346 -+  ApplicationContainer apps;
   6.347 -+  process.SetBinary ("ip");
   6.348 -+  process.SetStackSize (1<<31);
   6.349 -+  process.ResetArguments();
   6.350 -+  process.ParseArguments(str.c_str ());
   6.351 -+  apps = process.Install (node);
   6.352 -+  apps.Start (at);
   6.353 -+}
   6.354 -+
   6.355 -+std::string host0_srcid = "2001-200-0-e101-0-0-0-beaf";
   6.356 -+std::string host1_srcid = "2001-200-0-e101-0-0-0-3939";
   6.357 -+std::string gw_sim0 = "2001:3939:0:1::1";
   6.358 -+std::string host0_sim0 = "2001:3939:0:1::2";
   6.359 -+std::string gw_sim1_v6 = "2002:4949:0:1::1";
   6.360 -+std::string host1_sim0_v6 = "2002:4949:0:1::2";
   6.361 -+std::string gw_sim1_v4 = "11.0.0.1";
   6.362 -+std::string host1_sim0_v4 = "11.0.0.2";
   6.363 -+
   6.364 -+int main (int argc, char *argv[])
   6.365 -+{
   6.366 -+  CommandLine cmd;
   6.367 -+  cmd.AddValue ("stopTime", "Time to stop(seconds)", stopTime);
   6.368 -+  cmd.Parse (argc, argv);
   6.369 -+
   6.370 -+  // nodes
   6.371 -+  NodeContainer hosts, gw;
   6.372 -+  hosts.Create (2);
   6.373 -+  gw.Create (1);
   6.374 -+
   6.375 -+  // net devices
   6.376 -+  CsmaHelper csma;
   6.377 -+  PointToPointHelper p2p;
   6.378 -+  csma.SetChannelAttribute ("DataRate", StringValue ("5Mbps"));
   6.379 -+  csma.SetChannelAttribute ("Delay", StringValue ("2ms"));
   6.380 -+
   6.381 -+  p2p.Install (NodeContainer (gw, hosts.Get (0))); // Host - GW
   6.382 -+  p2p.Install (NodeContainer (gw, hosts.Get (1))); // Host - GW
   6.383 -+
   6.384 -+  // addresses (locators)
   6.385 -+  DceManagerHelper dceManager;
   6.386 -+  HimalisHelper himalis;
   6.387 -+  //  dceManager.SetLoader ("ns3::DlmLoaderFactory");
   6.388 -+  dceManager.SetNetworkStack("ns3::LinuxSocketFdFactory",
   6.389 -+                             "Library", StringValue ("liblinux-2.6.32.27-tpidl.so"));
   6.390 -+  dceManager.Install (NodeContainer (hosts, gw));
   6.391 -+  himalis.Install (NodeContainer (hosts, gw));
   6.392 -+
   6.393 -+  // GW
   6.394 -+  RunIp (gw.Get (0), Seconds (0.1), "link set lo up");
   6.395 -+  RunIp (gw.Get (0), Seconds (0.1), "link set sim0 up");
   6.396 -+  RunIp (gw.Get (0), Seconds (0.1), "link set sim1 up");
   6.397 -+  RunIp (gw.Get (0), Seconds (0.1), "link set sim2 up");
   6.398 -+  RunIp (gw.Get (0), Seconds (0.2), "-f inet addr add 10.0.0.1/24 dev sim0");
   6.399 -+  RunIp (gw.Get (0), Seconds (0.2), "-f inet6 addr add " + gw_sim0 + "/64 dev sim0");
   6.400 -+  RunIp (gw.Get (0), Seconds (0.2), "-f inet addr add " + gw_sim1_v4 + "/24 dev sim1");
   6.401 -+  RunIp (gw.Get (0), Seconds (0.2), "-f inet6 addr add " + gw_sim1_v6 + "/64 dev sim1");
   6.402 -+  // HIMALIS configuration
   6.403 -+  himalis.AddIdlRoute (gw.Get (0), Seconds (0.2), "forward", host0_srcid.c_str (), host1_srcid.c_str (),
   6.404 -+                       gw_sim1_v4.c_str (), host1_sim0_v4.c_str (), "sim1");
   6.405 -+  himalis.AddIdlRoute (gw.Get (0), Seconds (0.2), "forward", host1_srcid.c_str (), host0_srcid.c_str (),
   6.406 -+                       "10.0.0.1", "10.0.0.2", "sim0");
   6.407 -+  //                       gw_sim0.c_str (), host0_sim0.c_str (), "sim0");
   6.408 -+  himalis.ShowIdlRoute (gw.Get (0), Seconds (0.2));
   6.409 -+  RunIp (gw.Get (0), Seconds (1.0), "addr list");
   6.410 -+
   6.411 -+  // Host0 (MN)
   6.412 -+  RunIp (hosts.Get (0), Seconds (0.1), "link set lo up");
   6.413 -+  RunIp (hosts.Get (0), Seconds (0.1), "link set sim0 up");
   6.414 -+  RunIp (hosts.Get (0), Seconds (0.2), "-f inet addr add 10.0.0.2/24 dev sim0");
   6.415 -+  RunIp (hosts.Get (0), Seconds (0.2), "-f inet route add default via 10.0.0.1");
   6.416 -+  RunIp (hosts.Get (0), Seconds (0.2), "-f inet6 addr add " + host0_sim0 + "/64 dev sim0");
   6.417 -+  RunIp (hosts.Get (0), Seconds (0.2), "-f inet6 route add default via "+ gw_sim0);
   6.418 -+  himalis.AddIdlRoute (hosts.Get (0), Seconds (0.2), "host", host0_srcid.c_str (), host1_srcid.c_str (),
   6.419 -+                       "10.0.0.2", "10.0.0.1", "sim0");
   6.420 -+  //                       host0_sim0.c_str (), gw_sim0.c_str (), "sim0");
   6.421 -+  himalis.ShowIdlRoute (hosts.Get (0), Seconds (0.2));
   6.422 -+  RunIp (hosts.Get (0), Seconds (1.0), "addr list");
   6.423 -+
   6.424 -+  // Host1 (CN)
   6.425 -+  RunIp (hosts.Get (1), Seconds (0.1), "link set lo up");
   6.426 -+  RunIp (hosts.Get (1), Seconds (0.1), "link set sim0 up");
   6.427 -+  RunIp (hosts.Get (1), Seconds (0.2), "-f inet addr add " + host1_sim0_v4 + "/24 dev sim0");
   6.428 -+  RunIp (hosts.Get (1), Seconds (0.2), "-f inet route add default via " + gw_sim1_v4);
   6.429 -+  RunIp (hosts.Get (1), Seconds (0.2), "-f inet6 addr add " + host1_sim0_v6 + "/64 dev sim0");
   6.430 -+  RunIp (hosts.Get (1), Seconds (0.2), "-f inet6 route add default via " + gw_sim1_v6);
   6.431 -+  himalis.AddIdlRoute (hosts.Get (1), Seconds (0.2), "host", host1_srcid.c_str (), host0_srcid.c_str (),
   6.432 -+                       host1_sim0_v4.c_str (), gw_sim1_v4.c_str (), "sim0");
   6.433 -+
   6.434 -+  // Applications
   6.435 -+  DceApplicationHelper process;
   6.436 -+  ApplicationContainer apps;
   6.437 -+  // server install to host1
   6.438 -+  process.SetBinary ("idecho-s");
   6.439 -+  process.ResetArguments ();
   6.440 -+  process.ParseArguments ("-s " + host1_srcid);
   6.441 -+  process.SetStackSize (1<<16);
   6.442 -+  apps = process.Install (hosts.Get (1));
   6.443 -+  apps.Start (Seconds (4.0));
   6.444 -+
   6.445 -+  // client install to host0
   6.446 -+  process.SetBinary ("idecho-c");
   6.447 -+  process.ResetArguments ();
   6.448 -+  process.ParseArguments ("-s " + host0_srcid);
   6.449 -+  process.ParseArguments ("-d " + host1_srcid);
   6.450 -+  process.SetStackSize (1<<16);
   6.451 -+  apps = process.Install (hosts.Get (0));
   6.452 -+  apps.Start (Seconds (5.0));
   6.453 -+
   6.454 -+  p2p.EnablePcapAll ("dce-himalis");
   6.455 -+
   6.456 -+  Simulator::Stop (Seconds (stopTime));
   6.457 -+  Simulator::Run ();
   6.458 -+  Simulator::Destroy ();
   6.459 -+
   6.460 -+  NS_LOG_INFO ("End of experiment");
   6.461 -+
   6.462 -+  return 0;
   6.463 -+}
   6.464 -diff -r 9f12d65beb55 example/dce-linux.cc
   6.465 ---- a/example/dce-linux.cc	Thu Mar 29 13:55:58 2012 +0900
   6.466 -+++ b/example/dce-linux.cc	Thu Mar 29 13:58:16 2012 +0900
   6.467 -@@ -103,7 +103,7 @@
   6.468 -   }
   6.469 - 
   6.470 -   DceManagerHelper processManager;
   6.471 -- // processManager.SetLoader ("ns3::DlmLoaderFactory");
   6.472 -+  processManager.SetLoader ("ns3::DlmLoaderFactory");
   6.473 -   processManager.SetNetworkStack("ns3::LinuxSocketFdFactory",
   6.474 - 				 "Library", StringValue ("libfreebsd.git.so"));
   6.475 -   processManager.Install (nodes);
   6.476 -diff -r 9f12d65beb55 example/himalis/idecho-c.cc
   6.477 ---- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   6.478 -+++ b/example/himalis/idecho-c.cc	Thu Mar 29 13:58:16 2012 +0900
   6.479 -@@ -0,0 +1,163 @@
   6.480 -+/*****************************
   6.481 -+ * TP/ID/Locator echo client *
   6.482 -+ *                           *
   6.483 -+ * How to make.              *
   6.484 -+ * $ gcc THISFILE -lidlconn  *
   6.485 -+ *****************************/
   6.486 -+
   6.487 -+#include <stdio.h>
   6.488 -+#include <stdlib.h>
   6.489 -+#include <string.h>
   6.490 -+#include <unistd.h>
   6.491 -+#include <signal.h>
   6.492 -+
   6.493 -+#include <sys/socket.h>
   6.494 -+#include <sys/types.h>
   6.495 -+#include <netinet/in.h>
   6.496 -+#include <arpa/inet.h>
   6.497 -+
   6.498 -+#include "idl.h"                /* XXX */
   6.499 -+
   6.500 -+#define BUFFER_SIZE 1 * 1024    // XXX: avoid stack overflow
   6.501 -+#define DEFAULT_SERVER_PORT 6001
   6.502 -+
   6.503 -+
   6.504 -+int connect_sockfd;
   6.505 -+const int one = 1;
   6.506 -+
   6.507 -+void err_func(const char *msg)
   6.508 -+{
   6.509 -+	perror(msg);
   6.510 -+	exit(EXIT_FAILURE);
   6.511 -+}
   6.512 -+
   6.513 -+void sigint_handler(int sig)
   6.514 -+{
   6.515 -+	close(connect_sockfd);
   6.516 -+	fprintf(stderr, "-- Disonnected --\n");
   6.517 -+	exit(EXIT_SUCCESS);
   6.518 -+}
   6.519 -+
   6.520 -+char buf[BUFFER_SIZE], id_src_str[IDL_IDSTRLEN], id_dst_str[IDL_IDSTRLEN];
   6.521 -+int main(int argc, char **argv)
   6.522 -+{
   6.523 -+	int read_siz = 0, write_siz, wrote_siz = 0;
   6.524 -+	int opt, idlconn_ecode, http_status = -1, connect_sockfd;
   6.525 -+	struct idl_id src_id, dst_id;
   6.526 -+	struct sockid_idl idaddr;
   6.527 -+	unsigned short port = DEFAULT_SERVER_PORT;
   6.528 -+
   6.529 -+	while ((opt = getopt(argc, argv, "hd:s:p:")) != -1) {
   6.530 -+		switch (opt) {
   6.531 -+			case 'p':
   6.532 -+				port = (unsigned short)atoi(optarg);
   6.533 -+				break;
   6.534 -+			case 's':
   6.535 -+				memcpy (id_src_str, optarg, strlen (optarg));
   6.536 -+				break;
   6.537 -+			case 'd':
   6.538 -+				memcpy (id_dst_str, optarg, strlen (optarg));
   6.539 -+				break;
   6.540 -+			default:
   6.541 -+				goto missing_operand;
   6.542 -+		}
   6.543 -+	}
   6.544 -+
   6.545 -+        idl_pton(id_src_str, &src_id);
   6.546 -+        fprintf(stdout, "Client ID  : %s\n", id_src_str);
   6.547 -+        idl_pton(id_dst_str, &dst_id);
   6.548 -+        fprintf(stdout, "Server ID  : %s\n", id_dst_str);
   6.549 -+        fprintf(stdout, "Server Port: %d\n", port);
   6.550 -+
   6.551 -+	if ((connect_sockfd = socket(PF_IDL,
   6.552 -+			SOCK_STREAM, 0)) < 0)
   6.553 -+		err_func("socket");
   6.554 -+
   6.555 -+	if (setsockopt(connect_sockfd,
   6.556 -+			SOL_SOCKET, SO_REUSEADDR, &one, sizeof(int)) < 0)
   6.557 -+		err_func("setsockopt");
   6.558 -+
   6.559 -+	idaddr.sidl_family = IDF_IDL;
   6.560 -+	idaddr.sidl_port = 0;
   6.561 -+	memcpy (&idaddr.sidl_id, &src_id, sizeof (src_id));
   6.562 -+
   6.563 -+	if (bind(connect_sockfd, (struct sockaddr *)&idaddr, sizeof(idaddr)) < 0)
   6.564 -+		err_func("bind");
   6.565 -+
   6.566 -+	idaddr.sidl_family = IDF_IDL;
   6.567 -+	idaddr.sidl_port = htons(port);
   6.568 -+	memcpy (&idaddr.sidl_id, &dst_id, sizeof (dst_id));
   6.569 -+
   6.570 -+	if (connect(connect_sockfd, (struct sockaddr *)&idaddr, sizeof(idaddr)) < 0)
   6.571 -+		err_func("connect");
   6.572 -+
   6.573 -+	fprintf(stderr, "-- Connected --\n");
   6.574 -+
   6.575 -+	if (SIG_ERR == signal(SIGINT, sigint_handler))
   6.576 -+		err_func("signal");
   6.577 -+
   6.578 -+	do
   6.579 -+	{
   6.580 -+		fprintf(stderr, "-> ");
   6.581 -+#if 0
   6.582 -+		if (fgets(buf, BUFFER_SIZE, stdin) == NULL) {
   6.583 -+			if (ferror(stdin))
   6.584 -+				err_func("fgets");
   6.585 -+			if (feof(stdin))
   6.586 -+				break;
   6.587 -+		}
   6.588 -+		fflush(stdin);
   6.589 -+		write_siz = strlen(buf);
   6.590 -+#endif
   6.591 -+
   6.592 -+			
   6.593 -+		do
   6.594 -+		{
   6.595 -+                  char sendbuf[16] = "send echo\n";
   6.596 -+                  wrote_siz = 0;
   6.597 -+                  write_siz = sizeof (sendbuf);
   6.598 -+                  fprintf(stderr, "send-->%s\n", sendbuf);
   6.599 -+			int result = send(connect_sockfd,
   6.600 -+					sendbuf,
   6.601 -+					write_siz, 0);
   6.602 -+			if (result < 0)
   6.603 -+				err_func("send");
   6.604 -+
   6.605 -+			wrote_siz += result;
   6.606 -+		} while (wrote_siz < write_siz);
   6.607 -+
   6.608 -+		do
   6.609 -+		{
   6.610 -+			int result = recv(connect_sockfd,
   6.611 -+					buf + read_siz,
   6.612 -+					wrote_siz - read_siz, 0);
   6.613 -+			if (result < 0)
   6.614 -+				err_func("recv");
   6.615 -+
   6.616 -+			read_siz += result;
   6.617 -+
   6.618 -+		} while (read_siz < write_siz);
   6.619 -+
   6.620 -+		buf[read_siz] = '\0';
   6.621 -+		fprintf(stderr, "<- ");
   6.622 -+		fprintf(stdout, "%s", buf);
   6.623 -+		fprintf(stderr, "\n");
   6.624 -+
   6.625 -+		wrote_siz = 0;
   6.626 -+		read_siz = 0;
   6.627 -+	} while (strncmp(buf, "EXIT\r\n", 6) != 0
   6.628 -+			&& strncmp(buf, "EXIT\n", 5) != 0);
   6.629 -+
   6.630 -+	close(connect_sockfd);
   6.631 -+	fprintf(stderr, "-- Disonnected --\n");
   6.632 -+	exit(EXIT_SUCCESS);
   6.633 -+
   6.634 -+missing_operand:
   6.635 -+	printf(
   6.636 -+		"Usage: %s [-n DST HOST NAME]  [-d DST DOMAIN NAME]\n"
   6.637 -+		" -- Optional --\n"
   6.638 -+		"<-p SERVER PORT> Default server port is 6001.\n"
   6.639 -+		, argv[0], DEFAULT_SERVER_PORT
   6.640 -+	);
   6.641 -+	exit(EXIT_FAILURE);
   6.642 -+}
   6.643 -diff -r 9f12d65beb55 example/himalis/idecho-s.cc
   6.644 ---- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   6.645 -+++ b/example/himalis/idecho-s.cc	Thu Mar 29 13:58:16 2012 +0900
   6.646 -@@ -0,0 +1,146 @@
   6.647 -+/*****************************
   6.648 -+ * TP/ID/Locator echo server *
   6.649 -+ *                           *
   6.650 -+ * How to make.              *
   6.651 -+ * $ gcc THISFILE -lidlconn  *
   6.652 -+ *****************************/
   6.653 -+
   6.654 -+#include <stdio.h>
   6.655 -+#include <stdlib.h>
   6.656 -+#include <string.h>
   6.657 -+#include <unistd.h>
   6.658 -+#include <signal.h>
   6.659 -+
   6.660 -+#include <sys/socket.h>
   6.661 -+#include <sys/types.h>
   6.662 -+#include <netinet/in.h>
   6.663 -+#include <arpa/inet.h>
   6.664 -+
   6.665 -+#include "idl.h"                /* XXX */
   6.666 -+
   6.667 -+#define BUFFER_SIZE		1 * 1024
   6.668 -+#define DEFAULT_LISTEN_PORT	6001
   6.669 -+#define RCV_TIMEOUT_SEC		300
   6.670 -+
   6.671 -+int listen_sockfd, accept_sockfd = 0;
   6.672 -+const int TRUE = 1;
   6.673 -+
   6.674 -+void err_func(const char *msg)
   6.675 -+{
   6.676 -+	perror(msg);
   6.677 -+	exit(EXIT_FAILURE);
   6.678 -+}
   6.679 -+
   6.680 -+void sigint_handler(int sig)
   6.681 -+{
   6.682 -+	close(listen_sockfd);
   6.683 -+
   6.684 -+	if (accept_sockfd != -1) {
   6.685 -+		close(accept_sockfd);
   6.686 -+		fprintf(stderr, "-- Disconnected --\n");
   6.687 -+	}
   6.688 -+
   6.689 -+	exit(EXIT_SUCCESS);
   6.690 -+}
   6.691 -+
   6.692 -+char buf[BUFFER_SIZE], id_str[IDL_IDSTRLEN];
   6.693 -+int main(int argc, char **argv)
   6.694 -+{
   6.695 -+	int read_siz, wrote_siz = 0;
   6.696 -+	int opt;
   6.697 -+	struct idl_id src_id;
   6.698 -+	struct sockid_idl idaddr;
   6.699 -+	socklen_t sidl_siz;
   6.700 -+	unsigned short port = DEFAULT_LISTEN_PORT;
   6.701 -+
   6.702 -+	while ((opt = getopt(argc, argv, "hp:s:")) != -1) {
   6.703 -+		switch (opt) {
   6.704 -+			case 'p':
   6.705 -+				port = (unsigned short)atoi(optarg);
   6.706 -+				break;
   6.707 -+			case 's':
   6.708 -+				memcpy (id_str, optarg, strlen (optarg));
   6.709 -+				break;
   6.710 -+			default:
   6.711 -+				fprintf(stderr, "Usage: %s\n"
   6.712 -+					" -- Optional--\n"
   6.713 -+					"<-p PORT> Default listen port is %d.\n"
   6.714 -+					"<-i ID_STR> Id string.\n"
   6.715 -+					, argv[0], DEFAULT_LISTEN_PORT);
   6.716 -+				exit(EXIT_FAILURE);
   6.717 -+		}
   6.718 -+	}
   6.719 -+
   6.720 -+        idl_pton(id_str, &src_id);
   6.721 -+        fprintf(stdout, "Server ID  : %s\n", id_str);
   6.722 -+        fprintf(stdout, "Listen Port: %d\n", port);
   6.723 -+
   6.724 -+	if ((listen_sockfd = socket(PF_IDL,
   6.725 -+			SOCK_STREAM, 0)) < 0)
   6.726 -+		err_func("socket");
   6.727 -+
   6.728 -+	if (setsockopt(listen_sockfd,
   6.729 -+			SOL_SOCKET, SO_REUSEADDR, &TRUE, sizeof(int)) < 0)
   6.730 -+		err_func("setsockopt");
   6.731 -+
   6.732 -+	idaddr.sidl_family = IDF_IDL;
   6.733 -+	idaddr.sidl_port = htons(port);
   6.734 -+	memcpy (&idaddr.sidl_id, &src_id, sizeof (src_id));
   6.735 -+	sidl_siz = sizeof(struct sockid_idl);
   6.736 -+
   6.737 -+	if (bind(listen_sockfd, (struct sockaddr *)&idaddr, sidl_siz) < 0)
   6.738 -+		err_func("bind");
   6.739 -+
   6.740 -+	fprintf(stderr, "-- Listening --\n");
   6.741 -+	if (listen(listen_sockfd, SOMAXCONN) < 0)
   6.742 -+		err_func("listen");
   6.743 -+
   6.744 -+	if (SIG_ERR == signal(SIGINT, sigint_handler))
   6.745 -+		err_func("signal");
   6.746 -+
   6.747 -+	while (1)
   6.748 -+	{
   6.749 -+		if ((accept_sockfd = accept(listen_sockfd,
   6.750 -+				(struct sockaddr *)&idaddr, &sidl_siz)) < 0)
   6.751 -+			err_func("accept");
   6.752 -+
   6.753 -+		if (setsockopt(accept_sockfd,
   6.754 -+			SOL_SOCKET, SO_REUSEADDR, &TRUE, sizeof(int)) < 0)
   6.755 -+			err_func("setsockopt");
   6.756 -+
   6.757 -+		fprintf(stderr, "-- Connected --\n");
   6.758 -+		idl_ntop(&idaddr.sidl_id, id_str, IDL_IDSTRLEN);
   6.759 -+		fprintf(stderr, "Client ID  : %s\n", id_str);
   6.760 -+
   6.761 -+		do
   6.762 -+		{
   6.763 -+			read_siz = recv(accept_sockfd, buf, BUFFER_SIZE, 0);
   6.764 -+			if (read_siz < 0)
   6.765 -+				err_func("recv");
   6.766 -+			if (read_siz < 1)
   6.767 -+				break;
   6.768 -+
   6.769 -+			buf[read_siz] = '\0';
   6.770 -+			fprintf(stderr, "<- len=%d", read_siz);
   6.771 -+			fprintf(stdout, "%s\n", buf);
   6.772 -+
   6.773 -+			do
   6.774 -+			{ 
   6.775 -+				int result = send(accept_sockfd,
   6.776 -+						buf + wrote_siz,
   6.777 -+						read_siz - wrote_siz, 0);
   6.778 -+				if (result < 0)
   6.779 -+					err_func("send");
   6.780 -+
   6.781 -+				wrote_siz += result;
   6.782 -+			} while (wrote_siz < read_siz);
   6.783 -+
   6.784 -+			wrote_siz = 0;
   6.785 -+		} while (strncmp(buf, "EXIT\r\n", 6) != 0 &&
   6.786 -+				strncmp(buf, "EXIT\n", 5) != 0);
   6.787 -+
   6.788 -+		fprintf(stderr, "-- Disonnected --\n");
   6.789 -+		close(accept_sockfd);
   6.790 -+		accept_sockfd = -1;
   6.791 -+	}
   6.792 -+}
   6.793 -diff -r 9f12d65beb55 example/himalis/idl.h
   6.794 ---- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   6.795 -+++ b/example/himalis/idl.h	Thu Mar 29 13:58:16 2012 +0900
   6.796 -@@ -0,0 +1,331 @@
   6.797 -+/*
   6.798 -+ *	ID/Locator Split Architectur Implementation 
   6.799 -+ *
   6.800 -+ *      This header file provides interface of connect to another host APIs definition.
   6.801 -+ */
   6.802 -+
   6.803 -+
   6.804 -+#ifndef _IDL_H
   6.805 -+#define _IDL_H
   6.806 -+
   6.807 -+#include <stdbool.h>
   6.808 -+#include <string.h>
   6.809 -+#include <errno.h>
   6.810 -+
   6.811 -+#include <linux/types.h>
   6.812 -+
   6.813 -+/*
   6.814 -+ * Socket ID
   6.815 -+ */
   6.816 -+#define sockid sockaddr
   6.817 -+
   6.818 -+
   6.819 -+/*
   6.820 -+ * ID family and protocol family
   6.821 -+ */
   6.822 -+#define IDF_IDL		(37)
   6.823 -+#define PF_IDL		IDF_IDL
   6.824 -+
   6.825 -+
   6.826 -+/*
   6.827 -+ * TP/ID/L protocol number
   6.828 -+ */
   6.829 -+#define IPPROTO_TPIDL	(254)
   6.830 -+
   6.831 -+
   6.832 -+/*
   6.833 -+ * Misc
   6.834 -+ */
   6.835 -+#define IDL_IDLEN		16
   6.836 -+#define IDL_ID16LEN		8
   6.837 -+#define IDL_ID32LEN		4
   6.838 -+#define IDL_IDSTRLEN		40
   6.839 -+#define IDL_ID_DELIM		"-"
   6.840 -+#define IDL_ID_ABBR_DELIM	"--"
   6.841 -+
   6.842 -+
   6.843 -+/*
   6.844 -+ *	The ID/Locator protocol ID structure
   6.845 -+ */
   6.846 -+struct idl_id {
   6.847 -+	union 
   6.848 -+	{
   6.849 -+		__u8	uidl_id8[16];
   6.850 -+		__be16	uidl_id16[8];
   6.851 -+		__be32	uidl_id32[4];
   6.852 -+	} idl_u;
   6.853 -+#define sidl_id8	idl_u.uidl_id8
   6.854 -+#define sidl_id16	idl_u.uidl_id16
   6.855 -+#define sidl_id32	idl_u.uidl_id32
   6.856 -+};
   6.857 -+
   6.858 -+
   6.859 -+/*
   6.860 -+ *	Socket ID for The ID/Locator system
   6.861 -+ */
   6.862 -+struct sockid_idl {
   6.863 -+	unsigned short int	sidl_family;	/* IDF_IDL or PF_IDL */
   6.864 -+	__be16			sidl_port;	/* Transport layer port */
   6.865 -+	__be32			sidl__flowinfo;	/* Flow information (reserved field) */
   6.866 -+	struct idl_id		sidl_id;	/* ID */
   6.867 -+	__u32			sidl__scope_id;	/* scope id (reserved field) */
   6.868 -+};
   6.869 -+
   6.870 -+
   6.871 -+/*
   6.872 -+ *	Network format ID to printable format
   6.873 -+ */
   6.874 -+static inline int idl_ntop(const struct idl_id *id, char *id_str, size_t id_str_len)
   6.875 -+{
   6.876 -+	__be16 *id16p = (__be16 *) id;
   6.877 -+	int i, j, n, abberv_len = 0;
   6.878 -+	char *outp = id_str;
   6.879 -+	bool abbrev = false;
   6.880 -+
   6.881 -+	if (id == NULL || id_str == NULL || id_str_len < 2) {
   6.882 -+		errno = EINVAL;
   6.883 -+		return -1;
   6.884 -+	}
   6.885 -+
   6.886 -+	for (i = j = 0; i < IDL_ID16LEN; i++) {
   6.887 -+		while (i < IDL_ID16LEN && id16p[i] == 0) {
   6.888 -+			i++;
   6.889 -+			j++;
   6.890 -+		}
   6.891 -+
   6.892 -+		if (j > abberv_len)
   6.893 -+			abberv_len = j;
   6.894 -+
   6.895 -+		j = 0;
   6.896 -+	}
   6.897 -+
   6.898 -+	for (i = j = 0; i < IDL_ID16LEN; i++) {
   6.899 -+		if (!abbrev && id16p[i] == 0) {
   6.900 -+			while (i < IDL_ID16LEN && id16p[i] == 0) {
   6.901 -+				i++;
   6.902 -+				j++;
   6.903 -+			}
   6.904 -+			if (j == abberv_len) {
   6.905 -+				n = snprintf(outp, id_str_len, "%s", i > IDL_ID16LEN - 1 ? IDL_ID_ABBR_DELIM : IDL_ID_DELIM);
   6.906 -+				if (n < 0 || n >= id_str_len) {
   6.907 -+					errno = ENOMEM;
   6.908 -+					return -1;
   6.909 -+				}
   6.910 -+				outp += n;
   6.911 -+				id_str_len -= n;
   6.912 -+				abbrev = true;
   6.913 -+			}
   6.914 -+			else {
   6.915 -+				i -= j;
   6.916 -+				j = 0;
   6.917 -+			}
   6.918 -+		}
   6.919 -+
   6.920 -+		if (i < IDL_ID16LEN) {
   6.921 -+			n = snprintf(outp, id_str_len, "%s%x", i ? IDL_ID_DELIM : "", ntohs(id16p[i]));
   6.922 -+
   6.923 -+			if (n < 0 || n >= id_str_len) {
   6.924 -+				errno = ENOMEM;
   6.925 -+				return -1;
   6.926 -+			}
   6.927 -+			outp += n;
   6.928 -+			id_str_len -= n;
   6.929 -+		}
   6.930 -+	}
   6.931 -+
   6.932 -+	return 0;
   6.933 -+}
   6.934 -+
   6.935 -+
   6.936 -+/*
   6.937 -+ *	Printable format ID to network format
   6.938 -+ */
   6.939 -+static inline int __idl_ip6like_pton(const char *id_str, struct idl_id *id)
   6.940 -+{
   6.941 -+	size_t id_str_len = strlen(id_str);
   6.942 -+	int i = 0;
   6.943 -+
   6.944 -+	memset(id, 0, sizeof(*id));
   6.945 -+
   6.946 -+	if (id_str_len == 2) {
   6.947 -+		if (strcmp(id_str, "::") == 0)
   6.948 -+			return 0;
   6.949 -+		else {
   6.950 -+			errno = EINVAL;
   6.951 -+			return -1;
   6.952 -+		}
   6.953 -+	}
   6.954 -+
   6.955 -+	if (id_str_len < 2 || id_str_len > IDL_IDSTRLEN) {
   6.956 -+		errno = EINVAL;
   6.957 -+		return -1;
   6.958 -+	}
   6.959 -+
   6.960 -+	const char *cursor = id_str;
   6.961 -+	const char *abbrev_delim;
   6.962 -+	char *next_delim;
   6.963 -+	int j = IDL_ID16LEN, abbrev_len = 0, delim_cnt = 0;
   6.964 -+	long id_elm;
   6.965 -+
   6.966 -+	if ((abbrev_delim = strstr(id_str, "::")) != NULL) {
   6.967 -+		if (strstr(abbrev_delim + 1, "::")) {
   6.968 -+			errno = EINVAL; // Because, "::" cannot duplicate
   6.969 -+			return -1;
   6.970 -+		}
   6.971 -+
   6.972 -+		abbrev_len = IDL_ID16LEN;
   6.973 -+		while((cursor = strchr(cursor, *":")) != NULL) {
   6.974 -+			abbrev_len--;
   6.975 -+			cursor++;
   6.976 -+		}
   6.977 -+
   6.978 -+		if (abbrev_len < 0 || abbrev_len > IDL_ID16LEN - 2) {
   6.979 -+			errno = EINVAL; // "--" can include 0 to 6 x 16 bit
   6.980 -+			return -1;
   6.981 -+		}
   6.982 -+
   6.983 -+		cursor = id_str; // Initialize
   6.984 -+		if (abbrev_delim == id_str) {
   6.985 -+			i = abbrev_len + 1;
   6.986 -+			cursor += 2;
   6.987 -+		}
   6.988 -+	}
   6.989 -+	else {
   6.990 -+		while((cursor = strchr(cursor, *":")) != NULL) {
   6.991 -+			delim_cnt++;
   6.992 -+			cursor++;
   6.993 -+		}
   6.994 -+
   6.995 -+		if (delim_cnt != IDL_ID16LEN -1) {
   6.996 -+			errno = EINVAL; // "::" can include 0 to 6 x 16 bit
   6.997 -+			return -1;
   6.998 -+		}
   6.999 -+
  6.1000 -+		if (*id_str == *":" ||
  6.1001 -+				*(id_str + id_str_len - 1) == *":") {
  6.1002 -+			errno = EINVAL; // "::" can include 0 to 6 x 16 bit
  6.1003 -+			return -1;
  6.1004 -+		}
  6.1005 -+
  6.1006 -+		i = 0;
  6.1007 -+		cursor = id_str; // Initialize
  6.1008 -+	}
  6.1009 -+
  6.1010 -+	for (; i < j; i++) {
  6.1011 -+		id_elm = strtol(cursor, &next_delim, 16);
  6.1012 -+		if (id_elm < 0 || id_elm > 0xffff) {
  6.1013 -+			errno = EINVAL; // "::" can include 0 to 6 x 16 bit
  6.1014 -+			return -1;
  6.1015 -+		}
  6.1016 -+
  6.1017 -+		id->sidl_id16[i] = htons((__be16)id_elm);
  6.1018 -+
  6.1019 -+		if (next_delim == abbrev_delim) {
  6.1020 -+			i += abbrev_len;
  6.1021 -+			next_delim++;
  6.1022 -+		}
  6.1023 -+
  6.1024 -+		cursor = next_delim + 1;
  6.1025 -+	}
  6.1026 -+
  6.1027 -+	return 0;
  6.1028 -+}
  6.1029 -+
  6.1030 -+
  6.1031 -+/*
  6.1032 -+ *	Printable format ID to network format
  6.1033 -+ */
  6.1034 -+static inline int idl_pton(const char *id_str, struct idl_id *id)
  6.1035 -+{
  6.1036 -+	size_t id_str_len = strlen(id_str);
  6.1037 -+	int i = 0;
  6.1038 -+
  6.1039 -+	memset(id, 0, sizeof(*id));
  6.1040 -+
  6.1041 -+	if (id_str_len == 2) {
  6.1042 -+		if (strcmp(id_str, IDL_ID_ABBR_DELIM) == 0) // This meens "--"
  6.1043 -+			return 0;
  6.1044 -+		else {
  6.1045 -+			errno = EINVAL;
  6.1046 -+			return -1;
  6.1047 -+		}
  6.1048 -+	}
  6.1049 -+
  6.1050 -+	if (id_str_len < 2 || id_str_len > IDL_IDSTRLEN) {
  6.1051 -+		errno = EINVAL;
  6.1052 -+		return -1;
  6.1053 -+	}
  6.1054 -+
  6.1055 -+	const char *cursor = id_str;
  6.1056 -+	const char *abbrev_delim;
  6.1057 -+	char *next_delim;
  6.1058 -+	int j = IDL_ID16LEN, abbrev_len = 0, delim_cnt = 0;
  6.1059 -+	long id_elm;
  6.1060 -+
  6.1061 -+	if ((abbrev_delim = strstr(id_str, IDL_ID_ABBR_DELIM)) != NULL) {
  6.1062 -+		if (strstr(abbrev_delim + 1, IDL_ID_ABBR_DELIM)) {
  6.1063 -+			errno = EINVAL; // Because, "--" cannot duplicate
  6.1064 -+			return -1;
  6.1065 -+		}
  6.1066 -+
  6.1067 -+		abbrev_len = IDL_ID16LEN;
  6.1068 -+		while((cursor = strchr(cursor, *IDL_ID_DELIM)) != NULL) {
  6.1069 -+			abbrev_len--;
  6.1070 -+			cursor++;
  6.1071 -+		}
  6.1072 -+
  6.1073 -+		if (abbrev_len < 0 || abbrev_len > IDL_ID16LEN - 2) {
  6.1074 -+			errno = EINVAL; // "--" can include 0 to 6 x 16 bit
  6.1075 -+			return -1;
  6.1076 -+		}
  6.1077 -+
  6.1078 -+		cursor = id_str; // Initialize
  6.1079 -+		if (abbrev_delim == id_str) {
  6.1080 -+			i = abbrev_len + 1;
  6.1081 -+			cursor += 2;
  6.1082 -+		}
  6.1083 -+	}
  6.1084 -+	else {
  6.1085 -+		while((cursor = strchr(cursor, *IDL_ID_DELIM)) != NULL) {
  6.1086 -+			delim_cnt++;
  6.1087 -+			cursor++;
  6.1088 -+		}
  6.1089 -+
  6.1090 -+		if (delim_cnt != IDL_ID16LEN -1) {
  6.1091 -+			errno = EINVAL; // "--" can include 0 to 6 x 16 bit
  6.1092 -+			return -1;
  6.1093 -+		}
  6.1094 -+
  6.1095 -+		if (*id_str == *IDL_ID_DELIM ||
  6.1096 -+				*(id_str + id_str_len - 1) == *IDL_ID_DELIM) {
  6.1097 -+			errno = EINVAL; // "--" can include 0 to 6 x 16 bit
  6.1098 -+			return -1;
  6.1099 -+		}
  6.1100 -+
  6.1101 -+		i = 0;
  6.1102 -+		cursor = id_str; // Initialize
  6.1103 -+	}
  6.1104 -+
  6.1105 -+	for (; i < j; i++) {
  6.1106 -+		id_elm = strtol(cursor, &next_delim, 16);
  6.1107 -+		if (id_elm < 0 || id_elm > 0xffff) {
  6.1108 -+			errno = EINVAL; // "--" can include 0 to 6 x 16 bit
  6.1109 -+			return -1;
  6.1110 -+		}
  6.1111 -+
  6.1112 -+		id->sidl_id16[i] = htons((__be16)id_elm);
  6.1113 -+
  6.1114 -+		if (next_delim == abbrev_delim) {
  6.1115 -+			i += abbrev_len;
  6.1116 -+			next_delim++;
  6.1117 -+		}
  6.1118 -+
  6.1119 -+		cursor = next_delim + 1;
  6.1120 -+	}
  6.1121 -+
  6.1122 -+	return 0;
  6.1123 -+}
  6.1124 -+
  6.1125 -+#endif /* _IDL_H */
  6.1126 -+
  6.1127 -+
  6.1128 -diff -r 9f12d65beb55 helper/himalis-helper.cc
  6.1129 ---- /dev/null	Thu Jan 01 00:00:00 1970 +0000
  6.1130 -+++ b/helper/himalis-helper.cc	Thu Mar 29 13:58:16 2012 +0900
  6.1131 -@@ -0,0 +1,212 @@
  6.1132 -+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
  6.1133 -+/*
  6.1134 -+ * Copyright (c) 2012 NICT
  6.1135 -+ *
  6.1136 -+ * This program is free software; you can redistribute it and/or modify
  6.1137 -+ * it under the terms of the GNU General Public License version 2 as
  6.1138 -+ * published by the Free Software Foundation;
  6.1139 -+ *
  6.1140 -+ * This program is distributed in the hope that it will be useful,
  6.1141 -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
  6.1142 -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  6.1143 -+ * GNU General Public License for more details.
  6.1144 -+ *
  6.1145 -+ * You should have received a copy of the GNU General Public License
  6.1146 -+ * along with this program; if not, write to the Free Software
  6.1147 -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  6.1148 -+ *
  6.1149 -+ * Author: Hajime Tazaki <tazaki@nict.go.jp>
  6.1150 -+ */
  6.1151 -+
  6.1152 -+#include <Python.h>
  6.1153 -+#include "himalis-helper.h"
  6.1154 -+#include "ns3/object-factory.h"
  6.1155 -+#include "ns3/names.h"
  6.1156 -+#include "ns3/log.h"
  6.1157 -+#include "ns3/event-id.h"
  6.1158 -+#include "ns3/simulator.h"
  6.1159 -+
  6.1160 -+NS_LOG_COMPONENT_DEFINE ("HimalisHelper");
  6.1161 -+
  6.1162 -+namespace ns3 {
  6.1163 -+
  6.1164 -+
  6.1165 -+
  6.1166 -+
  6.1167 -+HimalisHelper::HimalisHelper ()
  6.1168 -+{
  6.1169 -+  InitIdlRoutePy ();
  6.1170 -+}
  6.1171 -+
  6.1172 -+HimalisHelper::~HimalisHelper ()
  6.1173 -+{
  6.1174 -+  Py_Finalize();
  6.1175 -+}
  6.1176 -+
  6.1177 -+PyObject *m_pycode = NULL;
  6.1178 -+
  6.1179 -+void
  6.1180 -+HimalisHelper::InitIdlRoutePy ()
  6.1181 -+{
  6.1182 -+  Py_Initialize();
  6.1183 -+  const char *argv[] = {"python", NULL};
  6.1184 -+  PySys_SetArgv(1, (char **)argv);
  6.1185 -+
  6.1186 -+  try
  6.1187 -+    {
  6.1188 -+      m_pycode = PyImport_ImportModule("idlroute");
  6.1189 -+      int i=0;
  6.1190 -+
  6.1191 -+      if(m_pycode == NULL)
  6.1192 -+        {
  6.1193 -+          PyErr_Print();
  6.1194 -+          throw "Unappropriate Python syntax";
  6.1195 -+        }
  6.1196 -+    }
  6.1197 -+  catch(const char* msg)
  6.1198 -+    {
  6.1199 -+      NS_LOG_WARN ("ERROR :" << msg );
  6.1200 -+    }
  6.1201 -+  catch(...)
  6.1202 -+    {
  6.1203 -+      NS_LOG_WARN ("ERROR : Something Error");
  6.1204 -+    }
  6.1205 -+}
  6.1206 -+
  6.1207 -+void 
  6.1208 -+HimalisHelper::AddIdlRoute (Ptr<Node> node, Time at, const char * host_or_fw, 
  6.1209 -+                            const char * src_id, const char * dst_id,
  6.1210 -+                            const char * src_addr, const char * dst_addr,
  6.1211 -+                            const char *dev_name)
  6.1212 -+{
  6.1213 -+  std::string format = "(ssssss)";
  6.1214 -+  PyObject* cmd_buf = NULL;
  6.1215 -+  std::string value;
  6.1216 -+
  6.1217 -+  try{
  6.1218 -+    cmd_buf = PyObject_CallMethod(m_pycode, (char *)"mk_add_route_cmd\0", (char *)format.c_str (),
  6.1219 -+                                  host_or_fw, src_id, dst_id, src_addr, dst_addr, dev_name);
  6.1220 -+    if(cmd_buf == NULL)
  6.1221 -+      {
  6.1222 -+
  6.1223 -+        PyErr_Print();
  6.1224 -+        throw "Unappropriate Python syntax";
  6.1225 -+        NS_LOG_WARN ("ERROR :" << cmd_buf );
  6.1226 -+      }
  6.1227 -+    if (cmd_buf != Py_None && PyString_CheckExact(cmd_buf))
  6.1228 -+      value = std::string(PyString_AsString(cmd_buf));
  6.1229 -+    else
  6.1230 -+      value = "None";
  6.1231 -+  }
  6.1232 -+  catch(const char* msg)
  6.1233 -+    {
  6.1234 -+      NS_LOG_WARN ("ERROR :" << msg );
  6.1235 -+      return;
  6.1236 -+    }
  6.1237 -+
  6.1238 -+  NS_LOG_DEBUG ("return value from python = " <<  value);
  6.1239 -+
  6.1240 -+  Ptr<LinuxSocketFdFactory> kern = node->GetObject<LinuxSocketFdFactory>();
  6.1241 -+  std::string key (".net.idl.idlrt");
  6.1242 -+  Simulator::ScheduleWithContext (node->GetId (), at,
  6.1243 -+                                  MakeEvent (&LinuxSocketFdFactory::Set, kern,
  6.1244 -+                                             key, value));
  6.1245 -+
  6.1246 -+  Py_DECREF(cmd_buf);
  6.1247 -+}
  6.1248 -+
  6.1249 -+void 
  6.1250 -+HimalisHelper::DelIdlRoute (Ptr<Node> node, Time at,
  6.1251 -+                            const char * src_id, const char * dst_id)
  6.1252 -+{
  6.1253 -+  std::string value;
  6.1254 -+  const char *format = "(ss)";
  6.1255 -+
  6.1256 -+  PyObject* cmd_buf = PyObject_CallMethod(m_pycode, (char *)"mk_del_route_cmd", 
  6.1257 -+                                          (char *)format,
  6.1258 -+                                          src_id, dst_id);
  6.1259 -+  if(cmd_buf == NULL)
  6.1260 -+    {
  6.1261 -+      PyErr_Print();
  6.1262 -+      throw "Unappropriate Python syntax";
  6.1263 -+    }
  6.1264 -+  if (cmd_buf != Py_None && PyString_CheckExact(cmd_buf))
  6.1265 -+    value = std::string(PyString_AsString(cmd_buf));
  6.1266 -+  else
  6.1267 -+    value = "None";
  6.1268 -+
  6.1269 -+  NS_LOG_DEBUG ("return value from python = " <<  value);
  6.1270 -+  Ptr<LinuxSocketFdFactory> kern = node->GetObject<LinuxSocketFdFactory>();
  6.1271 -+  std::string key (".net.idl.idlrt");
  6.1272 -+  Simulator::ScheduleWithContext (node->GetId (), at,
  6.1273 -+                                  MakeEvent (&LinuxSocketFdFactory::Set, kern,
  6.1274 -+                                             key, value));
  6.1275 -+  Py_DECREF(cmd_buf);
  6.1276 -+}
  6.1277 -+
  6.1278 -+void
  6.1279 -+PrintIdlRoute (Ptr<Node> node)
  6.1280 -+{
  6.1281 -+  std::string key (".net.idl.idlrt");
  6.1282 -+  Ptr<LinuxSocketFdFactory> kern = node->GetObject<LinuxSocketFdFactory>();
  6.1283 -+  std::string buffer = kern->Get (key);
  6.1284 -+  NS_LOG_INFO ("ShowIdlRoute " << buffer);
  6.1285 -+}
  6.1286 -+
  6.1287 -+void 
  6.1288 -+HimalisHelper::ShowIdlRoute (Ptr<Node> node, Time at)
  6.1289 -+{
  6.1290 -+  Ptr<LinuxSocketFdFactory> kern = node->GetObject<LinuxSocketFdFactory>();
  6.1291 -+  Simulator::ScheduleWithContext (node->GetId (), at,
  6.1292 -+                                  &LinuxSocketFdFactory::ScheduleTask, kern,
  6.1293 -+                                  MakeEvent (PrintIdlRoute, node));
  6.1294 -+}
  6.1295 -+
  6.1296 -+void 
  6.1297 -+HimalisHelper::SetAttribute (std::string name, const AttributeValue &value)
  6.1298 -+{
  6.1299 -+}
  6.1300 -+
  6.1301 -+
  6.1302 -+ApplicationContainer
  6.1303 -+HimalisHelper::Install (Ptr<Node> node)
  6.1304 -+{
  6.1305 -+  return ApplicationContainer (InstallPriv (node));
  6.1306 -+}
  6.1307 -+
  6.1308 -+ApplicationContainer
  6.1309 -+HimalisHelper::Install (std::string nodeName)
  6.1310 -+{
  6.1311 -+  Ptr<Node> node = Names::Find<Node> (nodeName);
  6.1312 -+  return ApplicationContainer (InstallPriv (node));
  6.1313 -+}
  6.1314 -+
  6.1315 -+ApplicationContainer
  6.1316 -+HimalisHelper::Install (NodeContainer c)
  6.1317 -+{
  6.1318 -+  ApplicationContainer apps;
  6.1319 -+  for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
  6.1320 -+    {
  6.1321 -+      apps.Add (InstallPriv (*i));
  6.1322 -+    }
  6.1323 -+
  6.1324 -+  return apps;
  6.1325 -+}
  6.1326 -+
  6.1327 -+ApplicationContainer
  6.1328 -+HimalisHelper::InstallPriv (Ptr<Node> node) 
  6.1329 -+{
  6.1330 -+  DceApplicationHelper process;
  6.1331 -+  ApplicationContainer apps;
  6.1332 -+
  6.1333 -+  return apps;
  6.1334 -+  process.SetBinary ("zebra");
  6.1335 -+  //  process.AddArguments ("-i", "/usr/local/etc/zebra.pid");
  6.1336 -+  process.SetStackSize (1<<16);
  6.1337 -+  apps.Add (process.Install (node));
  6.1338 -+  apps.Get(0)->SetStartTime (Seconds (10.0 + 0.01 * node->GetId ()));
  6.1339 -+  node->AddApplication (apps.Get (0));
  6.1340 -+  return apps;
  6.1341 -+}
  6.1342 -+
  6.1343 -+} // namespace ns3
  6.1344 -diff -r 9f12d65beb55 helper/himalis-helper.h
  6.1345 ---- /dev/null	Thu Jan 01 00:00:00 1970 +0000
  6.1346 -+++ b/helper/himalis-helper.h	Thu Mar 29 13:58:16 2012 +0900
  6.1347 -@@ -0,0 +1,103 @@
  6.1348 -+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
  6.1349 -+/*
  6.1350 -+ * Copyright (c) 2012 NICT
  6.1351 -+ *
  6.1352 -+ * This program is free software; you can redistribute it and/or modify
  6.1353 -+ * it under the terms of the GNU General Public License version 2 as
  6.1354 -+ * published by the Free Software Foundation;
  6.1355 -+ *
  6.1356 -+ * This program is distributed in the hope that it will be useful,
  6.1357 -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
  6.1358 -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  6.1359 -+ * GNU General Public License for more details.
  6.1360 -+ *
  6.1361 -+ * You should have received a copy of the GNU General Public License
  6.1362 -+ * along with this program; if not, write to the Free Software
  6.1363 -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  6.1364 -+ *
  6.1365 -+ * Author: Hajime Tazaki <tazaki@nict.go.jp>
  6.1366 -+ */
  6.1367 -+#ifndef HIMALIS_HELPER_H
  6.1368 -+#define HIMALIS_HELPER_H
  6.1369 -+
  6.1370 -+#include "dce-manager-helper.h"
  6.1371 -+#include "dce-application-helper.h"
  6.1372 -+#include "linux-socket-fd-factory.h"
  6.1373 -+
  6.1374 -+namespace ns3 {
  6.1375 -+
  6.1376 -+/**
  6.1377 -+ * \brief create a himalis routing daemon as an application and associate it to a node
  6.1378 -+ *
  6.1379 -+ * This class creates one or multiple instances of ns3::Himalis and associates
  6.1380 -+ * it/them to one/multiple node(s).
  6.1381 -+ */
  6.1382 -+class HimalisHelper : public Object
  6.1383 -+{
  6.1384 -+public:
  6.1385 -+  /**
  6.1386 -+   * Create a HimalisHelper which is used to make life easier for people wanting
  6.1387 -+   * to use himalis Applications.
  6.1388 -+   *
  6.1389 -+   */
  6.1390 -+  HimalisHelper ();
  6.1391 -+  ~HimalisHelper ();
  6.1392 -+
  6.1393 -+
  6.1394 -+  void InitIdlRoutePy ();
  6.1395 -+  /**
  6.1396 -+   * Install a himalis application on each Node in the provided NodeContainer.
  6.1397 -+   *
  6.1398 -+   * \param nodes The NodeContainer containing all of the nodes to get a himalis
  6.1399 -+   *              application via ProcessManager.
  6.1400 -+   *
  6.1401 -+   * \returns A list of himalis applications, one for each input node
  6.1402 -+   */
  6.1403 -+  ApplicationContainer Install (NodeContainer nodes);
  6.1404 -+
  6.1405 -+  /**
  6.1406 -+   * Install a himalis application on the provided Node.  The Node is specified
  6.1407 -+   * directly by a Ptr<Node>
  6.1408 -+   *
  6.1409 -+   * \param node The node to install the HimalisApplication on.
  6.1410 -+   *
  6.1411 -+   * \returns An ApplicationContainer holding the himalis application created.
  6.1412 -+   */
  6.1413 -+  ApplicationContainer Install (Ptr<Node> node);
  6.1414 -+
  6.1415 -+  /**
  6.1416 -+   * Install a himalis application on the provided Node.  The Node is specified
  6.1417 -+   * by a string that must have previosly been associated with a Node using the
  6.1418 -+   * Object Name Service.
  6.1419 -+   *
  6.1420 -+   * \param nodeName The node to install the ProcessApplication on.
  6.1421 -+   *
  6.1422 -+   * \returns An ApplicationContainer holding the himalis application created.
  6.1423 -+   */
  6.1424 -+  ApplicationContainer Install (std::string nodeName);
  6.1425 -+
  6.1426 -+  /**
  6.1427 -+   * \brief Configure ping applications attribute 
  6.1428 -+   * \param name   attribute's name
  6.1429 -+   * \param value  attribute's value
  6.1430 -+   */
  6.1431 -+  void SetAttribute (std::string name, const AttributeValue &value);
  6.1432 -+
  6.1433 -+  void AddIdlRoute (Ptr<Node> node, Time at, const char * host_or_fw, 
  6.1434 -+                    const char * src_id, const char * dst_id,
  6.1435 -+                    const char * src_addr, const char * dst_addr,
  6.1436 -+                    const char *dev_name);
  6.1437 -+  void DelIdlRoute (Ptr<Node> node, Time at, 
  6.1438 -+                    const char * src_id, const char * dst_id);
  6.1439 -+  void ShowIdlRoute (Ptr<Node> node, Time at);
  6.1440 -+
  6.1441 -+private:
  6.1442 -+  /**
  6.1443 -+   * \internal
  6.1444 -+   */
  6.1445 -+  ApplicationContainer InstallPriv (Ptr<Node> node);
  6.1446 -+};
  6.1447 -+
  6.1448 -+} // namespace ns3
  6.1449 -+
  6.1450 -+#endif /* HIMALIS_HELPER_H */
  6.1451 -diff -r 9f12d65beb55 idlroute
  6.1452 ---- /dev/null	Thu Jan 01 00:00:00 1970 +0000
  6.1453 -+++ b/idlroute	Thu Mar 29 13:58:16 2012 +0900
  6.1454 -@@ -0,0 +1,328 @@
  6.1455 -+#! /usr/bin/python
  6.1456 -+# -*- coding: utf-8 -*-
  6.1457 -+
  6.1458 -+import os
  6.1459 -+import sys
  6.1460 -+import socket
  6.1461 -+import fcntl
  6.1462 -+import struct
  6.1463 -+
  6.1464 -+
  6.1465 -+IDF_IDLOC	= socket.AF_INET6
  6.1466 -+PROC_DELIMITER	= ','
  6.1467 -+PROC_IDL_ROUTE	= '/proc/net/idlrt'
  6.1468 -+
  6.1469 -+ADD	= 'add'
  6.1470 -+DEL	= 'del'
  6.1471 -+HOST	= 'host'
  6.1472 -+FORWARD	= 'frwd'
  6.1473 -+IPV4	= 'ipv4'
  6.1474 -+IPV6	= 'ipv6'
  6.1475 -+
  6.1476 -+FLAG_HOST	= 1
  6.1477 -+FLAG_FORWARD	= 2
  6.1478 -+FLAG_IPV4	= 4
  6.1479 -+FLAG_IPV6	= 8
  6.1480 -+
  6.1481 -+PROC_IF_INET6	= '/proc/net/if_inet6'
  6.1482 -+PROC_NET_DEV	= '/proc/net/dev'
  6.1483 -+
  6.1484 -+ID_DELIMITER	= '-'
  6.1485 -+
  6.1486 -+def usage():
  6.1487 -+	print '\
  6.1488 -+Usage: idlroute [show|stat|add|delete] opt...\n\
  6.1489 -+\n\
  6.1490 -+  Show route\n\
  6.1491 -+    show\n\
  6.1492 -+\n\
  6.1493 -+  Show traffic status\n\
  6.1494 -+    stat [SRC_ID] [DST_ID]\n\
  6.1495 -+\n\
  6.1496 -+  Add host route\n\
  6.1497 -+    add host [SRC_ID] [DST_ID] [SRC_LOCATOR] [DST_LOCATOR]\n\
  6.1498 -+\n\
  6.1499 -+  Add forward route\n\
  6.1500 -+    add forward [SRC_ID] [DST_ID] [NEXT_SRC_LOCATOR] [NEXT_DST_LOCATOR]\n\
  6.1501 -+\n\
  6.1502 -+  Delete route\n\
  6.1503 -+    delete [SRC_ID] [DST_ID]\n\
  6.1504 -+    * No particular order: [SRC_ID] [DST_ID] <-> [DST_ID] [SRC_ID]\n\
  6.1505 -+    * If there is an ID entry for opposite way, then both are deleted.\n'
  6.1506 -+
  6.1507 -+
  6.1508 -+def search_dev_by_ipv4_addr(addr):
  6.1509 -+	dev_names = []
  6.1510 -+	addr_dict = {}
  6.1511 -+
  6.1512 -+	f = open(PROC_NET_DEV, 'r')
  6.1513 -+	# Format of PROC_NET_DEV
  6.1514 -+	# Inter-|   Receive
  6.1515 -+	#  face |bytes    packets errs drop fifo frame compressed ...
  6.1516 -+	#     lo:     240       4    0    0    0     0	  0 ...
  6.1517 -+	#   eth0: 7246766   70183    0    0    0     0	  0 ...
  6.1518 -+	# ...
  6.1519 -+	lines = f.readlines()
  6.1520 -+	f.close
  6.1521 -+
  6.1522 -+	for line in lines[2:]:
  6.1523 -+		dev_names.append(line.split()[0].split(":")[0])
  6.1524 -+
  6.1525 -+	for dev_name in dev_names:
  6.1526 -+		s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  6.1527 -+		try:
  6.1528 -+			addr_dict[socket.inet_ntoa(fcntl.ioctl(
  6.1529 -+				s.fileno(),0x8915,  # SIOCGIFADDR
  6.1530 -+				struct.pack('256s', dev_name[:15]))[20:24])
  6.1531 -+				] = dev_name
  6.1532 -+		except:
  6.1533 -+			pass
  6.1534 -+
  6.1535 -+	try:
  6.1536 -+		return addr_dict[addr]
  6.1537 -+	except:
  6.1538 -+		return None
  6.1539 -+
  6.1540 -+
  6.1541 -+def search_dev_by_ipv6_addr(addr):
  6.1542 -+	dev_name = None
  6.1543 -+
  6.1544 -+	f = open(PROC_IF_INET6, 'r')
  6.1545 -+	# Format of PROC_IF_INET6
  6.1546 -+	# 20010c901b8d03095a946bfffe1c76d0 03 40 00 00     eth0
  6.1547 -+	# ...
  6.1548 -+	lines = f.readlines()
  6.1549 -+	f.close
  6.1550 -+
  6.1551 -+	for line in lines:
  6.1552 -+		addr_dev = line.split()
  6.1553 -+		if (addr == addr_dev[0]):
  6.1554 -+			dev_name = addr_dev[5]
  6.1555 -+			break
  6.1556 -+
  6.1557 -+	return dev_name
  6.1558 -+
  6.1559 -+
  6.1560 -+def mk_add_route_cmd(host_or_fw, id_1, id_2, src_addr, dst_addr, exp_dev_name):
  6.1561 -+	buff = ADD + PROC_DELIMITER
  6.1562 -+	if   (host_or_fw == 'host'):
  6.1563 -+		buff += HOST    + PROC_DELIMITER
  6.1564 -+		src_id = id_1;
  6.1565 -+		dst_id = id_2;
  6.1566 -+	elif (host_or_fw == 'forward'):
  6.1567 -+		buff += FORWARD + PROC_DELIMITER
  6.1568 -+		src_id = id_2;
  6.1569 -+		dst_id = id_1;
  6.1570 -+	else:
  6.1571 -+		print 'Error: Bad params.'
  6.1572 -+		return 1
  6.1573 -+
  6.1574 -+	try:
  6.1575 -+		buff += ''.join(map(lambda B: '%02x' % B, struct.unpack('16B',
  6.1576 -+			socket.inet_pton(socket.AF_INET6,
  6.1577 -+			src_id.replace(ID_DELIMITER, ":"))))) + PROC_DELIMITER
  6.1578 -+		buff += ''.join(map(lambda B: '%02x' % B, struct.unpack('16B',
  6.1579 -+			socket.inet_pton(socket.AF_INET6,
  6.1580 -+			dst_id.replace(ID_DELIMITER, ":"))))) + PROC_DELIMITER
  6.1581 -+	except:
  6.1582 -+		print 'Error: Illegal ID format.'
  6.1583 -+		return 1
  6.1584 -+
  6.1585 -+	# If source addr is IPv6.
  6.1586 -+	try:
  6.1587 -+		src_addr = ''.join(map(lambda B: '%02x' % B,
  6.1588 -+			struct.unpack('16B',
  6.1589 -+			socket.inet_pton(socket.AF_INET6, src_addr))))
  6.1590 -+		dev_name = search_dev_by_ipv6_addr(src_addr)
  6.1591 -+	except:
  6.1592 -+		# Else if source addr is IPv4.
  6.1593 -+		try:
  6.1594 -+			dev_name = search_dev_by_ipv4_addr(src_addr)
  6.1595 -+			src_addr = '00000000000000000000ffff' \
  6.1596 -+				+ ''.join(map(lambda B: '%02x' % B, struct.unpack('4B',
  6.1597 -+				socket.inet_pton(socket.AF_INET, src_addr))))
  6.1598 -+		except:
  6.1599 -+			print 'Error: Illegal IP address format.'
  6.1600 -+			return 1
  6.1601 -+
  6.1602 -+	# If destination addr is IPv6 then.
  6.1603 -+	try:
  6.1604 -+		dst_addr = ''.join(map(lambda B: '%02x' % B,
  6.1605 -+			struct.unpack('16B',
  6.1606 -+			socket.inet_pton(socket.AF_INET6, dst_addr))))
  6.1607 -+	except:
  6.1608 -+		# Else if destination addr is IPv4.
  6.1609 -+		try:
  6.1610 -+			dst_addr = '00000000000000000000ffff' \
  6.1611 -+				+ ''.join(map(lambda B: '%02x' % B, struct.unpack('4B',
  6.1612 -+				socket.inet_pton(socket.AF_INET, dst_addr))))
  6.1613 -+		except:
  6.1614 -+			print 'Error: Illegal IP address format.'
  6.1615 -+			return 1
  6.1616 -+
  6.1617 -+	if (dev_name == None):
  6.1618 -+		dev_name = exp_dev_name
  6.1619 -+		if (exp_dev_name == None):
  6.1620 -+			print 'Error: Network interface not found.'
  6.1621 -+			return 1
  6.1622 -+
  6.1623 -+	buff += src_addr + PROC_DELIMITER
  6.1624 -+	buff += dst_addr + PROC_DELIMITER
  6.1625 -+	buff += dev_name
  6.1626 -+	return buff
  6.1627 -+
  6.1628 -+def add_route(host_or_fw, id_1, id_2, src_addr, dst_addr):
  6.1629 -+	buff = mk_add_route_cmd(host_or_fw, id_1, id_2, src_addr, dst_addr)
  6.1630 -+	try:
  6.1631 -+		f = open(PROC_IDL_ROUTE, 'w')
  6.1632 -+		f.write(buff)
  6.1633 -+		f.close()
  6.1634 -+	except (IOError):
  6.1635 -+		print 'Error: I/O error.'
  6.1636 -+
  6.1637 -+
  6.1638 -+def mk_del_route_cmd(src_id, dst_id):
  6.1639 -+	buff = DEL + PROC_DELIMITER
  6.1640 -+	try:
  6.1641 -+		buff += ''.join(map(lambda B: '%02x' % B, struct.unpack('16B',
  6.1642 -+			socket.inet_pton(socket.AF_INET6, src_id.replace(ID_DELIMITER, ":"))))) + PROC_DELIMITER
  6.1643 -+		buff += ''.join(map(lambda B: '%02x' % B, struct.unpack('16B',
  6.1644 -+			socket.inet_pton(socket.AF_INET6, dst_id.replace(ID_DELIMITER, ":")))))
  6.1645 -+
  6.1646 -+	except:
  6.1647 -+		print 'Error: Illegal ID format.'
  6.1648 -+		return "ERROR"
  6.1649 -+	return buff
  6.1650 -+
  6.1651 -+def del_route(src_id, dst_id):
  6.1652 -+	buff = mk_del_route_cmd(src_id, dst_id)
  6.1653 -+	f = open(PROC_IDL_ROUTE, 'w')
  6.1654 -+	f.write(buff)
  6.1655 -+	f.close()
  6.1656 -+
  6.1657 -+
  6.1658 -+def show_route():
  6.1659 -+	f = open(PROC_IDL_ROUTE, 'r')
  6.1660 -+	lines = f.readlines()
  6.1661 -+	f.close()
  6.1662 -+
  6.1663 -+	print 'Flags  Source ID                Destination ID           Source locator           Destination locator'
  6.1664 -+	for line in lines:
  6.1665 -+		host_or_fw = ' '
  6.1666 -+		ip_version = ' '
  6.1667 -+		forward = False
  6.1668 -+
  6.1669 -+		rec = line.split(',')
  6.1670 -+
  6.1671 -+		# Flags
  6.1672 -+		flags = int(rec[0], 16)
  6.1673 -+		if (flags & FLAG_HOST):
  6.1674 -+			host_or_fw = 'H'
  6.1675 -+		if (flags & FLAG_FORWARD):
  6.1676 -+			host_or_fw = 'F'
  6.1677 -+			forward = True
  6.1678 -+		if (flags & FLAG_IPV4):
  6.1679 -+			ip_version = '4'
  6.1680 -+		if (flags & FLAG_IPV6):
  6.1681 -+			ip_version = '6'
  6.1682 -+
  6.1683 -+		# IDs
  6.1684 -+		id_1 = socket.inet_ntop(socket.AF_INET6, \
  6.1685 -+				socket.inet_pton(socket.AF_INET6, rec[1])).replace(":", ID_DELIMITER)
  6.1686 -+		id_2 = socket.inet_ntop(socket.AF_INET6, \
  6.1687 -+				socket.inet_pton(socket.AF_INET6, rec[2])).replace(":", ID_DELIMITER)
  6.1688 -+
  6.1689 -+		# Locators
  6.1690 -+		src_addr = socket.inet_ntop(socket.AF_INET6, \
  6.1691 -+				socket.inet_pton(socket.AF_INET6, rec[3]))
  6.1692 -+		dst_addr = socket.inet_ntop(socket.AF_INET6, 
  6.1693 -+				socket.inet_pton(socket.AF_INET6, rec[4]))
  6.1694 -+
  6.1695 -+		if (ip_version == '4'):
  6.1696 -+			src_addr = src_addr.split('::ffff:')[-1]
  6.1697 -+			dst_addr = dst_addr.split('::ffff:')[-1]
  6.1698 -+
  6.1699 -+		# Host
  6.1700 -+		if (forward == False):
  6.1701 -+			print '%s%s     %-24s %-24s %-24s %-24s' % \
  6.1702 -+				(host_or_fw, ip_version,
  6.1703 -+				id_1, id_2, src_addr, dst_addr)
  6.1704 -+		# Forward
  6.1705 -+		else:
  6.1706 -+			print '%s%s     %-24s %-24s %-24s %-24s' % \
  6.1707 -+				(host_or_fw, ip_version,
  6.1708 -+				id_2, id_1, src_addr, dst_addr)
  6.1709 -+
  6.1710 -+
  6.1711 -+def stat_route(src_id, dst_id):
  6.1712 -+	src_id = socket.inet_ntop(socket.AF_INET6,
  6.1713 -+		socket.inet_pton(socket.AF_INET6, src_id.replace(ID_DELIMITER, ":")))
  6.1714 -+	dst_id = socket.inet_ntop(socket.AF_INET6,
  6.1715 -+		socket.inet_pton(socket.AF_INET6, dst_id.replace(ID_DELIMITER, ":")))
  6.1716 -+
  6.1717 -+	f = open(PROC_IDL_ROUTE, 'r')
  6.1718 -+	lines = f.readlines()
  6.1719 -+	f.close()
  6.1720 -+
  6.1721 -+	for line in lines:
  6.1722 -+		rec = line.split(',')
  6.1723 -+		# Host
  6.1724 -+		if int(rec[0], 16) & FLAG_HOST:
  6.1725 -+			src_id_in_rec = rec[1]
  6.1726 -+			dst_id_in_rec = rec[2]
  6.1727 -+		# Forward
  6.1728 -+		else:
  6.1729 -+			src_id_in_rec = rec[2]
  6.1730 -+			dst_id_in_rec = rec[1]
  6.1731 -+
  6.1732 -+		if (src_id == socket.inet_ntop(socket.AF_INET6, \
  6.1733 -+			socket.inet_pton(socket.AF_INET6, src_id_in_rec))
  6.1734 -+		and dst_id == socket.inet_ntop(socket.AF_INET6, \
  6.1735 -+			socket.inet_pton(socket.AF_INET6, dst_id_in_rec))):
  6.1736 -+
  6.1737 -+			rx = int(rec[6], 16)
  6.1738 -+			tx = int(rec[7], 16)
  6.1739 -+			print 'total    rx       tx'
  6.1740 -+			print '%-8d %-8d %-8d' % (rx + tx, rx, tx)
  6.1741 -+			f.close
  6.1742 -+			return 0
  6.1743 -+
  6.1744 -+	f.close
  6.1745 -+	print 'Info: No route info.'
  6.1746 -+	return 1
  6.1747 -+
  6.1748 -+
  6.1749 -+def main(argc, argv):
  6.1750 -+	if   argc == 7 and argv[1] == 'add':  # ADD
  6.1751 -+		if (os.getuid() != 0):
  6.1752 -+			print 'Error: Permission denied.'
  6.1753 -+			return 1
  6.1754 -+		else:
  6.1755 -+			add_route(argv[2], argv[3], argv[4], argv[5], argv[6])
  6.1756 -+	elif argc == 4 and (argv[1] == 'delete'
  6.1757 -+			or argv[1] == 'del'): # DEL
  6.1758 -+		if (os.getuid() != 0):
  6.1759 -+			print 'Error: Permission denied.'
  6.1760 -+			return 1
  6.1761 -+		else:
  6.1762 -+			del_route(argv[2], argv[3])
  6.1763 -+			del_route(argv[3], argv[2])
  6.1764 -+	elif argc == 2 and argv[1] == 'show': # SHOW
  6.1765 -+		show_route()
  6.1766 -+	elif argc == 4 and argv[1] == 'stat': # STAT
  6.1767 -+		exit(stat_route(argv[2], argv[3]))
  6.1768 -+	else:
  6.1769 -+		usage()
  6.1770 -+		return 1
  6.1771 -+
  6.1772 -+
  6.1773 -+if __name__ == "__main__":
  6.1774 -+	argv = sys.argv  # コマンドライン引数を格納したリストの取得
  6.1775 -+	argc = len(argv) # 引数の個数
  6.1776 -+
  6.1777 -+	if os.path.exists(PROC_IDL_ROUTE):
  6.1778 -+		main(argc, argv)
  6.1779 -+	else:
  6.1780 -+		print 'The kernel is running which does not support ID/Locator.'
  6.1781 -+
  6.1782 -+
  6.1783 -diff -r 9f12d65beb55 model/cooja-loader-factory.cc
  6.1784 ---- a/model/cooja-loader-factory.cc	Thu Mar 29 13:55:58 2012 +0900
  6.1785 -+++ b/model/cooja-loader-factory.cc	Thu Mar 29 13:58:16 2012 +0900
  6.1786 -@@ -214,7 +214,7 @@
  6.1787 -       if (sharedModule == 0)
  6.1788 -         {
  6.1789 -           void *handle = dlopen (cached.cachedFilename.c_str (),
  6.1790 --                                 RTLD_LAZY | RTLD_DEEPBIND | RTLD_LOCAL);
  6.1791 -+                                 RTLD_LAZY | RTLD_DEEPBIND | RTLD_GLOBAL);
  6.1792 -           NS_ASSERT_MSG (handle != 0, "Could not open " << cached.cachedFilename << " " << dlerror ());
  6.1793 -           struct link_map *link_map;
  6.1794 -           dlinfo (handle, RTLD_DI_LINKMAP, &link_map);
  6.1795 -diff -r 9f12d65beb55 model/libc-ns3.h
  6.1796 ---- a/model/libc-ns3.h	Thu Mar 29 13:55:58 2012 +0900
  6.1797 -+++ b/model/libc-ns3.h	Thu Mar 29 13:58:16 2012 +0900
  6.1798 -@@ -103,6 +103,8 @@
  6.1799 - NATIVE_EXPLICIT (strrchr, char * (*) (char *, int))
  6.1800 - NATIVE (strcasecmp)
  6.1801 - NATIVE (strncasecmp)
  6.1802 -+NATIVE (strfry)
  6.1803 -+NATIVE_EXPLICIT (strstr, char * (*) (char *, __const char *))
  6.1804 - 
  6.1805 - DCE_WITH_ALIAS (strdup)
  6.1806 - DCE    (strndup)
  6.1807 -diff -r 9f12d65beb55 model/linux-socket-fd-factory.cc
  6.1808 ---- a/model/linux-socket-fd-factory.cc	Thu Mar 29 13:55:58 2012 +0900
  6.1809 -+++ b/model/linux-socket-fd-factory.cc	Thu Mar 29 13:58:16 2012 +0900
  6.1810 -@@ -461,6 +461,7 @@
  6.1811 - void
  6.1812 - LinuxSocketFdFactory::SetTask (std::string path, std::string value)
  6.1813 - {
  6.1814 -+  NS_LOG_FUNCTION (path << value);
  6.1815 -   std::vector<std::pair<std::string,struct SimSysFile *> > files = GetSysFileList ();
  6.1816 -   for (uint32_t i = 0; i < files.size (); i++)
  6.1817 -     {
  6.1818 -@@ -488,6 +489,27 @@
  6.1819 -     }
  6.1820 - }
  6.1821 - 
  6.1822 -+std::string 
  6.1823 -+LinuxSocketFdFactory::Get (std::string path)
  6.1824 -+{
  6.1825 -+  NS_LOG_FUNCTION (path);
  6.1826 -+  std::string ret;
  6.1827 -+  std::vector<std::pair<std::string,struct SimSysFile *> > files = GetSysFileList ();
  6.1828 -+  for (uint32_t i = 0; i < files.size (); i++)
  6.1829 -+    {
  6.1830 -+      if (files[i].first == path)
  6.1831 -+        {
  6.1832 -+          char buffer[512];
  6.1833 -+          memset (buffer, 0, sizeof(buffer));
  6.1834 -+          m_exported->sys_file_read (files[i].second, buffer, sizeof(buffer), 0);
  6.1835 -+          NS_LOG_FUNCTION ("sysctl read: " << buffer);
  6.1836 -+          ret = std::string (buffer);
  6.1837 -+          break;
  6.1838 -+        }
  6.1839 -+    }
  6.1840 -+  return ret;
  6.1841 -+}
  6.1842 -+
  6.1843 - void
  6.1844 - LinuxSocketFdFactory::InitializeStack (void)
  6.1845 - {
  6.1846 -@@ -525,8 +547,9 @@
  6.1847 -                                                       this));
  6.1848 -   Set (".net.ipv4.conf.all.forwarding", "1");
  6.1849 -   Set (".net.ipv4.conf.all.log_martians", "1");
  6.1850 --  //  Set (".net.ipv6.conf.all.forwarding", "1");
  6.1851 -+  Set (".net.ipv6.conf.all.forwarding", "1");
  6.1852 -   Set (".net.ipv6.conf.all.proxy_ndp", "1");
  6.1853 -+  Set (".net.idl.idlrt", "BEAFBEAF");
  6.1854 - 
  6.1855 -   while (!m_earlySysfs.empty ())
  6.1856 -     {
  6.1857 -diff -r 9f12d65beb55 model/linux-socket-fd-factory.h
  6.1858 ---- a/model/linux-socket-fd-factory.h	Thu Mar 29 13:55:58 2012 +0900
  6.1859 -+++ b/model/linux-socket-fd-factory.h	Thu Mar 29 13:58:16 2012 +0900
  6.1860 -@@ -43,7 +43,8 @@
  6.1861 -   virtual UnixFd *CreateSocket (int domain, int type, int protocol);
  6.1862 - 
  6.1863 -   void Set (std::string path, std::string value);
  6.1864 --
  6.1865 -+  std::string Get (std::string path);
  6.1866 -+  void ScheduleTask (EventImpl *event);
  6.1867 - 
  6.1868 - private:
  6.1869 -   friend class LinuxSocketFd;
  6.1870 -@@ -118,7 +119,6 @@
  6.1871 -   void SetTask (std::string path, std::string value);
  6.1872 -   static void TaskSwitch (enum Task::SwitchType type, void *context);
  6.1873 -   static void ScheduleTaskTrampoline (void *context);
  6.1874 --  void ScheduleTask (EventImpl *event);
  6.1875 -   void EventTrampoline (void (*fn)(void *context),
  6.1876 -                         void *context, void (*pre_fn)(void),
  6.1877 -                         Ptr<EventIdHolder> event);
  6.1878 -diff -r 9f12d65beb55 utils/setenv.zsh
  6.1879 ---- a/utils/setenv.zsh	Thu Mar 29 13:55:58 2012 +0900
  6.1880 -+++ b/utils/setenv.zsh	Thu Mar 29 13:58:16 2012 +0900
  6.1881 -@@ -6,8 +6,9 @@
  6.1882 - LD_LIBRARY_PATH="$BASE/ns-3-dce/build/lib:$BASE/build/lib:$BASE/build/bin:$BASE/ns-3-dce/build/bin:.:/usr/local/mpi/gcc/openmpi-1.4.3/lib/"
  6.1883 - PKG_CONFIG_PATH="$BASE/build/lib/pkgconfig"
  6.1884 - PATH="$BASE/build/bin:$BASE/build/sbin:/home/tazaki/hgworks/ns-3-dce-thehajime/build/bin:/home/tazaki/hgworks/ns-3-dce-thehajime/build/sbin:$PATH"
  6.1885 --PYTHONPATH=$BASE/ns-3-dev/build/debug/bindings/python:$BASE/ns-3-dev/src/visualizer:$BASE/pybindgen-0.15.0.795:$BASE/build/lib/python2.6/site-packages/
  6.1886 --export LD_LIBRARY_PATH PKG_CONFIG_PATH PATH PYTHONPATH
  6.1887 -+DCE_PATH="$BASE/ns-3-dce/build/bin_dce"
  6.1888 -+PYTHONPATH=$BASE/ns-3-dev/build/debug/bindings/python:$BASE/ns-3-dev/src/visualizer:$BASE/pybindgen-0.15.0.795:$BASE/build/lib/python2.6/site-packages/:$BASE/ns-3-dce
  6.1889 -+export LD_LIBRARY_PATH PKG_CONFIG_PATH PATH PYTHONPATH DCE_PATH
  6.1890 - cd $BASE/ns-3-dce
  6.1891 - 
  6.1892 - 
  6.1893 -diff -r 9f12d65beb55 wscript
  6.1894 ---- a/wscript	Thu Mar 29 13:55:58 2012 +0900
  6.1895 -+++ b/wscript	Thu Mar 29 13:58:16 2012 +0900
  6.1896 -@@ -35,6 +35,7 @@
  6.1897 -     conf.check(header_name='sys/stat.h', define_name='HAVE_SYS_STAT_H', mandatory=False)
  6.1898 -     conf.check(header_name='dirent.h', define_name='HAVE_DIRENT_H', mandatory=False)
  6.1899 - 
  6.1900 -+    conf.env.append_value('CXXFLAGS', '-I/usr/include/python2.6')
  6.1901 -     conf.env.append_value('LINKFLAGS', '-pthread')
  6.1902 -     conf.env.append_value('LINKFLAGS', '-Wl,--dynamic-linker=' +
  6.1903 -                              os.path.abspath ('../build/lib/ldso'))
  6.1904 -@@ -186,6 +187,8 @@
  6.1905 -                     ['unix-client', []],
  6.1906 -                     ['udp-echo-server', []],
  6.1907 -                     ['udp-echo-client', []],
  6.1908 -+                    ['idl-server', []],
  6.1909 -+                    ['idl-client', []],
  6.1910 -                     ]
  6.1911 -     for name,lib in dce_examples:
  6.1912 -         module.add_example(**dce_kw(target = 'bin/' + name, 
  6.1913 -@@ -289,6 +292,23 @@
  6.1914 -                        target='bin/dce-fga-crawdad',
  6.1915 -                        source=['example/dce-fga-crawdad.cc'])
  6.1916 - 
  6.1917 -+    module.add_example(**dce_kw(target = 'bin_dce/idecho-s', 
  6.1918 -+                                source = ['example/himalis/idecho-s.cc'],
  6.1919 -+                                cflags = ['-fPIC -I../ns-3-linux/net-next2.6/include']))
  6.1920 -+
  6.1921 -+    
  6.1922 -+    module.add_example(**dce_kw(target = 'bin_dce/idecho-c', 
  6.1923 -+                                source = ['example/himalis/idecho-c.cc'],
  6.1924 -+                                cflags = ['-fPIC -I../ns-3-linux/net-next2.6/include']))
  6.1925 -+
  6.1926 -+    module.add_example(needed = ['core',  'dce', 'csma', 'point-to-point','visualizer'],
  6.1927 -+                       target='bin/dce-himalis-simple',
  6.1928 -+                       source=['example/dce-himalis-simple.cc'])
  6.1929 -+
  6.1930 -+    module.add_example(needed = ['core',  'dce', 'csma', 'point-to-point','visualizer'],
  6.1931 -+                       target='bin/dce-himalis-handoff',
  6.1932 -+                       source=['example/dce-himalis-handoff.cc'])
  6.1933 -+
  6.1934 - def build(bld):
  6.1935 -     build_netlink(bld)
  6.1936 - 
  6.1937 -@@ -389,6 +409,7 @@
  6.1938 -         'helper/dce-application-helper.h',
  6.1939 -         'helper/quagga-helper.h',
  6.1940 -         'helper/mip6d-helper.h',
  6.1941 -+        'helper/himalis-helper.h',
  6.1942 -         ]
  6.1943 -     module_source = module_source + kernel_source
  6.1944 -     module_headers = module_headers + kernel_headers
  6.1945 -@@ -398,7 +419,7 @@
  6.1946 -                                   headers=module_headers,
  6.1947 -                                   use=uselib,
  6.1948 -                                   includes=kernel_includes,
  6.1949 --                                  lib=['dl'])
  6.1950 -+                                  lib=['dl', 'python2.6'])
  6.1951 - #                                  lib=['dl','efence'])
  6.1952 -     build_dce_tests(module, bld.env['KERNEL_STACK'])
  6.1953 -     build_dce_examples(module)
     7.1 --- a/series	Thu Jun 21 17:26:37 2012 +0900
     7.2 +++ b/series	Wed Jul 04 17:06:26 2012 +0900
     7.3 @@ -1,4 +1,6 @@
     7.4 +dce_test_improve.patch
     7.5  120410-dce-umip-support.patch
     7.6 +hana-dce.patch
     7.7  dns_unbound.patch
     7.8  dns_bind9.patch
     7.9  dce_macro_alt.patch
    7.10 @@ -9,4 +11,3 @@
    7.11  bgp-caida.patch
    7.12  modulize-quagga-mip6.patch
    7.13  dce-freebsd.patch
    7.14 -himalis.patch