From Olivier Biot: have a separate subtree ett_ value for concatenated
[obnox/wireshark/wip.git] / packet-nisplus.c
1 /* packet-nisplus.c
2  * 2001  Ronnie Sahlberg   <See AUTHORS for email>
3  *
4  * $Id: packet-nisplus.c,v 1.15 2002/11/01 00:48:38 sahlberg Exp $
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@ethereal.com>
8  * Copyright 1998 Gerald Combs
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23  */
24
25 #ifdef HAVE_CONFIG_H
26 #include "config.h"
27 #endif
28
29 #include <time.h>
30
31 #include "packet-rpc.h"
32 #include "packet-nisplus.h"
33
34 static int proto_nisplus = -1;
35 static int hf_nisplus_procedure_v3 = -1;
36 static int hf_nisplus_object = -1;
37 static int hf_nisplus_oid = -1;
38 static int hf_nisplus_object_ctime = -1;
39 static int hf_nisplus_object_mtime = -1;
40 static int hf_nisplus_object_name = -1;
41 static int hf_nisplus_object_owner = -1;
42 static int hf_nisplus_object_group = -1;
43 static int hf_nisplus_object_domain = -1;
44 static int hf_nisplus_object_ttl = -1;
45 static int hf_nisplus_object_type = -1;
46 static int hf_nisplus_object_private = -1;
47 static int hf_nisplus_directory = -1;
48 static int hf_nisplus_directory_name = -1;
49 static int hf_nisplus_directory_type = -1;
50 static int hf_nisplus_directory_ttl = -1;
51 static int hf_nisplus_directory_mask = -1;
52 static int hf_nisplus_directory_mask_list = -1;
53 static int hf_nisplus_access_mask = -1;
54 static int hf_nisplus_mask_world_read = -1;
55 static int hf_nisplus_mask_world_modify = -1;
56 static int hf_nisplus_mask_world_create = -1;
57 static int hf_nisplus_mask_world_destroy = -1;
58 static int hf_nisplus_mask_group_read = -1;
59 static int hf_nisplus_mask_group_modify = -1;
60 static int hf_nisplus_mask_group_create = -1;
61 static int hf_nisplus_mask_group_destroy = -1;
62 static int hf_nisplus_mask_owner_read = -1;
63 static int hf_nisplus_mask_owner_modify = -1;
64 static int hf_nisplus_mask_owner_create = -1;
65 static int hf_nisplus_mask_owner_destroy = -1;
66 static int hf_nisplus_mask_nobody_read = -1;
67 static int hf_nisplus_mask_nobody_modify = -1;
68 static int hf_nisplus_mask_nobody_create = -1;
69 static int hf_nisplus_mask_nobody_destroy = -1;
70 static int hf_nisplus_server_name = -1;
71 static int hf_nisplus_key_type = -1;
72 static int hf_nisplus_key_data = -1;
73 static int hf_nisplus_servers = -1;
74 static int hf_nisplus_cbservers = -1;
75 static int hf_nisplus_server = -1;
76 static int hf_nisplus_endpoints = -1;
77 static int hf_nisplus_endpoint = -1;
78 static int hf_nisplus_endpoint_uaddr = -1;
79 static int hf_nisplus_endpoint_family = -1;
80 static int hf_nisplus_endpoint_proto = -1;
81 static int hf_nisplus_link = -1;
82 static int hf_nisplus_attrs_array = -1;
83 static int hf_nisplus_attr = -1;
84 static int hf_nisplus_attr_name = -1;
85 static int hf_nisplus_attr_val = -1;
86 static int hf_nisplus_entry = -1;
87 static int hf_nisplus_entry_type = -1;
88 static int hf_nisplus_entry_cols = -1;
89 static int hf_nisplus_entry_col = -1;
90 static int hf_nisplus_entry_flags = -1;
91 static int hf_nisplus_entry_val = -1;
92 static int hf_nisplus_entry_mask = -1;
93 static int hf_nisplus_entry_mask_binary = -1;
94 static int hf_nisplus_entry_mask_crypt = -1;
95 static int hf_nisplus_entry_mask_xdr = -1;
96 static int hf_nisplus_entry_mask_modified = -1;
97 static int hf_nisplus_entry_mask_asn = -1;
98 static int hf_nisplus_table = -1;
99 static int hf_nisplus_table_type = -1;
100 static int hf_nisplus_table_maxcol = -1;
101 static int hf_nisplus_table_sep = -1;
102 static int hf_nisplus_table_cols = -1;
103 static int hf_nisplus_table_col = -1;
104 static int hf_nisplus_table_path = -1;
105 static int hf_nisplus_table_col_name = -1;
106 static int hf_nisplus_table_col_mask = -1;
107 static int hf_nisplus_table_col_mask_binary = -1;
108 static int hf_nisplus_table_col_mask_encrypted = -1;
109 static int hf_nisplus_table_col_mask_xdr = -1;
110 static int hf_nisplus_table_col_mask_searchable = -1;
111 static int hf_nisplus_table_col_mask_casesensitive = -1;
112 static int hf_nisplus_table_col_mask_modified = -1;
113 static int hf_nisplus_table_col_mask_asn = -1;
114 static int hf_nisplus_group = -1;
115 static int hf_nisplus_group_flags = -1;
116 static int hf_nisplus_grps = -1;
117 static int hf_nisplus_group_name = -1;
118 static int hf_nisplus_ib_flags = -1;
119 static int hf_nisplus_ib_bufsize = -1;
120 static int hf_nisplus_cookie = -1;
121 static int hf_nisplus_fd_dirname = -1;
122 static int hf_nisplus_fd_requester = -1;
123 static int hf_nisplus_taglist = -1;
124 static int hf_nisplus_tag = -1;
125 static int hf_nisplus_tag_type = -1;
126 static int hf_nisplus_tag_val = -1;
127 static int hf_nisplus_dump_dir = -1;
128 static int hf_nisplus_dump_time = -1;
129 static int hf_nisplus_dummy = -1;
130 static int hf_nisplus_ping_dir = -1;
131 static int hf_nisplus_ping_time = -1;
132 static int hf_nisplus_error = -1;
133 static int hf_nisplus_dir_data = -1;
134 static int hf_nisplus_signature = -1;
135 static int hf_nisplus_log_entries = -1;
136 static int hf_nisplus_log_entry = -1;
137 static int hf_nisplus_log_type = -1;
138 static int hf_nisplus_log_time = -1;
139 static int hf_nisplus_log_principal = -1;
140 static int hf_nisplus_callback_status = -1;
141 static int hf_nisplus_cp_status = -1;
142 static int hf_nisplus_cp_zticks = -1;
143 static int hf_nisplus_cp_dticks = -1;
144 static int hf_nisplus_zticks = -1;
145 static int hf_nisplus_dticks = -1;
146 static int hf_nisplus_aticks = -1;
147 static int hf_nisplus_cticks = -1;
148
149 static gint ett_nisplus = -1;
150 static gint ett_nisplus_object = -1;
151 static gint ett_nisplus_oid = -1;
152 static gint ett_nisplus_directory = -1;
153 static gint ett_nisplus_directory_mask = -1;
154 static gint ett_nisplus_access_mask = -1;
155 static gint ett_nisplus_server = -1;
156 static gint ett_nisplus_endpoint = -1;
157 static gint ett_nisplus_link = -1;
158 static gint ett_nisplus_attr = -1;
159 static gint ett_nisplus_entry = -1;
160 static gint ett_nisplus_entry_col = -1;
161 static gint ett_nisplus_entry_mask = -1;
162 static gint ett_nisplus_table = -1;
163 static gint ett_nisplus_table_col = -1;
164 static gint ett_nisplus_table_col_mask = -1;
165 static gint ett_nisplus_group = -1;
166 static gint ett_nisplus_grps = -1;
167 static gint ett_nisplus_tag = -1;
168 static gint ett_nisplus_log_entry = -1;
169
170
171 #define NIS_MASK_TABLE_BINARY   0x0001
172 #define NIS_MASK_TABLE_CRYPT    0x0002
173 #define NIS_MASK_TABLE_XDR      0x0004
174 #define NIS_MASK_TABLE_SRCH     0x0008
175 #define NIS_MASK_TABLE_CASE     0x0010
176 #define NIS_MASK_TABLE_MODIFIED 0x0020
177 #define NIS_MASK_TABLE_ASN      0x0040
178
179
180 #define NIS_MASK_ENTRY_BINARY   0x0001
181 #define NIS_MASK_ENTRY_CRYPT    0x0002
182 #define NIS_MASK_ENTRY_XDR      0x0004
183 #define NIS_MASK_ENTRY_MODIFIED 0x0008
184 #define NIS_MASK_ENTRY_ASN      0x0040
185
186
187 #define NIS_MASK_WORLD_READ     0x0001
188 #define NIS_MASK_WORLD_MODIFY   0x0002
189 #define NIS_MASK_WORLD_CREATE   0x0004
190 #define NIS_MASK_WORLD_DESTROY  0x0008
191 #define NIS_MASK_GROUP_READ     0x0010
192 #define NIS_MASK_GROUP_MODIFY   0x0020
193 #define NIS_MASK_GROUP_CREATE   0x0040
194 #define NIS_MASK_GROUP_DESTROY  0x0080
195 #define NIS_MASK_OWNER_READ     0x0100
196 #define NIS_MASK_OWNER_MODIFY   0x0200
197 #define NIS_MASK_OWNER_CREATE   0x0400
198 #define NIS_MASK_OWNER_DESTROY  0x0800
199 #define NIS_MASK_NOBODY_READ    0x1000
200 #define NIS_MASK_NOBODY_MODIFY  0x2000
201 #define NIS_MASK_NOBODY_CREATE  0x4000
202 #define NIS_MASK_NOBODY_DESTROY 0x8000
203
204
205 static const value_string key_type[] = {
206 #define NIS_KEY_NONE            0
207         {       NIS_KEY_NONE,           "No Public Key (unix/sys auth)" },
208 #define NIS_KEY_DH              1
209         {       NIS_KEY_DH,             "Diffie-Hellman"        },
210 #define NIS_KEY_RSA             2
211         {       NIS_KEY_RSA,            "RSA"   },
212 #define NIS_KEY_KERB            3
213         {       NIS_KEY_KERB,           "Kerberos"      },
214 #define NIS_KEY_DHEXT           4
215         {       NIS_KEY_DHEXT,          "Extended Diffie-Hellman for RPC-GSS"   },
216         {       0,      NULL    },
217 };
218
219 static const value_string obj_type[] = {
220 #define NIS_BOGUS_OBJ           0
221         {       NIS_BOGUS_OBJ,          "Bogus Object"  },
222 #define NIS_NO_OBJ              1
223         {       NIS_NO_OBJ,             "NULL Object"   },
224 #define NIS_DIRECTORY_OBJ       2
225         {       NIS_DIRECTORY_OBJ,      "Directory Object"      },
226 #define NIS_GROUP_OBJ           3
227         {       NIS_GROUP_OBJ,          "Group Object"  },
228 #define NIS_TABLE_OBJ           4
229         {       NIS_TABLE_OBJ,          "Table Object"  },
230 #define NIS_ENTRY_OBJ           5
231         {       NIS_ENTRY_OBJ,          "Entry Object"  },
232 #define NIS_LINK_OBJ            6
233         {       NIS_LINK_OBJ,           "Link Object"   },
234 #define NIS_PRIVATE_OBJ         7
235         {       NIS_PRIVATE_OBJ,        "Private Object"        },
236         {       0,      NULL    },
237 };
238
239 static const value_string ns_type[] = {
240 #define NIS_TYPE_UNKNOWN        0
241         {       NIS_TYPE_UNKNOWN,       "UNKNOWN"       },
242 #define NIS_TYPE_NIS            1
243         {       NIS_TYPE_NIS,   "NIS Plus Service"      },
244 #define NIS_TYPE_SUNYP          2
245         {       NIS_TYPE_SUNYP, "Old NIS Service (YP)"  },
246 #define NIS_TYPE_IVY            3
247         {       NIS_TYPE_IVY,   "NIS Plus Plus Service" },
248 #define NIS_TYPE_DNS            4
249         {       NIS_TYPE_DNS,   "Domain Name Service (DNS)"     },
250 #define NIS_TYPE_X500           5
251         {       NIS_TYPE_X500,  "ISO/CCITT X.500 Service"       },
252 #define NIS_TYPE_DNANS          6
253         {       NIS_TYPE_DNANS, "Digital DECNet Name Service"   },
254 #define NIS_TYPE_XCHS           7
255         {       NIS_TYPE_XCHS,  "Xerox ClearingHouse Service"   },
256 #define NIS_TYPE_CDS            8
257         {       NIS_TYPE_CDS,   "CDS"   },
258         {       0,      NULL    },
259 };
260
261
262
263
264 static int
265 dissect_nisplus_time(tvbuff_t *tvb, int offset, proto_tree *tree, int hfindex)
266 {
267         nstime_t ts;
268
269         ts.nsecs = 0;
270         ts.secs = tvb_get_ntohl(tvb, offset);
271         offset += 4;
272
273         proto_tree_add_time(tree, hfindex, tvb, offset, 4, &ts);
274
275         return offset;
276 }
277
278 static int
279 dissect_group(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
280 {
281         offset = dissect_rpc_string(tvb, tree,
282                         hf_nisplus_group_name, offset, NULL);
283
284         return offset;
285 }
286
287
288 static int
289 dissect_group_obj(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
290 {
291         proto_item* lock_item = NULL;
292         proto_tree* lock_tree = NULL;
293         int old_offset = offset;
294
295         lock_item = proto_tree_add_item(tree, hf_nisplus_group,
296                         tvb, offset, -1, FALSE);
297
298         lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_group);
299
300         offset = dissect_rpc_uint32(tvb, lock_tree,
301                         hf_nisplus_group_flags, offset);
302
303         offset = dissect_rpc_array(tvb, pinfo, lock_tree, offset,
304                         dissect_group, hf_nisplus_grps);
305
306         proto_item_set_len(lock_item, offset-old_offset);
307         return offset;
308 }
309
310
311 static int
312 dissect_access_rights(tvbuff_t *tvb, int offset, proto_tree *tree)
313 {
314         proto_item* mask_item = NULL;
315         proto_tree* mask_tree = NULL;
316         guint32 mask;
317
318         mask_item = proto_tree_add_item(tree, hf_nisplus_access_mask,
319                         tvb, offset, 4, FALSE);
320
321         mask_tree = proto_item_add_subtree(mask_item, ett_nisplus_access_mask);
322         mask = tvb_get_ntohl(tvb, offset);
323         proto_tree_add_boolean(mask_tree, hf_nisplus_mask_world_read, tvb, offset, 4, mask);
324         proto_tree_add_boolean(mask_tree, hf_nisplus_mask_world_modify, tvb, offset, 4, mask);
325         proto_tree_add_boolean(mask_tree, hf_nisplus_mask_world_create, tvb, offset, 4, mask);
326         proto_tree_add_boolean(mask_tree, hf_nisplus_mask_world_destroy, tvb, offset, 4, mask);
327         proto_tree_add_boolean(mask_tree, hf_nisplus_mask_group_read, tvb, offset, 4, mask);
328         proto_tree_add_boolean(mask_tree, hf_nisplus_mask_group_modify, tvb, offset, 4, mask);
329         proto_tree_add_boolean(mask_tree, hf_nisplus_mask_group_create, tvb, offset, 4, mask);
330         proto_tree_add_boolean(mask_tree, hf_nisplus_mask_group_destroy, tvb, offset, 4, mask);
331         proto_tree_add_boolean(mask_tree, hf_nisplus_mask_owner_read, tvb, offset, 4, mask);
332         proto_tree_add_boolean(mask_tree, hf_nisplus_mask_owner_modify, tvb, offset, 4, mask);
333         proto_tree_add_boolean(mask_tree, hf_nisplus_mask_owner_create, tvb, offset, 4, mask);
334         proto_tree_add_boolean(mask_tree, hf_nisplus_mask_owner_destroy, tvb, offset, 4, mask);
335         proto_tree_add_boolean(mask_tree, hf_nisplus_mask_nobody_read, tvb, offset, 4, mask);
336         proto_tree_add_boolean(mask_tree, hf_nisplus_mask_nobody_modify, tvb, offset, 4, mask);
337         proto_tree_add_boolean(mask_tree, hf_nisplus_mask_nobody_create, tvb, offset, 4, mask);
338         proto_tree_add_boolean(mask_tree, hf_nisplus_mask_nobody_destroy, tvb, offset, 4, mask);
339         offset += 4;
340
341         return offset;
342 }
343
344 static int
345 dissect_table(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
346 {
347         proto_item* lock_item = NULL;
348         proto_tree* lock_tree = NULL;
349         proto_item* mask_item = NULL;
350         proto_tree* mask_tree = NULL;
351         guint32 mask;
352         int old_offset = offset;
353
354         lock_item = proto_tree_add_item(tree, hf_nisplus_table_col,
355                         tvb, offset, -1, FALSE);
356
357         lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_table_col);
358
359         offset = dissect_rpc_string(tvb, lock_tree,
360                         hf_nisplus_table_col_name, offset, NULL);
361
362
363         mask_item = proto_tree_add_item(lock_tree, hf_nisplus_table_col_mask,
364                 tvb, offset, 4,
365                 FALSE);
366         mask_tree = proto_item_add_subtree(mask_item, ett_nisplus_table_col_mask);
367         mask = tvb_get_ntohl(tvb, offset);
368         proto_tree_add_boolean(mask_tree, hf_nisplus_table_col_mask_binary,
369                 tvb, offset, 4, mask);
370         proto_tree_add_boolean(mask_tree, hf_nisplus_table_col_mask_encrypted,
371                 tvb, offset, 4, mask);
372         proto_tree_add_boolean(mask_tree, hf_nisplus_table_col_mask_xdr,
373                 tvb, offset, 4, mask);
374         proto_tree_add_boolean(mask_tree, hf_nisplus_table_col_mask_searchable,
375                 tvb, offset, 4, mask);
376         proto_tree_add_boolean(mask_tree, hf_nisplus_table_col_mask_casesensitive,
377                 tvb, offset, 4, mask);
378         proto_tree_add_boolean(mask_tree, hf_nisplus_table_col_mask_modified,
379                 tvb, offset, 4, mask);
380         proto_tree_add_boolean(mask_tree, hf_nisplus_table_col_mask_asn,
381                 tvb, offset, 4, mask);
382         offset += 4;
383
384         offset = dissect_access_rights(tvb, offset, lock_tree);
385
386         proto_item_set_len(lock_item, offset-old_offset);
387         return offset;
388 }
389
390 static int
391 dissect_table_obj(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
392
393 {
394         proto_item* lock_item = NULL;
395         proto_tree* lock_tree = NULL;
396         int old_offset = offset;
397
398         lock_item = proto_tree_add_item(tree, hf_nisplus_table,
399                         tvb, offset, -1, FALSE);
400
401         lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_table);
402
403         offset = dissect_rpc_string(tvb, lock_tree,
404                         hf_nisplus_table_type, offset, NULL);
405
406         offset = dissect_rpc_uint32(tvb, lock_tree,
407                         hf_nisplus_table_maxcol, offset);
408
409         offset = dissect_rpc_uint32(tvb, lock_tree,
410                         hf_nisplus_table_sep, offset);
411
412         offset = dissect_rpc_array(tvb, pinfo, lock_tree, offset,
413                         dissect_table, hf_nisplus_table_cols);
414
415         offset = dissect_rpc_string(tvb, lock_tree,
416                         hf_nisplus_table_path, offset, NULL);
417
418         proto_item_set_len(lock_item, offset-old_offset);
419         return offset;
420 }
421
422 static int
423 dissect_entry(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
424 {
425         proto_item* lock_item = NULL;
426         proto_tree* lock_tree = NULL;
427         proto_item* mask_item = NULL;
428         proto_tree* mask_tree = NULL;
429         guint32 mask;
430         int old_offset = offset;
431
432         lock_item = proto_tree_add_item(tree, hf_nisplus_entry_col,
433                         tvb, offset, -1, FALSE);
434
435         lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_entry_col);
436
437         mask_item = proto_tree_add_item(lock_tree, hf_nisplus_entry_mask,
438                         tvb, offset, 4,
439                         FALSE);
440
441         mask_tree = proto_item_add_subtree(mask_item, ett_nisplus_entry_mask);
442         mask = tvb_get_ntohl(tvb, offset);
443         proto_tree_add_boolean(mask_tree, hf_nisplus_entry_mask_binary, tvb, offset, 4, mask);
444         proto_tree_add_boolean(mask_tree, hf_nisplus_entry_mask_crypt, tvb, offset, 4, mask);
445         proto_tree_add_boolean(mask_tree, hf_nisplus_entry_mask_xdr, tvb, offset, 4, mask);
446         proto_tree_add_boolean(mask_tree, hf_nisplus_entry_mask_modified, tvb, offset, 4, mask);
447         proto_tree_add_boolean(mask_tree, hf_nisplus_entry_mask_asn, tvb, offset, 4, mask);
448         offset += 4;
449
450         offset = dissect_rpc_string(tvb, lock_tree,
451                         hf_nisplus_entry_val, offset, NULL);
452
453         proto_item_set_len(lock_item, offset-old_offset);
454         return offset;
455 }
456
457 static int
458 dissect_entry_obj(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
459 {
460         proto_item* lock_item = NULL;
461         proto_tree* lock_tree = NULL;
462         int old_offset = offset;
463
464         lock_item = proto_tree_add_item(tree, hf_nisplus_entry,
465                         tvb, offset, -1, FALSE);
466
467         lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_entry);
468
469         offset = dissect_rpc_string(tvb, lock_tree,
470                         hf_nisplus_entry_type, offset, NULL);
471
472         offset = dissect_rpc_array(tvb, pinfo, lock_tree, offset,
473                         dissect_entry, hf_nisplus_entry_cols);
474
475         proto_item_set_len(lock_item, offset-old_offset);
476         return offset;
477 }
478
479 static int
480 dissect_attr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
481 {
482         proto_item* lock_item = NULL;
483         proto_tree* lock_tree = NULL;
484         int old_offset = offset;
485
486         lock_item = proto_tree_add_item(tree, hf_nisplus_attr,
487                         tvb, offset, -1, FALSE);
488
489         lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_attr);
490
491         offset = dissect_rpc_string(tvb, lock_tree,
492                         hf_nisplus_attr_name, offset, NULL);
493
494         offset = dissect_rpc_data(tvb, lock_tree,
495                         hf_nisplus_attr_val, offset);
496
497         proto_item_set_len(lock_item, offset-old_offset);
498         return offset;
499 }
500
501 static int
502 dissect_link_obj(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
503 {
504         proto_item* lock_item = NULL;
505         proto_tree* lock_tree = NULL;
506         int old_offset = offset;
507
508         lock_item = proto_tree_add_item(tree, hf_nisplus_link,
509                         tvb, offset, -1, FALSE);
510
511         lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_link);
512
513         offset = dissect_rpc_uint32(tvb, lock_tree,
514                         hf_nisplus_object_type, offset);
515
516         offset = dissect_rpc_array(tvb, pinfo, lock_tree, offset,
517                         dissect_attr, hf_nisplus_attrs_array);
518
519         offset = dissect_rpc_string(tvb, lock_tree,
520                         hf_nisplus_object_name, offset, NULL);
521
522         proto_item_set_len(lock_item, offset-old_offset);
523         return offset;
524 }
525
526
527 static int
528 dissect_endpoint(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
529 {
530         proto_item* lock_item = NULL;
531         proto_tree* lock_tree = NULL;
532         int old_offset = offset;
533
534         lock_item = proto_tree_add_item(tree, hf_nisplus_endpoint,
535                         tvb, offset, -1, FALSE);
536
537         lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_endpoint);
538
539         offset = dissect_rpc_string(tvb, lock_tree,
540                         hf_nisplus_endpoint_uaddr, offset, NULL);
541
542         offset = dissect_rpc_string(tvb, lock_tree,
543                         hf_nisplus_endpoint_family, offset, NULL);
544
545         offset = dissect_rpc_string(tvb, lock_tree,
546                         hf_nisplus_endpoint_proto, offset, NULL);
547
548         proto_item_set_len(lock_item, offset-old_offset);
549         return offset;
550 }
551
552
553 static int
554 dissect_directory_server(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
555 {
556         proto_item* lock_item = NULL;
557         proto_tree* lock_tree = NULL;
558         int old_offset = offset;
559
560         lock_item = proto_tree_add_item(tree, hf_nisplus_server,
561                         tvb, offset, -1, FALSE);
562
563         lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_server);
564
565         offset = dissect_rpc_string(tvb, lock_tree,
566                         hf_nisplus_server_name, offset, NULL);
567
568         offset = dissect_rpc_array(tvb, pinfo, lock_tree, offset,
569                         dissect_endpoint, hf_nisplus_endpoints);
570
571         offset = dissect_rpc_uint32(tvb, lock_tree,
572                         hf_nisplus_key_type, offset);
573
574         offset = dissect_rpc_data(tvb, lock_tree,
575                         hf_nisplus_key_data, offset);
576
577         proto_item_set_len(lock_item, offset-old_offset);
578         return offset;
579 }
580
581
582 static int
583 dissect_directory_mask(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
584 {
585         proto_item* lock_item = NULL;
586         proto_tree* lock_tree = NULL;
587         int old_offset = offset;
588
589         lock_item = proto_tree_add_item(tree, hf_nisplus_directory_mask,
590                         tvb, offset, -1, FALSE);
591
592         lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_directory_mask);
593
594         offset = dissect_access_rights(tvb, offset, lock_tree);
595
596         offset = dissect_rpc_uint32(tvb, lock_tree,
597                         hf_nisplus_object_type, offset);
598
599         proto_item_set_len(lock_item, offset-old_offset);
600         return offset;
601 }
602
603 static int
604 dissect_directory_obj(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
605 {
606         proto_item* lock_item = NULL;
607         proto_tree* lock_tree = NULL;
608         int old_offset = offset;
609
610         lock_item = proto_tree_add_item(tree, hf_nisplus_directory,
611                         tvb, offset, -1, FALSE);
612
613         lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_directory);
614
615         offset = dissect_rpc_string(tvb, lock_tree,
616                         hf_nisplus_directory_name, offset, NULL);
617
618         offset = dissect_rpc_uint32(tvb, lock_tree,
619                         hf_nisplus_directory_type, offset);
620
621         offset = dissect_rpc_array(tvb, pinfo, lock_tree, offset,
622                         dissect_directory_server, hf_nisplus_servers);
623
624         offset = dissect_rpc_uint32(tvb, lock_tree,
625                         hf_nisplus_directory_ttl, offset);
626
627         offset = dissect_rpc_array(tvb, pinfo, lock_tree, offset,
628                         dissect_directory_mask, hf_nisplus_directory_mask_list);
629
630         proto_item_set_len(lock_item, offset-old_offset);
631         return offset;
632 }
633
634 static int
635 dissect_nisplus_oid(tvbuff_t *tvb, int offset, proto_tree *tree)
636 {
637         proto_item* lock_item = NULL;
638         proto_tree* lock_tree = NULL;
639         int old_offset = offset;
640
641         lock_item = proto_tree_add_item(tree, hf_nisplus_oid, tvb,
642                         offset, -1, FALSE);
643
644         lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_oid);
645
646         offset = dissect_nisplus_time(tvb, offset, lock_tree,
647                         hf_nisplus_object_ctime);
648
649         offset = dissect_nisplus_time(tvb, offset, lock_tree,
650                         hf_nisplus_object_mtime);
651
652         proto_item_set_len(lock_item, offset-old_offset);
653         return offset;
654 }
655
656 static int
657 dissect_nisplus_object(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
658 {
659         proto_item* lock_item = NULL;
660         proto_tree* lock_tree = NULL;
661         gint32  type;
662         int old_offset = offset;
663
664         lock_item = proto_tree_add_item(tree, hf_nisplus_object, tvb,
665                         offset, -1, FALSE);
666
667         lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_object);
668
669         offset = dissect_nisplus_oid(tvb, offset, lock_tree);
670
671         offset = dissect_rpc_string(tvb, lock_tree,
672                         hf_nisplus_object_name, offset, NULL);
673
674         offset = dissect_rpc_string(tvb, lock_tree,
675                         hf_nisplus_object_owner, offset, NULL);
676
677         offset = dissect_rpc_string(tvb, lock_tree,
678                         hf_nisplus_object_group, offset, NULL);
679
680         offset = dissect_rpc_string(tvb, lock_tree,
681                         hf_nisplus_object_domain, offset, NULL);
682
683         offset = dissect_access_rights(tvb, offset, lock_tree);
684
685         offset = dissect_rpc_uint32(tvb, lock_tree,
686                         hf_nisplus_object_ttl, offset);
687
688         type = tvb_get_ntohl(tvb, offset);
689         offset = dissect_rpc_uint32(tvb, lock_tree,
690                         hf_nisplus_object_type, offset);
691         switch (type) {
692         case    NIS_DIRECTORY_OBJ:
693                 offset = dissect_directory_obj(tvb, offset, pinfo, lock_tree);
694                 break;
695         case    NIS_GROUP_OBJ:
696                 offset = dissect_group_obj(tvb, offset, pinfo, lock_tree);
697                 break;
698         case    NIS_TABLE_OBJ:
699                 offset = dissect_table_obj(tvb, offset, pinfo, lock_tree);
700                 break;
701         case    NIS_ENTRY_OBJ:
702                 offset = dissect_entry_obj(tvb, offset, pinfo, lock_tree);
703                 break;
704         case    NIS_LINK_OBJ:
705                 offset = dissect_link_obj(tvb, offset, pinfo, lock_tree);
706                 break;
707         case    NIS_PRIVATE_OBJ:
708                 offset = dissect_rpc_data(tvb, lock_tree,
709                                 hf_nisplus_object_private, offset);
710                 break;
711         case    NIS_NO_OBJ:
712                 break;
713         case    NIS_BOGUS_OBJ:
714                 break;
715         default:
716                 break;
717         };
718
719         proto_item_set_len(lock_item, offset-old_offset);
720         return offset;
721 }
722 /* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
723         end of nis object, thats right, all this was the definition of
724         ONE SINGLE struct.
725 */
726
727
728
729 static int
730 dissect_ns_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
731 {
732         offset = dissect_rpc_string(tvb, tree,
733                         hf_nisplus_object_name, offset, NULL);
734
735         offset = dissect_rpc_array(tvb, pinfo, tree, offset,
736                         dissect_nisplus_object, hf_nisplus_object);
737
738         return offset;
739 }
740
741 static int
742 dissect_ib_request(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
743 {
744         offset = dissect_rpc_string(tvb, tree,
745                         hf_nisplus_object_name, offset, NULL);
746
747         offset = dissect_rpc_array(tvb, pinfo, tree, offset,
748                         dissect_attr, hf_nisplus_attrs_array);
749
750         offset = dissect_rpc_uint32(tvb, tree,
751                         hf_nisplus_ib_flags, offset);
752
753         offset = dissect_rpc_array(tvb, pinfo, tree, offset,
754                         dissect_nisplus_object, hf_nisplus_object);
755
756         offset = dissect_rpc_array(tvb, pinfo, tree, offset,
757                         dissect_directory_server, hf_nisplus_cbservers);
758
759         offset = dissect_rpc_uint32(tvb, tree,
760                         hf_nisplus_ib_bufsize, offset);
761
762         offset = dissect_rpc_data(tvb, tree,
763                         hf_nisplus_cookie, offset);
764
765         return offset;
766 }
767
768 static int
769 dissect_fd_args(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
770 {
771         offset = dissect_rpc_string(tvb, tree,
772                         hf_nisplus_fd_dirname, offset, NULL);
773
774         offset = dissect_rpc_string(tvb, tree,
775                         hf_nisplus_fd_requester, offset, NULL);
776
777         return offset;
778 }
779
780 static int
781 dissect_nisplus_tag(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
782 {
783         proto_item* lock_item = NULL;
784         proto_tree* lock_tree = NULL;
785         int old_offset = offset;
786
787         lock_item = proto_tree_add_item(tree, hf_nisplus_tag, tvb,
788                         offset, -1, FALSE);
789
790         lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_tag);
791
792         offset = dissect_rpc_uint32(tvb, lock_tree,
793                         hf_nisplus_tag_type, offset);
794
795         offset = dissect_rpc_string(tvb, lock_tree,
796                         hf_nisplus_tag_val, offset, NULL);
797
798         proto_item_set_len(lock_item, offset-old_offset);
799         return offset;
800 }
801
802 static int
803 dissect_nisplus_taglist(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
804 {
805         offset = dissect_rpc_array(tvb, pinfo, tree, offset,
806                         dissect_nisplus_tag, hf_nisplus_taglist);
807
808         return offset;
809 }
810
811 static int
812 dissect_dump_args(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
813 {
814         offset = dissect_rpc_string(tvb, tree,
815                         hf_nisplus_dump_dir, offset, NULL);
816
817         offset = dissect_nisplus_time(tvb, offset, tree,
818                         hf_nisplus_dump_time);
819
820         offset = dissect_rpc_array(tvb, pinfo, tree, offset,
821                         dissect_directory_server, hf_nisplus_cbservers);
822
823         return offset;
824 }
825
826 static int
827 dissect_netobj(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
828 {
829         offset = dissect_rpc_data(tvb, tree,
830                         hf_nisplus_dummy, offset);
831
832         return offset;
833 }
834
835 static int
836 dissect_nisname(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
837 {
838         offset = dissect_rpc_string(tvb, tree,
839                         hf_nisplus_object_name, offset, NULL);
840
841         return offset;
842 }
843
844 static int
845 dissect_ping_args(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
846 {
847         offset = dissect_rpc_string(tvb, tree,
848                         hf_nisplus_ping_dir, offset, NULL);
849
850         offset = dissect_nisplus_time(tvb, offset, tree,
851                         hf_nisplus_ping_time);
852
853         return offset;
854 }
855
856
857 static const value_string nis_error[] = {
858 #define NIS_SUCCESS             0
859         {       NIS_SUCCESS,            "A-ok, let's rock n roll"       },
860 #define NIS_S_SUCCESS           1
861         {       NIS_S_SUCCESS,          "Name found (maybe)"    },
862 #define NIS_NOTFOUND            2
863         {       NIS_NOTFOUND,           "Name definitely not found"     },
864 #define NIS_S_NOTFOUND          3
865         {       NIS_S_NOTFOUND,         "Name maybe not found"  },
866 #define NIS_CACHEEXPIRED        4
867         {       NIS_CACHEEXPIRED,       "Name exists but cache out of date"     },
868 #define NIS_NAMEUNREACHABLE     5
869         {       NIS_NAMEUNREACHABLE,    "Can't get there from here"     },
870 #define NIS_UNKNOWNOBJ          6
871         {       NIS_UNKNOWNOBJ,         "Object type is bogus"  },
872 #define NIS_TRYAGAIN            7
873         {       NIS_TRYAGAIN,           "I'm busy, call back"   },
874 #define NIS_SYSTEMERROR         8
875         {       NIS_SYSTEMERROR,        "Generic system error"  },
876 #define NIS_CHAINBROKEN         9
877         {       NIS_CHAINBROKEN,        "First/Next warning"    },
878 #define NIS_PERMISSION          10
879         {       NIS_PERMISSION,         "Not enough permission to access"       },
880 #define NIS_NOTOWNER            11
881         {       NIS_NOTOWNER,           "You don't own it, sorry"       },
882 #define NIS_NOT_ME              12
883         {       NIS_NOT_ME,             "I don't serve this name"       },
884 #define NIS_NOMEMORY            13
885         {       NIS_NOMEMORY,           "Outta VM! Help!"       },
886 #define NIS_NAMEEXISTS          14
887         {       NIS_NAMEEXISTS,         "Can't create over another name"        },
888 #define NIS_NOTMASTER           15
889         {       NIS_NOTMASTER,          "I'm justa secondaray, don't ask me"    },
890 #define NIS_INVALIDOBJ          16
891         {       NIS_INVALIDOBJ,         "Object is broken somehow"      },
892 #define NIS_BADNAME             17
893         {       NIS_BADNAME,            "Unparsable name"       },
894 #define NIS_NOCALLBACK          18
895         {       NIS_NOCALLBACK,         "Couldn't talk to call back proc"       },
896 #define NIS_CBRESULTS           19
897         {       NIS_CBRESULTS,          "Results being called back to you"      },
898 #define NIS_NOSUCHNAME          20
899         {       NIS_NOSUCHNAME,         "Name unknown"  },
900 #define NIS_NOTUNIQUE           21
901         {       NIS_NOTUNIQUE,          "Value is not uniques (entry)"  },
902 #define NIS_IBMODERROR          22
903         {       NIS_IBMODERROR,         "Inf. Base. Modify error."      },
904 #define NIS_NOSUCHTABLE         23
905         {       NIS_NOSUCHTABLE,        "Name for table was wrong"      },
906 #define NIS_TYPEMISMATCH        24
907         {       NIS_TYPEMISMATCH,       "Entry and table type mismatch" },
908 #define NIS_LINKNAMEERROR       25
909         {       NIS_LINKNAMEERROR,      "Link points to bogus name"     },
910 #define NIS_PARTIAL             26
911         {       NIS_PARTIAL,            "Partial success, found table"  },
912 #define NIS_TOOMANYATTRS        27
913         {       NIS_TOOMANYATTRS,       "Too many attributes"   },
914 #define NIS_RPCERROR            28
915         {       NIS_RPCERROR,           "RPC error encountered" },
916 #define NIS_BADATTRIBUTE        29
917         {       NIS_BADATTRIBUTE,       "Bad or invalid attribute"      },
918 #define NIS_NOTSEARCHABLE       30
919         {       NIS_NOTSEARCHABLE,      "Non-searchable object searched"        },
920 #define NIS_CBERROR             31
921         {       NIS_CBERROR,            "Error during callback (svc crash)"     },
922 #define NIS_FOREIGNNS           32
923         {       NIS_FOREIGNNS,          "Foreign Namespace"     },
924 #define NIS_BADOBJECT           33
925         {       NIS_BADOBJECT,          "Malformed object structure"    },
926 #define NIS_NOTSAMEOBJ          34
927         {       NIS_NOTSAMEOBJ,         "Object swapped during deletion"        },
928 #define NIS_MODFAIL             35
929         {       NIS_MODFAIL,            "Failure during a Modify."      },
930 #define NIS_BADREQUEST          36
931         {       NIS_BADREQUEST,         "Illegal query for table"       },
932 #define NIS_NOTEMPTY            37
933         {       NIS_NOTEMPTY,           "Attempt to remove a non-empty tbl"     },
934 #define NIS_COLDSTART_ERR       38
935         {       NIS_COLDSTART_ERR,      "Error accesing the cold start file"    },
936 #define NIS_RESYNC              39
937         {       NIS_RESYNC,             "Transaction log too far out of date"   },
938 #define NIS_FAIL                40
939         {       NIS_FAIL,               "NIS operation failed." },
940 #define NIS_UNAVAIL             41
941         {       NIS_UNAVAIL,            "NIS+ service is unavailable (client)"  },
942 #define NIS_RES2BIG             42
943         {       NIS_RES2BIG,            "NIS+ result too big for datagram"      },
944 #define NIS_SRVAUTH             43
945         {       NIS_SRVAUTH,            "NIS+ server wasn't authenticated."     },
946 #define NIS_CLNTAUTH            44
947         {       NIS_CLNTAUTH,           "NIS+ Client wasn't authenticated."     },
948 #define NIS_NOFILESPACE         45
949         {       NIS_NOFILESPACE,        "NIS+ server ran out of disk space"     },
950 #define NIS_NOPROC              46
951         {       NIS_NOPROC,             "NIS+ server couldn't create new proc"  },
952 #define NIS_DUMPLATER           47
953         {       NIS_DUMPLATER,          "NIS+ server already has dump child"    },
954         {       0,      NULL    },
955 };
956
957 static int
958 dissect_nisplus_result(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
959 {
960         offset = dissect_rpc_uint32(tvb, tree,
961                         hf_nisplus_error, offset);
962
963         offset = dissect_rpc_array(tvb, pinfo, tree, offset,
964                         dissect_nisplus_object, hf_nisplus_object);
965
966         offset = dissect_rpc_data(tvb, tree,
967                         hf_nisplus_cookie, offset);
968
969         offset = dissect_rpc_uint32(tvb, tree,
970                         hf_nisplus_zticks, offset);
971
972         offset = dissect_rpc_uint32(tvb, tree,
973                         hf_nisplus_dticks, offset);
974
975         offset = dissect_rpc_uint32(tvb, tree,
976                         hf_nisplus_aticks, offset);
977
978         offset = dissect_rpc_uint32(tvb, tree,
979                         hf_nisplus_cticks, offset);
980
981         return offset;
982 }
983
984 static int
985 dissect_fd_result(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
986 {
987         offset = dissect_rpc_uint32(tvb, tree,
988                         hf_nisplus_error, offset);
989
990         offset = dissect_rpc_string(tvb, tree,
991                         hf_nisplus_fd_dirname, offset, NULL);
992
993         offset = dissect_rpc_data(tvb, tree,
994                         hf_nisplus_dir_data, offset);
995
996         offset = dissect_rpc_data(tvb, tree,
997                         hf_nisplus_signature, offset);
998
999         return offset;
1000 }
1001
1002 static const value_string entry_type[] = {
1003 #define LOG_NOP         0
1004         {       LOG_NOP,                "NOP"   },
1005 #define LOG_ADD_NAME            1
1006         {       LOG_ADD_NAME,           "Name Was Added"        },
1007 #define LOG_REM_NAME            2
1008         {       LOG_REM_NAME,           "Name Was Removed"      },
1009 #define LOG_MOD_NAME_OLD        3
1010         {       LOG_MOD_NAME_OLD,               "Name Was Modified"     },
1011 #define LOG_MOD_NAME_NEW        4
1012         {       LOG_MOD_NAME_NEW,               "Name Was Modified"     },
1013 #define LOG_ADD_IBASE           5
1014         {       LOG_ADD_IBASE,          "Entry Added To Information Base"       },
1015 #define LOG_REM_IBASE           6
1016         {       LOG_REM_IBASE,          "Entry Removed From Information Base"   },
1017 #define LOG_MOD_IBASE           7
1018         {       LOG_MOD_IBASE,          "Entry Modified In Information Base"    },
1019 #define LOG_UPD_STAMP           8
1020         {       LOG_UPD_STAMP,          "Update Timestamp"      },
1021         {       0,      NULL    },
1022 };
1023 static int
1024 dissect_log_entry(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
1025 {
1026         proto_item* lock_item = NULL;
1027         proto_tree* lock_tree = NULL;
1028         int old_offset = offset;
1029
1030         lock_item = proto_tree_add_item(tree, hf_nisplus_log_entry,
1031                         tvb, offset, -1, FALSE);
1032
1033         lock_tree = proto_item_add_subtree(lock_item, ett_nisplus_log_entry);
1034
1035         offset = dissect_nisplus_time(tvb, offset, lock_tree,
1036                         hf_nisplus_log_time);
1037
1038         offset = dissect_rpc_uint32(tvb, lock_tree,
1039                         hf_nisplus_log_type, offset);
1040
1041         offset = dissect_rpc_string(tvb, lock_tree,
1042                         hf_nisplus_log_principal, offset, NULL);
1043
1044         offset = dissect_rpc_string(tvb, lock_tree,
1045                         hf_nisplus_directory_name, offset, NULL);
1046
1047         offset = dissect_rpc_array(tvb, pinfo, lock_tree, offset,
1048                         dissect_attr, hf_nisplus_attrs_array);
1049
1050         offset = dissect_nisplus_object(tvb, offset, pinfo, lock_tree);
1051
1052         proto_item_set_len(lock_item, offset-old_offset);
1053         return offset;
1054 }
1055
1056 static int
1057 dissect_log_result(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
1058 {
1059         offset = dissect_rpc_uint32(tvb, tree,
1060                         hf_nisplus_error, offset);
1061
1062         offset = dissect_rpc_data(tvb, tree,
1063                         hf_nisplus_cookie, offset);
1064
1065         offset = dissect_rpc_array(tvb, pinfo, tree, offset,
1066                         dissect_log_entry, hf_nisplus_log_entries);
1067
1068         return offset;
1069 }
1070
1071 static int
1072 dissect_callback_result(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1073 {
1074         offset = dissect_rpc_bool(tvb, tree, hf_nisplus_callback_status,
1075                         offset);
1076
1077         return offset;
1078 }
1079
1080 static int
1081 dissect_change_time(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1082 {
1083         offset = dissect_nisplus_time(tvb, offset, tree,
1084                         hf_nisplus_log_time);
1085
1086         return offset;
1087 }
1088
1089 static int
1090 dissect_cp_result(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1091 {
1092         offset = dissect_rpc_uint32(tvb, tree,
1093                         hf_nisplus_cp_status, offset);
1094
1095         offset = dissect_rpc_uint32(tvb, tree,
1096                         hf_nisplus_cp_zticks, offset);
1097
1098         offset = dissect_rpc_uint32(tvb, tree,
1099                         hf_nisplus_cp_dticks, offset);
1100
1101         return offset;
1102 }
1103
1104 static int
1105 dissect_nisplus_error(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1106 {
1107         offset = dissect_rpc_uint32(tvb, tree,
1108                         hf_nisplus_error, offset);
1109
1110         return offset;
1111 }
1112
1113 /* proc number, "proc name", dissect_request, dissect_reply */
1114 /* NULL as function pointer means: type of arguments is "void". */
1115 static const vsff nisplus3_proc[] = {
1116         { NISPROC_NULL,                 "NULL",
1117                 NULL,   NULL },
1118         { NISPROC_LOOKUP,               "LOOKUP",
1119                 dissect_ns_request,     dissect_nisplus_result },
1120         { NISPROC_ADD,                  "ADD",
1121                 dissect_ns_request,     dissect_nisplus_result },
1122         { NISPROC_MODIFY,               "MODIFY",
1123                 dissect_ns_request,     dissect_nisplus_result },
1124         { NISPROC_REMOVE,               "REMOVE",
1125                 dissect_ns_request,     dissect_nisplus_result },
1126         { NISPROC_IBLIST,               "IBLIST",
1127                 dissect_ib_request,     dissect_nisplus_result },
1128         { NISPROC_IBADD,                "IBADD",
1129                 dissect_ib_request,     dissect_nisplus_result },
1130         { NISPROC_IBMODIFY,             "IBMODIFY",
1131                 dissect_ib_request,     dissect_nisplus_result },
1132         { NISPROC_IBREMOVE,             "IBREMOVE",
1133                 dissect_ib_request,     dissect_nisplus_result },
1134         { NISPROC_IBFIRST,              "IBFIRST",
1135                 dissect_ib_request,     dissect_nisplus_result },
1136         { NISPROC_IBNEXT,               "IBNEXT",
1137                 dissect_ib_request,     dissect_nisplus_result },
1138         { NISPROC_FINDDIRECTORY,        "FINDDIRECTORY",
1139                 dissect_fd_args,        dissect_fd_result },
1140         { NISPROC_STATUS,               "STATUS",
1141                 dissect_nisplus_taglist, dissect_nisplus_taglist },
1142         { NISPROC_DUMPLOG,              "DUMPLOG",
1143                 dissect_dump_args,      dissect_log_result },
1144         { NISPROC_DUMP,                 "DUMP",
1145                 dissect_dump_args,      dissect_log_result },
1146         { NISPROC_CALLBACK,             "CALLBACK",
1147                 dissect_netobj,         dissect_callback_result },
1148         { NISPROC_CPTIME,               "CPTIME",
1149                 dissect_nisname,        dissect_change_time },
1150         { NISPROC_CHECKPOINT,           "CHECKPOINT",
1151                 dissect_nisname,        dissect_cp_result },
1152         { NISPROC_PING,                 "PING",
1153                 dissect_ping_args,      NULL },
1154         { NISPROC_SERVSTATE,            "SERVSTATE",
1155                 dissect_nisplus_taglist, dissect_nisplus_taglist },
1156         { NISPROC_MKDIR,                "MKDIR",
1157                 dissect_nisname,        dissect_nisplus_error },
1158         { NISPROC_RMDIR,                "RMDIR",
1159                 dissect_nisname,        dissect_nisplus_error },
1160         { NISPROC_UPDKEYS,              "UPDKEYS",
1161                 dissect_nisname,        dissect_nisplus_error },
1162         { 0,    NULL,           NULL,                           NULL }
1163 };
1164 static const value_string nisplus3_proc_vals[] = {
1165         { NISPROC_NULL,                 "NULL" },
1166         { NISPROC_LOOKUP,               "LOOKUP" },
1167         { NISPROC_ADD,                  "ADD" },
1168         { NISPROC_MODIFY,               "MODIFY" },
1169         { NISPROC_REMOVE,               "REMOVE" },
1170         { NISPROC_IBLIST,               "IBLIST" },
1171         { NISPROC_IBADD,                "IBADD" },
1172         { NISPROC_IBMODIFY,             "IBMODIFY" },
1173         { NISPROC_IBREMOVE,             "IBREMOVE" },
1174         { NISPROC_IBFIRST,              "IBFIRST" },
1175         { NISPROC_IBNEXT,               "IBNEXT" },
1176         { NISPROC_FINDDIRECTORY,        "FINDDIRECTORY" },
1177         { NISPROC_STATUS,               "STATUS" },
1178         { NISPROC_DUMPLOG,              "DUMPLOG" },
1179         { NISPROC_DUMP,                 "DUMP" },
1180         { NISPROC_CALLBACK,             "CALLBACK" },
1181         { NISPROC_CPTIME,               "CPTIME" },
1182         { NISPROC_CHECKPOINT,           "CHECKPOINT" },
1183         { NISPROC_PING,                 "PING" },
1184         { NISPROC_SERVSTATE,            "SERVSTATE" },
1185         { NISPROC_MKDIR,                "MKDIR" },
1186         { NISPROC_RMDIR,                "RMDIR" },
1187         { NISPROC_UPDKEYS,              "UPDKEYS" },
1188         { 0,    NULL }
1189 };
1190
1191
1192
1193 void
1194 proto_register_nis(void)
1195 {
1196         static const true_false_string tfs_col_binary = {
1197                 "column is binary",
1198                 "column is NOT binary"
1199         };
1200         static const true_false_string tfs_col_encrypted = {
1201                 "column is encrypted",
1202                 "column is NOT encrypted"
1203         };
1204         static const true_false_string tfs_col_xdr = {
1205                 "column is xdr encoded",
1206                 "column is NOT xdr encoded"
1207         };
1208         static const true_false_string tfs_col_searchable = {
1209                 "column is searchable",
1210                 "column is NOT searchable"
1211         };
1212         static const true_false_string tfs_col_casesensitive = {
1213                 "column is case sensitive",
1214                 "column is NOT case sensitive"
1215         };
1216         static const true_false_string tfs_col_modified = {
1217                 "column is modified",
1218                 "column is NOT modified"
1219         };
1220         static const true_false_string tfs_col_asn = {
1221                 "column is asn.1 encoded",
1222                 "column is NOT asn.1 encoded"
1223         };
1224
1225         static const true_false_string tfs_entry_binary = {
1226                 "entry is binary",
1227                 "entry is NOT binary"
1228         };
1229
1230         static const true_false_string tfs_entry_crypt = {
1231                 "entry is encrypted",
1232                 "entry is NOT encrypted"
1233         };
1234
1235         static const true_false_string tfs_entry_xdr = {
1236                 "entry is xdr encoded",
1237                 "entry is NOT xdr encoded"
1238         };
1239
1240         static const true_false_string tfs_entry_modified = {
1241                 "entry is modified",
1242                 "entry is NOT modified"
1243         };
1244
1245         static const true_false_string tfs_entry_asn = {
1246                 "entry is asn.1 encoded",
1247                 "entry is NOT asn.1 encoded"
1248         };
1249
1250         static const true_false_string tfs_world_read = {
1251                 "world can read",
1252                 "world can NOT read"
1253         };
1254
1255         static const true_false_string tfs_world_modify = {
1256                 "world can modify",
1257                 "world can NOT modify"
1258         };
1259
1260         static const true_false_string tfs_world_create = {
1261                 "world can create",
1262                 "world can NOT create"
1263         };
1264
1265         static const true_false_string tfs_world_destroy = {
1266                 "world can destroy",
1267                 "world can NOT destroy"
1268         };
1269
1270         static const true_false_string tfs_group_read = {
1271                 "group can read",
1272                 "group can NOT read"
1273         };
1274
1275         static const true_false_string tfs_group_modify = {
1276                 "group can modify",
1277                 "group can NOT modify"
1278         };
1279
1280         static const true_false_string tfs_group_create = {
1281                 "group can create",
1282                 "group can NOT create"
1283         };
1284
1285         static const true_false_string tfs_group_destroy = {
1286                 "group can destroy",
1287                 "group can NOT destroy"
1288         };
1289
1290         static const true_false_string tfs_owner_read = {
1291                 "owner can read",
1292                 "owner can NOT read"
1293         };
1294
1295         static const true_false_string tfs_owner_modify = {
1296                 "owner can modify",
1297                 "owner can NOT modify"
1298         };
1299
1300         static const true_false_string tfs_owner_create = {
1301                 "owner can create",
1302                 "owner can NOT create"
1303         };
1304
1305         static const true_false_string tfs_owner_destroy = {
1306                 "owner can destroy",
1307                 "owner can NOT destroy"
1308         };
1309
1310         static const true_false_string tfs_nobody_read = {
1311                 "nobody can read",
1312                 "nobody can NOT read"
1313         };
1314
1315         static const true_false_string tfs_nobody_modify = {
1316                 "nobody can modify",
1317                 "nobody can NOT modify"
1318         };
1319
1320         static const true_false_string tfs_nobody_create = {
1321                 "nobody can create",
1322                 "nobody can NOT create"
1323         };
1324
1325         static const true_false_string tfs_nobody_destroy = {
1326                 "nobody can destroy",
1327                 "nobody can NOT destroy"
1328         };
1329
1330         static const true_false_string tfs_callback_status = {
1331                 "unknown",
1332                 "unknown"
1333         };
1334
1335
1336
1337
1338         static hf_register_info hf[] = {
1339                 { &hf_nisplus_procedure_v3, {
1340                         "V3 Procedure", "nisplus.procedure_v3", FT_UINT32, BASE_DEC,
1341                         VALS(nisplus3_proc_vals), 0, "V3 Procedure", HFILL }},
1342                 { &hf_nisplus_object, {
1343                         "NIS Object", "nisplus.object", FT_NONE, BASE_NONE,
1344                         NULL, 0, "NIS Object", HFILL }},
1345
1346                 { &hf_nisplus_oid, {
1347                         "Object Identity Verifier", "nisplus.object.oid", FT_NONE, BASE_NONE,
1348                         NULL, 0, "NIS Object Identity Verifier", HFILL }},
1349
1350                 { &hf_nisplus_object_name, {
1351                         "name", "nisplus.object.name", FT_STRING, BASE_DEC,
1352                         NULL, 0, "NIS Name For This Object", HFILL }},
1353
1354                 { &hf_nisplus_object_owner, {
1355                         "owner", "nisplus.object.owner", FT_STRING, BASE_DEC,
1356                         NULL, 0, "NIS Name Of Object Owner", HFILL }},
1357
1358                 { &hf_nisplus_object_group, {
1359                         "group", "nisplus.object.group", FT_STRING, BASE_DEC,
1360                         NULL, 0, "NIS Name Of Access Group", HFILL }},
1361
1362                 { &hf_nisplus_object_domain, {
1363                         "domain", "nisplus.object.domain", FT_STRING, BASE_DEC,
1364                         NULL, 0, "NIS Administrator For This Object", HFILL }},
1365
1366                 { &hf_nisplus_object_ttl, {
1367                         "ttl", "nisplus.object.ttl", FT_UINT32, BASE_DEC,
1368                         NULL, 0, "NIS Time To Live For This Object", HFILL }},
1369
1370                 { &hf_nisplus_object_private, {
1371                         "private", "nisplus.object.private", FT_BYTES, BASE_DEC,
1372                         NULL, 0, "NIS Private Object", HFILL }},
1373
1374                 { &hf_nisplus_directory, {
1375                         "directory", "nisplus.directory", FT_NONE, BASE_NONE,
1376                         NULL, 0, "NIS Directory Object", HFILL }},
1377
1378                 { &hf_nisplus_directory_name, {
1379                         "directory name", "nisplus.directory.name", FT_STRING, BASE_DEC,
1380                         NULL, 0, "Name Of Directory Being Served", HFILL }},
1381
1382                 { &hf_nisplus_directory_type, {
1383                         "type", "nisplus.directory.type", FT_UINT32, BASE_DEC,
1384                         VALS(ns_type), 0, "NIS Type Of Name Service", HFILL }},
1385
1386                 { &hf_nisplus_directory_ttl, {
1387                         "ttl", "nisplus.directory.ttl", FT_UINT32, BASE_DEC,
1388                         NULL, 0, "Time To Live", HFILL }},
1389
1390                 { &hf_nisplus_directory_mask, {
1391                         "mask", "nisplus.directory.mask", FT_NONE, BASE_NONE,
1392                         NULL, 0, "NIS Directory Create/Destroy Rights", HFILL }},
1393
1394                 { &hf_nisplus_directory_mask_list, {
1395                         "mask list", "nisplus.directory.mask_list", FT_NONE, BASE_NONE,
1396                         NULL, 0, "List Of Directory Create/Destroy Rights", HFILL }},
1397
1398                 { &hf_nisplus_mask_world_read, {
1399                         "WORLD READ", "nisplus.directory.mask.world_read",
1400                         FT_BOOLEAN, 32, TFS(&tfs_world_read),
1401                         NIS_MASK_WORLD_READ, "World Read Flag", HFILL }},
1402
1403                 { &hf_nisplus_mask_world_modify, {
1404                         "WORLD MODIFY", "nisplus.directory.mask.world_modify",
1405                         FT_BOOLEAN, 32, TFS(&tfs_world_modify),
1406                         NIS_MASK_WORLD_MODIFY, "World Modify Flag", HFILL }},
1407
1408                 { &hf_nisplus_mask_world_create, {
1409                         "WORLD CREATE", "nisplus.directory.mask.world_create",
1410                         FT_BOOLEAN, 32, TFS(&tfs_world_create),
1411                         NIS_MASK_WORLD_CREATE, "World Create Flag", HFILL }},
1412
1413                 { &hf_nisplus_mask_world_destroy, {
1414                         "WORLD DESTROY", "nisplus.directory.mask.world_destroy",
1415                         FT_BOOLEAN, 32, TFS(&tfs_world_destroy),
1416                         NIS_MASK_WORLD_DESTROY, "World Destroy Flag", HFILL }},
1417
1418                 { &hf_nisplus_mask_group_read, {
1419                         "GROUP READ", "nisplus.directory.mask.group_read",
1420                         FT_BOOLEAN, 32, TFS(&tfs_group_read),
1421                         NIS_MASK_GROUP_READ, "Group Read Flag", HFILL }},
1422
1423                 { &hf_nisplus_mask_group_modify, {
1424                         "GROUP MODIFY", "nisplus.directory.mask.group_modify",
1425                         FT_BOOLEAN, 32, TFS(&tfs_group_modify),
1426                         NIS_MASK_GROUP_MODIFY, "Group Modify Flag", HFILL }},
1427
1428                 { &hf_nisplus_mask_group_create, {
1429                         "GROUP CREATE", "nisplus.directory.mask.group_create",
1430                         FT_BOOLEAN, 32, TFS(&tfs_group_create),
1431                         NIS_MASK_GROUP_CREATE, "Group Create Flag", HFILL }},
1432
1433                 { &hf_nisplus_mask_group_destroy, {
1434                         "GROUP DESTROY", "nisplus.directory.mask.group_destroy",
1435                         FT_BOOLEAN, 32, TFS(&tfs_group_destroy),
1436                         NIS_MASK_GROUP_DESTROY, "Group Destroy Flag", HFILL }},
1437
1438                 { &hf_nisplus_mask_owner_read, {
1439                         "OWNER READ", "nisplus.directory.mask.owner_read",
1440                         FT_BOOLEAN, 32, TFS(&tfs_owner_read),
1441                         NIS_MASK_OWNER_READ, "Owner Read Flag", HFILL }},
1442
1443                 { &hf_nisplus_mask_owner_modify, {
1444                         "OWNER MODIFY", "nisplus.directory.mask.owner_modify",
1445                         FT_BOOLEAN, 32, TFS(&tfs_owner_modify),
1446                         NIS_MASK_OWNER_MODIFY, "Owner Modify Flag", HFILL }},
1447
1448                 { &hf_nisplus_mask_owner_create, {
1449                         "OWNER CREATE", "nisplus.directory.mask.owner_create",
1450                         FT_BOOLEAN, 32, TFS(&tfs_owner_create),
1451                         NIS_MASK_OWNER_CREATE, "Owner Create Flag", HFILL }},
1452
1453                 { &hf_nisplus_mask_owner_destroy, {
1454                         "OWNER DESTROY", "nisplus.directory.mask.owner_destroy",
1455                         FT_BOOLEAN, 32, TFS(&tfs_owner_destroy),
1456                         NIS_MASK_OWNER_DESTROY, "Owner Destroy Flag", HFILL }},
1457
1458                 { &hf_nisplus_mask_nobody_read, {
1459                         "NOBODY READ", "nisplus.directory.mask.nobody_read",
1460                         FT_BOOLEAN, 32, TFS(&tfs_nobody_read),
1461                         NIS_MASK_NOBODY_READ, "Nobody Read Flag", HFILL }},
1462
1463                 { &hf_nisplus_mask_nobody_modify, {
1464                         "NOBODY MODIFY", "nisplus.directory.mask.nobody_modify",
1465                         FT_BOOLEAN, 32, TFS(&tfs_nobody_modify),
1466                         NIS_MASK_NOBODY_MODIFY, "Nobody Modify Flag", HFILL }},
1467
1468                 { &hf_nisplus_mask_nobody_create, {
1469                         "NOBODY CREATE", "nisplus.directory.mask.nobody_create",
1470                         FT_BOOLEAN, 32, TFS(&tfs_nobody_create),
1471                         NIS_MASK_NOBODY_CREATE, "Nobody Create Flag", HFILL }},
1472
1473                 { &hf_nisplus_mask_nobody_destroy, {
1474                         "NOBODY DESTROY", "nisplus.directory.mask.nobody_destroy",
1475                         FT_BOOLEAN, 32, TFS(&tfs_nobody_destroy),
1476                         NIS_MASK_NOBODY_DESTROY, "Nobody Destroy Flag", HFILL }},
1477
1478                 { &hf_nisplus_access_mask, {
1479                         "access mask", "nisplus.access.mask", FT_NONE, BASE_NONE,
1480                         NULL, 0, "NIS Access Mask", HFILL }},
1481
1482                 { &hf_nisplus_object_type, {
1483                         "type", "nisplus.object.type", FT_UINT32, BASE_DEC,
1484                         VALS(obj_type), 0, "NIS Type Of Object", HFILL }},
1485
1486                 { &hf_nisplus_servers, {
1487                         "nis servers", "nisplus.servers", FT_NONE, BASE_NONE,
1488                         NULL, 0, "NIS Servers For This Directory", HFILL }},
1489
1490                 { &hf_nisplus_cbservers, {
1491                         "nis servers", "nisplus.servers", FT_NONE, BASE_NONE,
1492                         NULL, 0, "Optional Callback Server", HFILL }},
1493
1494                 { &hf_nisplus_server, {
1495                         "server", "nisplus.server", FT_NONE, BASE_NONE,
1496                         NULL, 0, "NIS Server For This Directory", HFILL }},
1497
1498                 { &hf_nisplus_server_name, {
1499                         "name", "nisplus.server.name", FT_STRING, BASE_DEC,
1500                         NULL, 0, "Name Of NIS Server", HFILL }},
1501
1502                 { &hf_nisplus_key_type, {
1503                         "type", "nisplus.key.type", FT_UINT32, BASE_DEC,
1504                         VALS(key_type), 0, "Type Of Key", HFILL }},
1505
1506                 { &hf_nisplus_key_data, {
1507                         "key data", "nisplus.key.data", FT_BYTES, BASE_DEC,
1508                         NULL, 0, "Encryption Key", HFILL }},
1509
1510                 { &hf_nisplus_endpoints, {
1511                         "nis endpoints", "nisplus.endpoints", FT_NONE, BASE_NONE,
1512                         NULL, 0, "Endpoints For This NIS Server", HFILL }},
1513
1514                 { &hf_nisplus_endpoint, {
1515                         "endpoint", "nisplus.endpoint", FT_NONE, BASE_NONE,
1516                         NULL, 0, "Endpoint For This NIS Server", HFILL }},
1517
1518                 { &hf_nisplus_endpoint_uaddr, {
1519                         "addr", "nisplus.endpoint.uaddr", FT_STRING, BASE_DEC,
1520                         NULL, 0, "Address", HFILL }},
1521
1522                 { &hf_nisplus_endpoint_family, {
1523                         "family", "nisplus.endpoint.family", FT_STRING, BASE_DEC,
1524                         NULL, 0, "Transport Family", HFILL }},
1525
1526                 { &hf_nisplus_endpoint_proto, {
1527                         "proto", "nisplus.endpoint.proto", FT_STRING, BASE_DEC,
1528                         NULL, 0, "Protocol", HFILL }},
1529
1530                 { &hf_nisplus_link, {
1531                         "link", "nisplus.link", FT_NONE, BASE_NONE,
1532                         NULL, 0, "NIS Link Object", HFILL }},
1533
1534                 { &hf_nisplus_attrs_array, {
1535                         "Attributes", "nisplus.attributes", FT_NONE, BASE_NONE,
1536                         NULL, 0, "List Of Attributes", HFILL }},
1537
1538                 { &hf_nisplus_attr, {
1539                         "Attribute", "nisplus.attr", FT_NONE, BASE_NONE,
1540                         NULL, 0, "Attribute", HFILL }},
1541
1542                 { &hf_nisplus_attr_name, {
1543                         "name", "nisplus.attr.name", FT_STRING, BASE_DEC,
1544                         NULL, 0, "Attribute Name", HFILL }},
1545
1546                 { &hf_nisplus_attr_val, {
1547                         "val", "nisplus.attr.val", FT_BYTES, BASE_HEX,
1548                         NULL, 0, "Attribute Value", HFILL }},
1549
1550                 { &hf_nisplus_entry, {
1551                         "entry", "nisplus.entry", FT_NONE, BASE_NONE,
1552                         NULL, 0, "Entry Object", HFILL }},
1553
1554                 { &hf_nisplus_entry_type, {
1555                         "type", "nisplus.entry.type", FT_STRING, BASE_DEC,
1556                         NULL, 0, "Entry Type", HFILL }},
1557
1558                 { &hf_nisplus_entry_cols, {
1559                         "columns", "nisplus.entry.cols", FT_NONE, BASE_NONE,
1560                         NULL, 0, "Entry Columns", HFILL }},
1561
1562                 { &hf_nisplus_entry_col, {
1563                         "column", "nisplus.entry.col", FT_NONE, BASE_NONE,
1564                         NULL, 0, "Entry Column", HFILL }},
1565
1566                 { &hf_nisplus_entry_flags, {
1567                         "flags", "nisplus.entry.flags", FT_UINT32, BASE_HEX,
1568                         NULL, 0, "Entry Col Flags", HFILL }},
1569
1570                 { &hf_nisplus_entry_val, {
1571                         "val", "nisplus.entry.val", FT_STRING, BASE_DEC,
1572                         NULL, 0, "Entry Value", HFILL }},
1573
1574                 { &hf_nisplus_entry_mask, {
1575                         "flags", "nisplus.entry.flags", FT_NONE, BASE_NONE,
1576                         NULL, 0, "Entry Col Flags", HFILL }},
1577
1578                 { &hf_nisplus_entry_mask_binary, {
1579                         "BINARY", "nisplus.entry.flags.binary",
1580                         FT_BOOLEAN, 32, TFS(&tfs_entry_binary),
1581                         NIS_MASK_ENTRY_BINARY, "Is This Entry BINARY Flag", HFILL }},
1582
1583                 { &hf_nisplus_entry_mask_crypt, {
1584                         "ENCRYPTED", "nisplus.entry.flags.encrypted",
1585                         FT_BOOLEAN, 32, TFS(&tfs_entry_crypt),
1586                         NIS_MASK_ENTRY_CRYPT, "Is This Entry ENCRYPTED Flag", HFILL }},
1587
1588                 { &hf_nisplus_entry_mask_xdr, {
1589                         "XDR", "nisplus.entry.flags.xdr",
1590                         FT_BOOLEAN, 32, TFS(&tfs_entry_xdr),
1591                         NIS_MASK_ENTRY_XDR, "Is This Entry XDR Encoded Flag", HFILL }},
1592
1593                 { &hf_nisplus_entry_mask_modified, {
1594                         "MODIFIED", "nisplus.entry.flags.modified",
1595                         FT_BOOLEAN, 32, TFS(&tfs_entry_modified),
1596                         NIS_MASK_ENTRY_MODIFIED, "Is This Entry MODIFIED Flag", HFILL }},
1597
1598                 { &hf_nisplus_entry_mask_asn, {
1599                         "ASN.1", "nisplus.entry.flags.asn",
1600                         FT_BOOLEAN, 32, TFS(&tfs_entry_asn),
1601                         NIS_MASK_ENTRY_ASN, "Is This Entry ASN.1 Encoded Flag", HFILL }},
1602
1603                 { &hf_nisplus_table, {
1604                         "table", "nisplus.table", FT_NONE, BASE_NONE,
1605                         NULL, 0, "Table Object", HFILL }},
1606
1607                 { &hf_nisplus_table_type, {
1608                         "type", "nisplus.table.type", FT_STRING, BASE_DEC,
1609                         NULL, 0, "Table Type", HFILL }},
1610
1611                 { &hf_nisplus_table_maxcol, {
1612                         "max columns", "nisplus.table.maxcol", FT_UINT16, BASE_DEC,
1613                         NULL, 0, "Maximum Number Of Columns For Table", HFILL }},
1614
1615                 { &hf_nisplus_table_sep, {
1616                         "separator", "nisplus.table.separator", FT_UINT8, BASE_HEX,
1617                         NULL, 0, "Separator Character", HFILL }},
1618
1619                 { &hf_nisplus_table_cols, {
1620                         "columns", "nisplus.table.cols", FT_NONE, BASE_NONE,
1621                         NULL, 0, "Table Columns", HFILL }},
1622
1623                 { &hf_nisplus_table_col, {
1624                         "column", "nisplus.table.col", FT_NONE, BASE_NONE,
1625                         NULL, 0, "Table Column", HFILL }},
1626
1627                 { &hf_nisplus_table_path, {
1628                         "path", "nisplus.table.path", FT_STRING, BASE_DEC,
1629                         NULL, 0, "Table Path", HFILL }},
1630
1631                 { &hf_nisplus_table_col_name, {
1632                         "column name", "nisplus.table.col.name", FT_STRING, BASE_DEC,
1633                         NULL, 0, "Column Name", HFILL }},
1634
1635                 { &hf_nisplus_table_col_mask, {
1636                         "flags", "nisplus.table.col.flags", FT_NONE, BASE_NONE,
1637                         NULL, 0, "Flags For This Column", HFILL }},
1638
1639                 { &hf_nisplus_table_col_mask_binary, {
1640                         "binary", "nisplus.table.flags.binary",
1641                         FT_BOOLEAN, 32, TFS(&tfs_col_binary),
1642                         NIS_MASK_TABLE_BINARY, "Is This Column BINARY", HFILL }},
1643
1644                 { &hf_nisplus_table_col_mask_encrypted, {
1645                         "encrypted", "nisplus.table.flags.encrypted",
1646                         FT_BOOLEAN, 32, TFS(&tfs_col_encrypted),
1647                         NIS_MASK_TABLE_CRYPT, "Is This Column ENCRYPTED", HFILL }},
1648
1649                 { &hf_nisplus_table_col_mask_xdr, {
1650                         "xdr", "nisplus.table.flags.xdr",
1651                         FT_BOOLEAN, 32, TFS(&tfs_col_xdr),
1652                         NIS_MASK_TABLE_XDR, "Is This Column XDR Encoded", HFILL }},
1653
1654                 { &hf_nisplus_table_col_mask_searchable, {
1655                         "searchable", "nisplus.table.flags.searchable",
1656                         FT_BOOLEAN, 32, TFS(&tfs_col_searchable),
1657                         NIS_MASK_TABLE_SRCH, "Is This Column SEARCHABLE", HFILL }},
1658
1659                 { &hf_nisplus_table_col_mask_casesensitive, {
1660                         "casesensitive", "nisplus.table.flags.casesensitive",
1661                         FT_BOOLEAN, 32, TFS(&tfs_col_casesensitive),
1662                         NIS_MASK_TABLE_CASE, "Is This Column CASESENSITIVE", HFILL }},
1663
1664                 { &hf_nisplus_table_col_mask_modified, {
1665                         "modified", "nisplus.table.flags.modified",
1666                         FT_BOOLEAN, 32, TFS(&tfs_col_modified),
1667                         NIS_MASK_TABLE_MODIFIED, "Is This Column MODIFIED", HFILL }},
1668
1669                 { &hf_nisplus_table_col_mask_asn, {
1670                         "asn", "nisplus.table.flags.asn",
1671                         FT_BOOLEAN, 32, TFS(&tfs_col_asn),
1672                         NIS_MASK_TABLE_ASN, "Is This Column ASN.1 Encoded", HFILL }},
1673
1674                 { &hf_nisplus_group, {
1675                         "Group", "nisplus.group", FT_NONE, BASE_NONE,
1676                         NULL, 0, "Group Object", HFILL }},
1677
1678                 { &hf_nisplus_grps, {
1679                         "Groups", "nisplus.grps", FT_NONE, BASE_NONE,
1680                         NULL, 0, "List Of Groups", HFILL }},
1681
1682                 { &hf_nisplus_group_flags, {
1683                         "flags", "nisplus.group.flags", FT_UINT32, BASE_HEX,
1684                         NULL, 0, "Group Object Flags", HFILL }},
1685
1686                 { &hf_nisplus_group_name, {
1687                         "group name", "nisplus.group.name", FT_STRING, BASE_DEC,
1688                         NULL, 0, "Name Of Group Member", HFILL }},
1689
1690                 { &hf_nisplus_object_ctime, {
1691                         "ctime", "nisplus.ctime", FT_ABSOLUTE_TIME, BASE_NONE,
1692                         NULL, 0, "Time Of Creation", HFILL }},
1693
1694                 { &hf_nisplus_object_mtime, {
1695                         "mtime", "nisplus.mtime", FT_ABSOLUTE_TIME, BASE_NONE,
1696                         NULL, 0, "Time Last Modified", HFILL }},
1697
1698                 { &hf_nisplus_ib_flags, {
1699                         "flags", "nisplus.ib.flags", FT_UINT32, BASE_HEX,
1700                         NULL, 0, "Information Base Flags", HFILL }},
1701
1702                 { &hf_nisplus_ib_bufsize, {
1703                         "bufsize", "nisplus.ib.bufsize", FT_UINT32, BASE_HEX,
1704                         NULL, 0, "Optional First/NextBufSize", HFILL }},
1705
1706                 { &hf_nisplus_cookie, {
1707                         "cookie", "nisplus.cookie", FT_BYTES, BASE_HEX,
1708                         NULL, 0, "Cookie", HFILL }},
1709
1710                 { &hf_nisplus_fd_dirname, {
1711                         "dirname", "nisplus.fd.dirname", FT_STRING, BASE_DEC,
1712                         NULL, 0, "Directory Name", HFILL }},
1713
1714                 { &hf_nisplus_fd_requester, {
1715                         "requester", "nisplus.fd.requester", FT_STRING, BASE_DEC,
1716                         NULL, 0, "Host Principal Name For Signature", HFILL }},
1717
1718                 { &hf_nisplus_taglist, {
1719                         "taglist", "nisplus.taglist", FT_NONE, BASE_NONE,
1720                         NULL, 0, "List Of Tags", HFILL }},
1721
1722                 { &hf_nisplus_tag, {
1723                         "tag", "nisplus.tag", FT_NONE, BASE_NONE,
1724                         NULL, 0, "Tag", HFILL }},
1725
1726                 { &hf_nisplus_tag_type, {
1727                         "type", "nisplus.tag.type", FT_UINT32, BASE_DEC,
1728                         NULL, 0, "Type Of Statistics Tag", HFILL }},
1729
1730                 { &hf_nisplus_tag_val, {
1731                         "value", "nisplus.tag.value", FT_STRING, BASE_DEC,
1732                         NULL, 0, "Value Of Statistics Tag", HFILL }},
1733
1734                 { &hf_nisplus_dump_dir, {
1735                         "directory", "nisplus.dump.dir", FT_STRING, BASE_DEC,
1736                         NULL, 0, "Directory To Dump", HFILL }},
1737
1738                 { &hf_nisplus_dump_time, {
1739                         "time", "nisplus.dump.time", FT_ABSOLUTE_TIME, BASE_NONE,
1740                         NULL, 0, "From This Timestamp", HFILL }},
1741
1742                 { &hf_nisplus_dummy, {
1743                         " ", ".nisplus.dummy", FT_BYTES, BASE_NONE,
1744                         NULL, 0, " ", HFILL }},
1745
1746                 { &hf_nisplus_ping_time, {
1747                         "time", "nisplus.ping.time", FT_ABSOLUTE_TIME, BASE_NONE,
1748                         NULL, 0, "Timestamp Of The Transaction", HFILL }},
1749
1750                 { &hf_nisplus_ping_dir, {
1751                         "directory", "nisplus.ping.dir", FT_STRING, BASE_DEC,
1752                         NULL, 0, "Directory That Had The Change", HFILL }},
1753
1754                 { &hf_nisplus_error, {
1755                         "status", "nisplus.status", FT_UINT32, BASE_DEC,
1756                         VALS(nis_error), 0, "NIS Status Code", HFILL }},
1757
1758                 { &hf_nisplus_dir_data, {
1759                         "data", "nisplus.fd.dir.data", FT_BYTES, BASE_HEX,
1760                         NULL, 0, "Directory Data In XDR Format", HFILL }},
1761
1762                 { &hf_nisplus_signature, {
1763                         "signature", "nisplus.fd.sig", FT_BYTES, BASE_HEX,
1764                         NULL, 0, "Signature Of The Source", HFILL }},
1765
1766                 { &hf_nisplus_log_entries, {
1767                         "log entries", "nisplus.log.entries", FT_NONE, BASE_NONE,
1768                         NULL, 0, "Log Entries", HFILL }},
1769
1770                 { &hf_nisplus_log_entry, {
1771                         "log entry", "nisplus.log.entry", FT_NONE, BASE_NONE,
1772                         NULL, 0, "Log Entry", HFILL }},
1773
1774                 { &hf_nisplus_log_time, {
1775                         "time", "nisplus.log.time", FT_ABSOLUTE_TIME, BASE_NONE,
1776                         NULL, 0, "Time Of Log Entry", HFILL }},
1777
1778                 { &hf_nisplus_log_type, {
1779                         "type", "nisplus.log.entry.type", FT_UINT32, BASE_DEC,
1780                         VALS(entry_type), 0, "Type Of Entry In Transaction Log", HFILL }},
1781
1782                 { &hf_nisplus_log_principal, {
1783                         "principal", "nisplus.log.principal", FT_STRING, BASE_DEC,
1784                         NULL, 0, "Principal Making The Change", HFILL }},
1785
1786                 { &hf_nisplus_callback_status, {
1787                         "status", "nisplus.callback.status",
1788                         FT_BOOLEAN, 0, TFS(&tfs_callback_status),
1789                         0, "Status Of Callback Thread", HFILL }},
1790
1791                 { &hf_nisplus_cp_status, {
1792                         "status", "nisplus.checkpoint.status", FT_UINT32, BASE_DEC,
1793                         NULL, 0, "Checkpoint Status", HFILL }},
1794
1795                 { &hf_nisplus_cp_zticks, {
1796                         "zticks", "nisplus.checkpoint.zticks", FT_UINT32, BASE_DEC,
1797                         NULL, 0, "Service Ticks", HFILL }},
1798
1799                 { &hf_nisplus_cp_dticks, {
1800                         "dticks", "nisplus.checkpoint.dticks", FT_UINT32, BASE_DEC,
1801                         NULL, 0, "Database Ticks", HFILL }},
1802
1803                 { &hf_nisplus_zticks, {
1804                         "zticks", "nisplus.zticks", FT_UINT32, BASE_DEC,
1805                         NULL, 0, "", HFILL }},
1806
1807                 { &hf_nisplus_dticks, {
1808                         "dticks", "nisplus.dticks", FT_UINT32, BASE_DEC,
1809                         NULL, 0, "", HFILL }},
1810
1811                 { &hf_nisplus_aticks, {
1812                         "aticks", "nisplus.aticks", FT_UINT32, BASE_DEC,
1813                         NULL, 0, "", HFILL }},
1814
1815                 { &hf_nisplus_cticks, {
1816                         "cticks", "nisplus.cticks", FT_UINT32, BASE_DEC,
1817                         NULL, 0, "", HFILL }},
1818
1819         };
1820
1821         static gint *ett[] = {
1822                 &ett_nisplus,
1823                 &ett_nisplus_object,
1824                 &ett_nisplus_oid,
1825                 &ett_nisplus_directory,
1826                 &ett_nisplus_directory_mask,
1827                 &ett_nisplus_access_mask,
1828                 &ett_nisplus_server,
1829                 &ett_nisplus_endpoint,
1830                 &ett_nisplus_link,
1831                 &ett_nisplus_attr,
1832                 &ett_nisplus_entry,
1833                 &ett_nisplus_entry_col,
1834                 &ett_nisplus_entry_mask,
1835                 &ett_nisplus_table,
1836                 &ett_nisplus_table_col,
1837                 &ett_nisplus_table_col_mask,
1838                 &ett_nisplus_group,
1839                 &ett_nisplus_grps,
1840                 &ett_nisplus_tag,
1841                 &ett_nisplus_log_entry,
1842         };
1843
1844         proto_nisplus = proto_register_protocol("NIS+",
1845             "NIS+", "nisplus");
1846         proto_register_field_array(proto_nisplus, hf, array_length(hf));
1847         proto_register_subtree_array(ett, array_length(ett));
1848 }
1849
1850 void
1851 proto_reg_handoff_nis(void)
1852 {
1853         /* Register the protocol as RPC */
1854         rpc_init_prog(proto_nisplus, NIS_PROGRAM, ett_nisplus);
1855         /* Register the procedure tables */
1856         rpc_init_proc_table(NIS_PROGRAM, 3, nisplus3_proc, hf_nisplus_procedure_v3);
1857 }
1858
1859
1860
1861
1862
1863
1864 /* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1865    callback protocol for NIS+
1866    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx */
1867
1868 static int proto_nispluscb = -1;
1869 static int hf_nispluscb_procedure_v1 = -1;
1870 static int hf_nispluscb_entries = -1;
1871 static int hf_nispluscb_entry = -1;
1872
1873 static gint ett_nispluscb = -1;
1874 static gint ett_nispluscb_entry = -1;
1875
1876 static int
1877 dissect_cb_entry(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
1878 {
1879         proto_item* lock_item = NULL;
1880         proto_tree* lock_tree = NULL;
1881         int old_offset = offset;
1882
1883         lock_item = proto_tree_add_item(tree, hf_nispluscb_entry,
1884                         tvb, offset, -1, FALSE);
1885
1886         lock_tree = proto_item_add_subtree(lock_item, ett_nispluscb_entry);
1887
1888 /*XXXXX Not implemented yet*/
1889
1890         proto_item_set_len(lock_item, offset-old_offset);
1891         return offset;
1892 }
1893
1894 static int
1895 dissect_cback_data(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
1896 {
1897         offset = dissect_rpc_array(tvb, pinfo, tree, offset,
1898                         dissect_cb_entry, hf_nispluscb_entries);
1899
1900         return offset;
1901 }
1902
1903 /* proc number, "proc name", dissect_request, dissect_reply */
1904 /* NULL as function pointer means: type of arguments is "void". */
1905 static const vsff cb1_proc[] = {
1906         { CBPROC_NULL,                  "NULL",
1907                 NULL,   NULL },
1908         { CBPROC_RECEIVE,               "RECEIVE",
1909                 dissect_cback_data,     dissect_callback_result },
1910         { CBPROC_FINISH,                "FINISH",
1911                 NULL,   NULL },
1912         { CBPROC_ERROR,                 "ERROR",
1913                 dissect_nisplus_error,  NULL },
1914         {       0,      NULL,   NULL,   NULL },
1915 };
1916 static const value_string nispluscb1_proc_vals[] = {
1917         { CBPROC_NULL,          "NULL" },
1918         { CBPROC_RECEIVE,       "RECEIVE" },
1919         { CBPROC_FINISH,        "FINISH" },
1920         { CBPROC_ERROR,         "ERROR" },
1921         {       0,      NULL }
1922 };
1923
1924 void
1925 proto_register_niscb(void)
1926 {
1927         static hf_register_info hf[] = {
1928                 { &hf_nispluscb_procedure_v1, {
1929                         "V1 Procedure", "nispluscb.procedure_v1", FT_UINT32, BASE_DEC,
1930                         VALS(nispluscb1_proc_vals), 0, "V1 Procedure", HFILL }},
1931                 { &hf_nispluscb_entries, {
1932                         "entries", "nispluscb.entries", FT_NONE, BASE_NONE,
1933                         NULL, 0, "NIS Callback Entries", HFILL }},
1934
1935                 { &hf_nispluscb_entry, {
1936                         "entry", "nispluscb.entry", FT_NONE, BASE_NONE,
1937                         NULL, 0, "NIS Callback Entry", HFILL }},
1938
1939         };
1940
1941         static gint *ett[] = {
1942                 &ett_nispluscb,
1943                 &ett_nispluscb_entry,
1944         };
1945
1946         proto_nispluscb = proto_register_protocol("NIS+ Callback",
1947             "NIS+ CB", "nispluscb");
1948         proto_register_field_array(proto_nispluscb, hf, array_length(hf));
1949         proto_register_subtree_array(ett, array_length(ett));
1950 }
1951
1952 void
1953 proto_reg_handoff_niscb(void)
1954 {
1955         /* Register the protocol as RPC */
1956         rpc_init_prog(proto_nispluscb, CB_PROGRAM, ett_nispluscb);
1957         /* Register the procedure tables */
1958         rpc_init_proc_table(CB_PROGRAM, 1, cb1_proc, hf_nispluscb_procedure_v1);
1959 }