/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1996-2010 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* man this is sum library
*/
#define _SUM_PRIVATE_ \
#include <sum.h>
#include <ctype.h>
#include <swap.h>
#include <hashpart.h>
typedef struct Method_s
{
const char* match;
const char* description;
const char* options;
int scale;
} Method_t;
typedef struct Map_s
{
const char* match;
const char* description;
const char* map;
} Map_t;
/*
* 16 and 32 bit common code
*/
#define _INTEGRAL_PRIVATE_ \
typedef struct Integral_s
{
} Integral_t;
static Sum_t*
{
Integral_t* p;
{
}
return (Sum_t*)p;
}
static int
{
((Integral_t*)p)->sum = 0;
return 0;
}
static int
{
register Integral_t* x = (Integral_t*)p;
return 0;
}
static int
{
register Integral_t* x = (Integral_t*)p;
return 0;
}
static int
{
register Integral_t* x = (Integral_t*)p;
register uint32_t c;
register uintmax_t z;
register size_t n;
{
z = SCALE(z, n);
}
return 0;
}
static int
{
register Integral_t* x = (Integral_t*)p;
return 0;
}
#include "sum-att.c"
#include "sum-ast4.c"
#include "sum-bsd.c"
#include "sum-crc.c"
#include "sum-prng.c"
#include "sum-lmd.c"
#else
#include "sum-md5.c"
#include "sum-sha1.c"
#include "sum-sha2.c"
#endif
/*
* now the library interface
*/
#define METHOD(x) x##_match,x##_description,x##_options,x##_open,x##_init,x##_block,x##_data,x##_print,x##_done,x##_scale
{
#ifdef md4_description
#endif
#ifdef md5_description
#endif
#ifdef sha1_description
#endif
#ifdef sha256_description
#endif
#ifdef sha384_description
#endif
#ifdef sha512_description
#endif
};
{
{
"posix|cksum|std|standard",
"The posix 1003.2-1992 32 bit crc checksum. This is the"
" default \bcksum\b(1) method.",
"crc-0x04c11db7-rotate-done-size"
},
{
"zip",
"The \bzip\b(1) crc.",
"crc-0xedb88320-init-done"
},
{
"fddi",
"The FDDI crc.",
"crc-0xedb88320-size=0xcc55cc55"
},
{
"fnv|fnv1",
"The Fowler-Noll-Vo 32 bit PRNG hash with non-zero"
" initializer (FNV-1).",
"prng-0x01000193-init=0x811c9dc5"
},
{
"ast|strsum",
"The \bast\b \bstrsum\b(3) PRNG hash.",
"prng-0x63c63cd9-add=0x9c39c33d"
},
};
/*
* simple alternation prefix match
*/
static int
match(register const char* s, register const char* p)
{
register const char* b = s;
for (;;)
{
do
{
if (*p == '|' || *p == 0)
return 1;
} while (*s++ == *p++);
for (;;)
{
switch (*p++)
{
case 0:
return 0;
case '|':
break;
default:
continue;
}
break;
}
s = b;
}
return 0;
}
/*
* open sum method name
*/
{
register int n;
name = "default";
for (n = 0; n < elementsof(maps); n++)
{
break;
}
for (n = 0; n < elementsof(methods); n++)
return 0;
}
/*
* initialize for a new run of blocks
*/
int
{
p->size = 0;
}
/*
* compute the running sum on buf
*/
int
{
}
/*
* done with this run of blocks
*/
int
{
p->total_count++;
p->total_size += p->size;
}
/*
* print the sum [size] on sp
*/
int
{
}
/*
* return the current sum (internal) data
*/
int
{
}
/*
* close an open sum handle
*/
int
{
free(p);
return 0;
}
/*
* print the checksum method optget(3) usage on sp and return the length
*/
int
{
register int i;
register int n;
for (i = n = 0; i < elementsof(methods); i++)
{
}
for (i = 0; i < elementsof(maps); i++)
n += sfprintf(sp, "[+%s?%s Shorthand for \b%s\b.]", maps[i].match, maps[i].description, maps[i].map);
return n;
}