diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-02-16 10:03:18 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:10:43 -0500 |
commit | a6878f6c6e17ea99baf57e5724d524548a44ada8 (patch) | |
tree | ab330ca0026650d07d4c1d693ba77f43c81aab0e /source4/librpc | |
parent | 845f5596c86928b7db4337c8c269130bc55338fe (diff) | |
download | samba-a6878f6c6e17ea99baf57e5724d524548a44ada8.tar.gz samba-a6878f6c6e17ea99baf57e5724d524548a44ada8.tar.bz2 samba-a6878f6c6e17ea99baf57e5724d524548a44ada8.zip |
r5414: - added libcli/wins/, a basic client library for WINS replication
- added a new IDL type "udlongr", which is like udlong, but with the
two uint32 halves reversed
- modified the winsrepl.idl to cope with a wider range of packets
(This used to be commit bc8d60c918f2e268d591aac464fc6a78c38a4cf9)
Diffstat (limited to 'source4/librpc')
-rw-r--r-- | source4/librpc/idl/idl_types.h | 1 | ||||
-rw-r--r-- | source4/librpc/idl/nbt.idl | 2 | ||||
-rw-r--r-- | source4/librpc/idl/winsrepl.idl | 69 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_basic.c | 33 |
4 files changed, 66 insertions, 39 deletions
diff --git a/source4/librpc/idl/idl_types.h b/source4/librpc/idl/idl_types.h index 1db778476c..d4f2479d48 100644 --- a/source4/librpc/idl/idl_types.h +++ b/source4/librpc/idl/idl_types.h @@ -81,7 +81,6 @@ */ #define utf8string [flag(STR_UTF8|STR_NULLTERM)] string - #define NDR_NOALIGN LIBNDR_FLAG_NOALIGN #define NDR_REMAINING LIBNDR_FLAG_REMAINING #define NDR_ALIGN2 LIBNDR_FLAG_ALIGN2 diff --git a/source4/librpc/idl/nbt.idl b/source4/librpc/idl/nbt.idl index a5c5f46962..04fe0c4f90 100644 --- a/source4/librpc/idl/nbt.idl +++ b/source4/librpc/idl/nbt.idl @@ -50,7 +50,7 @@ interface nbt /* we support any 8bit name type, but by defining the common ones here we get better debug displays */ - typedef [enum8bit,public] enum { + typedef [enum8bit] enum { NBT_NAME_CLIENT = 0x00, NBT_NAME_MS = 0x01, NBT_NAME_USER = 0x03, diff --git a/source4/librpc/idl/winsrepl.idl b/source4/librpc/idl/winsrepl.idl index 919d3a94bb..cec82a5106 100644 --- a/source4/librpc/idl/winsrepl.idl +++ b/source4/librpc/idl/winsrepl.idl @@ -12,63 +12,53 @@ [ uuid("0-1-2-3-4"), version(0.0), - pointer_default(unique), - depends(nbt) + pointer_default(unique) ] interface wrepl { const int WINS_REPLICATION_PORT = 42; - declare enum nbt_name_type; - typedef [flag(NDR_BIG_ENDIAN)] struct { ipv4address owner; ipv4address ip; } wrepl_ip; typedef [flag(NDR_LITTLE_ENDIAN)] struct { - uint32 num_ips; - wrepl_ip ips[num_ips]; + uint32 num_ips; + wrepl_ip ips[num_ips]; ipv4address unknown; } wrepl_address_list; typedef [nodiscriminant] union { - [case(0)] wrepl_ip address; + [case(0)] wrepl_ip address; [case(2)] wrepl_address_list addresses; } wrepl_addresses; typedef struct { - uint32 id_high; - uint32 id_low; - } wrepl_id; - - typedef struct { - uint32 name_len; - astring15 name; - nbt_name_type type; - uint32 unknown; - uint32 flags; + uint32 name_len; + uint8 name[name_len]; + uint32 flags; [flag(NDR_LITTLE_ENDIAN)] uint32 group_flag; - wrepl_id id; + udlongr id; [switch_is(flags & 2)] wrepl_addresses addresses; } wrepl_wins_name; typedef struct { - uint32 num_names; + uint32 num_names; wrepl_wins_name names[num_names]; } wrepl_send_reply; typedef struct { ipv4address address; - wrepl_id max_version; - wrepl_id min_version; - uint32 type; + udlongr max_version; + udlongr min_version; + uint32 type; } wrepl_wins_owner; typedef struct { - uint32 partner_count; + uint32 partner_count; wrepl_wins_owner partners[partner_count]; - ipv4address initiator; + ipv4address initiator; } wrepl_table; typedef [v1_enum] enum { @@ -82,11 +72,11 @@ interface wrepl typedef [nodiscriminant] union { [case(WREPL_REPL_TABLE_QUERY)] ; - [case(WREPL_REPL_TABLE_REPLY)] wrepl_table table; + [case(WREPL_REPL_TABLE_REPLY)] wrepl_table table; [case(WREPL_REPL_SEND_REQUEST)] wrepl_wins_owner owner; - [case(WREPL_REPL_SEND_REPLY)] wrepl_send_reply reply; + [case(WREPL_REPL_SEND_REPLY)] wrepl_send_reply reply; [case(WREPL_REPL_UPDATE)] ; - [case(WREPL_REPL_INFORM)] wrepl_table table; + [case(WREPL_REPL_INFORM)] wrepl_table table; } wrepl_replication_info; typedef struct { @@ -112,23 +102,30 @@ interface wrepl } wrepl_mess_type; typedef [nodiscriminant] union { - [case(WREPL_START_ASSOCIATION)] wrepl_start start; + [case(WREPL_START_ASSOCIATION)] wrepl_start start; [case(WREPL_START_ASSOCIATION_REPLY)] wrepl_start start_reply; - [case(WREPL_STOP_ASSOCIATION)] wrepl_stop stop; - [case(WREPL_REPLICATION)] wrepl_replication replication; + [case(WREPL_STOP_ASSOCIATION)] wrepl_stop stop; + [case(WREPL_REPLICATION)] wrepl_replication replication; } wrepl_message; + /* + the opcode appears to be a bitfield, but as far as I can tell + you must always set the following bits. Additional bits don't + seem to matter. Very strange. + */ + const int WREPL_OPCODE_BITS = 0x7800; + - typedef [gensize,flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct { - uint32 opcode; - uint32 assoc_ctx; - wrepl_mess_type mess_type; + typedef [gensize,flag(NDR_BIG_ENDIAN|NDR_PAHEX),public] struct { + uint32 opcode; + uint32 assoc_ctx; + wrepl_mess_type mess_type; [switch_is(mess_type)] wrepl_message message; [flag(NDR_REMAINING)] DATA_BLOB padding; } wrepl_packet; - typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct { - [value(ndr_size_wrepl_packet(&r->packet, ndr->flags))] uint32 size; + typedef [flag(NDR_BIG_ENDIAN|NDR_PAHEX),public] struct { + [value(ndr_size_wrepl_packet(&r->packet, ndr->flags))] uint32 size; wrepl_packet packet; } wrepl_wrap; diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c index 5eecb1d60b..5f91cef2e8 100644 --- a/source4/librpc/ndr/ndr_basic.c +++ b/source4/librpc/ndr/ndr_basic.c @@ -132,6 +132,19 @@ NTSTATUS ndr_pull_udlong(struct ndr_pull *ndr, int ndr_flags, uint64_t *v) } /* + parse a udlongr +*/ +NTSTATUS ndr_pull_udlongr(struct ndr_pull *ndr, int ndr_flags, uint64_t *v) +{ + NDR_PULL_ALIGN(ndr, 4); + NDR_PULL_NEED_BYTES(ndr, 8); + *v = ((uint64_t)NDR_IVAL(ndr, ndr->offset)) << 32; + *v |= NDR_IVAL(ndr, ndr->offset+4); + ndr->offset += 8; + return NT_STATUS_OK; +} + +/* parse a dlong */ NTSTATUS ndr_pull_dlong(struct ndr_pull *ndr, int ndr_flags, int64_t *v) @@ -329,7 +342,7 @@ NTSTATUS ndr_push_int32(struct ndr_push *ndr, int ndr_flags, int32_t v) } /* - push a uint64 + push a udlong */ NTSTATUS ndr_push_udlong(struct ndr_push *ndr, int ndr_flags, uint64_t v) { @@ -342,6 +355,19 @@ NTSTATUS ndr_push_udlong(struct ndr_push *ndr, int ndr_flags, uint64_t v) } /* + push a udlongr +*/ +NTSTATUS ndr_push_udlongr(struct ndr_push *ndr, int ndr_flags, uint64_t v) +{ + NDR_PUSH_ALIGN(ndr, 4); + NDR_PUSH_NEED_BYTES(ndr, 8); + NDR_SIVAL(ndr, ndr->offset+4, (v>>32)); + NDR_SIVAL(ndr, ndr->offset, (v & 0xFFFFFFFF)); + ndr->offset += 8; + return NT_STATUS_OK; +} + +/* push a int64 */ NTSTATUS ndr_push_dlong(struct ndr_push *ndr, int ndr_flags, int64_t v) @@ -1107,6 +1133,11 @@ void ndr_print_udlong(struct ndr_print *ndr, const char *name, uint64_t v) v); } +void ndr_print_udlongr(struct ndr_print *ndr, const char *name, uint64_t v) +{ + ndr_print_udlong(ndr, name, v); +} + void ndr_print_dlong(struct ndr_print *ndr, const char *name, int64_t v) { ndr->print(ndr, "%-25s: 0x%08x%08x (%lld)", name, |