Download Restrained re-engineering

Transcript
excerpt - event code verification, from file hcsim_callback.c)
hcsim_callback_event_t get_hcsim_callback_event_code(
hcsim_callback_event_t val) {
hcsim_callback_event_t code = val & HCSIM_EVENT_SIDE_CHARLES ?
val & callback_event_mask_charles: val & callback_event_mask_diana;
if((code&HCSIM_EVENT_CLASS_MASK) && (code&HCSIM_EVENT_TYPE_MASK)) {
return code;
}
return 0;
}
Functions to get and set the event callback mask for each side were added to
hcsim_callback_interface.h. The addition of functions therein that allow the HC-Sim
GUI side to get and set the event callback masks does violate the relationship described in
Figure 13, as it is now not only the HC-Sim side which gets to invoke functions of the
callback interface. But what we have done is merely to include part of the HC-Sim control
interface abstraction in the callback interface, and as HC-Sim still implements the control
interface functionality we still maintain the most important aspect of the relationship. The
function declarations could of course just as well be put hcsim_main.h, which would be
more in line with our policy, but make less sense since the functions are more related to
the callback functions than to the control of HC-Sim in general.
The user of the program sets the event callback mask values via the preferences dialog of
HC-Sim GUI before or during a simulation, by simply choosing what events are the most
interesting in the current simulation (see Figure 40). Disabling an event category turns off
callbacks for all events related to that category. Note that the event categories and basic
event types are always the same regardless of what compression scheme is used, but that
some events only apply when using a specific type of compression. In this case, because
sending and receiving header requests can be applied, we are clearly using IPHC or CRTP
compression.
55