s3-smbd: Don't segfault if user specified ports out for range.
[Samba.git] / libcli / dns / libdns.h
blob31474ebc530279075f728f6b3b6bf860c4967274
1 /*
2 Unix SMB/CIFS implementation.
4 Small async DNS library for Samba with socketwrapper support
6 Copyright (C) 2012 Kai Blin <kai@samba.org>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef __LIBDNS_H__
23 #define __LIBDNS_H__
25 /** Send an dns request to a dns server using UDP
27 *@param mem_ctx talloc memory context to use
28 *@param ev tevent context to use
29 *@param server_address address of the server as a string
30 *@param query dns query to send
31 *@param query_len length of the query
32 *@return tevent_req with the active request or NULL on out-of-memory
34 struct tevent_req *dns_udp_request_send(TALLOC_CTX *mem_ctx,
35 struct tevent_context *ev,
36 const char *server_address,
37 const uint8_t *query,
38 size_t query_len);
40 /** Get the dns response from a dns server via UDP
42 *@param req tevent_req struct returned from dns_request_send
43 *@param mem_ctx talloc memory context to use for the reply string
44 *@param reply buffer that will be allocated and filled with the dns reply
45 *@param reply_len length of the reply buffer
46 *@return WERROR code depending on the async request result
48 WERROR dns_udp_request_recv(struct tevent_req *req,
49 TALLOC_CTX *mem_ctx,
50 uint8_t **reply,
51 size_t *reply_len);
53 #endif /*__LIBDNS_H__*/