compile stub main if USE_DTLS not defined

This commit is contained in:
J Harper
2016-05-24 17:03:12 -07:00
parent 833e2891c3
commit 7a254a8ecf
4 changed files with 29 additions and 9 deletions

View File

@@ -34,7 +34,7 @@
#include "dtlsCommon.h"
#ifdef USE_CLIENT_SIDE_SSL
#if defined(USE_DTLS) && defined(USE_CLIENT_SIDE_SSL)
static int packet_loss_prob = 0; /* Reciprocal of packet loss probability
(i.e. P(packet loss) = 1/x).
@@ -1087,15 +1087,15 @@ static int32 certCb(ssl_t *ssl, psX509Cert_t *cert, int32 alert)
#else
/******************************************************************************/
/*
Stub main for compiling without client enabled
Stub main for compiling without dtls and client enabled
*/
int32 main(int32 argc, char **argv)
{
printf("USE_CLIENT_SIDE_SSL must be enabled in matrixsslConfig.h at build" \
" time to run this application\n");
printf("USE_DTLS and USE_CLIENT_SIDE_SSL must be enabled in " \
"matrixsslConfig.h at build time to run this application\n");
return -1;
}
#endif /* USE_CLIENT_SIDE_SSL */
#endif /* USE_DTLS && USE_CLIENT_SIDE_SSL */
/******************************************************************************/

View File

@@ -31,6 +31,8 @@
#include "dtlsCommon.h"
#ifdef USE_DTLS
#ifdef DTLS_PACKET_LOSS_TEST
static int num_dropped = 0;
#endif /* DTLS_PACKET_LOSS_TEST */
@@ -121,3 +123,5 @@ int32 udpSend(SOCKET s, unsigned char *buf, int len,
#endif /* DTLS_PACKET_LOSS_TEST */
return len;
}
#endif /* USE_DTLS */

View File

@@ -34,9 +34,7 @@
#include "matrixssl/matrixsslApi.h"
#ifndef USE_DTLS
#error USE_DTLS must be defined in matrixsslConfig.h
#endif
#ifdef USE_DTLS
#include <stdlib.h>
#include <string.h>
@@ -60,7 +58,6 @@
#define MSG_DONTWAIT 0
#endif /* WIN32 */
#ifdef __cplusplus
extern "C" {
#endif
@@ -116,6 +113,7 @@ extern int32 udpSend(SOCKET s, unsigned char *buf, int len,
}
#endif
#endif /* USE_DTLS */
#endif /* _h_DTLSCOMMON */
/******************************************************************************/

View File

@@ -39,6 +39,9 @@
#endif
#include "dtlsCommon.h"
#ifdef USE_DTLS
#include "../../crypto/cryptoApi.h"
/* #define USE_CERT_VALIDATOR */
@@ -1265,3 +1268,18 @@ static void closeClientList()
psFree(clientTable, NULL);
tableSize = 0;
}
#else
/******************************************************************************/
/*
Stub main for compiling without dtls enabled
*/
int32 main(int32 argc, char **argv)
{
printf("USE_DTLS must be enabled in " \
"matrixsslConfig.h at build time to run this application\n");
return -1;
}
#endif /* USE_DTLS */
/******************************************************************************/