Debian Codegraph @

runtime/cryprov.h

raw
1 /* The interface definition for (file) crypto providers.
2 *
3 * This is just an abstract driver interface, which needs to be
4 * implemented by concrete classes.
5 *
6 * Copyright 2013 Adiscon GmbH.
7 *
8 * This file is part of the rsyslog runtime library.
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 * -or-
16 * see COPYING.ASL20 in the source distribution
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 */
24 #ifndef INCLUDED_CRYPROV_H
25 #define INCLUDED_CRYPROV_H
26
27 /* we unfortunately need to have two different param names depending on the
28 * context in which parameters are set. Other than (re/over)engineering the core
29 * interface, we just define some values to keep track of that.
30 */
31 #define CRYPROV_PARAMTYPE_REGULAR 0
32 #define CRYPROV_PARAMTYPE_DISK 1
33
34 /* interface */
35 BEGINinterface(cryprov) /* name must also be changed in ENDinterface macro! */
36 rsRetVal (*Construct)(void *ppThis);
37 rsRetVal (*SetCnfParam)(void *ppThis, struct nvlst *lst, int paramType);
38 rsRetVal (*Destruct)(void *ppThis);
39 rsRetVal (*OnFileOpen)(void *pThis, uchar *fn, void *pFileInstData, char openMode);
40 rsRetVal (*Encrypt)(void *pFileInstData, uchar *buf, size_t *lenBuf);
41 rsRetVal (*Decrypt)(void *pFileInstData, uchar *buf, size_t *lenBuf);
42 rsRetVal (*OnFileClose)(void *pFileInstData, off64_t offsLogfile);
43 rsRetVal (*DeleteStateFiles)(uchar *logfn);
44 rsRetVal (*GetBytesLeftInBlock)(void *pFileInstData, ssize_t *left);
45 void (*SetDeleteOnClose)(void *pFileInstData, int val);
46 ENDinterface(cryprov)
47 #define cryprovCURR_IF_VERSION 3 /* increment whenever you change the interface structure! */
48 #endif /* #ifndef INCLUDED_CRYPROV_H */