Next: Liste der verwendeten Abkürzungen
Up: Inference Handler Programmierbeispiel
Previous: CsIHTest.h
///////////////////////////////////////////////////////////////////////////////
//
// 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=("
hex

in_m_t_handle

dec
") constructor activated." 
endl );
CsVnmMTypeHandle

vmth =
new CsVnmMTypeHandle( in_m_t_handle );
//
Verify that the model type contains the attribute DeviceCRC.
if ( ! vmth

has_attr ( CsIRM2Hub::DeviceCRC ))
{
eout(
"No such attribute: DeviceCRC" 
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." 
endl);
eout( _t_handle = "

hex

m_t_handle

dec

endl );
set_error( CsError::FAILURE );
return;
}
else
{
tout(
"Registered for CsIRM2Hub::DeviceCRC change" 
endl);
}
}
tout(
"CsIHTest::CsIHTest() ending." 
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

change )
{
tout(
"CsIHTest::trig_attr_change() mh=("
hex

mh

dec
") activated." 
endl );
int errors =

(
int 
)(change

get_cur_value());
int prev_errors =

(
int 
)(change

get_prev_value());
//
if DeviceCRC has not changed, do nothing
if (errors

prev_errors)
{
switch( change

get_attr_id())
{
case CsIRM2Hub::DeviceCRC:
{
iout(
"CsIHTest:trig_attr_change() mh=(" 
hex

mh

dec
") Errors changed from "
prev_errors

"

errors

endl);
break;
}
default:
{
eout(
"Model with mh=(" 
hex

mh

dec
") is only registered for DeviceCRC " 
endl );
}
}
}
tout(
"CsIHTest::trig_attr_change() ending." 
endl );
}
Next: Liste der verwendeten Abkürzungen
Up: Inference Handler Programmierbeispiel
Previous: CsIHTest.h
Copyright Munich Network Management Team