1 /* Copyright (C) 2009-2010, Martin Johansson <martin@fatbob.nu>
2 Copyright (C) 2005-2010, Thorvald Natvig <thorvald@natvig.com>
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions
10 - Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer.
12 - Redistributions in binary form must reproduce the above copyright notice,
13 this list of conditions and the following disclaimer in the documentation
14 and/or other materials provided with the distribution.
15 - Neither the name of the Developers nor the names of its contributors may
16 be used to endorse or promote products derived from this software without
17 specific prior written permission.
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
23 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef MESSAGES_H_89768
32 #define MESSAGES_H_89768
35 #include "Mumble.pb-c.h"
39 #define PROTVER_MAJOR 1
40 #define PROTVER_MINOR 2
41 #define PROTVER_PATCH 0
42 #define PROTOCOL_VERSION ((PROTVER_MAJOR << 16) | (PROTVER_MINOR << 8) | (PROTVER_PATCH))
45 #define PERM_WRITE 0x1
46 #define PERM_TRAVERSE 0x2
47 #define PERM_ENTER 0x4
48 #define PERM_SPEAK 0x8
49 #define PERM_MUTEDEAFEN 0x10
50 #define PERM_MOVE 0x20
51 #define PERM_MAKECHANNEL 0x40
52 #define PERM_LINKCHANNEL 0x80
53 #define PERM_WHISPER 0x100
54 #define PERM_TEXTMESSAGE 0x200
55 #define PERM_MAKETEMPCHANNEL 0x400
57 #define PERM_KICK 0x10000
58 #define PERM_BAN 0x20000
59 #define PERM_REGISTER 0x40000
60 #define PERM_SELFREGISTER 0x80000
61 #define PERM_CACHED 0x8000000
62 #define PERM_ALL 0xf07ff
64 #define PERM_DEFAULT (PERM_TRAVERSE | PERM_ENTER | PERM_SPEAK | PERM_WHISPER | PERM_TEXTMESSAGE | PERM_MAKETEMPCHANNEL)
87 PermissionQuery, /* 20 */
99 typedef union payload {
100 struct _MumbleProto__Version *version;
101 struct _MumbleProto__UDPTunnel *UDPTunnel;
102 struct _MumbleProto__Authenticate *authenticate;
103 struct _MumbleProto__Ping *ping;
104 struct _MumbleProto__Reject *reject;
105 struct _MumbleProto__ServerSync *serverSync;
106 struct _MumbleProto__ChannelRemove *channelRemove;
107 struct _MumbleProto__ChannelState *channelState;
108 struct _MumbleProto__UserRemove *userRemove;
109 struct _MumbleProto__UserState *userState;
110 /* BanEntry not supported */
111 /* BanList not supported */
112 struct _MumbleProto__TextMessage *textMessage;
113 struct _MumbleProto__PermissionDenied *permissionDenied;
114 /* ChanACL not supported */
115 /* ACL not supported */
116 struct _MumbleProto__QueryUsers *queryUsers;
117 struct _MumbleProto__CryptSetup *cryptSetup;
118 /* ContextActionAdd not supported */
119 /* ContextAction not supported */
120 struct _MumbleProto__UserList__User *userList_user;
121 struct _MumbleProto__UserList *userList;
122 struct _MumbleProto__VoiceTarget__Target *voiceTarget_target;
123 struct _MumbleProto__VoiceTarget *voiceTarget;
124 struct _MumbleProto__PermissionQuery *permissionQuery;
125 struct _MumbleProto__CodecVersion *codecVersion;
128 typedef struct message {
129 messageType_t messageType;
137 int Msg_messageToNetwork(message_t *msg, uint8_t *buffer);
138 message_t *Msg_networkToMessage(uint8_t *data, int size);
139 void Msg_free(message_t *msg);
140 void Msg_inc_ref(message_t *msg);
142 message_t *Msg_create(messageType_t messageType);