/*
 * @internal
 * Check the syntax for a particular column
 */
NETSNMP_STATIC_INLINE int
_dot11WtpIfTable_check_column( dot11WtpIfTable_rowreq_ctx *rowreq_ctx,
                         netsnmp_variable_list *var, int column )
{
    int rc = SNMPERR_SUCCESS;
    
    DEBUGMSGTL(("internal:dot11WtpIfTable:_dot11WtpIfTable_check_column","called\n"));

    netsnmp_assert(NULL != rowreq_ctx);

    switch(column) {

    /* wtpIfSpeed(3)/GAUGE/ASN_GAUGE/u_long(u_long)//l/A/W/e/r/d/h */
    case COLUMN_WTPIFSPEED:
    rc = netsnmp_check_vb_type_and_size( var, ASN_GAUGE,
        sizeof( rowreq_ctx->data.wtpIfSpeed ) );
    /* yyy-rks: anything else we can do here? */
    if(SNMPERR_SUCCESS == rc) {
        rc = wtpIfSpeed_check_value( rowreq_ctx, *((u_long *)var->val.string) );
        if((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc) &&
           (MFD_NOT_VALID_NOW != rc)) {
            snmp_log(LOG_ERR, "bad rc %d from wtpIfSpeed_check_value\n", rc);
            rc = SNMP_ERR_GENERR;
        }
    }
        break;

    /* wtpIfAdminStatus(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h */
    case COLUMN_WTPIFADMINSTATUS:
    rc = netsnmp_check_vb_type_and_size( var, ASN_INTEGER,
        sizeof( rowreq_ctx->data.wtpIfAdminStatus ) );
    if(SNMPERR_SUCCESS == rc) {

    /* check that the value is one of defined enums */
    if( 1
 && ( *var->val.integer != WTPIFADMINSTATUS_DOWN )
 && ( *var->val.integer != WTPIFADMINSTATUS_UP )
        ) {
        rc = SNMP_ERR_WRONGVALUE;
        }
    }
    if(SNMPERR_SUCCESS == rc) {
        rc = wtpIfAdminStatus_check_value( rowreq_ctx, *((u_long *)var->val.string) );
        if((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc) &&
           (MFD_NOT_VALID_NOW != rc)) {
            snmp_log(LOG_ERR, "bad rc %d from wtpIfAdminStatus_check_value\n", rc);
            rc = SNMP_ERR_GENERR;
        }
    }
        break;

        default: /** We shouldn't get here */
            rc = SNMP_ERR_GENERR;
            snmp_log(LOG_ERR, "unknown column %d in _dot11WtpIfTable_check_column\n", column);
    }

    return rc;
} /* _dot11WtpIfTable_check_column */
Example #2
0
/************************************************************
 * RESERVE is used to check the syntax of all the variables
 * provided, that the values being set are sensible and consistent,
 * and to allocate any resources required for performing the SET.
 * After this stage, the expectation is that the set ought to
 * succeed, though this is not guaranteed. (In fact, with the UCD
 * agent, this is done in two passes - RESERVE1, and
 * RESERVE2, to allow for dependancies between variables).
 *
 * BEFORE calling this routine, the agent will call duplicate_row
 * to create a copy of the row (unless this is a new row; i.e.
 * row_created == 1).
 *
 * next state -> SET_RESERVE2 || SET_FREE
 */
void saHpiCtrlAnalogTable_set_reserve1( netsnmp_request_group *rg )
{
    saHpiCtrlAnalogTable_context *row_ctx =
        (saHpiCtrlAnalogTable_context *)rg->existing_row;
//	saHpiCtrlAnalogTable_context *undo_ctx =
//	(saHpiCtrlAnalogTable_context *)rg->undo_info;
    netsnmp_variable_list *var;
    netsnmp_request_group_item *current;
    int rc;

    DEBUGMSGTL ((AGENT, "saHpiCtrlAnalogTable_set_reserve1, called\n"));

    /*
     * TODO: loop through columns, check syntax and lengths. For
     * columns which have no dependencies, you could also move
     * the value/range checking here to attempt to catch error
     * cases as early as possible.
     */
    for ( current = rg->list; current; current = current->next ) {

        var = current->ri->requestvb;
        rc = SNMP_ERR_NOERROR;

        switch (current->tri->colnum) {

        case COLUMN_SAHPICTRLANALOGMODE:
            /** SaHpiCtrlMode = ASN_INTEGER */
            rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                                sizeof(row_ctx->saHpiCtrlAnalogMode));
            break;

        case COLUMN_SAHPICTRLANALOGSTATE:
            /** INTEGER = ASN_INTEGER */
            rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                                sizeof(row_ctx->saHpiCtrlAnalogState));
            break;

        default: /** We shouldn't get here */
            rc = SNMP_ERR_GENERR;
            snmp_log(LOG_ERR, "unknown column in "
                     "saHpiCtrlAnalogTable_set_reserve1\n");
        }

        if (rc)
            netsnmp_set_mode_request_error(MODE_SET_BEGIN, current->ri, rc );
        rg->status = SNMP_MAX( rg->status, current->ri->status );
    }

    /*
     * done with all the columns. Could check row related
     * requirements here.
     */
}
Example #3
0
NETSNMP_INLINE int
netsnmp_check_vb_uint(const netsnmp_variable_list *var)
{
    if (NULL == var)
        return SNMP_ERR_GENERR;
    
    return netsnmp_check_vb_type_and_size(var, ASN_UNSIGNED, sizeof(long));
}
/************************************************************
 * RESERVE is used to check the syntax of all the variables
 * provided, that the values being set are sensible and consistent,
 * and to allocate any resources required for performing the SET.
 * After this stage, the expectation is that the set ought to
 * succeed, though this is not guaranteed. (In fact, with the UCD
 * agent, this is done in two passes - RESERVE1, and
 * RESERVE2, to allow for dependancies between variables).
 *
 * BEFORE calling this routine, the agent will call duplicate_row
 * to create a copy of the row (unless this is a new row; i.e.
 * row_created == 1).
 *
 * next state -> SET_RESERVE2 || SET_FREE
 */
void
saHpiSensorThdNegHysteresisTable_set_reserve1 (netsnmp_request_group * rg)
{
  saHpiSensorThdNegHysteresisTable_context *row_ctx =
    (saHpiSensorThdNegHysteresisTable_context *) rg->existing_row;

  netsnmp_variable_list *var;
  netsnmp_request_group_item *current;
  int rc = 0;

  DEBUGMSGTL ((AGENT,
	       "saHpiSensorThdNegHysteresisTable_set_reserve1. Entry.\n"));
  for (current = rg->list; current; current = current->next)
    {

      var = current->ri->requestvb;
      rc = SNMP_ERR_NOERROR;

      switch (current->tri->colnum)
	{

	case COLUMN_SAHPISENSORTHDNEGHYSTERESISICALISREADABLE:
	case COLUMN_SAHPISENSORTHDNEGHYSTERESISICALISWRITABLE:
	case COLUMN_SAHPISENSORTHDNEGHYSTERESISICALISFIXED:
	case COLUMN_SAHPISENSORTHDNEGHYSTERESISICALVALUESPRESENT:
	  rc = SNMP_ERR_NOTWRITABLE;
	  break;

	case COLUMN_SAHPISENSORTHDNEGHYSTERESISICALRAW:
	    /** UNSIGNED32 = ASN_UNSIGNED */
	  rc = netsnmp_check_vb_type_and_size (var, ASN_UNSIGNED,
					       sizeof (row_ctx->
						       saHpiSensorThdNegHysteresisRaw));
	  break;

	case COLUMN_SAHPISENSORTHDNEGHYSTERESISICALINTERPRETED:
	    /** OCTETSTR = ASN_OCTET_STR */
	  if (var->type != ASN_OCTET_STR)
	    {
	      rc = SNMP_ERR_WRONGTYPE;
	    }
	  break;

	default:
		/** We shouldn't get here */
	  rc = SNMP_ERR_GENERR;
	  snmp_log (LOG_ERR, "unknown column in "
		    "saHpiSensorThdNegHysteresisTable_set_reserve1\n");
	}

      if (rc)
	netsnmp_set_mode_request_error (MODE_SET_BEGIN, current->ri, rc);
      rg->status = SNMP_MAX (rg->status, current->ri->status);
    }
  DEBUGMSGTL ((AGENT,
	       "saHpiSensorThdNegHysteresisTable_set_reserve1. Exit. (rc:%d) \n",
	       rc));
}
Example #5
0
int
netsnmp_check_vb_truthvalue(const netsnmp_variable_list *var)
{
    register int rc = SNMP_ERR_NOERROR;
    
    if (NULL == var)
        return SNMP_ERR_GENERR;
    
    if ((rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER, sizeof(long))))
        return rc;
    
    return netsnmp_check_vb_int_range(var, 1, 2);
}
Example #6
0
NETSNMP_INLINE int
netsnmp_check_vb_rowstatus_value(netsnmp_variable_list *var)
{
    register int rc = SNMP_ERR_NOERROR;

    if (NULL == var)
        return SNMP_ERR_GENERR;
    
    if ((rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER, sizeof(int))))
        return rc;
    
    return netsnmp_check_vb_int_range(var, SNMP_ROW_NONEXISTENT,
                                      SNMP_ROW_DESTROY);
}
/*
 * @internal
 * Check the syntax for a particular column
 */
NETSNMP_STATIC_INLINE int
_ifTable_check_column(ifTable_rowreq_ctx * rowreq_ctx,
                      netsnmp_variable_list * var, int column)
{
    int             rc = SNMPERR_SUCCESS;

    DEBUGMSGTL(("internal:_ifTable_check_column", "called\n"));

    netsnmp_assert(NULL != rowreq_ctx);

    switch (column) {

        /*
         * ifAdminStatus(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h 
         */
    case COLUMN_IFADMINSTATUS:
        rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                            sizeof(rowreq_ctx->data.
                                                   ifAdminStatus));
        if (SNMPERR_SUCCESS == rc) {

            /*
             * check that the value is one of defined enums 
             */
            if (1 && (*var->val.integer != IFADMINSTATUS_UP)
                && (*var->val.integer != IFADMINSTATUS_DOWN)
                && (*var->val.integer != IFADMINSTATUS_TESTING)
                ) {
                rc = SNMP_ERR_WRONGVALUE;
            }
        }
        if (SNMPERR_SUCCESS == rc) {
            rc = ifAdminStatus_check_value(rowreq_ctx,
                                           *((u_long *) var->val.string));
            if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
                && (MFD_NOT_VALID_NOW != rc)) {
                snmp_log(LOG_ERR,
                         "bad rc %d from ifAdminStatus_check_value\n", rc);
                rc = SNMP_ERR_GENERR;
            }
        }
        break;

    default:    /** We shouldn't get here */
        rc = SNMP_ERR_GENERR;
        snmp_log(LOG_ERR, "unknown column in _ifTable_check_column\n");
    }

    return rc;
}
Example #8
0
/************************************************************
 * RESERVE is used to check the syntax of all the variables
 * provided, that the values being set are sensible and consistent,
 * and to allocate any resources required for performing the SET.
 * After this stage, the expectation is that the set ought to
 * succeed, though this is not guaranteed. (In fact, with the UCD
 * agent, this is done in two passes - RESERVE1, and
 * RESERVE2, to allow for dependancies between variables).
 *
 * BEFORE calling this routine, the agent will call duplicate_row
 * to create a copy of the row (unless this is a new row; i.e.
 * row_created == 1).
 *
 * next state -> SET_RESERVE2 || SET_FREE
 */
void
pwrTable_set_reserve1(netsnmp_request_group * rg)
{
    pwrTable_context *row_ctx = (pwrTable_context *) rg->existing_row;
    pwrTable_context *undo_ctx = (pwrTable_context *) rg->undo_info;
    netsnmp_variable_list *var;
    netsnmp_request_group_item *current;
    int             rc;


    /*
     * TODO: loop through columns, check syntax and lengths. For
     * columns which have no dependencies, you could also move
     * the value/range checking here to attempt to catch error
     * cases as early as possible.
     */
    for (current = rg->list; current; current = current->next) {

        var = current->ri->requestvb;
        rc = SNMP_ERR_NOERROR;

        switch (current->tri->colnum) {

        case COLUMN_PWRSYSTEM:
            /** OCTETSTR = ASN_OCTET_STR */
            rc = netsnmp_check_vb_type_and_size(var, ASN_OCTET_STR,
                                                sizeof(row_ctx->
                                                       pwrSystem));
            break;

        default:/** We shouldn't get here */
            rc = SNMP_ERR_GENERR;
            log_print(LOGN_CRI, "unknown column in "
                     "pwrTable_set_reserve1\n");
        }

        if (rc)
            netsnmp_set_mode_request_error(MODE_SET_BEGIN, current->ri,
                                           rc);
        rg->status = SNMP_MAX(rg->status, current->ri->status);
    }

    /*
     * done with all the columns. Could check row related
     * requirements here.
     */
}
Example #9
0
NETSNMP_INLINE int
netsnmp_check_vb_rowstatus_value(const netsnmp_variable_list *var)
{
    register int rc = SNMP_ERR_NOERROR;

    if (NULL == var)
        return SNMP_ERR_GENERR;
    
    if ((rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER, sizeof(long))))
        return rc;
    
    if (*var->val.integer == RS_NOTREADY)
        return SNMP_ERR_WRONGVALUE;

    return netsnmp_check_vb_int_range(var, SNMP_ROW_NONEXISTENT,
                                      SNMP_ROW_DESTROY);
}
Example #10
0
NETSNMP_INLINE int
netsnmp_check_vb_int_range(const netsnmp_variable_list *var, int low, int high)
{
    register int rc = SNMP_ERR_NOERROR;
    
    if (NULL == var)
        return SNMP_ERR_GENERR;
    
    if ((rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER, sizeof(long))))
        return rc;
    
    if ((*var->val.integer < low) || (*var->val.integer > high)) {
        rc = SNMP_ERR_WRONGVALUE;
    }

    return rc;
}
Example #11
0
int
netsnmp_check_vb_storagetype(const netsnmp_variable_list *var, int old_value)
{
    int rc = SNMP_ERR_NOERROR;

    if (NULL == var)
        return SNMP_ERR_GENERR;
    
    if ((rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER, sizeof(long))))
        return rc;
    
    if ((rc = netsnmp_check_vb_int_range(var, SNMP_STORAGE_NONE,
                                        SNMP_STORAGE_READONLY)))
        return rc;
        
    return check_storage_transition(old_value, *var->val.integer);
}
Example #12
0
/************************************************************
 * RESERVE is used to check the syntax of all the variables
 * provided, that the values being set are sensible and consistent,
 * and to allocate any resources required for performing the SET.
 * After this stage, the expectation is that the set ought to
 * succeed, though this is not guaranteed. (In fact, with the UCD
 * agent, this is done in two passes - RESERVE1, and
 * RESERVE2, to allow for dependancies between variables).
 *
 * BEFORE calling this routine, the agent will call duplicate_row
 * to create a copy of the row (unless this is a new row; i.e.
 * row_created == 1).
 *
 * next state -> SET_RESERVE2 || SET_FREE
 */
