meanwhile 1.1.0
|
00001 00002 /* 00003 Meanwhile - Unofficial Lotus Sametime Community Client Library 00004 Copyright (C) 2004 Christopher (siege) O'Brien 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public 00017 License along with this library; if not, write to the Free 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 */ 00020 00021 #ifndef _MW_COMMON_H 00022 #define _MW_COMMON_H 00023 00024 00061 #include <glib.h> 00062 00063 00064 #ifdef __cplusplus 00065 extern "C" { 00066 #endif 00067 00068 00071 struct mwPutBuffer; 00072 00075 struct mwGetBuffer; 00076 00077 00079 struct mwOpaque { 00080 gsize len; 00081 guchar *data; 00082 }; 00083 00084 00085 /* 8.3.6 Login Types */ 00086 00093 enum mwLoginType { 00094 mwLogin_LIB = 0x1000, 00095 mwLogin_JAVA_WEB = 0x1001, 00096 mwLogin_BINARY = 0x1002, 00097 mwLogin_JAVA_APP = 0x1003, 00098 mwLogin_LINKS = 0x100a, 00100 /* now we're getting crazy */ 00101 mwLogin_NOTES_6_5 = 0x1200, 00102 mwLogin_NOTES_6_5_3 = 0x1203, 00103 mwLogin_NOTES_7_0_beta = 0x1210, 00104 mwLogin_NOTES_7_0 = 0x1214, 00105 mwLogin_ICT = 0x1300, 00106 mwLogin_ICT_1_7_8_2 = 0x1302, 00107 mwLogin_ICT_SIP = 0x1303, 00108 mwLogin_NOTESBUDDY_4_14 = 0x1400, 00109 mwLogin_NOTESBUDDY_4_15 = 0x1405, 00110 mwLogin_NOTESBUDDY_4_16 = 0x1406, 00111 mwLogin_SANITY = 0x1600, 00112 mwLogin_ST_PERL = 0x1625, 00113 mwLogin_PMR_ALERT = 0x1650, 00114 mwLogin_TRILLIAN = 0x16aa, 00115 mwLogin_TRILLIAN_IBM = 0x16bb, 00116 mwLogin_MEANWHILE = 0x1700, 00117 }; 00118 00119 00120 /* 8.2 Common Structures */ 00121 /* 8.2.1 Login Info block */ 00122 00123 struct mwLoginInfo { 00124 char *login_id; 00125 guint16 type; 00126 char *user_id; 00127 char *user_name; 00128 char *community; 00129 gboolean full; 00130 char *desc; 00131 guint32 ip_addr; 00132 char *server_id; 00133 }; 00134 00135 00136 /* 8.2.2 Private Info Block */ 00137 00138 struct mwUserItem { 00139 gboolean full; 00140 char *id; 00141 char *community; 00142 char *name; 00143 }; 00144 00145 00146 struct mwPrivacyInfo { 00147 gboolean deny; 00148 guint32 count; 00149 struct mwUserItem *users; 00150 }; 00151 00152 00153 /* 8.3.5 User Status Types */ 00154 00155 enum mwStatusType { 00156 mwStatus_OFFLINE = 0x0000, 00157 00158 mwStatus_ACTIVE = 0x0020, 00159 mwStatus_IDLE = 0x0040, 00160 mwStatus_AWAY = 0x0060, 00161 mwStatus_BUSY = 0x0080, 00162 00163 mwStatus_MASK_MOBILE = 0x0200, 00164 }; 00165 00166 00167 /* 8.2.3 User Status Block */ 00168 00169 struct mwUserStatus { 00170 guint16 status; 00171 guint32 time; 00172 char *desc; 00173 }; 00174 00175 00176 /* 8.2.4 ID Block */ 00177 00178 struct mwIdBlock { 00179 char *user; 00180 char *community; 00181 }; 00182 00183 00184 /* 8.3.8.2 Awareness Presence Types */ 00185 00186 /* @todo move mwAwareType, mwAwareIdBlock and mwAwareSnapshot into the 00187 aware service and out of common */ 00188 00190 enum mwAwareType { 00191 mwAware_USER = 0x0002, 00192 mwAware_GROUP = 0x0003, 00193 mwAware_SERVER = 0x0008, 00194 }; 00195 00196 00197 /* 8.4.2 Awareness Messages */ 00198 /* 8.4.2.1 Awareness ID Block */ 00199 00200 struct mwAwareIdBlock { 00201 guint16 type; 00202 char *user; 00203 char *community; 00204 }; 00205 00206 00207 /* 8.4.2.4 Snapshot */ 00208 00209 struct mwAwareSnapshot { 00210 struct mwAwareIdBlock id; 00211 char *group; 00212 gboolean online; 00213 char *alt_id; 00214 struct mwUserStatus status; 00215 char *name; 00216 }; 00217 00218 00220 struct mwEncryptItem { 00221 guint16 id; 00222 struct mwOpaque info; 00223 }; 00224 00225 00228 00229 00231 struct mwPutBuffer *mwPutBuffer_new(void); 00232 00233 00235 void mwPutBuffer_write(struct mwPutBuffer *b, gpointer data, gsize len); 00236 00237 00239 void mwPutBuffer_free(struct mwPutBuffer *b); 00240 00241 00243 void mwPutBuffer_finalize(struct mwOpaque *to, struct mwPutBuffer *from); 00244 00245 00247 struct mwGetBuffer *mwGetBuffer_new(struct mwOpaque *data); 00248 00249 00255 gsize mwGetBuffer_read(struct mwGetBuffer *b, gpointer mem, gsize len); 00256 00257 00263 gsize mwGetBuffer_advance(struct mwGetBuffer *b, gsize len); 00264 00265 00269 struct mwGetBuffer *mwGetBuffer_wrap(const struct mwOpaque *data); 00270 00271 00273 void mwGetBuffer_free(struct mwGetBuffer *b); 00274 00275 00278 void mwGetBuffer_reset(struct mwGetBuffer *b); 00279 00280 00282 gsize mwGetBuffer_remaining(struct mwGetBuffer *b); 00283 00284 00287 gboolean mwGetBuffer_error(struct mwGetBuffer *b); 00288 00289 00297 00298 00299 void guint16_put(struct mwPutBuffer *b, guint16 val); 00300 00301 void guint16_get(struct mwGetBuffer *b, guint16 *val); 00302 00303 guint16 guint16_peek(struct mwGetBuffer *b); 00304 00305 00306 void guint32_put(struct mwPutBuffer *b, guint32 val); 00307 00308 void guint32_get(struct mwGetBuffer *b, guint32 *val); 00309 00310 guint32 guint32_peek(struct mwGetBuffer *b); 00311 00312 00313 void gboolean_put(struct mwPutBuffer *b, gboolean val); 00314 00315 void gboolean_get(struct mwGetBuffer *b, gboolean *val); 00316 00317 gboolean gboolean_peek(struct mwGetBuffer *b); 00318 00319 00320 void mwString_put(struct mwPutBuffer *b, const char *str); 00321 00322 void mwString_get(struct mwGetBuffer *b, char **str); 00323 00324 00325 void mwOpaque_put(struct mwPutBuffer *b, const struct mwOpaque *o); 00326 00327 void mwOpaque_get(struct mwGetBuffer *b, struct mwOpaque *o); 00328 00329 void mwOpaque_clear(struct mwOpaque *o); 00330 00331 void mwOpaque_free(struct mwOpaque *o); 00332 00333 void mwOpaque_clone(struct mwOpaque *to, const struct mwOpaque *from); 00334 00335 00341 00342 00343 void mwLoginInfo_put(struct mwPutBuffer *b, const struct mwLoginInfo *info); 00344 00345 void mwLoginInfo_get(struct mwGetBuffer *b, struct mwLoginInfo *info); 00346 00347 void mwLoginInfo_clear(struct mwLoginInfo *info); 00348 00349 void mwLoginInfo_clone(struct mwLoginInfo *to, const struct mwLoginInfo *from); 00350 00351 00352 void mwUserItem_put(struct mwPutBuffer *b, const struct mwUserItem *user); 00353 00354 void mwUserItem_get(struct mwGetBuffer *b, struct mwUserItem *user); 00355 00356 void mwUserItem_clear(struct mwUserItem *user); 00357 00358 void mwUserItem_clone(struct mwUserItem *to, const struct mwUserItem *from); 00359 00360 00361 void mwPrivacyInfo_put(struct mwPutBuffer *b, 00362 const struct mwPrivacyInfo *info); 00363 00364 void mwPrivacyInfo_get(struct mwGetBuffer *b, struct mwPrivacyInfo *info); 00365 00366 void mwPrivacyInfo_clear(struct mwPrivacyInfo *info); 00367 00368 void mwPrivacyInfo_clone(struct mwPrivacyInfo *to, 00369 const struct mwPrivacyInfo *from); 00370 00371 00372 void mwUserStatus_put(struct mwPutBuffer *b, 00373 const struct mwUserStatus *stat); 00374 00375 void mwUserStatus_get(struct mwGetBuffer *b, struct mwUserStatus *stat); 00376 00377 void mwUserStatus_clear(struct mwUserStatus *stat); 00378 00379 void mwUserStatus_clone(struct mwUserStatus *to, 00380 const struct mwUserStatus *from); 00381 00382 00383 void mwIdBlock_put(struct mwPutBuffer *b, const struct mwIdBlock *id); 00384 00385 void mwIdBlock_get(struct mwGetBuffer *b, struct mwIdBlock *id); 00386 00387 void mwIdBlock_clear(struct mwIdBlock *id); 00388 00389 void mwIdBlock_clone(struct mwIdBlock *to, 00390 const struct mwIdBlock *from); 00391 00392 guint mwIdBlock_hash(const struct mwIdBlock *idb); 00393 00394 gboolean mwIdBlock_equal(const struct mwIdBlock *a, 00395 const struct mwIdBlock *b); 00396 00397 00398 void mwAwareIdBlock_put(struct mwPutBuffer *b, 00399 const struct mwAwareIdBlock *idb); 00400 00401 void mwAwareIdBlock_get(struct mwGetBuffer *b, struct mwAwareIdBlock *idb); 00402 00403 void mwAwareIdBlock_clear(struct mwAwareIdBlock *idb); 00404 00405 void mwAwareIdBlock_clone(struct mwAwareIdBlock *to, 00406 const struct mwAwareIdBlock *from); 00407 00408 guint mwAwareIdBlock_hash(const struct mwAwareIdBlock *a); 00409 00410 gboolean mwAwareIdBlock_equal(const struct mwAwareIdBlock *a, 00411 const struct mwAwareIdBlock *b); 00412 00413 00414 void mwAwareSnapshot_get(struct mwGetBuffer *b, 00415 struct mwAwareSnapshot *idb); 00416 00417 void mwAwareSnapshot_clear(struct mwAwareSnapshot *idb); 00418 00419 void mwAwareSnapshot_clone(struct mwAwareSnapshot *to, 00420 const struct mwAwareSnapshot *from); 00421 00422 00423 void mwEncryptItem_put(struct mwPutBuffer *b, 00424 const struct mwEncryptItem *item); 00425 00426 void mwEncryptItem_get(struct mwGetBuffer *b, struct mwEncryptItem *item); 00427 00428 void mwEncryptItem_clear(struct mwEncryptItem *item); 00429 00430 void mwEncryptItem_free(struct mwEncryptItem *item); 00431 00432 00436 #ifdef __cplusplus 00437 } 00438 #endif 00439 00440 00441 #endif /* _MW_COMMON_H */