flag = {}
op = {}
tag = {}
detail = {}
search = {}
value = {}
prefs = {}
flag['base'] = 0x20
protocol_version = 0x0204
flag['zlib'] = 0x00000001
flag['utf8_numbers'] = 0x00000002
flag['unknown_mask'] = 0xff7f7f08
op['noop'] = 0x01
op['auth_req'] = 0x02
op['auth_fail'] = 0x03
op['auth_ok'] = 0x04
op['failed'] = 0x05
op['strings'] = 0x06
op['misc_data'] = 0x07
op['shutdown'] = 0x08
op['add_link'] = 0x09
op['stat_req'] = 0x0A
op['get_connstate'] = 0x0B
op['stats'] = 0x0C
op['get_dload_queue'] = 0x0D
op['get_uload_queue'] = 0x0E
op['get_shared_files'] = 0x10
op['shared_set_prio'] = 0x11
op['partfile_swap_a4af_this'] = 0x16
op['partfile_swap_a4af_this_auto'] = 0x17
op['partfile_swap_a4af_others'] = 0x18
op['partfile_pause'] = 0x19
op['partfile_resume'] = 0x1A
op['partfile_stop'] = 0x1B
op['partfile_prio_set'] = 0x1C
op['partfile_delete'] = 0x1D
op['partfile_set_cat'] = 0x1E
op['dload_queue'] = 0x1F
op['uload_queue'] = 0x20
op['shared_files'] = 0x22
op['sharedfiles_reload'] = 0x23
op['rename_file'] = 0x25
op['search_start'] = 0x26
op['search_stop'] = 0x27
op['search_results'] = 0x28
op['search_progress'] = 0x29
op['download_search_result'] = 0x2A
op['ipfilter_reload'] = 0x2B
op['get_server_list'] = 0x2C
op['server_list'] = 0x2D
op['server_disconnect'] = 0x2E
op['server_connect'] = 0x2F
op['server_remove'] = 0x30
op['server_add'] = 0x31
op['server_update_from_url'] = 0x32
op['addlogline'] = 0x33
op['adddebuglogline'] = 0x34
op['get_log'] = 0x35
op['get_debuglog'] = 0x36
op['get_serverinfo'] = 0x37
op['log'] = 0x38
op['debuglog'] = 0x39
op['serverinfo'] = 0x3A
op['reset_log'] = 0x3B
op['reset_debuglog'] = 0x3C
op['clear_serverinfo'] = 0x3D
op['get_last_log_entry'] = 0x3E
op['get_preferences'] = 0x3F
op['set_preferences'] = 0x40
op['create_category'] = 0x41
op['update_category'] = 0x42
op['delete_category'] = 0x43
op['get_statsgraphs'] = 0x44
op['statsgraphs'] = 0x45
op['get_statstree'] = 0x46
op['statstree'] = 0x47
op['kad_start'] = 0x48
op['kad_stop'] = 0x49
op['connect'] = 0x4A
op['disconnect'] = 0x4B
op['kad_update_from_url'] = 0x4D
op['kad_bootstrap_from_ip'] = 0x4E
op['auth_salt'] = 0x4F
op['auth_passwd'] = 0x50
op['ipfilter_update'] = 0x51
op['get_update'] = 0x52
op['clear_completed'] = 0x53
op['client_swap_to_another_file'] = 0x54
op['shared_file_set_comment'] = 0x55
op['server_set_static_prio'] = 0x56
op['friend'] = 0x57
tag['string'] = 0x0000
tag['passwd_hash'] = 0x0001
tag['protocol_version'] = 0x0002
tag['version_id'] = 0x0003
tag['detail_level'] = 0x0004
tag['connstate'] = 0x0005
tag['ed2k_id'] = 0x0006
tag['log_to_status'] = 0x0007
tag['bootstrap_ip'] = 0x0008
tag['bootstrap_port'] = 0x0009
tag['client_id'] = 0x000A
tag['passwd_salt'] = 0x000B
tag['can_zlib'] = 0x000C
tag['can_utf8_numbers'] = 0x000D
tag['can_notify'] = 0x000E
tag['ecid'] = 0x000F
tag['kad_id'] = 0x0010
tag['client_name'] = 0x0100
tag['client_version'] = 0x0101
tag['client_mod'] = 0x0102
tag['stats_ul_speed'] = 0x0200
tag['stats_dl_speed'] = 0x0201
tag['stats_ul_speed_limit'] = 0x0202
tag['stats_dl_speed_limit'] = 0x0203
tag['stats_up_overhead'] = 0x0204
tag['stats_down_overhead'] = 0x0205
tag['stats_total_src_count'] = 0x0206
tag['stats_banned_count'] = 0x0207
tag['stats_ul_queue_len'] = 0x0208
tag['stats_ed2k_users'] = 0x0209
tag['stats_kad_users'] = 0x020A
tag['stats_ed2k_files'] = 0x020B
tag['stats_kad_files'] = 0x020C
tag['stats_logger_message'] = 0x020D
tag['stats_kad_firewalled_udp'] = 0x020E
tag['stats_kad_indexed_sources'] = 0x020F
tag['stats_kad_indexed_keywords'] = 0x0210
tag['stats_kad_indexed_notes'] = 0x0211
tag['stats_kad_indexed_load'] = 0x0212
tag['stats_kad_ip_adress'] = 0x0213
tag['stats_buddy_status'] = 0x0214
tag['stats_buddy_ip'] = 0x0215
tag['stats_buddy_port'] = 0x0216
tag['stats_kad_in_lan_mode'] = 0x0217
tag['stats_total_sent_bytes'] = 0x0218
tag['stats_total_received_bytes'] = 0x0219
tag['stats_shared_file_count'] = 0x021A
tag['stats_kad_nodes'] = 0x021B
tag['partfile'] = 0x0300
tag['partfile_name'] = 0x0301
tag['partfile_partmetid'] = 0x0302
tag['partfile_size_full'] = 0x0303
tag['partfile_size_xfer'] = 0x0304
tag['partfile_size_xfer_up'] = 0x0305
tag['partfile_size_done'] = 0x0306
tag['partfile_speed'] = 0x0307
tag['partfile_status'] = 0x0308
tag['partfile_prio'] = 0x0309
tag['partfile_source_count'] = 0x030A
tag['partfile_source_count_a4af'] = 0x030B
tag['partfile_source_count_not_current'] = 0x030C
tag['partfile_source_count_xfer'] = 0x030D
tag['partfile_ed2k_link'] = 0x030E
tag['partfile_cat'] = 0x030F
tag['partfile_last_recv'] = 0x0310
tag['partfile_last_seen_comp'] = 0x0311
tag['partfile_part_status'] = 0x0312
tag['partfile_gap_status'] = 0x0313
tag['partfile_req_status'] = 0x0314
tag['partfile_source_names'] = 0x0315
tag['partfile_comments'] = 0x0316
tag['partfile_stopped'] = 0x0317
tag['partfile_download_active'] = 0x0318
tag['partfile_lost_corruption'] = 0x0319
tag['partfile_gained_compression'] = 0x031A
tag['partfile_saved_ich'] = 0x031B
tag['partfile_source_names_counts'] = 0x031C
tag['partfile_available_parts'] = 0x031D
tag['partfile_hash'] = 0x031E
tag['partfile_shared'] = 0x031F
tag['partfile_hashed_part_count'] = 0x0320
tag['partfile_a4afauto'] = 0x0321
tag['partfile_a4af_sources'] = 0x0322
tag['knownfile'] = 0x0400
tag['knownfile_xferred'] = 0x0401
tag['knownfile_xferred_all'] = 0x0402
tag['knownfile_req_count'] = 0x0403
tag['knownfile_req_count_all'] = 0x0404
tag['knownfile_accept_count'] = 0x0405
tag['knownfile_accept_count_all'] = 0x0406
tag['knownfile_aich_masterhash'] = 0x0407
tag['knownfile_filename'] = 0x0408
tag['knownfile_complete_sources_low'] = 0x0409
tag['knownfile_complete_sources_high'] = 0x040A
tag['knownfile_prio'] = 0x040B
tag['knownfile_on_queue'] = 0x040C
tag['knownfile_complete_sources'] = 0x040D
tag['knownfile_comment'] = 0x040E
tag['knownfile_rating'] = 0x040F
tag['server'] = 0x0500
tag['server_name'] = 0x0501
tag['server_desc'] = 0x0502
tag['server_address'] = 0x0503
tag['server_ping'] = 0x0504
tag['server_users'] = 0x0505
tag['server_users_max'] = 0x0506
tag['server_files'] = 0x0507
tag['server_prio'] = 0x0508
tag['server_failed'] = 0x0509
tag['server_static'] = 0x050A
tag['server_version'] = 0x050B
tag['server_ip'] = 0x050C
tag['server_port'] = 0x050D
tag['client'] = 0x0600
tag['client_software'] = 0x0601
tag['client_score'] = 0x0602
tag['client_hash'] = 0x0603
tag['client_friend_slot'] = 0x0604
tag['client_wait_time'] = 0x0605
tag['client_xfer_time'] = 0x0606
tag['client_queue_time'] = 0x0607
tag['client_last_time'] = 0x0608
tag['client_upload_session'] = 0x0609
tag['client_upload_total'] = 0x060A
tag['client_download_total'] = 0x060B
tag['client_download_state'] = 0x060C
tag['client_up_speed'] = 0x060D
tag['client_down_speed'] = 0x060E
tag['client_from'] = 0x060F
tag['client_user_ip'] = 0x0610
tag['client_user_port'] = 0x0611
tag['client_server_ip'] = 0x0612
tag['client_server_port'] = 0x0613
tag['client_server_name'] = 0x0614
tag['client_soft_ver_str'] = 0x0615
tag['client_waiting_position'] = 0x0616
tag['client_ident_state'] = 0x0617
tag['client_obfuscation_status'] = 0x0618
tag['client_currentlyunused1'] = 0x0619
tag['client_remote_queue_rank'] = 0x061A
tag['client_disable_view_shared'] = 0x061B
tag['client_upload_state'] = 0x061C
tag['client_ext_protocol'] = 0x061D
tag['client_user_id'] = 0x061E
tag['client_upload_file'] = 0x061F
tag['client_request_file'] = 0x0620
tag['client_a4af_files'] = 0x0621
tag['client_old_remote_queue_rank'] = 0x0622
tag['client_kad_port'] = 0x0623
tag['client_part_status'] = 0x0624
tag['client_next_requested_part'] = 0x0625
tag['client_last_downloading_part'] = 0x0626
tag['client_remote_filename'] = 0x0627
tag['client_mod_version'] = 0x0628
tag['client_os_info'] = 0x0629
tag['client_available_parts'] = 0x062A
tag['client_upload_part_status'] = 0x062B
tag['searchfile'] = 0x0700
tag['search_type'] = 0x0701
tag['search_name'] = 0x0702
tag['search_min_size'] = 0x0703
tag['search_max_size'] = 0x0704
tag['search_file_type'] = 0x0705
tag['search_extension'] = 0x0706
tag['search_availability'] = 0x0707
tag['search_status'] = 0x0708
tag['search_parent'] = 0x0709
tag['friend'] = 0x0800
tag['friend_name'] = 0x0801
tag['friend_hash'] = 0x0802
tag['friend_ip'] = 0x0803
tag['friend_port'] = 0x0804
tag['friend_client'] = 0x0805
tag['friend_add'] = 0x0806
tag['friend_remove'] = 0x0807
tag['friend_friendslot'] = 0x0808
tag['friend_shared'] = 0x0809
tag['select_prefs'] = 0x1000
tag['prefs_categories'] = 0x1100
tag['category'] = 0x1101
tag['category_title'] = 0x1102
tag['category_path'] = 0x1103
tag['category_comment'] = 0x1104
tag['category_color'] = 0x1105
tag['category_prio'] = 0x1106
tag['prefs_general'] = 0x1200
tag['user_nick'] = 0x1201
tag['user_hash'] = 0x1202
tag['user_host'] = 0x1203
tag['general_check_new_version'] = 0x1204
tag['prefs_connections'] = 0x1300
tag['conn_dl_cap'] = 0x1301
tag['conn_ul_cap'] = 0x1302
tag['conn_max_dl'] = 0x1303
tag['conn_max_ul'] = 0x1304
tag['conn_slot_allocation'] = 0x1305
tag['conn_tcp_port'] = 0x1306
tag['conn_udp_port'] = 0x1307
tag['conn_udp_disable'] = 0x1308
tag['conn_max_file_sources'] = 0x1309
tag['conn_max_conn'] = 0x130A
tag['conn_autoconnect'] = 0x130B
tag['conn_reconnect'] = 0x130C
tag['network_ed2k'] = 0x130D
tag['network_kademlia'] = 0x130E
tag['prefs_messagefilter'] = 0x1400
tag['msgfilter_enabled'] = 0x1401
tag['msgfilter_all'] = 0x1402
tag['msgfilter_friends'] = 0x1403
tag['msgfilter_secure'] = 0x1404
tag['msgfilter_by_keyword'] = 0x1405
tag['msgfilter_keywords'] = 0x1406
tag['prefs_remotectrl'] = 0x1500
tag['webserver_autorun'] = 0x1501
tag['webserver_port'] = 0x1502
tag['webserver_guest'] = 0x1503
tag['webserver_usegzip'] = 0x1504
tag['webserver_refresh'] = 0x1505
tag['webserver_template'] = 0x1506
tag['prefs_onlinesig'] = 0x1600
tag['onlinesig_enabled'] = 0x1601
tag['prefs_servers'] = 0x1700
tag['servers_remove_dead'] = 0x1701
tag['servers_dead_server_retries'] = 0x1702
tag['servers_auto_update'] = 0x1703
tag['servers_url_list'] = 0x1704
tag['servers_add_from_server'] = 0x1705
tag['servers_add_from_client'] = 0x1706
tag['servers_use_score_system'] = 0x1707
tag['servers_smart_id_check'] = 0x1708
tag['servers_safe_server_connect'] = 0x1709
tag['servers_autoconn_static_only'] = 0x170A
tag['servers_manual_high_prio'] = 0x170B
tag['servers_update_url'] = 0x170C
tag['prefs_files'] = 0x1800
tag['files_ich_enabled'] = 0x1801
tag['files_aich_trust'] = 0x1802
tag['files_new_paused'] = 0x1803
tag['files_new_auto_dl_prio'] = 0x1804
tag['files_preview_prio'] = 0x1805
tag['files_new_auto_ul_prio'] = 0x1806
tag['files_ul_full_chunks'] = 0x1807
tag['files_start_next_paused'] = 0x1808
tag['files_resume_same_cat'] = 0x1809
tag['files_save_sources'] = 0x180A
tag['files_extract_metadata'] = 0x180B
tag['files_alloc_full_size'] = 0x180C
tag['files_check_free_space'] = 0x180D
tag['files_min_free_space'] = 0x180E
tag['files_create_normal'] = 0x180F
tag['prefs_directories'] = 0x1A00
tag['directories_incoming'] = 0x1A01
tag['directories_temp'] = 0x1A02
tag['directories_shared'] = 0x1A03
tag['directories_share_hidden'] = 0x1A04
tag['prefs_statistics'] = 0x1B00
tag['statsgraph_width'] = 0x1B01
tag['statsgraph_scale'] = 0x1B02
tag['statsgraph_last'] = 0x1B03
tag['statsgraph_data'] = 0x1B04
tag['stattree_capping'] = 0x1B05
tag['stattree_node'] = 0x1B06
tag['stat_node_value'] = 0x1B07
tag['stat_value_type'] = 0x1B08
tag['stattree_nodeid'] = 0x1B09
tag['prefs_security'] = 0x1C00
tag['security_can_see_shares'] = 0x1C01
tag['ipfilter_clients'] = 0x1C02
tag['ipfilter_servers'] = 0x1C03
tag['ipfilter_auto_update'] = 0x1C04
tag['ipfilter_update_url'] = 0x1C05
tag['ipfilter_level'] = 0x1C06
tag['ipfilter_filter_lan'] = 0x1C07
tag['security_use_secident'] = 0x1C08
tag['security_obfuscation_supported'] = 0x1C09
tag['security_obfuscation_requested'] = 0x1C0A
tag['security_obfuscation_required'] = 0x1C0B
tag['prefs_coretweaks'] = 0x1D00
tag['coretw_max_conn_per_five'] = 0x1D01
tag['coretw_verbose'] = 0x1D02
tag['coretw_filebuffer'] = 0x1D03
tag['coretw_ul_queue'] = 0x1D04
tag['coretw_srv_keepalive_timeout'] = 0x1D05
tag['prefs_kademlia'] = 0x1E00
tag['kademlia_update_url'] = 0x1E01
detail['cmd'] = 0x00
detail['web'] = 0x01
detail['full'] = 0x02
detail['update'] = 0x03
detail['inc_update'] = 0x04
search['local'] = 0x00
search['global'] = 0x01
search['kad'] = 0x02
search['web'] = 0x03
value['integer'] = 0x00
value['istring'] = 0x01
value['bytes'] = 0x02
value['ishort'] = 0x03
value['time'] = 0x04
value['speed'] = 0x05
value['string'] = 0x06
value['double'] = 0x07
prefs['categories'] = 0x00000001
prefs['general'] = 0x00000002
prefs['connections'] = 0x00000004
prefs['messagefilter'] = 0x00000008
prefs['remotecontrols'] = 0x00000010
prefs['onlinesig'] = 0x00000020
prefs['servers'] = 0x00000040
prefs['files'] = 0x00000080
prefs['directories'] = 0x00000200
prefs['statistics'] = 0x00000400
prefs['security'] = 0x00000800
prefs['coretweaks'] = 0x00001000
prefs['kademlia'] = 0x00002000
