Skip to content

Additional SNMP library output formatting options#21502

Draft
eskyuu wants to merge 7 commits intophp:masterfrom
eskyuu:snmp-displayoptions
Draft

Additional SNMP library output formatting options#21502
eskyuu wants to merge 7 commits intophp:masterfrom
eskyuu:snmp-displayoptions

Conversation

@eskyuu
Copy link

@eskyuu eskyuu commented Mar 23, 2026

The SNMP library has more formatting options than php-snmp allows. This PR adds some additional functions to control how the net-snmp library returns results to PHP.

Comment on lines +1514 to +1515
netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NUMERIC_TIMETICKS, (int) a1);
RETURN_TRUE;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless you're going to do something with the return value of netsnmp_ds_set_boolean() I think just having the function be void is better.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm actually wondering if a generic function like php_snmp_set_output_option(int, bool); would be better. Similar to what we do with SNMP_OID_OUTPUT_*

It would be a similar amount of work to add a new option. The difference would be:

  • Add a new const to snmp.stub.php instead of a function
  • Add new const to switch statement in php_snmp_set_output_option instead of copying the function

I'll have a think, but am leaning towards one function instead of many new ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants