summaryrefslogtreecommitdiffstats
path: root/runtime/nsd_gtls.h
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-06-24 15:12:22 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-06-24 15:12:22 +0200
commitb5d8f5d96aeff3e95cac135f9250da6e9d799382 (patch)
tree36c2a72530fa881120cf2cd315784461d6a8d25c /runtime/nsd_gtls.h
parentb711a34a075cf3979f48937f8af8b05030644e82 (diff)
downloadrsyslog-b5d8f5d96aeff3e95cac135f9250da6e9d799382.tar.gz
rsyslog-b5d8f5d96aeff3e95cac135f9250da6e9d799382.tar.xz
rsyslog-b5d8f5d96aeff3e95cac135f9250da6e9d799382.zip
added support for EGAIN while trying to receive data on gTLS session
This maps to bugzilla bug 83: http://bugzilla.adiscon.com/show_bug.cgi?id=83 This is the first test version, posted to user for repro of the problem. It contains code to handle the case, HOWEVER, I have not been able to test it in a scenario where a retry actually happens while receiving (I dont't get this in my environment). So I assume it is buggy and will probably not work.
Diffstat (limited to 'runtime/nsd_gtls.h')
-rw-r--r--runtime/nsd_gtls.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/runtime/nsd_gtls.h b/runtime/nsd_gtls.h
index d6821dce..52eea8ee 100644
--- a/runtime/nsd_gtls.h
+++ b/runtime/nsd_gtls.h
@@ -26,6 +26,8 @@
#include "nsd.h"
+#define NSD_GTLS_MAX_RCVBUF 8 * 1024 /* max size of buffer for message reception */
+
typedef enum {
gtlsRtry_None = 0, /**< no call needs to be retried */
gtlsRtry_handshake = 1,
@@ -60,6 +62,9 @@ struct nsd_gtls_s {
gnutls_x509_privkey ourKey; /**< our private key, if in client mode (unused in server mode) */
short bOurCertIsInit; /**< 1 if our certificate is initialized and must be deinit on destruction */
short bOurKeyIsInit; /**< 1 if our private key is initialized and must be deinit on destruction */
+ char *pszRcvBuf;
+ int lenRcvBuf; /**< -1: empty, 0: connection closed, 1..NSD_GTLS_MAX_RCVBUF-1: data of that size present */
+ int ptrRcvBuf; /**< offset for next recv operation if 0 < lenRcvBuf < NSD_GTLS_MAX_RCVBUF */
};
/* interface is defined in nsd.h, we just implement it! */
@@ -70,6 +75,16 @@ PROTOTYPEObj(nsd_gtls);
/* some prototypes for things used by our nsdsel_gtls helper class */
uchar *gtlsStrerror(int error);
rsRetVal gtlsChkPeerAuth(nsd_gtls_t *pThis);
+rsRetVal gtlsRecordRecv(nsd_gtls_t *pThis);
+static inline rsRetVal gtlsHasRcvInBuffer(nsd_gtls_t *pThis) {
+ /* we have a valid receive buffer one such is allocated and
+ * NOT exhausted!
+ */
+ dbgprintf("hasRcvInBuffer on nsd %p: pszRcvBuf %p, lenRcvBuf %d\n", pThis,
+ pThis->pszRcvBuf, pThis->lenRcvBuf);
+ return(pThis->pszRcvBuf != NULL && pThis->lenRcvBuf != -1);
+ }
+
/* the name of our library binary */
#define LM_NSD_GTLS_FILENAME "lmnsd_gtls"