| mw_channel.h | | mw_channel.h | |
| | | | |
| skipping to change at line 27 | | skipping to change at line 27 | |
| License along with this library; if not, write to the Free | | License along with this library; if not, write to the Free | |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| */ | | */ | |
| | | | |
| #ifndef _MW_CHANNEL_H | | #ifndef _MW_CHANNEL_H | |
| #define _MW_CHANNEL_H | | #define _MW_CHANNEL_H | |
| | | | |
| #include <time.h> | | #include <time.h> | |
| #include "mw_common.h" | | #include "mw_common.h" | |
| | | | |
|
| /* place-holders */ | | /** @file mw_channel.h | |
| struct mwCipherInstance; | | | |
| struct mwMsgChannelAccept; | | | |
| struct mwMsgChannelCreate; | | | |
| struct mwMsgChannelDestroy; | | | |
| struct mwMsgChannelSend; | | | |
| struct mwService; | | | |
| struct mwSession; | | | |
| | | | |
| /** @file channel.h | | | |
| | | | |
| Life-cycle of an outgoing channel: | | Life-cycle of an outgoing channel: | |
| | | | |
| 1: mwChannel_new is called. If there is a channel in the outgoing | | 1: mwChannel_new is called. If there is a channel in the outgoing | |
| collection in state NEW, then it is returned. Otherwise, a channel | | collection in state NEW, then it is returned. Otherwise, a channel | |
| is allocated, assigned a unique outgoing id, marked as NEW, and | | is allocated, assigned a unique outgoing id, marked as NEW, and | |
| returned. | | returned. | |
| | | | |
| 2: channel is set to INIT status (effectively earmarking it as in- | | 2: channel is set to INIT status (effectively earmarking it as in- | |
| use). fields on the channel can then be set as necessary to | | use). fields on the channel can then be set as necessary to | |
| | | | |
| skipping to change at line 89 | | skipping to change at line 80 | |
| out queues for that channel are processed. The channel is now ready | | out queues for that channel are processed. The channel is now ready | |
| to be used. | | to be used. | |
| | | | |
| 4: data is sent and received over the channel | | 4: data is sent and received over the channel | |
| | | | |
| 5: The channel is closed either by receipt of a close message or by | | 5: The channel is closed either by receipt of a close message or by | |
| local action. If by local action, then a close message is sent to | | local action. If by local action, then a close message is sent to | |
| the server. The channel is cleaned up, its queues dumped, and it | | the server. The channel is cleaned up, its queues dumped, and it | |
| is deallocated. */ | | is deallocated. */ | |
| | | | |
|
| | | /* place-holders */ | |
| | | struct mwCipherInstance; | |
| | | struct mwMsgChannelAccept; | |
| | | struct mwMsgChannelCreate; | |
| | | struct mwMsgChannelDestroy; | |
| | | struct mwMsgChannelSend; | |
| | | struct mwService; | |
| | | struct mwSession; | |
| | | | |
| /** @struct mwChannel | | /** @struct mwChannel | |
| Represents a channel to a service */ | | Represents a channel to a service */ | |
| struct mwChannel; | | struct mwChannel; | |
| | | | |
| /** @struct mwChannelSet | | /** @struct mwChannelSet | |
| Collection of channels */ | | Collection of channels */ | |
| struct mwChannelSet; | | struct mwChannelSet; | |
| | | | |
| /** special ID indicating the master channel */ | | /** special ID indicating the master channel */ | |
| #define MW_MASTER_CHANNEL_ID 0x00000000 | | #define MW_MASTER_CHANNEL_ID 0x00000000 | |
| | | | |
| skipping to change at line 141 | | skipping to change at line 141 | |
| @see mwChannel_getStatistic */ | | @see mwChannel_getStatistic */ | |
| enum mwChannelStatField { | | enum mwChannelStatField { | |
| mwChannelStat_MSG_SENT, /**< total send-on-chan messages sent */ | | mwChannelStat_MSG_SENT, /**< total send-on-chan messages sent */ | |
| mwChannelStat_MSG_RECV, /**< total send-on-chan messages received */ | | mwChannelStat_MSG_RECV, /**< total send-on-chan messages received */ | |
| mwChannelStat_U_BYTES_SENT, /**< total bytes sent, pre-encryption */ | | mwChannelStat_U_BYTES_SENT, /**< total bytes sent, pre-encryption */ | |
| mwChannelStat_U_BYTES_RECV, /**< total bytes received, post-decryption *
/ | | mwChannelStat_U_BYTES_RECV, /**< total bytes received, post-decryption *
/ | |
| mwChannelStat_OPENED_AT, /**< time when channel was opened */ | | mwChannelStat_OPENED_AT, /**< time when channel was opened */ | |
| mwChannelStat_CLOSED_AT, /**< time when channel was closed */ | | mwChannelStat_CLOSED_AT, /**< time when channel was closed */ | |
| }; | | }; | |
| | | | |
|
| | | /** @enum mwEncryptPolicy | |
| | | | |
| | | Policy for a channel, dictating what sort of encryption should be | |
| | | used, if any, and when. | |
| | | */ | |
| | | enum mwEncryptPolicy { | |
| | | mwEncrypt_NONE = 0x0000, /**< encrypt none */ | |
| | | mwEncrypt_WHATEVER = 0x0001, /**< encrypt whatever you want */ | |
| | | mwEncrypt_ALL = 0x0002, /**< encrypt all, any cipher */ | |
| | | mwEncrypt_RC2_40 = 0x1000, /**< encrypt all, RC2/40 cipher */ | |
| | | mwEncrypt_RC2_128 = 0x2000, /**< encrypt all, RC2/128 cipher */ | |
| | | }; | |
| | | | |
| /** Allocate and initialize a channel set for a session */ | | /** Allocate and initialize a channel set for a session */ | |
| struct mwChannelSet *mwChannelSet_new(struct mwSession *); | | struct mwChannelSet *mwChannelSet_new(struct mwSession *); | |
| | | | |
| /** Clear and deallocate a channel set. Closes, clears, and frees all | | /** Clear and deallocate a channel set. Closes, clears, and frees all | |
| contained channels. */ | | contained channels. */ | |
| void mwChannelSet_free(struct mwChannelSet *); | | void mwChannelSet_free(struct mwChannelSet *); | |
| | | | |
| /** Create an incoming channel with the given channel id. Channel's state | | /** Create an incoming channel with the given channel id. Channel's state | |
| will be set to WAIT. Primarily for use in mw_session */ | | will be set to WAIT. Primarily for use in mw_session */ | |
| struct mwChannel *mwChannel_newIncoming(struct mwChannelSet *, guint32 id); | | struct mwChannel *mwChannel_newIncoming(struct mwChannelSet *, guint32 id); | |
| | | | |
| skipping to change at line 199 | | skipping to change at line 212 | |
| void mwChannel_removeServiceData(struct mwChannel *chan); | | void mwChannel_removeServiceData(struct mwChannel *chan); | |
| | | | |
| guint32 mwChannel_getProtoType(struct mwChannel *chan); | | guint32 mwChannel_getProtoType(struct mwChannel *chan); | |
| | | | |
| void mwChannel_setProtoType(struct mwChannel *chan, guint32 proto_type); | | void mwChannel_setProtoType(struct mwChannel *chan, guint32 proto_type); | |
| | | | |
| guint32 mwChannel_getProtoVer(struct mwChannel *chan); | | guint32 mwChannel_getProtoVer(struct mwChannel *chan); | |
| | | | |
| void mwChannel_setProtoVer(struct mwChannel *chan, guint32 proto_ver); | | void mwChannel_setProtoVer(struct mwChannel *chan, guint32 proto_ver); | |
| | | | |
|
| | | /** Channel encryption policy. | |
| | | | |
| | | Cannot currently be set, used internally to automatically | |
| | | negotiate ciphers. Future revisions may allow this to be specified | |
| | | in a new channel to dictate channel encryption. | |
| | | | |
| | | @see enum mwEncryptPolicy | |
| | | */ | |
| | | guint16 mwChannel_getEncryptPolicy(struct mwChannel *chan); | |
| | | | |
| guint32 mwChannel_getOptions(struct mwChannel *chan); | | guint32 mwChannel_getOptions(struct mwChannel *chan); | |
| | | | |
| void mwChannel_setOptions(struct mwChannel *chan, guint32 options); | | void mwChannel_setOptions(struct mwChannel *chan, guint32 options); | |
| | | | |
| /** User at the other end of the channel. The target user for outgoing | | /** User at the other end of the channel. The target user for outgoing | |
| channels, the creator for incoming channels */ | | channels, the creator for incoming channels */ | |
| struct mwLoginInfo *mwChannel_getUser(struct mwChannel *chan); | | struct mwLoginInfo *mwChannel_getUser(struct mwChannel *chan); | |
| | | | |
| /** direct reference to the create addtl information for a channel */ | | /** direct reference to the create addtl information for a channel */ | |
| struct mwOpaque *mwChannel_getAddtlCreate(struct mwChannel *); | | struct mwOpaque *mwChannel_getAddtlCreate(struct mwChannel *); | |
| | | | |
| skipping to change at line 276 | | skipping to change at line 299 | |
| specification, and send it */ | | specification, and send it */ | |
| int mwChannel_send(struct mwChannel *chan, guint32 msg_type, | | int mwChannel_send(struct mwChannel *chan, guint32 msg_type, | |
| struct mwOpaque *msg); | | struct mwOpaque *msg); | |
| | | | |
| /** Compose a send-on-channel message, and if encrypt is TRUE, encrypt | | /** Compose a send-on-channel message, and if encrypt is TRUE, encrypt | |
| it as per the channel's specification, and send it */ | | it as per the channel's specification, and send it */ | |
| int mwChannel_sendEncrypted(struct mwChannel *chan, | | int mwChannel_sendEncrypted(struct mwChannel *chan, | |
| guint32 msg_type, struct mwOpaque *msg, | | guint32 msg_type, struct mwOpaque *msg, | |
| gboolean encrypt); | | gboolean encrypt); | |
| | | | |
|
| /** */ | | /** pass a create message to a channel for handling */ | |
| void mwChannel_recvCreate(struct mwChannel *chan, | | void mwChannel_recvCreate(struct mwChannel *chan, | |
| struct mwMsgChannelCreate *msg); | | struct mwMsgChannelCreate *msg); | |
| | | | |
|
| /** */ | | /** pass an accept message to a channel for handling */ | |
| void mwChannel_recvAccept(struct mwChannel *chan, | | void mwChannel_recvAccept(struct mwChannel *chan, | |
| struct mwMsgChannelAccept *msg); | | struct mwMsgChannelAccept *msg); | |
| | | | |
|
| /** */ | | /** pass a destroy message to a channel for handling */ | |
| void mwChannel_recvDestroy(struct mwChannel *chan, | | void mwChannel_recvDestroy(struct mwChannel *chan, | |
| struct mwMsgChannelDestroy *msg); | | struct mwMsgChannelDestroy *msg); | |
| | | | |
| /** Feed data into a channel. */ | | /** Feed data into a channel. */ | |
| void mwChannel_recv(struct mwChannel *chan, struct mwMsgChannelSend *msg); | | void mwChannel_recv(struct mwChannel *chan, struct mwMsgChannelSend *msg); | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 7 change blocks. |
| 13 lines changed or deleted | | 36 lines changed or added | |
|
| mw_cipher.h | | mw_cipher.h | |
| | | | |
| skipping to change at line 31 | | skipping to change at line 31 | |
| #ifndef _MW_CIPHER_H | | #ifndef _MW_CIPHER_H | |
| #define _MW_CIPHER_H | | #define _MW_CIPHER_H | |
| | | | |
| #include <glib.h> | | #include <glib.h> | |
| #include "mw_common.h" | | #include "mw_common.h" | |
| | | | |
| /* place-holders */ | | /* place-holders */ | |
| struct mwChannel; | | struct mwChannel; | |
| struct mwSession; | | struct mwSession; | |
| | | | |
|
| /** Common cipher types */ | | /** @enum mwCipherType | |
| | | Common cipher types */ | |
| enum mwCipherType { | | enum mwCipherType { | |
| mwCipher_RC2_40 = 0x0000, | | mwCipher_RC2_40 = 0x0000, | |
| mwCipher_RC2_128 = 0x0001, | | mwCipher_RC2_128 = 0x0001, | |
| }; | | }; | |
| | | | |
| struct mwCipher; | | struct mwCipher; | |
| struct mwCipherInstance; | | struct mwCipherInstance; | |
| | | | |
| /** Obtain an instance of a given cipher, which can be used for the | | /** Obtain an instance of a given cipher, which can be used for the | |
| processing of a single channel. */ | | processing of a single channel. */ | |
| typedef struct mwCipherInstance *(*mwCipherInstantiator) | | typedef struct mwCipherInstance *(*mwCipherInstantiator) | |
| (struct mwCipher *cipher, struct mwChannel *chan); | | (struct mwCipher *cipher, struct mwChannel *chan); | |
| | | | |
| /** Generate a descriptor for use in a channel create message to | | /** Generate a descriptor for use in a channel create message to | |
|
| indicate the availability of this cipher */ | | indicate the availability of this cipher | |
| | | | |
| | | @todo remove for 1.0 | |
| | | */ | |
| typedef struct mwEncryptItem *(*mwCipherDescriptor) | | typedef struct mwEncryptItem *(*mwCipherDescriptor) | |
| (struct mwCipherInstance *instance); | | (struct mwCipherInstance *instance); | |
| | | | |
| /** Process (encrypt or decrypt, depending) the given data. The passed | | /** Process (encrypt or decrypt, depending) the given data. The passed | |
| buffer may be freed in processing and be replaced with a freshly | | buffer may be freed in processing and be replaced with a freshly | |
| allocated buffer. The post-processed buffer must in turn be freed | | allocated buffer. The post-processed buffer must in turn be freed | |
| after use */ | | after use */ | |
| typedef int (*mwCipherProcessor) | | typedef int (*mwCipherProcessor) | |
| (struct mwCipherInstance *ci, struct mwOpaque *data); | | (struct mwCipherInstance *ci, struct mwOpaque *data); | |
| | | | |
| | | | |
| skipping to change at line 76 | | skipping to change at line 80 | |
| struct mwSession *session; | | struct mwSession *session; | |
| | | | |
| guint16 type; /**< @see mwCipher_getType */ | | guint16 type; /**< @see mwCipher_getType */ | |
| const char *(*get_name)(); /**< @see mwCipher_getName */ | | const char *(*get_name)(); /**< @see mwCipher_getName */ | |
| const char *(*get_desc)(); /**< @see mwCipher_getDesc */ | | const char *(*get_desc)(); /**< @see mwCipher_getDesc */ | |
| | | | |
| /** Generate a new Cipher Instance for use on a channel | | /** Generate a new Cipher Instance for use on a channel | |
| @see mwCipher_newInstance */ | | @see mwCipher_newInstance */ | |
| mwCipherInstantiator new_instance; | | mwCipherInstantiator new_instance; | |
| | | | |
|
| /** @see mwCipher_newItem */ | | /** @see mwCipher_newItem | |
| | | @todo remove for 1.0 | |
| | | */ | |
| mwCipherDescriptor new_item; | | mwCipherDescriptor new_item; | |
| | | | |
| void (*offered)(struct mwCipherInstance *ci, struct mwEncryptItem *item); | | void (*offered)(struct mwCipherInstance *ci, struct mwEncryptItem *item); | |
|
| void (*offer)(struct mwCipherInstance *ci); | | struct mwEncryptItem *(*offer)(struct mwCipherInstance *ci); | |
| void (*accepted)(struct mwCipherInstance *ci, struct mwEncryptItem *item)
; | | void (*accepted)(struct mwCipherInstance *ci, struct mwEncryptItem *item)
; | |
|
| void (*accept)(struct mwCipherInstance *ci); | | struct mwEncryptItem *(*accept)(struct mwCipherInstance *ci); | |
| | | | |
| mwCipherProcessor encrypt; /**< @see mwCipherInstance_encrypt */ | | mwCipherProcessor encrypt; /**< @see mwCipherInstance_encrypt */ | |
| mwCipherProcessor decrypt; /**< @see mwCipherInstance_decrypt */ | | mwCipherProcessor decrypt; /**< @see mwCipherInstance_decrypt */ | |
| | | | |
| /** prepare this cipher for being free'd | | /** prepare this cipher for being free'd | |
| @see mwCipher_free */ | | @see mwCipher_free */ | |
| void (*clear)(struct mwCipher *c); | | void (*clear)(struct mwCipher *c); | |
| | | | |
| /** clean up a cipher instance before being free'd | | /** clean up a cipher instance before being free'd | |
| @see mwCipherInstance_free */ | | @see mwCipherInstance_free */ | |
| | | | |
| skipping to change at line 112 | | skipping to change at line 118 | |
| @see mwCipherInstance_getCipher */ | | @see mwCipherInstance_getCipher */ | |
| struct mwCipher *cipher; | | struct mwCipher *cipher; | |
| | | | |
| /** the channel this instances processes | | /** the channel this instances processes | |
| @see mwCipherInstance_getChannel */ | | @see mwCipherInstance_getChannel */ | |
| struct mwChannel *channel; | | struct mwChannel *channel; | |
| }; | | }; | |
| | | | |
| struct mwCipher *mwCipher_new_RC2_40(struct mwSession *s); | | struct mwCipher *mwCipher_new_RC2_40(struct mwSession *s); | |
| | | | |
|
| #if 0 | | struct mwCipher *mwCipher_new_RC2_128(struct mwSession *s); | |
| /* @todo write this */ | | | |
| struct mwCipher *mwCipher_new_DH_RC2_128(struct mwSession *s); | | | |
| #endif | | | |
| | | | |
| struct mwSession *mwCipher_getSession(struct mwCipher *cipher); | | struct mwSession *mwCipher_getSession(struct mwCipher *cipher); | |
| | | | |
| guint16 mwCipher_getType(struct mwCipher *cipher); | | guint16 mwCipher_getType(struct mwCipher *cipher); | |
| | | | |
| const char *mwCipher_getName(struct mwCipher *cipher); | | const char *mwCipher_getName(struct mwCipher *cipher); | |
| | | | |
| const char *mwCipher_getDesc(struct mwCipher *cipher); | | const char *mwCipher_getDesc(struct mwCipher *cipher); | |
| | | | |
| struct mwCipherInstance *mwCipher_newInstance(struct mwCipher *cipher, | | struct mwCipherInstance *mwCipher_newInstance(struct mwCipher *cipher, | |
| struct mwChannel *channel); | | struct mwChannel *channel); | |
| | | | |
| /** destroy a cipher */ | | /** destroy a cipher */ | |
| void mwCipher_free(struct mwCipher* cipher); | | void mwCipher_free(struct mwCipher* cipher); | |
| | | | |
| /** reference the parent cipher of an instance */ | | /** reference the parent cipher of an instance */ | |
| struct mwCipher *mwCipherInstance_getCipher(struct mwCipherInstance *ci); | | struct mwCipher *mwCipherInstance_getCipher(struct mwCipherInstance *ci); | |
| | | | |
|
| | | /** | |
| | | Deprecated in favor of the methods mwCipherInstance_offer and | |
| | | mwCipherInstance_accept | |
| | | */ | |
| struct mwEncryptItem *mwCipherInstance_newItem(struct mwCipherInstance *ci)
; | | struct mwEncryptItem *mwCipherInstance_newItem(struct mwCipherInstance *ci)
; | |
| | | | |
| /** Indicates a cipher has been offered to our channel */ | | /** Indicates a cipher has been offered to our channel */ | |
| void mwCipherInstance_offered(struct mwCipherInstance *ci, | | void mwCipherInstance_offered(struct mwCipherInstance *ci, | |
| struct mwEncryptItem *item); | | struct mwEncryptItem *item); | |
| | | | |
| /** Offer a cipher */ | | /** Offer a cipher */ | |
|
| void mwCipherInstance_offer(struct mwCipherInstance *ci); | | struct mwEncryptItem * | |
| | | mwCipherInstance_offer(struct mwCipherInstance *ci); | |
| | | | |
| /** Indicates an offered cipher has been accepted */ | | /** Indicates an offered cipher has been accepted */ | |
| void mwCipherInstance_accepted(struct mwCipherInstance *ci, | | void mwCipherInstance_accepted(struct mwCipherInstance *ci, | |
| struct mwEncryptItem *item); | | struct mwEncryptItem *item); | |
| | | | |
| /** Accept a cipher offered to our channel */ | | /** Accept a cipher offered to our channel */ | |
|
| void mwCipherInstance_accept(struct mwCipherInstance *ci); | | struct mwEncryptItem * | |
| | | mwCipherInstance_accept(struct mwCipherInstance *ci); | |
| | | | |
| /** encrypt data */ | | /** encrypt data */ | |
| int mwCipherInstance_encrypt(struct mwCipherInstance *ci, | | int mwCipherInstance_encrypt(struct mwCipherInstance *ci, | |
| struct mwOpaque *data); | | struct mwOpaque *data); | |
| | | | |
| /** decrypt data */ | | /** decrypt data */ | |
| int mwCipherInstance_decrypt(struct mwCipherInstance *ci, | | int mwCipherInstance_decrypt(struct mwCipherInstance *ci, | |
| struct mwOpaque *data); | | struct mwOpaque *data); | |
| | | | |
| /** destroy a cipher instance */ | | /** destroy a cipher instance */ | |
| void mwCipherInstance_free(struct mwCipherInstance *ci); | | void mwCipherInstance_free(struct mwCipherInstance *ci); | |
| | | | |
| /** | | /** | |
| @section General Cipher Functions | | @section General Cipher Functions | |
| | | | |
|
| This set of functions is a broken sort of RC2 implementation. But it | | These functions are reused where encryption is necessary outside of | |
| works with sametime, so we're all happy, right? Primary change to | | a channel (eg. session authentication) | |
| functionality appears in the mwKeyExpand function. Hypothetically, | | | |
| using a key expanded here (but breaking it into a 128-char array | | | |
| rather than 64 ints), one could pass it at that length to openssl | | | |
| and no further key expansion would occur. | | | |
| | | | |
| I'm not certain if replacing this with a wrapper for calls to some | | | |
| other crypto library is a good idea or not. Proven software versus | | | |
| added dependencies... | | | |
| */ | | */ | |
| /* @{ */ | | /* @{ */ | |
| | | | |
| /** generate some pseudo-random bytes | | /** generate some pseudo-random bytes | |
| @param keylen count of bytes to write into key | | @param keylen count of bytes to write into key | |
| @param key buffer to write keys into | | @param key buffer to write keys into | |
| */ | | */ | |
|
| void rand_key(char *key, gsize keylen); | | void mwKeyRandom(char *key, gsize keylen); | |
| | | | |
|
| /** Setup an Initialization Vector */ | | /** Setup an Initialization Vector. IV must be at least 8 bytes */ | |
| void mwIV_init(char *iv); | | void mwIV_init(char *iv); | |
| | | | |
| /** Expand a variable-length key into a 128-byte key (represented as | | /** Expand a variable-length key into a 128-byte key (represented as | |
| an an array of 64 ints) */ | | an an array of 64 ints) */ | |
| void mwKeyExpand(int *ekey, const char *key, gsize keylen); | | void mwKeyExpand(int *ekey, const char *key, gsize keylen); | |
| | | | |
| /** Encrypt data using an already-expanded key */ | | /** Encrypt data using an already-expanded key */ | |
| void mwEncryptExpanded(const int *ekey, char *iv, | | void mwEncryptExpanded(const int *ekey, char *iv, | |
| struct mwOpaque *in, | | struct mwOpaque *in, | |
| struct mwOpaque *out); | | struct mwOpaque *out); | |
| | | | |
| skipping to change at line 210 | | skipping to change at line 211 | |
| void mwDecryptExpanded(const int *ekey, char *iv, | | void mwDecryptExpanded(const int *ekey, char *iv, | |
| struct mwOpaque *in, | | struct mwOpaque *in, | |
| struct mwOpaque *out); | | struct mwOpaque *out); | |
| | | | |
| /** Decrypt data using an expanded form of the given key */ | | /** Decrypt data using an expanded form of the given key */ | |
| void mwDecrypt(const char *key, gsize keylen, char *iv, | | void mwDecrypt(const char *key, gsize keylen, char *iv, | |
| struct mwOpaque *in, struct mwOpaque *out); | | struct mwOpaque *in, struct mwOpaque *out); | |
| | | | |
| /* @} */ | | /* @} */ | |
| | | | |
|
| | | /** | |
| | | @section Diffie-Hellman Functions | |
| | | | |
| | | These functions are reused where DH Key negotiation is necessary | |
| | | outside of a channel (eg. session authentication). You'll need to | |
| | | include <gmp.h> in order to use these functions. | |
| | | */ | |
| | | /* @{ */ | |
| | | #ifdef __GMP_H__ | |
| | | | |
| | | /** initialize and set a big integer to the Sametime Prime value */ | |
| | | void mwInitDHPrime(mpz_t z); | |
| | | | |
| | | /** initialize and set a big integer to the Sametime Base value */ | |
| | | void mwInitDHBase(mpz_t z); | |
| | | | |
| | | /** sets private to a randomly generated value, and calculates public | |
| | | using the Sametime Prime and Base */ | |
| | | void mwDHRandKeypair(mpz_t private, mpz_t public); | |
| | | | |
| | | /** sets the shared key value based on the remote and private keys, | |
| | | using the Sametime Prime and Base */ | |
| | | void mwDHCalculateShared(mpz_t shared, mpz_t remote, mpz_t private); | |
| | | | |
| | | /** Import a DH key from an opaque */ | |
| | | void mwDHImportKey(mpz_t key, struct mwOpaque *o); | |
| | | | |
| | | /** Export a DH key into an opaque */ | |
| | | void mwDHExportKey(mpz_t key, struct mwOpaque *o); | |
| | | | |
| | | #endif | |
| | | /* @} */ | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 13 change blocks. |
| 23 lines changed or deleted | | 57 lines changed or added | |
|
| mw_common.h | | mw_common.h | |
| | | | |
| skipping to change at line 26 | | skipping to change at line 26 | |
| You should have received a copy of the GNU Library General Public | | You should have received a copy of the GNU Library General Public | |
| License along with this library; if not, write to the Free | | License along with this library; if not, write to the Free | |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| */ | | */ | |
| | | | |
| #ifndef _MW_COMMON_H | | #ifndef _MW_COMMON_H | |
| #define _MW_COMMON_H | | #define _MW_COMMON_H | |
| | | | |
| #include <glib.h> | | #include <glib.h> | |
| | | | |
|
| /** @file common.h | | /** @file mw_common.h | |
| | | | |
| Common data types and functions for handling those types. | | Common data types and functions for handling those types. | |
| | | | |
| Functions in this file all fit into similar naming conventions of | | Functions in this file all fit into similar naming conventions of | |
| <code>TYPE_ACTION</code> as per the activity they perform. The | | <code>TYPE_ACTION</code> as per the activity they perform. The | |
| following actions are available: | | following actions are available: | |
| | | | |
| <code>void TYPE_put(struct mwPutBuffer *b, TYPE *val)</code> | | <code>void TYPE_put(struct mwPutBuffer *b, TYPE *val)</code> | |
| - marshalls val onto the buffer b. The buffer will grow as necessary | | - marshalls val onto the buffer b. The buffer will grow as necessary | |
| to fit all the data put into it. For guint16, guint32, and | | to fit all the data put into it. For guint16, guint32, and | |
| | | | |
| skipping to change at line 85 | | skipping to change at line 85 | |
| /* 8.3.6 Login Types */ | | /* 8.3.6 Login Types */ | |
| | | | |
| /** The type of login. Normally meaning the type of client code being | | /** The type of login. Normally meaning the type of client code being | |
| used to login with. | | used to login with. | |
| | | | |
| If you know of any additional client identifiers, please add them | | If you know of any additional client identifiers, please add them | |
| below. | | below. | |
| | | | |
| If you are using Meanwhile in your client code and would like to | | If you are using Meanwhile in your client code and would like to | |
| differentiate yourself, please email siege at preoccupied dot net | | differentiate yourself, please email siege at preoccupied dot net | |
|
| with all the relevant information you can think of. I intend to be | | with all the relevant information you can think of and I'll add it | |
| pretty liberal with 'em. | | to the text mapping as well | |
| | | | |
| | | @see mwLoginType_getName | |
| */ | | */ | |
| enum mwLoginType { | | enum mwLoginType { | |
| mwLogin_LIB = 0x1000, /**< official Lotus binary library */ | | mwLogin_LIB = 0x1000, /**< official Lotus binary library */ | |
| mwLogin_JAVA_WEB = 0x1001, /**< official Lotus Java applet */ | | mwLogin_JAVA_WEB = 0x1001, /**< official Lotus Java applet */ | |
| mwLogin_BINARY = 0x1002, /**< official Lotus binary application *
/ | | mwLogin_BINARY = 0x1002, /**< official Lotus binary application *
/ | |
| mwLogin_JAVA_APP = 0x1003, /**< official Lotus Java application */ | | mwLogin_JAVA_APP = 0x1003, /**< official Lotus Java application */ | |
|
| | | mwLogin_LINKS = 0x100a, /**< official Sametime Links toolkit */ | |
| | | | |
| /* now we're getting crazy */ | | /* now we're getting crazy */ | |
| mwLogin_NOTES_6_5 = 0x1200, | | mwLogin_NOTES_6_5 = 0x1200, | |
| mwLogin_NOTES_7_0 = 0x1210, | | mwLogin_NOTES_7_0 = 0x1210, | |
| mwLogin_ICT = 0x1300, | | mwLogin_ICT = 0x1300, | |
|
| | | mwLogin_ICT_1_7_8_2 = 0x1302, | |
| mwLogin_NOTESBUDDY = 0x1400, /**< 0xff00 mask? */ | | mwLogin_NOTESBUDDY = 0x1400, /**< 0xff00 mask? */ | |
| mwLogin_NOTESBUDDY_4_15 = 0x1405, | | mwLogin_NOTESBUDDY_4_15 = 0x1405, | |
| mwLogin_SANITY = 0x1600, | | mwLogin_SANITY = 0x1600, | |
| mwLogin_ST_PERL = 0x1625, | | mwLogin_ST_PERL = 0x1625, | |
| mwLogin_PMR_ALERT = 0x1650, | | mwLogin_PMR_ALERT = 0x1650, | |
| mwLogin_TRILLIAN = 0x16aa, /**< http://sf.net/st-plugin/ */ | | mwLogin_TRILLIAN = 0x16aa, /**< http://sf.net/st-plugin/ */ | |
| mwLogin_TRILLIAN_IBM = 0x16bb, | | mwLogin_TRILLIAN_IBM = 0x16bb, | |
| mwLogin_MEANWHILE = 0x1700, /**< Meanwhile library */ | | mwLogin_MEANWHILE = 0x1700, /**< Meanwhile library */ | |
|
| | | | |
| /* these aren't ready for use yet, DO NOT USE WHILE THIS COMMENT | | | |
| EXISTS HERE, it will only cause you trouble */ | | | |
| mwLogin_MW_PYTHON = 0x1701, /**< Meanwhile Python */ | | | |
| mwLogin_MW_GAIM = 0x1702, /**< gaim-meanwhile */ | | | |
| mwLogin_MW_ADIUM = 0x1703, /**< adium-meanwhile */ | | | |
| mwLogin_MW_KOPETE = 0x1704, /**< kopete-meanwhile */ | | | |
| }; | | }; | |
| | | | |
| /* 8.2 Common Structures */ | | /* 8.2 Common Structures */ | |
| /* 8.2.1 Login Info block */ | | /* 8.2.1 Login Info block */ | |
| | | | |
| struct mwLoginInfo { | | struct mwLoginInfo { | |
| char *login_id; /**< community-unique ID of the login */ | | char *login_id; /**< community-unique ID of the login */ | |
| guint16 type; /**< @see mwLoginType */ | | guint16 type; /**< @see mwLoginType */ | |
| char *user_id; /**< community-unique ID of the user */ | | char *user_id; /**< community-unique ID of the user */ | |
| char *user_name; /**< name of user (nick name, full name, etc) */ | | char *user_name; /**< name of user (nick name, full name, etc) */ | |
| | | | |
| skipping to change at line 329 | | skipping to change at line 326 | |
| | | | |
| void mwUserItem_clone(struct mwUserItem *to, const struct mwUserItem *from)
; | | void mwUserItem_clone(struct mwUserItem *to, const struct mwUserItem *from)
; | |
| | | | |
| void mwPrivacyInfo_put(struct mwPutBuffer *b, | | void mwPrivacyInfo_put(struct mwPutBuffer *b, | |
| const struct mwPrivacyInfo *info); | | const struct mwPrivacyInfo *info); | |
| | | | |
| void mwPrivacyInfo_get(struct mwGetBuffer *b, struct mwPrivacyInfo *info); | | void mwPrivacyInfo_get(struct mwGetBuffer *b, struct mwPrivacyInfo *info); | |
| | | | |
| void mwPrivacyInfo_clear(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, | | void mwUserStatus_put(struct mwPutBuffer *b, | |
| const struct mwUserStatus *stat); | | const struct mwUserStatus *stat); | |
| | | | |
| void mwUserStatus_get(struct mwGetBuffer *b, struct mwUserStatus *stat); | | void mwUserStatus_get(struct mwGetBuffer *b, struct mwUserStatus *stat); | |
| | | | |
| void mwUserStatus_clear(struct mwUserStatus *stat); | | void mwUserStatus_clear(struct mwUserStatus *stat); | |
| | | | |
| void mwUserStatus_clone(struct mwUserStatus *to, | | void mwUserStatus_clone(struct mwUserStatus *to, | |
| const struct mwUserStatus *from); | | const struct mwUserStatus *from); | |
| | | | |
| | | | |
| skipping to change at line 383 | | skipping to change at line 383 | |
| void mwAwareSnapshot_clone(struct mwAwareSnapshot *to, | | void mwAwareSnapshot_clone(struct mwAwareSnapshot *to, | |
| const struct mwAwareSnapshot *from); | | const struct mwAwareSnapshot *from); | |
| | | | |
| void mwEncryptItem_put(struct mwPutBuffer *b, | | void mwEncryptItem_put(struct mwPutBuffer *b, | |
| const struct mwEncryptItem *item); | | const struct mwEncryptItem *item); | |
| | | | |
| void mwEncryptItem_get(struct mwGetBuffer *b, struct mwEncryptItem *item); | | void mwEncryptItem_get(struct mwGetBuffer *b, struct mwEncryptItem *item); | |
| | | | |
| void mwEncryptItem_clear(struct mwEncryptItem *item); | | void mwEncryptItem_clear(struct mwEncryptItem *item); | |
| | | | |
|
| | | void mwEncryptItem_free(struct mwEncryptItem *item); | |
| | | | |
| /*@}*/ | | /*@}*/ | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 7 change blocks. |
| 10 lines changed or deleted | | 12 lines changed or added | |
|
| mw_message.h | | mw_message.h | |
| | | | |
| skipping to change at line 49 | | skipping to change at line 49 | |
| | | | |
| mwMessage_CHANNEL_CREATE = 0x0002, /**< mwMsgChannelCreate */ | | mwMessage_CHANNEL_CREATE = 0x0002, /**< mwMsgChannelCreate */ | |
| mwMessage_CHANNEL_DESTROY = 0x0003, /**< mwMsgChannelDestroy */ | | mwMessage_CHANNEL_DESTROY = 0x0003, /**< mwMsgChannelDestroy */ | |
| mwMessage_CHANNEL_SEND = 0x0004, /**< mwMsgChannelSend */ | | mwMessage_CHANNEL_SEND = 0x0004, /**< mwMsgChannelSend */ | |
| mwMessage_CHANNEL_ACCEPT = 0x0006, /**< mwMsgChannelAccept */ | | mwMessage_CHANNEL_ACCEPT = 0x0006, /**< mwMsgChannelAccept */ | |
| | | | |
| mwMessage_SET_USER_STATUS = 0x0009, /**< mwMsgSetUserStatus */ | | mwMessage_SET_USER_STATUS = 0x0009, /**< mwMsgSetUserStatus */ | |
| mwMessage_SET_PRIVACY_LIST = 0x000b, /**< mwMsgSetPrivacyList */ | | mwMessage_SET_PRIVACY_LIST = 0x000b, /**< mwMsgSetPrivacyList */ | |
| mwMessage_SENSE_SERVICE = 0x0011, /**< mwMsgSenseService */ | | mwMessage_SENSE_SERVICE = 0x0011, /**< mwMsgSenseService */ | |
| mwMessage_ADMIN = 0x0019, /**< mwMsgAdmin */ | | mwMessage_ADMIN = 0x0019, /**< mwMsgAdmin */ | |
|
| | | mwMessage_ANNOUNCE = 0x0022, /**< mwMsgAnnounce */ | |
| }; | | }; | |
| | | | |
| enum mwMessageOption { | | enum mwMessageOption { | |
| mwMessageOption_ENCRYPT = 0x4000, /**< message data is encrypted */ | | mwMessageOption_ENCRYPT = 0x4000, /**< message data is encrypted */ | |
| mwMessageOption_HAS_ATTRIBS = 0x8000, /**< message has attributes */ | | mwMessageOption_HAS_ATTRIBS = 0x8000, /**< message has attributes */ | |
| }; | | }; | |
| | | | |
| /** @see mwMessageOption */ | | /** @see mwMessageOption */ | |
| #define MW_MESSAGE_HAS_OPTION(msg, opt) \ | | #define MW_MESSAGE_HAS_OPTION(msg, opt) \ | |
| ((msg)->options & (opt)) | | ((msg)->options & (opt)) | |
| | | | |
| skipping to change at line 85 | | skipping to change at line 86 | |
| void mwMessage_free(struct mwMessage *msg); | | void mwMessage_free(struct mwMessage *msg); | |
| | | | |
| /* 8.4 Messages */ | | /* 8.4 Messages */ | |
| /* 8.4.1 Basic Community Messages */ | | /* 8.4.1 Basic Community Messages */ | |
| /* 8.4.1.1 Handshake */ | | /* 8.4.1.1 Handshake */ | |
| | | | |
| struct mwMsgHandshake { | | struct mwMsgHandshake { | |
| struct mwMessage head; | | struct mwMessage head; | |
| guint16 major; /**< client's major version number */ | | guint16 major; /**< client's major version number */ | |
| guint16 minor; /**< client's minor version number */ | | guint16 minor; /**< client's minor version number */ | |
|
| guint32 srvrcalc_addr; /**< */ | | guint32 srvrcalc_addr; /**< 0.0.0.0 */ | |
| guint16 login_type; /**< @see mwLoginType */ | | guint16 login_type; /**< @see mwLoginType */ | |
|
| guint32 loclcalc_addr; /**< */ | | guint32 loclcalc_addr; /**< local public IP */ | |
| | | guint16 unknown_a; /**< normally 0x0100 */ | |
| | | guint32 unknown_b; /**< normally 0x00000000 */ | |
| | | char *local_host; /**< name of client host */ | |
| }; | | }; | |
| | | | |
| /* 8.4.1.2 HandshakeAck */ | | /* 8.4.1.2 HandshakeAck */ | |
| | | | |
| struct mwMsgHandshakeAck { | | struct mwMsgHandshakeAck { | |
| struct mwMessage head; | | struct mwMessage head; | |
| guint16 major; /**< server's major version number */ | | guint16 major; /**< server's major version number */ | |
| guint16 minor; /**< server's minor version number */ | | guint16 minor; /**< server's minor version number */ | |
| guint32 srvrcalc_addr; /**< server-calculated address */ | | guint32 srvrcalc_addr; /**< server-calculated address */ | |
|
| guint32 unknown; /**< four bytes of something */ | | guint32 magic; /**< four bytes of something */ | |
| struct mwOpaque data; /**< some stuff */ | | struct mwOpaque data; /**< server's DH public key for auth */ | |
| }; | | }; | |
| | | | |
| /* 8.3.7 Authentication Types */ | | /* 8.3.7 Authentication Types */ | |
| | | | |
| enum mwAuthType { | | enum mwAuthType { | |
| mwAuthType_PLAIN = 0x0000, | | mwAuthType_PLAIN = 0x0000, | |
| mwAuthType_TOKEN = 0x0001, | | mwAuthType_TOKEN = 0x0001, | |
|
| mwAuthType_ENCRYPT = 0x0002, | | mwAuthType_ENCRYPT = 0x0002, /**< @todo remove for 1.0 */ | |
| | | mwAuthType_RC2_40 = 0x0002, | |
| | | mwAuthType_RC2_128 = 0x0004, | |
| }; | | }; | |
| | | | |
| /* 8.4.1.3 Login */ | | /* 8.4.1.3 Login */ | |
| | | | |
| struct mwMsgLogin { | | struct mwMsgLogin { | |
| struct mwMessage head; | | struct mwMessage head; | |
| guint16 login_type; /**< @see mwLoginType */ | | guint16 login_type; /**< @see mwLoginType */ | |
| char *name; /**< user identification */ | | char *name; /**< user identification */ | |
| guint16 auth_type; /**< @see mwAuthType */ | | guint16 auth_type; /**< @see mwAuthType */ | |
| struct mwOpaque auth_data; /**< authentication data */ | | struct mwOpaque auth_data; /**< authentication data */ | |
| | | | |
| skipping to change at line 241 | | skipping to change at line 247 | |
| }; | | }; | |
| | | | |
| /* Admin */ | | /* Admin */ | |
| | | | |
| /** An administrative broadcast message */ | | /** An administrative broadcast message */ | |
| struct mwMsgAdmin { | | struct mwMsgAdmin { | |
| struct mwMessage head; | | struct mwMessage head; | |
| char *text; | | char *text; | |
| }; | | }; | |
| | | | |
|
| | | /* Announce */ | |
| | | | |
| | | /** An announcement between users */ | |
| | | struct mwMsgAnnounce { | |
| | | struct mwMessage head; | |
| | | gboolean sender_present; /**< indicates presence of sender data */ | |
| | | struct mwLoginInfo sender; /**< who sent the announcement */ | |
| | | guint16 unknown_a; /**< unknown A. Usually 0x00 */ | |
| | | gboolean may_reply; /**< replies allowed */ | |
| | | char *text; /**< text of message */ | |
| | | | |
| | | /** list of (char *) indicating recipients. Recipient users are in | |
| | | the format "@U username" and recipient NAB groups are in the | |
| | | format "@G groupname" */ | |
| | | GList *recipients; | |
| | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 6 change blocks. |
| 5 lines changed or deleted | | 28 lines changed or added | |
|
| mw_session.h | | mw_session.h | |
| | | | |
| skipping to change at line 24 | | skipping to change at line 24 | |
| Library General Public License for more details. | | Library General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU Library General Public | | You should have received a copy of the GNU Library General Public | |
| License along with this library; if not, write to the Free | | License along with this library; if not, write to the Free | |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| */ | | */ | |
| | | | |
| #ifndef _MW_SESSION_H | | #ifndef _MW_SESSION_H | |
| #define _MW_SESSION_H | | #define _MW_SESSION_H | |
| | | | |
|
| | | /** @file mw_session.h | |
| | | | |
| | | A client session with a Sametime server is encapsulated in the | |
| | | mwSession structure. The session controls channels, provides | |
| | | encryption ciphers, and manages services using messages over the | |
| | | Master channel. | |
| | | | |
| | | A session does not directly communicate with a socket or stream, | |
| | | instead the session is initialized from client code with an | |
| | | instance of a mwSessionHandler structure. This session handler | |
| | | provides functions as call-backs for common session events, and | |
| | | provides functions for writing-to and closing the connection to | |
| | | the server. | |
| | | | |
| | | A session does not perform reads on a socket directly. Instead, it | |
| | | must be fed from an outside source via the mwSession_recv | |
| | | function. The session will buffer and merge data passed to this | |
| | | function to build complete protocol messages, and will act upon | |
| | | each complete message accordingly. | |
| | | */ | |
| | | | |
| #include "mw_common.h" | | #include "mw_common.h" | |
| | | | |
|
| | | struct mwChannelSet; | |
| struct mwCipher; | | struct mwCipher; | |
| struct mwMessage; | | struct mwMessage; | |
|
| | | struct mwService; | |
| /** @file mw_session.h | | | |
| ... | | | |
| */ | | | |
| | | | |
| /** default protocol major version */ | | /** default protocol major version */ | |
| #define MW_PROTOCOL_VERSION_MAJOR 0x001e | | #define MW_PROTOCOL_VERSION_MAJOR 0x001e | |
| | | | |
| /** default protocol minor version */ | | /** default protocol minor version */ | |
| #define MW_PROTOCOL_VERSION_MINOR 0x001d | | #define MW_PROTOCOL_VERSION_MINOR 0x001d | |
| | | | |
| /** @section Session Properties | | /** @section Session Properties | |
|
| ... | | for use with mwSession_setProperty, et al. | |
| */ | | */ | |
| /*@{*/ | | /*@{*/ | |
| | | | |
| /** char *, session user ID */ | | /** char *, session user ID */ | |
| #define mwSession_AUTH_USER_ID "session.auth.user" | | #define mwSession_AUTH_USER_ID "session.auth.user" | |
| | | | |
| /** char *, plaintext password */ | | /** char *, plaintext password */ | |
| #define mwSession_AUTH_PASSWORD "session.auth.password" | | #define mwSession_AUTH_PASSWORD "session.auth.password" | |
| | | | |
| /** struct mwOpaque *, authentication token */ | | /** struct mwOpaque *, authentication token */ | |
| #define mwSession_AUTH_TOKEN "session.auth.token" | | #define mwSession_AUTH_TOKEN "session.auth.token" | |
| | | | |
|
| | | /** char *, hostname of client */ | |
| | | #define mwSession_CLIENT_HOST "client.host" | |
| | | | |
| | | /** guint32, local IP of client */ | |
| | | #define mwSession_CLIENT_IP "client.ip" | |
| | | | |
| /** guint16, major version of client protocol */ | | /** guint16, major version of client protocol */ | |
| #define mwSession_CLIENT_VER_MAJOR "client.version.major" | | #define mwSession_CLIENT_VER_MAJOR "client.version.major" | |
| | | | |
| /** guint16, minor version of client protocol */ | | /** guint16, minor version of client protocol */ | |
| #define mwSession_CLIENT_VER_MINOR "client.version.minor" | | #define mwSession_CLIENT_VER_MINOR "client.version.minor" | |
| | | | |
| /** guint16, client type identifier */ | | /** guint16, client type identifier */ | |
| #define mwSession_CLIENT_TYPE_ID "client.id" | | #define mwSession_CLIENT_TYPE_ID "client.id" | |
| | | | |
| /** guint16, major version of server protocol */ | | /** guint16, major version of server protocol */ | |
| #define mwSession_SERVER_VER_MAJOR "server.version.major" | | #define mwSession_SERVER_VER_MAJOR "server.version.major" | |
| | | | |
| /** guint16, minor version of server protocol */ | | /** guint16, minor version of server protocol */ | |
| #define mwSession_SERVER_VER_MINOR "server.version.minor" | | #define mwSession_SERVER_VER_MINOR "server.version.minor" | |
| | | | |
| /*@}*/ | | /*@}*/ | |
| | | | |
|
| /** @file session.h | | | |
| | | | |
| A client session with a Sametime server is encapsulated in the | | | |
| mwSession structure. The session controls channels, provides | | | |
| encryption ciphers, and manages services using messages over the | | | |
| Master channel. | | | |
| | | | |
| A session does not directly communicate with a socket or stream, | | | |
| instead the session is initialized from client code with an | | | |
| instance of a mwSessionHandler structure. This session handler | | | |
| provides functions as call-backs for common session events, and | | | |
| provides functions for writing-to and closing the connection to | | | |
| the server. | | | |
| | | | |
| A session does not perform reads on a socket directly. Instead, it | | | |
| must be fed from an outside source via the mwSession_recv | | | |
| function. The session will buffer and merge data passed to this | | | |
| function to build complete protocol messages, and will act upon | | | |
| each complete message accordingly. | | | |
| */ | | | |
| | | | |
| enum mwSessionState { | | enum mwSessionState { | |
| mwSession_STARTING, /**< session is starting */ | | mwSession_STARTING, /**< session is starting */ | |
| mwSession_HANDSHAKE, /**< session has sent handshake */ | | mwSession_HANDSHAKE, /**< session has sent handshake */ | |
| mwSession_HANDSHAKE_ACK, /**< session has received handshake ack */ | | mwSession_HANDSHAKE_ACK, /**< session has received handshake ack */ | |
| mwSession_LOGIN, /**< session has sent login */ | | mwSession_LOGIN, /**< session has sent login */ | |
| mwSession_LOGIN_REDIR, /**< session has been redirected */ | | mwSession_LOGIN_REDIR, /**< session has been redirected */ | |
| mwSession_LOGIN_ACK, /**< session has received login ack */ | | mwSession_LOGIN_ACK, /**< session has received login ack */ | |
| mwSession_STARTED, /**< session is active */ | | mwSession_STARTED, /**< session is active */ | |
| mwSession_STOPPING, /**< session is shutting down */ | | mwSession_STOPPING, /**< session is shutting down */ | |
| mwSession_STOPPED, /**< session is stopped */ | | mwSession_STOPPED, /**< session is stopped */ | |
| | | | |
| skipping to change at line 127 | | skipping to change at line 131 | |
| #define mwSession_isStarted(s) \ | | #define mwSession_isStarted(s) \ | |
| (mwSession_isState((s), mwSession_STARTED)) | | (mwSession_isState((s), mwSession_STARTED)) | |
| | | | |
| #define mwSession_isStopping(s) \ | | #define mwSession_isStopping(s) \ | |
| (mwSession_isState((s), mwSession_STOPPING)) | | (mwSession_isState((s), mwSession_STOPPING)) | |
| | | | |
| #define mwSession_isStopped(s) \ | | #define mwSession_isStopped(s) \ | |
| (mwSession_isState((s), mwSession_STOPPED)) | | (mwSession_isState((s), mwSession_STOPPED)) | |
| | | | |
| /** @struct mwSession | | /** @struct mwSession | |
|
| | | | |
| Represents a Sametime client session */ | | Represents a Sametime client session */ | |
| struct mwSession; | | struct mwSession; | |
| | | | |
|
| /** session handler. Structure which interfaces a session with client | | /** @struct mwSessionHandler | |
| | | | |
| | | session handler. Structure which interfaces a session with client | |
| code to provide I/O and event handling */ | | code to provide I/O and event handling */ | |
| struct mwSessionHandler { | | struct mwSessionHandler { | |
| | | | |
| /** write data to the server connection. Required. Should return | | /** write data to the server connection. Required. Should return | |
| zero for success, non-zero for error */ | | zero for success, non-zero for error */ | |
| int (*io_write)(struct mwSession *, const char *buf, gsize len); | | int (*io_write)(struct mwSession *, const char *buf, gsize len); | |
| | | | |
| /** close the server connection. Required */ | | /** close the server connection. Required */ | |
| void (*io_close)(struct mwSession *); | | void (*io_close)(struct mwSession *); | |
| | | | |
| /** triggered by mwSession_free. Optional. Put cleanup code here */ | | /** triggered by mwSession_free. Optional. Put cleanup code here */ | |
| void (*clear)(struct mwSession *); | | void (*clear)(struct mwSession *); | |
| | | | |
| /** Called when the session has changed status. | | /** Called when the session has changed status. | |
| | | | |
|
| Uses of the info param: | | @see mwSession_getStateInfo for uses of info field | |
| - <code>STOPPING</code> error code causing the session to shut down | | | |
| | | | |
| @todo change info to a gpointer | | | |
| | | | |
| @param s the session | | @param s the session | |
| @param state the session's state | | @param state the session's state | |
|
| @param info additional state info. */ | | @param info additional state information */ | |
| void (*on_stateChange)(struct mwSession *s, | | void (*on_stateChange)(struct mwSession *s, | |
|
| enum mwSessionState state, guint32 info); | | enum mwSessionState state, gpointer info); | |
| | | | |
| /** called when privacy information has been sent or received | | /** called when privacy information has been sent or received | |
| | | | |
| @see mwSession_getPrivacyInfo | | @see mwSession_getPrivacyInfo | |
| */ | | */ | |
| void (*on_setPrivacyInfo)(struct mwSession *); | | void (*on_setPrivacyInfo)(struct mwSession *); | |
| | | | |
| /** called when user status has changed | | /** called when user status has changed | |
| | | | |
| @see mwSession_getUserStatus */ | | @see mwSession_getUserStatus */ | |
| void (*on_setUserStatus)(struct mwSession *); | | void (*on_setUserStatus)(struct mwSession *); | |
| | | | |
| /** called when an admin messages has been received */ | | /** called when an admin messages has been received */ | |
| void (*on_admin)(struct mwSession *, const char *text); | | void (*on_admin)(struct mwSession *, const char *text); | |
| | | | |
|
| /** called when a login redirect message is received | | /** called when an announcement arrives */ | |
| | | void (*on_announce)(struct mwSession *, struct mwLoginInfo *from, | |
| | | gboolean may_reply, const char *text); | |
| | | | |
|
| @todo remove in favour of on_stateChange, passing host as a | | | |
| gpointer in info */ | | | |
| void (*on_loginRedirect)(struct mwSession *, const char *host); | | | |
| }; | | }; | |
| | | | |
| /** allocate a new session */ | | /** allocate a new session */ | |
| struct mwSession *mwSession_new(struct mwSessionHandler *); | | struct mwSession *mwSession_new(struct mwSessionHandler *); | |
| | | | |
| /** stop, clear, free a session. Does not free contained ciphers or | | /** stop, clear, free a session. Does not free contained ciphers or | |
| services, these must be taken care of explicitly. */ | | services, these must be taken care of explicitly. */ | |
| void mwSession_free(struct mwSession *); | | void mwSession_free(struct mwSession *); | |
| | | | |
| /** obtain a reference to the session's handler */ | | /** obtain a reference to the session's handler */ | |
| | | | |
| skipping to change at line 213 | | skipping to change at line 216 | |
| @returns 0 for success */ | | @returns 0 for success */ | |
| int mwSession_send(struct mwSession *s, struct mwMessage *msg); | | int mwSession_send(struct mwSession *s, struct mwMessage *msg); | |
| | | | |
| /** sends the keepalive byte */ | | /** sends the keepalive byte */ | |
| int mwSession_sendKeepalive(struct mwSession *s); | | int mwSession_sendKeepalive(struct mwSession *s); | |
| | | | |
| /** respond to a login redirect message by forcing the login sequence | | /** respond to a login redirect message by forcing the login sequence | |
| to continue through the immediate server. */ | | to continue through the immediate server. */ | |
| int mwSession_forceLogin(struct mwSession *s); | | int mwSession_forceLogin(struct mwSession *s); | |
| | | | |
|
| | | /** send an announcement to a list of users/groups. Targets of | |
| | | announcement must be in the same community as the session. | |
| | | | |
| | | @param s session to send announcement from | |
| | | @param may_reply permit clients to reply. Not all clients honor this. | |
| | | @param text text of announcement | |
| | | @param recipients list of recipients. Each recipient is specified | |
| | | by a single string, prefix with "@U " for users | |
| | | and "@G " for Notes Address Book groups. | |
| | | */ | |
| | | int mwSession_sendAnnounce(struct mwSession *s, gboolean may_reply, | |
| | | const char *text, const GList *recipients); | |
| | | | |
| /** set the internal privacy information, and inform the server as | | /** set the internal privacy information, and inform the server as | |
| necessary. Triggers the on_setPrivacyInfo call-back. */ | | necessary. Triggers the on_setPrivacyInfo call-back. */ | |
| int mwSession_setPrivacyInfo(struct mwSession *, struct mwPrivacyInfo *); | | int mwSession_setPrivacyInfo(struct mwSession *, struct mwPrivacyInfo *); | |
| | | | |
|
| | | /** direct reference to the session's internal privacy structure */ | |
| struct mwPrivacyInfo *mwSession_getPrivacyInfo(struct mwSession *); | | struct mwPrivacyInfo *mwSession_getPrivacyInfo(struct mwSession *); | |
| | | | |
| /** reference the login information for the session */ | | /** reference the login information for the session */ | |
| struct mwLoginInfo *mwSession_getLoginInfo(struct mwSession *); | | struct mwLoginInfo *mwSession_getLoginInfo(struct mwSession *); | |
| | | | |
| /** set the internal user status state, and inform the server as | | /** set the internal user status state, and inform the server as | |
| necessary. Triggers the on_setUserStatus call-back */ | | necessary. Triggers the on_setUserStatus call-back */ | |
| int mwSession_setUserStatus(struct mwSession *, struct mwUserStatus *); | | int mwSession_setUserStatus(struct mwSession *, struct mwUserStatus *); | |
| | | | |
| struct mwUserStatus *mwSession_getUserStatus(struct mwSession *); | | struct mwUserStatus *mwSession_getUserStatus(struct mwSession *); | |
| | | | |
| /** current status of the session */ | | /** current status of the session */ | |
| enum mwSessionState mwSession_getState(struct mwSession *); | | enum mwSessionState mwSession_getState(struct mwSession *); | |
| | | | |
|
| /** additional status-specific information */ | | /** additional status-specific information. Depending on the state of | |
| guint32 mwSession_getStateInfo(struct mwSession *); | | the session, this value has different meaning. | |
| | | | |
| | | @li @c mwSession_STOPPING guint32 error code causing | |
| | | the session to shut down | |
| | | | |
| | | @li @c mwSession_STOPPED guint32 error code causing | |
| | | the session to shut down | |
| | | | |
| | | @li @c mwSession_LOGIN_REDIR (char *) host to redirect | |
| | | to | |
| | | */ | |
| | | gpointer mwSession_getStateInfo(struct mwSession *); | |
| | | | |
| struct mwChannelSet *mwSession_getChannels(struct mwSession *); | | struct mwChannelSet *mwSession_getChannels(struct mwSession *); | |
| | | | |
| /** adds a service to the session. If the session is started (or when | | /** adds a service to the session. If the session is started (or when | |
| the session is successfully started) and the service has a start | | the session is successfully started) and the service has a start | |
| function, the session will request service availability from the | | function, the session will request service availability from the | |
| server. On receipt of the service availability notification, the | | server. On receipt of the service availability notification, the | |
| session will call the service's start function. | | session will call the service's start function. | |
| | | | |
| @return TRUE if the session was added correctly */ | | @return TRUE if the session was added correctly */ | |
| | | | |
| skipping to change at line 290 | | skipping to change at line 318 | |
| /** a GList of ciphers in this session. The GList needs to be freed | | /** a GList of ciphers in this session. The GList needs to be freed | |
| after use */ | | after use */ | |
| GList *mwSession_getCiphers(struct mwSession *); | | GList *mwSession_getCiphers(struct mwSession *); | |
| | | | |
| /** associate a key:value pair with the session. If an existing value is | | /** associate a key:value pair with the session. If an existing value is | |
| associated with the same key, it will have its clear function called | | associated with the same key, it will have its clear function called | |
| and will be replaced with the new value */ | | and will be replaced with the new value */ | |
| void mwSession_setProperty(struct mwSession *, const char *key, | | void mwSession_setProperty(struct mwSession *, const char *key, | |
| gpointer val, GDestroyNotify clear); | | gpointer val, GDestroyNotify clear); | |
| | | | |
|
| | | /** obtain the value of a previously set property, or NULL */ | |
| gpointer mwSession_getProperty(struct mwSession *, const char *key); | | gpointer mwSession_getProperty(struct mwSession *, const char *key); | |
| | | | |
|
| | | /** remove a property, calling the optional GDestroyNotify function | |
| | | indicated in mwSession_setProperty if applicable */ | |
| void mwSession_removeProperty(struct mwSession *, const char *key); | | void mwSession_removeProperty(struct mwSession *, const char *key); | |
| | | | |
|
| | | /** associate arbitrary data with the session for use by the client | |
| | | code. Only client applications should use this, never services. | |
| | | | |
| | | @param session the session to associate the data with | |
| | | @param data arbitrary client data | |
| | | @param clear optional cleanup function called on data from | |
| | | mwSession_removeClientData and mwSession_free | |
| | | */ | |
| void mwSession_setClientData(struct mwSession *session, | | void mwSession_setClientData(struct mwSession *session, | |
| gpointer data, GDestroyNotify clear); | | gpointer data, GDestroyNotify clear); | |
| | | | |
| gpointer mwSession_getClientData(struct mwSession *session); | | gpointer mwSession_getClientData(struct mwSession *session); | |
| | | | |
|
| | | /** remove client data, calling the optional GDestroyNotify function | |
| | | indicated in mwSession_setClientData if applicable */ | |
| void mwSession_removeClientData(struct mwSession *session); | | void mwSession_removeClientData(struct mwSession *session); | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 20 change blocks. |
| 39 lines changed or deleted | | 80 lines changed or added | |
|
| mw_srvc_ft.h | | mw_srvc_ft.h | |
| | | | |
| skipping to change at line 113 | | skipping to change at line 113 | |
| void (*clear)(struct mwServiceFileTransfer *srvc); | | void (*clear)(struct mwServiceFileTransfer *srvc); | |
| }; | | }; | |
| | | | |
| struct mwServiceFileTransfer * | | struct mwServiceFileTransfer * | |
| mwServiceFileTransfer_new(struct mwSession *session, | | mwServiceFileTransfer_new(struct mwSession *session, | |
| struct mwFileTransferHandler *handler); | | struct mwFileTransferHandler *handler); | |
| | | | |
| struct mwFileTransferHandler * | | struct mwFileTransferHandler * | |
| mwServiceFileTransfer_getHandler(struct mwServiceFileTransfer *srvc); | | mwServiceFileTransfer_getHandler(struct mwServiceFileTransfer *srvc); | |
| | | | |
|
| | | const GList * | |
| | | mwServiceFileTransfer_getTransfers(struct mwServiceFileTransfer *srvc); | |
| | | | |
| struct mwFileTransfer * | | struct mwFileTransfer * | |
| mwFileTransfer_new(struct mwServiceFileTransfer *srvc, | | mwFileTransfer_new(struct mwServiceFileTransfer *srvc, | |
| const struct mwIdBlock *who, const char *msg, | | const struct mwIdBlock *who, const char *msg, | |
| const char *filename, guint32 filesize); | | const char *filename, guint32 filesize); | |
| | | | |
| /** deallocate a file transfer. will call mwFileTransfer_close if | | /** deallocate a file transfer. will call mwFileTransfer_close if | |
| necessary */ | | necessary */ | |
| void | | void | |
| mwFileTransfer_free(struct mwFileTransfer *ft); | | mwFileTransfer_free(struct mwFileTransfer *ft); | |
| | | | |
| | | | |
| skipping to change at line 170 | | skipping to change at line 173 | |
| #define mwFileTransfer_reject(ft) \ | | #define mwFileTransfer_reject(ft) \ | |
| mwFileTransfer_close((ft), mwFileTransfer_REJECTED) | | mwFileTransfer_close((ft), mwFileTransfer_REJECTED) | |
| | | | |
| /** cancel an open file transfer */ | | /** cancel an open file transfer */ | |
| #define mwFileTransfer_cancel(ft) \ | | #define mwFileTransfer_cancel(ft) \ | |
| mwFileTransfer_close((ft), mwFileTransfer_SUCCESS); | | mwFileTransfer_close((ft), mwFileTransfer_SUCCESS); | |
| | | | |
| /** Close a file transfer. This will trigger the ft_close function of the | | /** Close a file transfer. This will trigger the ft_close function of the | |
| session's handler. | | session's handler. | |
| | | | |
|
| @relates mwFileTransfer_reject | | @see mwFileTransfer_reject | |
| @relates mwFileTransfer_cancel | | @see mwFileTransfer_cancel | |
| */ | | */ | |
| int mwFileTransfer_close(struct mwFileTransfer *ft, guint32 code); | | int mwFileTransfer_close(struct mwFileTransfer *ft, guint32 code); | |
| | | | |
| /** send a chunk of data over an outbound file transfer. The client at | | /** send a chunk of data over an outbound file transfer. The client at | |
| the other end of the transfer should respond with an acknowledgement | | the other end of the transfer should respond with an acknowledgement | |
| message, which can be caught in the service's handler. | | message, which can be caught in the service's handler. | |
| | | | |
|
| @relates mwFileTransferHandler::ft_ack | | @see mwFileTransferHandler::ft_ack | |
| */ | | */ | |
| int mwFileTransfer_send(struct mwFileTransfer *ft, | | int mwFileTransfer_send(struct mwFileTransfer *ft, | |
| struct mwOpaque *data); | | struct mwOpaque *data); | |
| | | | |
| /** acknowledge the receipt of a chunk of data from an inbound file | | /** acknowledge the receipt of a chunk of data from an inbound file | |
| transfer. This should be done after every received chunk, or the | | transfer. This should be done after every received chunk, or the | |
| transfer will stall. However, not all clients will wait for an ack | | transfer will stall. However, not all clients will wait for an ack | |
| after sending a chunk before sending the next chunk, so it is | | after sending a chunk before sending the next chunk, so it is | |
| possible to have the handler's ft_recv function triggered again | | possible to have the handler's ft_recv function triggered again | |
| even if no ack was sent. | | even if no ack was sent. | |
| | | | |
|
| @relates mwFileTransferHandler::ft_recv | | @see mwFileTransferHandler::ft_recv | |
| */ | | */ | |
| int mwFileTransfer_ack(struct mwFileTransfer *ft); | | int mwFileTransfer_ack(struct mwFileTransfer *ft); | |
| | | | |
| void mwFileTransfer_setClientData(struct mwFileTransfer *ft, | | void mwFileTransfer_setClientData(struct mwFileTransfer *ft, | |
| gpointer data, GDestroyNotify clean); | | gpointer data, GDestroyNotify clean); | |
| | | | |
| gpointer mwFileTransfer_getClientData(struct mwFileTransfer *ft); | | gpointer mwFileTransfer_getClientData(struct mwFileTransfer *ft); | |
| | | | |
| void mwFileTransfer_removeClientData(struct mwFileTransfer *ft); | | void mwFileTransfer_removeClientData(struct mwFileTransfer *ft); | |
| | | | |
| | | | |
End of changes. 4 change blocks. |
| 4 lines changed or deleted | | 7 lines changed or added | |
|
| mw_srvc_im.h | | mw_srvc_im.h | |
| | | | |
| skipping to change at line 27 | | skipping to change at line 27 | |
| License along with this library; if not, write to the Free | | License along with this library; if not, write to the Free | |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| */ | | */ | |
| | | | |
| #ifndef _MW_SRVC_IM_H | | #ifndef _MW_SRVC_IM_H | |
| #define _MW_SRVC_IM_H | | #define _MW_SRVC_IM_H | |
| | | | |
| #include <glib.h> | | #include <glib.h> | |
| #include "mw_common.h" | | #include "mw_common.h" | |
| | | | |
|
| /** @file srvc_im.h | | /** @file mw_srvc_im.h | |
| | | | |
| The IM service provides one-on-one communication between | | The IM service provides one-on-one communication between | |
| users. Messages sent over conversations may relay different types | | users. Messages sent over conversations may relay different types | |
| of information, in a variety of formats. The basic feature-set | | of information, in a variety of formats. The basic feature-set | |
| provides plain-text chat with typing notification. More complex | | provides plain-text chat with typing notification. More complex | |
| features may be negotiated transparently by setting the IM Client | | features may be negotiated transparently by setting the IM Client | |
| Type for a conversation, or for the service as a whole. | | Type for a conversation, or for the service as a whole. | |
| */ | | */ | |
| | | | |
| /** Type identifier for the IM service */ | | /** Type identifier for the IM service */ | |
|
| #define SERVICE_IM 0x00001000 | | #define mwService_IM 0x00001000 | |
| | | | |
| /** @struct mwServiceIm | | /** @struct mwServiceIm | |
| | | | |
| An instance of the IM service. This service provides simple | | An instance of the IM service. This service provides simple | |
| instant messaging functionality */ | | instant messaging functionality */ | |
| struct mwServiceIm; | | struct mwServiceIm; | |
| | | | |
| /** @struct mwConversation | | /** @struct mwConversation | |
| | | | |
| A conversation between the local service and a single other user */ | | A conversation between the local service and a single other user */ | |
| | | | |
| skipping to change at line 66 | | skipping to change at line 66 | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| Types of supported messages. When a conversation is created, the | | Types of supported messages. When a conversation is created, the | |
| least common denominator of features between either side of the | | least common denominator of features between either side of the | |
| conversation (based on what features are available in the IM | | conversation (based on what features are available in the IM | |
| service itself) becomes the set of supported features for that | | service itself) becomes the set of supported features for that | |
| conversation. At any point, the feature set for the service may | | conversation. At any point, the feature set for the service may | |
| change, without affecting any existing conversations. | | change, without affecting any existing conversations. | |
| | | | |
|
| @relates mwServiceIm_supports | | @see mwServiceIm_supports | |
| @relates mwServiceIm_setSupported | | @see mwServiceIm_setSupported | |
| @relates mwConversation_supports | | @see mwConversation_supports | |
| @relates mwConversation_send | | @see mwConversation_send | |
| @relates mwServiceImHandler::conversation_recv | | @see mwServiceImHandler::conversation_recv | |
| */ | | */ | |
| enum mwImSendType { | | enum mwImSendType { | |
| mwImSend_PLAIN, /**< char *, plain-text message */ | | mwImSend_PLAIN, /**< char *, plain-text message */ | |
| mwImSend_TYPING, /**< gboolean, typing status */ | | mwImSend_TYPING, /**< gboolean, typing status */ | |
| mwImSend_HTML, /**< char *, HTML formatted message (NOTESBUDDY) */ | | mwImSend_HTML, /**< char *, HTML formatted message (NOTESBUDDY) */ | |
| mwImSend_SUBJECT, /**< char *, conversation subject (NOTESBUDDY) */ | | mwImSend_SUBJECT, /**< char *, conversation subject (NOTESBUDDY) */ | |
| mwImSend_MIME, /**< char *, MIME-encoded message (NOTESBUDDY) */ | | mwImSend_MIME, /**< char *, MIME-encoded message (NOTESBUDDY) */ | |
| }; | | }; | |
| | | | |
|
| /** @relates mwConversation_getState */ | | /** @see mwConversation_getState */ | |
| enum mwConversationState { | | enum mwConversationState { | |
| mwConversation_CLOSED, /**< conversation is not open */ | | mwConversation_CLOSED, /**< conversation is not open */ | |
| mwConversation_PENDING, /**< conversation is opening */ | | mwConversation_PENDING, /**< conversation is opening */ | |
| mwConversation_OPEN, /**< conversation is open */ | | mwConversation_OPEN, /**< conversation is open */ | |
| mwConversation_UNKNOWN, /**< unknown state */ | | mwConversation_UNKNOWN, /**< unknown state */ | |
| }; | | }; | |
| | | | |
| #define mwConversation_isState(conv, state) \ | | #define mwConversation_isState(conv, state) \ | |
| (mwConversation_getState(conv) == (state)) | | (mwConversation_getState(conv) == (state)) | |
| | | | |
| | | | |
| skipping to change at line 174 | | skipping to change at line 174 | |
| void mwConversation_close(struct mwConversation *conv, guint32 err); | | void mwConversation_close(struct mwConversation *conv, guint32 err); | |
| | | | |
| /** determine whether a conversation supports the given message type */ | | /** determine whether a conversation supports the given message type */ | |
| gboolean mwConversation_supports(struct mwConversation *conv, | | gboolean mwConversation_supports(struct mwConversation *conv, | |
| enum mwImSendType type); | | enum mwImSendType type); | |
| | | | |
| enum mwImClientType mwConversation_getClientType(struct mwConversation *con
v); | | enum mwImClientType mwConversation_getClientType(struct mwConversation *con
v); | |
| | | | |
| /** get the state of a conversation | | /** get the state of a conversation | |
| | | | |
|
| @relates mwConversation_isOpen | | @see mwConversation_isOpen | |
| @relates mwConversation_isClosed | | @see mwConversation_isClosed | |
| @relates mwConversation_isPending | | @see mwConversation_isPending | |
| */ | | */ | |
| enum mwConversationState mwConversation_getState(struct mwConversation *con
v); | | enum mwConversationState mwConversation_getState(struct mwConversation *con
v); | |
| | | | |
| /** send a message over an open conversation */ | | /** send a message over an open conversation */ | |
| int mwConversation_send(struct mwConversation *conv, | | int mwConversation_send(struct mwConversation *conv, | |
| enum mwImSendType type, gconstpointer send); | | enum mwImSendType type, gconstpointer send); | |
| | | | |
| /** @returns owning service for a conversation */ | | /** @returns owning service for a conversation */ | |
| struct mwServiceIm *mwConversation_getService(struct mwConversation *conv); | | struct mwServiceIm *mwConversation_getService(struct mwConversation *conv); | |
| | | | |
| | | | |
| skipping to change at line 205 | | skipping to change at line 205 | |
| negotiated cipher, if any */ | | negotiated cipher, if any */ | |
| void mwConversation_setEncrypted(struct mwConversation *conv, | | void mwConversation_setEncrypted(struct mwConversation *conv, | |
| gboolean useCipher); | | gboolean useCipher); | |
| | | | |
| /** determine whether outgoing messages are being encrypted */ | | /** determine whether outgoing messages are being encrypted */ | |
| gboolean mwConversation_isEncrypted(struct mwConversation *conv); | | gboolean mwConversation_isEncrypted(struct mwConversation *conv); | |
| | | | |
| /** Associates client data with a conversation. If there is existing data, | | /** Associates client data with a conversation. If there is existing data, | |
| it will not have its cleanup function called. | | it will not have its cleanup function called. | |
| | | | |
|
| @relates mwConversation_getClientData | | @see mwConversation_getClientData | |
| @relates mwConversation_removeClientData | | @see mwConversation_removeClientData | |
| */ | | */ | |
| void mwConversation_setClientData(struct mwConversation *conv, | | void mwConversation_setClientData(struct mwConversation *conv, | |
| gpointer data, GDestroyNotify clean); | | gpointer data, GDestroyNotify clean); | |
| | | | |
| /** Reference associated client data | | /** Reference associated client data | |
| | | | |
|
| @relates mwConversation_setClientData | | @see mwConversation_setClientData | |
| @relates mwConversation_removeClientData | | @see mwConversation_removeClientData | |
| */ | | */ | |
| gpointer mwConversation_getClientData(struct mwConversation *conv); | | gpointer mwConversation_getClientData(struct mwConversation *conv); | |
| | | | |
| /** Remove any associated client data, calling the optional cleanup | | /** Remove any associated client data, calling the optional cleanup | |
| function if one was provided | | function if one was provided | |
| | | | |
|
| @relates mwConversation_setClientData | | @see mwConversation_setClientData | |
| @relates mwConversation_getClientData | | @see mwConversation_getClientData | |
| */ | | */ | |
| void mwConversation_removeClientData(struct mwConversation *conv); | | void mwConversation_removeClientData(struct mwConversation *conv); | |
| | | | |
| /** close and destroy the conversation and its backing channel, and | | /** close and destroy the conversation and its backing channel, and | |
| call the optional client data cleanup function */ | | call the optional client data cleanup function */ | |
| void mwConversation_free(struct mwConversation *conv); | | void mwConversation_free(struct mwConversation *conv); | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 8 change blocks. |
| 17 lines changed or deleted | | 17 lines changed or added | |
|
| mw_srvc_store.h | | mw_srvc_store.h | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 28 | |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| */ | | */ | |
| | | | |
| #ifndef _MW_SRVC_STORE_H | | #ifndef _MW_SRVC_STORE_H | |
| #define _MW_SRVC_STORE_H | | #define _MW_SRVC_STORE_H | |
| | | | |
| #include <glib.h> | | #include <glib.h> | |
| #include "mw_common.h" | | #include "mw_common.h" | |
| | | | |
| /** Type identifier for the storage service */ | | /** Type identifier for the storage service */ | |
|
| #define SERVICE_STORAGE 0x00000018 | | #define mwService_STORAGE 0x00000018 | |
| | | | |
| /** @struct mwServiceStorage | | /** @struct mwServiceStorage | |
| @see mwServiceStorage_new | | @see mwServiceStorage_new | |
| | | | |
| Instance of the storage service */ | | Instance of the storage service */ | |
| struct mwServiceStorage; | | struct mwServiceStorage; | |
| | | | |
| /** @struct mwStorage | | /** @struct mwStorage | |
| | | | |
| Unit Represents information intended for loading from or saving to | | Unit Represents information intended for loading from or saving to | |
| | | | |
| skipping to change at line 136 | | skipping to change at line 136 | |
| | | | |
| /** direct access to the opaque data backing the storage unit */ | | /** direct access to the opaque data backing the storage unit */ | |
| struct mwOpaque *mwStorageUnit_asOpaque(struct mwStorageUnit *); | | struct mwOpaque *mwStorageUnit_asOpaque(struct mwStorageUnit *); | |
| | | | |
| /** clears and frees a storage unit */ | | /** clears and frees a storage unit */ | |
| void mwStorageUnit_free(struct mwStorageUnit *); | | void mwStorageUnit_free(struct mwStorageUnit *); | |
| | | | |
| /** Initiates a load call to the storage service. If the service is | | /** Initiates a load call to the storage service. If the service is | |
| not currently available, the call will be cached and processed | | not currently available, the call will be cached and processed | |
| when the service is started. | | when the service is started. | |
|
| | | | |
| | | @param srvc the storage service | |
| @param item storage unit to load | | @param item storage unit to load | |
| @param cb callback function when the load call completes | | @param cb callback function when the load call completes | |
| @param data user data for callback | | @param data user data for callback | |
| @param data_free optional cleanup function for user data | | @param data_free optional cleanup function for user data | |
| */ | | */ | |
| void mwServiceStorage_load(struct mwServiceStorage *srvc, | | void mwServiceStorage_load(struct mwServiceStorage *srvc, | |
| struct mwStorageUnit *item, | | struct mwStorageUnit *item, | |
| mwStorageCallback cb, | | mwStorageCallback cb, | |
| gpointer data, GDestroyNotify data_free); | | gpointer data, GDestroyNotify data_free); | |
| | | | |
| /** Initiates a store call to the storage service. If the service is | | /** Initiates a store call to the storage service. If the service is | |
| not currently available, the call will be cached and processed | | not currently available, the call will be cached and processed | |
| when the service is started. | | when the service is started. | |
|
| | | | |
| | | @param srvc the storage service | |
| @param item storage unit to save | | @param item storage unit to save | |
| @param cb callback function when the load call completes | | @param cb callback function when the load call completes | |
| @param data optional user data for callback | | @param data optional user data for callback | |
| @param data_free optional cleanup function for user data | | @param data_free optional cleanup function for user data | |
| */ | | */ | |
| void mwServiceStorage_save(struct mwServiceStorage *srvc, | | void mwServiceStorage_save(struct mwServiceStorage *srvc, | |
| struct mwStorageUnit *item, | | struct mwStorageUnit *item, | |
| mwStorageCallback cb, | | mwStorageCallback cb, | |
| gpointer data, GDestroyNotify data_free); | | gpointer data, GDestroyNotify data_free); | |
| | | | |
| | | | |
End of changes. 3 change blocks. |
| 1 lines changed or deleted | | 5 lines changed or added | |
|