Logo
Home page Net-SNMP

Archive Search:

Require all words?

Site Search:
Google
Main Page | Modules | Data Structures | File List | Data Fields | Related Pages | Examples

read_only.c

00001 #include <net-snmp/net-snmp-config.h>
00002 
00003 #if HAVE_STRING_H
00004 #include <string.h>
00005 #else
00006 #include <strings.h>
00007 #endif
00008 
00009 #include <net-snmp/net-snmp-includes.h>
00010 #include <net-snmp/agent/net-snmp-agent-includes.h>
00011 
00012 #include <net-snmp/agent/read_only.h>
00013 
00027 netsnmp_mib_handler *
00028 netsnmp_get_read_only_handler(void)
00029 {
00030     netsnmp_mib_handler *ret = NULL;
00031     
00032     ret = netsnmp_create_handler("read_only",
00033                                  netsnmp_read_only_helper);
00034     if (ret) {
00035         ret->flags |= MIB_HANDLER_AUTO_NEXT;
00036     }
00037     return ret;
00038 }
00039 
00041 int
00042 netsnmp_read_only_helper(netsnmp_mib_handler *handler,
00043                          netsnmp_handler_registration *reginfo,
00044                          netsnmp_agent_request_info *reqinfo,
00045                          netsnmp_request_info *requests)
00046 {
00047 
00048     DEBUGMSGTL(("helper:read_only", "Got request\n"));
00049 
00050     switch (reqinfo->mode) {
00051 
00052     case MODE_SET_RESERVE1:
00053     case MODE_SET_RESERVE2:
00054     case MODE_SET_ACTION:
00055     case MODE_SET_COMMIT:
00056     case MODE_SET_FREE:
00057     case MODE_SET_UNDO:
00058         netsnmp_request_set_error_all(requests, SNMP_ERR_NOTWRITABLE);
00059         return SNMP_ERR_NOTWRITABLE;
00060 
00061     case MODE_GET:
00062     case MODE_GETNEXT:
00063     case MODE_GETBULK:
00064         /* next handler called automatically - 'AUTO_NEXT' */
00065         return SNMP_ERR_NOERROR;
00066 
00067     default:
00068         netsnmp_request_set_error_all(requests, SNMP_ERR_GENERR);
00069         return SNMP_ERR_GENERR;
00070     }
00071     netsnmp_request_set_error_all(requests, SNMP_ERR_GENERR);
00072     return SNMP_ERR_GENERR;     /* should never get here */
00073 }
00074 
00079 void
00080 netsnmp_init_read_only_helper(void)
00081 {
00082     netsnmp_register_handler_by_name("read_only",
00083                                      netsnmp_get_read_only_handler());
00084 }

Generated on Fri Dec 30 13:47:46 2005 for net-snmp by  doxygen 1.3.9.1

Valid CSS!


Last modified: Thursday, 01-Mar-2007 16:20:14 PST
For questions regarding web content and site functionality, please write to the net-snmp-users mail list.