feat(p2): typed SET values, multi-varbind set, Client#set - #22
Merged
Conversation
Session#set only understood String/Int/Bool/Nil; the AppTags enum was unused, so Counters, Gauges, TimeTicks, IpAddress etc could not be set without hand-building a BER. Add typed value structs that encode themselves as application-tagged (RFC 3416) values, verified to round-trip through the wire. - values: TypedValue module + Counter32/Gauge32/TimeTicks/Counter64/IpAddress/ Opaque/OID structs, each with #to_ber setting the right Application tag - session, v3/session: recognise TypedValue in set; extract a to_varbind helper - spec: set_values_spec covers each type's tag/number/payload + a Session#set wire Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
RFC 3416 lets one SetRequest assign several variables. Add a Hash(String, _) overload so multiple OID => value pairs go out in a single request; the Hash keeps insertion order, so varbind order is preserved. - session, v3/session: set(values : Hash(String, _)) reusing to_varbind - spec: multi_set_spec covers the v2c and v3 builders Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Client had get/get_next/get_bulk/walk/bulk_walk but no set. Add single and multi-varbind set that round-trip through the socket, mirroring the existing read methods. - client: set(oid, value) and set(values : Hash(String, _)) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
64 tasks
This was referenced Jul 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second slice of the P2 (protocol completeness) group (#7) — the write story. Follows #21 (read/bulk).
Commits (one per audit item)
feat: typed SNMP SET value types—Session#setonly understood String/Int/Bool/Nil and theAppTagsenum was unused, so counters/gauges/timeticks/addresses couldn't be set without hand-building a BER. Adds aTypedValuemodule +Counter32/Gauge32/TimeTicks/Counter64/IpAddress/Opaque/OIDstructs, each encoding itself as an application-tagged (RFC 3416) value. Verified to round-trip through the wire.feat: multi-varbind set—set(values : Hash(String, _))assigns several OIDs in one SetRequest; the Hash keeps insertion order. Extracts a sharedto_varbindhelper.feat(client): expose set—Client#set(oid, value)andClient#set(values : Hash), mirroring the existing read methods.Usage
Tests
set_values_spec(each type's tag/number/payload + aSession#setwire) andmulti_set_spec(v2c + v3 builders) — offline.Client#setis socket glue, exercised by thee2esuite. Deterministic 70/70, multi-threaded 70/70, legacy 3/3, ameba clean, format clean; commits bisect-clean.Tracked in #7. Remaining P2 slices: v3 Report/usmStats resync → HC counters/ifXTable → trap/inform sending.
🤖 Generated with Claude Code