1 /* Definitions for the stream-based netstrmsworking class.
2  *
3  * Copyright 2007-2021 Rainer Gerhards and Adiscon GmbH.
4  *
5  * This file is part of the rsyslog runtime library.
6  *
7  * The rsyslog runtime library is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * The rsyslog runtime library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with the rsyslog runtime library.  If not, see <http://www.gnu.org/licenses/>.
19  *
20  * A copy of the GPL can be found in the file "COPYING" in this distribution.
21  * A copy of the LGPL can be found in the file "COPYING.LESSER" in this distribution.
22  */
23 
24 #ifndef INCLUDED_NETSTRMS_H
25 #define INCLUDED_NETSTRMS_H
26 
27 #include "nsd.h" /* we need our driver interface to be defined */
28 
29 /* the netstrms object */
30 struct netstrms_s {
31 	BEGINobjInstance;	/* Data to implement generic object - MUST be the first data element! */
32 	uchar *pBaseDrvrName;	/**< nsd base driver name to use, or NULL if system default */
33 	uchar *pDrvrName;	/**< full base driver name (set when driver is loaded) */
34 	int iDrvrMode;		/**< current default driver mode */
35 	uchar *pszDrvrAuthMode;	/**< current driver authentication mode */
36 	int DrvrChkExtendedKeyUsage;		/**< if true, verify extended key usage in certs */
37 	int DrvrPrioritizeSan;		/**< if true, perform stricter checking of names in certs */
38 	int DrvrVerifyDepth;		/**< Verify Depth for certificate chains */
39 	uchar *pszDrvrPermitExpiredCerts;
40 	const uchar *pszDrvrCAFile;
41 	const uchar *pszDrvrKeyFile;
42 	const uchar *pszDrvrCertFile;
43 	uchar *gnutlsPriorityString; /**< priorityString for connection */
44 	permittedPeers_t *pPermPeers;/**< current driver's permitted peers */
45 	rsRetVal(*fLstnInitDrvr)(netstrm_t*); /**< "late" driver-specific lstn init function NULL if none */
46 
47 	nsd_if_t Drvr;		/**< our stream driver */
48 };
49 
50 
51 /* interface */
52 BEGINinterface(netstrms) /* name must also be changed in ENDinterface macro! */
53 	rsRetVal (*Construct)(netstrms_t **ppThis);
54 	rsRetVal (*ConstructFinalize)(netstrms_t *pThis);
55 	rsRetVal (*Destruct)(netstrms_t **ppThis);
56 	rsRetVal (*CreateStrm)(netstrms_t *pThis, netstrm_t **ppStrm);
57 	rsRetVal (*SetDrvrName)(netstrms_t *pThis, uchar *pszName);
58 	rsRetVal (*SetDrvrMode)(netstrms_t *pThis, int iMode);
59 	rsRetVal (*SetDrvrAuthMode)(netstrms_t *pThis, uchar*);
60 	rsRetVal (*SetDrvrPermitExpiredCerts)(netstrms_t *pThis, uchar*);
61 	rsRetVal (*SetDrvrPermPeers)(netstrms_t *pThis, permittedPeers_t*);
62 	int      (*GetDrvrMode)(netstrms_t *pThis);
63 	uchar*   (*GetDrvrAuthMode)(netstrms_t *pThis);
64 	uchar*   (*GetDrvrPermitExpiredCerts)(netstrms_t *pThis);
65 	permittedPeers_t* (*GetDrvrPermPeers)(netstrms_t *pThis);
66 	rsRetVal (*SetDrvrGnutlsPriorityString)(netstrms_t *pThis, uchar*);
67 	uchar*   (*GetDrvrGnutlsPriorityString)(netstrms_t *pThis);
68 	rsRetVal (*SetDrvrCheckExtendedKeyUsage)(netstrms_t *pThis, int ChkExtendedKeyUsage);
69 	int      (*GetDrvrCheckExtendedKeyUsage)(netstrms_t *pThis);
70 	rsRetVal (*SetDrvrPrioritizeSAN)(netstrms_t *pThis, int prioritizeSan);
71 	int      (*GetDrvrPrioritizeSAN)(netstrms_t *pThis);
72 	rsRetVal (*SetDrvrTlsVerifyDepth)(netstrms_t *pThis, int verifyDepth);
73 	int      (*GetDrvrTlsVerifyDepth)(netstrms_t *pThis);
74 	/* v2 */
75 	rsRetVal (*SetDrvrTlsCAFile)(netstrms_t *pThis, const uchar *);
76 	const uchar* (*GetDrvrTlsCAFile)(netstrms_t *pThis);
77 	rsRetVal (*SetDrvrTlsKeyFile)(netstrms_t *pThis, const uchar *);
78 	const uchar* (*GetDrvrTlsKeyFile)(netstrms_t *pThis);
79 	rsRetVal (*SetDrvrTlsCertFile)(netstrms_t *pThis, const uchar *);
80 	const uchar* (*GetDrvrTlsCertFile)(netstrms_t *pThis);
81 
82 ENDinterface(netstrms)
83 #define netstrmsCURR_IF_VERSION 2 /* increment whenever you change the interface structure! */
84 
85 /* prototypes */
86 PROTOTYPEObj(netstrms);
87 
88 /* the name of our library binary */
89 #define LM_NETSTRMS_FILENAME "lmnetstrms"
90 
91 #endif /* #ifndef INCLUDED_NETSTRMS_H */
92