1 /*
2  * Intracluster message object (struct ha_msg)
3  *
4  * Copyright (C) 1999, 2000 Guochun Shi<gshi@unix.sh>
5  * This software licensed under the GNU LGPL.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  *
21  */
22 
23 #ifndef NET_STRING_H
24 #define NET_STRING_H
25 #include <stdlib.h>
26 #include <stdio.h>
27 #include <ha_msg.h>
28 
29 extern gboolean cl_msg_quiet_fmterr;
30 
31 /* Convert a message to netstring data */
32 char*			msg2netstring(const struct ha_msg*, size_t*);
33 char *		msg2netstring_noauth(const struct ha_msg *m, size_t * slen);
34 
35 /* Convert netstring data to a message */
36 struct ha_msg *		netstring2msg(const char*, size_t, int);
37 
38 /* Is this netstring authentic? */
39 int			is_auth_netstring(const char* datap, size_t datalen,
40 					  const char* authstring, size_t authlen);
41 
42 void cl_set_authentication_computation_method(int (*method)(int authmethod
43 ,	const void * data
44 ,	size_t datalen
45 ,	char * authstr
46 ,	size_t authlen));
47 
48 #endif
49