meanwhile  1.1.0
mw_srvc_ft.h
Go to the documentation of this file.
1 
2 /*
3  Meanwhile - Unofficial Lotus Sametime Community Client Library
4  Copyright (C) 2004 Christopher (siege) O'Brien
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public
17  License along with this library; if not, write to the Free
18  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20 
21 
22 #ifndef _MW_SRVC_FT_H
23 #define _MW_SRVC_FT_H
24 
25 
33 #include "mw_common.h"
34 
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 
45 
46 
50 struct mwFileTransfer;
51 
52 
53 #define mwService_FILE_TRANSFER 0x00000038
54 
55 
65 };
66 
67 
68 #define mwFileTransfer_isState(ft, state) \
69  (mwFileTransfer_getState(ft) == (state))
70 
71 #define mwFileTransfer_isNew(ft) \
72  mwFileTransfer_isState((ft), mwFileTransfer_NEW)
73 
74 #define mwFileTransfer_isPending(ft) \
75  mwFileTransfer_isState((ft), mwFileTransfer_PENDING)
76 
77 #define mwFileTransfer_isOpen(ft) \
78  mwFileTransfer_isState((ft), mwFileTransfer_OPEN)
79 
80 #define mwFileTransfer_isDone(ft) \
81  mwFileTransfer_isState((ft), mwFileTransfer_DONE)
82 
83 #define mwFileTransfer_isCancelLocal(ft) \
84  mwFileTransfer_isState((ft), mwFileTransfer_CANCEL_LOCAL)
85 
86 #define mwFileTransfer_isCancelRemote(ft) \
87  mwFileTransfer_isState((ft), mwFileTransfer_CANCEL_REMOTE)
88 
89 
91  mwFileTransfer_SUCCESS = 0x00000000,
93 };
94 
95 
97 
99  void (*ft_offered)(struct mwFileTransfer *ft);
100 
102  void (*ft_opened)(struct mwFileTransfer *ft);
103 
107  void (*ft_closed)(struct mwFileTransfer *ft, guint32 code);
108 
110  void (*ft_recv)(struct mwFileTransfer *ft, struct mwOpaque *data);
111 
115  void (*ft_ack)(struct mwFileTransfer *ft);
116 
118  void (*clear)(struct mwServiceFileTransfer *srvc);
119 };
120 
121 
122 struct mwServiceFileTransfer *
124  struct mwFileTransferHandler *handler);
125 
126 
127 struct mwFileTransferHandler *
129 
130 
131 const GList *
133 
134 
135 struct mwFileTransfer *
137  const struct mwIdBlock *who, const char *msg,
138  const char *filename, guint32 filesize);
139 
140 
143 void
145 
146 
150 
151 
152 struct mwServiceFileTransfer *
154 
155 
157 const struct mwIdBlock *
159 
160 
162 const char *
164 
165 
168 const char *
170 
171 
173 guint32 mwFileTransfer_getFileSize(struct mwFileTransfer *ft);
174 
175 
177 guint32 mwFileTransfer_getRemaining(struct mwFileTransfer *ft);
178 
179 
181 #define mwFileTransfer_getSent(ft) \
182  (mwFileTransfer_getFileSize(ft) - mwFileTransfer_getRemaining(ft))
183 
184 
186 int mwFileTransfer_offer(struct mwFileTransfer *ft);
187 
188 
190 int mwFileTransfer_accept(struct mwFileTransfer *ft);
191 
192 
194 #define mwFileTransfer_reject(ft) \
195  mwFileTransfer_close((ft), mwFileTransfer_REJECTED)
196 
197 
199 #define mwFileTransfer_cancel(ft) \
200  mwFileTransfer_close((ft), mwFileTransfer_SUCCESS);
201 
202 
209 int mwFileTransfer_close(struct mwFileTransfer *ft, guint32 code);
210 
211 
218 int mwFileTransfer_send(struct mwFileTransfer *ft,
219  struct mwOpaque *data);
220 
221 
231 int mwFileTransfer_ack(struct mwFileTransfer *ft);
232 
233 
235  gpointer data, GDestroyNotify clean);
236 
237 
238 gpointer mwFileTransfer_getClientData(struct mwFileTransfer *ft);
239 
240 
242 
243 
244 #ifdef __cplusplus
245 }
246 #endif
247 
248 
249 #endif /* _MW_SRVC_FT_H */
error in file transfer
Definition: mw_srvc_ft.h:63
mwFileTransferState
Definition: mw_srvc_ft.h:56
Definition: mw_srvc_ft.h:60
Definition: mw_srvc_ft.h:91
gpointer mwFileTransfer_getClientData(struct mwFileTransfer *ft)
enum mwFileTransferState mwFileTransfer_getState(struct mwFileTransfer *ft)
the status of this file transfer
const char * mwFileTransfer_getMessage(struct mwFileTransfer *ft)
the message sent along with an offered file transfer
struct mwServiceFileTransfer * mwFileTransfer_getService(struct mwFileTransfer *ft)
guint32 mwFileTransfer_getRemaining(struct mwFileTransfer *ft)
bytes remaining to be received/send
Definition: mw_srvc_ft.h:96
mwFileTranferCode
Definition: mw_srvc_ft.h:90
const GList * mwServiceFileTransfer_getTransfers(struct mwServiceFileTransfer *srvc)
A single file trasfer session.
Definition: mw_srvc_ft.h:44
struct mwFileTransfer * mwFileTransfer_new(struct mwServiceFileTransfer *srvc, const struct mwIdBlock *who, const char *msg, const char *filename, guint32 filesize)
int mwFileTransfer_close(struct mwFileTransfer *ft, guint32 code)
Close a file transfer.
const struct mwIdBlock * mwFileTransfer_getUser(struct mwFileTransfer *ft)
the user on the other end of the file transfer
Represents a Sametime client session.
Definition: mw_common.h:178
const char * mwFileTransfer_getFileName(struct mwFileTransfer *ft)
the publicized file name.
Common data types and functions for handling those types.
void mwFileTransfer_setClientData(struct mwFileTransfer *ft, gpointer data, GDestroyNotify clean)
void(* clear)(struct mwServiceFileTransfer *srvc)
optional.
Definition: mw_srvc_ft.h:118
struct mwServiceFileTransfer * mwServiceFileTransfer_new(struct mwSession *session, struct mwFileTransferHandler *handler)
void(* ft_ack)(struct mwFileTransfer *ft)
received an ack for a sent chunk on an outbound file transfer.
Definition: mw_srvc_ft.h:115
void(* ft_recv)(struct mwFileTransfer *ft, struct mwOpaque *data)
receive a chunk of a file from an inbound file transfer.
Definition: mw_srvc_ft.h:110
struct mwFileTransferHandler * mwServiceFileTransfer_getHandler(struct mwServiceFileTransfer *srvc)
struct mwSession * session
session this service is attached to.
Definition: mw_service.h:139
int mwFileTransfer_offer(struct mwFileTransfer *ft)
initiate an outgoing file transfer
void mwFileTransfer_removeClientData(struct mwFileTransfer *ft)
guint32 mwFileTransfer_getFileSize(struct mwFileTransfer *ft)
total bytes intended to be sent/received
void(* ft_closed)(struct mwFileTransfer *ft, guint32 code)
a file transfer has been closed.
Definition: mw_srvc_ft.h:107
Definition: mw_srvc_ft.h:61
void(* ft_opened)(struct mwFileTransfer *ft)
a file transfer has been fully initiated
Definition: mw_srvc_ft.h:102
unknown state
Definition: mw_srvc_ft.h:64
A length of binary data, not null-terminated.
Definition: mw_common.h:79
void(* ft_offered)(struct mwFileTransfer *ft)
an incoming file transfer has been offered
Definition: mw_srvc_ft.h:99
file transfer is opening
Definition: mw_srvc_ft.h:58
int mwFileTransfer_ack(struct mwFileTransfer *ft)
acknowledge the receipt of a chunk of data from an inbound file transfer.
int mwFileTransfer_accept(struct mwFileTransfer *ft)
accept an incoming file transfer
file transfer is open
Definition: mw_srvc_ft.h:59
Definition: mw_srvc_ft.h:62
File transfer service.
void mwFileTransfer_free(struct mwFileTransfer *ft)
deallocate a file transfer.
int mwFileTransfer_send(struct mwFileTransfer *ft, struct mwOpaque *data)
send a chunk of data over an outbound file transfer.
Definition: mw_srvc_ft.h:92
file transfer is not open
Definition: mw_srvc_ft.h:57
guchar * data
data, normally with no NULL termination
Definition: mw_common.h:81