λ³Έλ¬Έ λ°”λ‘œκ°€κΈ°
Computer Science/Network

8 μΊ‘μŠν™”μ™€ μ—­μΊ‘μŠν™” - Encapsulation & Decapsulation

by Dowon Kang 2023. 12. 19.

μΊ‘μŠν™” (Encapsulation)

λ„€νŠΈμ›Œν¬μ—μ„œμ˜ μΊ‘μŠν™”λŠ” λ°μ΄ν„°λ₯Ό μ „μ†‘ν•˜κΈ° μœ„ν•΄ νŠΉμ • ν”„λ‘œν† μ½œμ—μ„œ μ‚¬μš©ν•˜λŠ” νŒ¨ν‚·μœΌλ‘œ κ°μ‹ΈλŠ” κ³Όμ •μ„ μ˜λ―Έν•©λ‹ˆλ‹€. 이 νŒ¨ν‚·μ€ μ†‘μ‹ μžμ—μ„œ μˆ˜μ‹ μžλ‘œ μ „μ†‘λ˜λŠ” λ™μ•ˆ μ—¬λŸ¬ 계측을 거쳐 μ΄λ™ν•˜κ²Œ 되며, 각 κ³„μΈ΅μ—μ„œλŠ” ν•΄λ‹Ή κ³„μΈ΅μ˜ 정보λ₯Ό 헀더λ₯Ό 뢙이며 μΆ”κ°€ν•˜μ—¬ 데이터가 λͺ©μ μ§€μ— μ •ν™•ν•˜κ²Œ 도달할 수 μžˆλ„λ‘ ν•©λ‹ˆλ‹€.


μ—­μΊ‘μŠν™” (Decapsulation)

μ—­μΊ‘μŠν™”λŠ” μˆ˜μ‹ μžκ°€ 데이터λ₯Ό 전솑받은 ν›„, 각 κ³„μΈ΅μ—μ„œ ν•΄λ‹Ήν•˜λŠ” 헀더 정보λ₯Ό μ œκ±°ν•˜κ³  원본 데이터λ₯Ό μΆ”μΆœν•˜λŠ” κ³Όμ •μž…λ‹ˆλ‹€. 즉,각 κ³„μΈ΅μ—μ„œ μΆ”μΆœλœ 정보λ₯Ό 기반으둜 데이터λ₯Ό ν•΄μ„ν•˜μ—¬ μƒμœ„ κ³„μΈ΅μœΌλ‘œ μ „λ‹¬ν•©λ‹ˆλ‹€. μ΄λŸ¬ν•œ λ„€νŠΈμ›Œν¬μ—μ„œμ˜ μΊ‘μŠν™”μ™€ μ—­μΊ‘μŠν™” κ³Όμ •μ€ νš¨μœ¨μ μ΄κ³  μ•ˆμ •μ μΈ λ°μ΄ν„° μ „솑을 κ°€λŠ₯μΌ€ ν•˜λ©°, μ΄λŠ” λ„€νŠΈμ›Œν¬ ν†΅μ‹ μ˜ ν•΅μ‹¬ μ›λ¦¬ μ€‘ ν•˜λ‚˜μž…λ‹ˆλ‹€.

 

 


 

λ„€νŠΈμ›Œν¬ ν†΅μ‹ μ—μ„œ 헀더와 νŠΈλ ˆμΌλŸ¬μ— λŒ€ν•΄ 더 μ•Œμ•„λ΄…μ‹œλ‹€. 

 

ν—€λ”μ—λŠ” λ°μ΄ν„°λ₯Ό μ˜¬λ°”λ₯΄κ²Œ μ „μ†‘ν•˜κ³ , λͺ©μ μ§€μ— λ„λ‹¬ν•˜κΈ° μœ„ν•΄ ν•„μš”ν•œ μ œμ–΄ λ° λΌμš°νŒ… μ •λ³΄κ°€ ν¬ν•¨λ©λ‹ˆλ‹€.

 

ν—€λ”μ—λŠ” μ „μ†‘λ˜λŠ” λ°μ΄ν„°μ˜ μ’…λ₯˜λ₯Ό μ‹λ³„ν•˜κΈ° μœ„ν•œ ν”„λ‘œν† μ½œ 정보가 담겨 μžˆμŠ΅λ‹ˆλ‹€. 예λ₯Ό λ“€μ–΄, TCP/IPμ—μ„œλŠ” TCP ν”„λ‘œν† μ½œμ˜ ν—€λ”μ—λŠ” 솑신지, μˆ˜μ‹ μ§€, μ‹œν€€μŠ€ 번호 등이 ν¬ν•¨λ©λ‹ˆλ‹€. 또 ν•œ, ν—€λ”μ—λŠ” 데이터가 μ†μƒλ˜μ—ˆλŠ”μ§€λ₯Ό κ²€μ¦ν•˜κΈ° μœ„ν•œ 체크섬(Checksum)κ³Ό 같은 정보가 λ“€μ–΄ μžˆμŠ΅λ‹ˆλ‹€.

 

 

트레일러 (Trailer)


νŠΈλ ˆμΌλŸ¬μ—λŠ” 데이터 전체에 λŒ€ν•œ μ—λŸ¬ 체크 정보가 담겨 μžˆμ–΄, 데이터가 μ†μƒλ˜μ§€ μ•Šμ•˜λŠ”μ§€λ₯Ό κ²€μ¦ν•©λ‹ˆλ‹€. νŠΈλ ˆμΌλŸ¬λŠ” μ „μ†‘λ˜λŠ” λ°μ΄ν„°μ˜ 끝 뢀뢄에 μœ„μΉ˜ν•˜λ©°, 헀더와 ν•¨κ»˜ 데이터λ₯Ό κ°μ‹ΈλŠ” 역할을 ν•©λ‹ˆλ‹€.

 

 



Encapsulation involves wrapping data in a specific format or structure, including headers and possibly trailers, for transmission over a network. This process helps in organizing and securing the data for effective communication.

 

Decapsulation occurs when data is received at the destination. The headers and trailers added during encapsulation are successively removed at each layer to extract the original data.

Headers are added to the beginning of a data packet to include information such as source and destination addresses, sequencing, and protocol details. Headers help in routing and interpreting the data at each network layer.

Trailers are optional and may include error-checking information (like a checksum). Trailers are placed at the end of the data packet and are used to verify the integrity of the transmitted data.

 

 

λŒ“κΈ€