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 | import "nbt.idl";
|
---|
13 |
|
---|
14 | [
|
---|
15 | uuid("915f5653-bac1-431c-97ee-9ffb34526921"),
|
---|
16 | helpstring("WINS Replication PDUs")
|
---|
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 | } wrepl_address_list;
|
---|
30 |
|
---|
31 | typedef [nodiscriminant] union {
|
---|
32 | [case(0)] ipv4address ip;
|
---|
33 | [case(2)] wrepl_address_list addresses;
|
---|
34 | } wrepl_addresses;
|
---|
35 |
|
---|
36 | typedef [enum8bit] enum {
|
---|
37 | WREPL_TYPE_UNIQUE = 0x0,
|
---|
38 | WREPL_TYPE_GROUP = 0x1,
|
---|
39 | WREPL_TYPE_SGROUP = 0x2,
|
---|
40 | WREPL_TYPE_MHOMED = 0x3
|
---|
41 | } wrepl_name_type;
|
---|
42 |
|
---|
43 | typedef [enum8bit] enum {
|
---|
44 | WREPL_STATE_ACTIVE = 0x0,
|
---|
45 | WREPL_STATE_RELEASED = 0x1,
|
---|
46 | WREPL_STATE_TOMBSTONE = 0x2,
|
---|
47 | WREPL_STATE_RESERVED = 0x3
|
---|
48 | } wrepl_name_state;
|
---|
49 |
|
---|
50 | typedef [enum8bit] enum {
|
---|
51 | WREPL_NODE_B = 0x0,
|
---|
52 | WREPL_NODE_P = 0x1,
|
---|
53 | WREPL_NODE_M = 0x2,
|
---|
54 | WREPL_NODE_H = 0x3
|
---|
55 | } wrepl_name_node;
|
---|
56 |
|
---|
57 | typedef [bitmap32bit] bitmap {
|
---|
58 | WREPL_FLAGS_RECORD_TYPE = 0x00000003,
|
---|
59 | WREPL_FLAGS_RECORD_STATE = 0x0000000C,
|
---|
60 | WREPL_FLAGS_REGISTERED_LOCAL = 0x00000010,
|
---|
61 | WREPL_FLAGS_NODE_TYPE = 0x00000060,
|
---|
62 | WREPL_FLAGS_IS_STATIC = 0x00000080
|
---|
63 | } wrepl_flags;
|
---|
64 |
|
---|
65 | typedef [v1_enum] enum {
|
---|
66 | WREPL_GROUP_FLAG_NO_GROUP = 0x00000000,
|
---|
67 | WREPL_GROUP_FLAG_IS_GROUP = 0x00000001
|
---|
68 | } wrepl_group_flag;
|
---|
69 |
|
---|
70 | #define WREPL_IS_GROUP(flags) (\
|
---|
71 | ((((flags) & WREPL_FLAGS_RECORD_TYPE) == WREPL_TYPE_GROUP)|| \
|
---|
72 | (((flags) & WREPL_FLAGS_RECORD_TYPE) == WREPL_TYPE_SGROUP))\
|
---|
73 | ? WREPL_GROUP_FLAG_IS_GROUP : WREPL_GROUP_FLAG_NO_GROUP)
|
---|
74 |
|
---|
75 | typedef struct {
|
---|
76 | wrepl_nbt_name name;
|
---|
77 | wrepl_flags flags;
|
---|
78 | [flag(NDR_LITTLE_ENDIAN),value(WREPL_IS_GROUP(flags))] wrepl_group_flag is_group;
|
---|
79 | udlongr id;
|
---|
80 | [switch_is(flags & 2)] wrepl_addresses addresses;
|
---|
81 | ipv4address unknown;
|
---|
82 | } wrepl_wins_name;
|
---|
83 |
|
---|
84 | typedef struct {
|
---|
85 | uint32 num_names;
|
---|
86 | wrepl_wins_name names[num_names];
|
---|
87 | } wrepl_send_reply;
|
---|
88 |
|
---|
89 | typedef struct {
|
---|
90 | ipv4address address;
|
---|
91 | udlongr max_version;
|
---|
92 | udlongr min_version;
|
---|
93 | uint32 type;
|
---|
94 | } wrepl_wins_owner;
|
---|
95 |
|
---|
96 | typedef struct {
|
---|
97 | uint32 partner_count;
|
---|
98 | wrepl_wins_owner partners[partner_count];
|
---|
99 | ipv4address initiator;
|
---|
100 | } wrepl_table;
|
---|
101 |
|
---|
102 | typedef [v1_enum] enum {
|
---|
103 | WREPL_REPL_TABLE_QUERY = 0,
|
---|
104 | WREPL_REPL_TABLE_REPLY = 1,
|
---|
105 | WREPL_REPL_SEND_REQUEST = 2,
|
---|
106 | WREPL_REPL_SEND_REPLY = 3,
|
---|
107 | WREPL_REPL_UPDATE = 4,
|
---|
108 | WREPL_REPL_UPDATE2 = 5,
|
---|
109 | WREPL_REPL_INFORM = 8,
|
---|
110 | WREPL_REPL_INFORM2 = 9
|
---|
111 | } wrepl_replication_cmd;
|
---|
112 |
|
---|
113 | typedef [nodiscriminant] union {
|
---|
114 | [case(WREPL_REPL_TABLE_QUERY)] ;
|
---|
115 | [case(WREPL_REPL_TABLE_REPLY)] wrepl_table table;
|
---|
116 | [case(WREPL_REPL_SEND_REQUEST)] wrepl_wins_owner owner;
|
---|
117 | [case(WREPL_REPL_SEND_REPLY)] wrepl_send_reply reply;
|
---|
118 | [case(WREPL_REPL_UPDATE)] wrepl_table table;
|
---|
119 | [case(WREPL_REPL_UPDATE2)] wrepl_table table;
|
---|
120 | [case(WREPL_REPL_INFORM)] wrepl_table table;
|
---|
121 | [case(WREPL_REPL_INFORM2)] wrepl_table table;
|
---|
122 | } wrepl_replication_info;
|
---|
123 |
|
---|
124 | typedef struct {
|
---|
125 | wrepl_replication_cmd command;
|
---|
126 | [switch_is(command)] wrepl_replication_info info;
|
---|
127 | } wrepl_replication;
|
---|
128 |
|
---|
129 | typedef struct {
|
---|
130 | uint32 assoc_ctx;
|
---|
131 | uint16 minor_version;
|
---|
132 | uint16 major_version;
|
---|
133 | } wrepl_start;
|
---|
134 |
|
---|
135 | typedef struct {
|
---|
136 | uint32 reason;
|
---|
137 | } wrepl_stop;
|
---|
138 |
|
---|
139 | typedef [v1_enum] enum {
|
---|
140 | WREPL_START_ASSOCIATION = 0,
|
---|
141 | WREPL_START_ASSOCIATION_REPLY = 1,
|
---|
142 | WREPL_STOP_ASSOCIATION = 2,
|
---|
143 | WREPL_REPLICATION = 3
|
---|
144 | } wrepl_mess_type;
|
---|
145 |
|
---|
146 | typedef [nodiscriminant] union {
|
---|
147 | [case(WREPL_START_ASSOCIATION)] wrepl_start start;
|
---|
148 | [case(WREPL_START_ASSOCIATION_REPLY)] wrepl_start start_reply;
|
---|
149 | [case(WREPL_STOP_ASSOCIATION)] wrepl_stop stop;
|
---|
150 | [case(WREPL_REPLICATION)] wrepl_replication replication;
|
---|
151 | } wrepl_message;
|
---|
152 |
|
---|
153 | /*
|
---|
154 | the opcode appears to be a bitfield, but as far as I can tell
|
---|
155 | you must always set the following bits. Additional bits don't
|
---|
156 | seem to matter. Very strange.
|
---|
157 | */
|
---|
158 | const int WREPL_OPCODE_BITS = 0x7800;
|
---|
159 |
|
---|
160 |
|
---|
161 | typedef [gensize,flag(NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
|
---|
162 | uint32 opcode;
|
---|
163 | uint32 assoc_ctx;
|
---|
164 | wrepl_mess_type mess_type;
|
---|
165 | [switch_is(mess_type)] wrepl_message message;
|
---|
166 | [flag(NDR_REMAINING)] DATA_BLOB padding;
|
---|
167 | } wrepl_packet;
|
---|
168 |
|
---|
169 | typedef [flag(NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
|
---|
170 | [value(ndr_size_wrepl_packet(&packet, ndr->flags))] uint32 size;
|
---|
171 | wrepl_packet packet;
|
---|
172 | } wrepl_wrap;
|
---|
173 |
|
---|
174 | void decode_winsrepl(
|
---|
175 | [in] wrepl_wrap p
|
---|
176 | );
|
---|
177 |
|
---|
178 | }
|
---|