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/serialize.h> 00013 00029 netsnmp_mib_handler * 00030 netsnmp_get_serialize_handler(void) 00031 { 00032 return netsnmp_create_handler("serialize", 00033 netsnmp_serialize_helper_handler); 00034 } 00035 00038 int 00039 netsnmp_register_serialize(netsnmp_handler_registration *reginfo) 00040 { 00041 netsnmp_inject_handler(reginfo, netsnmp_get_serialize_handler()); 00042 return netsnmp_register_handler(reginfo); 00043 } 00044 00046 int 00047 netsnmp_serialize_helper_handler(netsnmp_mib_handler *handler, 00048 netsnmp_handler_registration *reginfo, 00049 netsnmp_agent_request_info *reqinfo, 00050 netsnmp_request_info *requests) 00051 { 00052 00053 netsnmp_request_info *request, *requesttmp; 00054 00055 DEBUGMSGTL(("helper:serialize", "Got request\n")); 00056 /* 00057 * loop through requests 00058 */ 00059 for (request = requests; request; request = request->next) { 00060 int ret; 00061 00062 /* 00063 * store next pointer and delete it 00064 */ 00065 requesttmp = request->next; 00066 request->next = NULL; 00067 00068 /* 00069 * call the next handler 00070 */ 00071 ret = 00072 netsnmp_call_next_handler(handler, reginfo, reqinfo, request); 00073 00074 /* 00075 * restore original next pointer 00076 */ 00077 request->next = requesttmp; 00078 00079 if (ret != SNMP_ERR_NOERROR) 00080 return ret; 00081 } 00082 00083 return SNMP_ERR_NOERROR; 00084 } 00085 00091 void 00092 netsnmp_init_serialize(void) 00093 { 00094 netsnmp_register_handler_by_name("serialize", 00095 netsnmp_get_serialize_handler()); 00096 }
1.3.9.1
Last modified: Thursday, 01-Mar-2007 16:20:03 PST
For questions regarding web content and site functionality, please write to the net-snmp-users mail list.