---
name: "ng_h4"
section: "4"
platform: "linux"
package: "freebsd-manpages"
version: "6.0-5"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/ng_h4"
---

# ng\_h4(4)

Netgraph node type that is also an H4 line discipline

## NAME

**ng\_h4** – Netgraph node type that is also an H4 line discipline

## SYNOPSIS

**#include \<sys/types.h\>**

**#include \<netgraph/bluetooth/include/ng\_h4.h\>**

## DESCRIPTION

The **h4** node type is both a persistent Netgraph node type and a H4 line discipline. It implements a Bluetooth HCI UART transport layer as per chapter H4 of the Bluetooth Specification Book v1.1. A new node is created when the corresponding line discipline, H4DISC, is registered on a tty device (see [tty(4)](/tty/4.md)).

The node has a single hook called hook. Incoming bytes received on the tty device are re-assembled into HCI frames (according to the length). Full HCI frames are sent out on the hook. HCI frames received on hook are transmitted out on the tty device. No modification to the data is performed in either direction. While the line discipline is installed on a tty, the normal read and write operations are unavailable, returning EIO.

Information about the node is available via the netgraph [ioctl(2)](/ioctl/2.md) command NGIOCGINFO. This command returns a *struct nodeinfo* similar to the NGM\_NODEINFO [netgraph(4)](/netgraph/4.md) control message.

## HOOKS

This node type supports the following hooks:

- hook

  single HCI frame contained in single *mbuf* structure.

## CONTROL MESSAGES

This node type supports the generic control messages, plus the following:

- NGM\_H4\_NODE\_RESET

  Reset the node.

- NGM\_H4\_NODE\_GET\_STATE

  Returns current receiving state for the node.

- NGM\_H4\_NODE\_GET\_DEBUG

  Returns an integer containing the current debug level for the node.

- NGM\_H4\_NODE\_SET\_DEBUG

  This command takes an integer argument and sets current debug level for the node.

- NGM\_H4\_NODE\_GET\_QLEN

  Returns current length of outgoing queue for the node.

- NGM\_H4\_NODE\_SET\_QLEN

  This command takes an integer argument and sets maximum length of outgoing queue for the node.

- NGM\_H4\_NODE\_GET\_STAT

  Returns various statistic information for the node, such as: number of bytes (frames) sent, number of bytes (frames) received and number of input (output) errors.

- NGM\_H4\_NODE\_RESET\_STAT

  Reset all statistic counters to zero.

## SHUTDOWN

This node shuts down when the corresponding device is closed (or the line discipline is uninstalled on the device).

## SEE ALSO

[ioctl(2)](/ioctl/2.md), [netgraph(4)](/netgraph/4.md), [tty(4)](/tty/4.md), [ngctl(8)](/ngctl/8.md)

## HISTORY

The **h4** node type was implemented in FreeBSD 5.0.

## AUTHORS

Maksim Yevmenkin ⟨m\_evmenkin@yahoo.com⟩

## BUGS

This node still uses [spltty(9)](/spltty/9.md) to lock tty layer. This is wrong.
