这篇教程C++ DEBUGMSGOID函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DEBUGMSGOID函数的典型用法代码示例。如果您正苦于以下问题:C++ DEBUGMSGOID函数的具体用法?C++ DEBUGMSGOID怎么用?C++ DEBUGMSGOID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DEBUGMSGOID函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: getStatPtru_char *getStatPtr( oid *name, /* IN - name of var, OUT - name matched */ size_t *namelen, /* IN -number of sub-ids in name, OUT - subid-is in matched name */ u_char *type, /* OUT - type of matched variable */ size_t *len, /* OUT - length of matched variable */ u_short *acl, /* OUT - access control list */ int exact, /* IN - TRUE if exact match wanted */ WriteMethod **write_method, struct snmp_pdu *pdu, /* IN - relevant auth info re PDU */ int *noSuchObject){ struct subtree *tp; oid save[MAX_OID_LEN]; size_t savelen = 0; u_char result_type; u_short result_acl; u_char *search_return=NULL; found = FALSE; if (!exact){ memcpy(save, name, *namelen * sizeof(oid)); savelen = *namelen; } *write_method = NULL; DEBUGMSGTL(("snmp_vars", "Looking for: ")); DEBUGMSGOID(("snmp_vars", name, *namelen)); DEBUGMSG(("snmp_vars"," .../n")); tp = find_subtree(name, *namelen, NULL); while ( search_return == NULL && tp != NULL ) { DEBUGMSGTL(("snmp_vars", "Trying tree: ")); DEBUGMSGOID(("snmp_vars", tp->name, tp->namelen)); DEBUGMSG(("snmp_vars"," .../n")); search_return = search_subtree_vars( tp, name, namelen, &result_type, len, &result_acl, exact, write_method, pdu, noSuchObject); if ( search_return != NULL || exact ) break; tp = tp->next; } if ( tp == NULL ) { if (!search_return && !exact){ memcpy(name, save, savelen * sizeof(oid)); *namelen = savelen; } if (found) *noSuchObject = FALSE; else *noSuchObject = TRUE; return NULL; } *type = result_type; *acl = result_acl; return search_return;}
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:60,
示例2: header_hrdiskintheader_hrdisk(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method){#define HRDISK_ENTRY_NAME_LENGTH 11 oid newname[MAX_OID_LEN]; int disk_idx, LowIndex = -1; int result; DEBUGMSGTL(("host/hr_disk", "var_hrdisk: ")); DEBUGMSGOID(("host/hr_disk", name, *length)); DEBUGMSG(("host/hr_disk"," %d/n", exact)); memcpy( (char *)newname,(char *)vp->name, (int)vp->namelen * sizeof(oid)); /* Find "next" disk entry */ Init_HR_Disk(); for ( ;; ) { disk_idx = Get_Next_HR_Disk(); if ( disk_idx == -1 ) break; newname[HRDISK_ENTRY_NAME_LENGTH] = disk_idx; result = snmp_oid_compare(name, *length, newname, (int)vp->namelen + 1); if (exact && (result == 0)) { LowIndex = disk_idx; Save_HR_Disk_Specific(); break; } if ((!exact && (result < 0)) && ( LowIndex == -1 || disk_idx < LowIndex )) { LowIndex = disk_idx; Save_HR_Disk_Specific();#ifdef HRD_MONOTONICALLY_INCREASING break;#endif } } if ( LowIndex == -1 ) { DEBUGMSGTL(("host/hr_disk", "... index out of range/n")); return(MATCH_FAILED); } newname[HRDISK_ENTRY_NAME_LENGTH] = LowIndex; memcpy( (char *)name,(char *)newname, ((int)vp->namelen + 1) * sizeof(oid)); *length = vp->namelen + 1; *write_method = 0; *var_len = sizeof(long); /* default to 'long' results */ DEBUGMSGTL(("host/hr_disk", "... get disk stats ")); DEBUGMSGOID(("host/hr_disk", name, *length)); DEBUGMSG(("host/hr_disk","/n")); return LowIndex;}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:59,
示例3: header_hrnetintheader_hrnet(struct variable *vp, oid * name, size_t * length, int exact, size_t * var_len, WriteMethod ** write_method){#define HRNET_ENTRY_NAME_LENGTH 11 oid newname[MAX_OID_LEN]; int net_idx; int result; int LowIndex = -1; DEBUGMSGTL(("host/hr_network", "var_hrnet: ")); DEBUGMSGOID(("host/hr_network", name, *length)); DEBUGMSG(("host/hr_network", " %d/n", exact)); memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid)); /* * Find "next" net entry */ Init_HR_Network(); for (;;) { net_idx = Get_Next_HR_Network(); if (net_idx == -1) break; newname[HRNET_ENTRY_NAME_LENGTH] = net_idx; result = snmp_oid_compare(name, *length, newname, vp->namelen + 1); if (exact && (result == 0)) { LowIndex = net_idx; break; } if (!exact && (result < 0) && (LowIndex == -1 || net_idx < LowIndex)) { LowIndex = net_idx;#ifdef HRN_MONOTONICALLY_INCREASING break;#endif } } if (LowIndex == -1) { DEBUGMSGTL(("host/hr_network", "... index out of range/n")); return (MATCH_FAILED); } newname[HRNET_ENTRY_NAME_LENGTH] = LowIndex; memcpy((char *) name, (char *) newname, (vp->namelen + 1) * sizeof(oid)); *length = vp->namelen + 1; *write_method = 0; *var_len = sizeof(long); /* default to 'long' results */ DEBUGMSGTL(("host/hr_network", "... get net stats ")); DEBUGMSGOID(("host/hr_network", name, *length)); DEBUGMSG(("host/hr_network", "/n")); return LowIndex;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:58,
示例4: header_hrfilesysintheader_hrfilesys(struct variable *vp, oid * name, size_t * length, int exact, size_t * var_len, WriteMethod ** write_method){#define HRFSYS_ENTRY_NAME_LENGTH 11 oid newname[MAX_OID_LEN]; int fsys_idx, LowIndex = -1; int result; DEBUGMSGTL(("host/hr_filesys", "var_hrfilesys: ")); DEBUGMSGOID(("host/hr_filesys", name, *length)); DEBUGMSG(("host/hr_filesys", " %d/n", exact)); memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid)); /* * Find "next" file system entry */ Init_HR_FileSys(); for (;;) { fsys_idx = Get_Next_HR_FileSys(); if (fsys_idx == -1) break; newname[HRFSYS_ENTRY_NAME_LENGTH] = fsys_idx; result = snmp_oid_compare(name, *length, newname, vp->namelen + 1); if (exact && (result == 0)) { LowIndex = fsys_idx; break; } if ((!exact && (result < 0)) && (LowIndex == -1 || fsys_idx < LowIndex)) { LowIndex = fsys_idx;#ifdef HRFS_MONOTONICALLY_INCREASING break;#endif } } if (LowIndex == -1) { DEBUGMSGTL(("host/hr_filesys", "... index out of range/n")); return (MATCH_FAILED); } memcpy((char *) name, (char *) newname, (vp->namelen + 1) * sizeof(oid)); *length = vp->namelen + 1; *write_method = (WriteMethod*)0; *var_len = sizeof(long); /* default to 'long' results */ DEBUGMSGTL(("host/hr_filesys", "... get filesys stats ")); DEBUGMSGOID(("host/hr_filesys", name, *length)); DEBUGMSG(("host/hr_filesys", "/n")); return LowIndex;}
开发者ID:duniansampa,项目名称:SigLog,代码行数:57,
示例5: header_dummy/* header_dummy(... Arguments: vp IN - pointer to variable entry that points here name IN/OUT - IN/name requested, OUT/name found length IN/OUT - length of input and output oid's exact IN - TRUE if an exact match was requested. var_len OUT - length of variable or 0 if function returned. write_method OUT - pointer to function to set variable, otherwise 0*/intheader_dummy(struct variable *vp, oid *name, int *length, int exact, int *var_len, WriteMethod **write_method) {#define DUMMY_NAME_LENGTH 8 oid newname[MAX_OID_LEN]; int result; /* just do trace and token print */ DEBUGMSGTL(("dummy/dummy:var_dummy", "")); DEBUGMSGOID(("dummy/dummy:var_dummy", name, *length)); DEBUGMSG(("dummy/dummy:var_dummy", " %d/n", exact)); memcpy(newname, vp->name, (int)vp->namelen * sizeof(oid)); newname[DUMMY_NAME_LENGTH] = 0; result = snmp_oid_compare(name, *length, newname, (int)vp->namelen + 1); if ((exact && (result != 0)) || (!exact && (result >= 0))) return(MATCH_FAILED); memcpy(name, newname, ((int)vp->namelen + 1) * sizeof(oid)); *length = vp->namelen + 1; *write_method = 0; *var_len = sizeof(long); /* default to 'long' results */ return(MATCH_SUCCEEDED);}
开发者ID:Einheri,项目名称:wl500g,代码行数:38,
示例6: header_complex_generate_oidvoidheader_complex_generate_oid(oid * name, /* out */ size_t * length, /* out */ oid * prefix, size_t prefix_len, netsnmp_variable_list * data){ oid *oidptr; netsnmp_variable_list *var; if (prefix) { memcpy(name, prefix, prefix_len * sizeof(oid)); oidptr = (name + (prefix_len)); *length = prefix_len; } else { oidptr = name; *length = 0; } for (var = data; var != NULL; var = var->next_variable) { header_complex_generate_varoid(var); memcpy(oidptr, var->name, sizeof(oid) * var->name_length); oidptr = oidptr + var->name_length; *length += var->name_length; } DEBUGMSGTL(("header_complex_generate_oid", "generated: ")); DEBUGMSGOID(("header_complex_generate_oid", name, *length)); DEBUGMSG(("header_complex_generate_oid", "/n"));}
开发者ID:gittestusername,项目名称:uClinux,代码行数:31,
示例7: header_hrswinstintheader_hrswinst(struct variable *vp, oid * name, size_t * length, int exact, size_t * var_len, WriteMethod ** write_method){#define HRSWINST_NAME_LENGTH 9 oid newname[MAX_OID_LEN]; int result; DEBUGMSGTL(("host/hr_swinst", "var_hrswinst: ")); DEBUGMSGOID(("host/hr_swinst", name, *length)); DEBUGMSG(("host/hr_swinst", " %d/n", exact)); memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid)); newname[HRSWINST_NAME_LENGTH] = 0; result = snmp_oid_compare(name, *length, newname, vp->namelen + 1); if ((exact && (result != 0)) || (!exact && (result >= 0))) return (MATCH_FAILED); memcpy((char *) name, (char *) newname, (vp->namelen + 1) * sizeof(oid)); *length = vp->namelen + 1; *write_method = 0; *var_len = sizeof(long); /* default to 'long' results */ return (MATCH_SUCCEEDED);}
开发者ID:KrisChaplin,项目名称:LRT2x4_v1.0.2.06_GPL_source,代码行数:27,
示例8: header_hrdeviceintheader_hrdevice (struct variable *vp, oid * name, size_t * length, int exact, size_t * var_len, WriteMethod ** write_method){#define HRDEV_ENTRY_NAME_LENGTH 11 oid newname[MAX_OID_LEN]; int dev_idx, LowIndex = -1, LowType = -1; int result; DEBUGMSGTL (("host/hr_device", "var_hrdevice: ")); DEBUGMSGOID (("host/hr_device", name, *length)); DEBUGMSG (("host/hr_device", " %d/n", exact)); memcpy ((char *) newname, (char *) vp->name, (int) vp->namelen * sizeof (oid)); /* * Find the "next" device entry. * If we're in the middle of the table, then there's * no point in examining earlier types of devices, * so set the starting type to that of the variable * being queried. * If we've moved from one column of the table to another, * then we need to start at the beginning again. * (i.e. the 'compare' fails to match) * Similarly if we're at the start of the table * (i.e. *length is too short to be a full instance) */ if ((snmp_oid_compare (vp->name, vp->namelen, name, vp->namelen) == 0) && (*length > HRDEV_ENTRY_NAME_LENGTH)) current_type = (name[HRDEV_ENTRY_NAME_LENGTH] >> HRDEV_TYPE_SHIFT); else
开发者ID:274914765,项目名称:C,代码行数:34,
示例9: netsnmp_null_handlerintnetsnmp_null_handler(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests){ DEBUGMSGTL(("helper:null", "Got request/n")); DEBUGMSGTL(("helper:null", " oid:")); DEBUGMSGOID(("helper:null", requests->requestvb->name, requests->requestvb->name_length)); DEBUGMSG(("helper:null", "/n")); switch (reqinfo->mode) { case MODE_GETNEXT: case MODE_GETBULK: return SNMP_ERR_NOERROR; case MODE_GET: netsnmp_set_all_requests_error(reqinfo, requests, SNMP_NOSUCHOBJECT); return SNMP_ERR_NOERROR; default: netsnmp_set_all_requests_error(reqinfo, requests, SNMP_ERR_NOSUCHNAME); return SNMP_ERR_NOERROR; }}
开发者ID:DYFeng,项目名称:infinidb,代码行数:29,
示例10: agentx_varu_char *agentx_var(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method){ int result; AddVarMethod *add_method; DEBUGMSGTL(("agentx/master","request to pass to client: ")); DEBUGMSGOID(("agentx/master", name, *length)); DEBUGMSG(("agentx/master","/n")); /* * If the requested OID precedes the area of responsibility * of this subagent (and hence it's presumable a non-exact match), * then update the "matched" name to be the starting point */ /* XXX shouldn't we check exact in this case? */ result = snmp_oid_compare(name, *length, vp->name, vp->namelen); if ( result < 0 ) { memcpy((char *)name,(char *)vp->name, vp->namelen*sizeof(oid)); *length = vp->namelen; } /* Return a pointer to an appropriate method */ add_method = agentx_add_request; return (u_char*)add_method;}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:29,
示例11: netsnmp_cache_timer_start/** starts the recurring cache_load callback */unsigned intnetsnmp_cache_timer_start(netsnmp_cache *cache){ if(NULL == cache) return 0; DEBUGMSGTL(( "cache_timer:start", "OID: ")); DEBUGMSGOID(("cache_timer:start", cache->rootoid, cache->rootoid_len)); DEBUGMSG(( "cache_timer:start", "/n")); if(0 != cache->timer_id) { snmp_log(LOG_WARNING, "cache has existing timer id./n"); return cache->timer_id; } if(! (cache->flags & NETSNMP_CACHE_AUTO_RELOAD)) { snmp_log(LOG_ERR, "cache_timer_start called but auto_reload not set./n"); return 0; } cache->timer_id = snmp_alarm_register(cache->timeout, SA_REPEAT, _timer_reload, cache); if(0 == cache->timer_id) { snmp_log(LOG_ERR,"could not register alarm/n"); return 0; } cache->flags &= ~NETSNMP_CACHE_AUTO_RELOAD; DEBUGMSGT(("cache_timer:start", "starting timer %lu for cache %p/n", cache->timer_id, cache)); return cache->timer_id;}
开发者ID:duniansampa,项目名称:SigLog,代码行数:34,
示例12: addintadd(netsnmp_pdu *pdu, const char *mibnodename, oid * index, size_t indexlen){ oid base[MAX_OID_LEN]; size_t base_length = MAX_OID_LEN; memset(base, 0, MAX_OID_LEN * sizeof(oid)); if (!snmp_parse_oid(mibnodename, base, &base_length)) { snmp_perror(mibnodename); fprintf(stderr, "couldn't find mib node %s, giving up/n", mibnodename);#if HAVE_CURSES_H endwin();#endif exit(1); } if (index && indexlen) { memcpy(&(base[base_length]), index, indexlen * sizeof(oid)); base_length += indexlen; } DEBUGMSGTL(("add", "created: ")); DEBUGMSGOID(("add", base, base_length)); DEBUGMSG(("add", "/n")); snmp_add_null_var(pdu, base, base_length); return base_length;}
开发者ID:michalklempa,项目名称:net-snmp,代码行数:30,
示例13: my_test_handlerintmy_test_handler(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests){ oid myoid1[] = { 1, 2, 3, 4, 5, 6 }; static u_long accesses = 0; DEBUGMSGTL(("testhandler", "Got request:/n")); /* * loop through requests */ while (requests) { netsnmp_variable_list *var = requests->requestvb; DEBUGMSGTL(("testhandler", " oid:")); DEBUGMSGOID(("testhandler", var->name, var->name_length)); DEBUGMSG(("testhandler", "/n")); switch (reqinfo->mode) { case MODE_GET: if (netsnmp_oid_equals(var->name, var->name_length, myoid1, 6) == 0) { snmp_set_var_typed_value(var, ASN_INTEGER, (u_char *) & accesses, sizeof(accesses)); return SNMP_ERR_NOERROR; } break; case MODE_GETNEXT: if (snmp_oid_compare(var->name, var->name_length, myoid1, 6) < 0) { snmp_set_var_objid(var, myoid1, 6); snmp_set_var_typed_value(var, ASN_INTEGER, (u_char *) & accesses, sizeof(accesses)); return SNMP_ERR_NOERROR; } break; default: netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_GENERR); break; } requests = requests->next; } return SNMP_ERR_NOERROR;}
开发者ID:ClausKlein,项目名称:net-snmp,代码行数:52,
示例14: header_complex_dumpvoidheader_complex_dump(struct header_complex_index *thestuff){ struct header_complex_index *hciptr; oid oidsave[MAX_OID_LEN]; size_t len; for (hciptr = thestuff; hciptr != NULL; hciptr = hciptr->next) { DEBUGMSGTL(("header_complex_dump", "var: ")); header_complex_generate_oid(oidsave, &len, NULL, 0, hciptr->); DEBUGMSGOID(("header_complex_dump", oidsave, len)); DEBUGMSG(("header_complex_dump", "/n")); }}
开发者ID:gittestusername,项目名称:uClinux,代码行数:14,
示例15: fillConfigOidstatic voidfillConfigOid(oid * name, struct tunnel *tunnel){ name[0] = ((unsigned char *) &tunnel->local)[0]; name[1] = ((unsigned char *) &tunnel->local)[1]; name[2] = ((unsigned char *) &tunnel->local)[2]; name[3] = ((unsigned char *) &tunnel->local)[3]; name[4] = ((unsigned char *) &tunnel->remote)[0]; name[5] = ((unsigned char *) &tunnel->remote)[1]; name[6] = ((unsigned char *) &tunnel->remote)[2]; name[7] = ((unsigned char *) &tunnel->remote)[3]; name[8] = tunnel->encaps; name[9] = tunnel->id; DEBUGMSGOID(("tunnel", name, 10));}
开发者ID:duniansampa,项目名称:SigLog,代码行数:15,
示例16: netsnmp_watched_spinlock_handlerintnetsnmp_watched_spinlock_handler(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests){ int *spinlock = (int *) handler->myvoid; netsnmp_request_info *request; DEBUGMSGTL(("helper:watcher:spinlock", "Got request: %d/n", reqinfo->mode)); DEBUGMSGTL(( "helper:watcher:spinlock", " oid:")); DEBUGMSGOID(("helper:watcher:spinlock", requests->requestvb->name, requests->requestvb->name_length)); DEBUGMSG(( "helper:watcher:spinlock", "/n")); switch (reqinfo->mode) { /* * Ensure the assigned value matches the current one */ case MODE_SET_RESERVE1: for (request=requests; request; request=request->next) { if (request->processed) continue; if (*request->requestvb->val.integer != *spinlock) { netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_WRONGVALUE); handler->flags |= MIB_HANDLER_AUTO_NEXT_OVERRIDE_ONCE; return SNMP_ERR_WRONGVALUE; } } break; /* * Everything else worked, so increment the spinlock */ case MODE_SET_COMMIT: (*spinlock)++; break; } /* next handler called automatically - 'AUTO_NEXT' */ return SNMP_ERR_NOERROR;}
开发者ID:olegto,项目名称:osx-project-1,代码行数:45,
示例17: register_sysORTable_sessint register_sysORTable_sess(oid *oidin, size_t oidlen, const char *descr, struct snmp_session *ss){ struct sysORTable **ptr=&table; struct register_sysOR_parameters reg_sysOR_parms; DEBUGMSGTL(("mibII/sysORTable", "sysORTable registering: ")); DEBUGMSGOID(("mibII/sysORTable", oidin, oidlen)); DEBUGMSG(("mibII/sysORTable","/n")); while(*ptr != NULL) ptr = &((*ptr)->next); *ptr = (struct sysORTable *) malloc(sizeof(struct sysORTable)); if ( *ptr == NULL ) { return SYS_ORTABLE_REGISTRATION_FAILED; } (*ptr)->OR_descr = (char *) malloc(strlen(descr)+1); if ( (*ptr)->OR_descr == NULL ) { free( *ptr ); return SYS_ORTABLE_REGISTRATION_FAILED; } strcpy((*ptr)->OR_descr, descr); (*ptr)->OR_oidlen = oidlen; (*ptr)->OR_oid = (oid *) malloc(sizeof(oid)*oidlen); if ( (*ptr)->OR_oid == NULL ) { free( *ptr ); free( (*ptr)->OR_descr ); return SYS_ORTABLE_REGISTRATION_FAILED; } memcpy((*ptr)->OR_oid, oidin, sizeof(oid)*oidlen); gettimeofday(&((*ptr)->OR_uptime), NULL); (*ptr)->OR_sess = ss; (*ptr)->next = NULL; numEntries++; reg_sysOR_parms.name = oidin; reg_sysOR_parms.namelen = oidlen; reg_sysOR_parms.descr = descr; snmp_call_callbacks(SNMP_CALLBACK_APPLICATION, SNMPD_CALLBACK_REG_SYSOR, ®_sysOR_parms); return SYS_ORTABLE_REGISTERED_OK;}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:45,
示例18: netsnmp_watched_timestamp_handlerintnetsnmp_watched_timestamp_handler(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests){ marker_t timestamp = (marker_t) handler->myvoid; long uptime; DEBUGMSGTL(("helper:watcher:timestamp", "Got request: %d/n", reqinfo->mode)); DEBUGMSGTL(( "helper:watcher:timestamp", " oid:")); DEBUGMSGOID(("helper:watcher:timestamp", requests->requestvb->name, requests->requestvb->name_length)); DEBUGMSG(( "helper:watcher:timestamp", "/n")); switch (reqinfo->mode) { /* * data requests */ case MODE_GET: if (handler->flags & NETSNMP_WATCHER_DIRECT) uptime = * (long*)timestamp; else uptime = netsnmp_marker_uptime( timestamp ); snmp_set_var_typed_value(requests->requestvb, ASN_TIMETICKS, (u_char *) &uptime, sizeof(uptime)); break; /* * Timestamps are inherently Read-Only, * so don't need to support SET requests. */ case MODE_SET_RESERVE1: netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_NOTWRITABLE); handler->flags |= MIB_HANDLER_AUTO_NEXT_OVERRIDE_ONCE; return SNMP_ERR_NOTWRITABLE; } /* next handler called automatically - 'AUTO_NEXT' */ return SNMP_ERR_NOERROR;}
开发者ID:olegto,项目名称:osx-project-1,代码行数:45,
示例19: agentx_registerintagentx_register( struct snmp_session *ss, oid start[], size_t startlen, int priority, int range_subid, oid range_ubound){ struct snmp_pdu *pdu, *response; DEBUGMSGTL(("agentx/subagent","registering: ")); DEBUGMSGOID(("agentx/subagent", start, startlen)); DEBUGMSG(("agentx/subagent","/n")); if (! IS_AGENTX_VERSION( ss->version )) return 0; pdu = snmp_pdu_create(AGENTX_MSG_REGISTER); if ( pdu == NULL ) return 0; pdu->time = 0; pdu->priority = priority; pdu->sessid = ss->sessid; pdu->range_subid = range_subid; if ( range_subid ) { snmp_pdu_add_variable( pdu, start, startlen, ASN_OBJECT_ID, (u_char *)start, startlen); pdu->variables->val.objid[ range_subid-1 ] = range_ubound; } else snmp_add_null_var( pdu, start, startlen); if ( agentx_synch_response(ss, pdu, &response) != STAT_SUCCESS ) { DEBUGMSGTL(("agentx/subagent","registering failed!/n")); return 0; } if ( response->errstat != SNMP_ERR_NOERROR ) { DEBUGMSGTL(("agentx/subagent","registering pdu failed: %d!/n", response->errstat)); snmp_free_pdu(response); return 0; } snmp_free_pdu(response); DEBUGMSGTL(("agentx/subagent","registered/n")); return 1;}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:43,
示例20: _mteEvent_dumpvoid _mteEvent_dump (void){ struct mteEvent *entry; netsnmp_tdata_row *row; int i = 0; for (row = netsnmp_tdata_row_first (event_table_data); row; row = netsnmp_tdata_row_next (event_table_data, row)) { entry = (struct mteEvent *) row->data; DEBUGMSGTL (("disman:event:dump", "EventTable entry %d: ", i)); DEBUGMSGOID (("disman:event:dump", row->oid_index.oids, row->oid_index.len)); DEBUGMSG (("disman:event:dump", "(%s, %s)", row->indexes->val.string, row->indexes->next_variable->val.string)); DEBUGMSG (("disman:event:dump", ": %p, %p/n", row, entry)); i++; } DEBUGMSGTL (("disman:event:dump", "EventTable %d entries/n", i));}
开发者ID:274914765,项目名称:C,代码行数:19,
示例21: netsnmp_tdomain_dumpstatic voidnetsnmp_tdomain_dump(void){ netsnmp_tdomain *d; int i = 0; DEBUGMSGTL(("tdomain", "domain_list -> ")); for (d = domain_list; d != NULL; d = d->next) { DEBUGMSG(("tdomain", "{ ")); DEBUGMSGOID(("tdomain", d->name, d->name_length)); DEBUGMSG(("tdomain", ", /"")); for (i = 0; d->prefix[i] != NULL; i++) { DEBUGMSG(("tdomain", "%s%s", d->prefix[i], (d->prefix[i + 1]) ? "/" : "")); } DEBUGMSG(("tdomain", "/" } -> ")); } DEBUGMSG(("tdomain", "[NIL]/n"));}
开发者ID:pexip,项目名称:os-net-snmp,代码行数:19,
示例22: getNextTunnelByConfigOidstatic struct tunnel *getNextTunnelByConfigOid(oid * name, size_t * length){ struct tunnel *tunnel, *last_tunnel; oid tname[10], last_tname[10]; DEBUGMSG(("tunnel", "getNextTunnelByConfigOid(")); DEBUGMSGOID(("tunnel", name, *length)); DEBUGMSG(("tunnel", "): ")); last_tunnel = NULL; for (tunnel = tunnels; tunnel; tunnel = tunnel->next) { if (!tunnel->active) continue; fillConfigOid(tname, tunnel); if (snmp_oid_compare(tname, 10, &name[tunnel_len + 3], (*length) - tunnel_len - 3) > 0) { if (!last_tunnel) { last_tunnel = tunnel; memcpy((char *) last_tname, (char *) tname, 10 * sizeof(oid)); } else { if (snmp_oid_compare(tname, 10, last_tname, 10) < 0) { last_tunnel = tunnel; memcpy((char *) last_tname, (char *) tname, 10 * sizeof(oid)); } } } } if (last_tunnel) { DEBUGMSG(("tunnel", "%s (index=%" NETSNMP_PRIo "u)/n", last_tunnel->ifname, last_tunnel->ifindex)); } else { DEBUGMSG(("tunnel", "NONE/n")); } return last_tunnel;}
开发者ID:duniansampa,项目名称:SigLog,代码行数:41,
示例23: proxy_free_configvoidproxy_free_config(void){ struct simple_proxy *rm; DEBUGMSGTL(("proxy_free_config", "Free config/n")); while (proxies) { rm = proxies; proxies = rm->next; DEBUGMSGTL(( "proxy_free_config", "freeing ")); DEBUGMSGOID(("proxy_free_config", rm->name, rm->name_len)); DEBUGMSG(( "proxy_free_config", " (%s)/n", rm->context)); unregister_mib_context(rm->name, rm->name_len, DEFAULT_MIB_PRIORITY, 0, 0, rm->context); SNMP_FREE(rm->variables); SNMP_FREE(rm->context); snmp_close(rm->sess); SNMP_FREE(rm); }}
开发者ID:Nymphetaminer,项目名称:dsl-n55u,代码行数:22,
示例24: unregister_sysORTable_sessint unregister_sysORTable_sess(oid *oidin, size_t oidlen, struct snmp_session *ss){ struct sysORTable **ptr=&table, *prev=NULL; int found = SYS_ORTABLE_NO_SUCH_REGISTRATION; struct register_sysOR_parameters reg_sysOR_parms; DEBUGMSGTL(("mibII/sysORTable", "sysORTable unregistering: ")); DEBUGMSGOID(("mibII/sysORTable", oidin, oidlen)); DEBUGMSG(("mibII/sysORTable","/n")); while(*ptr != NULL) { if ( snmp_oid_compare( oidin, oidlen, (*ptr)->OR_oid, (*ptr)->OR_oidlen) == 0 ) { if ( (*ptr)->OR_sess != ss ) continue; /* different session */ if ( prev == NULL ) table = (*ptr)->next; else prev->next = (*ptr)->next; free( (*ptr)->OR_descr ); free( (*ptr)->OR_oid ); free( (*ptr) ); numEntries--; found = SYS_ORTABLE_UNREGISTERED_OK; break; } prev = *ptr; ptr = &((*ptr)->next); } reg_sysOR_parms.name = oidin; reg_sysOR_parms.namelen = oidlen; snmp_call_callbacks(SNMP_CALLBACK_APPLICATION, SNMPD_CALLBACK_UNREG_SYSOR, ®_sysOR_parms); return found;}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:39,
示例25: netsnmp_tdomain_transport_oidnetsnmp_transport *netsnmp_tdomain_transport_oid(const oid * dom, size_t dom_len, const u_char * o, size_t o_len, int local){ netsnmp_tdomain *d; int i; DEBUGMSGTL(("tdomain", "domain /"")); DEBUGMSGOID(("tdomain", dom, dom_len)); DEBUGMSG(("tdomain", "/"/n")); for (d = domain_list; d != NULL; d = d->next) { for (i = 0; d->prefix[i] != NULL; i++) { if (netsnmp_oid_equals(dom, dom_len, d->name, d->name_length) == 0) { return d->f_create_from_ostring(o, o_len, local); } } } snmp_log(LOG_ERR, "No support for requested transport domain/n"); return NULL;}
开发者ID:pexip,项目名称:os-net-snmp,代码行数:24,
示例26: var_bgpu_char *var_bgp(struct variable *vp, oid * name, int *length, int exact, int *var_len, WriteMethod ** write_method){ u_char *var; int result; DEBUGMSGTL(("smux/snmp_bgp", "[var_bgp] var len %d, oid requested Len %d-", *var_len, *length)); DEBUGMSGOID(("smux/snmp_bgp", name, *length)); DEBUGMSG(("smux/snmp_bgp", "/n")); /* * Pass on the request to Gated. * If the request sent out was a get next, check to see if * it lies in the bgp range. If it doesn't, return NULL. * In either case, make sure that errors are checked on the * returned packets. */ /* * No writes for now */ *write_method = NULL; /* * Donot allow access to the peer stuff as it crashes gated. * However A GetNext on the last 23.3.1.9 variable will force gated into * the peer stuff and cause it to crash. * The only way to fix this is to either solve the Gated problem, or * remove the peer variables from Gated itself and cause it to return * NULL at the crossing. Currently doing the later. */ /* * Reject GET and GETNEXT for anything above bgpifconf range */ result = snmp_oid_compare(name, *length, max_bgp_mib, sizeof(max_bgp_mib) / sizeof(u_int)); if (result >= 0) { DEBUGMSGTL(("smux/snmp_bgp", "Over shot/n")); return NULL; } /* * for GETs we need to be in the bgp range so reject anything below */ result = snmp_oid_compare(name, *length, min_bgp_mib, sizeof(min_bgp_mib) / sizeof(u_int)); if (exact && (result < 0)) { DEBUGMSGTL(("smux/snmp_bgp", "Exact but doesn't match length %d, size %d/n", *length, sizeof(min_bgp_mib))); return NULL; } /* * On return, 'var' points to the value returned which is of length * '*var_len'. 'name' points to the new (same as the one passed in for * GETs) oid which has 'length' suboids. * 'smux_type' contains the type of the variable. */ var = smux_snmp_process(exact, name, length, var_len); DEBUGMSGTL(("smux/snmp_bgp", "[var_bgp] var len %d, oid obtained Len %d-", *var_len, *length)); DEBUGMSGOID(("smux/snmp_bgp", name, *length)); DEBUGMSG(("smux/snmp_bgp", "/n")); vp->type = smux_type; /* * XXX Need a mechanism to return errors in gated's responses */ if (var == NULL) return NULL; /* * Any resullt returned should be within the bgp tree. * bgp_mib - static u_int bgp_mib[] = {1, 3, 6, 1, 2, 1, 15}; */ if (memcmp(bgp_mib, name, sizeof(bgp_mib)) != 0) { return NULL; } else { return var; }}
开发者ID:KrisChaplin,项目名称:LRT2x4_v1.0.2.06_GPL_source,代码行数:92,
示例27: search_subtree_varsstatic u_char *search_subtree_vars(struct subtree *tp, oid *name, /* IN - name of var, OUT - name matched */ size_t *namelen, /* IN -number of sub-ids in name, OUT - subid-is in matched name */ u_char *type, /* OUT - type of matched variable */ size_t *len, /* OUT - length of matched variable */ u_short *acl, /* OUT - access control list */ int exact, /* IN - TRUE if exact match wanted */ WriteMethod **write_method, struct snmp_pdu *pdu, /* IN - relevant auth info re PDU */ int *noSuchObject){ register struct variable *vp; struct variable compat_var, *cvp = &compat_var; register int x; u_char *access = NULL; int result; oid *suffix; size_t suffixlen;#if MIB_CLIENTS_ARE_EVIL oid save[MAX_OID_LEN]; size_t savelen = 0;#endif if ( tp->variables == NULL ) return NULL; result = compare_tree(name, *namelen, tp->name, tp->namelen); suffixlen = *namelen - tp->namelen; suffix = name + tp->namelen; /* the following is part of the setup for the compatability structure below that has been moved out of the main loop. */ memcpy(cvp->name, tp->name, tp->namelen * sizeof(oid)); *noSuchObject = TRUE; /* In case of null variables_len */ for(x = 0, vp = tp->variables; x < tp->variables_len; vp =(struct variable *)((char *)vp +tp->variables_width), x++){ /* if exact and ALWAYS if next and result >= 0 */ /* and if vp->namelen != 0 -- Wes */ if (vp->namelen && (exact || result >= 0)){ result = compare_tree(suffix, suffixlen, vp->name, vp->namelen); } /* if exact and result == 0 if next and result <= 0 */ /* or if vp->namelen == 0 -- Wes */ if ((!exact && (result <= 0)) || (exact && (result == 0)) || vp->namelen == 0) { /* builds an old (long) style variable structure to retain compatability with var_* functions written previously. */ if (vp->namelen) memcpy((cvp->name + tp->namelen), vp->name, vp->namelen * sizeof(oid)); cvp->namelen = tp->namelen + vp->namelen; cvp->type = vp->type; cvp->magic = vp->magic; cvp->acl = vp->acl; cvp->findVar = vp->findVar; *write_method = NULL;#if MIB_CLIENTS_ARE_EVIL memcpy(save, name, *namelen*sizeof(oid)); savelen = *namelen;#endif DEBUGMSGTL(("snmp_vars", "Trying variable: ")); DEBUGMSGOID(("snmp_vars", cvp->name, cvp->namelen)); DEBUGMSG(("snmp_vars"," .../n")); gaga: access = (*(vp->findVar))(cvp, name, namelen, exact, len, write_method); DEBUGMSGTL(("snmp_vars", "Returned %s/n", (access==NULL) ? "(null)" : "something" )); /* * Check that the answer is acceptable. * i.e. lies within the current subtree chunk * * It might be worth saving this answer just in * case it turns out to be valid, but for now * we'll simply discard it. */ if ( access && snmp_oid_compare(name, *namelen, tp->end, tp->end_len) > 0) { memcpy(name, tp->end, tp->end_len); access = 0; }#if MIB_CLIENTS_ARE_EVIL if (access == NULL) { if (snmp_oid_compare(name, *namelen, save, savelen) != 0) { DEBUGMSGTL(("snmp_vars", "evil_client: ")); DEBUGMSGOID(("snmp_vars", save, savelen)); DEBUGMSG(("snmp_vars"," =>")); DEBUGMSGOID(("snmp_vars", name, *namelen)); DEBUGMSG(("snmp_vars","/n")); memcpy(name, save, savelen*sizeof(oid)); *namelen = savelen;//.........这里部分代码省略.........
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:101,
示例28: var_extensible_versionu_char *var_extensible_version(struct variable *vp, oid * name, size_t * length, int exact, size_t * var_len, WriteMethod ** write_method){ static long long_ret; static char errmsg[300]; char *cptr; time_t curtime;#ifdef CONFIGURE_OPTIONS static char config_opts[] = CONFIGURE_OPTIONS;#endif DEBUGMSGTL(("ucd-snmp/versioninfo", "var_extensible_version: ")); DEBUGMSGOID(("ucd-snmp/versioninfo", name, *length)); DEBUGMSG(("ucd-snmp/versioninfo", " %d/n", exact)); if (header_generic(vp, name, length, exact, var_len, write_method)) return (NULL); switch (vp->magic) { case MIBINDEX: long_ret = name[8]; return ((u_char *) (&long_ret)); case VERTAG: sprintf(errmsg, netsnmp_get_version()); *var_len = strlen(errmsg); return ((u_char *) errmsg); case VERDATE: sprintf(errmsg, "$Date: 2004/01/27 17:24:26 $"); *var_len = strlen(errmsg); return ((u_char *) errmsg); case VERCDATE: curtime = time(NULL); cptr = ctime(&curtime); sprintf(errmsg, cptr); *var_len = strlen(errmsg) - 1; return ((u_char *) errmsg); case VERIDENT: sprintf(errmsg, "$Id: versioninfo.c,v 5.2 2004/01/27 17:24:26 slif Exp $"); *var_len = strlen(errmsg); return ((u_char *) errmsg); case VERCONFIG:#ifdef CONFIGURE_OPTIONS *var_len = strlen(config_opts); if (*var_len > 1024) *var_len = 1024; /* mib imposed restriction */ return (u_char *) config_opts;#else sprintf(errmsg, ""); *var_len = strlen(errmsg); return ((u_char *) errmsg);#endif case VERCLEARCACHE: *write_method = clear_cache; long_ret = 0; return ((u_char *) & long_ret); case VERUPDATECONFIG: *write_method = update_hook; long_ret = 0; return ((u_char *) & long_ret); case VERRESTARTAGENT: *write_method = restart_hook; long_ret = 0; return ((u_char *) & long_ret); case VERSAVEPERSISTENT: *write_method = save_persistent; long_ret = 0; return ((u_char *) & long_ret); case VERDEBUGGING: *write_method = debugging_hook; long_ret = snmp_get_do_debugging(); return ((u_char *) & long_ret); } return NULL;}
开发者ID:DYFeng,项目名称:infinidb,代码行数:80,
示例29: var_atEntryu_char *var_atEntry(struct variable * vp, oid * name, size_t * length, int exact, size_t * var_len, WriteMethod ** write_method){ /* * object identifier is of form: * 1.3.6.1.2.1.3.1.1.1.interface.1.A.B.C.D, where A.B.C.D is IP address. * Interface is at offset 10, * IPADDR starts at offset 12. */#define AT_MAX_NAME_LENGTH 16#define AT_IFINDEX_OFF 10 u_char *cp; oid *op; oid lowest[AT_MAX_NAME_LENGTH]; oid current[AT_MAX_NAME_LENGTH]; if_ip_t NextAddr; mib2_ipNetToMediaEntry_t entry; static mib2_ipNetToMediaEntry_t Lowentry; int Found = 0; req_e req_type; int offset, olength; static in_addr_t addr_ret; /* * fill in object part of name for current (less sizeof instance part) */ DEBUGMSGTL(("mibII/at", "var_atEntry: ")); DEBUGMSGOID(("mibII/at", vp->name, vp->namelen)); DEBUGMSG(("mibII/at", " %d/n", exact)); memset(&Lowentry, 0, sizeof(Lowentry)); memcpy((char *) current, (char *) vp->name, vp->namelen * sizeof(oid)); lowest[0] = 1024; for (NextAddr.ipAddr = (u_long) - 1, NextAddr.ifIdx = 255, req_type = GET_FIRST;; NextAddr.ipAddr = entry.ipNetToMediaNetAddress, NextAddr.ifIdx = current[AT_IFINDEX_OFF], req_type = GET_NEXT) { if (getMibstat (MIB_IP_NET, &entry, sizeof(mib2_ipNetToMediaEntry_t), req_type, &AT_Cmp, &NextAddr) != 0) break;#ifdef NETSNMP_INCLUDE_IFTABLE_REWRITES entry.ipNetToMediaIfIndex.o_bytes[entry.ipNetToMediaIfIndex.o_length] = '/0'; current[AT_IFINDEX_OFF] = netsnmp_access_interface_index_find( entry.ipNetToMediaIfIndex.o_bytes);#else current[AT_IFINDEX_OFF] = Interface_Index_By_Name(entry.ipNetToMediaIfIndex.o_bytes, entry.ipNetToMediaIfIndex.o_length);#endif if (current[6] == 3) { /* AT group oid */ current[AT_IFINDEX_OFF + 1] = 1; offset = AT_IFINDEX_OFF + 2; olength = AT_IFINDEX_OFF + 6; } else { offset = AT_IFINDEX_OFF + 1; olength = AT_IFINDEX_OFF + 5; } COPY_IPADDR(cp, (u_char *) & entry.ipNetToMediaNetAddress, op, current + offset); if (exact) { if (snmp_oid_compare(current, olength, name, *length) == 0) { memcpy((char *) lowest, (char *) current, olength * sizeof(oid)); Lowentry = entry; Found++; break; /* no need to search further */ } } else { if (snmp_oid_compare(current, olength, name, *length) > 0 && snmp_oid_compare(current, olength, lowest, *length) < 0) { /* * if new one is greater than input and closer to input than * previous lowest, and is not equal to it, save this one as the "next" one. */ memcpy((char *) lowest, (char *) current, olength * sizeof(oid)); Lowentry = entry; Found++; } } } DEBUGMSGTL(("mibII/at", "... Found = %d/n", Found)); if (Found == 0) return (NULL); memcpy((char *) name, (char *) lowest, olength * sizeof(oid)); *length = olength; *write_method = 0; switch (vp->magic) { case IPMEDIAIFINDEX: *var_len = sizeof long_return;#ifdef NETSNMP_INCLUDE_IFTABLE_REWRITES Lowentry.ipNetToMediaIfIndex.o_bytes[ Lowentry.ipNetToMediaIfIndex.o_length] = '/0'; long_return = netsnmp_access_interface_index_find(//.........这里部分代码省略.........
开发者ID:pexip,项目名称:os-net-snmp,代码行数:101,
示例30: ip_handlerintip_handler(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests){ netsnmp_request_info *request; netsnmp_variable_list *requestvb; long ret_value; oid subid; int type = ASN_COUNTER; /* * The cached data should already have been loaded by the * cache handler, higher up the handler chain. */#ifdef _USE_PERFSTAT_PROTOCOL ip_load(NULL, NULL);#endif /* * * */ DEBUGMSGTL(("mibII/ip", "Handler - mode %s/n", se_find_label_in_slist("agent_mode", reqinfo->mode))); switch (reqinfo->mode) { case MODE_GET: for (request=requests; request; request=request->next) { requestvb = request->requestvb; subid = requestvb->name[OID_LENGTH(ip_oid)]; /* XXX */ DEBUGMSGTL(( "mibII/ip", "oid: ")); DEBUGMSGOID(("mibII/ip", requestvb->name, requestvb->name_length)); DEBUGMSG(( "mibII/ip", "/n")); switch (subid) {#ifdef USES_SNMP_DESIGNED_IPSTAT case IPFORWARDING: ret_value = ipstat.ipForwarding; type = ASN_INTEGER; break; case IPDEFAULTTTL: ret_value = ipstat.ipDefaultTTL; type = ASN_INTEGER; break; case IPINRECEIVES: ret_value = ipstat.ipInReceives & 0xffffffff; break; case IPINHDRERRORS: ret_value = ipstat.ipInHdrErrors; break; case IPINADDRERRORS: ret_value = ipstat.ipInAddrErrors; break; case IPFORWDATAGRAMS: ret_value = ipstat.ipForwDatagrams; break; case IPINUNKNOWNPROTOS: ret_value = ipstat.ipInUnknownProtos; break; case IPINDISCARDS: ret_value = ipstat.ipInDiscards; break; case IPINDELIVERS: ret_value = ipstat.ipInDelivers & 0xffffffff; break; case IPOUTREQUESTS: ret_value = ipstat.ipOutRequests & 0xffffffff; break; case IPOUTDISCARDS: ret_value = ipstat.ipOutDiscards; break; case IPOUTNOROUTES: ret_value = ipstat.ipOutNoRoutes; break; case IPREASMTIMEOUT: ret_value = ipstat.ipReasmTimeout; type = ASN_INTEGER; break; case IPREASMREQDS: ret_value = ipstat.ipReasmReqds; break; case IPREASMOKS: ret_value = ipstat.ipReasmOKs; break; case IPREASMFAILS: ret_value = ipstat.ipReasmFails; break; case IPFRAGOKS: ret_value = ipstat.ipFragOKs; break; case IPFRAGFAILS: ret_value = ipstat.ipFragFails; break; case IPFRAGCREATES: ret_value = ipstat.ipFragCreates; break; case IPROUTEDISCARDS://.........这里部分代码省略.........
开发者ID:fenner,项目名称:net-snmp,代码行数:101,
注:本文中的DEBUGMSGOID函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ DEBUGMSGT函数代码示例 C++ DEBUGLVL函数代码示例 |