summaryrefslogtreecommitdiff
path: root/source3/librpc/rpc/dcerpc_ep.h
blob: 421038f0ad19ef36d7e465e38654ccea0242f02d (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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
 *  Endpoint Mapper Functions
 *  DCERPC local endpoint mapper client routines
 *  Copyright (c) 2010-2011 Andreas Schneider.
 *
 *  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 3 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, see <http://www.gnu.org/licenses/>.
 */

#ifndef _DCERPC_EP_H_
#define _DCERPC_EP_H_

struct dcerpc_binding_vector {
    struct dcerpc_binding *bindings;
    uint32_t count;
    uint32_t allocated;
};

/**
 * @brief Allocate a new binding vector.
 *
 * @param[in]  mem_ctx  The memory context to allocate the vector.
 *
 * @param[out] pbvec    A pointer to store the binding vector.
 *
 * @return              An NTSTATUS error code.
 */
NTSTATUS dcerpc_binding_vector_new(TALLOC_CTX *mem_ctx,
				   struct dcerpc_binding_vector **pbvec);

/**
 * @brief Add default named pipes to the binding vector.
 *
 * @param[in] iface     The rpc interface to add.
 *
 * @param[in] bvec      The binding vector to add the interface.
 *
 * @return              An NTSTATUS error code.
 */
NTSTATUS dcerpc_binding_vector_add_np_default(const struct ndr_interface_table *iface,
					      struct dcerpc_binding_vector *bvec);

/**
 * @brief Add a tcpip port to a binding vector.
 *
 * @param[in] iface     The rpc interface to add.
 *
 * @param[in] bvec      The binding vector to add the intface, host and port.
 *
 * @param[in] host      The ip address of the network inteface bound.
 *
 * @param[in] port      The port bound.
 *
 * @return              An NTSTATUS error code.
 */
NTSTATUS dcerpc_binding_vector_add_port(const struct ndr_interface_table *iface,
					struct dcerpc_binding_vector *bvec,
					const char *host,
					uint16_t port);

/**
 * @brief Add a unix socket (ncalrpc) to a binding vector.
 *
 * @param[in] iface     The rpc interface to add.
 *
 * @param[in] bvec      The binding vector to add the intface, host and port.
 *
 * @param[in] name      The name of the unix socket.
 *
 * @return              An NTSTATUS error code.
 */
NTSTATUS dcerpc_binding_vector_add_unix(const struct ndr_interface_table *iface,
					struct dcerpc_binding_vector *bvec,
					const char *name);

NTSTATUS dcerpc_binding_vector_create(TALLOC_CTX *mem_ctx,
				      const struct ndr_interface_table *iface,
				      uint16_t port,
				      const char *ncalrpc,
				      struct dcerpc_binding_vector **pbvec);

/**
 * @brief Adds server address information in the local endpoint map.
 *
 * @param[in]  mem_ctx  The memory context to use for the binding handle.
 *
 * @param[in]  iface    The interface specification to register with the local
 *                      endpoint map.
 *
 * @param[in]  binding  The server binding handles over which the server can
 *                      receive remote procedure calls.
 *
 * @param[in]  object_guid The object GUID that the server offers. The server
 *                         application constructs this vector.
 *
 * @param[in]  annotation  Defines a character string comment applied to the
 *                         element added to the local endpoint map. The string
 *                         can be up to 64 characters long, including the null
 *                         terminating character. Strings longer than 64
 *                         characters are truncated. The application supplies
 *                         the value NULL or the string "" to indicate an empty
 *                         annotation string.
 *
 *                         When replacing elements, the annotation string
 *                         supplied, including an empty annotation string,
 *                         replaces any existing annotation string.
 *
 * @param[out] ph          A pointer to store the binding handle. The memory
 *                         context will be the give one. If you free this handle
 *                         then the connection will be closed.
 *
 * @return                 An NTSTATUS error code.
 */
NTSTATUS dcerpc_ep_register(TALLOC_CTX *mem_ctx,
			    struct messaging_context *msg_ctx,
			    const struct ndr_interface_table *iface,
			    const struct dcerpc_binding_vector *bind_vec,
			    const struct GUID *object_guid,
			    const char *annotation,
			    struct dcerpc_binding_handle **ph);

NTSTATUS dcerpc_ep_register_noreplace(TALLOC_CTX *mem_ctx,
				      struct messaging_context *msg_ctx,
				      const struct ndr_interface_table *iface,
				      const struct dcerpc_binding_vector *bind_vec,
				      const struct GUID *object_guid,
				      const char *annotation,
				      struct dcerpc_binding_handle **ph);

NTSTATUS dcerpc_ep_unregister(struct messaging_context *msg_ctx,
			      const struct ndr_interface_table *iface,
			      const struct dcerpc_binding_vector *bind_vec,
			      const struct GUID *object_guid);

#endif /* _DCERPC_EP_H_ */