> For the complete documentation index, see [llms.txt](https://krjaeh0.gitbook.io/j-log/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://krjaeh0.gitbook.io/j-log/network/protocols/hdlc.md).

# HDLC

## HDLC(High-Level Data Link Control)란?

* 데이터 링크 계층(Layer 2)에서 사용하는 비트 지향(비트 단위 전송) 프로토콜
* 데이터를 신뢰성 있게 전송하기 위해 프레임 구조를 정의하고 오류 제어 기능을 제공한다. (CRC 포함)
* 점대점(Point-to-Point), 다중점(Multipoint) 통신 지원
* ISO(국제 표준화 기구)가 정의한 표준 프로토콜

***

## HDLC의 주요 기능

| 기능                     | 설명                                 |
| ---------------------- | ---------------------------------- |
| 데이터 프레임화(Framing)      | 데이터를 프레임 단위로 나누어 전송                |
| 흐름 제어(Flow Control)    | 송신 속도를 조절하여 네트워크 과부하 방지            |
| 오류 제어(Error Control)   | CRC(Cyclic Redundancy Check) 오류 검출 |
| 비트 지향(Bit-Oriented) 방식 | 데이터를 비트 단위로 처리하여 다양한 데이터 형식 지원     |

***

## HDLC의 프레임 구조

* 데이터를 프레임(Frame) 단위로 전송하며, 각 프레임은 고유한 구조를 가진다.

| 필드                        | 크기        | 설명                                          |
| ------------------------- | --------- | ------------------------------------------- |
| 플래그(Flag)                 | 8bit      | <p>프레임의 시작과 끝을 나타낸다.<br>01111110 (0x7E)</p> |
| 주소(Address)               | 8\~16bit  | 목적지 주소를 지정                                  |
| 제어(Control)               | 8\~16bit  | 프레임 유형(정보, 제어, 비번호 응답)                      |
| 데이터(Data)                 | 가변        | 전송할 실제 데이터                                  |
| FCS(Frame Check Sequence) | 16\~32bit | CRC 오류 검출                                   |

* HDLC 프레임 예시

{% code title="HDLC 프레임 예시" %}

```
| Flag (01111110) | Address | Control | Data | FCS | Flag (01111110) |
```

{% endcode %}

***

## HDLC의 프레임 유형

| 유형                        | 설명                      |
| ------------------------- | ----------------------- |
| <p>정보 프레임<br>I-Frame</p>  | 데이터 전송을 담당              |
| <p>감독 프레임<br>S-Frame</p>  | 흐름 제어(ACK/NACK) 및 오류 제어 |
| <p>비번호 프레임<br>U-Frame</p> | 링크 설정 및 관리              |

* I-Frame은 실제 데이터를 전송, S-Frame과 U-Frame은 제어 및 관리

***

## HDLC의 동작 모드

| 모드                                                    | 설명                                          | 비고                                           |
| ----------------------------------------------------- | ------------------------------------------- | -------------------------------------------- |
| <p>정규 응답 모드<br>(NRM, Normal Response Mode)</p>        | <p>마스터-슬레이브 방식 (1대 다수),<br>슬레이브는 응답만 가능</p> | <p>중앙 집중식 네트워크<br>(슬레이브가 마스터의 명령을 기다린다.)</p> |
| <p>비동기 균형 모드<br>(ABM, Asynchronous Balanced Mode)</p> | <p>점대점 방식,<br>송신/수신 역할을 자유롭게 수행</p>         | 두 장치가 대등한 관계에서 데이터를 송수신 가능                   |
| <p>비동기 응답 모드<br>(ARM, Asynchronous Response Mode)</p> | <p>비동기 방식 마스터-슬레이브,<br>거의 사용되지 않는다.</p>     | -                                            |

***

## HDLC의 장점과 단점

| 장점                                                   | 단점                                                                  |
| ---------------------------------------------------- | ------------------------------------------------------------------- |
| <p>신뢰성 높은 데이터 전송<br>→ 오류 검출(CRC) 및 흐름 제어 제공</p>      | <p>헤더 오버헤드 존재<br>→ 플래그, 주소, 제어 필드가 추가되어 데이터 크기가 증가</p>              |
| <p>효율적인 프레임 구조<br>→ 불필요한 헤더 정보 없이 효율적인 데이터 전송 가능</p> | <p>비트 스터핑(비트 삽입) 필요<br>→ 01111110(플래그)와 동일한 데이터가 포함되면 추가 처리가 필요</p> |
| <p>다양한 통신 방식 지원<br>→ 점대점, 다중점 가능</p>                 | <p>WAN 전용 프로토콜<br>→ LAN 환경에서는 사용되지 않는다.</p>                         |

***

## HDLC의 활용 분야

* 주로 WAN 환경에서 사용되며, 점대점 연결에서 많이 활용된다.

| 사용 분야                                           | 설명                      |
| ----------------------------------------------- | ----------------------- |
| WAN 네트워크                                        | 라우터 간 점대점(Serial) 연결    |
| <p>위성 통신<br>(Satellite Communication)</p>       | 원거리 데이터 전송              |
| x.25 네트워크                                       | 패킷 교환 네트워크에서 프레임 관리     |
| <p>PPP 기반 네트워크<br>(Point-to-Point Protocol)</p> | HDLC에서 발전한 PPP 프로토콜을 사용 |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://krjaeh0.gitbook.io/j-log/network/protocols/hdlc.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
