1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

librpc: further fixes for witness.idl.

Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Gregor Beck 2014-02-04 15:43:39 +01:00 committed by Günther Deschner
parent 0c6c081dc4
commit 130740100b
2 changed files with 51 additions and 10 deletions

View File

@ -77,11 +77,52 @@ interface witness
WITNESS_NOTIFY_IP_CHANGE = 4
} witness_notifyResponse_type;
typedef struct {
witness_notifyResponse_type message_type;
uint32 length;
uint32 num_messages;
[size_is(length)] uint8 *message_buffer;
typedef [v1_enum] enum {
WITNESS_RESOURCE_STATE_UNKNOWN = 0x00,
WITNESS_RESOURCE_STATE_AVAILABLE = 0x01,
WITNESS_RESOURCE_STATE_UNAVAILABLE = 0xff
} witness_ResourceChange_type;
typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN),gensize,public] struct {
[value(ndr_size_witness_ResourceChange(r,ndr->flags))] uint32 length;
witness_ResourceChange_type type;
nstring name;
} witness_ResourceChange;
typedef [bitmap32bit] bitmap {
WITNESS_IPADDR_V4 = 0x01,
WITNESS_IPADDR_V6 = 0x02,
WITNESS_IPADDR_ONLINE = 0x08,
WITNESS_IPADDR_OFFLINE = 0x10
} witness_IPaddrInfo_flags;
typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN),gensize] struct {
witness_IPaddrInfo_flags flags;
ipv4address ipv4;
ipv6address ipv6;
} witness_IPaddrInfo;
typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN)] struct {
[value(r->num*ndr_size_witness_IPaddrInfo(r->addr, ndr->flags))] uint32 length;
[value(0)] uint32 reserved;
uint32 num;
witness_IPaddrInfo addr[num];
} witness_IPaddrInfoList;
typedef [public,switch_type(witness_notifyResponse_type),nodiscriminant, flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN)] union {
[case(WITNESS_NOTIFY_RESOURCE_CHANGE)] witness_ResourceChange resource_change;
[case(WITNESS_NOTIFY_CLIENT_MOVE)] witness_IPaddrInfoList client_move;
[case(WITNESS_NOTIFY_SHARE_MOVE)] witness_IPaddrInfoList share_move;
[case(WITNESS_NOTIFY_IP_CHANGE)] witness_IPaddrInfoList ip_change;
} witness_notifyResponse_message;
typedef [flag(NDR_PAHEX)] struct {
witness_notifyResponse_type type;
[value(messages->length)] uint32 length;
uint32 num;
/* [switch_is(type), size_is(num)] witness_notifyResponse_message *messages; */
/* [size_is(length)] uint8 *messages; */
[subcontext(4), subcontext_size(length), flag(NDR_REMAINING)] DATA_BLOB *messages;
} witness_notifyResponse;
WERROR witness_AsyncNotify(

View File

@ -453,7 +453,7 @@ static WERROR cmd_witness_AsyncNotify(struct rpc_pipe_client *cli,
goto done;
}
switch(response->message_type) {
switch(response->type) {
case WITNESS_NOTIFY_RESOURCE_CHANGE:
d_printf("Resource change");
read_response = AsyncNotify_Change;
@ -471,15 +471,15 @@ static WERROR cmd_witness_AsyncNotify(struct rpc_pipe_client *cli,
read_response = AsyncNotify_Move;
break;
default:
d_printf("Unknown (0x%x)", (int)response->message_type);
d_printf("Unknown (0x%x)", (int)response->type);
}
d_printf(" with %d messages\n", response->num_messages);
d_printf(" with %d messages\n", response->num);
if (read_response) {
unsigned n;
const uint8_t *pos = response->message_buffer;
const uint8_t *pos = response->messages->data;
for (n=0; n<response->num_messages; n++) {
for (n=0; n<response->num; n++) {
read_response(frame, &pos);
}
}