next up previous contents
Next: Liste der verwendeten Abkürzungen Up: Inference Handler Programmierbeispiel Previous: CsIHTest.h

CsIHTest.cc

///////////////////////////////////////////////////////////////////////////////
//
//      Entwurf und Implementierung von Managementszenarien zu verteilten 
//      Kommunikationsanwendungen
//      Diplomarbeit
//      Technische Universitaet Muenchen
//
//      Workfile:               CsIHTest.cc
//      Directory:              /proj/Spectrum3/IHAPI/nwp
//      Original Author:        Alexander Keller
//      Date:                   11/3/93 
//
///////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////
//
// FILE
//
//      CsIHTest.cc - File containing the implementation of CsIHTest
//
// DESCRIPTION
//
//      CsIHTest is attached to the CABLETRON-IRM2-Hub Model Type.
//      It monitors the changes in the counter for broken MAC-frames and
//      reports them to the user.
//
/////////////////////////////////////////////////////////////////////////////
indentation

#ifndef MY_DEBUG
#define MY_DEBUG 1
#endif

#if !defined ( __CSIRM2HUB_H__ )
#include "CsIRM2Hub.hmbox
#endif

#if !defined ( __CSIHTEST__ )
#include "CsIHTest.hmbox
#endif

#if !defined ( __CSATTRVALL_H__ )
#include "CsAttrValL.hmbox
#endif

#if !defined ( __CSATTRVALDEF_H__ )
#include "CsAttrValDef.hmbox
#endif

#if !defined ( __CSATTRDESC_H__ )
#include "CsAttrDesc.hmbox
#endif

#if !defined ( __CSDEBUG_H__ )
#include "CsDebug.hmbox
#endif

unsigned long CsIHBase::debug_flags = CsDebug::ALL_ON;

///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION
//
//    CsIHTest::CsIHTest()
//
// SYNOPSIS
//
//    CsIHTest( CsMTypeHandle& in_m_t_handle)
//      : CsIHBase(in_m_t_handle)
//
// DESCRIPTION
//
//      This is the constructor for CsIHTest. It will verify that the
//      model type to which CsIHTest is attached contains the DeviceCRC
//      attribute. It will register to receive attribute changes for DeviceCRC.
//
//////////////////////////////////////////////////////////////////////////////
indentation

CsIHTest::CsIHTest( CsMTypeHandle& in_m_t_handle )
: CsIHBase ( in_m_t_handle )
{
tout( "CsIHTest::CsIHTest() m_t_handle=("$\ll$ hex $\ll$ in_m_t_handle $\ll$ dec $\ll$ ") constructor activated." $\ll$ endl );

CsVnmMTypeHandle $\ast$vmth = new CsVnmMTypeHandle( in_m_t_handle );

// Verify that the model type contains the attribute DeviceCRC.


if ( ! vmth$\rightarrow$has_attr ( CsIRM2Hub::DeviceCRC ))
{
eout( "No such attribute: DeviceCRC" $\ll$ endl );
set_error( CsError::FAILURE );
}
else
{
// Register to receive changes in DeviceCRC


if (!reg_attr_change( CsIRM2Hub::DeviceCRC ))
{
eout( "Couldn't register for changes in DeviceCRC." $\ll$ endl);
eout( _t_handle = " $\ll$ hex $\ll$ m_t_handle $\ll$ dec $\ll$ endl );
set_error( CsError::FAILURE );
return;
}
else
{
tout( "Registered for CsIRM2Hub::DeviceCRC change" $\ll$ endl);
}
}
tout( "CsIHTest::CsIHTest() ending." $\ll$ endl);
}

///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION
//
//    CsIHTest::trig_attr_change()
//
// SYNOPSIS
//
//    trig_attr_change( const CsModelHandle& mh,
//                      const CsChangeNode * change )
//
// DESCRIPTION
//
//    This method will receive changes in DeviceCRC.
//
// RETURNS
//
//      void
//
// ERRORS
//
//      none
//
// CAVEATS
//
//      none
//
//
// SEE ALSO
//
///////////////////////////////////////////////////////////////////////////////

indentation

void CsIHTest::trig_attr_change( const CsModelHandle& mh,
const CsChangeNode $\ast$ change )
{
tout("CsIHTest::trig_attr_change() mh=("$\ll$ hex $\ll$ mh $\ll$ dec $\ll$ ") activated." $\ll$ endl );

int errors = $\ast$ (int $\ast$)(change$\rightarrow$get_cur_value());
int prev_errors = $\ast$ (int $\ast$)(change$\rightarrow$get_prev_value());

// if DeviceCRC has not changed, do nothing


if (errors $\neq$ prev_errors)
{
switch( change$\rightarrow$get_attr_id())
{
case CsIRM2Hub::DeviceCRC:
{
iout("CsIHTest:trig_attr_change() mh=(" $\ll$ hex $\ll$ mh $\ll$ dec $\ll$ ") Errors changed from "$\ll$ prev_errors $\ll$ " $\ll$ errors $\ll$ endl);

break;
}

default:
{
eout( "Model with mh=(" $\ll$ hex $\ll$ mh $\ll$ dec $\ll$
") is only registered for DeviceCRC " $\ll$ endl );
}
}
}
tout( "CsIHTest::trig_attr_change() ending." $\ll$ endl );
}

next up previous contents
Next: Liste der verwendeten Abkürzungen Up: Inference Handler Programmierbeispiel Previous: CsIHTest.h
Copyright Munich Network Management Team