Lecture note for 08/28

Example of a Network stanard: RS232

Problems with electrical transmission

Characteristic of a sine wave

AM: Amplitude modulation
FM: Frequency modulation
PM: Phase modulation


Class note for 8/30

Lab: decode the ethernet and ip address
Using snoop: we can only sneak packets of the private network.
  1. Generate difference packets in private network, and capture them. Save packets in a file.
  2. Write a program to decode the packets and write the header information. The packets are stored in a file. analyze filename
  3. Funtions to read packets are provided
    While there are packets in a file {
       read the packet,
       if the packet is ARP, print ARP header
       else if packet is IP, {
           print IP header,
           if TCP, print TCP header,
           else if UDP, print UDP header,
           else if ICMP, print ICMP header
       }
    }
    
How do you know if a packet is ARP or IP?

How do you know if a packet is TCP, UDP or ICMP?
Decode the packet: IP packet is in the ethernet packet data area.

How to place a packet header in data area?
char * buffer;
struct ehdr * e;  /* this defines a structure that is ethernet header.
                     in ether.h:
                     struct ehdr{
                        unsigned char dst[6],
                        unsigned char src[6],
                        unsigned short type,
                        unsigned char data[1]
                        }
                 /*
e = (struct ehdr * ) buffer ;
/* you can access e->type (look it up in ether.h file 
   Assume that it is IP header, now decode ip header the same way, */

struct iphdr * ip;
ip= (struct iphdr *) e->data;

/* Bit order is different in some architecture. In packets, 
   the least significant bit comes first. So, use 
   ntohs() for short and ntohl() for long to convert short/longs from
   network byte order to host byte order */

Types of modulation

Amplitude

Amplitude of signals encode 0 and 1.
Problem: it's hard to distinguish in a noisy environment.

Frequency modulation
Data is encoded in changes of frequency.
FM is more tolarant to noise.

Phase-shift modulation

Modems

Class notes for 9/1

Network parameters

Relationship between bandwidth and Throughput

Nyquist Theorem

: relates network bandwidth and throughput

D = 2 B log(K)


where D: max throuput, B: bandwidth, K: Number of values that encodes data. log is base 2.
example: in RS232,
K = 2      (+15V/-15V)
D = 2 B log 2 = 2 B
So, the throuput in RS232 is 2 times the bandwidth.

example: Phase shift encoding

Assume K=4   (4 possible phase shifts )
D = 2 B log 4 = 4 B
Notice that Nyquist theorem does not consider noise. therefore, it only gives a maximum theoretical limit.

Shannon's Therom

  C = B  log (1+ (S/N) )

  where C : throughtput (bits/sec)
        B : bandwidth   (hardware bandwidth )
        S: power of signal ( in watts )
        N : power of noise ( in watts )
        log : based two

Notice that if noise is zero, throughput is infinity.
(S/N) is called "signal-to-noise ratio"

example: telephone system:

Bandwitdth : 3000Hz (anything over 3000Hz is lost. the highest we can hear is 20kHz)
S/N : signal to noise ratio
effective capacity (Throughput) C = B log (1 + (S/N)) = 30,000bps
with a S/N of 1000, there is little hope to complish more than 30kbps. 56kbps modems have this sped only with good quality phone lines with larger S/N ratio and also use compression.

S/N (signal to noise ratio) is usually given in decibels (dB).

S/N in decibels = 10*log(S/N)    ***notice that this log is base 10 ***
example:
if S/N = 1000, then S/N in decibels = 10*3 = 30dB.
if S/N = 20dB, then S/N =100
Conclusion:

Multiplexing

using a shared channel to transmit seperate sources of information.

multiplexing needs to prevent interference among signals.