Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libuv support #7

Open
wants to merge 64 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
d7ee97f
Make it possible to create a DTLS socket without having an UDP socket…
lgrahl Oct 31, 2016
b3beb21
Raise FD_EXCEPT on EPOLLHUP (fixes closed pipes)
lgrahl Mar 1, 2017
f05afb5
Add the possibility to set Diffie-Hellman parameters
lgrahl Oct 20, 2016
ddc1ab1
Add Libs.private to pkg-config file
lgrahl Mar 22, 2017
8bf8b72
Merge branch 'dtls-socketless' into rawrtc-patched
lgrahl Mar 22, 2017
00a0945
Merge branch 'pipe-epoll-fix' into rawrtc-patched
lgrahl Mar 22, 2017
0ac7a62
Merge branch 'tls-set-dh-params' into rawrtc-patched
lgrahl Mar 22, 2017
69da9f1
Add install-static option to Makefile
lgrahl Mar 22, 2017
b614d2e
Merge branch 'makefile-improvements' into rawrtc-patched
lgrahl Mar 22, 2017
24ac34c
Print OpenSSL sysroot on make info
lgrahl Mar 22, 2017
114883e
Merge branch 'makefile-improvements' into rawrtc-patched
lgrahl Mar 22, 2017
0071283
Fix add include and libs directory when using `OPENSSL_SYSROOT`
lgrahl Mar 22, 2017
df950db
Merge branch 'makefile-improvements' into rawrtc-patched
lgrahl Mar 22, 2017
29b5a2b
Remove `OPENSSL_SYSROOT` (`SYSROOT_ALT` should be sufficient)
lgrahl Mar 22, 2017
adbe6a6
Merge branch 'makefile-improvements' into rawrtc-patched
lgrahl Mar 22, 2017
6abcc92
Explicitly use `long` as value for `SSL_CTX_set_ecdh_auto` call
lgrahl Mar 22, 2017
0fc077c
Merge branch 'tls-set-dh-params' into rawrtc-patched
lgrahl Mar 22, 2017
3762eb8
Fix use `long` for `SSL_CTX_set_ecdh_auto` and `SSL_CTX_set_tmp_ecdh`…
lgrahl Mar 26, 2017
12ae81d
Merge branch 'tls-set-dh-params' into rawrtc-patched
lgrahl Mar 26, 2017
ecc1a62
Handle %h prefixed (short) types in formatter functions
lgrahl Mar 27, 2017
d52e2df
Merge branch 'support-fmt-h' into rawrtc-patched
lgrahl Mar 27, 2017
5bedf3b
Allow 'c='-line in SPD media to be explicitly set to unspecified
lgrahl Apr 6, 2017
c709622
Merge branch 'sdp-media-address' into rawrtc-patched
lgrahl Apr 6, 2017
8aca84a
Allow to exclude direction attribute
lgrahl Apr 7, 2017
6f1f67a
Merge branch 'sdp-media-exclude-ldir' into rawrtc-patched
lgrahl Apr 7, 2017
35f6d0b
Less code duplication
lgrahl Apr 11, 2017
c12309a
Use `PREFIX ?= ...` instead of `ifndef`
lgrahl Apr 28, 2017
3844e14
Less code duplication
lgrahl Apr 11, 2017
728577b
Use `PREFIX ?= ...` instead of `ifndef`
lgrahl Apr 28, 2017
93b3fa3
Remove `install-static` target
lgrahl Apr 28, 2017
585f196
Merge branch 'makefile-improvements' into rawrtc-patched
lgrahl Apr 28, 2017
1c36501
Raise FD_EXCEPT on EPOLLHUP (fixes closed pipes)
lgrahl Mar 1, 2017
57ca16a
Make it possible to create a DTLS socket without having an UDP socket…
lgrahl Oct 31, 2016
e2c464e
Allow 'c='-line in SPD media to be explicitly set to unspecified
lgrahl Apr 6, 2017
625c787
Allow 'c='-line in SPD media to be explicitly set to unspecified
lgrahl Apr 6, 2017
0616c5e
Allow to exclude direction attribute
lgrahl Apr 7, 2017
96110a7
Merge branch 'pipe-epoll-fix' into rawrtc-patched
lgrahl May 8, 2017
ab1d110
Merge branch 'dtls-socketless' into rawrtc-patched
lgrahl May 8, 2017
640b305
Merge branch 'sdp-media-address' into rawrtc-patched
lgrahl May 8, 2017
f01cf0c
Merge branch 'sdp-media-exclude-ldir' into rawrtc-patched
lgrahl May 8, 2017
cf8bcea
Merge branch 'master' into rawrtc-patched
lgrahl Jun 14, 2017
244e02f
Return whether the packet has been handled in `dtls_receive`.
lgrahl Jul 28, 2017
6c90041
Merge branch 'dtls-socketless' into rawrtc-patched
lgrahl Jul 28, 2017
3a6d314
Make headroom of an outgoing DTLS packet configurable
lgrahl Jul 28, 2017
9d1ba44
Merge branch 'dtls-configurable-headroom' into rawrtc-patched
lgrahl Jul 28, 2017
fcb10a0
Make it possible to create a DTLS socket without having an UDP socket…
lgrahl Oct 31, 2016
53ee9fa
Return whether the packet has been handled in `dtls_receive`.
lgrahl Jul 28, 2017
97f455c
Make headroom of an outgoing DTLS packet configurable
lgrahl Jul 28, 2017
9db0181
Raise FD_EXCEPT on EPOLLHUP (fixes closed pipes)
lgrahl Mar 1, 2017
631c880
Handle %h prefixed (short) types in formatter functions
lgrahl Mar 27, 2017
3d990f6
Add the possibility to set Diffie-Hellman parameters
lgrahl Oct 20, 2016
8c98282
Explicitly use `long` as value for `SSL_CTX_set_ecdh_auto` call
lgrahl Mar 22, 2017
4deed71
Fix use `long` for `SSL_CTX_set_ecdh_auto` and `SSL_CTX_set_tmp_ecdh`…
lgrahl Mar 26, 2017
762f98f
Merge branch 'master' into rawrtc-patched
lgrahl Feb 11, 2018
7b52ff0
Merge branch 'dtls-configurable-headroom' into rawrtc-patched
lgrahl Feb 11, 2018
3a376df
Merge branch 'dtls-socketless' into rawrtc-patched
lgrahl Feb 11, 2018
954b254
Merge branch 'pipe-epoll-fix' into rawrtc-patched
lgrahl Feb 11, 2018
485ee70
Merge branch 'support-fmt-h' into rawrtc-patched
lgrahl Feb 11, 2018
7d83790
Merge branch 'tls-set-dh-params' into rawrtc-patched
lgrahl Feb 11, 2018
4681816
Merge branch 'master' into rawrtc-patched
lgrahl Oct 8, 2018
eed008c
BoringSSL compatilibity fixes
Oct 30, 2018
65ed024
Merge remote-tracking branch 'origin/rawrtc-patched'
Oct 31, 2018
a53d284
Initial work
Nov 2, 2018
f6dba97
libuv support
nachooya Nov 3, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions include/re_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
* Copyright (C) 2010 Creytiv.com
*/

