我对ISO 七层模型的理解
应用层:
负责native格式的请求配置,请求发起、关闭等功能;
负责应用数据请求可直接调用的api的支持。
使用表示层和会话层包装而成的便捷工具(API):Alamofire
表示层:
将应用层配置的数据格式化为协议支持的数据格式(数据包);
根据应用要求和协议规定进行请求和相应数据的格式化和反格式化;
Techopedia explains Presentation Layer
The presentation layer is responsible for the following:
- Data encryption/decryption
- Character/string conversion
- Data compression
- Graphic handling
The presentation layer mainly translates data between the application layer and the network format. Data can be communicated in different formats via different sources. Thus, the presentation layer is responsible for integrating all formats into a standard format for efficient and effective communication.
OSI模型的表示层,为应用层提供数据,并负责数据装换和代码的格式化。从本质上来说,这一层是翻译器,并提供编码和转换功能。
会话层:
承接应用层的请求发起、关闭指令,进行会话处理和控制;包含会话数据的安全;
包含 http的会话管理策略、鉴权策略、ssl加密策略、证书验证策略、缓存策略等等等;
token、sessionid,cookie,应用状态码等。
根据协议规定进行会话控制;
会话层是整个应用通信的核心;应用层所做的工作就是和表示层、会话层一起协作,配置会话需要的数据,从而完成会话。
编程的过程实在最上面的三个层次进行的;
之所以要分为三个层次,是为了方便逻辑上的组织;没有其它更多用途。
The Presentation Layer (Layer 6)
This layer is sometimes called the syntax layer. It isn’t often referred to, but in general the Presentation Layer is responsible for converting application data to a syntax that is ready for network transport using lower layer protocols.
https://www.wordfence.com/learn/networking-for-wordpress-administrators/
https://www.networxsecurity.org/members-area/glossary/o/osi-model.html
https://www.networxsecurity.org/members-area/glossary/o/osi-model.html
Application (think web browser, email client)
Application layer usually is the easiest to understand, so we should start our discussion here. This layer can be the program running on your computer (or on a server) that connects you to Google.com, eBay, or this blog. The client application will exchange data with the server application (and vice versa) without understanding Ethernet, TCP/IP, or other networking techniques (in general). This application data requires some processing locally before sending it to the server, care of the next several layers. I've provided examples next to the layer name, to help connect the layer to a common implementation.
Presentation (think encryption, compression)
Presentation layer provides formatting for data to be transferred between systems, so the end-system can readily receive and interpret the application data correctly. This step was vital when differing standards of data format were a problem (think 7-bit ASCII vs 8-bit EBCDIC). The most common examples now would be any encryption/decryption required for transmitting application data (not VPN-based, but application-based encryption) or the use of compression within applications transmitting data between systems.
Session (think Remote Procedure Calls)
Session layer provides a way for applications to "synchronize" their client-server communication and translate between "transport addresses" of Layer 4 and the "session addresses" that represent the application. If a system were running Firefox and Internet Explorer simultaneously, the session layer keeps Layer 4 connections associated with the right browser (or the pages displayed would be unusable in most cases). A good example of this layer are the remote procedure calls (RPC) associated with many client-server applications like Microsoft Exchange and Network File System (NFS).
https://primacore.net/articles/osi-model-overview.html
会话层:
在ssh、fastcgi以及http2等协议中,确实是有session的概念的。一个tcp链接里multiplex了多个session,每个session都可以单独close,创建session基本没有开销,session就相当于轻量级链接。
The session layer provides the mechanism for opening, closing and managing a session between end-user application processes, Communication sessions consist of requests and responses that occur between applications.
Session-layer services are commonly used in application environments that make use of remote procedure calls (RPCs).
Session layer establishes, controls and ends the sessions between local and remote applications.(tracks the dialogs between multiple computers)