diff --git a/src/the_dude_to_human/database/dude_field_parser.cpp b/src/the_dude_to_human/database/dude_field_parser.cpp index 2e1c909..246eac4 100644 --- a/src/the_dude_to_human/database/dude_field_parser.cpp +++ b/src/the_dude_to_human/database/dude_field_parser.cpp @@ -201,7 +201,20 @@ ParserResult DudeFieldParser::ReadField(ByteField& field, FieldId id) { return result; } - if (field.info.type.Value() != FieldType::Byte) { + switch (field.info.type) { + case FieldType::Byte: + break; + case FieldType::Int: + printf("Warning attempted to read byte on int field: %s\n", + field.info.SerializeJson().c_str()); + RestoreOffset(); + return ParserResult::FieldTypeMismatch; + case FieldType::Long: + printf("Warning attempted to read byte on long field: %s\n", + field.info.SerializeJson().c_str()); + RestoreOffset(); + return ParserResult::FieldTypeMismatch; + default: RestoreOffset(); return ParserResult::FieldTypeMismatch; } @@ -219,6 +232,10 @@ ParserResult DudeFieldParser::ReadField(IntField& field, FieldId id) { case FieldType::Int: case FieldType::Byte: break; + case FieldType::Long: + printf("Warning attempted to read int on long field: %s\n", + field.info.SerializeJson().c_str()); + return ParserResult::FieldTypeMismatch; default: RestoreOffset(); return ParserResult::FieldTypeMismatch; diff --git a/src/the_dude_to_human/database/dude_types.h b/src/the_dude_to_human/database/dude_types.h index c139489..78f7496 100644 --- a/src/the_dude_to_human/database/dude_types.h +++ b/src/the_dude_to_human/database/dude_types.h @@ -272,14 +272,14 @@ struct ServerConfigData : DudeObj { IntField object_id; ByteField version; IntField snmp_profile_id; - ByteField agent_id; - ByteField probe_interval; - ByteField probe_timeout; - ByteField probe_down_count; + IntField agent_id; + IntField probe_interval; + IntField probe_timeout; + IntField probe_down_count; IntField syslog_port; - ByteField snmp_trap_port; + IntField snmp_trap_port; IntField map_background_color; - ByteField map_label_refresh_interval; + IntField map_label_refresh_interval; IntField map_up_color; IntField map_down_partial_color; IntField map_down_complete_color; @@ -747,15 +747,15 @@ struct DeviceData : DudeObj { BoolField notify_use; BoolField prove_enabled; ByteField lookup; - ByteField dns_lookup_interval; + IntField dns_lookup_interval; ByteField mac_lookup; IntField type_id; IntField agent_id; IntField snmp_profile_id; IntField object_id; IntField prove_interval; - ByteField prove_timeout; - ByteField prove_down_count; + IntField prove_timeout; + IntField prove_down_count; TextField custom_field_3; TextField custom_field_2; TextField custom_field_1; @@ -810,9 +810,9 @@ struct ServiceData : DudeObj { BoolField notify_use; BoolField acked; IntField probe_port; - ByteField probe_interval; - ByteField probe_timeout; - ByteField probe_down_count; + IntField probe_interval; + IntField probe_timeout; + IntField probe_down_count; IntField data_source_id; ByteField status; IntField time_since_changed; @@ -820,7 +820,7 @@ struct ServiceData : DudeObj { IntField time_since_last_down; IntField time_previous_up; IntField time_previous_down; - ByteField proves_down; + IntField proves_down; IntField object_id; IntField device_id; IntField agent_id; @@ -864,8 +864,8 @@ struct NotificationData : DudeObj { IntField log_color; ByteField speak_rate; ByteField speak_volume; - ByteField delay_interval; - ByteField repeat_interval; + IntField delay_interval; + IntField repeat_interval; ByteField repeat_count; IntField object_id; IntField rype_id; @@ -960,13 +960,13 @@ struct LinkTypeData : DudeObj { struct DataSourceData : DudeObj { BoolField enabled; IntField function_device_id; - ByteField function_interval; + IntField function_interval; ByteField data_source_type; IntField object_id; - ByteField keep_time_raw; - ByteField keep_time_10min; - ByteField keep_time_2hour; - ByteField keep_time_1Day; + IntField keep_time_raw; + IntField keep_time_10min; + IntField keep_time_2hour; + IntField keep_time_1Day; TextField function_code; TextField unit; TextField name;