void saHpiWatchdogTable_set_reserve1( netsnmp_request_group *rg )
{
    saHpiWatchdogTable_context *row_ctx =
            (saHpiWatchdogTable_context *)rg->existing_row;
    saHpiWatchdogTable_context *undo_ctx =
            (saHpiWatchdogTable_context *)rg->undo_info;
    netsnmp_variable_list *var;
    netsnmp_request_group_item *current;
    int rc;


    /*
     * TODO: loop through columns, check syntax and lengths. For
     * columns which have no dependencies, you could also move
     * the value/range checking here to attempt to catch error
     * cases as early as possible.
     */
    for( current = rg->list; current; current = current->next ) {

        var = current->ri->requestvb;
        rc = SNMP_ERR_NOERROR;

        switch(current->tri->colnum) {

        case COLUMN_SAHPIWATCHDOGLOG:
            /** TruthValue = ASN_INTEGER */
            rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                                sizeof(row_ctx->saHpiWatchdogLog));
        break;

        case COLUMN_SAHPIWATCHDOGRUNNING:
            /** TruthValue = ASN_INTEGER */
            rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                                sizeof(row_ctx->saHpiWatchdogRunning));
        break;

        case COLUMN_SAHPIWATCHDOGTIMERUSE:
            /** SaHpiWatchdogTimerUse = ASN_INTEGER */
            rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                                sizeof(row_ctx->saHpiWatchdogTimerUse));
        break;

        case COLUMN_SAHPIWATCHDOGTIMERACTION:
            /** INTEGER = ASN_INTEGER */
            rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                                sizeof(row_ctx->saHpiWatchdogTimerAction));
        break;

        case COLUMN_SAHPIWATCHDOGPRETIMERINTERRUPT:
            /** SaHpiWatchdogPreTimerAction = ASN_INTEGER */
            rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                                sizeof(row_ctx->saHpiWatchdogPretimerInterrupt));
        break;

        case COLUMN_SAHPIWATCHDOGPRETIMEOUTINTERVAL:
            /** UNSIGNED32 = ASN_UNSIGNED */
            rc = netsnmp_check_vb_type_and_size(var, ASN_UNSIGNED,
                                                sizeof(row_ctx->saHpiWatchdogPreTimeoutInterval));
        break;

        case COLUMN_SAHPIWATCHDOGTIMERUSEEXPFLAGS:
            /** OCTETSTR = ASN_OCTET_STR */
            rc = netsnmp_check_vb_type_and_size(var, ASN_OCTET_STR,
                                                sizeof(row_ctx->saHpiWatchdogTimerUseExpFlags));
        break;

        case COLUMN_SAHPIWATCHDOGTIMERINITIALCOUNT:
            /** UNSIGNED32 = ASN_UNSIGNED */
            rc = netsnmp_check_vb_type_and_size(var, ASN_UNSIGNED,
                                                sizeof(row_ctx->saHpiWatchdogTimerInitialCount));
        break;

        case COLUMN_SAHPIWATCHDOGTIMERPRESENTCOUNT:
            /** UNSIGNED32 = ASN_UNSIGNED */
            rc = netsnmp_check_vb_type_and_size(var, ASN_UNSIGNED,
                                                sizeof(row_ctx->saHpiWatchdogTimerPresentCount));
        break;

        case COLUMN_SAHPIWATCHDOGTIMERRESET:
            /** TruthValue = ASN_INTEGER */
            rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                                sizeof(row_ctx->saHpiWatchdogTimerReset));
        break;

        default: /** We shouldn't get here */
            rc = SNMP_ERR_GENERR;
            snmp_log(LOG_ERR, "unknown column in "
                     "saHpiWatchdogTable_set_reserve1\n");
        }

        if (rc)
           netsnmp_set_mode_request_error(MODE_SET_BEGIN, current->ri, rc );
        rg->status = SNMP_MAX( rg->status, current->ri->status );
    }

    /*
     * done with all the columns. Could check row related
     * requirements here.
     */
}
/*
 * Large parts of this function have been auto-generated.  The functions purpose
 * is to check to make sure all SNMP set values for the given row, have been
 * valid.  If not, then the process is supposed to be aborted.  Otherwise, we
 * pass on to the *_reserve2 function.  
 *
 * For our purposes, our only check is to make sure that either of the following
 * conditions are true: 
 *
 * 1) If this row already exists, then the SET request is setting the rowStatus
 *    column to 'destroy'.
 *
 * 2) If this row does not already exist, then the SET request is setting the 
 *    rowStatus to 'createAndGo'. 
 *
 * Since the MIB specified there are to be no other modifications to the row,
 * any other condition is considered illegal, and will result in an SNMP error
 * being returned. 
 */
void openserSIPStatusCodesTable_set_reserve1( netsnmp_request_group *rg )
{
	openserSIPStatusCodesTable_context *row_ctx =
		(openserSIPStatusCodesTable_context *)rg->existing_row;

	netsnmp_variable_list      *var;
	netsnmp_request_group_item *current;

	int rc;

	/* Loop through the specified columns, and make sure that all values are
	 * valid. */
	for( current = rg->list; current; current = current->next ) {

		var = current->ri->requestvb;
		rc = SNMP_ERR_NOERROR;

		switch(current->tri->colnum) 
		{
			case COLUMN_OPENSERSIPSTATUSCODEROWSTATUS:

				/** RowStatus = ASN_INTEGER */
				rc = netsnmp_check_vb_type_and_size(var, 
						ASN_INTEGER,
						sizeof(
						row_ctx->openserSIPStatusCodeRowStatus));
			
				/* Want to make sure that if it already exists that it
				 * is setting it to 'destroy', or if it doesn't exist,
				 * that it is setting it to 'createAndGo' */
				if (row_ctx->openserSIPStatusCodeRowStatus == 0 && 
				    *var->val.integer != TC_ROWSTATUS_CREATEANDGO) 
				{
					rc = SNMP_ERR_BADVALUE;
				}			

				else if (row_ctx->openserSIPStatusCodeRowStatus ==
						TC_ROWSTATUS_ACTIVE && 
						*var->val.integer != 
						TC_ROWSTATUS_DESTROY) 
				{
					rc = SNMP_ERR_BADVALUE;
				}
		

				break;

			default: /** We shouldn't get here */
				rc = SNMP_ERR_GENERR;
				snmp_log(LOG_ERR, "unknown column in openserSIP"
						"StatusCodesTable_set_reserve1\n");
		}

		if (rc)
		{
		   netsnmp_set_mode_request_error(MODE_SET_BEGIN, 
				   current->ri, rc );
		}

		rg->status = SNMP_MAX(rg->status, current->ri->status);
	}

}
Example #14
0
/************************************************************
 * RESERVE is used to check the syntax of all the variables
 * provided, that the values being set are sensible and consistent,
 * and to allocate any resources required for performing the SET.
 * After this stage, the expectation is that the set ought to
 * succeed, though this is not guaranteed. (In fact, with the UCD
 * agent, this is done in two passes - RESERVE1, and
 * RESERVE2, to allow for dependancies between variables).
 *
 * BEFORE calling this routine, the agent will call duplicate_row
 * to create a copy of the row (unless this is a new row; i.e.
 * row_created == 1).
 *
 * next state -> SET_RESERVE2 || SET_FREE
 */
void
netSnmpIETFWGTable_set_reserve1(netsnmp_request_group * rg)
{
    netSnmpIETFWGTable_context *row_ctx =
        (netSnmpIETFWGTable_context *) rg->existing_row;
    netSnmpIETFWGTable_context *undo_ctx =
        (netSnmpIETFWGTable_context *) rg->undo_info;

    netsnmp_variable_list *var;
    netsnmp_request_group_item *current;
    int             rc;

	DEBUGMSGTL((AGENT,"netSnmpIETFWGTable_set_reserve1"));
    /*
     * TODO: loop through columns, check syntax and lengths. For
     * columns which have no dependencies, you could also move
     * the value/range checking here to attempt to catch error
     * cases as early as possible.
     */
    for (current = rg->list; current; current = current->next) {

        var = current->ri->requestvb;
        rc = SNMP_ERR_NOERROR;
	DEBUGMSGTL((AGENT,"Length of char1: %d ", sizeof(row_ctx->nsIETFWGChair1)));

        switch (current->tri->colnum) {

        case COLUMN_NSIETFWGCHAIR1:
            /** OCTETSTR = ASN_OCTET_STR */
            rc = netsnmp_check_vb_type_and_size(var, ASN_OCTET_STR,
                                                sizeof(row_ctx->
                                                       nsIETFWGChair1));
            break;

        case COLUMN_NSIETFWGCHAIR2:
            /** OCTETSTR = ASN_OCTET_STR */
            rc = netsnmp_check_vb_type_and_size(var, ASN_OCTET_STR,
                                                sizeof(row_ctx->
                                                       nsIETFWGChair2));
            break;

        default:/** We shouldn't get here */
            rc = SNMP_ERR_GENERR;
            snmp_log(LOG_ERR, "unknown column in "
                     "netSnmpIETFWGTable_set_reserve1\n");
        }

		DEBUGMSGTL((AGENT,"rc: %d", rc));
		
	 if (rc == SNMP_ERR_WRONGLENGTH) 
	    	rc = SNMP_ERR_NOERROR;
         if (rc)
            netsnmp_set_mode_request_error(MODE_SET_BEGIN, current->ri, rc);

        rg->status = SNMP_MAX(rg->status, current->ri->status);
    }

    /*
     * done with all the columns. Could check row related
     * requirements here.
     */
}
Example #15
0
/** handles requests for the mteEventTable table */
int
mteEventTable_handler(netsnmp_mib_handler *handler,
                      netsnmp_handler_registration *reginfo,
                      netsnmp_agent_request_info *reqinfo,
                      netsnmp_request_info *requests)
{

    netsnmp_request_info       *request;
    netsnmp_table_request_info *tinfo;
    netsnmp_tdata_row          *row;
    struct mteEvent            *entry;
    char mteOwner[MTE_STR1_LEN+1];
    char mteEName[MTE_STR1_LEN+1];
    long ret;

    DEBUGMSGTL(("disman:event:mib", "Event Table handler (%d)\n",
                                     reqinfo->mode));

    switch (reqinfo->mode) {
        /*
         * Read-support (also covers GetNext requests)
         */
    case MODE_GET:
        for (request = requests; request; request = request->next) {
            if (request->processed)
                continue;

            entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
            tinfo = netsnmp_extract_table_info(request);
            if (!entry || !(entry->flags & MTE_EVENT_FLAG_VALID))
                continue;

            switch (tinfo->colnum) {
            case COLUMN_MTEEVENTCOMMENT:
                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
                                         entry->mteEventComment,
                                  strlen(entry->mteEventComment));
                break;
            case COLUMN_MTEEVENTACTIONS:
                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
                                        &entry->mteEventActions, 1);
                break;
            case COLUMN_MTEEVENTENABLED:
                ret = (entry->flags & MTE_EVENT_FLAG_ENABLED ) ?
                           TV_TRUE : TV_FALSE;
                snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
                break;
            case COLUMN_MTEEVENTENTRYSTATUS:
                ret = (entry->flags & MTE_EVENT_FLAG_ACTIVE ) ?
                           RS_ACTIVE : RS_NOTINSERVICE;
                snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
                break;
            }
        }
        break;


