nscdcli.h revision 158115
1158115Sume/*-
2158115Sume * Copyright (c) 2004 Michael Bushkov <bushman@rsu.ru>
3158115Sume * All rights reserved.
4158115Sume *
5158115Sume * Redistribution and use in source and binary forms, with or without
6158115Sume * modification, are permitted provided that the following conditions
7158115Sume * are met:
8158115Sume * 1. Redistributions of source code must retain the above copyright
9158115Sume *    notice, this list of conditions and the following disclaimer.
10158115Sume * 2. Redistributions in binary form must reproduce the above copyright
11158115Sume *    notice, this list of conditions and the following disclaimer in the
12158115Sume *    documentation and/or other materials provided with the distribution.
13158115Sume *
14158115Sume * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15158115Sume * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16158115Sume * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17158115Sume * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18158115Sume * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19158115Sume * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20158115Sume * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21158115Sume * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22158115Sume * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23158115Sume * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24158115Sume * SUCH DAMAGE.
25158115Sume *
26158115Sume * $FreeBSD: head/usr.sbin/nscd/nscdcli.h 158115 2006-04-28 12:03:38Z ume $
27158115Sume */
28158115Sume
29158115Sume#ifndef __CACHED_CACHEDCLI_H__
30158115Sume#define __CACHED_CACHEDCLI_H__
31158115Sume
32158115Sumestruct cached_connection_params {
33158115Sume	char	*socket_path;
34158115Sume	struct	timeval	timeout;
35158115Sume};
36158115Sume
37158115Sumestruct cached_connection_ {
38158115Sume	int	sockfd;
39158115Sume	int read_queue;
40158115Sume	int write_queue;
41158115Sume};
42158115Sume
43158115Sume/* simple abstractions for not to write "struct" every time */
44158115Sumetypedef struct cached_connection_		*cached_connection;
45158115Sumetypedef struct cached_connection_		*cached_mp_write_session;
46158115Sumetypedef struct cached_connection_		*cached_mp_read_session;
47158115Sume
48158115Sume#define	INVALID_CACHED_CONNECTION	(NULL)
49158115Sume
50158115Sume/* initialization/destruction routines */
51158115Sumeextern	cached_connection	open_cached_connection__(
52158115Sume	struct cached_connection_params const *);
53158115Sumeextern	void	close_cached_connection__(cached_connection);
54158115Sume
55158115Sumeextern	int cached_transform__(cached_connection, const char *, int);
56158115Sume
57158115Sume#endif
58