Lecture 3:
The Application Layer Architecture
The three approaches to applications
Protocol-based applications
Prof. Yechiam Yemini (YY)
Computer Science Department
Columbia University
Copyright, 1990-2003, Y. Yemini.
Three Approaches To Build Applications
y Protocol-based applications: encode interactions in packets
Protocol API
App
App
Protocol
Protocol
Transport
y Remote-procedure calls: encode interactions in RPC invocations
RPC library
App
RPC
App
RPC
Transport
y Web-based applications: invoke CGI for URL
URL
App
HTTP
Transport
Copyright, 1990-2003, Y. Yemini.
App
HTTP
2
The OSI Protocol Layering Architecture
y Service Access Points (SAPs) [API]:
o Protocol primitives: e.g., establish/terminate connection, transfer data
y Protocol Data Units (PDUs) [Headers]:
o Carry data and control instructions among peer entities
y Protocol Entities:
o Perform peer to peer procedures, encapsulate frames, mux/demux traffic
PDU
Protocol
Entity
Peer Interactions
SAP
Protocol
Entity
Header
Lower Layer Medium
Copyright, 1990-2003, Y. Yemini.
The OSI Confirmed Services Model
y Services defined in terms of primitives (verbs, API)
o Example: X=
z
z
z
Connect, send, receive (data transfer)
Invoke (remote operation)
Get, set (managed variables)
y Peers use handshake to ensure performance
o Example:
z
z
z
z
Connect request
Connect Indication
Connect Response
Connect Confirm
X.Request
1
X.Confirm
4
Protocol
Entity
X.IndicationX.Response
2
3
Peer Interactions
Copyright, 1990-2003, Y. Yemini.
Protocol
Entity
PDUs Encode Primitive Actions
y Headers encode service primitives and parameters
X
A1
A2
...
An
Payload
y Examples
Connect
Sndr Id
Get
URL
Dest
.......
Payload
Copyright, 1990-2003, Y. Yemini.
Example: UDP
y Goal: connectionless (datagram) transport between sockets
y Primitives (socket API):
o Socket/Close: create/close a local socket entity
o Sendto/Recvfrom: transfer a message
y Protocol entity:
oRecipient
o Sender
z
z
z
z
z
Socket (local)
Bind (local)
Sendto(socket,message,length,flags..destaddrss..)
Recvfrom(.)
Close (local)
App
UDP
zSocket
zBind
zRecvfrom
zSendto
zClose
App
IP
Copyright, 1990-2003, Y. Yemini.
UDP
How To Design A Protocol?
Example: a simple peer-2-peer content downloading protocol
y Step 1: design service primitives [API]
o Offer, request, send, receive.
y Step 2: design packet encoding
o Version#;action; transaction id; file descriptor; authorization.
y Step 3: design peer procedures
y Step 4: build applications
App
App
Protocol
Protocol
Transport
Copyright, 1990-2003, Y. Yemini.
The Client-server Model
y A server provides access to shared resources
y Asymmetric: provider-consumer
y Synchronous: request-response interactions
y Loosely coupled distributed processing
y Examples:
o
WWW, FTP, Mail.
Server
REQUEST
Client
RESPONSE
Copyright, 1990-2003, Y. Yemini.
Example: VOD Server
y Goal: provide video-on-demand
y Protocol primitives:
Play: movie identifier, service features
o Pause, resume, fast-forward, fast-backward, restart, end, stop.
o
zSocket,bind
zSocket,bind
zRecvfrom()
zSendto([play:])
zSendto([Segment]..)
zRecvfrom()
z..
z..
zRecvfrom(..)
zSendto([Pause])
zClose
zSendto([Resume]..)
zClose
VOD Srvr
VOD Clnt
UDP
UDP
IP
Copyright, 1990-2003, Y. Yemini.
The Challenges (Continued)
y Challenge 1: managing complex interactions
o VOD server must maintain multiple threads of activities (play, control)
y Challenge 2: managing unreliable behaviors
o Loss of messages: e.g., what if a restart command is lost?
o Reordering of messages: e.g., what if the pause arrives after the resume?
o Loss of server: e.g., client sent a pause server crashed and rebooted
o Loss of client: e.g., a client crashes, reboots and restarts a new session
z
Stateless servers
y Challenge 3: managing security exposure
o Protocols can have specific vulnerabilities; e.g., disclose passwords
o Protocols can have generic vulnerabilities; e.g., denial-of-service-attacks (DOS)
Bruce the Breaker
zPlay
zPause/Resume
VOD Srvr
UDP
zFast
Forward/Backward
zRestart
zStop
IP
Copyright, 1990-2003, Y. Yemini.
VOD Clnt
UDP
10
Application Environment Issues
y What server structures are needed?
Process vs. thread
o Iterative vs. concurrent servers
o
y What OS services are needed?
o
IPC, Daemons, Threads, Kernelization,
y What generic network services are needed?
o
Name services, security services, file services
Kerberos
NFS
DNS
Server
Client
OS
OS
Copyright, 1990-2003, Y. Yemini.
11