s3-librpc: Add dcerpc_binding_vector_add_port().
[ddiss/samba.git] / source3 / librpc / rpc / dcerpc_ep.h
1 /*
2  *  Endpoint Mapper Functions
3  *  DCERPC local endpoint mapper client routines
4  *  Copyright (c) 2010-2011 Andreas Schneider.
5  *
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.
10  *
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.
15  *
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/>.
18  */
19
20 #ifndef _DCERPC_EP_H_
21 #define _DCERPC_EP_H_
22
23 struct dcerpc_binding_vector {
24     struct dcerpc_binding *bindings;
25     uint32_t count;
26     uint32_t allocated;
27 };
28
29 /**
30  * @brief Allocate a new binding vector.
31  *
32  * @param[in]  mem_ctx  The memory context to allocate the vector.
33  *
34  * @param[out] pbvec    A pointer to store the binding vector.
35  *
36  * @return              An NTSTATUS error code.
37  */
38 NTSTATUS dcerpc_binding_vector_new(TALLOC_CTX *mem_ctx,
39                                    struct dcerpc_binding_vector **pbvec);
40
41 /**
42  * @brief Add default named pipes to the binding vector.
43  *
44  * @param[in] iface     The rpc interface to add.
45  *
46  * @param[in] bvec      The binding vector to add the interface.
47  *
48  * @return              An NTSTATUS error code.
49  */
50 NTSTATUS dcerpc_binding_vector_add_np_default(const struct ndr_interface_table *iface,
51                                               struct dcerpc_binding_vector *bvec);
52
53 /**
54  * @brief Add a tcpip port to a binding vector.
55  *
56  * @param[in] iface     The rpc interface to add.
57  *
58  * @param[in] bvec      The binding vector to add the intface, host and port.
59  *
60  * @param[in] host      The ip address of the network inteface bound.
61  *
62  * @param[in] port      The port bound.
63  *
64  * @return              An NTSTATUS error code.
65  */
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);
70
71 NTSTATUS dcerpc_binding_vector_create(TALLOC_CTX *mem_ctx,
72                                       const struct ndr_interface_table *iface,
73                                       uint16_t port,
74                                       const char *ncalrpc,
75                                       struct dcerpc_binding_vector **pbvec);
76
77 /**
78  * @brief Adds server address information in the local endpoint map.
79  *
80  * @param[in]  mem_ctx  The memory context to use for the binding handle.
81  *
82  * @param[in]  iface    The interface specification to register with the local
83  *                      endpoint map.
84  *
85  * @param[in]  binding  The server binding handles over which the server can
86  *                      receive remote procedure calls.
87  *
88  * @param[in]  object_guid The object GUID that the server offers. The server
89  *                         application constructs this vector.
90  *
91  * @param[in]  annotation  Defines a character string comment applied to the
92  *                         element added to the local endpoint map. The string
93  *                         can be up to 64 characters long, including the null
94  *                         terminating character. Strings longer than 64
95  *                         characters are truncated. The application supplies
96  *                         the value NULL or the string "" to indicate an empty
97  *                         annotation string.
98  *
99  *                         When replacing elements, the annotation string
100  *                         supplied, including an empty annotation string,
101  *                         replaces any existing annotation string.
102  *
103  * @param[out] ph          A pointer to store the binding handle. The memory
104  *                         context will be the give one. If you free this handle
105  *                         then the connection will be closed.
106  *
107  * @return                 An NTSTATUS error code.
108  */
109 NTSTATUS dcerpc_ep_register(TALLOC_CTX *mem_ctx,
110                             struct messaging_context *msg_ctx,
111                             const struct ndr_interface_table *iface,
112                             const struct dcerpc_binding_vector *bind_vec,
113                             const struct GUID *object_guid,
114                             const char *annotation,
115                             struct dcerpc_binding_handle **ph);
116
117 NTSTATUS dcerpc_ep_register_noreplace(TALLOC_CTX *mem_ctx,
118                                       struct messaging_context *msg_ctx,
119                                       const struct ndr_interface_table *iface,
120                                       const struct dcerpc_binding_vector *bind_vec,
121                                       const struct GUID *object_guid,
122                                       const char *annotation,
123                                       struct dcerpc_binding_handle **ph);
124
125 NTSTATUS dcerpc_ep_unregister(struct messaging_context *msg_ctx,
126                               const struct ndr_interface_table *iface,
127                               const struct dcerpc_binding_vector *bind_vec,
128                               const struct GUID *object_guid);
129
130 #endif /* _DCERPC_EP_H_ */