本文整理汇总了C++中DEBUGMSGOID函数的典型用法代码示例。如果您正苦于以下问题:C++ DEBUGMSGOID函数的具体用法?C++ DEBUGMSGOID怎么用?C++ DEBUGMSGOID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DEBUGMSGOID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getStatPtr
u_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;
}
示例2: header_hrdisk
int
header_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;
}
示例3: header_hrnet
int
header_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;
}
示例4: header_hrfilesys
int
header_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;
}
示例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
*/
int
header_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);
}
示例6: header_complex_generate_oid
void
header_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"));
}
示例7: header_hrswinst
int
header_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);
}
示例8: header_hrdevice
int
header_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
示例9: netsnmp_null_handler
int
netsnmp_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;
}
}
示例10: agentx_var
u_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;
}
示例11: netsnmp_cache_timer_start
/** starts the recurring cache_load callback */
unsigned int
netsnmp_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;
}
示例12: add
int
add(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;
}
示例13: my_test_handler
int
my_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;
}
示例14: header_complex_dump
void
header_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"));
}
}
示例15: fillConfigOid
static void
fillConfigOid(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));
}