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;
143 };
144 
145 
146 /* 8.4.1.4 LoginAck */
147 
149  struct mwMessage head;
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;
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;
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;
250 };
251 
252 
253 /* 8.4.1.12 SetPrivacyList */
254 
256  struct mwMessage head;
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;
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 
mwMsgChannelCreate::target
struct mwIdBlock target
User ID.
Definition: mw_message.h:187
mwMsgAnnounce::head
struct mwMessage head
Definition: mw_message.h:285
mwMessage_get
struct mwMessage * mwMessage_get(struct mwGetBuffer *b)
build a message from its representation
mwMsgChannelCreate::options
guint32 options
options
Definition: mw_message.h:191
mwMessage::channel
guint32 channel
ID of channel message is intended for.
Definition: mw_message.h:75
mwMessage_ADMIN
@ mwMessage_ADMIN
mwMsgAdmin
Definition: mw_message.h:56
mwMsgHandshake::local_host
char * local_host
name of client host
Definition: mw_message.h:108
mwMessage_new
struct mwMessage * mwMessage_new(enum mwMessageType type)
Allocate and initialize a new message of the specified type.
mwMsgChannelCreate::creator_flag
gboolean creator_flag
indicate presence of creator information
Definition: mw_message.h:193
mwAuthType_PLAIN
@ mwAuthType_PLAIN
Definition: mw_message.h:127
mwMessage_SENSE_SERVICE
@ mwMessage_SENSE_SERVICE
mwMsgSenseService
Definition: mw_message.h:55
mwMsgChannelCreate::reserved
guint32 reserved
unknown reserved data
Definition: mw_message.h:185
mwAuthType_TOKEN
@ mwAuthType_TOKEN
Definition: mw_message.h:128
mwMsgLoginContinue::head
struct mwMessage head
Definition: mw_message.h:159
mwLoginInfo
Definition: mw_common.h:123
mwMsgLoginAck
Definition: mw_message.h:148
mwMsgChannelAccept::acceptor
struct mwLoginInfo acceptor
Definition: mw_message.h:217
mwMessage_CHANNEL_DESTROY
@ mwMessage_CHANNEL_DESTROY
mwMsgChannelDestroy
Definition: mw_message.h:49
mwMsgHandshakeAck::magic
guint32 magic
four bytes of something
Definition: mw_message.h:119
mwMsgChannelCreate::proto_type
guint32 proto_type
protocol type for the service
Definition: mw_message.h:189
mwMessageOption_HAS_ATTRIBS
@ mwMessageOption_HAS_ATTRIBS
message has attributes
Definition: mw_message.h:63
mwMessageType
mwMessageType
Indicates the type of a message.
Definition: mw_message.h:40
mwMsgChannelCreate
Definition: mw_message.h:183
mwMessage
Definition: mw_message.h:72
mwMsgChannelCreate::addtl
struct mwOpaque addtl
service-specific additional data
Definition: mw_message.h:192
mwMsgHandshake::head
struct mwMessage head
Definition: mw_message.h:100
mwMsgSenseService::service
guint32 service
Definition: mw_message.h:268
mwMsgChannelAccept::proto_type
guint32 proto_type
protocol type for the service
Definition: mw_message.h:213
mwMsgLoginContinue
Definition: mw_message.h:158
mwMsgAdmin
An administrative broadcast message.
Definition: mw_message.h:275
mwMsgAdmin::text
char * text
Definition: mw_message.h:277
mwEncryptItem
encryption blocks
Definition: mw_common.h:216
mwMsgSenseService::head
struct mwMessage head
Definition: mw_message.h:267
mwMsgLogin::login_type
guint16 login_type
Definition: mw_message.h:139
mw_common.h
mwMsgSetUserStatus
Definition: mw_message.h:247
mwMsgHandshake::loclcalc_addr
guint32 loclcalc_addr
local public IP
Definition: mw_message.h:105
mwMessage_CHANNEL_SEND
@ mwMessage_CHANNEL_SEND
mwMsgChannelSend
Definition: mw_message.h:50
mwMsgAnnounce::sender
struct mwLoginInfo sender
who sent the announcement
Definition: mw_message.h:287
mwMsgChannelCreate::proto_ver
guint32 proto_ver
protocol version for the service
Definition: mw_message.h:190
mwMsgChannelSend::data
struct mwOpaque data
protocol data to be interpreted by the handling service
Definition: mw_message.h:232
mwMsgChannelAccept::encrypt
struct mwEncryptAccept encrypt
Definition: mw_message.h:218
mwMessage_LOGIN_REDIRECT
@ mwMessage_LOGIN_REDIRECT
mwMsgLoginRedirect
Definition: mw_message.h:45
mwMessage_LOGIN
@ mwMessage_LOGIN
mwMsgLogin
Definition: mw_message.h:43
mwMsgHandshakeAck::data
struct mwOpaque data
server's DH public key for auth
Definition: mw_message.h:120
mwMessage_LOGIN_CONTINUE
@ mwMessage_LOGIN_CONTINUE
mwMsgLoginContinue
Definition: mw_message.h:46
mwUserStatus
Definition: mw_common.h:165
mwMessage_SET_PRIVACY_LIST
@ mwMessage_SET_PRIVACY_LIST
mwMsgSetPrivacyList
Definition: mw_message.h:54
mwMsgChannelSend
Definition: mw_message.h:224
mwMsgChannelAccept
Definition: mw_message.h:210
mwMsgLoginRedirect
Definition: mw_message.h:165
mwMsgHandshakeAck::head
struct mwMessage head
Definition: mw_message.h:115
mwMsgSenseService
Sent to the server to request the presense of a service by its ID.
Definition: mw_message.h:266
mwMsgAnnounce::sender_present
gboolean sender_present
indicates presence of sender data
Definition: mw_message.h:286
mwMsgLoginAck::login
struct mwLoginInfo login
Definition: mw_message.h:150
mwMsgSetPrivacyList::head
struct mwMessage head
Definition: mw_message.h:256
mwMsgChannelAccept::addtl
struct mwOpaque addtl
service-specific additional data
Definition: mw_message.h:215
mwMsgAnnounce::recipients
GList * recipients
list of (char *) indicating recipients.
Definition: mw_message.h:295
mwMsgAnnounce::text
char * text
text of message
Definition: mw_message.h:290
mwMessage_put
void mwMessage_put(struct mwPutBuffer *b, struct mwMessage *msg)
mwMsgChannelSend::type
guint16 type
message type.
Definition: mw_message.h:229
mwMsgAnnounce
An announcement between users.
Definition: mw_message.h:284
mwMsgChannelAccept::service
guint32 service
ID for the channel's service.
Definition: mw_message.h:212
mwMsgHandshake::srvrcalc_addr
guint32 srvrcalc_addr
0.0.0.0
Definition: mw_message.h:103
mwMsgChannelDestroy::data
struct mwOpaque data
additional information
Definition: mw_message.h:241
mwMsgSetUserStatus::head
struct mwMessage head
Definition: mw_message.h:248
mwMsgChannelDestroy::reason
guint32 reason
reason for closing the channel.
Definition: mw_message.h:240
mwMsgSetPrivacyList
Definition: mw_message.h:255
mwMsgChannelDestroy::head
struct mwMessage head
Definition: mw_message.h:239
mwMessage_CHANNEL_ACCEPT
@ mwMessage_CHANNEL_ACCEPT
mwMsgChannelAccept
Definition: mw_message.h:51
mwAuthType
mwAuthType
Definition: mw_message.h:126
mwMsgChannelDestroy
Definition: mw_message.h:238
mwPutBuffer
mwMsgLoginRedirect::head
struct mwMessage head
Definition: mw_message.h:166
mwMessageOption
mwMessageOption
Definition: mw_message.h:61
mwMsgHandshake::login_type
guint16 login_type
Definition: mw_message.h:104
mwMsgLoginAck::privacy
struct mwPrivacyInfo privacy
Definition: mw_message.h:151
mwMsgChannelSend::head
struct mwMessage head
Definition: mw_message.h:225
mwIdBlock
Definition: mw_common.h:174
mwMsgLogin::auth_data
struct mwOpaque auth_data
authentication data
Definition: mw_message.h:142
mwMsgHandshake::unknown_a
guint16 unknown_a
normally 0x0100
Definition: mw_message.h:106
mwMessage_free
void mwMessage_free(struct mwMessage *msg)
mwMsgLogin::auth_type
guint16 auth_type
Definition: mw_message.h:141
mwMsgChannelCreate::service
guint32 service
ID for the target service.
Definition: mw_message.h:188
mwMsgAdmin::head
struct mwMessage head
Definition: mw_message.h:276
mwEncryptOffer::extra
guint16 extra
encryption mode again?
Definition: mw_message.h:178
mwMessage::options
guint16 options
Definition: mw_message.h:74
mwMessage_HANDSHAKE_ACK
@ mwMessage_HANDSHAKE_ACK
mwMsgHandshakeAck
Definition: mw_message.h:42
mwPrivacyInfo
Definition: mw_common.h:146
mwEncryptOffer::mode
guint16 mode
encryption mode
Definition: mw_message.h:176
mwGetBuffer
Definition: mw_common.h:71
mwMessage::attribs
struct mwOpaque attribs
optional message attributes
Definition: mw_message.h:76
mwMsgHandshakeAck::major
guint16 major
server's major version number
Definition: mw_message.h:116
mwEncryptAccept
a selected encryption item from those offered
Definition: mw_message.h:202
mwEncryptAccept::mode
guint16 mode
encryption mode
Definition: mw_message.h:203
mwMsgAnnounce::unknown_a
guint16 unknown_a
unknown A.
Definition: mw_message.h:288
mwMsgChannelCreate::head
struct mwMessage head
Definition: mw_message.h:184
mwMsgHandshakeAck::minor
guint16 minor
server's minor version number
Definition: mw_message.h:117
mwMsgLogin
Definition: mw_message.h:137
mwMsgLoginAck::status
struct mwUserStatus status
Definition: mw_message.h:152
mwEncryptAccept::item
struct mwEncryptItem * item
chosen mwEncryptItem (optional)
Definition: mw_message.h:204
mwMsgChannelAccept::acceptor_flag
gboolean acceptor_flag
indicate presence of acceptor information
Definition: mw_message.h:216
mwMessage_ANNOUNCE
@ mwMessage_ANNOUNCE
mwMsgAnnounce
Definition: mw_message.h:57
mwMsgHandshakeAck::srvrcalc_addr
guint32 srvrcalc_addr
server-calculated address
Definition: mw_message.h:118
mwEncryptAccept::extra
guint16 extra
encryption mode again?
Definition: mw_message.h:205
mwMsgChannelCreate::channel
guint32 channel
intended ID for new channel
Definition: mw_message.h:186
mwMessageOption_ENCRYPT
@ mwMessageOption_ENCRYPT
message data is encrypted
Definition: mw_message.h:62
mwMsgChannelAccept::head
struct mwMessage head
Definition: mw_message.h:211
mwMsgChannelCreate::creator
struct mwLoginInfo creator
Definition: mw_message.h:194
mwMsgChannelCreate::encrypt
struct mwEncryptOffer encrypt
Definition: mw_message.h:195
mwEncryptOffer::items
GList * items
list of mwEncryptItem offered
Definition: mw_message.h:177
mwMessage_CHANNEL_CREATE
@ mwMessage_CHANNEL_CREATE
mwMsgChannelCreate
Definition: mw_message.h:48
mwMsgLoginRedirect::server_id
char * server_id
Definition: mw_message.h:168
mwMessage_LOGIN_ACK
@ mwMessage_LOGIN_ACK
mwMsgLoginAck
Definition: mw_message.h:44
mwMessage_SET_USER_STATUS
@ mwMessage_SET_USER_STATUS
mwMsgSetUserStatus
Definition: mw_message.h:53
mwMsgSetUserStatus::status
struct mwUserStatus status
Definition: mw_message.h:249
mwOpaque
A length of binary data, not null-terminated.
Definition: mw_common.h:79
mwAuthType_RC2_128
@ mwAuthType_RC2_128
Definition: mw_message.h:131
mwMessage_HANDSHAKE
@ mwMessage_HANDSHAKE
mwMsgHandshake
Definition: mw_message.h:41
mwEncryptOffer::flag
gboolean flag
unknown flag
Definition: mw_message.h:179
mwEncryptOffer
an offer of encryption items
Definition: mw_message.h:175
mwMsgHandshake::major
guint16 major
client's major version number
Definition: mw_message.h:101
mwMessage::type
guint16 type
Definition: mw_message.h:73
mwEncryptAccept::flag
gboolean flag
unknown flag
Definition: mw_message.h:206
mwMsgLogin::name
char * name
user identification
Definition: mw_message.h:140
mwMsgChannelAccept::proto_ver
guint32 proto_ver
protocol version for the service
Definition: mw_message.h:214
mwMsgHandshake::minor
guint16 minor
client's minor version number
Definition: mw_message.h:102
mwMsgLoginRedirect::host
char * host
Definition: mw_message.h:167
mwMsgHandshake::unknown_b
guint32 unknown_b
normally 0x00000000
Definition: mw_message.h:107
mwMsgLogin::head
struct mwMessage head
Definition: mw_message.h:138
mwMsgLoginAck::head
struct mwMessage head
Definition: mw_message.h:149
mwMsgSetPrivacyList::privacy
struct mwPrivacyInfo privacy
Definition: mw_message.h:257
mwMsgHandshake
Definition: mw_message.h:99
mwAuthType_ENCRYPT
@ mwAuthType_ENCRYPT
Definition: mw_message.h:129
mwAuthType_RC2_40
@ mwAuthType_RC2_40
Definition: mw_message.h:130
mwMsgAnnounce::may_reply
gboolean may_reply
replies allowed
Definition: mw_message.h:289
mwMsgHandshakeAck
Definition: mw_message.h:114