#ifndef NETSNMP_NO_WRITE_SUPPORT
        /*
         * Write-support
         */
    case MODE_SET_RESERVE1:
        for (request = requests; request; request = request->next) {
            if (request->processed)
                continue;

            entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
            tinfo = netsnmp_extract_table_info(request);

            switch (tinfo->colnum) {
            case COLUMN_MTEEVENTCOMMENT:
                ret = netsnmp_check_vb_type_and_max_size(
                          request->requestvb, ASN_OCTET_STR, MTE_STR1_LEN);
                if (ret != SNMP_ERR_NOERROR) {
                    netsnmp_set_request_error(reqinfo, request, ret);
                    return SNMP_ERR_NOERROR;
                }
                /*
                 * Can't modify the comment of an active row
                 *   (No good reason for this, but that's what the MIB says!)
                 */
                if (entry &&
                    entry->flags & MTE_EVENT_FLAG_ACTIVE ) {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_ERR_INCONSISTENTVALUE);
                    return SNMP_ERR_NOERROR;
                }
                break;
            case COLUMN_MTEEVENTACTIONS:
                ret = netsnmp_check_vb_type_and_size(
                          request->requestvb, ASN_OCTET_STR, 1);
                if (ret != SNMP_ERR_NOERROR) {
                    netsnmp_set_request_error(reqinfo, request, ret);
                    return SNMP_ERR_NOERROR;
                }
                /*
                 * Can't modify the event types of an active row
                 *   (A little more understandable perhaps,
                 *    but still an unnecessary restriction IMO)
                 */
                if (entry &&
                    entry->flags & MTE_EVENT_FLAG_ACTIVE ) {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_ERR_INCONSISTENTVALUE);
                    return SNMP_ERR_NOERROR;
                }
                break;
            case COLUMN_MTEEVENTENABLED:
                ret = netsnmp_check_vb_truthvalue(request->requestvb);
                if (ret != SNMP_ERR_NOERROR) {
                    netsnmp_set_request_error(reqinfo, request, ret);
                    return SNMP_ERR_NOERROR;
                }
                /*
                 * The published version of the Event MIB forbids
                 *   enabling (or disabling) an active row, which
                 *   would make this object completely pointless!
                 * Fortunately this ludicrous decision has since been corrected.
                 */
                break;

            case COLUMN_MTEEVENTENTRYSTATUS:
                ret = netsnmp_check_vb_rowstatus(request->requestvb,
                          (entry ? RS_ACTIVE : RS_NONEXISTENT));
                if (ret != SNMP_ERR_NOERROR) {
                    netsnmp_set_request_error(reqinfo, request, ret);
                    return SNMP_ERR_NOERROR;
                }
                /* An active row can only be deleted */
                if (entry &&
                    entry->flags & MTE_EVENT_FLAG_ACTIVE &&
                    *request->requestvb->val.integer == RS_NOTINSERVICE ) {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_ERR_INCONSISTENTVALUE);
                    return SNMP_ERR_NOERROR;
                }
                break;
            default:
                netsnmp_set_request_error(reqinfo, request,
                                          SNMP_ERR_NOTWRITABLE);
                return SNMP_ERR_NOERROR;
            }
        }
        break;

    case MODE_SET_RESERVE2:
        for (request = requests; request; request = request->next) {
            if (request->processed)
                continue;

            tinfo = netsnmp_extract_table_info(request);

            switch (tinfo->colnum) {
            case COLUMN_MTEEVENTENTRYSTATUS:
                switch (*request->requestvb->val.integer) {
                case RS_CREATEANDGO:
                case RS_CREATEANDWAIT:
                    /*
                     * Create an (empty) new row structure
                     */
                    memset(mteOwner, 0, sizeof(mteOwner));
                    memcpy(mteOwner, tinfo->indexes->val.string,
                                     tinfo->indexes->val_len);
                    memset(mteEName, 0, sizeof(mteEName));
                    memcpy(mteEName,
                           tinfo->indexes->next_variable->val.string,
                           tinfo->indexes->next_variable->val_len);

                    row = mteEvent_createEntry(mteOwner, mteEName, 0);
                    if (!row) {
                        netsnmp_set_request_error(reqinfo, request,
                                                  SNMP_ERR_RESOURCEUNAVAILABLE);
                        return SNMP_ERR_NOERROR;
                    }
                    netsnmp_insert_tdata_row( request, row );
                }
            }
        }
        break;

    case MODE_SET_FREE:
        for (request = requests; request; request = request->next) {
            if (request->processed)
                continue;

            tinfo = netsnmp_extract_table_info(request);

            switch (tinfo->colnum) {
            case COLUMN_MTEEVENTENTRYSTATUS:
                switch (*request->requestvb->val.integer) {
                case RS_CREATEANDGO:
                case RS_CREATEANDWAIT:
                    /*
                     * Tidy up after a failed row creation request
                     */ 
                    entry = (struct mteEvent *)
                                netsnmp_tdata_extract_entry(request);
                    if (entry &&
                      !(entry->flags & MTE_EVENT_FLAG_VALID)) {
                        row = (netsnmp_tdata_row *)
                                netsnmp_tdata_extract_row(request);
                        mteEvent_removeEntry( row );
                    }
                }
            }
        }
        break;

    case MODE_SET_ACTION:
        for (request = requests; request; request = request->next) {
            if (request->processed)
                continue;

            tinfo = netsnmp_extract_table_info(request);
            entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
            if (!entry) {
                /*
                 * New rows must be created via the RowStatus column
                 */
                netsnmp_set_request_error(reqinfo, request,
                                          SNMP_ERR_NOCREATION);
                                      /* or inconsistentName? */
                return SNMP_ERR_NOERROR;

            }
        }
        break;

    case MODE_SET_UNDO:
        break;

    case MODE_SET_COMMIT:
        /*
         * All these assignments are "unfailable", so it's
         *  (reasonably) safe to apply them in the Commit phase
         */
        for (request = requests; request; request = request->next) {
            if (request->processed)
                continue;

            entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
            tinfo = netsnmp_extract_table_info(request);

            switch (tinfo->colnum) {
            case COLUMN_MTEEVENTCOMMENT:
                memset(entry->mteEventComment, 0,
                       sizeof(entry->mteEventComment));
                memcpy(entry->mteEventComment,
                       request->requestvb->val.string,
                       request->requestvb->val_len);
                break;

            case COLUMN_MTEEVENTACTIONS:
                entry->mteEventActions = request->requestvb->val.string[0];
                break;

            case COLUMN_MTEEVENTENABLED:
                if (*request->requestvb->val.integer == TV_TRUE)
                    entry->flags |=  MTE_EVENT_FLAG_ENABLED;
                else
                    entry->flags &= ~MTE_EVENT_FLAG_ENABLED;
                break;

            case COLUMN_MTEEVENTENTRYSTATUS:
                switch (*request->requestvb->val.integer) {
                case RS_ACTIVE:
                    entry->flags |= MTE_EVENT_FLAG_ACTIVE;
                    break;
                case RS_CREATEANDGO:
                    entry->flags |= MTE_EVENT_FLAG_ACTIVE;
                    /* fall-through */
                case RS_CREATEANDWAIT:
                    entry->flags |= MTE_EVENT_FLAG_VALID;
                    entry->session =
                        netsnmp_iquery_pdu_session(reqinfo->asp->pdu);
                    break;

                case RS_DESTROY:
                    row = (netsnmp_tdata_row *)
                               netsnmp_tdata_extract_row(request);
                    mteEvent_removeEntry(row);
                }
            }
        }
        break;
#endif /* !NETSNMP_NO_WRITE_SUPPORT */

    }
    DEBUGMSGTL(("disman:event:mib", "Table handler, done\n"));
    return SNMP_ERR_NOERROR;
}
/*
 * Large parts of this function have been auto-generated.  The functions purpose
 * is to check to make sure all SNMP set values for the given row, have been
 * valid.  If not, then the process is supposed to be aborted.  Otherwise, we
 * pass on to the *_reserve2 function.  
 *
 * For our purposes, our only check is to make sure that either of the following
 * conditions are true: 
 *
 * 1) If this row already exists, then the SET request is setting the rowStatus
 *    column to 'destroy'.
 *
 * 2) If this row does not already exist, then the SET request is setting the 
 *    rowStatus to 'createAndGo'. 
 *
 * Since the MIB specified there are to be no other modifications to the row,
 * any other condition is considered illegal, and will result in an SNMP error
 * being returned. 
 */
void kamailioSIPRegUserLookupTable_set_reserve1( netsnmp_request_group *rg )
{
	kamailioSIPRegUserLookupTable_context *row_ctx =
		(kamailioSIPRegUserLookupTable_context *)rg->existing_row;

	netsnmp_variable_list *var;

	netsnmp_request_group_item *current;

	int rc;

	for( current = rg->list; current; current = current->next ) {

		var = current->ri->requestvb;
		rc = SNMP_ERR_NOERROR;

		switch(current->tri->colnum) 
		{

			case COLUMN_KAMAILIOSIPREGUSERLOOKUPURI:

				if (row_ctx->kamailioSIPRegUserLookupRowStatus == 0 ||
				    row_ctx->kamailioSIPRegUserLookupRowStatus == 
				    TC_ROWSTATUS_NOTREADY) {

				} else {
					rc = SNMP_ERR_BADVALUE;
				}
				
				break;

			case COLUMN_KAMAILIOSIPREGUSERLOOKUPROWSTATUS:

				/** RowStatus = ASN_INTEGER */
				rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
						sizeof(
						row_ctx->kamailioSIPRegUserLookupRowStatus));
			 
				/* Want to make sure that if it already exists that it
				 * is setting it to 'destroy', or if it doesn't exist,
				 * that it is setting it to 'createAndGo' */
				if (row_ctx->kamailioSIPRegUserLookupRowStatus == 0 && 
				    *var->val.integer != TC_ROWSTATUS_CREATEANDGO) 
				{
					rc = SNMP_ERR_BADVALUE;
				} 
			
				else if (row_ctx->kamailioSIPRegUserLookupRowStatus ==
						TC_ROWSTATUS_ACTIVE && 
						*var->val.integer != 
						TC_ROWSTATUS_DESTROY) 
				{
					rc = SNMP_ERR_BADVALUE;
				}
	
			break;

			default: /** We shouldn't get here */
				rc = SNMP_ERR_GENERR;
				snmp_log(LOG_ERR, "unknown column in kamailioSIPReg"
						  "UserLookupTable_set_reserve1\n");
		}

		if (rc) 
		{
			netsnmp_set_mode_request_error(
					MODE_SET_BEGIN, current->ri, rc );
		}

		rg->status = SNMP_MAX( rg->status, current->ri->status );
	}

}
Example #17
0
/************************************************************
 * RESERVE is used to check the syntax of all the variables
 * provided, that the values being set are sensible and consistent,
 * and to allocate any resources required for performing the SET.
 * After this stage, the expectation is that the set ought to
 * succeed, though this is not guaranteed. (In fact, with the UCD
 * agent, this is done in two passes - RESERVE1, and
 * RESERVE2, to allow for dependancies between variables).
 *
 * BEFORE calling this routine, the agent will call duplicate_row
 * to create a copy of the row (unless this is a new row; i.e.
 * row_created == 1).
 *
 * next state -> SET_RESERVE2 || SET_FREE
 */
void saHpiHotSwapTable_set_reserve1( netsnmp_request_group *rg )
{
    saHpiHotSwapTable_context *row_ctx =
            (saHpiHotSwapTable_context *)rg->existing_row;
    saHpiHotSwapTable_context *undo_ctx =
            (saHpiHotSwapTable_context *)rg->undo_info;
    netsnmp_variable_list *var;
    netsnmp_request_group_item *current;
    int rc;


    /*
     * TODO: loop through columns, check syntax and lengths. For
     * columns which have no dependencies, you could also move
     * the value/range checking here to attempt to catch error
     * cases as early as possible.
     */
    for( current = rg->list; current; current = current->next ) {

        var = current->ri->requestvb;
        rc = SNMP_ERR_NOERROR;

        switch(current->tri->colnum) {

        case COLUMN_SAHPIHOTSWAPINDICATOR:
            /** INTEGER = ASN_INTEGER */
            rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                                sizeof(row_ctx->saHpiHotSwapIndicator));
        break;

        case COLUMN_SAHPIHOTSWAPSTATE:
            /** SaHpiHotSwapState = ASN_INTEGER */
            rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                                sizeof(row_ctx->saHpiHotSwapState));
        break;

        case COLUMN_SAHPIHOTSWAPEXTRACTTIMEOUT:
            /** SaHpiTime = ASN_COUNTER64 */
            rc = netsnmp_check_vb_type_and_size(var, ASN_COUNTER64,
                                                sizeof(row_ctx->saHpiHotSwapExtractTimeout));
        break;

        case COLUMN_SAHPIHOTSWAPACTIONREQUEST:
            /** INTEGER = ASN_INTEGER */
            rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                                sizeof(row_ctx->saHpiHotSwapActionRequest));
        break;

        case COLUMN_SAHPIHOTSWAPPOLICYCANCEL:
            /** INTEGER = ASN_INTEGER */
            rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                                sizeof(row_ctx->saHpiHotSwapPolicyCancel));
        break;

        case COLUMN_SAHPIHOTSWAPRESOURCEREQUEST:
            /** INTEGER = ASN_INTEGER */
            rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                                sizeof(row_ctx->saHpiHotSwapResourceRequest));
        break;

        default: /** We shouldn't get here */
            rc = SNMP_ERR_GENERR;
            snmp_log(LOG_ERR, "unknown column in "
                     "saHpiHotSwapTable_set_reserve1\n");
        }

        if (rc)
           netsnmp_set_mode_request_error(MODE_SET_BEGIN, current->ri, rc );
        rg->status = SNMP_MAX( rg->status, current->ri->status );
    }

    /*
     * done with all the columns. Could check row related
     * requirements here.
     */
}
/*
 * @internal
 * Check the syntax for a particular column
 */
NETSNMP_STATIC_INLINE int
_dot11ConfTotalTrapGroupTable_check_column( dot11ConfTotalTrapGroupTable_rowreq_ctx *rowreq_ctx,
                         netsnmp_variable_list *var, int column )
{
    int rc = SNMPERR_SUCCESS;
    
    DEBUGMSGTL(("internal:dot11ConfTotalTrapGroupTable:_dot11ConfTotalTrapGroupTable_check_column","called\n"));

    netsnmp_assert(NULL != rowreq_ctx);

    switch(column) {

    /* NewTrapDescr(3)/DisplayString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H */
    case COLUMN_NEWTRAPDESCR:
    rc = netsnmp_check_vb_type( var, ASN_OCTET_STR );
    if(SNMPERR_SUCCESS == rc) {
    /* check that the value is in the defined range(s); inefficent
     * but keeps rc value knowledge in libarary where it belongs. */
    if( 1
       && ((rc = netsnmp_check_vb_size_range(var, 0,255)) != SNMP_ERR_NOERROR)
     ) {
        ; /* rc set in condition */
    }
   }
    if(SNMPERR_SUCCESS == rc) {
        rc = NewTrapDescr_check_value( rowreq_ctx, (char *)var->val.string, var->val_len );
        if((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc) &&
           (MFD_NOT_VALID_NOW != rc)) {
            snmp_log(LOG_ERR, "bad rc %d from NewTrapDescr_check_value\n", rc);
            rc = SNMP_ERR_GENERR;
        }
    }
        break;

    /* NewTrapOnOff(4)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h */
    case COLUMN_NEWTRAPONOFF:
    rc = netsnmp_check_vb_type_and_size( var, ASN_INTEGER,
        sizeof( rowreq_ctx->data.NewTrapOnOff ) );
    if(SNMPERR_SUCCESS == rc) {

    /* check that the value is one of defined enums */
    if( 1
 && ( *var->val.integer != NEWTRAPONOFF_ON )
 && ( *var->val.integer != NEWTRAPONOFF_OFF )
        ) {
        rc = SNMP_ERR_WRONGVALUE;
        }
    }
    if(SNMPERR_SUCCESS == rc) {
        rc = NewTrapOnOff_check_value( rowreq_ctx, *((u_long *)var->val.string) );
        if((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc) &&
           (MFD_NOT_VALID_NOW != rc)) {
            snmp_log(LOG_ERR, "bad rc %d from NewTrapOnOff_check_value\n", rc);
            rc = SNMP_ERR_GENERR;
        }
    }
        break;

        default: /** We shouldn't get here */
            rc = SNMP_ERR_GENERR;
            snmp_log(LOG_ERR, "unknown column %d in _dot11ConfTotalTrapGroupTable_check_column\n", column);
    }

    return rc;
} /* _dot11ConfTotalTrapGroupTable_check_column */
Example #19
0
/************************************************************
 * RESERVE is used to check the syntax of all the variables
 * provided, that the values being set are sensible and consistent,
 * and to allocate any resources required for performing the SET.
 * After this stage, the expectation is that the set ought to
 * succeed, though this is not guaranteed. (In fact, with the UCD
 * agent, this is done in two passes - RESERVE1, and
 * RESERVE2, to allow for dependancies between variables).
 *
 * BEFORE calling this routine, the agent will call duplicate_row
 * to create a copy of the row (unless this is a new row; i.e.
 * row_created == 1).
 *
 * next state -> SET_RESERVE2 || SET_FREE
 */
