NG_ASYNC(4)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

okay so this is NG_ASYNC(4), straight outta the Kernel Interfaces Manual, and it's the async framing netgraph node type page β€” yes bestie, we're doing kernel networking today πŸ’…βœ¨

πŸŽ€ NAME πŸŽ€

ng_async β€” asynchronous framing netgraph node type. that's the whole name, no cap 🫢

🌸 SYNOPSIS 🌸

slap these includes in and you're so ready:

#include <sys/types.h>
#include <netgraph/ng_async.h>

πŸ’– DESCRIPTION πŸ’–

okay so the async node type is out here converting between synchronous frames and asynchronous frames, exactly as defined for the PPP protocol in RFC 1662. Asynchronous framing uses flag bytes and octet-stuffing to simulate a frame-oriented connection over an octet-oriented asynchronous serial line β€” it's giving protocol magic ✨

The node transmits and receives asynchronous data on the async hook. Mbuf boundaries of incoming data are ignored β€” literally ignored, don't come for them. Once a complete packet has been received, it is decoded and stripped of all framing bytes, and transmitted out the sync hook as a single frame. slay.

Synchronous frames are transmitted and received on the sync hook. Packets received on this hook are encoded as asynchronous frames and sent out on async. Received packets should start with the address and control fields, or the PPP protocol field if address and control field compression is employed, and contain no checksum field. And if the first four bytes are 0xff 0x03 0xc0 0x21 (an LCP protocol frame), then complete control character escaping is enabled for that frame β€” in PPP, LCP packets are always sent with no address and control field compression and all control characters escaped. iykyk 😌

This node supports β€œflag sharing” for packets transmitted on async. This is an optimization where the trailing flag byte of one frame is shared with the opening flag byte of the next. Flag sharing between frames is disabled after one second of transmit idle time. cute optimization, but the timer said periodt ⏱️

πŸ¦‹ HOOKS πŸ¦‹

This node type supports the following hooks:

  • async β€” Asynchronous connection. Typically this hook would be connected to a ng_tty(4) node, which handles transmission of serial data over a tty device. so yes, serial tty business πŸ’«
  • sync β€” Synchronous connection. This hook sends and receives synchronous frames. For PPP, these frames should contain address, control, and protocol fields, but no checksum field. Typically this hook would be connected to an individual link hook of a ng_ppp(4) type node. link hook energy πŸ”—

πŸ’¬ CONTROL MESSAGES πŸ’¬

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

🌟 NGM_ASYNC_CMD_SET_CONFIG (setconfig)

Sets the node configuration, which is described by a struct ng_async_cfg:

struct ng_async_cfg {
        u_char    enabled;  /* Turn encoding on/off */
        uint16_t  amru;     /* Max receive async frame length */
        uint16_t  smru;     /* Max receive sync frame length */
        uint32_t  accm;     /* ACCM encoding */
};

The enabled field enables or disables all encoding/decoding functions (default disabled). When disabled, the node operates in simple β€œpass through” mode. The amru and smru fields are the asynchronous and synchronous MRU (maximum receive unit) values, respectively. These both default to 1600; note that the async MRU applies to the incoming frame length after asynchronous decoding. The accm field is the asynchronous character control map, which controls the escaping of characters 0x00 through 0x1f (default 0xffffffff). config me up πŸ’…

🌈 NGM_ASYNC_CMD_GET_CONFIG (getconfig)

This command returns the current configuration structure. simple as that, no cap πŸ’…

πŸ“ NGM_ASYNC_CMD_GET_STATS (getstats)

This command returns a struct ng_async_stat containing node statistics for packet, octet, and error counts. stats girlies rise πŸ“

🧚 NGM_ASYNC_CMD_CLR_STATS (clrstats)

Clears the node statistics. bye-bye counters 🧹

πŸ›‘ SHUTDOWN πŸ›‘

This node shuts down upon receipt of a NGM_SHUTDOWN control message, or when all hooks have been disconnected. that's the exit strategy, bestie 🫢

πŸ‘€ SEE ALSO πŸ‘€

πŸ“œ HISTORY πŸ“œ

The ng_async node type was implemented in FreeBSD 4.0. vintage but still iconic πŸ’œ

πŸ’Œ AUTHORS πŸ’Œ

Archie Cobbs <archie@FreeBSD.org> β€” that's the author, give them their flowers πŸ’


okay that's the whole page, bestie β€” this NG_ASYNC(4) manual comes from the Debian manual set and is dated November 13, 2012. mwah, go forth and frame some async data πŸ’‹βœ¨

πŸ“¦ where this page comes from