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