void
saHpiWatchdogTable_set_reserve1(netsnmp_request_group * rg)
{
    saHpiWatchdogTable_context *row_ctx =
        (saHpiWatchdogTable_context *) rg->existing_row;
    /*    saHpiWatchdogTable_context *undo_ctx =
	  (saHpiWatchdogTable_context *) rg->undo_info;*/
    netsnmp_variable_list *var;
    netsnmp_request_group_item *current;
    int             rc;

    DEBUGMSGTL((AGENT,"saHpiWatchdogTable_set_reserve1.Entry\n"));
    for (current = rg->list; current; current = current->next) {

        var = current->ri->requestvb;
        rc = SNMP_ERR_NOERROR;

        switch (current->tri->colnum) {

        case COLUMN_SAHPIWATCHDOGLOG:
            /** TruthValue = ASN_INTEGER */
	  rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
					      sizeof(row_ctx->
						     saHpiWatchdogLog));
	  break;

        case COLUMN_SAHPIWATCHDOGRUNNING:
            /** TruthValue = ASN_INTEGER */
	  rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
					   sizeof(row_ctx->saHpiWatchdogRunning));

            break;

        case COLUMN_SAHPIWATCHDOGTIMERUSE:
            /** INTEGER = ASN_INTEGER */
            rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                                sizeof(row_ctx->
                                                       saHpiWatchdogTimerUse));
            break;

        case COLUMN_SAHPIWATCHDOGTIMERACTION:
            /** INTEGER = ASN_INTEGER */
            rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                                sizeof(row_ctx->
                                                       saHpiWatchdogTimerAction));
            break;

        case COLUMN_SAHPIWATCHDOGPRETIMERINTERRUPT:
            /** INTEGER = ASN_INTEGER */
            rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                                sizeof(row_ctx->
                                                       saHpiWatchdogPretimerInterrupt));
            break;

        case COLUMN_SAHPIWATCHDOGPRETIMEOUTINTERVAL:
            /** UNSIGNED32 = ASN_UNSIGNED */
            rc = netsnmp_check_vb_type_and_size(var, ASN_UNSIGNED,
                                                sizeof(row_ctx->
                                                       saHpiWatchdogPreTimeoutInterval));
            break;

        case COLUMN_SAHPIWATCHDOGTIMERUSEEXPFLAGS:
            /** UNSIGNED32 = ASN_UNSIGNED */
            rc = netsnmp_check_vb_type_and_size(var, ASN_UNSIGNED,
                                                sizeof(row_ctx->
                                                       saHpiWatchdogTimerUseExpFlags));
            break;

        case COLUMN_SAHPIWATCHDOGTIMERINITIALCOUNT:
            /** UNSIGNED32 = ASN_UNSIGNED */
            rc = netsnmp_check_vb_type_and_size(var, ASN_UNSIGNED,
                                                sizeof(row_ctx->
                                                       saHpiWatchdogTimerInitialCount));
            break;

        case COLUMN_SAHPIWATCHDOGTIMERPRESENTCOUNT:
            /** UNSIGNED32 = ASN_UNSIGNED */
            rc = netsnmp_check_vb_type_and_size(var, ASN_UNSIGNED,
                                                sizeof(row_ctx->
                                                       saHpiWatchdogTimerPresentCount));
            break;       

        default:/** We shouldn't get here */
            rc = SNMP_ERR_GENERR;
            snmp_log(LOG_ERR, "unknown column in "
                     "saHpiWatchdogTable_set_reserve1\n");
        }

        if (rc)
            netsnmp_set_mode_request_error(MODE_SET_BEGIN, current->ri,
                                           rc);
        rg->status = SNMP_MAX(rg->status, current->ri->status);
    }

    DEBUGMSGTL((AGENT,"saHpiWatchdogTable_set_reserve1. Exit\n"));
}
Example #20
0
static int mib_ipRouteTable_handler(netsnmp_mib_handler *handler,
                    netsnmp_handler_registration *reginfo,
                    netsnmp_agent_request_info *reqinfo,
                    netsnmp_request_info *requests)
{
    netsnmp_request_info       *request;
    netsnmp_table_request_info *table_req_info;
    struct ipRouteTable_entry *table_entry;
    int                         ret;
    switch (reqinfo->mode)
    {
    case MODE_GET:
        for (request=requests; request; request=request->next)
        {
            table_entry = (struct ipRouteTable_entry *)
                              netsnmp_extract_iterator_context(request);
            table_req_info  = netsnmp_extract_table_info(request);
            if(NULL == table_req_info)
            {
                netsnmp_set_request_error(reqinfo, request,
                                          SNMP_ERR_NOACCESS);
                continue;
            }

            switch (table_req_info->colnum)
            {
            case COLUMN_IPROUTEDEST:
                if ( !table_entry )
                {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_NOSUCHINSTANCE);
                    continue;
                }
                snmp_set_var_typed_integer( request->requestvb, ASN_IPADDRESS,
                                            htonl(table_entry->ipRouteDest));
                break;

            case COLUMN_IPROUTEIFINDEX:
                if ( !table_entry )
                {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_NOSUCHINSTANCE);
                    continue;
                }
                snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER,
                                            table_entry->ipRouteIfIndex);
                break;

            case COLUMN_IPROUTEMETRIC1:
                if ( !table_entry )
                {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_NOSUCHINSTANCE);
                    continue;
                }
                snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER,
                                            table_entry->ipRouteMetric1);
                break;

            case COLUMN_IPROUTEMETRIC2:
                if ( !table_entry )
                {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_NOSUCHINSTANCE);
                    continue;
                }
                snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER,
                                            table_entry->ipRouteMetric2);
                break;

            case COLUMN_IPROUTEMETRIC3:
                if ( !table_entry )
                {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_NOSUCHINSTANCE);
                    continue;
                }
                snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER,
                                            table_entry->ipRouteMetric3);
                break;

            case COLUMN_IPROUTEMETRIC4:
                if ( !table_entry )
                {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_NOSUCHINSTANCE);
                    continue;
                }
                snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER,
                                            table_entry->ipRouteMetric4);
                break;

            case COLUMN_IPROUTENEXTHOP:
                if ( !table_entry )
                {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_NOSUCHINSTANCE);
                    continue;
                }
                snmp_set_var_typed_integer( request->requestvb, ASN_IPADDRESS,
                                            htonl(table_entry->ipRouteNextHop));
                break;

            case COLUMN_IPROUTETYPE:
                if ( !table_entry )
                {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_NOSUCHINSTANCE);
                    continue;
                }
                snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER,
                                            table_entry->ipRouteType);
                break;

            case COLUMN_IPROUTEPROTO:
                if ( !table_entry )
                {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_NOSUCHINSTANCE);
                    continue;
                }
                snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER,
                                            table_entry->ipRouteProto);
                break;

            case COLUMN_IPROUTEAGE:
                if ( !table_entry )
                {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_NOSUCHINSTANCE);
                    continue;
                }
                snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER,
                                            table_entry->ipRouteAge);
                break;

            case COLUMN_IPROUTEMASK:
                if ( !table_entry )
                {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_NOSUCHINSTANCE);
                    continue;
                }
                snmp_set_var_typed_integer( request->requestvb, ASN_IPADDRESS,
                                            htonl(table_entry->ipRouteMask));
                break;

            case COLUMN_IPROUTEMETRIC5:
                if ( !table_entry )
                {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_NOSUCHINSTANCE);
                    continue;
                }
                snmp_set_var_typed_integer( request->requestvb, ASN_INTEGER,
                                            table_entry->ipRouteMetric5);
                break;

            case COLUMN_IPROUTEINFO:
                if ( !table_entry )
                {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_NOSUCHINSTANCE);
                    continue;
                }
                snmp_set_var_typed_value( request->requestvb, ASN_OBJECT_ID,
                                 (u_char*)table_entry->ipRouteInfo,
                                          table_entry->ipRouteInfo_len);
                break;

            default:
                netsnmp_set_request_error(reqinfo, request,
                                          SNMP_NOSUCHOBJECT);
                break;

            }
        }
        break;
    case MODE_SET_RESERVE1:
        for (request=requests; request; request=request->next)
        {
            table_entry = (struct ipRouteTable_entry *)
                              netsnmp_extract_iterator_context(request);
            table_req_info  = netsnmp_extract_table_info(request);
            if(NULL == table_req_info)
            {
                netsnmp_set_request_error( reqinfo, request,
                                           SNMP_ERR_NOACCESS );
                return SNMP_ERR_NOERROR;
            }

            switch (table_req_info->colnum)
            {
            case COLUMN_IPROUTEDEST:
                ret = netsnmp_check_vb_type_and_size(
                          request->requestvb, ASN_IPADDRESS, sizeof(table_entry->ipRouteDest));
                if ( ret != SNMP_ERR_NOERROR )
                {
                    netsnmp_set_request_error( reqinfo, request, ret );
                    return SNMP_ERR_NOERROR;
                }
                break;

            case COLUMN_IPROUTEIFINDEX:
                ret = netsnmp_check_vb_int( request->requestvb );
                if ( ret != SNMP_ERR_NOERROR )
                {
                    netsnmp_set_request_error( reqinfo, request, ret );
                    return SNMP_ERR_NOERROR;
                }
                break;

            case COLUMN_IPROUTEMETRIC1:
                ret = netsnmp_check_vb_int( request->requestvb );
                if ( ret != SNMP_ERR_NOERROR )
                {
                    netsnmp_set_request_error( reqinfo, request, ret );
                    return SNMP_ERR_NOERROR;
                }
                break;

            case COLUMN_IPROUTEMETRIC2:
                ret = netsnmp_check_vb_int( request->requestvb );
                if ( ret != SNMP_ERR_NOERROR )
                {
                    netsnmp_set_request_error( reqinfo, request, ret );
                    return SNMP_ERR_NOERROR;
                }
                break;

            case COLUMN_IPROUTEMETRIC3:
                ret = netsnmp_check_vb_int( request->requestvb );
                if ( ret != SNMP_ERR_NOERROR )
                {
                    netsnmp_set_request_error( reqinfo, request, ret );
                    return SNMP_ERR_NOERROR;
                }
                break;

            case COLUMN_IPROUTEMETRIC4:
                ret = netsnmp_check_vb_int( request->requestvb );
                if ( ret != SNMP_ERR_NOERROR )
                {
                    netsnmp_set_request_error( reqinfo, request, ret );
                    return SNMP_ERR_NOERROR;
                }
                break;

            case COLUMN_IPROUTENEXTHOP:
                ret = netsnmp_check_vb_type_and_size(
                          request->requestvb, ASN_IPADDRESS, sizeof(table_entry->ipRouteNextHop));
                if ( ret != SNMP_ERR_NOERROR )
                {
                    netsnmp_set_request_error( reqinfo, request, ret );
                    return SNMP_ERR_NOERROR;
                }
                break;

            case COLUMN_IPROUTETYPE:
                ret = netsnmp_check_vb_int( request->requestvb );
                if ( ret != SNMP_ERR_NOERROR )
                {
                    netsnmp_set_request_error( reqinfo, request, ret );
                    return SNMP_ERR_NOERROR;
                }
                break;

            case COLUMN_IPROUTEAGE:
                ret = netsnmp_check_vb_int( request->requestvb );
                if ( ret != SNMP_ERR_NOERROR )
                {
                    netsnmp_set_request_error( reqinfo, request, ret );
                    return SNMP_ERR_NOERROR;
                }
                break;

            case COLUMN_IPROUTEMASK:
                ret = netsnmp_check_vb_type_and_size(
                          request->requestvb, ASN_IPADDRESS, sizeof(table_entry->ipRouteMask));
                if ( ret != SNMP_ERR_NOERROR )
                {
                    netsnmp_set_request_error( reqinfo, request, ret );
                    return SNMP_ERR_NOERROR;
                }
                break;

            case COLUMN_IPROUTEMETRIC5:
                ret = netsnmp_check_vb_int( request->requestvb );
                if ( ret != SNMP_ERR_NOERROR )
                {
                    netsnmp_set_request_error( reqinfo, request, ret );
                    return SNMP_ERR_NOERROR;
                }
                break;

            default:
                netsnmp_set_request_error( reqinfo, request,
                                           SNMP_ERR_NOTWRITABLE );
                return SNMP_ERR_NOERROR;
            }
        }
        break;

    case MODE_SET_RESERVE2:
        break;

    case MODE_SET_FREE:
        break;

    case MODE_SET_ACTION:
        for (request=requests; request; request=request->next)
        {
            table_entry = (struct ipRouteTable_entry *)
                              netsnmp_extract_iterator_context(request);
            table_req_info  = netsnmp_extract_table_info(request);

            switch (table_req_info->colnum)
            {
            case COLUMN_IPROUTEDEST:
                table_entry->old_ipRouteDest = table_entry->ipRouteDest;
                table_entry->ipRouteDest     = *request->requestvb->val.integer;
                break;

            case COLUMN_IPROUTEIFINDEX:
                table_entry->old_ipRouteIfIndex = table_entry->ipRouteIfIndex;
                table_entry->ipRouteIfIndex     = *request->requestvb->val.integer;
                break;

            case COLUMN_IPROUTEMETRIC1:
                table_entry->old_ipRouteMetric1 = table_entry->ipRouteMetric1;
                table_entry->ipRouteMetric1     = *request->requestvb->val.integer;
                break;

            case COLUMN_IPROUTEMETRIC2:
                table_entry->old_ipRouteMetric2 = table_entry->ipRouteMetric2;
                table_entry->ipRouteMetric2     = *request->requestvb->val.integer;
                break;

            case COLUMN_IPROUTEMETRIC3:
                table_entry->old_ipRouteMetric3 = table_entry->ipRouteMetric3;
                table_entry->ipRouteMetric3     = *request->requestvb->val.integer;
                break;

            case COLUMN_IPROUTEMETRIC4:
                table_entry->old_ipRouteMetric4 = table_entry->ipRouteMetric4;
                table_entry->ipRouteMetric4     = *request->requestvb->val.integer;
                break;

            case COLUMN_IPROUTENEXTHOP:
                table_entry->old_ipRouteNextHop = table_entry->ipRouteNextHop;
                table_entry->ipRouteNextHop     = *request->requestvb->val.integer;
                break;

            case COLUMN_IPROUTETYPE:
                table_entry->old_ipRouteType = table_entry->ipRouteType;
                table_entry->ipRouteType     = *request->requestvb->val.integer;
                break;

            case COLUMN_IPROUTEAGE:
                table_entry->old_ipRouteAge = table_entry->ipRouteAge;
                table_entry->ipRouteAge     = *request->requestvb->val.integer;
                break;

            case COLUMN_IPROUTEMASK:
                table_entry->old_ipRouteMask = table_entry->ipRouteMask;
                table_entry->ipRouteMask     = *request->requestvb->val.integer;
                break;

            case COLUMN_IPROUTEMETRIC5:
                table_entry->old_ipRouteMetric5 = table_entry->ipRouteMetric5;
                table_entry->ipRouteMetric5     = *request->requestvb->val.integer;
                break;

            }
        }
        break;

    case MODE_SET_COMMIT:
        break;

    case MODE_SET_UNDO:
        for (request=requests; request; request=request->next)
        {
            table_entry = (struct ipRouteTable_entry *)
                              netsnmp_extract_iterator_context(request);
            table_req_info  = netsnmp_extract_table_info( request);

            switch (table_req_info->colnum)
            {
            case COLUMN_IPROUTEDEST:
                table_entry->ipRouteDest     = table_entry->old_ipRouteDest;
                table_entry->old_ipRouteDest = 0;
                break;

            case COLUMN_IPROUTEIFINDEX:
                table_entry->ipRouteIfIndex     = table_entry->old_ipRouteIfIndex;
                table_entry->old_ipRouteIfIndex = 0;
                break;

            case COLUMN_IPROUTEMETRIC1:
                table_entry->ipRouteMetric1     = table_entry->old_ipRouteMetric1;
                table_entry->old_ipRouteMetric1 = 0;
                break;

            case COLUMN_IPROUTEMETRIC2:
                table_entry->ipRouteMetric2     = table_entry->old_ipRouteMetric2;
                table_entry->old_ipRouteMetric2 = 0;
                break;

            case COLUMN_IPROUTEMETRIC3:
                table_entry->ipRouteMetric3     = table_entry->old_ipRouteMetric3;
                table_entry->old_ipRouteMetric3 = 0;
                break;

            case COLUMN_IPROUTEMETRIC4:
                table_entry->ipRouteMetric4     = table_entry->old_ipRouteMetric4;
                table_entry->old_ipRouteMetric4 = 0;
                break;

            case COLUMN_IPROUTENEXTHOP:
                table_entry->ipRouteNextHop     = table_entry->old_ipRouteNextHop;
                table_entry->old_ipRouteNextHop = 0;
                break;

            case COLUMN_IPROUTETYPE:
                table_entry->ipRouteType     = table_entry->old_ipRouteType;
                table_entry->old_ipRouteType = 0;
                break;

            case COLUMN_IPROUTEAGE:
                table_entry->ipRouteAge     = table_entry->old_ipRouteAge;
                table_entry->old_ipRouteAge = 0;
                break;

            case COLUMN_IPROUTEMASK:
                table_entry->ipRouteMask     = table_entry->old_ipRouteMask;
                table_entry->old_ipRouteMask = 0;
                break;

            case COLUMN_IPROUTEMETRIC5:
                table_entry->ipRouteMetric5     = table_entry->old_ipRouteMetric5;
                table_entry->old_ipRouteMetric5 = 0;
                break;

            }
        }
        break;

    }
    return SNMP_ERR_NOERROR;
}
/** handles requests for the mteTriggerExistenceTable table */
int
mteTriggerExistenceTable_handler(netsnmp_mib_handler *handler,
                                 netsnmp_handler_registration *reginfo,
                                 netsnmp_agent_request_info *reqinfo,
                                 netsnmp_request_info *requests)
{

    netsnmp_request_info       *request;
    netsnmp_table_request_info *tinfo;
    struct mteTrigger          *entry;
    int ret;

    DEBUGMSGTL(("disman:event:mib", "Exist Table handler (%d)\n",
                                     reqinfo->mode));

    switch (reqinfo->mode) {
        /*
         * Read-support (also covers GetNext requests)
         */
    case MODE_GET:
        for (request = requests; request; request = request->next) {
            entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
            tinfo = netsnmp_extract_table_info(request);

            /*
             * The mteTriggerExistenceTable should only contains entries for
             *   rows where the mteTriggerTest 'existence(0)' bit is set.
             * So skip entries where this isn't the case.
             */
            if (!entry || !(entry->mteTriggerTest & MTE_TRIGGER_EXISTENCE ))
                continue;

            switch (tinfo->colnum) {
            case COLUMN_MTETRIGGEREXISTENCETEST:
                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
                              (u_char *)&entry->mteTExTest, 1);
                break;
            case COLUMN_MTETRIGGEREXISTENCESTARTUP:
                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
                              (u_char *)&entry->mteTExStartup, 1);
                break;
            case COLUMN_MTETRIGGEREXISTENCEOBJECTSOWNER:
                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
                              (u_char *) entry->mteTExObjOwner,
                                  strlen(entry->mteTExObjOwner));
                break;
            case COLUMN_MTETRIGGEREXISTENCEOBJECTS:
                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
                              (u_char *) entry->mteTExObjects,
                                  strlen(entry->mteTExObjects));
                break;
            case COLUMN_MTETRIGGEREXISTENCEEVENTOWNER:
                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
                              (u_char *) entry->mteTExEvOwner,
                                  strlen(entry->mteTExEvOwner));
                break;
            case COLUMN_MTETRIGGEREXISTENCEEVENT:
                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
                              (u_char *) entry->mteTExEvent,
                                  strlen(entry->mteTExEvent));
                break;
            }
        }
        break;

