version 1.7, 2020/01/17 09:52:44 |
version 1.8, 2020/05/19 13:41:01 |
|
|
bzero(buf, len); |
bzero(buf, len); |
bzero(&key, sizeof(key)); |
bzero(&key, sizeof(key)); |
bcopy(o, &key.o_id, sizeof(struct ber_oid)); |
bcopy(o, &key.o_id, sizeof(struct ber_oid)); |
key.o_flags |= OID_KEY; /* do not match wildcards */ |
|
|
|
for (i = 0; i < o->bo_n; i++) { |
for (i = 0; i < o->bo_n; i++) { |
key.o_oidlen = i + 1; |
key.o_oidlen = i + 1; |
|
|
continue; |
continue; |
} |
} |
decl = RB_FIND(oidtree, &smi_oidtree, oid); |
decl = RB_FIND(oidtree, &smi_oidtree, oid); |
decl->o_flags = oid->o_flags; |
|
decl->o_get = oid->o_get; |
|
decl->o_set = oid->o_set; |
|
decl->o_table = oid->o_table; |
|
decl->o_val = oid->o_val; |
|
decl->o_data = oid->o_data; |
|
} |
} |
} |
} |
|
|
|
|
} |
} |
|
|
struct oid * |
struct oid * |
smi_foreach(struct oid *oid, u_int flags) |
smi_foreach(struct oid *oid) |
{ |
{ |
/* |
/* |
* Traverse the tree of MIBs with the option to check |
* Traverse the tree of MIBs with the option to check |
* for specific OID flags. |
* for specific OID flags. |
*/ |
*/ |
if (oid == NULL) { |
if (oid == NULL) |
oid = RB_MIN(oidtree, &smi_oidtree); |
return RB_MIN(oidtree, &smi_oidtree); |
if (oid == NULL) |
return RB_NEXT(oidtree, &smi_oidtree, oid); |
return (NULL); |
|
if (flags == 0 || (oid->o_flags & flags)) |
|
return (oid); |
|
} |
|
for (;;) { |
|
oid = RB_NEXT(oidtree, &smi_oidtree, oid); |
|
if (oid == NULL) |
|
break; |
|
if (flags == 0 || (oid->o_flags & flags)) |
|
return (oid); |
|
} |
|
|
|
return (oid); |
|
} |
} |
|
|
int |
int |
|
|
if (a->o_oid[i] != b->o_oid[i]) |
if (a->o_oid[i] != b->o_oid[i]) |
return (a->o_oid[i] - b->o_oid[i]); |
return (a->o_oid[i] - b->o_oid[i]); |
} |
} |
|
|
/* |
|
* Return success if the matched object is a table |
|
* or a MIB registered by a subagent |
|
* (it will match any sub-elements) |
|
*/ |
|
if ((b->o_flags & OID_TABLE || |
|
b->o_flags & OID_REGISTERED) && |
|
(a->o_flags & OID_KEY) == 0 && |
|
(a->o_oidlen > b->o_oidlen)) |
|
return (0); |
|
|
|
return (a->o_oidlen - b->o_oidlen); |
return (a->o_oidlen - b->o_oidlen); |
} |
} |