Hi Dave:
 

I can hardly caught you what your meaning about " Try registering a routine 
using snmp_register_callback()",I am sorry,I read the vacm_conf.c file 
wholely,I found nothing I need,yes, I am nothing on it.
 

In my prototype snmptrapd ,I implemented send trap routine like follows:
 

init_uit(){
[SKIP]
initialize_table_hostInterfaceFCTable();
[SKIP]
snmp_alarm_register(10,     /* seconds */
  SA_REPEAT,      /* repeat (every 10 seconds). */
  send_fcSpeedtrap_trap,      /* our callback */
  NULL    /* no callback data needed */
  );
[SKIP]
}
 

It make perfect right,now,my team leader want to call my function send the 
trap,so I want to know whether has a function can send trap when I call it.I 
just want a simple example when I want to send the trap,My leader will give me 
a data structure(include the index and the bounded inqueries data)So,Dave,give 
me more information how about I can deal with this situation,Thank you!
 
 
 
Some pieces code:
 
int
send_uit_trap( netlink_msg_full_t example)
{
// netlink_msg_full_t example;
example.DeviceType = SES_JBOD_POWER ;
example.DeviceSubID = SES_JBOD_POWER_A;
example.DeviceSubStatus = SES_JBOD_POWER_HALT;
 

if( example.DeviceSubStatus == SES_JBOD_POWER_HALT  ){
 
 
 
/*Here,I cannot find a suitable function send the trap when I want to trigger 
it 。 */
    snmp_alarm_register(5,     /* seconds */
        SA_REPEAT,      /* repeat (every 10 seconds). */
        send_uitJBODPowerATraps_trap,      /* our callback */
        NULL    /* no callback data needed */);
 
}else{
    return;
}
 
 
 
int
send_uitJBODPowerATraps_trap( void )
{
    netsnmp_variable_list  *var_list = NULL;
    oid uitJBODPowerATraps_oid[] = { 1,3,6,1,4,1,30901,2090,7000,5,0,18 };
    oid jBODPowerDENum_oid[] = { 1,3,6,1,4,1,30901,2090,7000,2,4,4,1,1,2,  
example->msg_source/* insert tableindex here */ };
    oid jBODPowerAStatus_oid[] = { 1,3,6,1,4,1,30901,2090,7000,2,4,4,1,1,3, 
example->msg_source/* insert tableindex here */ };
    char *temp = "uituit";
    /*
     * Set the snmpTrapOid.0 value
     */
    snmp_varlist_add_variable(&var_list,
        snmptrap_oid, OID_LENGTH(snmptrap_oid),
        ASN_OBJECT_ID,
        uitJBODPowerATraps_oid, sizeof(uitJBODPowerATraps_oid));
    PRINT_SNMP(__FUNCTION__,__LINE__);
    /*
     * Add any objects from the trap definition
     */
    snmp_varlist_add_variable(&var_list,
        jBODPowerDENum_oid, OID_LENGTH(jBODPowerDENum_oid),
        ASN_OCTET_STR,
        /* Set an appropriate value for jBODPowerDENum */
        temp, stelen(temp));
    PRINT_SNMP(__FUNCTION__,__LINE__);
    snmp_varlist_add_variable(&var_list,
        jBODPowerAStatus_oid, OID_LENGTH(jBODPowerAStatus_oid),
        ASN_INTEGER,
        /* Set an appropriate value for jBODPowerAStatus */
        &( example->element_status ), sizeof( example->element_status ));
    PRINT_SNMP(__FUNCTION__,__LINE__);
 
    /*
     * Add any extra (optional) objects here
     */
 
    /*
     * Send the trap to the list of configured destinations
     *  and clean up
     */
    send_v2trap( var_list );
    PRINT_SNMP(__FUNCTION__,__LINE__);
 
    snmp_free_varbind( var_list );
    PRINT_SNMP(__FUNCTION__,__LINE__);
 
    return SNMP_ERR_NOERROR;
}
------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to