meanwhile 1.0.2
|
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_ACTIVE = 0x0020, 00157 mwStatus_IDLE = 0x0040, 00158 mwStatus_AWAY = 0x0060, 00159 mwStatus_BUSY = 0x0080, 00160 }; 00161 00162 00163 /* 8.2.3 User Status Block */ 00164 00165 struct mwUserStatus { 00166 guint16 status; 00167 guint32 time; 00168 char *desc; 00169 }; 00170 00171 00172 /* 8.2.4 ID Block */ 00173 00174 struct mwIdBlock { 00175 char *user; 00176 char *community; 00177 }; 00178 00179 00180 /* 8.3.8.2 Awareness Presence Types */ 00181 00182 /* @todo move mwAwareType, mwAwareIdBlock and mwAwareSnapshot into the 00183 aware service and out of common */ 00184 00186 enum mwAwareType { 00187 mwAware_USER = 0x0002, 00188 mwAware_GROUP = 0x0003, 00189 mwAware_SERVER = 0x0008, 00190 }; 00191 00192 00193 /* 8.4.2 Awareness Messages */ 00194 /* 8.4.2.1 Awareness ID Block */ 00195 00196 struct mwAwareIdBlock { 00197 guint16 type; 00198 char *user; 00199 char *community; 00200 }; 00201 00202 00203 /* 8.4.2.4 Snapshot */ 00204 00205 struct mwAwareSnapshot { 00206 struct mwAwareIdBlock id; 00207 char *group; 00208 gboolean online; 00209 char *alt_id; 00210 struct mwUserStatus status; 00211 char *name; 00212 }; 00213 00214 00216 struct mwEncryptItem { 00217 guint16 id; 00218 struct mwOpaque info; 00219 }; 00220 00221 00224 00225 00227 struct mwPutBuffer *mwPutBuffer_new(); 00228 00229 00231 void mwPutBuffer_write(struct mwPutBuffer *b, gpointer data, gsize len); 00232 00233 00235 void mwPutBuffer_free(struct mwPutBuffer *b); 00236 00237 00239 void mwPutBuffer_finalize(struct mwOpaque *to, struct mwPutBuffer *from); 00240 00241 00243 struct mwGetBuffer *mwGetBuffer_new(struct mwOpaque *data); 00244 00245 00251 gsize mwGetBuffer_read(struct mwGetBuffer *b, gpointer mem, gsize len); 00252 00253 00259 gsize mwGetBuffer_advance(struct mwGetBuffer *b, gsize len); 00260 00261 00265 struct mwGetBuffer *mwGetBuffer_wrap(const struct mwOpaque *data); 00266 00267 00269 void mwGetBuffer_free(struct mwGetBuffer *b); 00270 00271 00274 void mwGetBuffer_reset(struct mwGetBuffer *b); 00275 00276 00278 gsize mwGetBuffer_remaining(struct mwGetBuffer *b); 00279 00280 00283 gboolean mwGetBuffer_error(struct mwGetBuffer *b); 00284 00285 00293 00294 00295 void guint16_put(struct mwPutBuffer *b, guint16 val); 00296 00297 void guint16_get(struct mwGetBuffer *b, guint16 *val); 00298 00299 guint16 guint16_peek(struct mwGetBuffer *b); 00300 00301 00302 void guint32_put(struct mwPutBuffer *b, guint32 val); 00303 00304 void guint32_get(struct mwGetBuffer *b, guint32 *val); 00305 00306 guint32 guint32_peek(struct mwGetBuffer *b); 00307 00308 00309 void gboolean_put(struct mwPutBuffer *b, gboolean val); 00310 00311 void gboolean_get(struct mwGetBuffer *b, gboolean *val); 00312 00313 gboolean gboolean_peek(struct mwGetBuffer *b); 00314 00315 00316 void mwString_put(struct mwPutBuffer *b, const char *str); 00317 00318 void mwString_get(struct mwGetBuffer *b, char **str); 00319 00320 00321 void mwOpaque_put(struct mwPutBuffer *b, const struct mwOpaque *o); 00322 00323 void mwOpaque_get(struct mwGetBuffer *b, struct mwOpaque *o); 00324 00325 void mwOpaque_clear(struct mwOpaque *o); 00326 00327 void mwOpaque_free(struct mwOpaque *o); 00328 00329 void mwOpaque_clone(struct mwOpaque *to, const struct mwOpaque *from); 00330 00331 00337 00338 00339 void mwLoginInfo_put(struct mwPutBuffer *b, const struct mwLoginInfo *info); 00340 00341 void mwLoginInfo_get(struct mwGetBuffer *b, struct mwLoginInfo *info); 00342 00343 void mwLoginInfo_clear(struct mwLoginInfo *info); 00344 00345 void mwLoginInfo_clone(struct mwLoginInfo *to, const struct mwLoginInfo *from); 00346 00347 00348 void mwUserItem_put(struct mwPutBuffer *b, const struct mwUserItem *user); 00349 00350 void mwUserItem_get(struct mwGetBuffer *b, struct mwUserItem *user); 00351 00352 void mwUserItem_clear(struct mwUserItem *user); 00353 00354 void mwUserItem_clone(struct mwUserItem *to, const struct mwUserItem *from); 00355 00356 00357 void mwPrivacyInfo_put(struct mwPutBuffer *b, 00358 const struct mwPrivacyInfo *info); 00359 00360 void mwPrivacyInfo_get(struct mwGetBuffer *b, struct mwPrivacyInfo *info); 00361 00362 void mwPrivacyInfo_clear(struct mwPrivacyInfo *info); 00363 00364 void mwPrivacyInfo_clone(struct mwPrivacyInfo *to, 00365 const struct mwPrivacyInfo *from); 00366 00367 00368 void mwUserStatus_put(struct mwPutBuffer *b, 00369 const struct mwUserStatus *stat); 00370 00371 void mwUserStatus_get(struct mwGetBuffer *b, struct mwUserStatus *stat); 00372 00373 void mwUserStatus_clear(struct mwUserStatus *stat); 00374 00375 void mwUserStatus_clone(struct mwUserStatus *to, 00376 const struct mwUserStatus *from); 00377 00378 00379 void mwIdBlock_put(struct mwPutBuffer *b, const struct mwIdBlock *id); 00380 00381 void mwIdBlock_get(struct mwGetBuffer *b, struct mwIdBlock *id); 00382 00383 void mwIdBlock_clear(struct mwIdBlock *id); 00384 00385 void mwIdBlock_clone(struct mwIdBlock *to, 00386 const struct mwIdBlock *from); 00387 00388 guint mwIdBlock_hash(const struct mwIdBlock *idb); 00389 00390 gboolean mwIdBlock_equal(const struct mwIdBlock *a, 00391 const struct mwIdBlock *b); 00392 00393 00394 void mwAwareIdBlock_put(struct mwPutBuffer *b, 00395 const struct mwAwareIdBlock *idb); 00396 00397 void mwAwareIdBlock_get(struct mwGetBuffer *b, struct mwAwareIdBlock *idb); 00398 00399 void mwAwareIdBlock_clear(struct mwAwareIdBlock *idb); 00400 00401 void mwAwareIdBlock_clone(struct mwAwareIdBlock *to, 00402 const struct mwAwareIdBlock *from); 00403 00404 guint mwAwareIdBlock_hash(const struct mwAwareIdBlock *a); 00405 00406 gboolean mwAwareIdBlock_equal(const struct mwAwareIdBlock *a, 00407 const struct mwAwareIdBlock *b); 00408 00409 00410 void mwAwareSnapshot_get(struct mwGetBuffer *b, 00411 struct mwAwareSnapshot *idb); 00412 00413 void mwAwareSnapshot_clear(struct mwAwareSnapshot *idb); 00414 00415 void mwAwareSnapshot_clone(struct mwAwareSnapshot *to, 00416 const struct mwAwareSnapshot *from); 00417 00418 00419 void mwEncryptItem_put(struct mwPutBuffer *b, 00420 const struct mwEncryptItem *item); 00421 00422 void mwEncryptItem_get(struct mwGetBuffer *b, struct mwEncryptItem *item); 00423 00424 void mwEncryptItem_clear(struct mwEncryptItem *item); 00425 00426 void mwEncryptItem_free(struct mwEncryptItem *item); 00427 00428 00432 #ifdef __cplusplus 00433 } 00434 #endif 00435 00436 00437 #endif /* _MW_COMMON_H */