Revision 237 (by dpavlin, 2004/03/08 17:43:12) initial import of openisis 0.9.0 vendor drop
/*
	openisis - an open implementation of the CDS/ISIS database
	Version 0.8.x (patchlevel see file Version)
	Copyright (C) 2001-2003 by Erik Grziwotz, erik@openisis.org

	This library is free software; you can redistribute it and/or
	modify it under the terms of the GNU Lesser General Public
	License as published by the Free Software Foundation; either
	version 2.1 of the License, or (at your option) any later version.

	This library is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

	see README for more information
EOH */
#ifndef LCLI_H
#define LCLI_H

/*
	$Id: lcli.h,v 1.8 2003/05/06 21:01:21 mawag Exp $
	OpenIsis client side of communication
*/

typedef struct CliChnl {
	int  sd;   /* socket */
	int  err;  /* errno */
} CliChnl;

/**	open channel and connect to server.
	@return 0 success, <0 error code
*/
extern int cliConnect (CliChnl *ch, const char *hostname, int port);

/**	close channel.
*/
extern void cliClose (CliChnl *ch);

/** serialize and write record.
	@return number of bytes written, <0 error code
*/
extern int cliWrite (CliChnl *ch, Rec *rec);

/**	deserialize record from stream using plain protocol.
	@param str input stream
	@param stat internal state, must be initialized with 0 before first call
	@param rec address of record to fill
	@return 0 - more input needed, 1 - done, <0 error code
*/
extern int cliPlain (Stream str, int *stat, Rec **rec);

/**	read and deserialize record.
	@return deserialized record, 0 on error
*/
extern Rec* cliRead (CliChnl *ch);

#endif /* LCLI_H */