Update copyright year.
[umurmur.git] / src / client.h
index a7d43f0bbb42d108de343ad1d9535aebc572f7e1..5f8f2ef4873bdac82891835595b26e19a73113d3 100644 (file)
@@ -1,5 +1,5 @@
-/* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
-   Copyright (C) 2005-2010, 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.
 
@@ -31,7 +31,7 @@
 #ifndef CLIENT_H_45786678
 #define CLIENT_H_45786678
 
-#include <openssl/ssl.h>
+#include <config.h>
 #include <stdint.h>
 #include <unistd.h>             /* close() */
 #include <sys/types.h>
 #include "crypt.h"
 #include "timer.h"
 #include "pds.h"
+#include "ssl.h"
 
 #define BUFSIZE 8192
 #define UDP_BUFSIZE 512
 #define INACTICITY_TIMEOUT 15 /* Seconds */
 #define MAX_CODECS 10
+#define MAX_TOKENSIZE 64
+#define MAX_TOKENS 32
 
 #define IS_AUTH(_a_) ((_a_)->authenticated)
 
 typedef struct {
        int tcpfd;
-       SSL *ssl;
+       SSL_handle_t *ssl;
        bool_t SSLready;
        bool_t shutdown_wait;
        cryptState_t cryptState;
@@ -70,13 +73,13 @@ typedef struct {
        int sessionId;
        uint64_t key;
        char *username;
-       bool_t authenticated, deaf, mute;
-       char *os, *release;
+       bool_t bUDP, authenticated, deaf, mute, recording;
+       char *os, *release, *os_version;
        uint32_t version;
        int codec_count;
        struct dlist codecs;
        int availableBandwidth;
-       etimer_t lastActivity;
+       etimer_t lastActivity, connectTime, idleTime;
        struct dlist node;
        struct dlist txMsgQueue;
        int txQueueCount;
@@ -84,6 +87,12 @@ 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;
 
 typedef struct {
@@ -91,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();
@@ -98,6 +112,8 @@ int Client_add(int fd, struct sockaddr_in *remote);
 int Client_read_fd(int fd);
 int Client_write_fd(int fd);
 int Client_send_message(client_t *client, message_t *msg);
+int Client_send_message_ver(client_t *client, message_t *msg, uint32_t version);
+int Client_send_message_except_ver(client_t *client, message_t *msg, uint32_t version);
 int Client_count(void);
 void Client_close(client_t *client);
 client_t *Client_iterate(client_t **client);