mirror of https://github.com/sipwise/rtpengine.git
commitchanges/73/27473/22029144368Author: Richard Fuchs <rfuchs@sipwise.com> Date: Thu Feb 21 13:12:50 2019 -0500 TT#52651 switch TCP to TLS Change-Id: Iab6b05d3b5c88553cbd6f531f3189084d9e71995 commitb28e718ee4Author: Richard Fuchs <rfuchs@sipwise.com> Date: Fri Feb 22 09:20:54 2019 -0500 TT#52651 generalise streambuf interface Change-Id: I7d5ab8ffe13e52d4dbb1901531cc13fcc173d60d commitcb2dbd2a92Author: Richard Fuchs <rfuchs@sipwise.com> Date: Tue Feb 19 09:32:56 2019 -0500 TT#52651 add start/stop forwarding commands and party selection logic Change-Id: I8ef7e288d3a3e485bd2fa14e1a2407a0c8d94bac commit442c48f627Author: Richard Fuchs <rfuchs@sipwise.com> Date: Thu Feb 14 15:43:23 2019 -0500 TT#52651 produce output for TCP forwarding feature Change-Id: I18543921577faf655679829684f5af46c0af5054 commit2ef8028eb2Author: Richard Fuchs <rfuchs@sipwise.com> Date: Thu Feb 14 10:18:21 2019 -0500 TT#52651 make recording to output files optional Change-Id: I12c288b965641352658ce3b499c2ee90593e1322 commit10a58cd7a0Author: Richard Fuchs <rfuchs@sipwise.com> Date: Wed Feb 13 16:02:16 2019 -0500 TT#52651 strip streambuf into lib and include in recording daemon Change-Id: I1f6638961e9e767063e0b4e6b5d55d88799366d3 commit9d3bb5bffcAuthor: Richard Fuchs <rfuchs@sipwise.com> Date: Wed Feb 13 15:40:12 2019 -0500 TT#52651 extract/move unrelated old legacy decoder struct members Change-Id: Iffd79b43180c30a9e128a460f7ba85ba49dedeaf commit1bc38e4201Author: Richard Fuchs <rfuchs@sipwise.com> Date: Tue Feb 12 16:43:42 2019 -0500 TT#52651 config options for forwarding option Change-Id: Ieaa2ee0e55a0c531158174bc6a534738a64dbee6 commit06d61cd3ddAuthor: Richard Fuchs <rfuchs@sipwise.com> Date: Tue Feb 12 16:29:52 2019 -0500 TT#52651 move socket.[ch] into lib/ includes necessary re-shuffling of additional code pieces Change-Id: I74b314ab5936ac8a0eeaff94e084617b59b28d79 Change-Id: I025e8ec86b90ede79565542dff57ec1559d04200
parent
b290bb8a98
commit
3b28460507
@ -0,0 +1,51 @@
|
|||||||
|
#include "ssllib.h"
|
||||||
|
#include <openssl/ssl.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
|
||||||
|
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||||
|
static mutex_t *openssl_locks;
|
||||||
|
|
||||||
|
static void cb_openssl_threadid(CRYPTO_THREADID *tid) {
|
||||||
|
pthread_t me;
|
||||||
|
|
||||||
|
me = pthread_self();
|
||||||
|
|
||||||
|
if (sizeof(me) == sizeof(void *))
|
||||||
|
CRYPTO_THREADID_set_pointer(tid, (void *) me);
|
||||||
|
else
|
||||||
|
CRYPTO_THREADID_set_numeric(tid, (unsigned long) me);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void cb_openssl_lock(int mode, int type, const char *file, int line) {
|
||||||
|
if ((mode & CRYPTO_LOCK))
|
||||||
|
mutex_lock(&openssl_locks[type]);
|
||||||
|
else
|
||||||
|
mutex_unlock(&openssl_locks[type]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void make_OpenSSL_thread_safe(void) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
openssl_locks = malloc(sizeof(*openssl_locks) * CRYPTO_num_locks());
|
||||||
|
for (i = 0; i < CRYPTO_num_locks(); i++)
|
||||||
|
mutex_init(&openssl_locks[i]);
|
||||||
|
|
||||||
|
CRYPTO_THREADID_set_callback(cb_openssl_threadid);
|
||||||
|
CRYPTO_set_locking_callback(cb_openssl_lock);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static void make_OpenSSL_thread_safe(void) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
void rtpe_ssl_init(void) {
|
||||||
|
struct timespec ts;
|
||||||
|
clock_gettime(CLOCK_REALTIME, &ts);
|
||||||
|
srandom(ts.tv_sec ^ ts.tv_nsec);
|
||||||
|
SSL_library_init();
|
||||||
|
SSL_load_error_strings();
|
||||||
|
make_OpenSSL_thread_safe();
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef __SSLLIB_H__
|
||||||
|
#define __SSLLIB_H__
|
||||||
|
|
||||||
|
|
||||||
|
void rtpe_ssl_init(void);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
#include "poller.h"
|
||||||
|
|
||||||
|
void poller_blocked(struct poller *p, void *fdp) {
|
||||||
|
p->state = PS_WRITE_BLOCKED;
|
||||||
|
}
|
||||||
|
int poller_isblocked(struct poller *p, void *fdp) {
|
||||||
|
return p->state != PS_OPEN;
|
||||||
|
}
|
||||||
|
void poller_error(struct poller *p, void *fdp) {
|
||||||
|
p->state = PS_ERROR;
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
#ifndef __POLLER_H__
|
||||||
|
#define __POLLER_H__
|
||||||
|
|
||||||
|
|
||||||
|
// dummy poller
|
||||||
|
struct poller {
|
||||||
|
enum {
|
||||||
|
PS_CLOSED = 0,
|
||||||
|
PS_CONNECTING,
|
||||||
|
PS_HANDSHAKE,
|
||||||
|
PS_OPEN,
|
||||||
|
PS_WRITE_BLOCKED,
|
||||||
|
PS_ERROR,
|
||||||
|
} state;
|
||||||
|
};
|
||||||
|
|
||||||
|
void poller_blocked(struct poller *, void *);
|
||||||
|
int poller_isblocked(struct poller *, void *);
|
||||||
|
void poller_error(struct poller *, void *);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Reference in new issue