Logo
Home page Net-SNMP

Archive Search:

Require all words?

Site Search:
Google
snmp_vars.h File Reference
Main Page   Data Structures   File List   Data Fields   Globals  

snmp_vars.h File Reference

#include "agent_registry.h"

Go to the source code of this file.


Data Structures

struct  variable

Defines

#define INST   0xFFFFFFFF
#define MATCH_FAILED   (-1)
#define MATCH_SUCCEEDED   0

Typedefs

typedef u_char * FindVarMethod (struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)

Functions

typedef int (WriteMethod)(int action, u_char *var_val, u_char var_val_type, size_t var_val_len, u_char *statP, oid *name, size_t length)
typedef int (AddVarMethod)(struct agent_snmp_session *asp, struct variable_list *vbp)
u_char * getStatPtr (oid *, size_t *, u_char *, size_t *, u_short *, int, WriteMethod **write_method, struct snmp_pdu *, int *)
int init_agent (const char *)
int subtree_old_size (void)
void sort_tree (void)

Variables

long long_return
u_char return_buf []
oid nullOid []
int nullOidLen

Define Documentation

#define INST   0xFFFFFFFF
 

Definition at line 67 of file snmp_vars.h.

#define MATCH_FAILED   (-1)
 

Definition at line 88 of file snmp_vars.h.

#define MATCH_SUCCEEDED   0
 

Definition at line 89 of file snmp_vars.h.


Typedef Documentation

typedef u_char* FindVarMethod(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
 

Definition at line 44 of file snmp_vars.h.


Function Documentation

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
 

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 }

int init_agent const char *    app
 

Definition at line 217 of file snmp_vars.c.

Referenced by main().

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() */

typedef int AddVarMethod   
 

typedef int WriteMethod   
 

void sort_tree void   
 

int subtree_old_size void   
 


Variable Documentation

long long_return
 

Definition at line 61 of file snmp_vars.h.

oid nullOid[]
 

Definition at line 64 of file snmp_vars.h.

int nullOidLen
 

Definition at line 65 of file snmp_vars.h.

u_char return_buf[]
 

Definition at line 62 of file snmp_vars.h.


Generated on Sat Nov 10 14:09:56 2001 for net-snmp by doxygen1.2.11 written by Dimitri van Heesch, © 1997-2001
[an error occurred while processing this directive] [an error occurred while processing this directive]

Valid CSS!


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.