meanwhile 1.0.2
mw_common.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_COMMON_H
22#define _MW_COMMON_H
23
24
61#include <glib.h>
62
63
64#ifdef __cplusplus
65extern "C" {
66#endif
67
68
71struct mwPutBuffer;
72
75struct mwGetBuffer;
76
77
79struct mwOpaque {
80 gsize len;
81 guchar *data;
82};
83
84
85/* 8.3.6 Login Types */
86
94 mwLogin_LIB = 0x1000,
96 mwLogin_BINARY = 0x1002,
98 mwLogin_LINKS = 0x100a,
100 /* now we're getting crazy */
105 mwLogin_ICT = 0x1300,
117};
118
119
120/* 8.2 Common Structures */
121/* 8.2.1 Login Info block */
122
124 char *login_id;
125 guint16 type;
126 char *user_id;
127 char *user_name;
128 char *community;
129 gboolean full;
130 char *desc;
131 guint32 ip_addr;
132 char *server_id;
133};
134
135
136/* 8.2.2 Private Info Block */
137
139 gboolean full;
140 char *id;
141 char *community;
142 char *name;
143};
144
145
147 gboolean deny;
148 guint32 count;
150};
151
152
153/* 8.3.5 User Status Types */
154
160};
161
162
163/* 8.2.3 User Status Block */
164
166 guint16 status;
167 guint32 time;
168 char *desc;
169};
170
171
172/* 8.2.4 ID Block */
173
174struct mwIdBlock {
175 char *user;
176 char *community;
177};
178
179
180/* 8.3.8.2 Awareness Presence Types */
181
182/* @todo move mwAwareType, mwAwareIdBlock and mwAwareSnapshot into the
183 aware service and out of common */
184
187 mwAware_USER = 0x0002,
188 mwAware_GROUP = 0x0003,
189 mwAware_SERVER = 0x0008,
190};
191
192
193/* 8.4.2 Awareness Messages */
194/* 8.4.2.1 Awareness ID Block */
195
197 guint16 type;
198 char *user;
199 char *community;
200};
201
202
203/* 8.4.2.4 Snapshot */
204
207 char *group;
208 gboolean online;
209 char *alt_id;
211 char *name;
212};
213
214
217 guint16 id;
218 struct mwOpaque info;
219};
220
221
224
225
228
229
231void mwPutBuffer_write(struct mwPutBuffer *b, gpointer data, gsize len);
232
233
236
237
239void mwPutBuffer_finalize(struct mwOpaque *to, struct mwPutBuffer *from);
240
241
244
245
251gsize mwGetBuffer_read(struct mwGetBuffer *b, gpointer mem, gsize len);
252
253
259gsize mwGetBuffer_advance(struct mwGetBuffer *b, gsize len);
260
261
265struct mwGetBuffer *mwGetBuffer_wrap(const struct mwOpaque *data);
266
267
270
271
275
276
279
280
283gboolean mwGetBuffer_error(struct mwGetBuffer *b);
284
285
293
294
295void guint16_put(struct mwPutBuffer *b, guint16 val);
296
297void guint16_get(struct mwGetBuffer *b, guint16 *val);
298
299guint16 guint16_peek(struct mwGetBuffer *b);
300
301
302void guint32_put(struct mwPutBuffer *b, guint32 val);
303
304void guint32_get(struct mwGetBuffer *b, guint32 *val);
305
306guint32 guint32_peek(struct mwGetBuffer *b);
307
308
309void gboolean_put(struct mwPutBuffer *b, gboolean val);
310
311void gboolean_get(struct mwGetBuffer *b, gboolean *val);
312
313gboolean gboolean_peek(struct mwGetBuffer *b);
314
315
316void mwString_put(struct mwPutBuffer *b, const char *str);
317
318void mwString_get(struct mwGetBuffer *b, char **str);
319
320
321void mwOpaque_put(struct mwPutBuffer *b, const struct mwOpaque *o);
322
323void mwOpaque_get(struct mwGetBuffer *b, struct mwOpaque *o);
324
325void mwOpaque_clear(struct mwOpaque *o);
326
327void mwOpaque_free(struct mwOpaque *o);
328
329void mwOpaque_clone(struct mwOpaque *to, const struct mwOpaque *from);
330
331
337
338
339void mwLoginInfo_put(struct mwPutBuffer *b, const struct mwLoginInfo *info);
340
341void mwLoginInfo_get(struct mwGetBuffer *b, struct mwLoginInfo *info);
342
344
345void mwLoginInfo_clone(struct mwLoginInfo *to, const struct mwLoginInfo *from);
346
347
348void mwUserItem_put(struct mwPutBuffer *b, const struct mwUserItem *user);
349
350void mwUserItem_get(struct mwGetBuffer *b, struct mwUserItem *user);
351
352void mwUserItem_clear(struct mwUserItem *user);
353
354void mwUserItem_clone(struct mwUserItem *to, const struct mwUserItem *from);
355
356
358 const struct mwPrivacyInfo *info);
359
360void mwPrivacyInfo_get(struct mwGetBuffer *b, struct mwPrivacyInfo *info);
361
363
365 const struct mwPrivacyInfo *from);
366
367
369 const struct mwUserStatus *stat);
370
371void mwUserStatus_get(struct mwGetBuffer *b, struct mwUserStatus *stat);
372
374
376 const struct mwUserStatus *from);
377
378
379void mwIdBlock_put(struct mwPutBuffer *b, const struct mwIdBlock *id);
380
381void mwIdBlock_get(struct mwGetBuffer *b, struct mwIdBlock *id);
382
383void mwIdBlock_clear(struct mwIdBlock *id);
384
386 const struct mwIdBlock *from);
387
388guint mwIdBlock_hash(const struct mwIdBlock *idb);
389
390gboolean mwIdBlock_equal(const struct mwIdBlock *a,
391 const struct mwIdBlock *b);
392
393
395 const struct mwAwareIdBlock *idb);
396
397void mwAwareIdBlock_get(struct mwGetBuffer *b, struct mwAwareIdBlock *idb);
398
400
402 const struct mwAwareIdBlock *from);
403
404guint mwAwareIdBlock_hash(const struct mwAwareIdBlock *a);
405
406gboolean mwAwareIdBlock_equal(const struct mwAwareIdBlock *a,
407 const struct mwAwareIdBlock *b);
408
409
411 struct mwAwareSnapshot *idb);
412
414
416 const struct mwAwareSnapshot *from);
417
418
420 const struct mwEncryptItem *item);
421
422void mwEncryptItem_get(struct mwGetBuffer *b, struct mwEncryptItem *item);
423
425
427
428
432#ifdef __cplusplus
433}
434#endif
435
436
437#endif /* _MW_COMMON_H */
void mwIdBlock_get(struct mwGetBuffer *b, struct mwIdBlock *id)
guint16 guint16_peek(struct mwGetBuffer *b)
void mwAwareIdBlock_put(struct mwPutBuffer *b, const struct mwAwareIdBlock *idb)
void mwPrivacyInfo_clone(struct mwPrivacyInfo *to, const struct mwPrivacyInfo *from)
void mwEncryptItem_get(struct mwGetBuffer *b, struct mwEncryptItem *item)
void guint32_get(struct mwGetBuffer *b, guint32 *val)
void mwIdBlock_put(struct mwPutBuffer *b, const struct mwIdBlock *id)
void mwIdBlock_clear(struct mwIdBlock *id)
void mwLoginInfo_clone(struct mwLoginInfo *to, const struct mwLoginInfo *from)
void mwAwareIdBlock_get(struct mwGetBuffer *b, struct mwAwareIdBlock *idb)
guint mwIdBlock_hash(const struct mwIdBlock *idb)
gsize mwGetBuffer_remaining(struct mwGetBuffer *b)
count of remaining available bytes
void mwOpaque_get(struct mwGetBuffer *b, struct mwOpaque *o)
mwAwareType
type codes for mwAwareIdBlock
Definition: mw_common.h:186
@ mwAware_USER
a single user
Definition: mw_common.h:187
@ mwAware_GROUP
a group
Definition: mw_common.h:188
@ mwAware_SERVER
a server
Definition: mw_common.h:189
void mwOpaque_clear(struct mwOpaque *o)
void mwUserStatus_clear(struct mwUserStatus *stat)
struct mwPutBuffer * mwPutBuffer_new()
allocate a new empty buffer
void mwUserItem_get(struct mwGetBuffer *b, struct mwUserItem *user)
struct mwGetBuffer * mwGetBuffer_wrap(const struct mwOpaque *data)
allocate a new buffer backed by the given data.
void gboolean_get(struct mwGetBuffer *b, gboolean *val)
void mwLoginInfo_get(struct mwGetBuffer *b, struct mwLoginInfo *info)
void mwPutBuffer_finalize(struct mwOpaque *to, struct mwPutBuffer *from)
move the buffer's data into an opaque, destroy the buffer
guint32 guint32_peek(struct mwGetBuffer *b)
void mwPutBuffer_write(struct mwPutBuffer *b, gpointer data, gsize len)
write raw data to the put buffer
void mwString_put(struct mwPutBuffer *b, const char *str)
void mwPrivacyInfo_clear(struct mwPrivacyInfo *info)
void mwGetBuffer_reset(struct mwGetBuffer *b)
reset the buffer to the very beginning.
void mwLoginInfo_clear(struct mwLoginInfo *info)
void mwUserStatus_get(struct mwGetBuffer *b, struct mwUserStatus *stat)
void mwUserItem_clone(struct mwUserItem *to, const struct mwUserItem *from)
gboolean mwIdBlock_equal(const struct mwIdBlock *a, const struct mwIdBlock *b)
void mwIdBlock_clone(struct mwIdBlock *to, const struct mwIdBlock *from)
void mwAwareSnapshot_clone(struct mwAwareSnapshot *to, const struct mwAwareSnapshot *from)
void mwGetBuffer_free(struct mwGetBuffer *b)
destroy the buffer
void mwUserItem_put(struct mwPutBuffer *b, const struct mwUserItem *user)
void mwEncryptItem_put(struct mwPutBuffer *b, const struct mwEncryptItem *item)
mwStatusType
Definition: mw_common.h:155
@ mwStatus_BUSY
Definition: mw_common.h:159
@ mwStatus_ACTIVE
Definition: mw_common.h:156
@ mwStatus_AWAY
Definition: mw_common.h:158
@ mwStatus_IDLE
Definition: mw_common.h:157
gboolean gboolean_peek(struct mwGetBuffer *b)
void mwAwareSnapshot_clear(struct mwAwareSnapshot *idb)
void mwUserStatus_clone(struct mwUserStatus *to, const struct mwUserStatus *from)
void mwOpaque_free(struct mwOpaque *o)
void mwUserItem_clear(struct mwUserItem *user)
mwLoginType
The type of login.
Definition: mw_common.h:93
@ mwLogin_PMR_ALERT
Definition: mw_common.h:113
@ mwLogin_LIB
official Lotus binary library
Definition: mw_common.h:94
@ mwLogin_NOTES_7_0
Definition: mw_common.h:104
@ mwLogin_LINKS
official Sametime Links toolkit
Definition: mw_common.h:98
@ mwLogin_SANITY
Definition: mw_common.h:111
@ mwLogin_JAVA_WEB
official Lotus Java applet
Definition: mw_common.h:95
@ mwLogin_NOTESBUDDY_4_14
0xff00 mask?
Definition: mw_common.h:108
@ mwLogin_NOTES_6_5
Definition: mw_common.h:101
@ mwLogin_ICT
Definition: mw_common.h:105
@ mwLogin_NOTES_7_0_beta
Definition: mw_common.h:103
@ mwLogin_NOTESBUDDY_4_15
Definition: mw_common.h:109
@ mwLogin_MEANWHILE
Meanwhile library.
Definition: mw_common.h:116
@ mwLogin_NOTESBUDDY_4_16
Definition: mw_common.h:110
@ mwLogin_TRILLIAN
http://sf.net/st-plugin/
Definition: mw_common.h:114
@ mwLogin_NOTES_6_5_3
Definition: mw_common.h:102
@ mwLogin_ICT_SIP
Definition: mw_common.h:107
@ mwLogin_ICT_1_7_8_2
Definition: mw_common.h:106
@ mwLogin_TRILLIAN_IBM
Definition: mw_common.h:115
@ mwLogin_ST_PERL
Definition: mw_common.h:112
@ mwLogin_BINARY
official Lotus binary application
Definition: mw_common.h:96
@ mwLogin_JAVA_APP
official Lotus Java application
Definition: mw_common.h:97
gboolean mwGetBuffer_error(struct mwGetBuffer *b)
TRUE if an error occurred while reading a basic type from this buffer.
void mwEncryptItem_clear(struct mwEncryptItem *item)
void guint32_put(struct mwPutBuffer *b, guint32 val)
void mwString_get(struct mwGetBuffer *b, char **str)
void mwOpaque_clone(struct mwOpaque *to, const struct mwOpaque *from)
void guint16_get(struct mwGetBuffer *b, guint16 *val)
void mwEncryptItem_free(struct mwEncryptItem *item)
void mwPrivacyInfo_get(struct mwGetBuffer *b, struct mwPrivacyInfo *info)
void mwUserStatus_put(struct mwPutBuffer *b, const struct mwUserStatus *stat)
void mwPrivacyInfo_put(struct mwPutBuffer *b, const struct mwPrivacyInfo *info)
gsize mwGetBuffer_advance(struct mwGetBuffer *b, gsize len)
skip len bytes in the get buffer.
void mwAwareIdBlock_clone(struct mwAwareIdBlock *to, const struct mwAwareIdBlock *from)
void mwLoginInfo_put(struct mwPutBuffer *b, const struct mwLoginInfo *info)
struct mwGetBuffer * mwGetBuffer_new(struct mwOpaque *data)
allocate a new buffer with a copy of the given data
void mwPutBuffer_free(struct mwPutBuffer *b)
destroy the buffer
void guint16_put(struct mwPutBuffer *b, guint16 val)
gsize mwGetBuffer_read(struct mwGetBuffer *b, gpointer mem, gsize len)
read len bytes of raw data from the get buffer into mem.
void mwAwareSnapshot_get(struct mwGetBuffer *b, struct mwAwareSnapshot *idb)
void mwAwareIdBlock_clear(struct mwAwareIdBlock *idb)
void gboolean_put(struct mwPutBuffer *b, gboolean val)
void mwOpaque_put(struct mwPutBuffer *b, const struct mwOpaque *o)
guint mwAwareIdBlock_hash(const struct mwAwareIdBlock *a)
gboolean mwAwareIdBlock_equal(const struct mwAwareIdBlock *a, const struct mwAwareIdBlock *b)
Definition: mw_common.h:196
guint16 type
Definition: mw_common.h:197
char * user
user id
Definition: mw_common.h:198
char * community
community id (NULL for same community)
Definition: mw_common.h:199
Definition: mw_common.h:205
struct mwUserStatus status
status of this user
Definition: mw_common.h:210
char * alt_id
alternate ID, often same as id.user
Definition: mw_common.h:209
char * group
group this id belongs to
Definition: mw_common.h:207
char * name
Formatted version of ID.
Definition: mw_common.h:211
struct mwAwareIdBlock id
Definition: mw_common.h:206
gboolean online
is this user online?
Definition: mw_common.h:208
encryption blocks
Definition: mw_common.h:216
guint16 id
cipher identifier
Definition: mw_common.h:217
struct mwOpaque info
cipher information
Definition: mw_common.h:218
buffer to be read from
Definition: mw_common.h:71
Definition: mw_common.h:174
char * community
community id (NULL for same community)
Definition: mw_common.h:176
char * user
user id (login id or empty for some services)
Definition: mw_common.h:175
Definition: mw_common.h:123
char * desc
implementation defined description
Definition: mw_common.h:130
guint16 type
Definition: mw_common.h:125
char * user_id
community-unique ID of the user
Definition: mw_common.h:126
char * server_id
unique ID of login's server
Definition: mw_common.h:132
guint32 ip_addr
ip addr of the login
Definition: mw_common.h:131
char * user_name
name of user (nick name, full name, etc)
Definition: mw_common.h:127
gboolean full
if FALSE, following fields non-existant
Definition: mw_common.h:129
char * community
community name (usually domain name)
Definition: mw_common.h:128
char * login_id
community-unique ID of the login
Definition: mw_common.h:124
A length of binary data, not null-terminated.
Definition: mw_common.h:79
guchar * data
data, normally with no NULL termination
Definition: mw_common.h:81
gsize len
length of data.
Definition: mw_common.h:80
Definition: mw_common.h:146
struct mwUserItem * users
the users list
Definition: mw_common.h:149
guint32 count
count of users
Definition: mw_common.h:148
gboolean deny
deny (true) or allow (false) users
Definition: mw_common.h:147
buffer to be written to
Definition: mw_common.h:138
char * id
user id
Definition: mw_common.h:140
char * name
user name
Definition: mw_common.h:142
gboolean full
if FALSE, don't include name
Definition: mw_common.h:139
char * community
community
Definition: mw_common.h:141
Definition: mw_common.h:165
guint32 time
last status change time in seconds
Definition: mw_common.h:167
guint16 status
Definition: mw_common.h:166
char * desc
status description
Definition: mw_common.h:168