本文整理汇总了C++中snmp_oid_compare函数的典型用法代码示例。如果您正苦于以下问题:C++ snmp_oid_compare函数的具体用法?C++ snmp_oid_compare怎么用?C++ snmp_oid_compare使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snmp_oid_compare函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: snmp_input
int snmp_input(int op,
struct snmp_session *session,
int reqid,
struct snmp_pdu *pdu,
void *magic)
{
struct sockaddr_in *src_ip;
uint32_t specific;
struct variable_list *var;
#ifdef HAVE_NETSNMP
if (op != NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE)
goto out;
#else
if (op != RECEIVED_MESSAGE)
goto out;
#endif
if (pdu->command != SNMP_MSG_TRAP)
goto out;
if (snmp_oid_compare(ipmi_oid, IPMI_OID_SIZE,
pdu->enterprise, pdu->enterprise_length)
!= 0)
{
goto out;
}
if (pdu->trap_type != SNMP_TRAP_ENTERPRISESPECIFIC)
goto out;
src_ip = (struct sockaddr_in *) &pdu->agent_addr;
specific = pdu->specific_type;
var = pdu->variables;
if (var == NULL)
goto out;
if (var->type != ASN_OCTET_STR)
goto out;
if (snmp_oid_compare(ipmi_oid, IPMI_OID_SIZE, var->name, var->name_length)
!= 0)
{
goto out;
}
if (var->val_len < 46)
goto out;
ipmi_handle_snmp_trap_data(src_ip,
sizeof(*src_ip),
IPMI_EXTERN_ADDR_IP,
specific,
var->val.string,
var->val_len);
out:
return 1;
}
开发者ID:ystk,项目名称:debian-openipmi,代码行数:54,代码来源:basic_ui.c
示例2: agentx_notify
int
agentx_notify(netsnmp_session * session, netsnmp_pdu *pdu)
{
netsnmp_session *sp;
netsnmp_variable_list *var;
extern const oid sysuptime_oid[], snmptrap_oid[];
extern const size_t sysuptime_oid_len, snmptrap_oid_len;
sp = find_agentx_session(session, pdu->sessid);
if (sp == NULL)
return AGENTX_ERR_NOT_OPEN;
var = pdu->variables;
if (!var)
return AGENTX_ERR_PROCESSING_ERROR;
if (snmp_oid_compare(var->name, var->name_length,
sysuptime_oid, sysuptime_oid_len) == 0) {
var = var->next_variable;
}
if (!var || snmp_oid_compare(var->name, var->name_length,
snmptrap_oid, snmptrap_oid_len) != 0)
return AGENTX_ERR_PROCESSING_ERROR;
/*
* If sysUptime isn't the first varbind, don't worry.
* send_trap_vars() will add it if necessary.
*
* Note that if this behaviour is altered, it will
* be necessary to add sysUptime here,
* as this is valid AgentX syntax.
*/
/* If a context name was specified, send the trap using that context.
* Otherwise, send the trap without the context using the old method */
if (pdu->contextName != NULL)
{
send_trap_vars_with_context(-1, -1, pdu->variables,
pdu->contextName);
}
else
{
send_trap_vars(-1, -1, pdu->variables);
}
return AGENTX_ERR_NOERROR;
}
开发者ID:WimObiwan,项目名称:net-snmp,代码行数:48,代码来源:master_admin.c
示例3: 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);
}
开发者ID:KrisChaplin,项目名称:LRT2x4_v1.0.2.06_GPL_source,代码行数:27,代码来源:hr_swinst.c
示例4: header_system
int
header_system(struct variable *vp,
oid *name,
int *length,
int exact,
int *var_len,
WriteMethod **write_method)
{
#define SYSTEM_NAME_LENGTH 8
oid newname[MAX_OID_LEN];
int result;
char c_oid[SPRINT_MAX_LEN];
if (snmp_get_do_debugging()) {
sprint_objid (c_oid, name, *length);
DEBUGMSGTL(("mibII/system", "var_system: %s %d\n", c_oid, exact));
DEBUGMSGTL(("mibII/system", "vp len: %d / %d\n", vp->namelen, 8));
}
memcpy((char *)newname, (char *)vp->name, (int)vp->namelen * sizeof(oid));
newname[SYSTEM_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( (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 */
return(MATCH_SUCCEEDED);
}
开发者ID:Einheri,项目名称:wl500g,代码行数:31,代码来源:system_mib.c
示例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);
}
开发者ID:Einheri,项目名称:wl500g,代码行数:38,代码来源:dummy.c
示例6: 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;
}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:29,代码来源:master.c
示例7: header_complex_maybe_add_data_by_oid
struct header_complex_index *
header_complex_maybe_add_data_by_oid(struct header_complex_index **thedata,
oid * newoid, size_t newoid_len, void *data,
int dont_allow_duplicates)
{
struct header_complex_index *hciptrn, *hciptrp;
int rc;
if (thedata == NULL || newoid == NULL || data == NULL)
return NULL;
for (hciptrn = *thedata, hciptrp = NULL;
hciptrn != NULL; hciptrp = hciptrn, hciptrn = hciptrn->next) {
/*
* XXX: check for == and error (overlapping table entries)
* 8/2005 rks Ok, I added duplicate entry check, but only log
* warning and continue, because it seems that nobody
* that calls this fucntion does error checking!.
*/
rc = snmp_oid_compare(hciptrn->name, hciptrn->namelen,
newoid, newoid_len);
if (rc > 0)
break;
else if (0 == rc) {
snmp_log(LOG_WARNING, "header_complex_add_data_by_oid with "
"duplicate index.\n");
if (dont_allow_duplicates)
return NULL;
}
}
return _header_complex_add_between(thedata, hciptrp, hciptrn,
newoid, newoid_len, data);
}
开发者ID:duniansampa,项目名称:SigLog,代码行数:34,代码来源:header_complex.cpp
示例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
开发者ID:274914765,项目名称:C,代码行数:34,代码来源:hr_device.c
示例9: header_dlmod
static int
header_dlmod(struct variable *vp,
oid * name,
size_t * length,
int exact, size_t * var_len, WriteMethod ** write_method)
{
#define DLMOD_NAME_LENGTH 10
oid newname[MAX_OID_LEN];
int result;
memcpy((char *) newname, (char *) vp->name,
(int) vp->namelen * sizeof(oid));
newname[DLMOD_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((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 */
return MATCH_SUCCEEDED;
}
开发者ID:RasmusKoldsoe,项目名称:performand.k70.2,代码行数:27,代码来源:dlmod.c
示例10: expValueTable_set
static int
expValueTable_set(struct expExpressionTable_data *expression_data,
const char *owner, size_t owner_len, const char *name,
size_t name_len, oid *index, size_t index_len)
{
netsnmp_variable_list *vars = NULL;
struct expValueTable_data *thedata;
struct header_complex_index *hcindex;
int found = 0;
for (hcindex = expValueTableStorage; hcindex; hcindex = hcindex->next) {
thedata = hcindex->data;
if (strcmp(thedata->expExpressionOwner, owner) == 0 &&
thedata->expExpressionOwnerLen == owner_len &&
strcmp(thedata->expExpressionName, name) == 0 &&
thedata->expExpressionNameLen == name_len) {
found = 1;
break;
}
}
if (found) {
if (snmp_oid_compare(thedata->expValueInstance,
thedata->expValueInstanceLen, index,
index_len) != 0) {
SNMP_FREE(thedata->expValueInstance);
thedata->expValueInstance = netsnmp_memdup(index, index_len);
thedata->expValueInstanceLen = index_len;
} else {
SNMP_FREE(index);
}
} else if ((thedata = calloc(1, sizeof(*thedata)))) {
thedata->expExpressionOwner = owner;
thedata->expExpressionOwnerLen = owner_len;
thedata->expExpressionName = name;
thedata->expExpressionNameLen = name_len;
thedata->expValueInstance = index;
thedata->expValueInstanceLen = index_len;
thedata->expression_data = expression_data;
snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR,
(const char *) thedata->expExpressionOwner,
thedata->expExpressionOwnerLen);
snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR,
(const char *) thedata->expExpressionName,
thedata->expExpressionNameLen);
snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OBJECT_ID,
(u_char *) thedata->expValueInstance,
thedata->expValueInstanceLen * sizeof(oid));
header_complex_add_data(&expValueTableStorage, vars, thedata);
} else {
return SNMPERR_GENERR;
}
thedata->set = 1;
return SNMPERR_SUCCESS;
}
开发者ID:michalklempa,项目名称:net-snmp,代码行数:60,代码来源:expValueTable.c
示例11: vacm_getViewEntry
struct vacm_viewEntry *
vacm_getViewEntry(const char *viewName,
oid * viewSubtree, size_t viewSubtreeLen, int mode)
{
struct vacm_viewEntry *vp, *vpret = NULL;
char view[VACMSTRINGLEN];
int found, glen;
int count=0;
glen = (int) strlen(viewName);
if (glen < 0 || glen >= VACM_MAX_STRING)
return NULL;
view[0] = glen;
strcpy(view + 1, viewName);
for (vp = viewList; vp; vp = vp->next) {
if (!memcmp(view, vp->viewName, glen + 1)
&& viewSubtreeLen >= (vp->viewSubtreeLen - 1)) {
int mask = 0x80, maskpos = 0;
int oidpos;
found = 1;
if (mode != VACM_MODE_IGNORE_MASK) { /* check the mask */
for (oidpos = 0;
found && oidpos < (int) vp->viewSubtreeLen - 1;
oidpos++) {
if ((vp->viewMask[maskpos] & mask) != 0) {
if (viewSubtree[oidpos] !=
vp->viewSubtree[oidpos + 1])
found = 0;
}
if (mask == 1) {
mask = 0x80;
maskpos++;
} else
mask >>= 1;
}
}
if (found) {
/*
* match successful, keep this node if its longer than
* the previous or (equal and lexicographically greater
* than the previous).
*/
count++;
if (mode == VACM_MODE_CHECK_SUBTREE) {
vpret = vp;
} else if (vpret == NULL
|| vp->viewSubtreeLen > vpret->viewSubtreeLen
|| (vp->viewSubtreeLen == vpret->viewSubtreeLen
&& snmp_oid_compare(vp->viewSubtree + 1,
vp->viewSubtreeLen - 1,
vpret->viewSubtree + 1,
vpret->viewSubtreeLen - 1) >
0)) {
vpret = vp;
}
}
}
}
开发者ID:DYFeng,项目名称:infinidb,代码行数:59,代码来源:vacm.c
示例12: 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;
}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:59,代码来源:hr_disk.c
示例13: netsnmp_tdata_compare_oid
/** compare a row with the given index OID */
int
netsnmp_tdata_compare_oid(netsnmp_tdata_row *row,
oid * compareto, size_t compareto_len)
{
netsnmp_index *index = (netsnmp_index *)row;
return snmp_oid_compare( index->oids, index->len,
compareto, compareto_len);
}
开发者ID:KrisChaplin,项目名称:LRT2x4_v1.0.2.06_GPL_source,代码行数:9,代码来源:table_tdata.c
示例14: 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;
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:58,代码来源:hr_network.c
示例15: 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;
}
开发者ID:duniansampa,项目名称:SigLog,代码行数:57,代码来源:hr_filesys.cpp
示例16: pass_persist_compare
int
pass_persist_compare(const void *a, const void *b)
{
const struct extensible *const *ap, *const *bp;
ap = (const struct extensible * const *) a;
bp = (const struct extensible * const *) b;
return snmp_oid_compare((*ap)->miboid, (*ap)->miblen, (*bp)->miboid,
(*bp)->miblen);
}
开发者ID:bugfreeKK,项目名称:net-snmp-1,代码行数:9,代码来源:pass_persist.c
示例17: getNextTunnelByConfigOid
static 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,代码来源:tunnel.cpp
示例18: find_subtree_previous
struct subtree *find_subtree(oid *name,
size_t len,
struct subtree *subtree)
{
struct subtree *myptr;
myptr = find_subtree_previous(name, len, subtree);
if (myptr && snmp_oid_compare(name, len, myptr->end, myptr->end_len) < 0)
return myptr;
return NULL;
}
开发者ID:EPiCS,项目名称:reconos_v2,代码行数:12,代码来源:agent_registry.c
示例19: free_subtree
struct subtree *
free_subtree(struct subtree *st)
{
struct subtree *ret = NULL;
if ((snmp_oid_compare(st->name, st->namelen, st->start, st->start_len) == 0)
&& (st->variables != NULL))
free(st->variables);
if (st->next != NULL)
ret = st->next;
free(st);
return ret;
}
开发者ID:EPiCS,项目名称:reconos_v2,代码行数:12,代码来源:agent_registry.c
示例20: collect
netsnmp_variable_list *
collect(netsnmp_session * ss, netsnmp_pdu *pdu,
oid * base, size_t base_length)
{
netsnmp_pdu *response;
int running = 1;
netsnmp_variable_list *saved = NULL, **vlpp = &saved;
int status;
while (running) {
/*
* gotta catch em all, gotta catch em all!
*/
status = snmp_synch_response(ss, pdu, &response);
if (status != STAT_SUCCESS || !response) {
snmp_sess_perror("snmpdf", ss);
exit(1);
}
if (response->errstat != SNMP_ERR_NOERROR) {
fprintf(stderr, "snmpdf: Error in packet: %s\n",
snmp_errstring(response->errstat));
exit(1);
}
if (response && snmp_oid_compare(response->variables->name,
SNMP_MIN(base_length,
response->variables->
name_length), base,
base_length) != 0)
running = 0;
else {
/*
* get response
*/
*vlpp = response->variables;
(*vlpp)->next_variable = NULL; /* shouldn't be any, but just in case */
/*
* create the next request
*/
pdu = snmp_pdu_create(SNMP_MSG_GETNEXT);
snmp_add_null_var(pdu, (*vlpp)->name, (*vlpp)->name_length);
/*
* finish loop setup
*/
vlpp = &((*vlpp)->next_variable);
response->variables = NULL; /* ahh, forget about it */
}
snmp_free_pdu(response);
}
return saved;
}
开发者ID:ColdStart,项目名称:SNMPD,代码行数:52,代码来源:snmpdf.c
注:本文中的snmp_oid_compare函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论