dmlite
0.6
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
include
dmlite
c
checksums.h
Go to the documentation of this file.
1
/** @file include/dmlite/c/utils.h
2
* @brief C wrapper for DMLite utils.
3
* @author Alejandro Álvarez Ayllon <aalvarez@cern.ch>
4
*/
5
#ifndef DMLITE_CHECKSUMS_H
6
#define DMLITE_CHECKSUMS_H
7
8
#include <stddef.h>
9
#include "
io.h
"
10
11
#ifdef __cplusplus
12
extern
"C"
{
13
#endif
14
15
/**
16
* @brief Puts into output the full name of the checksum algorithm
17
* specified with shortName.
18
* @param shortName The checksum short name (CS, AD, MD)
19
* @param output The full name will be put here.
20
* @param osize The size of the buffer pointed by output.
21
* @return The same value as the pointer output
22
*/
23
char
*
dmlite_checksum_full_name
(
const
char
* shortName,
char
* output,
24
size_t
osize);
25
/**
26
* @brief Puts into output the short name of the checksum algorithm
27
* specified with longName.
28
* @param shortName The checksum long name (MD5, ADLER32, ...)
29
* @param output The short name will be put here.
30
* @param osize The size of the buffer pointed by output.
31
* @return The same value as the pointer output
32
*/
33
char
*
dmlite_checksum_short_name
(
const
char
* longName,
char
* output,
34
size_t
osize);
35
36
/**
37
* @brief Generated the MD5 checksum of the given file.
38
* @param fd The file descriptor where to read the data to digest.
39
* @param offset Where to start to digest.
40
* @param size The number of bytes to digest. 0 means the whole file.
41
* @param output Where to put the resulting checksum (in hexadecimal)
42
* @param outsize The size of the memory area pointed by output.
43
* @return 0 on success, error code otherwise.
44
*/
45
int
dmlite_checksum_md5
(
dmlite_fd
* fd, off_t offset, off_t size,
46
char
* output,
size_t
outsize);
47
48
/**
49
* @brief Generated the CRC32 checksum of the given file.
50
* @param fd The file descriptor where to read the data to digest.
51
* @param offset Where to start to digest.
52
* @param size The number of bytes to digest. 0 means the whole file.
53
* @param output Where to put the resulting checksum (in decimal)
54
* @param outsize The size of the memory area pointed by output.
55
* @return 0 on success, error code otherwise.
56
*/
57
int
dmlite_checksum_crc32
(
dmlite_fd
* fd, off_t offset, off_t size,
58
char
* output,
size_t
outsize);
59
60
/**
61
* @brief Generated the Adler32 checksum of the given file.
62
* @param fd The file descriptor where to read the data to digest.
63
* @param offset Where to start to digest.
64
* @param size The number of bytes to digest. 0 means the whole file.
65
* @param output Where to put the resulting checksum (in hexadecimal)
66
* @param outsize The size of the memory area pointed by output.
67
* @return 0 on success, error code otherwise.
68
*/
69
int
dmlite_checksum_adler32
(
dmlite_fd
* fd, off_t offset, off_t size,
70
char
* output,
size_t
outsize);
71
72
#ifdef __cplusplus
73
}
74
#endif
75
76
#endif
/* DMLITE_CHECKSUMS_H */
Generated on Fri Jul 12 2013 07:34:22 for dmlite by
1.8.3.1