Skip to content

Commit

Permalink
Add 'DISABLE_PEER_SIGNALING'
Browse files Browse the repository at this point in the history
Allows library to be used without MQTT/HTTP dependencies

Resolves #102
  • Loading branch information
Sean-Der committed Sep 3, 2024
1 parent dfb7f4c commit 65d5168
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@
// #define LOG_LEVEL LEVEL_DEBUG
#define LOG_REDIRECT 0

// Disable MQTT and HTTP signaling
// #define DISABLE_PEER_SIGNALING 1

#endif // CONFIG_H_
2 changes: 2 additions & 0 deletions src/peer_signaling.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifndef DISABLE_PEER_SIGNALING
#include <assert.h>
#include <cJSON.h>
#include <signal.h>
Expand Down Expand Up @@ -526,3 +527,4 @@ void peer_signaling_set_config(ServiceConfiguration* service_config) {
g_ps.pc = service_config->pc;
peer_connection_onicecandidate(g_ps.pc, peer_signaling_onicecandidate);
}
#endif // DISABLE_PEER_SIGNALING
4 changes: 4 additions & 0 deletions src/peer_signaling.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
extern "C" {
#endif

#ifndef DISABLE_PEER_SIGNALING

typedef struct ServiceConfiguration {
const char* mqtt_url;
int mqtt_port;
Expand Down Expand Up @@ -46,4 +48,6 @@ int peer_signaling_loop();
}
#endif

#endif // DISABLE_PEER_SIGNALING

#endif // PEER_SIGNALING_H_
2 changes: 2 additions & 0 deletions src/ssl_transport.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifndef DISABLE_PEER_SIGNALING
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -122,3 +123,4 @@ int ssl_transport_send(NetworkContext_t* net_ctx, const void* buf, size_t len) {

return ret;
}
#endif // DISABLE_PEER_SIGNALING
3 changes: 3 additions & 0 deletions src/ssl_transport.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef SSL_TRANSPORT_H_
#define SSL_TRANSPORT_H_

#ifndef DISABLE_PEER_SIGNALING

#include <mbedtls/ctr_drbg.h>
#include <mbedtls/entropy.h>
#include <mbedtls/ssl.h>
Expand Down Expand Up @@ -29,4 +31,5 @@ int ssl_transport_recv(NetworkContext_t* net_ctx, void* buf, size_t len);

int ssl_transport_send(NetworkContext_t* net_ctx, const void* buf, size_t len);

#ifndef // DISABLE_PEER_SIGNALING
#endif // SSL_TRANSPORT_H_

0 comments on commit 65d5168

Please sign in to comment.