Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-nlm.c
blob7fe553396c440335ea31951a65fc4acc2d63dc4b
1 /* packet-nlm.c
2 * Routines for nlm dissection
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * Copied from packet-mount.c
10 * 2001-JAN Ronnie Sahlberg <See AUTHORS for email>
11 * Updates to version 1 of the protocol.
12 * Added version 3 of the protocol.
13 * Added version 4 of the protocol.
16 * SPDX-License-Identifier: GPL-2.0-or-later
20 #include "config.h"
22 #include "packet-nfs.h"
23 #include "packet-nlm.h"
24 #include <epan/prefs.h>
25 #include <epan/tfs.h>
26 #include <wsutil/array.h>
28 void proto_register_nlm(void);
29 void proto_reg_handoff_nlm(void);
32 * NFS Lock Manager protocol specs can only be found in actual
33 * implementations or in the nice book:
34 * Brent Callaghan: "NFS Illustrated", Addison-Wesley, ISBN 0-201-32570-5
35 * which I use here as reference (BC).
37 * They can also be found if you go to
39 * http://www.opengroup.org/publications/catalog/c702.htm
41 * and follow the links to the HTML version of the document.
44 static int proto_nlm;
45 static int hf_nlm_procedure_v1;
46 static int hf_nlm_procedure_v2;
47 static int hf_nlm_procedure_v3;
48 static int hf_nlm_procedure_v4;
49 static int hf_nlm_cookie;
50 static int hf_nlm_block;
51 static int hf_nlm_exclusive;
52 static int hf_nlm_lock;
53 static int hf_nlm_lock_caller_name;
54 static int hf_nlm_lock_owner;
55 static int hf_nlm_lock_svid;
56 static int hf_nlm_lock_l_offset;
57 static int hf_nlm_lock_l_offset64;
58 static int hf_nlm_lock_l_len;
59 static int hf_nlm_lock_l_len64;
60 static int hf_nlm_reclaim;
61 static int hf_nlm_stat;
62 static int hf_nlm_state;
63 static int hf_nlm_test_stat;
64 static int hf_nlm_test_stat_stat;
65 static int hf_nlm_holder;
66 static int hf_nlm_share;
67 static int hf_nlm_share_mode;
68 static int hf_nlm_share_access;
69 static int hf_nlm_share_name;
70 static int hf_nlm_sequence;
71 static int hf_nlm_request_in;
72 static int hf_nlm_reply_in;
73 static int hf_nlm_time;
75 static int ett_nlm;
76 static int ett_nlm_lock;
81 * stuff to match MSG and RES packets for async NLM
84 static bool nlm_match_msgres;
85 static wmem_map_t *nlm_msg_res_unmatched;
86 static wmem_map_t *nlm_msg_res_matched;
88 /* XXX when matching the packets we should really check the conversation (only address
89 NOT ports) and command type as well. I am lazy and thinks the cookie itself is
90 good enough for now
92 typedef struct _nlm_msg_res_unmatched_data {
93 int req_frame;
94 nstime_t ns;
95 int cookie_len;
96 const uint8_t *cookie;
97 } nlm_msg_res_unmatched_data;
99 typedef struct _nlm_msg_res_matched_data {
100 int req_frame;
101 int rep_frame;
102 nstime_t ns;
103 } nlm_msg_res_matched_data;
105 static unsigned
106 nlm_msg_res_unmatched_hash(const void *k)
108 const nlm_msg_res_unmatched_data *umd = (const nlm_msg_res_unmatched_data *)k;
109 uint8_t hash=0;
110 int i;
112 for(i=0;i<umd->cookie_len;i++){
113 hash^=umd->cookie[i];
116 return hash;
118 static unsigned
119 nlm_msg_res_matched_hash(const void *k)
121 unsigned hash = GPOINTER_TO_UINT(k);
123 return hash;
126 static int
127 nlm_msg_res_unmatched_equal(const void *k1, const void *k2)
129 const nlm_msg_res_unmatched_data *umd1 = (const nlm_msg_res_unmatched_data *)k1;
130 const nlm_msg_res_unmatched_data *umd2 = (const nlm_msg_res_unmatched_data *)k2;
132 if(umd1->cookie_len!=umd2->cookie_len){
133 return 0;
136 return (memcmp(umd1->cookie, umd2->cookie, umd1->cookie_len) == 0);
138 static int
139 nlm_msg_res_matched_equal(const void *k1, const void *k2)
141 unsigned mk1 = GPOINTER_TO_UINT(k1);
142 unsigned mk2 = GPOINTER_TO_UINT(k2);
144 return mk1==mk2;
147 static void
148 nlm_print_msgres_reply(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb)
150 nlm_msg_res_matched_data *md;
152 md=(nlm_msg_res_matched_data *)wmem_map_lookup(nlm_msg_res_matched, GINT_TO_POINTER(pinfo->num));
153 if(md){
154 nstime_t ns;
155 proto_tree_add_uint(tree, hf_nlm_request_in, tvb, 0, 0, md->req_frame);
156 nstime_delta(&ns, &pinfo->abs_ts, &md->ns);
157 proto_tree_add_time(tree, hf_nlm_time, tvb, 0, 0, &ns);
161 static void
162 nlm_print_msgres_request(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb)
164 nlm_msg_res_matched_data *md;
166 md=(nlm_msg_res_matched_data *)wmem_map_lookup(nlm_msg_res_matched, GINT_TO_POINTER(pinfo->num));
167 if(md){
168 proto_tree_add_uint(tree, hf_nlm_reply_in, tvb, 0, 0, md->rep_frame);
171 static void
172 nlm_match_fhandle_reply(packet_info *pinfo, proto_tree *tree)
174 nlm_msg_res_matched_data *md;
176 md=(nlm_msg_res_matched_data *)wmem_map_lookup(nlm_msg_res_matched, GINT_TO_POINTER(pinfo->num));
177 if(md && md->rep_frame){
178 dissect_fhandle_hidden(pinfo,
179 tree, md->req_frame);
182 static void
183 nlm_match_fhandle_request(packet_info *pinfo, proto_tree *tree)
185 nlm_msg_res_matched_data *md;
187 md=(nlm_msg_res_matched_data *)wmem_map_lookup(nlm_msg_res_matched, GINT_TO_POINTER(pinfo->num));
188 if(md && md->rep_frame){
189 dissect_fhandle_hidden(pinfo,
190 tree, md->rep_frame);
194 static void
195 nlm_register_unmatched_res(packet_info *pinfo, tvbuff_t *tvb, int offset)
197 nlm_msg_res_unmatched_data umd;
198 nlm_msg_res_unmatched_data *old_umd;
200 umd.cookie_len=tvb_get_ntohl(tvb, offset);
201 umd.cookie=tvb_get_ptr(tvb, offset+4, -1);
203 /* have we seen this cookie before? */
204 old_umd=(nlm_msg_res_unmatched_data *)wmem_map_lookup(nlm_msg_res_unmatched, (const void *)&umd);
205 if(old_umd){
206 nlm_msg_res_matched_data *md_req, *md_rep;
208 md_req = wmem_new(wmem_file_scope(), nlm_msg_res_matched_data);
209 md_req->req_frame = old_umd->req_frame;
210 md_req->rep_frame = pinfo->num;
211 md_req->ns = old_umd->ns;
212 md_rep = (nlm_msg_res_matched_data *)wmem_memdup(wmem_file_scope(), md_req, sizeof(nlm_msg_res_matched_data));
213 wmem_map_insert(nlm_msg_res_matched, GINT_TO_POINTER(md_req->req_frame), md_req);
214 wmem_map_insert(nlm_msg_res_matched, GINT_TO_POINTER(md_rep->rep_frame), md_rep);
216 wmem_map_remove(nlm_msg_res_unmatched, old_umd);
220 static void
221 nlm_register_unmatched_msg(packet_info *pinfo, tvbuff_t *tvb, int offset)
223 nlm_msg_res_unmatched_data *umd;
224 nlm_msg_res_unmatched_data *old_umd;
226 /* allocate and build the unmatched structure for this request */
227 umd = wmem_new(wmem_file_scope(), nlm_msg_res_unmatched_data);
228 umd->req_frame = pinfo->num;
229 umd->ns = pinfo->abs_ts;
230 umd->cookie_len = tvb_get_ntohl(tvb, offset);
231 umd->cookie = (const uint8_t *)tvb_memdup(wmem_file_scope(), tvb, offset+4, umd->cookie_len);
233 /* remove any old duplicates */
234 old_umd=(nlm_msg_res_unmatched_data *)wmem_map_lookup(nlm_msg_res_unmatched, umd);
235 if(old_umd){
236 wmem_map_remove(nlm_msg_res_unmatched, (const void *)old_umd);
239 /* add new one */
240 wmem_map_insert(nlm_msg_res_unmatched, umd, umd);
246 static const value_string names_nlm_stats[] =
248 /* NLM_GRANTED is the function number 5 and the state code 0.
249 * So we use for the state the postfix _S.
251 #define NLM_GRANTED_S 0
252 { NLM_GRANTED_S, "NLM_GRANTED" },
253 #define NLM_DENIED 1
254 { NLM_DENIED, "NLM_DENIED" },
255 #define NLM_DENIED_NOLOCKS 2
256 { NLM_DENIED_NOLOCKS, "NLM_DENIED_NOLOCKS" },
257 #define NLM_BLOCKED 3
258 { NLM_BLOCKED, "NLM_BLOCKED" },
259 #define NLM_DENIED_GRACE_PERIOD 4
260 { NLM_DENIED_GRACE_PERIOD, "NLM_DENIED_GRACE_PERIOD" },
261 #define NLM_DEADLCK 5
262 { NLM_DEADLCK, "NLM_DEADLCK" },
263 #define NLM_ROFS 6
264 { NLM_ROFS, "NLM_ROFS" },
265 #define NLM_STALE_FH 7
266 { NLM_STALE_FH, "NLM_STALE_FH" },
267 #define NLM_BIG 8
268 { NLM_BIG, "NLM_BIG" },
269 #define NLM_FAILED 9
270 { NLM_FAILED, "NLM_FAILED" },
271 { 0, NULL }
275 static const value_string names_fsh_mode[] =
277 #define FSM_DN 0
278 { FSM_DN, "deny none" },
279 #define FSM_DR 1
280 { FSM_DR, "deny read" },
281 #define FSM_DW 2
282 { FSM_DW, "deny write" },
283 #define FSM_DRW 3
284 { FSM_DRW, "deny read/write" },
286 { 0, NULL }
290 static const value_string names_fsh_access[] =
292 #define FSA_NONE 0
293 { FSA_NONE, "no access" },
294 #define FSA_R 1
295 { FSA_R, "read-only" },
296 #define FSA_W 2
297 { FSA_W, "write-only" },
298 #define FSA_RW 3
299 { FSA_RW, "read/write" },
300 { 0, NULL }
308 /* **************************** */
309 /* generic dissecting functions */
310 /* **************************** */
311 static int
312 dissect_lock(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int version, int offset, rpc_call_info_value* civ)
314 proto_item* lock_item = NULL;
315 proto_tree* lock_tree = NULL;
316 uint32_t fh_hash, svid;
317 uint64_t start_offset=0, end_offset=0;
319 if (tree) {
320 lock_item = proto_tree_add_item(tree, hf_nlm_lock, tvb,
321 offset, -1, ENC_NA);
322 if (lock_item)
323 lock_tree = proto_item_add_subtree(lock_item, ett_nlm_lock);
326 offset = dissect_rpc_string(tvb,lock_tree,
327 hf_nlm_lock_caller_name, offset, NULL);
328 offset = dissect_nfs3_fh(tvb, offset, pinfo, lock_tree, "fh", &fh_hash, civ);
329 col_append_fstr(pinfo->cinfo, COL_INFO, " FH:0x%08x", fh_hash);
331 offset = dissect_rpc_data(tvb, lock_tree, hf_nlm_lock_owner, offset);
333 svid = tvb_get_ntohl(tvb, offset);
334 offset = dissect_rpc_uint32(tvb, lock_tree, hf_nlm_lock_svid, offset);
335 col_append_fstr(pinfo->cinfo, COL_INFO, " svid:%d", svid);
337 if (version == 4) {
338 start_offset = tvb_get_ntoh64(tvb, offset);
339 offset = dissect_rpc_uint64(tvb, lock_tree, hf_nlm_lock_l_offset64, offset);
340 end_offset = tvb_get_ntoh64(tvb, offset);
341 offset = dissect_rpc_uint64(tvb, lock_tree, hf_nlm_lock_l_len64, offset);
343 else {
344 start_offset = tvb_get_ntohl(tvb, offset);
345 offset = dissect_rpc_uint32(tvb, lock_tree, hf_nlm_lock_l_offset, offset);
346 end_offset = tvb_get_ntohl(tvb, offset);
347 offset = dissect_rpc_uint32(tvb, lock_tree, hf_nlm_lock_l_len, offset);
350 col_append_fstr(pinfo->cinfo, COL_INFO, " pos:%" PRIu64 "-%" PRIu64, start_offset, end_offset);
352 return offset;
356 static int
357 dissect_nlm_test(tvbuff_t *tvb, int offset, packet_info *pinfo,
358 proto_tree *tree, int version, rpc_call_info_value* rpc_call)
360 if(nlm_match_msgres){
361 if(rpc_call->proc==6){ /* NLM_TEST_MSG */
362 if( (!pinfo->fd->visited) ){
363 nlm_register_unmatched_msg(pinfo, tvb, offset);
364 } else {
365 nlm_print_msgres_request(pinfo, tree, tvb);
367 /* for the fhandle matching that finds both request and
368 response packet */
369 if(nfs_fhandle_reqrep_matching){
370 nlm_match_fhandle_request(pinfo, tree);
375 offset = dissect_rpc_data(tvb, tree, hf_nlm_cookie, offset);
376 dissect_rpc_bool(tvb, tree, hf_nlm_exclusive, offset);
377 offset += 4;
378 offset = dissect_lock(tvb, pinfo, tree, version, offset, rpc_call);
379 return offset;
382 static int
383 dissect_nlm_lock(tvbuff_t *tvb, int offset, packet_info *pinfo,
384 proto_tree *tree,int version, rpc_call_info_value* rpc_call)
386 if(nlm_match_msgres){
387 if(rpc_call->proc==7){ /* NLM_LOCK_MSG */
388 if( (!pinfo->fd->visited) ){
389 nlm_register_unmatched_msg(pinfo, tvb, offset);
390 } else {
391 nlm_print_msgres_request(pinfo, tree, tvb);
393 /* for the fhandle matching that finds both request and
394 response packet */
395 if(nfs_fhandle_reqrep_matching){
396 nlm_match_fhandle_request(pinfo, tree);
401 offset = dissect_rpc_data(tvb, tree, hf_nlm_cookie, offset);
402 offset = dissect_rpc_bool(tvb, tree, hf_nlm_block, offset);
403 offset = dissect_rpc_bool(tvb, tree, hf_nlm_exclusive, offset);
404 offset = dissect_lock(tvb, pinfo, tree, version, offset, rpc_call);
405 offset = dissect_rpc_bool(tvb, tree, hf_nlm_reclaim, offset);
406 offset = dissect_rpc_uint32(tvb, tree, hf_nlm_state, offset);
407 return offset;
410 static int
411 dissect_nlm_cancel(tvbuff_t *tvb, int offset, packet_info *pinfo,
412 proto_tree *tree,int version, rpc_call_info_value* rpc_call)
414 if(nlm_match_msgres){
415 if(rpc_call->proc==8){ /* NLM_CANCEL_MSG */
416 if( (!pinfo->fd->visited) ){
417 nlm_register_unmatched_msg(pinfo, tvb, offset);
418 } else {
419 nlm_print_msgres_request(pinfo, tree, tvb);
421 /* for the fhandle matching that finds both request and
422 response packet */
423 if(nfs_fhandle_reqrep_matching){
424 nlm_match_fhandle_request(pinfo, tree);
429 offset = dissect_rpc_data(tvb, tree, hf_nlm_cookie, offset);
430 offset = dissect_rpc_bool(tvb, tree, hf_nlm_block, offset);
431 offset = dissect_rpc_bool(tvb, tree, hf_nlm_exclusive, offset);
432 offset = dissect_lock(tvb, pinfo, tree, version, offset, rpc_call);
433 return offset;
436 static int
437 dissect_nlm_unlock(tvbuff_t *tvb, int offset, packet_info *pinfo,
438 proto_tree *tree,int version, rpc_call_info_value* rpc_call)
440 if(nlm_match_msgres){
441 if(rpc_call->proc==9){ /* NLM_UNLOCK_MSG */
442 if( (!pinfo->fd->visited) ){
443 nlm_register_unmatched_msg(pinfo, tvb, offset);
444 } else {
445 nlm_print_msgres_request(pinfo, tree, tvb);
447 /* for the fhandle matching that finds both request and
448 response packet */
449 if(nfs_fhandle_reqrep_matching){
450 nlm_match_fhandle_request(pinfo, tree);
455 offset = dissect_rpc_data(tvb, tree, hf_nlm_cookie, offset);
456 offset = dissect_lock(tvb, pinfo, tree, version, offset, rpc_call);
457 return offset;
460 static int
461 dissect_nlm_granted(tvbuff_t *tvb, int offset, packet_info *pinfo,
462 proto_tree *tree,int version, rpc_call_info_value* rpc_call)
464 if(nlm_match_msgres){
465 if(rpc_call->proc==10){ /* NLM_GRANTED_MSG */
466 if( (!pinfo->fd->visited) ){
467 nlm_register_unmatched_msg(pinfo, tvb, offset);
468 } else {
469 nlm_print_msgres_request(pinfo, tree, tvb);
471 /* for the fhandle matching that finds both request and
472 response packet */
473 if(nfs_fhandle_reqrep_matching){
474 nlm_match_fhandle_request(pinfo, tree);
479 offset = dissect_rpc_data(tvb, tree, hf_nlm_cookie, offset);
480 offset = dissect_rpc_bool(tvb, tree, hf_nlm_exclusive, offset);
481 offset = dissect_lock(tvb, pinfo, tree, version, offset, rpc_call);
482 return offset;
486 static int
487 dissect_nlm_test_res(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
488 proto_tree *tree, int version, rpc_call_info_value *rpc_call)
490 proto_item* lock_item = NULL;
491 proto_tree* lock_tree = NULL;
493 if(nlm_match_msgres){
494 if(rpc_call->proc==11){ /* NLM_TEST_RES */
495 if( (!pinfo->fd->visited) ){
496 nlm_register_unmatched_res(pinfo, tvb, offset);
497 } else {
498 nlm_print_msgres_reply(pinfo, tree, tvb);
500 /* for the fhandle matching that finds both request and
501 response packet */
502 if(nfs_fhandle_reqrep_matching){
503 nlm_match_fhandle_reply(pinfo, tree);
508 offset = dissect_rpc_data(tvb, tree, hf_nlm_cookie, offset);
510 if (tree) {
511 lock_item = proto_tree_add_item(tree, hf_nlm_test_stat, tvb,
512 offset, -1, ENC_NA);
513 lock_tree = proto_item_add_subtree(lock_item, ett_nlm_lock);
516 offset = dissect_rpc_uint32(tvb, lock_tree, hf_nlm_test_stat_stat,
517 offset);
519 /* last structure is optional, only supplied for stat==1 (LOCKED) */
520 if(tvb_reported_length_remaining(tvb, offset) == 0){
521 return offset;
524 if (tree) {
525 lock_item = proto_tree_add_item(lock_tree, hf_nlm_holder, tvb,
526 offset, -1, ENC_NA);
527 if (lock_item)
528 lock_tree = proto_item_add_subtree(lock_item,
529 ett_nlm_lock);
532 offset = dissect_rpc_bool(tvb, lock_tree, hf_nlm_exclusive,
533 offset);
534 offset = dissect_rpc_uint32(tvb, lock_tree, hf_nlm_lock_svid,
535 offset);
536 offset = dissect_rpc_data(tvb, lock_tree, hf_nlm_lock_owner,
537 offset);
539 if (version == 4) {
540 offset = dissect_rpc_uint64(tvb, lock_tree,
541 hf_nlm_lock_l_offset64, offset);
542 offset = dissect_rpc_uint64(tvb, lock_tree,
543 hf_nlm_lock_l_len64, offset);
545 else {
546 offset = dissect_rpc_uint32(tvb, lock_tree,
547 hf_nlm_lock_l_offset, offset);
548 offset = dissect_rpc_uint32(tvb, lock_tree,
549 hf_nlm_lock_l_len, offset);
552 return offset;
556 static int
557 dissect_nlm_share(tvbuff_t *tvb, int offset, packet_info *pinfo,
558 proto_tree *tree,int version _U_, rpc_call_info_value* civ)
560 proto_item* lock_item = NULL;
561 proto_tree* lock_tree = NULL;
562 uint32_t fh_hash;
564 offset = dissect_rpc_data(tvb, tree, hf_nlm_cookie, offset);
566 if (tree) {
567 lock_item = proto_tree_add_item(tree, hf_nlm_share, tvb,
568 offset, -1, ENC_NA);
569 if (lock_item)
570 lock_tree = proto_item_add_subtree(lock_item,
571 ett_nlm_lock);
574 offset = dissect_rpc_string(tvb,lock_tree,
575 hf_nlm_lock_caller_name, offset, NULL);
577 offset = dissect_nfs3_fh(tvb, offset, pinfo, lock_tree, "fh", &fh_hash, civ);
578 col_append_fstr(pinfo->cinfo, COL_INFO, " FH:0x%08x", fh_hash);
580 offset = dissect_rpc_data(tvb, lock_tree, hf_nlm_lock_owner, offset);
582 offset = dissect_rpc_uint32(tvb, lock_tree, hf_nlm_share_mode, offset);
583 offset = dissect_rpc_uint32(tvb, lock_tree, hf_nlm_share_access, offset);
586 offset = dissect_rpc_bool(tvb, tree, hf_nlm_reclaim, offset);
587 return offset;
590 static int
591 dissect_nlm_shareres(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
592 proto_tree *tree, int version _U_)
594 uint32_t nlm_stat;
596 offset = dissect_rpc_data(tvb, tree, hf_nlm_cookie, offset);
597 nlm_stat = tvb_get_ntohl(tvb, offset);
598 if (nlm_stat) {
599 col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
600 val_to_str(nlm_stat, names_nlm_stats, "Unknown Status (%u)"));
602 offset = dissect_rpc_uint32(tvb, tree, hf_nlm_stat, offset);
603 offset = dissect_rpc_uint32(tvb, tree, hf_nlm_sequence, offset);
604 return offset;
607 static int
608 dissect_nlm_freeall(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
609 proto_tree *tree,int version _U_)
611 offset = dissect_rpc_string(tvb,tree,
612 hf_nlm_share_name, offset, NULL);
614 offset = dissect_rpc_uint32(tvb, tree, hf_nlm_state, offset);
616 return offset;
620 /* RPC functions */
623 /* This function is identical for all NLM protocol versions (1-4)*/
624 static int
625 dissect_nlm_gen_reply(tvbuff_t *tvb, packet_info *pinfo _U_,
626 proto_tree *tree, void* data)
628 uint32_t nlm_stat;
629 int offset = 0;
631 if(nlm_match_msgres){
632 rpc_call_info_value *rpc_call=(rpc_call_info_value *)data;
633 if((rpc_call->proc==12) /* NLM_LOCK_RES */
634 || (rpc_call->proc==13) /* NLM_CANCEL_RES */
635 || (rpc_call->proc==14) /* NLM_UNLOCK_RES */
636 || (rpc_call->proc==15) ){ /* NLM_GRENTED_RES */
637 if( (!pinfo->fd->visited) ){
638 nlm_register_unmatched_res(pinfo, tvb, offset);
639 } else {
640 nlm_print_msgres_reply(pinfo, tree, tvb);
642 /* for the fhandle matching that finds both request and
643 response packet */
644 if(nfs_fhandle_reqrep_matching){
645 nlm_match_fhandle_reply(pinfo, tree);
650 offset = dissect_rpc_data(tvb, tree, hf_nlm_cookie, offset);
652 nlm_stat = tvb_get_ntohl(tvb, offset);
653 if (nlm_stat) {
654 col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
655 val_to_str(nlm_stat, names_nlm_stats, "Unknown Status (%u)"));
657 offset = dissect_rpc_uint32(tvb, tree, hf_nlm_stat, offset);
658 return offset;
661 static int
662 dissect_nlm1_test(tvbuff_t *tvb, packet_info *pinfo,
663 proto_tree *tree, void* data)
665 return dissect_nlm_test(tvb,0,pinfo,tree,1,(rpc_call_info_value*)data);
668 static int
669 dissect_nlm4_test(tvbuff_t *tvb, packet_info *pinfo,
670 proto_tree *tree, void* data)
672 return dissect_nlm_test(tvb,0,pinfo,tree,4,(rpc_call_info_value*)data);
676 static int
677 dissect_nlm1_lock(tvbuff_t *tvb, packet_info *pinfo,
678 proto_tree *tree, void* data)
680 return dissect_nlm_lock(tvb,0,pinfo,tree,1,(rpc_call_info_value*)data);
683 static int
684 dissect_nlm4_lock(tvbuff_t *tvb, packet_info *pinfo,
685 proto_tree *tree, void* data)
687 return dissect_nlm_lock(tvb,0,pinfo,tree,4,(rpc_call_info_value*)data);
691 static int
692 dissect_nlm1_cancel(tvbuff_t *tvb, packet_info *pinfo,
693 proto_tree *tree, void* data)
695 return dissect_nlm_cancel(tvb,0,pinfo,tree,1,(rpc_call_info_value*)data);
698 static int
699 dissect_nlm4_cancel(tvbuff_t *tvb, packet_info *pinfo,
700 proto_tree *tree, void* data)
702 return dissect_nlm_cancel(tvb,0,pinfo,tree,4,(rpc_call_info_value*)data);
706 static int
707 dissect_nlm1_unlock(tvbuff_t *tvb, packet_info *pinfo,
708 proto_tree *tree, void* data)
710 return dissect_nlm_unlock(tvb,0,pinfo,tree,1,(rpc_call_info_value*)data);
713 static int
714 dissect_nlm4_unlock(tvbuff_t *tvb, packet_info *pinfo,
715 proto_tree *tree, void* data)
717 return dissect_nlm_unlock(tvb,0,pinfo,tree,4,(rpc_call_info_value*)data);
721 static int
722 dissect_nlm1_granted(tvbuff_t *tvb, packet_info *pinfo,
723 proto_tree *tree, void* data)
725 return dissect_nlm_granted(tvb,0,pinfo,tree,1,(rpc_call_info_value*)data);
728 static int
729 dissect_nlm4_granted(tvbuff_t *tvb, packet_info *pinfo,
730 proto_tree *tree, void* data)
732 return dissect_nlm_granted(tvb,0,pinfo,tree,4,(rpc_call_info_value*)data);
736 static int
737 dissect_nlm1_test_res(tvbuff_t *tvb, packet_info *pinfo,
738 proto_tree *tree, void* data)
740 return dissect_nlm_test_res(tvb,0,pinfo,tree,1,(rpc_call_info_value*)data);
743 static int
744 dissect_nlm4_test_res(tvbuff_t *tvb, packet_info *pinfo,
745 proto_tree *tree, void* data)
747 return dissect_nlm_test_res(tvb,0,pinfo,tree,4,(rpc_call_info_value*)data);
750 static int
751 dissect_nlm3_share(tvbuff_t *tvb, packet_info *pinfo,
752 proto_tree *tree, void* data _U_)
754 return dissect_nlm_share(tvb,0,pinfo,tree,3,(rpc_call_info_value*)data);
757 static int
758 dissect_nlm4_share(tvbuff_t *tvb, packet_info *pinfo,
759 proto_tree *tree, void* data _U_)
761 return dissect_nlm_share(tvb,0,pinfo,tree,4,(rpc_call_info_value*)data);
764 static int
765 dissect_nlm3_shareres(tvbuff_t *tvb, packet_info *pinfo,
766 proto_tree *tree, void* data _U_)
768 return dissect_nlm_shareres(tvb,0,pinfo,tree,3);
771 static int
772 dissect_nlm4_shareres(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
774 return dissect_nlm_shareres(tvb,0,pinfo,tree,4);
777 static int
778 dissect_nlm3_freeall(tvbuff_t *tvb, packet_info *pinfo,
779 proto_tree *tree, void* data _U_)
781 return dissect_nlm_freeall(tvb,0,pinfo,tree,3);
784 static int
785 dissect_nlm4_freeall(tvbuff_t *tvb, packet_info *pinfo,
786 proto_tree *tree, void* data _U_)
788 return dissect_nlm_freeall(tvb,0,pinfo,tree,4);
794 /* proc number, "proc name", dissect_request, dissect_reply */
795 /* NLM protocol version 1 */
796 static const vsff nlm1_proc[] = {
797 { NLM_NULL, "NULL",
798 dissect_rpc_void, dissect_rpc_void },
799 { NLM_TEST, "TEST",
800 dissect_nlm1_test, dissect_nlm1_test_res },
801 { NLM_LOCK, "LOCK",
802 dissect_nlm1_lock, dissect_nlm_gen_reply },
803 { NLM_CANCEL, "CANCEL",
804 dissect_nlm1_cancel, dissect_nlm_gen_reply },
805 { NLM_UNLOCK, "UNLOCK",
806 dissect_nlm1_unlock, dissect_nlm_gen_reply },
807 { NLM_GRANTED, "GRANTED",
808 dissect_nlm1_granted, dissect_nlm_gen_reply },
809 { NLM_TEST_MSG, "TEST_MSG",
810 dissect_nlm1_test, dissect_rpc_void },
811 { NLM_LOCK_MSG, "LOCK_MSG",
812 dissect_nlm1_lock, dissect_rpc_void },
813 { NLM_CANCEL_MSG, "CANCEL_MSG",
814 dissect_nlm1_cancel, dissect_rpc_void },
815 { NLM_UNLOCK_MSG, "UNLOCK_MSG",
816 dissect_nlm1_unlock, dissect_rpc_void },
817 { NLM_GRANTED_MSG, "GRANTED_MSG",
818 dissect_nlm1_granted, dissect_rpc_void },
819 { NLM_TEST_RES, "TEST_RES",
820 dissect_nlm1_test_res, dissect_rpc_void },
821 { NLM_LOCK_RES, "LOCK_RES",
822 dissect_nlm_gen_reply, dissect_rpc_void },
823 { NLM_CANCEL_RES, "CANCEL_RES",
824 dissect_nlm_gen_reply, dissect_rpc_void },
825 { NLM_UNLOCK_RES, "UNLOCK_RES",
826 dissect_nlm_gen_reply, dissect_rpc_void },
827 { NLM_GRANTED_RES, "GRANTED_RES",
828 dissect_nlm_gen_reply, dissect_rpc_void },
829 { 0, NULL,
830 NULL, NULL }
832 static const value_string nlm1_proc_vals[] = {
833 { NLM_NULL, "NULL" },
834 { NLM_TEST, "TEST" },
835 { NLM_LOCK, "LOCK" },
836 { NLM_CANCEL, "CANCEL" },
837 { NLM_UNLOCK, "UNLOCK" },
838 { NLM_GRANTED, "GRANTED" },
839 { NLM_TEST_MSG, "TEST_MSG" },
840 { NLM_LOCK_MSG, "LOCK_MSG" },
841 { NLM_CANCEL_MSG, "CANCEL_MSG" },
842 { NLM_UNLOCK_MSG, "UNLOCK_MSG" },
843 { NLM_GRANTED_MSG, "GRANTED_MSG" },
844 { NLM_TEST_RES, "TEST_RES" },
845 { NLM_LOCK_RES, "LOCK_RES" },
846 { NLM_CANCEL_RES, "CANCEL_RES" },
847 { NLM_UNLOCK_RES, "UNLOCK_RES" },
848 { NLM_GRANTED_RES, "GRANTED_RES" },
849 { 0, NULL }
851 /* end of NLM protocol version 1 */
853 /* NLM protocol version 2 */
854 static const vsff nlm2_proc[] = {
855 { NLM_NULL, "NULL",
856 dissect_rpc_void, dissect_rpc_void },
857 { NLM_TEST, "TEST",
858 dissect_nlm1_test, dissect_nlm1_test_res },
859 { NLM_LOCK, "LOCK",
860 dissect_nlm1_lock, dissect_nlm_gen_reply },
861 { NLM_CANCEL, "CANCEL",
862 dissect_nlm1_cancel, dissect_nlm_gen_reply },
863 { NLM_UNLOCK, "UNLOCK",
864 dissect_nlm1_unlock, dissect_nlm_gen_reply },
865 { NLM_GRANTED, "GRANTED",
866 dissect_nlm1_granted, dissect_nlm_gen_reply },
867 { NLM_TEST_MSG, "TEST_MSG",
868 dissect_nlm1_test, dissect_rpc_void },
869 { NLM_LOCK_MSG, "LOCK_MSG",
870 dissect_nlm1_lock, dissect_rpc_void },
871 { NLM_CANCEL_MSG, "CANCEL_MSG",
872 dissect_nlm1_cancel, dissect_rpc_void },
873 { NLM_UNLOCK_MSG, "UNLOCK_MSG",
874 dissect_nlm1_unlock, dissect_rpc_void },
875 { NLM_GRANTED_MSG, "GRANTED_MSG",
876 dissect_nlm1_granted, dissect_rpc_void },
877 { NLM_TEST_RES, "TEST_RES",
878 dissect_nlm1_test_res, dissect_rpc_void },
879 { NLM_LOCK_RES, "LOCK_RES",
880 dissect_nlm_gen_reply, dissect_rpc_void },
881 { NLM_CANCEL_RES, "CANCEL_RES",
882 dissect_nlm_gen_reply, dissect_rpc_void },
883 { NLM_UNLOCK_RES, "UNLOCK_RES",
884 dissect_nlm_gen_reply, dissect_rpc_void },
885 { NLM_GRANTED_RES, "GRANTED_RES",
886 dissect_nlm_gen_reply, dissect_rpc_void },
887 { 0, NULL,
888 NULL, NULL }
890 static const value_string nlm2_proc_vals[] = {
891 { NLM_NULL, "NULL" },
892 { NLM_TEST, "TEST" },
893 { NLM_LOCK, "LOCK" },
894 { NLM_CANCEL, "CANCEL" },
895 { NLM_UNLOCK, "UNLOCK" },
896 { NLM_GRANTED, "GRANTED" },
897 { NLM_TEST_MSG, "TEST_MSG" },
898 { NLM_LOCK_MSG, "LOCK_MSG" },
899 { NLM_CANCEL_MSG, "CANCEL_MSG" },
900 { NLM_UNLOCK_MSG, "UNLOCK_MSG" },
901 { NLM_GRANTED_MSG, "GRANTED_MSG" },
902 { NLM_TEST_RES, "TEST_RES" },
903 { NLM_LOCK_RES, "LOCK_RES" },
904 { NLM_CANCEL_RES, "CANCEL_RES" },
905 { NLM_UNLOCK_RES, "UNLOCK_RES" },
906 { NLM_GRANTED_RES, "GRANTED_RES" },
907 { 0, NULL }
909 /* end of NLM protocol version 2 */
911 /* NLM protocol version 3 */
912 static const vsff nlm3_proc[] = {
913 { NLM_NULL, "NULL",
914 dissect_rpc_void, dissect_rpc_void },
915 { NLM_TEST, "TEST",
916 dissect_nlm1_test, dissect_nlm1_test_res },
917 { NLM_LOCK, "LOCK",
918 dissect_nlm1_lock, dissect_nlm_gen_reply },
919 { NLM_CANCEL, "CANCEL",
920 dissect_nlm1_cancel, dissect_nlm_gen_reply },
921 { NLM_UNLOCK, "UNLOCK",
922 dissect_nlm1_unlock, dissect_nlm_gen_reply },
923 { NLM_GRANTED, "GRANTED",
924 dissect_nlm1_granted, dissect_nlm_gen_reply },
925 { NLM_TEST_MSG, "TEST_MSG",
926 dissect_nlm1_test, dissect_rpc_void },
927 { NLM_LOCK_MSG, "LOCK_MSG",
928 dissect_nlm1_lock, dissect_rpc_void },
929 { NLM_CANCEL_MSG, "CANCEL_MSG",
930 dissect_nlm1_cancel, dissect_rpc_void },
931 { NLM_UNLOCK_MSG, "UNLOCK_MSG",
932 dissect_nlm1_unlock, dissect_rpc_void },
933 { NLM_GRANTED_MSG, "GRANTED_MSG",
934 dissect_nlm1_granted, dissect_rpc_void },
935 { NLM_TEST_RES, "TEST_RES",
936 dissect_nlm1_test_res, dissect_rpc_void },
937 { NLM_LOCK_RES, "LOCK_RES",
938 dissect_nlm_gen_reply, dissect_rpc_void },
939 { NLM_CANCEL_RES, "CANCEL_RES",
940 dissect_nlm_gen_reply, dissect_rpc_void },
941 { NLM_UNLOCK_RES, "UNLOCK_RES",
942 dissect_nlm_gen_reply, dissect_rpc_void },
943 { NLM_GRANTED_RES, "GRANTED_RES",
944 dissect_nlm_gen_reply, dissect_rpc_void },
945 { NLM_SHARE, "SHARE",
946 dissect_nlm3_share, dissect_nlm3_shareres },
947 { NLM_UNSHARE, "UNSHARE",
948 dissect_nlm3_share, dissect_nlm3_shareres },
949 { NLM_NM_LOCK, "NM_LOCK",
950 dissect_nlm1_lock, dissect_nlm_gen_reply },
951 { NLM_FREE_ALL, "FREE_ALL",
952 dissect_nlm3_freeall, dissect_rpc_void },
953 { 0, NULL,
954 NULL, NULL }
956 static const value_string nlm3_proc_vals[] = {
957 { NLM_NULL, "NULL" },
958 { NLM_TEST, "TEST" },
959 { NLM_LOCK, "LOCK" },
960 { NLM_CANCEL, "CANCEL" },
961 { NLM_UNLOCK, "UNLOCK" },
962 { NLM_GRANTED, "GRANTED" },
963 { NLM_TEST_MSG, "TEST_MSG" },
964 { NLM_LOCK_MSG, "LOCK_MSG" },
965 { NLM_CANCEL_MSG, "CANCEL_MSG" },
966 { NLM_UNLOCK_MSG, "UNLOCK_MSG" },
967 { NLM_GRANTED_MSG, "GRANTED_MSG" },
968 { NLM_TEST_RES, "TEST_RES" },
969 { NLM_LOCK_RES, "LOCK_RES" },
970 { NLM_CANCEL_RES, "CANCEL_RES" },
971 { NLM_UNLOCK_RES, "UNLOCK_RES" },
972 { NLM_GRANTED_RES, "GRANTED_RES" },
973 { NLM_SHARE, "SHARE" },
974 { NLM_UNSHARE, "UNSHARE" },
975 { NLM_NM_LOCK, "NM_LOCK" },
976 { NLM_FREE_ALL, "FREE_ALL" },
977 { 0, NULL }
979 /* end of NLM protocol version 3 */
982 /* NLM protocol version 4 */
983 static const vsff nlm4_proc[] = {
984 { NLM_NULL, "NULL",
985 dissect_rpc_void, dissect_rpc_void },
986 { NLM_TEST, "TEST",
987 dissect_nlm4_test, dissect_nlm4_test_res },
988 { NLM_LOCK, "LOCK",
989 dissect_nlm4_lock, dissect_nlm_gen_reply },
990 { NLM_CANCEL, "CANCEL",
991 dissect_nlm4_cancel, dissect_nlm_gen_reply },
992 { NLM_UNLOCK, "UNLOCK",
993 dissect_nlm4_unlock, dissect_nlm_gen_reply },
994 { NLM_GRANTED, "GRANTED",
995 dissect_nlm4_granted, dissect_nlm_gen_reply },
996 { NLM_TEST_MSG, "TEST_MSG",
997 dissect_nlm4_test, dissect_rpc_void },
998 { NLM_LOCK_MSG, "LOCK_MSG",
999 dissect_nlm4_lock, dissect_rpc_void },
1000 { NLM_CANCEL_MSG, "CANCEL_MSG",
1001 dissect_nlm4_cancel, dissect_rpc_void },
1002 { NLM_UNLOCK_MSG, "UNLOCK_MSG",
1003 dissect_nlm4_unlock, dissect_rpc_void },
1004 { NLM_GRANTED_MSG, "GRANTED_MSG",
1005 dissect_nlm4_granted, dissect_rpc_void },
1006 { NLM_TEST_RES, "TEST_RES",
1007 dissect_nlm4_test_res, dissect_rpc_void },
1008 { NLM_LOCK_RES, "LOCK_RES",
1009 dissect_nlm_gen_reply, dissect_rpc_void },
1010 { NLM_CANCEL_RES, "CANCEL_RES",
1011 dissect_nlm_gen_reply, dissect_rpc_void },
1012 { NLM_UNLOCK_RES, "UNLOCK_RES",
1013 dissect_nlm_gen_reply, dissect_rpc_void },
1014 { NLM_GRANTED_RES, "GRANTED_RES",
1015 dissect_nlm_gen_reply, dissect_rpc_void },
1016 { NLM_SHARE, "SHARE",
1017 dissect_nlm4_share, dissect_nlm4_shareres },
1018 { NLM_UNSHARE, "UNSHARE",
1019 dissect_nlm4_share, dissect_nlm4_shareres },
1020 { NLM_NM_LOCK, "NM_LOCK",
1021 dissect_nlm4_lock, dissect_nlm_gen_reply },
1022 { NLM_FREE_ALL, "FREE_ALL",
1023 dissect_nlm4_freeall, dissect_rpc_void },
1024 { 0, NULL,
1025 NULL, NULL }
1027 static const value_string nlm4_proc_vals[] = {
1028 { NLM_NULL, "NULL" },
1029 { NLM_TEST, "TEST" },
1030 { NLM_LOCK, "LOCK" },
1031 { NLM_CANCEL, "CANCEL" },
1032 { NLM_UNLOCK, "UNLOCK" },
1033 { NLM_GRANTED, "GRANTED" },
1034 { NLM_TEST_MSG, "TEST_MSG" },
1035 { NLM_LOCK_MSG, "LOCK_MSG" },
1036 { NLM_CANCEL_MSG, "CANCEL_MSG" },
1037 { NLM_UNLOCK_MSG, "UNLOCK_MSG" },
1038 { NLM_GRANTED_MSG, "GRANTED_MSG" },
1039 { NLM_TEST_RES, "TEST_RES" },
1040 { NLM_LOCK_RES, "LOCK_RES" },
1041 { NLM_CANCEL_RES, "CANCEL_RES" },
1042 { NLM_UNLOCK_RES, "UNLOCK_RES" },
1043 { NLM_GRANTED_RES, "GRANTED_RES" },
1044 { NLM_SHARE, "SHARE" },
1045 { NLM_UNSHARE, "UNSHARE" },
1046 { NLM_NM_LOCK, "NM_LOCK" },
1047 { NLM_FREE_ALL, "FREE_ALL" },
1048 { 0, NULL }
1050 /* end of NLM protocol version 4 */
1052 static const rpc_prog_vers_info nlm_vers_info[] = {
1053 { 1, nlm1_proc, &hf_nlm_procedure_v1 },
1054 { 2, nlm2_proc, &hf_nlm_procedure_v2 },
1055 { 3, nlm3_proc, &hf_nlm_procedure_v3 },
1056 { 4, nlm4_proc, &hf_nlm_procedure_v4 },
1059 void
1060 proto_register_nlm(void)
1062 static hf_register_info hf[] = {
1063 { &hf_nlm_procedure_v1, {
1064 "V1 Procedure", "nlm.procedure_v1", FT_UINT32, BASE_DEC,
1065 VALS(nlm1_proc_vals), 0, NULL, HFILL }},
1066 { &hf_nlm_procedure_v2, {
1067 "V2 Procedure", "nlm.procedure_v2", FT_UINT32, BASE_DEC,
1068 VALS(nlm2_proc_vals), 0, NULL, HFILL }},
1069 { &hf_nlm_procedure_v3, {
1070 "V3 Procedure", "nlm.procedure_v3", FT_UINT32, BASE_DEC,
1071 VALS(nlm3_proc_vals), 0, NULL, HFILL }},
1072 { &hf_nlm_procedure_v4, {
1073 "V4 Procedure", "nlm.procedure_v4", FT_UINT32, BASE_DEC,
1074 VALS(nlm4_proc_vals), 0, NULL, HFILL }},
1075 { &hf_nlm_cookie, {
1076 "cookie", "nlm.cookie", FT_BYTES, BASE_NONE,
1077 NULL, 0, NULL, HFILL }},
1078 { &hf_nlm_block, {
1079 "block", "nlm.block", FT_BOOLEAN, BASE_NONE,
1080 TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
1081 { &hf_nlm_exclusive, {
1082 "exclusive", "nlm.exclusive", FT_BOOLEAN, BASE_NONE,
1083 TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
1084 { &hf_nlm_lock, {
1085 "lock", "nlm.lock", FT_NONE, BASE_NONE,
1086 NULL, 0, NULL, HFILL }},
1087 { &hf_nlm_lock_caller_name, {
1088 "caller_name", "nlm.lock.caller_name", FT_STRING, BASE_NONE,
1089 NULL, 0, NULL, HFILL }},
1090 { &hf_nlm_lock_owner, {
1091 "owner", "nlm.lock.owner", FT_BYTES, BASE_NONE,
1092 NULL, 0, NULL, HFILL }},
1093 { &hf_nlm_lock_svid, {
1094 "svid", "nlm.lock.svid", FT_UINT32, BASE_DEC,
1095 NULL, 0, NULL, HFILL }},
1096 { &hf_nlm_lock_l_offset64, {
1097 "l_offset", "nlm.lock.l_offset64", FT_UINT64, BASE_DEC,
1098 NULL, 0, NULL, HFILL }},
1099 { &hf_nlm_lock_l_offset, {
1100 "l_offset", "nlm.lock.l_offset", FT_UINT32, BASE_DEC,
1101 NULL, 0, NULL, HFILL }},
1102 { &hf_nlm_lock_l_len64, {
1103 "l_len", "nlm.lock.l_len64", FT_UINT64, BASE_DEC,
1104 NULL, 0, NULL, HFILL }},
1105 { &hf_nlm_lock_l_len, {
1106 "l_len", "nlm.lock.l_len", FT_UINT32, BASE_DEC,
1107 NULL, 0, NULL, HFILL }},
1108 { &hf_nlm_reclaim, {
1109 "reclaim", "nlm.reclaim", FT_BOOLEAN, BASE_NONE,
1110 TFS(&tfs_yes_no), 0x0, NULL, HFILL }},
1111 { &hf_nlm_state, {
1112 "state", "nlm.state", FT_UINT32, BASE_DEC,
1113 NULL, 0, "STATD state", HFILL }},
1114 { &hf_nlm_stat, {
1115 "stat", "nlm.stat", FT_UINT32, BASE_DEC,
1116 VALS(names_nlm_stats), 0, NULL, HFILL }},
1117 { &hf_nlm_test_stat, {
1118 "test_stat", "nlm.test_stat", FT_NONE, BASE_NONE,
1119 NULL, 0, NULL, HFILL }},
1120 { &hf_nlm_test_stat_stat, {
1121 "stat", "nlm.test_stat.stat", FT_UINT32, BASE_DEC,
1122 VALS(names_nlm_stats), 0, NULL, HFILL }},
1123 { &hf_nlm_holder, {
1124 "holder", "nlm.holder", FT_NONE, BASE_NONE,
1125 NULL, 0, NULL, HFILL }},
1126 { &hf_nlm_share, {
1127 "share", "nlm.share", FT_NONE, BASE_NONE,
1128 NULL, 0, NULL, HFILL }},
1129 { &hf_nlm_share_mode, {
1130 "mode", "nlm.share.mode", FT_UINT32, BASE_DEC,
1131 VALS(names_fsh_mode), 0, NULL, HFILL }},
1132 { &hf_nlm_share_access, {
1133 "access", "nlm.share.access", FT_UINT32, BASE_DEC,
1134 VALS(names_fsh_access), 0, NULL, HFILL }},
1135 { &hf_nlm_share_name, {
1136 "name", "nlm.share.name", FT_STRING, BASE_NONE,
1137 NULL, 0, NULL, HFILL }},
1138 { &hf_nlm_sequence, {
1139 "sequence", "nlm.sequence", FT_INT32, BASE_DEC,
1140 NULL, 0, NULL, HFILL }},
1141 { &hf_nlm_request_in, {
1142 "Request MSG in", "nlm.msg_in", FT_UINT32, BASE_DEC,
1143 NULL, 0, "The RES packet is a response to the MSG in this packet", HFILL }},
1144 { &hf_nlm_reply_in, {
1145 "Reply RES in", "nlm.res_in", FT_UINT32, BASE_DEC,
1146 NULL, 0, "The response to this MSG packet is in this packet", HFILL }},
1147 { &hf_nlm_time, {
1148 "Time from request", "nlm.time", FT_RELATIVE_TIME, BASE_NONE,
1149 NULL, 0, "Time between Request and Reply for async NLM calls", HFILL }},
1153 static int *ett[] = {
1154 &ett_nlm,
1155 &ett_nlm_lock,
1157 module_t *nlm_module;
1159 proto_nlm = proto_register_protocol("Network Lock Manager Protocol",
1160 "NLM", "nlm");
1161 proto_register_field_array(proto_nlm, hf, array_length(hf));
1162 proto_register_subtree_array(ett, array_length(ett));
1164 nlm_module = prefs_register_protocol(proto_nlm, NULL);
1165 prefs_register_bool_preference(nlm_module, "msg_res_matching",
1166 "Match MSG/RES packets for async NLM",
1167 "Whether the dissector will track and match MSG and RES calls for asynchronous NLM",
1168 &nlm_match_msgres);
1170 nlm_msg_res_unmatched = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(),
1171 nlm_msg_res_unmatched_hash, nlm_msg_res_unmatched_equal);
1172 nlm_msg_res_matched = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(),
1173 nlm_msg_res_matched_hash, nlm_msg_res_matched_equal);
1176 void
1177 proto_reg_handoff_nlm(void)
1179 /* Register the protocol as RPC */
1180 rpc_init_prog(proto_nlm, NLM_PROGRAM, ett_nlm,
1181 G_N_ELEMENTS(nlm_vers_info), nlm_vers_info);
1185 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1187 * Local variables:
1188 * c-basic-offset: 8
1189 * tab-width: 8
1190 * indent-tabs-mode: t
1191 * End:
1193 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1194 * :indentSize=8:tabSize=8:noTabs=false: