Computer networks -- 2007-2008 -- info.uvt.ro/Course 2
- courses 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13;
- laboratories agenda, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, evaluation, tools, repository.
- a written specification (a standard) which describes the exact method in which two (or more) entities communicate.
- PDU -- Protocol Data Unit
- is the smallest piece of data that a protocol can handle. This is a generic term used when speaking of protocols, but each implementation (instance) of a protocol could use different names:
- frame -- at the physical layers;
- packet -- at the network layers;
- message -- at application layers;
- syntax -- how the data is encoded / decoded, how a PDU is constructed;
- semantics -- what is the interpretation of an encoded PDU, how each field should be interpreted, what modifications can be made for a PDU;
- synchronization -- how do the communicating entities know when to transmit, receive, and how much;
Usually the protocols are not the direct link between an application and the wire, but they are stacked one on another, thus creating layering, and for each protocol we can speak of:
- an upper layer protocol -- the most abstract one -- for example in case of TCP this is HTTP;
- a lower layer protocol -- the most concrete one -- for example in case of TCP this is IP;
For example HTTP is based on TCP, which is based on IP, which is based on (let's say) Ethernet. But HTTP could be also written on-top on any other stream, reliable protocol, or any datagram-oriented protocol that can handle big enough datagrams.
Thus we can say that a protocol has two interfaces:
- the upper one, which is used by upper levels -- the protocol input:
- in our case HTTP presents to applications a message-oriented state-less (connection-less we might say) interface;
- TCP presents to applications (or usually higher protocols) a stream, reliable and connection-oriented interface;
- the lower one, which we can see as the protocol's output:
- HTTP sends a stream of octets, and after sending it, it receives another stream of octets;
- TCP outputs IP packets;
Segmentation and reassembly
- is the process in which a protocol takes the data it needs to handle and breaks it into smaller pieces in order to be able to send them to the lower protocol layers. For example TCP receives a stream of octets, but takes these octets and splits them into packets.
- is the reverse process, in which the packets are taken and concatenated to obtain the entire message which must be delivered to higher layers.
- MTU -- Maximum Transmission Unit
- is the largest piece of data -- including headers -- that a protocol can handle. For example for Ethernet frames the limit is 1.5KB.
After the segmentation of the inputs, we obtain blocks of data -- we shall call the messages or payload -- which have to be transmitted.
A message is composed of:
- addresses of the sender and receiver;
- error detection and correction codes;
- control information;
- other protocol dependent information (message authentication, etc.)
- body: the actual payload;
And because of the layering of protocols we obtain: wikipedia:Image:UDP encapsulation.svg
In the case of connection oriented protocols before any data can be exchanged the connection must be established. This usually happens by exchanging a set of packets before and after the real data exchange. And we can speak of three phases:
- connection establishment:
- usually it implies the following steps:
- one entity waits for connections -- we call the entity server and the act of waiting listening;
- another entity sends a connection request message -- we call the entity client and the process connecting;
- the server sends back a reply saying it accepts the connection -- acknowledgment;
- it might also involve issues like:
- encryption keys exchange;
- usually it implies the following steps:
- data exchange;
- connection termination:
- it implies:
- one entity sends a termination request;
- the other entity sends a reply;
- it implies:
- wikipedia:Connection-oriented protocol
- wikipedia:Connectionless protocol
- wikipedia:Connectionless mode transmission
In a communication process we might encounter entities with different network capacity or processing power, or we might encounter congestion on the route tho the other entity, so in this case we need a way to limit the data quantity that passes between two entities;
This can be done by:
- the protocol by explicitly exchanging flow control information, and actively using them;
- the entities through which the packet passes, usually these entities drop / discard the packets;
As we have seen in the process of exchanging data there could be errors, and we must:
- detect these errors;
- try to recover the original data;
- repetition -- we repeat the same data a couple of times;
- parity bit;
- we sum the values of the octets and we negate by one, we append this result;
- on the other side we do the same thing to the data and the checksum, if the result is not 0 we have an error;
- cyclic redundancy check:
- we use the octets as coefficients in a polynom; we append this result;
- on the other side we remake the computation and check with the previous result;
- message digest -- cryptographic hash function: MD5, SHA familiy, etc.;
- wikipedia:Error detection and correction;
- wikipedia:Parity bit;
- wikipedia:Cyclic redundancy check;
- wikipedia:Hash function;
- wikipedia:Cryptographic hash function;
Because usually there are many types of messages, each one must be sent at a particular time and in a correct order. Also in reliable protocols previous data must be acknowledged.
Because the packets received from lower layers can be received in a different order, they have to be reordered, and maybe wait for the missing ones.
The problems that addressing raises are not trivial.
- How does an entity address another entity?
- Usually we chose a number, or an array of numbers (like in the case of IP), or we could choose a fixed binary string (like in the case of MAC). But we might also use readable strings like in the case of DNS names or URL's (but only in high level protocols).
- Is the address global or only local?
- For example MAC is local to the LAN, but IP could be global (public IP).
- If the address is global how can we reach it? How do we determine if the other entity is up?
- Do we use an indirection for an address? If so how do we resolve this indirection?
- For example DNS -- a logical name -- that is resolved to an IP.
- If we don't have the address of the other entity how do we find it?
- We could use a directory service.
- How do we assign addresses? How do we make sure they are unique?
As with addressing this is another non-trivial issue. Multiplexing means taking one channel and transforming it into multiple ones. We can speak of:
- upward multiplexing -- when one lower layer channel is used to create multiple higher layer channels;
- downward or division multiplexing -- when a higher layer channel is obtained by combining multiple lower layer channels;
The most common way to implement multiplexing is time division: each upper layer channel has the possibility to send a packet, but only one at a time, thus the bandwidth is split.
- priory -- quality of service;
- Network architecture
- refers to both the layout of the nodes -- topology -- and the protocols used between the nodes -- protocol stack; and some times it could also refer to the equipments used.
Usually the network architectures are standard, because in order to develop one it takes a lot of time, expertise, and trial-and-error process. For example in the early days there were two competing standards: DNA (Digital Network Architecture) and SNA (System Network Architecture) which both could connect only equipments made especially for them, and interconnection was not possible.
- LAN is a well known architecture and it involves:
- the star topology;
- Ethernet compatible hardware -- almost all switches and network cards;
- TCP/IP stack;
As we have seen in the previous section protocols are layered, they are built one on-top of the other.
To reduce their design complexity, most networks are organized as a stack of layers or levels, each one built upon the one below it. The number of layers, the name of each layer, the contents of each layer, and the function of each layer differ from network to network.
The purpose of each layer is to offer certain services to the higher layers, shielding those layers from the details of how the offered services are actually implemented. In a sense, each layer is a kind of virtual machine, offering certain services to the layer above it.
This concept is actually a familiar one and used throughout computer science, where it is variously known as information hiding, abstract data types, data encapsulation, and used in object-oriented programming. The fundamental idea is that a particular piece of software (or hardware) provides a service to its users but keeps the details of its internal state and algorithms hidden from them.
Taking some TCP/IP suite based examples:
- HTTP, FTP, SSH, DNS -- the application layer;
- TCP, UDP -- the transport layer;
- IP, ARP, RARP, ICMP, IGMP -- the network layer;
- Ethernet, PPP, WLAN -- the data link layer;
- wire, tunnel, airwaves -- the physical layer;
Or the OSI stack:
- application layer;
- presentation layer;
- session layer;
- transport layer;
- network layer;
- data link layer;
- physical layer;
This layering has some advantages:
- in breaks the complexity into smaller pieces that can be studied and implemented separately;
- it standards the network components and the interfaces between them, thus allowing multiple vendors to create competing products;
- it permits interconnection and inter-operation, in which different equipments or protocols can be used to communicate;
- it allows vendors to create simpler devices that can speak only up to a particular level, and maybe give software that compensates;
- modularization allows us to make changes only in a particular layer, without affecting the ones above or below;
- and non the least it eases explanation and understanding on the way in which the network works;
We can think of layers as being services -- applications -- that receive requests, act accordingly, and issue responses.
For example the service primitives in the case of TCP are:
- listen -- on the server side it waits for connections;
- connect -- the client makes a connection to a server;
- The relation between protocols and services
- A service is a set of primitives (operations) that a layer provides to the layer above it. The service defines what operations the layer is prepared to perform on behalf of its users, but it says nothing at all about how these operations are implemented. A service relates to an interface between two layers, with the lower layer being the service provider and the upper layer being the service user.
- A protocol, in contrast, is a set of rules governing the format and meaning of the packets, or messages that are exchanged by the peer entities within a layer. Entities use protocols to implement their service definitions. They are free to change their protocols at will, provided they do not change the service visible to their users. In this way, the service and the protocol are completely decoupled. 
OSI -- ISO/OSI
The OSI model is an ISO standard created in 1983 and was meant to standardize the network layers, and it had the following principles:
- A layer should be created where a different abstraction is needed.
- Each layer should perform a well-defined function.
- The function of each layer should be chosen with an eye toward defining internationally standardized protocols.
- The layer boundaries should be chosen to minimize the information flow across the interfaces.
- The number of layers should be large enough that distinct functions need not be thrown together in the same layer.
And as a result they obtained seven layers which we shall see bellow.
Observation: We must note that the OSI model is a complex one, and that almost all protocols used today could be fitted into this model, even if they have lesser layers (some of them being collapsed).
- The physical layer is concerned with transmitting raw bits over a communication channel. The design issues have to do with making sure that when one side sends a 1 bit, it is received by the other side as a 1 bit, not as a 0 bit. Typical questions here are how many volts should be used to represent a 1 and how many for a 0, how many nanoseconds a bit lasts, whether transmission may proceed simultaneously in both directions, how the initial connection is established and how it is torn down when both sides are finished, and how many pins the network connector has and what each pin is used for. The design issues here largely deal with mechanical, electrical, and timing interfaces, and the physical transmission medium, which lies below the physical layer. 
- The main task of the data link layer is to transform a raw transmission facility into a line that appears free of undetected transmission errors to the network layer. It accomplishes this task by having the sender break up the input data into data frames (typically a few hundred or a few thousand bytes) and transmit the frames sequentially. If the service is reliable, the receiver confirms correct receipt of each frame by sending back an acknowledgment frame.
- Another issue that arises in the data link layer (and most of the higher layers as well) is how to keep a fast transmitter from drowning a slow receiver in data. Some traffic regulation mechanism is often needed to let the transmitter know how much buffer space the receiver has at the moment. Frequently, this flow regulation and the error handling are integrated.
- Broadcast networks have an additional issue in the data link layer: how to control access to the shared channel.A special sublayer of the data link layer, the medium access control sublayer, deals with this problem. 
This is usually split in two:
- media access Layer -- what are the conditions in which one can access the wire to send data -- see token ring from the previous course;
- logical link layer -- we are not concerned with how do we access the wire, we just imagine it to be a queue.
- The network layer controls the operation of the subnet. A key design issue is determining how packets are routed from source to destination. Routes can be based on static tables that are wired into the network and rarely changed. They can also be determined at the start of each conversation, for example, a terminal session (e.g., a login to a remote machine). Finally, they can be highly dynamic, being determined anew for each packet, to reflect the current network load.
- If too many packets are present in the subnet at the same time, they will get in one another's way, forming bottlenecks. The control of such congestion also belongs to the network layer. More generally, the quality of service provided (delay, transit time, jitter, etc.) is also a network layer issue.
- When a packet has to travel from one network to another to get to its destination, many problems can arise. The addressing used by the second network may be different from the first one. The second one may not accept the packet at all because it is too large. The protocols may differ, and so on. It is up to the network layer to overcome all these problems to allow heterogeneous networks to be interconnected.
- In broadcast networks, the routing problem is simple, so the network layer is often thin or even nonexistent. 
- The basic function of the transport layer is to accept data from above, split it up into smaller units if need be, pass these to the network layer, and ensure that the pieces all arrive correctly at the other end. Furthermore, all this must be done efficiently and in a way that isolates the upper layers from the inevitable changes in the hardware technology.
- The transport layer also determines what type of service to provide to the session layer, and, ultimately, to the users of the network. The most popular type of transport connection is an error-free point-to-point channel that delivers messages or bytes in the order in which they were sent. However, other possible kinds of transport service are the transporting of isolated messages, with no guarantee about the order of delivery, and the broadcasting of messages to multiple destinations. The type of service is determined when the connection is established. 
- The session layer allows users on different machines to establish sessions between them. Sessions offer various services, including dialog control (keeping track of whose turn it is to transmit), token management (preventing two parties from attempting the same critical operation at the same time), and synchronization (checkpointing long transmissions to allow them to continue from where they were after a crash). 
- Unlike lower layers, which are mostly concerned with moving bits around, the presentation layer is concerned with the syntax and semantics of the information transmitted. In order to make it possible for computers with different data representations to communicate, the data structures to be exchanged can be defined in an abstract way, along with a standard encoding to be used on the wire. The presentation layer manages these abstract data structures and allows higher-level data structures (e.g., banking records), to be defined and exchanged. 
- The application layer contains a variety of protocols that are commonly needed by users. One widely-used application protocol is HTTP (HyperText Transfer Protocol), which is the basis for the World Wide Web. When a browser wants a Web page, it sends the name of the page it wants to the server using HTTP. The server then sends the page back. Other application protocols are used for file transfer, electronic mail, and network news. 
- Computer networks -- 4th edition -- by Andrew Tannenbaum