mw_common.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_COMMON_H
#define _MW_COMMON_H
#include <glib.h>
#ifdef __cplusplus
extern "C" {
#endif
struct mwPutBuffer;
struct mwGetBuffer;
struct mwOpaque {
gsize len;
guchar *data;
};
/* 8.3.6 Login Types */
enum mwLoginType {
mwLogin_LIB = 0x1000,
mwLogin_JAVA_WEB = 0x1001,
mwLogin_BINARY = 0x1002,
mwLogin_JAVA_APP = 0x1003,
mwLogin_LINKS = 0x100a,
/* now we're getting crazy */
mwLogin_NOTES_6_5 = 0x1200,
mwLogin_NOTES_6_5_3 = 0x1203,
mwLogin_NOTES_7_0_beta = 0x1210,
mwLogin_NOTES_7_0 = 0x1214,
mwLogin_ICT = 0x1300,
mwLogin_ICT_1_7_8_2 = 0x1302,
mwLogin_ICT_SIP = 0x1303,
mwLogin_NOTESBUDDY_4_14 = 0x1400,
mwLogin_NOTESBUDDY_4_15 = 0x1405,
mwLogin_NOTESBUDDY_4_16 = 0x1406,
mwLogin_SANITY = 0x1600,
mwLogin_ST_PERL = 0x1625,
mwLogin_PMR_ALERT = 0x1650,
mwLogin_TRILLIAN = 0x16aa,
mwLogin_TRILLIAN_IBM = 0x16bb,
mwLogin_MEANWHILE = 0x1700,
};
/* 8.2 Common Structures */
/* 8.2.1 Login Info block */
struct mwLoginInfo {
char *login_id;
guint16 type;
char *user_id;
char *user_name;
char *community;
gboolean full;
char *desc;
guint32 ip_addr;
char *server_id;
};
/* 8.2.2 Private Info Block */
struct mwUserItem {
gboolean full;
char *id;
char *community;
char *name;
};
struct mwPrivacyInfo {
gboolean deny;
guint32 count;
struct mwUserItem *users;
};
/* 8.3.5 User Status Types */
enum mwStatusType {
mwStatus_OFFLINE = 0x0000,
mwStatus_ACTIVE = 0x0020,
mwStatus_IDLE = 0x0040,
mwStatus_AWAY = 0x0060,
mwStatus_BUSY = 0x0080,
mwStatus_MASK_MOBILE = 0x0200,
};
/* 8.2.3 User Status Block */
struct mwUserStatus {
guint16 status;
guint32 time;
char *desc;
};
/* 8.2.4 ID Block */
struct mwIdBlock {
char *user;
char *community;
};
/* 8.3.8.2 Awareness Presence Types */
/* @todo move mwAwareType, mwAwareIdBlock and mwAwareSnapshot into the
aware service and out of common */
enum mwAwareType {
mwAware_USER = 0x0002,
mwAware_GROUP = 0x0003,
mwAware_SERVER = 0x0008,
};
/* 8.4.2 Awareness Messages */
/* 8.4.2.1 Awareness ID Block */
struct mwAwareIdBlock {
guint16 type;
char *user;
char *community;
};
/* 8.4.2.4 Snapshot */
struct mwAwareSnapshot {
struct mwAwareIdBlock id;
char *group;
gboolean online;
char *alt_id;
struct mwUserStatus status;
char *name;
};
struct mwEncryptItem {
guint16 id;
struct mwOpaque info;
};
struct mwPutBuffer *mwPutBuffer_new(void);
void mwPutBuffer_write(struct mwPutBuffer *b, gpointer data, gsize len);
void mwPutBuffer_free(struct mwPutBuffer *b);
void mwPutBuffer_finalize(struct mwOpaque *to, struct mwPutBuffer *from);
struct mwGetBuffer *mwGetBuffer_new(struct mwOpaque *data);
gsize mwGetBuffer_read(struct mwGetBuffer *b, gpointer mem, gsize len);
gsize mwGetBuffer_advance(struct mwGetBuffer *b, gsize len);
struct mwGetBuffer *mwGetBuffer_wrap(const struct mwOpaque *data);
void mwGetBuffer_free(struct mwGetBuffer *b);
void mwGetBuffer_reset(struct mwGetBuffer *b);
gsize mwGetBuffer_remaining(struct mwGetBuffer *b);
gboolean mwGetBuffer_error(struct mwGetBuffer *b);
void guint16_put(struct mwPutBuffer *b, guint16 val);
void guint16_get(struct mwGetBuffer *b, guint16 *val);
guint16 guint16_peek(struct mwGetBuffer *b);
void guint32_put(struct mwPutBuffer *b, guint32 val);
void guint32_get(struct mwGetBuffer *b, guint32 *val);
guint32 guint32_peek(struct mwGetBuffer *b);
void gboolean_put(struct mwPutBuffer *b, gboolean val);
void gboolean_get(struct mwGetBuffer *b, gboolean *val);
gboolean gboolean_peek(struct mwGetBuffer *b);
void mwString_put(struct mwPutBuffer *b, const char *str);
void mwString_get(struct mwGetBuffer *b, char **str);
void mwOpaque_put(struct mwPutBuffer *b, const struct mwOpaque *o);
void mwOpaque_get(struct mwGetBuffer *b, struct mwOpaque *o);
void mwOpaque_clear(struct mwOpaque *o);
void mwOpaque_free(struct mwOpaque *o);
void mwOpaque_clone(struct mwOpaque *to, const struct mwOpaque *from);
void mwLoginInfo_put(struct mwPutBuffer *b, const struct mwLoginInfo *info);
void mwLoginInfo_get(struct mwGetBuffer *b, struct mwLoginInfo *info);
void mwLoginInfo_clear(struct mwLoginInfo *info);
void mwLoginInfo_clone(struct mwLoginInfo *to, const struct mwLoginInfo *from);
void mwUserItem_put(struct mwPutBuffer *b, const struct mwUserItem *user);
void mwUserItem_get(struct mwGetBuffer *b, struct mwUserItem *user);
void mwUserItem_clear(struct mwUserItem *user);
void mwUserItem_clone(struct mwUserItem *to, const struct mwUserItem *from);
void mwPrivacyInfo_put(struct mwPutBuffer *b,
const struct mwPrivacyInfo *info);
void mwPrivacyInfo_get(struct mwGetBuffer *b, struct mwPrivacyInfo *info);
void mwPrivacyInfo_clear(struct mwPrivacyInfo *info);
void mwPrivacyInfo_clone(struct mwPrivacyInfo *to,
const struct mwPrivacyInfo *from);
void mwUserStatus_put(struct mwPutBuffer *b,
const struct mwUserStatus *stat);
void mwUserStatus_get(struct mwGetBuffer *b, struct mwUserStatus *stat);
void mwUserStatus_clear(struct mwUserStatus *stat);
void mwUserStatus_clone(struct mwUserStatus *to,
const struct mwUserStatus *from);
void mwIdBlock_put(struct mwPutBuffer *b, const struct mwIdBlock *id);
void mwIdBlock_get(struct mwGetBuffer *b, struct mwIdBlock *id);
void mwIdBlock_clear(struct mwIdBlock *id);
void mwIdBlock_clone(struct mwIdBlock *to,
const struct mwIdBlock *from);
guint mwIdBlock_hash(const struct mwIdBlock *idb);
gboolean mwIdBlock_equal(const struct mwIdBlock *a,
const struct mwIdBlock *b);
void mwAwareIdBlock_put(struct mwPutBuffer *b,
const struct mwAwareIdBlock *idb);
void mwAwareIdBlock_get(struct mwGetBuffer *b, struct mwAwareIdBlock *idb);
void mwAwareIdBlock_clear(struct mwAwareIdBlock *idb);
void mwAwareIdBlock_clone(struct mwAwareIdBlock *to,
const struct mwAwareIdBlock *from);
guint mwAwareIdBlock_hash(const struct mwAwareIdBlock *a);
gboolean mwAwareIdBlock_equal(const struct mwAwareIdBlock *a,
const struct mwAwareIdBlock *b);
void mwAwareSnapshot_get(struct mwGetBuffer *b,
struct mwAwareSnapshot *idb);
void mwAwareSnapshot_clear(struct mwAwareSnapshot *idb);
void mwAwareSnapshot_clone(struct mwAwareSnapshot *to,
const struct mwAwareSnapshot *from);
void mwEncryptItem_put(struct mwPutBuffer *b,
const struct mwEncryptItem *item);
void mwEncryptItem_get(struct mwGetBuffer *b, struct mwEncryptItem *item);
void mwEncryptItem_clear(struct mwEncryptItem *item);
void mwEncryptItem_free(struct mwEncryptItem *item);
#ifdef __cplusplus
}
#endif
#endif /* _MW_COMMON_H */
mwIdBlock_get
void mwIdBlock_get(struct mwGetBuffer *b, struct mwIdBlock *id)
guint16_peek
guint16 guint16_peek(struct mwGetBuffer *b)
mwAwareIdBlock_put
void mwAwareIdBlock_put(struct mwPutBuffer *b, const struct mwAwareIdBlock *idb)
mwPrivacyInfo_clone
void mwPrivacyInfo_clone(struct mwPrivacyInfo *to, const struct mwPrivacyInfo *from)
mwEncryptItem_get
void mwEncryptItem_get(struct mwGetBuffer *b, struct mwEncryptItem *item)
guint32_get
void guint32_get(struct mwGetBuffer *b, guint32 *val)
mwPutBuffer_new
struct mwPutBuffer * mwPutBuffer_new(void)
allocate a new empty buffer
mwIdBlock_put
void mwIdBlock_put(struct mwPutBuffer *b, const struct mwIdBlock *id)
mwIdBlock_clear
void mwIdBlock_clear(struct mwIdBlock *id)
mwLoginInfo_clone
void mwLoginInfo_clone(struct mwLoginInfo *to, const struct mwLoginInfo *from)
mwAwareIdBlock_get
void mwAwareIdBlock_get(struct mwGetBuffer *b, struct mwAwareIdBlock *idb)
mwIdBlock_hash
guint mwIdBlock_hash(const struct mwIdBlock *idb)
mwGetBuffer_remaining
gsize mwGetBuffer_remaining(struct mwGetBuffer *b)
count of remaining available bytes
mwOpaque_get
void mwOpaque_get(struct mwGetBuffer *b, struct mwOpaque *o)
mwAwareType
mwAwareType
type codes for mwAwareIdBlock
Definition mw_common.h:190
mwAware_USER
@ mwAware_USER
a single user
Definition mw_common.h:191
mwAware_GROUP
@ mwAware_GROUP
a group
Definition mw_common.h:192
mwAware_SERVER
@ mwAware_SERVER
a server
Definition mw_common.h:193
mwOpaque_clear
void mwOpaque_clear(struct mwOpaque *o)
mwUserStatus_clear
void mwUserStatus_clear(struct mwUserStatus *stat)
mwUserItem_get
void mwUserItem_get(struct mwGetBuffer *b, struct mwUserItem *user)
mwGetBuffer_wrap
struct mwGetBuffer * mwGetBuffer_wrap(const struct mwOpaque *data)
allocate a new buffer backed by the given data.
gboolean_get
void gboolean_get(struct mwGetBuffer *b, gboolean *val)
mwLoginInfo_get
void mwLoginInfo_get(struct mwGetBuffer *b, struct mwLoginInfo *info)
mwPutBuffer_finalize
void mwPutBuffer_finalize(struct mwOpaque *to, struct mwPutBuffer *from)
move the buffer's data into an opaque, destroy the buffer
guint32_peek
guint32 guint32_peek(struct mwGetBuffer *b)
mwPutBuffer_write
void mwPutBuffer_write(struct mwPutBuffer *b, gpointer data, gsize len)
write raw data to the put buffer
mwString_put
void mwString_put(struct mwPutBuffer *b, const char *str)
mwPrivacyInfo_clear
void mwPrivacyInfo_clear(struct mwPrivacyInfo *info)
mwGetBuffer_reset
void mwGetBuffer_reset(struct mwGetBuffer *b)
reset the buffer to the very beginning.
mwLoginInfo_clear
void mwLoginInfo_clear(struct mwLoginInfo *info)
mwUserStatus_get
void mwUserStatus_get(struct mwGetBuffer *b, struct mwUserStatus *stat)
mwUserItem_clone
void mwUserItem_clone(struct mwUserItem *to, const struct mwUserItem *from)
mwIdBlock_equal
gboolean mwIdBlock_equal(const struct mwIdBlock *a, const struct mwIdBlock *b)
mwIdBlock_clone
void mwIdBlock_clone(struct mwIdBlock *to, const struct mwIdBlock *from)
mwAwareSnapshot_clone
void mwAwareSnapshot_clone(struct mwAwareSnapshot *to, const struct mwAwareSnapshot *from)
mwGetBuffer_free
void mwGetBuffer_free(struct mwGetBuffer *b)
destroy the buffer
mwUserItem_put
void mwUserItem_put(struct mwPutBuffer *b, const struct mwUserItem *user)
mwEncryptItem_put
void mwEncryptItem_put(struct mwPutBuffer *b, const struct mwEncryptItem *item)
mwStatusType
mwStatusType
Definition mw_common.h:155
mwStatus_BUSY
@ mwStatus_BUSY
Definition mw_common.h:161
mwStatus_ACTIVE
@ mwStatus_ACTIVE
Definition mw_common.h:158
mwStatus_MASK_MOBILE
@ mwStatus_MASK_MOBILE
Definition mw_common.h:163
mwStatus_OFFLINE
@ mwStatus_OFFLINE
Definition mw_common.h:156
mwStatus_AWAY
@ mwStatus_AWAY
Definition mw_common.h:160
mwStatus_IDLE
@ mwStatus_IDLE
Definition mw_common.h:159
gboolean_peek
gboolean gboolean_peek(struct mwGetBuffer *b)
mwAwareSnapshot_clear
void mwAwareSnapshot_clear(struct mwAwareSnapshot *idb)
mwUserStatus_clone
void mwUserStatus_clone(struct mwUserStatus *to, const struct mwUserStatus *from)
mwOpaque_free
void mwOpaque_free(struct mwOpaque *o)
mwUserItem_clear
void mwUserItem_clear(struct mwUserItem *user)
mwLoginType
mwLoginType
The type of login.
Definition mw_common.h:93
mwLogin_PMR_ALERT
@ mwLogin_PMR_ALERT
Definition mw_common.h:113
mwLogin_LIB
@ mwLogin_LIB
official Lotus binary library
Definition mw_common.h:94
mwLogin_NOTES_7_0
@ mwLogin_NOTES_7_0
Definition mw_common.h:104
mwLogin_LINKS
@ mwLogin_LINKS
official Sametime Links toolkit
Definition mw_common.h:98
mwLogin_SANITY
@ mwLogin_SANITY
Definition mw_common.h:111
mwLogin_JAVA_WEB
@ mwLogin_JAVA_WEB
official Lotus Java applet
Definition mw_common.h:95
mwLogin_NOTESBUDDY_4_14
@ mwLogin_NOTESBUDDY_4_14
0xff00 mask?
Definition mw_common.h:108
mwLogin_NOTES_6_5
@ mwLogin_NOTES_6_5
Definition mw_common.h:101
mwLogin_ICT
@ mwLogin_ICT
Definition mw_common.h:105
mwLogin_NOTES_7_0_beta
@ mwLogin_NOTES_7_0_beta
Definition mw_common.h:103
mwLogin_NOTESBUDDY_4_15
@ mwLogin_NOTESBUDDY_4_15
Definition mw_common.h:109
mwLogin_MEANWHILE
@ mwLogin_MEANWHILE
Meanwhile library.
Definition mw_common.h:116
mwLogin_NOTESBUDDY_4_16
@ mwLogin_NOTESBUDDY_4_16
Definition mw_common.h:110
mwLogin_TRILLIAN
@ mwLogin_TRILLIAN
http://sf.net/st-plugin/
Definition mw_common.h:114
mwLogin_NOTES_6_5_3
@ mwLogin_NOTES_6_5_3
Definition mw_common.h:102
mwLogin_ICT_SIP
@ mwLogin_ICT_SIP
Definition mw_common.h:107
mwLogin_ICT_1_7_8_2
@ mwLogin_ICT_1_7_8_2
Definition mw_common.h:106
mwLogin_TRILLIAN_IBM
@ mwLogin_TRILLIAN_IBM
Definition mw_common.h:115
mwLogin_ST_PERL
@ mwLogin_ST_PERL
Definition mw_common.h:112
mwLogin_BINARY
@ mwLogin_BINARY
official Lotus binary application
Definition mw_common.h:96
mwLogin_JAVA_APP
@ mwLogin_JAVA_APP
official Lotus Java application
Definition mw_common.h:97
mwGetBuffer_error
gboolean mwGetBuffer_error(struct mwGetBuffer *b)
TRUE if an error occurred while reading a basic type from this buffer.
mwEncryptItem_clear
void mwEncryptItem_clear(struct mwEncryptItem *item)
guint32_put
void guint32_put(struct mwPutBuffer *b, guint32 val)
mwString_get
void mwString_get(struct mwGetBuffer *b, char **str)
mwOpaque_clone
void mwOpaque_clone(struct mwOpaque *to, const struct mwOpaque *from)
guint16_get
void guint16_get(struct mwGetBuffer *b, guint16 *val)
mwEncryptItem_free
void mwEncryptItem_free(struct mwEncryptItem *item)
mwPrivacyInfo_get
void mwPrivacyInfo_get(struct mwGetBuffer *b, struct mwPrivacyInfo *info)
mwUserStatus_put
void mwUserStatus_put(struct mwPutBuffer *b, const struct mwUserStatus *stat)
mwPrivacyInfo_put
void mwPrivacyInfo_put(struct mwPutBuffer *b, const struct mwPrivacyInfo *info)
mwGetBuffer_advance
gsize mwGetBuffer_advance(struct mwGetBuffer *b, gsize len)
skip len bytes in the get buffer.
mwAwareIdBlock_clone
void mwAwareIdBlock_clone(struct mwAwareIdBlock *to, const struct mwAwareIdBlock *from)
mwLoginInfo_put
void mwLoginInfo_put(struct mwPutBuffer *b, const struct mwLoginInfo *info)
mwGetBuffer_new
struct mwGetBuffer * mwGetBuffer_new(struct mwOpaque *data)
allocate a new buffer with a copy of the given data
mwPutBuffer_free
void mwPutBuffer_free(struct mwPutBuffer *b)
destroy the buffer
guint16_put
void guint16_put(struct mwPutBuffer *b, guint16 val)
mwGetBuffer_read
gsize mwGetBuffer_read(struct mwGetBuffer *b, gpointer mem, gsize len)
read len bytes of raw data from the get buffer into mem.
mwAwareSnapshot_get
void mwAwareSnapshot_get(struct mwGetBuffer *b, struct mwAwareSnapshot *idb)
mwAwareIdBlock_clear
void mwAwareIdBlock_clear(struct mwAwareIdBlock *idb)
gboolean_put
void gboolean_put(struct mwPutBuffer *b, gboolean val)
mwOpaque_put
void mwOpaque_put(struct mwPutBuffer *b, const struct mwOpaque *o)
mwAwareIdBlock_hash
guint mwAwareIdBlock_hash(const struct mwAwareIdBlock *a)
mwAwareIdBlock_equal
gboolean mwAwareIdBlock_equal(const struct mwAwareIdBlock *a, const struct mwAwareIdBlock *b)
mwAwareIdBlock
Definition mw_common.h:200
mwAwareIdBlock::type
guint16 type
Definition mw_common.h:201
mwAwareIdBlock::user
char * user
user id
Definition mw_common.h:202
mwAwareIdBlock::community
char * community
community id (NULL for same community)
Definition mw_common.h:203
mwAwareSnapshot
Definition mw_common.h:209
mwAwareSnapshot::status
struct mwUserStatus status
status of this user
Definition mw_common.h:214
mwAwareSnapshot::alt_id
char * alt_id
alternate ID, often same as id.user
Definition mw_common.h:213
mwAwareSnapshot::group
char * group
group this id belongs to
Definition mw_common.h:211
mwAwareSnapshot::name
char * name
Formatted version of ID.
Definition mw_common.h:215
mwAwareSnapshot::id
struct mwAwareIdBlock id
Definition mw_common.h:210
mwAwareSnapshot::online
gboolean online
is this user online?
Definition mw_common.h:212
mwEncryptItem
encryption blocks
Definition mw_common.h:220
mwEncryptItem::id
guint16 id
cipher identifier
Definition mw_common.h:221
mwEncryptItem::info
struct mwOpaque info
cipher information
Definition mw_common.h:222
mwGetBuffer
buffer to be read from
mwIdBlock
Definition mw_common.h:178
mwIdBlock::community
char * community
community id (NULL for same community)
Definition mw_common.h:180
mwIdBlock::user
char * user
user id (login id or empty for some services)
Definition mw_common.h:179
mwLoginInfo
Definition mw_common.h:123
mwLoginInfo::desc
char * desc
implementation defined description
Definition mw_common.h:130
mwLoginInfo::type
guint16 type
Definition mw_common.h:125
mwLoginInfo::user_id
char * user_id
community-unique ID of the user
Definition mw_common.h:126
mwLoginInfo::server_id
char * server_id
unique ID of login's server
Definition mw_common.h:132
mwLoginInfo::ip_addr
guint32 ip_addr
ip addr of the login
Definition mw_common.h:131
mwLoginInfo::user_name
char * user_name
name of user (nick name, full name, etc)
Definition mw_common.h:127
mwLoginInfo::full
gboolean full
if FALSE, following fields non-existant
Definition mw_common.h:129
mwLoginInfo::community
char * community
community name (usually domain name)
Definition mw_common.h:128
mwLoginInfo::login_id
char * login_id
community-unique ID of the login
Definition mw_common.h:124
mwOpaque
A length of binary data, not null-terminated.
Definition mw_common.h:79
mwOpaque::data
guchar * data
data, normally with no NULL termination
Definition mw_common.h:81
mwOpaque::len
gsize len
length of data.
Definition mw_common.h:80
mwPrivacyInfo
Definition mw_common.h:146
mwPrivacyInfo::users
struct mwUserItem * users
the users list
Definition mw_common.h:149
mwPrivacyInfo::count
guint32 count
count of users
Definition mw_common.h:148
mwPrivacyInfo::deny
gboolean deny
deny (true) or allow (false) users
Definition mw_common.h:147
mwPutBuffer
buffer to be written to
mwUserItem
Definition mw_common.h:138
mwUserItem::id
char * id
user id
Definition mw_common.h:140
mwUserItem::name
char * name
user name
Definition mw_common.h:142
mwUserItem::full
gboolean full
if FALSE, don't include name
Definition mw_common.h:139
mwUserItem::community
char * community
community
Definition mw_common.h:141
mwUserStatus
Definition mw_common.h:169
mwUserStatus::time
guint32 time
last status change time in seconds
Definition mw_common.h:171
mwUserStatus::status
guint16 status
Definition mw_common.h:170
mwUserStatus::desc
char * desc
status description
Definition mw_common.h:172