RPC, Presentation Layer
- x-kernel RPC:
- Presentation Layer:
- Encoding
- Lossless Compression
- Lossy Compression
- Security
x-kernel RPC
- Blast: fragmentation, acknowledgement, retransmission, but not
a reliable protocol (may give up).
- Chan: basic RPC, with channel ID, transaction ID, at-most-once semantics
- Select: called-procedure identification
- non-standard RPC protocol built from general-purpose "building blocks"
Blast protocol
- receiver sends a selective retransmission request (SRR -- a
combination positive and negative ack) when:
- the last segment arrives
- a timer expires that was started when the first fragment arrives
- a retry timer expires that was started when we first sent SRR for
missing packets
- sender keeps packet for a fixed time, or until a completely positive
SRR is received
- more reliable than IP fragmentation (retransmits missing fragments),
but not as reliable as TCP (gives up after a time)
- at most 32 fragments per packet, since the SRR has a 32-bit bitmask
Chan protocol
- interfaces below to a send/receive (asynchronous) protocol, and
above to an RPC (synchronous) protocol
- retransmits until ack is received
- reply is ack for request, next request is ack for reply
- probe packets assure that the server is still working
- "boot ID" prevents errors, allows message ID counter to start at 0
rather than random number
Presentation Layer: Encoding Principles
- which data types are we going to encode?
- ints, char, arrays, pointers, ...
- length, content type, text/html, ...
- how are we going to represent them?
- big-endian
- little-endian
- ASCII (American Standard Code for Information Interchange)
- how is the receiver going to decode?
- compiled or interpreted?
Presentation Layer: Encoding
- XDR:
- 32-bit encoding for basic types
- 32-bit multiples for other types
- arrays encoded by length followed by contents
- same routines used for encoding or decoding
- Sun RPC
- ASN.1
- ISO standard
- variable, value-dependent encoding size: (tag, length, value)
- tagged, generally interpreted
- SNMP
Compression
- most real data has redundancy, i.e. is encoded using more bits than
the theoretical minimum
- trivial example: the sequence 1111111111111... (n ones) can be
encoded using 1 + log n bits instead of n bits
- compression:
- encodes the data using fewer bits (if possible)
- sends (or stores) the data
- reconstructs the original (or a sufficient approximation) from the
compressed data
- lossless compression: exact reconstruction
- lossy compression: approximate reconstruction
Lossless Compression
- run-length encoding, e.g. encoding 1111111111111... (n ones) as
the value (1) and the number of occurrences (n)
- Differential Pulse Code Modulation (DPCM) sends the differences between
successive values of a slowly changing signal, using fewer bits
- Dictionary-based compression:
- Lempel-Ziv (Unix compress)
- builds a table of substrings which appear (repeatedly) in the text
- encodes each substring by its dictionary position
- GIF replaces 24-bit color pixels with 8-bit pixels by selecting the
"most important" 256 colors and only using those
Presentation Layer: Lossy Compression
- JPEG:
- discrete cosine transform (almost lossless)
- quantization: reduced precision of high spatial frequencies
- run-length encoding of quantized data
- MPEG:
- JPEG on each frame
- 3 frame types:
- I (Intrapicture), like JPEG
- P (Predicted), specified in terms of the differences from prior I frame
- B (Bidirectional Predicted), specified in terms of the differences from
prior I/P frame to next I/P frame
Presentation Layer: Security
- trusted system(s): own computer, partner's computer
- untrusted system: network
- plaintext encrypted to give cyphertext, decrypted
to give back plaintext
- secret key is required for decryption, may be required
for encryption:
- if encryption and decryption keys are same, encryption key must
be kept secret: this is secret key cryptography
- if encryption and decryption keys are same, encryption key may
be published: this is public key cryptography
- in both cases, the decryption key must be kept secret to
guarantee privacy
Security Algorithms, Protocols
- one-time pad: unbreakable, but key security is difficult (secret key)
- DES: hard to break 56-bit key, commercial use (secret key)
- Kerberos: security protocol, distributes and renews session keys
based on host keys (secret key)
- RSA: arbitrary size keys, public keys
- message integrity: can I prove in court that this message was sent
to me by person X?