[740] | 1 | /*
|
---|
| 2 | Unix SMB/CIFS implementation.
|
---|
| 3 |
|
---|
| 4 | Echo structures and headers, example async client library
|
---|
| 5 |
|
---|
| 6 | Copyright (C) 2010 Kai Blin <kai@samba.org>
|
---|
| 7 |
|
---|
| 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.
|
---|
| 12 |
|
---|
| 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.
|
---|
| 17 |
|
---|
| 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/>.
|
---|
| 20 | */
|
---|
| 21 |
|
---|
| 22 | #ifndef __LIBECHO_H__
|
---|
| 23 | #define __LIBECHO_H__
|
---|
| 24 |
|
---|
| 25 | /* The echo port is fixed, so just set a constant. */
|
---|
| 26 | #define ECHO_PORT 7
|
---|
| 27 |
|
---|
| 28 | /** Send an echo request to an echo server
|
---|
| 29 | *
|
---|
| 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
|
---|
| 35 | */
|
---|
| 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);
|
---|
| 40 |
|
---|
| 41 | /** Get the echo response from an echo server
|
---|
| 42 | *
|
---|
| 43 | * Once the echo_request_send async request is finished, you can call
|
---|
| 44 | * this function to collect the echo reply.
|
---|
| 45 | *
|
---|
| 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
|
---|
| 51 | */
|
---|
| 52 | NTSTATUS echo_request_recv(struct tevent_req *req,
|
---|
| 53 | TALLOC_CTX *mem_ctx,
|
---|
| 54 | char **message);
|
---|
| 55 |
|
---|
| 56 | #endif /*__LIBECHO_H__*/
|
---|