#include <config.h>#include <string.h>#include <stdlib.h>#include <sys/types.h>#include <stdio.h>#include <fcntl.h>#include <sys/time.h>#include <time.h>#include <sys/socket.h>#include <netinet/in.h>#include <netinet/in_systm.h>#include <netinet/ip.h>#include <sys/queue.h>#include <net/route.h>#include <dmalloc.h>#include "mibincl.h"#include "snmpv3.h"#include "snmp_secmod.h"#include "snmpusm.h"#include "system.h"#include "kernel.h"#include "snmp_vars.h"#include "default_store.h"#include "ds_agent.h"#include "snmpUDPDomain.h"#include "mibgroup/struct.h"#include "read_config.h"#include "agent_read_config.h"#include "agent_registry.h"#include "transform_oids.h"#include "callback.h"#include "snmp_alarm.h"#include "snmpd.h"#include "helpers/table.h"#include "mib_module_includes.h"Go to the source code of this file.
Defines | |
| #define | MIN(a, b) (((a) < (b)) ? (a) : (b)) |
| #define | MIB_CLIENTS_ARE_EVIL 1 |
Functions | |
| int | init_agent (const char *app) |
| u_char * | getStatPtr (oid *name, size_t *namelen, u_char *type, size_t *len, u_short *acl, int exact, WriteMethod **write_method, struct snmp_pdu *pdu, int *noSuchObject) |
Variables | |
| subtree * | subtrees |
| int | subtree_size |
| int | subtree_malloc_size |
| long | long_return |
| u_char | return_buf [258] |
| timeval | starttime |
| snmp_session * | callback_master_sess |
| int | callback_master_num |
| oid | nullOid [] = {0,0} |
| int | nullOidLen = sizeof(nullOid) |
|
|
Definition at line 148 of file snmp_vars.c. |
|
|
Definition at line 135 of file snmp_vars.c. |
|
||||||||||||||||||||||||||||||||||||||||
|
Definition at line 437 of file snmp_vars.c. 00448 {
00449 struct subtree *tp;
00450 oid save[MAX_OID_LEN];
00451 size_t savelen = 0;
00452 u_char result_type;
00453 u_short result_acl;
00454 u_char *search_return=NULL;
00455
00456 found = FALSE;
00457
00458 if (!exact){
00459 memcpy(save, name, *namelen * sizeof(oid));
00460 savelen = *namelen;
00461 }
00462 *write_method = NULL;
00463
00464 DEBUGMSGTL(("snmp_vars", "Looking for: "));
00465 DEBUGMSGOID(("snmp_vars", name, *namelen));
00466 DEBUGMSG(("snmp_vars"," ...\n"));
00467
00468 tp = find_subtree(name, *namelen, NULL, ""); /* WWW delete this function */
00469
00470 if ((tp != NULL) && (tp->flags & FULLY_QUALIFIED_INSTANCE) && (!exact)) {
00471 /* There is no point in trying to do a getNext operation at this
00472 node, because it covers exactly one instance. Therfore, find the
00473 next node. This arises in AgentX row registrations (only). */
00474 DEBUGMSGTL(("snmp_vars", "fully-qualified instance && !exact\n"));
00475 tp = find_subtree_next(name, *namelen, tp, ""); /* WWW: delete this function */
00476 }
00477
00478 while (search_return == NULL && tp != NULL) {
00479 DEBUGMSGTL(("snmp_vars", "Trying tree: "));
00480 DEBUGMSGOID(("snmp_vars", tp->name, tp->namelen));
00481 DEBUGMSG(("snmp_vars"," ...\n"));
00482 search_return = search_subtree_vars( tp, name, namelen, &result_type,
00483 len, &result_acl, exact, write_method,
00484 pdu, noSuchObject);
00485 if ( search_return != NULL || exact )
00486 break;
00487 tp = tp->next;
00488 }
00489 if ( tp == NULL ) {
00490 if (!search_return && !exact){
00491 memcpy(name, save, savelen * sizeof(oid));
00492 *namelen = savelen;
00493 }
00494 if (found)
00495 *noSuchObject = FALSE;
00496 else
00497 *noSuchObject = TRUE;
00498 return NULL;
00499 }
00500 *type = result_type;
00501 *acl = result_acl;
00502 return search_return;
00503 }
|
|
|
Definition at line 217 of file snmp_vars.c. 00218 {
00219 int r = 0;
00220
00221 /* get current time (ie, the time the agent started) */
00222 gettimeofday(&starttime, NULL);
00223 starttime.tv_sec--;
00224 starttime.tv_usec += 1000000L;
00225
00226 /* we handle alarm signals ourselves in the select loop */
00227 ds_set_boolean(DS_LIBRARY_ID, DS_LIB_ALARM_DONT_USE_SIG, 1);
00228
00229 #ifdef CAN_USE_NLIST
00230 init_kmem("/dev/kmem");
00231 #endif
00232
00233 setup_tree();
00234
00235 init_agent_read_config(app);
00236
00237 #ifdef TESTING
00238 auto_nlist_print_tree(-2, 0);
00239 #endif
00240
00241 /* always register a callback transport for internal use */
00242 callback_master_sess = snmp_callback_open(0, handle_snmp_packet,
00243 snmp_check_packet,
00244 snmp_check_parse);
00245 if (callback_master_sess)
00246 callback_master_num = callback_master_sess->local_port;
00247 else
00248 callback_master_num = -1;
00249
00250 /* initialize agentx subagent if necessary. */
00251 #ifdef USING_AGENTX_SUBAGENT_MODULE
00252 if(ds_get_boolean(DS_APPLICATION_ID, DS_AGENT_ROLE) == SUB_AGENT)
00253 r = subagent_pre_init();
00254 #endif
00255
00256 /* Register configuration tokens from transport modules. */
00257 #ifdef SNMP_TRANSPORT_UDP_DOMAIN
00258 snmp_udp_agent_config_tokens_register();
00259 #endif
00260
00261 return r;
00262 } /* end init_agent() */
|
|
|
Definition at line 213 of file snmp_vars.c. |
|
|
Definition at line 212 of file snmp_vars.c. |
|
|
Definition at line 204 of file snmp_vars.c. |
|
|
Definition at line 266 of file snmp_vars.c. |
|
|
Definition at line 267 of file snmp_vars.c. |
|
|
Definition at line 206 of file snmp_vars.c. |
|
|
Definition at line 211 of file snmp_vars.c. |
|
|
Definition at line 152 of file snmp_vars.c. |
|
|
Definition at line 151 of file snmp_vars.c. |
|
|
Definition at line 150 of file snmp_vars.c. |
1.2.11 written by Dimitri van Heesch,
© 1997-2001
[an error occurred while processing this directive]
[an error occurred while processing this directive]
Last modified: Wednesday, 01-Aug-2018 04:41:28 UTC
For questions regarding web content and site functionality, please write to the net-snmp-users mail list.