Protocol Mechanisms

The next step is to look at the tasks that an application protocol must perform and how it goes about performing them. Although an exhaustive exposition might identify a dozen (or so) areas, the ones we’re interested in are:

Framing

Tells how the beginning and ending of each message is delimited.

Encoding

Tells how a message is represented when exchanged.

Reporting

Tells how errors are described.

Asynchrony

Tells how independent exchanges are handled.

Authentication

Tells how the peers at each end of the connection are identified and verified.

Privacy

Tells how the exchanges are protected against third-party interception or modification.

A notable absence in this list is naming—we’ll explain why later on.

Framing

There are three commonly used approaches to delimiting messages: octet-stuffing, octet-counting, and connection-blasting.

An example of a protocol that uses octet-stuffing is SMTP. Commands in SMTP are line-oriented (each command ends in a CR-LF pair). When an SMTP peer sends a message, it first transmits the DATA command, then it transmits the message, then it transmits a . (dot) followed by a CR-LF. If the message contains any lines that begin with a dot, the sending SMTP peer sends two dots; similarly, when the other SMTP peer receives a line that begins with a dot, it discards the dot, and, if the line is empty, it knows it’s received the entire message. Octet-stuffing has the property that you don’t need the entire message in front of you before you start sending ...

Get BEEP: The Definitive Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.