| 1 |
/* |
| 2 |
* DisMan Event MIB: |
| 3 |
* Core implementation of the event handling behaviour |
| 4 |
*/ |
| 5 |
|
| 6 |
#include <net-snmp/net-snmp-config.h> |
| 7 |
#include <net-snmp/net-snmp-features.h> |
| 8 |
#include <net-snmp/net-snmp-includes.h> |
| 9 |
#include <net-snmp/agent/net-snmp-agent-includes.h> |
| 10 |
#include "agent_global_vars.h" |
| 11 |
#include "agentx/subagent.h" |
| 12 |
#include "disman/event/mteEvent.h" |
| 13 |
#include "disman/event/mteTrigger.h" |
| 14 |
#include "disman/event/mteObjects.h" |
| 15 |
|
| 16 |
netsnmp_feature_child_of(disman_debugging, libnetsnmpmibs); |
| 17 |
netsnmp_feature_child_of(mteevent, libnetsnmpmibs); |
| 18 |
netsnmp_feature_child_of(mteevent_removeentry, mteevent); |
| 19 |
|
| 20 |
netsnmp_tdata *event_table_data; |
| 21 |
|
| 22 |
/* |
| 23 |
* Initialize the container for the (combined) mteEvent*Table, |
| 24 |
* regardless of which table initialisation routine is called first. |
| 25 |
*/ |
| 26 |
|
| 27 |
void |
| 28 |
init_event_table_data(void) |
| 29 |
{ |
| 30 |
DEBUGMSGTL(("disman:event:init", "init event container\n")); |
| 31 |
if (!event_table_data) { |
| 32 |
event_table_data = netsnmp_tdata_create_table("mteEventTable", 0); |
| 33 |
DEBUGMSGTL(("disman:event:init", "create event container (%p)\n", |
| 34 |
event_table_data)); |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
void _init_default_mteEvent( const char *event, const char *oname, int specific ); |
| 39 |
void _init_link_mteEvent( const char *event, const char *oname, int specific ); |
| 40 |
void _init_builtin_mteEvent( const char *event, const char *oname, |
| 41 |
oid *trapOID, size_t trapOID_len ); |
| 42 |
|
| 43 |
|
| 44 |
/** Initializes the mteEvent module */ |
| 45 |
void |
| 46 |
init_mteEvent(void) |
| 47 |
{ |
| 48 |
static int _defaults_init = 0; |
| 49 |
init_event_table_data(); |
| 50 |
|
| 51 |
/* |
| 52 |
* Insert fixed events for the default trigger notifications |
| 53 |
* |
| 54 |
* NB: internal events (with an owner of "_snmpd") will not in |
| 55 |
* fact refer to the mteObjectsTable for the payload varbinds. |
| 56 |
* The routine mteObjects_internal_vblist() hardcodes the |
| 57 |
* appropriate varbinds for these internal events. |
| 58 |
* This routine will need to be updated whenever a new |
| 59 |
* internal event is added. |
| 60 |
*/ |
| 61 |
if ( _defaults_init) |
| 62 |
return; |
| 63 |
|
| 64 |
_init_default_mteEvent( "mteTriggerFired", "_triggerFire", 1 ); |
| 65 |
_init_default_mteEvent( "mteTriggerRising", "_triggerFire", 2 ); |
| 66 |
_init_default_mteEvent( "mteTriggerFalling", "_triggerFire", 3 ); |
| 67 |
_init_default_mteEvent( "mteTriggerFailure", "_triggerFail", 4 ); |
| 68 |
|
| 69 |
_init_link_mteEvent( "linkDown", "_linkUpDown", 3 ); |
| 70 |
_init_link_mteEvent( "linkUp", "_linkUpDown", 4 ); |
| 71 |
_defaults_init = 1; |
| 72 |
} |
| 73 |
|
| 74 |
void |
| 75 |
_init_builtin_mteEvent( const char *event, const char *oname, oid *trapOID, size_t trapOID_len ) |
| 76 |
{ |
| 77 |
char ename[ MTE_STR1_LEN+1 ]; |
| 78 |
netsnmp_tdata_row *row; |
| 79 |
struct mteEvent *entry; |
| 80 |
|
| 81 |
snprintf(ename, sizeof(ename), "_%s", event); |
| 82 |
|
| 83 |
row = mteEvent_createEntry( "_snmpd", ename, 1 ); |
| 84 |
if (!row || !row->data) |
| 85 |
return; |
| 86 |
entry = (struct mteEvent *)row->data; |
| 87 |
|
| 88 |
entry->mteEventActions = MTE_EVENT_NOTIFICATION; |
| 89 |
entry->mteNotification_len = trapOID_len; |
| 90 |
memcpy( entry->mteNotification, trapOID, trapOID_len*sizeof(oid)); |
| 91 |
memcpy( entry->mteNotifyOwner, "_snmpd", 6 ); |
| 92 |
strlcpy(entry->mteNotifyObjects, oname, sizeof(entry->mteNotifyObjects)); |
| 93 |
entry->flags |= MTE_EVENT_FLAG_ENABLED| |
| 94 |
MTE_EVENT_FLAG_ACTIVE| |
| 95 |
MTE_EVENT_FLAG_VALID; |
| 96 |
} |
| 97 |
|
| 98 |
void |
| 99 |
_init_default_mteEvent( const char *event, const char *oname, int specific ) |
| 100 |
{ |
| 101 |
oid mteTrapOID[] = {1, 3, 6, 1, 2, 1, 88, 2, 0, 99 /* placeholder */}; |
| 102 |
size_t mteTrapOID_len = OID_LENGTH(mteTrapOID); |
| 103 |
|
| 104 |
mteTrapOID[ mteTrapOID_len-1 ] = specific; |
| 105 |
_init_builtin_mteEvent( event, oname, mteTrapOID, mteTrapOID_len ); |
| 106 |
} |
| 107 |
|
| 108 |
|
| 109 |
void |
| 110 |
_init_link_mteEvent( const char *event, const char *oname, int specific ) |
| 111 |
{ |
| 112 |
oid mteTrapOID[] = {1, 3, 6, 1, 6, 3, 1, 1, 5, 99 /* placeholder */}; |
| 113 |
size_t mteTrapOID_len = OID_LENGTH(mteTrapOID); |
| 114 |
|
| 115 |
mteTrapOID[ mteTrapOID_len-1 ] = specific; |
| 116 |
_init_builtin_mteEvent( event, oname, mteTrapOID, mteTrapOID_len ); |
| 117 |
} |
| 118 |
|
| 119 |
|
| 120 |
/* =================================================== |
| 121 |
* |
| 122 |
* APIs for maintaining the contents of the (combined) |
| 123 |
* mteEvent*Table container. |
| 124 |
* |
| 125 |
* =================================================== */ |
| 126 |
|
| 127 |
#ifndef NETSNMP_FEATURE_REMOVE_DISMAN_DEBUGGING |
| 128 |
void |
| 129 |
_mteEvent_dump(void) |
| 130 |
{ |
| 131 |
struct mteEvent *entry; |
| 132 |
netsnmp_tdata_row *row; |
| 133 |
int i = 0; |
| 134 |
|
| 135 |
for (row = netsnmp_tdata_row_first(event_table_data); |
| 136 |
row; |
| 137 |
row = netsnmp_tdata_row_next(event_table_data, row)) { |
| 138 |
entry = (struct mteEvent *)row->data; |
| 139 |
DEBUGMSGTL(("disman:event:dump", "EventTable entry %d: ", i)); |
| 140 |
DEBUGMSGOID(("disman:event:dump", row->oid_index.oids, row->oid_index.len)); |
| 141 |
DEBUGMSG(("disman:event:dump", "(%s, %s)", |
| 142 |
row->indexes->val.string, |
| 143 |
row->indexes->next_variable->val.string)); |
| 144 |
DEBUGMSG(("disman:event:dump", ": %p, %p\n", row, entry)); |
| 145 |
i++; |
| 146 |
} |
| 147 |
DEBUGMSGTL(("disman:event:dump", "EventTable %d entries\n", i)); |
| 148 |
} |
| 149 |
#endif /* NETSNMP_FEATURE_REMOVE_DISMAN_DEBUGGING */ |
| 150 |
|
| 151 |
/* |
| 152 |
* Create a new row in the event table |
| 153 |
*/ |
| 154 |
netsnmp_tdata_row * |
| 155 |
mteEvent_createEntry(const char *mteOwner, const char *mteEName, int fixed) |
| 156 |
{ |
| 157 |
struct mteEvent *entry; |
| 158 |
netsnmp_tdata_row *row; |
| 159 |
size_t mteOwner_len = (mteOwner) ? strlen(mteOwner) : 0; |
| 160 |
size_t mteEName_len = (mteEName) ? strlen(mteEName) : 0; |
| 161 |
|
| 162 |
DEBUGMSGTL(("disman:event:table", "Create event entry (%s, %s)\n", |
| 163 |
mteOwner, mteEName)); |
| 164 |
/* |
| 165 |
* Create the mteEvent entry, and the |
| 166 |
* (table-independent) row wrapper structure... |
| 167 |
*/ |
| 168 |
entry = SNMP_MALLOC_TYPEDEF(struct mteEvent); |
| 169 |
if (!entry) |
| 170 |
return NULL; |
| 171 |
|
| 172 |
row = netsnmp_tdata_create_row(); |
| 173 |
if (!row) { |
| 174 |
SNMP_FREE(entry); |
| 175 |
return NULL; |
| 176 |
} |
| 177 |
row->data = entry; |
| 178 |
|
| 179 |
/* |
| 180 |
* ... initialize this row with the indexes supplied |
| 181 |
* and the default values for the row... |
| 182 |
*/ |
| 183 |
if (mteOwner) |
| 184 |
memcpy(entry->mteOwner, mteOwner, mteOwner_len); |
| 185 |
netsnmp_table_row_add_index(row, ASN_OCTET_STR, |
| 186 |
entry->mteOwner, mteOwner_len); |
| 187 |
if (mteEName) |
| 188 |
memcpy(entry->mteEName, mteEName, mteEName_len); |
| 189 |
netsnmp_table_row_add_index(row, ASN_PRIV_IMPLIED_OCTET_STR, |
| 190 |
entry->mteEName, mteEName_len); |
| 191 |
|
| 192 |
entry->mteNotification_len = 2; /* .0.0 */ |
| 193 |
if (fixed) |
| 194 |
entry->flags |= MTE_EVENT_FLAG_FIXED; |
| 195 |
|
| 196 |
/* |
| 197 |
* ... and insert the row into the (common) table container |
| 198 |
*/ |
| 199 |
netsnmp_tdata_add_row(event_table_data, row); |
| 200 |
DEBUGMSGTL(("disman:event:table", "Event entry created\n")); |
| 201 |
return row; |
| 202 |
} |
| 203 |
|
| 204 |
|
| 205 |
#ifndef NETSNMP_FEATURE_REMOVE_MTEEVENT_REMOVEENTRY |
| 206 |
/* |
| 207 |
* Remove a row from the event table |
| 208 |
*/ |
| 209 |
void |
| 210 |
mteEvent_removeEntry(netsnmp_tdata_row *row) |
| 211 |
{ |
| 212 |
struct mteEvent *entry; |
| 213 |
|
| 214 |
if (!row) |
| 215 |
return; /* Nothing to remove */ |
| 216 |
entry = (struct mteEvent *) |
| 217 |
netsnmp_tdata_remove_and_delete_row(event_table_data, row); |
| 218 |
SNMP_FREE(entry); |
| 219 |
} |
| 220 |
#endif /* NETSNMP_FEATURE_REMOVE_MTEEVENT_REMOVEENTRY */ |
| 221 |
|
| 222 |
/* =================================================== |
| 223 |
* |
| 224 |
* APIs for processing the firing of an event |
| 225 |
* |
| 226 |
* =================================================== */ |
| 227 |
|
| 228 |
int |
| 229 |
_mteEvent_fire_notify( struct mteEvent *event, |
| 230 |
struct mteTrigger *trigger, |
| 231 |
oid *suffix, size_t sfx_len ); |
| 232 |
#ifndef NETSNMP_NO_WRITE_SUPPORT |
| 233 |
int |
| 234 |
_mteEvent_fire_set( struct mteEvent *event, |
| 235 |
struct mteTrigger *trigger, |
| 236 |
oid *suffix, size_t sfx_len ); |
| 237 |
#endif /* NETSNMP_NO_WRITE_SUPPORT */ |
| 238 |
|
| 239 |
int |
| 240 |
mteEvent_fire( char *owner, char *event, /* Event to invoke */ |
| 241 |
struct mteTrigger *trigger, /* Trigger that fired */ |
| 242 |
oid *suffix, size_t s_len ) /* Matching instance */ |
| 243 |
{ |
| 244 |
struct mteEvent *entry; |
| 245 |
int fired = 0; |
| 246 |
netsnmp_variable_list owner_var, event_var; |
| 247 |
|
| 248 |
DEBUGMSGTL(("disman:event:fire", "Event fired (%s, %s)\n", |
| 249 |
owner, event)); |
| 250 |
|
| 251 |
/* |
| 252 |
* Retrieve the entry for the specified event |
| 253 |
*/ |
| 254 |
memset( &owner_var, 0, sizeof(owner_var)); |
| 255 |
memset( &event_var, 0, sizeof(event_var)); |
| 256 |
snmp_set_var_typed_value(&owner_var, ASN_OCTET_STR, owner, strlen(owner)); |
| 257 |
snmp_set_var_typed_value(&event_var, ASN_PRIV_IMPLIED_OCTET_STR, |
| 258 |
event, strlen(event)); |
| 259 |
owner_var.next_variable = &event_var; |
| 260 |
entry = (struct mteEvent *) |
| 261 |
netsnmp_tdata_row_entry( |
| 262 |
netsnmp_tdata_row_get_byidx( event_table_data, &owner_var )); |
| 263 |
if (!entry) { |
| 264 |
DEBUGMSGTL(("disman:event:fire", "No matching event\n")); |
| 265 |
return -1; |
| 266 |
} |
| 267 |
|
| 268 |
if (entry->mteEventActions & MTE_EVENT_NOTIFICATION) { |
| 269 |
DEBUGMSGTL(("disman:event:fire", "Firing notification event\n")); |
| 270 |
_mteEvent_fire_notify( entry, trigger, suffix, s_len ); |
| 271 |
fired = 1; |
| 272 |
} |
| 273 |
#ifndef NETSNMP_NO_WRITE_SUPPORT |
| 274 |
if (entry->mteEventActions & MTE_EVENT_SET) { |
| 275 |
DEBUGMSGTL(("disman:event:fire", "Firing set event\n")); |
| 276 |
_mteEvent_fire_set( entry, trigger, suffix, s_len ); |
| 277 |
fired = 1; |
| 278 |
} |
| 279 |
#endif /* NETSNMP_NO_WRITE_SUPPORT */ |
| 280 |
|
| 281 |
if (!fired) |
| 282 |
DEBUGMSGTL(("disman:event:fire", "Matched event is empty\n")); |
| 283 |
|
| 284 |
return fired; |
| 285 |
} |
| 286 |
|
| 287 |
|
| 288 |
#ifdef __NOT_NEEDED |
| 289 |
void |
| 290 |
_insert_internal_objects( netsnmp_variable_list *vblist, char *oname, |
| 291 |
struct mteTrigger *trigger) |
| 292 |
{ |
| 293 |
netsnmp_variable_list *var = NULL, *vp; |
| 294 |
oid mteHotTrigger[] = {1, 3, 6, 1, 2, 1, 88, 2, 1, 1, 0}; |
| 295 |
oid mteHotTarget[] = {1, 3, 6, 1, 2, 1, 88, 2, 1, 2, 0}; |
| 296 |
oid mteHotContext[] = {1, 3, 6, 1, 2, 1, 88, 2, 1, 3, 0}; |
| 297 |
oid mteHotOID[] = {1, 3, 6, 1, 2, 1, 88, 2, 1, 4, 0}; |
| 298 |
oid mteHotValue[] = {1, 3, 6, 1, 2, 1, 88, 2, 1, 5, 0}; |
| 299 |
|
| 300 |
/* |
| 301 |
* Construct the varbinds for this (internal) event... |
| 302 |
*/ |
| 303 |
if ((!strcmp(oname, "_mteTriggerFired" )) || |
| 304 |
(!strcmp(oname, "_mteTriggerRising" )) || |
| 305 |
(!strcmp(oname, "_mteTriggerFalling")) || |
| 306 |
(!strcmp(oname, "_triggerFire"))) { |
| 307 |
|
| 308 |
snmp_varlist_add_variable( &var, |
| 309 |
mteHotTrigger, OID_LENGTH(mteHotTrigger), |
| 310 |
ASN_OCTET_STR, trigger->mteTName, |
| 311 |
strlen(trigger->mteTName)); |
| 312 |
snmp_varlist_add_variable( &var, |
| 313 |
mteHotTarget, OID_LENGTH(mteHotTarget), |
| 314 |
ASN_OCTET_STR, trigger->mteTriggerTarget, |
| 315 |
strlen(trigger->mteTriggerTarget)); |
| 316 |
snmp_varlist_add_variable( &var, |
| 317 |
mteHotContext, OID_LENGTH(mteHotContext), |
| 318 |
ASN_OCTET_STR, trigger->mteTriggerContext, |
| 319 |
strlen(trigger->mteTriggerContext)); |
| 320 |
snmp_varlist_add_variable( &var, |
| 321 |
mteHotOID, OID_LENGTH(mteHotOID), |
| 322 |
ASN_OBJECT_ID, (char *)trigger->mteTriggerFired->name, |
| 323 |
trigger->mteTriggerFired->name_length*sizeof(oid)); |
| 324 |
snmp_varlist_add_variable( &var, |
| 325 |
mteHotValue, OID_LENGTH(mteHotValue), |
| 326 |
trigger->mteTriggerFired->type, |
| 327 |
trigger->mteTriggerFired->val.string, |
| 328 |
trigger->mteTriggerFired->val_len); |
| 329 |
} else { |
| 330 |
DEBUGMSGTL(("disman:event:fire", |
| 331 |
"Unknown internal objects tag (%s)\n", oname)); |
| 332 |
return; |
| 333 |
} |
| 334 |
|
| 335 |
/* |
| 336 |
* ... and insert them into the main varbind list |
| 337 |
* (at the point specified) |
| 338 |
*/ |
| 339 |
for (vp = var; vp && vp->next_variable; vp=vp->next_variable) |
| 340 |
; |
| 341 |
vp->next_variable = vblist->next_variable; |
| 342 |
vblist->next_variable = var; |
| 343 |
} |
| 344 |
#endif /* __NOT_NEEDED */ |
| 345 |
|
| 346 |
int |
| 347 |
_mteEvent_fire_notify( struct mteEvent *entry, /* The event to fire */ |
| 348 |
struct mteTrigger *trigger, /* Trigger that fired */ |
| 349 |
oid *suffix, size_t sfx_len ) /* Matching instance */ |
| 350 |
{ |
| 351 |
netsnmp_variable_list *var, *v2; |
| 352 |
netsnmp_session *s; |
| 353 |
|
| 354 |
/* |
| 355 |
* The Event-MIB specification says that objects from the |
| 356 |
* mteEventTable should come after those from the trigger, |
| 357 |
* but things actually work better if these come first. |
| 358 |
* Allow the agent to be configured either way. |
| 359 |
*/ |
| 360 |
int strictOrdering = netsnmp_ds_get_boolean( |
| 361 |
NETSNMP_DS_APPLICATION_ID, |
| 362 |
NETSNMP_DS_AGENT_STRICT_DISMAN); |
| 363 |
|
| 364 |
var = (netsnmp_variable_list *)SNMP_MALLOC_TYPEDEF( netsnmp_variable_list ); |
| 365 |
if (!var) |
| 366 |
return -1; |
| 367 |
|
| 368 |
/* |
| 369 |
* Set the basic notification OID... |
| 370 |
*/ |
| 371 |
memset(var, 0, sizeof(netsnmp_variable_list)); |
| 372 |
snmp_set_var_objid( var, snmptrap_oid, snmptrap_oid_len ); |
| 373 |
snmp_set_var_typed_value( var, ASN_OBJECT_ID, |
| 374 |
(u_char *)entry->mteNotification, |
| 375 |
entry->mteNotification_len*sizeof(oid)); |
| 376 |
|
| 377 |
/* |
| 378 |
* ... then add the specified objects from the Objects Table. |
| 379 |
* |
| 380 |
* Strictly speaking, the objects from the EventTable are meant |
| 381 |
* to be listed last (after the various trigger objects). |
| 382 |
* But logically things actually work better if the event objects |
| 383 |
* are placed first. So this code handles things either way :-) |
| 384 |
*/ |
| 385 |
|
| 386 |
if (!strictOrdering) { |
| 387 |
DEBUGMSGTL(("disman:event:fire", "Adding event objects (first)\n")); |
| 388 |
if (strcmp(entry->mteNotifyOwner, "_snmpd") != 0) |
| 389 |
mteObjects_vblist( var, entry->mteNotifyOwner, |
| 390 |
entry->mteNotifyObjects, |
| 391 |
suffix, sfx_len ); |
| 392 |
} |
| 393 |
|
| 394 |
DEBUGMSGTL(("disman:event:fire", "Adding trigger objects (general)\n")); |
| 395 |
mteObjects_vblist( var, trigger->mteTriggerOOwner, |
| 396 |
trigger->mteTriggerObjects, |
| 397 |
suffix, sfx_len ); |
| 398 |
DEBUGMSGTL(("disman:event:fire", "Adding trigger objects (specific)\n")); |
| 399 |
mteObjects_vblist( var, trigger->mteTriggerXOwner, |
| 400 |
trigger->mteTriggerXObjects, |
| 401 |
suffix, sfx_len ); |
| 402 |
|
| 403 |
if (strictOrdering) { |
| 404 |
DEBUGMSGTL(("disman:event:fire", "Adding event objects (last)\n")); |
| 405 |
if (strcmp(entry->mteNotifyOwner, "_snmpd") != 0) |
| 406 |
mteObjects_vblist( var, entry->mteNotifyOwner, |
| 407 |
entry->mteNotifyObjects, |
| 408 |
suffix, sfx_len ); |
| 409 |
} |
| 410 |
|
| 411 |
/* |
| 412 |
* Query the agent to retrieve the necessary values... |
| 413 |
* (skipping the initial snmpTrapOID varbind) |
| 414 |
*/ |
| 415 |
v2 = var->next_variable; |
| 416 |
if (entry->session) |
| 417 |
s = entry->session; |
| 418 |
else |
| 419 |
s = trigger->session; |
| 420 |
netsnmp_query_get( v2, s ); |
| 421 |
|
| 422 |
/* |
| 423 |
* ... add any "internal" objects... |
| 424 |
* (skipped by the processing above, and best handled directly) |
| 425 |
*/ |
| 426 |
if (strcmp(entry->mteNotifyOwner, "_snmpd") == 0) { |
| 427 |
DEBUGMSGTL(("disman:event:fire", "Adding event objects (internal)\n")); |
| 428 |
if ( !strictOrdering ) { |
| 429 |
mteObjects_internal_vblist(var, entry->mteNotifyObjects, trigger, s); |
| 430 |
} else { |
| 431 |
for (v2 = var; v2 && v2->next_variable; v2=v2->next_variable) |
| 432 |
; |
| 433 |
mteObjects_internal_vblist(v2, entry->mteNotifyObjects, trigger, s); |
| 434 |
} |
| 435 |
} |
| 436 |
|
| 437 |
/* |
| 438 |
* ... and send the resulting varbind list as a notification |
| 439 |
*/ |
| 440 |
send_v2trap( var ); |
| 441 |
snmp_free_varbind( var ); |
| 442 |
return 0; |
| 443 |
} |
| 444 |
|
| 445 |
|
| 446 |
#ifndef NETSNMP_NO_WRITE_SUPPORT |
| 447 |
int |
| 448 |
_mteEvent_fire_set( struct mteEvent *entry, /* The event to fire */ |
| 449 |
struct mteTrigger *trigger, /* Trigger that fired */ |
| 450 |
oid *suffix, size_t sfx_len ) /* Matching instance */ |
| 451 |
{ |
| 452 |
netsnmp_variable_list var; |
| 453 |
oid set_oid[ MAX_OID_LEN ]; |
| 454 |
size_t set_len; |
| 455 |
|
| 456 |
/* |
| 457 |
* Set the basic assignment OID... |
| 458 |
*/ |
| 459 |
memset(set_oid, 0, sizeof(set_oid)); |
| 460 |
memcpy(set_oid, entry->mteSetOID, entry->mteSetOID_len*sizeof(oid)); |
| 461 |
set_len = entry->mteSetOID_len; |
| 462 |
|
| 463 |
/* |
| 464 |
* ... if the trigger value is wildcarded (sfx_len > 0), |
| 465 |
* *and* the SET event entry is wildcarded, |
| 466 |
* then add the supplied instance suffix... |
| 467 |
*/ |
| 468 |
if (sfx_len && |
| 469 |
entry->flags & MTE_SET_FLAG_OBJWILD) { |
| 470 |
memcpy( &set_oid[set_len], suffix, sfx_len*sizeof(oid)); |
| 471 |
set_len += sfx_len; |
| 472 |
} |
| 473 |
|
| 474 |
/* |
| 475 |
* ... finally build the assignment varbind, |
| 476 |
* and pass it to be acted on. |
| 477 |
* |
| 478 |
* XXX: Need to handle (remote) targets and non-default contexts |
| 479 |
*/ |
| 480 |
memset( &var, 0, sizeof(var)); |
| 481 |
snmp_set_var_objid( &var, set_oid, set_len ); |
| 482 |
snmp_set_var_typed_integer( &var, ASN_INTEGER, entry->mteSetValue ); |
| 483 |
if (entry->session) |
| 484 |
return netsnmp_query_set( &var, entry->session ); |
| 485 |
else |
| 486 |
return netsnmp_query_set( &var, trigger->session ); |
| 487 |
|
| 488 |
/* XXX - Need to check result */ |
| 489 |
} |
| 490 |
#endif /* NETSNMP_NO_WRITE_SUPPORT */ |