home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume40 / ipp / part06 < prev    next >
Encoding:
Text File  |  1993-11-24  |  64.3 KB  |  2,048 lines

  1. Newsgroups: comp.sources.misc
  2. From: db15@ukc.ac.uk (Damiano Bolla)
  3. Subject: v40i164:  ipp - IPP Routing Architecture Toolkit, Part06/06
  4. Message-ID: <1993Nov24.193929.7858@sparky.sterling.com>
  5. X-Md4-Signature: 02ee24973c9cf01bd71feb3245730906
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Computing Lab, University of Kent at Canterbury, UK.
  8. Date: Wed, 24 Nov 1993 19:39:29 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: db15@ukc.ac.uk (Damiano Bolla)
  12. Posting-number: Volume 40, Issue 164
  13. Archive-name: ipp/part06
  14. Environment: INET
  15.  
  16. #! /bin/sh
  17. # This is a shell archive.  Remove anything before this line, then feed it
  18. # into a shell via "sh file" or similar.  To overwrite existing files,
  19. # type "sh file -c".
  20. # Contents:  IPP/Makefile IPP/config/ex1/1.1links
  21. #   IPP/config/ex1/1.20links IPP/config/ex1/1.30links
  22. #   IPP/config/ex1/1.3config IPP/config/ex1/1.4config
  23. #   IPP/config/ex1/1.5config IPP/config/ex1/10config
  24. #   IPP/config/ex1/11config IPP/config/ex1/15links
  25. #   IPP/config/ex1/16links IPP/config/ex1/2links
  26. #   IPP/config/ex1/5config IPP/config/ex1/doscript
  27. #   IPP/config/ex1/killrouter IPP/config/ex1/runhost
  28. #   IPP/config/ex1/script IPP/config/ex2/2links IPP/config/ex2/3links
  29. #   IPP/config/ex2/4links IPP/config/ex2/5links IPP/config/ex2/6config
  30. #   IPP/config/ex2/7config IPP/config/ex2/8config
  31. #   IPP/config/ex2/9config IPP/config/ex2/doscript
  32. #   IPP/config/ex2/killrouter IPP/config/ex2/run
  33. #   IPP/config/ex2/runhost IPP/config/ex2/script IPP/doall
  34. #   IPP/ethernet/EthIo.c IPP/ethernet/EthStats.c IPP/ethernet/Makefile
  35. #   IPP/host/Makefile IPP/host/README_config IPP/host/SendPacket.c
  36. #   IPP/include/commands.h IPP/include/tcp.h IPP/include/watchdog.h
  37. #   IPP/lib/Makefile IPP/lib/README IPP/lib/route/Makefile
  38. #   IPP/lib/route/RecordRoute.c IPP/lib/utils/BeDaemon.c
  39. #   IPP/lib/utils/ExistFd.c IPP/lib/utils/Makefile
  40. #   IPP/lib/utils/README IPP/lib/utils/SeenAlready.c
  41. #   IPP/lib/utils/TtyGets.c IPP/logd/Logtest.c IPP/logd/Makefile
  42. #   IPP/monitor/Makefile IPP/monitor/README IPP/monitor/Receive.c
  43. #   IPP/router/Makefile IPP/router/README IPP/router/RouterInit.c
  44. #   IPP/router/ShowStat.c IPP/search
  45. # Wrapped by kent@sparky on Wed Nov 24 11:51:09 1993
  46. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
  47. echo If this archive is complete, you will see the following message:
  48. echo '          "shar: End of archive 6 (of 6)."'
  49. if test -f 'IPP/Makefile' -a "${1}" != "-c" ; then 
  50.   echo shar: Will not clobber existing file \"'IPP/Makefile'\"
  51. else
  52.   echo shar: Extracting \"'IPP/Makefile'\" \(94 characters\)
  53.   sed "s/^X//" >'IPP/Makefile' <<'END_OF_FILE'
  54. Xall:
  55. X    ./doall make
  56. X
  57. Xclean:
  58. X    ./doall clean
  59. X
  60. Xtar: clean
  61. X    tar -cf - * | gzip -c >../tmp/proj.gz
  62. X
  63. END_OF_FILE
  64.   if test 94 -ne `wc -c <'IPP/Makefile'`; then
  65.     echo shar: \"'IPP/Makefile'\" unpacked with wrong size!
  66.   fi
  67.   # end of 'IPP/Makefile'
  68. fi
  69. if test -f 'IPP/config/ex1/1.1links' -a "${1}" != "-c" ; then 
  70.   echo shar: Will not clobber existing file \"'IPP/config/ex1/1.1links'\"
  71. else
  72.   echo shar: Extracting \"'IPP/config/ex1/1.1links'\" \(87 characters\)
  73.   sed "s/^X//" >'IPP/config/ex1/1.1links' <<'END_OF_FILE'
  74. XListeningPort 2 stork 44940 
  75. XListeningPort 3 stork 44941 
  76. XListeningPort 4 stork 44942 
  77. END_OF_FILE
  78.   if test 87 -ne `wc -c <'IPP/config/ex1/1.1links'`; then
  79.     echo shar: \"'IPP/config/ex1/1.1links'\" unpacked with wrong size!
  80.   fi
  81.   # end of 'IPP/config/ex1/1.1links'
  82. fi
  83. if test -f 'IPP/config/ex1/1.20links' -a "${1}" != "-c" ; then 
  84.   echo shar: Will not clobber existing file \"'IPP/config/ex1/1.20links'\"
  85. else
  86.   echo shar: Extracting \"'IPP/config/ex1/1.20links'\" \(58 characters\)
  87.   sed "s/^X//" >'IPP/config/ex1/1.20links' <<'END_OF_FILE'
  88. XListeningPort 3 stork 44952 
  89. XListeningPort 4 stork 44953 
  90. END_OF_FILE
  91.   if test 58 -ne `wc -c <'IPP/config/ex1/1.20links'`; then
  92.     echo shar: \"'IPP/config/ex1/1.20links'\" unpacked with wrong size!
  93.   fi
  94.   # end of 'IPP/config/ex1/1.20links'
  95. fi
  96. if test -f 'IPP/config/ex1/1.30links' -a "${1}" != "-c" ; then 
  97.   echo shar: Will not clobber existing file \"'IPP/config/ex1/1.30links'\"
  98. else
  99.   echo shar: Extracting \"'IPP/config/ex1/1.30links'\" \(87 characters\)
  100.   sed "s/^X//" >'IPP/config/ex1/1.30links' <<'END_OF_FILE'
  101. XListeningPort 2 stork 44945 
  102. XListeningPort 3 stork 44947 
  103. XListeningPort 4 stork 44948 
  104. END_OF_FILE
  105.   if test 87 -ne `wc -c <'IPP/config/ex1/1.30links'`; then
  106.     echo shar: \"'IPP/config/ex1/1.30links'\" unpacked with wrong size!
  107.   fi
  108.   # end of 'IPP/config/ex1/1.30links'
  109. fi
  110. if test -f 'IPP/config/ex1/1.3config' -a "${1}" != "-c" ; then 
  111.   echo shar: Will not clobber existing file \"'IPP/config/ex1/1.3config'\"
  112. else
  113.   echo shar: Extracting \"'IPP/config/ex1/1.3config'\" \(857 characters\)
  114.   sed "s/^X//" >'IPP/config/ex1/1.3config' <<'END_OF_FILE'
  115. X# The config file is quite strict in terms of layout, Comments MUST start with a #
  116. X# You cannot place comments anywhere you want...
  117. X# You are allowed blank lines...
  118. X# ONLY spaces are allowed as separators...
  119. X# The FIRST thing you have to write is the address of the router.,
  120. X
  121. XAddress 1.3
  122. X
  123. X# The n you have to write the interface specification.. the thing begins with
  124. X# a special keyword... otherwise it is too complicated.
  125. X# The other thing is tha all parameters fit in one line... in the following order
  126. X# Technology parameters
  127. X
  128. XInterface sock localhost 1027
  129. X
  130. X# The host needs to have a reference router. In theory is not needed since
  131. X# even a host should be able to do routing, but it makes things easy for now
  132. XRouter 1
  133. X
  134. X# then follows a list of hosts to talk to by means of a ping request
  135. XTalkTo 5
  136. XTalkTo 10
  137. XTalkTo 11
  138. X#TalkTo 1.3
  139. XTalkTo 1.4
  140. XTalkTo 1.5
  141. X
  142. X
  143. END_OF_FILE
  144.   if test 857 -ne `wc -c <'IPP/config/ex1/1.3config'`; then
  145.     echo shar: \"'IPP/config/ex1/1.3config'\" unpacked with wrong size!
  146.   fi
  147.   # end of 'IPP/config/ex1/1.3config'
  148. fi
  149. if test -f 'IPP/config/ex1/1.4config' -a "${1}" != "-c" ; then 
  150.   echo shar: Will not clobber existing file \"'IPP/config/ex1/1.4config'\"
  151. else
  152.   echo shar: Extracting \"'IPP/config/ex1/1.4config'\" \(857 characters\)
  153.   sed "s/^X//" >'IPP/config/ex1/1.4config' <<'END_OF_FILE'
  154. X# The config file is quite strict in terms of layout, Comments MUST start with a #
  155. X# You cannot place comments anywhere you want...
  156. X# You are allowed blank lines...
  157. X# ONLY spaces are allowed as separators...
  158. X# The FIRST thing you have to write is the address of the router.,
  159. X
  160. XAddress 1.4
  161. X
  162. X# The n you have to write the interface specification.. the thing begins with
  163. X# a special keyword... otherwise it is too complicated.
  164. X# The other thing is tha all parameters fit in one line... in the following order
  165. X# Technology parameters
  166. X
  167. XInterface sock localhost 1027
  168. X
  169. X# The host needs to have a reference router. In theory is not needed since
  170. X# even a host should be able to do routing, but it makes things easy for now
  171. XRouter 30
  172. X
  173. X# then follows a list of hosts to talk to by means of a ping request
  174. XTalkTo 5
  175. XTalkTo 10
  176. XTalkTo 11
  177. XTalkTo 1.3
  178. X#TalkTo 1.4
  179. XTalkTo 1.5
  180. X
  181. END_OF_FILE
  182.   if test 857 -ne `wc -c <'IPP/config/ex1/1.4config'`; then
  183.     echo shar: \"'IPP/config/ex1/1.4config'\" unpacked with wrong size!
  184.   fi
  185.   # end of 'IPP/config/ex1/1.4config'
  186. fi
  187. if test -f 'IPP/config/ex1/1.5config' -a "${1}" != "-c" ; then 
  188.   echo shar: Will not clobber existing file \"'IPP/config/ex1/1.5config'\"
  189. else
  190.   echo shar: Extracting \"'IPP/config/ex1/1.5config'\" \(858 characters\)
  191.   sed "s/^X//" >'IPP/config/ex1/1.5config' <<'END_OF_FILE'
  192. X# The config file is quite strict in terms of layout, Comments MUST start with a #
  193. X# You cannot place comments anywhere you want...
  194. X# You are allowed blank lines...
  195. X# ONLY spaces are allowed as separators...
  196. X# The FIRST thing you have to write is the address of the router.,
  197. X
  198. XAddress 1.5
  199. X
  200. X# The n you have to write the interface specification.. the thing begins with
  201. X# a special keyword... otherwise it is too complicated.
  202. X# The other thing is tha all parameters fit in one line... in the following order
  203. X# Technology parameters
  204. X
  205. XInterface sock localhost 1027
  206. X
  207. X# The host needs to have a reference router. In theory is not needed since
  208. X# even a host should be able to do routing, but it makes things easy for now
  209. XRouter 20
  210. X
  211. X# then follows a list of hosts to talk to by means of a ping request
  212. XTalkTo 5
  213. XTalkTo 10
  214. XTalkTo 11
  215. XTalkTo 1.3
  216. XTalkTo 1.4
  217. X#TalkTo 1.5
  218. X
  219. X
  220. END_OF_FILE
  221.   if test 858 -ne `wc -c <'IPP/config/ex1/1.5config'`; then
  222.     echo shar: \"'IPP/config/ex1/1.5config'\" unpacked with wrong size!
  223.   fi
  224.   # end of 'IPP/config/ex1/1.5config'
  225. fi
  226. if test -f 'IPP/config/ex1/10config' -a "${1}" != "-c" ; then 
  227.   echo shar: Will not clobber existing file \"'IPP/config/ex1/10config'\"
  228. else
  229.   echo shar: Extracting \"'IPP/config/ex1/10config'\" \(855 characters\)
  230.   sed "s/^X//" >'IPP/config/ex1/10config' <<'END_OF_FILE'
  231. X# The config file is quite strict in terms of layout, Comments MUST start with a #
  232. X# You cannot place comments anywhere you want...
  233. X# You are allowed blank lines...
  234. X# ONLY spaces are allowed as separators...
  235. X# The FIRST thing you have to write is the address of the router.,
  236. X
  237. XAddress 10
  238. X
  239. X# The n you have to write the interface specification.. the thing begins with
  240. X# a special keyword... otherwise it is too complicated.
  241. X# The other thing is tha all parameters fit in one line... in the following order
  242. X# Technology parameters
  243. X
  244. XInterface sock localhost 1027
  245. X
  246. X# The host needs to have a reference router. In theory is not needed since
  247. X# even a host should be able to do routing, but it makes things easy for now
  248. XRouter 2
  249. X
  250. X# then follows a list of hosts to talk to by means of a ping request
  251. XTalkTo 5
  252. X#TalkTo 10
  253. XTalkTo 11
  254. XTalkTo 1.3
  255. XTalkTo 1.4
  256. XTalkTo 1.5
  257. X
  258. END_OF_FILE
  259.   if test 855 -ne `wc -c <'IPP/config/ex1/10config'`; then
  260.     echo shar: \"'IPP/config/ex1/10config'\" unpacked with wrong size!
  261.   fi
  262.   # end of 'IPP/config/ex1/10config'
  263. fi
  264. if test -f 'IPP/config/ex1/11config' -a "${1}" != "-c" ; then 
  265.   echo shar: Will not clobber existing file \"'IPP/config/ex1/11config'\"
  266. else
  267.   echo shar: Extracting \"'IPP/config/ex1/11config'\" \(857 characters\)
  268.   sed "s/^X//" >'IPP/config/ex1/11config' <<'END_OF_FILE'
  269. X# The config file is quite strict in terms of layout, Comments MUST start with a #
  270. X# You cannot place comments anywhere you want...
  271. X# You are allowed blank lines...
  272. X# ONLY spaces are allowed as separators...
  273. X# The FIRST thing you have to write is the address of the router.,
  274. X
  275. XAddress 11
  276. X
  277. X# The n you have to write the interface specification.. the thing begins with
  278. X# a special keyword... otherwise it is too complicated.
  279. X# The other thing is tha all parameters fit in one line... in the following order
  280. X# Technology parameters
  281. X
  282. XInterface sock localhost 1027
  283. X
  284. X# The host needs to have a reference router. In theory is not needed since
  285. X# even a host should be able to do routing, but it makes things easy for now
  286. XRouter 16
  287. X
  288. X# then follows a list of hosts to talk to by means of a ping request
  289. XTalkTo 5
  290. XTalkTo 10
  291. X#TalkTo 11
  292. XTalkTo 1.3
  293. XTalkTo 1.4
  294. XTalkTo 1.5
  295. X
  296. X
  297. END_OF_FILE
  298.   if test 857 -ne `wc -c <'IPP/config/ex1/11config'`; then
  299.     echo shar: \"'IPP/config/ex1/11config'\" unpacked with wrong size!
  300.   fi
  301.   # end of 'IPP/config/ex1/11config'
  302. fi
  303. if test -f 'IPP/config/ex1/15links' -a "${1}" != "-c" ; then 
  304.   echo shar: Will not clobber existing file \"'IPP/config/ex1/15links'\"
  305. else
  306.   echo shar: Extracting \"'IPP/config/ex1/15links'\" \(87 characters\)
  307.   sed "s/^X//" >'IPP/config/ex1/15links' <<'END_OF_FILE'
  308. XListeningPort 2 stork 44930 
  309. XListeningPort 3 stork 44932 
  310. XListeningPort 4 stork 44933 
  311. END_OF_FILE
  312.   if test 87 -ne `wc -c <'IPP/config/ex1/15links'`; then
  313.     echo shar: \"'IPP/config/ex1/15links'\" unpacked with wrong size!
  314.   fi
  315.   # end of 'IPP/config/ex1/15links'
  316. fi
  317. if test -f 'IPP/config/ex1/16links' -a "${1}" != "-c" ; then 
  318.   echo shar: Will not clobber existing file \"'IPP/config/ex1/16links'\"
  319. else
  320.   echo shar: Extracting \"'IPP/config/ex1/16links'\" \(87 characters\)
  321.   sed "s/^X//" >'IPP/config/ex1/16links' <<'END_OF_FILE'
  322. XListeningPort 2 stork 44935 
  323. XListeningPort 3 stork 44937 
  324. XListeningPort 4 stork 44938 
  325. END_OF_FILE
  326.   if test 87 -ne `wc -c <'IPP/config/ex1/16links'`; then
  327.     echo shar: \"'IPP/config/ex1/16links'\" unpacked with wrong size!
  328.   fi
  329.   # end of 'IPP/config/ex1/16links'
  330. fi
  331. if test -f 'IPP/config/ex1/2links' -a "${1}" != "-c" ; then 
  332.   echo shar: Will not clobber existing file \"'IPP/config/ex1/2links'\"
  333. else
  334.   echo shar: Extracting \"'IPP/config/ex1/2links'\" \(116 characters\)
  335.   sed "s/^X//" >'IPP/config/ex1/2links' <<'END_OF_FILE'
  336. XListeningPort 1 stork 44925 
  337. XListeningPort 2 stork 44926 
  338. XListeningPort 3 stork 44927 
  339. XListeningPort 4 stork 44928 
  340. END_OF_FILE
  341.   if test 116 -ne `wc -c <'IPP/config/ex1/2links'`; then
  342.     echo shar: \"'IPP/config/ex1/2links'\" unpacked with wrong size!
  343.   fi
  344.   # end of 'IPP/config/ex1/2links'
  345. fi
  346. if test -f 'IPP/config/ex1/5config' -a "${1}" != "-c" ; then 
  347.   echo shar: Will not clobber existing file \"'IPP/config/ex1/5config'\"
  348. else
  349.   echo shar: Extracting \"'IPP/config/ex1/5config'\" \(855 characters\)
  350.   sed "s/^X//" >'IPP/config/ex1/5config' <<'END_OF_FILE'
  351. X# The config file is quite strict in terms of layout, Comments MUST start with a #
  352. X# You cannot place comments anywhere you want...
  353. X# You are allowed blank lines...
  354. X# ONLY spaces are allowed as separators...
  355. X# The FIRST thing you have to write is the address of the router.,
  356. X
  357. XAddress 5
  358. X
  359. X# The n you have to write the interface specification.. the thing begins with
  360. X# a special keyword... otherwise it is too complicated.
  361. X# The other thing is tha all parameters fit in one line... in the following order
  362. X# Technology parameters
  363. X
  364. XInterface sock localhost 1027
  365. X
  366. X# The host needs to have a reference router. In theory is not needed since
  367. X# even a host should be able to do routing, but it makes things easy for now
  368. XRouter 15
  369. X
  370. X# then follows a list of hosts to talk to by means of a ping request
  371. X#TalkTo 5
  372. XTalkTo 10
  373. XTalkTo 11
  374. XTalkTo 1.3
  375. XTalkTo 1.4
  376. XTalkTo 1.5
  377. X
  378. END_OF_FILE
  379.   if test 855 -ne `wc -c <'IPP/config/ex1/5config'`; then
  380.     echo shar: \"'IPP/config/ex1/5config'\" unpacked with wrong size!
  381.   fi
  382.   # end of 'IPP/config/ex1/5config'
  383. fi
  384. if test -f 'IPP/config/ex1/doscript' -a "${1}" != "-c" ; then 
  385.   echo shar: Will not clobber existing file \"'IPP/config/ex1/doscript'\"
  386. else
  387.   echo shar: Extracting \"'IPP/config/ex1/doscript'\" \(552 characters\)
  388.   sed "s/^X//" >'IPP/config/ex1/doscript' <<'END_OF_FILE'
  389. X# This function extract link information and then prepare them to be used
  390. X# by sed to form the right config file for the router.
  391. X# It wants three parameters
  392. X# NOTE: It ONLY appends informations at the end of script !
  393. X# 1) The router from where to extract the informations
  394. X# 2) The link to extract the informations
  395. X# 3) The interface the link has to be wired on
  396. X
  397. Xcat ${1}links | while read word ifn host port
  398. X   do
  399. X   if [ "$ifn" = "$2" ]; then
  400. X      echo "s/^Interface ${3} sock no .*\$/Interface ${3} sock no localhost ${port}/" >>script
  401. X   fi 
  402. Xdone
  403. X
  404. END_OF_FILE
  405.   if test 552 -ne `wc -c <'IPP/config/ex1/doscript'`; then
  406.     echo shar: \"'IPP/config/ex1/doscript'\" unpacked with wrong size!
  407.   fi
  408.   chmod +x 'IPP/config/ex1/doscript'
  409.   # end of 'IPP/config/ex1/doscript'
  410. fi
  411. if test -f 'IPP/config/ex1/killrouter' -a "${1}" != "-c" ; then 
  412.   echo shar: Will not clobber existing file \"'IPP/config/ex1/killrouter'\"
  413. else
  414.   echo shar: Extracting \"'IPP/config/ex1/killrouter'\" \(142 characters\)
  415.   sed "s/^X//" >'IPP/config/ex1/killrouter' <<'END_OF_FILE'
  416. X#ps -aux | grep router | while read user uid altro
  417. Xps -ef | grep router | while read user uid altro
  418. Xdo
  419. X   echo killing $uid
  420. X   kill $uid
  421. Xdone
  422. END_OF_FILE
  423.   if test 142 -ne `wc -c <'IPP/config/ex1/killrouter'`; then
  424.     echo shar: \"'IPP/config/ex1/killrouter'\" unpacked with wrong size!
  425.   fi
  426.   chmod +x 'IPP/config/ex1/killrouter'
  427.   # end of 'IPP/config/ex1/killrouter'
  428. fi
  429. if test -f 'IPP/config/ex1/runhost' -a "${1}" != "-c" ; then 
  430.   echo shar: Will not clobber existing file \"'IPP/config/ex1/runhost'\"
  431. else
  432.   echo shar: Extracting \"'IPP/config/ex1/runhost'\" \(468 characters\)
  433.   sed "s/^X//" >'IPP/config/ex1/runhost' <<'END_OF_FILE'
  434. X#!/bin/sh
  435. X# This starts a host it requires three parameters
  436. X# 1) The router to be connected to , just the IPP number, ex: 1.1
  437. X# 2) The interface to use of thet router, ex: 2
  438. X# 3) The address of this host , just the IPP nbumber, ex: 1.3
  439. X
  440. Xscript=/tmp/script$$
  441. X
  442. Xcat ${1}links | while read word ifn host port
  443. Xdo
  444. X   if [ "$ifn" = "$2" ]; then
  445. X    echo "s/^Interface sock .*\$/Interface sock localhost ${port}/" >$script
  446. X   fi
  447. Xdone
  448. Xsed -f $script <${3}config | host
  449. Xrm $script
  450. END_OF_FILE
  451.   if test 468 -ne `wc -c <'IPP/config/ex1/runhost'`; then
  452.     echo shar: \"'IPP/config/ex1/runhost'\" unpacked with wrong size!
  453.   fi
  454.   chmod +x 'IPP/config/ex1/runhost'
  455.   # end of 'IPP/config/ex1/runhost'
  456. fi
  457. if test -f 'IPP/config/ex1/script' -a "${1}" != "-c" ; then 
  458.   echo shar: Will not clobber existing file \"'IPP/config/ex1/script'\"
  459. else
  460.   echo shar: Extracting \"'IPP/config/ex1/script'\" \(128 characters\)
  461.   sed "s/^X//" >'IPP/config/ex1/script' <<'END_OF_FILE'
  462. Xs/^Interface 2 sock no .*$/Interface 2 sock no localhost 44945/
  463. Xs/^Interface 1 sock no .*$/Interface 1 sock no localhost 44937/
  464. END_OF_FILE
  465.   if test 128 -ne `wc -c <'IPP/config/ex1/script'`; then
  466.     echo shar: \"'IPP/config/ex1/script'\" unpacked with wrong size!
  467.   fi
  468.   # end of 'IPP/config/ex1/script'
  469. fi
  470. if test -f 'IPP/config/ex2/2links' -a "${1}" != "-c" ; then 
  471.   echo shar: Will not clobber existing file \"'IPP/config/ex2/2links'\"
  472. else
  473.   echo shar: Extracting \"'IPP/config/ex2/2links'\" \(145 characters\)
  474.   sed "s/^X//" >'IPP/config/ex2/2links' <<'END_OF_FILE'
  475. XListeningPort 1 stork 44975 
  476. XListeningPort 2 stork 44976 
  477. XListeningPort 3 stork 44977 
  478. XListeningPort 4 stork 44978 
  479. XListeningPort 5 stork 44979 
  480. END_OF_FILE
  481.   if test 145 -ne `wc -c <'IPP/config/ex2/2links'`; then
  482.     echo shar: \"'IPP/config/ex2/2links'\" unpacked with wrong size!
  483.   fi
  484.   # end of 'IPP/config/ex2/2links'
  485. fi
  486. if test -f 'IPP/config/ex2/3links' -a "${1}" != "-c" ; then 
  487.   echo shar: Will not clobber existing file \"'IPP/config/ex2/3links'\"
  488. else
  489.   echo shar: Extracting \"'IPP/config/ex2/3links'\" \(116 characters\)
  490.   sed "s/^X//" >'IPP/config/ex2/3links' <<'END_OF_FILE'
  491. XListeningPort 1 stork 44980 
  492. XListeningPort 2 stork 44981 
  493. XListeningPort 3 stork 44982 
  494. XListeningPort 5 stork 44984 
  495. END_OF_FILE
  496.   if test 116 -ne `wc -c <'IPP/config/ex2/3links'`; then
  497.     echo shar: \"'IPP/config/ex2/3links'\" unpacked with wrong size!
  498.   fi
  499.   # end of 'IPP/config/ex2/3links'
  500. fi
  501. if test -f 'IPP/config/ex2/4links' -a "${1}" != "-c" ; then 
  502.   echo shar: Will not clobber existing file \"'IPP/config/ex2/4links'\"
  503. else
  504.   echo shar: Extracting \"'IPP/config/ex2/4links'\" \(87 characters\)
  505.   sed "s/^X//" >'IPP/config/ex2/4links' <<'END_OF_FILE'
  506. XListeningPort 1 stork 44986 
  507. XListeningPort 2 stork 44987 
  508. XListeningPort 5 stork 44991 
  509. END_OF_FILE
  510.   if test 87 -ne `wc -c <'IPP/config/ex2/4links'`; then
  511.     echo shar: \"'IPP/config/ex2/4links'\" unpacked with wrong size!
  512.   fi
  513.   # end of 'IPP/config/ex2/4links'
  514. fi
  515. if test -f 'IPP/config/ex2/5links' -a "${1}" != "-c" ; then 
  516.   echo shar: Will not clobber existing file \"'IPP/config/ex2/5links'\"
  517. else
  518.   echo shar: Extracting \"'IPP/config/ex2/5links'\" \(58 characters\)
  519.   sed "s/^X//" >'IPP/config/ex2/5links' <<'END_OF_FILE'
  520. XListeningPort 1 stork 44995 
  521. XListeningPort 5 stork 45001 
  522. END_OF_FILE
  523.   if test 58 -ne `wc -c <'IPP/config/ex2/5links'`; then
  524.     echo shar: \"'IPP/config/ex2/5links'\" unpacked with wrong size!
  525.   fi
  526.   # end of 'IPP/config/ex2/5links'
  527. fi
  528. if test -f 'IPP/config/ex2/6config' -a "${1}" != "-c" ; then 
  529.   echo shar: Will not clobber existing file \"'IPP/config/ex2/6config'\"
  530. else
  531.   echo shar: Extracting \"'IPP/config/ex2/6config'\" \(819 characters\)
  532.   sed "s/^X//" >'IPP/config/ex2/6config' <<'END_OF_FILE'
  533. X# The config file is quite strict in terms of layout, Comments MUST start with a #
  534. X# You cannot place comments anywhere you want...
  535. X# You are allowed blank lines...
  536. X# ONLY spaces are allowed as separators...
  537. X# The FIRST thing you have to write is the address of the router.,
  538. X
  539. XAddress 6
  540. X
  541. X# The n you have to write the interface specification.. the thing begins with
  542. X# a special keyword... otherwise it is too complicated.
  543. X# The other thing is tha all parameters fit in one line... in the following order
  544. X# Technology parameters
  545. X
  546. XInterface sock localhost 1631
  547. X
  548. X# The host needs to have a reference router. In theory is not needed since
  549. X# even a host should be able to do routing, but it makes things easy for now
  550. XRouter 2
  551. X
  552. X# then follows a list of hosts to talk to by means of a ping request
  553. XTalkTo 7
  554. XTalkTo 8
  555. XTalkTo 9
  556. X
  557. X
  558. END_OF_FILE
  559.   if test 819 -ne `wc -c <'IPP/config/ex2/6config'`; then
  560.     echo shar: \"'IPP/config/ex2/6config'\" unpacked with wrong size!
  561.   fi
  562.   # end of 'IPP/config/ex2/6config'
  563. fi
  564. if test -f 'IPP/config/ex2/7config' -a "${1}" != "-c" ; then 
  565.   echo shar: Will not clobber existing file \"'IPP/config/ex2/7config'\"
  566. else
  567.   echo shar: Extracting \"'IPP/config/ex2/7config'\" \(819 characters\)
  568.   sed "s/^X//" >'IPP/config/ex2/7config' <<'END_OF_FILE'
  569. X# The config file is quite strict in terms of layout, Comments MUST start with a #
  570. X# You cannot place comments anywhere you want...
  571. X# You are allowed blank lines...
  572. X# ONLY spaces are allowed as separators...
  573. X# The FIRST thing you have to write is the address of the router.,
  574. X
  575. XAddress 7
  576. X
  577. X# The n you have to write the interface specification.. the thing begins with
  578. X# a special keyword... otherwise it is too complicated.
  579. X# The other thing is tha all parameters fit in one line... in the following order
  580. X# Technology parameters
  581. X
  582. XInterface sock localhost 1027
  583. X
  584. X# The host needs to have a reference router. In theory is not needed since
  585. X# even a host should be able to do routing, but it makes things easy for now
  586. XRouter 3
  587. X
  588. X# then follows a list of hosts to talk to by means of a ping request
  589. XTalkTo 6
  590. XTalkTo 8
  591. XTalkTo 9
  592. X
  593. X
  594. END_OF_FILE
  595.   if test 819 -ne `wc -c <'IPP/config/ex2/7config'`; then
  596.     echo shar: \"'IPP/config/ex2/7config'\" unpacked with wrong size!
  597.   fi
  598.   # end of 'IPP/config/ex2/7config'
  599. fi
  600. if test -f 'IPP/config/ex2/8config' -a "${1}" != "-c" ; then 
  601.   echo shar: Will not clobber existing file \"'IPP/config/ex2/8config'\"
  602. else
  603.   echo shar: Extracting \"'IPP/config/ex2/8config'\" \(845 characters\)
  604.   sed "s/^X//" >'IPP/config/ex2/8config' <<'END_OF_FILE'
  605. X# The config file is quite strict in terms of layout, Comments MUST start with a #
  606. X# You cannot place comments anywhere you want...
  607. X# You are allowed blank lines...
  608. X# ONLY spaces are allowed as separators...
  609. X# The FIRST thing you have to write is the address of the router.,
  610. X
  611. XAddress 8
  612. X
  613. X# The n you have to write the interface specification.. the thing begins with
  614. X# a special keyword... otherwise it is too complicated.
  615. X# The other thing is tha all parameters fit in one line... in the following order
  616. X# Technology parameters
  617. X
  618. XInterface sock localhost 1027
  619. X
  620. X# The host needs to have a reference router. In theory is not needed since
  621. X# even a host should be able to do routing, but it makes things easy for now
  622. XRouter 4
  623. X
  624. X# then follows a list of hosts to talk to by means of a ping request
  625. XTalkTo 6
  626. XTalkTo 7
  627. XTalkTo 9
  628. X#TalkTo 2.12
  629. X#TalkTo 2.13
  630. X
  631. X
  632. END_OF_FILE
  633.   if test 845 -ne `wc -c <'IPP/config/ex2/8config'`; then
  634.     echo shar: \"'IPP/config/ex2/8config'\" unpacked with wrong size!
  635.   fi
  636.   # end of 'IPP/config/ex2/8config'
  637. fi
  638. if test -f 'IPP/config/ex2/9config' -a "${1}" != "-c" ; then 
  639.   echo shar: Will not clobber existing file \"'IPP/config/ex2/9config'\"
  640. else
  641.   echo shar: Extracting \"'IPP/config/ex2/9config'\" \(845 characters\)
  642.   sed "s/^X//" >'IPP/config/ex2/9config' <<'END_OF_FILE'
  643. X# The config file is quite strict in terms of layout, Comments MUST start with a #
  644. X# You cannot place comments anywhere you want...
  645. X# You are allowed blank lines...
  646. X# ONLY spaces are allowed as separators...
  647. X# The FIRST thing you have to write is the address of the router.,
  648. X
  649. XAddress 9
  650. X
  651. X# The n you have to write the interface specification.. the thing begins with
  652. X# a special keyword... otherwise it is too complicated.
  653. X# The other thing is tha all parameters fit in one line... in the following order
  654. X# Technology parameters
  655. X
  656. XInterface sock localhost 1027
  657. X
  658. X# The host needs to have a reference router. In theory is not needed since
  659. X# even a host should be able to do routing, but it makes things easy for now
  660. XRouter 5
  661. X
  662. X# then follows a list of hosts to talk to by means of a ping request
  663. XTalkTo 6
  664. XTalkTo 7
  665. XTalkTo 8
  666. X#TalkTo 2.12
  667. X#TalkTo 2.13
  668. X
  669. X
  670. END_OF_FILE
  671.   if test 845 -ne `wc -c <'IPP/config/ex2/9config'`; then
  672.     echo shar: \"'IPP/config/ex2/9config'\" unpacked with wrong size!
  673.   fi
  674.   # end of 'IPP/config/ex2/9config'
  675. fi
  676. if test -f 'IPP/config/ex2/doscript' -a "${1}" != "-c" ; then 
  677.   echo shar: Will not clobber existing file \"'IPP/config/ex2/doscript'\"
  678. else
  679.   echo shar: Extracting \"'IPP/config/ex2/doscript'\" \(552 characters\)
  680.   sed "s/^X//" >'IPP/config/ex2/doscript' <<'END_OF_FILE'
  681. X# This function extract link information and then prepare them to be used
  682. X# by sed to form the right config file for the router.
  683. X# It wants three parameters
  684. X# NOTE: It ONLY appends informations at the end of script !
  685. X# 1) The router from where to extract the informations
  686. X# 2) The link to extract the informations
  687. X# 3) The interface the link has to be wired on
  688. X
  689. Xcat ${1}links | while read word ifn host port
  690. X   do
  691. X   if [ "$ifn" = "$2" ]; then
  692. X      echo "s/^Interface ${3} sock no .*\$/Interface ${3} sock no localhost ${port}/" >>script
  693. X   fi 
  694. Xdone
  695. X
  696. END_OF_FILE
  697.   if test 552 -ne `wc -c <'IPP/config/ex2/doscript'`; then
  698.     echo shar: \"'IPP/config/ex2/doscript'\" unpacked with wrong size!
  699.   fi
  700.   chmod +x 'IPP/config/ex2/doscript'
  701.   # end of 'IPP/config/ex2/doscript'
  702. fi
  703. if test -f 'IPP/config/ex2/killrouter' -a "${1}" != "-c" ; then 
  704.   echo shar: Will not clobber existing file \"'IPP/config/ex2/killrouter'\"
  705. else
  706.   echo shar: Extracting \"'IPP/config/ex2/killrouter'\" \(91 characters\)
  707.   sed "s/^X//" >'IPP/config/ex2/killrouter' <<'END_OF_FILE'
  708. Xps -ef | grep router | while read user uid altro
  709. Xdo
  710. X   echo killing $uid
  711. X   kill $uid
  712. Xdone
  713. END_OF_FILE
  714.   if test 91 -ne `wc -c <'IPP/config/ex2/killrouter'`; then
  715.     echo shar: \"'IPP/config/ex2/killrouter'\" unpacked with wrong size!
  716.   fi
  717.   chmod +x 'IPP/config/ex2/killrouter'
  718.   # end of 'IPP/config/ex2/killrouter'
  719. fi
  720. if test -f 'IPP/config/ex2/run' -a "${1}" != "-c" ; then 
  721.   echo shar: Will not clobber existing file \"'IPP/config/ex2/run'\"
  722. else
  723.   echo shar: Extracting \"'IPP/config/ex2/run'\" \(1328 characters\)
  724.   sed "s/^X//" >'IPP/config/ex2/run' <<'END_OF_FILE'
  725. X#!/bin/sh
  726. X
  727. XPATH=.:$PATH; export PATH
  728. X
  729. X# ------------------------------------------------------------------------
  730. Xrouter <2config >2links &
  731. Xecho "Router 2 started"
  732. Xsleep 2
  733. X
  734. X# ---------------------------------------------------------------------------
  735. X>script
  736. Xdoscript 2 2 4
  737. Xsed -f script <3config | router >3links &
  738. Xecho "Router 3 started"
  739. Xsleep 2
  740. X
  741. X# ---------------------------------------------------------------------------
  742. X>script
  743. Xdoscript 2 3 3
  744. Xdoscript 3 2 4
  745. Xsed -f script <4config | router >4links &
  746. Xecho "Router 4 started"
  747. Xsleep 2
  748. X
  749. X
  750. X# ---------------------------------------------------------------------------
  751. X>script 
  752. Xdoscript 2 4 2
  753. Xdoscript 3 3 3
  754. Xdoscript 4 2 4
  755. Xsed -f script <5config | router >5links &
  756. Xecho "Router 5 started"
  757. Xsleep 2
  758. X
  759. X# ---------------------------------------------------------------------------
  760. X# The runhost requires three parameters
  761. X# 1) The router to be connected to , just the IPP number, ex: 1.1
  762. X# 2) The interface to use of thet router, ex: 2
  763. X# 3) The address of this host , just the IPP nbumber, ex: 1.3
  764. X
  765. Xxterm -geometry 26x55+1378+0 -e runhost 2 1 6 &
  766. Xecho "Host 6 started"
  767. X
  768. Xxterm -geometry 27x55+1833+0 -e runhost 3 1 7 &
  769. Xecho "Host 7 started"
  770. X
  771. Xxterm -geometry 26x55+1605+0 -e runhost 4 1 8 &
  772. Xecho "Host 8 started"
  773. X
  774. Xxterm -geometry 28x55+2066+0 -e runhost 5 1 9  &
  775. Xecho "Host 9 started"
  776. X
  777. X
  778. END_OF_FILE
  779.   if test 1328 -ne `wc -c <'IPP/config/ex2/run'`; then
  780.     echo shar: \"'IPP/config/ex2/run'\" unpacked with wrong size!
  781.   fi
  782.   chmod +x 'IPP/config/ex2/run'
  783.   # end of 'IPP/config/ex2/run'
  784. fi
  785. if test -f 'IPP/config/ex2/runhost' -a "${1}" != "-c" ; then 
  786.   echo shar: Will not clobber existing file \"'IPP/config/ex2/runhost'\"
  787. else
  788.   echo shar: Extracting \"'IPP/config/ex2/runhost'\" \(468 characters\)
  789.   sed "s/^X//" >'IPP/config/ex2/runhost' <<'END_OF_FILE'
  790. X#!/bin/sh
  791. X# This starts a host it requires three parameters
  792. X# 1) The router to be connected to , just the IPP number, ex: 1.1
  793. X# 2) The interface to use of thet router, ex: 2
  794. X# 3) The address of this host , just the IPP nbumber, ex: 1.3
  795. X
  796. Xscript=/tmp/script$$
  797. X
  798. Xcat ${1}links | while read word ifn host port
  799. Xdo
  800. X   if [ "$ifn" = "$2" ]; then
  801. X    echo "s/^Interface sock .*\$/Interface sock localhost ${port}/" >$script
  802. X   fi
  803. Xdone
  804. Xsed -f $script <${3}config | host
  805. Xrm $script
  806. END_OF_FILE
  807.   if test 468 -ne `wc -c <'IPP/config/ex2/runhost'`; then
  808.     echo shar: \"'IPP/config/ex2/runhost'\" unpacked with wrong size!
  809.   fi
  810.   chmod +x 'IPP/config/ex2/runhost'
  811.   # end of 'IPP/config/ex2/runhost'
  812. fi
  813. if test -f 'IPP/config/ex2/script' -a "${1}" != "-c" ; then 
  814.   echo shar: Will not clobber existing file \"'IPP/config/ex2/script'\"
  815. else
  816.   echo shar: Extracting \"'IPP/config/ex2/script'\" \(192 characters\)
  817.   sed "s/^X//" >'IPP/config/ex2/script' <<'END_OF_FILE'
  818. Xs/^Interface 2 sock no .*$/Interface 2 sock no localhost 44978/
  819. Xs/^Interface 3 sock no .*$/Interface 3 sock no localhost 44982/
  820. Xs/^Interface 4 sock no .*$/Interface 4 sock no localhost 44987/
  821. END_OF_FILE
  822.   if test 192 -ne `wc -c <'IPP/config/ex2/script'`; then
  823.     echo shar: \"'IPP/config/ex2/script'\" unpacked with wrong size!
  824.   fi
  825.   # end of 'IPP/config/ex2/script'
  826. fi
  827. if test -f 'IPP/doall' -a "${1}" != "-c" ; then 
  828.   echo shar: Will not clobber existing file \"'IPP/doall'\"
  829. else
  830.   echo shar: Extracting \"'IPP/doall'\" \(425 characters\)
  831.   sed "s/^X//" >'IPP/doall' <<'END_OF_FILE'
  832. X# Very simple script to do recursive Makefile.
  833. X# I should do it properly one day..
  834. X
  835. Xcurrent=`pwd`
  836. Xsubdirs="lib/utils lib/route lib ethernet host logd router monitor"
  837. X
  838. Xif [ "$1" = "make" ]; then
  839. X   for d in $subdirs
  840. X   do
  841. X      cd $current/$d
  842. X      make clean
  843. X      sync
  844. X      make
  845. X      sync
  846. X   done
  847. X   fi
  848. X
  849. Xif [ "$1" = "clean" ]; then
  850. X   for d in $subdirs
  851. X   do
  852. X      cd $current/$d
  853. X      make clean
  854. X      sync
  855. X   done
  856. X   fi
  857. END_OF_FILE
  858.   if test 425 -ne `wc -c <'IPP/doall'`; then
  859.     echo shar: \"'IPP/doall'\" unpacked with wrong size!
  860.   fi
  861.   chmod +x 'IPP/doall'
  862.   # end of 'IPP/doall'
  863. fi
  864. if test -f 'IPP/ethernet/EthIo.c' -a "${1}" != "-c" ; then 
  865.   echo shar: Will not clobber existing file \"'IPP/ethernet/EthIo.c'\"
  866. else
  867.   echo shar: Extracting \"'IPP/ethernet/EthIo.c'\" \(1091 characters\)
  868.   sed "s/^X//" >'IPP/ethernet/EthIo.c' <<'END_OF_FILE'
  869. X/* -----------------------------------------------------------------------------
  870. X * Ident: EthIo.c
  871. X * Author: Damiano Bolla 1993
  872. X * All this project is covered by the GNU Copyright.
  873. X */
  874. X
  875. X
  876. X#include <stdio.h>
  877. X#include <string.h>
  878. X#include <sys/types.h>
  879. X#include <sys/socket.h>
  880. X#include <sys/time.h>
  881. X#include <netinet/in.h>
  882. X#include "defs.h"
  883. X#include "debug.h"
  884. X#include "ethernet.h"
  885. X#include "func_defs.h"
  886. X
  887. Xextern struct Debug dbg;
  888. X
  889. X/* What this does is to read from the selected iofd and do teh appropriate thing
  890. X */
  891. X
  892. Xint EthIo ( struct Ethernet *eth )
  893. X   {
  894. X   int c;
  895. X   int  Newsocket;
  896. X   char Msg[CONF_LLEN+2];
  897. X
  898. X   /* Let's see if there is a new incoming connection..                */
  899. X   if ( FD_ISSET (eth->ListenFd, ð->readfds))
  900. X      if ( Accept ( eth->ListenFd, &Newsocket, Msg, CONF_LLEN ) == DONE )
  901. X         EthParseCall ( eth, Newsocket, Msg );
  902. X
  903. X   /* What I have to do is to go trough all the available fd and check them    */
  904. X   for (c=0; c<ADDR_NUM; c++)
  905. X      {
  906. X      if ( eth->IoFd[c] && (FD_ISSET (eth->IoFd[c], ð->readfds)) )
  907. X     ProcessPacket ( eth, c);
  908. X      }
  909. X
  910. X   return (DONE);
  911. X   }
  912. X
  913. END_OF_FILE
  914.   if test 1091 -ne `wc -c <'IPP/ethernet/EthIo.c'`; then
  915.     echo shar: \"'IPP/ethernet/EthIo.c'\" unpacked with wrong size!
  916.   fi
  917.   # end of 'IPP/ethernet/EthIo.c'
  918. fi
  919. if test -f 'IPP/ethernet/EthStats.c' -a "${1}" != "-c" ; then 
  920.   echo shar: Will not clobber existing file \"'IPP/ethernet/EthStats.c'\"
  921. else
  922.   echo shar: Extracting \"'IPP/ethernet/EthStats.c'\" \(1001 characters\)
  923.   sed "s/^X//" >'IPP/ethernet/EthStats.c' <<'END_OF_FILE'
  924. X/* -----------------------------------------------------------------------------
  925. X * Ident: EthStats.h
  926. X * Author: Damiano Bolla 1993
  927. X * All this project is covered by the GNU Copyright.
  928. X */
  929. X
  930. X#include <stdio.h>
  931. X#include <unistd.h>
  932. X#include <string.h>
  933. X#include <sys/types.h>
  934. X#include <sys/socket.h>
  935. X#include <sys/time.h>
  936. X#include <netinet/in.h>
  937. X#include "defs.h"
  938. X#include "debug.h"
  939. X#include "ethernet.h"
  940. X#include "func_defs.h"
  941. X
  942. Xextern struct Debug dbg;
  943. X
  944. X/* This bit sends statistics out to who requested them.
  945. X * Should be fine...    
  946. X */
  947. X
  948. Xint EthStats ( struct Ethernet *eth,  int fd )
  949. X   {
  950. X   int c;
  951. X   char buff[IPP_DATA+2];
  952. X
  953. X   for ( c=0; c<ADDR_NUM; c++ )
  954. X      if ( eth->IoFd[c] ) 
  955. X     {
  956. X     sprintf (buff, "Address %d is bound to channel %d \n",c,eth->IoFd[c]);
  957. X     write (fd, buff, strlen(buff));
  958. X     }
  959. X
  960. X   sprintf (buff, "Idle time %d \n",eth->Idle);
  961. X   write (fd, buff, strlen(buff));
  962. X
  963. X   sprintf (buff, "Debug Level %d \n",dbg.current_level);
  964. X   write (fd, buff, strlen(buff));
  965. X
  966. X   return (DONE);
  967. X   }
  968. X
  969. X
  970. END_OF_FILE
  971.   if test 1001 -ne `wc -c <'IPP/ethernet/EthStats.c'`; then
  972.     echo shar: \"'IPP/ethernet/EthStats.c'\" unpacked with wrong size!
  973.   fi
  974.   # end of 'IPP/ethernet/EthStats.c'
  975. fi
  976. if test -f 'IPP/ethernet/Makefile' -a "${1}" != "-c" ; then 
  977.   echo shar: Will not clobber existing file \"'IPP/ethernet/Makefile'\"
  978. else
  979.   echo shar: Extracting \"'IPP/ethernet/Makefile'\" \(303 characters\)
  980.   sed "s/^X//" >'IPP/ethernet/Makefile' <<'END_OF_FILE'
  981. XINC=../include
  982. XCC=gcc
  983. XLIBIPP=../lib/libipp.a
  984. XSOCKLIB=-lsocket -lnsl
  985. XCFLAGS=-I$(INC) -g 
  986. X
  987. XOBJ=Tnet.o EthStats.o EthIo.o EthParseCall.o NewAddress.o ProcessPacket.o
  988. X
  989. XTnet: $(LIBIPP) $(OBJ)
  990. X    gcc $(OBJ) $(LIBIPP) $(SOCKLIB) -o Tnet
  991. X
  992. Xclean:
  993. X    rm -f *.o Tnet core errlist
  994. X
  995. X.c.o:
  996. X    $(CC) $(CFLAGS) -c -o $*.o $<
  997. END_OF_FILE
  998.   if test 303 -ne `wc -c <'IPP/ethernet/Makefile'`; then
  999.     echo shar: \"'IPP/ethernet/Makefile'\" unpacked with wrong size!
  1000.   fi
  1001.   # end of 'IPP/ethernet/Makefile'
  1002. fi
  1003. if test -f 'IPP/host/Makefile' -a "${1}" != "-c" ; then 
  1004.   echo shar: Will not clobber existing file \"'IPP/host/Makefile'\"
  1005. else
  1006.   echo shar: Extracting \"'IPP/host/Makefile'\" \(262 characters\)
  1007.   sed "s/^X//" >'IPP/host/Makefile' <<'END_OF_FILE'
  1008. XINC=../include
  1009. XCC=gcc
  1010. XLIBIPP=../lib/libipp.a 
  1011. XCFLAGS=-I$(INC) -g 
  1012. X
  1013. XOBJ=host.o HostInit.o ReceivePacket.o SendPacket.o
  1014. X
  1015. Xrouter:$(OBJ) $(LIBIPP)
  1016. X    $(CC) $(OBJ) $(LIBIPP) $(SOCKLIB) -o host
  1017. X
  1018. Xclean:
  1019. X    rm -f *.o host core errlist
  1020. X
  1021. X.c.o:
  1022. X    $(CC) $(CFLAGS) -c -o $*.o $<
  1023. X
  1024. END_OF_FILE
  1025.   if test 262 -ne `wc -c <'IPP/host/Makefile'`; then
  1026.     echo shar: \"'IPP/host/Makefile'\" unpacked with wrong size!
  1027.   fi
  1028.   # end of 'IPP/host/Makefile'
  1029. fi
  1030. if test -f 'IPP/host/README_config' -a "${1}" != "-c" ; then 
  1031.   echo shar: Will not clobber existing file \"'IPP/host/README_config'\"
  1032. else
  1033.   echo shar: Extracting \"'IPP/host/README_config'\" \(1023 characters\)
  1034.   sed "s/^X//" >'IPP/host/README_config' <<'END_OF_FILE'
  1035. X# This is an exmaple of config for a host
  1036. X# The config file is quite strict in terms of layout, Comments MUST start with a #
  1037. X# You cannot place comments anywhere you want...
  1038. X# You are allowed blank lines...
  1039. X# ONLY spaces are allowed as separators...
  1040. X# The FIRST thing you have to write is the address of the router.,
  1041. X
  1042. XAddress 10
  1043. X
  1044. X# The n you have to write the interface specification.. the thing begins with
  1045. X# a special keyword... otherwise it is too complicated.
  1046. X# The other thing is tha all parameters fit in one line... in the following order
  1047. X# Technology parameters
  1048. X
  1049. XInterface sock localhost 1027
  1050. X
  1051. X# The host needs to have a reference router. In theory is not needed since
  1052. X# even a host should be able to do routing, but it makes things easy for now
  1053. X# NOTE: The router address given here is just the single trailing byte of 
  1054. X# the router address. 
  1055. X
  1056. XRouter 2
  1057. X
  1058. X# then follows a list of hosts to talk to by means of a ping request
  1059. X# IN this case you have to specify the full address.
  1060. X
  1061. XTalkTo 5
  1062. X#TalkTo 2.12
  1063. X#TalkTo 2.13
  1064. X
  1065. X
  1066. END_OF_FILE
  1067.   if test 1023 -ne `wc -c <'IPP/host/README_config'`; then
  1068.     echo shar: \"'IPP/host/README_config'\" unpacked with wrong size!
  1069.   fi
  1070.   # end of 'IPP/host/README_config'
  1071. fi
  1072. if test -f 'IPP/host/SendPacket.c' -a "${1}" != "-c" ; then 
  1073.   echo shar: Will not clobber existing file \"'IPP/host/SendPacket.c'\"
  1074. else
  1075.   echo shar: Extracting \"'IPP/host/SendPacket.c'\" \(1414 characters\)
  1076.   sed "s/^X//" >'IPP/host/SendPacket.c' <<'END_OF_FILE'
  1077. X/* ------------------------------------------------------------------------------
  1078. X * Ident: SendPacket.c
  1079. X * Author: Damiano Bolla 1993
  1080. X * All this project is covered by the GNU Copyright.
  1081. X */
  1082. X
  1083. X#include <stdio.h>
  1084. X#include <string.h>
  1085. X#include <sys/types.h>
  1086. X#include <sys/socket.h>
  1087. X#include <netdb.h>
  1088. X#include <sys/time.h>
  1089. X#include <netinet/in.h>
  1090. X#include "defs.h"
  1091. X#include "debug.h"
  1092. X#include "packet.h"
  1093. X#include "router.h"
  1094. X#include "host.h"
  1095. X#include "func_defs.h"
  1096. X
  1097. Xextern struct Debug dbg;
  1098. X
  1099. Xint SendPacket ( struct Host *hostdata )
  1100. X   {
  1101. X   int    c;
  1102. X   int    Eof;
  1103. X   u_char Mylastbyte;
  1104. X   struct IPPaddr *dest;
  1105. X   struct IPP ippS;
  1106. X
  1107. X   Mylastbyte = hostdata->Myaddr.Addr[hostdata->Myaddr.Al -1];
  1108. X
  1109. X   c=hostdata->CurPeer+1;
  1110. X   if ( (c>=PEER_MAX) || (hostdata->Peer[c].Peer.Al==0) ) c=0;
  1111. X
  1112. X   dest = &hostdata->Peer[c].Peer;
  1113. X   hostdata->CurPeer = c;
  1114. X
  1115. X   ippS.Type = PTYPE_RR;
  1116. X   ipp_AtoS ( &hostdata->Myaddr, &ippS );    
  1117. X   ipp_AtoR ( dest, &ippS );
  1118. X   ippS.NextRouter = NOT_USED;
  1119. X   ippS.NextHop = hostdata->Router;
  1120. X   ippS.From = Mylastbyte;
  1121. X   ippS.Sender = Mylastbyte;
  1122. X   ippS.PackId = ++(hostdata->PackId);
  1123. X
  1124. X   ippS.Depth=0;
  1125. X   ippS.TTL=INIT_TTL;
  1126. X
  1127. X/*
  1128. X   sprintf (ippS.Data,"Packid %d",hostdata->PackId);
  1129. X   ippS.DataLen = strlen(ippS.Data);
  1130. X*/
  1131. X   ippS.DataLen = 0;
  1132. X
  1133. X   Eof = FALSE;
  1134. X   if ( SndPack( &ippS, hostdata->NetFd, &Eof) ) printf ("Send failed \n");
  1135. X   if ( Eof ) return (NOT_DONE);
  1136. X
  1137. X   return (DONE);
  1138. X   }
  1139. END_OF_FILE
  1140.   if test 1414 -ne `wc -c <'IPP/host/SendPacket.c'`; then
  1141.     echo shar: \"'IPP/host/SendPacket.c'\" unpacked with wrong size!
  1142.   fi
  1143.   # end of 'IPP/host/SendPacket.c'
  1144. fi
  1145. if test -f 'IPP/include/commands.h' -a "${1}" != "-c" ; then 
  1146.   echo shar: Will not clobber existing file \"'IPP/include/commands.h'\"
  1147. else
  1148.   echo shar: Extracting \"'IPP/include/commands.h'\" \(1092 characters\)
  1149.   sed "s/^X//" >'IPP/include/commands.h' <<'END_OF_FILE'
  1150. X/* ----------------------------------------------------------------------
  1151. X * AUthor: Damiano Bolla, 1993
  1152. X * All this project is covered by the GNU Copyright.
  1153. X */
  1154. X
  1155. X#ifndef COMMANDS_H
  1156. X#define COMMANDS_H
  1157. X
  1158. X
  1159. X/* This file holds the various commands allowed in the system
  1160. X */
  1161. X
  1162. X#define CMD_SHOW    "Show"        /* Used to show thingsd            */
  1163. X#define CMD_SET        "Set"        /* Used to set things in a system    */
  1164. X#define CMD_STAT    "Stat"        /* Return statistics            */
  1165. X#define CMD_ADDR    "Address"    /* Associate and address        */
  1166. X#define CMD_INTERFACE    "Interface"    /* Set up an intrface            */
  1167. X#define CMD_ROUTE    "Route"        /* Set a route                */
  1168. X#define CMD_DEBUG    "Debug"        /* Set the debugging level        */
  1169. X#define CMD_EXIT    "Exit"        /* Say that you want to kill the prog    */
  1170. X#define CMD_ROUTER    "Router"
  1171. X#define CMD_TALKTO    "talkto"
  1172. X#define SAY_YES        "Yes"        /* This is yes :-) Can be si...        */
  1173. X#define SAY_NO        "No"        /* This is no :-) Can be none...    */
  1174. X#define LEV_NET        "Net"        /* To specify the routing level        */
  1175. X#define LEV_HOST    "Host"        /* To specify the routing level        */
  1176. X#define LEV_PARENT    "Parent"    /* To specify the routing level        */
  1177. X
  1178. X#endif
  1179. END_OF_FILE
  1180.   if test 1092 -ne `wc -c <'IPP/include/commands.h'`; then
  1181.     echo shar: \"'IPP/include/commands.h'\" unpacked with wrong size!
  1182.   fi
  1183.   # end of 'IPP/include/commands.h'
  1184. fi
  1185. if test -f 'IPP/include/tcp.h' -a "${1}" != "-c" ; then 
  1186.   echo shar: Will not clobber existing file \"'IPP/include/tcp.h'\"
  1187. else
  1188.   echo shar: Extracting \"'IPP/include/tcp.h'\" \(656 characters\)
  1189.   sed "s/^X//" >'IPP/include/tcp.h' <<'END_OF_FILE'
  1190. X/* ----------------------------------------------------------------------
  1191. X * AUthor: Damiano Bolla, 1993
  1192. X * All this project is covered by the GNU Copyright.
  1193. X */
  1194. X
  1195. X#ifndef TCP_H
  1196. X#define TCP_H
  1197. X
  1198. X/* This file contains the various constants that are used by the TCP system    */
  1199. X
  1200. X#define SHUT_RECV       0       /* Codice per shutdown                  */
  1201. X#define SHUT_SEND       1       /* Codice per shutdown                  */
  1202. X#define SHUT_ALL        2       /* Codice per shutdown                  */
  1203. X#define SOCK_QUIK       0       /* Per SO_LINGER                        */
  1204. X#define SOCK_SLOW       1       /* Per SO_LINGER                        */
  1205. X
  1206. X
  1207. X#endif
  1208. END_OF_FILE
  1209.   if test 656 -ne `wc -c <'IPP/include/tcp.h'`; then
  1210.     echo shar: \"'IPP/include/tcp.h'\" unpacked with wrong size!
  1211.   fi
  1212.   # end of 'IPP/include/tcp.h'
  1213. fi
  1214. if test -f 'IPP/include/watchdog.h' -a "${1}" != "-c" ; then 
  1215.   echo shar: Will not clobber existing file \"'IPP/include/watchdog.h'\"
  1216. else
  1217.   echo shar: Extracting \"'IPP/include/watchdog.h'\" \(461 characters\)
  1218.   sed "s/^X//" >'IPP/include/watchdog.h' <<'END_OF_FILE'
  1219. X/* ----------------------------------------------------------------------
  1220. X * AUthor: Damiano Bolla, 1993
  1221. X * All this project is covered by the GNU Copyright.
  1222. X */
  1223. X
  1224. X#ifndef WATCHDOG_H
  1225. X#define WATCHDOG_H
  1226. X
  1227. X/* This file specify the structure of a watchdog system.
  1228. X * There are many thing that are needed in hndling a watchdog, this structure
  1229. X * will hold them.
  1230. X */
  1231. X
  1232. Xstruct Watch
  1233. X   {
  1234. X   void (*Handler)();        /* I also need the handler of rthe error    */
  1235. X   };
  1236. X
  1237. X
  1238. X#endif
  1239. END_OF_FILE
  1240.   if test 461 -ne `wc -c <'IPP/include/watchdog.h'`; then
  1241.     echo shar: \"'IPP/include/watchdog.h'\" unpacked with wrong size!
  1242.   fi
  1243.   # end of 'IPP/include/watchdog.h'
  1244. fi
  1245. if test -f 'IPP/lib/Makefile' -a "${1}" != "-c" ; then 
  1246.   echo shar: Will not clobber existing file \"'IPP/lib/Makefile'\"
  1247. else
  1248.   echo shar: Extracting \"'IPP/lib/Makefile'\" \(200 characters\)
  1249.   sed "s/^X//" >'IPP/lib/Makefile' <<'END_OF_FILE'
  1250. X
  1251. Xlibipp:
  1252. X    rm -f  libipp.a
  1253. X    ar rcvs libipp.a utils/*.o route/*.o
  1254. X
  1255. X# If on BSD use the two following lines.
  1256. X#    ar rcv libipp.a utils/*.o route/*.o
  1257. X#    ranlib libipp.a
  1258. X
  1259. Xclean:
  1260. X    rm -f libipp.a core errlist
  1261. X
  1262. END_OF_FILE
  1263.   if test 200 -ne `wc -c <'IPP/lib/Makefile'`; then
  1264.     echo shar: \"'IPP/lib/Makefile'\" unpacked with wrong size!
  1265.   fi
  1266.   # end of 'IPP/lib/Makefile'
  1267. fi
  1268. if test -f 'IPP/lib/README' -a "${1}" != "-c" ; then 
  1269.   echo shar: Will not clobber existing file \"'IPP/lib/README'\"
  1270. else
  1271.   echo shar: Extracting \"'IPP/lib/README'\" \(193 characters\)
  1272.   sed "s/^X//" >'IPP/lib/README' <<'END_OF_FILE'
  1273. XThis directory holds the functions that are used by all the programs.
  1274. X
  1275. XThe makefile has two different setup depending if you have ranlib (SunOS)
  1276. Xor if you can do without it. (Linux, Solaris).
  1277. X
  1278. END_OF_FILE
  1279.   if test 193 -ne `wc -c <'IPP/lib/README'`; then
  1280.     echo shar: \"'IPP/lib/README'\" unpacked with wrong size!
  1281.   fi
  1282.   # end of 'IPP/lib/README'
  1283. fi
  1284. if test -f 'IPP/lib/route/Makefile' -a "${1}" != "-c" ; then 
  1285.   echo shar: Will not clobber existing file \"'IPP/lib/route/Makefile'\"
  1286. else
  1287.   echo shar: Extracting \"'IPP/lib/route/Makefile'\" \(307 characters\)
  1288.   sed "s/^X//" >'IPP/lib/route/Makefile' <<'END_OF_FILE'
  1289. XINC=../../include
  1290. XCC=gcc
  1291. XCFLAGS=-I$(INC) -g
  1292. X
  1293. XFUNCS= FindRoute.o WhatIsIt.o ShowRoute.o ShowInterface.o AddressMatch.o \
  1294. X    RouteAdd.o CloseIf.o RouteMgr.o FindHostRoute.o \
  1295. X    FindSubnetRoute.o FindParentRoute.o RecordRoute.o
  1296. X
  1297. Xall:$(FUNCS)
  1298. X
  1299. Xclean:
  1300. X    rm -f *.o core errlist
  1301. X
  1302. X.c.o:
  1303. X    $(CC) $(CFLAGS) -c -o $*.o $<
  1304. X
  1305. END_OF_FILE
  1306.   if test 307 -ne `wc -c <'IPP/lib/route/Makefile'`; then
  1307.     echo shar: \"'IPP/lib/route/Makefile'\" unpacked with wrong size!
  1308.   fi
  1309.   # end of 'IPP/lib/route/Makefile'
  1310. fi
  1311. if test -f 'IPP/lib/route/RecordRoute.c' -a "${1}" != "-c" ; then 
  1312.   echo shar: Will not clobber existing file \"'IPP/lib/route/RecordRoute.c'\"
  1313. else
  1314.   echo shar: Extracting \"'IPP/lib/route/RecordRoute.c'\" \(936 characters\)
  1315.   sed "s/^X//" >'IPP/lib/route/RecordRoute.c' <<'END_OF_FILE'
  1316. X/* ------------------------------------------------------------------------
  1317. X * Ident: RecordRoute.c
  1318. X * Author: Damiano Bolla 1993
  1319. X * All this project is covered by the GNU Copyright.
  1320. X */
  1321. X
  1322. X#include <stdio.h>
  1323. X#include <string.h>
  1324. X#include <sys/types.h>
  1325. X#include <sys/time.h>
  1326. X#include "defs.h"
  1327. X#include "debug.h"
  1328. X#include "packet.h"
  1329. X#include "router.h"
  1330. X#include "func_defs.h"
  1331. X
  1332. Xextern struct Debug dbg;
  1333. X
  1334. X/* This simply put my address in the data of the packet.
  1335. X * In this way it isp ossible to see where a packet has travelled. 
  1336. X */
  1337. Xint RecordRoute ( struct IPPaddr *myaddr, char *Buff, int Bufflen )
  1338. X   {
  1339. X   char *Ptr;
  1340. X
  1341. X   if ( strlen(Buff) + strlen (ipp_ntoa(myaddr)) > Bufflen )
  1342. X      {
  1343. X      sprintf (dbg.msg,"RecordRoute: There is no space in the buffer");
  1344. X      DebugCall ( ERR_NOSPACE, DEBUG_CRITICAL );
  1345. X      return (NOT_DONE);
  1346. X      }
  1347. X
  1348. X   Ptr = Buff + strlen(Buff);
  1349. X   sprintf (Ptr,"%s\n",ipp_ntoa(myaddr));
  1350. X   return (DONE);
  1351. X   } 
  1352. END_OF_FILE
  1353.   if test 936 -ne `wc -c <'IPP/lib/route/RecordRoute.c'`; then
  1354.     echo shar: \"'IPP/lib/route/RecordRoute.c'\" unpacked with wrong size!
  1355.   fi
  1356.   # end of 'IPP/lib/route/RecordRoute.c'
  1357. fi
  1358. if test -f 'IPP/lib/utils/BeDaemon.c' -a "${1}" != "-c" ; then 
  1359.   echo shar: Will not clobber existing file \"'IPP/lib/utils/BeDaemon.c'\"
  1360. else
  1361.   echo shar: Extracting \"'IPP/lib/utils/BeDaemon.c'\" \(367 characters\)
  1362.   sed "s/^X//" >'IPP/lib/utils/BeDaemon.c' <<'END_OF_FILE'
  1363. X/* --------------------------------------------------------------------------
  1364. X * Ident: BeDaemon.c
  1365. X * Author: Damiano Bolla 1993
  1366. X * All this project is covered by the GNU Copyright.
  1367. X */
  1368. X
  1369. X#include <unistd.h>
  1370. X#include <string.h>
  1371. X#include "defs.h"
  1372. X
  1373. X/* This transform a program in a daemon.
  1374. X * I have to look this up...
  1375. X */
  1376. X
  1377. Xint BeDaemon (  )
  1378. X   {
  1379. X   return (DONE);
  1380. X   }
  1381. END_OF_FILE
  1382.   if test 367 -ne `wc -c <'IPP/lib/utils/BeDaemon.c'`; then
  1383.     echo shar: \"'IPP/lib/utils/BeDaemon.c'\" unpacked with wrong size!
  1384.   fi
  1385.   # end of 'IPP/lib/utils/BeDaemon.c'
  1386. fi
  1387. if test -f 'IPP/lib/utils/ExistFd.c' -a "${1}" != "-c" ; then 
  1388.   echo shar: Will not clobber existing file \"'IPP/lib/utils/ExistFd.c'\"
  1389. else
  1390.   echo shar: Extracting \"'IPP/lib/utils/ExistFd.c'\" \(1096 characters\)
  1391.   sed "s/^X//" >'IPP/lib/utils/ExistFd.c' <<'END_OF_FILE'
  1392. X/* ----------------------------------------------------------------------------
  1393. X * Ident: ExistFd.c
  1394. X * Author: Damiano Bolla 1993
  1395. X * All this project is covered by the GNU Copyright.
  1396. X */ 
  1397. X
  1398. X#include <stdio.h>
  1399. X#include <sys/types.h>
  1400. X#include <sys/socket.h>
  1401. X#include <netinet/in.h>
  1402. X#include "defs.h"
  1403. X#include "debug.h"
  1404. X#include "func_defs.h"
  1405. X
  1406. Xextern struct Debug dbg;
  1407. X
  1408. X/* This one checks that an Fd is a good one...
  1409. X * It will return TRUE if it exist already and it is a good one
  1410. X */
  1411. X
  1412. Xint ExistFd ( int fd, int Type )
  1413. X   {
  1414. X
  1415. X   if ( Type == SOCK_TECH )
  1416. X      {
  1417. X      struct sockaddr_in name;
  1418. X      int namelen;
  1419. X      int error;
  1420. X
  1421. X      namelen = sizeof (name);
  1422. X      error = getsockname (fd, (struct sockaddr *)&name, &namelen );
  1423. X      if ( error < 0 ) 
  1424. X     {
  1425. X     /* I assume that the descriptor is bad...                */
  1426. X     /* And therefore no more existent...                    */
  1427. X     return (FALSE);
  1428. X     }
  1429. X
  1430. X      return (TRUE);
  1431. X      }
  1432. X
  1433. X   /* If I don't know of what you are talkign about...                */
  1434. X   sprintf (dbg.msg,"ExistFd: Descriptor Type unknown %d ",Type);
  1435. X   DebugCall ( ERR_NOCHECK, DEBUG_ALERT );
  1436. X   return (FALSE);
  1437. X   }
  1438. END_OF_FILE
  1439.   if test 1096 -ne `wc -c <'IPP/lib/utils/ExistFd.c'`; then
  1440.     echo shar: \"'IPP/lib/utils/ExistFd.c'\" unpacked with wrong size!
  1441.   fi
  1442.   # end of 'IPP/lib/utils/ExistFd.c'
  1443. fi
  1444. if test -f 'IPP/lib/utils/Makefile' -a "${1}" != "-c" ; then 
  1445.   echo shar: Will not clobber existing file \"'IPP/lib/utils/Makefile'\"
  1446. else
  1447.   echo shar: Extracting \"'IPP/lib/utils/Makefile'\" \(304 characters\)
  1448.   sed "s/^X//" >'IPP/lib/utils/Makefile' <<'END_OF_FILE'
  1449. XINC=../../include
  1450. XCC=gcc
  1451. XCFLAGS=-I$(INC) -g
  1452. X
  1453. XFUNCS= Debug.o Listen.o SafeRead.o Connect.o RcvPack.o WatchDog.o \
  1454. X    SndPack.o ipp_utils.o ReadConfig.o GetAddress.o ExistFd.o \
  1455. X    Accept.o TtyGets.o SeenAlready.o BeDaemon.o
  1456. X
  1457. Xall:$(FUNCS)
  1458. X
  1459. Xclean:
  1460. X    rm -f *.o core errlist
  1461. X
  1462. X.c.o:
  1463. X    $(CC) $(CFLAGS) -c -o $*.o $<
  1464. X
  1465. END_OF_FILE
  1466.   if test 304 -ne `wc -c <'IPP/lib/utils/Makefile'`; then
  1467.     echo shar: \"'IPP/lib/utils/Makefile'\" unpacked with wrong size!
  1468.   fi
  1469.   # end of 'IPP/lib/utils/Makefile'
  1470. fi
  1471. if test -f 'IPP/lib/utils/README' -a "${1}" != "-c" ; then 
  1472.   echo shar: Will not clobber existing file \"'IPP/lib/utils/README'\"
  1473. else
  1474.   echo shar: Extracting \"'IPP/lib/utils/README'\" \(781 characters\)
  1475.   sed "s/^X//" >'IPP/lib/utils/README' <<'END_OF_FILE'
  1476. XThis directory holds the functions that are used by all the programs.
  1477. XWhat is performed is the following.
  1478. X
  1479. X
  1480. Xethernet.c
  1481. X
  1482. X   This provides the functions for openning an ethernet connection and performing
  1483. X   the requested operations. The requested operations are:
  1484. X     open a link given the ethernet ID.
  1485. X     read a packet
  1486. X     write a packet
  1487. X
  1488. Xtcp.c
  1489. X
  1490. X   This provides the functions for openning a tcp link and performing
  1491. X   the requested operations.
  1492. X     open a link by creating it
  1493. X     open a link by using an existing one
  1494. X     read a packet
  1495. X     write a packet
  1496. X
  1497. Xatm.c
  1498. X
  1499. X   This provides the functions for openning an atm link and performing
  1500. X   the requested operations.
  1501. X     open a link by creating it
  1502. X     open a link by using an existing one
  1503. X     read a packet
  1504. X     write a packet
  1505. END_OF_FILE
  1506.   if test 781 -ne `wc -c <'IPP/lib/utils/README'`; then
  1507.     echo shar: \"'IPP/lib/utils/README'\" unpacked with wrong size!
  1508.   fi
  1509.   # end of 'IPP/lib/utils/README'
  1510. fi
  1511. if test -f 'IPP/lib/utils/SeenAlready.c' -a "${1}" != "-c" ; then 
  1512.   echo shar: Will not clobber existing file \"'IPP/lib/utils/SeenAlready.c'\"
  1513. else
  1514.   echo shar: Extracting \"'IPP/lib/utils/SeenAlready.c'\" \(1331 characters\)
  1515.   sed "s/^X//" >'IPP/lib/utils/SeenAlready.c' <<'END_OF_FILE'
  1516. X/* ---------------------------------------------------------------------------
  1517. X * Ident: SeenAlready.c
  1518. X * Author: Damiano Bolla 1993
  1519. X * All this project is covered by the GNU Copyright.
  1520. X */
  1521. X
  1522. X#include <stdio.h>
  1523. X#include <unistd.h>
  1524. X#include <malloc.h>
  1525. X#include <sys/types.h>
  1526. X#include <sys/time.h>
  1527. X#include <sys/timeb.h>
  1528. X#include <string.h>
  1529. X#include "defs.h"
  1530. X#include "packet.h"
  1531. X#include "router.h"
  1532. X#include "debug.h"
  1533. X#include "func_defs.h"
  1534. X
  1535. X
  1536. Xextern struct Debug dbg;
  1537. X
  1538. X/* This function is VERY delicate.
  1539. X * In theory we have an always running up time but in reality I wrap around every second...
  1540. X * This is SHURELY going to cause drop packets...
  1541. X */
  1542. X
  1543. Xint SeenAlready ( SeenData seendata, u_char Sender, u_char PackId )
  1544. X   {
  1545. X   u_short CurSec;
  1546. X   u_short LastSec;
  1547. X   time_t  tim;
  1548. X
  1549. X   if ( Sender == NOT_USED ) return (FALSE);
  1550. X
  1551. X   tim = time (NULL);
  1552. X   CurSec = tim;        /* The cast should do things right...            */
  1553. X   LastSec = seendata[Sender][PackId].Sec;
  1554. X   
  1555. X   /* I have to save the current time in any way...                    */
  1556. X   seendata[Sender][PackId].Sec=CurSec;
  1557. X
  1558. X   /* If we have a second difference it si OK..                        */
  1559. X   if ( CurSec > LastSec ) return (FALSE);
  1560. X
  1561. X   /* Also, if a packet is older than one second it is also valid...              */
  1562. X   if ( CurSec < LastSec ) return (FALSE);
  1563. X
  1564. X   /* Mhhh... too bad...                                */
  1565. X   return (TRUE);
  1566. X   }
  1567. END_OF_FILE
  1568.   if test 1331 -ne `wc -c <'IPP/lib/utils/SeenAlready.c'`; then
  1569.     echo shar: \"'IPP/lib/utils/SeenAlready.c'\" unpacked with wrong size!
  1570.   fi
  1571.   # end of 'IPP/lib/utils/SeenAlready.c'
  1572. fi
  1573. if test -f 'IPP/lib/utils/TtyGets.c' -a "${1}" != "-c" ; then 
  1574.   echo shar: Will not clobber existing file \"'IPP/lib/utils/TtyGets.c'\"
  1575. else
  1576.   echo shar: Extracting \"'IPP/lib/utils/TtyGets.c'\" \(875 characters\)
  1577.   sed "s/^X//" >'IPP/lib/utils/TtyGets.c' <<'END_OF_FILE'
  1578. X/* --------------------------------------------------------------------------
  1579. X * Ident: TtyGets.c
  1580. X * Author: Damiano Bolla 1993
  1581. X * All this project is covered by the GNU Copyright.
  1582. X */
  1583. X
  1584. X#include <unistd.h>
  1585. X#include <string.h>
  1586. X#include "defs.h"
  1587. X
  1588. X#define INPUT    0
  1589. X
  1590. X/* This one is a replacemente for gets that does not seems to do 
  1591. X * exactly what I want...
  1592. X * It reads from stdin in the given buffer and return a string 
  1593. X * without the CR. If the input is NULL it returns an empty buffer
  1594. X * If all is fine it returns DONE, if eof or other it returns NOT_DONE
  1595. X */
  1596. X
  1597. Xint TtyGets ( char *Buff, int Bufflen )
  1598. X   {
  1599. X   int Letti;
  1600. X   char *Ptr;
  1601. X
  1602. X   Letti = read (INPUT, Buff, Bufflen-1 );
  1603. X
  1604. X   if ( Letti < 0 ) return (NOT_DONE);
  1605. X
  1606. X   /* I have to put a zero at the end to use strchr            */
  1607. X   Buff[Letti] = 0;    
  1608. X
  1609. X   Ptr = strchr (Buff,'\n');
  1610. X   if ( Ptr ) *Ptr = 0;
  1611. X
  1612. X   return (DONE);
  1613. X   }
  1614. END_OF_FILE
  1615.   if test 875 -ne `wc -c <'IPP/lib/utils/TtyGets.c'`; then
  1616.     echo shar: \"'IPP/lib/utils/TtyGets.c'\" unpacked with wrong size!
  1617.   fi
  1618.   # end of 'IPP/lib/utils/TtyGets.c'
  1619. fi
  1620. if test -f 'IPP/logd/Logtest.c' -a "${1}" != "-c" ; then 
  1621.   echo shar: Will not clobber existing file \"'IPP/logd/Logtest.c'\"
  1622. else
  1623.   echo shar: Extracting \"'IPP/logd/Logtest.c'\" \(1330 characters\)
  1624.   sed "s/^X//" >'IPP/logd/Logtest.c' <<'END_OF_FILE'
  1625. X/* This program open a socket and then send data to it..
  1626. X */
  1627. X
  1628. X#include <stdio.h>
  1629. X#include <sys/types.h>
  1630. X#include <sys/socket.h>
  1631. X#include <netdb.h>
  1632. X#include <netinet/in.h>
  1633. X#include <signal.h>
  1634. X#include <sys/utsname.h>
  1635. X#include <errno.h>
  1636. X#include "defs.h"
  1637. X
  1638. X#define  MSG_SIZE    1024    /* This should be enough        */
  1639. X
  1640. Xmain ()
  1641. X   {
  1642. X   int send_socket;
  1643. X   int address_len;
  1644. X   struct sockaddr_in address;
  1645. X   int err;
  1646. X
  1647. X   /* I need a buffer for the messages...                */
  1648. X   char MsgBuff[MSG_SIZE+2];
  1649. X
  1650. X   send_socket = socket ( PF_INET, SOCK_DGRAM, 0);
  1651. X   if ( send_socket < 0)
  1652. X      {
  1653. X      fprintf (stderr,"Cannot create the SOCK_DGRAM socket \n");
  1654. X      exit (1);
  1655. X      }
  1656. X
  1657. X   strcpy (MsgBuff,"ciao there");
  1658. X
  1659. X   address.sin_family = SOCK_DGRAM;    
  1660. X   address.sin_port = htons(1234);    
  1661. X   address.sin_addr.s_addr = inet_addr("129.12.21.3");
  1662. X   memset (address.sin_zero, 0, sizeof(address.sin_zero));
  1663. X
  1664. X   address_len = sizeof (struct sockaddr_in);
  1665. X   err = sendto (send_socket,     /* The socket from where to get data    */
  1666. X        MsgBuff,         /* Destination buffer            */
  1667. X        MSG_SIZE,         /* Size of the buffer            */
  1668. X        0,            /* Options                */
  1669. X        &address,         /* A place where to store the address    */
  1670. X        address_len         /* The length of address        */
  1671. X        );
  1672. X
  1673. X
  1674. X   if ( err < 0 )
  1675. X      {
  1676. X      printf ("Error in sendto \n");
  1677. X      perror ("error code");
  1678. X      }
  1679. X   
  1680. X   exit (0);
  1681. X   }
  1682. END_OF_FILE
  1683.   if test 1330 -ne `wc -c <'IPP/logd/Logtest.c'`; then
  1684.     echo shar: \"'IPP/logd/Logtest.c'\" unpacked with wrong size!
  1685.   fi
  1686.   # end of 'IPP/logd/Logtest.c'
  1687. fi
  1688. if test -f 'IPP/logd/Makefile' -a "${1}" != "-c" ; then 
  1689.   echo shar: Will not clobber existing file \"'IPP/logd/Makefile'\"
  1690. else
  1691.   echo shar: Extracting \"'IPP/logd/Makefile'\" \(150 characters\)
  1692.   sed "s/^X//" >'IPP/logd/Makefile' <<'END_OF_FILE'
  1693. Xlogd: logd.c
  1694. X    gcc -I../include logd.c $(SOCKLIB) -o logd
  1695. X
  1696. Xlogtest: logtest.c
  1697. X    gcc -I../include logtest.c -o logtest
  1698. X
  1699. Xclean:
  1700. X    rm -f logd core errlist
  1701. X
  1702. END_OF_FILE
  1703.   if test 150 -ne `wc -c <'IPP/logd/Makefile'`; then
  1704.     echo shar: \"'IPP/logd/Makefile'\" unpacked with wrong size!
  1705.   fi
  1706.   # end of 'IPP/logd/Makefile'
  1707. fi
  1708. if test -f 'IPP/monitor/Makefile' -a "${1}" != "-c" ; then 
  1709.   echo shar: Will not clobber existing file \"'IPP/monitor/Makefile'\"
  1710. else
  1711.   echo shar: Extracting \"'IPP/monitor/Makefile'\" \(248 characters\)
  1712.   sed "s/^X//" >'IPP/monitor/Makefile' <<'END_OF_FILE'
  1713. XINC=../include
  1714. XCC=gcc
  1715. XLIBIPP=../lib/libipp.a
  1716. XCFLAGS=-I$(INC) -g 
  1717. X
  1718. XOBJ=monitor.o Send.o Receive.o
  1719. X
  1720. Xmon:$(OBJ) $(LIBIPP)
  1721. X    $(CC) $(OBJ) $(LIBIPP) $(SOCKLIB) -o mon
  1722. X    sync
  1723. X
  1724. Xclean:
  1725. X    rm -f *.o mon core errlist
  1726. X    sync
  1727. X
  1728. X.c.o:
  1729. X    $(CC) $(CFLAGS) -c -o $*.o $<
  1730. X
  1731. END_OF_FILE
  1732.   if test 248 -ne `wc -c <'IPP/monitor/Makefile'`; then
  1733.     echo shar: \"'IPP/monitor/Makefile'\" unpacked with wrong size!
  1734.   fi
  1735.   # end of 'IPP/monitor/Makefile'
  1736. fi
  1737. if test -f 'IPP/monitor/README' -a "${1}" != "-c" ; then 
  1738.   echo shar: Will not clobber existing file \"'IPP/monitor/README'\"
  1739. else
  1740.   echo shar: Extracting \"'IPP/monitor/README'\" \(409 characters\)
  1741.   sed "s/^X//" >'IPP/monitor/README' <<'END_OF_FILE'
  1742. XThe monitor will be essential to collect statistics from the routers...
  1743. X
  1744. XBeside the simple host program needs some knowledge of who is on the net to send
  1745. Xpackets. There are various functions that are desirable.
  1746. X
  1747. X1) Ilst of all nodes in a given level including if theya re routers or not.
  1748. X
  1749. X2) Show statistics of traffic and show routing tables.
  1750. X
  1751. X3) Send commands to the routers...
  1752. X
  1753. X4) Send and show packets.
  1754. X
  1755. X
  1756. END_OF_FILE
  1757.   if test 409 -ne `wc -c <'IPP/monitor/README'`; then
  1758.     echo shar: \"'IPP/monitor/README'\" unpacked with wrong size!
  1759.   fi
  1760.   # end of 'IPP/monitor/README'
  1761. fi
  1762. if test -f 'IPP/monitor/Receive.c' -a "${1}" != "-c" ; then 
  1763.   echo shar: Will not clobber existing file \"'IPP/monitor/Receive.c'\"
  1764. else
  1765.   echo shar: Extracting \"'IPP/monitor/Receive.c'\" \(1411 characters\)
  1766.   sed "s/^X//" >'IPP/monitor/Receive.c' <<'END_OF_FILE'
  1767. X/* ------------------------------------------------------------------------------
  1768. X * Ident: Receive.d
  1769. X * Author: Damiano Bolla 1993
  1770. X * All this project is covered by the GNU Copyright.
  1771. X */
  1772. X
  1773. X#include <stdio.h>
  1774. X#include <string.h>
  1775. X#include <sys/types.h>
  1776. X#include <sys/socket.h>
  1777. X#include <netdb.h>
  1778. X#include <sys/time.h>
  1779. X#include <netinet/in.h>
  1780. X#include "defs.h"
  1781. X#include "debug.h"
  1782. X#include "packet.h"
  1783. X#include "router.h"
  1784. X#include "func_defs.h"
  1785. X
  1786. Xextern struct Debug dbg;
  1787. X
  1788. Xint Receive ( struct IPPaddr *myaddr, int talksock, u_char NextHop )
  1789. X   {
  1790. X   int Eof;
  1791. X   struct IPP     ippR;
  1792. X   struct IPPaddr addr;
  1793. X
  1794. X   Eof = FALSE;
  1795. X   RcvPack( &ippR, talksock, &Eof);
  1796. X   if ( Eof ) return (NOT_DONE);
  1797. X
  1798. X   ipp_StoA (&ippR,&addr);
  1799. X
  1800. X   if ( ippR.Type == PTYPE_DATA )
  1801. X      {
  1802. X      printf ("============== Data Packet from %s ============== \n",ipp_ntoa (&addr));
  1803. X      ippR.Data[ippR.DataLen] = 0;
  1804. X      printf ("%s \n",ippR.Data);
  1805. X      return (DONE);
  1806. X      }
  1807. X   
  1808. X   if ( ippR.Type == PTYPE_RR )
  1809. X      {
  1810. X      printf ("============== RR Packet from %s ============== \n",ipp_ntoa (&addr));
  1811. X      ippR.Data[ippR.DataLen] = 0;
  1812. X      printf ("%s \n",ippR.Data);
  1813. X      return (DONE);
  1814. X      }
  1815. X
  1816. X   if ( ippR.Type == PTYPE_PING )
  1817. X      {
  1818. X      printf ("Received PING packet from %s \n",ipp_ntoa(&addr));
  1819. X      return (DONE);
  1820. X      }
  1821. X
  1822. X   printf ("Unknown packet type %d from %s \n",ippR.Type, ipp_ntoa(&addr));
  1823. X   return (DONE);
  1824. X   }
  1825. END_OF_FILE
  1826.   if test 1411 -ne `wc -c <'IPP/monitor/Receive.c'`; then
  1827.     echo shar: \"'IPP/monitor/Receive.c'\" unpacked with wrong size!
  1828.   fi
  1829.   # end of 'IPP/monitor/Receive.c'
  1830. fi
  1831. if test -f 'IPP/router/Makefile' -a "${1}" != "-c" ; then 
  1832.   echo shar: Will not clobber existing file \"'IPP/router/Makefile'\"
  1833. else
  1834.   echo shar: Extracting \"'IPP/router/Makefile'\" \(345 characters\)
  1835.   sed "s/^X//" >'IPP/router/Makefile' <<'END_OF_FILE'
  1836. XINC=../include
  1837. XCC=gcc
  1838. XLIBIPP=../lib/libipp.a 
  1839. XCFLAGS=-I$(INC) -g 
  1840. X
  1841. XOBJ=router.o RouterInit.o RouterIo.o SetInterface.o TableInit.o \
  1842. X    ProcessCall.o ProcessPack.o ParsePack.o ParseData.o ShowStat.o
  1843. X
  1844. Xrouter:$(OBJ) $(LIBIPP)
  1845. X    $(CC) $(OBJ) $(LIBIPP) $(SOCKLIB) -o router
  1846. X
  1847. Xclean:
  1848. X    rm -f *.o router core errlist
  1849. X
  1850. X.c.o:
  1851. X    $(CC) $(CFLAGS) -c -o $*.o $<
  1852. X
  1853. END_OF_FILE
  1854.   if test 345 -ne `wc -c <'IPP/router/Makefile'`; then
  1855.     echo shar: \"'IPP/router/Makefile'\" unpacked with wrong size!
  1856.   fi
  1857.   # end of 'IPP/router/Makefile'
  1858. fi
  1859. if test -f 'IPP/router/README' -a "${1}" != "-c" ; then 
  1860.   echo shar: Will not clobber existing file \"'IPP/router/README'\"
  1861. else
  1862.   echo shar: Extracting \"'IPP/router/README'\" \(437 characters\)
  1863.   sed "s/^X//" >'IPP/router/README' <<'END_OF_FILE'
  1864. XThis router must be started with a config file in stdin. 
  1865. XSee the two exmaples in config/ex1 config/ex2 for the config file
  1866. Xsyntax.
  1867. X
  1868. Xa router accept the following commands.
  1869. XNOTE: The set commands arguments are in the same format as the config file.
  1870. XYou can give these commands by using the mon program (in the monitor
  1871. Xdirectory) and connecting to a router. 
  1872. X
  1873. X
  1874. Xshow route
  1875. Xshow interface
  1876. Xshow stat
  1877. X
  1878. Xset route
  1879. Xset interface
  1880. Xset debug
  1881. X
  1882. Xexit
  1883. END_OF_FILE
  1884.   if test 437 -ne `wc -c <'IPP/router/README'`; then
  1885.     echo shar: \"'IPP/router/README'\" unpacked with wrong size!
  1886.   fi
  1887.   # end of 'IPP/router/README'
  1888. fi
  1889. if test -f 'IPP/router/RouterInit.c' -a "${1}" != "-c" ; then 
  1890.   echo shar: Will not clobber existing file \"'IPP/router/RouterInit.c'\"
  1891. else
  1892.   echo shar: Extracting \"'IPP/router/RouterInit.c'\" \(1409 characters\)
  1893.   sed "s/^X//" >'IPP/router/RouterInit.c' <<'END_OF_FILE'
  1894. X/* ---------------------------------------------------------------------------
  1895. X * Ident: RouterInit.c
  1896. X * Author: Damiano Bolla 1993
  1897. X * All this project is covered by the GNU Copyright.
  1898. X */
  1899. X
  1900. X#include <stdio.h>
  1901. X#include <string.h>
  1902. X#include <sys/types.h>
  1903. X#include <sys/time.h>
  1904. X#include "defs.h"
  1905. X#include "debug.h"
  1906. X#include "packet.h"
  1907. X#include "router.h"
  1908. X#include "commands.h"
  1909. X#include "func_defs.h"
  1910. X
  1911. Xextern struct Debug dbg;
  1912. X/* It returns NOT_DONE if it fails, DOEN otherwise...
  1913. X * Debugging is done via the logd daemon.
  1914. X * Ok... the format of the config file is quite strict... othervise I will spend
  1915. X * more time parsing the file than doing "real" things... So !
  1916. X */
  1917. X
  1918. Xint RouterInit ( struct Routing *rinfo )
  1919. X   {
  1920. X   char *Line;
  1921. X   char *Cmd;
  1922. X   char *Arg;
  1923. X   char Null[2]={0};
  1924. X
  1925. X   /* I must be shure that the tables are initilized properly            */
  1926. X   TableInit ( rinfo );
  1927. X
  1928. X   /* Then first thing to do is to get my own address...            */
  1929. X   if ( GetAddress (&rinfo->MyAddr) ) return (NOT_DONE);
  1930. X
  1931. X   /* Ok, now... we get a line and see what the key is                */
  1932. X   while ( (Line=ReadConfig(stdin)) != NULL )
  1933. X      {
  1934. X      if ((Cmd=strtok(Line,CMD_SEP))==NULL) { Cmd=Null; Arg=Null; }
  1935. X      else Arg=Cmd+strlen(Cmd)+1;
  1936. X
  1937. X      if ( strcasecmp (Cmd, CMD_INTERFACE) == 0 )
  1938. X         SetInterface (rinfo, Arg);
  1939. X     
  1940. X      if ( strcasecmp (Cmd, CMD_ROUTE) == 0 )
  1941. X         RouteAdd (rinfo, Arg);
  1942. X      }
  1943. X
  1944. X   return (DONE);
  1945. X   }
  1946. END_OF_FILE
  1947.   if test 1409 -ne `wc -c <'IPP/router/RouterInit.c'`; then
  1948.     echo shar: \"'IPP/router/RouterInit.c'\" unpacked with wrong size!
  1949.   fi
  1950.   # end of 'IPP/router/RouterInit.c'
  1951. fi
  1952. if test -f 'IPP/router/ShowStat.c' -a "${1}" != "-c" ; then 
  1953.   echo shar: Will not clobber existing file \"'IPP/router/ShowStat.c'\"
  1954. else
  1955.   echo shar: Extracting \"'IPP/router/ShowStat.c'\" \(1178 characters\)
  1956.   sed "s/^X//" >'IPP/router/ShowStat.c' <<'END_OF_FILE'
  1957. X/* ---------------------------------------------------------------------------
  1958. X * Ident: ShowStat.c
  1959. X * Author: Damiano Bolla 1993
  1960. X * All this project is covered by the GNU Copyright.
  1961. X */
  1962. X
  1963. X#include <stdio.h>
  1964. X#include <string.h>
  1965. X#include <sys/types.h>
  1966. X#include <sys/time.h>
  1967. X#include "defs.h"
  1968. X#include "debug.h"
  1969. X#include "packet.h"
  1970. X#include "router.h"
  1971. X#include "commands.h"
  1972. X#include "func_defs.h"
  1973. X
  1974. Xextern struct Debug dbg;
  1975. X
  1976. X/* This one show statistics for this router.
  1977. X * The difficult thing is NOT to overflow th buffer.
  1978. X * Since I have very little data, I do not bother...
  1979. X */
  1980. Xint ShowStat (struct Routing *rinfo, char *Buff, int Bufflen )
  1981. X   {
  1982. X   char *ptr;
  1983. X
  1984. X   sprintf (dbg.msg,"ShowStat: Formatting statistics ");
  1985. X   DebugCall ( ERR_MSG, DEBUG_TEXT );
  1986. X   ptr = Buff;
  1987. X   sprintf (ptr,"Debug Level %d \n",dbg.current_level);
  1988. X   ptr += strlen (ptr);
  1989. X   sprintf (ptr,"Idle Time %d \n",rinfo->Idle);
  1990. X   ptr += strlen (ptr);
  1991. X   sprintf (ptr,"Bad Packets %d \n",rinfo->BadCount);
  1992. X   ptr += strlen (ptr);
  1993. X   sprintf (ptr,"Loop Count %d \n",rinfo->LoopCount);
  1994. X   ptr += strlen (ptr);
  1995. X   sprintf (ptr,"TTL Count %d \n",rinfo->TTLCount);
  1996. X   ptr += strlen (ptr);
  1997. X
  1998. X   return (DONE);
  1999. X   }
  2000. X
  2001. END_OF_FILE
  2002.   if test 1178 -ne `wc -c <'IPP/router/ShowStat.c'`; then
  2003.     echo shar: \"'IPP/router/ShowStat.c'\" unpacked with wrong size!
  2004.   fi
  2005.   # end of 'IPP/router/ShowStat.c'
  2006. fi
  2007. if test -f 'IPP/search' -a "${1}" != "-c" ; then 
  2008.   echo shar: Will not clobber existing file \"'IPP/search'\"
  2009. else
  2010.   echo shar: Extracting \"'IPP/search'\" \(198 characters\)
  2011.   sed "s/^X//" >'IPP/search' <<'END_OF_FILE'
  2012. X# This simple script is used to search for something in the source files
  2013. X
  2014. Xfind . \( -name '*.c' -o -name '*.h' \) -print |
  2015. Xwhile read f
  2016. Xdo
  2017. X   if grep "$1" $f
  2018. X      then
  2019. X      echo $f
  2020. X      fi
  2021. Xdone
  2022. X
  2023. END_OF_FILE
  2024.   if test 198 -ne `wc -c <'IPP/search'`; then
  2025.     echo shar: \"'IPP/search'\" unpacked with wrong size!
  2026.   fi
  2027.   chmod +x 'IPP/search'
  2028.   # end of 'IPP/search'
  2029. fi
  2030. echo shar: End of archive 6 \(of 6\).
  2031. cp /dev/null ark6isdone
  2032. MISSING=""
  2033. for I in 1 2 3 4 5 6 ; do
  2034.     if test ! -f ark${I}isdone ; then
  2035.     MISSING="${MISSING} ${I}"
  2036.     fi
  2037. done
  2038. if test "${MISSING}" = "" ; then
  2039.     echo You have unpacked all 6 archives.
  2040.     rm -f ark[1-9]isdone
  2041. else
  2042.     echo You still must unpack the following archives:
  2043.     echo "        " ${MISSING}
  2044. fi
  2045. exit 0
  2046. exit 0 # Just in case...
  2047.