r10126: WREPL_REPL_UPDATE also takes a wrepl_table
[kai/samba.git] / source4 / librpc / idl / winsrepl.idl
1 #include "idl_types.h"
2
3 /*
4    IDL structures for WINS replication protocol (port 42)
5
6    Note that WINS replication is not traditionally encoded using
7    IDL/NDR
8
9    Written by Andrew Tridgell <tridge@osdl.org>
10 */
11
12 [
13   uuid("0-1-2-3-4"),
14   version(0.0),
15   pointer_default(unique),
16   pointer_default_top(unique)
17 ]
18 interface wrepl
19 {
20         const int WINS_REPLICATION_PORT = 42;
21
22         typedef [flag(NDR_BIG_ENDIAN)] struct {
23                 ipv4address owner;
24                 ipv4address ip;
25         } wrepl_ip;
26
27         typedef [flag(NDR_LITTLE_ENDIAN)] struct {
28                 uint32      num_ips;
29                 wrepl_ip    ips[num_ips];
30                 ipv4address unknown;
31         } wrepl_address_list;
32
33         typedef [nodiscriminant] union {
34                 [case(0)] wrepl_ip           address;
35                 [case(2)] wrepl_address_list addresses;
36         } wrepl_addresses;
37
38         typedef struct {
39                 uint32    name_len;
40                 uint8     name[name_len];
41                 uint32    flags;
42                 [flag(NDR_LITTLE_ENDIAN)] uint32 group_flag;
43                 udlongr   id;
44                 [switch_is(flags & 2)] wrepl_addresses addresses;
45         } wrepl_wins_name;
46
47         typedef struct {
48                 uint32          num_names;
49                 wrepl_wins_name names[num_names];
50         } wrepl_send_reply;
51
52         typedef struct {
53                 ipv4address address;
54                 udlongr     max_version;
55                 udlongr     min_version;
56                 uint32      type;
57         } wrepl_wins_owner;
58
59         typedef struct {
60                 uint32           partner_count;
61                 wrepl_wins_owner partners[partner_count];
62                 ipv4address      initiator;
63         } wrepl_table;
64
65         typedef [v1_enum] enum {
66                 WREPL_REPL_TABLE_QUERY  = 0,
67                 WREPL_REPL_TABLE_REPLY  = 1,
68                 WREPL_REPL_SEND_REQUEST = 2,
69                 WREPL_REPL_SEND_REPLY   = 3,
70                 WREPL_REPL_UPDATE       = 4,
71                 WREPL_REPL_5            = 5,
72                 WREPL_REPL_INFORM       = 8,
73                 WREPL_REPL_9            = 9
74         } wrepl_replication_cmd;
75
76         typedef [nodiscriminant] union {
77                 [case(WREPL_REPL_TABLE_QUERY)] ;
78                 [case(WREPL_REPL_TABLE_REPLY)]  wrepl_table      table;
79                 [case(WREPL_REPL_SEND_REQUEST)] wrepl_wins_owner owner;
80                 [case(WREPL_REPL_SEND_REPLY)]   wrepl_send_reply reply;
81                 [case(WREPL_REPL_UPDATE)]       wrepl_table      table;
82                 [case(WREPL_REPL_5)]            wrepl_table      table;
83                 [case(WREPL_REPL_INFORM)]       wrepl_table      table;
84                 [case(WREPL_REPL_9)]            wrepl_table      table;
85         } wrepl_replication_info;
86
87         typedef struct {
88                 wrepl_replication_cmd command;
89                 [switch_is(command)] wrepl_replication_info info;
90         } wrepl_replication;
91
92         typedef struct {
93                 uint32 assoc_ctx;
94                 uint16 minor_version;
95                 uint16 major_version;
96         } wrepl_start;
97
98         typedef struct {
99                 uint32 reason;
100         } wrepl_stop;
101
102         typedef [v1_enum] enum {
103                 WREPL_START_ASSOCIATION       = 0,
104                 WREPL_START_ASSOCIATION_REPLY = 1,
105                 WREPL_STOP_ASSOCIATION        = 2,
106                 WREPL_REPLICATION             = 3
107         } wrepl_mess_type;
108
109         typedef [nodiscriminant] union {
110                 [case(WREPL_START_ASSOCIATION)]       wrepl_start start;
111                 [case(WREPL_START_ASSOCIATION_REPLY)] wrepl_start start_reply;
112                 [case(WREPL_STOP_ASSOCIATION)]        wrepl_stop stop;
113                 [case(WREPL_REPLICATION)]             wrepl_replication replication;
114         } wrepl_message;
115
116         /*
117           the opcode appears to be a bitfield, but as far as I can tell
118           you must always set the following bits. Additional bits don't
119           seem to matter. Very strange.
120         */
121         const int WREPL_OPCODE_BITS = 0x7800;
122
123
124         typedef [gensize,flag(NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
125                 uint32                 opcode;
126                 uint32                 assoc_ctx;
127                 wrepl_mess_type        mess_type;
128                 [switch_is(mess_type)] wrepl_message message;
129                 [flag(NDR_REMAINING)] DATA_BLOB padding;
130         } wrepl_packet;
131
132         typedef [flag(NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
133                 [value(ndr_size_wrepl_packet(&packet, ndr->flags))] uint32 size;
134                 wrepl_packet    packet;
135         } wrepl_wrap;
136
137         void decode_winsrepl(
138                 [in] wrepl_wrap p
139                 );
140
141 }