2 * Routines for Microsoft ActiveSync Desktop Pass-Through (DTPT) packet
5 * Uwe Girlich <uwe@planetquake.com>
6 * http://www.synce.org/moin/ProtocolDocumentation/DesktopPassThrough
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1998 Gerald Combs
14 * Copied from packet-quake.c
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
36 #include <epan/packet.h>
37 #include <epan/conversation.h>
38 #include <epan/prefs.h>
39 #include <epan/aftypes.h>
40 #include <epan/ipproto.h>
42 void proto_register_dtpt(void);
44 static int proto_dtpt
= -1;
46 static int hf_dtpt_version
= -1;
47 static int hf_dtpt_message_type
= -1;
48 static int hf_dtpt_flags
= -1;
49 static int hf_dtpt_flags_deep
= -1;
50 static int hf_dtpt_flags_containers
= -1;
51 static int hf_dtpt_flags_nocontainers
= -1;
52 static int hf_dtpt_flags_nearest
= -1;
53 static int hf_dtpt_flags_return_name
= -1;
54 static int hf_dtpt_flags_return_type
= -1;
55 static int hf_dtpt_flags_return_version
= -1;
56 static int hf_dtpt_flags_return_comment
= -1;
57 static int hf_dtpt_flags_return_addr
= -1;
58 static int hf_dtpt_flags_return_blob
= -1;
59 static int hf_dtpt_flags_return_aliases
= -1;
60 static int hf_dtpt_flags_return_query_string
= -1;
61 static int hf_dtpt_flags_flushcache
= -1;
62 static int hf_dtpt_flags_flushprevious
= -1;
63 static int hf_dtpt_flags_res_service
= -1;
64 static int hf_dtpt_payload_size
= -1;
65 static int hf_dtpt_handle
= -1;
66 static int hf_dtpt_error
= -1;
67 static int hf_dtpt_buffer_size
= -1;
68 static int hf_dtpt_data_size
= -1;
69 static int hf_dtpt_queryset_rawsize
= -1;
70 static int hf_dtpt_queryset_size
= -1;
71 static int hf_dtpt_queryset_service_instance_name_pointer
= -1;
72 static int hf_dtpt_queryset_service_class_id_pointer
= -1;
73 static int hf_dtpt_queryset_version
= -1;
74 static int hf_dtpt_queryset_comment_pointer
= -1;
75 static int hf_dtpt_queryset_namespace
= -1;
76 static int hf_dtpt_queryset_provider_id_pointer
= -1;
77 static int hf_dtpt_queryset_context_pointer
= -1;
78 static int hf_dtpt_queryset_protocols_number
= -1;
79 static int hf_dtpt_queryset_protocols_pointer
= -1;
80 static int hf_dtpt_queryset_query_string_pointer
= -1;
81 static int hf_dtpt_queryset_cs_addrs_number
= -1;
82 static int hf_dtpt_queryset_cs_addrs_pointer
= -1;
83 static int hf_dtpt_queryset_output_flags
= -1;
84 static int hf_dtpt_queryset_blob_pointer
= -1;
85 static int hf_dtpt_wstring_length
= -1;
86 static int hf_dtpt_wstring_data
= -1;
87 static int hf_dtpt_guid_length
= -1;
88 static int hf_dtpt_guid_data
= -1;
89 static int hf_dtpt_service_instance_name
= -1;
90 static int hf_dtpt_service_class_id
= -1;
91 static int hf_dtpt_comment
= -1;
92 static int hf_dtpt_ns_provider_id
= -1;
93 static int hf_dtpt_context
= -1;
94 static int hf_dtpt_protocols_number
= -1;
95 static int hf_dtpt_protocols_length
= -1;
96 static int hf_dtpt_protocol_family
= -1;
97 static int hf_dtpt_protocol_protocol
= -1;
98 static int hf_dtpt_query_string
= -1;
99 static int hf_dtpt_cs_addrs_number
= -1;
100 static int hf_dtpt_cs_addrs_length1
= -1;
101 static int hf_dtpt_cs_addr_socket_type
= -1;
102 static int hf_dtpt_cs_addr_protocol
= -1;
103 static int hf_dtpt_cs_addr_local_pointer
= -1;
104 static int hf_dtpt_cs_addr_local_length
= -1;
105 static int hf_dtpt_cs_addr_local
= -1;
106 static int hf_dtpt_cs_addr_remote_pointer
= -1;
107 static int hf_dtpt_cs_addr_remote_length
= -1;
108 static int hf_dtpt_cs_addr_remote
= -1;
109 static int hf_dtpt_sockaddr_length
= -1;
110 static int hf_dtpt_sockaddr_family
= -1;
111 static int hf_dtpt_sockaddr_port
= -1;
112 static int hf_dtpt_sockaddr_address
= -1;
113 static int hf_dtpt_blob_rawsize
= -1;
114 static int hf_dtpt_blob_size
= -1;
115 static int hf_dtpt_blob_data_pointer
= -1;
116 static int hf_dtpt_blob_data_length
= -1;
117 static int hf_dtpt_blob_data
= -1;
118 static int hf_dtpt_connect_addr
= -1;
120 static gint ett_dtpt
= -1;
121 static gint ett_dtpt_flags
= -1;
122 static gint ett_dtpt_queryset
= -1;
123 static gint ett_dtpt_wstring
= -1;
124 static gint ett_dtpt_guid
= -1;
125 static gint ett_dtpt_protocols
= -1;
126 static gint ett_dtpt_protocol
= -1;
127 static gint ett_dtpt_cs_addrs
= -1;
128 static gint ett_dtpt_cs_addr1
= -1;
129 static gint ett_dtpt_cs_addr2
= -1;
130 static gint ett_dtpt_sockaddr
= -1;
131 static gint ett_dtpt_blobraw
= -1;
132 static gint ett_dtpt_blob
= -1;
136 static dissector_handle_t dtpt_conversation_handle
;
137 /** static dissector_handle_t dtpt_data_handle; **/
138 static dissector_handle_t data_handle
;
142 static unsigned int gbl_dtptServerPort
=5721;
144 static const value_string names_message_type
[] = {
145 #define LookupBeginRequest 9
146 { LookupBeginRequest
, "LookupBeginRequest" },
147 #define LookupBeginResponse 10
148 { LookupBeginResponse
, "LookupBeginResponse" },
149 #define LookupNextRequest 11
150 { LookupNextRequest
, "LookupNextRequest" },
151 #define LookupNextResponse 12
152 { LookupNextResponse
, "LookupNextResponse" },
153 #define LookupEndRequest 13
154 { LookupEndRequest
, "LookupEndRequest" },
155 #define ConnectRequest 1
156 { ConnectRequest
, "ConnectRequest" },
157 #define ConnectResponseOK 0x5A
158 { ConnectResponseOK
, "ConnectResponseOK" },
159 #define ConnectResponseERR 0x5B
160 { ConnectResponseERR
, "ConnectResponseERR" },
164 static const value_string names_error
[] = {
166 { 10014, "WSAEFAULT" },
167 { 10060, "WSAETIMEDOUT" },
168 { 10108, "WSASERVICE_NOT_FOUND" },
169 { 11001, "WSAHOST_NOT_FOUND" },
173 static const value_string names_family
[] = {
174 { WINSOCK_AF_INET
, "AF_INET" },
179 * Winsock's SOCK_ values. These are probably the same as they are on
180 * other OSes, as they probably all come from 4.2BSD, but it's still
181 * best to define them ourselves (to avoid problems if other OSes
182 * define them differently, and to avoid having to include system
183 * header files that might require a bunch of other includes).
185 #define WINSOCK_SOCK_STREAM 1
186 #define WINSOCK_SOCK_DGRAM 2
187 #define WINSOCK_SOCK_RAW 3
189 static const value_string names_socket_type
[] = {
190 { WINSOCK_SOCK_STREAM
, "SOCK_STREAM" },
191 { WINSOCK_SOCK_DGRAM
, "SOCK_DGRAM" },
192 { WINSOCK_SOCK_RAW
, "SOCK_RAW" },
196 static const value_string names_protocol
[] = {
197 { IP_PROTO_IP
, "IPPROTO_IP" },
198 { IP_PROTO_TCP
, "IPPROTO_TCP" },
199 { IP_PROTO_UDP
, "IPPROTP_UDP" },
203 #define LUP_DEEP 0x0001
204 #define LUP_CONTAINERS 0x0002
205 #define LUP_NOCONTAINERS 0x0004
206 #define LUP_NEAREST 0x0008
207 #define LUP_RETURN_NAME 0x0010
208 #define LUP_RETURN_TYPE 0x0020
209 #define LUP_RETURN_VERSION 0x0040
210 #define LUP_RETURN_COMMENT 0x0080
211 #define LUP_RETURN_ADDR 0x0100
212 #define LUP_RETURN_BLOB 0x0200
213 #define LUP_RETURN_ALIASES 0x0400
214 #define LUP_RETURN_QUERY_STRING 0x0800
215 #define LUP_FLUSHCACHE 0x1000
216 #define LUP_FLUSHPREVIOUS 0x2000
217 #define LUP_RES_SERVICE 0x8000
219 #define SOCKADDR_WITH_LEN 1
220 #define SOCKADDR_CONNECT 2
223 dissect_dtpt_data(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
);
225 dissect_dtpt(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
);
229 dissect_dtpt_wstring(tvbuff_t
*tvb
, guint offset
, proto_tree
*tree
, int hfindex
)
231 guint32 wstring_length
;
232 guint32 wstring_size
;
233 char *wstring_data
= NULL
;
234 guint32 wstring_padding
= 0;
236 wstring_length
= tvb_get_letohl(tvb
, offset
);
237 wstring_data
= tvb_get_unicode_string(wmem_packet_scope(), tvb
, offset
+4, wstring_length
, ENC_LITTLE_ENDIAN
);
238 wstring_size
= wstring_length
;
239 if (wstring_size
%4) {
240 wstring_padding
= (4-wstring_size
%4);
241 wstring_size
+= wstring_padding
;
244 proto_item
*dtpt_wstring_item
= NULL
;
245 proto_tree
*dtpt_wstring_tree
= NULL
;
246 dtpt_wstring_item
= proto_tree_add_string(tree
, hfindex
,
247 tvb
, offset
+0, 4+wstring_size
, wstring_data
);
248 if (dtpt_wstring_item
)
249 dtpt_wstring_tree
= proto_item_add_subtree(dtpt_wstring_item
, ett_dtpt_wstring
);
250 if (dtpt_wstring_tree
) {
251 proto_tree_add_uint(dtpt_wstring_tree
, hf_dtpt_wstring_length
,
252 tvb
, offset
+0, 4, wstring_length
);
254 proto_tree_add_string(dtpt_wstring_tree
, hf_dtpt_wstring_data
,
255 tvb
, offset
+4, wstring_length
, wstring_data
);
257 proto_tree_add_text(dtpt_wstring_tree
, tvb
,
258 offset
+4+wstring_length
,wstring_padding
, "Padding");
261 offset
+= 4+wstring_size
;
266 dissect_dtpt_guid(tvbuff_t
*tvb
, guint offset
, proto_tree
*tree
, int hfindex
)
270 guid_length
= tvb_get_letohl(tvb
, offset
);
273 proto_item
*dtpt_guid_item
= NULL
;
274 proto_tree
*dtpt_guid_tree
= NULL
;
275 const gchar
*guid_name
= NULL
;
278 tvb_get_guid(tvb
, offset
+4, &guid
, ENC_LITTLE_ENDIAN
);
281 memset(&guid
, 0, sizeof(guid
));
283 dtpt_guid_item
= proto_tree_add_guid(tree
, hfindex
, tvb
, offset
, 4 + guid_length
, &guid
);
284 if (dtpt_guid_item
) {
285 guid_name
= guids_get_guid_name(&guid
);
286 if (guid_name
!= NULL
)
287 proto_item_set_text(dtpt_guid_item
, "%s: %s (%s)",
288 proto_registrar_get_name(hfindex
), guid_name
, guid_to_str(&guid
));
289 dtpt_guid_tree
= proto_item_add_subtree(dtpt_guid_item
, ett_dtpt_guid
);
291 if (dtpt_guid_tree
) {
292 proto_item
*dtpt_guid_data_item
= NULL
;
294 proto_tree_add_uint(dtpt_guid_tree
, hf_dtpt_guid_length
,
295 tvb
, offset
, 4, guid_length
);
297 dtpt_guid_data_item
= proto_tree_add_guid(dtpt_guid_tree
, hf_dtpt_guid_data
,
298 tvb
, offset
+4, guid_length
, &guid
);
299 if (guid_name
!= NULL
&& dtpt_guid_data_item
!= NULL
) {
300 proto_item_set_text(dtpt_guid_data_item
, "%s: %s (%s)",
301 proto_registrar_get_name(hf_dtpt_guid_data
),
302 guid_name
, guid_to_str(&guid
));
314 dissect_dtpt_sockaddr(tvbuff_t
*tvb
, guint offset
, proto_tree
*tree
, int hfindex
, int sockaddr_type
)
316 guint32 sockaddr_length
= 0;
317 proto_item
*sockaddr_item
= NULL
;
318 proto_tree
*sockaddr_tree
= NULL
;
319 guint32 sockaddr_len1
= 0;
320 guint32 sockaddr_len2
= 0;
322 switch (sockaddr_type
) {
323 case SOCKADDR_WITH_LEN
:
327 case SOCKADDR_CONNECT
:
333 if (sockaddr_type
== SOCKADDR_WITH_LEN
)
334 sockaddr_length
= tvb_get_letohl(tvb
, offset
+ 0);
337 sockaddr_item
= proto_tree_add_text(tree
,
338 tvb
, offset
, sockaddr_len1
+sockaddr_len2
, "%s", proto_registrar_get_name(hfindex
));
341 sockaddr_tree
= proto_item_add_subtree(sockaddr_item
, ett_dtpt_sockaddr
);
343 if (sockaddr_type
== SOCKADDR_WITH_LEN
)
344 proto_tree_add_uint(sockaddr_tree
, hf_dtpt_sockaddr_length
,
345 tvb
, offset
+0, 4, sockaddr_length
);
349 offset
+= sockaddr_len1
;
352 switch (sockaddr_type
) {
353 case SOCKADDR_WITH_LEN
: {
356 family
= tvb_get_letohs(tvb
, offset
);
357 proto_tree_add_uint(sockaddr_tree
, hf_dtpt_sockaddr_family
,
358 tvb
, offset
, 2, family
);
360 case WINSOCK_AF_INET
: {
364 port
= tvb_get_ntohs(tvb
,offset
+2);
365 proto_tree_add_uint(sockaddr_tree
, hf_dtpt_sockaddr_port
,
366 tvb
, offset
+2,2,port
);
367 addr
= tvb_get_ipv4(tvb
,offset
+4);
368 proto_tree_add_ipv4(sockaddr_tree
, hf_dtpt_sockaddr_address
,
369 tvb
, offset
+4,4,addr
);
370 proto_tree_add_text(sockaddr_tree
, tvb
, offset
+8, 8, "Padding");
371 proto_item_append_text(sockaddr_item
, ": %s:%d", ip_to_str((guint8
*)&addr
), port
);
377 case SOCKADDR_CONNECT
: {
380 family
= tvb_get_letohl(tvb
, offset
+0);
381 proto_tree_add_uint(sockaddr_tree
, hf_dtpt_sockaddr_family
,
382 tvb
, offset
+0, 4, family
);
384 case WINSOCK_AF_INET
: {
388 proto_tree_add_text(sockaddr_tree
, tvb
, offset
+4, 4, "Padding");
389 port
= tvb_get_ntohs(tvb
,offset
+8);
390 proto_tree_add_uint(sockaddr_tree
, hf_dtpt_sockaddr_port
,
391 tvb
, offset
+8,2,port
);
392 addr
= tvb_get_ipv4(tvb
,offset
+10);
393 proto_tree_add_ipv4(sockaddr_tree
, hf_dtpt_sockaddr_address
,
394 tvb
, offset
+10,4,addr
);
395 proto_tree_add_text(sockaddr_tree
, tvb
, offset
+14, 16, "Padding");
396 proto_item_append_text(sockaddr_item
, ": %s:%d", ip_to_str((guint8
*)&addr
), port
);
405 offset
+= sockaddr_len2
;
410 dissect_dtpt_conversation(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
414 /* First try to decode it as "normal" DTPT packets. */
415 offset
= dissect_dtpt(tvb
, pinfo
, tree
, NULL
);
418 /* No, maybe it was a DTPT data packet. */
419 offset
= dissect_dtpt_data(tvb
, pinfo
, tree
);
422 /* Handle any remaining bytes ... */
423 if (tvb_reported_length_remaining(tvb
, offset
) > 0) {
425 call_dissector(data_handle
,
426 tvb_new_subset_remaining(tvb
, offset
), pinfo
, tree
);
428 return tvb_reported_length(tvb
);
433 dissect_dtpt_data(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
435 proto_item
*dtpt_item
= NULL
;
436 proto_tree
*dtpt_tree
= NULL
;
437 proto_item
*dtpt_queryset_item
= NULL
;
438 proto_tree
*dtpt_queryset_tree
= NULL
;
440 guint32 queryset_rawsize
;
441 guint32 queryset_size
;
442 guint32 num_protocols
;
443 guint32 protocols_length
= 0;
446 guint32 addrs_length1
= 0;
447 proto_item
*dtpt_addrs_item
= NULL
;
448 proto_tree
*dtpt_addrs_tree
= NULL
;
449 guint32 blob_rawsize
= 0;
450 guint32 blob_size
= 0;
451 guint32 blob_data_length
= 0;
453 queryset_rawsize
= tvb_get_letohl(tvb
, offset
+ 0);
454 if (queryset_rawsize
!= 60) return 0;
455 queryset_size
= tvb_get_letohl(tvb
, offset
+ 4);
456 if (queryset_size
!= 60) return 0;
458 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "DTPT");
459 col_set_str(pinfo
->cinfo
, COL_INFO
, "QuerySet");
462 dtpt_item
= proto_tree_add_item(tree
, proto_dtpt
,
465 dtpt_tree
= proto_item_add_subtree(dtpt_item
, ett_dtpt
);
469 proto_tree_add_uint(dtpt_tree
, hf_dtpt_queryset_rawsize
,
470 tvb
, 0, 4, queryset_rawsize
);
472 dtpt_queryset_item
= proto_tree_add_text(dtpt_tree
,
473 tvb
, 4, 60, "QuerySet raw");
474 if (dtpt_queryset_item
)
475 dtpt_queryset_tree
= proto_item_add_subtree(dtpt_queryset_item
, ett_dtpt_queryset
);
477 if (dtpt_queryset_tree
) {
478 proto_tree_add_uint(dtpt_queryset_tree
, hf_dtpt_queryset_size
,
479 tvb
, offset
+4+0, 4, queryset_size
);
480 proto_tree_add_uint(dtpt_queryset_tree
, hf_dtpt_queryset_service_instance_name_pointer
,
481 tvb
, offset
+4+4, 4, tvb_get_letohl(tvb
, offset
+4+ 4));
482 proto_tree_add_uint(dtpt_queryset_tree
, hf_dtpt_queryset_service_class_id_pointer
,
483 tvb
, offset
+4+8, 4, tvb_get_letohl(tvb
, offset
+4+ 8));
484 proto_tree_add_uint(dtpt_queryset_tree
, hf_dtpt_queryset_version
,
485 tvb
, offset
+4+12, 4, tvb_get_letohl(tvb
, offset
+4+12));
486 proto_tree_add_uint(dtpt_queryset_tree
, hf_dtpt_queryset_comment_pointer
,
487 tvb
, offset
+4+16, 4, tvb_get_letohl(tvb
, offset
+4+16));
488 proto_tree_add_uint(dtpt_queryset_tree
, hf_dtpt_queryset_namespace
,
489 tvb
, offset
+4+20, 4, tvb_get_letohl(tvb
, offset
+4+20));
490 proto_tree_add_uint(dtpt_queryset_tree
, hf_dtpt_queryset_provider_id_pointer
,
491 tvb
, offset
+4+24, 4, tvb_get_letohl(tvb
, offset
+4+24));
492 proto_tree_add_uint(dtpt_queryset_tree
, hf_dtpt_queryset_context_pointer
,
493 tvb
, offset
+4+28, 4, tvb_get_letohl(tvb
, offset
+4+28));
494 proto_tree_add_uint(dtpt_queryset_tree
, hf_dtpt_queryset_protocols_number
,
495 tvb
, offset
+4+32, 4, tvb_get_letohl(tvb
, offset
+4+32));
496 proto_tree_add_uint(dtpt_queryset_tree
, hf_dtpt_queryset_protocols_pointer
,
497 tvb
, offset
+4+36, 4, tvb_get_letohl(tvb
, offset
+4+36));
498 proto_tree_add_uint(dtpt_queryset_tree
, hf_dtpt_queryset_query_string_pointer
,
499 tvb
, offset
+4+40, 4, tvb_get_letohl(tvb
, offset
+4+40));
500 proto_tree_add_uint(dtpt_queryset_tree
, hf_dtpt_queryset_cs_addrs_number
,
501 tvb
, offset
+4+44, 4, tvb_get_letohl(tvb
, offset
+4+44));
502 proto_tree_add_uint(dtpt_queryset_tree
, hf_dtpt_queryset_cs_addrs_pointer
,
503 tvb
, offset
+4+48, 4, tvb_get_letohl(tvb
, offset
+4+48));
504 proto_tree_add_uint(dtpt_queryset_tree
, hf_dtpt_queryset_output_flags
,
505 tvb
, offset
+4+52, 4, tvb_get_letohl(tvb
, offset
+4+52));
506 proto_tree_add_uint(dtpt_queryset_tree
, hf_dtpt_queryset_blob_pointer
,
507 tvb
, offset
+4+56, 4, tvb_get_letohl(tvb
, offset
+4+56));
514 offset
= dissect_dtpt_wstring(tvb
, offset
, dtpt_tree
, hf_dtpt_service_instance_name
);
515 offset
= dissect_dtpt_guid (tvb
, offset
, dtpt_tree
, hf_dtpt_service_class_id
);
516 offset
= dissect_dtpt_wstring(tvb
, offset
, dtpt_tree
, hf_dtpt_comment
);
517 offset
= dissect_dtpt_guid (tvb
, offset
, dtpt_tree
, hf_dtpt_ns_provider_id
);
518 offset
= dissect_dtpt_wstring(tvb
, offset
, dtpt_tree
, hf_dtpt_context
);
519 num_protocols
= tvb_get_letohl(tvb
, offset
);
520 if (num_protocols
>0) {
521 protocols_length
= tvb_get_letohl(tvb
, offset
+4);
524 proto_item
*dtpt_protocols_item
= NULL
;
525 proto_tree
*dtpt_protocols_tree
= NULL
;
528 dtpt_protocols_item
= proto_tree_add_text(dtpt_tree
,
529 tvb
, offset
, 4+(num_protocols
>0?4:0)+num_protocols
*8,
530 "Protocols: %d", num_protocols
);
531 if (dtpt_protocols_item
)
532 dtpt_protocols_tree
= proto_item_add_subtree(dtpt_protocols_item
, ett_dtpt_protocols
);
533 if (dtpt_protocols_tree
) {
534 proto_tree_add_uint(dtpt_protocols_tree
, hf_dtpt_protocols_number
,
535 tvb
, offset
, 4, num_protocols
);
537 proto_tree_add_uint(dtpt_protocols_tree
, hf_dtpt_protocols_length
,
538 tvb
, offset
+4, 4, protocols_length
);
539 for (i
=0;i
<num_protocols
;i
++) {
540 proto_item
*dtpt_protocol_item
= NULL
;
541 proto_tree
*dtpt_protocol_tree
= NULL
;
543 dtpt_protocol_item
= proto_tree_add_text(dtpt_protocols_tree
,
544 tvb
, offset
+4+4+i
*8, 8, "Protocol[%d]", i
+1);
545 if (dtpt_protocol_item
)
546 dtpt_protocol_tree
= proto_item_add_subtree(dtpt_protocol_item
, ett_dtpt_protocol
);
547 if (dtpt_protocol_tree
) {
548 proto_tree_add_uint(dtpt_protocol_tree
, hf_dtpt_protocol_family
,
549 tvb
, offset
+4+4+i
*8, 4, tvb_get_letohl(tvb
, offset
+4+4+i
*8));
550 proto_tree_add_uint(dtpt_protocol_tree
, hf_dtpt_protocol_protocol
,
551 tvb
, offset
+4+4+i
*8+4, 4, tvb_get_letohl(tvb
, offset
+4+4+i
*8+4));
556 offset
+= 4 + (num_protocols
>0?4:0) + num_protocols
*8;
557 offset
= dissect_dtpt_wstring(tvb
, offset
, dtpt_tree
, hf_dtpt_query_string
);
559 addrs_start
= offset
;
560 num_addrs
= tvb_get_letohl(tvb
, offset
);
562 addrs_length1
= tvb_get_letohl(tvb
, offset
+4);
565 dtpt_addrs_item
= proto_tree_add_text(dtpt_tree
,
566 tvb
, offset
, -1, "Addresses");
568 dtpt_addrs_tree
= proto_item_add_subtree(dtpt_addrs_item
, ett_dtpt_cs_addrs
);
569 if (dtpt_addrs_tree
) {
570 proto_tree_add_uint(dtpt_addrs_tree
, hf_dtpt_cs_addrs_number
,
571 tvb
, offset
, 4, num_addrs
);
573 proto_tree_add_uint(dtpt_addrs_tree
, hf_dtpt_cs_addrs_length1
,
574 tvb
, offset
+4, 4, addrs_length1
);
577 offset
+= 4 + (num_addrs
>0?4:0);
583 offset2
= offset
+ 24*num_addrs
;
585 for (i
=0;i
<num_addrs
;i
++,offset
+=24) {
586 proto_item
*dtpt_addr1_item
= NULL
;
587 proto_tree
*dtpt_addr1_tree
= NULL
;
588 proto_item
*dtpt_addr2_item
= NULL
;
589 proto_tree
*dtpt_addr2_tree
= NULL
;
590 guint32 offset2_start
;
592 if (dtpt_addrs_tree
) {
593 dtpt_addr1_item
= proto_tree_add_text(dtpt_addrs_tree
,
594 tvb
, offset
, 24, "Address[%u] Part 1", i
+1);
596 dtpt_addr1_tree
= proto_item_add_subtree(dtpt_addr1_item
,
598 if (dtpt_addr1_tree
) {
599 proto_tree_add_uint(dtpt_addr1_tree
, hf_dtpt_cs_addr_local_pointer
,
600 tvb
, offset
+ 0, 4, tvb_get_letohl(tvb
, offset
+ 0));
601 proto_tree_add_uint(dtpt_addr1_tree
, hf_dtpt_cs_addr_local_length
,
602 tvb
, offset
+ 4, 4, tvb_get_letohl(tvb
, offset
+ 4));
603 proto_tree_add_uint(dtpt_addr1_tree
, hf_dtpt_cs_addr_remote_pointer
,
604 tvb
, offset
+ 8, 4, tvb_get_letohl(tvb
, offset
+ 8));
605 proto_tree_add_uint(dtpt_addr1_tree
, hf_dtpt_cs_addr_remote_length
,
606 tvb
, offset
+12, 4, tvb_get_letohl(tvb
, offset
+12));
607 proto_tree_add_uint(dtpt_addr1_tree
, hf_dtpt_cs_addr_socket_type
,
608 tvb
, offset
+16, 4, tvb_get_letohl(tvb
, offset
+16));
609 proto_tree_add_uint(dtpt_addr1_tree
, hf_dtpt_cs_addr_protocol
,
610 tvb
, offset
+20, 4, tvb_get_letohl(tvb
, offset
+20));
613 dtpt_addr2_item
= proto_tree_add_text(dtpt_addrs_tree
,
614 tvb
, offset2
, -1, "Address[%u] Part 2", i
+1);
616 dtpt_addr2_tree
= proto_item_add_subtree(dtpt_addr2_item
,
620 offset2_start
= offset2
;
622 offset2
= dissect_dtpt_sockaddr(tvb
, offset2
, dtpt_addr2_tree
, hf_dtpt_cs_addr_local
, SOCKADDR_WITH_LEN
);
623 offset2
= dissect_dtpt_sockaddr(tvb
, offset2
, dtpt_addr2_tree
, hf_dtpt_cs_addr_remote
, SOCKADDR_WITH_LEN
);
626 proto_item_set_len(dtpt_addr2_item
,
627 offset2
- offset2_start
);
633 proto_item_set_len(dtpt_addrs_item
, offset
- addrs_start
);
636 proto_item_set_len(dtpt_item
, offset
);
638 blob_rawsize
= tvb_get_letohl(tvb
, offset
);
639 if (blob_rawsize
>=4) {
640 blob_size
= tvb_get_letohl(tvb
,offset
+4+0);
643 proto_item
*dtpt_blobraw_item
= NULL
;
644 proto_tree
*dtpt_blobraw_tree
= NULL
;
646 proto_tree_add_uint(dtpt_tree
, hf_dtpt_blob_rawsize
,
647 tvb
, offset
+0, 4, blob_rawsize
);
648 if (blob_rawsize
>0) {
649 dtpt_blobraw_item
= proto_tree_add_text(dtpt_tree
,
650 tvb
, offset
+4, blob_rawsize
, "Blob raw");
651 if (dtpt_blobraw_item
)
652 dtpt_blobraw_tree
= proto_item_add_subtree(dtpt_blobraw_item
,
654 if (dtpt_blobraw_tree
) {
655 proto_tree_add_uint(dtpt_blobraw_tree
, hf_dtpt_blob_size
,
656 tvb
, offset
+4+0, 4, blob_size
);
657 proto_tree_add_uint(dtpt_blobraw_tree
, hf_dtpt_blob_data_pointer
,
658 tvb
, offset
+4+4, 4, tvb_get_letohl(tvb
,offset
+4+4));
663 offset
+= 4+blob_rawsize
;
666 proto_item_set_len(dtpt_item
, offset
);
669 proto_item
*dtpt_blob_item
= NULL
;
670 proto_tree
*dtpt_blob_tree
= NULL
;
672 blob_data_length
= tvb_get_letohl(tvb
,offset
);
675 dtpt_blob_item
= proto_tree_add_text(dtpt_tree
,
676 tvb
, offset
, 4+blob_data_length
, "Blob");
678 dtpt_blob_tree
= proto_item_add_subtree(dtpt_blob_item
,
680 if (dtpt_blob_tree
) {
681 proto_tree_add_uint(dtpt_blob_tree
, hf_dtpt_blob_data_length
,
682 tvb
, offset
+0, 4, blob_data_length
);
683 proto_tree_add_item(dtpt_blob_tree
, hf_dtpt_blob_data
,
684 tvb
, offset
+4, blob_data_length
, ENC_NA
);
687 offset
+= 4+blob_data_length
;
689 proto_item_set_len(dtpt_item
, offset
);
696 dissect_dtpt(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data _U_
)
698 proto_tree
*dtpt_tree
= NULL
;
699 proto_item
*dtpt_item
= NULL
;
703 guint32 payload_size
;
705 version
= tvb_get_guint8(tvb
, 0);
706 if (version
!= 1) return 0;
707 message_type
= tvb_get_guint8(tvb
, 1);
708 switch (message_type
) {
709 case LookupBeginRequest
:
710 case LookupBeginResponse
:
711 case LookupNextRequest
:
712 case LookupNextResponse
:
713 case LookupEndRequest
:
714 if (tvb_reported_length(tvb
) != 20) return 0;
717 case ConnectResponseOK
:
718 case ConnectResponseERR
:
719 if (tvb_reported_length(tvb
) != 36) return 0;
725 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "DTPT");
726 col_add_str(pinfo
->cinfo
, COL_INFO
, val_to_str(message_type
, names_message_type
, "Unknown (%d)"));
728 if (message_type
== LookupBeginRequest
) {
730 c
= find_or_create_conversation(pinfo
);
731 conversation_set_dissector(c
, dtpt_conversation_handle
);
735 dtpt_item
= proto_tree_add_item(tree
, proto_dtpt
,
738 dtpt_tree
= proto_item_add_subtree(dtpt_item
, ett_dtpt
);
742 proto_tree_add_uint(dtpt_tree
, hf_dtpt_version
,
744 proto_tree_add_uint(dtpt_tree
, hf_dtpt_message_type
,
745 tvb
, 1, 1, message_type
);
747 switch (message_type
) {
748 case LookupBeginRequest
: {
749 proto_item
* flags_item
= NULL
;
750 proto_tree
* flags_tree
= NULL
;
752 flags
= tvb_get_letohl(tvb
, 12);
754 flags_item
= proto_tree_add_uint(dtpt_tree
, hf_dtpt_flags
,
757 flags_tree
= proto_item_add_subtree(flags_item
, ett_dtpt_flags
);
760 proto_tree_add_boolean(flags_tree
, hf_dtpt_flags_res_service
, tvb
, 12, 4, flags
);
761 proto_tree_add_boolean(flags_tree
, hf_dtpt_flags_flushprevious
, tvb
, 12, 4, flags
);
762 proto_tree_add_boolean(flags_tree
, hf_dtpt_flags_flushcache
, tvb
, 12, 4, flags
);
763 proto_tree_add_boolean(flags_tree
, hf_dtpt_flags_return_query_string
, tvb
, 12, 4, flags
);
764 proto_tree_add_boolean(flags_tree
, hf_dtpt_flags_return_aliases
, tvb
, 12, 4, flags
);
765 proto_tree_add_boolean(flags_tree
, hf_dtpt_flags_return_blob
, tvb
, 12, 4, flags
);
766 proto_tree_add_boolean(flags_tree
, hf_dtpt_flags_return_addr
, tvb
, 12, 4, flags
);
767 proto_tree_add_boolean(flags_tree
, hf_dtpt_flags_return_comment
, tvb
, 12, 4, flags
);
768 proto_tree_add_boolean(flags_tree
, hf_dtpt_flags_return_version
, tvb
, 12, 4, flags
);
769 proto_tree_add_boolean(flags_tree
, hf_dtpt_flags_return_type
, tvb
, 12, 4, flags
);
770 proto_tree_add_boolean(flags_tree
, hf_dtpt_flags_return_name
, tvb
, 12, 4, flags
);
771 proto_tree_add_boolean(flags_tree
, hf_dtpt_flags_nearest
, tvb
, 12, 4, flags
);
772 proto_tree_add_boolean(flags_tree
, hf_dtpt_flags_nocontainers
, tvb
, 12, 4, flags
);
773 proto_tree_add_boolean(flags_tree
, hf_dtpt_flags_containers
, tvb
, 12, 4, flags
);
774 proto_tree_add_boolean(flags_tree
, hf_dtpt_flags_deep
, tvb
, 12, 4, flags
);
776 payload_size
= tvb_get_letohl(tvb
, 16);
777 proto_tree_add_uint(dtpt_tree
, hf_dtpt_payload_size
,
778 tvb
, 16, 4, payload_size
);
781 case LookupBeginResponse
: {
782 proto_tree_add_uint64(dtpt_tree
, hf_dtpt_handle
,
783 tvb
, 4, 8, tvb_get_letoh64(tvb
, 4));
784 proto_tree_add_uint(dtpt_tree
, hf_dtpt_error
,
785 tvb
, 12, 4, tvb_get_letohl(tvb
, 12));
788 case LookupNextRequest
: {
789 proto_tree_add_uint64(dtpt_tree
, hf_dtpt_handle
,
790 tvb
, 4, 8, tvb_get_letoh64(tvb
, 4));
791 proto_tree_add_uint(dtpt_tree
, hf_dtpt_buffer_size
,
792 tvb
, 16, 4, tvb_get_letohl(tvb
, 16));
795 case LookupNextResponse
: {
796 proto_tree_add_uint(dtpt_tree
, hf_dtpt_error
,
797 tvb
, 12, 4, tvb_get_letohl(tvb
, 12));
798 proto_tree_add_uint(dtpt_tree
, hf_dtpt_data_size
,
799 tvb
, 16, 4, tvb_get_letohl(tvb
, 16));
802 case LookupEndRequest
: {
803 proto_tree_add_uint64(dtpt_tree
, hf_dtpt_handle
,
804 tvb
, 4, 8, tvb_get_letoh64(tvb
, 4));
807 case ConnectRequest
: {
808 dissect_dtpt_sockaddr(tvb
, 2, dtpt_tree
, hf_dtpt_connect_addr
, SOCKADDR_CONNECT
);
809 proto_tree_add_uint(dtpt_tree
, hf_dtpt_error
,
810 tvb
, 32, 4, tvb_get_letohl(tvb
, 32));
813 case ConnectResponseOK
: {
814 dissect_dtpt_sockaddr(tvb
, 2, dtpt_tree
, hf_dtpt_connect_addr
, SOCKADDR_CONNECT
);
815 proto_tree_add_uint(dtpt_tree
, hf_dtpt_error
,
816 tvb
, 32, 4, tvb_get_letohl(tvb
, 32));
819 case ConnectResponseERR
: {
820 dissect_dtpt_sockaddr(tvb
, 2, dtpt_tree
, hf_dtpt_connect_addr
, SOCKADDR_CONNECT
);
821 proto_tree_add_uint(dtpt_tree
, hf_dtpt_error
,
822 tvb
, 32, 4, tvb_get_letohl(tvb
, 32));
828 return tvb_length(tvb
);
831 void proto_reg_handoff_dtpt(void);
834 proto_register_dtpt(void)
836 static hf_register_info hf
[] = {
838 { "Version", "dtpt.version",
839 FT_UINT8
, BASE_DEC
, NULL
, 0x0,
840 "Protocol Version", HFILL
}},
842 { &hf_dtpt_message_type
,
843 { "Message Type", "dtpt.message_type",
844 FT_UINT8
, BASE_DEC
, VALS(names_message_type
), 0x0,
845 "Packet Message Type", HFILL
}},
848 { "ControlFlags", "dtpt.flags",
849 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
850 "ControlFlags as documented for WSALookupServiceBegin", HFILL
}},
852 { &hf_dtpt_flags_deep
,
853 { "DEEP", "dtpt.flags.deep",
854 FT_BOOLEAN
, 32, TFS(&tfs_set_notset
), LUP_DEEP
,
857 { &hf_dtpt_flags_containers
,
858 { "CONTAINERS", "dtpt.flags.containers",
859 FT_BOOLEAN
, 32, TFS(&tfs_set_notset
), LUP_CONTAINERS
,
862 { &hf_dtpt_flags_nocontainers
,
863 { "NOCONTAINERS", "dtpt.flags.nocontainers",
864 FT_BOOLEAN
, 32, TFS(&tfs_set_notset
), LUP_NOCONTAINERS
,
867 { &hf_dtpt_flags_nearest
,
868 { "NEAREST", "dtpt.flags.nearest",
869 FT_BOOLEAN
, 32, TFS(&tfs_set_notset
), LUP_NEAREST
,
872 { &hf_dtpt_flags_return_name
,
873 { "RETURN_NAME", "dtpt.flags.return_name",
874 FT_BOOLEAN
, 32, TFS(&tfs_set_notset
), LUP_RETURN_NAME
,
877 { &hf_dtpt_flags_return_type
,
878 { "RETURN_TYPE", "dtpt.flags.return_type",
879 FT_BOOLEAN
, 32, TFS(&tfs_set_notset
), LUP_RETURN_TYPE
,
882 { &hf_dtpt_flags_return_version
,
883 { "RETURN_VERSION", "dtpt.flags.return_version",
884 FT_BOOLEAN
, 32, TFS(&tfs_set_notset
), LUP_RETURN_VERSION
,
887 { &hf_dtpt_flags_return_comment
,
888 { "RETURN_COMMENT", "dtpt.flags.return_comment",
889 FT_BOOLEAN
, 32, TFS(&tfs_set_notset
), LUP_RETURN_COMMENT
,
892 { &hf_dtpt_flags_return_addr
,
893 { "RETURN_ADDR", "dtpt.flags.return_addr",
894 FT_BOOLEAN
, 32, TFS(&tfs_set_notset
), LUP_RETURN_ADDR
,
897 { &hf_dtpt_flags_return_blob
,
898 { "RETURN_BLOB", "dtpt.flags.return_blob",
899 FT_BOOLEAN
, 32, TFS(&tfs_set_notset
), LUP_RETURN_BLOB
,
902 { &hf_dtpt_flags_return_aliases
,
903 { "RETURN_ALIASES", "dtpt.flags.return_aliases",
904 FT_BOOLEAN
, 32, TFS(&tfs_set_notset
), LUP_RETURN_ALIASES
,
907 { &hf_dtpt_flags_return_query_string
,
908 { "RETURN_QUERY_STRING", "dtpt.flags.return_query_string",
909 FT_BOOLEAN
, 32, TFS(&tfs_set_notset
), LUP_RETURN_QUERY_STRING
,
912 { &hf_dtpt_flags_flushcache
,
913 { "FLUSHCACHE", "dtpt.flags.flushcache",
914 FT_BOOLEAN
, 32, TFS(&tfs_set_notset
), LUP_FLUSHCACHE
,
917 { &hf_dtpt_flags_flushprevious
,
918 { "FLUSHPREVIOUS", "dtpt.flags.flushprevious",
919 FT_BOOLEAN
, 32, TFS(&tfs_set_notset
), LUP_FLUSHPREVIOUS
,
922 { &hf_dtpt_flags_res_service
,
923 { "RES_SERVICE", "dtpt.flags.res_service",
924 FT_BOOLEAN
, 32, TFS(&tfs_set_notset
), LUP_RES_SERVICE
,
927 { &hf_dtpt_payload_size
,
928 { "Payload Size", "dtpt.payload_size",
929 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
930 "Payload Size of the following packet containing a serialized WSAQUERYSET", HFILL
}},
933 { "Handle", "dtpt.handle",
934 FT_UINT64
, BASE_HEX
, NULL
, 0x0,
935 "Lookup handle", HFILL
}},
938 { "Last Error", "dtpt.error",
939 FT_UINT32
, BASE_DEC
, VALS(names_error
), 0x0,
942 { &hf_dtpt_buffer_size
,
943 { "Buffer Size", "dtpt.buffer_size",
944 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
947 { &hf_dtpt_data_size
,
948 { "Data Size", "dtpt.data_size",
949 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
952 { &hf_dtpt_queryset_rawsize
,
953 { "QuerySet Size", "dtpt.queryset_size",
954 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
955 "Size of the binary WSAQUERYSET", HFILL
}},
957 { &hf_dtpt_queryset_size
,
958 { "dwSize", "dtpt.queryset.dwSize",
959 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
960 "dwSize field in WSAQUERYSET", HFILL
}},
962 { &hf_dtpt_queryset_service_instance_name_pointer
,
963 { "lpszServiceInstanceName", "dtpt.queryset.lpszServiceInstanceName",
964 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
965 "lpszServiceInstanceName field in WSAQUERYSET", HFILL
}},
967 { &hf_dtpt_queryset_service_class_id_pointer
,
968 { "lpServiceClassId", "dtpt.queryset.lpServiceClassId",
969 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
970 "lpServiceClassId in the WSAQUERYSET", HFILL
}},
972 { &hf_dtpt_queryset_version
,
973 { "lpVersion", "dtpt.queryset.lpVersion",
974 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
975 "lpVersion in WSAQUERYSET", HFILL
}},
977 { &hf_dtpt_queryset_comment_pointer
,
978 { "lpszComment", "dtpt.lpszComment",
979 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
980 "lpszComment field in WSAQUERYSET", HFILL
}},
982 { &hf_dtpt_queryset_namespace
,
983 { "dwNameSpace", "dtpt.queryset.dwNameSpace",
984 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
985 "dwNameSpace field in WSAQUERYSE", HFILL
}},
987 { &hf_dtpt_queryset_provider_id_pointer
,
988 { "lpNSProviderId", "dtpt.queryset.lpNSProviderId",
989 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
990 "lpNSProviderId field in WSAQUERYSET", HFILL
}},
992 { &hf_dtpt_queryset_context_pointer
,
993 { "lpszContext", "dtpt.queryset.lpszContext",
994 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
995 "lpszContext field in WSAQUERYSET", HFILL
}},
997 { &hf_dtpt_queryset_protocols_number
,
998 { "dwNumberOfProtocols", "dtpt.queryset.dwNumberOfProtocols",
999 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1000 "dwNumberOfProtocols field in WSAQUERYSET", HFILL
}},
1002 { &hf_dtpt_queryset_protocols_pointer
,
1003 { "lpafpProtocols", "dtpt.queryset.lpafpProtocols",
1004 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
1005 "lpafpProtocols field in WSAQUERYSET", HFILL
}},
1007 { &hf_dtpt_queryset_query_string_pointer
,
1008 { "lpszQueryString", "dtpt.queryset.lpszQueryString",
1009 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
1010 "lpszQueryString field in WSAQUERYSET", HFILL
}},
1012 { &hf_dtpt_queryset_cs_addrs_number
,
1013 { "dwNumberOfCsAddrs", "dtpt.queryset.dwNumberOfCsAddrs",
1014 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1015 "dwNumberOfCsAddrs field in WSAQUERYSET", HFILL
}},
1017 { &hf_dtpt_queryset_cs_addrs_pointer
,
1018 { "lpcsaBuffer", "dtpt.queryset.lpcsaBuffer",
1019 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
1020 "lpcsaBuffer field in WSAQUERYSET", HFILL
}},
1022 { &hf_dtpt_queryset_output_flags
,
1023 { "dwOutputFlags", "dtpt.queryset.dwOutputFlags",
1024 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
1025 "dwOutputFlags field in WSAQUERYSET", HFILL
}},
1027 { &hf_dtpt_queryset_blob_pointer
,
1028 { "lpBlob", "dtpt.queryset.lpBlob",
1029 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
1030 "lpBlob field in WSAQUERYSET", HFILL
}},
1032 { &hf_dtpt_wstring_length
,
1033 { "Length", "dtpt.wstring.length",
1034 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1035 "String Length", HFILL
}},
1037 { &hf_dtpt_wstring_data
,
1038 { "Data", "dtpt.wstring.data",
1039 FT_STRING
, BASE_NONE
, NULL
, 0x0,
1040 "String Data", HFILL
}},
1042 { &hf_dtpt_guid_length
,
1043 { "Length", "dtpt.guid.length",
1044 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1045 "GUID Length", HFILL
}},
1047 { &hf_dtpt_guid_data
,
1048 { "Data", "dtpt.guid.data",
1049 FT_GUID
, BASE_NONE
, NULL
, 0x0,
1050 "GUID Data", HFILL
}},
1052 { &hf_dtpt_service_instance_name
,
1053 { "Service Instance Name", "dtpt.service_instance_name",
1054 FT_STRINGZ
, BASE_NONE
, NULL
, 0x0,
1057 { &hf_dtpt_service_class_id
,
1058 { "Service Class ID", "dtpt.service_class_id",
1059 FT_GUID
, BASE_NONE
, NULL
, 0x0,
1063 { "Comment", "dtpt.comment",
1064 FT_STRINGZ
, BASE_NONE
, NULL
, 0x0,
1067 { &hf_dtpt_ns_provider_id
,
1068 { "NS Provider ID", "dtpt.ns_provider_id",
1069 FT_GUID
, BASE_NONE
, NULL
, 0x0,
1073 { "Context", "dtpt.context",
1074 FT_STRINGZ
, BASE_NONE
, NULL
, 0x0,
1077 { &hf_dtpt_protocols_number
,
1078 { "Number of Protocols", "dtpt.protocols.number",
1079 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1082 { &hf_dtpt_protocols_length
,
1083 { "Length of Protocols", "dtpt.protocols.length",
1084 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1087 { &hf_dtpt_protocol_family
,
1088 { "Family", "dtpt.protocol.family",
1089 FT_UINT32
, BASE_DEC
, VALS(names_family
), 0x0,
1090 "Protocol Family", HFILL
}},
1092 { &hf_dtpt_protocol_protocol
,
1093 { "Protocol", "dtpt.protocol.protocol",
1094 FT_UINT32
, BASE_DEC
, VALS(names_protocol
), 0x0,
1095 "Protocol Protocol", HFILL
}},
1097 { &hf_dtpt_query_string
,
1098 { "Query String", "dtpt.query_string",
1099 FT_STRINGZ
, BASE_NONE
, NULL
, 0x0,
1102 { &hf_dtpt_cs_addrs_number
,
1103 { "Number of CS Addresses", "dtpt.cs_addrs.number",
1104 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1107 { &hf_dtpt_cs_addrs_length1
,
1108 { "Length of CS Addresses Part 1", "dtpt.cs_addrs.length1",
1109 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1112 { &hf_dtpt_cs_addr_socket_type
,
1113 { "Socket Type", "dtpt.cs_addrs.socket_type",
1114 FT_UINT32
, BASE_DEC
, VALS(names_socket_type
), 0x0,
1117 { &hf_dtpt_cs_addr_protocol
,
1118 { "Protocol", "dtpt.cs_addrs.protocol",
1119 FT_UINT32
, BASE_DEC
, VALS(names_protocol
), 0x0,
1122 { &hf_dtpt_cs_addr_local_pointer
,
1123 { "Local Address Pointer", "dtpt.cs_addr.local_pointer",
1124 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
1127 { &hf_dtpt_cs_addr_local_length
,
1128 { "Local Address Length", "dtpt.cs_addr.local_length",
1129 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1130 "Local Address Pointer", HFILL
}},
1132 { &hf_dtpt_cs_addr_local
,
1133 { "Local Address", "dtpt.cs_addr.local",
1134 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1137 { &hf_dtpt_cs_addr_remote_pointer
,
1138 { "Remote Address Pointer", "dtpt.cs_addr.remote_pointer",
1139 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
1142 { &hf_dtpt_cs_addr_remote_length
,
1143 { "Remote Address Length", "dtpt.cs_addr.remote_length",
1144 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1145 "Remote Address Pointer", HFILL
}},
1147 { &hf_dtpt_cs_addr_remote
,
1148 { "Remote Address", "dtpt.cs_addr.remote",
1149 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1152 { &hf_dtpt_sockaddr_length
,
1153 { "Length", "dtpt.sockaddr.length",
1154 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1155 "Socket Address Length", HFILL
}},
1157 { &hf_dtpt_sockaddr_family
,
1158 { "Family", "dtpt.sockaddr.family",
1159 FT_UINT16
, BASE_DEC
, VALS(names_family
), 0x0,
1160 "Socket Address Family", HFILL
}},
1162 { &hf_dtpt_sockaddr_port
,
1163 { "Port", "dtpt.sockaddr.port",
1164 FT_UINT16
, BASE_DEC
, NULL
, 0x0,
1165 "Socket Address Port", HFILL
}},
1167 { &hf_dtpt_sockaddr_address
,
1168 { "Address", "dtpt.sockaddr.address",
1169 FT_IPv4
, BASE_NONE
, NULL
, 0x0,
1170 "Socket Address Address", HFILL
}},
1172 { &hf_dtpt_blob_rawsize
,
1173 { "Blob Size", "dtpt.blob_size",
1174 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1175 "Size of the binary BLOB", HFILL
}},
1177 { &hf_dtpt_blob_size
,
1178 { "cbSize", "dtpt.blob.cbSize",
1179 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1180 "cbSize field in BLOB", HFILL
}},
1182 { &hf_dtpt_blob_data_pointer
,
1183 { "pBlobData", "dtpt.blob.pBlobData",
1184 FT_UINT32
, BASE_HEX
, NULL
, 0x0,
1185 "pBlobData field in BLOB", HFILL
}},
1187 { &hf_dtpt_blob_data_length
,
1188 { "Length", "dtpt.blob.data_length",
1189 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1190 "Length of the Blob Data Block", HFILL
}},
1192 { &hf_dtpt_blob_data
,
1193 { "Data", "dtpt.blob.data",
1194 FT_BYTES
, BASE_NONE
, NULL
, 0x0,
1195 "Blob Data Block", HFILL
}},
1197 { &hf_dtpt_connect_addr
,
1198 { "Address", "dtpt.connect_addr",
1199 FT_UINT32
, BASE_DEC
, NULL
, 0x0,
1200 "Connect to Address", HFILL
}},
1202 static gint
*ett
[] = {
1208 &ett_dtpt_protocols
,
1217 module_t
*dtpt_module
;
1218 e_guid_t guid_svcid_inet_hostaddrbyname
= {0x0002A803, 0x0000, 0x0000, {0xC0,0,0,0,0,0,0,0x46}};
1219 e_guid_t guid_svcid_inet_hostaddrbyinetstring
= {0x0002A801, 0x0000, 0x0000, {0xC0,0,0,0,0,0,0,0x46}};
1220 guids_add_guid(&guid_svcid_inet_hostaddrbyname
, "SVCID_INET_HOSTADDRBYNAME");
1221 guids_add_guid(&guid_svcid_inet_hostaddrbyinetstring
, "SVCID_INET_HOSTADDRBYINETSTRING");
1223 proto_dtpt
= proto_register_protocol("DeskTop PassThrough Protocol",
1225 proto_register_field_array(proto_dtpt
, hf
, array_length(hf
));
1226 proto_register_subtree_array(ett
, array_length(ett
));
1228 /* Register a configuration option for port */
1229 dtpt_module
= prefs_register_protocol(proto_dtpt
,
1230 proto_reg_handoff_dtpt
);
1231 prefs_register_uint_preference(dtpt_module
, "tcp.port",
1232 "DTPT Server TCP Port",
1233 "Set the TDP port for the DTPT Server",
1234 10, &gbl_dtptServerPort
);
1239 proto_reg_handoff_dtpt(void)
1241 static dissector_handle_t dtpt_handle
;
1242 static gboolean Initialized
=FALSE
;
1243 static int ServerPort
;
1246 dtpt_handle
= new_create_dissector_handle(dissect_dtpt
, proto_dtpt
);
1247 dtpt_conversation_handle
= new_create_dissector_handle(dissect_dtpt_conversation
, proto_dtpt
);
1248 /** dtpt_data_handle = new_create_dissector_handle(dissect_dtpt_data, proto_dtpt); **/
1250 data_handle
= find_dissector("data");
1253 dissector_delete_uint("tcp.port", ServerPort
, dtpt_handle
);
1256 /* set port for future deletes */
1257 ServerPort
=gbl_dtptServerPort
;
1259 dissector_add_uint("tcp.port", gbl_dtptServerPort
, dtpt_handle
);