Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

mw_channel.h

Go to the documentation of this file.
00001 
00002 /*
00003   Meanwhile - Unofficial Lotus Sametime Community Client Library
00004   Copyright (C) 2004  Christopher (siege) O'Brien
00005   
00006   This library is free software; you can redistribute it and/or
00007   modify it under the terms of the GNU Library General Public
00008   License as published by the Free Software Foundation; either
00009   version 2 of the License, or (at your option) any later version.
00010   
00011   This library is distributed in the hope that it will be useful,
00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014   Library General Public License for more details.
00015   
00016   You should have received a copy of the GNU Library General Public
00017   License along with this library; if not, write to the Free
00018   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 */
00020 
00021 #ifndef _MW_CHANNEL_H
00022 #define _MW_CHANNEL_H
00023 
00024 
00025 #include <time.h>
00026 #include "mw_common.h"
00027 
00028 
00083 /* place-holders */
00084 struct mwCipherInstance;
00085 struct mwMsgChannelAccept;
00086 struct mwMsgChannelCreate;
00087 struct mwMsgChannelDestroy;
00088 struct mwMsgChannelSend;
00089 struct mwService;
00090 struct mwSession;
00091 
00092 
00093 
00096 struct mwChannel;
00097 
00098 
00101 struct mwChannelSet;
00102 
00103 
00105 #define MW_MASTER_CHANNEL_ID  0x00000000
00106 
00107 
00109 #define mwChannel_idIsOutgoing(id) \
00110   (! (0x80000000 & (id)))
00111 
00113 #define mwChannel_idIsIncoming(id) \
00114   (! mwChannel_idIsOutgoing(id))
00115 
00117 #define mwChannel_isOutgoing(chan) \
00118   mwChannel_idIsOutgoing(mwChannel_getId(chan))
00119 
00121 #define mwChannel_isIncoming(chan) \
00122   mwChannel_idIsIncoming(mwChannel_getId(chan))
00123 
00124 
00126 enum mwChannelState {
00127   mwChannel_NEW,      
00128   mwChannel_INIT,     
00129   mwChannel_WAIT,     
00130   mwChannel_OPEN,     
00131   mwChannel_DESTROY,  
00132   mwChannel_ERROR,    
00133   mwChannel_UNKNOWN,  
00134 };
00135 
00136 
00137 #define mwChannel_isState(chan, state) \
00138   (mwChannel_getState(chan) == (state))
00139 
00140 
00143 enum mwChannelStatField {
00144   mwChannelStat_MSG_SENT,      
00145   mwChannelStat_MSG_RECV,      
00146   mwChannelStat_U_BYTES_SENT,  
00147   mwChannelStat_U_BYTES_RECV,  
00148   mwChannelStat_OPENED_AT,     
00149   mwChannelStat_CLOSED_AT,     
00150 };
00151 
00152 
00158 enum mwEncryptPolicy {
00159   mwEncrypt_NONE      = 0x0000, 
00160   mwEncrypt_WHATEVER  = 0x0001, 
00161   mwEncrypt_ALL       = 0x0002, 
00162   mwEncrypt_RC2_40    = 0x1000, 
00163   mwEncrypt_RC2_128   = 0x2000, 
00164 };
00165 
00166 
00168 struct mwChannelSet *mwChannelSet_new(struct mwSession *);
00169 
00170 
00173 void mwChannelSet_free(struct mwChannelSet *);
00174 
00175 
00178 struct mwChannel *mwChannel_newIncoming(struct mwChannelSet *, guint32 id);
00179 
00180 
00183 struct mwChannel *mwChannel_newOutgoing(struct mwChannelSet *);
00184 
00185 
00188 struct mwChannel *mwChannel_find(struct mwChannelSet *cs, guint32 chan);
00189 
00190 
00193 guint32 mwChannel_getId(struct mwChannel *);
00194 
00195 
00197 struct mwSession *mwChannel_getSession(struct mwChannel *);
00198 
00199 
00202 guint32 mwChannel_getServiceId(struct mwChannel *);
00203 
00204 
00207 struct mwService *mwChannel_getService(struct mwChannel *);
00208 
00209 
00211 void mwChannel_setService(struct mwChannel *chan, struct mwService *srvc);
00212 
00213 
00217 gpointer mwChannel_getServiceData(struct mwChannel *chan);
00218 
00219 
00223 void mwChannel_setServiceData(struct mwChannel *chan,
00224                               gpointer data, GDestroyNotify clean);
00225 
00226 
00227 void mwChannel_removeServiceData(struct mwChannel *chan);
00228 
00229 
00230 guint32 mwChannel_getProtoType(struct mwChannel *chan);
00231 
00232 
00233 void mwChannel_setProtoType(struct mwChannel *chan, guint32 proto_type);
00234 
00235 
00236 guint32 mwChannel_getProtoVer(struct mwChannel *chan);
00237 
00238 
00239 void mwChannel_setProtoVer(struct mwChannel *chan, guint32 proto_ver);
00240 
00241 
00250 guint16 mwChannel_getEncryptPolicy(struct mwChannel *chan);
00251 
00252 
00253 guint32 mwChannel_getOptions(struct mwChannel *chan);
00254 
00255 
00256 void mwChannel_setOptions(struct mwChannel *chan, guint32 options);
00257 
00258 
00261 struct mwLoginInfo *mwChannel_getUser(struct mwChannel *chan);
00262 
00263 
00265 struct mwOpaque *mwChannel_getAddtlCreate(struct mwChannel *);
00266 
00267 
00269 struct mwOpaque *mwChannel_getAddtlAccept(struct mwChannel *);
00270 
00271 
00274 void mwChannel_populateSupportedCipherInstances(struct mwChannel *chan);
00275 
00276 
00279 void mwChannel_addSupportedCipherInstance(struct mwChannel *chan,
00280                                           struct mwCipherInstance *ci);
00281 
00282 
00285 GList *mwChannel_getSupportedCipherInstances(struct mwChannel *chan);
00286 
00287 
00290 void mwChannel_selectCipherInstance(struct mwChannel *chan,
00291                                     struct mwCipherInstance *ci);
00292 
00293 
00295 enum mwChannelState mwChannel_getState(struct mwChannel *);
00296 
00297 
00299 gpointer mwChannel_getStatistic(struct mwChannel *chan,
00300                                 enum mwChannelStatField stat);
00301 
00302 
00313 int mwChannel_create(struct mwChannel *chan);
00314 
00315 
00319 int mwChannel_accept(struct mwChannel *chan);
00320 
00321 
00329 int mwChannel_destroy(struct mwChannel *chan, guint32 reason,
00330                       struct mwOpaque *data);
00331 
00332 
00335 int mwChannel_send(struct mwChannel *chan, guint32 msg_type,
00336                    struct mwOpaque *msg);
00337 
00338 
00341 int mwChannel_sendEncrypted(struct mwChannel *chan,
00342                             guint32 msg_type, struct mwOpaque *msg,
00343                             gboolean encrypt);
00344 
00345 
00347 void mwChannel_recvCreate(struct mwChannel *chan,
00348                           struct mwMsgChannelCreate *msg);
00349 
00350 
00352 void mwChannel_recvAccept(struct mwChannel *chan,
00353                           struct mwMsgChannelAccept *msg);
00354 
00355 
00357 void mwChannel_recvDestroy(struct mwChannel *chan,
00358                            struct mwMsgChannelDestroy *msg);
00359 
00360 
00362 void mwChannel_recv(struct mwChannel *chan, struct mwMsgChannelSend *msg);
00363 
00364 
00365 #endif
00366 

Generated on Tue Nov 1 15:51:53 2005 for meanwhile by  doxygen 1.4.4