summaryrefslogtreecommitdiff
path: root/source4/wrepl_server/wrepl_in_call.c
blob: 444fda544b93e20ee85ff870985da37201807761 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/* 
   Unix SMB/CIFS implementation.
   
   WINS Replication server
   
   Copyright (C) Stefan Metzmacher	2005
   
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include "includes.h"
#include "dlinklist.h"
#include "lib/events/events.h"
#include "lib/socket/socket.h"
#include "smbd/service_task.h"
#include "smbd/service_stream.h"
#include "lib/messaging/irpc.h"
#include "librpc/gen_ndr/ndr_winsrepl.h"
#include "wrepl_server/wrepl_server.h"

static NTSTATUS wreplsrv_in_start_association(struct wreplsrv_in_call *call)
{
	struct wrepl_stop *stop;

	call->rep_packet.opcode		= WREPL_OPCODE_BITS;
	call->rep_packet.assoc_ctx	= 0;
	call->rep_packet.mess_type	= WREPL_STOP_ASSOCIATION;
	stop				= &call->rep_packet.message.stop;
	stop->reason			= 4;

	return NT_STATUS_OK;
}

static NTSTATUS wreplsrv_in_replication(struct wreplsrv_in_call *call)
{
	struct wrepl_replication *repl_in = &call->req_packet.message.replication;
	struct wrepl_stop *stop_out;

	switch (repl_in->command) {
		case WREPL_REPL_TABLE_QUERY:
			break;
		case WREPL_REPL_TABLE_REPLY:
			break;
		case WREPL_REPL_SEND_REQUEST:
			break;
		case WREPL_REPL_SEND_REPLY:
			break;
		case WREPL_REPL_UPDATE:
			break;
		case WREPL_REPL_5:
			break;
		case WREPL_REPL_INFORM:
			break;
		case WREPL_REPL_9:
			break;
	}

	call->rep_packet.opcode		= WREPL_OPCODE_BITS;
	call->rep_packet.assoc_ctx	= 0;
	call->rep_packet.mess_type	= WREPL_STOP_ASSOCIATION;
	stop_out			= &call->rep_packet.message.stop;
	stop_out->reason		= 4;

	return NT_STATUS_OK;
}

NTSTATUS wreplsrv_in_call(struct wreplsrv_in_call *call)
{
	struct wrepl_stop *stop_out;

	/* TODO: check opcode and assoc_ctx */

	switch (call->req_packet.mess_type) {
		case WREPL_START_ASSOCIATION:
			return wreplsrv_in_start_association(call);

		case WREPL_START_ASSOCIATION_REPLY:
			/* this is not valid here */
			break;
		case WREPL_STOP_ASSOCIATION:
			/* this is not valid here */
			break;

		case WREPL_REPLICATION:
			return wreplsrv_in_replication(call);
	}

	call->rep_packet.opcode		= WREPL_OPCODE_BITS;
	call->rep_packet.assoc_ctx	= 0;
	call->rep_packet.mess_type	= WREPL_STOP_ASSOCIATION;
	call->rep_packet.padding	= data_blob(NULL, 0);
	stop_out			= &call->rep_packet.message.stop;
	stop_out->reason		= 4;

	return NT_STATUS_OK;
}