npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-rohc

v1.0.5

Published

Binding ROHC library

Readme

Node-Rohc

Node.js Binding ROHC library, see more on https://github.com/stefanwerfling/rohc.

  • More information, see on: https://de.wikipedia.org/wiki/ROHC.
  • Inspired by:
    • https://github.com/airbus-cyber/IP2LoRa
    • https://www.cyber.airbus.com/ip2lora-a-diverted-use-of-lora-to-build-your-wireless-ip-link-over-kilometers/

A package for binding to the rohc library with Typescript. It will later be combined with https://github.com/stefanwerfling/node-tuntap2. It is intended to reduce data traffic, for example via LoRa, a VPN or etc.

This is an alpha version 1.0.5!

Rohc install

sudo apt-get install autotools-dev
sudo apt-get install automake
sudo apt-get install libtool
sudo apt-get install libpcap-dev
sudo apt-get install -y libcmocka-dev

git clone https://github.com/stefanwerfling/rohc.git
cd rohc

./autogen.sh --prefix=/usr

make all
sudo make install
cd yourProject
npm intall git+https://github.com/stefanwerfling/node-rohc

or

npm i node-rohc

Check build by hand:

npm run build --loglevel verbose

Used

import {Rohc, RohcProfiles, RohcStatus} from 'node-rohc';

console.log(Rohc.getVersion());

const r = new Rohc([
  RohcProfiles.ROHC_PROFILE_UNCOMPRESSED,
  RohcProfiles.ROHC_PROFILE_IP,
  RohcProfiles.ROHC_PROFILE_TCP,
  RohcProfiles.ROHC_PROFILE_UDP,
  RohcProfiles.ROHC_PROFILE_ESP,
  RohcProfiles.ROHC_PROFILE_RTP
]);

r.setLogger(msg => {
    console.log(msg);
});

try {
    const compress = r.compress(new Uint8Array(ipPacketBufferWithContent));

    console.log(compress);

    if (compress) {
        console.log(Buffer.from(compress).toString("hex"));

        const decompress = r.decompress(compress);

        console.log(decompress);

        if (decompress) {
            console.log(Buffer.from(decompress).toString("hex"));
        }
    }

    if (r.getLastStatus() === RohcStatus.ROHC_OK) {
      console.log('All OK');
    }
    
    console.log(r.compressLastPacketInfo());
    console.log(r.compressGeneralInfo());
    console.log(r.decompressLastPacketInfo());
    console.log(r.decompressGeneralInfo());
} catch (e) {
    console.error(e);
}

Output:

Debugger attached.
Uint8Array(52) [
   69,   0,   0,  52,   0,   0,   0,   0,  64,  6, 249,
  112, 192, 168,   0,   1, 192, 168,   0,   2, 72, 101,
  108, 108, 111,  44,  32, 116, 104, 105, 115, 32, 105,
  115,  32, 116, 104, 101,  32, 100,  97, 116, 97,  32,
  112,  97, 121, 108, 111,  97, 100,  33
]
2.4.0~a0d95093
Buffer Dump: 45 00 00 34 00 00 00 00 40 06 f9 70 c0 a8 00 01 c0 a8 00 02 48 65 6c 6c 6f 2c 20 74 68 69 73 20 69 73 20 74 68 65 20 64 61 74 61 20 70 61 79 6c 6f 61 64 21 
[rohc_comp.c:640 rohc_comp_get_profile()] ROHCv1 Uncompressed profile is possible

[rohc_comp.c:1022 rohc_comp_are_ip_hdrs_supported()] found IPv4

[rohc_comp.c:1078 rohc_comp_are_ip_hdrs_supported()]    source address = c0a80001 (192.168.0.1)
...

[rohc_comp.c:1595 rohc_compress4()] copy full 32-byte payload

[rohc_comp.c:1603 rohc_compress4()] ROHC size = 53 bytes (header = 21, payload = 32), output buffer size = 2048

compress status: = 0
Uint8Array(53) [
  253,   4,  69,  64,   6, 192, 168,   0,   1, 192, 168,
    0,   2,   0,  64,   0,   0,  32,   0, 251, 103,  72,
  101, 108, 108, 111,  44,  32, 116, 104, 105, 115,  32,
  105, 115,  32, 116, 104, 101,  32, 100,  97, 116,  97,
   32, 112,  97, 121, 108, 111,  97, 100,  33
]
fd04454006c0a80001c0a80002004000002000fb6748656c6c6f2c2074686973206973207468652064617461207061796c6f616421
Buffer Dump: fd 04 45 40 06 c0 a8 00 01 c0 a8 00 02 00 40 00 00 20 00 fb 67 48 65 6c 6c 6f 2c 20 74 68 69 73 20 69 73 20 74 68 65 20 64 61 74 61 20 70 61 79 6c 6f 61 64 21 
[rohc_decomp.c:793 rohc_decompress3()] decompress the 53-byte packet #1

[rohc_decomp.c:3924 rohc_decomp_parse_padding()] skip 0 byte(s) of padding

[rohc_decomp.c:3852 rohc_decomp_decode_cid()] no add-CID found, CID defaults to 0

....

decompress status: = 0
Uint8Array(52) [
   69,   0,   0,  52,   0,   0,   0,   0,  64,  6, 249,
  112, 192, 168,   0,   1, 192, 168,   0,   2, 72, 101,
  108, 108, 111,  44,  32, 116, 104, 105, 115, 32, 105,
  115,  32, 116, 104, 101,  32, 100,  97, 116, 97,  32,
  112,  97, 121, 108, 111,  97, 100,  33
]
45000034000000004006f970c0a80001c0a8000248656c6c6f2c2074686973206973207468652064617461207061796c6f616421
All OK
{
  version_major: 0,
  version_minor: 0,
  context_id: 0,
  is_context_init: true,
  context_mode: 1,
  context_state: 1,
  context_used: true,
  profile_id: 4,
  packet_type: 0,
  total_last_uncomp_size: 52,
  header_last_uncomp_size: 20,
  total_last_comp_size: 53,
  header_last_comp_size: 21
}
{
  version_major: 0,
  version_minor: 0,
  contexts_nr: 1,
  packets_nr: 1,
  uncomp_bytes_nr: 52,
  comp_bytes_nr: 53
}
{
  version_major: 0,
  version_minor: 0,
  context_mode: 2,
  context_state: 3,
  profile_id: 4,
  nr_lost_packets: 0,
  nr_misordered_packets: 0,
  is_duplicated: false,
  corrected_crc_failures: 11745388377929038000,
  corrected_sn_wraparounds: 14987979559889062000,
  corrected_wrong_sn_updates: 12105675798372346000,
  packet_type: 449595,
  total_last_comp_size: 18407961667527770000,
  header_last_comp_size: 1940628627783807,
  total_last_uncomp_size: 18407961667125117000,
  header_last_uncomp_size: 217316637802623
}
{
  version_major: 0,
  version_minor: 0,
  contexts_nr: 1,
  packets_nr: 1,
  comp_bytes_nr: 53,
  uncomp_bytes_nr: 52,
  corrected_crc_failures: 0,
  corrected_sn_wraparounds: 8518447232180027000,
  corrected_wrong_sn_updates: 4295000063
}

Dev

Missing rohclib.o

Set path for the Linker to the libary:

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
npm run build --loglevel verbose

Doc

  • https://rohc-lib.org/support/documentation/API/rohc-doc-2.3.1/group__rohc.html

Helpful pages

  • https://hpd.gasmi.net/
  • https://www.sharetechnote.com/html/Handbook_LTE_ROHC.html