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