Add support for UserStats message.
[umurmur.git] / src / client.h
index 358993e0e77d6850cc60add09284bdb6be1fcbeb..d2f935c2511c52dac9d0eca17b20dc34f80e400c 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2009, Martin Johansson <martin@fatbob.nu>
-   Copyright (C) 2005-2009, Thorvald Natvig <thorvald@natvig.com>
+/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
+   Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
 
@@ -31,7 +31,6 @@
 #ifndef CLIENT_H_45786678
 #define CLIENT_H_45786678
 
-#include <openssl/ssl.h>
 #include <stdint.h>
 #include <unistd.h>             /* close() */
 #include <sys/types.h>
@@ -47,8 +46,9 @@
 #include "crypt.h"
 #include "timer.h"
 #include "pds.h"
+#include "ssl.h"
 
-#define BUFSIZE 2048
+#define BUFSIZE 8192
 #define UDP_BUFSIZE 512
 #define INACTICITY_TIMEOUT 15 /* Seconds */
 #define MAX_CODECS 10
@@ -57,7 +57,7 @@
 
 typedef struct {
        int tcpfd;
-       SSL *ssl;
+       SSL_handle_t *ssl;
        bool_t SSLready;
        bool_t shutdown_wait;
        cryptState_t cryptState;
@@ -69,23 +69,29 @@ typedef struct {
        uint32_t rxcount, msgsize, drainleft, txcount, txsize;
        int sessionId;
        uint64_t key;
-       char playerName[MAX_TEXT];
-       int playerId;
-       bool_t authenticated, deaf, mute;
-       char *os, *release;
+       char *username;
+       bool_t bUDP, authenticated, deaf, mute;
+       char *os, *release, *os_version;
        uint32_t version;
        int codec_count;
-       int32_t codecs[MAX_CODECS];
+       struct dlist codecs;
        int availableBandwidth;
-       etimer_t lastActivity;
+       etimer_t lastActivity, connectTime, idleTime;
        struct dlist node;
        struct dlist txMsgQueue;
        int txQueueCount;
-       /* Channel */
-       void *channel; /*Ugly... */
+       void *channel; /* Ugly... */
+       char *context;
        struct dlist chan_node;
+       struct dlist voicetargets;
+       float UDPPingAvg, UDPPingVar, TCPPingAvg, TCPPingVar;
+       uint32_t UDPPackets, TCPPackets;
 } client_t;
 
+typedef struct {
+       int codec, count;
+       struct dlist node;
+} codec_t;
 
 void Client_init();
 int Client_getfds(struct pollfd *pollfds);
@@ -102,5 +108,8 @@ int Client_read_udp(void);
 void Client_disconnect_all();
 int Client_voiceMsg(client_t *client, uint8_t *data, int len);
 void recheckCodecVersions();
+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);
 
 #endif