#ifndef NETSNMP_NO_WRITE_SUPPORT
        /*
         * Write-support
         */
    case MODE_SET_RESERVE1:
        for (request = requests; request; request = request->next) {
            entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
            tinfo = netsnmp_extract_table_info(request);

            /*
             * Since the mteTriggerExistenceTable only contains entries for
             *   rows where the mteTriggerTest 'existence(0)' bit is set,
             *   strictly speaking we should reject assignments where
             *   this isn't the case.
             * But SET requests that include an assignment of the
             *   'existence(0)' bit at the same time are valid, so would
             *    need to be accepted. Unfortunately, this assignment
             *   is only applied in the COMMIT pass, so it's difficult
             *   to detect whether this holds or not.
             *
             * Let's fudge things for now, by processing assignments
             *   even if the 'existence(0)' bit isn't set.
             */
            switch (tinfo->colnum) {
            case COLUMN_MTETRIGGEREXISTENCETEST:
            case COLUMN_MTETRIGGEREXISTENCESTARTUP:
                ret = netsnmp_check_vb_type_and_size(
                         request->requestvb, ASN_OCTET_STR, 1);
                if (ret != SNMP_ERR_NOERROR ) {
                    netsnmp_set_request_error(reqinfo, request, ret );
                    return SNMP_ERR_NOERROR;
                }
                break;

            case COLUMN_MTETRIGGEREXISTENCEOBJECTSOWNER:
            case COLUMN_MTETRIGGEREXISTENCEOBJECTS:
            case COLUMN_MTETRIGGEREXISTENCEEVENTOWNER:
            case COLUMN_MTETRIGGEREXISTENCEEVENT:
                ret = netsnmp_check_vb_type_and_max_size(
                          request->requestvb, ASN_OCTET_STR, MTE_STR1_LEN);
                if (ret != SNMP_ERR_NOERROR ) {
                    netsnmp_set_request_error(reqinfo, request, ret );
                    return SNMP_ERR_NOERROR;
                }
                break;

            default:
                netsnmp_set_request_error(reqinfo, request,
                                          SNMP_ERR_NOTWRITABLE);
                return SNMP_ERR_NOERROR;
            }

            /*
             * The Event MIB is somewhat ambiguous as to whether the
             *  various trigger table entries can be modified once the
             *  main mteTriggerTable entry has been marked 'active'. 
             * But it's clear from discussion on the DisMan mailing
             *  list is that the intention is not.
             *
             * So check for whether this row is already active,
             *  and reject *all* SET requests if it is.
             */
            entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
            if (entry &&
                entry->flags & MTE_TRIGGER_FLAG_ACTIVE ) {
                netsnmp_set_request_error(reqinfo, request,
                                          SNMP_ERR_INCONSISTENTVALUE);
                return SNMP_ERR_NOERROR;
            }
        }
        break;

    case MODE_SET_RESERVE2:
    case MODE_SET_FREE:
    case MODE_SET_UNDO:
        break;

    case MODE_SET_ACTION:
        for (request = requests; request; request = request->next) {
            entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
            if (!entry) {
                /*
                 * New rows must be created via the RowStatus column
                 *   (in the main mteTriggerTable)
                 */
                netsnmp_set_request_error(reqinfo, request,
                                          SNMP_ERR_NOCREATION);
                                      /* or inconsistentName? */
                return SNMP_ERR_NOERROR;

            }
        }
        break;

    case MODE_SET_COMMIT:
        /*
         * All these assignments are "unfailable", so it's
         *  (reasonably) safe to apply them in the Commit phase
         */
        for (request = requests; request; request = request->next) {
            entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
            tinfo = netsnmp_extract_table_info(request);

            switch (tinfo->colnum) {
            case COLUMN_MTETRIGGEREXISTENCETEST:
                entry->mteTExTest    = request->requestvb->val.string[0];
                break;
            case COLUMN_MTETRIGGEREXISTENCESTARTUP:
                entry->mteTExStartup = request->requestvb->val.string[0];
                break;
            case COLUMN_MTETRIGGEREXISTENCEOBJECTSOWNER:
                memset(entry->mteTExObjOwner, 0, sizeof(entry->mteTExObjOwner));
                memcpy(entry->mteTExObjOwner, request->requestvb->val.string,
                                              request->requestvb->val_len);
                break;
            case COLUMN_MTETRIGGEREXISTENCEOBJECTS:
                memset(entry->mteTExObjects, 0, sizeof(entry->mteTExObjects));
                memcpy(entry->mteTExObjects, request->requestvb->val.string,
                                             request->requestvb->val_len);
                break;
            case COLUMN_MTETRIGGEREXISTENCEEVENTOWNER:
                memset(entry->mteTExEvOwner, 0, sizeof(entry->mteTExEvOwner));
                memcpy(entry->mteTExEvOwner, request->requestvb->val.string,
                                             request->requestvb->val_len);
                break;
            case COLUMN_MTETRIGGEREXISTENCEEVENT:
                memset(entry->mteTExEvent, 0, sizeof(entry->mteTExEvent));
                memcpy(entry->mteTExEvent, request->requestvb->val.string,
                                           request->requestvb->val_len);
                break;
            }
        }
        break;
