Add initial support for Opus
[umurmur.git] / src / client.h
index 608c87c036f81d453f133ace43342af1ef3c3c0f..a0f42d56d4dafc33856ab7fffcd37772cfb41e77 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2009-2011, Martin Johansson <martin@fatbob.nu>
-   Copyright (C) 2005-2011, Thorvald Natvig <thorvald@natvig.com>
+/* Copyright (C) 2009-2012, Martin Johansson <martin@fatbob.nu>
+   Copyright (C) 2005-2012, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
 
 
 #define BUFSIZE 8192
 #define UDP_BUFSIZE 512
-#define INACTICITY_TIMEOUT 15 /* Seconds */
+#define INACTIVITY_TIMEOUT 15 /* Seconds */
 #define MAX_CODECS 10
+#define MAX_TOKENSIZE 64
+#define MAX_TOKENS 32
 
 #define IS_AUTH(_a_) ((_a_)->authenticated)
 
@@ -71,7 +73,7 @@ typedef struct {
        int sessionId;
        uint64_t key;
        char *username;
-       bool_t bUDP, authenticated, deaf, mute, recording;
+       bool_t bUDP, authenticated, deaf, mute, self_deaf, self_mute, recording, bOpus;
        char *os, *release, *os_version;
        uint32_t version;
        int codec_count;
@@ -85,6 +87,10 @@ typedef struct {
        char *context;
        struct dlist chan_node;
        struct dlist voicetargets;
+       struct dlist tokens;
+       int tokencount;
+       uint8_t hash[20];
+       bool_t isAdmin;
        float UDPPingAvg, UDPPingVar, TCPPingAvg, TCPPingVar;
        uint32_t UDPPackets, TCPPackets;
 } client_t;
@@ -94,6 +100,11 @@ typedef struct {
        struct dlist node;
 } codec_t;
 
+typedef struct {
+       char *token;
+       struct dlist node;
+} token_t;
+
 void Client_init();
 int Client_getfds(struct pollfd *pollfds);
 void Client_janitor();
@@ -110,7 +121,7 @@ int Client_send_message_except(client_t *client, message_t *msg);
 int Client_read_udp(void);
 void Client_disconnect_all();
 int Client_voiceMsg(client_t *client, uint8_t *data, int len);
-void recheckCodecVersions();
+void recheckCodecVersions(client_t *connectingClient);
 void Client_codec_add(client_t *client, int codec);
 void Client_codec_free(client_t *client);
 codec_t *Client_codec_iterate(client_t *client, codec_t **codec_itr);