diff options
Diffstat (limited to 'epan/dissectors/packet-msrp.c')
-rw-r--r-- | epan/dissectors/packet-msrp.c | 101 |
1 files changed, 42 insertions, 59 deletions
diff --git a/epan/dissectors/packet-msrp.c b/epan/dissectors/packet-msrp.c index c357379586..b3099c8036 100644 --- a/epan/dissectors/packet-msrp.c +++ b/epan/dissectors/packet-msrp.c @@ -25,7 +25,7 @@ #include <wsutil/str_util.h> #include "packet-msrp.h" -#include "packet-http.h" +#include "packet-media-type.h" void proto_register_msrp(void); void proto_reg_handoff_msrp(void); @@ -36,35 +36,35 @@ void proto_reg_handoff_msrp(void); #define MSRP_HDR_LEN (strlen (MSRP_HDR)) /* Initialize the protocol and registered fields */ -static int proto_msrp = -1; +static int proto_msrp; /* Initialize the subtree pointers */ -static int ett_msrp = -1; -static int ett_raw_text = -1; -static int ett_msrp_reqresp = -1; -static int ett_msrp_hdr = -1; -static int ett_msrp_data = -1; -static int ett_msrp_end_line = -1; -static int ett_msrp_setup = -1; - -static int hf_msrp_response_line = -1; -static int hf_msrp_request_line = -1; -static int hf_msrp_transactionID = -1; -static int hf_msrp_method = -1; -static int hf_msrp_status_code = -1; -static int hf_msrp_hdr = -1; -static int hf_msrp_msg_hdr = -1; -static int hf_msrp_end_line = -1; -static int hf_msrp_cnt_flg = -1; - -static int hf_msrp_data = -1; - -static expert_field ei_msrp_status_code_invalid = EI_INIT; +static int ett_msrp; +static int ett_raw_text; +static int ett_msrp_reqresp; +static int ett_msrp_hdr; +static int ett_msrp_data; +static int ett_msrp_end_line; +static int ett_msrp_setup; + +static int hf_msrp_response_line; +static int hf_msrp_request_line; +static int hf_msrp_transactionID; +static int hf_msrp_method; +static int hf_msrp_status_code; +static int hf_msrp_hdr; +static int hf_msrp_msg_hdr; +static int hf_msrp_end_line; +static int hf_msrp_cnt_flg; + +static int hf_msrp_data; + +static expert_field ei_msrp_status_code_invalid; /* MSRP setup fields */ -static int hf_msrp_setup = -1; -static int hf_msrp_setup_frame = -1; -static int hf_msrp_setup_method = -1; +static int hf_msrp_setup; +static int hf_msrp_setup_frame; +static int hf_msrp_setup_method; typedef struct { const char *name; @@ -89,24 +89,7 @@ static const msrp_header_t msrp_headers[] = { { "Authentication-Info"}, /* 15 */ }; -static gint hf_header_array[] = { - -1, /* 0"Unknown-header" - Pad so that the real headers start at index 1 */ - -1, /* 1"From-Path */ - -1, /* 2"To-Path */ - -1, /* 3"Message-ID" */ - -1, /* 4"Success-Report" */ - -1, /* 5"Failure-Report" */ - -1, /* 6"Byte-Range" */ - -1, /* 7"Status" */ - -1, /* 8"Content-Type" */ - -1, /* 9"Content-ID" */ - -1, /* 10"Content-Description" */ - -1, /* 11"Content-Disposition" */ - -1, /* 12"Use-Path" */ - -1, /* 13"WWW-Authenticate" */ - -1, /* 14"Authorization" */ - -1, /* 15"Authentication-Info" */ -}; +static gint hf_header_array[array_length(msrp_headers)]; #define MSRP_FROM_PATH 1 #define MSRP_TO_PATH 2 @@ -165,14 +148,14 @@ msrp_add_address( packet_info *pinfo, * Check if the ip address and port combination is not * already registered as a conversation. */ - p_conv = find_conversation( pinfo->num, addr, &null_addr, ENDPOINT_TCP, port, 0, + p_conv = find_conversation( pinfo->num, addr, &null_addr, CONVERSATION_TCP, port, 0, NO_ADDR_B | NO_PORT_B); /* * If not, create a new conversation. */ if (!p_conv) { - p_conv = conversation_new( pinfo->num, addr, &null_addr, ENDPOINT_TCP, + p_conv = conversation_new( pinfo->num, addr, &null_addr, CONVERSATION_TCP, (guint32)port, 0, NO_ADDR2 | NO_PORT2); } @@ -219,7 +202,7 @@ show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { /* First time, get info from conversation */ p_conv = find_conversation(pinfo->num, &pinfo->net_dst, &pinfo->net_src, - ENDPOINT_TCP, + CONVERSATION_TCP, pinfo->destport, pinfo->srcport, 0); if (p_conv) @@ -457,7 +440,7 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ int found_match = 0; gint content_type_len, content_type_parameter_str_len; gchar *media_type_str_lower_case = NULL; - http_message_info_t message_info = { HTTP_OTHERS, NULL, NULL, NULL }; + media_content_info_t content_info = { MEDIA_CONTAINER_OTHER, NULL, NULL, NULL }; tvbuff_t *next_tvb; gint parameter_offset; gint semi_colon_offset; @@ -550,9 +533,9 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ guint32 msrp_status_code = -1; gboolean msrp_status_code_valid; proto_item* pi; - th = proto_tree_add_item(msrp_tree,hf_msrp_response_line,tvb,0,linelen,ENC_UTF_8|ENC_NA); + th = proto_tree_add_item(msrp_tree,hf_msrp_response_line,tvb,0,linelen,ENC_UTF_8); reqresp_tree = proto_item_add_subtree(th, ett_msrp_reqresp); - proto_tree_add_item(reqresp_tree,hf_msrp_transactionID,tvb,token_2_start,token_2_len,ENC_UTF_8|ENC_NA); + proto_tree_add_item(reqresp_tree,hf_msrp_transactionID,tvb,token_2_start,token_2_len,ENC_UTF_8); msrp_status_code_valid = ws_strtou32( tvb_get_string_enc(pinfo->pool, tvb, token_3_start, token_3_len, ENC_UTF_8|ENC_NA), NULL, & msrp_status_code); @@ -560,10 +543,10 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ if (!msrp_status_code_valid) expert_add_info(pinfo, pi, &ei_msrp_status_code_invalid); }else{ - th = proto_tree_add_item(msrp_tree,hf_msrp_request_line,tvb,0,linelen,ENC_UTF_8|ENC_NA); + th = proto_tree_add_item(msrp_tree,hf_msrp_request_line,tvb,0,linelen,ENC_UTF_8); reqresp_tree = proto_item_add_subtree(th, ett_msrp_reqresp); - proto_tree_add_item(reqresp_tree,hf_msrp_transactionID,tvb,token_2_start,token_2_len,ENC_UTF_8|ENC_NA); - proto_tree_add_item(reqresp_tree,hf_msrp_method,tvb,token_3_start,token_3_len,ENC_UTF_8|ENC_NA); + proto_tree_add_item(reqresp_tree,hf_msrp_transactionID,tvb,token_2_start,token_2_len,ENC_UTF_8); + proto_tree_add_item(reqresp_tree,hf_msrp_method,tvb,token_3_start,token_3_len,ENC_UTF_8); } /* Conversation setup info */ @@ -650,7 +633,7 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ parameter_offset++; content_type_len = semi_colon_offset - value_offset; content_type_parameter_str_len = line_end_offset - parameter_offset; - message_info.media_str = tvb_get_string_enc(pinfo->pool, tvb, + content_info.media_str = tvb_get_string_enc(pinfo->pool, tvb, parameter_offset, content_type_parameter_str_len, ENC_UTF_8|ENC_NA); } media_type_str_lower_case = ascii_strdown_inplace( @@ -675,7 +658,7 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ /* Create new tree & tvb for data */ next_tvb = tvb_new_subset_remaining(tvb, next_offset); ti = proto_tree_add_item(msrp_tree, hf_msrp_data, tvb, - next_offset, -1, ENC_UTF_8|ENC_NA); + next_offset, -1, ENC_UTF_8); msrp_data_tree = proto_item_add_subtree(ti, ett_msrp_data); /* give the content type parameters to sub dissectors */ @@ -684,7 +667,7 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ found_match = dissector_try_string(media_type_dissector_table, media_type_str_lower_case, next_tvb, pinfo, - msrp_data_tree, &message_info); + msrp_data_tree, &content_info); /* If no match dump as text */ } if ( found_match == 0 ) @@ -703,12 +686,12 @@ dissect_msrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ /* End line */ - ti = proto_tree_add_item(msrp_tree,hf_msrp_end_line,tvb,end_line_offset,end_line_len,ENC_UTF_8|ENC_NA); + ti = proto_tree_add_item(msrp_tree,hf_msrp_end_line,tvb,end_line_offset,end_line_len,ENC_UTF_8); msrp_end_tree = proto_item_add_subtree(ti, ett_msrp_end_line); - proto_tree_add_item(msrp_end_tree,hf_msrp_transactionID,tvb,end_line_offset + 7,token_2_len,ENC_UTF_8|ENC_NA); + proto_tree_add_item(msrp_end_tree,hf_msrp_transactionID,tvb,end_line_offset + 7,token_2_len,ENC_UTF_8); /* continuation-flag */ - proto_tree_add_item(msrp_end_tree,hf_msrp_cnt_flg,tvb,end_line_offset+end_line_len-1,1,ENC_UTF_8|ENC_NA); + proto_tree_add_item(msrp_end_tree,hf_msrp_cnt_flg,tvb,end_line_offset+end_line_len-1,1,ENC_UTF_8); if (global_msrp_raw_text && tree) { raw_tree = proto_tree_add_subtree(tree, tvb, 0, -1, ett_msrp, NULL, "Message Session Relay Protocol(as raw text)"); |