xref: /titanic_41/usr/src/lib/libsum/common/sum.h (revision 581cede61ac9c14d8d4ea452562a567189eead78)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1996-2008 AT&T Intellectual Property          *
5 *                      and is licensed under the                       *
6 *                  Common Public License, Version 1.0                  *
7 *                    by AT&T Intellectual Property                     *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *            http://www.opensource.org/licenses/cpl1.0.txt             *
11 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
12 *                                                                      *
13 *              Information and Software Systems Research               *
14 *                            AT&T Research                             *
15 *                           Florham Park NJ                            *
16 *                                                                      *
17 *                 Glenn Fowler <gsf@research.att.com>                  *
18 *                                                                      *
19 ***********************************************************************/
20 #pragma prototyped
21 
22 /*
23  * Glenn Fowler
24  * AT&T Research
25  *
26  * checksum library interface
27  */
28 
29 #ifndef _SUM_H
30 #define _SUM_H
31 
32 #include <ast.h>
33 
34 #define SUM_SIZE	(1<<0)		/* print size too		*/
35 #define SUM_SCALE	(1<<1)		/* traditional size scale	*/
36 #define SUM_TOTAL	(1<<2)		/* print totals since sumopen	*/
37 #define SUM_LEGACY	(1<<3)		/* legacy field widths		*/
38 
39 #define _SUM_PUBLIC_	const char*	name;
40 
41 typedef struct Sumdata_s
42 {
43 	uint32_t	size;
44 	uint32_t	num;
45 	void*		buf;
46 } Sumdata_t;
47 
48 typedef struct Sum_s
49 {
50 	_SUM_PUBLIC_
51 #ifdef	_SUM_PRIVATE_
52 	_SUM_PRIVATE_
53 #endif
54 } Sum_t;
55 
56 extern Sum_t*	sumopen(const char*);
57 extern int	suminit(Sum_t*);
58 extern int	sumblock(Sum_t*, const void*, size_t);
59 extern int	sumdone(Sum_t*);
60 extern int	sumdata(Sum_t*, Sumdata_t*);
61 extern int	sumprint(Sum_t*, Sfio_t*, int, size_t);
62 extern int	sumusage(Sfio_t*);
63 extern int	sumclose(Sum_t*);
64 
65 #endif
66