From e8c2f949660b46b720c0f729c0ca3cd511b0efba Mon Sep 17 00:00:00 2001
From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com>
Date: Tue, 2 Feb 2021 21:43:37 +0100
Subject: [PATCH 01/18] Initial commit
---
.gitignore | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++++
LICENSE | 21 +++++++++++
README.md | 2 ++
3 files changed, 127 insertions(+)
create mode 100644 .gitignore
create mode 100644 LICENSE
create mode 100644 README.md
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..67045665
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,104 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+lerna-debug.log*
+
+# Diagnostic reports (https://nodejs.org/api/report.html)
+report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
+
+# Runtime data
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+*.lcov
+
+# nyc test coverage
+.nyc_output
+
+# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# Bower dependency directory (https://bower.io/)
+bower_components
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (https://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directories
+node_modules/
+jspm_packages/
+
+# TypeScript v1 declaration files
+typings/
+
+# TypeScript cache
+*.tsbuildinfo
+
+# Optional npm cache directory
+.npm
+
+# Optional eslint cache
+.eslintcache
+
+# Microbundle cache
+.rpt2_cache/
+.rts2_cache_cjs/
+.rts2_cache_es/
+.rts2_cache_umd/
+
+# Optional REPL history
+.node_repl_history
+
+# Output of 'npm pack'
+*.tgz
+
+# Yarn Integrity file
+.yarn-integrity
+
+# dotenv environment variables file
+.env
+.env.test
+
+# parcel-bundler cache (https://parceljs.org/)
+.cache
+
+# Next.js build output
+.next
+
+# Nuxt.js build / generate output
+.nuxt
+dist
+
+# Gatsby files
+.cache/
+# Comment in the public line in if your project uses Gatsby and *not* Next.js
+# https://nextjs.org/blog/next-9-1#public-directory-support
+# public
+
+# vuepress build output
+.vuepress/dist
+
+# Serverless directories
+.serverless/
+
+# FuseBox cache
+.fusebox/
+
+# DynamoDB Local files
+.dynamodb/
+
+# TernJS port file
+.tern-port
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000..5c3f22a6
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2021 Discord Open Source
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..c6705b32
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+# discord-voice
+A discord voice and video server
From 94c431ba9a45a477a604567780ee48564070c386 Mon Sep 17 00:00:00 2001
From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com>
Date: Tue, 9 Feb 2021 09:57:33 +0100
Subject: [PATCH 02/18] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index c6705b32..ebef54fe 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,2 @@
-# discord-voice
-A discord voice and video server
+# Fosscord-voice
+A Fosscord voice and video server
From c9e227e495a2041d74ed0187428972d4843499b6 Mon Sep 17 00:00:00 2001
From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com>
Date: Sat, 3 Apr 2021 15:22:07 +0200
Subject: [PATCH 03/18] :see_no_evil: add .DS_Store to .gitignore
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index 67045665..5c7cd31d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -102,3 +102,4 @@ dist
# TernJS port file
.tern-port
+.DS_Store
\ No newline at end of file
From 72d7171af756b86e495ee8f564f07e3d7677e3a9 Mon Sep 17 00:00:00 2001
From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com>
Date: Thu, 8 Apr 2021 04:45:31 +0200
Subject: [PATCH 04/18] :page_facing_up: use Creative Commons
Attribution-NonCommercial-ShareAlike 4.0 International Public License
---
LICENSE | 111 +++++++++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 94 insertions(+), 17 deletions(-)
diff --git a/LICENSE b/LICENSE
index 5c3f22a6..425b12be 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,21 +1,98 @@
-MIT License
+Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License
-Copyright (c) 2021 Discord Open Source
+Copyright (c) 2021 Fosscord
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
+By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
+Section 1 – Definitions.
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
+Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
+Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
+BY-NC-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License.
+Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
+Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
+Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
+License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution, NonCommercial, and ShareAlike.
+Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
+Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
+Licensor means the individual(s) or entity(ies) granting rights under this Public License.
+NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
+Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
+Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
+You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
+Section 2 – Scope.
+
+License grant.
+Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
+reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
+produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
+Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
+Term. The term of this Public License is specified in Section 6(a).
+Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
+Downstream recipients.
+Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
+Additional offer from the Licensor – Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply.
+No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
+No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
+Other rights.
+
+Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
+Patent and trademark rights are not licensed under this Public License.
+To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
+Section 3 – License Conditions.
+
+Your exercise of the Licensed Rights is expressly made subject to the following conditions.
+
+Attribution.
+
+If You Share the Licensed Material (including in modified form), You must:
+
+retain the following if it is supplied by the Licensor with the Licensed Material:
+identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
+a copyright notice;
+a notice that refers to this Public License;
+a notice that refers to the disclaimer of warranties;
+a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
+indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
+indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
+You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
+If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
+ShareAlike.
+In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
+
+The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-NC-SA Compatible License.
+You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
+You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
+Section 4 – Sui Generis Database Rights.
+
+Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
+
+for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
+if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
+You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
+For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
+Section 5 – Disclaimer of Warranties and Limitation of Liability.
+
+Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
+To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
+The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
+Section 6 – Term and Termination.
+
+This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
+Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
+
+automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
+upon express reinstatement by the Licensor.
+For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
+For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
+Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
+Section 7 – Other Terms and Conditions.
+
+The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
+Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
+Section 8 – Interpretation.
+
+For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
+To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
+No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
+Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
From 8d9965e5526f2bd81d0a702668ffefd8644cd6ef Mon Sep 17 00:00:00 2001
From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com>
Date: Sat, 24 Apr 2021 18:31:23 +0200
Subject: [PATCH 05/18] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index ebef54fe..ecd3c7ca 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,2 @@
-# Fosscord-voice
-A Fosscord voice and video server
+# Fosscord-media
+A Fosscord media (voice and video) server
From ce44ba9dc68d29314d3f6f4be812cad0146b6668 Mon Sep 17 00:00:00 2001
From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com>
Date: Sat, 8 May 2021 12:58:05 +0200
Subject: [PATCH 06/18] :page_facing_up: GPL V3 license
---
LICENSE | 106 ++++++--------------------------------------------------
1 file changed, 11 insertions(+), 95 deletions(-)
diff --git a/LICENSE b/LICENSE
index 425b12be..f19bf520 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,98 +1,14 @@
-Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License
+Copyright (C) 2021 Fosscord and contributors
-Copyright (c) 2021 Fosscord
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as
+published by the Free Software Foundation, either version 3 of the
+License, or (at your option) any later version.
-By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
+This program 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 Affero General Public License for more details.
-Section 1 – Definitions.
-
-Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
-Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
-BY-NC-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License.
-Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
-Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
-Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
-License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution, NonCommercial, and ShareAlike.
-Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
-Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
-Licensor means the individual(s) or entity(ies) granting rights under this Public License.
-NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
-Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
-Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
-You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
-Section 2 – Scope.
-
-License grant.
-Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
-reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
-produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
-Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
-Term. The term of this Public License is specified in Section 6(a).
-Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
-Downstream recipients.
-Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
-Additional offer from the Licensor – Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply.
-No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
-No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
-Other rights.
-
-Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
-Patent and trademark rights are not licensed under this Public License.
-To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
-Section 3 – License Conditions.
-
-Your exercise of the Licensed Rights is expressly made subject to the following conditions.
-
-Attribution.
-
-If You Share the Licensed Material (including in modified form), You must:
-
-retain the following if it is supplied by the Licensor with the Licensed Material:
-identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
-a copyright notice;
-a notice that refers to this Public License;
-a notice that refers to the disclaimer of warranties;
-a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
-indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
-indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
-You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
-If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
-ShareAlike.
-In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
-
-The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-NC-SA Compatible License.
-You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
-You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
-Section 4 – Sui Generis Database Rights.
-
-Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
-
-for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
-if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
-You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
-For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
-Section 5 – Disclaimer of Warranties and Limitation of Liability.
-
-Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
-To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
-The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
-Section 6 – Term and Termination.
-
-This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
-Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
-
-automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
-upon express reinstatement by the Licensor.
-For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
-For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
-Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
-Section 7 – Other Terms and Conditions.
-
-The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
-Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
-Section 8 – Interpretation.
-
-For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
-To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
-No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
-Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see .
\ No newline at end of file
From 7d40250c11077d6717388412479a65bb8826960b Mon Sep 17 00:00:00 2001
From: Newe
Date: Fri, 21 May 2021 11:13:17 +0200
Subject: [PATCH 07/18] [add] Basic project structure
---
.gitignore | 125 ++----
CMakeLists.txt | 32 ++
README.md | 14 +
config.json | 1 +
src/main.cpp | 36 ++
src/protodefs/include/protos.grpc.pb.cc | 86 +++++
src/protodefs/include/protos.grpc.pb.h | 295 ++++++++++++++
src/protodefs/include/protos.pb.cc | 487 ++++++++++++++++++++++++
src/protodefs/include/protos.pb.h | 413 ++++++++++++++++++++
src/protodefs/protos.proto | 24 ++
src/rpcStub.cpp | 24 ++
src/rpcStub.hpp | 10 +
src/rtcPeerHandler.cpp | 57 +++
src/rtcPeerHandler.hpp | 29 ++
src/rtcServer.hpp | 0
15 files changed, 1535 insertions(+), 98 deletions(-)
create mode 100644 CMakeLists.txt
create mode 100644 config.json
create mode 100644 src/main.cpp
create mode 100644 src/protodefs/include/protos.grpc.pb.cc
create mode 100644 src/protodefs/include/protos.grpc.pb.h
create mode 100644 src/protodefs/include/protos.pb.cc
create mode 100644 src/protodefs/include/protos.pb.h
create mode 100644 src/protodefs/protos.proto
create mode 100644 src/rpcStub.cpp
create mode 100644 src/rpcStub.hpp
create mode 100644 src/rtcPeerHandler.cpp
create mode 100644 src/rtcPeerHandler.hpp
create mode 100644 src/rtcServer.hpp
diff --git a/.gitignore b/.gitignore
index 5c7cd31d..788c5adb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,105 +1,34 @@
-# Logs
-logs
-*.log
-npm-debug.log*
-yarn-debug.log*
-yarn-error.log*
-lerna-debug.log*
+# Prerequisites
+*.d
-# Diagnostic reports (https://nodejs.org/api/report.html)
-report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
+# Compiled Object files
+*.slo
+*.lo
+*.o
+*.obj
-# Runtime data
-pids
-*.pid
-*.seed
-*.pid.lock
+# Precompiled Headers
+*.gch
+*.pch
-# Directory for instrumented libs generated by jscoverage/JSCover
-lib-cov
+# Compiled Dynamic libraries
+*.so
+*.dylib
+*.dll
-# Coverage directory used by tools like istanbul
-coverage
-*.lcov
+# Fortran module files
+*.mod
+*.smod
-# nyc test coverage
-.nyc_output
+# Compiled Static libraries
+*.lai
+*.la
+*.a
+*.lib
-# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
-.grunt
+# Executables
+*.o
-# Bower dependency directory (https://bower.io/)
-bower_components
-
-# node-waf configuration
-.lock-wscript
-
-# Compiled binary addons (https://nodejs.org/api/addons.html)
-build/Release
-
-# Dependency directories
-node_modules/
-jspm_packages/
-
-# TypeScript v1 declaration files
-typings/
-
-# TypeScript cache
-*.tsbuildinfo
-
-# Optional npm cache directory
-.npm
-
-# Optional eslint cache
-.eslintcache
-
-# Microbundle cache
-.rpt2_cache/
-.rts2_cache_cjs/
-.rts2_cache_es/
-.rts2_cache_umd/
-
-# Optional REPL history
-.node_repl_history
-
-# Output of 'npm pack'
-*.tgz
-
-# Yarn Integrity file
-.yarn-integrity
-
-# dotenv environment variables file
-.env
-.env.test
-
-# parcel-bundler cache (https://parceljs.org/)
-.cache
-
-# Next.js build output
-.next
-
-# Nuxt.js build / generate output
-.nuxt
-dist
-
-# Gatsby files
-.cache/
-# Comment in the public line in if your project uses Gatsby and *not* Next.js
-# https://nextjs.org/blog/next-9-1#public-directory-support
-# public
-
-# vuepress build output
-.vuepress/dist
-
-# Serverless directories
-.serverless/
-
-# FuseBox cache
-.fusebox/
-
-# DynamoDB Local files
-.dynamodb/
-
-# TernJS port file
-.tern-port
-.DS_Store
\ No newline at end of file
+# Directories
+build/
+.vscode/
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 00000000..cebd3adf
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 3.15)
+project(fosscord-media)
+
+set(CMAKE_CXX_STANDARD 17)
+
+find_package(Threads REQUIRED)
+find_package(Protobuf REQUIRED)
+find_package(gRPC CONFIG REQUIRED)
+find_package(absl REQUIRED)
+find_package(nlohmann_json REQUIRED)
+
+file(GLOB SourceFiles ${PROJECT_SOURCE_DIR}/src/*.cpp)
+
+file(GLOB ProtoFiles ${PROJECT_SOURCE_DIR}/src/protodefs/*.proto)
+set(PROTOBUF_INPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/src/protodefs)
+set(PROTOBUF_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/src/protodefs/include)
+
+foreach(file ${ProtoFiles})
+ execute_process(COMMAND "LD_LIBRARY_PATH=/usr/local/lib protoc --proto_path=\"${PROTOBUF_INPUT_DIRECTORY}\"
+ --cpp_out=\"${PROJECT_SOURCE_DIR}/src/protodefs/include\" --grpc_out=\"${PROJECT_SOURCE_DIR}/src/protodefs/include\"
+ --plugin=protoc-gen-grpc=/usr/local/bin/grpc_cpp_plugin protos.proto"
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
+endforeach()
+
+
+include_directories(${Protobuf_INCLUDE_DIRS})
+
+#protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ProtoFiles)
+
+add_executable(${CMAKE_PROJECT_NAME} ${SourceFiles})
+
+target_link_libraries(${CMAKE_PROJECT_NAME} datachannel gRPC::grpc++ absl::base absl::synchronization absl::strings ${Protobuf_LIBRARIES} nlohmann_json::nlohmann_json)
\ No newline at end of file
diff --git a/README.md b/README.md
index ecd3c7ca..4ddd4708 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,16 @@
# Fosscord-media
A Fosscord media (voice and video) server
+
+
+## Installation
+### Prerequisites
+- Install the [libdatachannel](https://github.com/paullouisageneau/libdatachannel) library
+- Install the [gRPC](https://github.com/grpc/grpc) library
+
+### Building
+
+```bash
+$ cmake
+$ cd build
+$ make
+```
diff --git a/config.json b/config.json
new file mode 100644
index 00000000..9e26dfee
--- /dev/null
+++ b/config.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 00000000..3f131512
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,36 @@
+// $$$$$$\ $$\
+// $$ __$$\ $$ |
+// $$ / \__|$$$$$$\ $$$$$$$\ $$$$$$$\ $$$$$$$\ $$$$$$\ $$$$$$\ $$$$$$$ |
+// $$$$\ $$ __$$\ $$ _____|$$ _____|$$ _____|$$ __$$\ $$ __$$\ $$ __$$ |
+// $$ _| $$ / $$ |\$$$$$$\ \$$$$$$\ $$ / $$ / $$ |$$ | \__|$$ / $$ |
+// $$ | $$ | $$ | \____$$\ \____$$\ $$ | $$ | $$ |$$ | $$ | $$ |
+// $$ | \$$$$$$ |$$$$$$$ |$$$$$$$ |\$$$$$$$\ \$$$$$$ |$$ | \$$$$$$$ |
+// \__| \______/ \_______/ \_______/ \_______| \______/ \__| \_______|
+//
+//
+//
+// $$\ $$$$$$\
+// \__| $$ __$$\
+// $$\ $$\ $$$$$$\ $$\ $$$$$$$\ $$$$$$\ $$ / \__| $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$\ $$$$$$\
+// \$$\ $$ |$$ __$$\ $$ |$$ _____|$$ __$$\ \$$$$$$\ $$ __$$\ $$ __$$\\$$\ $$ |$$ __$$\ $$ __$$\
+// \$$\$$ / $$ / $$ |$$ |$$ / $$$$$$$$ | \____$$\ $$$$$$$$ |$$ | \__|\$$\$$ / $$$$$$$$ |$$ | \__|
+// \$$$ / $$ | $$ |$$ |$$ | $$ ____|$$\ $$ |$$ ____|$$ | \$$$ / $$ ____|$$ |
+// \$ / \$$$$$$ |$$ |\$$$$$$$\ \$$$$$$$\ \$$$$$$ |\$$$$$$$\ $$ | \$ / \$$$$$$$\ $$ |
+// \_/ \______/ \__| \_______| \_______| \______/ \_______|\__| \_/ \_______|\__|
+//
+//
+//
+
+
+#include "rtcPeerHandler.hpp" //HAndle peer connection requests
+#include "rpcStub.hpp" //Handle gRPC communications between the different fosscord elements
+
+int main (int argc, char** argv){
+
+ auto handler = std::make_shared();
+ auto rpcHandler = std::unique_ptr();
+
+ std::cout << "Server created" <
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+namespace fosscordMedia {
+
+static const char* fosscordInternals_method_names[] = {
+ "/fosscordMedia.fosscordInternals/sendRequest",
+};
+
+std::unique_ptr< fosscordInternals::Stub> fosscordInternals::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) {
+ (void)options;
+ std::unique_ptr< fosscordInternals::Stub> stub(new fosscordInternals::Stub(channel, options));
+ return stub;
+}
+
+fosscordInternals::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options)
+ : channel_(channel), rpcmethod_sendRequest_(fosscordInternals_method_names[0], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel)
+ {}
+
+::grpc::Status fosscordInternals::Stub::sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::fosscordMedia::rpcResponse* response) {
+ return ::grpc::internal::BlockingUnaryCall< ::fosscordMedia::rpcRequest, ::fosscordMedia::rpcResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_sendRequest_, context, request, response);
+}
+
+void fosscordInternals::Stub::experimental_async::sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response, std::function f) {
+ ::grpc::internal::CallbackUnaryCall< ::fosscordMedia::rpcRequest, ::fosscordMedia::rpcResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_sendRequest_, context, request, response, std::move(f));
+}
+
+void fosscordInternals::Stub::experimental_async::sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) {
+ ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_sendRequest_, context, request, response, reactor);
+}
+
+::grpc::ClientAsyncResponseReader< ::fosscordMedia::rpcResponse>* fosscordInternals::Stub::PrepareAsyncsendRequestRaw(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::grpc::CompletionQueue* cq) {
+ return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::fosscordMedia::rpcResponse, ::fosscordMedia::rpcRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_sendRequest_, context, request);
+}
+
+::grpc::ClientAsyncResponseReader< ::fosscordMedia::rpcResponse>* fosscordInternals::Stub::AsyncsendRequestRaw(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::grpc::CompletionQueue* cq) {
+ auto* result =
+ this->PrepareAsyncsendRequestRaw(context, request, cq);
+ result->StartCall();
+ return result;
+}
+
+fosscordInternals::Service::Service() {
+ AddMethod(new ::grpc::internal::RpcServiceMethod(
+ fosscordInternals_method_names[0],
+ ::grpc::internal::RpcMethod::NORMAL_RPC,
+ new ::grpc::internal::RpcMethodHandler< fosscordInternals::Service, ::fosscordMedia::rpcRequest, ::fosscordMedia::rpcResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
+ [](fosscordInternals::Service* service,
+ ::grpc::ServerContext* ctx,
+ const ::fosscordMedia::rpcRequest* req,
+ ::fosscordMedia::rpcResponse* resp) {
+ return service->sendRequest(ctx, req, resp);
+ }, this)));
+}
+
+fosscordInternals::Service::~Service() {
+}
+
+::grpc::Status fosscordInternals::Service::sendRequest(::grpc::ServerContext* context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response) {
+ (void) context;
+ (void) request;
+ (void) response;
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+}
+
+
+} // namespace fosscordMedia
+
diff --git a/src/protodefs/include/protos.grpc.pb.h b/src/protodefs/include/protos.grpc.pb.h
new file mode 100644
index 00000000..0f7f5881
--- /dev/null
+++ b/src/protodefs/include/protos.grpc.pb.h
@@ -0,0 +1,295 @@
+// Generated by the gRPC C++ plugin.
+// If you make any local change, they will be lost.
+// source: protos.proto
+// Original file comments:
+// LD_LIBRARY_PATH=/usr/local/lib protoc --proto_path="/data/fosscord-media/src/protodefs" --cpp_out="/data/fosscord-media/src/protodefs/include" --grpc_out="/data/fosscord-media/src/protodefs/include" --plugin=protoc-gen-grpc=/usr/local/bin/grpc_cpp_plugin protos.proto
+//
+#ifndef GRPC_protos_2eproto__INCLUDED
+#define GRPC_protos_2eproto__INCLUDED
+
+#include "protos.pb.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace fosscordMedia {
+
+class fosscordInternals final {
+ public:
+ static constexpr char const* service_full_name() {
+ return "fosscordMedia.fosscordInternals";
+ }
+ class StubInterface {
+ public:
+ virtual ~StubInterface() {}
+ virtual ::grpc::Status sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::fosscordMedia::rpcResponse* response) = 0;
+ std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::fosscordMedia::rpcResponse>> AsyncsendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::fosscordMedia::rpcResponse>>(AsyncsendRequestRaw(context, request, cq));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::fosscordMedia::rpcResponse>> PrepareAsyncsendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::fosscordMedia::rpcResponse>>(PrepareAsyncsendRequestRaw(context, request, cq));
+ }
+ class experimental_async_interface {
+ public:
+ virtual ~experimental_async_interface() {}
+ virtual void sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response, std::function) = 0;
+ #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+ virtual void sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0;
+ #else
+ virtual void sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0;
+ #endif
+ };
+ #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+ typedef class experimental_async_interface async_interface;
+ #endif
+ #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+ async_interface* async() { return experimental_async(); }
+ #endif
+ virtual class experimental_async_interface* experimental_async() { return nullptr; }
+ private:
+ virtual ::grpc::ClientAsyncResponseReaderInterface< ::fosscordMedia::rpcResponse>* AsyncsendRequestRaw(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::grpc::CompletionQueue* cq) = 0;
+ virtual ::grpc::ClientAsyncResponseReaderInterface< ::fosscordMedia::rpcResponse>* PrepareAsyncsendRequestRaw(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::grpc::CompletionQueue* cq) = 0;
+ };
+ class Stub final : public StubInterface {
+ public:
+ Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());
+ ::grpc::Status sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::fosscordMedia::rpcResponse* response) override;
+ std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::fosscordMedia::rpcResponse>> AsyncsendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::fosscordMedia::rpcResponse>>(AsyncsendRequestRaw(context, request, cq));
+ }
+ std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::fosscordMedia::rpcResponse>> PrepareAsyncsendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::grpc::CompletionQueue* cq) {
+ return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::fosscordMedia::rpcResponse>>(PrepareAsyncsendRequestRaw(context, request, cq));
+ }
+ class experimental_async final :
+ public StubInterface::experimental_async_interface {
+ public:
+ void sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response, std::function) override;
+ #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+ void sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response, ::grpc::ClientUnaryReactor* reactor) override;
+ #else
+ void sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) override;
+ #endif
+ private:
+ friend class Stub;
+ explicit experimental_async(Stub* stub): stub_(stub) { }
+ Stub* stub() { return stub_; }
+ Stub* stub_;
+ };
+ class experimental_async_interface* experimental_async() override { return &async_stub_; }
+
+ private:
+ std::shared_ptr< ::grpc::ChannelInterface> channel_;
+ class experimental_async async_stub_{this};
+ ::grpc::ClientAsyncResponseReader< ::fosscordMedia::rpcResponse>* AsyncsendRequestRaw(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::grpc::CompletionQueue* cq) override;
+ ::grpc::ClientAsyncResponseReader< ::fosscordMedia::rpcResponse>* PrepareAsyncsendRequestRaw(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::grpc::CompletionQueue* cq) override;
+ const ::grpc::internal::RpcMethod rpcmethod_sendRequest_;
+ };
+ static std::unique_ptr NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());
+
+ class Service : public ::grpc::Service {
+ public:
+ Service();
+ virtual ~Service();
+ virtual ::grpc::Status sendRequest(::grpc::ServerContext* context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response);
+ };
+ template
+ class WithAsyncMethod_sendRequest : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
+ public:
+ WithAsyncMethod_sendRequest() {
+ ::grpc::Service::MarkMethodAsync(0);
+ }
+ ~WithAsyncMethod_sendRequest() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status sendRequest(::grpc::ServerContext* /*context*/, const ::fosscordMedia::rpcRequest* /*request*/, ::fosscordMedia::rpcResponse* /*response*/) override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ void RequestsendRequest(::grpc::ServerContext* context, ::fosscordMedia::rpcRequest* request, ::grpc::ServerAsyncResponseWriter< ::fosscordMedia::rpcResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
+ ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag);
+ }
+ };
+ typedef WithAsyncMethod_sendRequest AsyncService;
+ template
+ class ExperimentalWithCallbackMethod_sendRequest : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
+ public:
+ ExperimentalWithCallbackMethod_sendRequest() {
+ #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+ ::grpc::Service::
+ #else
+ ::grpc::Service::experimental().
+ #endif
+ MarkMethodCallback(0,
+ new ::grpc::internal::CallbackUnaryHandler< ::fosscordMedia::rpcRequest, ::fosscordMedia::rpcResponse>(
+ [this](
+ #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+ ::grpc::CallbackServerContext*
+ #else
+ ::grpc::experimental::CallbackServerContext*
+ #endif
+ context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response) { return this->sendRequest(context, request, response); }));}
+ void SetMessageAllocatorFor_sendRequest(
+ ::grpc::experimental::MessageAllocator< ::fosscordMedia::rpcRequest, ::fosscordMedia::rpcResponse>* allocator) {
+ #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+ ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(0);
+ #else
+ ::grpc::internal::MethodHandler* const handler = ::grpc::Service::experimental().GetHandler(0);
+ #endif
+ static_cast<::grpc::internal::CallbackUnaryHandler< ::fosscordMedia::rpcRequest, ::fosscordMedia::rpcResponse>*>(handler)
+ ->SetMessageAllocator(allocator);
+ }
+ ~ExperimentalWithCallbackMethod_sendRequest() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status sendRequest(::grpc::ServerContext* /*context*/, const ::fosscordMedia::rpcRequest* /*request*/, ::fosscordMedia::rpcResponse* /*response*/) override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+ virtual ::grpc::ServerUnaryReactor* sendRequest(
+ ::grpc::CallbackServerContext* /*context*/, const ::fosscordMedia::rpcRequest* /*request*/, ::fosscordMedia::rpcResponse* /*response*/)
+ #else
+ virtual ::grpc::experimental::ServerUnaryReactor* sendRequest(
+ ::grpc::experimental::CallbackServerContext* /*context*/, const ::fosscordMedia::rpcRequest* /*request*/, ::fosscordMedia::rpcResponse* /*response*/)
+ #endif
+ { return nullptr; }
+ };
+ #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+ typedef ExperimentalWithCallbackMethod_sendRequest CallbackService;
+ #endif
+
+ typedef ExperimentalWithCallbackMethod_sendRequest ExperimentalCallbackService;
+ template
+ class WithGenericMethod_sendRequest : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
+ public:
+ WithGenericMethod_sendRequest() {
+ ::grpc::Service::MarkMethodGeneric(0);
+ }
+ ~WithGenericMethod_sendRequest() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status sendRequest(::grpc::ServerContext* /*context*/, const ::fosscordMedia::rpcRequest* /*request*/, ::fosscordMedia::rpcResponse* /*response*/) override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ };
+ template
+ class WithRawMethod_sendRequest : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
+ public:
+ WithRawMethod_sendRequest() {
+ ::grpc::Service::MarkMethodRaw(0);
+ }
+ ~WithRawMethod_sendRequest() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status sendRequest(::grpc::ServerContext* /*context*/, const ::fosscordMedia::rpcRequest* /*request*/, ::fosscordMedia::rpcResponse* /*response*/) override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ void RequestsendRequest(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
+ ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag);
+ }
+ };
+ template
+ class ExperimentalWithRawCallbackMethod_sendRequest : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
+ public:
+ ExperimentalWithRawCallbackMethod_sendRequest() {
+ #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+ ::grpc::Service::
+ #else
+ ::grpc::Service::experimental().
+ #endif
+ MarkMethodRawCallback(0,
+ new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>(
+ [this](
+ #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+ ::grpc::CallbackServerContext*
+ #else
+ ::grpc::experimental::CallbackServerContext*
+ #endif
+ context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->sendRequest(context, request, response); }));
+ }
+ ~ExperimentalWithRawCallbackMethod_sendRequest() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable synchronous version of this method
+ ::grpc::Status sendRequest(::grpc::ServerContext* /*context*/, const ::fosscordMedia::rpcRequest* /*request*/, ::fosscordMedia::rpcResponse* /*response*/) override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
+ virtual ::grpc::ServerUnaryReactor* sendRequest(
+ ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/)
+ #else
+ virtual ::grpc::experimental::ServerUnaryReactor* sendRequest(
+ ::grpc::experimental::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/)
+ #endif
+ { return nullptr; }
+ };
+ template
+ class WithStreamedUnaryMethod_sendRequest : public BaseClass {
+ private:
+ void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
+ public:
+ WithStreamedUnaryMethod_sendRequest() {
+ ::grpc::Service::MarkMethodStreamed(0,
+ new ::grpc::internal::StreamedUnaryHandler<
+ ::fosscordMedia::rpcRequest, ::fosscordMedia::rpcResponse>(
+ [this](::grpc::ServerContext* context,
+ ::grpc::ServerUnaryStreamer<
+ ::fosscordMedia::rpcRequest, ::fosscordMedia::rpcResponse>* streamer) {
+ return this->StreamedsendRequest(context,
+ streamer);
+ }));
+ }
+ ~WithStreamedUnaryMethod_sendRequest() override {
+ BaseClassMustBeDerivedFromService(this);
+ }
+ // disable regular version of this method
+ ::grpc::Status sendRequest(::grpc::ServerContext* /*context*/, const ::fosscordMedia::rpcRequest* /*request*/, ::fosscordMedia::rpcResponse* /*response*/) override {
+ abort();
+ return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
+ }
+ // replace default version of method with streamed unary
+ virtual ::grpc::Status StreamedsendRequest(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::fosscordMedia::rpcRequest,::fosscordMedia::rpcResponse>* server_unary_streamer) = 0;
+ };
+ typedef WithStreamedUnaryMethod_sendRequest StreamedUnaryService;
+ typedef Service SplitStreamedService;
+ typedef WithStreamedUnaryMethod_sendRequest StreamedService;
+};
+
+} // namespace fosscordMedia
+
+
+#endif // GRPC_protos_2eproto__INCLUDED
diff --git a/src/protodefs/include/protos.pb.cc b/src/protodefs/include/protos.pb.cc
new file mode 100644
index 00000000..1e88f216
--- /dev/null
+++ b/src/protodefs/include/protos.pb.cc
@@ -0,0 +1,487 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: protos.proto
+
+#include "protos.pb.h"
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+// @@protoc_insertion_point(includes)
+#include
+
+PROTOBUF_PRAGMA_INIT_SEG
+namespace fosscordMedia {
+constexpr rpcRequest::rpcRequest(
+ ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
+ : a_(0){}
+struct rpcRequestDefaultTypeInternal {
+ constexpr rpcRequestDefaultTypeInternal()
+ : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
+ ~rpcRequestDefaultTypeInternal() {}
+ union {
+ rpcRequest _instance;
+ };
+};
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT rpcRequestDefaultTypeInternal _rpcRequest_default_instance_;
+constexpr rpcResponse::rpcResponse(
+ ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
+ : b_(0){}
+struct rpcResponseDefaultTypeInternal {
+ constexpr rpcResponseDefaultTypeInternal()
+ : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
+ ~rpcResponseDefaultTypeInternal() {}
+ union {
+ rpcResponse _instance;
+ };
+};
+PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT rpcResponseDefaultTypeInternal _rpcResponse_default_instance_;
+} // namespace fosscordMedia
+static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_protos_2eproto[2];
+static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_protos_2eproto = nullptr;
+static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_protos_2eproto = nullptr;
+
+const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_protos_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
+ ~0u, // no _has_bits_
+ PROTOBUF_FIELD_OFFSET(::fosscordMedia::rpcRequest, _internal_metadata_),
+ ~0u, // no _extensions_
+ ~0u, // no _oneof_case_
+ ~0u, // no _weak_field_map_
+ PROTOBUF_FIELD_OFFSET(::fosscordMedia::rpcRequest, a_),
+ ~0u, // no _has_bits_
+ PROTOBUF_FIELD_OFFSET(::fosscordMedia::rpcResponse, _internal_metadata_),
+ ~0u, // no _extensions_
+ ~0u, // no _oneof_case_
+ ~0u, // no _weak_field_map_
+ PROTOBUF_FIELD_OFFSET(::fosscordMedia::rpcResponse, b_),
+};
+static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
+ { 0, -1, sizeof(::fosscordMedia::rpcRequest)},
+ { 6, -1, sizeof(::fosscordMedia::rpcResponse)},
+};
+
+static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
+ reinterpret_cast(&::fosscordMedia::_rpcRequest_default_instance_),
+ reinterpret_cast(&::fosscordMedia::_rpcResponse_default_instance_),
+};
+
+const char descriptor_table_protodef_protos_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
+ "\n\014protos.proto\022\rfosscordMedia\"\027\n\nrpcRequ"
+ "est\022\t\n\001a\030\001 \001(\005\"\030\n\013rpcResponse\022\t\n\001b\030\001 \001(\005"
+ "2[\n\021fosscordInternals\022F\n\013sendRequest\022\031.f"
+ "osscordMedia.rpcRequest\032\032.fosscordMedia."
+ "rpcResponse\"\000b\006proto3"
+ ;
+static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_protos_2eproto_once;
+const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_protos_2eproto = {
+ false, false, 181, descriptor_table_protodef_protos_2eproto, "protos.proto",
+ &descriptor_table_protos_2eproto_once, nullptr, 0, 2,
+ schemas, file_default_instances, TableStruct_protos_2eproto::offsets,
+ file_level_metadata_protos_2eproto, file_level_enum_descriptors_protos_2eproto, file_level_service_descriptors_protos_2eproto,
+};
+PROTOBUF_ATTRIBUTE_WEAK ::PROTOBUF_NAMESPACE_ID::Metadata
+descriptor_table_protos_2eproto_metadata_getter(int index) {
+ ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_protos_2eproto);
+ return descriptor_table_protos_2eproto.file_level_metadata[index];
+}
+
+// Force running AddDescriptors() at dynamic initialization time.
+PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_protos_2eproto(&descriptor_table_protos_2eproto);
+namespace fosscordMedia {
+
+// ===================================================================
+
+class rpcRequest::_Internal {
+ public:
+};
+
+rpcRequest::rpcRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena)
+ : ::PROTOBUF_NAMESPACE_ID::Message(arena) {
+ SharedCtor();
+ RegisterArenaDtor(arena);
+ // @@protoc_insertion_point(arena_constructor:fosscordMedia.rpcRequest)
+}
+rpcRequest::rpcRequest(const rpcRequest& from)
+ : ::PROTOBUF_NAMESPACE_ID::Message() {
+ _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ a_ = from.a_;
+ // @@protoc_insertion_point(copy_constructor:fosscordMedia.rpcRequest)
+}
+
+void rpcRequest::SharedCtor() {
+a_ = 0;
+}
+
+rpcRequest::~rpcRequest() {
+ // @@protoc_insertion_point(destructor:fosscordMedia.rpcRequest)
+ SharedDtor();
+ _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
+}
+
+void rpcRequest::SharedDtor() {
+ GOOGLE_DCHECK(GetArena() == nullptr);
+}
+
+void rpcRequest::ArenaDtor(void* object) {
+ rpcRequest* _this = reinterpret_cast< rpcRequest* >(object);
+ (void)_this;
+}
+void rpcRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
+}
+void rpcRequest::SetCachedSize(int size) const {
+ _cached_size_.Set(size);
+}
+
+void rpcRequest::Clear() {
+// @@protoc_insertion_point(message_clear_start:fosscordMedia.rpcRequest)
+ ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ // Prevent compiler warnings about cached_has_bits being unused
+ (void) cached_has_bits;
+
+ a_ = 0;
+ _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
+}
+
+const char* rpcRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
+ while (!ctx->Done(&ptr)) {
+ ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+ CHK_(ptr);
+ switch (tag >> 3) {
+ // int32 a = 1;
+ case 1:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+ a_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+ CHK_(ptr);
+ } else goto handle_unusual;
+ continue;
+ default: {
+ handle_unusual:
+ if ((tag & 7) == 4 || tag == 0) {
+ ctx->SetLastTag(tag);
+ goto success;
+ }
+ ptr = UnknownFieldParse(tag,
+ _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
+ ptr, ctx);
+ CHK_(ptr != nullptr);
+ continue;
+ }
+ } // switch
+ } // while
+success:
+ return ptr;
+failure:
+ ptr = nullptr;
+ goto success;
+#undef CHK_
+}
+
+::PROTOBUF_NAMESPACE_ID::uint8* rpcRequest::_InternalSerialize(
+ ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+ // @@protoc_insertion_point(serialize_to_array_start:fosscordMedia.rpcRequest)
+ ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ (void) cached_has_bits;
+
+ // int32 a = 1;
+ if (this->a() != 0) {
+ target = stream->EnsureSpace(target);
+ target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_a(), target);
+ }
+
+ if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
+ target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
+ _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
+ }
+ // @@protoc_insertion_point(serialize_to_array_end:fosscordMedia.rpcRequest)
+ return target;
+}
+
+size_t rpcRequest::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:fosscordMedia.rpcRequest)
+ size_t total_size = 0;
+
+ ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ // Prevent compiler warnings about cached_has_bits being unused
+ (void) cached_has_bits;
+
+ // int32 a = 1;
+ if (this->a() != 0) {
+ total_size += 1 +
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
+ this->_internal_a());
+ }
+
+ if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
+ return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
+ _internal_metadata_, total_size, &_cached_size_);
+ }
+ int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
+ SetCachedSize(cached_size);
+ return total_size;
+}
+
+void rpcRequest::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
+// @@protoc_insertion_point(generalized_merge_from_start:fosscordMedia.rpcRequest)
+ GOOGLE_DCHECK_NE(&from, this);
+ const rpcRequest* source =
+ ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated(
+ &from);
+ if (source == nullptr) {
+ // @@protoc_insertion_point(generalized_merge_from_cast_fail:fosscordMedia.rpcRequest)
+ ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
+ } else {
+ // @@protoc_insertion_point(generalized_merge_from_cast_success:fosscordMedia.rpcRequest)
+ MergeFrom(*source);
+ }
+}
+
+void rpcRequest::MergeFrom(const rpcRequest& from) {
+// @@protoc_insertion_point(class_specific_merge_from_start:fosscordMedia.rpcRequest)
+ GOOGLE_DCHECK_NE(&from, this);
+ _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ (void) cached_has_bits;
+
+ if (from.a() != 0) {
+ _internal_set_a(from._internal_a());
+ }
+}
+
+void rpcRequest::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
+// @@protoc_insertion_point(generalized_copy_from_start:fosscordMedia.rpcRequest)
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+void rpcRequest::CopyFrom(const rpcRequest& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:fosscordMedia.rpcRequest)
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool rpcRequest::IsInitialized() const {
+ return true;
+}
+
+void rpcRequest::InternalSwap(rpcRequest* other) {
+ using std::swap;
+ _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ swap(a_, other->a_);
+}
+
+::PROTOBUF_NAMESPACE_ID::Metadata rpcRequest::GetMetadata() const {
+ return GetMetadataStatic();
+}
+
+
+// ===================================================================
+
+class rpcResponse::_Internal {
+ public:
+};
+
+rpcResponse::rpcResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena)
+ : ::PROTOBUF_NAMESPACE_ID::Message(arena) {
+ SharedCtor();
+ RegisterArenaDtor(arena);
+ // @@protoc_insertion_point(arena_constructor:fosscordMedia.rpcResponse)
+}
+rpcResponse::rpcResponse(const rpcResponse& from)
+ : ::PROTOBUF_NAMESPACE_ID::Message() {
+ _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ b_ = from.b_;
+ // @@protoc_insertion_point(copy_constructor:fosscordMedia.rpcResponse)
+}
+
+void rpcResponse::SharedCtor() {
+b_ = 0;
+}
+
+rpcResponse::~rpcResponse() {
+ // @@protoc_insertion_point(destructor:fosscordMedia.rpcResponse)
+ SharedDtor();
+ _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
+}
+
+void rpcResponse::SharedDtor() {
+ GOOGLE_DCHECK(GetArena() == nullptr);
+}
+
+void rpcResponse::ArenaDtor(void* object) {
+ rpcResponse* _this = reinterpret_cast< rpcResponse* >(object);
+ (void)_this;
+}
+void rpcResponse::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
+}
+void rpcResponse::SetCachedSize(int size) const {
+ _cached_size_.Set(size);
+}
+
+void rpcResponse::Clear() {
+// @@protoc_insertion_point(message_clear_start:fosscordMedia.rpcResponse)
+ ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ // Prevent compiler warnings about cached_has_bits being unused
+ (void) cached_has_bits;
+
+ b_ = 0;
+ _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
+}
+
+const char* rpcResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
+#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
+ while (!ctx->Done(&ptr)) {
+ ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+ ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
+ CHK_(ptr);
+ switch (tag >> 3) {
+ // int32 b = 1;
+ case 1:
+ if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+ b_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+ CHK_(ptr);
+ } else goto handle_unusual;
+ continue;
+ default: {
+ handle_unusual:
+ if ((tag & 7) == 4 || tag == 0) {
+ ctx->SetLastTag(tag);
+ goto success;
+ }
+ ptr = UnknownFieldParse(tag,
+ _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
+ ptr, ctx);
+ CHK_(ptr != nullptr);
+ continue;
+ }
+ } // switch
+ } // while
+success:
+ return ptr;
+failure:
+ ptr = nullptr;
+ goto success;
+#undef CHK_
+}
+
+::PROTOBUF_NAMESPACE_ID::uint8* rpcResponse::_InternalSerialize(
+ ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+ // @@protoc_insertion_point(serialize_to_array_start:fosscordMedia.rpcResponse)
+ ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ (void) cached_has_bits;
+
+ // int32 b = 1;
+ if (this->b() != 0) {
+ target = stream->EnsureSpace(target);
+ target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_b(), target);
+ }
+
+ if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
+ target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
+ _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
+ }
+ // @@protoc_insertion_point(serialize_to_array_end:fosscordMedia.rpcResponse)
+ return target;
+}
+
+size_t rpcResponse::ByteSizeLong() const {
+// @@protoc_insertion_point(message_byte_size_start:fosscordMedia.rpcResponse)
+ size_t total_size = 0;
+
+ ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ // Prevent compiler warnings about cached_has_bits being unused
+ (void) cached_has_bits;
+
+ // int32 b = 1;
+ if (this->b() != 0) {
+ total_size += 1 +
+ ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
+ this->_internal_b());
+ }
+
+ if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
+ return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
+ _internal_metadata_, total_size, &_cached_size_);
+ }
+ int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
+ SetCachedSize(cached_size);
+ return total_size;
+}
+
+void rpcResponse::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
+// @@protoc_insertion_point(generalized_merge_from_start:fosscordMedia.rpcResponse)
+ GOOGLE_DCHECK_NE(&from, this);
+ const rpcResponse* source =
+ ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated(
+ &from);
+ if (source == nullptr) {
+ // @@protoc_insertion_point(generalized_merge_from_cast_fail:fosscordMedia.rpcResponse)
+ ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
+ } else {
+ // @@protoc_insertion_point(generalized_merge_from_cast_success:fosscordMedia.rpcResponse)
+ MergeFrom(*source);
+ }
+}
+
+void rpcResponse::MergeFrom(const rpcResponse& from) {
+// @@protoc_insertion_point(class_specific_merge_from_start:fosscordMedia.rpcResponse)
+ GOOGLE_DCHECK_NE(&from, this);
+ _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
+ ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+ (void) cached_has_bits;
+
+ if (from.b() != 0) {
+ _internal_set_b(from._internal_b());
+ }
+}
+
+void rpcResponse::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
+// @@protoc_insertion_point(generalized_copy_from_start:fosscordMedia.rpcResponse)
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+void rpcResponse::CopyFrom(const rpcResponse& from) {
+// @@protoc_insertion_point(class_specific_copy_from_start:fosscordMedia.rpcResponse)
+ if (&from == this) return;
+ Clear();
+ MergeFrom(from);
+}
+
+bool rpcResponse::IsInitialized() const {
+ return true;
+}
+
+void rpcResponse::InternalSwap(rpcResponse* other) {
+ using std::swap;
+ _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ swap(b_, other->b_);
+}
+
+::PROTOBUF_NAMESPACE_ID::Metadata rpcResponse::GetMetadata() const {
+ return GetMetadataStatic();
+}
+
+
+// @@protoc_insertion_point(namespace_scope)
+} // namespace fosscordMedia
+PROTOBUF_NAMESPACE_OPEN
+template<> PROTOBUF_NOINLINE ::fosscordMedia::rpcRequest* Arena::CreateMaybeMessage< ::fosscordMedia::rpcRequest >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::fosscordMedia::rpcRequest >(arena);
+}
+template<> PROTOBUF_NOINLINE ::fosscordMedia::rpcResponse* Arena::CreateMaybeMessage< ::fosscordMedia::rpcResponse >(Arena* arena) {
+ return Arena::CreateMessageInternal< ::fosscordMedia::rpcResponse >(arena);
+}
+PROTOBUF_NAMESPACE_CLOSE
+
+// @@protoc_insertion_point(global_scope)
+#include
diff --git a/src/protodefs/include/protos.pb.h b/src/protodefs/include/protos.pb.h
new file mode 100644
index 00000000..bc310678
--- /dev/null
+++ b/src/protodefs/include/protos.pb.h
@@ -0,0 +1,413 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: protos.proto
+
+#ifndef GOOGLE_PROTOBUF_INCLUDED_protos_2eproto
+#define GOOGLE_PROTOBUF_INCLUDED_protos_2eproto
+
+#include
+#include
+
+#include
+#if PROTOBUF_VERSION < 3015000
+#error This file was generated by a newer version of protoc which is
+#error incompatible with your Protocol Buffer headers. Please update
+#error your headers.
+#endif
+#if 3015008 < PROTOBUF_MIN_PROTOC_VERSION
+#error This file was generated by an older version of protoc which is
+#error incompatible with your Protocol Buffer headers. Please
+#error regenerate this file with a newer version of protoc.
+#endif
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include // IWYU pragma: export
+#include // IWYU pragma: export
+#include
+// @@protoc_insertion_point(includes)
+#include
+#define PROTOBUF_INTERNAL_EXPORT_protos_2eproto
+PROTOBUF_NAMESPACE_OPEN
+namespace internal {
+class AnyMetadata;
+} // namespace internal
+PROTOBUF_NAMESPACE_CLOSE
+
+// Internal implementation detail -- do not use these members.
+struct TableStruct_protos_2eproto {
+ static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[]
+ PROTOBUF_SECTION_VARIABLE(protodesc_cold);
+ static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[]
+ PROTOBUF_SECTION_VARIABLE(protodesc_cold);
+ static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[2]
+ PROTOBUF_SECTION_VARIABLE(protodesc_cold);
+ static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
+ static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
+ static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
+};
+extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_protos_2eproto;
+::PROTOBUF_NAMESPACE_ID::Metadata descriptor_table_protos_2eproto_metadata_getter(int index);
+namespace fosscordMedia {
+class rpcRequest;
+struct rpcRequestDefaultTypeInternal;
+extern rpcRequestDefaultTypeInternal _rpcRequest_default_instance_;
+class rpcResponse;
+struct rpcResponseDefaultTypeInternal;
+extern rpcResponseDefaultTypeInternal _rpcResponse_default_instance_;
+} // namespace fosscordMedia
+PROTOBUF_NAMESPACE_OPEN
+template<> ::fosscordMedia::rpcRequest* Arena::CreateMaybeMessage<::fosscordMedia::rpcRequest>(Arena*);
+template<> ::fosscordMedia::rpcResponse* Arena::CreateMaybeMessage<::fosscordMedia::rpcResponse>(Arena*);
+PROTOBUF_NAMESPACE_CLOSE
+namespace fosscordMedia {
+
+// ===================================================================
+
+class rpcRequest PROTOBUF_FINAL :
+ public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:fosscordMedia.rpcRequest) */ {
+ public:
+ inline rpcRequest() : rpcRequest(nullptr) {}
+ virtual ~rpcRequest();
+ explicit constexpr rpcRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+
+ rpcRequest(const rpcRequest& from);
+ rpcRequest(rpcRequest&& from) noexcept
+ : rpcRequest() {
+ *this = ::std::move(from);
+ }
+
+ inline rpcRequest& operator=(const rpcRequest& from) {
+ CopyFrom(from);
+ return *this;
+ }
+ inline rpcRequest& operator=(rpcRequest&& from) noexcept {
+ if (GetArena() == from.GetArena()) {
+ if (this != &from) InternalSwap(&from);
+ } else {
+ CopyFrom(from);
+ }
+ return *this;
+ }
+
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
+ return GetDescriptor();
+ }
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
+ return GetMetadataStatic().descriptor;
+ }
+ static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
+ return GetMetadataStatic().reflection;
+ }
+ static const rpcRequest& default_instance() {
+ return *internal_default_instance();
+ }
+ static inline const rpcRequest* internal_default_instance() {
+ return reinterpret_cast(
+ &_rpcRequest_default_instance_);
+ }
+ static constexpr int kIndexInFileMessages =
+ 0;
+
+ friend void swap(rpcRequest& a, rpcRequest& b) {
+ a.Swap(&b);
+ }
+ inline void Swap(rpcRequest* other) {
+ if (other == this) return;
+ if (GetArena() == other->GetArena()) {
+ InternalSwap(other);
+ } else {
+ ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
+ }
+ }
+ void UnsafeArenaSwap(rpcRequest* other) {
+ if (other == this) return;
+ GOOGLE_DCHECK(GetArena() == other->GetArena());
+ InternalSwap(other);
+ }
+
+ // implements Message ----------------------------------------------
+
+ inline rpcRequest* New() const final {
+ return CreateMaybeMessage(nullptr);
+ }
+
+ rpcRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+ return CreateMaybeMessage(arena);
+ }
+ void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
+ void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
+ void CopyFrom(const rpcRequest& from);
+ void MergeFrom(const rpcRequest& from);
+ PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
+ bool IsInitialized() const final;
+
+ size_t ByteSizeLong() const final;
+ const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
+ ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
+ ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+ int GetCachedSize() const final { return _cached_size_.Get(); }
+
+ private:
+ inline void SharedCtor();
+ inline void SharedDtor();
+ void SetCachedSize(int size) const final;
+ void InternalSwap(rpcRequest* other);
+ friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
+ static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
+ return "fosscordMedia.rpcRequest";
+ }
+ protected:
+ explicit rpcRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena);
+ private:
+ static void ArenaDtor(void* object);
+ inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
+ public:
+
+ ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
+ private:
+ static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
+ return ::descriptor_table_protos_2eproto_metadata_getter(kIndexInFileMessages);
+ }
+
+ public:
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ enum : int {
+ kAFieldNumber = 1,
+ };
+ // int32 a = 1;
+ void clear_a();
+ ::PROTOBUF_NAMESPACE_ID::int32 a() const;
+ void set_a(::PROTOBUF_NAMESPACE_ID::int32 value);
+ private:
+ ::PROTOBUF_NAMESPACE_ID::int32 _internal_a() const;
+ void _internal_set_a(::PROTOBUF_NAMESPACE_ID::int32 value);
+ public:
+
+ // @@protoc_insertion_point(class_scope:fosscordMedia.rpcRequest)
+ private:
+ class _Internal;
+
+ template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
+ typedef void InternalArenaConstructable_;
+ typedef void DestructorSkippable_;
+ ::PROTOBUF_NAMESPACE_ID::int32 a_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ friend struct ::TableStruct_protos_2eproto;
+};
+// -------------------------------------------------------------------
+
+class rpcResponse PROTOBUF_FINAL :
+ public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:fosscordMedia.rpcResponse) */ {
+ public:
+ inline rpcResponse() : rpcResponse(nullptr) {}
+ virtual ~rpcResponse();
+ explicit constexpr rpcResponse(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
+
+ rpcResponse(const rpcResponse& from);
+ rpcResponse(rpcResponse&& from) noexcept
+ : rpcResponse() {
+ *this = ::std::move(from);
+ }
+
+ inline rpcResponse& operator=(const rpcResponse& from) {
+ CopyFrom(from);
+ return *this;
+ }
+ inline rpcResponse& operator=(rpcResponse&& from) noexcept {
+ if (GetArena() == from.GetArena()) {
+ if (this != &from) InternalSwap(&from);
+ } else {
+ CopyFrom(from);
+ }
+ return *this;
+ }
+
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
+ return GetDescriptor();
+ }
+ static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
+ return GetMetadataStatic().descriptor;
+ }
+ static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
+ return GetMetadataStatic().reflection;
+ }
+ static const rpcResponse& default_instance() {
+ return *internal_default_instance();
+ }
+ static inline const rpcResponse* internal_default_instance() {
+ return reinterpret_cast(
+ &_rpcResponse_default_instance_);
+ }
+ static constexpr int kIndexInFileMessages =
+ 1;
+
+ friend void swap(rpcResponse& a, rpcResponse& b) {
+ a.Swap(&b);
+ }
+ inline void Swap(rpcResponse* other) {
+ if (other == this) return;
+ if (GetArena() == other->GetArena()) {
+ InternalSwap(other);
+ } else {
+ ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
+ }
+ }
+ void UnsafeArenaSwap(rpcResponse* other) {
+ if (other == this) return;
+ GOOGLE_DCHECK(GetArena() == other->GetArena());
+ InternalSwap(other);
+ }
+
+ // implements Message ----------------------------------------------
+
+ inline rpcResponse* New() const final {
+ return CreateMaybeMessage(nullptr);
+ }
+
+ rpcResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+ return CreateMaybeMessage(arena);
+ }
+ void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
+ void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
+ void CopyFrom(const rpcResponse& from);
+ void MergeFrom(const rpcResponse& from);
+ PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
+ bool IsInitialized() const final;
+
+ size_t ByteSizeLong() const final;
+ const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
+ ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
+ ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+ int GetCachedSize() const final { return _cached_size_.Get(); }
+
+ private:
+ inline void SharedCtor();
+ inline void SharedDtor();
+ void SetCachedSize(int size) const final;
+ void InternalSwap(rpcResponse* other);
+ friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
+ static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
+ return "fosscordMedia.rpcResponse";
+ }
+ protected:
+ explicit rpcResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena);
+ private:
+ static void ArenaDtor(void* object);
+ inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
+ public:
+
+ ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
+ private:
+ static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
+ return ::descriptor_table_protos_2eproto_metadata_getter(kIndexInFileMessages);
+ }
+
+ public:
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ enum : int {
+ kBFieldNumber = 1,
+ };
+ // int32 b = 1;
+ void clear_b();
+ ::PROTOBUF_NAMESPACE_ID::int32 b() const;
+ void set_b(::PROTOBUF_NAMESPACE_ID::int32 value);
+ private:
+ ::PROTOBUF_NAMESPACE_ID::int32 _internal_b() const;
+ void _internal_set_b(::PROTOBUF_NAMESPACE_ID::int32 value);
+ public:
+
+ // @@protoc_insertion_point(class_scope:fosscordMedia.rpcResponse)
+ private:
+ class _Internal;
+
+ template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
+ typedef void InternalArenaConstructable_;
+ typedef void DestructorSkippable_;
+ ::PROTOBUF_NAMESPACE_ID::int32 b_;
+ mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
+ friend struct ::TableStruct_protos_2eproto;
+};
+// ===================================================================
+
+
+// ===================================================================
+
+#ifdef __GNUC__
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wstrict-aliasing"
+#endif // __GNUC__
+// rpcRequest
+
+// int32 a = 1;
+inline void rpcRequest::clear_a() {
+ a_ = 0;
+}
+inline ::PROTOBUF_NAMESPACE_ID::int32 rpcRequest::_internal_a() const {
+ return a_;
+}
+inline ::PROTOBUF_NAMESPACE_ID::int32 rpcRequest::a() const {
+ // @@protoc_insertion_point(field_get:fosscordMedia.rpcRequest.a)
+ return _internal_a();
+}
+inline void rpcRequest::_internal_set_a(::PROTOBUF_NAMESPACE_ID::int32 value) {
+
+ a_ = value;
+}
+inline void rpcRequest::set_a(::PROTOBUF_NAMESPACE_ID::int32 value) {
+ _internal_set_a(value);
+ // @@protoc_insertion_point(field_set:fosscordMedia.rpcRequest.a)
+}
+
+// -------------------------------------------------------------------
+
+// rpcResponse
+
+// int32 b = 1;
+inline void rpcResponse::clear_b() {
+ b_ = 0;
+}
+inline ::PROTOBUF_NAMESPACE_ID::int32 rpcResponse::_internal_b() const {
+ return b_;
+}
+inline ::PROTOBUF_NAMESPACE_ID::int32 rpcResponse::b() const {
+ // @@protoc_insertion_point(field_get:fosscordMedia.rpcResponse.b)
+ return _internal_b();
+}
+inline void rpcResponse::_internal_set_b(::PROTOBUF_NAMESPACE_ID::int32 value) {
+
+ b_ = value;
+}
+inline void rpcResponse::set_b(::PROTOBUF_NAMESPACE_ID::int32 value) {
+ _internal_set_b(value);
+ // @@protoc_insertion_point(field_set:fosscordMedia.rpcResponse.b)
+}
+
+#ifdef __GNUC__
+ #pragma GCC diagnostic pop
+#endif // __GNUC__
+// -------------------------------------------------------------------
+
+
+// @@protoc_insertion_point(namespace_scope)
+
+} // namespace fosscordMedia
+
+// @@protoc_insertion_point(global_scope)
+
+#include
+#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_protos_2eproto
diff --git a/src/protodefs/protos.proto b/src/protodefs/protos.proto
new file mode 100644
index 00000000..a8c9f845
--- /dev/null
+++ b/src/protodefs/protos.proto
@@ -0,0 +1,24 @@
+syntax = "proto3";
+
+package fosscordMedia;
+
+service fosscordInternals{
+ rpc requestProtocol(voiceRequest) returns (voiceAnswer) {}
+}
+
+message voiceRequest{ //OP1 from gw
+ uint64 userid = 1;
+ uint64 guildid = 2;
+ string IP=3;
+ uint32 port=4;
+ string protocol=5;
+ string rtcConnectionId=6;
+}
+
+message voiceAnswer{//OP2 and OP4 to gw
+ string ip=1;
+ uint32 port=3;
+ repeated string modes=2;
+ int32 ssrc=4;
+ string audioCodec=5;
+}
\ No newline at end of file
diff --git a/src/rpcStub.cpp b/src/rpcStub.cpp
new file mode 100644
index 00000000..3d848924
--- /dev/null
+++ b/src/rpcStub.cpp
@@ -0,0 +1,24 @@
+#include "rpcStub.hpp"
+
+class fossCordInternalsImpl final : public fosscordMedia::fosscordInternals::Service{
+ grpc::Status sendRequest(
+ grpc::ServerContext* ctx,
+ const fosscordMedia::rpcRequest* req,
+ fosscordMedia::rpcResponse* resp
+ ) override{
+ resp->set_b(333);
+ return grpc::Status::OK;
+ }
+
+};
+
+rpcStub::rpcStub(int port){
+ grpc::ServerBuilder builder;
+
+ fossCordInternalsImpl* service;
+ builder.AddListeningPort("0.0.0.0:8057", grpc::InsecureServerCredentials() );
+ builder.RegisterService(service);
+
+ std::unique_ptr server(builder.BuildAndStart());
+ std::cout << "Server listening on port 8057 " << std::endl;
+}
\ No newline at end of file
diff --git a/src/rpcStub.hpp b/src/rpcStub.hpp
new file mode 100644
index 00000000..9da80cda
--- /dev/null
+++ b/src/rpcStub.hpp
@@ -0,0 +1,10 @@
+#include
+#include "protodefs/include/protos.grpc.pb.h"
+
+class rpcStub{
+ public:
+ rpcStub(int port);
+ private:
+ std::unique_ptr server;
+
+};
\ No newline at end of file
diff --git a/src/rtcPeerHandler.cpp b/src/rtcPeerHandler.cpp
new file mode 100644
index 00000000..4696c4c7
--- /dev/null
+++ b/src/rtcPeerHandler.cpp
@@ -0,0 +1,57 @@
+#include "rtcPeerHandler.hpp"
+rtcPeerHandler::rtcPeerHandler()
+{
+ rtc::InitLogger(rtc::LogLevel::Verbose, NULL);
+}
+
+void rtcPeerHandler::initiateConnection(std::string peerIP, int peerPort)
+{
+ //Socket connection between client and server
+ SOCKET sock = socket(AF_INET, SOCK_DGRAM, 0);
+ sockaddr_in addr;
+ addr.sin_addr.s_addr = inet_addr(peerIP.c_str());
+ addr.sin_port = htons(peerPort);
+ addr.sin_family = AF_INET;
+
+ rtc::Configuration conf;
+ conf.enableIceTcp = false;
+ conf.disableAutoNegotiation = false;
+
+ auto pc = std::make_shared(conf);
+
+ rtc::Description::Audio media("audio", rtc::Description::Direction::SendRecv);
+ media.addOpusCodec(96);
+ media.setBitrate(64);
+
+
+ auto track = pc->addTrack(media);
+
+ //auto session = std::make_shared();
+
+ //track->setMediaHandler(session);
+
+ rtc::Reliability rtcRel;
+ rtcRel.unordered = true;
+ rtcRel.type = rtc::Reliability::Type::Timed;
+ rtcRel.rexmit = 500;
+
+ rtc::DataChannelInit rtcConf;
+ rtcConf.reliability = rtcRel;
+ rtcConf.negotiated = false;
+
+ pc->onStateChange([](rtc::PeerConnection::State state) {
+ std::cout << "State: " << state << std::endl;
+ if (state == rtc::PeerConnection::State::Disconnected ||
+ state == rtc::PeerConnection::State::Failed ||
+ state == rtc::PeerConnection::State::Closed) {
+ // remove disconnected client
+ }
+ });
+
+ pc->onGatheringStateChange(
+ [](rtc::PeerConnection::GatheringState state) { std::cout << "Gathering State: " << state << std::endl; });
+
+
+ pc->createDataChannel("Fosscord voice connection", rtcConf);
+}
+
\ No newline at end of file
diff --git a/src/rtcPeerHandler.hpp b/src/rtcPeerHandler.hpp
new file mode 100644
index 00000000..030f41fa
--- /dev/null
+++ b/src/rtcPeerHandler.hpp
@@ -0,0 +1,29 @@
+#include "libdatachannel/rtc.hpp"
+#include
+#include
+#include "nlohmann/json.hpp"
+#include
+
+#ifdef _WIN32
+#include
+#else
+#include
+typedef int SOCKET;
+#endif
+
+using json = nlohmann::json;
+
+class rtcPeerHandler{
+public:
+ rtcPeerHandler();
+ void initiateConnection(std::string peerIP, int peerPort);
+
+ struct client
+ {
+ std::shared_ptr pc;
+ std::shared_ptr dc;
+ };
+
+private:
+ std::map clients;
+};
\ No newline at end of file
diff --git a/src/rtcServer.hpp b/src/rtcServer.hpp
new file mode 100644
index 00000000..e69de29b
From 80282f6ba3821ff49007895947733aa840b8f575 Mon Sep 17 00:00:00 2001
From: Newe
Date: Fri, 21 May 2021 11:19:56 +0200
Subject: [PATCH 08/18] [edit] Set rpcStub.server to public
---
src/main.cpp | 3 ++-
src/rpcStub.hpp | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/main.cpp b/src/main.cpp
index 3f131512..88adc97c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -27,10 +27,11 @@
int main (int argc, char** argv){
- auto handler = std::make_shared();
+ auto commsHandler = std::make_shared();
auto rpcHandler = std::unique_ptr();
std::cout << "Server created" <server->Wait(); //blocking, this will need to be threaded
return 0;
}
\ No newline at end of file
diff --git a/src/rpcStub.hpp b/src/rpcStub.hpp
index 9da80cda..99d6d582 100644
--- a/src/rpcStub.hpp
+++ b/src/rpcStub.hpp
@@ -4,7 +4,8 @@
class rpcStub{
public:
rpcStub(int port);
- private:
std::unique_ptr server;
+ private:
+
};
\ No newline at end of file
From f8eceb3124ac4149f180b496082d9965f6b8c1b6 Mon Sep 17 00:00:00 2001
From: Newe
Date: Fri, 21 May 2021 15:48:56 +0200
Subject: [PATCH 09/18] [edit] Hypothetical gRPC handshake
---
.gitignore | 4 ++
src/main.cpp | 45 +++++++++---------
src/protodefs/protos.proto | 4 +-
src/rpcStub.cpp | 38 +++++++++------
src/rpcStub.hpp | 7 +--
src/rtcPeerHandler.cpp | 94 ++++++++++++++++++++++++--------------
src/rtcPeerHandler.hpp | 5 +-
7 files changed, 119 insertions(+), 78 deletions(-)
diff --git a/.gitignore b/.gitignore
index 788c5adb..539bb001 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,6 +29,10 @@
# Executables
*.o
+# Protobuffer builds
+*.pb.cc
+*.pb.h
+
# Directories
build/
.vscode/
diff --git a/src/main.cpp b/src/main.cpp
index 88adc97c..2fdeceee 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,37 +1,36 @@
// $$$$$$\ $$\
-// $$ __$$\ $$ |
-// $$ / \__|$$$$$$\ $$$$$$$\ $$$$$$$\ $$$$$$$\ $$$$$$\ $$$$$$\ $$$$$$$ |
-// $$$$\ $$ __$$\ $$ _____|$$ _____|$$ _____|$$ __$$\ $$ __$$\ $$ __$$ |
-// $$ _| $$ / $$ |\$$$$$$\ \$$$$$$\ $$ / $$ / $$ |$$ | \__|$$ / $$ |
-// $$ | $$ | $$ | \____$$\ \____$$\ $$ | $$ | $$ |$$ | $$ | $$ |
-// $$ | \$$$$$$ |$$$$$$$ |$$$$$$$ |\$$$$$$$\ \$$$$$$ |$$ | \$$$$$$$ |
-// \__| \______/ \_______/ \_______/ \_______| \______/ \__| \_______|
-//
-//
-//
+// $$ __$$\ $$ |
+// $$ / \__|$$$$$$\ $$$$$$$\ $$$$$$$\ $$$$$$$\ $$$$$$\ $$$$$$\ $$$$$$$ |
+// $$$$\ $$ __$$\ $$ _____|$$ _____|$$ _____|$$ __$$\ $$ __$$\ $$ __$$ |
+// $$ _| $$ / $$ |\$$$$$$\ \$$$$$$\ $$ / $$ / $$ |$$ | \__|$$ / $$ |
+// $$ | $$ | $$ | \____$$\ \____$$\ $$ | $$ | $$ |$$ | $$ | $$ |
+// $$ | \$$$$$$ |$$$$$$$ |$$$$$$$ |\$$$$$$$\ \$$$$$$ |$$ | \$$$$$$$ |
+// \__| \______/ \_______/ \_______/ \_______| \______/ \__| \_______|
+//
+//
+//
// $$\ $$$$$$\
// \__| $$ __$$\
// $$\ $$\ $$$$$$\ $$\ $$$$$$$\ $$$$$$\ $$ / \__| $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$\ $$$$$$\
// \$$\ $$ |$$ __$$\ $$ |$$ _____|$$ __$$\ \$$$$$$\ $$ __$$\ $$ __$$\\$$\ $$ |$$ __$$\ $$ __$$\
// \$$\$$ / $$ / $$ |$$ |$$ / $$$$$$$$ | \____$$\ $$$$$$$$ |$$ | \__|\$$\$$ / $$$$$$$$ |$$ | \__|
-// \$$$ / $$ | $$ |$$ |$$ | $$ ____|$$\ $$ |$$ ____|$$ | \$$$ / $$ ____|$$ |
-// \$ / \$$$$$$ |$$ |\$$$$$$$\ \$$$$$$$\ \$$$$$$ |\$$$$$$$\ $$ | \$ / \$$$$$$$\ $$ |
-// \_/ \______/ \__| \_______| \_______| \______/ \_______|\__| \_/ \_______|\__|
-//
-//
-//
+// \$$$ / $$ | $$ |$$ |$$ | $$ ____|$$\ $$ |$$ ____|$$ | \$$$ / $$ ____|$$ |
+// \$ / \$$$$$$ |$$ |\$$$$$$$\ \$$$$$$$\ \$$$$$$ |\$$$$$$$\ $$ | \$ / \$$$$$$$\ $$ |
+// \_/ \______/ \__| \_______| \_______| \______/ \_______|\__| \_/ \_______|\__|
+//
+//
+//
+#include "rtcPeerHandler.hpp" //Handle peer connection requests
+#include "rpcStub.hpp" //Handle gRPC communications between the different fosscord elements
-#include "rtcPeerHandler.hpp" //HAndle peer connection requests
-#include "rpcStub.hpp" //Handle gRPC communications between the different fosscord elements
-
-int main (int argc, char** argv){
+int main(int argc, char **argv){
auto commsHandler = std::make_shared();
- auto rpcHandler = std::unique_ptr();
+ auto rpcHandler = std::unique_ptr(new rpcStub(commsHandler, 8057));
- std::cout << "Server created" <server->Wait(); //blocking, this will need to be threaded
- return 0;
+ return 0;
}
\ No newline at end of file
diff --git a/src/protodefs/protos.proto b/src/protodefs/protos.proto
index a8c9f845..11face5f 100644
--- a/src/protodefs/protos.proto
+++ b/src/protodefs/protos.proto
@@ -3,13 +3,13 @@ syntax = "proto3";
package fosscordMedia;
service fosscordInternals{
- rpc requestProtocol(voiceRequest) returns (voiceAnswer) {}
+ rpc vRequest(voiceRequest) returns (voiceAnswer) {}
}
message voiceRequest{ //OP1 from gw
uint64 userid = 1;
uint64 guildid = 2;
- string IP=3;
+ string ip=3;
uint32 port=4;
string protocol=5;
string rtcConnectionId=6;
diff --git a/src/rpcStub.cpp b/src/rpcStub.cpp
index 3d848924..1633aab8 100644
--- a/src/rpcStub.cpp
+++ b/src/rpcStub.cpp
@@ -1,24 +1,32 @@
#include "rpcStub.hpp"
-class fossCordInternalsImpl final : public fosscordMedia::fosscordInternals::Service{
- grpc::Status sendRequest(
- grpc::ServerContext* ctx,
- const fosscordMedia::rpcRequest* req,
- fosscordMedia::rpcResponse* resp
- ) override{
- resp->set_b(333);
- return grpc::Status::OK;
+class fossCordInternalsImpl final : public fosscordMedia::fosscordInternals::Service {
+ std::shared_ptr ph;
+ fossCordInternalsImpl(std::shared_ptr handler){
+ this->ph= handler;
}
+ grpc::Status vRequest(grpc::ServerContext* ctx,
+ const fosscordMedia::voiceRequest* req,
+ fosscordMedia::voiceAnswer* resp) override {
+ this->ph->initiateConnection(req->ip(), req->port());
+ return grpc::Status::OK;
+ }
};
-rpcStub::rpcStub(int port){
- grpc::ServerBuilder builder;
+rpcStub::rpcStub(std::shared_ptr handler, int port) {
+ if (not port) {
+ port = 8057;
+ }
+ this->ph = handler;
- fossCordInternalsImpl* service;
- builder.AddListeningPort("0.0.0.0:8057", grpc::InsecureServerCredentials() );
- builder.RegisterService(service);
+ fossCordInternalsImpl* service;
+ grpc::ServerBuilder builder;
+ builder.AddListeningPort("0.0.0.0:" + std::to_string(port),
+ grpc::InsecureServerCredentials());
+ builder.RegisterService(service);
- std::unique_ptr server(builder.BuildAndStart());
- std::cout << "Server listening on port 8057 " << std::endl;
+ this->server = builder.BuildAndStart();
+
+ std::cout << "RPC stub listening on port " << port << std::endl;
}
\ No newline at end of file
diff --git a/src/rpcStub.hpp b/src/rpcStub.hpp
index 99d6d582..f567cd97 100644
--- a/src/rpcStub.hpp
+++ b/src/rpcStub.hpp
@@ -1,11 +1,12 @@
#include
#include "protodefs/include/protos.grpc.pb.h"
+#include "rtcPeerHandler.hpp"
class rpcStub{
public:
- rpcStub(int port);
+ rpcStub(std::shared_ptr peerHandler, int port);
std::unique_ptr server;
- private:
-
+ private:
+ std::shared_ptr ph;
};
\ No newline at end of file
diff --git a/src/rtcPeerHandler.cpp b/src/rtcPeerHandler.cpp
index 4696c4c7..9bfc6466 100644
--- a/src/rtcPeerHandler.cpp
+++ b/src/rtcPeerHandler.cpp
@@ -1,45 +1,44 @@
#include "rtcPeerHandler.hpp"
-rtcPeerHandler::rtcPeerHandler()
-{
- rtc::InitLogger(rtc::LogLevel::Verbose, NULL);
+
+rtcPeerHandler::rtcPeerHandler() {
+ rtc::InitLogger(rtc::LogLevel::Verbose, NULL);
}
-void rtcPeerHandler::initiateConnection(std::string peerIP, int peerPort)
-{
- //Socket connection between client and server
- SOCKET sock = socket(AF_INET, SOCK_DGRAM, 0);
- sockaddr_in addr;
- addr.sin_addr.s_addr = inet_addr(peerIP.c_str());
- addr.sin_port = htons(peerPort);
- addr.sin_family = AF_INET;
+void rtcPeerHandler::initiateConnection(std::string peerIP, int peerPort) {
+ // Socket connection between client and server
+ SOCKET sock = socket(AF_INET, SOCK_DGRAM, 0);
+ sockaddr_in addr;
+ addr.sin_addr.s_addr = inet_addr(peerIP.c_str());
+ addr.sin_port = htons(peerPort);
+ addr.sin_family = AF_INET;
- rtc::Configuration conf;
- conf.enableIceTcp = false;
- conf.disableAutoNegotiation = false;
+ rtc::Configuration conf;
+ conf.enableIceTcp = false;
+ conf.disableAutoNegotiation = false;
- auto pc = std::make_shared(conf);
+ auto pc = std::make_shared(conf);
- rtc::Description::Audio media("audio", rtc::Description::Direction::SendRecv);
- media.addOpusCodec(96);
- media.setBitrate(64);
+ rtc::Description::Audio media("audio",
+ rtc::Description::Direction::SendRecv);
+ media.addOpusCodec(96);
+ media.setBitrate(64);
+ auto track = pc->addTrack(media);
- auto track = pc->addTrack(media);
+ // auto session = std::make_shared();
- //auto session = std::make_shared();
+ // track->setMediaHandler(session);
- //track->setMediaHandler(session);
+ rtc::Reliability rtcRel;
+ rtcRel.unordered = true;
+ rtcRel.type = rtc::Reliability::Type::Timed;
+ rtcRel.rexmit = 500;
- rtc::Reliability rtcRel;
- rtcRel.unordered = true;
- rtcRel.type = rtc::Reliability::Type::Timed;
- rtcRel.rexmit = 500;
+ rtc::DataChannelInit rtcConf;
+ rtcConf.reliability = rtcRel;
+ rtcConf.negotiated = false;
- rtc::DataChannelInit rtcConf;
- rtcConf.reliability = rtcRel;
- rtcConf.negotiated = false;
-
- pc->onStateChange([](rtc::PeerConnection::State state) {
+ pc->onStateChange([](rtc::PeerConnection::State state) {
std::cout << "State: " << state << std::endl;
if (state == rtc::PeerConnection::State::Disconnected ||
state == rtc::PeerConnection::State::Failed ||
@@ -48,10 +47,37 @@ void rtcPeerHandler::initiateConnection(std::string peerIP, int peerPort)
}
});
- pc->onGatheringStateChange(
- [](rtc::PeerConnection::GatheringState state) { std::cout << "Gathering State: " << state << std::endl; });
+ pc->onGatheringStateChange([](rtc::PeerConnection::GatheringState state) {
+ std::cout << "Gathering State: " << state << std::endl;
+ });
+ /*std::tuple addAudio(
+
+ const std::shared_ptr pc,
+ const uint8_t payloadType, const uint32_t ssrc, const std::string cname,
+ const std::string msid, const std::function onOpen) {
+ auto audio = Description::Audio(cname);
+ audio.addOpusCodec(payloadType);
+ audio.addSSRC(ssrc, cname, msid, cname);
+ auto track = pc->addTrack(audio);
+ // create RTP configuration
+ auto rtpConfig = make_shared(
+ ssrc, cname, payloadType, OpusRtpPacketizer::defaultClockRate);
+ // create packetizer
+ auto packetizer = make_shared(rtpConfig);
+ // create opus handler
+ auto opusHandler = make_shared(packetizer);
- pc->createDataChannel("Fosscord voice connection", rtcConf);
+ // add RTCP SR handler
+ auto srReporter = make_shared(rtpConfig);
+ opusHandler->addToChain(srReporter);
+
+ // set handler
+ track->setMediaHandler(opusHandler);
+ track->onOpen(onOpen);
+ auto trackData = make_shared(track, srReporter);
+ return trackData;
+ }*/
+
+ pc->createDataChannel("Fosscord voice connection", rtcConf);
}
-
\ No newline at end of file
diff --git a/src/rtcPeerHandler.hpp b/src/rtcPeerHandler.hpp
index 030f41fa..3ba32a83 100644
--- a/src/rtcPeerHandler.hpp
+++ b/src/rtcPeerHandler.hpp
@@ -13,6 +13,8 @@ typedef int SOCKET;
using json = nlohmann::json;
+#ifndef RTCPEERHANDLER
+#define RTCPEERHANDLER
class rtcPeerHandler{
public:
rtcPeerHandler();
@@ -26,4 +28,5 @@ public:
private:
std::map clients;
-};
\ No newline at end of file
+};
+#endif
\ No newline at end of file
From c29252d5e54020050fb8f431122e181f44a5153e Mon Sep 17 00:00:00 2001
From: Newe
Date: Fri, 21 May 2021 15:51:57 +0200
Subject: [PATCH 10/18] [add] RpcStub header guards
---
src/rpcStub.hpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/rpcStub.hpp b/src/rpcStub.hpp
index f567cd97..d183cf3c 100644
--- a/src/rpcStub.hpp
+++ b/src/rpcStub.hpp
@@ -2,6 +2,8 @@
#include "protodefs/include/protos.grpc.pb.h"
#include "rtcPeerHandler.hpp"
+#ifndef RPCSTUB
+#define RPCSTUB
class rpcStub{
public:
rpcStub(std::shared_ptr peerHandler, int port);
@@ -9,4 +11,5 @@ class rpcStub{
private:
std::shared_ptr ph;
-};
\ No newline at end of file
+};
+#endif
\ No newline at end of file
From a25ccfdc07d11671e751feab3c5fa49629a8703c Mon Sep 17 00:00:00 2001
From: Newe
Date: Fri, 21 May 2021 15:52:41 +0200
Subject: [PATCH 11/18] [del] Removed protobuf build files
---
src/protodefs/include/protos.grpc.pb.cc | 86 -----
src/protodefs/include/protos.grpc.pb.h | 295 --------------
src/protodefs/include/protos.pb.cc | 487 ------------------------
src/protodefs/include/protos.pb.h | 413 --------------------
4 files changed, 1281 deletions(-)
delete mode 100644 src/protodefs/include/protos.grpc.pb.cc
delete mode 100644 src/protodefs/include/protos.grpc.pb.h
delete mode 100644 src/protodefs/include/protos.pb.cc
delete mode 100644 src/protodefs/include/protos.pb.h
diff --git a/src/protodefs/include/protos.grpc.pb.cc b/src/protodefs/include/protos.grpc.pb.cc
deleted file mode 100644
index 26914fad..00000000
--- a/src/protodefs/include/protos.grpc.pb.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-// Generated by the gRPC C++ plugin.
-// If you make any local change, they will be lost.
-// source: protos.proto
-
-#include "protos.pb.h"
-#include "protos.grpc.pb.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-namespace fosscordMedia {
-
-static const char* fosscordInternals_method_names[] = {
- "/fosscordMedia.fosscordInternals/sendRequest",
-};
-
-std::unique_ptr< fosscordInternals::Stub> fosscordInternals::NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options) {
- (void)options;
- std::unique_ptr< fosscordInternals::Stub> stub(new fosscordInternals::Stub(channel, options));
- return stub;
-}
-
-fosscordInternals::Stub::Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options)
- : channel_(channel), rpcmethod_sendRequest_(fosscordInternals_method_names[0], options.suffix_for_stats(),::grpc::internal::RpcMethod::NORMAL_RPC, channel)
- {}
-
-::grpc::Status fosscordInternals::Stub::sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::fosscordMedia::rpcResponse* response) {
- return ::grpc::internal::BlockingUnaryCall< ::fosscordMedia::rpcRequest, ::fosscordMedia::rpcResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), rpcmethod_sendRequest_, context, request, response);
-}
-
-void fosscordInternals::Stub::experimental_async::sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response, std::function f) {
- ::grpc::internal::CallbackUnaryCall< ::fosscordMedia::rpcRequest, ::fosscordMedia::rpcResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_sendRequest_, context, request, response, std::move(f));
-}
-
-void fosscordInternals::Stub::experimental_async::sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) {
- ::grpc::internal::ClientCallbackUnaryFactory::Create< ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(stub_->channel_.get(), stub_->rpcmethod_sendRequest_, context, request, response, reactor);
-}
-
-::grpc::ClientAsyncResponseReader< ::fosscordMedia::rpcResponse>* fosscordInternals::Stub::PrepareAsyncsendRequestRaw(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::grpc::CompletionQueue* cq) {
- return ::grpc::internal::ClientAsyncResponseReaderHelper::Create< ::fosscordMedia::rpcResponse, ::fosscordMedia::rpcRequest, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(channel_.get(), cq, rpcmethod_sendRequest_, context, request);
-}
-
-::grpc::ClientAsyncResponseReader< ::fosscordMedia::rpcResponse>* fosscordInternals::Stub::AsyncsendRequestRaw(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::grpc::CompletionQueue* cq) {
- auto* result =
- this->PrepareAsyncsendRequestRaw(context, request, cq);
- result->StartCall();
- return result;
-}
-
-fosscordInternals::Service::Service() {
- AddMethod(new ::grpc::internal::RpcServiceMethod(
- fosscordInternals_method_names[0],
- ::grpc::internal::RpcMethod::NORMAL_RPC,
- new ::grpc::internal::RpcMethodHandler< fosscordInternals::Service, ::fosscordMedia::rpcRequest, ::fosscordMedia::rpcResponse, ::grpc::protobuf::MessageLite, ::grpc::protobuf::MessageLite>(
- [](fosscordInternals::Service* service,
- ::grpc::ServerContext* ctx,
- const ::fosscordMedia::rpcRequest* req,
- ::fosscordMedia::rpcResponse* resp) {
- return service->sendRequest(ctx, req, resp);
- }, this)));
-}
-
-fosscordInternals::Service::~Service() {
-}
-
-::grpc::Status fosscordInternals::Service::sendRequest(::grpc::ServerContext* context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response) {
- (void) context;
- (void) request;
- (void) response;
- return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
-}
-
-
-} // namespace fosscordMedia
-
diff --git a/src/protodefs/include/protos.grpc.pb.h b/src/protodefs/include/protos.grpc.pb.h
deleted file mode 100644
index 0f7f5881..00000000
--- a/src/protodefs/include/protos.grpc.pb.h
+++ /dev/null
@@ -1,295 +0,0 @@
-// Generated by the gRPC C++ plugin.
-// If you make any local change, they will be lost.
-// source: protos.proto
-// Original file comments:
-// LD_LIBRARY_PATH=/usr/local/lib protoc --proto_path="/data/fosscord-media/src/protodefs" --cpp_out="/data/fosscord-media/src/protodefs/include" --grpc_out="/data/fosscord-media/src/protodefs/include" --plugin=protoc-gen-grpc=/usr/local/bin/grpc_cpp_plugin protos.proto
-//
-#ifndef GRPC_protos_2eproto__INCLUDED
-#define GRPC_protos_2eproto__INCLUDED
-
-#include "protos.pb.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-namespace fosscordMedia {
-
-class fosscordInternals final {
- public:
- static constexpr char const* service_full_name() {
- return "fosscordMedia.fosscordInternals";
- }
- class StubInterface {
- public:
- virtual ~StubInterface() {}
- virtual ::grpc::Status sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::fosscordMedia::rpcResponse* response) = 0;
- std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::fosscordMedia::rpcResponse>> AsyncsendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::grpc::CompletionQueue* cq) {
- return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::fosscordMedia::rpcResponse>>(AsyncsendRequestRaw(context, request, cq));
- }
- std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::fosscordMedia::rpcResponse>> PrepareAsyncsendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::grpc::CompletionQueue* cq) {
- return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::fosscordMedia::rpcResponse>>(PrepareAsyncsendRequestRaw(context, request, cq));
- }
- class experimental_async_interface {
- public:
- virtual ~experimental_async_interface() {}
- virtual void sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response, std::function) = 0;
- #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
- virtual void sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response, ::grpc::ClientUnaryReactor* reactor) = 0;
- #else
- virtual void sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) = 0;
- #endif
- };
- #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
- typedef class experimental_async_interface async_interface;
- #endif
- #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
- async_interface* async() { return experimental_async(); }
- #endif
- virtual class experimental_async_interface* experimental_async() { return nullptr; }
- private:
- virtual ::grpc::ClientAsyncResponseReaderInterface< ::fosscordMedia::rpcResponse>* AsyncsendRequestRaw(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::grpc::CompletionQueue* cq) = 0;
- virtual ::grpc::ClientAsyncResponseReaderInterface< ::fosscordMedia::rpcResponse>* PrepareAsyncsendRequestRaw(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::grpc::CompletionQueue* cq) = 0;
- };
- class Stub final : public StubInterface {
- public:
- Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());
- ::grpc::Status sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::fosscordMedia::rpcResponse* response) override;
- std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::fosscordMedia::rpcResponse>> AsyncsendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::grpc::CompletionQueue* cq) {
- return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::fosscordMedia::rpcResponse>>(AsyncsendRequestRaw(context, request, cq));
- }
- std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::fosscordMedia::rpcResponse>> PrepareAsyncsendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::grpc::CompletionQueue* cq) {
- return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::fosscordMedia::rpcResponse>>(PrepareAsyncsendRequestRaw(context, request, cq));
- }
- class experimental_async final :
- public StubInterface::experimental_async_interface {
- public:
- void sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response, std::function) override;
- #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
- void sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response, ::grpc::ClientUnaryReactor* reactor) override;
- #else
- void sendRequest(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response, ::grpc::experimental::ClientUnaryReactor* reactor) override;
- #endif
- private:
- friend class Stub;
- explicit experimental_async(Stub* stub): stub_(stub) { }
- Stub* stub() { return stub_; }
- Stub* stub_;
- };
- class experimental_async_interface* experimental_async() override { return &async_stub_; }
-
- private:
- std::shared_ptr< ::grpc::ChannelInterface> channel_;
- class experimental_async async_stub_{this};
- ::grpc::ClientAsyncResponseReader< ::fosscordMedia::rpcResponse>* AsyncsendRequestRaw(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::grpc::CompletionQueue* cq) override;
- ::grpc::ClientAsyncResponseReader< ::fosscordMedia::rpcResponse>* PrepareAsyncsendRequestRaw(::grpc::ClientContext* context, const ::fosscordMedia::rpcRequest& request, ::grpc::CompletionQueue* cq) override;
- const ::grpc::internal::RpcMethod rpcmethod_sendRequest_;
- };
- static std::unique_ptr NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());
-
- class Service : public ::grpc::Service {
- public:
- Service();
- virtual ~Service();
- virtual ::grpc::Status sendRequest(::grpc::ServerContext* context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response);
- };
- template
- class WithAsyncMethod_sendRequest : public BaseClass {
- private:
- void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
- public:
- WithAsyncMethod_sendRequest() {
- ::grpc::Service::MarkMethodAsync(0);
- }
- ~WithAsyncMethod_sendRequest() override {
- BaseClassMustBeDerivedFromService(this);
- }
- // disable synchronous version of this method
- ::grpc::Status sendRequest(::grpc::ServerContext* /*context*/, const ::fosscordMedia::rpcRequest* /*request*/, ::fosscordMedia::rpcResponse* /*response*/) override {
- abort();
- return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
- }
- void RequestsendRequest(::grpc::ServerContext* context, ::fosscordMedia::rpcRequest* request, ::grpc::ServerAsyncResponseWriter< ::fosscordMedia::rpcResponse>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
- ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag);
- }
- };
- typedef WithAsyncMethod_sendRequest AsyncService;
- template
- class ExperimentalWithCallbackMethod_sendRequest : public BaseClass {
- private:
- void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
- public:
- ExperimentalWithCallbackMethod_sendRequest() {
- #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
- ::grpc::Service::
- #else
- ::grpc::Service::experimental().
- #endif
- MarkMethodCallback(0,
- new ::grpc::internal::CallbackUnaryHandler< ::fosscordMedia::rpcRequest, ::fosscordMedia::rpcResponse>(
- [this](
- #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
- ::grpc::CallbackServerContext*
- #else
- ::grpc::experimental::CallbackServerContext*
- #endif
- context, const ::fosscordMedia::rpcRequest* request, ::fosscordMedia::rpcResponse* response) { return this->sendRequest(context, request, response); }));}
- void SetMessageAllocatorFor_sendRequest(
- ::grpc::experimental::MessageAllocator< ::fosscordMedia::rpcRequest, ::fosscordMedia::rpcResponse>* allocator) {
- #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
- ::grpc::internal::MethodHandler* const handler = ::grpc::Service::GetHandler(0);
- #else
- ::grpc::internal::MethodHandler* const handler = ::grpc::Service::experimental().GetHandler(0);
- #endif
- static_cast<::grpc::internal::CallbackUnaryHandler< ::fosscordMedia::rpcRequest, ::fosscordMedia::rpcResponse>*>(handler)
- ->SetMessageAllocator(allocator);
- }
- ~ExperimentalWithCallbackMethod_sendRequest() override {
- BaseClassMustBeDerivedFromService(this);
- }
- // disable synchronous version of this method
- ::grpc::Status sendRequest(::grpc::ServerContext* /*context*/, const ::fosscordMedia::rpcRequest* /*request*/, ::fosscordMedia::rpcResponse* /*response*/) override {
- abort();
- return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
- }
- #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
- virtual ::grpc::ServerUnaryReactor* sendRequest(
- ::grpc::CallbackServerContext* /*context*/, const ::fosscordMedia::rpcRequest* /*request*/, ::fosscordMedia::rpcResponse* /*response*/)
- #else
- virtual ::grpc::experimental::ServerUnaryReactor* sendRequest(
- ::grpc::experimental::CallbackServerContext* /*context*/, const ::fosscordMedia::rpcRequest* /*request*/, ::fosscordMedia::rpcResponse* /*response*/)
- #endif
- { return nullptr; }
- };
- #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
- typedef ExperimentalWithCallbackMethod_sendRequest CallbackService;
- #endif
-
- typedef ExperimentalWithCallbackMethod_sendRequest ExperimentalCallbackService;
- template
- class WithGenericMethod_sendRequest : public BaseClass {
- private:
- void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
- public:
- WithGenericMethod_sendRequest() {
- ::grpc::Service::MarkMethodGeneric(0);
- }
- ~WithGenericMethod_sendRequest() override {
- BaseClassMustBeDerivedFromService(this);
- }
- // disable synchronous version of this method
- ::grpc::Status sendRequest(::grpc::ServerContext* /*context*/, const ::fosscordMedia::rpcRequest* /*request*/, ::fosscordMedia::rpcResponse* /*response*/) override {
- abort();
- return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
- }
- };
- template
- class WithRawMethod_sendRequest : public BaseClass {
- private:
- void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
- public:
- WithRawMethod_sendRequest() {
- ::grpc::Service::MarkMethodRaw(0);
- }
- ~WithRawMethod_sendRequest() override {
- BaseClassMustBeDerivedFromService(this);
- }
- // disable synchronous version of this method
- ::grpc::Status sendRequest(::grpc::ServerContext* /*context*/, const ::fosscordMedia::rpcRequest* /*request*/, ::fosscordMedia::rpcResponse* /*response*/) override {
- abort();
- return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
- }
- void RequestsendRequest(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
- ::grpc::Service::RequestAsyncUnary(0, context, request, response, new_call_cq, notification_cq, tag);
- }
- };
- template
- class ExperimentalWithRawCallbackMethod_sendRequest : public BaseClass {
- private:
- void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
- public:
- ExperimentalWithRawCallbackMethod_sendRequest() {
- #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
- ::grpc::Service::
- #else
- ::grpc::Service::experimental().
- #endif
- MarkMethodRawCallback(0,
- new ::grpc::internal::CallbackUnaryHandler< ::grpc::ByteBuffer, ::grpc::ByteBuffer>(
- [this](
- #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
- ::grpc::CallbackServerContext*
- #else
- ::grpc::experimental::CallbackServerContext*
- #endif
- context, const ::grpc::ByteBuffer* request, ::grpc::ByteBuffer* response) { return this->sendRequest(context, request, response); }));
- }
- ~ExperimentalWithRawCallbackMethod_sendRequest() override {
- BaseClassMustBeDerivedFromService(this);
- }
- // disable synchronous version of this method
- ::grpc::Status sendRequest(::grpc::ServerContext* /*context*/, const ::fosscordMedia::rpcRequest* /*request*/, ::fosscordMedia::rpcResponse* /*response*/) override {
- abort();
- return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
- }
- #ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
- virtual ::grpc::ServerUnaryReactor* sendRequest(
- ::grpc::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/)
- #else
- virtual ::grpc::experimental::ServerUnaryReactor* sendRequest(
- ::grpc::experimental::CallbackServerContext* /*context*/, const ::grpc::ByteBuffer* /*request*/, ::grpc::ByteBuffer* /*response*/)
- #endif
- { return nullptr; }
- };
- template
- class WithStreamedUnaryMethod_sendRequest : public BaseClass {
- private:
- void BaseClassMustBeDerivedFromService(const Service* /*service*/) {}
- public:
- WithStreamedUnaryMethod_sendRequest() {
- ::grpc::Service::MarkMethodStreamed(0,
- new ::grpc::internal::StreamedUnaryHandler<
- ::fosscordMedia::rpcRequest, ::fosscordMedia::rpcResponse>(
- [this](::grpc::ServerContext* context,
- ::grpc::ServerUnaryStreamer<
- ::fosscordMedia::rpcRequest, ::fosscordMedia::rpcResponse>* streamer) {
- return this->StreamedsendRequest(context,
- streamer);
- }));
- }
- ~WithStreamedUnaryMethod_sendRequest() override {
- BaseClassMustBeDerivedFromService(this);
- }
- // disable regular version of this method
- ::grpc::Status sendRequest(::grpc::ServerContext* /*context*/, const ::fosscordMedia::rpcRequest* /*request*/, ::fosscordMedia::rpcResponse* /*response*/) override {
- abort();
- return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
- }
- // replace default version of method with streamed unary
- virtual ::grpc::Status StreamedsendRequest(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::fosscordMedia::rpcRequest,::fosscordMedia::rpcResponse>* server_unary_streamer) = 0;
- };
- typedef WithStreamedUnaryMethod_sendRequest StreamedUnaryService;
- typedef Service SplitStreamedService;
- typedef WithStreamedUnaryMethod_sendRequest StreamedService;
-};
-
-} // namespace fosscordMedia
-
-
-#endif // GRPC_protos_2eproto__INCLUDED
diff --git a/src/protodefs/include/protos.pb.cc b/src/protodefs/include/protos.pb.cc
deleted file mode 100644
index 1e88f216..00000000
--- a/src/protodefs/include/protos.pb.cc
+++ /dev/null
@@ -1,487 +0,0 @@
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: protos.proto
-
-#include "protos.pb.h"
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-// @@protoc_insertion_point(includes)
-#include
-
-PROTOBUF_PRAGMA_INIT_SEG
-namespace fosscordMedia {
-constexpr rpcRequest::rpcRequest(
- ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : a_(0){}
-struct rpcRequestDefaultTypeInternal {
- constexpr rpcRequestDefaultTypeInternal()
- : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
- ~rpcRequestDefaultTypeInternal() {}
- union {
- rpcRequest _instance;
- };
-};
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT rpcRequestDefaultTypeInternal _rpcRequest_default_instance_;
-constexpr rpcResponse::rpcResponse(
- ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : b_(0){}
-struct rpcResponseDefaultTypeInternal {
- constexpr rpcResponseDefaultTypeInternal()
- : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
- ~rpcResponseDefaultTypeInternal() {}
- union {
- rpcResponse _instance;
- };
-};
-PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT rpcResponseDefaultTypeInternal _rpcResponse_default_instance_;
-} // namespace fosscordMedia
-static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_protos_2eproto[2];
-static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_protos_2eproto = nullptr;
-static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_protos_2eproto = nullptr;
-
-const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_protos_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
- ~0u, // no _has_bits_
- PROTOBUF_FIELD_OFFSET(::fosscordMedia::rpcRequest, _internal_metadata_),
- ~0u, // no _extensions_
- ~0u, // no _oneof_case_
- ~0u, // no _weak_field_map_
- PROTOBUF_FIELD_OFFSET(::fosscordMedia::rpcRequest, a_),
- ~0u, // no _has_bits_
- PROTOBUF_FIELD_OFFSET(::fosscordMedia::rpcResponse, _internal_metadata_),
- ~0u, // no _extensions_
- ~0u, // no _oneof_case_
- ~0u, // no _weak_field_map_
- PROTOBUF_FIELD_OFFSET(::fosscordMedia::rpcResponse, b_),
-};
-static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
- { 0, -1, sizeof(::fosscordMedia::rpcRequest)},
- { 6, -1, sizeof(::fosscordMedia::rpcResponse)},
-};
-
-static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
- reinterpret_cast(&::fosscordMedia::_rpcRequest_default_instance_),
- reinterpret_cast(&::fosscordMedia::_rpcResponse_default_instance_),
-};
-
-const char descriptor_table_protodef_protos_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
- "\n\014protos.proto\022\rfosscordMedia\"\027\n\nrpcRequ"
- "est\022\t\n\001a\030\001 \001(\005\"\030\n\013rpcResponse\022\t\n\001b\030\001 \001(\005"
- "2[\n\021fosscordInternals\022F\n\013sendRequest\022\031.f"
- "osscordMedia.rpcRequest\032\032.fosscordMedia."
- "rpcResponse\"\000b\006proto3"
- ;
-static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_protos_2eproto_once;
-const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_protos_2eproto = {
- false, false, 181, descriptor_table_protodef_protos_2eproto, "protos.proto",
- &descriptor_table_protos_2eproto_once, nullptr, 0, 2,
- schemas, file_default_instances, TableStruct_protos_2eproto::offsets,
- file_level_metadata_protos_2eproto, file_level_enum_descriptors_protos_2eproto, file_level_service_descriptors_protos_2eproto,
-};
-PROTOBUF_ATTRIBUTE_WEAK ::PROTOBUF_NAMESPACE_ID::Metadata
-descriptor_table_protos_2eproto_metadata_getter(int index) {
- ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_protos_2eproto);
- return descriptor_table_protos_2eproto.file_level_metadata[index];
-}
-
-// Force running AddDescriptors() at dynamic initialization time.
-PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_protos_2eproto(&descriptor_table_protos_2eproto);
-namespace fosscordMedia {
-
-// ===================================================================
-
-class rpcRequest::_Internal {
- public:
-};
-
-rpcRequest::rpcRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena)
- : ::PROTOBUF_NAMESPACE_ID::Message(arena) {
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:fosscordMedia.rpcRequest)
-}
-rpcRequest::rpcRequest(const rpcRequest& from)
- : ::PROTOBUF_NAMESPACE_ID::Message() {
- _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
- a_ = from.a_;
- // @@protoc_insertion_point(copy_constructor:fosscordMedia.rpcRequest)
-}
-
-void rpcRequest::SharedCtor() {
-a_ = 0;
-}
-
-rpcRequest::~rpcRequest() {
- // @@protoc_insertion_point(destructor:fosscordMedia.rpcRequest)
- SharedDtor();
- _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
-}
-
-void rpcRequest::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
-}
-
-void rpcRequest::ArenaDtor(void* object) {
- rpcRequest* _this = reinterpret_cast< rpcRequest* >(object);
- (void)_this;
-}
-void rpcRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
-}
-void rpcRequest::SetCachedSize(int size) const {
- _cached_size_.Set(size);
-}
-
-void rpcRequest::Clear() {
-// @@protoc_insertion_point(message_clear_start:fosscordMedia.rpcRequest)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
- // Prevent compiler warnings about cached_has_bits being unused
- (void) cached_has_bits;
-
- a_ = 0;
- _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
-}
-
-const char* rpcRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
-#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
- while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
- CHK_(ptr);
- switch (tag >> 3) {
- // int32 a = 1;
- case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
- a_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
- CHK_(ptr);
- } else goto handle_unusual;
- continue;
- default: {
- handle_unusual:
- if ((tag & 7) == 4 || tag == 0) {
- ctx->SetLastTag(tag);
- goto success;
- }
- ptr = UnknownFieldParse(tag,
- _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
- ptr, ctx);
- CHK_(ptr != nullptr);
- continue;
- }
- } // switch
- } // while
-success:
- return ptr;
-failure:
- ptr = nullptr;
- goto success;
-#undef CHK_
-}
-
-::PROTOBUF_NAMESPACE_ID::uint8* rpcRequest::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
- // @@protoc_insertion_point(serialize_to_array_start:fosscordMedia.rpcRequest)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
- (void) cached_has_bits;
-
- // int32 a = 1;
- if (this->a() != 0) {
- target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_a(), target);
- }
-
- if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
- _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
- }
- // @@protoc_insertion_point(serialize_to_array_end:fosscordMedia.rpcRequest)
- return target;
-}
-
-size_t rpcRequest::ByteSizeLong() const {
-// @@protoc_insertion_point(message_byte_size_start:fosscordMedia.rpcRequest)
- size_t total_size = 0;
-
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
- // Prevent compiler warnings about cached_has_bits being unused
- (void) cached_has_bits;
-
- // int32 a = 1;
- if (this->a() != 0) {
- total_size += 1 +
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
- this->_internal_a());
- }
-
- if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
- _internal_metadata_, total_size, &_cached_size_);
- }
- int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
- return total_size;
-}
-
-void rpcRequest::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
-// @@protoc_insertion_point(generalized_merge_from_start:fosscordMedia.rpcRequest)
- GOOGLE_DCHECK_NE(&from, this);
- const rpcRequest* source =
- ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated(
- &from);
- if (source == nullptr) {
- // @@protoc_insertion_point(generalized_merge_from_cast_fail:fosscordMedia.rpcRequest)
- ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
- } else {
- // @@protoc_insertion_point(generalized_merge_from_cast_success:fosscordMedia.rpcRequest)
- MergeFrom(*source);
- }
-}
-
-void rpcRequest::MergeFrom(const rpcRequest& from) {
-// @@protoc_insertion_point(class_specific_merge_from_start:fosscordMedia.rpcRequest)
- GOOGLE_DCHECK_NE(&from, this);
- _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
- (void) cached_has_bits;
-
- if (from.a() != 0) {
- _internal_set_a(from._internal_a());
- }
-}
-
-void rpcRequest::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
-// @@protoc_insertion_point(generalized_copy_from_start:fosscordMedia.rpcRequest)
- if (&from == this) return;
- Clear();
- MergeFrom(from);
-}
-
-void rpcRequest::CopyFrom(const rpcRequest& from) {
-// @@protoc_insertion_point(class_specific_copy_from_start:fosscordMedia.rpcRequest)
- if (&from == this) return;
- Clear();
- MergeFrom(from);
-}
-
-bool rpcRequest::IsInitialized() const {
- return true;
-}
-
-void rpcRequest::InternalSwap(rpcRequest* other) {
- using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
- swap(a_, other->a_);
-}
-
-::PROTOBUF_NAMESPACE_ID::Metadata rpcRequest::GetMetadata() const {
- return GetMetadataStatic();
-}
-
-
-// ===================================================================
-
-class rpcResponse::_Internal {
- public:
-};
-
-rpcResponse::rpcResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena)
- : ::PROTOBUF_NAMESPACE_ID::Message(arena) {
- SharedCtor();
- RegisterArenaDtor(arena);
- // @@protoc_insertion_point(arena_constructor:fosscordMedia.rpcResponse)
-}
-rpcResponse::rpcResponse(const rpcResponse& from)
- : ::PROTOBUF_NAMESPACE_ID::Message() {
- _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
- b_ = from.b_;
- // @@protoc_insertion_point(copy_constructor:fosscordMedia.rpcResponse)
-}
-
-void rpcResponse::SharedCtor() {
-b_ = 0;
-}
-
-rpcResponse::~rpcResponse() {
- // @@protoc_insertion_point(destructor:fosscordMedia.rpcResponse)
- SharedDtor();
- _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
-}
-
-void rpcResponse::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
-}
-
-void rpcResponse::ArenaDtor(void* object) {
- rpcResponse* _this = reinterpret_cast< rpcResponse* >(object);
- (void)_this;
-}
-void rpcResponse::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
-}
-void rpcResponse::SetCachedSize(int size) const {
- _cached_size_.Set(size);
-}
-
-void rpcResponse::Clear() {
-// @@protoc_insertion_point(message_clear_start:fosscordMedia.rpcResponse)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
- // Prevent compiler warnings about cached_has_bits being unused
- (void) cached_has_bits;
-
- b_ = 0;
- _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
-}
-
-const char* rpcResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
-#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
- while (!ctx->Done(&ptr)) {
- ::PROTOBUF_NAMESPACE_ID::uint32 tag;
- ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
- CHK_(ptr);
- switch (tag >> 3) {
- // int32 b = 1;
- case 1:
- if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
- b_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
- CHK_(ptr);
- } else goto handle_unusual;
- continue;
- default: {
- handle_unusual:
- if ((tag & 7) == 4 || tag == 0) {
- ctx->SetLastTag(tag);
- goto success;
- }
- ptr = UnknownFieldParse(tag,
- _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
- ptr, ctx);
- CHK_(ptr != nullptr);
- continue;
- }
- } // switch
- } // while
-success:
- return ptr;
-failure:
- ptr = nullptr;
- goto success;
-#undef CHK_
-}
-
-::PROTOBUF_NAMESPACE_ID::uint8* rpcResponse::_InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
- // @@protoc_insertion_point(serialize_to_array_start:fosscordMedia.rpcResponse)
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
- (void) cached_has_bits;
-
- // int32 b = 1;
- if (this->b() != 0) {
- target = stream->EnsureSpace(target);
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_b(), target);
- }
-
- if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
- _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
- }
- // @@protoc_insertion_point(serialize_to_array_end:fosscordMedia.rpcResponse)
- return target;
-}
-
-size_t rpcResponse::ByteSizeLong() const {
-// @@protoc_insertion_point(message_byte_size_start:fosscordMedia.rpcResponse)
- size_t total_size = 0;
-
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
- // Prevent compiler warnings about cached_has_bits being unused
- (void) cached_has_bits;
-
- // int32 b = 1;
- if (this->b() != 0) {
- total_size += 1 +
- ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
- this->_internal_b());
- }
-
- if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
- return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
- _internal_metadata_, total_size, &_cached_size_);
- }
- int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
- SetCachedSize(cached_size);
- return total_size;
-}
-
-void rpcResponse::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
-// @@protoc_insertion_point(generalized_merge_from_start:fosscordMedia.rpcResponse)
- GOOGLE_DCHECK_NE(&from, this);
- const rpcResponse* source =
- ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated(
- &from);
- if (source == nullptr) {
- // @@protoc_insertion_point(generalized_merge_from_cast_fail:fosscordMedia.rpcResponse)
- ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
- } else {
- // @@protoc_insertion_point(generalized_merge_from_cast_success:fosscordMedia.rpcResponse)
- MergeFrom(*source);
- }
-}
-
-void rpcResponse::MergeFrom(const rpcResponse& from) {
-// @@protoc_insertion_point(class_specific_merge_from_start:fosscordMedia.rpcResponse)
- GOOGLE_DCHECK_NE(&from, this);
- _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
- ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
- (void) cached_has_bits;
-
- if (from.b() != 0) {
- _internal_set_b(from._internal_b());
- }
-}
-
-void rpcResponse::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
-// @@protoc_insertion_point(generalized_copy_from_start:fosscordMedia.rpcResponse)
- if (&from == this) return;
- Clear();
- MergeFrom(from);
-}
-
-void rpcResponse::CopyFrom(const rpcResponse& from) {
-// @@protoc_insertion_point(class_specific_copy_from_start:fosscordMedia.rpcResponse)
- if (&from == this) return;
- Clear();
- MergeFrom(from);
-}
-
-bool rpcResponse::IsInitialized() const {
- return true;
-}
-
-void rpcResponse::InternalSwap(rpcResponse* other) {
- using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
- swap(b_, other->b_);
-}
-
-::PROTOBUF_NAMESPACE_ID::Metadata rpcResponse::GetMetadata() const {
- return GetMetadataStatic();
-}
-
-
-// @@protoc_insertion_point(namespace_scope)
-} // namespace fosscordMedia
-PROTOBUF_NAMESPACE_OPEN
-template<> PROTOBUF_NOINLINE ::fosscordMedia::rpcRequest* Arena::CreateMaybeMessage< ::fosscordMedia::rpcRequest >(Arena* arena) {
- return Arena::CreateMessageInternal< ::fosscordMedia::rpcRequest >(arena);
-}
-template<> PROTOBUF_NOINLINE ::fosscordMedia::rpcResponse* Arena::CreateMaybeMessage< ::fosscordMedia::rpcResponse >(Arena* arena) {
- return Arena::CreateMessageInternal< ::fosscordMedia::rpcResponse >(arena);
-}
-PROTOBUF_NAMESPACE_CLOSE
-
-// @@protoc_insertion_point(global_scope)
-#include
diff --git a/src/protodefs/include/protos.pb.h b/src/protodefs/include/protos.pb.h
deleted file mode 100644
index bc310678..00000000
--- a/src/protodefs/include/protos.pb.h
+++ /dev/null
@@ -1,413 +0,0 @@
-// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: protos.proto
-
-#ifndef GOOGLE_PROTOBUF_INCLUDED_protos_2eproto
-#define GOOGLE_PROTOBUF_INCLUDED_protos_2eproto
-
-#include
-#include
-
-#include
-#if PROTOBUF_VERSION < 3015000
-#error This file was generated by a newer version of protoc which is
-#error incompatible with your Protocol Buffer headers. Please update
-#error your headers.
-#endif
-#if 3015008 < PROTOBUF_MIN_PROTOC_VERSION
-#error This file was generated by an older version of protoc which is
-#error incompatible with your Protocol Buffer headers. Please
-#error regenerate this file with a newer version of protoc.
-#endif
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include // IWYU pragma: export
-#include // IWYU pragma: export
-#include
-// @@protoc_insertion_point(includes)
-#include
-#define PROTOBUF_INTERNAL_EXPORT_protos_2eproto
-PROTOBUF_NAMESPACE_OPEN
-namespace internal {
-class AnyMetadata;
-} // namespace internal
-PROTOBUF_NAMESPACE_CLOSE
-
-// Internal implementation detail -- do not use these members.
-struct TableStruct_protos_2eproto {
- static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[]
- PROTOBUF_SECTION_VARIABLE(protodesc_cold);
- static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[]
- PROTOBUF_SECTION_VARIABLE(protodesc_cold);
- static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[2]
- PROTOBUF_SECTION_VARIABLE(protodesc_cold);
- static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
- static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
- static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
-};
-extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_protos_2eproto;
-::PROTOBUF_NAMESPACE_ID::Metadata descriptor_table_protos_2eproto_metadata_getter(int index);
-namespace fosscordMedia {
-class rpcRequest;
-struct rpcRequestDefaultTypeInternal;
-extern rpcRequestDefaultTypeInternal _rpcRequest_default_instance_;
-class rpcResponse;
-struct rpcResponseDefaultTypeInternal;
-extern rpcResponseDefaultTypeInternal _rpcResponse_default_instance_;
-} // namespace fosscordMedia
-PROTOBUF_NAMESPACE_OPEN
-template<> ::fosscordMedia::rpcRequest* Arena::CreateMaybeMessage<::fosscordMedia::rpcRequest>(Arena*);
-template<> ::fosscordMedia::rpcResponse* Arena::CreateMaybeMessage<::fosscordMedia::rpcResponse>(Arena*);
-PROTOBUF_NAMESPACE_CLOSE
-namespace fosscordMedia {
-
-// ===================================================================
-
-class rpcRequest PROTOBUF_FINAL :
- public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:fosscordMedia.rpcRequest) */ {
- public:
- inline rpcRequest() : rpcRequest(nullptr) {}
- virtual ~rpcRequest();
- explicit constexpr rpcRequest(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
-
- rpcRequest(const rpcRequest& from);
- rpcRequest(rpcRequest&& from) noexcept
- : rpcRequest() {
- *this = ::std::move(from);
- }
-
- inline rpcRequest& operator=(const rpcRequest& from) {
- CopyFrom(from);
- return *this;
- }
- inline rpcRequest& operator=(rpcRequest&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
- } else {
- CopyFrom(from);
- }
- return *this;
- }
-
- static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
- return GetDescriptor();
- }
- static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
- return GetMetadataStatic().descriptor;
- }
- static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
- return GetMetadataStatic().reflection;
- }
- static const rpcRequest& default_instance() {
- return *internal_default_instance();
- }
- static inline const rpcRequest* internal_default_instance() {
- return reinterpret_cast(
- &_rpcRequest_default_instance_);
- }
- static constexpr int kIndexInFileMessages =
- 0;
-
- friend void swap(rpcRequest& a, rpcRequest& b) {
- a.Swap(&b);
- }
- inline void Swap(rpcRequest* other) {
- if (other == this) return;
- if (GetArena() == other->GetArena()) {
- InternalSwap(other);
- } else {
- ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
- }
- }
- void UnsafeArenaSwap(rpcRequest* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
- InternalSwap(other);
- }
-
- // implements Message ----------------------------------------------
-
- inline rpcRequest* New() const final {
- return CreateMaybeMessage(nullptr);
- }
-
- rpcRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
- return CreateMaybeMessage(arena);
- }
- void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
- void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
- void CopyFrom(const rpcRequest& from);
- void MergeFrom(const rpcRequest& from);
- PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
- bool IsInitialized() const final;
-
- size_t ByteSizeLong() const final;
- const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
- ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
- private:
- inline void SharedCtor();
- inline void SharedDtor();
- void SetCachedSize(int size) const final;
- void InternalSwap(rpcRequest* other);
- friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
- static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
- return "fosscordMedia.rpcRequest";
- }
- protected:
- explicit rpcRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
- public:
-
- ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
- private:
- static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
- return ::descriptor_table_protos_2eproto_metadata_getter(kIndexInFileMessages);
- }
-
- public:
-
- // nested types ----------------------------------------------------
-
- // accessors -------------------------------------------------------
-
- enum : int {
- kAFieldNumber = 1,
- };
- // int32 a = 1;
- void clear_a();
- ::PROTOBUF_NAMESPACE_ID::int32 a() const;
- void set_a(::PROTOBUF_NAMESPACE_ID::int32 value);
- private:
- ::PROTOBUF_NAMESPACE_ID::int32 _internal_a() const;
- void _internal_set_a(::PROTOBUF_NAMESPACE_ID::int32 value);
- public:
-
- // @@protoc_insertion_point(class_scope:fosscordMedia.rpcRequest)
- private:
- class _Internal;
-
- template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
- ::PROTOBUF_NAMESPACE_ID::int32 a_;
- mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
- friend struct ::TableStruct_protos_2eproto;
-};
-// -------------------------------------------------------------------
-
-class rpcResponse PROTOBUF_FINAL :
- public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:fosscordMedia.rpcResponse) */ {
- public:
- inline rpcResponse() : rpcResponse(nullptr) {}
- virtual ~rpcResponse();
- explicit constexpr rpcResponse(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
-
- rpcResponse(const rpcResponse& from);
- rpcResponse(rpcResponse&& from) noexcept
- : rpcResponse() {
- *this = ::std::move(from);
- }
-
- inline rpcResponse& operator=(const rpcResponse& from) {
- CopyFrom(from);
- return *this;
- }
- inline rpcResponse& operator=(rpcResponse&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
- } else {
- CopyFrom(from);
- }
- return *this;
- }
-
- static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
- return GetDescriptor();
- }
- static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
- return GetMetadataStatic().descriptor;
- }
- static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
- return GetMetadataStatic().reflection;
- }
- static const rpcResponse& default_instance() {
- return *internal_default_instance();
- }
- static inline const rpcResponse* internal_default_instance() {
- return reinterpret_cast(
- &_rpcResponse_default_instance_);
- }
- static constexpr int kIndexInFileMessages =
- 1;
-
- friend void swap(rpcResponse& a, rpcResponse& b) {
- a.Swap(&b);
- }
- inline void Swap(rpcResponse* other) {
- if (other == this) return;
- if (GetArena() == other->GetArena()) {
- InternalSwap(other);
- } else {
- ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
- }
- }
- void UnsafeArenaSwap(rpcResponse* other) {
- if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
- InternalSwap(other);
- }
-
- // implements Message ----------------------------------------------
-
- inline rpcResponse* New() const final {
- return CreateMaybeMessage(nullptr);
- }
-
- rpcResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
- return CreateMaybeMessage(arena);
- }
- void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
- void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
- void CopyFrom(const rpcResponse& from);
- void MergeFrom(const rpcResponse& from);
- PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
- bool IsInitialized() const final;
-
- size_t ByteSizeLong() const final;
- const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
- ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
- ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
- int GetCachedSize() const final { return _cached_size_.Get(); }
-
- private:
- inline void SharedCtor();
- inline void SharedDtor();
- void SetCachedSize(int size) const final;
- void InternalSwap(rpcResponse* other);
- friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
- static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
- return "fosscordMedia.rpcResponse";
- }
- protected:
- explicit rpcResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena);
- private:
- static void ArenaDtor(void* object);
- inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena);
- public:
-
- ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
- private:
- static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
- return ::descriptor_table_protos_2eproto_metadata_getter(kIndexInFileMessages);
- }
-
- public:
-
- // nested types ----------------------------------------------------
-
- // accessors -------------------------------------------------------
-
- enum : int {
- kBFieldNumber = 1,
- };
- // int32 b = 1;
- void clear_b();
- ::PROTOBUF_NAMESPACE_ID::int32 b() const;
- void set_b(::PROTOBUF_NAMESPACE_ID::int32 value);
- private:
- ::PROTOBUF_NAMESPACE_ID::int32 _internal_b() const;
- void _internal_set_b(::PROTOBUF_NAMESPACE_ID::int32 value);
- public:
-
- // @@protoc_insertion_point(class_scope:fosscordMedia.rpcResponse)
- private:
- class _Internal;
-
- template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
- typedef void InternalArenaConstructable_;
- typedef void DestructorSkippable_;
- ::PROTOBUF_NAMESPACE_ID::int32 b_;
- mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
- friend struct ::TableStruct_protos_2eproto;
-};
-// ===================================================================
-
-
-// ===================================================================
-
-#ifdef __GNUC__
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wstrict-aliasing"
-#endif // __GNUC__
-// rpcRequest
-
-// int32 a = 1;
-inline void rpcRequest::clear_a() {
- a_ = 0;
-}
-inline ::PROTOBUF_NAMESPACE_ID::int32 rpcRequest::_internal_a() const {
- return a_;
-}
-inline ::PROTOBUF_NAMESPACE_ID::int32 rpcRequest::a() const {
- // @@protoc_insertion_point(field_get:fosscordMedia.rpcRequest.a)
- return _internal_a();
-}
-inline void rpcRequest::_internal_set_a(::PROTOBUF_NAMESPACE_ID::int32 value) {
-
- a_ = value;
-}
-inline void rpcRequest::set_a(::PROTOBUF_NAMESPACE_ID::int32 value) {
- _internal_set_a(value);
- // @@protoc_insertion_point(field_set:fosscordMedia.rpcRequest.a)
-}
-
-// -------------------------------------------------------------------
-
-// rpcResponse
-
-// int32 b = 1;
-inline void rpcResponse::clear_b() {
- b_ = 0;
-}
-inline ::PROTOBUF_NAMESPACE_ID::int32 rpcResponse::_internal_b() const {
- return b_;
-}
-inline ::PROTOBUF_NAMESPACE_ID::int32 rpcResponse::b() const {
- // @@protoc_insertion_point(field_get:fosscordMedia.rpcResponse.b)
- return _internal_b();
-}
-inline void rpcResponse::_internal_set_b(::PROTOBUF_NAMESPACE_ID::int32 value) {
-
- b_ = value;
-}
-inline void rpcResponse::set_b(::PROTOBUF_NAMESPACE_ID::int32 value) {
- _internal_set_b(value);
- // @@protoc_insertion_point(field_set:fosscordMedia.rpcResponse.b)
-}
-
-#ifdef __GNUC__
- #pragma GCC diagnostic pop
-#endif // __GNUC__
-// -------------------------------------------------------------------
-
-
-// @@protoc_insertion_point(namespace_scope)
-
-} // namespace fosscordMedia
-
-// @@protoc_insertion_point(global_scope)
-
-#include
-#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_protos_2eproto
From a5d98b9dccc149e75161b33ea3d1c4121029747f Mon Sep 17 00:00:00 2001
From: Newe
Date: Mon, 24 May 2021 17:46:50 +0200
Subject: [PATCH 12/18] [edit] Deprecate gRPC in favor of MongoDB
---
CMakeLists.txt | 30 +++++++-----------------------
README.md | 2 +-
src/main.cpp | 15 ++++++++++++---
src/mongoStub.cpp | 26 ++++++++++++++++++++++++++
src/mongoStub.hpp | 29 +++++++++++++++++++++++++++++
src/rpcStub.cpp | 32 --------------------------------
src/rpcStub.hpp | 15 ---------------
7 files changed, 75 insertions(+), 74 deletions(-)
create mode 100644 src/mongoStub.cpp
create mode 100644 src/mongoStub.hpp
delete mode 100644 src/rpcStub.cpp
delete mode 100644 src/rpcStub.hpp
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cebd3adf..2cf5c0a6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,32 +1,16 @@
-cmake_minimum_required(VERSION 3.15)
+cmake_minimum_required(VERSION 3.2)
project(fosscord-media)
set(CMAKE_CXX_STANDARD 17)
find_package(Threads REQUIRED)
-find_package(Protobuf REQUIRED)
-find_package(gRPC CONFIG REQUIRED)
-find_package(absl REQUIRED)
-find_package(nlohmann_json REQUIRED)
+
+find_package(mongocxx REQUIRED)
+find_package(Boost REQUIRED)
+
file(GLOB SourceFiles ${PROJECT_SOURCE_DIR}/src/*.cpp)
-
-file(GLOB ProtoFiles ${PROJECT_SOURCE_DIR}/src/protodefs/*.proto)
-set(PROTOBUF_INPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/src/protodefs)
-set(PROTOBUF_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/src/protodefs/include)
-
-foreach(file ${ProtoFiles})
- execute_process(COMMAND "LD_LIBRARY_PATH=/usr/local/lib protoc --proto_path=\"${PROTOBUF_INPUT_DIRECTORY}\"
- --cpp_out=\"${PROJECT_SOURCE_DIR}/src/protodefs/include\" --grpc_out=\"${PROJECT_SOURCE_DIR}/src/protodefs/include\"
- --plugin=protoc-gen-grpc=/usr/local/bin/grpc_cpp_plugin protos.proto"
- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
-endforeach()
-
-
-include_directories(${Protobuf_INCLUDE_DIRS})
-
-#protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ProtoFiles)
-
+#include_directories("bsoncxx/v_noabi/bsoncxx/")
add_executable(${CMAKE_PROJECT_NAME} ${SourceFiles})
-target_link_libraries(${CMAKE_PROJECT_NAME} datachannel gRPC::grpc++ absl::base absl::synchronization absl::strings ${Protobuf_LIBRARIES} nlohmann_json::nlohmann_json)
\ No newline at end of file
+target_link_libraries(${CMAKE_PROJECT_NAME} datachannel mongo::mongocxx_shared Boost::boost)
\ No newline at end of file
diff --git a/README.md b/README.md
index 4ddd4708..a1ff3c08 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@ A Fosscord media (voice and video) server
## Installation
### Prerequisites
- Install the [libdatachannel](https://github.com/paullouisageneau/libdatachannel) library
-- Install the [gRPC](https://github.com/grpc/grpc) library
+- Install the [limbongocxx]() driver
### Building
diff --git a/src/main.cpp b/src/main.cpp
index 2fdeceee..bd4ebbec 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -22,15 +22,24 @@
//
#include "rtcPeerHandler.hpp" //Handle peer connection requests
-#include "rpcStub.hpp" //Handle gRPC communications between the different fosscord elements
+#include "mongoStub.hpp" //Handle communication with the MongoDB server
int main(int argc, char **argv){
auto commsHandler = std::make_shared();
- auto rpcHandler = std::unique_ptr(new rpcStub(commsHandler, 8057));
+ auto mongoHandler = std::make_unique();
+ mongocxx::options::change_stream options;
+ mongocxx::change_stream colCs = mongoHandler->getCol().watch(options);
+
+ //Check for new messages in the collection
+ for (;;){
+ std::vector t = mongoHandler->getNewMessages(&colCs);
+ for(auto &i : t){
+ std::cout << i << std::endl;
+ }
+ }
std::cout << "Server created" << std::endl;
- //rpcHandler->server->Wait(); //blocking, this will need to be threaded
return 0;
}
\ No newline at end of file
diff --git a/src/mongoStub.cpp b/src/mongoStub.cpp
new file mode 100644
index 00000000..50312fc6
--- /dev/null
+++ b/src/mongoStub.cpp
@@ -0,0 +1,26 @@
+#include "mongoStub.hpp"
+
+mongoStub::mongoStub() {
+ if (this->client) {
+ this->db = client["fosscord"];
+
+ if (this->db) {
+ this->col = db["events"];
+
+ } else {
+ std::cout << "db not found";
+ exit(-1);
+ }
+ } else {
+ std::cout << "Client couldn't be initialized";
+ exit(-1);
+ }
+}
+
+std::vectormongoStub::getNewMessages(mongocxx::change_stream* colCs) {
+ std::vector retVec;
+ for (const auto& event : *colCs) {
+ retVec.push_back(bsoncxx::to_json(event));
+ }
+ return retVec;
+}
diff --git a/src/mongoStub.hpp b/src/mongoStub.hpp
new file mode 100644
index 00000000..3cee472c
--- /dev/null
+++ b/src/mongoStub.hpp
@@ -0,0 +1,29 @@
+#ifndef MONGOSTUB_HPP
+#define MONGOSTUB_HPP
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+class mongoStub : boost::noncopyable {
+ public:
+ mongoStub();
+ std::vector getNewMessages(mongocxx::change_stream* colCs);
+
+ mongocxx::collection getCol() const { return col; }
+
+ private:
+ mongocxx::instance instance;
+ mongocxx::client client{mongocxx::uri{}};
+ mongocxx::database db;
+ mongocxx::collection col;
+ mongocxx::change_stream* colCs = nullptr;
+};
+
+#endif
diff --git a/src/rpcStub.cpp b/src/rpcStub.cpp
deleted file mode 100644
index 1633aab8..00000000
--- a/src/rpcStub.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "rpcStub.hpp"
-
-class fossCordInternalsImpl final : public fosscordMedia::fosscordInternals::Service {
- std::shared_ptr ph;
- fossCordInternalsImpl(std::shared_ptr handler){
- this->ph= handler;
- }
- grpc::Status vRequest(grpc::ServerContext* ctx,
- const fosscordMedia::voiceRequest* req,
- fosscordMedia::voiceAnswer* resp) override {
-
- this->ph->initiateConnection(req->ip(), req->port());
- return grpc::Status::OK;
- }
-};
-
-rpcStub::rpcStub(std::shared_ptr handler, int port) {
- if (not port) {
- port = 8057;
- }
- this->ph = handler;
-
- fossCordInternalsImpl* service;
- grpc::ServerBuilder builder;
- builder.AddListeningPort("0.0.0.0:" + std::to_string(port),
- grpc::InsecureServerCredentials());
- builder.RegisterService(service);
-
- this->server = builder.BuildAndStart();
-
- std::cout << "RPC stub listening on port " << port << std::endl;
-}
\ No newline at end of file
diff --git a/src/rpcStub.hpp b/src/rpcStub.hpp
deleted file mode 100644
index d183cf3c..00000000
--- a/src/rpcStub.hpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include
-#include "protodefs/include/protos.grpc.pb.h"
-#include "rtcPeerHandler.hpp"
-
-#ifndef RPCSTUB
-#define RPCSTUB
-class rpcStub{
- public:
- rpcStub(std::shared_ptr peerHandler, int port);
- std::unique_ptr server;
-
- private:
- std::shared_ptr ph;
-};
-#endif
\ No newline at end of file
From 7ddc2aaf39f2e34f4a6c1540a36b347ba1a1e102 Mon Sep 17 00:00:00 2001
From: Newe
Date: Mon, 24 May 2021 17:52:06 +0200
Subject: [PATCH 13/18] [edit] Edited README
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index a1ff3c08..f965b84a 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@ A Fosscord media (voice and video) server
## Installation
### Prerequisites
- Install the [libdatachannel](https://github.com/paullouisageneau/libdatachannel) library
-- Install the [limbongocxx]() driver
+- Install the [libmongocxx](http://mongocxx.org/mongocxx-v3/installation/) driver and its requirements
### Building
From 63407d96e37df8457e8350e9184b9e3de376fd1f Mon Sep 17 00:00:00 2001
From: Newe
Date: Tue, 25 May 2021 12:41:28 +0200
Subject: [PATCH 14/18] [edit] Retrieve the event name from mongoDB event
payload
---
src/main.cpp | 8 +++++---
src/mongoStub.cpp | 26 ++++++++++++++++++++++----
src/mongoStub.hpp | 17 +++++++++++++----
3 files changed, 40 insertions(+), 11 deletions(-)
diff --git a/src/main.cpp b/src/main.cpp
index bd4ebbec..372eaa00 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -30,16 +30,18 @@ int main(int argc, char **argv){
auto mongoHandler = std::make_unique();
mongocxx::options::change_stream options;
+ //voiceEvents collection watcher
mongocxx::change_stream colCs = mongoHandler->getCol().watch(options);
+ std::cout << "Server created and listening for events" << std::endl;
+
//Check for new messages in the collection
for (;;){
- std::vector t = mongoHandler->getNewMessages(&colCs);
+ std::vector t = mongoHandler->getNewMessages(&colCs);
for(auto &i : t){
- std::cout << i << std::endl;
+ std::cout << "[" << i.eventName << "] " << std::endl;
}
}
- std::cout << "Server created" << std::endl;
return 0;
}
\ No newline at end of file
diff --git a/src/mongoStub.cpp b/src/mongoStub.cpp
index 50312fc6..3e7ae3df 100644
--- a/src/mongoStub.cpp
+++ b/src/mongoStub.cpp
@@ -17,10 +17,28 @@ mongoStub::mongoStub() {
}
}
-std::vector