00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _MW_COMMON_H
00022 #define _MW_COMMON_H
00023
00024
00025 #include <glib.h>
00026
00027
00066 struct mwPutBuffer;
00067
00070 struct mwGetBuffer;
00071
00072
00074 struct mwOpaque {
00075 gsize len;
00076 char *data;
00077 };
00078
00079
00080
00081
00095 enum mwLoginType {
00096 mwLogin_LIB = 0x1000,
00097 mwLogin_JAVA_WEB = 0x1001,
00098 mwLogin_BINARY = 0x1002,
00099 mwLogin_JAVA_APP = 0x1003,
00100 mwLogin_LINKS = 0x100a,
00102
00103 mwLogin_NOTES_6_5 = 0x1200,
00104 mwLogin_NOTES_7_0 = 0x1210,
00105 mwLogin_ICT = 0x1300,
00106 mwLogin_ICT_1_7_8_2 = 0x1302,
00107 mwLogin_NOTESBUDDY = 0x1400,
00108 mwLogin_NOTESBUDDY_4_15 = 0x1405,
00109 mwLogin_SANITY = 0x1600,
00110 mwLogin_ST_PERL = 0x1625,
00111 mwLogin_PMR_ALERT = 0x1650,
00112 mwLogin_TRILLIAN = 0x16aa,
00113 mwLogin_TRILLIAN_IBM = 0x16bb,
00114 mwLogin_MEANWHILE = 0x1700,
00115 };
00116
00117
00118
00119
00120
00121 struct mwLoginInfo {
00122 char *login_id;
00123 guint16 type;
00124 char *user_id;
00125 char *user_name;
00126 char *community;
00127 gboolean full;
00128 char *desc;
00129 guint32 ip_addr;
00130 char *server_id;
00131 };
00132
00133
00134
00135
00136 struct mwUserItem {
00137 gboolean full;
00138 char *id;
00139 char *community;
00140 char *name;
00141 };
00142
00143
00144 struct mwPrivacyInfo {
00145 gboolean deny;
00146 guint32 count;
00147 struct mwUserItem *users;
00148 };
00149
00150
00151
00152
00153 enum mwStatusType {
00154 mwStatus_ACTIVE = 0x0020,
00155 mwStatus_IDLE = 0x0040,
00156 mwStatus_AWAY = 0x0060,
00157 mwStatus_BUSY = 0x0080,
00158 };
00159
00160
00161
00162
00163 struct mwUserStatus {
00164 guint16 status;
00165 guint32 time;
00166 char *desc;
00167 };
00168
00169
00170
00171
00172 struct mwIdBlock {
00173 char *user;
00174 char *community;
00175 };
00176
00177
00178
00179
00180
00181
00182
00184 enum mwAwareType {
00185 mwAware_USER = 0x0002,
00186 mwAware_GROUP = 0x0003,
00187 mwAware_SERVER = 0x0008,
00188 };
00189
00190
00191
00192
00193
00194 struct mwAwareIdBlock {
00195 guint16 type;
00196 char *user;
00197 char *community;
00198 };
00199
00200
00201
00202
00203 struct mwAwareSnapshot {
00204 struct mwAwareIdBlock id;
00205 char *group;
00206 gboolean online;
00207 char *alt_id;
00208 struct mwUserStatus status;
00209 char *name;
00210 };
00211
00212
00214 struct mwEncryptItem {
00215 guint16 id;
00216 struct mwOpaque info;
00217 };
00218
00219
00222
00223
00225 struct mwPutBuffer *mwPutBuffer_new();
00226
00227
00229 void mwPutBuffer_write(struct mwPutBuffer *b, gpointer data, gsize len);
00230
00231
00233 void mwPutBuffer_free(struct mwPutBuffer *b);
00234
00235
00237 void mwPutBuffer_finalize(struct mwOpaque *to, struct mwPutBuffer *from);
00238
00239
00241 struct mwGetBuffer *mwGetBuffer_new(struct mwOpaque *data);
00242
00243
00249 gsize mwGetBuffer_read(struct mwGetBuffer *b, gpointer mem, gsize len);
00250
00251
00257 gsize mwGetBuffer_advance(struct mwGetBuffer *b, gsize len);
00258
00259
00263 struct mwGetBuffer *mwGetBuffer_wrap(const struct mwOpaque *data);
00264
00265
00267 void mwGetBuffer_free(struct mwGetBuffer *b);
00268
00269
00272 void mwGetBuffer_reset(struct mwGetBuffer *b);
00273
00274
00276 gsize mwGetBuffer_remaining(struct mwGetBuffer *b);
00277
00278
00281 gboolean mwGetBuffer_error(struct mwGetBuffer *b);
00282
00283
00289 const char *mwLoginType_getName(enum mwLoginType type);
00290
00291
00296
00297
00298 void guint16_put(struct mwPutBuffer *b, guint16 val);
00299
00300 void guint16_get(struct mwGetBuffer *b, guint16 *val);
00301
00302 guint16 guint16_peek(struct mwGetBuffer *b);
00303
00304
00305 void guint32_put(struct mwPutBuffer *b, guint32 val);
00306
00307 void guint32_get(struct mwGetBuffer *b, guint32 *val);
00308
00309 guint32 guint32_peek(struct mwGetBuffer *b);
00310
00311
00312 void gboolean_put(struct mwPutBuffer *b, gboolean val);
00313
00314 void gboolean_get(struct mwGetBuffer *b, gboolean *val);
00315
00316 gboolean gboolean_peek(struct mwGetBuffer *b);
00317
00318
00319 void mwString_put(struct mwPutBuffer *b, const char *str);
00320
00321 void mwString_get(struct mwGetBuffer *b, char **str);
00322
00323
00324 void mwOpaque_put(struct mwPutBuffer *b, const struct mwOpaque *o);
00325
00326 void mwOpaque_get(struct mwGetBuffer *b, struct mwOpaque *o);
00327
00328 void mwOpaque_clear(struct mwOpaque *o);
00329
00330 void mwOpaque_free(struct mwOpaque *o);
00331
00332 void mwOpaque_clone(struct mwOpaque *to, const struct mwOpaque *from);
00333
00334
00340
00341
00342 void mwLoginInfo_put(struct mwPutBuffer *b, const struct mwLoginInfo *info);
00343
00344 void mwLoginInfo_get(struct mwGetBuffer *b, struct mwLoginInfo *info);
00345
00346 void mwLoginInfo_clear(struct mwLoginInfo *info);
00347
00348 void mwLoginInfo_clone(struct mwLoginInfo *to, const struct mwLoginInfo *from);
00349
00350
00351 void mwUserItem_put(struct mwPutBuffer *b, const struct mwUserItem *user);
00352
00353 void mwUserItem_get(struct mwGetBuffer *b, struct mwUserItem *user);
00354
00355 void mwUserItem_clear(struct mwUserItem *user);
00356
00357 void mwUserItem_clone(struct mwUserItem *to, const struct mwUserItem *from);
00358
00359
00360 void mwPrivacyInfo_put(struct mwPutBuffer *b,
00361 const struct mwPrivacyInfo *info);
00362
00363 void mwPrivacyInfo_get(struct mwGetBuffer *b, struct mwPrivacyInfo *info);
00364
00365 void mwPrivacyInfo_clear(struct mwPrivacyInfo *info);
00366
00367 void mwPrivacyInfo_clone(struct mwPrivacyInfo *to,
00368 const struct mwPrivacyInfo *from);
00369
00370
00371 void mwUserStatus_put(struct mwPutBuffer *b,
00372 const struct mwUserStatus *stat);
00373
00374 void mwUserStatus_get(struct mwGetBuffer *b, struct mwUserStatus *stat);
00375
00376 void mwUserStatus_clear(struct mwUserStatus *stat);
00377
00378 void mwUserStatus_clone(struct mwUserStatus *to,
00379 const struct mwUserStatus *from);
00380
00381
00382 void mwIdBlock_put(struct mwPutBuffer *b, const struct mwIdBlock *id);
00383
00384 void mwIdBlock_get(struct mwGetBuffer *b, struct mwIdBlock *id);
00385
00386 void mwIdBlock_clear(struct mwIdBlock *id);
00387
00388 void mwIdBlock_clone(struct mwIdBlock *to,
00389 const struct mwIdBlock *from);
00390
00391 guint mwIdBlock_hash(const struct mwIdBlock *idb);
00392
00393 gboolean mwIdBlock_equal(const struct mwIdBlock *a,
00394 const struct mwIdBlock *b);
00395
00396
00397 void mwAwareIdBlock_put(struct mwPutBuffer *b,
00398 const struct mwAwareIdBlock *idb);
00399
00400 void mwAwareIdBlock_get(struct mwGetBuffer *b, struct mwAwareIdBlock *idb);
00401
00402 void mwAwareIdBlock_clear(struct mwAwareIdBlock *idb);
00403
00404 void mwAwareIdBlock_clone(struct mwAwareIdBlock *to,
00405 const struct mwAwareIdBlock *from);
00406
00407 guint mwAwareIdBlock_hash(const struct mwAwareIdBlock *a);
00408
00409 gboolean mwAwareIdBlock_equal(const struct mwAwareIdBlock *a,
00410 const struct mwAwareIdBlock *b);
00411
00412
00413 void mwAwareSnapshot_get(struct mwGetBuffer *b,
00414 struct mwAwareSnapshot *idb);
00415
00416 void mwAwareSnapshot_clear(struct mwAwareSnapshot *idb);
00417
00418 void mwAwareSnapshot_clone(struct mwAwareSnapshot *to,
00419 const struct mwAwareSnapshot *from);
00420
00421
00422 void mwEncryptItem_put(struct mwPutBuffer *b,
00423 const struct mwEncryptItem *item);
00424
00425 void mwEncryptItem_get(struct mwGetBuffer *b, struct mwEncryptItem *item);
00426
00427 void mwEncryptItem_clear(struct mwEncryptItem *item);
00428
00429 void mwEncryptItem_free(struct mwEncryptItem *item);
00430
00431
00435 #endif