s3-librpc: Add dcerpc_binding_vector_dup().
[Samba/id10ts.git] / source3 / librpc / rpc / dcerpc_ep.h
blobc982ff853c8710cc72453747062b046b6bd7bd1f
1 /*
2 * Endpoint Mapper Functions
3 * DCERPC local endpoint mapper client routines
4 * Copyright (c) 2010-2011 Andreas Schneider.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #ifndef _DCERPC_EP_H_
21 #define _DCERPC_EP_H_
23 struct dcerpc_binding_vector {
24 struct dcerpc_binding *bindings;
25 uint32_t count;
26 uint32_t allocated;
29 /**
30 * @brief Allocate a new binding vector.
32 * @param[in] mem_ctx The memory context to allocate the vector.
34 * @param[out] pbvec A pointer to store the binding vector.
36 * @return An NTSTATUS error code.
38 NTSTATUS dcerpc_binding_vector_new(TALLOC_CTX *mem_ctx,
39 struct dcerpc_binding_vector **pbvec);
41 /**
42 * @brief Add default named pipes to the binding vector.
44 * @param[in] iface The rpc interface to add.
46 * @param[in] bvec The binding vector to add the interface.
48 * @return An NTSTATUS error code.
50 NTSTATUS dcerpc_binding_vector_add_np_default(const struct ndr_interface_table *iface,
51 struct dcerpc_binding_vector *bvec);
53 /**
54 * @brief Add a tcpip port to a binding vector.
56 * @param[in] iface The rpc interface to add.
58 * @param[in] bvec The binding vector to add the intface, host and port.
60 * @param[in] host The ip address of the network inteface bound.
62 * @param[in] port The port bound.
64 * @return An NTSTATUS error code.
66 NTSTATUS dcerpc_binding_vector_add_port(const struct ndr_interface_table *iface,
67 struct dcerpc_binding_vector *bvec,
68 const char *host,
69 uint16_t port);
71 /**
72 * @brief Add a unix socket (ncalrpc) to a binding vector.
74 * @param[in] iface The rpc interface to add.
76 * @param[in] bvec The binding vector to add the intface, host and port.
78 * @param[in] name The name of the unix socket.
80 * @return An NTSTATUS error code.
82 NTSTATUS dcerpc_binding_vector_add_unix(const struct ndr_interface_table *iface,
83 struct dcerpc_binding_vector *bvec,
84 const char *name);
86 /**
87 * @brief Duplicate a dcerpc_binding_vector.
89 * @param[in] mem_ctx The memory context to create the duplicate on.
91 * @param[in] bvec The binding vector to duplicate.
93 * @return The duplicated binding vector or NULL on error.
95 struct dcerpc_binding_vector *dcerpc_binding_vector_dup(TALLOC_CTX *mem_ctx,
96 const struct dcerpc_binding_vector *bvec);
98 NTSTATUS dcerpc_binding_vector_create(TALLOC_CTX *mem_ctx,
99 const struct ndr_interface_table *iface,
100 uint16_t port,
101 const char *ncalrpc,
102 struct dcerpc_binding_vector **pbvec);
105 * @brief Adds server address information in the local endpoint map.
107 * @param[in] mem_ctx The memory context to use for the binding handle.
109 * @param[in] iface The interface specification to register with the local
110 * endpoint map.
112 * @param[in] binding The server binding handles over which the server can
113 * receive remote procedure calls.
115 * @param[in] object_guid The object GUID that the server offers. The server
116 * application constructs this vector.
118 * @param[in] annotation Defines a character string comment applied to the
119 * element added to the local endpoint map. The string
120 * can be up to 64 characters long, including the null
121 * terminating character. Strings longer than 64
122 * characters are truncated. The application supplies
123 * the value NULL or the string "" to indicate an empty
124 * annotation string.
126 * When replacing elements, the annotation string
127 * supplied, including an empty annotation string,
128 * replaces any existing annotation string.
130 * @param[out] ph A pointer to store the binding handle. The memory
131 * context will be the give one. If you free this handle
132 * then the connection will be closed.
134 * @return An NTSTATUS error code.
136 NTSTATUS dcerpc_ep_register(TALLOC_CTX *mem_ctx,
137 struct messaging_context *msg_ctx,
138 const struct ndr_interface_table *iface,
139 const struct dcerpc_binding_vector *bind_vec,
140 const struct GUID *object_guid,
141 const char *annotation,
142 struct dcerpc_binding_handle **ph);
144 NTSTATUS dcerpc_ep_register_noreplace(TALLOC_CTX *mem_ctx,
145 struct messaging_context *msg_ctx,
146 const struct ndr_interface_table *iface,
147 const struct dcerpc_binding_vector *bind_vec,
148 const struct GUID *object_guid,
149 const char *annotation,
150 struct dcerpc_binding_handle **ph);
152 NTSTATUS dcerpc_ep_unregister(struct messaging_context *msg_ctx,
153 const struct ndr_interface_table *iface,
154 const struct dcerpc_binding_vector *bind_vec,
155 const struct GUID *object_guid);
157 #endif /* _DCERPC_EP_H_ */