home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-11-24 | 64.3 KB | 2,048 lines |
- Newsgroups: comp.sources.misc
- From: db15@ukc.ac.uk (Damiano Bolla)
- Subject: v40i164: ipp - IPP Routing Architecture Toolkit, Part06/06
- Message-ID: <1993Nov24.193929.7858@sparky.sterling.com>
- X-Md4-Signature: 02ee24973c9cf01bd71feb3245730906
- Sender: kent@sparky.sterling.com (Kent Landfield)
- Organization: Computing Lab, University of Kent at Canterbury, UK.
- Date: Wed, 24 Nov 1993 19:39:29 GMT
- Approved: kent@sparky.sterling.com
-
- Submitted-by: db15@ukc.ac.uk (Damiano Bolla)
- Posting-number: Volume 40, Issue 164
- Archive-name: ipp/part06
- Environment: INET
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: IPP/Makefile IPP/config/ex1/1.1links
- # IPP/config/ex1/1.20links IPP/config/ex1/1.30links
- # IPP/config/ex1/1.3config IPP/config/ex1/1.4config
- # IPP/config/ex1/1.5config IPP/config/ex1/10config
- # IPP/config/ex1/11config IPP/config/ex1/15links
- # IPP/config/ex1/16links IPP/config/ex1/2links
- # IPP/config/ex1/5config IPP/config/ex1/doscript
- # IPP/config/ex1/killrouter IPP/config/ex1/runhost
- # IPP/config/ex1/script IPP/config/ex2/2links IPP/config/ex2/3links
- # IPP/config/ex2/4links IPP/config/ex2/5links IPP/config/ex2/6config
- # IPP/config/ex2/7config IPP/config/ex2/8config
- # IPP/config/ex2/9config IPP/config/ex2/doscript
- # IPP/config/ex2/killrouter IPP/config/ex2/run
- # IPP/config/ex2/runhost IPP/config/ex2/script IPP/doall
- # IPP/ethernet/EthIo.c IPP/ethernet/EthStats.c IPP/ethernet/Makefile
- # IPP/host/Makefile IPP/host/README_config IPP/host/SendPacket.c
- # IPP/include/commands.h IPP/include/tcp.h IPP/include/watchdog.h
- # IPP/lib/Makefile IPP/lib/README IPP/lib/route/Makefile
- # IPP/lib/route/RecordRoute.c IPP/lib/utils/BeDaemon.c
- # IPP/lib/utils/ExistFd.c IPP/lib/utils/Makefile
- # IPP/lib/utils/README IPP/lib/utils/SeenAlready.c
- # IPP/lib/utils/TtyGets.c IPP/logd/Logtest.c IPP/logd/Makefile
- # IPP/monitor/Makefile IPP/monitor/README IPP/monitor/Receive.c
- # IPP/router/Makefile IPP/router/README IPP/router/RouterInit.c
- # IPP/router/ShowStat.c IPP/search
- # Wrapped by kent@sparky on Wed Nov 24 11:51:09 1993
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 6 (of 6)."'
- if test -f 'IPP/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/Makefile'\"
- else
- echo shar: Extracting \"'IPP/Makefile'\" \(94 characters\)
- sed "s/^X//" >'IPP/Makefile' <<'END_OF_FILE'
- Xall:
- X ./doall make
- X
- Xclean:
- X ./doall clean
- X
- Xtar: clean
- X tar -cf - * | gzip -c >../tmp/proj.gz
- X
- END_OF_FILE
- if test 94 -ne `wc -c <'IPP/Makefile'`; then
- echo shar: \"'IPP/Makefile'\" unpacked with wrong size!
- fi
- # end of 'IPP/Makefile'
- fi
- if test -f 'IPP/config/ex1/1.1links' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex1/1.1links'\"
- else
- echo shar: Extracting \"'IPP/config/ex1/1.1links'\" \(87 characters\)
- sed "s/^X//" >'IPP/config/ex1/1.1links' <<'END_OF_FILE'
- XListeningPort 2 stork 44940
- XListeningPort 3 stork 44941
- XListeningPort 4 stork 44942
- END_OF_FILE
- if test 87 -ne `wc -c <'IPP/config/ex1/1.1links'`; then
- echo shar: \"'IPP/config/ex1/1.1links'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex1/1.1links'
- fi
- if test -f 'IPP/config/ex1/1.20links' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex1/1.20links'\"
- else
- echo shar: Extracting \"'IPP/config/ex1/1.20links'\" \(58 characters\)
- sed "s/^X//" >'IPP/config/ex1/1.20links' <<'END_OF_FILE'
- XListeningPort 3 stork 44952
- XListeningPort 4 stork 44953
- END_OF_FILE
- if test 58 -ne `wc -c <'IPP/config/ex1/1.20links'`; then
- echo shar: \"'IPP/config/ex1/1.20links'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex1/1.20links'
- fi
- if test -f 'IPP/config/ex1/1.30links' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex1/1.30links'\"
- else
- echo shar: Extracting \"'IPP/config/ex1/1.30links'\" \(87 characters\)
- sed "s/^X//" >'IPP/config/ex1/1.30links' <<'END_OF_FILE'
- XListeningPort 2 stork 44945
- XListeningPort 3 stork 44947
- XListeningPort 4 stork 44948
- END_OF_FILE
- if test 87 -ne `wc -c <'IPP/config/ex1/1.30links'`; then
- echo shar: \"'IPP/config/ex1/1.30links'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex1/1.30links'
- fi
- if test -f 'IPP/config/ex1/1.3config' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex1/1.3config'\"
- else
- echo shar: Extracting \"'IPP/config/ex1/1.3config'\" \(857 characters\)
- sed "s/^X//" >'IPP/config/ex1/1.3config' <<'END_OF_FILE'
- X# The config file is quite strict in terms of layout, Comments MUST start with a #
- X# You cannot place comments anywhere you want...
- X# You are allowed blank lines...
- X# ONLY spaces are allowed as separators...
- X# The FIRST thing you have to write is the address of the router.,
- X
- XAddress 1.3
- X
- X# The n you have to write the interface specification.. the thing begins with
- X# a special keyword... otherwise it is too complicated.
- X# The other thing is tha all parameters fit in one line... in the following order
- X# Technology parameters
- X
- XInterface sock localhost 1027
- X
- X# The host needs to have a reference router. In theory is not needed since
- X# even a host should be able to do routing, but it makes things easy for now
- XRouter 1
- X
- X# then follows a list of hosts to talk to by means of a ping request
- XTalkTo 5
- XTalkTo 10
- XTalkTo 11
- X#TalkTo 1.3
- XTalkTo 1.4
- XTalkTo 1.5
- X
- X
- END_OF_FILE
- if test 857 -ne `wc -c <'IPP/config/ex1/1.3config'`; then
- echo shar: \"'IPP/config/ex1/1.3config'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex1/1.3config'
- fi
- if test -f 'IPP/config/ex1/1.4config' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex1/1.4config'\"
- else
- echo shar: Extracting \"'IPP/config/ex1/1.4config'\" \(857 characters\)
- sed "s/^X//" >'IPP/config/ex1/1.4config' <<'END_OF_FILE'
- X# The config file is quite strict in terms of layout, Comments MUST start with a #
- X# You cannot place comments anywhere you want...
- X# You are allowed blank lines...
- X# ONLY spaces are allowed as separators...
- X# The FIRST thing you have to write is the address of the router.,
- X
- XAddress 1.4
- X
- X# The n you have to write the interface specification.. the thing begins with
- X# a special keyword... otherwise it is too complicated.
- X# The other thing is tha all parameters fit in one line... in the following order
- X# Technology parameters
- X
- XInterface sock localhost 1027
- X
- X# The host needs to have a reference router. In theory is not needed since
- X# even a host should be able to do routing, but it makes things easy for now
- XRouter 30
- X
- X# then follows a list of hosts to talk to by means of a ping request
- XTalkTo 5
- XTalkTo 10
- XTalkTo 11
- XTalkTo 1.3
- X#TalkTo 1.4
- XTalkTo 1.5
- X
- END_OF_FILE
- if test 857 -ne `wc -c <'IPP/config/ex1/1.4config'`; then
- echo shar: \"'IPP/config/ex1/1.4config'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex1/1.4config'
- fi
- if test -f 'IPP/config/ex1/1.5config' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex1/1.5config'\"
- else
- echo shar: Extracting \"'IPP/config/ex1/1.5config'\" \(858 characters\)
- sed "s/^X//" >'IPP/config/ex1/1.5config' <<'END_OF_FILE'
- X# The config file is quite strict in terms of layout, Comments MUST start with a #
- X# You cannot place comments anywhere you want...
- X# You are allowed blank lines...
- X# ONLY spaces are allowed as separators...
- X# The FIRST thing you have to write is the address of the router.,
- X
- XAddress 1.5
- X
- X# The n you have to write the interface specification.. the thing begins with
- X# a special keyword... otherwise it is too complicated.
- X# The other thing is tha all parameters fit in one line... in the following order
- X# Technology parameters
- X
- XInterface sock localhost 1027
- X
- X# The host needs to have a reference router. In theory is not needed since
- X# even a host should be able to do routing, but it makes things easy for now
- XRouter 20
- X
- X# then follows a list of hosts to talk to by means of a ping request
- XTalkTo 5
- XTalkTo 10
- XTalkTo 11
- XTalkTo 1.3
- XTalkTo 1.4
- X#TalkTo 1.5
- X
- X
- END_OF_FILE
- if test 858 -ne `wc -c <'IPP/config/ex1/1.5config'`; then
- echo shar: \"'IPP/config/ex1/1.5config'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex1/1.5config'
- fi
- if test -f 'IPP/config/ex1/10config' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex1/10config'\"
- else
- echo shar: Extracting \"'IPP/config/ex1/10config'\" \(855 characters\)
- sed "s/^X//" >'IPP/config/ex1/10config' <<'END_OF_FILE'
- X# The config file is quite strict in terms of layout, Comments MUST start with a #
- X# You cannot place comments anywhere you want...
- X# You are allowed blank lines...
- X# ONLY spaces are allowed as separators...
- X# The FIRST thing you have to write is the address of the router.,
- X
- XAddress 10
- X
- X# The n you have to write the interface specification.. the thing begins with
- X# a special keyword... otherwise it is too complicated.
- X# The other thing is tha all parameters fit in one line... in the following order
- X# Technology parameters
- X
- XInterface sock localhost 1027
- X
- X# The host needs to have a reference router. In theory is not needed since
- X# even a host should be able to do routing, but it makes things easy for now
- XRouter 2
- X
- X# then follows a list of hosts to talk to by means of a ping request
- XTalkTo 5
- X#TalkTo 10
- XTalkTo 11
- XTalkTo 1.3
- XTalkTo 1.4
- XTalkTo 1.5
- X
- END_OF_FILE
- if test 855 -ne `wc -c <'IPP/config/ex1/10config'`; then
- echo shar: \"'IPP/config/ex1/10config'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex1/10config'
- fi
- if test -f 'IPP/config/ex1/11config' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex1/11config'\"
- else
- echo shar: Extracting \"'IPP/config/ex1/11config'\" \(857 characters\)
- sed "s/^X//" >'IPP/config/ex1/11config' <<'END_OF_FILE'
- X# The config file is quite strict in terms of layout, Comments MUST start with a #
- X# You cannot place comments anywhere you want...
- X# You are allowed blank lines...
- X# ONLY spaces are allowed as separators...
- X# The FIRST thing you have to write is the address of the router.,
- X
- XAddress 11
- X
- X# The n you have to write the interface specification.. the thing begins with
- X# a special keyword... otherwise it is too complicated.
- X# The other thing is tha all parameters fit in one line... in the following order
- X# Technology parameters
- X
- XInterface sock localhost 1027
- X
- X# The host needs to have a reference router. In theory is not needed since
- X# even a host should be able to do routing, but it makes things easy for now
- XRouter 16
- X
- X# then follows a list of hosts to talk to by means of a ping request
- XTalkTo 5
- XTalkTo 10
- X#TalkTo 11
- XTalkTo 1.3
- XTalkTo 1.4
- XTalkTo 1.5
- X
- X
- END_OF_FILE
- if test 857 -ne `wc -c <'IPP/config/ex1/11config'`; then
- echo shar: \"'IPP/config/ex1/11config'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex1/11config'
- fi
- if test -f 'IPP/config/ex1/15links' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex1/15links'\"
- else
- echo shar: Extracting \"'IPP/config/ex1/15links'\" \(87 characters\)
- sed "s/^X//" >'IPP/config/ex1/15links' <<'END_OF_FILE'
- XListeningPort 2 stork 44930
- XListeningPort 3 stork 44932
- XListeningPort 4 stork 44933
- END_OF_FILE
- if test 87 -ne `wc -c <'IPP/config/ex1/15links'`; then
- echo shar: \"'IPP/config/ex1/15links'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex1/15links'
- fi
- if test -f 'IPP/config/ex1/16links' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex1/16links'\"
- else
- echo shar: Extracting \"'IPP/config/ex1/16links'\" \(87 characters\)
- sed "s/^X//" >'IPP/config/ex1/16links' <<'END_OF_FILE'
- XListeningPort 2 stork 44935
- XListeningPort 3 stork 44937
- XListeningPort 4 stork 44938
- END_OF_FILE
- if test 87 -ne `wc -c <'IPP/config/ex1/16links'`; then
- echo shar: \"'IPP/config/ex1/16links'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex1/16links'
- fi
- if test -f 'IPP/config/ex1/2links' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex1/2links'\"
- else
- echo shar: Extracting \"'IPP/config/ex1/2links'\" \(116 characters\)
- sed "s/^X//" >'IPP/config/ex1/2links' <<'END_OF_FILE'
- XListeningPort 1 stork 44925
- XListeningPort 2 stork 44926
- XListeningPort 3 stork 44927
- XListeningPort 4 stork 44928
- END_OF_FILE
- if test 116 -ne `wc -c <'IPP/config/ex1/2links'`; then
- echo shar: \"'IPP/config/ex1/2links'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex1/2links'
- fi
- if test -f 'IPP/config/ex1/5config' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex1/5config'\"
- else
- echo shar: Extracting \"'IPP/config/ex1/5config'\" \(855 characters\)
- sed "s/^X//" >'IPP/config/ex1/5config' <<'END_OF_FILE'
- X# The config file is quite strict in terms of layout, Comments MUST start with a #
- X# You cannot place comments anywhere you want...
- X# You are allowed blank lines...
- X# ONLY spaces are allowed as separators...
- X# The FIRST thing you have to write is the address of the router.,
- X
- XAddress 5
- X
- X# The n you have to write the interface specification.. the thing begins with
- X# a special keyword... otherwise it is too complicated.
- X# The other thing is tha all parameters fit in one line... in the following order
- X# Technology parameters
- X
- XInterface sock localhost 1027
- X
- X# The host needs to have a reference router. In theory is not needed since
- X# even a host should be able to do routing, but it makes things easy for now
- XRouter 15
- X
- X# then follows a list of hosts to talk to by means of a ping request
- X#TalkTo 5
- XTalkTo 10
- XTalkTo 11
- XTalkTo 1.3
- XTalkTo 1.4
- XTalkTo 1.5
- X
- END_OF_FILE
- if test 855 -ne `wc -c <'IPP/config/ex1/5config'`; then
- echo shar: \"'IPP/config/ex1/5config'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex1/5config'
- fi
- if test -f 'IPP/config/ex1/doscript' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex1/doscript'\"
- else
- echo shar: Extracting \"'IPP/config/ex1/doscript'\" \(552 characters\)
- sed "s/^X//" >'IPP/config/ex1/doscript' <<'END_OF_FILE'
- X# This function extract link information and then prepare them to be used
- X# by sed to form the right config file for the router.
- X# It wants three parameters
- X# NOTE: It ONLY appends informations at the end of script !
- X# 1) The router from where to extract the informations
- X# 2) The link to extract the informations
- X# 3) The interface the link has to be wired on
- X
- Xcat ${1}links | while read word ifn host port
- X do
- X if [ "$ifn" = "$2" ]; then
- X echo "s/^Interface ${3} sock no .*\$/Interface ${3} sock no localhost ${port}/" >>script
- X fi
- Xdone
- X
- END_OF_FILE
- if test 552 -ne `wc -c <'IPP/config/ex1/doscript'`; then
- echo shar: \"'IPP/config/ex1/doscript'\" unpacked with wrong size!
- fi
- chmod +x 'IPP/config/ex1/doscript'
- # end of 'IPP/config/ex1/doscript'
- fi
- if test -f 'IPP/config/ex1/killrouter' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex1/killrouter'\"
- else
- echo shar: Extracting \"'IPP/config/ex1/killrouter'\" \(142 characters\)
- sed "s/^X//" >'IPP/config/ex1/killrouter' <<'END_OF_FILE'
- X#ps -aux | grep router | while read user uid altro
- Xps -ef | grep router | while read user uid altro
- Xdo
- X echo killing $uid
- X kill $uid
- Xdone
- END_OF_FILE
- if test 142 -ne `wc -c <'IPP/config/ex1/killrouter'`; then
- echo shar: \"'IPP/config/ex1/killrouter'\" unpacked with wrong size!
- fi
- chmod +x 'IPP/config/ex1/killrouter'
- # end of 'IPP/config/ex1/killrouter'
- fi
- if test -f 'IPP/config/ex1/runhost' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex1/runhost'\"
- else
- echo shar: Extracting \"'IPP/config/ex1/runhost'\" \(468 characters\)
- sed "s/^X//" >'IPP/config/ex1/runhost' <<'END_OF_FILE'
- X#!/bin/sh
- X# This starts a host it requires three parameters
- X# 1) The router to be connected to , just the IPP number, ex: 1.1
- X# 2) The interface to use of thet router, ex: 2
- X# 3) The address of this host , just the IPP nbumber, ex: 1.3
- X
- Xscript=/tmp/script$$
- X
- Xcat ${1}links | while read word ifn host port
- Xdo
- X if [ "$ifn" = "$2" ]; then
- X echo "s/^Interface sock .*\$/Interface sock localhost ${port}/" >$script
- X fi
- Xdone
- Xsed -f $script <${3}config | host
- Xrm $script
- END_OF_FILE
- if test 468 -ne `wc -c <'IPP/config/ex1/runhost'`; then
- echo shar: \"'IPP/config/ex1/runhost'\" unpacked with wrong size!
- fi
- chmod +x 'IPP/config/ex1/runhost'
- # end of 'IPP/config/ex1/runhost'
- fi
- if test -f 'IPP/config/ex1/script' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex1/script'\"
- else
- echo shar: Extracting \"'IPP/config/ex1/script'\" \(128 characters\)
- sed "s/^X//" >'IPP/config/ex1/script' <<'END_OF_FILE'
- Xs/^Interface 2 sock no .*$/Interface 2 sock no localhost 44945/
- Xs/^Interface 1 sock no .*$/Interface 1 sock no localhost 44937/
- END_OF_FILE
- if test 128 -ne `wc -c <'IPP/config/ex1/script'`; then
- echo shar: \"'IPP/config/ex1/script'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex1/script'
- fi
- if test -f 'IPP/config/ex2/2links' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex2/2links'\"
- else
- echo shar: Extracting \"'IPP/config/ex2/2links'\" \(145 characters\)
- sed "s/^X//" >'IPP/config/ex2/2links' <<'END_OF_FILE'
- XListeningPort 1 stork 44975
- XListeningPort 2 stork 44976
- XListeningPort 3 stork 44977
- XListeningPort 4 stork 44978
- XListeningPort 5 stork 44979
- END_OF_FILE
- if test 145 -ne `wc -c <'IPP/config/ex2/2links'`; then
- echo shar: \"'IPP/config/ex2/2links'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex2/2links'
- fi
- if test -f 'IPP/config/ex2/3links' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex2/3links'\"
- else
- echo shar: Extracting \"'IPP/config/ex2/3links'\" \(116 characters\)
- sed "s/^X//" >'IPP/config/ex2/3links' <<'END_OF_FILE'
- XListeningPort 1 stork 44980
- XListeningPort 2 stork 44981
- XListeningPort 3 stork 44982
- XListeningPort 5 stork 44984
- END_OF_FILE
- if test 116 -ne `wc -c <'IPP/config/ex2/3links'`; then
- echo shar: \"'IPP/config/ex2/3links'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex2/3links'
- fi
- if test -f 'IPP/config/ex2/4links' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex2/4links'\"
- else
- echo shar: Extracting \"'IPP/config/ex2/4links'\" \(87 characters\)
- sed "s/^X//" >'IPP/config/ex2/4links' <<'END_OF_FILE'
- XListeningPort 1 stork 44986
- XListeningPort 2 stork 44987
- XListeningPort 5 stork 44991
- END_OF_FILE
- if test 87 -ne `wc -c <'IPP/config/ex2/4links'`; then
- echo shar: \"'IPP/config/ex2/4links'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex2/4links'
- fi
- if test -f 'IPP/config/ex2/5links' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex2/5links'\"
- else
- echo shar: Extracting \"'IPP/config/ex2/5links'\" \(58 characters\)
- sed "s/^X//" >'IPP/config/ex2/5links' <<'END_OF_FILE'
- XListeningPort 1 stork 44995
- XListeningPort 5 stork 45001
- END_OF_FILE
- if test 58 -ne `wc -c <'IPP/config/ex2/5links'`; then
- echo shar: \"'IPP/config/ex2/5links'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex2/5links'
- fi
- if test -f 'IPP/config/ex2/6config' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex2/6config'\"
- else
- echo shar: Extracting \"'IPP/config/ex2/6config'\" \(819 characters\)
- sed "s/^X//" >'IPP/config/ex2/6config' <<'END_OF_FILE'
- X# The config file is quite strict in terms of layout, Comments MUST start with a #
- X# You cannot place comments anywhere you want...
- X# You are allowed blank lines...
- X# ONLY spaces are allowed as separators...
- X# The FIRST thing you have to write is the address of the router.,
- X
- XAddress 6
- X
- X# The n you have to write the interface specification.. the thing begins with
- X# a special keyword... otherwise it is too complicated.
- X# The other thing is tha all parameters fit in one line... in the following order
- X# Technology parameters
- X
- XInterface sock localhost 1631
- X
- X# The host needs to have a reference router. In theory is not needed since
- X# even a host should be able to do routing, but it makes things easy for now
- XRouter 2
- X
- X# then follows a list of hosts to talk to by means of a ping request
- XTalkTo 7
- XTalkTo 8
- XTalkTo 9
- X
- X
- END_OF_FILE
- if test 819 -ne `wc -c <'IPP/config/ex2/6config'`; then
- echo shar: \"'IPP/config/ex2/6config'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex2/6config'
- fi
- if test -f 'IPP/config/ex2/7config' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex2/7config'\"
- else
- echo shar: Extracting \"'IPP/config/ex2/7config'\" \(819 characters\)
- sed "s/^X//" >'IPP/config/ex2/7config' <<'END_OF_FILE'
- X# The config file is quite strict in terms of layout, Comments MUST start with a #
- X# You cannot place comments anywhere you want...
- X# You are allowed blank lines...
- X# ONLY spaces are allowed as separators...
- X# The FIRST thing you have to write is the address of the router.,
- X
- XAddress 7
- X
- X# The n you have to write the interface specification.. the thing begins with
- X# a special keyword... otherwise it is too complicated.
- X# The other thing is tha all parameters fit in one line... in the following order
- X# Technology parameters
- X
- XInterface sock localhost 1027
- X
- X# The host needs to have a reference router. In theory is not needed since
- X# even a host should be able to do routing, but it makes things easy for now
- XRouter 3
- X
- X# then follows a list of hosts to talk to by means of a ping request
- XTalkTo 6
- XTalkTo 8
- XTalkTo 9
- X
- X
- END_OF_FILE
- if test 819 -ne `wc -c <'IPP/config/ex2/7config'`; then
- echo shar: \"'IPP/config/ex2/7config'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex2/7config'
- fi
- if test -f 'IPP/config/ex2/8config' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex2/8config'\"
- else
- echo shar: Extracting \"'IPP/config/ex2/8config'\" \(845 characters\)
- sed "s/^X//" >'IPP/config/ex2/8config' <<'END_OF_FILE'
- X# The config file is quite strict in terms of layout, Comments MUST start with a #
- X# You cannot place comments anywhere you want...
- X# You are allowed blank lines...
- X# ONLY spaces are allowed as separators...
- X# The FIRST thing you have to write is the address of the router.,
- X
- XAddress 8
- X
- X# The n you have to write the interface specification.. the thing begins with
- X# a special keyword... otherwise it is too complicated.
- X# The other thing is tha all parameters fit in one line... in the following order
- X# Technology parameters
- X
- XInterface sock localhost 1027
- X
- X# The host needs to have a reference router. In theory is not needed since
- X# even a host should be able to do routing, but it makes things easy for now
- XRouter 4
- X
- X# then follows a list of hosts to talk to by means of a ping request
- XTalkTo 6
- XTalkTo 7
- XTalkTo 9
- X#TalkTo 2.12
- X#TalkTo 2.13
- X
- X
- END_OF_FILE
- if test 845 -ne `wc -c <'IPP/config/ex2/8config'`; then
- echo shar: \"'IPP/config/ex2/8config'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex2/8config'
- fi
- if test -f 'IPP/config/ex2/9config' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex2/9config'\"
- else
- echo shar: Extracting \"'IPP/config/ex2/9config'\" \(845 characters\)
- sed "s/^X//" >'IPP/config/ex2/9config' <<'END_OF_FILE'
- X# The config file is quite strict in terms of layout, Comments MUST start with a #
- X# You cannot place comments anywhere you want...
- X# You are allowed blank lines...
- X# ONLY spaces are allowed as separators...
- X# The FIRST thing you have to write is the address of the router.,
- X
- XAddress 9
- X
- X# The n you have to write the interface specification.. the thing begins with
- X# a special keyword... otherwise it is too complicated.
- X# The other thing is tha all parameters fit in one line... in the following order
- X# Technology parameters
- X
- XInterface sock localhost 1027
- X
- X# The host needs to have a reference router. In theory is not needed since
- X# even a host should be able to do routing, but it makes things easy for now
- XRouter 5
- X
- X# then follows a list of hosts to talk to by means of a ping request
- XTalkTo 6
- XTalkTo 7
- XTalkTo 8
- X#TalkTo 2.12
- X#TalkTo 2.13
- X
- X
- END_OF_FILE
- if test 845 -ne `wc -c <'IPP/config/ex2/9config'`; then
- echo shar: \"'IPP/config/ex2/9config'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex2/9config'
- fi
- if test -f 'IPP/config/ex2/doscript' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex2/doscript'\"
- else
- echo shar: Extracting \"'IPP/config/ex2/doscript'\" \(552 characters\)
- sed "s/^X//" >'IPP/config/ex2/doscript' <<'END_OF_FILE'
- X# This function extract link information and then prepare them to be used
- X# by sed to form the right config file for the router.
- X# It wants three parameters
- X# NOTE: It ONLY appends informations at the end of script !
- X# 1) The router from where to extract the informations
- X# 2) The link to extract the informations
- X# 3) The interface the link has to be wired on
- X
- Xcat ${1}links | while read word ifn host port
- X do
- X if [ "$ifn" = "$2" ]; then
- X echo "s/^Interface ${3} sock no .*\$/Interface ${3} sock no localhost ${port}/" >>script
- X fi
- Xdone
- X
- END_OF_FILE
- if test 552 -ne `wc -c <'IPP/config/ex2/doscript'`; then
- echo shar: \"'IPP/config/ex2/doscript'\" unpacked with wrong size!
- fi
- chmod +x 'IPP/config/ex2/doscript'
- # end of 'IPP/config/ex2/doscript'
- fi
- if test -f 'IPP/config/ex2/killrouter' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex2/killrouter'\"
- else
- echo shar: Extracting \"'IPP/config/ex2/killrouter'\" \(91 characters\)
- sed "s/^X//" >'IPP/config/ex2/killrouter' <<'END_OF_FILE'
- Xps -ef | grep router | while read user uid altro
- Xdo
- X echo killing $uid
- X kill $uid
- Xdone
- END_OF_FILE
- if test 91 -ne `wc -c <'IPP/config/ex2/killrouter'`; then
- echo shar: \"'IPP/config/ex2/killrouter'\" unpacked with wrong size!
- fi
- chmod +x 'IPP/config/ex2/killrouter'
- # end of 'IPP/config/ex2/killrouter'
- fi
- if test -f 'IPP/config/ex2/run' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex2/run'\"
- else
- echo shar: Extracting \"'IPP/config/ex2/run'\" \(1328 characters\)
- sed "s/^X//" >'IPP/config/ex2/run' <<'END_OF_FILE'
- X#!/bin/sh
- X
- XPATH=.:$PATH; export PATH
- X
- X# ------------------------------------------------------------------------
- Xrouter <2config >2links &
- Xecho "Router 2 started"
- Xsleep 2
- X
- X# ---------------------------------------------------------------------------
- X>script
- Xdoscript 2 2 4
- Xsed -f script <3config | router >3links &
- Xecho "Router 3 started"
- Xsleep 2
- X
- X# ---------------------------------------------------------------------------
- X>script
- Xdoscript 2 3 3
- Xdoscript 3 2 4
- Xsed -f script <4config | router >4links &
- Xecho "Router 4 started"
- Xsleep 2
- X
- X
- X# ---------------------------------------------------------------------------
- X>script
- Xdoscript 2 4 2
- Xdoscript 3 3 3
- Xdoscript 4 2 4
- Xsed -f script <5config | router >5links &
- Xecho "Router 5 started"
- Xsleep 2
- X
- X# ---------------------------------------------------------------------------
- X# The runhost requires three parameters
- X# 1) The router to be connected to , just the IPP number, ex: 1.1
- X# 2) The interface to use of thet router, ex: 2
- X# 3) The address of this host , just the IPP nbumber, ex: 1.3
- X
- Xxterm -geometry 26x55+1378+0 -e runhost 2 1 6 &
- Xecho "Host 6 started"
- X
- Xxterm -geometry 27x55+1833+0 -e runhost 3 1 7 &
- Xecho "Host 7 started"
- X
- Xxterm -geometry 26x55+1605+0 -e runhost 4 1 8 &
- Xecho "Host 8 started"
- X
- Xxterm -geometry 28x55+2066+0 -e runhost 5 1 9 &
- Xecho "Host 9 started"
- X
- X
- END_OF_FILE
- if test 1328 -ne `wc -c <'IPP/config/ex2/run'`; then
- echo shar: \"'IPP/config/ex2/run'\" unpacked with wrong size!
- fi
- chmod +x 'IPP/config/ex2/run'
- # end of 'IPP/config/ex2/run'
- fi
- if test -f 'IPP/config/ex2/runhost' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex2/runhost'\"
- else
- echo shar: Extracting \"'IPP/config/ex2/runhost'\" \(468 characters\)
- sed "s/^X//" >'IPP/config/ex2/runhost' <<'END_OF_FILE'
- X#!/bin/sh
- X# This starts a host it requires three parameters
- X# 1) The router to be connected to , just the IPP number, ex: 1.1
- X# 2) The interface to use of thet router, ex: 2
- X# 3) The address of this host , just the IPP nbumber, ex: 1.3
- X
- Xscript=/tmp/script$$
- X
- Xcat ${1}links | while read word ifn host port
- Xdo
- X if [ "$ifn" = "$2" ]; then
- X echo "s/^Interface sock .*\$/Interface sock localhost ${port}/" >$script
- X fi
- Xdone
- Xsed -f $script <${3}config | host
- Xrm $script
- END_OF_FILE
- if test 468 -ne `wc -c <'IPP/config/ex2/runhost'`; then
- echo shar: \"'IPP/config/ex2/runhost'\" unpacked with wrong size!
- fi
- chmod +x 'IPP/config/ex2/runhost'
- # end of 'IPP/config/ex2/runhost'
- fi
- if test -f 'IPP/config/ex2/script' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/config/ex2/script'\"
- else
- echo shar: Extracting \"'IPP/config/ex2/script'\" \(192 characters\)
- sed "s/^X//" >'IPP/config/ex2/script' <<'END_OF_FILE'
- Xs/^Interface 2 sock no .*$/Interface 2 sock no localhost 44978/
- Xs/^Interface 3 sock no .*$/Interface 3 sock no localhost 44982/
- Xs/^Interface 4 sock no .*$/Interface 4 sock no localhost 44987/
- END_OF_FILE
- if test 192 -ne `wc -c <'IPP/config/ex2/script'`; then
- echo shar: \"'IPP/config/ex2/script'\" unpacked with wrong size!
- fi
- # end of 'IPP/config/ex2/script'
- fi
- if test -f 'IPP/doall' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/doall'\"
- else
- echo shar: Extracting \"'IPP/doall'\" \(425 characters\)
- sed "s/^X//" >'IPP/doall' <<'END_OF_FILE'
- X# Very simple script to do recursive Makefile.
- X# I should do it properly one day..
- X
- Xcurrent=`pwd`
- Xsubdirs="lib/utils lib/route lib ethernet host logd router monitor"
- X
- Xif [ "$1" = "make" ]; then
- X for d in $subdirs
- X do
- X cd $current/$d
- X make clean
- X sync
- X make
- X sync
- X done
- X fi
- X
- Xif [ "$1" = "clean" ]; then
- X for d in $subdirs
- X do
- X cd $current/$d
- X make clean
- X sync
- X done
- X fi
- END_OF_FILE
- if test 425 -ne `wc -c <'IPP/doall'`; then
- echo shar: \"'IPP/doall'\" unpacked with wrong size!
- fi
- chmod +x 'IPP/doall'
- # end of 'IPP/doall'
- fi
- if test -f 'IPP/ethernet/EthIo.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/ethernet/EthIo.c'\"
- else
- echo shar: Extracting \"'IPP/ethernet/EthIo.c'\" \(1091 characters\)
- sed "s/^X//" >'IPP/ethernet/EthIo.c' <<'END_OF_FILE'
- X/* -----------------------------------------------------------------------------
- X * Ident: EthIo.c
- X * Author: Damiano Bolla 1993
- X * All this project is covered by the GNU Copyright.
- X */
- X
- X
- X#include <stdio.h>
- X#include <string.h>
- X#include <sys/types.h>
- X#include <sys/socket.h>
- X#include <sys/time.h>
- X#include <netinet/in.h>
- X#include "defs.h"
- X#include "debug.h"
- X#include "ethernet.h"
- X#include "func_defs.h"
- X
- Xextern struct Debug dbg;
- X
- X/* What this does is to read from the selected iofd and do teh appropriate thing
- X */
- X
- Xint EthIo ( struct Ethernet *eth )
- X {
- X int c;
- X int Newsocket;
- X char Msg[CONF_LLEN+2];
- X
- X /* Let's see if there is a new incoming connection.. */
- X if ( FD_ISSET (eth->ListenFd, ð->readfds))
- X if ( Accept ( eth->ListenFd, &Newsocket, Msg, CONF_LLEN ) == DONE )
- X EthParseCall ( eth, Newsocket, Msg );
- X
- X /* What I have to do is to go trough all the available fd and check them */
- X for (c=0; c<ADDR_NUM; c++)
- X {
- X if ( eth->IoFd[c] && (FD_ISSET (eth->IoFd[c], ð->readfds)) )
- X ProcessPacket ( eth, c);
- X }
- X
- X return (DONE);
- X }
- X
- END_OF_FILE
- if test 1091 -ne `wc -c <'IPP/ethernet/EthIo.c'`; then
- echo shar: \"'IPP/ethernet/EthIo.c'\" unpacked with wrong size!
- fi
- # end of 'IPP/ethernet/EthIo.c'
- fi
- if test -f 'IPP/ethernet/EthStats.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/ethernet/EthStats.c'\"
- else
- echo shar: Extracting \"'IPP/ethernet/EthStats.c'\" \(1001 characters\)
- sed "s/^X//" >'IPP/ethernet/EthStats.c' <<'END_OF_FILE'
- X/* -----------------------------------------------------------------------------
- X * Ident: EthStats.h
- X * Author: Damiano Bolla 1993
- X * All this project is covered by the GNU Copyright.
- X */
- X
- X#include <stdio.h>
- X#include <unistd.h>
- X#include <string.h>
- X#include <sys/types.h>
- X#include <sys/socket.h>
- X#include <sys/time.h>
- X#include <netinet/in.h>
- X#include "defs.h"
- X#include "debug.h"
- X#include "ethernet.h"
- X#include "func_defs.h"
- X
- Xextern struct Debug dbg;
- X
- X/* This bit sends statistics out to who requested them.
- X * Should be fine...
- X */
- X
- Xint EthStats ( struct Ethernet *eth, int fd )
- X {
- X int c;
- X char buff[IPP_DATA+2];
- X
- X for ( c=0; c<ADDR_NUM; c++ )
- X if ( eth->IoFd[c] )
- X {
- X sprintf (buff, "Address %d is bound to channel %d \n",c,eth->IoFd[c]);
- X write (fd, buff, strlen(buff));
- X }
- X
- X sprintf (buff, "Idle time %d \n",eth->Idle);
- X write (fd, buff, strlen(buff));
- X
- X sprintf (buff, "Debug Level %d \n",dbg.current_level);
- X write (fd, buff, strlen(buff));
- X
- X return (DONE);
- X }
- X
- X
- END_OF_FILE
- if test 1001 -ne `wc -c <'IPP/ethernet/EthStats.c'`; then
- echo shar: \"'IPP/ethernet/EthStats.c'\" unpacked with wrong size!
- fi
- # end of 'IPP/ethernet/EthStats.c'
- fi
- if test -f 'IPP/ethernet/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/ethernet/Makefile'\"
- else
- echo shar: Extracting \"'IPP/ethernet/Makefile'\" \(303 characters\)
- sed "s/^X//" >'IPP/ethernet/Makefile' <<'END_OF_FILE'
- XINC=../include
- XCC=gcc
- XLIBIPP=../lib/libipp.a
- XSOCKLIB=-lsocket -lnsl
- XCFLAGS=-I$(INC) -g
- X
- XOBJ=Tnet.o EthStats.o EthIo.o EthParseCall.o NewAddress.o ProcessPacket.o
- X
- XTnet: $(LIBIPP) $(OBJ)
- X gcc $(OBJ) $(LIBIPP) $(SOCKLIB) -o Tnet
- X
- Xclean:
- X rm -f *.o Tnet core errlist
- X
- X.c.o:
- X $(CC) $(CFLAGS) -c -o $*.o $<
- END_OF_FILE
- if test 303 -ne `wc -c <'IPP/ethernet/Makefile'`; then
- echo shar: \"'IPP/ethernet/Makefile'\" unpacked with wrong size!
- fi
- # end of 'IPP/ethernet/Makefile'
- fi
- if test -f 'IPP/host/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/host/Makefile'\"
- else
- echo shar: Extracting \"'IPP/host/Makefile'\" \(262 characters\)
- sed "s/^X//" >'IPP/host/Makefile' <<'END_OF_FILE'
- XINC=../include
- XCC=gcc
- XLIBIPP=../lib/libipp.a
- XCFLAGS=-I$(INC) -g
- X
- XOBJ=host.o HostInit.o ReceivePacket.o SendPacket.o
- X
- Xrouter:$(OBJ) $(LIBIPP)
- X $(CC) $(OBJ) $(LIBIPP) $(SOCKLIB) -o host
- X
- Xclean:
- X rm -f *.o host core errlist
- X
- X.c.o:
- X $(CC) $(CFLAGS) -c -o $*.o $<
- X
- END_OF_FILE
- if test 262 -ne `wc -c <'IPP/host/Makefile'`; then
- echo shar: \"'IPP/host/Makefile'\" unpacked with wrong size!
- fi
- # end of 'IPP/host/Makefile'
- fi
- if test -f 'IPP/host/README_config' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/host/README_config'\"
- else
- echo shar: Extracting \"'IPP/host/README_config'\" \(1023 characters\)
- sed "s/^X//" >'IPP/host/README_config' <<'END_OF_FILE'
- X# This is an exmaple of config for a host
- X# The config file is quite strict in terms of layout, Comments MUST start with a #
- X# You cannot place comments anywhere you want...
- X# You are allowed blank lines...
- X# ONLY spaces are allowed as separators...
- X# The FIRST thing you have to write is the address of the router.,
- X
- XAddress 10
- X
- X# The n you have to write the interface specification.. the thing begins with
- X# a special keyword... otherwise it is too complicated.
- X# The other thing is tha all parameters fit in one line... in the following order
- X# Technology parameters
- X
- XInterface sock localhost 1027
- X
- X# The host needs to have a reference router. In theory is not needed since
- X# even a host should be able to do routing, but it makes things easy for now
- X# NOTE: The router address given here is just the single trailing byte of
- X# the router address.
- X
- XRouter 2
- X
- X# then follows a list of hosts to talk to by means of a ping request
- X# IN this case you have to specify the full address.
- X
- XTalkTo 5
- X#TalkTo 2.12
- X#TalkTo 2.13
- X
- X
- END_OF_FILE
- if test 1023 -ne `wc -c <'IPP/host/README_config'`; then
- echo shar: \"'IPP/host/README_config'\" unpacked with wrong size!
- fi
- # end of 'IPP/host/README_config'
- fi
- if test -f 'IPP/host/SendPacket.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/host/SendPacket.c'\"
- else
- echo shar: Extracting \"'IPP/host/SendPacket.c'\" \(1414 characters\)
- sed "s/^X//" >'IPP/host/SendPacket.c' <<'END_OF_FILE'
- X/* ------------------------------------------------------------------------------
- X * Ident: SendPacket.c
- X * Author: Damiano Bolla 1993
- X * All this project is covered by the GNU Copyright.
- X */
- X
- X#include <stdio.h>
- X#include <string.h>
- X#include <sys/types.h>
- X#include <sys/socket.h>
- X#include <netdb.h>
- X#include <sys/time.h>
- X#include <netinet/in.h>
- X#include "defs.h"
- X#include "debug.h"
- X#include "packet.h"
- X#include "router.h"
- X#include "host.h"
- X#include "func_defs.h"
- X
- Xextern struct Debug dbg;
- X
- Xint SendPacket ( struct Host *hostdata )
- X {
- X int c;
- X int Eof;
- X u_char Mylastbyte;
- X struct IPPaddr *dest;
- X struct IPP ippS;
- X
- X Mylastbyte = hostdata->Myaddr.Addr[hostdata->Myaddr.Al -1];
- X
- X c=hostdata->CurPeer+1;
- X if ( (c>=PEER_MAX) || (hostdata->Peer[c].Peer.Al==0) ) c=0;
- X
- X dest = &hostdata->Peer[c].Peer;
- X hostdata->CurPeer = c;
- X
- X ippS.Type = PTYPE_RR;
- X ipp_AtoS ( &hostdata->Myaddr, &ippS );
- X ipp_AtoR ( dest, &ippS );
- X ippS.NextRouter = NOT_USED;
- X ippS.NextHop = hostdata->Router;
- X ippS.From = Mylastbyte;
- X ippS.Sender = Mylastbyte;
- X ippS.PackId = ++(hostdata->PackId);
- X
- X ippS.Depth=0;
- X ippS.TTL=INIT_TTL;
- X
- X/*
- X sprintf (ippS.Data,"Packid %d",hostdata->PackId);
- X ippS.DataLen = strlen(ippS.Data);
- X*/
- X ippS.DataLen = 0;
- X
- X Eof = FALSE;
- X if ( SndPack( &ippS, hostdata->NetFd, &Eof) ) printf ("Send failed \n");
- X if ( Eof ) return (NOT_DONE);
- X
- X return (DONE);
- X }
- END_OF_FILE
- if test 1414 -ne `wc -c <'IPP/host/SendPacket.c'`; then
- echo shar: \"'IPP/host/SendPacket.c'\" unpacked with wrong size!
- fi
- # end of 'IPP/host/SendPacket.c'
- fi
- if test -f 'IPP/include/commands.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/include/commands.h'\"
- else
- echo shar: Extracting \"'IPP/include/commands.h'\" \(1092 characters\)
- sed "s/^X//" >'IPP/include/commands.h' <<'END_OF_FILE'
- X/* ----------------------------------------------------------------------
- X * AUthor: Damiano Bolla, 1993
- X * All this project is covered by the GNU Copyright.
- X */
- X
- X#ifndef COMMANDS_H
- X#define COMMANDS_H
- X
- X
- X/* This file holds the various commands allowed in the system
- X */
- X
- X#define CMD_SHOW "Show" /* Used to show thingsd */
- X#define CMD_SET "Set" /* Used to set things in a system */
- X#define CMD_STAT "Stat" /* Return statistics */
- X#define CMD_ADDR "Address" /* Associate and address */
- X#define CMD_INTERFACE "Interface" /* Set up an intrface */
- X#define CMD_ROUTE "Route" /* Set a route */
- X#define CMD_DEBUG "Debug" /* Set the debugging level */
- X#define CMD_EXIT "Exit" /* Say that you want to kill the prog */
- X#define CMD_ROUTER "Router"
- X#define CMD_TALKTO "talkto"
- X#define SAY_YES "Yes" /* This is yes :-) Can be si... */
- X#define SAY_NO "No" /* This is no :-) Can be none... */
- X#define LEV_NET "Net" /* To specify the routing level */
- X#define LEV_HOST "Host" /* To specify the routing level */
- X#define LEV_PARENT "Parent" /* To specify the routing level */
- X
- X#endif
- END_OF_FILE
- if test 1092 -ne `wc -c <'IPP/include/commands.h'`; then
- echo shar: \"'IPP/include/commands.h'\" unpacked with wrong size!
- fi
- # end of 'IPP/include/commands.h'
- fi
- if test -f 'IPP/include/tcp.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/include/tcp.h'\"
- else
- echo shar: Extracting \"'IPP/include/tcp.h'\" \(656 characters\)
- sed "s/^X//" >'IPP/include/tcp.h' <<'END_OF_FILE'
- X/* ----------------------------------------------------------------------
- X * AUthor: Damiano Bolla, 1993
- X * All this project is covered by the GNU Copyright.
- X */
- X
- X#ifndef TCP_H
- X#define TCP_H
- X
- X/* This file contains the various constants that are used by the TCP system */
- X
- X#define SHUT_RECV 0 /* Codice per shutdown */
- X#define SHUT_SEND 1 /* Codice per shutdown */
- X#define SHUT_ALL 2 /* Codice per shutdown */
- X#define SOCK_QUIK 0 /* Per SO_LINGER */
- X#define SOCK_SLOW 1 /* Per SO_LINGER */
- X
- X
- X#endif
- END_OF_FILE
- if test 656 -ne `wc -c <'IPP/include/tcp.h'`; then
- echo shar: \"'IPP/include/tcp.h'\" unpacked with wrong size!
- fi
- # end of 'IPP/include/tcp.h'
- fi
- if test -f 'IPP/include/watchdog.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/include/watchdog.h'\"
- else
- echo shar: Extracting \"'IPP/include/watchdog.h'\" \(461 characters\)
- sed "s/^X//" >'IPP/include/watchdog.h' <<'END_OF_FILE'
- X/* ----------------------------------------------------------------------
- X * AUthor: Damiano Bolla, 1993
- X * All this project is covered by the GNU Copyright.
- X */
- X
- X#ifndef WATCHDOG_H
- X#define WATCHDOG_H
- X
- X/* This file specify the structure of a watchdog system.
- X * There are many thing that are needed in hndling a watchdog, this structure
- X * will hold them.
- X */
- X
- Xstruct Watch
- X {
- X void (*Handler)(); /* I also need the handler of rthe error */
- X };
- X
- X
- X#endif
- END_OF_FILE
- if test 461 -ne `wc -c <'IPP/include/watchdog.h'`; then
- echo shar: \"'IPP/include/watchdog.h'\" unpacked with wrong size!
- fi
- # end of 'IPP/include/watchdog.h'
- fi
- if test -f 'IPP/lib/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/lib/Makefile'\"
- else
- echo shar: Extracting \"'IPP/lib/Makefile'\" \(200 characters\)
- sed "s/^X//" >'IPP/lib/Makefile' <<'END_OF_FILE'
- X
- Xlibipp:
- X rm -f libipp.a
- X ar rcvs libipp.a utils/*.o route/*.o
- X
- X# If on BSD use the two following lines.
- X# ar rcv libipp.a utils/*.o route/*.o
- X# ranlib libipp.a
- X
- Xclean:
- X rm -f libipp.a core errlist
- X
- END_OF_FILE
- if test 200 -ne `wc -c <'IPP/lib/Makefile'`; then
- echo shar: \"'IPP/lib/Makefile'\" unpacked with wrong size!
- fi
- # end of 'IPP/lib/Makefile'
- fi
- if test -f 'IPP/lib/README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/lib/README'\"
- else
- echo shar: Extracting \"'IPP/lib/README'\" \(193 characters\)
- sed "s/^X//" >'IPP/lib/README' <<'END_OF_FILE'
- XThis directory holds the functions that are used by all the programs.
- X
- XThe makefile has two different setup depending if you have ranlib (SunOS)
- Xor if you can do without it. (Linux, Solaris).
- X
- END_OF_FILE
- if test 193 -ne `wc -c <'IPP/lib/README'`; then
- echo shar: \"'IPP/lib/README'\" unpacked with wrong size!
- fi
- # end of 'IPP/lib/README'
- fi
- if test -f 'IPP/lib/route/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/lib/route/Makefile'\"
- else
- echo shar: Extracting \"'IPP/lib/route/Makefile'\" \(307 characters\)
- sed "s/^X//" >'IPP/lib/route/Makefile' <<'END_OF_FILE'
- XINC=../../include
- XCC=gcc
- XCFLAGS=-I$(INC) -g
- X
- XFUNCS= FindRoute.o WhatIsIt.o ShowRoute.o ShowInterface.o AddressMatch.o \
- X RouteAdd.o CloseIf.o RouteMgr.o FindHostRoute.o \
- X FindSubnetRoute.o FindParentRoute.o RecordRoute.o
- X
- Xall:$(FUNCS)
- X
- Xclean:
- X rm -f *.o core errlist
- X
- X.c.o:
- X $(CC) $(CFLAGS) -c -o $*.o $<
- X
- END_OF_FILE
- if test 307 -ne `wc -c <'IPP/lib/route/Makefile'`; then
- echo shar: \"'IPP/lib/route/Makefile'\" unpacked with wrong size!
- fi
- # end of 'IPP/lib/route/Makefile'
- fi
- if test -f 'IPP/lib/route/RecordRoute.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/lib/route/RecordRoute.c'\"
- else
- echo shar: Extracting \"'IPP/lib/route/RecordRoute.c'\" \(936 characters\)
- sed "s/^X//" >'IPP/lib/route/RecordRoute.c' <<'END_OF_FILE'
- X/* ------------------------------------------------------------------------
- X * Ident: RecordRoute.c
- X * Author: Damiano Bolla 1993
- X * All this project is covered by the GNU Copyright.
- X */
- X
- X#include <stdio.h>
- X#include <string.h>
- X#include <sys/types.h>
- X#include <sys/time.h>
- X#include "defs.h"
- X#include "debug.h"
- X#include "packet.h"
- X#include "router.h"
- X#include "func_defs.h"
- X
- Xextern struct Debug dbg;
- X
- X/* This simply put my address in the data of the packet.
- X * In this way it isp ossible to see where a packet has travelled.
- X */
- Xint RecordRoute ( struct IPPaddr *myaddr, char *Buff, int Bufflen )
- X {
- X char *Ptr;
- X
- X if ( strlen(Buff) + strlen (ipp_ntoa(myaddr)) > Bufflen )
- X {
- X sprintf (dbg.msg,"RecordRoute: There is no space in the buffer");
- X DebugCall ( ERR_NOSPACE, DEBUG_CRITICAL );
- X return (NOT_DONE);
- X }
- X
- X Ptr = Buff + strlen(Buff);
- X sprintf (Ptr,"%s\n",ipp_ntoa(myaddr));
- X return (DONE);
- X }
- END_OF_FILE
- if test 936 -ne `wc -c <'IPP/lib/route/RecordRoute.c'`; then
- echo shar: \"'IPP/lib/route/RecordRoute.c'\" unpacked with wrong size!
- fi
- # end of 'IPP/lib/route/RecordRoute.c'
- fi
- if test -f 'IPP/lib/utils/BeDaemon.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/lib/utils/BeDaemon.c'\"
- else
- echo shar: Extracting \"'IPP/lib/utils/BeDaemon.c'\" \(367 characters\)
- sed "s/^X//" >'IPP/lib/utils/BeDaemon.c' <<'END_OF_FILE'
- X/* --------------------------------------------------------------------------
- X * Ident: BeDaemon.c
- X * Author: Damiano Bolla 1993
- X * All this project is covered by the GNU Copyright.
- X */
- X
- X#include <unistd.h>
- X#include <string.h>
- X#include "defs.h"
- X
- X/* This transform a program in a daemon.
- X * I have to look this up...
- X */
- X
- Xint BeDaemon ( )
- X {
- X return (DONE);
- X }
- END_OF_FILE
- if test 367 -ne `wc -c <'IPP/lib/utils/BeDaemon.c'`; then
- echo shar: \"'IPP/lib/utils/BeDaemon.c'\" unpacked with wrong size!
- fi
- # end of 'IPP/lib/utils/BeDaemon.c'
- fi
- if test -f 'IPP/lib/utils/ExistFd.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/lib/utils/ExistFd.c'\"
- else
- echo shar: Extracting \"'IPP/lib/utils/ExistFd.c'\" \(1096 characters\)
- sed "s/^X//" >'IPP/lib/utils/ExistFd.c' <<'END_OF_FILE'
- X/* ----------------------------------------------------------------------------
- X * Ident: ExistFd.c
- X * Author: Damiano Bolla 1993
- X * All this project is covered by the GNU Copyright.
- X */
- X
- X#include <stdio.h>
- X#include <sys/types.h>
- X#include <sys/socket.h>
- X#include <netinet/in.h>
- X#include "defs.h"
- X#include "debug.h"
- X#include "func_defs.h"
- X
- Xextern struct Debug dbg;
- X
- X/* This one checks that an Fd is a good one...
- X * It will return TRUE if it exist already and it is a good one
- X */
- X
- Xint ExistFd ( int fd, int Type )
- X {
- X
- X if ( Type == SOCK_TECH )
- X {
- X struct sockaddr_in name;
- X int namelen;
- X int error;
- X
- X namelen = sizeof (name);
- X error = getsockname (fd, (struct sockaddr *)&name, &namelen );
- X if ( error < 0 )
- X {
- X /* I assume that the descriptor is bad... */
- X /* And therefore no more existent... */
- X return (FALSE);
- X }
- X
- X return (TRUE);
- X }
- X
- X /* If I don't know of what you are talkign about... */
- X sprintf (dbg.msg,"ExistFd: Descriptor Type unknown %d ",Type);
- X DebugCall ( ERR_NOCHECK, DEBUG_ALERT );
- X return (FALSE);
- X }
- END_OF_FILE
- if test 1096 -ne `wc -c <'IPP/lib/utils/ExistFd.c'`; then
- echo shar: \"'IPP/lib/utils/ExistFd.c'\" unpacked with wrong size!
- fi
- # end of 'IPP/lib/utils/ExistFd.c'
- fi
- if test -f 'IPP/lib/utils/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/lib/utils/Makefile'\"
- else
- echo shar: Extracting \"'IPP/lib/utils/Makefile'\" \(304 characters\)
- sed "s/^X//" >'IPP/lib/utils/Makefile' <<'END_OF_FILE'
- XINC=../../include
- XCC=gcc
- XCFLAGS=-I$(INC) -g
- X
- XFUNCS= Debug.o Listen.o SafeRead.o Connect.o RcvPack.o WatchDog.o \
- X SndPack.o ipp_utils.o ReadConfig.o GetAddress.o ExistFd.o \
- X Accept.o TtyGets.o SeenAlready.o BeDaemon.o
- X
- Xall:$(FUNCS)
- X
- Xclean:
- X rm -f *.o core errlist
- X
- X.c.o:
- X $(CC) $(CFLAGS) -c -o $*.o $<
- X
- END_OF_FILE
- if test 304 -ne `wc -c <'IPP/lib/utils/Makefile'`; then
- echo shar: \"'IPP/lib/utils/Makefile'\" unpacked with wrong size!
- fi
- # end of 'IPP/lib/utils/Makefile'
- fi
- if test -f 'IPP/lib/utils/README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/lib/utils/README'\"
- else
- echo shar: Extracting \"'IPP/lib/utils/README'\" \(781 characters\)
- sed "s/^X//" >'IPP/lib/utils/README' <<'END_OF_FILE'
- XThis directory holds the functions that are used by all the programs.
- XWhat is performed is the following.
- X
- X
- Xethernet.c
- X
- X This provides the functions for openning an ethernet connection and performing
- X the requested operations. The requested operations are:
- X open a link given the ethernet ID.
- X read a packet
- X write a packet
- X
- Xtcp.c
- X
- X This provides the functions for openning a tcp link and performing
- X the requested operations.
- X open a link by creating it
- X open a link by using an existing one
- X read a packet
- X write a packet
- X
- Xatm.c
- X
- X This provides the functions for openning an atm link and performing
- X the requested operations.
- X open a link by creating it
- X open a link by using an existing one
- X read a packet
- X write a packet
- END_OF_FILE
- if test 781 -ne `wc -c <'IPP/lib/utils/README'`; then
- echo shar: \"'IPP/lib/utils/README'\" unpacked with wrong size!
- fi
- # end of 'IPP/lib/utils/README'
- fi
- if test -f 'IPP/lib/utils/SeenAlready.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/lib/utils/SeenAlready.c'\"
- else
- echo shar: Extracting \"'IPP/lib/utils/SeenAlready.c'\" \(1331 characters\)
- sed "s/^X//" >'IPP/lib/utils/SeenAlready.c' <<'END_OF_FILE'
- X/* ---------------------------------------------------------------------------
- X * Ident: SeenAlready.c
- X * Author: Damiano Bolla 1993
- X * All this project is covered by the GNU Copyright.
- X */
- X
- X#include <stdio.h>
- X#include <unistd.h>
- X#include <malloc.h>
- X#include <sys/types.h>
- X#include <sys/time.h>
- X#include <sys/timeb.h>
- X#include <string.h>
- X#include "defs.h"
- X#include "packet.h"
- X#include "router.h"
- X#include "debug.h"
- X#include "func_defs.h"
- X
- X
- Xextern struct Debug dbg;
- X
- X/* This function is VERY delicate.
- X * In theory we have an always running up time but in reality I wrap around every second...
- X * This is SHURELY going to cause drop packets...
- X */
- X
- Xint SeenAlready ( SeenData seendata, u_char Sender, u_char PackId )
- X {
- X u_short CurSec;
- X u_short LastSec;
- X time_t tim;
- X
- X if ( Sender == NOT_USED ) return (FALSE);
- X
- X tim = time (NULL);
- X CurSec = tim; /* The cast should do things right... */
- X LastSec = seendata[Sender][PackId].Sec;
- X
- X /* I have to save the current time in any way... */
- X seendata[Sender][PackId].Sec=CurSec;
- X
- X /* If we have a second difference it si OK.. */
- X if ( CurSec > LastSec ) return (FALSE);
- X
- X /* Also, if a packet is older than one second it is also valid... */
- X if ( CurSec < LastSec ) return (FALSE);
- X
- X /* Mhhh... too bad... */
- X return (TRUE);
- X }
- END_OF_FILE
- if test 1331 -ne `wc -c <'IPP/lib/utils/SeenAlready.c'`; then
- echo shar: \"'IPP/lib/utils/SeenAlready.c'\" unpacked with wrong size!
- fi
- # end of 'IPP/lib/utils/SeenAlready.c'
- fi
- if test -f 'IPP/lib/utils/TtyGets.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/lib/utils/TtyGets.c'\"
- else
- echo shar: Extracting \"'IPP/lib/utils/TtyGets.c'\" \(875 characters\)
- sed "s/^X//" >'IPP/lib/utils/TtyGets.c' <<'END_OF_FILE'
- X/* --------------------------------------------------------------------------
- X * Ident: TtyGets.c
- X * Author: Damiano Bolla 1993
- X * All this project is covered by the GNU Copyright.
- X */
- X
- X#include <unistd.h>
- X#include <string.h>
- X#include "defs.h"
- X
- X#define INPUT 0
- X
- X/* This one is a replacemente for gets that does not seems to do
- X * exactly what I want...
- X * It reads from stdin in the given buffer and return a string
- X * without the CR. If the input is NULL it returns an empty buffer
- X * If all is fine it returns DONE, if eof or other it returns NOT_DONE
- X */
- X
- Xint TtyGets ( char *Buff, int Bufflen )
- X {
- X int Letti;
- X char *Ptr;
- X
- X Letti = read (INPUT, Buff, Bufflen-1 );
- X
- X if ( Letti < 0 ) return (NOT_DONE);
- X
- X /* I have to put a zero at the end to use strchr */
- X Buff[Letti] = 0;
- X
- X Ptr = strchr (Buff,'\n');
- X if ( Ptr ) *Ptr = 0;
- X
- X return (DONE);
- X }
- END_OF_FILE
- if test 875 -ne `wc -c <'IPP/lib/utils/TtyGets.c'`; then
- echo shar: \"'IPP/lib/utils/TtyGets.c'\" unpacked with wrong size!
- fi
- # end of 'IPP/lib/utils/TtyGets.c'
- fi
- if test -f 'IPP/logd/Logtest.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/logd/Logtest.c'\"
- else
- echo shar: Extracting \"'IPP/logd/Logtest.c'\" \(1330 characters\)
- sed "s/^X//" >'IPP/logd/Logtest.c' <<'END_OF_FILE'
- X/* This program open a socket and then send data to it..
- X */
- X
- X#include <stdio.h>
- X#include <sys/types.h>
- X#include <sys/socket.h>
- X#include <netdb.h>
- X#include <netinet/in.h>
- X#include <signal.h>
- X#include <sys/utsname.h>
- X#include <errno.h>
- X#include "defs.h"
- X
- X#define MSG_SIZE 1024 /* This should be enough */
- X
- Xmain ()
- X {
- X int send_socket;
- X int address_len;
- X struct sockaddr_in address;
- X int err;
- X
- X /* I need a buffer for the messages... */
- X char MsgBuff[MSG_SIZE+2];
- X
- X send_socket = socket ( PF_INET, SOCK_DGRAM, 0);
- X if ( send_socket < 0)
- X {
- X fprintf (stderr,"Cannot create the SOCK_DGRAM socket \n");
- X exit (1);
- X }
- X
- X strcpy (MsgBuff,"ciao there");
- X
- X address.sin_family = SOCK_DGRAM;
- X address.sin_port = htons(1234);
- X address.sin_addr.s_addr = inet_addr("129.12.21.3");
- X memset (address.sin_zero, 0, sizeof(address.sin_zero));
- X
- X address_len = sizeof (struct sockaddr_in);
- X err = sendto (send_socket, /* The socket from where to get data */
- X MsgBuff, /* Destination buffer */
- X MSG_SIZE, /* Size of the buffer */
- X 0, /* Options */
- X &address, /* A place where to store the address */
- X address_len /* The length of address */
- X );
- X
- X
- X if ( err < 0 )
- X {
- X printf ("Error in sendto \n");
- X perror ("error code");
- X }
- X
- X exit (0);
- X }
- END_OF_FILE
- if test 1330 -ne `wc -c <'IPP/logd/Logtest.c'`; then
- echo shar: \"'IPP/logd/Logtest.c'\" unpacked with wrong size!
- fi
- # end of 'IPP/logd/Logtest.c'
- fi
- if test -f 'IPP/logd/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/logd/Makefile'\"
- else
- echo shar: Extracting \"'IPP/logd/Makefile'\" \(150 characters\)
- sed "s/^X//" >'IPP/logd/Makefile' <<'END_OF_FILE'
- Xlogd: logd.c
- X gcc -I../include logd.c $(SOCKLIB) -o logd
- X
- Xlogtest: logtest.c
- X gcc -I../include logtest.c -o logtest
- X
- Xclean:
- X rm -f logd core errlist
- X
- END_OF_FILE
- if test 150 -ne `wc -c <'IPP/logd/Makefile'`; then
- echo shar: \"'IPP/logd/Makefile'\" unpacked with wrong size!
- fi
- # end of 'IPP/logd/Makefile'
- fi
- if test -f 'IPP/monitor/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/monitor/Makefile'\"
- else
- echo shar: Extracting \"'IPP/monitor/Makefile'\" \(248 characters\)
- sed "s/^X//" >'IPP/monitor/Makefile' <<'END_OF_FILE'
- XINC=../include
- XCC=gcc
- XLIBIPP=../lib/libipp.a
- XCFLAGS=-I$(INC) -g
- X
- XOBJ=monitor.o Send.o Receive.o
- X
- Xmon:$(OBJ) $(LIBIPP)
- X $(CC) $(OBJ) $(LIBIPP) $(SOCKLIB) -o mon
- X sync
- X
- Xclean:
- X rm -f *.o mon core errlist
- X sync
- X
- X.c.o:
- X $(CC) $(CFLAGS) -c -o $*.o $<
- X
- END_OF_FILE
- if test 248 -ne `wc -c <'IPP/monitor/Makefile'`; then
- echo shar: \"'IPP/monitor/Makefile'\" unpacked with wrong size!
- fi
- # end of 'IPP/monitor/Makefile'
- fi
- if test -f 'IPP/monitor/README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/monitor/README'\"
- else
- echo shar: Extracting \"'IPP/monitor/README'\" \(409 characters\)
- sed "s/^X//" >'IPP/monitor/README' <<'END_OF_FILE'
- XThe monitor will be essential to collect statistics from the routers...
- X
- XBeside the simple host program needs some knowledge of who is on the net to send
- Xpackets. There are various functions that are desirable.
- X
- X1) Ilst of all nodes in a given level including if theya re routers or not.
- X
- X2) Show statistics of traffic and show routing tables.
- X
- X3) Send commands to the routers...
- X
- X4) Send and show packets.
- X
- X
- END_OF_FILE
- if test 409 -ne `wc -c <'IPP/monitor/README'`; then
- echo shar: \"'IPP/monitor/README'\" unpacked with wrong size!
- fi
- # end of 'IPP/monitor/README'
- fi
- if test -f 'IPP/monitor/Receive.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/monitor/Receive.c'\"
- else
- echo shar: Extracting \"'IPP/monitor/Receive.c'\" \(1411 characters\)
- sed "s/^X//" >'IPP/monitor/Receive.c' <<'END_OF_FILE'
- X/* ------------------------------------------------------------------------------
- X * Ident: Receive.d
- X * Author: Damiano Bolla 1993
- X * All this project is covered by the GNU Copyright.
- X */
- X
- X#include <stdio.h>
- X#include <string.h>
- X#include <sys/types.h>
- X#include <sys/socket.h>
- X#include <netdb.h>
- X#include <sys/time.h>
- X#include <netinet/in.h>
- X#include "defs.h"
- X#include "debug.h"
- X#include "packet.h"
- X#include "router.h"
- X#include "func_defs.h"
- X
- Xextern struct Debug dbg;
- X
- Xint Receive ( struct IPPaddr *myaddr, int talksock, u_char NextHop )
- X {
- X int Eof;
- X struct IPP ippR;
- X struct IPPaddr addr;
- X
- X Eof = FALSE;
- X RcvPack( &ippR, talksock, &Eof);
- X if ( Eof ) return (NOT_DONE);
- X
- X ipp_StoA (&ippR,&addr);
- X
- X if ( ippR.Type == PTYPE_DATA )
- X {
- X printf ("============== Data Packet from %s ============== \n",ipp_ntoa (&addr));
- X ippR.Data[ippR.DataLen] = 0;
- X printf ("%s \n",ippR.Data);
- X return (DONE);
- X }
- X
- X if ( ippR.Type == PTYPE_RR )
- X {
- X printf ("============== RR Packet from %s ============== \n",ipp_ntoa (&addr));
- X ippR.Data[ippR.DataLen] = 0;
- X printf ("%s \n",ippR.Data);
- X return (DONE);
- X }
- X
- X if ( ippR.Type == PTYPE_PING )
- X {
- X printf ("Received PING packet from %s \n",ipp_ntoa(&addr));
- X return (DONE);
- X }
- X
- X printf ("Unknown packet type %d from %s \n",ippR.Type, ipp_ntoa(&addr));
- X return (DONE);
- X }
- END_OF_FILE
- if test 1411 -ne `wc -c <'IPP/monitor/Receive.c'`; then
- echo shar: \"'IPP/monitor/Receive.c'\" unpacked with wrong size!
- fi
- # end of 'IPP/monitor/Receive.c'
- fi
- if test -f 'IPP/router/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/router/Makefile'\"
- else
- echo shar: Extracting \"'IPP/router/Makefile'\" \(345 characters\)
- sed "s/^X//" >'IPP/router/Makefile' <<'END_OF_FILE'
- XINC=../include
- XCC=gcc
- XLIBIPP=../lib/libipp.a
- XCFLAGS=-I$(INC) -g
- X
- XOBJ=router.o RouterInit.o RouterIo.o SetInterface.o TableInit.o \
- X ProcessCall.o ProcessPack.o ParsePack.o ParseData.o ShowStat.o
- X
- Xrouter:$(OBJ) $(LIBIPP)
- X $(CC) $(OBJ) $(LIBIPP) $(SOCKLIB) -o router
- X
- Xclean:
- X rm -f *.o router core errlist
- X
- X.c.o:
- X $(CC) $(CFLAGS) -c -o $*.o $<
- X
- END_OF_FILE
- if test 345 -ne `wc -c <'IPP/router/Makefile'`; then
- echo shar: \"'IPP/router/Makefile'\" unpacked with wrong size!
- fi
- # end of 'IPP/router/Makefile'
- fi
- if test -f 'IPP/router/README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/router/README'\"
- else
- echo shar: Extracting \"'IPP/router/README'\" \(437 characters\)
- sed "s/^X//" >'IPP/router/README' <<'END_OF_FILE'
- XThis router must be started with a config file in stdin.
- XSee the two exmaples in config/ex1 config/ex2 for the config file
- Xsyntax.
- X
- Xa router accept the following commands.
- XNOTE: The set commands arguments are in the same format as the config file.
- XYou can give these commands by using the mon program (in the monitor
- Xdirectory) and connecting to a router.
- X
- X
- Xshow route
- Xshow interface
- Xshow stat
- X
- Xset route
- Xset interface
- Xset debug
- X
- Xexit
- END_OF_FILE
- if test 437 -ne `wc -c <'IPP/router/README'`; then
- echo shar: \"'IPP/router/README'\" unpacked with wrong size!
- fi
- # end of 'IPP/router/README'
- fi
- if test -f 'IPP/router/RouterInit.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/router/RouterInit.c'\"
- else
- echo shar: Extracting \"'IPP/router/RouterInit.c'\" \(1409 characters\)
- sed "s/^X//" >'IPP/router/RouterInit.c' <<'END_OF_FILE'
- X/* ---------------------------------------------------------------------------
- X * Ident: RouterInit.c
- X * Author: Damiano Bolla 1993
- X * All this project is covered by the GNU Copyright.
- X */
- X
- X#include <stdio.h>
- X#include <string.h>
- X#include <sys/types.h>
- X#include <sys/time.h>
- X#include "defs.h"
- X#include "debug.h"
- X#include "packet.h"
- X#include "router.h"
- X#include "commands.h"
- X#include "func_defs.h"
- X
- Xextern struct Debug dbg;
- X
- X/* It returns NOT_DONE if it fails, DOEN otherwise...
- X * Debugging is done via the logd daemon.
- X * Ok... the format of the config file is quite strict... othervise I will spend
- X * more time parsing the file than doing "real" things... So !
- X */
- X
- Xint RouterInit ( struct Routing *rinfo )
- X {
- X char *Line;
- X char *Cmd;
- X char *Arg;
- X char Null[2]={0};
- X
- X /* I must be shure that the tables are initilized properly */
- X TableInit ( rinfo );
- X
- X /* Then first thing to do is to get my own address... */
- X if ( GetAddress (&rinfo->MyAddr) ) return (NOT_DONE);
- X
- X /* Ok, now... we get a line and see what the key is */
- X while ( (Line=ReadConfig(stdin)) != NULL )
- X {
- X if ((Cmd=strtok(Line,CMD_SEP))==NULL) { Cmd=Null; Arg=Null; }
- X else Arg=Cmd+strlen(Cmd)+1;
- X
- X if ( strcasecmp (Cmd, CMD_INTERFACE) == 0 )
- X SetInterface (rinfo, Arg);
- X
- X if ( strcasecmp (Cmd, CMD_ROUTE) == 0 )
- X RouteAdd (rinfo, Arg);
- X }
- X
- X return (DONE);
- X }
- END_OF_FILE
- if test 1409 -ne `wc -c <'IPP/router/RouterInit.c'`; then
- echo shar: \"'IPP/router/RouterInit.c'\" unpacked with wrong size!
- fi
- # end of 'IPP/router/RouterInit.c'
- fi
- if test -f 'IPP/router/ShowStat.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/router/ShowStat.c'\"
- else
- echo shar: Extracting \"'IPP/router/ShowStat.c'\" \(1178 characters\)
- sed "s/^X//" >'IPP/router/ShowStat.c' <<'END_OF_FILE'
- X/* ---------------------------------------------------------------------------
- X * Ident: ShowStat.c
- X * Author: Damiano Bolla 1993
- X * All this project is covered by the GNU Copyright.
- X */
- X
- X#include <stdio.h>
- X#include <string.h>
- X#include <sys/types.h>
- X#include <sys/time.h>
- X#include "defs.h"
- X#include "debug.h"
- X#include "packet.h"
- X#include "router.h"
- X#include "commands.h"
- X#include "func_defs.h"
- X
- Xextern struct Debug dbg;
- X
- X/* This one show statistics for this router.
- X * The difficult thing is NOT to overflow th buffer.
- X * Since I have very little data, I do not bother...
- X */
- Xint ShowStat (struct Routing *rinfo, char *Buff, int Bufflen )
- X {
- X char *ptr;
- X
- X sprintf (dbg.msg,"ShowStat: Formatting statistics ");
- X DebugCall ( ERR_MSG, DEBUG_TEXT );
- X ptr = Buff;
- X sprintf (ptr,"Debug Level %d \n",dbg.current_level);
- X ptr += strlen (ptr);
- X sprintf (ptr,"Idle Time %d \n",rinfo->Idle);
- X ptr += strlen (ptr);
- X sprintf (ptr,"Bad Packets %d \n",rinfo->BadCount);
- X ptr += strlen (ptr);
- X sprintf (ptr,"Loop Count %d \n",rinfo->LoopCount);
- X ptr += strlen (ptr);
- X sprintf (ptr,"TTL Count %d \n",rinfo->TTLCount);
- X ptr += strlen (ptr);
- X
- X return (DONE);
- X }
- X
- END_OF_FILE
- if test 1178 -ne `wc -c <'IPP/router/ShowStat.c'`; then
- echo shar: \"'IPP/router/ShowStat.c'\" unpacked with wrong size!
- fi
- # end of 'IPP/router/ShowStat.c'
- fi
- if test -f 'IPP/search' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'IPP/search'\"
- else
- echo shar: Extracting \"'IPP/search'\" \(198 characters\)
- sed "s/^X//" >'IPP/search' <<'END_OF_FILE'
- X# This simple script is used to search for something in the source files
- X
- Xfind . \( -name '*.c' -o -name '*.h' \) -print |
- Xwhile read f
- Xdo
- X if grep "$1" $f
- X then
- X echo $f
- X fi
- Xdone
- X
- END_OF_FILE
- if test 198 -ne `wc -c <'IPP/search'`; then
- echo shar: \"'IPP/search'\" unpacked with wrong size!
- fi
- chmod +x 'IPP/search'
- # end of 'IPP/search'
- fi
- echo shar: End of archive 6 \(of 6\).
- cp /dev/null ark6isdone
- MISSING=""
- for I in 1 2 3 4 5 6 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 6 archives.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-