Use Client_find_by_session() instead of a few open-coded loops.
[umurmur.git] / src / messages.h
index 9aebc4b6574f8066b8bd957f708b1d5f2a3d6f95..0ba277d530c70d5dde9ee80fbdf92862afbe21f9 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-2014, Martin Johansson <martin@fatbob.nu>
+   Copyright (C) 2005-2014, Thorvald Natvig <thorvald@natvig.com>
 
    All rights reserved.
 
 #define MESSAGES_H_89768
 
 #include <stdint.h>
+#include <arpa/inet.h>
 #include "Mumble.pb-c.h"
 #include "list.h"
 #include "types.h"
 
 #define PROTVER_MAJOR 1
 #define PROTVER_MINOR 2
-#define PROTVER_PATCH 0
+#define PROTVER_PATCH 4
 #define PROTOCOL_VERSION ((PROTVER_MAJOR << 16) | (PROTVER_MINOR << 8) | (PROTVER_PATCH))
 
 #define PERM_NONE 0x0
@@ -62,6 +63,7 @@
 #define PERM_ALL 0xf07ff
 
 #define PERM_DEFAULT (PERM_TRAVERSE | PERM_ENTER | PERM_SPEAK | PERM_WHISPER | PERM_TEXTMESSAGE | PERM_MAKETEMPCHANNEL)
+#define PERM_ADMIN (PERM_DEFAULT | PERM_MUTEDEAFEN | PERM_MOVE | PERM_KICK | PERM_BAN)
 
 typedef enum {
        Version,
@@ -86,6 +88,9 @@ typedef enum {
        VoiceTarget,
        PermissionQuery, /* 20 */
        CodecVersion,
+       UserStats,
+       RequestBlob,
+       ServerConfig
 } messageType_t;
 
 typedef enum {
@@ -93,6 +98,7 @@ typedef enum {
        UDPPing,
        UDPVoiceSpeex,
        UDPVoiceCELTBeta,
+       UDPVoiceOpus,
 } UDPMessageType_t;
 
 
@@ -107,8 +113,7 @@ typedef union payload {
        struct  _MumbleProto__ChannelState *channelState;
        struct  _MumbleProto__UserRemove *userRemove;
        struct  _MumbleProto__UserState *userState;
-       /* BanEntry not supported */
-       /* BanList not supported */
+       struct  _MumbleProto__BanList *banList; 
        struct  _MumbleProto__TextMessage *textMessage;
        struct  _MumbleProto__PermissionDenied *permissionDenied;
        /* ChanACL not supported */
@@ -123,6 +128,8 @@ typedef union payload {
        struct  _MumbleProto__VoiceTarget *voiceTarget;
        struct  _MumbleProto__PermissionQuery *permissionQuery;
        struct  _MumbleProto__CodecVersion *codecVersion;
+       struct  _MumbleProto__UserStats *userStats;
+       struct  _MumbleProto__ServerConfig *serverConfig;
 } payload_t;
 
 typedef struct message {
@@ -139,6 +146,13 @@ message_t *Msg_networkToMessage(uint8_t *data, int size);
 void Msg_free(message_t *msg);
 void Msg_inc_ref(message_t *msg);
 
+message_t *Msg_CreateVoiceMsg(uint8_t *data, int size);
 message_t *Msg_create(messageType_t messageType);
+void Msg_banList_addEntry(message_t *msg, int index, uint8_t *address, uint32_t mask,
+                          char *name, char *hash, char *reason, char *start, uint32_t duration);
+void Msg_banList_getEntry(message_t *msg, int index, uint8_t **address, uint32_t *mask,
+                          char **name, char **hash, char **reason, char **start, uint32_t *duration);
+message_t *Msg_banList_create(int n_bans);
+
 
 #endif