#endif /* !NETSNMP_NO_WRITE_SUPPORT */
    }
    return SNMP_ERR_NOERROR;
}
Example #22
0
/** handles requests for the schedTable table */
int
schedTable_handler(netsnmp_mib_handler *handler,
                   netsnmp_handler_registration *reginfo,
                   netsnmp_agent_request_info *reqinfo,
                   netsnmp_request_info *requests)
{

    netsnmp_request_info       *request;
    netsnmp_table_request_info *tinfo;
    netsnmp_tdata_row          *row;
    struct schedTable_entry    *entry;
    int    recalculate = 0;
    size_t len;
    char  *cp;
    char   owner[SCHED_STR1_LEN+1];
    char   name[ SCHED_STR1_LEN+1];
    int    ret;

    DEBUGMSGTL(("disman:schedule:mib", "Schedule handler (%d)\n",
                                        reqinfo->mode));
    switch (reqinfo->mode) {
        /*
         * Read-support (also covers GetNext requests)
         */
    case MODE_GET:
        for (request = requests; request; request = request->next) {
            if (request->processed)
                continue;

            entry = (struct schedTable_entry *)
                    netsnmp_tdata_extract_entry(request);
            tinfo = netsnmp_extract_table_info( request);

            switch (tinfo->colnum) {
            case COLUMN_SCHEDDESCR:
                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
                                         entry->schedDescr,
                                  strlen(entry->schedDescr));
                break;
            case COLUMN_SCHEDINTERVAL:
                snmp_set_var_typed_integer(request->requestvb, ASN_UNSIGNED,
                                           entry->schedInterval);
                break;
            case COLUMN_SCHEDWEEKDAY:
                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
                                        &entry->schedWeekDay,
                                  sizeof(entry->schedWeekDay));
                break;
            case COLUMN_SCHEDMONTH:
                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
                                         entry->schedMonth,
                                  sizeof(entry->schedMonth));
                break;
            case COLUMN_SCHEDDAY:
                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
                                         entry->schedDay,
                                  sizeof(entry->schedDay));
                break;
            case COLUMN_SCHEDHOUR:
                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
                                         entry->schedHour,
                                  sizeof(entry->schedHour));
                break;
            case COLUMN_SCHEDMINUTE:
                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
                                         entry->schedMinute,
                                  sizeof(entry->schedMinute));
                break;
            case COLUMN_SCHEDCONTEXTNAME:
                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
                                         entry->schedContextName,
                                  strlen(entry->schedContextName));
                break;
            case COLUMN_SCHEDVARIABLE:
                snmp_set_var_typed_value(request->requestvb, ASN_OBJECT_ID,
                               (u_char *)entry->schedVariable,
                                         entry->schedVariable_len*sizeof(oid));
                break;
            case COLUMN_SCHEDVALUE:
                snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
                                           entry->schedValue);
                break;
            case COLUMN_SCHEDTYPE:
                snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
                                           entry->schedType);
                break;
            case COLUMN_SCHEDADMINSTATUS:
                ret = (entry->flags & SCHEDULE_FLAG_ENABLED ) ?
                           TV_TRUE : TV_FALSE;
                snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
                break;
            case COLUMN_SCHEDOPERSTATUS:
                ret = (entry->flags & SCHEDULE_FLAG_ENABLED ) ?
                           TV_TRUE : TV_FALSE;
                /*
                 * Check for one-shot entries that have already fired
                 */
                if ((entry->schedType == SCHED_TYPE_ONESHOT) &&
                    (entry->schedLastRun != 0 ))
                    ret = 3;  /* finished(3) */
                snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
                break;
            case COLUMN_SCHEDFAILURES:
                snmp_set_var_typed_integer(request->requestvb, ASN_COUNTER,
                                           entry->schedFailures);
                break;
            case COLUMN_SCHEDLASTFAILURE:
                snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
                                           entry->schedLastFailure);
                break;
            case COLUMN_SCHEDLASTFAILED:
                /*
                 * Convert 'schedLastFailed' timestamp
                 *   into DateAndTime string
                 */
                cp = (char *) date_n_time( &entry->schedLastFailed, &len );
                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
                                         cp, len);
                break;
            case COLUMN_SCHEDSTORAGETYPE:
                snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
                                           entry->schedStorageType);
                break;
            case COLUMN_SCHEDROWSTATUS:
                ret = (entry->flags & SCHEDULE_FLAG_ACTIVE ) ?
                           TV_TRUE : TV_FALSE;
                snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
                break;
            case COLUMN_SCHEDTRIGGERS:
                snmp_set_var_typed_integer(request->requestvb, ASN_COUNTER,
                                           entry->schedTriggers);
                break;
            }
        }
        break;

        /*
         * Write-support
         */
    case MODE_SET_RESERVE1:
        for (request = requests; request; request = request->next) {
            if (request->processed)
                continue;

            entry = (struct schedTable_entry *)
                    netsnmp_tdata_extract_entry(request);
            tinfo = netsnmp_extract_table_info( request);

            switch (tinfo->colnum) {
            case COLUMN_SCHEDDESCR:
                ret = netsnmp_check_vb_type_and_max_size(
                          request->requestvb, ASN_OCTET_STR, SCHED_STR2_LEN);
                if (ret != SNMP_ERR_NOERROR) {
                    netsnmp_set_request_error(reqinfo, request, ret);
                    return SNMP_ERR_NOERROR;
                }
                break;
            case COLUMN_SCHEDINTERVAL:
                ret = netsnmp_check_vb_uint( request->requestvb );
                if (ret != SNMP_ERR_NOERROR) {
                    netsnmp_set_request_error(reqinfo, request, ret);
                    return SNMP_ERR_NOERROR;
                }
                break;
            case COLUMN_SCHEDWEEKDAY:
                ret = netsnmp_check_vb_type_and_size(
                          request->requestvb, ASN_OCTET_STR, 1);
                /* XXX - check for bit(7) set */
                if (ret != SNMP_ERR_NOERROR) {
                    netsnmp_set_request_error(reqinfo, request, ret);
                    return SNMP_ERR_NOERROR;
                }
                break;
            case COLUMN_SCHEDMONTH:
                ret = netsnmp_check_vb_type_and_size(  /* max_size ?? */
                          request->requestvb, ASN_OCTET_STR, 2);
                /* XXX - check for bit(12)-bit(15) set */
                if (ret != SNMP_ERR_NOERROR) {
                    netsnmp_set_request_error(reqinfo, request, ret);
                    return SNMP_ERR_NOERROR;
                }
                break;
            case COLUMN_SCHEDDAY:
                ret = netsnmp_check_vb_type_and_size(  /* max_size ?? */
                          request->requestvb, ASN_OCTET_STR, 4+4);
                /* XXX - check for bit(62) or bit(63) set */
                if (ret != SNMP_ERR_NOERROR) {
                    netsnmp_set_request_error(reqinfo, request, ret);
                    return SNMP_ERR_NOERROR;
                }
                break;
            case COLUMN_SCHEDHOUR:
                ret = netsnmp_check_vb_type_and_size(  /* max_size ?? */
                          request->requestvb, ASN_OCTET_STR, 3);
                if (ret != SNMP_ERR_NOERROR) {
                    netsnmp_set_request_error(reqinfo, request, ret);
                    return SNMP_ERR_NOERROR;
                }
                break;
            case COLUMN_SCHEDMINUTE:
                ret = netsnmp_check_vb_type_and_size(  /* max_size ?? */
                          request->requestvb, ASN_OCTET_STR, 8);
                /* XXX - check for bit(60)-bit(63) set */
                if (ret != SNMP_ERR_NOERROR) {
                    netsnmp_set_request_error(reqinfo, request, ret);
                    return SNMP_ERR_NOERROR;
                }
                break;
            case COLUMN_SCHEDCONTEXTNAME:
                ret = netsnmp_check_vb_type_and_max_size(
                          request->requestvb, ASN_OCTET_STR, SCHED_STR1_LEN);
                if (ret != SNMP_ERR_NOERROR) {
                    netsnmp_set_request_error(reqinfo, request, ret);
                    return SNMP_ERR_NOERROR;
                }
                break;
            case COLUMN_SCHEDVARIABLE:
                ret = netsnmp_check_vb_oid( request->requestvb );
                if (ret != SNMP_ERR_NOERROR) {
                    netsnmp_set_request_error(reqinfo, request, ret);
                    return SNMP_ERR_NOERROR;
                }
                break;
            case COLUMN_SCHEDVALUE:
                ret = netsnmp_check_vb_int( request->requestvb );
                if (ret != SNMP_ERR_NOERROR) {
                    netsnmp_set_request_error(reqinfo, request, ret);
                    return SNMP_ERR_NOERROR;
                }
                break;
            case COLUMN_SCHEDTYPE:
                ret = netsnmp_check_vb_int_range( request->requestvb,
                             SCHED_TYPE_PERIODIC, SCHED_TYPE_ONESHOT );
                if (ret != SNMP_ERR_NOERROR) {
                    netsnmp_set_request_error(reqinfo, request, ret);
                    return SNMP_ERR_NOERROR;
                }
                break;
            case COLUMN_SCHEDADMINSTATUS:
                ret = netsnmp_check_vb_truthvalue( request->requestvb );
                if (ret != SNMP_ERR_NOERROR) {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_ERR_WRONGTYPE);
                    return SNMP_ERR_NOERROR;
                }
                break;
            case COLUMN_SCHEDSTORAGETYPE:
                ret = netsnmp_check_vb_int_range( request->requestvb,
                                                  ST_NONE, ST_READONLY );
                /* XXX - check valid/consistent assignments */
                if (ret != SNMP_ERR_NOERROR) {
                    netsnmp_set_request_error(reqinfo, request, ret);
                    return SNMP_ERR_NOERROR;
                }
                break;
            case COLUMN_SCHEDROWSTATUS:
                ret = netsnmp_check_vb_rowstatus( request->requestvb,
                          (entry ? RS_ACTIVE: RS_NONEXISTENT));
                /* XXX - check consistency assignments */
                if (ret != SNMP_ERR_NOERROR) {
                    netsnmp_set_request_error(reqinfo, request, ret);
                    return SNMP_ERR_NOERROR;
                }
                break;
            default:
                netsnmp_set_request_error(reqinfo, request,
                                          SNMP_ERR_NOTWRITABLE);
                return SNMP_ERR_NOERROR;
            }
        }
        break;

    case MODE_SET_RESERVE2:
        for (request = requests; request; request = request->next) {
            if (request->processed)
                continue;

            tinfo = netsnmp_extract_table_info(request);

            switch (tinfo->colnum) {
            case COLUMN_SCHEDROWSTATUS:
                switch (*request->requestvb->val.integer) {
                case RS_CREATEANDGO:
                case RS_CREATEANDWAIT:
                    /*
                     * Create an (empty) new row structure
                     */
                    memset(owner, 0, SCHED_STR1_LEN+1);
                    memset(name,  0, SCHED_STR1_LEN+1);
                    memcpy(owner, tinfo->indexes->val.string,
                                  tinfo->indexes->val_len);
                    memcpy(name,  tinfo->indexes->next_variable->val.string,
                                  tinfo->indexes->next_variable->val_len);
                    row = schedTable_createEntry(owner, name);
                    if (!row) {
                        netsnmp_set_request_error(reqinfo, request,
                                                  SNMP_ERR_RESOURCEUNAVAILABLE);
                        return SNMP_ERR_NOERROR;
                    }
                    netsnmp_insert_tdata_row(request, row);
                }
            }
        }
        break;

    case MODE_SET_FREE:
        for (request = requests; request; request = request->next) {
            if (request->processed)
                continue;

            tinfo = netsnmp_extract_table_info(request);

            switch (tinfo->colnum) {
            case COLUMN_SCHEDROWSTATUS:
                switch (*request->requestvb->val.integer) {
                case RS_CREATEANDGO:
                case RS_CREATEANDWAIT:
                    /*
                     * Tidy up after a failed row creation request
                     */ 
                    entry = (struct schedTable_entry *)
                                netsnmp_tdata_extract_entry(request);
                    if (entry &&
                      !(entry->flags & SCHEDULE_FLAG_VALID)) {
                        row = (netsnmp_tdata_row *)
                                netsnmp_tdata_extract_row(request);
                        schedTable_removeEntry(row);
                    }
                }
            }
        }
        break;

    case MODE_SET_ACTION:
        for (request = requests; request; request = request->next) {
            entry = (struct schedTable_entry *)
                    netsnmp_tdata_extract_entry(request);
            if (!entry) {
                /*
                 * New rows must be created via the RowStatus column
                 */
                netsnmp_set_request_error(reqinfo, request,
                                          SNMP_ERR_NOCREATION);
                                      /* or inconsistentName? */
                return SNMP_ERR_NOERROR;
            }
        }
        break;

    case MODE_SET_UNDO:
        break;

    case MODE_SET_COMMIT:
        /*
         * All these assignments are "unfailable", so it's
         *  (reasonably) safe to apply them in the Commit phase
         */
        entry = NULL;
        for (request = requests; request; request = request->next) {
            if (request->processed)
                continue;

            entry = (struct schedTable_entry *)
                    netsnmp_tdata_extract_entry(request);
            tinfo = netsnmp_extract_table_info( request);

            switch (tinfo->colnum) {
            case COLUMN_SCHEDDESCR:
                memset(entry->schedDescr, 0, sizeof(entry->schedDescr));
                memcpy(entry->schedDescr, request->requestvb->val.string,
                                          request->requestvb->val_len);
                break;
            case COLUMN_SCHEDINTERVAL:
                entry->schedInterval = *request->requestvb->val.integer;
                recalculate = 1;
                break;
            case COLUMN_SCHEDWEEKDAY:
                entry->schedWeekDay  = request->requestvb->val.string[0];
                recalculate = 1;
                break;
            case COLUMN_SCHEDMONTH:
                entry->schedMonth[0] = request->requestvb->val.string[0];
                entry->schedMonth[1] = request->requestvb->val.string[1];
                recalculate = 1;
                break;
            case COLUMN_SCHEDDAY:
                memset(entry->schedDay, 0, sizeof(entry->schedDay));
                memcpy(entry->schedDay, request->requestvb->val.string,
                                        request->requestvb->val_len);
                recalculate = 1;
                break;
            case COLUMN_SCHEDHOUR:
                entry->schedHour[0]  = request->requestvb->val.string[0];
                entry->schedHour[1]  = request->requestvb->val.string[1];
                entry->schedHour[2]  = request->requestvb->val.string[2];
                recalculate = 1;
                break;
            case COLUMN_SCHEDMINUTE:
                memset(entry->schedMinute, 0, sizeof(entry->schedMinute));
                memcpy(entry->schedMinute, request->requestvb->val.string,
                                           request->requestvb->val_len);
                recalculate = 1;
                break;
            case COLUMN_SCHEDCONTEXTNAME:
                memset(entry->schedContextName, 0, sizeof(entry->schedContextName));
                memcpy(entry->schedContextName,
                                           request->requestvb->val.string,
                                           request->requestvb->val_len);
                break;
            case COLUMN_SCHEDVARIABLE:
                memset(entry->schedVariable, 0, sizeof(entry->schedVariable));
                memcpy(entry->schedVariable,
                                           request->requestvb->val.string,
                                           request->requestvb->val_len);
                entry->schedVariable_len =
                                  request->requestvb->val_len/sizeof(oid);
                break;
            case COLUMN_SCHEDVALUE:
                entry->schedValue = *request->requestvb->val.integer;
                break;
            case COLUMN_SCHEDTYPE:
                entry->schedType  = *request->requestvb->val.integer;
                break;
            case COLUMN_SCHEDADMINSTATUS:
                if (*request->requestvb->val.integer == TV_TRUE)
                    entry->flags |=  SCHEDULE_FLAG_ENABLED;
                else
                    entry->flags &= ~SCHEDULE_FLAG_ENABLED;
                break;
            case COLUMN_SCHEDSTORAGETYPE:
                entry->schedStorageType = *request->requestvb->val.integer;
                break;
            case COLUMN_SCHEDROWSTATUS:
                switch (*request->requestvb->val.integer) {
                case RS_ACTIVE:
                    entry->flags |= SCHEDULE_FLAG_ACTIVE;
                    break;
                case RS_CREATEANDGO:
                    entry->flags |= SCHEDULE_FLAG_ACTIVE;
                    entry->flags |= SCHEDULE_FLAG_VALID;
                    entry->session =
                        netsnmp_iquery_pdu_session(reqinfo->asp->pdu);
                    break;
                case RS_CREATEANDWAIT:
                    entry->flags |= SCHEDULE_FLAG_VALID;
                    entry->session =
                        netsnmp_iquery_pdu_session(reqinfo->asp->pdu);
                    break;

                case RS_DESTROY:
                    row = (netsnmp_tdata_row *)
                               netsnmp_tdata_extract_row(request);
                    schedTable_removeEntry(row);
                }
                recalculate = 1;
                break;
            }
        }
        if (recalculate) {
            netsnmp_assert(entry);
            sched_nextTime(entry);
        }
        break;
    }
    return SNMP_ERR_NOERROR;
}
Example #23
0
/************************************************************
 * RESERVE is used to check the syntax of all the variables
 * provided, that the values being set are sensible and consistent,
 * and to allocate any resources required for performing the SET.
 * After this stage, the expectation is that the set ought to
 * succeed, though this is not guaranteed. (In fact, with the UCD
 * agent, this is done in two passes - RESERVE1, and
 * RESERVE2, to allow for dependancies between variables).
 *
 * BEFORE calling this routine, the agent will call duplicate_row
 * to create a copy of the row (unless this is a new row; i.e.
 * row_created == 1).
 *
 * next state -> SET_RESERVE2 || SET_FREE
 */
