CSCI 363 Homework 5

This homework is not graded. It is practice for Quiz 5.

Problem 1

For both ONC RPC and Java RMI define an interface for a program with two procedures: (1), a SetBase procedure which is passed a positive integer; and (2), a PrintInteger which is passed a positive integer and returns the character string that results from printing the argument string in the stored base.

For example, after a call of SetBase(6), PrintInteger(333) should return "1313".

Don't show the implementation code; just show the XDR file for ONC RPC and the Java interface definition for Java RMI.

Problem 2

The following table appears in RFC 793, the TCP protocol specification.


    0                   1                   2                   3   
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |          Source Port          |       Destination Port        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                        Sequence Number                        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                    Acknowledgment Number                      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |  Data |           |U|A|P|R|S|F|                               |
   | Offset| Reserved  |R|C|S|S|Y|I|            Window             |
   |       |           |G|K|H|T|N|N|                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |           Checksum            |         Urgent Pointer        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                    Options                    |    Padding    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                             data                              |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                            TCP Header Format

And the following table appears in RFC 768, the UDP protocol specification.


                  0      7 8     15 16    23 24    31  
                 +--------+--------+--------+--------+ 
                 |     Source      |   Destination   | 
                 |      Port       |      Port       | 
                 +--------+--------+--------+--------+ 
                 |                 |                 | 
                 |     Length      |    Checksum     | 
                 +--------+--------+--------+--------+ 
                 |                                     
                 |          data octets ...            
                 +---------------- ...                 

                      User Datagram Header Format

And finally the following table appears in RFC 791, the Internet Protocol specification.


  0                   1                   2                   3   
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |Version|  IHL  |Type of Service|          Total Length         |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |         Identification        |Flags|      Fragment Offset    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |  Time to Live |    Protocol   |         Header Checksum       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                       Source Address                          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                    Destination Address                        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                    Options                    |    Padding    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                    Example Internet Datagram Header

The following six lines are the output of tcpdump when it was printing the headers of network packets being received on etowah.cs.unca.edu one morning. Because tcpdump was running in verbose mode the "lines" are very long and I've put each line in its own row of an HTML table.

11:16:37.805957 gate251.cs.unca.edu.hsrp > ALL-ROUTERS.MCAST.NET.hsrp: [udp sum ok] HSRPv0-hello 20: state=active group=69 addr=gateway.cs.unca.edu hellotime=3s holdtime=10s priority=40 auth="unc\hsrp" [tos 0xc0] (ttl 2, id 0, len 48)
11:16:38.096654 gate253.cs.unca.edu.hsrp > ALL-ROUTERS.MCAST.NET.hsrp: [udp sum ok] HSRPv0-hello 20: state=standby group=69 addr=gateway.cs.unca.edu hellotime=3s holdtime=10s priority=30 auth="unc\hsrp" [tos 0xc0] (ttl 2, id 0, len 48)
11:16:38.532041 candler.cs.unca.edu.38488 > etowah.cs.unca.edu.ssh: S [tcp sum ok] 649561505:649561505(0) win 5840 <mss 1460,sackOK,timestamp 126090315 0,nop,wscale 0> (DF) [tos 0x60] (ttl 64, id 31210, len 60)
11:16:38.532187 etowah.cs.unca.edu.ssh > candler.cs.unca.edu.38488: S [tcp sum ok] 3380068222:3380068222(0) ack 649561506 win 5792 <mss 1460,sackOK,timestamp 397987036 126090315,nop,wscale 0> (DF) (ttl 64, id 0, len 60)
11:16:38.532495 candler.cs.unca.edu.38488 > etowah.cs.unca.edu.ssh: . [tcp sum ok] ack 1 win 5840 <nop,nop,timestamp 126090315 397987036> (DF) [tos 0x60] (ttl 64, id 31211, len 52)
11:16:38.536325 etowah.cs.unca.edu.ssh > candler.cs.unca.edu.38488: P [tcp sum ok] 1:24(23) ack 1 win 5792 <nop,nop,timestamp 397987036 126090315> (DF) (ttl 64, id 29603, len 75)

Read a bit about the documentation of tcpdump. You can type the command "man tcpdump" on just about any Unix computer, or you can search for information about tcpdump on the Internet.

Use your of tcpdump and the TCP/IP protocol to examine the output of tcpdump shown above. Keep in mind that the sequence and acknowledgment numbers in all but the first two packets are relative to the beginning sequence and acknowledgment numbers shown in those two packets.

Finally download the CSCI 363 tcpdump Homework form and fill in the header fields for each our the six packets and give an explanation of the purpose of each packet. You don't have to decode the TCP options fields, but you should try to understand them.