v3-6-test: Further fix for bug 8338
[Samba.git] / libcli / echo / libecho.h
blob35a0986a6fce5880ab7215aafda2c4aef554454a
1 /*
2 Unix SMB/CIFS implementation.
4 Echo structures and headers, example async client library
6 Copyright (C) 2010 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 __LIBECHO_H__
23 #define __LIBECHO_H__
25 /* The echo port is fixed, so just set a constant. */
26 #define ECHO_PORT 7
28 /** Send an echo request to an echo server
30 *@param mem_ctx talloc memory context to use
31 *@param ev tevent context to use
32 *@param server_address address of the server as a string
33 *@param message echo message to send
34 *@return tevent_req with the active request or NULL on out-of-memory
36 struct tevent_req *echo_request_send(TALLOC_CTX *mem_ctx,
37 struct tevent_context *ev,
38 const char *server_address,
39 const char *message);
41 /** Get the echo response from an echo server
43 * Once the echo_request_send async request is finished, you can call
44 * this function to collect the echo reply.
46 *@param req tevent_req struct returned from echo_request_send
47 *@param mem_ctx talloc memory context to use for the reply string
48 *@param message pointer to a string that will be allocated and filled with
49 the echo reply.
50 *@return NTSTATUS code depending on the async request result
52 NTSTATUS echo_request_recv(struct tevent_req *req,
53 TALLOC_CTX *mem_ctx,
54 char **message);
56 #endif /*__LIBECHO_H__*/