void
saHpiSensorTable_set_reserve1 (netsnmp_request_group * rg)
{

  netsnmp_variable_list *var;
  netsnmp_request_group_item *current;
  saHpiSensorTable_context *row_ctx =
    (saHpiSensorTable_context *) rg->existing_row;
  int rc = SNMP_ERR_NOERROR;

  DEBUGMSGTL ((AGENT, "saHpiSensorTable_set_reserve1. Entry\n"));
  for (current = rg->list; current; current = current->next)
    {

      var = current->ri->requestvb;
      rc = SNMP_ERR_NOERROR;

      switch (current->tri->colnum)
	{

	case COLUMN_SAHPISENSORSTATUS:
	    /** UNSIGNED32 = ASN_UNSIGNED */
	  rc = netsnmp_check_vb_type_and_size (var, ASN_UNSIGNED,
					       sizeof (row_ctx->
						       saHpiSensorStatus));
	  break;

	case COLUMN_SAHPISENSORASSERTEVENTS:
	  /** OCTETSTR = ASN_OCTET_STR */
	  if (var->type != ASN_OCTET_STR)
	    {
	      rc = SNMP_ERR_WRONGTYPE;
	    }
	  else if (var->val_len > SENSOR_EVENTS_SUPPORTED_MAX)
	    {
	      rc = SNMP_ERR_WRONGLENGTH;
	    }
	  else if (var->val_len < 0)
	    {
	      rc = SNMP_ERR_WRONGLENGTH;
	    }
	  break;

	case COLUMN_SAHPISENSORDEASSERTEVENTS:
	  /** OCTETSTR = ASN_OCTET_STR */
	  if (var->type != ASN_OCTET_STR)
	    {
	      rc = SNMP_ERR_WRONGTYPE;
	    }
	  else if (var->val_len > SENSOR_EVENTS_SUPPORTED_MAX)
	    {
	      rc = SNMP_ERR_WRONGLENGTH;
	    }
	  else if (var->val_len < 0)
	    {
	      rc = SNMP_ERR_WRONGLENGTH;
	    }
	  break;

	case COLUMN_SAHPISENSORINDEX:
	case COLUMN_SAHPISENSORTYPE:
	case COLUMN_SAHPISENSORCATEGORY:
	case COLUMN_SAHPISENSOREVENTSCATEGORYCONTROL:
	case COLUMN_SAHPISENSOREVENTSSUPPORTED:
	case COLUMN_SAHPISENSORIGNORE:
	case COLUMN_SAHPISENSORREADINGFORMATS:
	case COLUMN_SAHPISENSORISNUMERIC:
	case COLUMN_SAHPISENSORSIGNFORMAT:
	case COLUMN_SAHPISENSORBASEUNITS:
	case COLUMN_SAHPISENSORMODIFIERUNITS:
	case COLUMN_SAHPISENSORMODIFIERUSE:
	case COLUMN_SAHPISENSORFACTORSSTATIC:
	case COLUMN_SAHPISENSORFACTORS:
	case COLUMN_SAHPISENSORFACTORSLINEARIZATION:
	case COLUMN_SAHPISENSORPERCENTAGE:
	case COLUMN_SAHPISENSORRANGEFLAGS:
	case COLUMN_SAHPISENSORHASTHRESHOLDS:
	case COLUMN_SAHPISENSORTHRESHOLDCAPABILITIES:
	case COLUMN_SAHPISENSOROEM:
	case COLUMN_SAHPISENSORRDR:
	  rc = SNMP_ERR_NOTWRITABLE;
	  break;
	default:		// Trying to write to read-only objects or to unknown columns?
	  rc = SNMP_ERR_GENERR;
	  break;
	}

      if (rc)
	netsnmp_set_mode_request_error (MODE_SET_BEGIN, current->ri, rc);
      rg->status = SNMP_MAX (rg->status, current->ri->status);
    }
  for (current = rg->list; current; current = current->next)
    {

      // The nice thing about this API is that _row_copy() is called
      // for this row - if the API has matched the index with an
      // already existing entry. We check the 'hash' value. If its
      // 0 the API couldn't find the right context.

      if (((saHpiSensorTable_context *) rg->existing_row)->hash == 0)
	{
	  rc = SNMP_ERR_NOSUCHNAME;
	  netsnmp_set_mode_request_error (MODE_SET_BEGIN, current->ri, rc);
	}
    }
  DEBUGMSGTL ((AGENT, "saHpiSensorTable_set_reserve1: Exit (rc:%d)\n", rc));
}
Example #24
0
/************************************************************
 * RESERVE is used to check the syntax of all the variables
 * provided, that the values being set are sensible and consistent,
 * and to allocate any resources required for performing the SET.
 * After this stage, the expectation is that the set ought to
 * succeed, though this is not guaranteed. (In fact, with the UCD
 * agent, this is done in two passes - RESERVE1, and
 * RESERVE2, to allow for dependancies between variables).
 *
 * BEFORE calling this routine, the agent will call duplicate_row
 * to create a copy of the row (unless this is a new row; i.e.
 * row_created == 1).
 *
 * next state -> SET_RESERVE2 || SET_FREE
 */
void
saHpiWatchdogTable_set_reserve1 (netsnmp_request_group * rg)
{
  saHpiWatchdogTable_context *row_ctx =
    (saHpiWatchdogTable_context *) rg->existing_row;


  netsnmp_variable_list *var;
  netsnmp_request_group_item *current;

  int rc;

  DEBUGMSGTL ((AGENT, "saHpiWatchdogTable_set_reserve1.Entry\n"));
  for (current = rg->list; current; current = current->next)
    {

      var = current->ri->requestvb;
      rc = SNMP_ERR_NOERROR;

      switch (current->tri->colnum)
	{
	case COLUMN_SAHPIWATCHDOGNUM:
	case COLUMN_SAHPIWATCHDOGOEM:
	case COLUMN_SAHPIWATCHDOGRDR:
	  rc = SNMP_ERR_NOTWRITABLE;
	  break;
	case COLUMN_SAHPIWATCHDOGLOG:
	    /** TruthValue = ASN_INTEGER */
	  rc = netsnmp_check_vb_type_and_size (var, ASN_INTEGER,
					       sizeof (row_ctx->
						       saHpiWatchdogLog));
	  break;

	case COLUMN_SAHPIWATCHDOGRUNNING:
	    /** TruthValue = ASN_INTEGER */
	  rc = netsnmp_check_vb_type_and_size (var, ASN_INTEGER,
					       sizeof (row_ctx->
						       saHpiWatchdogRunning));

	  break;

	case COLUMN_SAHPIWATCHDOGTIMERUSE:
	    /** INTEGER = ASN_INTEGER */
	  rc = netsnmp_check_vb_type_and_size (var, ASN_INTEGER,
					       sizeof (row_ctx->
						       saHpiWatchdogTimerUse));
	  break;

	case COLUMN_SAHPIWATCHDOGTIMERACTION:
	    /** INTEGER = ASN_INTEGER */
	  rc = netsnmp_check_vb_type_and_size (var, ASN_INTEGER,
					       sizeof (row_ctx->
						       saHpiWatchdogTimerAction));
	  break;

	case COLUMN_SAHPIWATCHDOGPRETIMERINTERRUPT:
	    /** INTEGER = ASN_INTEGER */
	  rc = netsnmp_check_vb_type_and_size (var, ASN_INTEGER,
					       sizeof (row_ctx->
						       saHpiWatchdogPretimerInterrupt));
	  break;

	case COLUMN_SAHPIWATCHDOGPRETIMEOUTINTERVAL:
	    /** UNSIGNED32 = ASN_UNSIGNED */
	  rc = netsnmp_check_vb_type_and_size (var, ASN_UNSIGNED,
					       sizeof (row_ctx->
						       saHpiWatchdogPreTimeoutInterval));
	  break;

	case COLUMN_SAHPIWATCHDOGTIMERUSEEXPFLAGS:
	    /** UNSIGNED32 = ASN_UNSIGNED */
	  rc = netsnmp_check_vb_type_and_size (var, ASN_UNSIGNED,
					       sizeof (row_ctx->
						       saHpiWatchdogTimerUseExpFlags));
	  break;

	case COLUMN_SAHPIWATCHDOGTIMERINITIALCOUNT:
	    /** UNSIGNED32 = ASN_UNSIGNED */
	  rc = netsnmp_check_vb_type_and_size (var, ASN_UNSIGNED,
					       sizeof (row_ctx->
						       saHpiWatchdogTimerInitialCount));
	  break;

	case COLUMN_SAHPIWATCHDOGTIMERPRESENTCOUNT:
	    /** UNSIGNED32 = ASN_UNSIGNED */
	  rc = netsnmp_check_vb_type_and_size (var, ASN_UNSIGNED,
					       sizeof (row_ctx->
						       saHpiWatchdogTimerPresentCount));
	  break;
	case COLUMN_SAHPIWATCHDOGTIMERRESET:
	  /** TruthValue = ASN_INTEGER */
	  rc = netsnmp_check_vb_type_and_size (var, ASN_INTEGER,
					       sizeof (row_ctx->
						       saHpiWatchdogTimerReset));
	  break;

	default:
		/** We shouldn't get here */
	  rc = SNMP_ERR_GENERR;
	  snmp_log (LOG_ERR, "unknown column in "
		    "saHpiWatchdogTable_set_reserve1\n");
	}

      if (rc)
	netsnmp_set_mode_request_error (MODE_SET_BEGIN, current->ri, rc);
      rg->status = SNMP_MAX (rg->status, current->ri->status);
    }
  for (current = rg->list; current; current = current->next)
    {

      // The nice thing about this API is that _row_copy() is called
      // for this row - if the API has matched the index with an
      // already existing entry. We check the 'hash' value. If its
      // 0 the API couldn't find the right context.

      if (((saHpiWatchdogTable_context *) rg->existing_row)->hash == 0)
	{

	  netsnmp_set_mode_request_error (MODE_SET_BEGIN, current->ri,
					  SNMP_ERR_NOSUCHNAME);
	}
    }
  DEBUGMSGTL ((AGENT, "saHpiWatchdogTable_set_reserve1. Exit\n"));
}
Example #25
0
/************************************************************
 * RESERVE is used to check the syntax of all the variables
 * provided, that the values being set are sensible and consistent,
 * and to allocate any resources required for performing the SET.
 * After this stage, the expectation is that the set ought to
 * succeed, though this is not guaranteed. (In fact, with the UCD
 * agent, this is done in two passes - RESERVE1, and
 * RESERVE2, to allow for dependancies between variables).
 *
 * BEFORE calling this routine, the agent will call duplicate_row
 * to create a copy of the row (unless this is a new row; i.e.
 * row_created == 1).
 *
 * next state -> SET_RESERVE2 || SET_FREE
 */
void
saHpiHotSwapTable_set_reserve1 (netsnmp_request_group * rg)
{
  saHpiHotSwapTable_context *row_ctx =
    (saHpiHotSwapTable_context *) rg->existing_row;

  netsnmp_variable_list *var;
  netsnmp_request_group_item *current;
  int rc;


  DEBUGMSGTL ((AGENT, "saHpiHotSwapTable_set_reserve1: Entry.\n"));
  for (current = rg->list; current; current = current->next)
    {

      var = current->ri->requestvb;
      rc = SNMP_ERR_NOERROR;

      switch (current->tri->colnum)
	{

	case COLUMN_SAHPIHOTSWAPINDICATOR:
	    /** INTEGER = ASN_INTEGER */
	  rc = netsnmp_check_vb_type_and_size (var, ASN_INTEGER,
					       sizeof (row_ctx->
						       saHpiHotSwapIndicator));
	  break;

	case COLUMN_SAHPIHOTSWAPPOWERSTATE:
	    /** INTEGER = ASN_INTEGER */
	  rc = netsnmp_check_vb_type_and_size (var, ASN_INTEGER,
					       sizeof (row_ctx->
						       saHpiHotSwapPowerState));
	  break;

	case COLUMN_SAHPIHOTSWAPRESETSTATE:
	    /** INTEGER = ASN_INTEGER */
	  rc = netsnmp_check_vb_type_and_size (var, ASN_INTEGER,
					       sizeof (row_ctx->
						       saHpiHotSwapResetState));
	  break;

	case COLUMN_SAHPIHOTSWAPSTATE:
	    /** INTEGER = ASN_INTEGER */
	case COLUMN_SAHPIHOTSWAPPREVIOUSSTATE:
	    /** INTEGER = ASN_INTEGER */
	case COLUMN_SAHPIHOTSWAPEVENTSEVERITY:
	  rc = SNMP_ERR_NOTWRITABLE;
	  break;
	case COLUMN_SAHPIHOTSWAPINSERTTIMEOUT:
	    /** UNSIGNED32 = ASN_UNSIGNED */
	  rc = netsnmp_check_vb_type_and_size (var, ASN_UNSIGNED,
					       sizeof (row_ctx->
						       saHpiHotSwapInsertTimeout));
	  break;

	case COLUMN_SAHPIHOTSWAPEXTRACTTIMEOUT:
	    /** UNSIGNED32 = ASN_UNSIGNED */
	  rc = netsnmp_check_vb_type_and_size (var, ASN_UNSIGNED,
					       sizeof (row_ctx->
						       saHpiHotSwapExtractTimeout));
	  break;

	case COLUMN_SAHPIHOTSWAPACTIONREQUEST:
	    /** INTEGER = ASN_INTEGER */
	  rc = netsnmp_check_vb_type_and_size (var, ASN_INTEGER,
					       sizeof (row_ctx->
						       saHpiHotSwapActionRequest));
	  break;
	case COLUMN_SAHPIHOTSWAPRTP:
	  rc = SNMP_ERR_NOTWRITABLE;
	  break;
	default:
		/** We shouldn't get here */
	  rc = SNMP_ERR_GENERR;
	  snmp_log (LOG_ERR, "unknown column in "
		    "saHpiHotSwapTable_set_reserve1\n");
	}

      if (rc)
	netsnmp_set_mode_request_error (MODE_SET_BEGIN, current->ri, rc);
      rg->status = SNMP_MAX (rg->status, current->ri->status);
    }
  for (current = rg->list; current; current = current->next)
    {

      // The nice thing about this API is that _row_copy() is called
      // for this row - if the API has matched the index with an
      // already existing entry. We check the 'hash' value. If its
      // 0 the API couldn't find the right context.

      if (row_ctx->hash == 0)
	{
	  netsnmp_set_mode_request_error (MODE_SET_BEGIN, current->ri,
					  SNMP_ERR_NOSUCHNAME);
	}
    }
  DEBUGMSGTL ((AGENT, "saHpiHotSwapTable_set_reserve1: Exit.\n"));
}
/*
 * @internal
 * Check the syntax for a particular column
 */
