CompSci 314 notes

Ulrich

Electrical signals

Types of cables

Wireless

Logarithm rules

  1. log is the inverse exponential: if x = y^z, then _log_y x = z_
  2. convert log bases by diving by the base you want: log-10 x = ln x / ln 10
    • Products turn into sums under log functions: _log_y(AB) = log_y A + log_y B_
    • Ratios turn into differences: _log_y(A/B) = log_y A - log_y B_
    • Exponents turn into factors: _log_y(A^b) = b log_y A_

Ratios and Decibels

Power ratio dB
1:1 0
2:1 3
4:1 6
8:1 9
16:1 12
10:1 10
100:1 20
1000:1 30
10000:1 40

Satellite communication

Types of communication channel

Signals and information

Fourier transforms / series

Power spectrum

Modulation

Signal degradation

Error recovery

Checksums

100110110000 : 11001 = 11100110 (result: NOT interesting)
-11001
 =10100
 -11001
  =11011
  -11001
   =00101
   -00000 (use 00000 when the result starts with a 0 at each step)
    =01010
    -00000
     =10100
     -11001
      =11010
      -11001
       =00110
        =0110 (remainder: interesting)

Hamming codes

p1 p2 m1 p3 m2 m3 m4 p4 m5 m6 m7 m8

p1 : m1 m2    m4 m5    m7
p2 : m1    m3 m4    m6 m7
p3 :    m2 m3 m4          m8
p4 :             m5 m6 m7 m8

Coding

Clocking

'   '   '   '   '   '   '   '   '   '   '
|___|‾‾‾|_|‾|_|‾|___|‾‾‾|___|‾‾‾|___|‾‾‾|__
0   1   0   0   0   1   0   1   0   1   0
- this means the signal rate is twice the data-rate, not very bandwidth friendly - __Differential manchester coding__ codes `0` as transition from opposite level to current level and `1` as transition from current to opposite
'   '   '   '   '   '   '   '   '   '   '
|_|‾|___|‾‾‾|___|‾|_|‾‾‾|_|‾|___|‾|_|‾‾‾|__
1   0   1   1   1   0   1   0   1   0   1

Framing

Compression

Analog-to-Digital Conversion


Nevil

UDP, TCP, and other Transport protocols

UDP

.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       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             Length            |           Checksum            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                   data                                    ... 
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

TCP

CONNECTION:
Initiator     Listener
------------------------
Send SYN
              Send SYN
              Send ACK
Send ACK
Connection OK   
              Connection OK

DISCONNECTION:
A         B
-------------------
Send FIN
          Send ACK
Closed
          Send FIN
Send ACK
           Closed
.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                        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    Acknowledgement 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                    | Zero Padding  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                     data segment                           ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
A  Listen port X
B  Open A:X
SYN/ACK
Data transfer
    A  Send D1
    B  Receive D1
    B  Send D2
    A  Receive D2
    ...
B  Close
FIN/ACK
A  Listen port X

Flow control

LAN

Ethernet

WiFi 802.11(a,b,g,n,ac…)

Bridges and switches

Routing algorithms and protocols


Aniket

Application layer

HTTP

METHOD request_url HTTP/1.1\r\n
HEADER1: VALUE\r\n
HEADER2: VALUE\r\n
HEADERn: VALUE\r\n
\r\n

e.g.
GET / HTTP/1.1\r\n
User-Agent: curl/7.30.0\r\n
Host: mwild.me\r\n
Accept: */*\r\n
\r\n
HTTP/1.1 STATUS_CODE STATUS_DESCRIPTION\r\n
HEADER1: VALUE\r\n
HEADER2: VALUE\r\n
HEADERn: VALUE\r\n
\r\n
data data data data ...

e.g
HTTP/1.1 200 OK\r\n
Server: GitHub.com\r\n
Content-Type: text/html; charset=utf-8\r\n
Last-Modified: Fri, 19 Sep 2014 01:09:48 GMT\r\n
Expires: Sat, 25 Oct 2014 03:41:13 GMT\r\n
Cache-Control: max-age=600\r\n
Accept-Ranges: bytes\r\n
Date: Sat, 25 Oct 2014 03:31:13 GMT\r\n
Via: 1.1 varnish\r\n
X-Served-By: cache-ak102-NZ\r\n
X-Cache: MISS\r\n
X-Cache-Hits: 0\r\n
X-Timer: S1413682670.180972,VS0,VE469\r\n
Vary: Accept-Encoding\r\n
Connection: close\r\n
Age: 0\r\n
\r\n
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="author" content="Michael Wildman">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <title>Michael Wildman | mwild.me</title>
...

FTP

Email

220 ak47 ESMTP ready
> HELO mwild.me
250 ak47
> MAIL FROM: <[email protected]>  
250 2.0.0 OK
> RCPT TO: <[email protected]>   
250 Recipient address accepted
> DATA
354 Continue
> Subject: Hello
> 
> This message was sent via telnet :D
> .
250 Great success
> QUIT

DNS

P2P (Peer-to-peer)