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