NETSNMP_STATIC_INLINE int
_dot11DHCPIpAddressPoolTable_check_column( dot11DHCPIpAddressPoolTable_rowreq_ctx *rowreq_ctx,
                         netsnmp_variable_list *var, int column )
{
    int rc = SNMPERR_SUCCESS;
    
    DEBUGMSGTL(("internal:dot11DHCPIpAddressPoolTable:_dot11DHCPIpAddressPoolTable_check_column","called\n"));

    netsnmp_assert(NULL != rowreq_ctx);

    switch(column) {

    /* IPAddpoolStartAdd(2)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/W/e/r/d/h */
    case COLUMN_IPADDPOOLSTARTADD:
    rc = netsnmp_check_vb_type_and_size( var, ASN_IPADDRESS,
        sizeof( rowreq_ctx->data.IPAddpoolStartAdd ) );
    /* yyy-rks: anything else we can do here? */
    if(SNMPERR_SUCCESS == rc) {
        rc = IPAddpoolStartAdd_check_value( rowreq_ctx, *((u_long *)var->val.string) );
        if((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc) &&
           (MFD_NOT_VALID_NOW != rc)) {
            snmp_log(LOG_ERR, "bad rc %d from IPAddpoolStartAdd_check_value\n", rc);
            rc = SNMP_ERR_GENERR;
        }
    }
        break;

    /* IPAddpoolEndAdd(3)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/W/e/r/d/h */
    case COLUMN_IPADDPOOLENDADD:
    rc = netsnmp_check_vb_type_and_size( var, ASN_IPADDRESS,
        sizeof( rowreq_ctx->data.IPAddpoolEndAdd ) );
    /* yyy-rks: anything else we can do here? */
    if(SNMPERR_SUCCESS == rc) {
        rc = IPAddpoolEndAdd_check_value( rowreq_ctx, *((u_long *)var->val.string) );
        if((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc) &&
           (MFD_NOT_VALID_NOW != rc)) {
            snmp_log(LOG_ERR, "bad rc %d from IPAddpoolEndAdd_check_value\n", rc);
            rc = SNMP_ERR_GENERR;
        }
    }
        break;

    /* GatewayAddress(4)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/W/e/r/d/h */
    case COLUMN_GATEWAYADDRESS:
    rc = netsnmp_check_vb_type_and_size( var, ASN_IPADDRESS,
        sizeof( rowreq_ctx->data.GatewayAddress ) );
    /* yyy-rks: anything else we can do here? */
    if(SNMPERR_SUCCESS == rc) {
        rc = GatewayAddress_check_value( rowreq_ctx, *((u_long *)var->val.string) );
        if((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc) &&
           (MFD_NOT_VALID_NOW != rc)) {
            snmp_log(LOG_ERR, "bad rc %d from GatewayAddress_check_value\n", rc);
            rc = SNMP_ERR_GENERR;
        }
    }
        break;

    /* IPAddLeasePeriod(5)/INTEGER/ASN_INTEGER/long(long)//l/A/W/e/r/d/h */
    case COLUMN_IPADDLEASEPERIOD:
    rc = netsnmp_check_vb_type_and_size( var, ASN_INTEGER,
        sizeof( rowreq_ctx->data.IPAddLeasePeriod ) );
    /* yyy-rks: anything else we can do here? */
    if(SNMPERR_SUCCESS == rc) {
        rc = IPAddLeasePeriod_check_value( rowreq_ctx, *((long *)var->val.string) );
        if((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc) &&
           (MFD_NOT_VALID_NOW != rc)) {
            snmp_log(LOG_ERR, "bad rc %d from IPAddLeasePeriod_check_value\n", rc);
            rc = SNMP_ERR_GENERR;
        }
    }
        break;

        default: /** We shouldn't get here */
            rc = SNMP_ERR_GENERR;
            snmp_log(LOG_ERR, "unknown column %d in _dot11DHCPIpAddressPoolTable_check_column\n", column);
    }

    return rc;
} /* _dot11DHCPIpAddressPoolTable_check_column */
Example #27
0
/************************************************************
 * RESERVE is used to check the syntax of all the variables
 * provided, that the values being set are sensible and consistent,
 * and to allocate any resources required for performing the SET.
 * After this stage, the expectation is that the set ought to
 * succeed, though this is not guaranteed. (In fact, with the UCD
 * agent, this is done in two passes - RESERVE1, and
 * RESERVE2, to allow for dependancies between variables).
 *
 * BEFORE calling this routine, the agent will call duplicate_row
 * to create a copy of the row (unless this is a new row; i.e.
 * row_created == 1).
 *
 * next state -> SET_RESERVE2 || SET_FREE
 */
void saHpiUserEventTable_set_reserve1( netsnmp_request_group *rg )
{
    saHpiUserEventTable_context *row_ctx =
            (saHpiUserEventTable_context *)rg->existing_row;
    saHpiUserEventTable_context *undo_ctx =
            (saHpiUserEventTable_context *)rg->undo_info;
    netsnmp_variable_list *var;
    netsnmp_request_group_item *current;
    int rc;


    /*
     * TODO: loop through columns, check syntax and lengths. For
     * columns which have no dependencies, you could also move
     * the value/range checking here to attempt to catch error
     * cases as early as possible.
     */
    for( current = rg->list; current; current = current->next ) {

        var = current->ri->requestvb;
        rc = SNMP_ERR_NOERROR;

        switch(current->tri->colnum) {

        case COLUMN_SAHPIUSEREVENTTIMESTAMP:
            /** SaHpiTime = ASN_COUNTER64 */
            rc = netsnmp_check_vb_type_and_size(var, ASN_COUNTER64,
                                                sizeof(row_ctx->saHpiUserEventTimestamp));
        break;

        case COLUMN_SAHPIUSEREVENTTEXTTYPE:
            /** SaHpiTextType = ASN_INTEGER */
            rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                                sizeof(row_ctx->saHpiUserEventTextType));
        break;

        case COLUMN_SAHPIUSEREVENTTEXTLANGUAGE:
            /** SaHpiTextLanguage = ASN_INTEGER */
            rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                                sizeof(row_ctx->saHpiUserEventTextLanguage));
        break;

        case COLUMN_SAHPIUSEREVENTTEXT:
            /** SaHpiText = ASN_OCTET_STR */
            rc = netsnmp_check_vb_type_and_size(var, ASN_OCTET_STR,
                                                sizeof(row_ctx->saHpiUserEventText));
        break;

        case COLUMN_SAHPIUSEREVENTROWSTATUS:
            /** RowStatus = ASN_INTEGER */
            rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                                sizeof(row_ctx->saHpiUserEventRowStatus));
        break;

        default: /** We shouldn't get here */
            rc = SNMP_ERR_GENERR;
            snmp_log(LOG_ERR, "unknown column in "
                     "saHpiUserEventTable_set_reserve1\n");
        }

        if (rc)
           netsnmp_set_mode_request_error(MODE_SET_BEGIN, current->ri, rc );
        rg->status = SNMP_MAX( rg->status, current->ri->status );
    }

    /*
     * done with all the columns. Could check row related
     * requirements here.
     */
}
Example #28
0
/************************************************************
 * RESERVE is used to check the syntax of all the variables
 * provided, that the values being set are sensible and consistent,
 * and to allocate any resources required for performing the SET.
 * After this stage, the expectation is that the set ought to
 * succeed, though this is not guaranteed. (In fact, with the UCD
 * agent, this is done in two passes - RESERVE1, and
 * RESERVE2, to allow for dependancies between variables).
 *
 * BEFORE calling this routine, the agent will call duplicate_row
 * to create a copy of the row (unless this is a new row; i.e.
 * row_created == 1).
 *
 * next state -> SET_RESERVE2 || SET_FREE
 */
void saHpiCtrlStreamTable_set_reserve1( netsnmp_request_group *rg )
{
	saHpiCtrlStreamTable_context *row_ctx =
	(saHpiCtrlStreamTable_context *)rg->existing_row;
//	saHpiCtrlStreamTable_context *undo_ctx =
//	(saHpiCtrlStreamTable_context *)rg->undo_info;
	netsnmp_variable_list *var;
	netsnmp_request_group_item *current;
	int rc;

	DEBUGMSGTL ((AGENT, "saHpiCtrlStreamTable_set_reserve1, called\n"));

	/*
	 * TODO: loop through columns, check syntax and lengths. For
	 * columns which have no dependencies, you could also move
	 * the value/range checking here to attempt to catch error
	 * cases as early as possible.
	 */
	for ( current = rg->list; current; current = current->next ) {

		var = current->ri->requestvb;
		rc = SNMP_ERR_NOERROR;

		switch (current->tri->colnum) {
		
		case COLUMN_SAHPICTRLSTREAMMODE:
			/** SaHpiCtrlMode = ASN_INTEGER */
			rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
							    sizeof(row_ctx->saHpiCtrlStreamMode));
			break;

		case COLUMN_SAHPICTRLSTREAMREPEAT:
			/** TruthValue = ASN_INTEGER */
			rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
							    sizeof(row_ctx->saHpiCtrlStreamRepeat));
			break;

		case COLUMN_SAHPICTRLSTREAMSTATE:
			/** SaHpiText = ASN_OCTET_STR */
			rc = netsnmp_check_vb_type(var, ASN_OCTET_STR);                 
			if (rc == SNMP_ERR_NOERROR ) {
				if (var->val_len > sizeof(row_ctx->saHpiCtrlStreamState)) {
					rc = SNMP_ERR_WRONGLENGTH;
				}
			}
			if (rc == SNMP_ERR_NOERROR)
				DEBUGMSGTL ((AGENT, 
			            "COLUMN_SAHPICTRLSTREAMSTATE NO ERROR: %d\n", rc));
			else
				DEBUGMSGTL ((AGENT, 
				    "COLUMN_SAHPICTRLSTREAMSTATE ERROR: %d\n", rc));
			break;

		default: /** We shouldn't get here */
			rc = SNMP_ERR_GENERR;
			snmp_log(LOG_ERR, "unknown column in "
				 "saHpiCtrlStreamTable_set_reserve1\n");
		}

		if (rc)
			netsnmp_request_set_error( current->ri, rc );
		rg->status = SNMP_MAX( rg->status, current->ri->status );
	}

	/*
	 * done with all the columns. Could check row related
	 * requirements here.
	 */
}
/*
 * @internal
 * Check the syntax for a particular column
 */
NETSNMP_STATIC_INLINE int
_ipv4InterfaceTable_check_column(ipv4InterfaceTable_rowreq_ctx *
                                 rowreq_ctx, netsnmp_variable_list * var,
                                 int column)
{
    int             rc = SNMPERR_SUCCESS;

    DEBUGMSGTL(("internal:ipv4InterfaceTable:_ipv4InterfaceTable_check_column", "called for %d\n", column));

    netsnmp_assert(NULL != rowreq_ctx);

    switch (column) {
        /*
         * (INDEX) ipv4InterfaceIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H 
         */
    case COLUMN_IPV4INTERFACEIFINDEX:
        rc = SNMP_ERR_NOTWRITABLE;      /* can not change index of active row */
        break;

        /*
         * ipv4InterfaceReasmMaxSize(2)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h 
         */
    case COLUMN_IPV4INTERFACEREASMMAXSIZE:
        rc = SNMP_ERR_NOTWRITABLE;
        break;

        /*
         * ipv4InterfaceEnableStatus(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h 
         */
    case COLUMN_IPV4INTERFACEENABLESTATUS:
        rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                            sizeof(rowreq_ctx->data.
                                                   ipv4InterfaceEnableStatus));
        /*
         * check that the value is one of defined enums 
         */
        if ((SNMPERR_SUCCESS == rc)
            && (*var->val.integer != IPV4INTERFACEENABLESTATUS_UP)
            && (*var->val.integer != IPV4INTERFACEENABLESTATUS_DOWN)
            ) {
            rc = SNMP_ERR_WRONGVALUE;
        }
        if (SNMPERR_SUCCESS != rc) {
            DEBUGMSGTL(("ipv4InterfaceTable:_ipv4InterfaceTable_check_column:ipv4InterfaceEnableStatus", "varbind validation failed (eg bad type or size)\n"));
        } else {
            rc = ipv4InterfaceEnableStatus_check_value(rowreq_ctx,
                                                       *((u_long *) var->
                                                         val.string));
            if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
                && (MFD_NOT_VALID_NOW != rc)) {
                snmp_log(LOG_ERR,
                         "bad rc %d from ipv4InterfaceEnableStatus_check_value\n",
                         rc);
                rc = SNMP_ERR_GENERR;
            }
        }
        break;

        /*
         * ipv4InterfaceRetransmitTime(4)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/D/h 
         */
    case COLUMN_IPV4INTERFACERETRANSMITTIME:
        rc = SNMP_ERR_NOTWRITABLE;
        break;

    default:   /** We shouldn't get here */
        rc = SNMP_ERR_GENERR;
        snmp_log(LOG_ERR,
                 "unknown column %d in _ipv4InterfaceTable_check_column\n",
                 column);
    }

    return rc;
}                               /* _ipv4InterfaceTable_check_column */
Example #30
0
/*
 * @internal
 * Check the syntax for a particular column
 */
NETSNMP_STATIC_INLINE int
_ifXTable_check_column(ifXTable_rowreq_ctx * rowreq_ctx,
                       netsnmp_variable_list * var, int column)
{
    int             rc = SNMPERR_SUCCESS;

    DEBUGMSGTL(("internal:ifXTable:_ifXTable_check_column", "called\n"));

    netsnmp_assert(NULL != rowreq_ctx);

    switch (column) {

        /*
         * ifLinkUpDownTrapEnable(14)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h 
         */
    case COLUMN_IFLINKUPDOWNTRAPENABLE:
        rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                            sizeof(rowreq_ctx->data.
                                                   ifLinkUpDownTrapEnable));
        if (SNMPERR_SUCCESS == rc) {

            /*
             * check that the value is one of defined enums 
             */
            if (1 && (*var->val.integer != IFLINKUPDOWNTRAPENABLE_ENABLED)
                && (*var->val.integer != IFLINKUPDOWNTRAPENABLE_DISABLED)
                ) {
                rc = SNMP_ERR_WRONGVALUE;
            }
        }
        if (SNMPERR_SUCCESS == rc) {
            rc = ifLinkUpDownTrapEnable_check_value(rowreq_ctx,
                                                    *((u_long *) var->val.
                                                      string));
            if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
                && (MFD_NOT_VALID_NOW != rc)) {
                snmp_log(LOG_ERR,
                         "bad rc %d from ifLinkUpDownTrapEnable_check_value\n",
                         rc);
                rc = SNMP_ERR_GENERR;
            }
        }
        break;

        /*
         * ifPromiscuousMode(16)/TruthValue/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h 
         */
    case COLUMN_IFPROMISCUOUSMODE:
        rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
                                            sizeof(rowreq_ctx->data.
                                                   ifPromiscuousMode));
        if (SNMPERR_SUCCESS == rc) {

            /*
             * check that the value is one of defined enums 
             */
            if (1 && (*var->val.integer != TRUTHVALUE_TRUE)
                && (*var->val.integer != TRUTHVALUE_FALSE)
                ) {
                rc = SNMP_ERR_WRONGVALUE;
            }
        }
        if (SNMPERR_SUCCESS == rc) {
            rc = ifPromiscuousMode_check_value(rowreq_ctx,
                                               *((u_long *) var->val.
                                                 string));
            if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
                && (MFD_NOT_VALID_NOW != rc)) {
                snmp_log(LOG_ERR,
                         "bad rc %d from ifPromiscuousMode_check_value\n",
                         rc);
                rc = SNMP_ERR_GENERR;
            }
        }
        break;

        /*
         * ifAlias(18)/DisplayString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H 
         */
    case COLUMN_IFALIAS:
        rc = netsnmp_check_vb_type(var, ASN_OCTET_STR);
        if (SNMPERR_SUCCESS == rc) {
            /*
             * check that the value is in the defined range(s); inefficent
             * * but keeps rc value knowledge in libarary where it belongs. 
             */
            if (1
                && ((rc = netsnmp_check_vb_size_range(var, 0, 64)) !=
                    SNMP_ERR_NOERROR)
                ) {
                ;               /* rc set in condition */
            }
        }
        if (SNMPERR_SUCCESS == rc) {
            rc = ifAlias_check_value(rowreq_ctx, (char *) var->val.string,
                                     var->val_len);
            if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
                && (MFD_NOT_VALID_NOW != rc)) {
                snmp_log(LOG_ERR, "bad rc %d from ifAlias_check_value\n",
                         rc);
                rc = SNMP_ERR_GENERR;
            }
        }
        break;

    default: /** We shouldn't get here */
        rc = SNMP_ERR_GENERR;
        snmp_log(LOG_ERR, "unknown column %d in _ifXTable_check_column\n",
                 column);
    }

    return rc;
}                               /* _ifXTable_check_column */