diff options
Diffstat (limited to 'epan/dissectors/packet-vnc.c')
-rw-r--r-- | epan/dissectors/packet-vnc.c | 720 |
1 files changed, 364 insertions, 356 deletions
diff --git a/epan/dissectors/packet-vnc.c b/epan/dissectors/packet-vnc.c index 50f86e0f07..7b2e3541e4 100644 --- a/epan/dissectors/packet-vnc.c +++ b/epan/dissectors/packet-vnc.c @@ -24,8 +24,7 @@ * * The protocol itself is known as RFB - Remote Frame Buffer Protocol. * - * This code is based on the protocol specification: - * http://www.realvnc.com/docs/rfbproto.pdf + * This code is based on the protocol specification published in RFC 6143 * and the RealVNC free edition & TightVNC source code * Note: rfbproto.rst [ https://github.com/svn2github/tigervnc/blob/master/rfbproto/rfbproto.rst ] * seems to have additional information over rfbproto.pdf. @@ -61,7 +60,6 @@ Check types, etc against IANA list Optimize: Do col_set(..., COL_INFO) once (after fetching message type & before dispatching ?) Dispatch via a message table (instead of using a switch(...) - Worry about globals (vnc_bytes_per_pixel & nc_depth): "Global so they keep their value between packets" Msg type 150: client-server: enable/disable (1+9 bytes); server-client: endofContinousUpdates(1+0 bytes) ? */ @@ -139,12 +137,6 @@ static const true_false_string auth_result_tfs = { "OK" }; -static const value_string yes_no_vs[] = { - { 0, "No" }, - { 1, "Yes" }, - { 0, NULL } -}; - typedef enum { /* Required */ VNC_CLIENT_MESSAGE_TYPE_SET_PIXEL_FORMAT = 0, @@ -479,7 +471,6 @@ typedef enum { /* This structure will be tied to each conversation. */ typedef struct { gdouble server_proto_ver, client_proto_ver; - vnc_session_state_e vnc_next_state; guint32 server_port; /* These are specific to TightVNC */ gint num_server_message_types; @@ -489,12 +480,18 @@ typedef struct { gboolean tight_enabled; /* This is specific to Apple Remote Desktop */ guint16 ard_key_length; + /* State information valid on first sequential pass; + * stored in per-packet info for subsequent passes. */ + guint8 bytes_per_pixel; + guint8 depth; + vnc_session_state_e vnc_next_state; + gint preferred_encoding; } vnc_conversation_t; /* This structure will be tied to each packet */ typedef struct { vnc_session_state_e state; - gint preferred_encoding; + //gint preferred_encoding; XXX: Not actually used? guint8 bytes_per_pixel; guint8 depth; } vnc_packet_t; @@ -505,13 +502,16 @@ static gboolean vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, proto_tree *tree, vnc_conversation_t *per_conversation_info); static void vnc_client_to_server(tvbuff_t *tvb, packet_info *pinfo, - gint *offset, proto_tree *tree); + gint *offset, proto_tree *tree, + vnc_conversation_t *per_conversation_info); static void vnc_server_to_client(tvbuff_t *tvb, packet_info *pinfo, gint *offset, proto_tree *tree); static void vnc_client_set_pixel_format(tvbuff_t *tvb, packet_info *pinfo, - gint *offset, proto_tree *tree); + gint *offset, proto_tree *tree, + vnc_conversation_t *per_conversation_info); static void vnc_client_set_encodings(tvbuff_t *tvb, packet_info *pinfo, - gint *offset, proto_tree *tree); + gint *offset, proto_tree *tree, + vnc_conversation_t *per_conversation_info); static void vnc_client_framebuffer_update_request(tvbuff_t *tvb, packet_info *pinfo, gint *offset, @@ -551,8 +551,8 @@ static void vnc_server_ring_bell(tvbuff_t *tvb, packet_info *pinfo, gint *offset, proto_tree *tree); static guint vnc_server_cut_text(tvbuff_t *tvb, packet_info *pinfo, gint *offset, proto_tree *tree); -static void vnc_set_bytes_per_pixel(packet_info *pinfo, const guint8 bytes_per_pixel); -static void vnc_set_depth(packet_info *pinfo, const guint8 depth); +static void vnc_set_bytes_per_pixel(packet_info *pinfo, vnc_conversation_t *per_conversation_info, const guint8 bytes_per_pixel); +static void vnc_set_depth(packet_info *pinfo, vnc_conversation_t *per_conversation_info, const guint8 depth); static guint8 vnc_get_bytes_per_pixel(packet_info *pinfo); static guint8 vnc_get_depth(packet_info *pinfo); static guint32 vnc_extended_desktop_size(tvbuff_t *tvb, gint *offset, proto_tree *tree); @@ -581,291 +581,291 @@ static guint vnc_h264_encoding(tvbuff_t *tvb, gint *offset, proto_tree *tree); return (a); /* Initialize the protocol and registered fields */ -static int proto_vnc = -1; /* Protocol subtree */ -static int hf_vnc_padding = -1; -static int hf_vnc_server_proto_ver = -1; -static int hf_vnc_client_proto_ver = -1; -static int hf_vnc_num_security_types = -1; -static int hf_vnc_security_type = -1; -static int hf_vnc_server_security_type = -1; -static int hf_vnc_client_security_type = -1; -static int hf_vnc_auth_challenge = -1; -static int hf_vnc_auth_response = -1; -static int hf_vnc_auth_result = -1; -static int hf_vnc_auth_error = -1; -static int hf_vnc_auth_error_length = -1; - -static int hf_vnc_ard_auth_generator = -1; -static int hf_vnc_ard_auth_key_len = -1; -static int hf_vnc_ard_auth_modulus = -1; -static int hf_vnc_ard_auth_server_key = -1; -static int hf_vnc_ard_auth_credentials = -1; -static int hf_vnc_ard_auth_client_key = -1; - -static int hf_vnc_share_desktop_flag = -1; -static int hf_vnc_width = -1; -static int hf_vnc_height = -1; -static int hf_vnc_server_bits_per_pixel = -1; -static int hf_vnc_server_depth = -1; -static int hf_vnc_server_big_endian_flag = -1; -static int hf_vnc_server_true_color_flag = -1; -static int hf_vnc_server_red_max = -1; -static int hf_vnc_server_green_max = -1; -static int hf_vnc_server_blue_max = -1; -static int hf_vnc_server_red_shift = -1; -static int hf_vnc_server_green_shift = -1; -static int hf_vnc_server_blue_shift = -1; -static int hf_vnc_desktop_name = -1; -static int hf_vnc_desktop_name_len = -1; -static int hf_vnc_desktop_screen_num = -1; -static int hf_vnc_desktop_screen_id = -1; -static int hf_vnc_desktop_screen_x = -1; -static int hf_vnc_desktop_screen_y = -1; -static int hf_vnc_desktop_screen_width = -1; -static int hf_vnc_desktop_screen_height = -1; -static int hf_vnc_desktop_screen_flags = -1; -static int hf_vnc_num_server_message_types = -1; -static int hf_vnc_num_client_message_types = -1; -static int hf_vnc_num_encoding_types = -1; +static int proto_vnc; /* Protocol subtree */ +static int hf_vnc_padding; +static int hf_vnc_server_proto_ver; +static int hf_vnc_client_proto_ver; +static int hf_vnc_num_security_types; +static int hf_vnc_security_type; +static int hf_vnc_server_security_type; +static int hf_vnc_client_security_type; +static int hf_vnc_auth_challenge; +static int hf_vnc_auth_response; +static int hf_vnc_auth_result; +static int hf_vnc_auth_error; +static int hf_vnc_auth_error_length; + +static int hf_vnc_ard_auth_generator; +static int hf_vnc_ard_auth_key_len; +static int hf_vnc_ard_auth_modulus; +static int hf_vnc_ard_auth_server_key; +static int hf_vnc_ard_auth_credentials; +static int hf_vnc_ard_auth_client_key; + +static int hf_vnc_share_desktop_flag; +static int hf_vnc_width; +static int hf_vnc_height; +static int hf_vnc_server_bits_per_pixel; +static int hf_vnc_server_depth; +static int hf_vnc_server_big_endian_flag; +static int hf_vnc_server_true_color_flag; +static int hf_vnc_server_red_max; +static int hf_vnc_server_green_max; +static int hf_vnc_server_blue_max; +static int hf_vnc_server_red_shift; +static int hf_vnc_server_green_shift; +static int hf_vnc_server_blue_shift; +static int hf_vnc_desktop_name; +static int hf_vnc_desktop_name_len; +static int hf_vnc_desktop_screen_num; +static int hf_vnc_desktop_screen_id; +static int hf_vnc_desktop_screen_x; +static int hf_vnc_desktop_screen_y; +static int hf_vnc_desktop_screen_width; +static int hf_vnc_desktop_screen_height; +static int hf_vnc_desktop_screen_flags; +static int hf_vnc_num_server_message_types; +static int hf_vnc_num_client_message_types; +static int hf_vnc_num_encoding_types; /********** Client Message Types **********/ -static int hf_vnc_client_message_type = -1; /* A subtree under VNC */ -static int hf_vnc_client_bits_per_pixel = -1; -static int hf_vnc_client_depth = -1; -static int hf_vnc_client_big_endian_flag = -1; -static int hf_vnc_client_true_color_flag = -1; -static int hf_vnc_client_red_max = -1; -static int hf_vnc_client_green_max = -1; -static int hf_vnc_client_blue_max = -1; -static int hf_vnc_client_red_shift = -1; -static int hf_vnc_client_green_shift = -1; -static int hf_vnc_client_blue_shift = -1; +static int hf_vnc_client_message_type; /* A subtree under VNC */ +static int hf_vnc_client_bits_per_pixel; +static int hf_vnc_client_depth; +static int hf_vnc_client_big_endian_flag; +static int hf_vnc_client_true_color_flag; +static int hf_vnc_client_red_max; +static int hf_vnc_client_green_max; +static int hf_vnc_client_blue_max; +static int hf_vnc_client_red_shift; +static int hf_vnc_client_green_shift; +static int hf_vnc_client_blue_shift; /* Client Key Event */ -static int hf_vnc_key_down = -1; -static int hf_vnc_key = -1; +static int hf_vnc_key_down; +static int hf_vnc_key; /* Client Pointer Event */ -static int hf_vnc_button_1_pos = -1; -static int hf_vnc_button_2_pos = -1; -static int hf_vnc_button_3_pos = -1; -static int hf_vnc_button_4_pos = -1; -static int hf_vnc_button_5_pos = -1; -static int hf_vnc_button_6_pos = -1; -static int hf_vnc_button_7_pos = -1; -static int hf_vnc_button_8_pos = -1; -static int hf_vnc_pointer_x_pos = -1; -static int hf_vnc_pointer_y_pos = -1; +static int hf_vnc_button_1_pos; +static int hf_vnc_button_2_pos; +static int hf_vnc_button_3_pos; +static int hf_vnc_button_4_pos; +static int hf_vnc_button_5_pos; +static int hf_vnc_button_6_pos; +static int hf_vnc_button_7_pos; +static int hf_vnc_button_8_pos; +static int hf_vnc_pointer_x_pos; +static int hf_vnc_pointer_y_pos; /* Client Framebuffer Update Request */ -static int hf_vnc_update_req_incremental = -1; -static int hf_vnc_update_req_x_pos = -1; -static int hf_vnc_update_req_y_pos = -1; -static int hf_vnc_update_req_width = -1; -static int hf_vnc_update_req_height = -1; +static int hf_vnc_update_req_incremental; +static int hf_vnc_update_req_x_pos; +static int hf_vnc_update_req_y_pos; +static int hf_vnc_update_req_width; +static int hf_vnc_update_req_height; /* Client Set Encodings */ -static int hf_vnc_encoding_num = -1; -static int hf_vnc_client_set_encodings_encoding_type = -1; +static int hf_vnc_encoding_num; +static int hf_vnc_client_set_encodings_encoding_type; /* Client Cut Text */ -static int hf_vnc_client_cut_text_len = -1; -static int hf_vnc_client_cut_text = -1; +static int hf_vnc_client_cut_text_len; +static int hf_vnc_client_cut_text; /********** Server Message Types **********/ -static int hf_vnc_server_message_type = -1; /* Subtree */ +static int hf_vnc_server_message_type; /* Subtree */ /* Tunneling capabilities (TightVNC extension) */ -static int hf_vnc_tight_num_tunnel_types = -1; -static int hf_vnc_tight_tunnel_type_code = -1; -static int hf_vnc_tight_tunnel_type_vendor = -1; -static int hf_vnc_tight_tunnel_type_signature = -1; +static int hf_vnc_tight_num_tunnel_types; +static int hf_vnc_tight_tunnel_type_code; +static int hf_vnc_tight_tunnel_type_vendor; +static int hf_vnc_tight_tunnel_type_signature; /* Authentication capabilities (TightVNC extension) */ -static int hf_vnc_tight_num_auth_types = -1; -static int hf_vnc_tight_auth_code = -1; +static int hf_vnc_tight_num_auth_types; +static int hf_vnc_tight_auth_code; /* TightVNC capabilities */ -static int hf_vnc_tight_server_message_type = -1; -static int hf_vnc_tight_server_vendor = -1; -static int hf_vnc_tight_signature = -1; -static int hf_vnc_tight_server_name = -1; +static int hf_vnc_tight_server_message_type; +static int hf_vnc_tight_server_vendor; +static int hf_vnc_tight_signature; +static int hf_vnc_tight_server_name; -static int hf_vnc_tight_client_message_type = -1; -static int hf_vnc_tight_client_vendor = -1; -static int hf_vnc_tight_client_name = -1; +static int hf_vnc_tight_client_message_type; +static int hf_vnc_tight_client_vendor; +static int hf_vnc_tight_client_name; -static int hf_vnc_tight_encoding_type = -1; -static int hf_vnc_tight_encoding_vendor = -1; -static int hf_vnc_tight_encoding_name = -1; +static int hf_vnc_tight_encoding_type; +static int hf_vnc_tight_encoding_vendor; +static int hf_vnc_tight_encoding_name; /* VeNCrypt capabilities */ -static int hf_vnc_vencrypt_server_major_ver = -1; -static int hf_vnc_vencrypt_server_minor_ver = -1; -static int hf_vnc_vencrypt_client_major_ver = -1; -static int hf_vnc_vencrypt_client_minor_ver = -1; -static int hf_vnc_vencrypt_version_ack = -1; -static int hf_vnc_vencrypt_num_auth_types = -1; -static int hf_vnc_vencrypt_auth_type = -1; -static int hf_vnc_vencrypt_auth_type_ack = -1; +static int hf_vnc_vencrypt_server_major_ver; +static int hf_vnc_vencrypt_server_minor_ver; +static int hf_vnc_vencrypt_client_major_ver; +static int hf_vnc_vencrypt_client_minor_ver; +static int hf_vnc_vencrypt_version_ack; +static int hf_vnc_vencrypt_num_auth_types; +static int hf_vnc_vencrypt_auth_type; +static int hf_vnc_vencrypt_auth_type_ack; /* Tight compression parameters */ -static int hf_vnc_tight_reset_stream0 = -1; -static int hf_vnc_tight_reset_stream1 = -1; -static int hf_vnc_tight_reset_stream2 = -1; -static int hf_vnc_tight_reset_stream3 = -1; +static int hf_vnc_tight_reset_stream0; +static int hf_vnc_tight_reset_stream1; +static int hf_vnc_tight_reset_stream2; +static int hf_vnc_tight_reset_stream3; -static int hf_vnc_tight_rect_type = -1; +static int hf_vnc_tight_rect_type; -static int hf_vnc_tight_image_len = -1; -static int hf_vnc_tight_image_data = -1; +static int hf_vnc_tight_image_len; +static int hf_vnc_tight_image_data; -static int hf_vnc_tight_fill_color = -1; +static int hf_vnc_tight_fill_color; -static int hf_vnc_tight_filter_flag = -1; -static int hf_vnc_tight_filter_id = -1; +static int hf_vnc_tight_filter_flag; +static int hf_vnc_tight_filter_id; -static int hf_vnc_tight_palette_num_colors = -1; -static int hf_vnc_tight_palette_data = -1; +static int hf_vnc_tight_palette_num_colors; +static int hf_vnc_tight_palette_data; /* Server Framebuffer Update */ -static int hf_vnc_rectangle_num = -1; -static int hf_vnc_fb_update_x_pos = -1; -static int hf_vnc_fb_update_y_pos = -1; -static int hf_vnc_fb_update_width = -1; -static int hf_vnc_fb_update_height = -1; -static int hf_vnc_fb_update_encoding_type = -1; +static int hf_vnc_rectangle_num; +static int hf_vnc_fb_update_x_pos; +static int hf_vnc_fb_update_y_pos; +static int hf_vnc_fb_update_width; +static int hf_vnc_fb_update_height; +static int hf_vnc_fb_update_encoding_type; /* Raw Encoding */ -static int hf_vnc_raw_pixel_data = -1; +static int hf_vnc_raw_pixel_data; /* CopyRect Encoding */ -static int hf_vnc_copyrect_src_x_pos = -1; -static int hf_vnc_copyrect_src_y_pos = -1; +static int hf_vnc_copyrect_src_x_pos; +static int hf_vnc_copyrect_src_y_pos; /* RRE Encoding */ -static int hf_vnc_rre_num_subrects = -1; -static int hf_vnc_rre_bg_pixel = -1; +static int hf_vnc_rre_num_subrects; +static int hf_vnc_rre_bg_pixel; -static int hf_vnc_rre_subrect_pixel = -1; -static int hf_vnc_rre_subrect_x_pos = -1; -static int hf_vnc_rre_subrect_y_pos = -1; -static int hf_vnc_rre_subrect_width = -1; -static int hf_vnc_rre_subrect_height = -1; +static int hf_vnc_rre_subrect_pixel; +static int hf_vnc_rre_subrect_x_pos; +static int hf_vnc_rre_subrect_y_pos; +static int hf_vnc_rre_subrect_width; +static int hf_vnc_rre_subrect_height; /* Hextile Encoding */ -static int hf_vnc_hextile_subencoding_mask = -1; -static int hf_vnc_hextile_raw = -1; -static int hf_vnc_hextile_raw_value = -1; -static int hf_vnc_hextile_bg = -1; -static int hf_vnc_hextile_bg_value = -1; -static int hf_vnc_hextile_fg = -1; -static int hf_vnc_hextile_fg_value = -1; -static int hf_vnc_hextile_anysubrects = -1; -static int hf_vnc_hextile_num_subrects = -1; -static int hf_vnc_hextile_subrectscolored = -1; -static int hf_vnc_hextile_subrect_pixel_value = -1; -static int hf_vnc_hextile_subrect_x_pos = -1; -static int hf_vnc_hextile_subrect_y_pos = -1; -static int hf_vnc_hextile_subrect_width = -1; -static int hf_vnc_hextile_subrect_height = -1; +static int hf_vnc_hextile_subencoding_mask; +static int hf_vnc_hextile_raw; +static int hf_vnc_hextile_raw_value; +static int hf_vnc_hextile_bg; +static int hf_vnc_hextile_bg_value; +static int hf_vnc_hextile_fg; +static int hf_vnc_hextile_fg_value; +static int hf_vnc_hextile_anysubrects; +static int hf_vnc_hextile_num_subrects; +static int hf_vnc_hextile_subrectscolored; +static int hf_vnc_hextile_subrect_pixel_value; +static int hf_vnc_hextile_subrect_x_pos; +static int hf_vnc_hextile_subrect_y_pos; +static int hf_vnc_hextile_subrect_width; +static int hf_vnc_hextile_subrect_height; /* ZRLE Encoding */ -static int hf_vnc_zrle_len = -1; -static int hf_vnc_zrle_subencoding = -1; -static int hf_vnc_zrle_rle = -1; -static int hf_vnc_zrle_palette_size = -1; -static int hf_vnc_zrle_data = -1; -static int hf_vnc_zrle_raw = -1; -static int hf_vnc_zrle_palette = -1; +static int hf_vnc_zrle_len; +static int hf_vnc_zrle_subencoding; +static int hf_vnc_zrle_rle; +static int hf_vnc_zrle_palette_size; +static int hf_vnc_zrle_data; +static int hf_vnc_zrle_raw; +static int hf_vnc_zrle_palette; /* Cursor Encoding */ -static int hf_vnc_cursor_x_fore_back = -1; -static int hf_vnc_cursor_encoding_pixels = -1; -static int hf_vnc_cursor_encoding_bitmask = -1; +static int hf_vnc_cursor_x_fore_back; +static int hf_vnc_cursor_encoding_pixels; +static int hf_vnc_cursor_encoding_bitmask; /* Server Set Colormap Entries */ -static int hf_vnc_color_groups = -1; -static int hf_vnc_colormap_first_color = -1; -static int hf_vnc_colormap_num_colors = -1; -static int hf_vnc_colormap_red = -1; -static int hf_vnc_colormap_green = -1; -static int hf_vnc_colormap_blue = -1; +static int hf_vnc_color_groups; +static int hf_vnc_colormap_first_color; +static int hf_vnc_colormap_num_colors; +static int hf_vnc_colormap_red; +static int hf_vnc_colormap_green; +static int hf_vnc_colormap_blue; /* Server Cut Text */ -static int hf_vnc_server_cut_text_len = -1; -static int hf_vnc_server_cut_text = -1; +static int hf_vnc_server_cut_text_len; +static int hf_vnc_server_cut_text; /* LibVNCServer additions */ -static int hf_vnc_supported_messages_client2server = -1; -static int hf_vnc_supported_messages_server2client = -1; -static int hf_vnc_num_supported_encodings = -1; -static int hf_vnc_supported_encodings = -1; -static int hf_vnc_server_identity = -1; +static int hf_vnc_supported_messages_client2server; +static int hf_vnc_supported_messages_server2client; +static int hf_vnc_num_supported_encodings; +static int hf_vnc_supported_encodings; +static int hf_vnc_server_identity; /* MirrorLink */ -static int hf_vnc_mirrorlink_type = -1; -static int hf_vnc_mirrorlink_length = -1; -static int hf_vnc_mirrorlink_version_major = -1; -static int hf_vnc_mirrorlink_version_minor = -1; -static int hf_vnc_mirrorlink_framebuffer_configuration = -1; -static int hf_vnc_mirrorlink_pixel_width = -1; -static int hf_vnc_mirrorlink_pixel_height = -1; -static int hf_vnc_mirrorlink_pixel_format = -1; -static int hf_vnc_mirrorlink_display_width = -1; -static int hf_vnc_mirrorlink_display_height = -1; -static int hf_vnc_mirrorlink_display_distance = -1; -static int hf_vnc_mirrorlink_keyboard_language = -1; -static int hf_vnc_mirrorlink_keyboard_country = -1; -static int hf_vnc_mirrorlink_ui_language = -1; -static int hf_vnc_mirrorlink_ui_country = -1; -static int hf_vnc_mirrorlink_knob_keys = -1; -static int hf_vnc_mirrorlink_device_keys = -1; -static int hf_vnc_mirrorlink_multimedia_keys = -1; -static int hf_vnc_mirrorlink_key_related = -1; -static int hf_vnc_mirrorlink_pointer_related = -1; -static int hf_vnc_mirrorlink_key_symbol_value_client = -1; -static int hf_vnc_mirrorlink_key_symbol_value_server = -1; -static int hf_vnc_mirrorlink_key_configuration = -1; -static int hf_vnc_mirrorlink_key_num_events = -1; -static int hf_vnc_mirrorlink_key_event_counter = -1; -static int hf_vnc_mirrorlink_key_symbol_value = -1; -static int hf_vnc_mirrorlink_key_request_configuration = -1; -static int hf_vnc_mirrorlink_keyboard_configuration = -1; -static int hf_vnc_mirrorlink_cursor_x = -1; -static int hf_vnc_mirrorlink_cursor_y = -1; -static int hf_vnc_mirrorlink_text_x = -1; -static int hf_vnc_mirrorlink_text_y = -1; -static int hf_vnc_mirrorlink_text_width = -1; -static int hf_vnc_mirrorlink_text_height = -1; -static int hf_vnc_mirrorlink_keyboard_request_configuration = -1; -static int hf_vnc_mirrorlink_device_status = -1; -static int hf_vnc_mirrorlink_app_id = -1; -static int hf_vnc_mirrorlink_fb_block_x = -1; -static int hf_vnc_mirrorlink_fb_block_y = -1; -static int hf_vnc_mirrorlink_fb_block_width = -1; -static int hf_vnc_mirrorlink_fb_block_height = -1; -static int hf_vnc_mirrorlink_fb_block_reason = -1; -static int hf_vnc_mirrorlink_audio_block_reason = -1; -static int hf_vnc_mirrorlink_touch_num_events = -1; -static int hf_vnc_mirrorlink_touch_x = -1; -static int hf_vnc_mirrorlink_touch_y = -1; -static int hf_vnc_mirrorlink_touch_id = -1; -static int hf_vnc_mirrorlink_touch_pressure = -1; -static int hf_vnc_mirrorlink_text = -1; -static int hf_vnc_mirrorlink_text_length = -1; -static int hf_vnc_mirrorlink_text_max_length = -1; -static int hf_vnc_mirrorlink_unknown = -1; +static int hf_vnc_mirrorlink_type; +static int hf_vnc_mirrorlink_length; +static int hf_vnc_mirrorlink_version_major; +static int hf_vnc_mirrorlink_version_minor; +static int hf_vnc_mirrorlink_framebuffer_configuration; +static int hf_vnc_mirrorlink_pixel_width; +static int hf_vnc_mirrorlink_pixel_height; +static int hf_vnc_mirrorlink_pixel_format; +static int hf_vnc_mirrorlink_display_width; +static int hf_vnc_mirrorlink_display_height; +static int hf_vnc_mirrorlink_display_distance; +static int hf_vnc_mirrorlink_keyboard_language; +static int hf_vnc_mirrorlink_keyboard_country; +static int hf_vnc_mirrorlink_ui_language; +static int hf_vnc_mirrorlink_ui_country; +static int hf_vnc_mirrorlink_knob_keys; +static int hf_vnc_mirrorlink_device_keys; +static int hf_vnc_mirrorlink_multimedia_keys; +static int hf_vnc_mirrorlink_key_related; +static int hf_vnc_mirrorlink_pointer_related; +static int hf_vnc_mirrorlink_key_symbol_value_client; +static int hf_vnc_mirrorlink_key_symbol_value_server; +static int hf_vnc_mirrorlink_key_configuration; +static int hf_vnc_mirrorlink_key_num_events; +static int hf_vnc_mirrorlink_key_event_counter; +static int hf_vnc_mirrorlink_key_symbol_value; +static int hf_vnc_mirrorlink_key_request_configuration; +static int hf_vnc_mirrorlink_keyboard_configuration; +static int hf_vnc_mirrorlink_cursor_x; +static int hf_vnc_mirrorlink_cursor_y; +static int hf_vnc_mirrorlink_text_x; +static int hf_vnc_mirrorlink_text_y; +static int hf_vnc_mirrorlink_text_width; +static int hf_vnc_mirrorlink_text_height; +static int hf_vnc_mirrorlink_keyboard_request_configuration; +static int hf_vnc_mirrorlink_device_status; +static int hf_vnc_mirrorlink_app_id; +static int hf_vnc_mirrorlink_fb_block_x; +static int hf_vnc_mirrorlink_fb_block_y; +static int hf_vnc_mirrorlink_fb_block_width; +static int hf_vnc_mirrorlink_fb_block_height; +static int hf_vnc_mirrorlink_fb_block_reason; +static int hf_vnc_mirrorlink_audio_block_reason; +static int hf_vnc_mirrorlink_touch_num_events; +static int hf_vnc_mirrorlink_touch_x; +static int hf_vnc_mirrorlink_touch_y; +static int hf_vnc_mirrorlink_touch_id; +static int hf_vnc_mirrorlink_touch_pressure; +static int hf_vnc_mirrorlink_text; +static int hf_vnc_mirrorlink_text_length; +static int hf_vnc_mirrorlink_text_max_length; +static int hf_vnc_mirrorlink_unknown; /* Fence */ -static int hf_vnc_fence_flags = -1; -static int hf_vnc_fence_request = -1; -static int hf_vnc_fence_sync_next = -1; -static int hf_vnc_fence_block_after = -1; -static int hf_vnc_fence_block_before = -1; -static int hf_vnc_fence_payload_length = -1; -static int hf_vnc_fence_payload = -1; +static int hf_vnc_fence_flags; +static int hf_vnc_fence_request; +static int hf_vnc_fence_sync_next; +static int hf_vnc_fence_block_after; +static int hf_vnc_fence_block_before; +static int hf_vnc_fence_payload_length; +static int hf_vnc_fence_payload; static int * const vnc_fence_flags[] = { &hf_vnc_fence_request, @@ -876,65 +876,65 @@ static int * const vnc_fence_flags[] = { }; /* Context Information */ -static int hf_vnc_context_information_app_id = -1; -static int hf_vnc_context_information_app_category = -1; -static int hf_vnc_context_information_app_trust_level = -1; -static int hf_vnc_context_information_content_category = -1; -static int hf_vnc_context_information_content_rules = -1; -static int hf_vnc_context_information_content_trust_level = -1; +static int hf_vnc_context_information_app_id; +static int hf_vnc_context_information_app_category; +static int hf_vnc_context_information_app_trust_level; +static int hf_vnc_context_information_content_category; +static int hf_vnc_context_information_content_rules; +static int hf_vnc_context_information_content_trust_level; /* Scan Line based Run-Length Encoding */ -static int hf_vnc_slrle_run_num = -1; -static int hf_vnc_slrle_run_data = -1; +static int hf_vnc_slrle_run_num; +static int hf_vnc_slrle_run_data; /* H.264 Encoding */ -static int hf_vnc_h264_slice_type = -1; -static int hf_vnc_h264_nbytes = -1; -static int hf_vnc_h264_width = -1; -static int hf_vnc_h264_height = -1; -static int hf_vnc_h264_data = -1; +static int hf_vnc_h264_slice_type; +static int hf_vnc_h264_nbytes; +static int hf_vnc_h264_width; +static int hf_vnc_h264_height; +static int hf_vnc_h264_data; /********** End of Server Message Types **********/ static gboolean vnc_preference_desegment = TRUE; /* Initialize the subtree pointers */ -static gint ett_vnc = -1; -static gint ett_vnc_client_message_type = -1; -static gint ett_vnc_server_message_type = -1; -static gint ett_vnc_rect = -1; -static gint ett_vnc_encoding_type = -1; -static gint ett_vnc_rre_subrect = -1; -static gint ett_vnc_hextile_subencoding_mask = -1; -static gint ett_vnc_hextile_num_subrects = -1; -static gint ett_vnc_hextile_subrect = -1; -static gint ett_vnc_hextile_tile = -1; -static gint ett_vnc_zrle_subencoding = -1; -static gint ett_vnc_colormap_num_groups = -1; -static gint ett_vnc_colormap_color_group = -1; -static gint ett_vnc_desktop_screen = -1; -static gint ett_vnc_key_events = -1; -static gint ett_vnc_touch_events = -1; -static gint ett_vnc_slrle_subline = -1; -static gint ett_vnc_fence_flags = -1; - -static expert_field ei_vnc_possible_gtk_vnc_bug = EI_INIT; -static expert_field ei_vnc_auth_code_mismatch = EI_INIT; -static expert_field ei_vnc_unknown_tight_vnc_auth = EI_INIT; -static expert_field ei_vnc_too_many_rectangles = EI_INIT; -static expert_field ei_vnc_too_many_sub_rectangles = EI_INIT; -static expert_field ei_vnc_invalid_encoding = EI_INIT; -static expert_field ei_vnc_too_many_colors = EI_INIT; -static expert_field ei_vnc_too_many_cut_text = EI_INIT; -static expert_field ei_vnc_zrle_failed = EI_INIT; -static expert_field ei_vnc_unknown_tight = EI_INIT; -static expert_field ei_vnc_reassemble = EI_INIT; - -/* Global so they keep their value between packets */ -guint8 vnc_bytes_per_pixel; -guint8 vnc_depth; - -#define VNC_PORT_RANGE "5500-5501,5900-5901" /* Not IANA registered */ +static gint ett_vnc; +static gint ett_vnc_client_message_type; +static gint ett_vnc_server_message_type; +static gint ett_vnc_rect; +static gint ett_vnc_encoding_type; +static gint ett_vnc_rre_subrect; +static gint ett_vnc_hextile_subencoding_mask; +static gint ett_vnc_hextile_num_subrects; +static gint ett_vnc_hextile_subrect; +static gint ett_vnc_hextile_tile; +static gint ett_vnc_zrle_subencoding; +static gint ett_vnc_colormap_num_groups; +static gint ett_vnc_colormap_color_group; +static gint ett_vnc_desktop_screen; +static gint ett_vnc_key_events; +static gint ett_vnc_touch_events; +static gint ett_vnc_slrle_subline; +static gint ett_vnc_fence_flags; + +static expert_field ei_vnc_possible_gtk_vnc_bug; +static expert_field ei_vnc_auth_code_mismatch; +static expert_field ei_vnc_unknown_tight_vnc_auth; +static expert_field ei_vnc_too_many_rectangles; +static expert_field ei_vnc_too_many_sub_rectangles; +static expert_field ei_vnc_invalid_encoding; +static expert_field ei_vnc_too_many_colors; +static expert_field ei_vnc_too_many_cut_text; +static expert_field ei_vnc_zrle_failed; +static expert_field ei_vnc_unknown_tight; +static expert_field ei_vnc_reassemble; + +#define VNC_PORT_RANGE "5500-5501,5900-5901" +/* Port 5900 is IANA registered (under the service name "Remote Framebuffer"), + * the others are customary but not registered as mentioned in RFC 6143. + * (5900+N is commonly used in the case of multiple servers, analogous to + * X11.) */ static range_t *vnc_tcp_range = NULL; static dissector_handle_t vnc_handle; @@ -965,6 +965,12 @@ dissect_vnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) per_conversation_info->vnc_next_state = VNC_SESSION_STATE_SERVER_VERSION; per_conversation_info->security_type_selected = VNC_SECURITY_TYPE_INVALID; per_conversation_info->tight_enabled = FALSE; + per_conversation_info->preferred_encoding = VNC_ENCODING_TYPE_RAW; + /* Initial values for depth and bytes_per_pixel are set in + * in the mandatory VNC_SESSION_STATE_SERVER_INIT startup + * message. "This pixel format will be used unless the + * client requests a different format using the SetPixelFormat + * message" (RFC 6143 7.3.2 ServerInit) */ conversation_add_proto_data(conversation, proto_vnc, per_conversation_info); } @@ -984,9 +990,6 @@ dissect_vnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) ret = vnc_startup_messages(tvb, pinfo, offset, vnc_tree, per_conversation_info); - vnc_set_bytes_per_pixel(pinfo, vnc_bytes_per_pixel); - vnc_set_depth(pinfo, vnc_depth); - if (ret) { return tvb_captured_length(tvb); /* We're in a "startup" state; Cannot yet do "normal" processing */ } @@ -997,7 +1000,7 @@ dissect_vnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) } if(value_is_in_range(vnc_tcp_range, pinfo->destport) || per_conversation_info->server_port == pinfo->destport) { - vnc_client_to_server(tvb, pinfo, &offset, vnc_tree); + vnc_client_to_server(tvb, pinfo, &offset, vnc_tree, per_conversation_info); } else { vnc_server_to_client(tvb, pinfo, &offset, vnc_tree); @@ -1101,7 +1104,7 @@ static gboolean test_vnc_protocol(tvbuff_t *tvb, packet_info *pinfo, if (vnc_is_client_or_server_version_message(tvb, NULL, NULL)) { conversation = conversation_new(pinfo->num, &pinfo->src, - &pinfo->dst, conversation_pt_to_endpoint_type(pinfo->ptype), + &pinfo->dst, conversation_pt_to_conversation_type(pinfo->ptype), pinfo->srcport, pinfo->destport, 0); conversation_set_dissector(conversation, vnc_handle); @@ -1130,7 +1133,8 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, per_packet_info = wmem_new(wmem_file_scope(), vnc_packet_t); per_packet_info->state = per_conversation_info->vnc_next_state; - per_packet_info->preferred_encoding = -1; + per_packet_info->bytes_per_pixel = per_conversation_info->bytes_per_pixel; + per_packet_info->depth = per_conversation_info->depth; p_add_proto_data(wmem_file_scope(), pinfo, proto_vnc, 0, per_packet_info); } @@ -1143,7 +1147,7 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, return TRUE; /* we still hope to get a SERVER_VERSION message some day. Do not proceed yet */ proto_tree_add_item(tree, hf_vnc_server_proto_ver, tvb, 4, - 7, ENC_ASCII|ENC_NA); + 7, ENC_ASCII); per_conversation_info->server_proto_ver = g_ascii_strtod((char *)tvb_get_string_enc(wmem_packet_scope(), tvb, 4, 7, ENC_ASCII), NULL); per_conversation_info->server_port = pinfo->srcport; @@ -1160,7 +1164,7 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, return TRUE; /* we still hope to get a CLIENT_VERSION message some day. Do not proceed yet */ proto_tree_add_item(tree, hf_vnc_client_proto_ver, tvb, - 4, 7, ENC_ASCII|ENC_NA); + 4, 7, ENC_ASCII); per_conversation_info->client_proto_ver = g_ascii_strtod((char *)tvb_get_string_enc(wmem_packet_scope(), tvb, 4, 7, ENC_ASCII), NULL); @@ -1289,8 +1293,8 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, */ proto_tree_add_item(tree, hf_vnc_tight_tunnel_type_code, tvb, offset, 4, ENC_BIG_ENDIAN); - proto_tree_add_item(tree, hf_vnc_tight_tunnel_type_vendor, tvb, offset + 4, 4, ENC_ASCII|ENC_NA); - proto_tree_add_item(tree, hf_vnc_tight_tunnel_type_signature, tvb, offset + 8, 8, ENC_ASCII|ENC_NA); + proto_tree_add_item(tree, hf_vnc_tight_tunnel_type_vendor, tvb, offset + 4, 4, ENC_ASCII); + proto_tree_add_item(tree, hf_vnc_tight_tunnel_type_signature, tvb, offset + 8, 8, ENC_ASCII); offset += 16; } @@ -1491,7 +1495,7 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, offset += 4; proto_tree_add_item(tree, hf_vnc_auth_error, tvb, - offset, text_len, ENC_ASCII|ENC_NA); + offset, text_len, ENC_ASCII); } return TRUE; /* All versions: Do not continue @@ -1589,12 +1593,12 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, proto_tree_add_item(tree, hf_vnc_server_bits_per_pixel, tvb, offset, 1, ENC_BIG_ENDIAN); - vnc_bytes_per_pixel = tvb_get_guint8(tvb, offset)/8; - vnc_set_bytes_per_pixel(pinfo, vnc_bytes_per_pixel); + vnc_set_bytes_per_pixel(pinfo, per_conversation_info, tvb_get_guint8(tvb, offset) / 8); offset += 1; proto_tree_add_item(tree, hf_vnc_server_depth, tvb, offset, 1, ENC_BIG_ENDIAN); + vnc_set_depth(pinfo, per_conversation_info, tvb_get_guint8(tvb, offset)); offset += 1; proto_tree_add_item(tree, hf_vnc_server_big_endian_flag, @@ -1642,7 +1646,7 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, proto_tree_add_item(tree, hf_vnc_desktop_name, tvb, offset, desktop_name_len, - ENC_ASCII|ENC_NA); + ENC_ASCII); } if(per_conversation_info->tight_enabled == TRUE) @@ -1702,7 +1706,8 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, static void vnc_client_to_server(tvbuff_t *tvb, packet_info *pinfo, gint *offset, - proto_tree *tree) + proto_tree *tree, + vnc_conversation_t *per_conversation_info) { guint8 message_type; @@ -1723,12 +1728,14 @@ vnc_client_to_server(tvbuff_t *tvb, packet_info *pinfo, gint *offset, case VNC_CLIENT_MESSAGE_TYPE_SET_PIXEL_FORMAT : vnc_client_set_pixel_format(tvb, pinfo, offset, - vnc_client_message_type_tree); + vnc_client_message_type_tree, + per_conversation_info); break; case VNC_CLIENT_MESSAGE_TYPE_SET_ENCODINGS : vnc_client_set_encodings(tvb, pinfo, offset, - vnc_client_message_type_tree); + vnc_client_message_type_tree, + per_conversation_info); break; case VNC_CLIENT_MESSAGE_TYPE_FRAMEBUF_UPDATE_REQ : @@ -1856,7 +1863,8 @@ again: static void vnc_client_set_pixel_format(tvbuff_t *tvb, packet_info *pinfo, gint *offset, - proto_tree *tree) + proto_tree *tree, + vnc_conversation_t *per_conversation_info) { col_set_str(pinfo->cinfo, COL_INFO, "Client set pixel format"); @@ -1865,14 +1873,12 @@ vnc_client_set_pixel_format(tvbuff_t *tvb, packet_info *pinfo, gint *offset, proto_tree_add_item(tree, hf_vnc_client_bits_per_pixel, tvb, *offset, 1, ENC_BIG_ENDIAN); - vnc_bytes_per_pixel = tvb_get_guint8(tvb, *offset)/8; - vnc_set_bytes_per_pixel(pinfo, vnc_bytes_per_pixel); + vnc_set_bytes_per_pixel(pinfo, per_conversation_info, tvb_get_guint8(tvb, *offset) / 8); *offset += 1; proto_tree_add_item(tree, hf_vnc_client_depth, tvb, *offset, 1, ENC_BIG_ENDIAN); - vnc_depth = tvb_get_guint8(tvb, *offset); - vnc_set_depth(pinfo, vnc_depth); + vnc_set_depth(pinfo, per_conversation_info, tvb_get_guint8(tvb, *offset)); *offset += 1; proto_tree_add_item(tree, hf_vnc_client_big_endian_flag, tvb, *offset, @@ -1914,15 +1920,11 @@ vnc_client_set_pixel_format(tvbuff_t *tvb, packet_info *pinfo, gint *offset, static void vnc_client_set_encodings(tvbuff_t *tvb, packet_info *pinfo, gint *offset, - proto_tree *tree) + proto_tree *tree, + vnc_conversation_t *per_conversation_info) { guint16 number_of_encodings; guint counter; - vnc_packet_t *per_packet_info; - - per_packet_info = (vnc_packet_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_vnc, 0); - /* Our calling function should have set the packet's proto data already */ - DISSECTOR_ASSERT(per_packet_info != NULL); col_set_str(pinfo->cinfo, COL_INFO, "Client set encodings"); @@ -1933,7 +1935,7 @@ vnc_client_set_encodings(tvbuff_t *tvb, packet_info *pinfo, gint *offset, proto_tree_add_item(tree, hf_vnc_encoding_num, tvb, *offset, 2, ENC_BIG_ENDIAN); *offset += 2; - per_packet_info->preferred_encoding = -1; + per_conversation_info->preferred_encoding = -1; for(counter = 0; counter < number_of_encodings; counter++) { proto_tree_add_item(tree, @@ -1944,7 +1946,7 @@ vnc_client_set_encodings(tvbuff_t *tvb, packet_info *pinfo, gint *offset, * per xserver/hw/vnc/rfbserver.c:rfbProcessClientNormalMessage(). * Otherwise, use RAW as the preferred encoding. */ - if (per_packet_info->preferred_encoding == -1) { + if (per_conversation_info->preferred_encoding == -1) { int encoding; encoding = tvb_get_ntohl(tvb, *offset); @@ -1956,7 +1958,7 @@ vnc_client_set_encodings(tvbuff_t *tvb, packet_info *pinfo, gint *offset, case VNC_ENCODING_TYPE_HEXTILE: case VNC_ENCODING_TYPE_ZLIB: case VNC_ENCODING_TYPE_TIGHT: - per_packet_info->preferred_encoding = encoding; + per_conversation_info->preferred_encoding = encoding; break; } } @@ -1964,8 +1966,8 @@ vnc_client_set_encodings(tvbuff_t *tvb, packet_info *pinfo, gint *offset, *offset += 4; } - if (per_packet_info->preferred_encoding == -1) - per_packet_info->preferred_encoding = VNC_ENCODING_TYPE_RAW; + if (per_conversation_info->preferred_encoding == -1) + per_conversation_info->preferred_encoding = VNC_ENCODING_TYPE_RAW; } @@ -2055,7 +2057,7 @@ vnc_client_cut_text(tvbuff_t *tvb, packet_info *pinfo, gint *offset, *offset += 4; proto_tree_add_item(tree, hf_vnc_client_cut_text, tvb, *offset, - text_len, ENC_ASCII|ENC_NA); + text_len, ENC_ASCII); *offset += text_len; } @@ -2358,7 +2360,6 @@ vnc_rre_encoding(tvbuff_t *tvb, packet_info *pinfo, gint *offset, return(0); } - *offset += 2; VNC_BYTES_NEEDED(bytes_per_pixel); proto_tree_add_item(tree, hf_vnc_rre_bg_pixel, tvb, *offset, bytes_per_pixel, ENC_NA); @@ -2575,7 +2576,7 @@ vnc_server_identity(tvbuff_t *tvb, gint *offset, proto_tree *tree, { VNC_BYTES_NEEDED(width); proto_tree_add_item(tree, hf_vnc_server_identity, - tvb, *offset, width, ENC_ASCII|ENC_NA); + tvb, *offset, width, ENC_ASCII); *offset += width; return 0; /* bytes_needed */ @@ -2672,16 +2673,16 @@ vnc_mirrorlink(tvbuff_t *tvb, packet_info *pinfo, gint *offset, case VNC_ML_EXT_CLIENT_EVENT_CONFIGURATION : VNC_BYTES_NEEDED(28); proto_tree_add_item(tree, hf_vnc_mirrorlink_keyboard_language, - tvb, *offset, 2, ENC_ASCII|ENC_NA); + tvb, *offset, 2, ENC_ASCII); *offset += 2; proto_tree_add_item(tree, hf_vnc_mirrorlink_keyboard_country, - tvb, *offset, 2, ENC_ASCII|ENC_NA); + tvb, *offset, 2, ENC_ASCII); *offset += 2; proto_tree_add_item(tree, hf_vnc_mirrorlink_ui_language, - tvb, *offset, 2, ENC_ASCII|ENC_NA); + tvb, *offset, 2, ENC_ASCII); *offset += 2; proto_tree_add_item(tree, hf_vnc_mirrorlink_ui_country, - tvb, *offset, 2, ENC_ASCII|ENC_NA); + tvb, *offset, 2, ENC_ASCII); *offset += 2; proto_tree_add_item(tree, hf_vnc_mirrorlink_knob_keys, tvb, *offset, 4, ENC_BIG_ENDIAN); @@ -2864,7 +2865,7 @@ vnc_mirrorlink(tvbuff_t *tvb, packet_info *pinfo, gint *offset, *offset += 2; VNC_BYTES_NEEDED(num); proto_tree_add_item(tree, hf_vnc_mirrorlink_text, - tvb, *offset, num, ENC_ASCII|ENC_NA); + tvb, *offset, num, ENC_ASCII); *offset += num; break; @@ -3497,7 +3498,7 @@ vnc_server_cut_text(tvbuff_t *tvb, packet_info *pinfo, gint *offset, VNC_BYTES_NEEDED(text_len); proto_tree_add_item(tree, hf_vnc_server_cut_text, tvb, *offset, - text_len, ENC_ASCII|ENC_NA); + text_len, ENC_ASCII); *offset += text_len; return *offset; @@ -3505,28 +3506,36 @@ vnc_server_cut_text(tvbuff_t *tvb, packet_info *pinfo, gint *offset, static void -vnc_set_bytes_per_pixel(packet_info *pinfo, const guint8 bytes_per_pixel) +vnc_set_bytes_per_pixel(packet_info *pinfo, vnc_conversation_t *per_conversation_info, const guint8 bytes_per_pixel) { + if (PINFO_FD_VISITED(pinfo)) { + return; + } + vnc_packet_t *per_packet_info; per_packet_info = (vnc_packet_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_vnc, 0); /* Our calling function should have set the packet's proto data already */ DISSECTOR_ASSERT(per_packet_info != NULL); - per_packet_info->bytes_per_pixel = bytes_per_pixel; + per_packet_info->bytes_per_pixel = per_conversation_info->bytes_per_pixel = bytes_per_pixel; } static void -vnc_set_depth(packet_info *pinfo, const guint8 depth) +vnc_set_depth(packet_info *pinfo, vnc_conversation_t *per_conversation_info, const guint8 depth) { + if (PINFO_FD_VISITED(pinfo)) { + return; + } + vnc_packet_t *per_packet_info; per_packet_info = (vnc_packet_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_vnc, 0); /* Our calling function should have set the packet's proto data already */ DISSECTOR_ASSERT(per_packet_info != NULL); - per_packet_info->depth = depth; + per_packet_info->depth = per_conversation_info->depth = depth; } @@ -3594,7 +3603,7 @@ proto_register_vnc(void) { &hf_vnc_security_type, { "Security type", "vnc.security_type", FT_UINT8, BASE_DEC, VALS(vnc_security_types_vs), 0x0, - "Security types offered by the server (VNC versions => 3.007", HFILL } + "Security types offered by the server (VNC versions => 3.007)", HFILL } }, { &hf_vnc_server_security_type, { "Security type", "vnc.server_security_type", @@ -3618,12 +3627,12 @@ proto_register_vnc(void) }, { &hf_vnc_tight_tunnel_type_vendor, { "Tunnel type vendor", "vnc.tunnel_type_vendor", - FT_STRING, STR_ASCII, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, "Tunnel type vendor specific to TightVNC", HFILL } }, { &hf_vnc_tight_tunnel_type_signature, { "Tunnel type signature", "vnc.tunnel_type_signature", - FT_STRING, STR_ASCII, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, "Tunnel type signature specific to TightVNC", HFILL } }, { &hf_vnc_tight_num_auth_types, @@ -3764,12 +3773,12 @@ proto_register_vnc(void) { &hf_vnc_auth_error_length, { "Length of authentication error", "vnc.auth_error_len", FT_UINT32, BASE_DEC, NULL, 0x0, - "Authentication error length (present only if the authentication result is fail", HFILL } + "Authentication error length (present only if the authentication result is fail)", HFILL } }, { &hf_vnc_auth_error, { "Authentication error", "vnc.auth_error", FT_STRING, BASE_NONE, NULL, 0x0, - "Authentication error (present only if the authentication result is fail", HFILL } + "Authentication error (present only if the authentication result is fail)", HFILL } }, { &hf_vnc_ard_auth_generator, { "Generator", "vnc.ard_auth_generator", @@ -4367,7 +4376,7 @@ proto_register_vnc(void) { &hf_vnc_zrle_rle, { "RLE", "vnc.zrle_rle", - FT_UINT8, BASE_DEC, VALS(yes_no_vs), 0x80, /* Upper bit */ + FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80, /* Upper bit */ "Specifies that data is run-length encoded", HFILL } }, @@ -4507,7 +4516,7 @@ proto_register_vnc(void) }, { &hf_vnc_mirrorlink_pixel_format, { "Pixel Format", "vnc.mirrorlink_pixel_format", - FT_UINT16, BASE_HEX, NULL, 0x0, + FT_UINT32, BASE_HEX, NULL, 0x0, "Pixel format support", HFILL } }, { &hf_vnc_mirrorlink_display_width, @@ -4663,24 +4672,24 @@ proto_register_vnc(void) "Unique application id", HFILL } }, { &hf_vnc_mirrorlink_fb_block_x, - { "Frambuffer X", "vnc.mirrorlink_fb_block_x", + { "Framebuffer X", "vnc.mirrorlink_fb_block_x", FT_UINT16, BASE_DEC, NULL, 0x0, - "Frambuffer blocking - X position", HFILL } + "Framebuffer blocking - X position", HFILL } }, { &hf_vnc_mirrorlink_fb_block_y, - { "Frambuffer Y", "vnc.mirrorlink_fb_block_y", + { "Framebuffer Y", "vnc.mirrorlink_fb_block_y", FT_UINT16, BASE_DEC, NULL, 0x0, - "Frambuffer blocking - Y position", HFILL } + "Framdbuffer blocking - Y position", HFILL } }, { &hf_vnc_mirrorlink_fb_block_width, - { "Frambuffer Width", "vnc.mirrorlink_fb_block_width", + { "Framebuffer Width", "vnc.mirrorlink_fb_block_width", FT_UINT16, BASE_DEC, NULL, 0x0, - "Frambuffer blocking - Width", HFILL } + "Framebuffer blocking - Width", HFILL } }, { &hf_vnc_mirrorlink_fb_block_height, - { "Frambuffer Height", "vnc.mirrorlink_fb_block_height", + { "Framebuffer Height", "vnc.mirrorlink_fb_block_height", FT_UINT16, BASE_DEC, NULL, 0x0, - "Frambuffer blocking - Height", HFILL } + "Framebuffer blocking - Height", HFILL } }, { &hf_vnc_mirrorlink_fb_block_reason, { "Reason", "vnc.mirrorlink_fb_block_reason", @@ -4888,6 +4897,7 @@ proto_register_vnc(void) /* Register the protocol name and description */ proto_vnc = proto_register_protocol("Virtual Network Computing", "VNC", "vnc"); + vnc_handle = register_dissector("vnc", dissect_vnc, proto_vnc); /* Required function calls to register the header fields and subtrees */ proto_register_field_array(proto_vnc, hf, array_length(hf)); @@ -4909,8 +4919,6 @@ proto_register_vnc(void) void proto_reg_handoff_vnc(void) { - vnc_handle = create_dissector_handle(dissect_vnc, proto_vnc); - dissector_add_uint_range_with_preference("tcp.port", VNC_PORT_RANGE, vnc_handle); heur_dissector_add("tcp", test_vnc_protocol, "VNC over TCP", "vnc_tcp", proto_vnc, HEURISTIC_ENABLE); /* We don't register a port for the VNC HTTP server because |