meanwhile: mw_message.h Source File

- Main Page
- Related Pages
- Data Structures
- Files

# mw_message.h

Go to the documentation of this file.

    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_MESSAGE_H
    00022 #define _MW_MESSAGE_H
    00023
    00024
    00025 #include <glib/glist.h>
    00026 #include "mw_common.h"
    00027
    00028
    00029 #ifdef __cplusplus
    00030 extern "C" {
    00031 #endif
    00032
    00033
    00036 #define MW_MESSAGE(msg) (&msg->head)
    00037
    00038
    00040 enum mwMessageType {
    00041   mwMessage_HANDSHAKE         = 0x0000,
    00042   mwMessage_HANDSHAKE_ACK     = 0x8000,
    00043   mwMessage_LOGIN             = 0x0001,
    00044   mwMessage_LOGIN_ACK         = 0x8001,
    00045   mwMessage_LOGIN_REDIRECT    = 0x0018,
    00046   mwMessage_LOGIN_CONTINUE    = 0x0016,
    00048   mwMessage_CHANNEL_CREATE    = 0x0002,
    00049   mwMessage_CHANNEL_DESTROY   = 0x0003,
    00050   mwMessage_CHANNEL_SEND      = 0x0004,
    00051   mwMessage_CHANNEL_ACCEPT    = 0x0006,
    00053   mwMessage_SET_USER_STATUS   = 0x0009,
    00054   mwMessage_SET_PRIVACY_LIST  = 0x000b,
    00055   mwMessage_SENSE_SERVICE     = 0x0011,
    00056   mwMessage_ADMIN             = 0x0019,
    00057   mwMessage_ANNOUNCE          = 0x0022,
    00058 };
    00059
    00060
    00061 enum mwMessageOption {
    00062   mwMessageOption_ENCRYPT      = 0x4000,
    00063   mwMessageOption_HAS_ATTRIBS  = 0x8000,
    00064 };
    00065
    00066
    00068 #define MW_MESSAGE_HAS_OPTION(msg, opt) \
    00069   ((msg)->options & (opt))
    00070
    00071
    00072 struct mwMessage {
    00073   guint16 type;
    00074   guint16 options;
    00075   guint32 channel;
    00076   struct mwOpaque attribs;
    00077 };
    00078
    00079
    00080
    00082 struct mwMessage *mwMessage_new(enum mwMessageType type);
    00083
    00084
    00086 struct mwMessage *mwMessage_get(struct mwGetBuffer *b);
    00087
    00088
    00089 void mwMessage_put(struct mwPutBuffer *b, struct mwMessage *msg);
    00090
    00091
    00092 void mwMessage_free(struct mwMessage *msg);
    00093
    00094
    00095 /* 8.4 Messages */
    00096 /* 8.4.1 Basic Community Messages */
    00097 /* 8.4.1.1 Handshake */
    00098
    00099 struct mwMsgHandshake {
    00100   struct mwMessage head;
    00101   guint16 major;
    00102   guint16 minor;
    00103   guint32 srvrcalc_addr;
    00104   guint16 login_type;
    00105   guint32 loclcalc_addr;
    00106   guint16 unknown_a;
    00107   guint32 unknown_b;
    00108   char *local_host;
    00109 };
    00110
    00111
    00112 /* 8.4.1.2 HandshakeAck */
    00113
    00114 struct mwMsgHandshakeAck {
    00115   struct mwMessage head;
    00116   guint16 major;
    00117   guint16 minor;
    00118   guint32 srvrcalc_addr;
    00119   guint32 magic;
    00120   struct mwOpaque data;
    00121 };
    00122
    00123
    00124 /* 8.3.7 Authentication Types */
    00125
    00126 enum mwAuthType {
    00127   mwAuthType_PLAIN    = 0x0000,
    00128   mwAuthType_TOKEN    = 0x0001,
    00129   mwAuthType_ENCRYPT  = 0x0002,
    00130   mwAuthType_RC2_40   = 0x0002,
    00131   mwAuthType_RC2_128  = 0x0004,
    00132 };
    00133
    00134
    00135 /* 8.4.1.3 Login */
    00136
    00137 struct mwMsgLogin {
    00138   struct mwMessage head;
    00139   guint16 login_type;
    00140   char *name;
    00141   guint16 auth_type;
    00142   struct mwOpaque auth_data;
    00143 };
    00144
    00145
    00146 /* 8.4.1.4 LoginAck */
    00147
    00148 struct mwMsgLoginAck {
    00149   struct mwMessage head;
    00150   struct mwLoginInfo login;
    00151   struct mwPrivacyInfo privacy;
    00152   struct mwUserStatus status;
    00153 };
    00154
    00155
    00156 /* 8.4.1.5 LoginCont */
    00157
    00158 struct mwMsgLoginContinue {
    00159   struct mwMessage head;
    00160 };
    00161
    00162
    00163 /* 8.4.1.6 AuthPassed */
    00164
    00165 struct mwMsgLoginRedirect {
    00166   struct mwMessage head;
    00167   char *host;
    00168   char *server_id;
    00169 };
    00170
    00171
    00172 /* 8.4.1.7 CreateCnl */
    00173
    00175 struct mwEncryptOffer {
    00176   guint16 mode;
    00177   GList *items;
    00178   guint16 extra;
    00179   gboolean flag;
    00180 };
    00181
    00182
    00183 struct mwMsgChannelCreate {
    00184   struct mwMessage head;
    00185   guint32 reserved;
    00186   guint32 channel;
    00187   struct mwIdBlock target;
    00188   guint32 service;
    00189   guint32 proto_type;
    00190   guint32 proto_ver;
    00191   guint32 options;
    00192   struct mwOpaque addtl;
    00193   gboolean creator_flag;
    00194   struct mwLoginInfo creator;
    00195   struct mwEncryptOffer encrypt;
    00196 };
    00197
    00198
    00199 /* 8.4.1.8 AcceptCnl */
    00200
    00202 struct mwEncryptAccept {
    00203   guint16 mode;
    00204   struct mwEncryptItem *item;
    00205   guint16 extra;
    00206   gboolean flag;
    00207 };
    00208
    00209
    00210 struct mwMsgChannelAccept {
    00211   struct mwMessage head;
    00212   guint32 service;
    00213   guint32 proto_type;
    00214   guint32 proto_ver;
    00215   struct mwOpaque addtl;
    00216   gboolean acceptor_flag;
    00217   struct mwLoginInfo acceptor;
    00218   struct mwEncryptAccept encrypt;
    00219 };
    00220
    00221
    00222 /* 8.4.1.9 SendOnCnl */
    00223
    00224 struct mwMsgChannelSend {
    00225   struct mwMessage head;
    00226
    00229   guint16 type;
    00230
    00232   struct mwOpaque data;
    00233 };
    00234
    00235
    00236 /* 8.4.1.10 DestroyCnl */
    00237
    00238 struct mwMsgChannelDestroy {
    00239   struct mwMessage head;
    00240   guint32 reason;
    00241   struct mwOpaque data;
    00242 };
    00243
    00244
    00245 /* 8.4.1.11 SetUserStatus */
    00246
    00247 struct mwMsgSetUserStatus {
    00248   struct mwMessage head;
    00249   struct mwUserStatus status;
    00250 };
    00251
    00252
    00253 /* 8.4.1.12 SetPrivacyList */
    00254
    00255 struct mwMsgSetPrivacyList {
    00256   struct mwMessage head;
    00257   struct mwPrivacyInfo privacy;
    00258 };
    00259
    00260
    00261 /* Sense Service */
    00262
    00266 struct mwMsgSenseService {
    00267   struct mwMessage head;
    00268   guint32 service;
    00269 };
    00270
    00271
    00272 /* Admin */
    00273
    00275 struct mwMsgAdmin {
    00276   struct mwMessage head;
    00277   char *text;
    00278 };
    00279
    00280
    00281 /* Announce */
    00282
    00284 struct mwMsgAnnounce {
    00285   struct mwMessage head;
    00286   gboolean sender_present;
    00287   struct mwLoginInfo sender;
    00288   guint16 unknown_a;
    00289   gboolean may_reply;
    00290   char *text;
    00295   GList *recipients;
    00296 };
    00297
    00298
    00299 #ifdef __cplusplus
    00300 }
    00301 #endif
    00302
    00303
    00304 #endif /* _MW_MESSAGE_H */
    00305