Skip to content

SNMP_Embedded v3.3.5 — Five-input system-group call: the library deduces your buffer sizes

Choose a tag to compare

@syntax1269 syntax1269 released this 06 Sep 01:23
· 10 commits to main since this release

v3.3.4 introduced the one-call RFC 1213 system-group helper, but the read-write
strings needed an explicit sizeof() per buffer — safe, yet noisy. v3.3.5
listens to how the API actually reads:

// Before (v3.3.4): 8 arguments, three sizeof() calls
snmp.addRFC1213SystemGroup(sysDescr,
    &sysContact, sizeof(sysContactBuf),
    &sysName,    sizeof(sysNameBuf),
    &sysLocation,sizeof(sysLocBuf), &sysServices);

// Now (v3.3.5): 5 arguments, zero sizeof()
snmp.addRFC1213SystemGroup(sysDescr, sysContactBuf, sysNameBuf, sysLocBuf, &sysServices);

Skip an OID in one self-documenting token — RFC1213_SKIP replaces the
nullptr, 0 pair:

// only sysName + sysLocation exist on this agent:
snmp.addRFC1213SystemGroup(sysDescr, RFC1213_SKIP, sysNameBuf, sysLocBuf, nullptr);

Safety didn't move — it got stricter

  • The capacity is deduced from the array itself, so a SET can still never
    overflow your storage (over-long SETs answer WRONG_LENGTH, covered by a new
    host test).
  • SysBuf accepts real arrays or RFC1213_SKIP — and not a bare char*.
    A pointer has no deducible capacity, so that mistake fails to compile
    instead of silently guessing.
  • Heap or runtime-sized storage? The v3.3.4 pointer+len overload remains; both
    forms work side by side (and SNMP_Sensor now shows them together).

Under the hood

  • New StringBufCallback binds the char[] directly — same semantics as the
    pointer form, zero allocation.
  • All five sketches/examples updated to teach the auto-size form.

Verification

  • Host suite: 243 assertions / 22 test cases (default) · 175 / 17 with
    -DSNMP_NO_BUILTIN_SYSUPTIME — both exit clean.
  • Compile matrix: 8/8 (2 examples × ESP8266 + ESP32, 2 CLI demos,
    PlatformIO minimal × 2 envs).
  • Hardware (ESP8266): clean boot, 1-minute flood soak at ~3 ops/s — 0 pool
    alarms, 0 crashes, heap floor 23,504 B.