r5414: - added libcli/wins/, a basic client library for WINS replication
[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 ]
17 interface wrepl
18 {
19         const int WINS_REPLICATION_PORT = 42;
20
21         typedef [flag(NDR_BIG_ENDIAN)] struct {
22                 ipv4address owner;
23                 ipv4address ip;
24         } wrepl_ip;
25
26         typedef [flag(NDR_LITTLE_ENDIAN)] struct {
27                 uint32      num_ips;
28                 wrepl_ip    ips[num_ips];
29                 ipv4address unknown;
30         } wrepl_address_list;
31
32         typedef [nodiscriminant] union {
33                 [case(0)] wrepl_ip           address;
34                 [case(2)] wrepl_address_list addresses;
35         } wrepl_addresses;
36
37         typedef struct {
38                 uint32    name_len;
39                 uint8     name[name_len];
40                 uint32    flags;
41                 [flag(NDR_LITTLE_ENDIAN)] uint32 group_flag;
42                 udlongr   id;
43                 [switch_is(flags & 2)] wrepl_addresses addresses;
44         } wrepl_wins_name;
45
46         typedef struct {
47                 uint32          num_names;
48                 wrepl_wins_name names[num_names];
49         } wrepl_send_reply;
50
51         typedef struct {
52                 ipv4address address;
53                 udlongr     max_version;
54                 udlongr     min_version;
55                 uint32      type;
56         } wrepl_wins_owner;
57
58         typedef struct {
59                 uint32           partner_count;
60                 wrepl_wins_owner partners[partner_count];
61                 ipv4address      initiator;
62         } wrepl_table;
63
64         typedef [v1_enum] enum {
65                 WREPL_REPL_TABLE_QUERY  = 0,
66                 WREPL_REPL_TABLE_REPLY  = 1,
67                 WREPL_REPL_SEND_REQUEST = 2,
68                 WREPL_REPL_SEND_REPLY   = 3,
69                 WREPL_REPL_UPDATE       = 4,
70                 WREPL_REPL_INFORM       = 8
71         } wrepl_replication_cmd;
72
73         typedef [nodiscriminant] union {
74                 [case(WREPL_REPL_TABLE_QUERY)] ;
75                 [case(WREPL_REPL_TABLE_REPLY)]  wrepl_table      table;
76                 [case(WREPL_REPL_SEND_REQUEST)] wrepl_wins_owner owner;
77                 [case(WREPL_REPL_SEND_REPLY)]   wrepl_send_reply reply;
78                 [case(WREPL_REPL_UPDATE)] ;
79                 [case(WREPL_REPL_INFORM)]       wrepl_table      table;
80         } wrepl_replication_info;
81
82         typedef struct {
83                 wrepl_replication_cmd command;
84                 [switch_is(command)] wrepl_replication_info info;
85         } wrepl_replication;
86
87         typedef struct {
88                 uint32 assoc_ctx;
89                 uint16 minor_version;
90                 uint16 major_version;
91         } wrepl_start;
92
93         typedef struct {
94                 uint32 reason;
95         } wrepl_stop;
96
97         typedef [v1_enum] enum {
98                 WREPL_START_ASSOCIATION       = 0,
99                 WREPL_START_ASSOCIATION_REPLY = 1,
100                 WREPL_STOP_ASSOCIATION        = 2,
101                 WREPL_REPLICATION             = 3
102         } wrepl_mess_type;
103
104         typedef [nodiscriminant] union {
105                 [case(WREPL_START_ASSOCIATION)]       wrepl_start start;
106                 [case(WREPL_START_ASSOCIATION_REPLY)] wrepl_start start_reply;
107                 [case(WREPL_STOP_ASSOCIATION)]        wrepl_stop stop;
108                 [case(WREPL_REPLICATION)]             wrepl_replication replication;
109         } wrepl_message;
110
111         /*
112           the opcode appears to be a bitfield, but as far as I can tell
113           you must always set the following bits. Additional bits don't
114           seem to matter. Very strange.
115         */
116         const int WREPL_OPCODE_BITS = 0x7800;
117
118
119         typedef [gensize,flag(NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
120                 uint32                 opcode;
121                 uint32                 assoc_ctx;
122                 wrepl_mess_type        mess_type;
123                 [switch_is(mess_type)] wrepl_message message;
124                 [flag(NDR_REMAINING)] DATA_BLOB padding;
125         } wrepl_packet;
126
127         typedef [flag(NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
128                 [value(ndr_size_wrepl_packet(&r->packet, ndr->flags))] uint32 size;
129                 wrepl_packet    packet;
130         } wrepl_wrap;
131
132         void decode_winsrepl(
133                 [in] wrepl_wrap p
134                 );
135
136 }