|
@@ -1,12 +1,30 @@
|
|
-
|
|
|
|
- #include <rtc/rtc.h>
|
|
|
|
-
|
|
|
|
- #include <stdbool.h>
|
|
|
|
- #include <stdio.h>
|
|
|
|
- #include <stdlib.h>
|
|
|
|
- #include <string.h>
|
|
|
|
- #include <unistd.h> // for sleep
|
|
|
|
- #include <ctype.h>
|
|
|
|
|
|
+/**
|
|
|
|
+ * Copyright (c) 2020 Paul-Louis Ageneau
|
|
|
|
+ * Copyright (c) 2020 stevedanOgochu
|
|
|
|
+ *
|
|
|
|
+ * This library is free software; you can redistribute it and/or
|
|
|
|
+ * modify it under the terms of the GNU Lesser General Public
|
|
|
|
+ * License as published by the Free Software Foundation; either
|
|
|
|
+ * version 2.1 of the License, or (at your option) any later version.
|
|
|
|
+ *
|
|
|
|
+ * This library is distributed in the hope that it will be useful,
|
|
|
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
+ * Lesser General Public License for more details.
|
|
|
|
+ *
|
|
|
|
+ * You should have received a copy of the GNU Lesser General Public
|
|
|
|
+ * License along with this library; if not, write to the Free Software
|
|
|
|
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+#include <rtc/rtc.h>
|
|
|
|
+
|
|
|
|
+#include <stdbool.h>
|
|
|
|
+#include <stdio.h>
|
|
|
|
+#include <stdlib.h>
|
|
|
|
+#include <string.h>
|
|
|
|
+#include <unistd.h> // for sleep
|
|
|
|
+#include <ctype.h>
|
|
|
|
|
|
typedef struct {
|
|
typedef struct {
|
|
rtcState state;
|
|
rtcState state;
|
|
@@ -17,7 +35,9 @@ typedef struct {
|
|
} Peer;
|
|
} Peer;
|
|
|
|
|
|
Peer *peer = NULL;
|
|
Peer *peer = NULL;
|
|
|
|
+
|
|
static void dataChannelCallback(int dc, void *ptr);
|
|
static void dataChannelCallback(int dc, void *ptr);
|
|
|
|
+
|
|
static void descriptionCallback(const char *sdp, const char *type, void *ptr);
|
|
static void descriptionCallback(const char *sdp, const char *type, void *ptr);
|
|
|
|
|
|
static void candidateCallback(const char *cand, const char *mid, void *ptr);
|
|
static void candidateCallback(const char *cand, const char *mid, void *ptr);
|
|
@@ -26,17 +46,16 @@ static void stateChangeCallback(rtcState state, void *ptr);
|
|
|
|
|
|
static void gatheringStateCallback(rtcGatheringState state, void *ptr);
|
|
static void gatheringStateCallback(rtcGatheringState state, void *ptr);
|
|
|
|
|
|
-
|
|
|
|
static void closedCallback(void *ptr);
|
|
static void closedCallback(void *ptr);
|
|
|
|
|
|
static void messageCallback(const char *message, int size, void *ptr);
|
|
static void messageCallback(const char *message, int size, void *ptr);
|
|
|
|
|
|
static void deletePeer(Peer *peer);
|
|
static void deletePeer(Peer *peer);
|
|
|
|
+
|
|
int all_space(const char *str);
|
|
int all_space(const char *str);
|
|
char* state_print(rtcState state);
|
|
char* state_print(rtcState state);
|
|
char* rtcGatheringState_print(rtcState state);
|
|
char* rtcGatheringState_print(rtcState state);
|
|
|
|
|
|
-
|
|
|
|
int main(int argc, char **argv) {
|
|
int main(int argc, char **argv) {
|
|
rtcInitLogger(RTC_LOG_DEBUG);
|
|
rtcInitLogger(RTC_LOG_DEBUG);
|
|
|
|
|