SmartSNMP API
=============

In general, if you want to embed **SmartSNMP** in your application, then you
need to use SmartSNMP as a lua library instead of using `bin/snmpd`.

Use SmartSNMP as A Lua Library
------------------------------

First, you need to import SmartSNMP library like this.

    local smartsnmp = require "smartsnmp"

And now, SmartSNMP provide following API.

- `smartsnmp.init(protocol, port)` : initialize agent with specified protocol and port number.
  - `protocol` : protocol name, eg: 'snmp';
  - `port` : port number, eg: 161.
- `smartsnmp.open()` : open the agent.
- `smartsnmp.start() : start to run the agent.
- `smartsnmp.set_ro_community(community, oid)` : set read only community.
  - `community` : read only community string, eg: 'public';
  - `oid` : oid view to be registered, eg: `{1,3,6,1,2,1,1}`.
- `smartsnmp.set_rw_community(community, oid)` : set read/write community.
  - `community` : read write community string, eg: 'private';
  - `oid` : oid view to be registered, eg: `{1,3,6,1,2,1,4}`.
- `smartsnmp.set_ro_user(user, oid)` : set read only user.
  - `user` : read only user name, eg: 'Jack';
  - `oid` : oid view to be registered, eg: `{1,3,6,1,2,1,1}`.
- `smartsnmp.set_rw_user(user, oid)` : set read/write user.
  - `user` : read write user name, eg: 'Jack';
  - `oid` : oid view to be registered, eg: `{1,3,6,1,2,1,4}`.
- `smartsnmp.register_mib_group(oid, mib_group, name)` : register mib group into core.
  - `oid` : group oid to be registered, eg: `{1,3,6,1,2,1,1}`;
  - `mib_group` : generated by SmartSNMP group generator;
  - `name` : mib group name.
- `smartsnmp.unregister_mib_group(mib_oid)` : unregister mib group.
  - `oid` : group oid to be unregistered, eg: `{1,3,6,1,2,1,1}`.
- `smartsnmp.group_index_table_check(mib_group, name)` : Check if the mib group can be traversed in lexicographical order.
  - `mib_group` : object generated by SmartSNMP group generator;
  - `name` : mib group name.
