aboutsummaryrefslogtreecommitdiffstats
path: root/src/server.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/server.h')
-rw-r--r--src/server.h79
1 files changed, 7 insertions, 72 deletions
diff --git a/src/server.h b/src/server.h
index adf4c36..d3cf88c 100644
--- a/src/server.h
+++ b/src/server.h
@@ -15,82 +15,14 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "message.h"
-#include "ring.h"
+#ifndef SERVER_H
+#define SERVER_H
-#include <stddef.h>
-
-
-
-#ifndef GCC_ONLY
-# if defined(__GNUC__) && !defined(__clang__)
-# define GCC_ONLY(...) __VA_ARGS__
-# else
-# define GCC_ONLY(...) /* nothing */
-# endif
-#endif
-
-
-
-/**
- * List of all client's file descriptors
- *
- * Unused slots, with index less than `connections_used`,
- * should have the value -1 (negative)
- */
-extern int* restrict connections;
/**
- * The number of elements allocated for `connections`
+ * Disconnect all clients
*/
-extern size_t connections_alloc;
-
-/**
- * The index of the first unused slot in `connections`
- */
-extern size_t connections_ptr;
-
-/**
- * The index of the last used slot in `connections`, plus 1
- */
-extern size_t connections_used;
-
-/**
- * The clients' connections' inbound-message buffers
- */
-extern struct message* restrict inbound;
-
-/**
- * The clients' connections' outbound-message buffers
- */
-extern struct ring* restrict outbound;
-
-
-
-/**
- * Destroy the state of the connections
- *
- * @param disconnect Disconnect all connections?
- */
-void server_destroy(int disconnect);
-
-/**
- * Marshal the state of the connections
- *
- * @param buf Output buffer for the marshalled data,
- * `NULL` to only measure how many bytes
- * this buffer needs
- * @return The number of marshalled bytes
- */
-size_t server_marshal(void* restrict buf);
-
-/**
- * Unmarshal the state of the connections
- *
- * @param buf Buffer for the marshalled data
- * @return The number of unmarshalled bytes, 0 on error
- */
-size_t server_unmarshal(const void* restrict buf);
+void disconnect_all(void);
/**
* The program's main loop
@@ -99,3 +31,6 @@ size_t server_unmarshal(const void* restrict buf);
*/
int main_loop(void);
+
+#endif
+