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