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