meanwhile  1.0.2
mw_message.h
Go to the documentation of this file.
1 
2 /*
3  Meanwhile - Unofficial Lotus Sametime Community Client Library
4  Copyright (C) 2004 Christopher (siege) O'Brien
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public
17  License along with this library; if not, write to the Free
18  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20 
21 #ifndef _MW_MESSAGE_H
22 #define _MW_MESSAGE_H
23 
24 
25 #include <glib.h>
26 #include "mw_common.h"
27 
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 
36 #define MW_MESSAGE(msg) (&msg->head)
37 
38 
43  mwMessage_LOGIN = 0x0001,
56  mwMessage_ADMIN = 0x0019,
57  mwMessage_ANNOUNCE = 0x0022,
58 };
59 
60 
64 };
65 
66 
68 #define MW_MESSAGE_HAS_OPTION(msg, opt) \
69  ((msg)->options & (opt))
70 
71 
72 struct mwMessage {
73  guint16 type;
74  guint16 options;
75  guint32 channel;
76  struct mwOpaque attribs;
77 };
78 
79 
80 
83 
84 
86 struct mwMessage *mwMessage_get(struct mwGetBuffer *b);
87 
88 
89 void mwMessage_put(struct mwPutBuffer *b, struct mwMessage *msg);
90 
91 
92 void mwMessage_free(struct mwMessage *msg);
93 
94 
95 /* 8.4 Messages */
96 /* 8.4.1 Basic Community Messages */
97 /* 8.4.1.1 Handshake */
98 
100  struct mwMessage head;
101  guint16 major;
102  guint16 minor;
103  guint32 srvrcalc_addr;
104  guint16 login_type;
105  guint32 loclcalc_addr;
106  guint16 unknown_a;
107  guint32 unknown_b;
108  char *local_host;
109 };
110 
111 
112 /* 8.4.1.2 HandshakeAck */
113 
115  struct mwMessage head;
116  guint16 major;
117  guint16 minor;
118  guint32 srvrcalc_addr;
119  guint32 magic;
120  struct mwOpaque data;
121 };
122 
123 
124 /* 8.3.7 Authentication Types */
125 
132 };
133 
134 
135 /* 8.4.1.3 Login */
136 
137 struct mwMsgLogin {
138  struct mwMessage head;
139  guint16 login_type;
140  char *name;
141  guint16 auth_type;
142  struct mwOpaque auth_data;
143 };
144 
145 
146 /* 8.4.1.4 LoginAck */
147 
149  struct mwMessage head;
150  struct mwLoginInfo login;
151  struct mwPrivacyInfo privacy;
153 };
154 
155 
156 /* 8.4.1.5 LoginCont */
157 
159  struct mwMessage head;
160 };
161 
162 
163 /* 8.4.1.6 AuthPassed */
164 
166  struct mwMessage head;
167  char *host;
168  char *server_id;
169 };
170 
171 
172 /* 8.4.1.7 CreateCnl */
173 
176  guint16 mode;
177  GList *items;
178  guint16 extra;
179  gboolean flag;
180 };
181 
182 
184  struct mwMessage head;
185  guint32 reserved;
186  guint32 channel;
187  struct mwIdBlock target;
188  guint32 service;
189  guint32 proto_type;
190  guint32 proto_ver;
191  guint32 options;
192  struct mwOpaque addtl;
193  gboolean creator_flag;
194  struct mwLoginInfo creator;
195  struct mwEncryptOffer encrypt;
196 };
197 
198 
199 /* 8.4.1.8 AcceptCnl */
200 
203  guint16 mode;
204  struct mwEncryptItem *item;
205  guint16 extra;
206  gboolean flag;
207 };
208 
209 
211  struct mwMessage head;
212  guint32 service;
213  guint32 proto_type;
214  guint32 proto_ver;
215  struct mwOpaque addtl;
216  gboolean acceptor_flag;
217  struct mwLoginInfo acceptor;
218  struct mwEncryptAccept encrypt;
219 };
220 
221 
222 /* 8.4.1.9 SendOnCnl */
223 
225  struct mwMessage head;
226 
229  guint16 type;
230 
232  struct mwOpaque data;
233 };
234 
235 
236 /* 8.4.1.10 DestroyCnl */
237 
239  struct mwMessage head;
240  guint32 reason;
241  struct mwOpaque data;
242 };
243 
244 
245 /* 8.4.1.11 SetUserStatus */
246 
248  struct mwMessage head;
249  struct mwUserStatus status;
250 };
251 
252 
253 /* 8.4.1.12 SetPrivacyList */
254 
256  struct mwMessage head;
257  struct mwPrivacyInfo privacy;
258 };
259 
260 
261 /* Sense Service */
262 
267  struct mwMessage head;
268  guint32 service;
269 };
270 
271 
272 /* Admin */
273 
275 struct mwMsgAdmin {
276  struct mwMessage head;
277  char *text;
278 };
279 
280 
281 /* Announce */
282 
285  struct mwMessage head;
286  gboolean sender_present;
287  struct mwLoginInfo sender;
288  guint16 unknown_a;
289  gboolean may_reply;
290  char *text;
295  GList *recipients;
296 };
297 
298 
299 #ifdef __cplusplus
300 }
301 #endif
302 
303 
304 #endif /* _MW_MESSAGE_H */
305 
mwMsgSetPrivacyList
Definition: mw_message.h:54
Definition: mw_message.h:129
Definition: mw_common.h:123
Sent to the server to request the presense of a service by its ID.
Definition: mw_message.h:266
guint32 magic
four bytes of something
Definition: mw_message.h:119
Definition: mw_message.h:99
Definition: mw_message.h:130
an offer of encryption items
Definition: mw_message.h:175
guint16 extra
encryption mode again?
Definition: mw_message.h:205
guint16 unknown_a
unknown A.
Definition: mw_message.h:288
guint16 mode
encryption mode
Definition: mw_message.h:203
guint16 login_type
Definition: mw_message.h:139
Definition: mw_message.h:183
char * name
user identification
Definition: mw_message.h:140
Definition: mw_message.h:210
GList * items
list of mwEncryptItem offered
Definition: mw_message.h:177
buffer to be read from
Definition: mw_common.h:71
mwMsgLoginAck
Definition: mw_message.h:44
guint16 mode
encryption mode
Definition: mw_message.h:176
Definition: mw_message.h:114
Definition: mw_message.h:128
mwMsgChannelCreate
Definition: mw_message.h:48
guint32 reason
reason for closing the channel.
Definition: mw_message.h:240
char * text
Definition: mw_message.h:277
mwMsgLoginContinue
Definition: mw_message.h:46
gboolean flag
unknown flag
Definition: mw_message.h:179
gboolean creator_flag
indicate presence of creator information
Definition: mw_message.h:193
void mwMessage_free(struct mwMessage *msg)
guint32 proto_ver
protocol version for the service
Definition: mw_message.h:190
a selected encryption item from those offered
Definition: mw_message.h:202
mwMsgLogin
Definition: mw_message.h:43
mwMsgChannelAccept
Definition: mw_message.h:51
An administrative broadcast message.
Definition: mw_message.h:275
Definition: mw_message.h:148
guint32 srvrcalc_addr
0.0.0.0
Definition: mw_message.h:103
guint16 major
server&#39;s major version number
Definition: mw_message.h:116
mwMsgChannelDestroy
Definition: mw_message.h:49
guint32 reserved
unknown reserved data
Definition: mw_message.h:185
gboolean acceptor_flag
indicate presence of acceptor information
Definition: mw_message.h:216
guint16 type
Definition: mw_message.h:73
mwMsgChannelSend
Definition: mw_message.h:50
mwAuthType
Definition: mw_message.h:126
mwMsgSenseService
Definition: mw_message.h:55
guint32 unknown_b
normally 0x00000000
Definition: mw_message.h:107
guint32 proto_type
protocol type for the service
Definition: mw_message.h:189
Definition: mw_common.h:174
struct mwEncryptItem * item
chosen mwEncryptItem (optional)
Definition: mw_message.h:204
guint16 type
message type.
Definition: mw_message.h:229
guint32 channel
ID of channel message is intended for.
Definition: mw_message.h:75
Common data types and functions for handling those types.
Definition: mw_message.h:127
guint32 srvrcalc_addr
server-calculated address
Definition: mw_message.h:118
struct mwMessage * mwMessage_new(enum mwMessageType type)
Allocate and initialize a new message of the specified type.
guint16 major
client&#39;s major version number
Definition: mw_message.h:101
char * server_id
Definition: mw_message.h:168
Definition: mw_message.h:131
gboolean sender_present
indicates presence of sender data
Definition: mw_message.h:286
Definition: mw_message.h:255
Definition: mw_message.h:238
guint32 service
ID for the channel&#39;s service.
Definition: mw_message.h:212
An announcement between users.
Definition: mw_message.h:284
mwMsgAnnounce
Definition: mw_message.h:57
mwMessageType
Indicates the type of a message.
Definition: mw_message.h:40
guint16 minor
server&#39;s minor version number
Definition: mw_message.h:117
char * host
Definition: mw_message.h:167
message data is encrypted
Definition: mw_message.h:62
GList * recipients
list of (char *) indicating recipients.
Definition: mw_message.h:295
guint16 options
Definition: mw_message.h:74
char * local_host
name of client host
Definition: mw_message.h:108
Definition: mw_common.h:165
mwMsgSetUserStatus
Definition: mw_message.h:53
mwMsgHandshakeAck
Definition: mw_message.h:42
guint16 extra
encryption mode again?
Definition: mw_message.h:178
void mwMessage_put(struct mwPutBuffer *b, struct mwMessage *msg)
gboolean flag
unknown flag
Definition: mw_message.h:206
Definition: mw_message.h:165
A length of binary data, not null-terminated.
Definition: mw_common.h:79
char * text
text of message
Definition: mw_message.h:290
struct mwMessage * mwMessage_get(struct mwGetBuffer *b)
build a message from its representation
Definition: mw_common.h:146
mwMsgAdmin
Definition: mw_message.h:56
Definition: mw_message.h:224
mwMsgHandshake
Definition: mw_message.h:41
guint32 loclcalc_addr
local public IP
Definition: mw_message.h:105
message has attributes
Definition: mw_message.h:63
guint32 channel
intended ID for new channel
Definition: mw_message.h:186
guint32 proto_ver
protocol version for the service
Definition: mw_message.h:214
guint32 service
ID for the target service.
Definition: mw_message.h:188
guint32 proto_type
protocol type for the service
Definition: mw_message.h:213
guint32 options
options
Definition: mw_message.h:191
guint16 login_type
Definition: mw_message.h:104
guint16 status
Definition: mw_common.h:166
mwMsgLoginRedirect
Definition: mw_message.h:45
guint16 unknown_a
normally 0x0100
Definition: mw_message.h:106
encryption blocks
Definition: mw_common.h:216
guint16 auth_type
Definition: mw_message.h:141
guint32 service
Definition: mw_message.h:268
Definition: mw_message.h:158
Definition: mw_message.h:247
gboolean may_reply
replies allowed
Definition: mw_message.h:289
struct mwOpaque attribs
optional message attributes
Definition: mw_message.h:76
mwMessageOption
Definition: mw_message.h:61
Definition: mw_message.h:137
guint16 minor
client&#39;s minor version number
Definition: mw_message.h:102
guchar * data
data, normally with no NULL termination
Definition: mw_common.h:81
Definition: mw_message.h:72
buffer to be written to