mw_message.h
Go to the documentation of this file.
/*
Meanwhile - Unofficial Lotus Sametime Community Client Library
Copyright (C) 2004 Christopher (siege) O'Brien
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _MW_MESSAGE_H
#define _MW_MESSAGE_H
#include <glib.h>
#include "mw_common.h"
#ifdef __cplusplus
extern "C" {
#endif
#define MW_MESSAGE(msg) (&msg->head)
enum mwMessageType {
mwMessage_HANDSHAKE = 0x0000,
mwMessage_HANDSHAKE_ACK = 0x8000,
mwMessage_LOGIN = 0x0001,
mwMessage_LOGIN_ACK = 0x8001,
mwMessage_LOGIN_REDIRECT = 0x0018,
mwMessage_LOGIN_CONTINUE = 0x0016,
mwMessage_CHANNEL_CREATE = 0x0002,
mwMessage_CHANNEL_DESTROY = 0x0003,
mwMessage_CHANNEL_SEND = 0x0004,
mwMessage_CHANNEL_ACCEPT = 0x0006,
mwMessage_SET_USER_STATUS = 0x0009,
mwMessage_SET_PRIVACY_LIST = 0x000b,
mwMessage_SENSE_SERVICE = 0x0011,
mwMessage_ADMIN = 0x0019,
mwMessage_ANNOUNCE = 0x0022,
};
enum mwMessageOption {
mwMessageOption_ENCRYPT = 0x4000,
mwMessageOption_HAS_ATTRIBS = 0x8000,
};
#define MW_MESSAGE_HAS_OPTION(msg, opt) \
((msg)->options & (opt))
struct mwMessage {
guint16 type;
guint16 options;
guint32 channel;
struct mwOpaque attribs;
};
struct mwMessage *mwMessage_new(enum mwMessageType type);
struct mwMessage *mwMessage_get(struct mwGetBuffer *b);
void mwMessage_put(struct mwPutBuffer *b, struct mwMessage *msg);
void mwMessage_free(struct mwMessage *msg);
/* 8.4 Messages */
/* 8.4.1 Basic Community Messages */
/* 8.4.1.1 Handshake */
struct mwMsgHandshake {
struct mwMessage head;
guint16 major;
guint16 minor;
guint32 srvrcalc_addr;
guint16 login_type;
guint32 loclcalc_addr;
guint16 unknown_a;
guint32 unknown_b;
char *local_host;
};
/* 8.4.1.2 HandshakeAck */
struct mwMsgHandshakeAck {
struct mwMessage head;
guint16 major;
guint16 minor;
guint32 srvrcalc_addr;
guint32 magic;
struct mwOpaque data;
};
/* 8.3.7 Authentication Types */
enum mwAuthType {
mwAuthType_PLAIN = 0x0000,
mwAuthType_TOKEN = 0x0001,
mwAuthType_ENCRYPT = 0x0002,
mwAuthType_RC2_40 = 0x0002,
mwAuthType_RC2_128 = 0x0004,
};
/* 8.4.1.3 Login */
struct mwMsgLogin {
struct mwMessage head;
guint16 login_type;
char *name;
guint16 auth_type;
struct mwOpaque auth_data;
};
/* 8.4.1.4 LoginAck */
struct mwMsgLoginAck {
struct mwMessage head;
struct mwLoginInfo login;
struct mwPrivacyInfo privacy;
struct mwUserStatus status;
};
/* 8.4.1.5 LoginCont */
struct mwMsgLoginContinue {
struct mwMessage head;
};
/* 8.4.1.6 AuthPassed */
struct mwMsgLoginRedirect {
struct mwMessage head;
char *host;
char *server_id;
};
/* 8.4.1.7 CreateCnl */
struct mwEncryptOffer {
guint16 mode;
GList *items;
guint16 extra;
gboolean flag;
};
struct mwMsgChannelCreate {
struct mwMessage head;
guint32 reserved;
guint32 channel;
struct mwIdBlock target;
guint32 service;
guint32 proto_type;
guint32 proto_ver;
guint32 options;
struct mwOpaque addtl;
gboolean creator_flag;
struct mwLoginInfo creator;
struct mwEncryptOffer encrypt;
};
/* 8.4.1.8 AcceptCnl */
struct mwEncryptAccept {
guint16 mode;
struct mwEncryptItem *item;
guint16 extra;
gboolean flag;
};
struct mwMsgChannelAccept {
struct mwMessage head;
guint32 service;
guint32 proto_type;
guint32 proto_ver;
struct mwOpaque addtl;
gboolean acceptor_flag;
struct mwLoginInfo acceptor;
struct mwEncryptAccept encrypt;
};
/* 8.4.1.9 SendOnCnl */
struct mwMsgChannelSend {
struct mwMessage head;
guint16 type;
struct mwOpaque data;
};
/* 8.4.1.10 DestroyCnl */
struct mwMsgChannelDestroy {
struct mwMessage head;
guint32 reason;
struct mwOpaque data;
};
/* 8.4.1.11 SetUserStatus */
struct mwMsgSetUserStatus {
struct mwMessage head;
struct mwUserStatus status;
};
/* 8.4.1.12 SetPrivacyList */
struct mwMsgSetPrivacyList {
struct mwMessage head;
struct mwPrivacyInfo privacy;
};
/* Sense Service */
struct mwMsgSenseService {
struct mwMessage head;
guint32 service;
};
/* Admin */
struct mwMsgAdmin {
struct mwMessage head;
char *text;
};
/* Announce */
struct mwMsgAnnounce {
struct mwMessage head;
gboolean sender_present;
struct mwLoginInfo sender;
guint16 unknown_a;
gboolean may_reply;
char *text;
GList *recipients;
};
#ifdef __cplusplus
}
#endif
#endif /* _MW_MESSAGE_H */
mw_common.h
Common data types and functions for handling those types.
mwMessage_put
void mwMessage_put(struct mwPutBuffer *b, struct mwMessage *msg)
mwMessage_get
struct mwMessage * mwMessage_get(struct mwGetBuffer *b)
build a message from its representation
mwMessageOption
mwMessageOption
Definition mw_message.h:61
mwMessageOption_HAS_ATTRIBS
@ mwMessageOption_HAS_ATTRIBS
message has attributes
Definition mw_message.h:63
mwMessageOption_ENCRYPT
@ mwMessageOption_ENCRYPT
message data is encrypted
Definition mw_message.h:62
mwMessageType
mwMessageType
Indicates the type of a message.
Definition mw_message.h:40
mwMessage_CHANNEL_ACCEPT
@ mwMessage_CHANNEL_ACCEPT
mwMsgChannelAccept
Definition mw_message.h:51
mwMessage_HANDSHAKE
@ mwMessage_HANDSHAKE
mwMsgHandshake
Definition mw_message.h:41
mwMessage_CHANNEL_CREATE
@ mwMessage_CHANNEL_CREATE
mwMsgChannelCreate
Definition mw_message.h:48
mwMessage_ADMIN
@ mwMessage_ADMIN
mwMsgAdmin
Definition mw_message.h:56
mwMessage_SENSE_SERVICE
@ mwMessage_SENSE_SERVICE
mwMsgSenseService
Definition mw_message.h:55
mwMessage_CHANNEL_DESTROY
@ mwMessage_CHANNEL_DESTROY
mwMsgChannelDestroy
Definition mw_message.h:49
mwMessage_LOGIN_ACK
@ mwMessage_LOGIN_ACK
mwMsgLoginAck
Definition mw_message.h:44
mwMessage_LOGIN_REDIRECT
@ mwMessage_LOGIN_REDIRECT
mwMsgLoginRedirect
Definition mw_message.h:45
mwMessage_SET_USER_STATUS
@ mwMessage_SET_USER_STATUS
mwMsgSetUserStatus
Definition mw_message.h:53
mwMessage_HANDSHAKE_ACK
@ mwMessage_HANDSHAKE_ACK
mwMsgHandshakeAck
Definition mw_message.h:42
mwMessage_ANNOUNCE
@ mwMessage_ANNOUNCE
mwMsgAnnounce
Definition mw_message.h:57
mwMessage_LOGIN
@ mwMessage_LOGIN
mwMsgLogin
Definition mw_message.h:43
mwMessage_LOGIN_CONTINUE
@ mwMessage_LOGIN_CONTINUE
mwMsgLoginContinue
Definition mw_message.h:46
mwMessage_SET_PRIVACY_LIST
@ mwMessage_SET_PRIVACY_LIST
mwMsgSetPrivacyList
Definition mw_message.h:54
mwMessage_CHANNEL_SEND
@ mwMessage_CHANNEL_SEND
mwMsgChannelSend
Definition mw_message.h:50
mwMessage_free
void mwMessage_free(struct mwMessage *msg)
mwAuthType
mwAuthType
Definition mw_message.h:126
mwAuthType_ENCRYPT
@ mwAuthType_ENCRYPT
Definition mw_message.h:129
mwAuthType_RC2_40
@ mwAuthType_RC2_40
Definition mw_message.h:130
mwAuthType_RC2_128
@ mwAuthType_RC2_128
Definition mw_message.h:131
mwAuthType_PLAIN
@ mwAuthType_PLAIN
Definition mw_message.h:127
mwAuthType_TOKEN
@ mwAuthType_TOKEN
Definition mw_message.h:128
mwMessage_new
struct mwMessage * mwMessage_new(enum mwMessageType type)
Allocate and initialize a new message of the specified type.
mwEncryptAccept
a selected encryption item from those offered
Definition mw_message.h:202
mwEncryptAccept::extra
guint16 extra
encryption mode again?
Definition mw_message.h:205
mwEncryptAccept::flag
gboolean flag
unknown flag
Definition mw_message.h:206
mwEncryptAccept::mode
guint16 mode
encryption mode
Definition mw_message.h:203
mwEncryptAccept::item
struct mwEncryptItem * item
chosen mwEncryptItem (optional)
Definition mw_message.h:204
mwEncryptItem
encryption blocks
Definition mw_common.h:220
mwEncryptOffer
an offer of encryption items
Definition mw_message.h:175
mwEncryptOffer::mode
guint16 mode
encryption mode
Definition mw_message.h:176
mwEncryptOffer::extra
guint16 extra
encryption mode again?
Definition mw_message.h:178
mwEncryptOffer::flag
gboolean flag
unknown flag
Definition mw_message.h:179
mwEncryptOffer::items
GList * items
list of mwEncryptItem offered
Definition mw_message.h:177
mwGetBuffer
buffer to be read from
mwIdBlock
Definition mw_common.h:178
mwLoginInfo
Definition mw_common.h:123
mwMessage
Definition mw_message.h:72
mwMessage::attribs
struct mwOpaque attribs
optional message attributes
Definition mw_message.h:76
mwMessage::type
guint16 type
Definition mw_message.h:73
mwMessage::options
guint16 options
Definition mw_message.h:74
mwMessage::channel
guint32 channel
ID of channel message is intended for.
Definition mw_message.h:75
mwMsgAdmin
An administrative broadcast message.
Definition mw_message.h:275
mwMsgAdmin::text
char * text
Definition mw_message.h:277
mwMsgAdmin::head
struct mwMessage head
Definition mw_message.h:276
mwMsgAnnounce
An announcement between users.
Definition mw_message.h:284
mwMsgAnnounce::head
struct mwMessage head
Definition mw_message.h:285
mwMsgAnnounce::sender_present
gboolean sender_present
indicates presence of sender data
Definition mw_message.h:286
mwMsgAnnounce::unknown_a
guint16 unknown_a
unknown A.
Definition mw_message.h:288
mwMsgAnnounce::sender
struct mwLoginInfo sender
who sent the announcement
Definition mw_message.h:287
mwMsgAnnounce::may_reply
gboolean may_reply
replies allowed
Definition mw_message.h:289
mwMsgAnnounce::recipients
GList * recipients
list of (char *) indicating recipients.
Definition mw_message.h:295
mwMsgAnnounce::text
char * text
text of message
Definition mw_message.h:290
mwMsgChannelAccept
Definition mw_message.h:210
mwMsgChannelAccept::proto_ver
guint32 proto_ver
protocol version for the service
Definition mw_message.h:214
mwMsgChannelAccept::encrypt
struct mwEncryptAccept encrypt
Definition mw_message.h:218
mwMsgChannelAccept::acceptor_flag
gboolean acceptor_flag
indicate presence of acceptor information
Definition mw_message.h:216
mwMsgChannelAccept::addtl
struct mwOpaque addtl
service-specific additional data
Definition mw_message.h:215
mwMsgChannelAccept::head
struct mwMessage head
Definition mw_message.h:211
mwMsgChannelAccept::service
guint32 service
ID for the channel's service.
Definition mw_message.h:212
mwMsgChannelAccept::acceptor
struct mwLoginInfo acceptor
Definition mw_message.h:217
mwMsgChannelAccept::proto_type
guint32 proto_type
protocol type for the service
Definition mw_message.h:213
mwMsgChannelCreate
Definition mw_message.h:183
mwMsgChannelCreate::target
struct mwIdBlock target
User ID.
Definition mw_message.h:187
mwMsgChannelCreate::reserved
guint32 reserved
unknown reserved data
Definition mw_message.h:185
mwMsgChannelCreate::service
guint32 service
ID for the target service.
Definition mw_message.h:188
mwMsgChannelCreate::channel
guint32 channel
intended ID for new channel
Definition mw_message.h:186
mwMsgChannelCreate::proto_type
guint32 proto_type
protocol type for the service
Definition mw_message.h:189
mwMsgChannelCreate::options
guint32 options
options
Definition mw_message.h:191
mwMsgChannelCreate::encrypt
struct mwEncryptOffer encrypt
Definition mw_message.h:195
mwMsgChannelCreate::proto_ver
guint32 proto_ver
protocol version for the service
Definition mw_message.h:190
mwMsgChannelCreate::head
struct mwMessage head
Definition mw_message.h:184
mwMsgChannelCreate::creator
struct mwLoginInfo creator
Definition mw_message.h:194
mwMsgChannelCreate::creator_flag
gboolean creator_flag
indicate presence of creator information
Definition mw_message.h:193
mwMsgChannelCreate::addtl
struct mwOpaque addtl
service-specific additional data
Definition mw_message.h:192
mwMsgChannelDestroy
Definition mw_message.h:238
mwMsgChannelDestroy::head
struct mwMessage head
Definition mw_message.h:239
mwMsgChannelDestroy::data
struct mwOpaque data
additional information
Definition mw_message.h:241
mwMsgChannelDestroy::reason
guint32 reason
reason for closing the channel.
Definition mw_message.h:240
mwMsgChannelSend
Definition mw_message.h:224
mwMsgChannelSend::type
guint16 type
message type.
Definition mw_message.h:229
mwMsgChannelSend::head
struct mwMessage head
Definition mw_message.h:225
mwMsgChannelSend::data
struct mwOpaque data
protocol data to be interpreted by the handling service
Definition mw_message.h:232
mwMsgHandshakeAck
Definition mw_message.h:114
mwMsgHandshakeAck::data
struct mwOpaque data
server's DH public key for auth
Definition mw_message.h:120
mwMsgHandshakeAck::major
guint16 major
server's major version number
Definition mw_message.h:116
mwMsgHandshakeAck::srvrcalc_addr
guint32 srvrcalc_addr
server-calculated address
Definition mw_message.h:118
mwMsgHandshakeAck::head
struct mwMessage head
Definition mw_message.h:115
mwMsgHandshakeAck::minor
guint16 minor
server's minor version number
Definition mw_message.h:117
mwMsgHandshakeAck::magic
guint32 magic
four bytes of something
Definition mw_message.h:119
mwMsgHandshake
Definition mw_message.h:99
mwMsgHandshake::minor
guint16 minor
client's minor version number
Definition mw_message.h:102
mwMsgHandshake::loclcalc_addr
guint32 loclcalc_addr
local public IP
Definition mw_message.h:105
mwMsgHandshake::srvrcalc_addr
guint32 srvrcalc_addr
0.0.0.0
Definition mw_message.h:103
mwMsgHandshake::major
guint16 major
client's major version number
Definition mw_message.h:101
mwMsgHandshake::unknown_b
guint32 unknown_b
normally 0x00000000
Definition mw_message.h:107
mwMsgHandshake::login_type
guint16 login_type
Definition mw_message.h:104
mwMsgHandshake::local_host
char * local_host
name of client host
Definition mw_message.h:108
mwMsgHandshake::head
struct mwMessage head
Definition mw_message.h:100
mwMsgHandshake::unknown_a
guint16 unknown_a
normally 0x0100
Definition mw_message.h:106
mwMsgLoginAck
Definition mw_message.h:148
mwMsgLoginAck::status
struct mwUserStatus status
Definition mw_message.h:152
mwMsgLoginAck::login
struct mwLoginInfo login
Definition mw_message.h:150
mwMsgLoginAck::head
struct mwMessage head
Definition mw_message.h:149
mwMsgLoginAck::privacy
struct mwPrivacyInfo privacy
Definition mw_message.h:151
mwMsgLoginContinue
Definition mw_message.h:158
mwMsgLoginContinue::head
struct mwMessage head
Definition mw_message.h:159
mwMsgLoginRedirect
Definition mw_message.h:165
mwMsgLoginRedirect::host
char * host
Definition mw_message.h:167
mwMsgLoginRedirect::head
struct mwMessage head
Definition mw_message.h:166
mwMsgLoginRedirect::server_id
char * server_id
Definition mw_message.h:168
mwMsgLogin
Definition mw_message.h:137
mwMsgLogin::auth_type
guint16 auth_type
Definition mw_message.h:141
mwMsgLogin::head
struct mwMessage head
Definition mw_message.h:138
mwMsgLogin::login_type
guint16 login_type
Definition mw_message.h:139
mwMsgLogin::name
char * name
user identification
Definition mw_message.h:140
mwMsgLogin::auth_data
struct mwOpaque auth_data
authentication data
Definition mw_message.h:142
mwMsgSenseService
Sent to the server to request the presense of a service by its ID.
Definition mw_message.h:266
mwMsgSenseService::service
guint32 service
Definition mw_message.h:268
mwMsgSenseService::head
struct mwMessage head
Definition mw_message.h:267
mwMsgSetPrivacyList
Definition mw_message.h:255
mwMsgSetPrivacyList::privacy
struct mwPrivacyInfo privacy
Definition mw_message.h:257
mwMsgSetPrivacyList::head
struct mwMessage head
Definition mw_message.h:256
mwMsgSetUserStatus
Definition mw_message.h:247
mwMsgSetUserStatus::head
struct mwMessage head
Definition mw_message.h:248
mwMsgSetUserStatus::status
struct mwUserStatus status
Definition mw_message.h:249
mwOpaque
A length of binary data, not null-terminated.
Definition mw_common.h:79
mwPrivacyInfo
Definition mw_common.h:146
mwPutBuffer
buffer to be written to
mwUserStatus
Definition mw_common.h:169