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

mw_srvc_ft.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 
00022 #ifndef _MW_SRVC_FT_H
00023 #define _MW_SRVC_FT_H
00024 
00025 
00026 #include "mw_common.h"
00027 
00028 
00039 struct mwServiceFileTransfer;
00040 
00041 
00045 struct mwFileTransfer;
00046 
00047 
00048 #define mwService_FILE_TRANSFER  0x00000038
00049 
00050 
00051 enum mwFileTransferState {
00052   mwFileTransfer_NEW,   
00053   mwFileTransfer_PENDING,  
00054   mwFileTransfer_OPEN,     
00055   mwFileTransfer_CANCEL_LOCAL,
00056   mwFileTransfer_CANCEL_REMOTE,
00057   mwFileTransfer_DONE,
00058   mwFileTransfer_ERROR,    
00059   mwFileTransfer_UNKNOWN,  
00060 };
00061 
00062 
00063 #define mwFileTransfer_isState(ft, state) \
00064   (mwFileTransfer_getState(ft) == (state))
00065 
00066 #define mwFileTransfer_isNew(ft) \
00067   mwFileTransfer_isState((ft), mwFileTransfer_NEW)
00068 
00069 #define mwFileTransfer_isPending(ft) \
00070   mwFileTransfer_isState((ft), mwFileTransfer_PENDING)
00071 
00072 #define mwFileTransfer_isOpen(ft) \
00073   mwFileTransfer_isState((ft), mwFileTransfer_OPEN)
00074 
00075 #define mwFileTransfer_isDone(ft) \
00076   mwFileTransfer_isState((ft), mwFileTransfer_DONE)
00077 
00078 #define mwFileTransfer_isCancelLocal(ft) \
00079   mwFileTransfer_isState((ft), mwFileTransfer_CANCEL_LOCAL)
00080 
00081 #define mwFileTransfer_isCancelRemote(ft) \
00082   mwFileTransfer_isState((ft), mwFileTransfer_CANCEL_REMOTE)
00083 
00084 
00085 enum mwFileTranferCode {
00086   mwFileTransfer_SUCCESS   = 0x00000000,
00087   mwFileTransfer_REJECTED  = 0x08000606,
00088 };
00089 
00090 
00091 struct mwFileTransferHandler {
00092 
00094   void (*ft_offered)(struct mwFileTransfer *ft);
00095 
00097   void (*ft_opened)(struct mwFileTransfer *ft);
00098 
00102   void (*ft_closed)(struct mwFileTransfer *ft, guint32 code);
00103 
00105   void (*ft_recv)(struct mwFileTransfer *ft, struct mwOpaque *data);
00106 
00110   void (*ft_ack)(struct mwFileTransfer *ft);
00111 
00113   void (*clear)(struct mwServiceFileTransfer *srvc);
00114 };
00115 
00116 
00117 struct mwServiceFileTransfer *
00118 mwServiceFileTransfer_new(struct mwSession *session,
00119                           struct mwFileTransferHandler *handler);
00120 
00121 
00122 struct mwFileTransferHandler *
00123 mwServiceFileTransfer_getHandler(struct mwServiceFileTransfer *srvc);
00124 
00125 
00126 const GList *
00127 mwServiceFileTransfer_getTransfers(struct mwServiceFileTransfer *srvc);
00128 
00129 
00130 struct mwFileTransfer *
00131 mwFileTransfer_new(struct mwServiceFileTransfer *srvc,
00132                    const struct mwIdBlock *who, const char *msg,
00133                    const char *filename, guint32 filesize);
00134 
00135 
00138 void
00139 mwFileTransfer_free(struct mwFileTransfer *ft);
00140 
00141 
00143 enum mwFileTransferState
00144 mwFileTransfer_getState(struct mwFileTransfer *ft);
00145 
00146 
00147 struct mwServiceFileTransfer *
00148 mwFileTransfer_getService(struct mwFileTransfer *ft);
00149 
00150 
00152 const struct mwIdBlock *
00153 mwFileTransfer_getUser(struct mwFileTransfer *ft);
00154 
00155 
00157 const char *
00158 mwFileTransfer_getMessage(struct mwFileTransfer *ft);
00159 
00160 
00163 const char *
00164 mwFileTransfer_getFileName(struct mwFileTransfer *ft);
00165 
00166 
00168 guint32 mwFileTransfer_getFileSize(struct mwFileTransfer *ft);
00169 
00170 
00172 guint32 mwFileTransfer_getRemaining(struct mwFileTransfer *ft);
00173 
00174 
00176 #define mwFileTransfer_getSent(ft) \
00177   (mwFileTransfer_getFileSize(ft) - mwFileTransfer_getRemaining(ft))
00178 
00179 
00181 int mwFileTransfer_offer(struct mwFileTransfer *ft);
00182 
00183 
00185 int mwFileTransfer_accept(struct mwFileTransfer *ft);
00186 
00187 
00189 #define mwFileTransfer_reject(ft) \
00190   mwFileTransfer_close((ft), mwFileTransfer_REJECTED)
00191 
00192 
00194 #define mwFileTransfer_cancel(ft) \
00195   mwFileTransfer_close((ft), mwFileTransfer_SUCCESS);
00196 
00197 
00204 int mwFileTransfer_close(struct mwFileTransfer *ft, guint32 code);
00205 
00206 
00213 int mwFileTransfer_send(struct mwFileTransfer *ft,
00214                         struct mwOpaque *data);
00215 
00216 
00226 int mwFileTransfer_ack(struct mwFileTransfer *ft);
00227 
00228 
00229 void mwFileTransfer_setClientData(struct mwFileTransfer *ft,
00230                                   gpointer data, GDestroyNotify clean);
00231 
00232 
00233 gpointer mwFileTransfer_getClientData(struct mwFileTransfer *ft);
00234 
00235 
00236 void mwFileTransfer_removeClientData(struct mwFileTransfer *ft);
00237 
00238 
00239 #endif

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