Use python.h from libreplace
[samba.git] / source3 / libsmb / namequery.h
1 /*
2  * Unix SMB/CIFS implementation.
3  * Copyright (C) Volker Lendecke 2018
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, see <http://www.gnu.org/licenses/>.
17  */
18
19 #ifndef __LIBSMB_NAMEQUERY_H__
20 #define __LIBSMB_NAMEQUERY_H__
21
22 #include "includes.h"
23 #include <tevent.h>
24
25 /* The following definitions come from libsmb/namequery.c  */
26 bool saf_store( const char *domain, const char *servername );
27 bool saf_join_store( const char *domain, const char *servername );
28 bool saf_delete( const char *domain );
29 char *saf_fetch(TALLOC_CTX *mem_ctx, const char *domain );
30 struct tevent_req *node_status_query_send(TALLOC_CTX *mem_ctx,
31                                           struct tevent_context *ev,
32                                           struct nmb_name *name,
33                                           const struct sockaddr_storage *addr);
34 NTSTATUS node_status_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
35                                 struct node_status **pnode_status,
36                                 size_t *pnum_names,
37                                 struct node_status_extra *extra);
38 NTSTATUS node_status_query(TALLOC_CTX *mem_ctx, struct nmb_name *name,
39                            const struct sockaddr_storage *addr,
40                            struct node_status **pnode_status,
41                            size_t *pnum_names,
42                            struct node_status_extra *extra);
43 bool name_status_find(const char *q_name,
44                         int q_type,
45                         int type,
46                         const struct sockaddr_storage *to_ss,
47                         fstring name);
48 size_t remove_duplicate_addrs2(struct samba_sockaddr *salist, size_t count);
49 struct tevent_req *name_query_send(TALLOC_CTX *mem_ctx,
50                                    struct tevent_context *ev,
51                                    const char *name, int name_type,
52                                    bool bcast, bool recurse,
53                                    const struct sockaddr_storage *addr);
54 NTSTATUS name_query_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
55                          struct sockaddr_storage **addrs, size_t *num_addrs,
56                          uint8_t *flags);
57 NTSTATUS name_query(const char *name, int name_type,
58                     bool bcast, bool recurse,
59                     const struct sockaddr_storage *to_ss,
60                     TALLOC_CTX *mem_ctx,
61                     struct sockaddr_storage **addrs,
62                     size_t *num_addrs, uint8_t *flags);
63 struct tevent_req *name_resolve_bcast_send(TALLOC_CTX *mem_ctx,
64                                            struct tevent_context *ev,
65                                            const char *name,
66                                            int name_type);
67 NTSTATUS name_resolve_bcast_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
68                                  struct sockaddr_storage **addrs,
69                                  size_t *num_addrs);
70 NTSTATUS name_resolve_bcast(TALLOC_CTX *mem_ctx,
71                         const char *name,
72                         int name_type,
73                         struct sockaddr_storage **return_iplist,
74                         size_t *return_count);
75 struct tevent_req *resolve_wins_send(TALLOC_CTX *mem_ctx,
76                                      struct tevent_context *ev,
77                                      const char *name,
78                                      int name_type);
79 NTSTATUS resolve_wins_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
80                            struct sockaddr_storage **addrs,
81                            size_t *num_addrs, uint8_t *flags);
82 NTSTATUS resolve_wins(TALLOC_CTX *mem_ctx,
83                 const char *name,
84                 int name_type,
85                 struct sockaddr_storage **return_iplist,
86                 size_t *return_count);
87 NTSTATUS internal_resolve_name(TALLOC_CTX *ctx,
88                                 const char *name,
89                                 int name_type,
90                                 const char *sitename,
91                                 struct samba_sockaddr **return_salist,
92                                 size_t *ret_count,
93                                 const char **resolve_order);
94 bool resolve_name(const char *name,
95                 struct sockaddr_storage *return_ss,
96                 int name_type,
97                 bool prefer_ipv4);
98 NTSTATUS resolve_name_list(TALLOC_CTX *ctx,
99                 const char *name,
100                 int name_type,
101                 struct sockaddr_storage **return_ss_arr,
102                 unsigned int *p_num_entries);
103 bool find_master_ip(const char *group, struct sockaddr_storage *master_ss);
104 bool get_pdc_ip(const char *domain, struct sockaddr_storage *pss);
105 NTSTATUS get_sorted_dc_list(TALLOC_CTX *ctx,
106                         const char *domain,
107                         const char *sitename,
108                         struct samba_sockaddr **sa_list_ret,
109                         size_t *ret_count,
110                         bool ads_only);
111 NTSTATUS get_kdc_list(TALLOC_CTX *ctx,
112                         const char *realm,
113                         const char *sitename,
114                         struct samba_sockaddr **sa_list_ret,
115                         size_t *ret_count);
116 #endif