#ifdef HAVE_LIBUV
#include <uv.h>
#endif

enum {
#ifndef FD_READ
Expand Down Expand Up @@ -41,6 +44,9 @@ int libre_init(void);
void libre_close(void);

int re_main(re_signal_h *signalh);
#if HAVE_LIBUV
int re_main_uvloop (uv_loop_t* loop, re_signal_h *signalh );
#endif
void re_cancel(void);
int re_debug(struct re_printf *pf, void *unused);

Expand All @@ -59,11 +65,13 @@ enum poll_method {
METHOD_SELECT,
METHOD_EPOLL,
METHOD_KQUEUE,
METHOD_LIBUV,
/* sep */
METHOD_MAX
};

int poll_method_set(enum poll_method method);
enum poll_method poll_method_get (void);
enum poll_method poll_method_best(void);
const char *poll_method_name(enum poll_method method);
int poll_method_type(enum poll_method *method, const struct pl *name);
1 change: 1 addition & 0 deletions include/re_sdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ void sdp_media_set_lbandwidth(struct sdp_media *m, enum sdp_bandwidth type,
void sdp_media_set_lport_rtcp(struct sdp_media *m, uint16_t port);
void sdp_media_set_laddr_rtcp(struct sdp_media *m, const struct sa *laddr);
void sdp_media_set_ldir(struct sdp_media *m, enum sdp_dir dir);
void sdp_media_ldir_exclude(struct sdp_media *m, bool exclude);
int sdp_media_set_lattr(struct sdp_media *m, bool replace,
const char *name, const char *value, ...);
void sdp_media_del_lattr(struct sdp_media *m, const char *name);
Expand Down
11 changes: 11 additions & 0 deletions include/re_tls.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ int tls_srtp_keyinfo(const struct tls_conn *tc, enum srtp_suite *suite,
uint8_t *srv_key, size_t srv_key_size);
const char *tls_cipher_name(const struct tls_conn *tc);
int tls_set_ciphers(struct tls *tls, const char *cipherv[], size_t count);
int tls_set_dh_params_pem(struct tls *tls, const char *pem, size_t len);
int tls_set_dh_params_der(struct tls *tls, const uint8_t *der, size_t len);
int tls_set_servername(struct tls_conn *tc, const char *servername);


Expand All @@ -66,6 +68,9 @@ int tls_start_tcp(struct tls_conn **ptc, struct tls *tls,
/* UDP (DTLS) */

typedef void (dtls_conn_h)(const struct sa *peer, void *arg);
typedef int (dtls_send_h)(struct tls_conn *tc, const struct sa *dst,
struct mbuf *mb, void *arg);
typedef size_t (dtls_mtu_h)(struct tls_conn *tc, void *arg);
typedef void (dtls_estab_h)(void *arg);
typedef void (dtls_recv_h)(struct mbuf *mb, void *arg);
typedef void (dtls_close_h)(int err, void *arg);
Expand All @@ -75,8 +80,13 @@ struct dtls_sock;
int dtls_listen(struct dtls_sock **sockp, const struct sa *laddr,
struct udp_sock *us, uint32_t htsize, int layer,
dtls_conn_h *connh, void *arg);
int dtls_socketless(struct dtls_sock **sockp, uint32_t htsize,
dtls_conn_h *connh, dtls_send_h *sendh, dtls_mtu_h *mtuh,
void *arg);
struct udp_sock *dtls_udp_sock(struct dtls_sock *sock);
void dtls_set_mtu(struct dtls_sock *sock, size_t mtu);
size_t dtls_headroom(struct dtls_sock *sock);
void dtls_set_headroom(struct dtls_sock *sock, size_t headroom);
int dtls_connect(struct tls_conn **ptc, struct tls *tls,
struct dtls_sock *sock, const struct sa *peer,
dtls_estab_h *estabh, dtls_recv_h *recvh,
Expand All @@ -86,6 +96,7 @@ int dtls_accept(struct tls_conn **ptc, struct tls *tls,
dtls_estab_h *estabh, dtls_recv_h *recvh,
dtls_close_h *closeh, void *arg);
int dtls_send(struct tls_conn *tc, struct mbuf *mb);
bool dtls_receive(struct dtls_sock *sock, struct sa *src, struct mbuf *mb);
void dtls_set_handlers(struct tls_conn *tc, dtls_estab_h *estabh,
dtls_recv_h *recvh, dtls_close_h *closeh, void *arg);
const struct sa *dtls_peer(const struct tls_conn *tc);
Expand Down
6 changes: 6 additions & 0 deletions include/re_tmr.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
* Copyright (C) 2010 Creytiv.com
*/

#ifdef HAVE_LIBUV
#include <uv.h>
#endif

/**
* Defines the timeout handler
Expand All @@ -18,6 +21,9 @@ struct tmr {
tmr_h *th; /**< Timeout handler */
void *arg; /**< Handler argument */
uint64_t jfs; /**< Jiffies for timeout */
#ifdef HAVE_LIBUV
uv_timer_t* uv_timer; /**< libbuv handler */
#endif
};


Expand Down
10 changes: 10 additions & 0 deletions mk/re.mk
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,15 @@ CFLAGS += -DUSE_ZLIB
LIBS += -lz
endif

USE_LIBUV := $(shell [ -f $(SYSROOT)/include/uv.h ] || \
[ -f $(SYSROOT)/local/include/uv.h ] || \
[ -f $(SYSROOT_ALT)/include/uv.h ] && echo "yes")

ifneq ($(USE_LIBUV),)
CFLAGS += -D_XOPEN_SOURCE=600 -DHAVE_LIBUV
LIBS += -luv
endif


ifneq ($(OS),win32)

Expand Down Expand Up @@ -687,6 +696,7 @@ info:
@echo " USE_DTLS: $(USE_DTLS)"
@echo " USE_DTLS_SRTP: $(USE_DTLS_SRTP)"
@echo " USE_ZLIB: $(USE_ZLIB)"
@echo " USE_LIBUV: $(USE_LIBUV)"
@echo " GCOV: $(GCOV)"
@echo " GPROF: $(GPROF)"
@echo " CROSS_COMPILE: $(CROSS_COMPILE)"
Expand Down
5 changes: 5 additions & 0 deletions src/fmt/print.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ int re_vhprintf(const char *fmt, va_list ap, re_vprintf_h *vph, void *arg)
}
break;

case 'h':
lenmod = LENMOD_NONE;
fm = true;
break;

case 'H':
ph = va_arg(ap, re_printf_h *);
ph_arg = va_arg(ap, void *);
Expand Down
Loading