summaryrefslogtreecommitdiff
path: root/source3/rpc_server/srv_epmapper_nt.c
blob: e82484af4af3034ee5f80a2964aa79d428a0b4e1 (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

/* 
   Unix SMB/CIFS implementation.
   Samba end point mapper utility and mapping functions
   Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2003
   
   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"

/*******************************************************************/
/*  _epm_map - fill out mapping on input and output structs */
/*******************************************************************/
void _epm_map(pipes_struct *ps, const EPM_Q_MAP *q_u, EPM_R_MAP *r_u)
{
	int i;
	uint8 target_address[] = { 9, 53, 95, 27 };
	EPM_FLOOR *floors = talloc(ps->mem_ctx, sizeof(EPM_FLOOR) *
				   q_u->tower->num_floors);
	EPM_TOWER *towers = talloc(ps->mem_ctx, 
				   sizeof(EPM_TOWER) * MAX_TOWERS);
	EPM_TOWER_ARRAY array;

	if (!floors || !towers) {
		DEBUG(0, ("_epm_map: talloc failed!\n"));
		return;
	}

	for (i = 0; i < q_u->tower->num_floors; i++) {
		switch (q_u->tower->floors[i].lhs.protocol) {
                case EPM_FLOOR_UUID:
			init_epm_floor_uuid(&floors[i],
					    q_u->tower->floors[i].
					    lhs.uuid.uuid,
					    q_u->tower->floors[i].
					    lhs.uuid.version);
			break;
		case EPM_FLOOR_RPC:
			init_epm_floor_rpc(&floors[i]);
			break;
		case EPM_FLOOR_TCP:
			/* for now map all requests to port 135 */
			init_epm_floor_tcp(&floors[i], 135);
			break;
		case EPM_FLOOR_IP:
			init_epm_floor_ip(&floors[i], target_address);
			break;
		}
	}

	init_epm_tower(ps->mem_ctx, &towers[0], floors, 5);
	init_epm_tower_array(ps->mem_ctx, &array, towers, 1);
	init_epm_r_map(ps->mem_ctx, r_u, &q_u->term_handle, &array, 1, 0);

	return;

}