static void dissect_UDPInitAck(tvbuff_t *tvb, proto_tree *adwin_tree) { if (! adwin_tree) return; ADWIN_ADD_BE(adwin_tree, pattern, 0, 4); ADWIN_ADD_LE(adwin_tree, reboot, 4, 4); ADWIN_ADD_BE(adwin_tree, mac, 8, 6); ADWIN_ADD_LE(adwin_tree, unused, 14, 2); ADWIN_ADD_LE(adwin_tree, unused, 16, 80); }
static void dissect_UDPOut(tvbuff_t *tvb, proto_tree *adwin_tree) { if (! adwin_tree) return; ADWIN_ADD_LE(adwin_tree, status, 0, 4); ADWIN_ADD_BE(adwin_tree, mac, 4, 6); ADWIN_ADD_LE(adwin_tree, netmask, 10, 4); ADWIN_ADD_BE(adwin_tree, gateway, 14, 4); ADWIN_ADD_LE(adwin_tree, dhcp, 18, 2); ADWIN_ADD_BE(adwin_tree, port16, 20, 2); }
static void dissect_UDPR1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *adwin_tree, proto_tree *adwin_debug_tree, gchar** info_string) { const gchar *status_string; guint32 seq_num, status; status = tvb_get_letohl(tvb, 0); status_string = match_strval_ext(status, &error_code_mapping_ext); if (status_string) { *info_string = ep_strdup_printf("UDPR1 Status: %s", status_string); } else { *info_string = ep_strdup_printf("UDPR1 Undefined error code %d", status); } /* Get the transaction identifier */ seq_num = tvb_get_letohl(tvb, 4); adwin_request_response_handling(tvb, pinfo, adwin_tree, seq_num, ADWIN_RESPONSE); if (! adwin_tree) return; SET_PACKET_TYPE(adwin_tree, APT_UDPR1); ADWIN_ADD_LE(adwin_tree, status, 0, 4); ADWIN_ADD_LE(adwin_tree, packet_index, 4, 4); ADWIN_ADD_LE(adwin_tree, val1, 8, 4); ADWIN_ADD_LE(adwin_tree, val1f, 8, 4); ADWIN_ADD_LE(adwin_tree, val2, 12, 4); ADWIN_ADD_LE(adwin_tree, val3, 16, 4); ADWIN_ADD_LE(adwin_tree, val4, 20, 4); ADWIN_ADD_LE(adwin_debug_tree, unused, 24, 8); }
static void dissect_UDPR2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *adwin_tree, proto_tree *adwin_debug_tree, gchar** info_string) { const gchar *status_string; guint32 i, status, seq_num; status = tvb_get_letohl(tvb, 0); status_string = match_strval_ext(status, &error_code_mapping_ext); if (status_string) { *info_string = ep_strdup_printf("UDPR2 Status: %s", status_string); } else { *info_string = ep_strdup_printf("UDPR2 Undefined error code %d", status); } /* Get the transaction identifier */ seq_num = tvb_get_letohl(tvb, 4); adwin_request_response_handling(tvb, pinfo, adwin_tree, seq_num, ADWIN_RESPONSE); if (! adwin_tree) return; SET_PACKET_TYPE(adwin_tree, APT_UDPR2); ADWIN_ADD_LE(adwin_tree, status, 0, 4); ADWIN_ADD_LE(adwin_tree, packet_index, 4, 4); if (! global_adwin_dissect_data) { proto_tree_add_text(adwin_debug_tree, tvb, 8, 250 * 4, "Data"); return; } for (i = 0; i < 250; i++) { proto_item *item; guint32 offset = 8 + i * sizeof(guint32); gint32 value = tvb_get_letohl(tvb, offset); void * fvalue = &value; proto_tree_add_text(adwin_debug_tree, tvb, offset, 4, "Data[%3d]: %10d - %10f - 0x%08x", i, value, *(float*)fvalue, value); item = ADWIN_ADD_LE(adwin_debug_tree, data_int, offset, 4); PROTO_ITEM_SET_HIDDEN(item); item = ADWIN_ADD_LE(adwin_debug_tree, data_float, offset, 4); PROTO_ITEM_SET_HIDDEN(item); item = ADWIN_ADD_LE(adwin_debug_tree, data_hex, offset, 4); PROTO_ITEM_SET_HIDDEN(item); } }
static void dissect_UDPExtStatus(tvbuff_t *tvb, proto_tree *adwin_tree) { const gchar *processor_type, *system_type; if (! adwin_tree) return; ADWIN_ADD_BE(adwin_tree, mac, 0, 6); ADWIN_ADD_LE(adwin_tree, unused, 6, 2); ADWIN_ADD_BE(adwin_tree, pattern, 8, 4); ADWIN_ADD_BE(adwin_tree, version, 12, 4); ADWIN_ADD_LE(adwin_tree, description, 16, 16); ADWIN_ADD_BE(adwin_tree, timerresets, 32, 4); ADWIN_ADD_BE(adwin_tree, socketshutdowns, 36, 4); ADWIN_ADD_BE(adwin_tree, disk_free, 40, 4); ADWIN_ADD_BE(adwin_tree, disk_size, 44, 4); ADWIN_ADD_LE(adwin_tree, date, 48, 8); ADWIN_ADD_LE(adwin_tree, revision, 56, 8); /* add the processor type raw values to the tree, to allow filtering */ ADWIN_ADD_LE(adwin_tree, processor_type, 64, 2); /* add the processor type as a pretty printed string */ processor_type = tvb_get_ephemeral_string(tvb, 64, 2); processor_type = str_to_str(processor_type, processor_type_mapping, "Unknown (%s)"); proto_tree_add_text(adwin_tree, tvb, 64, 2, "Processor Type: %s", processor_type); /* add system type as raw value and pretty printed string */ ADWIN_ADD_LE(adwin_tree, system_type, 66, 2); system_type = tvb_get_ephemeral_string(tvb, 66, 2); system_type = str_to_str(system_type, system_type_mapping, "Unknown (%s)"); proto_tree_add_text(adwin_tree, tvb, 66, 2, "System Type: %s", system_type); ADWIN_ADD_LE(adwin_tree, unused, 68,364); }
static void dissect_GDSHP(tvbuff_t *tvb, packet_info *pinfo, proto_tree *adwin_tree, proto_tree *adwin_debug_tree) { guint32 i, seq_num; /* Get the transaction identifier */ seq_num = tvb_get_ntohl(tvb, 0); adwin_request_response_handling(tvb, pinfo, adwin_tree, seq_num, ADWIN_RESPONSE); if (! adwin_tree) return; SET_PACKET_TYPE(adwin_tree, APT_GDSHP); ADWIN_ADD_BE(adwin_tree, packet_index, 0, 4); ADWIN_ADD_BE(adwin_tree, packet_no, 4, 4); ADWIN_ADD_BE(adwin_tree, unused, 8, 4); if (! global_adwin_dissect_data) { proto_tree_add_text(adwin_debug_tree, tvb, 12, 336 * 4, "Data"); return; } for (i = 0; i < 336; i++) { proto_item *item; guint32 offset = 12 + i * sizeof(guint32); gint32 value = tvb_get_letohl(tvb, offset); void * fvalue = &value; proto_tree_add_text(adwin_debug_tree, tvb, offset, 4, "Data[%3d]: %10d - %10f - 0x%08x", i, value, *(float*)fvalue, value); item = ADWIN_ADD_LE(adwin_debug_tree, data_int, offset, 4); PROTO_ITEM_SET_HIDDEN(item); item = ADWIN_ADD_LE(adwin_debug_tree, data_float, offset, 4); PROTO_ITEM_SET_HIDDEN(item); item = ADWIN_ADD_LE(adwin_debug_tree, data_hex, offset, 4); PROTO_ITEM_SET_HIDDEN(item); } }
static void dissect_UDPStatus(tvbuff_t *tvb, proto_tree *adwin_tree) { proto_tree *status_tree; proto_tree *debug_tree; proto_item *st, *dt; if (! adwin_tree) return; dt = proto_tree_add_item(adwin_tree, proto_adwin_config, tvb, 0, -1, ENC_NA); debug_tree = proto_item_add_subtree(dt, ett_adwin_config_debug); proto_item_set_text(dt, "ADwin Debug information"); ADWIN_ADD_BE(adwin_tree, pattern, 0, 4); ADWIN_ADD_BE(adwin_tree, version, 4, 4); st = ADWIN_ADD_BE(adwin_tree, status, 8, 4); status_tree = proto_item_add_subtree(st, ett_adwin_config_status); ADWIN_ADD_BE(status_tree, status_bootloader, 8, 4); ADWIN_ADD_BE(status_tree, status_reprogrammable, 8, 4); ADWIN_ADD_BE(status_tree, status_configurable, 8, 4); ADWIN_ADD_BE(status_tree, status_bootloader_boots, 8, 4); ADWIN_ADD_BE(status_tree, status_bootloader_reprogrammable,8, 4); ADWIN_ADD_BE(status_tree, status_bootloader_receive, 8, 4); ADWIN_ADD_BE(status_tree, status_bootloader_reprogramming_done, 8, 4); ADWIN_ADD_BE(status_tree, status_eeprom_support, 8, 4); ADWIN_ADD_BE(adwin_tree, server_version_beta,12, 2); ADWIN_ADD_BE(adwin_tree, server_version, 14, 2); ADWIN_ADD_BE(adwin_tree, xilinx_version, 16, 4); ADWIN_ADD_BE(adwin_tree, mac, 20, 6); ADWIN_ADD_LE(debug_tree, unused, 26, 2); ADWIN_ADD_BE(adwin_tree, port16, 28, 2); ADWIN_ADD_LE(adwin_tree, dhcp, 30, 1); ADWIN_ADD_LE(adwin_tree, netmask_count, 31, 1); ADWIN_ADD_BE(adwin_tree, gateway, 32, 4); ADWIN_ADD_LE(debug_tree, unused, 36, 11); ADWIN_ADD_LE(adwin_tree, reply_broadcast, 47, 1); ADWIN_ADD_LE(adwin_tree, scan_id, 48, 4); }
static void dissect_UDPMessage(tvbuff_t *tvb, proto_tree *adwin_tree) { const gchar *processor_type, *system_type; if (! adwin_tree) return; ADWIN_ADD_LE(adwin_tree, command, 0, 4); ADWIN_ADD_LE(adwin_tree, version, 4, 4); ADWIN_ADD_LE(adwin_tree, mac, 8, 6); ADWIN_ADD_LE(adwin_tree, unused, 14, 2); ADWIN_ADD_LE(adwin_tree, server_ip, 16, 4); ADWIN_ADD_LE(adwin_tree, unused, 20, 4); ADWIN_ADD_LE(adwin_tree, netmask, 24, 4); ADWIN_ADD_LE(adwin_tree, unused, 28, 4); ADWIN_ADD_LE(adwin_tree, gateway, 32, 4); ADWIN_ADD_LE(adwin_tree, unused, 36, 4); ADWIN_ADD_LE(adwin_tree, dhcp, 40, 4); ADWIN_ADD_LE(adwin_tree, port32, 44, 4); ADWIN_ADD_LE(adwin_tree, password, 48, 10); ADWIN_ADD_LE(adwin_tree, bootloader, 58, 1); ADWIN_ADD_LE(adwin_tree, unused, 59, 5); ADWIN_ADD_LE(adwin_tree, description, 64, 16); ADWIN_ADD_LE(adwin_tree, date, 80, 8); ADWIN_ADD_LE(adwin_tree, revision, 88, 8); /* add the processor type raw values to the tree, to allow filtering */ ADWIN_ADD_LE(adwin_tree, processor_type, 96, 2); /* add the processor type as a pretty printed string */ processor_type = tvb_get_ephemeral_string(tvb, 96, 2); processor_type = str_to_str(processor_type, processor_type_mapping, "Unknown"); proto_tree_add_text(adwin_tree, tvb, 96, 2, "Processor Type: %s", processor_type); /* add system type as raw value and pretty printed string */ ADWIN_ADD_LE(adwin_tree, system_type, 98, 2); system_type = tvb_get_ephemeral_string(tvb, 98, 2); system_type = str_to_str(system_type, system_type_mapping, "Unknown"); proto_tree_add_text(adwin_tree, tvb, 98, 2, "System Type: %s", system_type); }
static void dissect_UDPR4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *adwin_tree, proto_tree *adwin_debug_tree, gchar** info_string) { const gchar *status_string; guint32 data_type, i, status, seq_num; status = tvb_get_letohl(tvb, 0); status_string = match_strval_ext(status, &error_code_mapping_ext); if (status_string) { *info_string = ep_strdup_printf("UDPR4 Status: %s", status_string); } else { *info_string = ep_strdup_printf("UDPR4 Undefined error code %d", status); } /* Get the transaction identifier */ seq_num = tvb_get_letohl(tvb, 4); adwin_request_response_handling(tvb, pinfo, adwin_tree, seq_num, ADWIN_RESPONSE); if (! adwin_tree) return; SET_PACKET_TYPE(adwin_tree, APT_UDPR4); ADWIN_ADD_LE(adwin_tree, status, 0, 4); ADWIN_ADD_LE(adwin_tree, packet_index, 4, 4); ADWIN_ADD_LE(adwin_tree, packet_no, 1408, 4); ADWIN_ADD_LE(adwin_tree, data_type, 1412, 4); data_type = tvb_get_letohl(tvb, 1412); if (! global_adwin_dissect_data) { proto_tree_add_text(adwin_debug_tree, tvb, 8, 350 * 4, "Data"); return; } for (i = 0; i < 350; i++) { proto_item *item; guint32 offset = 8 + i * sizeof(guint32); gint32 value = tvb_get_letohl(tvb, offset); void * fvalue = &value; switch (data_type) { case 2: case 3: case 4: /* some kind of int, usually int/long */ proto_tree_add_text(adwin_debug_tree, tvb, offset, 4, "Data[%3d]: %10d - 0x%08x", i, value, value); item = ADWIN_ADD_LE(adwin_debug_tree, data_int, offset, 4); PROTO_ITEM_SET_HIDDEN(item); item = ADWIN_ADD_LE(adwin_debug_tree, data_hex, offset, 4); PROTO_ITEM_SET_HIDDEN(item); break; case 5: /* float */ proto_tree_add_text(adwin_debug_tree, tvb, offset, 4, "Data[%3d]: %10f - 0x%08x", i, *(float*)fvalue, value); item = ADWIN_ADD_LE(adwin_debug_tree, data_float, offset, 4); PROTO_ITEM_SET_HIDDEN(item); item = ADWIN_ADD_LE(adwin_debug_tree, data_hex, offset, 4); PROTO_ITEM_SET_HIDDEN(item); break; default: /* string, double, variant, something funny... */ proto_tree_add_text(adwin_debug_tree, tvb, offset, 4, "Data[%3d]: 0x%08x", i, value); item = ADWIN_ADD_LE(adwin_debug_tree, data_hex, offset, 4); PROTO_ITEM_SET_HIDDEN(item); } } }
static void dissect_UDPH1_generic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *adwin_tree, proto_tree *adwin_debug_tree, gchar** info_string, const gchar* packet_name) { guint32 i3plus1code = 0, instructionID, seq_num; instructionID = tvb_get_letohl(tvb, 0); *info_string = ep_strdup_printf("%s: %s", packet_name, val_to_str_ext(instructionID, &instruction_mapping_ext, "unknown instruction: %d")); if (instructionID == I_3PLUS1) { gchar *tmp = *info_string; i3plus1code = tvb_get_letohl(tvb, 20); *info_string = ep_strdup_printf("%s: %s", tmp, val_to_str_ext(i3plus1code, &instruction_3plus1_mapping_ext, "unknown 3+1 code: %d")); } /* Get the transaction identifier */ seq_num = tvb_get_letohl(tvb, 4); adwin_request_response_handling(tvb, pinfo, adwin_tree, seq_num, ADWIN_REQUEST); if (! adwin_tree) return; SET_PACKET_TYPE(adwin_tree, APT_UDPH1_old); ADWIN_ADD_LE(adwin_tree, instruction, 0, 4); ADWIN_ADD_LE(adwin_tree, packet_index, 4, 4); ADWIN_ADD_BE(adwin_tree, password, 8, 10); ADWIN_ADD_LE(adwin_debug_tree, unused, 18, 2); switch(instructionID) { case I_3PLUS1: ADWIN_ADD_LE(adwin_tree, i3plus1, 20, 4); switch (i3plus1code) { case I_3P1_SET_PAR: ADWIN_ADD_LE(adwin_tree, parameter, 24, 4); ADWIN_ADD_LE(adwin_tree, val1, 28, 4); ADWIN_ADD_LE(adwin_tree, val1f, 28, 4); ADWIN_ADD_LE(adwin_debug_tree, unused, 32, 4); break; case I_3P1_GET_PAR: ADWIN_ADD_LE(adwin_tree, parameter, 24, 4); ADWIN_ADD_LE(adwin_debug_tree, unused, 28, 8); break; case I_3P1_GET_MEMORY_INFO: case I_3P1_GET_DETAILED_MEM_INFO: ADWIN_ADD_LE(adwin_tree, mem_type, 24, 4); ADWIN_ADD_LE(adwin_debug_tree, unused, 28, 8); break; case I_3P1_START: case I_3P1_STOP: case I_3P1_CLEAR_PROCESS: ADWIN_ADD_LE(adwin_tree, process_no, 24, 4); ADWIN_ADD_LE(adwin_debug_tree, unused, 28, 8); break; case I_3P1_GET_DATA_LENGTH: ADWIN_ADD_LE(adwin_tree, data_no32, 24, 4); ADWIN_ADD_LE(adwin_debug_tree, unused, 28, 8); break; case I_3P1_CLEAR_FIFO: case I_3P1_GET_FIFO_EMPTY: case I_3P1_GET_FIFO_COUNT: ADWIN_ADD_LE(adwin_tree, fifo_no32, 24, 4); ADWIN_ADD_LE(adwin_debug_tree, unused, 28, 8); break; default: ; /* should not happen */ /* illegal values should be displayed properly by 3plus1_mapping */ } break; case I_BOOT: ADWIN_ADD_LE(adwin_tree, memsize, 20, 4); ADWIN_ADD_LE(adwin_tree, blocksize, 24, 2); ADWIN_ADD_LE(adwin_debug_tree, unused, 26, 2); ADWIN_ADD_LE(adwin_tree, processor, 28, 4); ADWIN_ADD_LE(adwin_tree, binfilesize, 32, 4); break; case I_LOAD_BIN_FILE: ADWIN_ADD_LE(adwin_debug_tree, unused, 20, 6); ADWIN_ADD_LE(adwin_tree, blocksize, 26, 2); ADWIN_ADD_LE(adwin_tree, processor, 28, 4); ADWIN_ADD_LE(adwin_tree, binfilesize, 32, 4); break; case I_GET_WORKLOAD: ADWIN_ADD_LE(adwin_tree, instruction, 20, 4); ADWIN_ADD_LE(adwin_debug_tree, unused, 24, 12); break; case I_GET_DATA_TYPE: ADWIN_ADD_LE(adwin_debug_tree, unused, 20, 4); ADWIN_ADD_LE(adwin_tree, data_no32, 24, 4); ADWIN_ADD_LE(adwin_tree, start_index, 28, 4); ADWIN_ADD_LE(adwin_debug_tree, unused, 32, 4); break; case I_GET_DATA: case I_SET_DATA: ADWIN_ADD_LE(adwin_tree, data_type, 20, 4); ADWIN_ADD_LE(adwin_tree, data_no16, 24, 2); ADWIN_ADD_LE(adwin_tree, blocksize, 26, 2); ADWIN_ADD_LE(adwin_tree, start_index, 28, 4); ADWIN_ADD_LE(adwin_tree, count, 32, 4); break; case I_GET_DATA_SHIFTED_HANDSHAKE: ADWIN_ADD_BE(adwin_tree, data_no16, 20, 2); ADWIN_ADD_BE(adwin_tree, blocksize, 22, 2); ADWIN_ADD_BE(adwin_tree, start_index, 24, 4); ADWIN_ADD_BE(adwin_tree, count, 28, 4); ADWIN_ADD_BE(adwin_debug_tree, unused, 32, 4); break; case I_GET_DATA_SMALL: ADWIN_ADD_LE(adwin_debug_tree, unused, 20, 4); ADWIN_ADD_LE(adwin_tree, data_no16, 24, 2); ADWIN_ADD_LE(adwin_debug_tree, unused, 26, 2); ADWIN_ADD_LE(adwin_tree, start_index, 28, 4); ADWIN_ADD_LE(adwin_tree, count, 32, 4); break; case I_GET_PAR_ALL: ADWIN_ADD_LE(adwin_tree, start_index, 20, 4); ADWIN_ADD_LE(adwin_tree, count, 24, 4); ADWIN_ADD_LE(adwin_debug_tree, unused, 28, 8); break; case I_SET_DATA_LAST_STATUS: ADWIN_ADD_LE(adwin_tree, data_packet_index, 20, 4); ADWIN_ADD_LE(adwin_debug_tree, unused, 24, 12); break; case I_GET_ARM_VERSION: ADWIN_ADD_LE(adwin_tree, armVersion, 20, 4); ADWIN_ADD_LE(adwin_debug_tree, unused,24, 12); break; case I_GET_FIFO: case I_SET_FIFO: ADWIN_ADD_LE(adwin_tree, data_type, 20, 4); ADWIN_ADD_LE(adwin_tree, fifo_no16, 24, 2); ADWIN_ADD_LE(adwin_debug_tree, unused, 26, 6); ADWIN_ADD_LE(adwin_tree, count, 32, 4); break; case I_GET_FIFO_RETRY: case I_SET_FIFO_RETRY: ADWIN_ADD_LE(adwin_tree, data_type, 20, 4); ADWIN_ADD_LE(adwin_tree, fifo_no16, 24, 2); ADWIN_ADD_LE(adwin_debug_tree, unused, 26, 2); ADWIN_ADD_LE(adwin_tree, retry_packet_index, 28, 4); ADWIN_ADD_LE(adwin_tree, count, 32, 4); break; case I_TEST_VERSION: ADWIN_ADD_LE(adwin_debug_tree, unused, 20, 16); break; case I_GET_MEMORY: ADWIN_ADD_LE(adwin_tree, address, 20, 4); ADWIN_ADD_LE(adwin_tree, count, 24, 4); ADWIN_ADD_LE(adwin_debug_tree, unused, 28, 8); break; default: ; /* should not happen */ /* illegal values should be displayed properly by instruction_mapping */ } ADWIN_ADD_LE(adwin_debug_tree, link_addr,36, 4); ADWIN_ADD_LE(adwin_tree, timeout, 40, 4); ADWIN_ADD_LE(adwin_debug_tree, osys, 44, 4); ADWIN_ADD_LE(adwin_debug_tree, unused, 48, 4); }