r15328: Move some functions around, remove dependencies.
[kai/samba.git] / source4 / librpc / idl / nbt.idl
1 #include "idl_types.h"
2
3 /*
4    IDL structures for NBT operations
5
6    NBT is not traditionally encoded using IDL/NDR. This is a bit of an
7    experiment, and I may well switch us back to a more traditional
8    encoding if it doesn't work out
9 */
10
11 [
12   depends(security,svcctl),
13   helper("libcli/nbt/nbtname.h")
14 ] interface nbt
15 {
16         const int NBT_NAME_SERVICE_PORT  = 137;
17         const int NBT_DGRAM_SERVICE_PORT = 138;
18
19         typedef [bitmap16bit] bitmap {
20                 NBT_RCODE                   = 0x000F,
21                 NBT_FLAG_BROADCAST          = 0x0010,
22                 NBT_FLAG_RECURSION_AVAIL    = 0x0080,
23                 NBT_FLAG_RECURSION_DESIRED  = 0x0100,
24                 NBT_FLAG_TRUNCATION         = 0x0200,
25                 NBT_FLAG_AUTHORITIVE        = 0x0400,
26                 NBT_OPCODE                  = 0x7800,
27                 NBT_FLAG_REPLY              = 0x8000
28         } nbt_operation;
29
30         /* the opcodes are in the operation field, masked with
31            NBT_OPCODE */
32         typedef enum {
33                 NBT_OPCODE_QUERY          =  (0x0<<11),
34                 NBT_OPCODE_REGISTER       =  (0x5<<11),
35                 NBT_OPCODE_RELEASE        =  (0x6<<11),
36                 NBT_OPCODE_WACK           =  (0x7<<11),
37                 NBT_OPCODE_REFRESH        =  (0x8<<11),
38                 NBT_OPCODE_REFRESH2       =  (0x9<<11),
39                 NBT_OPCODE_MULTI_HOME_REG =  (0xf<<11)
40         } nbt_opcode;
41
42         /* rcode values */
43         typedef enum {
44                 NBT_RCODE_OK  = 0x0,
45                 NBT_RCODE_FMT = 0x1,
46                 NBT_RCODE_SVR = 0x2,
47                 NBT_RCODE_NAM = 0x3,
48                 NBT_RCODE_IMP = 0x4,
49                 NBT_RCODE_RFS = 0x5,
50                 NBT_RCODE_ACT = 0x6,
51                 NBT_RCODE_CFT = 0x7
52         } nbt_rcode;
53
54         /* we support any 8bit name type, but by defining the common
55            ones here we get better debug displays */
56         typedef [enum8bit] enum {
57                 NBT_NAME_CLIENT   = 0x00,
58                 NBT_NAME_MS       = 0x01,
59                 NBT_NAME_USER     = 0x03,
60                 NBT_NAME_SERVER   = 0x20,
61                 NBT_NAME_PDC      = 0x1B,
62                 NBT_NAME_LOGON    = 0x1C,
63                 NBT_NAME_MASTER   = 0x1D,
64                 NBT_NAME_BROWSER  = 0x1E
65         } nbt_name_type;
66
67         /* the ndr parser for nbt_name is separately defined in
68            nbtname.c (along with the parsers for nbt_string) */
69         typedef [public,nopull,nopush] struct {
70                 string        name;
71                 string        scope;
72                 nbt_name_type type;
73         } nbt_name;
74
75         typedef [enum16bit] enum {
76                 NBT_QCLASS_IP = 0x01
77         } nbt_qclass;
78
79         typedef [enum16bit] enum {
80                 NBT_QTYPE_ADDRESS     = 0x0001,
81                 NBT_QTYPE_NAMESERVICE = 0x0002,
82                 NBT_QTYPE_NULL        = 0x000A,
83                 NBT_QTYPE_NETBIOS     = 0x0020,
84                 NBT_QTYPE_STATUS      = 0x0021
85         } nbt_qtype;
86
87         typedef struct {
88                 nbt_name   name;
89                 nbt_qtype  question_type;
90                 nbt_qclass question_class;
91         } nbt_name_question;
92
93         /* these are the possible values of the NBT_NM_OWNER_TYPE
94            field */
95         typedef enum {
96                 NBT_NODE_B = 0x0000,
97                 NBT_NODE_P = 0x2000,
98                 NBT_NODE_M = 0x4000,
99                 NBT_NODE_H = 0x6000
100         } nbt_node_type;
101
102         typedef [bitmap16bit] bitmap {
103                 NBT_NM_PERMANENT        = 0x0200,
104                 NBT_NM_ACTIVE           = 0x0400,
105                 NBT_NM_CONFLICT         = 0x0800,
106                 NBT_NM_DEREGISTER       = 0x1000,
107                 NBT_NM_OWNER_TYPE       = 0x6000,
108                 NBT_NM_GROUP            = 0x8000
109         } nb_flags;
110
111         typedef struct {
112                 nb_flags nb_flags;
113                 ipv4address ipaddr;
114         } nbt_rdata_address;
115
116         typedef struct {
117                 uint16 length;
118                 nbt_rdata_address addresses[length/6];
119         } nbt_rdata_netbios;
120
121         typedef struct {
122                 uint8 unit_id[6];
123                 uint8 jumpers;
124                 uint8 test_result;
125                 uint16 version_number;
126                 uint16 period_of_statistics;
127                 uint16 number_of_crcs;
128                 uint16 number_alignment_errors;
129                 uint16 number_of_collisions;
130                 uint16 number_send_aborts;
131                 uint32 number_good_sends;
132                 uint32 number_good_receives;
133                 uint16 number_retransmits;
134                 uint16 number_no_resource_conditions;
135                 uint16 number_free_command_blocks;
136                 uint16 total_number_command_blocks;
137                 uint16 max_total_number_command_blocks;
138                 uint16 number_pending_sessions;
139                 uint16 max_number_pending_sessions;
140                 uint16 max_total_sessions_possible;
141                 uint16 session_data_packet_size;
142         } nbt_statistics;
143
144         typedef struct {
145                 astring15 name;
146                 nbt_name_type type;
147                 nb_flags  nb_flags;
148         } nbt_status_name;
149
150         typedef struct {
151                 [value(num_names * 18 + 47)] uint16 length;
152                 uint8 num_names;
153                 nbt_status_name names[num_names];
154                 nbt_statistics  statistics;
155         } nbt_rdata_status;
156
157         typedef struct {
158                 uint16 length;
159                 uint8  data[length];
160         } nbt_rdata_data;
161
162         typedef [nodiscriminant] union {
163                 [case(NBT_QTYPE_NETBIOS)] nbt_rdata_netbios netbios;
164                 [case(NBT_QTYPE_STATUS)]  nbt_rdata_status status;
165                 [default]                 nbt_rdata_data   data;
166         } nbt_rdata;
167
168         typedef [flag(LIBNDR_PRINT_ARRAY_HEX)] struct {
169                 nbt_name   name;
170                 nbt_qtype  rr_type;
171                 nbt_qclass rr_class;
172                 uint32     ttl;
173                 [switch_is(rr_type)] nbt_rdata rdata;
174         } nbt_res_rec;
175
176         typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
177                 uint16            name_trn_id;
178                 nbt_operation     operation;
179                 uint16            qdcount;
180                 uint16            ancount;
181                 uint16            nscount;
182                 uint16            arcount;
183                 nbt_name_question questions[qdcount];
184                 nbt_res_rec       answers[ancount];
185                 nbt_res_rec       nsrecs[nscount];
186                 nbt_res_rec       additional[arcount];
187                 [flag(NDR_REMAINING)] DATA_BLOB padding;
188         } nbt_name_packet;
189
190
191         /*
192           NBT DGRAM packets (UDP/138)
193         */
194
195         typedef [enum8bit] enum {
196                 DGRAM_DIRECT_UNIQUE  = 0x10,
197                 DGRAM_DIRECT_GROUP   = 0x11,
198                 DGRAM_BCAST          = 0x12,
199                 DGRAM_ERROR          = 0x13,
200                 DGRAM_QUERY          = 0x14,
201                 DGRAM_QUERY_POSITIVE = 0x15,
202                 DGRAM_QUERY_NEGATIVE = 0x16
203         } dgram_msg_type;
204
205         typedef [bitmap8bit] bitmap {
206                 DGRAM_FLAG_MORE         = 0x01,
207                 DGRAM_FLAG_FIRST        = 0x02,
208                 DGRAM_FLAG_NODE_TYPE    = 0x0C
209         } dgram_flags;
210
211         typedef [enum8bit] enum {
212                 DGRAM_NODE_B    = 0x00,
213                 DGRAM_NODE_P    = 0x04,
214                 DGRAM_NODE_M    = 0x08,
215                 DGRAM_NODE_NBDD = 0x0C
216         } dgram_node_type;
217
218         /* a dgram_message is the main dgram body in general use */
219
220         /* the most common datagram type is a SMB_TRANSACTION
221            operation, where a SMB packet is used in the data section
222            of a dgram_message to hold a trans request, which in turn
223            holds a small command structure. It's a very strange beast
224            indeed. To make the code cleaner we define a basic SMB
225            packet in IDL here. This is not a general purpose SMB
226            packet, and won't be used in the core SMB client/server
227            code, but it does make working with these types of dgrams
228            easier */
229
230         const string NBT_MAILSLOT_NETLOGON = "\\MAILSLOT\\NET\\NETLOGON";
231         const string NBT_MAILSLOT_NTLOGON  = "\\MAILSLOT\\NET\\NTLOGON";
232         const string NBT_MAILSLOT_GETDC    = "\\MAILSLOT\\GETDC";
233         const string NBT_MAILSLOT_BROWSE   = "\\MAILSLOT\\BROWSE";
234
235         typedef [enum8bit] enum {
236                 SMB_TRANSACTION = 0x25
237         } smb_command;
238
239         typedef struct {
240                 [range(17,17),value(17)] uint8 wct;
241                 uint16                      total_param_count;
242                 uint16                      total_data_count;
243                 uint16                      max_param_count;
244                 uint16                      max_data_count;
245                 uint8                       max_setup_count;
246                 uint8                       pad;
247                 uint16                      trans_flags;
248                 uint32                      timeout;
249                 uint16                      reserved;
250                 uint16                      param_count;
251                 uint16                      param_offset;
252                 uint16                      data_count;
253                 uint16                      data_offset;
254                 [range(3,3),value(3)] uint8 setup_count;
255                 uint8                       pad2;
256                 uint16                      opcode;
257                 uint16                      priority;
258                 uint16                      class;
259                 [value(strlen(mailslot_name)+1+r->data.length)] 
260                       uint16                byte_count;
261                 astring                     mailslot_name;
262                 [flag(NDR_REMAINING)]       DATA_BLOB data;
263         } smb_trans_body;
264
265         typedef [nodiscriminant] union {
266                 [case(SMB_TRANSACTION)] smb_trans_body trans;
267         } smb_body;
268
269
270         typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN|NDR_PAHEX),public] struct {
271                 smb_command                smb_command;
272                 uint8                      err_class;
273                 uint8                      pad;
274                 uint16                     err_code;
275                 uint8                      flags;
276                 uint16                     flags2;
277                 uint16                     pid_high;
278                 uint8                      signature[8];
279                 uint16                     reserved;
280                 uint16                     tid;
281                 uint16                     pid;
282                 uint16                     vuid;
283                 uint16                     mid;
284                 [switch_is(smb_command)]   smb_body body;
285         } dgram_smb_packet;
286
287         const uint32 DGRAM_SMB = 0xff534d42; /* 0xffSMB */
288
289         typedef [nodiscriminant] union {
290                 [case(DGRAM_SMB)] dgram_smb_packet smb;
291         } dgram_message_body;
292
293         typedef struct {
294                 uint16          length;
295                 uint16          offset;
296                 nbt_name        source_name;
297                 nbt_name        dest_name;
298                 uint32          dgram_body_type;
299                 [switch_is(dgram_body_type)] dgram_message_body body;
300         } dgram_message;
301
302         typedef [enum8bit] enum {
303                 DGRAM_ERROR_NAME_NOT_PRESENT = 0x82,
304                 DGRAM_ERROR_INVALID_SOURCE   = 0x83,
305                 DGRAM_ERROR_INVALID_DEST     = 0x84
306         } dgram_err_code;
307
308         typedef [nodiscriminant] union {
309                 [case(DGRAM_DIRECT_UNIQUE)]   dgram_message  msg;
310                 [case(DGRAM_DIRECT_GROUP)]    dgram_message  msg;
311                 [case(DGRAM_BCAST)]           dgram_message  msg;
312                 [case(DGRAM_ERROR)]           dgram_err_code error;
313                 [case(DGRAM_QUERY)]           nbt_name       dest_name;
314                 [case(DGRAM_QUERY_POSITIVE)]  nbt_name       dest_name;
315                 [case(DGRAM_QUERY_NEGATIVE)]  nbt_name       dest_name;
316         } dgram_data;
317
318         typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
319                 dgram_msg_type msg_type;
320                 dgram_flags    flags;
321                 uint16         dgram_id;
322                 ipv4address    src_addr;
323                 uint16         src_port;
324                 [switch_is(msg_type)] dgram_data data;
325         } nbt_dgram_packet;
326
327
328         /*******************************************/
329         /* \MAILSLOT\NET\NETLOGON mailslot requests */
330         typedef enum {
331                 NETLOGON_QUERY_FOR_PDC           = 0x7, 
332                 NETLOGON_ANNOUNCE_UAS            = 0xa,
333                 NETLOGON_RESPONSE_FROM_PDC       = 0xc,
334                 NETLOGON_QUERY_FOR_PDC2          = 0x12,
335                 NETLOGON_RESPONSE_FROM_PDC2      = 0x17,
336                 NETLOGON_RESPONSE_FROM_PDC_USER  = 0x19
337         } nbt_netlogon_command;
338
339         /* query for pdc request */
340         typedef struct {
341                 astring              computer_name;
342                 astring              mailslot_name;
343                 [flag(NDR_ALIGN2)]   DATA_BLOB _pad;
344                 nstring              unicode_name;
345                 uint32               nt_version;
346                 uint16               lmnt_token;
347                 uint16               lm20_token;
348         } nbt_netlogon_query_for_pdc;
349
350         /* query for pdc request - new style */
351         typedef struct {
352                 uint16               request_count;
353                 nstring              computer_name;
354                 nstring              user_name;
355                 astring              mailslot_name;
356                 uint32               unknown[2];
357                 uint32               nt_version;
358                 uint16               lmnt_token;
359                 uint16               lm20_token;
360         } nbt_netlogon_query_for_pdc2;
361
362         /* response from pdc */
363         typedef struct {
364                 astring pdc_name;
365                 [flag(NDR_ALIGN2)]   DATA_BLOB _pad;
366                 nstring              unicode_pdc_name;
367                 nstring              domain_name;
368                 uint32               nt_version;
369                 uint16               lmnt_token;
370                 uint16               lm20_token;
371         } nbt_netlogon_response_from_pdc;
372
373         typedef [bitmap32bit] bitmap {
374                 NBT_SERVER_PDC           = 0x00000001,
375                 NBT_SERVER_GC            = 0x00000004,
376                 NBT_SERVER_LDAP          = 0x00000008,
377                 NBT_SERVER_DS            = 0x00000010,
378                 NBT_SERVER_KDC           = 0x00000020,
379                 NBT_SERVER_TIMESERV      = 0x00000040,
380                 NBT_SERVER_CLOSEST       = 0x00000080,
381                 NBT_SERVER_WRITABLE      = 0x00000100, 
382                 NBT_SERVER_GOOD_TIMESERV = 0x00000200
383         } nbt_server_type;
384
385         /* response from pdc - type2 */
386         typedef struct {
387                 [flag(NDR_ALIGN4)]   DATA_BLOB _pad;
388                 nbt_server_type      server_type;
389                 GUID                 domain_uuid;
390                 nbt_string           forest;
391                 nbt_string           dns_domain;
392                 nbt_string           pdc_dns_name;
393                 nbt_string           domain;
394                 nbt_string           pdc_name;
395                 nbt_string           user_name;
396                 nbt_string           site_name;
397                 nbt_string           site_name2;
398                 uint8                unknown;
399                 uint32               unknown2;
400                 [flag(NDR_BIG_ENDIAN)] 
401                   ipv4address          pdc_ip;
402                 uint32               unknown3[2];
403                 uint32               nt_version;
404                 uint16               lmnt_token;
405                 uint16               lm20_token;
406         } nbt_netlogon_response_from_pdc2;
407
408         declare enum netr_SamDatabaseID;
409
410         /* announce change to UAS or SAM */
411         typedef struct {
412                 netr_SamDatabaseID   db_index;
413                 hyper                serial;
414                 NTTIME               timestamp;
415         } nbt_db_change;
416
417         /* used to announce SAM changes */
418         typedef struct {
419                 uint32           serial_lo;
420                 time_t           timestamp;
421                 uint32           pulse;
422                 uint32           random;
423                 astring          pdc_name;
424                 astring          domain;
425                 [flag(NDR_ALIGN2)] DATA_BLOB _pad;
426                 nstring          unicode_pdc_name;
427                 nstring          unicode_domain;
428                 uint32           db_count;
429                 nbt_db_change    dbchange[db_count];
430                 [value(ndr_size_dom_sid(&sid, ndr->flags))] uint32 sid_size;
431                 [flag(NDR_ALIGN4)] DATA_BLOB _pad2;
432                 dom_sid          sid;
433                 uint32           nt_version;
434                 uint16           lmnt_token;
435                 uint16           lm20_token;
436         } nbt_netlogon_announce_uas;
437
438         typedef [nodiscriminant] union {
439                 [case(NETLOGON_QUERY_FOR_PDC)] nbt_netlogon_query_for_pdc pdc;
440                 [case(NETLOGON_QUERY_FOR_PDC2)] nbt_netlogon_query_for_pdc2 pdc2;
441                 [case(NETLOGON_ANNOUNCE_UAS)] nbt_netlogon_announce_uas uas;
442                 [case(NETLOGON_RESPONSE_FROM_PDC)] nbt_netlogon_response_from_pdc response;
443                 [case(NETLOGON_RESPONSE_FROM_PDC2)] nbt_netlogon_response_from_pdc2 response2;
444                 [case(NETLOGON_RESPONSE_FROM_PDC_USER)] nbt_netlogon_response_from_pdc2 response2;
445         } nbt_netlogon_request;
446
447         typedef [flag(NDR_NOALIGN),public] struct {
448                 nbt_netlogon_command command;
449                 [switch_is(command)] nbt_netlogon_request req;
450         } nbt_netlogon_packet;
451
452         /*******************************************/
453         /* CLDAP netlogon response                 */
454
455         /* note that these structures are very similar to, but not
456            quite identical to, the netlogon structures above */
457
458         typedef struct {
459                 uint16               type;
460                 nstring              pdc_name;
461                 nstring              user_name;
462                 nstring              domain_name;
463                 [value(1)] uint32    nt_version;
464                 uint16               lmnt_token;
465                 uint16               lm20_token;                
466         } nbt_cldap_netlogon_1;
467
468         typedef struct {
469                 uint16               type;
470                 nstring              pdc_name;
471                 nstring              user_name;
472                 nstring              domain_name;
473                 GUID                 domain_uuid;
474                 GUID                 unknown_uuid;
475                 nbt_string           forest;
476                 nbt_string           dns_domain;
477                 nbt_string           pdc_dns_name;
478                 ipv4address          pdc_ip;
479                 nbt_server_type      server_type;
480                 [value(3)] uint32    nt_version;
481                 uint16               lmnt_token;
482                 uint16               lm20_token;                
483         } nbt_cldap_netlogon_3;
484
485         typedef struct {
486                 uint32               type;
487                 nbt_server_type      server_type;
488                 GUID                 domain_uuid;
489                 nbt_string           forest;
490                 nbt_string           dns_domain;
491                 nbt_string           pdc_dns_name;
492                 nbt_string           domain;
493                 nbt_string           pdc_name;
494                 nbt_string           user_name;
495                 nbt_string           site_name;
496                 nbt_string           site_name2;
497                 [value(5)] uint32    nt_version;
498                 uint16               lmnt_token;
499                 uint16               lm20_token;
500         } nbt_cldap_netlogon_5;
501
502         typedef struct {
503                 uint32               type;
504                 nbt_server_type      server_type;
505                 GUID                 domain_uuid;
506                 nbt_string           forest;
507                 nbt_string           dns_domain;
508                 nbt_string           pdc_dns_name;
509                 nbt_string           domain;
510                 nbt_string           pdc_name;
511                 nbt_string           user_name;
512                 nbt_string           site_name;
513                 nbt_string           site_name2;
514                 uint8                unknown;
515                 uint32               unknown2;
516                 [flag(NDR_BIG_ENDIAN)] 
517                   ipv4address          pdc_ip;
518                 uint32               unknown3[2];
519                 [value(13)] uint32   nt_version;
520                 uint16               lmnt_token;
521                 uint16               lm20_token;
522         } nbt_cldap_netlogon_13;
523
524         typedef [flag(NDR_NOALIGN),public,nodiscriminant] union {
525                 [case(0)]  nbt_cldap_netlogon_1 logon1;
526                 [case(1)]  nbt_cldap_netlogon_1 logon1;
527                 [case(2)]  nbt_cldap_netlogon_3 logon3;
528                 [case(3)]  nbt_cldap_netlogon_3 logon3;
529                 [case(4)]  nbt_cldap_netlogon_5 logon5;
530                 [case(5)]  nbt_cldap_netlogon_5 logon5;
531                 [case(6)]  nbt_cldap_netlogon_5 logon5;
532                 [case(7)]  nbt_cldap_netlogon_5 logon5;
533                 [default]  nbt_cldap_netlogon_13 logon13;
534         } nbt_cldap_netlogon;
535
536         /*******************************************/
537         /* \MAILSLOT\NET\NTLOGON mailslot requests */
538         typedef enum {
539                 NTLOGON_SAM_LOGON         = 0x12,
540                 NTLOGON_SAM_LOGON_REPLY   = 0x13,
541                 NTLOGON_SAM_LOGON_REPLY15 = 0x15
542         } nbt_ntlogon_command;
543
544         typedef struct {
545                 uint16               request_count;
546                 nstring              computer_name;
547                 nstring              user_name;
548                 astring              mailslot_name;
549                 uint32               acct_control;
550                 [value(ndr_size_dom_sid(&sid, ndr->flags))] uint32 sid_size;
551                 [flag(NDR_ALIGN4)]   DATA_BLOB _pad;
552                 dom_sid              sid;
553                 uint32               nt_version;
554                 uint16               lmnt_token;
555                 uint16               lm20_token;
556         } nbt_ntlogon_sam_logon;
557
558         typedef struct {
559                 nstring              server;
560                 nstring              user_name;
561                 nstring              domain;
562                 uint32               nt_version;
563                 uint16               lmnt_token;
564                 uint16               lm20_token;
565         } nbt_ntlogon_sam_logon_reply;
566
567         typedef [nodiscriminant] union {
568                 [case(NTLOGON_SAM_LOGON)]       nbt_ntlogon_sam_logon logon;
569                 [case(NTLOGON_SAM_LOGON_REPLY)] nbt_ntlogon_sam_logon_reply reply;
570                 [case(NTLOGON_SAM_LOGON_REPLY15)] nbt_ntlogon_sam_logon_reply reply;
571         } nbt_ntlogon_request;
572
573         typedef [flag(NDR_NOALIGN),public] struct {
574                 nbt_ntlogon_command command;
575                 [switch_is(command)] nbt_ntlogon_request req;
576         } nbt_ntlogon_packet;
577
578         /********************************************************/
579         /* \MAILSLOT\BROWSE mailslot requests                   */
580         /* for details see http://ubiqx.org/cifs/Browsing.html  */
581         /********************************************************/
582         declare bitmap svcctl_ServerType;
583
584         typedef [enum8bit] enum { 
585                 HostAnnouncement        = 1,
586                 AnnouncementRequest     = 2,
587                 Election                = 8,
588                 GetBackupListReq        = 9,
589                 GetBackupListResp       = 10,
590                 BecomeBackup            = 11,
591                 DomainAnnouncement      = 12,
592                 MasterAnnouncement      = 13,
593                 ResetBrowserState       = 14,
594                 LocalMasterAnnouncement = 15
595         } nbt_browse_opcode;
596
597         typedef struct {
598                 uint8 UpdateCount;
599                 uint32 Periodicity;
600                 [charset(DOS)] uint8 ServerName[16];
601                 uint8 OSMajor;
602                 uint8 OSMinor;
603                 svcctl_ServerType ServerType;
604                 uint8 BroMajorVer;
605                 uint8 BroMinorVer;
606                 uint16 Signature;
607                 astring Comment;
608         } nbt_browse_host_announcement;
609
610         typedef struct {
611                 uint8 Unused;
612                 astring ResponseName; 
613         } nbt_browse_announcement_request;
614
615         typedef struct {
616                 uint8 Version;
617                 uint32 Criteria;
618                 uint32 UpTime; /* In milliseconds */
619                 uint32 Reserved; /* Must be zero */
620                 astring ServerName; 
621         } nbt_browse_election_request;
622
623         typedef struct {
624                 uint8 ReqCount;
625                 uint32 Token;
626         } nbt_browse_backup_list_request;
627
628         typedef struct {
629                 uint8 BackupCount;
630                 uint32 Token;
631                 nbt_name BackupServerList[BackupCount];/* TODO: this is wrong */
632         } nbt_browse_backup_list_response;
633
634         typedef struct {
635                 astring BrowserName;
636         } nbt_browse_become_backup;
637
638         typedef struct {
639                 uint8 UpdateCount;
640                 uint32 Periodicity;
641                 [charset(DOS)] uint8 ServerName[16];
642                 uint8 OSMajor;
643                 uint8 OSMinor;
644                 svcctl_ServerType ServerType;
645                 uint32 MysteriousField;
646                 astring Comment;
647         } nbt_browse_domain_announcement;
648
649         typedef struct {
650                 astring ServerName;
651         } nbt_browse_master_announcement;
652
653         typedef struct {
654                 uint8 Command;
655         } nbt_browse_reset_state;
656
657         typedef struct {
658                 uint8 UpdateCount;
659                 uint32 Periodicity;
660                 [charset(DOS)] uint8 ServerName[16];
661                 uint8 OSMajor;
662                 uint8 OSMinor;
663                 svcctl_ServerType ServerType;
664                 uint8 BroMajorVer;
665                 uint8 BroMinorVer;
666                 uint16 Signature;
667                 astring Comment;
668         } nbt_browse_local_master_announcement;
669
670         typedef [nodiscriminant] union {
671                 [case(HostAnnouncement)] nbt_browse_host_announcement host_annoucement;
672                 [case(AnnouncementRequest)] nbt_browse_announcement_request announcement_request;
673                 [case(Election)] nbt_browse_election_request election_request;
674                 [case(GetBackupListReq)] nbt_browse_backup_list_request backup_list_request;
675                 [case(GetBackupListResp)] nbt_browse_backup_list_response backup_list_response;
676                 [case(BecomeBackup)] nbt_browse_become_backup become_backup;
677                 [case(DomainAnnouncement)] nbt_browse_domain_announcement domain_announcement;
678                 [case(MasterAnnouncement)] nbt_browse_master_announcement master_announcement;
679                 [case(ResetBrowserState)] nbt_browse_reset_state reset_browser_state;
680                 [case(LocalMasterAnnouncement)] nbt_browse_local_master_announcement local_master_announcement;
681         } nbt_browse_payload;
682
683         typedef [public,flag(NDR_NOALIGN)] struct {
684                 nbt_browse_opcode opcode;
685                 [switch_is(opcode)] nbt_browse_payload payload; 
686         } nbt_browse_packet;
687 }