diff options
author | Guy Harris <guy@alum.mit.edu> | 2009-05-05 19:33:46 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2009-05-05 19:33:46 +0000 |
commit | cfe974aadd33da87e3f94c1226ab6de0f847d920 (patch) | |
tree | af534cbbed5dde4b3fe77a21bc46c00b4a813965 /epan | |
parent | 6c46249150da295635cb09167585860d8669206f (diff) |
The expert_item pointers and expert_status values don't need to be
static; make them auto variables.
Make sure that expert information is added outside "if (tree) { }", so
it gets added even if we're not building the protocol tree.
Clean up white space.
svn path=/trunk/; revision=28281
Diffstat (limited to 'epan')
-rwxr-xr-x | epan/dissectors/ncp2222.py | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-ncp-nmas.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-ncp-sss.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-ncp.c | 851 | ||||
-rw-r--r-- | epan/dissectors/packet-ncp2222.inc | 37 | ||||
-rw-r--r-- | epan/dissectors/packet-ndps.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-srvloc.c | 1038 |
7 files changed, 972 insertions, 974 deletions
diff --git a/epan/dissectors/ncp2222.py b/epan/dissectors/ncp2222.py index 81a033b409..75205d0cd8 100755 --- a/epan/dissectors/ncp2222.py +++ b/epan/dissectors/ncp2222.py @@ -6263,8 +6263,6 @@ static int hf_iter_search = -1; static int hf_iter_other = -1; static int hf_nds_oid = -1; -static proto_item *expert_item = NULL; - """ # Look at all packet types in the packets collection, and cull information diff --git a/epan/dissectors/packet-ncp-nmas.c b/epan/dissectors/packet-ncp-nmas.c index dfc66f527f..689b8d6def 100644 --- a/epan/dissectors/packet-ncp-nmas.c +++ b/epan/dissectors/packet-ncp-nmas.c @@ -68,8 +68,6 @@ static int hf_enc_data = -1; static int hf_reply_buffer_size = -1; static int hf_encrypt_error = -1; -static proto_item *expert_item = NULL; - static const value_string nmas_func_enum[] = { { 0x01, "Ping" }, { 0x02, "Fragment" }, @@ -488,6 +486,8 @@ dissect_nmas_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, guin guint32 return_code=0, encrypt_error=0; proto_tree *atree; proto_item *aitem; + proto_item *expert_item; + foffset = 8; if (request_value) { diff --git a/epan/dissectors/packet-ncp-sss.c b/epan/dissectors/packet-ncp-sss.c index 5a7d153a2d..508d615ebe 100644 --- a/epan/dissectors/packet-ncp-sss.c +++ b/epan/dissectors/packet-ncp-sss.c @@ -86,8 +86,6 @@ static int hfbit30 = -1; static int hfbit31 = -1; static int hfbit32 = -1; -static proto_item *expert_item = NULL; - static const value_string sss_func_enum[] = { { 0x00000001, "Ping Server" }, { 0x00000002, "Fragment" }, @@ -722,6 +720,8 @@ dissect_sss_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, guint proto_tree *atree; proto_item *aitem; + proto_item *expert_item; + foffset = 8; if (request_value) { diff --git a/epan/dissectors/packet-ncp.c b/epan/dissectors/packet-ncp.c index 368c05b073..3e7df69d12 100644 --- a/epan/dissectors/packet-ncp.c +++ b/epan/dissectors/packet-ncp.c @@ -116,8 +116,6 @@ static gboolean ncp_desegment = TRUE; static dissector_handle_t data_handle; -static proto_item *expert_item = NULL; - #define TCP_PORT_NCP 524 #define UDP_PORT_NCP 524 @@ -255,82 +253,83 @@ mncp_postseq_cleanup(void) static mncp_rhash_value* mncp_hash_insert(conversation_t *conversation, guint32 nwconnection, guint8 nwtask, packet_info *pinfo) { - mncp_rhash_key *key; - mncp_rhash_value *value; + mncp_rhash_key *key; + mncp_rhash_value *value; - /* Now remember the request, so we can find it if we later - a reply to it. Track by conversation, connection, and task number. + /* Now remember the request, so we can find it if we later + a reply to it. Track by conversation, connection, and task number. in NetWare these values determine each unique session */ - key = se_alloc(sizeof(mncp_rhash_key)); - key->conversation = conversation; + key = se_alloc(sizeof(mncp_rhash_key)); + key->conversation = conversation; key->nwconnection = nwconnection; key->nwtask = nwtask; - value = se_alloc(sizeof(mncp_rhash_value)); + value = se_alloc(sizeof(mncp_rhash_value)); - g_hash_table_insert(mncp_rhash, key, value); + g_hash_table_insert(mncp_rhash, key, value); if (ncp_echo_conn && nwconnection != 65535) { expert_add_info_format(pinfo, NULL, PI_RESPONSE_CODE, PI_CHAT, "Detected New Server Session. Connection %d, Task %d", nwconnection, nwtask); value->session_start_packet_num = pinfo->fd->num; } - return value; + return value; } /* Returns the ncp_rec*, or NULL if not found. */ static mncp_rhash_value* mncp_hash_lookup(conversation_t *conversation, guint32 nwconnection, guint8 nwtask) { - mncp_rhash_key key; + mncp_rhash_key key; - key.conversation = conversation; + key.conversation = conversation; key.nwconnection = nwconnection; key.nwtask = nwtask; - return g_hash_table_lookup(mncp_rhash, &key); + return g_hash_table_lookup(mncp_rhash, &key); } /* * Burst packet system flags. */ -#define ABT 0x04 /* Abort request */ +#define ABT 0x04 /* Abort request */ #define BSY 0x08 /* Server Busy */ -#define EOB 0x10 /* End of burst */ +#define EOB 0x10 /* End of burst */ #define LST 0x40 /* Include Fragment List */ -#define SYS 0x80 /* System packet */ +#define SYS 0x80 /* System packet */ static void dissect_ncp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_tcp) { - proto_tree *ncp_tree = NULL; - proto_item *ti; - struct ncp_ip_header ncpiph; - struct ncp_ip_rqhdr ncpiphrq; - guint16 ncp_burst_seqno, ncp_ack_seqno; - guint16 flags = 0; - proto_tree *flags_tree = NULL; - int hdr_offset = 0; - int commhdr = 0; - int offset = 0; - gint length_remaining; - tvbuff_t *next_tvb; - guint32 testvar = 0, ncp_burst_command, burst_len, burst_off, burst_file; - guint8 subfunction; - guint32 nw_connection = 0, data_offset; - guint16 data_len = 0; - guint16 missing_fraglist_count = 0; - mncp_rhash_value *request_value = NULL; - conversation_t *conversation; - - if (check_col(pinfo->cinfo, COL_PROTOCOL)) - col_set_str(pinfo->cinfo, COL_PROTOCOL, "NCP"); - if (check_col(pinfo->cinfo, COL_INFO)) - col_clear(pinfo->cinfo, COL_INFO); - - hdr_offset = 0; - ncp_hdr = &header; + proto_tree *ncp_tree = NULL; + proto_item *ti; + struct ncp_ip_header ncpiph; + struct ncp_ip_rqhdr ncpiphrq; + guint16 ncp_burst_seqno, ncp_ack_seqno; + guint16 flags = 0; + proto_tree *flags_tree = NULL; + int hdr_offset = 0; + int commhdr = 0; + int offset = 0; + gint length_remaining; + tvbuff_t *next_tvb; + guint32 testvar = 0, ncp_burst_command, burst_len, burst_off, burst_file; + guint8 subfunction; + guint32 nw_connection = 0, data_offset; + guint16 data_len = 0; + guint16 missing_fraglist_count = 0; + mncp_rhash_value *request_value = NULL; + conversation_t *conversation; + proto_item *expert_item; + + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "NCP"); + if (check_col(pinfo->cinfo, COL_INFO)) + col_clear(pinfo->cinfo, COL_INFO); + + hdr_offset = 0; + ncp_hdr = &header; commhdr = hdr_offset; ti = proto_tree_add_item(tree, proto_ncp, tvb, 0, -1, FALSE); @@ -339,16 +338,16 @@ dissect_ncp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (tvb_get_ntohl(tvb, hdr_offset) != NCPIP_RQST && tvb_get_ntohl(tvb, hdr_offset) != NCPIP_RPLY) commhdr += 1; /* Get NCPIP Header data */ - ncpiph.signature = tvb_get_ntohl(tvb, commhdr); + ncpiph.signature = tvb_get_ntohl(tvb, commhdr); proto_tree_add_uint(ncp_tree, hf_ncp_ip_sig, tvb, commhdr, 4, ncpiph.signature); - ncpiph.length = (0x7fffffff & tvb_get_ntohl(tvb, commhdr+4)); + ncpiph.length = (0x7fffffff & tvb_get_ntohl(tvb, commhdr+4)); proto_tree_add_uint(ncp_tree, hf_ncp_ip_length, tvb, commhdr+4, 4, ncpiph.length); commhdr += 8; if (ncpiph.signature == NCPIP_RQST) { - ncpiphrq.version = tvb_get_ntohl(tvb, commhdr); + ncpiphrq.version = tvb_get_ntohl(tvb, commhdr); proto_tree_add_uint(ncp_tree, hf_ncp_ip_ver, tvb, commhdr, 4, ncpiphrq.version); commhdr += 4; - ncpiphrq.rplybufsize = tvb_get_ntohl(tvb, commhdr); + ncpiphrq.rplybufsize = tvb_get_ntohl(tvb, commhdr); proto_tree_add_uint(ncp_tree, hf_ncp_ip_rplybufsize, tvb, commhdr, 4, ncpiphrq.rplybufsize); commhdr += 4; } @@ -361,16 +360,16 @@ dissect_ncp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } } } else { - /* Initialize this structure, we use it below */ - memset(&ncpiph, 0, sizeof(ncpiph)); + /* Initialize this structure, we use it below */ + memset(&ncpiph, 0, sizeof(ncpiph)); } - header.type = tvb_get_ntohs(tvb, commhdr); - header.sequence = tvb_get_guint8(tvb, commhdr+2); - header.conn_low = tvb_get_guint8(tvb, commhdr+3); + header.type = tvb_get_ntohs(tvb, commhdr); + header.sequence = tvb_get_guint8(tvb, commhdr+2); + header.conn_low = tvb_get_guint8(tvb, commhdr+3); header.task = tvb_get_guint8(tvb, commhdr+4); - header.conn_high = tvb_get_guint8(tvb, commhdr+5); - proto_tree_add_uint(ncp_tree, hf_ncp_type, tvb, commhdr, 2, header.type); + header.conn_high = tvb_get_guint8(tvb, commhdr+5); + proto_tree_add_uint(ncp_tree, hf_ncp_type, tvb, commhdr, 2, header.type); nw_connection = (header.conn_high*256)+header.conn_low; /* Ok, we need to track the conversation so that we can @@ -460,392 +459,390 @@ dissect_ncp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } } } - } + } - tap_queue_packet(ncp_tap.hdr, pinfo, ncp_hdr); + tap_queue_packet(ncp_tap.hdr, pinfo, ncp_hdr); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_str(pinfo->cinfo, COL_INFO, - val_to_str(header.type, ncp_type_vals, "Unknown type (0x%04x)")); - } + if (check_col(pinfo->cinfo, COL_INFO)) { + col_add_str(pinfo->cinfo, COL_INFO, + val_to_str(header.type, ncp_type_vals, "Unknown type (0x%04x)")); + } - /* - * Process the packet-type-specific header. - */ - switch (header.type) { - - case NCP_BROADCAST_SLOT: /* Server Broadcast */ - proto_tree_add_uint(ncp_tree, hf_ncp_seq, tvb, commhdr + 2, 1, header.sequence); - proto_tree_add_uint(ncp_tree, hf_ncp_connection,tvb, commhdr + 3, 3, nw_connection); - proto_tree_add_item(ncp_tree, hf_ncp_task, tvb, commhdr + 4, 1, FALSE); - proto_tree_add_item(ncp_tree, hf_ncp_oplock_flag, tvb, commhdr + 9, 1, tvb_get_guint8(tvb, commhdr+9)); - proto_tree_add_item(ncp_tree, hf_ncp_oplock_handle, tvb, commhdr + 10, 4, FALSE); + /* + * Process the packet-type-specific header. + */ + switch (header.type) { + + case NCP_BROADCAST_SLOT: /* Server Broadcast */ + proto_tree_add_uint(ncp_tree, hf_ncp_seq, tvb, commhdr + 2, 1, header.sequence); + proto_tree_add_uint(ncp_tree, hf_ncp_connection,tvb, commhdr + 3, 3, nw_connection); + proto_tree_add_item(ncp_tree, hf_ncp_task, tvb, commhdr + 4, 1, FALSE); + proto_tree_add_item(ncp_tree, hf_ncp_oplock_flag, tvb, commhdr + 9, 1, tvb_get_guint8(tvb, commhdr+9)); + proto_tree_add_item(ncp_tree, hf_ncp_oplock_handle, tvb, commhdr + 10, 4, FALSE); if ((tvb_get_guint8(tvb, commhdr+9)==0x24) && ncp_echo_file) { expert_add_info_format(pinfo, NULL, PI_RESPONSE_CODE, PI_CHAT, "Server requesting station to clear oplock on handle - %08x", tvb_get_ntohl(tvb, commhdr+10)); } - break; - - case NCP_LIP_ECHO: /* Lip Echo Packet */ - proto_tree_add_item(ncp_tree, hf_lip_echo, tvb, commhdr, 13, FALSE); - break; - - case NCP_BURST_MODE_XFER: /* Packet Burst Packet */ - /* - * XXX - we should keep track of whether there's a burst - * outstanding on a connection and, if not, treat the - * beginning of the data as a burst header. - * - * The burst header contains: - * - * 4 bytes of little-endian function number: - * 1 = read, 2 = write; - * - * 4 bytes of file handle; - * - * 8 reserved bytes; - * - * 4 bytes of big-endian file offset; - * - * 4 bytes of big-endian byte count. - * - * The data follows for a burst write operation. - * - * The first packet of a burst read reply contains: - * - * 4 bytes of little-endian result code: - * 0: No error - * 1: Initial error - * 2: I/O error - * 3: No data read; - * - * 4 bytes of returned byte count (big-endian?). - * - * The data follows. - * - * Each burst of a write request is responded to with a - * burst packet with a 2-byte little-endian result code: - * - * 0: Write successful - * 4: Write error - */ - flags = tvb_get_guint8(tvb, commhdr + 2); - - ti = proto_tree_add_uint(ncp_tree, hf_ncp_system_flags, - tvb, commhdr + 2, 1, flags); - flags_tree = proto_item_add_subtree(ti, ett_ncp_system_flags); - - proto_tree_add_item(flags_tree, hf_ncp_system_flags_abt, - tvb, commhdr + 2, 1, FALSE); - if (flags & ABT) { - proto_item_append_text(ti, " ABT"); - } - flags&=(~( ABT )); - - proto_tree_add_item(flags_tree, hf_ncp_system_flags_bsy, - tvb, commhdr + 2, 1, FALSE); - if (flags & BSY) { - proto_item_append_text(ti, " BSY"); - } - flags&=(~( BSY )); - - proto_tree_add_item(flags_tree, hf_ncp_system_flags_eob, - tvb, commhdr + 2, 1, FALSE); - if (flags & EOB) { - proto_item_append_text(ti, " EOB"); - } - flags&=(~( EOB )); - - proto_tree_add_item(flags_tree, hf_ncp_system_flags_lst, - tvb, commhdr + 2, 1, FALSE); - if (flags & LST) { - proto_item_append_text(ti, " LST"); - } - flags&=(~( LST )); - - proto_tree_add_item(flags_tree, hf_ncp_system_flags_sys, - tvb, commhdr + 2, 1, FALSE); - if (flags & SYS) { - proto_item_append_text(ti, " SYS"); - } - flags&=(~( SYS )); - - - proto_tree_add_item(ncp_tree, hf_ncp_stream_type, - tvb, commhdr + 3, 1, FALSE); - proto_tree_add_item(ncp_tree, hf_ncp_src_connection, - tvb, commhdr + 4, 4, FALSE); - proto_tree_add_item(ncp_tree, hf_ncp_dst_connection, - tvb, commhdr + 8, 4, FALSE); - proto_tree_add_item(ncp_tree, hf_ncp_packet_seqno, - tvb, commhdr + 12, 4, FALSE); - proto_tree_add_item(ncp_tree, hf_ncp_delay_time, - tvb, commhdr + 16, 4, FALSE); - ncp_burst_seqno = tvb_get_ntohs(tvb, commhdr+20); - proto_tree_add_item(ncp_tree, hf_ncp_burst_seqno, - tvb, commhdr + 20, 2, FALSE); - ncp_ack_seqno = tvb_get_ntohs(tvb, commhdr+22); - proto_tree_add_item(ncp_tree, hf_ncp_ack_seqno, - tvb, commhdr + 22, 2, FALSE); - proto_tree_add_item(ncp_tree, hf_ncp_burst_len, - tvb, commhdr + 24, 4, FALSE); - data_offset = tvb_get_ntohl(tvb, commhdr + 28); - proto_tree_add_uint(ncp_tree, hf_ncp_data_offset, - tvb, commhdr + 28, 4, data_offset); - data_len = tvb_get_ntohs(tvb, commhdr + 32); - proto_tree_add_uint(ncp_tree, hf_ncp_data_bytes, - tvb, commhdr + 32, 2, data_len); - missing_fraglist_count = tvb_get_ntohs(tvb, commhdr + 34); - proto_tree_add_item(ncp_tree, hf_ncp_missing_fraglist_count, - tvb, commhdr + 34, 2, FALSE); - offset = commhdr + 36; - if (!(flags & SYS) && ncp_burst_seqno == ncp_ack_seqno && - data_offset == 0) { - /* - * This is either a Burst Read or Burst Write - * command. The data length includes the burst - * mode header, plus any data in the command - * (there shouldn't be any in a read, but there - * might be some in a write). - */ - if (data_len < 4) - return; - ncp_burst_command = tvb_get_ntohl(tvb, offset); - proto_tree_add_item(ncp_tree, hf_ncp_burst_command, - tvb, offset, 4, FALSE); - offset += 4; - data_len -= 4; - - if (data_len < 4) - return; - burst_file = tvb_get_ntohl(tvb, offset); - proto_tree_add_item(ncp_tree, hf_ncp_burst_file_handle, - tvb, offset, 4, FALSE); - offset += 4; - data_len -= 4; - - if (data_len < 8) - return; - proto_tree_add_item(ncp_tree, hf_ncp_burst_reserved, - tvb, offset, 8, FALSE); - offset += 8; - data_len -= 8; - - if (data_len < 4) - return; - burst_off = tvb_get_ntohl(tvb, offset); - proto_tree_add_uint(ncp_tree, hf_ncp_burst_offset, - tvb, offset, 4, burst_off); - offset += 4; - data_len -= 4; - - if (data_len < 4) - return; - burst_len = tvb_get_ntohl(tvb, offset); - proto_tree_add_uint(ncp_tree, hf_ncp_burst_len, - tvb, offset, 4, burst_len); - offset += 4; - data_len -= 4; - - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, - "%s %d bytes starting at offset %d in file 0x%08x", - val_to_str(ncp_burst_command, - burst_command, "Unknown (0x%08x)"), - burst_len, burst_off, burst_file); - } - break; - } else { - if (tvb_get_guint8(tvb, commhdr + 2) & 0x10) { - if (check_col(pinfo->cinfo, COL_INFO)) { - col_set_str(pinfo->cinfo, COL_INFO, - "End of Burst"); - } - } - } - break; - - case NCP_ALLOCATE_SLOT: /* Allocate Slot Request */ - length_remaining = tvb_length_remaining(tvb, commhdr + 4); - if (length_remaining > 4) { - testvar = tvb_get_ntohl(tvb, commhdr+4); - if (testvar == 0x4c495020) { - proto_tree_add_item(ncp_tree, hf_lip_echo, tvb, commhdr+4, 13, FALSE); - break; - } - } - /* otherwise fall through */ - - case NCP_POSITIVE_ACK: /* Positive Acknowledgement */ - case NCP_SERVICE_REQUEST: /* Server NCP Request */ - case NCP_SERVICE_REPLY: /* Server NCP Reply */ - case NCP_WATCHDOG: /* Watchdog Packet */ - case NCP_DEALLOCATE_SLOT: /* Deallocate Slot Request */ - default: - proto_tree_add_uint(ncp_tree, hf_ncp_seq, tvb, commhdr + 2, 1, header.sequence); - proto_tree_add_uint(ncp_tree, hf_ncp_connection,tvb, commhdr + 3, 3, nw_connection); - proto_tree_add_item(ncp_tree, hf_ncp_task, tvb, commhdr + 4, 1, FALSE); - break; - } + break; + + case NCP_LIP_ECHO: /* Lip Echo Packet */ + proto_tree_add_item(ncp_tree, hf_lip_echo, tvb, commhdr, 13, FALSE); + break; + + case NCP_BURST_MODE_XFER: /* Packet Burst Packet */ + /* + * XXX - we should keep track of whether there's a burst + * outstanding on a connection and, if not, treat the + * beginning of the data as a burst header. + * + * The burst header contains: + * + * 4 bytes of little-endian function number: + * 1 = read, 2 = write; + * + * 4 bytes of file handle; + * + * 8 reserved bytes; + * + * 4 bytes of big-endian file offset; + * + * 4 bytes of big-endian byte count. + * + * The data follows for a burst write operation. + * + * The first packet of a burst read reply contains: + * + * 4 bytes of little-endian result code: + * 0: No error + * 1: Initial error + * 2: I/O error + * 3: No data read; + * + * 4 bytes of returned byte count (big-endian?). + * + * The data follows. + * + * Each burst of a write request is responded to with a + * burst packet with a 2-byte little-endian result code: + * + * 0: Write successful + * 4: Write error + */ + flags = tvb_get_guint8(tvb, commhdr + 2); + + ti = proto_tree_add_uint(ncp_tree, hf_ncp_system_flags, + tvb, commhdr + 2, 1, flags); + flags_tree = proto_item_add_subtree(ti, ett_ncp_system_flags); - /* - * Process the packet body. - */ - switch (header.type) { - - case NCP_ALLOCATE_SLOT: /* Allocate Slot Request */ - length_remaining = tvb_length_remaining(tvb, commhdr + 4); - if (length_remaining > 4) { - testvar = tvb_get_ntohl(tvb, commhdr+4); - if (testvar == 0x4c495020) { - proto_tree_add_text(ncp_tree, tvb, commhdr, -1, - "Lip Echo Packet"); - /*break;*/ - } - } - next_tvb = tvb_new_subset(tvb, commhdr, -1, -1); - dissect_ncp_request(next_tvb, pinfo, nw_connection, - header.sequence, header.type, ncp_tree); - break; - - case NCP_DEALLOCATE_SLOT: /* Deallocate Slot Request */ - next_tvb = tvb_new_subset(tvb, commhdr, -1, -1); - dissect_ncp_request(next_tvb, pinfo, nw_connection, - header.sequence, header.type, ncp_tree); - break; - - case NCP_SERVICE_REQUEST: /* Server NCP Request */ - case NCP_BROADCAST_SLOT: /* Server Broadcast Packet */ - next_tvb = tvb_new_subset(tvb, commhdr, -1, -1); - if (tvb_get_guint8(tvb, commhdr+6) == 0x68) { - subfunction = tvb_get_guint8(tvb, commhdr+7); - switch (subfunction) { - - case 0x02: /* NDS Frag Packet to decode */ - dissect_nds_request(next_tvb, pinfo, - nw_connection, header.sequence, - header.type, ncp_tree); - break; - - case 0x01: /* NDS Ping */ - dissect_ping_req(next_tvb, pinfo, - nw_connection, header.sequence, - header.type, ncp_tree); - break; - - default: - dissect_ncp_request(next_tvb, pinfo, - nw_connection, header.sequence, - header.type, ncp_tree); - break; - } - } else { - dissect_ncp_request(next_tvb, pinfo, nw_connection, - header.sequence, header.type, ncp_tree); - } - break; - - case NCP_SERVICE_REPLY: /* Server NCP Reply */ - next_tvb = tvb_new_subset(tvb, commhdr, -1, -1); - nds_defrag(next_tvb, pinfo, nw_connection, header.sequence, - header.type, ncp_tree, &ncp_tap); - break; - - case NCP_POSITIVE_ACK: /* Positive Acknowledgement */ - /* - * XXX - this used to call "nds_defrag()", which would - * clear out "frags". Was that the right thing to - * do? - */ - next_tvb = tvb_new_subset(tvb, commhdr, -1, -1); - dissect_ncp_reply(next_tvb, pinfo, nw_connection, - header.sequence, header.type, ncp_tree, &ncp_tap); - break; - - case NCP_WATCHDOG: /* Watchdog Packet */ - /* - * XXX - should the completion code be interpreted as - * it is in "packet-ncp2222.inc"? If so, this - * packet should be handled by "dissect_ncp_reply()". - */ - proto_tree_add_item(ncp_tree, hf_ncp_completion_code, - tvb, commhdr + 6, 1, TRUE); - proto_tree_add_item(ncp_tree, hf_ncp_connection_status, - tvb, commhdr + 7, 1, TRUE); - proto_tree_add_item(ncp_tree, hf_ncp_slot, - tvb, commhdr + 8, 1, TRUE); - proto_tree_add_item(ncp_tree, hf_ncp_control_code, - tvb, commhdr + 9, 1, TRUE); - /* - * Display the rest of the packet as data. - */ - if (tvb_offset_exists(tvb, commhdr + 10)) { - call_dissector(data_handle, - tvb_new_subset(tvb, commhdr + 10, -1, -1), - pinfo, ncp_tree); - } - break; - - case NCP_BURST_MODE_XFER: /* Packet Burst Packet */ - if (flags & SYS) { - /* - * System packet; show missing fragments if there - * are any. - */ - while (missing_fraglist_count != 0) { - proto_tree_add_item(ncp_tree, hf_ncp_missing_data_offset, - tvb, offset, 4, FALSE); - offset += 4; - proto_tree_add_item(ncp_tree, hf_ncp_missing_data_count, - tvb, offset, 2, FALSE); - offset += 2; - missing_fraglist_count--; - } - } else { - /* - * XXX - do this by using -1 and -1 as the length - * arguments to "tvb_new_subset()" and then calling - * "tvb_set_reported_length()"? That'll throw an - * exception if "data_len" goes past the reported - * length of the packet, but that's arguably a - * feature in this case. - */ - length_remaining = tvb_length_remaining(tvb, offset); - if (length_remaining > data_len) - length_remaining = data_len; - if (data_len != 0) { - call_dissector(data_handle, - tvb_new_subset(tvb, offset, - length_remaining, data_len), - pinfo, ncp_tree); - } - } - break; - - case NCP_LIP_ECHO: /* LIP Echo Packet */ - proto_tree_add_text(ncp_tree, tvb, commhdr, -1, - "Lip Echo Packet"); - break; - - default: - if (tree) { - expert_item = proto_tree_add_text(ncp_tree, tvb, commhdr + 6, -1, - "%s packets not supported yet", - val_to_str(header.type, ncp_type_vals, - "Unknown type (0x%04x)")); - if (ncp_echo_err) { - expert_add_info_format(pinfo, expert_item, PI_UNDECODED, PI_NOTE, "%s packets not supported yet", val_to_str(header.type, ncp_type_vals, - "Unknown type (0x%04x)")); + proto_tree_add_item(flags_tree, hf_ncp_system_flags_abt, + tvb, commhdr + 2, 1, FALSE); + if (flags & ABT) { + proto_item_append_text(ti, " ABT"); + } + flags&=(~( ABT )); + + proto_tree_add_item(flags_tree, hf_ncp_system_flags_bsy, + tvb, commhdr + 2, 1, FALSE); + if (flags & BSY) { + proto_item_append_text(ti, " BSY"); + } + flags&=(~( BSY )); + + proto_tree_add_item(flags_tree, hf_ncp_system_flags_eob, + tvb, commhdr + 2, 1, FALSE); + if (flags & EOB) { + proto_item_append_text(ti, " EOB"); + } + flags&=(~( EOB )); + + proto_tree_add_item(flags_tree, hf_ncp_system_flags_lst, + tvb, commhdr + 2, 1, FALSE); + if (flags & LST) { + proto_item_append_text(ti, " LST"); + } + flags&=(~( LST )); + + proto_tree_add_item(flags_tree, hf_ncp_system_flags_sys, + tvb, commhdr + 2, 1, FALSE); + if (flags & SYS) { + proto_item_append_text(ti, " SYS"); + } + flags&=(~( SYS )); + + + proto_tree_add_item(ncp_tree, hf_ncp_stream_type, + tvb, commhdr + 3, 1, FALSE); + proto_tree_add_item(ncp_tree, hf_ncp_src_connection, + tvb, commhdr + 4, 4, FALSE); + proto_tree_add_item(ncp_tree, hf_ncp_dst_connection, + tvb, commhdr + 8, 4, FALSE); + proto_tree_add_item(ncp_tree, hf_ncp_packet_seqno, + tvb, commhdr + 12, 4, FALSE); + proto_tree_add_item(ncp_tree, hf_ncp_delay_time, + tvb, commhdr + 16, 4, FALSE); + ncp_burst_seqno = tvb_get_ntohs(tvb, commhdr+20); + proto_tree_add_item(ncp_tree, hf_ncp_burst_seqno, + tvb, commhdr + 20, 2, FALSE); + ncp_ack_seqno = tvb_get_ntohs(tvb, commhdr+22); + proto_tree_add_item(ncp_tree, hf_ncp_ack_seqno, + tvb, commhdr + 22, 2, FALSE); + proto_tree_add_item(ncp_tree, hf_ncp_burst_len, + tvb, commhdr + 24, 4, FALSE); + data_offset = tvb_get_ntohl(tvb, commhdr + 28); + proto_tree_add_uint(ncp_tree, hf_ncp_data_offset, + tvb, commhdr + 28, 4, data_offset); + data_len = tvb_get_ntohs(tvb, commhdr + 32); + proto_tree_add_uint(ncp_tree, hf_ncp_data_bytes, + tvb, commhdr + 32, 2, data_len); + missing_fraglist_count = tvb_get_ntohs(tvb, commhdr + 34); + proto_tree_add_item(ncp_tree, hf_ncp_missing_fraglist_count, + tvb, commhdr + 34, 2, FALSE); + offset = commhdr + 36; + if (!(flags & SYS) && ncp_burst_seqno == ncp_ack_seqno && + data_offset == 0) { + /* + * This is either a Burst Read or Burst Write + * command. The data length includes the burst + * mode header, plus any data in the command + * (there shouldn't be any in a read, but there + * might be some in a write). + */ + if (data_len < 4) + return; + ncp_burst_command = tvb_get_ntohl(tvb, offset); + proto_tree_add_item(ncp_tree, hf_ncp_burst_command, + tvb, offset, 4, FALSE); + offset += 4; + data_len -= 4; + + if (data_len < 4) + return; + burst_file = tvb_get_ntohl(tvb, offset); + proto_tree_add_item(ncp_tree, hf_ncp_burst_file_handle, + tvb, offset, 4, FALSE); + offset += 4; + data_len -= 4; + + if (data_len < 8) + return; + proto_tree_add_item(ncp_tree, hf_ncp_burst_reserved, + tvb, offset, 8, FALSE); + offset += 8; + data_len -= 8; + + if (data_len < 4) + return; + burst_off = tvb_get_ntohl(tvb, offset); + proto_tree_add_uint(ncp_tree, hf_ncp_burst_offset, + tvb, offset, 4, burst_off); + offset += 4; + data_len -= 4; + + if (data_len < 4) + return; + burst_len = tvb_get_ntohl(tvb, offset); + proto_tree_add_uint(ncp_tree, hf_ncp_burst_len, + tvb, offset, 4, burst_len); + offset += 4; + data_len -= 4; + + if (check_col(pinfo->cinfo, COL_INFO)) { + col_add_fstr(pinfo->cinfo, COL_INFO, + "%s %d bytes starting at offset %d in file 0x%08x", + val_to_str(ncp_burst_command, + burst_command, "Unknown (0x%08x)"), + burst_len, burst_off, burst_file); } - } - break; - } + break; + } else { + if (tvb_get_guint8(tvb, commhdr + 2) & 0x10) { + if (check_col(pinfo->cinfo, COL_INFO)) { + col_set_str(pinfo->cinfo, COL_INFO, + "End of Burst"); + } + } + } + break; + + case NCP_ALLOCATE_SLOT: /* Allocate Slot Request */ + length_remaining = tvb_length_remaining(tvb, commhdr + 4); + if (length_remaining > 4) { + testvar = tvb_get_ntohl(tvb, commhdr+4); + if (testvar == 0x4c495020) { + proto_tree_add_item(ncp_tree, hf_lip_echo, tvb, commhdr+4, 13, FALSE); + break; + } + } + /* otherwise fall through */ + + case NCP_POSITIVE_ACK: /* Positive Acknowledgement */ + case NCP_SERVICE_REQUEST: /* Server NCP Request */ + case NCP_SERVICE_REPLY: /* Server NCP Reply */ + case NCP_WATCHDOG: /* Watchdog Packet */ + case NCP_DEALLOCATE_SLOT: /* Deallocate Slot Request */ + default: + proto_tree_add_uint(ncp_tree, hf_ncp_seq, tvb, commhdr + 2, 1, header.sequence); + proto_tree_add_uint(ncp_tree, hf_ncp_connection,tvb, commhdr + 3, 3, nw_connection); + proto_tree_add_item(ncp_tree, hf_ncp_task, tvb, commhdr + 4, 1, FALSE); + break; + } + + /* + * Process the packet body. + */ + switch (header.type) { + + case NCP_ALLOCATE_SLOT: /* Allocate Slot Request */ + length_remaining = tvb_length_remaining(tvb, commhdr + 4); + if (length_remaining > 4) { + testvar = tvb_get_ntohl(tvb, commhdr+4); + if (testvar == 0x4c495020) { + proto_tree_add_text(ncp_tree, tvb, commhdr, -1, + "Lip Echo Packet"); + /*break;*/ + } + } + next_tvb = tvb_new_subset(tvb, commhdr, -1, -1); + dissect_ncp_request(next_tvb, pinfo, nw_connection, + header.sequence, header.type, ncp_tree); + break; + + case NCP_DEALLOCATE_SLOT: /* Deallocate Slot Request */ + next_tvb = tvb_new_subset(tvb, commhdr, -1, -1); + dissect_ncp_request(next_tvb, pinfo, nw_connection, + header.sequence, header.type, ncp_tree); + break; + + case NCP_SERVICE_REQUEST: /* Server NCP Request */ + case NCP_BROADCAST_SLOT: /* Server Broadcast Packet */ + next_tvb = tvb_new_subset(tvb, commhdr, -1, -1); + if (tvb_get_guint8(tvb, commhdr+6) == 0x68) { + subfunction = tvb_get_guint8(tvb, commhdr+7); + switch (subfunction) { + + case 0x02: /* NDS Frag Packet to decode */ + dissect_nds_request(next_tvb, pinfo, + nw_connection, header.sequence, + header.type, ncp_tree); + break; + + case 0x01: /* NDS Ping */ + dissect_ping_req(next_tvb, pinfo, + nw_connection, header.sequence, + header.type, ncp_tree); + break; + + default: + dissect_ncp_request(next_tvb, pinfo, + nw_connection, header.sequence, + header.type, ncp_tree); + break; + } + } else { + dissect_ncp_request(next_tvb, pinfo, nw_connection, + header.sequence, header.type, ncp_tree); + } + break; + + case NCP_SERVICE_REPLY: /* Server NCP Reply */ + next_tvb = tvb_new_subset(tvb, commhdr, -1, -1); + nds_defrag(next_tvb, pinfo, nw_connection, header.sequence, + header.type, ncp_tree, &ncp_tap); + break; + + case NCP_POSITIVE_ACK: /* Positive Acknowledgement */ + /* + * XXX - this used to call "nds_defrag()", which would + * clear out "frags". Was that the right thing to + * do? + */ + next_tvb = tvb_new_subset(tvb, commhdr, -1, -1); + dissect_ncp_reply(next_tvb, pinfo, nw_connection, + header.sequence, header.type, ncp_tree, &ncp_tap); + break; + + case NCP_WATCHDOG: /* Watchdog Packet */ + /* + * XXX - should the completion code be interpreted as + * it is in "packet-ncp2222.inc"? If so, this + * packet should be handled by "dissect_ncp_reply()". + */ + proto_tree_add_item(ncp_tree, hf_ncp_completion_code, + tvb, commhdr + 6, 1, TRUE); + proto_tree_add_item(ncp_tree, hf_ncp_connection_status, + tvb, commhdr + 7, 1, TRUE); + proto_tree_add_item(ncp_tree, hf_ncp_slot, + tvb, commhdr + 8, 1, TRUE); + proto_tree_add_item(ncp_tree, hf_ncp_control_code, + tvb, commhdr + 9, 1, TRUE); + /* + * Display the rest of the packet as data. + */ + if (tvb_offset_exists(tvb, commhdr + 10)) { + call_dissector(data_handle, + tvb_new_subset(tvb, commhdr + 10, -1, -1), + pinfo, ncp_tree); + } + break; + + case NCP_BURST_MODE_XFER: /* Packet Burst Packet */ + if (flags & SYS) { + /* + * System packet; show missing fragments if there + * are any. + */ + while (missing_fraglist_count != 0) { + proto_tree_add_item(ncp_tree, hf_ncp_missing_data_offset, + tvb, offset, 4, FALSE); + offset += 4; + proto_tree_add_item(ncp_tree, hf_ncp_missing_data_count, + tvb, offset, 2, FALSE); + offset += 2; + missing_fraglist_count--; + } + } else { + /* + * XXX - do this by using -1 and -1 as the length + * arguments to "tvb_new_subset()" and then calling + * "tvb_set_reported_length()"? That'll throw an + * exception if "data_len" goes past the reported + * length of the packet, but that's arguably a + * feature in this case. + */ + length_remaining = tvb_length_remaining(tvb, offset); + if (length_remaining > data_len) + length_remaining = data_len; + if (data_len != 0) { + call_dissector(data_handle, + tvb_new_subset(tvb, offset, + length_remaining, data_len), + pinfo, ncp_tree); + } + } + break; + + case NCP_LIP_ECHO: /* LIP Echo Packet */ + proto_tree_add_text(ncp_tree, tvb, commhdr, -1, + "Lip Echo Packet"); + break; + + default: + expert_item = proto_tree_add_text(ncp_tree, tvb, commhdr + 6, -1, + "%s packets not supported yet", + val_to_str(header.type, ncp_type_vals, + "Unknown type (0x%04x)")); + if (ncp_echo_err) { + expert_add_info_format(pinfo, expert_item, PI_UNDECODED, PI_NOTE, "%s packets not supported yet", val_to_str(header.type, ncp_type_vals, + "Unknown type (0x%04x)")); + } + break; + } } static void dissect_ncp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - dissect_ncp_common(tvb, pinfo, tree, FALSE); + dissect_ncp_common(tvb, pinfo, tree, FALSE); } static guint diff --git a/epan/dissectors/packet-ncp2222.inc b/epan/dissectors/packet-ncp2222.inc index 7f8ce5bfc3..489a16073f 100644 --- a/epan/dissectors/packet-ncp2222.inc +++ b/epan/dissectors/packet-ncp2222.inc @@ -4735,6 +4735,7 @@ dissect_nds_iterator(proto_tree *it_tree, tvbuff_t *tvb, packet_info *pinfo, gui nds_val values; proto_tree *it_subtree, *it_subtree1; proto_item *it_subitem, *it_subitem1; + proto_item *expert_item; values.vtype = 0; values.vvalue = 0; @@ -8320,6 +8321,7 @@ dissect_nds_reply(tvbuff_t *tvb, packet_info *pinfo, guint32 nds_offset; guint32 nds_reply_buffer; guint32 nds_frag; + proto_item *expert_item; const char *verb_string; nds_val pvalues[9]; gboolean resolve_eid=FALSE; @@ -9010,6 +9012,9 @@ dissect_ncp_reply(tvbuff_t *tvb, packet_info *pinfo, guint32 nds_reply_buffer = 0; const char *nds_error_string = NULL; guint32 nds_frag=0; + proto_item *expert_item; + guint8 conn_stat; + #ifdef FAKE_TREE_IS_VISIBLE if (ncp_tree) { @@ -9181,25 +9186,21 @@ dissect_ncp_reply(tvbuff_t *tvb, packet_info *pinfo, completion_code, error_string); } - if (ncp_tree) { - guint8 conn_stat; - - conn_stat = tvb_get_guint8(tvb, 7); - expert_item = proto_tree_add_item(ncp_tree, hf_ncp_connection_status, tvb, - 7, 1, FALSE); - if (conn_stat != 0 && conn_stat != 0x40 ) { - if (check_col(pinfo->cinfo, COL_INFO)) { - col_set_str(pinfo->cinfo, COL_INFO, - "Error: Bad Connection Status"); - } - if (ncp_echo_err) { - expert_add_info_format(pinfo, expert_item, - PI_RESPONSE_CODE, PI_ERROR, - "Error: Bad Connection Status"); - } - return; + conn_stat = tvb_get_guint8(tvb, 7); + expert_item = proto_tree_add_item(ncp_tree, hf_ncp_connection_status, tvb, + 7, 1, FALSE); + if (conn_stat != 0 && conn_stat != 0x40 ) { + if (check_col(pinfo->cinfo, COL_INFO)) { + col_set_str(pinfo->cinfo, COL_INFO, + "Error: Bad Connection Status"); } - } + if (ncp_echo_err) { + expert_add_info_format(pinfo, expert_item, + PI_RESPONSE_CODE, PI_ERROR, + "Error: Bad Connection Status"); + } + return; + } /* * Unless this is a successful reply, that's all there * is to parse. diff --git a/epan/dissectors/packet-ndps.c b/epan/dissectors/packet-ndps.c index 6acabfc7b0..9c082bd370 100644 --- a/epan/dissectors/packet-ndps.c +++ b/epan/dissectors/packet-ndps.c @@ -360,10 +360,6 @@ static dissector_handle_t ndps_data_handle; /* desegmentation of NDPS over TCP */ static gboolean ndps_desegment = TRUE; -/* global item and value for passing expert data */ -static proto_item *expert_item; -static guint32 expert_status; - static const value_string true_false[] = { { 0x00000000, "Accept" }, { 0x00000001, "Deny" }, @@ -6740,6 +6736,7 @@ ndps_error(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int foffset proto_item *aitem; proto_tree *btree; proto_item *bitem; + proto_item *expert_item; ndps_problem_type = tvb_get_ntohl(tvb, foffset); if (check_col(pinfo->cinfo, COL_INFO)) @@ -6940,6 +6937,9 @@ ndps_error(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int foffset static int return_code(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int foffset) { + guint32 expert_status; + proto_item *expert_item; + expert_status = tvb_get_ntohl(tvb, foffset); expert_item = proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, FALSE); if (expert_status != 0) { @@ -6982,6 +6982,8 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int guint32 error_val=0; guint32 resource_type=0; gint length_remaining; + proto_item *expert_item; + guint32 expert_status; if (!pinfo->fd->flags.visited) { /* Find the conversation whence the request would have come. */ diff --git a/epan/dissectors/packet-srvloc.c b/epan/dissectors/packet-srvloc.c index 813cf58dc4..3709db1e07 100644 --- a/epan/dissectors/packet-srvloc.c +++ b/epan/dissectors/packet-srvloc.c @@ -52,8 +52,6 @@ #include "packet-tcp.h" #include <epan/expert.h> -static proto_item *expert_item = NULL; -static guint16 expert_status = 0; static gboolean srvloc_desegment = TRUE; static int proto_srvloc = -1; static int hf_srvloc_version = -1; @@ -810,18 +808,20 @@ dissect_url_entry_v2(tvbuff_t *tvb, int offset, proto_tree *tree) static void dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - int offset = 0; - proto_item *ti, *tf; - proto_tree *srvloc_tree, *srvloc_flags; - guint8 version; - guint8 function; - guint16 encoding; - guint32 length; /* three bytes needed for v2 */ - guint16 flags; /* two byes needed for v2 */ - guint32 count; - guint32 next_ext_off; /* three bytes, v2 only */ - guint16 lang_tag_len; - nstime_t ts; + int offset = 0; + proto_item *ti, *tf; + proto_tree *srvloc_tree, *srvloc_flags; + guint8 version; + guint8 function; + guint16 encoding; + guint32 length; /* three bytes needed for v2 */ + guint16 flags; /* two byes needed for v2 */ + guint32 count; + guint32 next_ext_off; /* three bytes, v2 only */ + guint16 lang_tag_len; + nstime_t ts; + proto_item *expert_item; + guint16 expert_status; if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "SRVLOC"); @@ -836,567 +836,567 @@ dissect_srvloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) col_add_str(pinfo->cinfo, COL_INFO, val_to_str(function, srvloc_functions, "Unknown Function (%u)")); - if (tree) { - ti = proto_tree_add_item(tree, proto_srvloc, tvb, offset, -1, FALSE); - srvloc_tree = proto_item_add_subtree(ti, ett_srvloc); - - proto_tree_add_uint(srvloc_tree, hf_srvloc_version, tvb, offset, 1, - version); - proto_tree_add_uint(srvloc_tree, hf_srvloc_function, tvb, offset + 1, 1, - function); - if (version < 2) { - length = tvb_get_ntohs(tvb, offset + 2); - proto_tree_add_uint(srvloc_tree, hf_srvloc_pktlen, tvb, offset + 2, 2, - length); - flags = tvb_get_guint8(tvb, offset + 4); - tf = proto_tree_add_uint(srvloc_tree, hf_srvloc_flags_v1, tvb, offset + 4, 1, - flags); - srvloc_flags = proto_item_add_subtree(tf, ett_srvloc_flags); - proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v1_overflow, - tvb, offset+4, 1, flags); - proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v1_monolingual, - tvb, offset+4, 1, flags); - proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v1_url_auth, - tvb, offset+4, 1, flags); - proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v1_attribute_auth, - tvb, offset+4, 1, flags); - proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v1_fresh, - tvb, offset+4, 1, flags); - proto_tree_add_text(srvloc_tree, tvb, offset + 5, 1, "Dialect: %u", - tvb_get_guint8(tvb, offset + 5)); - proto_tree_add_text(srvloc_tree, tvb, offset + 6, 2, "Language: %s", - tvb_format_text(tvb, offset + 6, 2)); - encoding = tvb_get_ntohs(tvb, offset + 8); - proto_tree_add_text(srvloc_tree, tvb, offset + 8, 2, "Encoding: %u (%s)", - encoding, - val_to_str(encoding, charsets, "Unknown")); - proto_tree_add_text(srvloc_tree, tvb, offset + 10, 2, "Transaction ID: %u", - tvb_get_ntohs(tvb, offset + 10)); + ti = proto_tree_add_item(tree, proto_srvloc, tvb, offset, -1, FALSE); + srvloc_tree = proto_item_add_subtree(ti, ett_srvloc); + + proto_tree_add_uint(srvloc_tree, hf_srvloc_version, tvb, offset, 1, + version); + proto_tree_add_uint(srvloc_tree, hf_srvloc_function, tvb, offset + 1, 1, + function); + if (version < 2) { + length = tvb_get_ntohs(tvb, offset + 2); + proto_tree_add_uint(srvloc_tree, hf_srvloc_pktlen, tvb, offset + 2, 2, + length); + flags = tvb_get_guint8(tvb, offset + 4); + tf = proto_tree_add_uint(srvloc_tree, hf_srvloc_flags_v1, tvb, offset + 4, 1, + flags); + srvloc_flags = proto_item_add_subtree(tf, ett_srvloc_flags); + proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v1_overflow, + tvb, offset+4, 1, flags); + proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v1_monolingual, + tvb, offset+4, 1, flags); + proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v1_url_auth, + tvb, offset+4, 1, flags); + proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v1_attribute_auth, + tvb, offset+4, 1, flags); + proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v1_fresh, + tvb, offset+4, 1, flags); + proto_tree_add_text(srvloc_tree, tvb, offset + 5, 1, "Dialect: %u", + tvb_get_guint8(tvb, offset + 5)); + proto_tree_add_text(srvloc_tree, tvb, offset + 6, 2, "Language: %s", + tvb_format_text(tvb, offset + 6, 2)); + encoding = tvb_get_ntohs(tvb, offset + 8); + proto_tree_add_text(srvloc_tree, tvb, offset + 8, 2, "Encoding: %u (%s)", + encoding, + val_to_str(encoding, charsets, "Unknown")); + proto_tree_add_text(srvloc_tree, tvb, offset + 10, 2, "Transaction ID: %u", + tvb_get_ntohs(tvb, offset + 10)); /* added echo of XID to info colomn by Greg Morris 0ct 14, 2005 */ if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ", V1 Transaction ID - %u", tvb_get_ntohs(tvb, offset + 10)); + col_append_fstr(pinfo->cinfo, COL_INFO, ", V1 Transaction ID - %u", tvb_get_ntohs(tvb, offset + 10)); - offset += 12; + offset += 12; - switch (function) { - case SRVREQ: - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreq_prlistlen, tvb, offset, 2, length); - offset += 2; - add_v1_string(srvloc_tree, hf_srvloc_srvreq_prlist, tvb, offset, length, encoding); - offset += length; - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreq_predicatelen, tvb, offset, 2, length); - offset += 2; - add_v1_string(srvloc_tree, hf_srvloc_srvreq_predicate, tvb, offset, length, encoding); - offset += length; - break; + switch (function) { - case SRVRPLY: - expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error, tvb, offset, 2, FALSE); - expert_status = tvb_get_ntohs(tvb, offset); - if (expert_status!=0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs, "Unknown SRVLOC Error (0x%02x)")); - } - offset += 2; - count = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvrply_urlcount, tvb, offset, 2, count); - offset += 2; - while (count > 0) { - offset = dissect_url_entry_v1(tvb, offset, srvloc_tree, - encoding, flags); - count--; - } + case SRVREQ: + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreq_prlistlen, tvb, offset, 2, length); + offset += 2; + add_v1_string(srvloc_tree, hf_srvloc_srvreq_prlist, tvb, offset, length, encoding); + offset += length; + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreq_predicatelen, tvb, offset, 2, length); + offset += 2; + add_v1_string(srvloc_tree, hf_srvloc_srvreq_predicate, tvb, offset, length, encoding); + offset += length; break; - case SRVREG: - offset = dissect_url_entry_v1(tvb, offset, srvloc_tree, encoding, - flags); - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreg_attrlistlen, tvb, offset, 2, length); + case SRVRPLY: + expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error, tvb, offset, 2, FALSE); + expert_status = tvb_get_ntohs(tvb, offset); + if (expert_status!=0) { + expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs, "Unknown SRVLOC Error (0x%02x)")); + } + offset += 2; + count = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvrply_urlcount, tvb, offset, 2, count); + offset += 2; + while (count > 0) { + offset = dissect_url_entry_v1(tvb, offset, srvloc_tree, + encoding, flags); + count--; + } + break; + + case SRVREG: + offset = dissect_url_entry_v1(tvb, offset, srvloc_tree, encoding, + flags); + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreg_attrlistlen, tvb, offset, 2, length); + offset += 2; + add_v1_string(srvloc_tree, hf_srvloc_srvreg_attrlist, tvb, offset, length, encoding); + offset += length; + if ( (flags & FLAG_A) == FLAG_A ) + offset = dissect_authblk(tvb, offset, srvloc_tree); + break; + + case SRVDEREG: + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(tree, hf_srvloc_url_urllen, tvb, offset, 2, length); + offset += 2; + add_v1_string(tree, hf_srvloc_url_url, tvb, offset, length, encoding); + offset += length; + if ( (flags & FLAG_U) == FLAG_U ) + offset = dissect_authblk(tvb, offset, srvloc_tree); + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvdereg_taglistlen, tvb, offset, 2, length); + offset += 2; + add_v1_string(srvloc_tree, hf_srvloc_srvdereg_taglist, tvb, offset, length, encoding); + offset += length; + /* + * XXX - this was there before, but RFC 2165 doesn't speak + * of there being an attribute authentication block in + * a Service Deregister message. Is that a post-RFC-2165 + * addition? + */ + if ( (flags & FLAG_A) == FLAG_A ) + offset = dissect_authblk(tvb, offset, srvloc_tree); + break; + + case SRVACK: + expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error, tvb, offset, 2, FALSE); + expert_status = tvb_get_ntohs(tvb, offset); + if (expert_status!=0) { + expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs, "Unknown SRVLOC Error (0x%02x)")); + } + offset += 2; + break; + + case ATTRRQST: + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_attrreq_prlistlen, tvb, offset, 2, length); + offset += 2; + add_v1_string(srvloc_tree, hf_srvloc_attrreq_prlist, tvb, offset, length, encoding); + offset += length; + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_attrreq_urllen, tvb, offset, 2, length); + offset += 2; + add_v1_string(srvloc_tree, hf_srvloc_attrreq_url, tvb, offset, length, encoding); + offset += length; + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_attrreq_scopelistlen, tvb, offset, 2, length); + offset += 2; + add_v1_string(srvloc_tree, hf_srvloc_attrreq_scopelist, tvb, offset, length, encoding); + offset += length; + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_attrreq_attrlistlen, tvb, offset, 2, length); + offset += 2; + add_v1_string(srvloc_tree, hf_srvloc_attrreq_attrlist, tvb, offset, length, encoding); + offset += length; + break; + + case ATTRRPLY: + expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error_v2, tvb, offset, 2, FALSE); + expert_status = tvb_get_ntohs(tvb, offset); + if (expert_status!=0) { + expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); + } + offset += 2; + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_attrrply_attrlistlen, tvb, offset, 2, length); + if (length > 0) { offset += 2; - add_v1_string(srvloc_tree, hf_srvloc_srvreg_attrlist, tvb, offset, length, encoding); + attr_list(srvloc_tree, hf_srvloc_attrrply_attrlist, tvb, offset, length, encoding); offset += length; if ( (flags & FLAG_A) == FLAG_A ) offset = dissect_authblk(tvb, offset, srvloc_tree); + } break; - case SRVDEREG: - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(tree, hf_srvloc_url_urllen, tvb, offset, 2, length); + case DAADVERT: + expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error, tvb, offset, 2, FALSE); + expert_status = tvb_get_ntohs(tvb, offset); + if (expert_status!=0) { + expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs, "Unknown SRVLOC Error (0x%02x)")); + } + offset += 2; + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_daadvert_urllen, tvb, offset, 2, length); + offset += 2; + add_v1_string(srvloc_tree, hf_srvloc_daadvert_url, tvb, offset, length, encoding); + offset += length; + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_daadvert_scopelistlen, tvb, offset, 2, length); + offset += 2; + add_v1_string(srvloc_tree, hf_srvloc_daadvert_scopelist, tvb, offset, length, encoding); + offset += length; + break; + + case SRVTYPERQST: + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvtypereq_prlistlen, tvb, offset, 2, length); + offset += 2; + add_v1_string(srvloc_tree, hf_srvloc_srvtypereq_prlist, tvb, offset, length, encoding); + offset += length; + length = tvb_get_ntohs(tvb, offset); + /* Updated by Greg Morris on 1-30-04 */ + if (0xFFFF == length) { + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvtypereq_nameauthlistlenall, tvb, offset, 2, length); offset += 2; - add_v1_string(tree, hf_srvloc_url_url, tvb, offset, length, encoding); - offset += length; - if ( (flags & FLAG_U) == FLAG_U ) - offset = dissect_authblk(tvb, offset, srvloc_tree); - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvdereg_taglistlen, tvb, offset, 2, length); + } + else + { + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvtypereq_nameauthlistlen, tvb, offset, 2, length); offset += 2; - add_v1_string(srvloc_tree, hf_srvloc_srvdereg_taglist, tvb, offset, length, encoding); + add_v1_string(srvloc_tree, hf_srvloc_srvtypereq_nameauthlist, tvb, offset, length, encoding); offset += length; - /* - * XXX - this was there before, but RFC 2165 doesn't speak - * of there being an attribute authentication block in - * a Service Deregister message. Is that a post-RFC-2165 - * addition? - */ - if ( (flags & FLAG_A) == FLAG_A ) - offset = dissect_authblk(tvb, offset, srvloc_tree); + } + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvtypereq_scopelistlen, tvb, offset, 2, length); + offset += 2; + add_v1_string(srvloc_tree, hf_srvloc_srvtypereq_scopelist, tvb, offset, length, encoding); + offset += length; break; - case SRVACK: - expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error, tvb, offset, 2, FALSE); - expert_status = tvb_get_ntohs(tvb, offset); - if (expert_status!=0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs, "Unknown SRVLOC Error (0x%02x)")); - } + case SRVTYPERPLY: + expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error, tvb, offset, 2, FALSE); + expert_status = tvb_get_ntohs(tvb, offset); + if (expert_status!=0) { + expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs, "Unknown SRVLOC Error (0x%02x)")); + } + offset += 2; + count = tvb_get_ntohs(tvb, offset); + proto_tree_add_text(srvloc_tree, tvb, offset, 2, "Service Type Count: %u", + count); + offset += 2; + while (count > 0) { + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvtyperply_srvtypelen, tvb, offset, 2, length); offset += 2; + add_v1_string(srvloc_tree, hf_srvloc_srvtyperply_srvtype, tvb, offset, length, encoding); + offset += length; + count--; + } break; - case ATTRRQST: - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_attrreq_prlistlen, tvb, offset, 2, length); - offset += 2; - add_v1_string(srvloc_tree, hf_srvloc_attrreq_prlist, tvb, offset, length, encoding); + default: + expert_item = proto_tree_add_text(srvloc_tree, tvb, offset, -1, "Unknown Function Type"); + expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Unknown Function Type: %d", function); + } + } + else { /* Version 2 */ + length = tvb_get_ntoh24(tvb, offset + 2); + proto_tree_add_uint(srvloc_tree, hf_srvloc_pktlen, tvb, offset + 2, 3, + length); + flags = tvb_get_ntohs(tvb, offset + 5); + tf = proto_tree_add_uint(srvloc_tree, hf_srvloc_flags_v2, tvb, offset + 5, 2, + flags); + srvloc_flags = proto_item_add_subtree(tf, ett_srvloc_flags); + proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v2_overflow, + tvb, offset+5, 1, flags); + proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v2_fresh, + tvb, offset+5, 1, flags); + proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v2_reqmulti, + tvb, offset+5, 1, flags); + + next_ext_off = tvb_get_ntoh24(tvb, offset + 7); + proto_tree_add_uint(srvloc_tree, hf_srvloc_nextextoff, tvb, offset + 7, 3, + next_ext_off); + proto_tree_add_uint(srvloc_tree, hf_srvloc_xid, tvb, offset + 10, 2, + tvb_get_ntohs(tvb, offset + 10)); + if (check_col(pinfo->cinfo, COL_INFO)) + col_append_fstr(pinfo->cinfo, COL_INFO, ", V2 XID - %u", tvb_get_ntohs(tvb, offset + 10)); + lang_tag_len = tvb_get_ntohs(tvb, offset + 12); + proto_tree_add_uint(srvloc_tree, hf_srvloc_langtaglen, tvb, offset + 12, 2, lang_tag_len); + proto_tree_add_item(srvloc_tree, hf_srvloc_langtag, tvb, offset + 14, lang_tag_len, TRUE); + offset += 14+lang_tag_len; + + switch (function) { + + case SRVREQ: /* RFC2608 8.1 */ + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreq_prlistlen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_srvreq_prlist, tvb, offset, length, TRUE); offset += length; - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_attrreq_urllen, tvb, offset, 2, length); - offset += 2; - add_v1_string(srvloc_tree, hf_srvloc_attrreq_url, tvb, offset, length, encoding); + } + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreq_srvtypelen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_srvreq_srvtypelist, tvb, offset, length, TRUE); offset += length; - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_attrreq_scopelistlen, tvb, offset, 2, length); - offset += 2; - add_v1_string(srvloc_tree, hf_srvloc_attrreq_scopelist, tvb, offset, length, encoding); + } + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreq_scopelistlen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_srvreq_scopelist, tvb, offset, length, TRUE); offset += length; - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_attrreq_attrlistlen, tvb, offset, 2, length); - offset += 2; - add_v1_string(srvloc_tree, hf_srvloc_attrreq_attrlist, tvb, offset, length, encoding); + } + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreq_predicatelen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_srvreq_predicate, tvb, offset, length, TRUE); offset += length; + } + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreq_slpspilen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_srvreq_slpspi, tvb, offset, length, TRUE); + offset += length; + } break; - case ATTRRPLY: - expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error_v2, tvb, offset, 2, FALSE); - expert_status = tvb_get_ntohs(tvb, offset); - if (expert_status!=0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); - } - offset += 2; - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_attrrply_attrlistlen, tvb, offset, 2, length); - if (length > 0) { - offset += 2; - attr_list(srvloc_tree, hf_srvloc_attrrply_attrlist, tvb, offset, length, encoding); - offset += length; - if ( (flags & FLAG_A) == FLAG_A ) - offset = dissect_authblk(tvb, offset, srvloc_tree); - } + case SRVRPLY: /* RFC2608 8.2 */ + expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error_v2, tvb, offset, 2, FALSE); + expert_status = tvb_get_ntohs(tvb, offset); + if (expert_status!=0) { + expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); + } + offset += 2; + count = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvrply_urlcount, tvb, offset, 2, count); + offset += 2; + while (count > 0) { + offset = dissect_url_entry_v2(tvb, offset, srvloc_tree); + count--; + } break; - case DAADVERT: - expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error, tvb, offset, 2, FALSE); - expert_status = tvb_get_ntohs(tvb, offset); - if (expert_status!=0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs, "Unknown SRVLOC Error (0x%02x)")); - } - offset += 2; - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_daadvert_urllen, tvb, offset, 2, length); - offset += 2; - add_v1_string(srvloc_tree, hf_srvloc_daadvert_url, tvb, offset, length, encoding); + case SRVREG: /* RFC2608 8.3 */ + offset = dissect_url_entry_v2(tvb, offset, srvloc_tree); + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreg_srvtypelen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_srvreg_srvtype, tvb, offset, length, TRUE); offset += length; - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_daadvert_scopelistlen, tvb, offset, 2, length); - offset += 2; - add_v1_string(srvloc_tree, hf_srvloc_daadvert_scopelist, tvb, offset, length, encoding); + } + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreg_scopelistlen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_srvreg_scopelist, tvb, offset, length, TRUE); + offset += length; + } + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreg_attrlistlen, tvb, offset, 2, length); + offset += 2; + if (length) { + attr_list2(srvloc_tree, hf_srvloc_srvreg_attrlist, tvb, offset, length, CHARSET_UTF_8); offset += length; + } + count = tvb_get_guint8(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreg_attrauthcount, tvb, offset, 1, count); + offset += 1; + while (count > 0) { + offset = dissect_attrauthblk_v2(tvb, offset, srvloc_tree); + count--; + } break; - case SRVTYPERQST: - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvtypereq_prlistlen, tvb, offset, 2, length); - offset += 2; - add_v1_string(srvloc_tree, hf_srvloc_srvtypereq_prlist, tvb, offset, length, encoding); + case SRVDEREG: /* RFC2608 10.6 */ + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvdereg_scopelistlen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_srvdereg_scopelist, tvb, offset, length, TRUE); offset += length; - length = tvb_get_ntohs(tvb, offset); - /* Updated by Greg Morris on 1-30-04 */ - if (0xFFFF == length) { - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvtypereq_nameauthlistlenall, tvb, offset, 2, length); - offset += 2; - } - else - { - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvtypereq_nameauthlistlen, tvb, offset, 2, length); - offset += 2; - add_v1_string(srvloc_tree, hf_srvloc_srvtypereq_nameauthlist, tvb, offset, length, encoding); - offset += length; - } - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvtypereq_scopelistlen, tvb, offset, 2, length); - offset += 2; - add_v1_string(srvloc_tree, hf_srvloc_srvtypereq_scopelist, tvb, offset, length, encoding); + } + offset = dissect_url_entry_v2(tvb, offset, srvloc_tree); + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvdereg_taglistlen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_srvdereg_taglist, tvb, offset, length, TRUE); offset += length; + } break; - case SRVTYPERPLY: - expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error, tvb, offset, 2, FALSE); - expert_status = tvb_get_ntohs(tvb, offset); - if (expert_status!=0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs, "Unknown SRVLOC Error (0x%02x)")); - } - offset += 2; - count = tvb_get_ntohs(tvb, offset); - proto_tree_add_text(srvloc_tree, tvb, offset, 2, "Service Type Count: %u", - count); - offset += 2; - while (count > 0) { - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvtyperply_srvtypelen, tvb, offset, 2, length); - offset += 2; - add_v1_string(srvloc_tree, hf_srvloc_srvtyperply_srvtype, tvb, offset, length, encoding); - offset += length; - count--; - } - break; - - default: - expert_item = proto_tree_add_text(srvloc_tree, tvb, offset, -1, "Unknown Function Type"); - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Unknown Function Type: %d", function); - } - } - else { /* Version 2 */ - length = tvb_get_ntoh24(tvb, offset + 2); - proto_tree_add_uint(srvloc_tree, hf_srvloc_pktlen, tvb, offset + 2, 3, - length); - flags = tvb_get_ntohs(tvb, offset + 5); - tf = proto_tree_add_uint(srvloc_tree, hf_srvloc_flags_v2, tvb, offset + 5, 2, - flags); - srvloc_flags = proto_item_add_subtree(tf, ett_srvloc_flags); - proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v2_overflow, - tvb, offset+5, 1, flags); - proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v2_fresh, - tvb, offset+5, 1, flags); - proto_tree_add_boolean(srvloc_flags, hf_srvloc_flags_v2_reqmulti, - tvb, offset+5, 1, flags); - - next_ext_off = tvb_get_ntoh24(tvb, offset + 7); - proto_tree_add_uint(srvloc_tree, hf_srvloc_nextextoff, tvb, offset + 7, 3, - next_ext_off); - proto_tree_add_uint(srvloc_tree, hf_srvloc_xid, tvb, offset + 10, 2, - tvb_get_ntohs(tvb, offset + 10)); - if (check_col(pinfo->cinfo, COL_INFO)) - col_append_fstr(pinfo->cinfo, COL_INFO, ", V2 XID - %u", tvb_get_ntohs(tvb, offset + 10)); - lang_tag_len = tvb_get_ntohs(tvb, offset + 12); - proto_tree_add_uint(srvloc_tree, hf_srvloc_langtaglen, tvb, offset + 12, 2, lang_tag_len); - proto_tree_add_item(srvloc_tree, hf_srvloc_langtag, tvb, offset + 14, lang_tag_len, TRUE); - offset += 14+lang_tag_len; - - switch (function) { - case SRVREQ: /* RFC2608 8.1 */ - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreq_prlistlen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_srvreq_prlist, tvb, offset, length, TRUE); - offset += length; - } - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreq_srvtypelen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_srvreq_srvtypelist, tvb, offset, length, TRUE); - offset += length; - } - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreq_scopelistlen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_srvreq_scopelist, tvb, offset, length, TRUE); - offset += length; - } - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreq_predicatelen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_srvreq_predicate, tvb, offset, length, TRUE); - offset += length; - } - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreq_slpspilen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_srvreq_slpspi, tvb, offset, length, TRUE); - offset += length; - } - break; - - case SRVRPLY: /* RFC2608 8.2 */ - expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error_v2, tvb, offset, 2, FALSE); - expert_status = tvb_get_ntohs(tvb, offset); - if (expert_status!=0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); - } - offset += 2; - count = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvrply_urlcount, tvb, offset, 2, count); - offset += 2; - while (count > 0) { - offset = dissect_url_entry_v2(tvb, offset, srvloc_tree); - count--; - } + case SRVACK: /* RFC2608 8.4 */ + expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error_v2, tvb, offset, 2, FALSE); + expert_status = tvb_get_ntohs(tvb, offset); + if (expert_status!=0) { + expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); + } + offset += 2; break; - case SRVREG: /* RFC2608 8.3 */ - offset = dissect_url_entry_v2(tvb, offset, srvloc_tree); - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreg_srvtypelen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_srvreg_srvtype, tvb, offset, length, TRUE); - offset += length; - } - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreg_scopelistlen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_srvreg_scopelist, tvb, offset, length, TRUE); - offset += length; - } - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreg_attrlistlen, tvb, offset, 2, length); - offset += 2; - if (length) { - attr_list2(srvloc_tree, hf_srvloc_srvreg_attrlist, tvb, offset, length, CHARSET_UTF_8); - offset += length; - } - count = tvb_get_guint8(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvreg_attrauthcount, tvb, offset, 1, count); - offset += 1; - while (count > 0) { - offset = dissect_attrauthblk_v2(tvb, offset, srvloc_tree); - count--; - } - break; - - case SRVDEREG: /* RFC2608 10.6 */ - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvdereg_scopelistlen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_srvdereg_scopelist, tvb, offset, length, TRUE); - offset += length; - } - offset = dissect_url_entry_v2(tvb, offset, srvloc_tree); - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvdereg_taglistlen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_srvdereg_taglist, tvb, offset, length, TRUE); - offset += length; - } - break; - - case SRVACK: /* RFC2608 8.4 */ - expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error_v2, tvb, offset, 2, FALSE); - expert_status = tvb_get_ntohs(tvb, offset); - if (expert_status!=0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); - } - offset += 2; + case ATTRRQST: /* RFC2608 10.3*/ + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_attrreq_prlistlen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_attrreq_prlist, tvb, offset, length, TRUE); + offset += length; + } + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_attrreq_urllen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_attrreq_url, tvb, offset, length, TRUE); + offset += length; + } + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_attrreq_scopelistlen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_attrreq_scopelist, tvb, offset, length, TRUE); + offset += length; + } + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_attrreq_taglistlen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_attrreq_taglist, tvb, offset, length, TRUE); + offset += length; + } + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_attrreq_slpspilen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_attrreq_slpspi, tvb, offset, length, TRUE); + offset += length; + } break; - case ATTRRQST: /* RFC2608 10.3*/ - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_attrreq_prlistlen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_attrreq_prlist, tvb, offset, length, TRUE); - offset += length; - } - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_attrreq_urllen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_attrreq_url, tvb, offset, length, TRUE); - offset += length; - } - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_attrreq_scopelistlen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_attrreq_scopelist, tvb, offset, length, TRUE); - offset += length; - } - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_attrreq_taglistlen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_attrreq_taglist, tvb, offset, length, TRUE); - offset += length; - } - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_attrreq_slpspilen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_attrreq_slpspi, tvb, offset, length, TRUE); - offset += length; - } + case ATTRRPLY: /* RFC2608 10.4 */ + expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error_v2, tvb, offset, 2, FALSE); + expert_status = tvb_get_ntohs(tvb, offset); + if (expert_status!=0) { + expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); + } + offset += 2; + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_attrrply_attrlistlen, tvb, offset, 2, length); + offset += 2; + if (length) { + attr_list2(srvloc_tree, hf_srvloc_attrrply_attrlist, tvb, offset, length, CHARSET_UTF_8); + offset += length; + } + count = tvb_get_guint8(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_attrrply_attrauthcount, tvb, offset, 1, count); + offset += 1; + while (count > 0) { + offset = dissect_attrauthblk_v2(tvb, offset, srvloc_tree); + count--; + } break; - case ATTRRPLY: /* RFC2608 10.4 */ - expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error_v2, tvb, offset, 2, FALSE); - expert_status = tvb_get_ntohs(tvb, offset); - if (expert_status!=0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); - } - offset += 2; - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_attrrply_attrlistlen, tvb, offset, 2, length); - offset += 2; - if (length) { - attr_list2(srvloc_tree, hf_srvloc_attrrply_attrlist, tvb, offset, length, CHARSET_UTF_8); - offset += length; - } - count = tvb_get_guint8(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_attrrply_attrauthcount, tvb, offset, 1, count); - offset += 1; - while (count > 0) { - offset = dissect_attrauthblk_v2(tvb, offset, srvloc_tree); - count--; - } + case DAADVERT: /* RCC 2608 8.5 */ + expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error_v2, tvb, offset, 2, FALSE); + expert_status = tvb_get_ntohs(tvb, offset); + if (expert_status!=0) { + expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); + } + offset += 2; + ts.nsecs = 0; + ts.secs = tvb_get_ntohl(tvb, offset); + proto_tree_add_time(srvloc_tree, hf_srvloc_daadvert_timestamp, tvb, offset, 4, + &ts); + offset += 4; + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_daadvert_urllen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_daadvert_url, tvb, offset, length, TRUE); + offset += length; + } + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_daadvert_scopelistlen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_daadvert_scopelist, tvb, offset, length, TRUE); + offset += length; + } + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_daadvert_attrlistlen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_daadvert_attrlist, tvb, offset, length, TRUE); + offset += length; + } + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_daadvert_slpspilen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_daadvert_slpspi, tvb, offset, length, TRUE); + offset += length; + } + count = tvb_get_guint8(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_daadvert_authcount, tvb, offset, 1, count); + offset += 1; + while (count > 0) { + offset = dissect_authblk_v2(tvb, offset, srvloc_tree); + count--; + } break; - case DAADVERT: /* RCC 2608 8.5 */ - expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error_v2, tvb, offset, 2, FALSE); - expert_status = tvb_get_ntohs(tvb, offset); - if (expert_status!=0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); - } - offset += 2; - ts.nsecs = 0; - ts.secs = tvb_get_ntohl(tvb, offset); - proto_tree_add_time(srvloc_tree, hf_srvloc_daadvert_timestamp, tvb, offset, 4, - &ts); - offset += 4; - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_daadvert_urllen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_daadvert_url, tvb, offset, length, TRUE); - offset += length; - } - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_daadvert_scopelistlen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_daadvert_scopelist, tvb, offset, length, TRUE); - offset += length; - } - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_daadvert_attrlistlen, tvb, offset, 2, length); + case SRVTYPERQST: /* RFC2608 10.1 */ + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvtypereq_prlistlen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_srvtypereq_prlist, tvb, offset, length, TRUE); + offset += length; + } + length = tvb_get_ntohs(tvb, offset); + if (0xFFFF == length) { + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvtypereq_nameauthlistlenall, tvb, offset, 2, length); offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_daadvert_attrlist, tvb, offset, length, TRUE); - offset += length; - } - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_daadvert_slpspilen, tvb, offset, 2, length); + } else { + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvtypereq_nameauthlistlen, tvb, offset, 2, length); offset += 2; if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_daadvert_slpspi, tvb, offset, length, TRUE); + proto_tree_add_item(srvloc_tree, hf_srvloc_srvtypereq_nameauthlist, tvb, offset, length, TRUE); offset += length; } - count = tvb_get_guint8(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_daadvert_authcount, tvb, offset, 1, count); - offset += 1; - while (count > 0) { - offset = dissect_authblk_v2(tvb, offset, srvloc_tree); - count--; - } + } + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvtypereq_scopelistlen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_srvtypereq_scopelist, tvb, offset, length, TRUE); + offset += length; + } break; - case SRVTYPERQST: /* RFC2608 10.1 */ - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvtypereq_prlistlen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_srvtypereq_prlist, tvb, offset, length, TRUE); - offset += length; - } - length = tvb_get_ntohs(tvb, offset); - if (0xFFFF == length) { - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvtypereq_nameauthlistlenall, tvb, offset, 2, length); - offset += 2; - } else { - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvtypereq_nameauthlistlen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_srvtypereq_nameauthlist, tvb, offset, length, TRUE); - offset += length; - } - } - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvtypereq_scopelistlen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_srvtypereq_scopelist, tvb, offset, length, TRUE); - offset += length; - } + case SRVTYPERPLY: /* rfc2608 10.2 */ + expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error_v2, tvb, offset, 2, FALSE); + expert_status = tvb_get_ntohs(tvb, offset); + if (expert_status!=0) { + expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); + } + offset += 2; + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_srvtyperply_srvtypelistlen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_srvtyperply_srvtypelist, tvb, offset, length, TRUE); + offset += length; + } break; - case SRVTYPERPLY: /* rfc2608 10.2 */ - expert_item = proto_tree_add_item(srvloc_tree, hf_srvloc_error_v2, tvb, offset, 2, FALSE); - expert_status = tvb_get_ntohs(tvb, offset); - if (expert_status!=0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Error: %s", val_to_str(expert_status, srvloc_errs_v2, "Unknown SRVLOC Error (0x%02x)")); - } - offset += 2; - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_srvtyperply_srvtypelistlen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_srvtyperply_srvtypelist, tvb, offset, length, TRUE); - offset += length; - } + case SAADVERT: /* rfc2608 10.2 */ + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_saadvert_urllen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_saadvert_url, tvb, offset, length, TRUE); + offset += length; + } + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_saadvert_scopelistlen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_saadvert_scopelist, tvb, offset, length, TRUE); + offset += length; + } + length = tvb_get_ntohs(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_saadvert_attrlistlen, tvb, offset, 2, length); + offset += 2; + if (length) { + proto_tree_add_item(srvloc_tree, hf_srvloc_saadvert_attrlist, tvb, offset, length, TRUE); + offset += length; + } + count = tvb_get_guint8(tvb, offset); + proto_tree_add_uint(srvloc_tree, hf_srvloc_saadvert_authcount, tvb, offset, 1, length); + offset += 1; + while (count > 0) { + offset = dissect_authblk_v2(tvb, offset, srvloc_tree); + count--; + } break; - case SAADVERT: /* rfc2608 10.2 */ - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_saadvert_urllen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_saadvert_url, tvb, offset, length, TRUE); - offset += length; - } - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_saadvert_scopelistlen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_saadvert_scopelist, tvb, offset, length, TRUE); - offset += length; - } - length = tvb_get_ntohs(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_saadvert_attrlistlen, tvb, offset, 2, length); - offset += 2; - if (length) { - proto_tree_add_item(srvloc_tree, hf_srvloc_saadvert_attrlist, tvb, offset, length, TRUE); - offset += length; - } - count = tvb_get_guint8(tvb, offset); - proto_tree_add_uint(srvloc_tree, hf_srvloc_saadvert_authcount, tvb, offset, 1, length); - offset += 1; - while (count > 0) { - offset = dissect_authblk_v2(tvb, offset, srvloc_tree); - count--; - } - break; - - default: - expert_item = proto_tree_add_text(srvloc_tree, tvb, offset, -1, "Unknown Function Type"); - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Unknown Function Type: %d", function); - } - } + default: + expert_item = proto_tree_add_text(srvloc_tree, tvb, offset, -1, "Unknown Function Type"); + expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Unknown Function Type: %d", function); + } } } |