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

mw_srvc_ft.h File Reference


Detailed Description

A file transfer is a simple way to get large chunks of binary data from one client to another.

#include "mw_common.h"

Go to the source code of this file.

Data Structures

struct  mwFileTransferHandler

Defines

#define mwFileTransfer_cancel(ft)   mwFileTransfer_close((ft), mwFileTransfer_SUCCESS);
 cancel an open file transfer
#define mwFileTransfer_getSent(ft)   (mwFileTransfer_getFileSize(ft) - mwFileTransfer_getRemaining(ft))
 count of bytes sent/received over this file transfer so far
#define mwFileTransfer_isCancelLocal(ft)   mwFileTransfer_isState((ft), mwFileTransfer_CANCEL_LOCAL)
#define mwFileTransfer_isCancelRemote(ft)   mwFileTransfer_isState((ft), mwFileTransfer_CANCEL_REMOTE)
#define mwFileTransfer_isDone(ft)   mwFileTransfer_isState((ft), mwFileTransfer_DONE)
#define mwFileTransfer_isNew(ft)   mwFileTransfer_isState((ft), mwFileTransfer_NEW)
#define mwFileTransfer_isOpen(ft)   mwFileTransfer_isState((ft), mwFileTransfer_OPEN)
#define mwFileTransfer_isPending(ft)   mwFileTransfer_isState((ft), mwFileTransfer_PENDING)
#define mwFileTransfer_isState(ft, state)   (mwFileTransfer_getState(ft) == (state))
#define mwFileTransfer_reject(ft)   mwFileTransfer_close((ft), mwFileTransfer_REJECTED)
 reject an incoming file transfer
#define mwService_FILE_TRANSFER   0x00000038

Enumerations

enum  mwFileTranferCode {
  mwFileTransfer_SUCCESS = 0x00000000,
  mwFileTransfer_REJECTED = 0x08000606
}
enum  mwFileTransferState {
  mwFileTransfer_NEW,
  mwFileTransfer_PENDING,
  mwFileTransfer_OPEN,
  mwFileTransfer_CANCEL_LOCAL,
  mwFileTransfer_CANCEL_REMOTE,
  mwFileTransfer_DONE,
  mwFileTransfer_ERROR,
  mwFileTransfer_UNKNOWN
}

Functions

int mwFileTransfer_accept (struct mwFileTransfer *ft)
 accept an incoming file transfer
void mwFileTransfer_free (struct mwFileTransfer *ft)
 deallocate a file transfer.
gpointer mwFileTransfer_getClientData (struct mwFileTransfer *ft)
const char * mwFileTransfer_getFileName (struct mwFileTransfer *ft)
 the publicized file name.
guint32 mwFileTransfer_getFileSize (struct mwFileTransfer *ft)
 total bytes intended to be sent/received
const char * mwFileTransfer_getMessage (struct mwFileTransfer *ft)
 the message sent along with an offered file transfer
guint32 mwFileTransfer_getRemaining (struct mwFileTransfer *ft)
 bytes remaining to be received/send
mwServiceFileTransfermwFileTransfer_getService (struct mwFileTransfer *ft)
enum mwFileTransferState mwFileTransfer_getState (struct mwFileTransfer *ft)
 the status of this file transfer
const struct mwIdBlockmwFileTransfer_getUser (struct mwFileTransfer *ft)
 the user on the other end of the file transfer
mwFileTransfermwFileTransfer_new (struct mwServiceFileTransfer *srvc, const struct mwIdBlock *who, const char *msg, const char *filename, guint32 filesize)
int mwFileTransfer_offer (struct mwFileTransfer *ft)
 initiate an outgoing file transfer
void mwFileTransfer_removeClientData (struct mwFileTransfer *ft)
void mwFileTransfer_setClientData (struct mwFileTransfer *ft, gpointer data, GDestroyNotify clean)
mwFileTransferHandlermwServiceFileTransfer_getHandler (struct mwServiceFileTransfer *srvc)
mwServiceFileTransfermwServiceFileTransfer_new (struct mwSession *session, struct mwFileTransferHandler *handler)


Define Documentation

#define mwFileTransfer_cancel ft   )     mwFileTransfer_close((ft), mwFileTransfer_SUCCESS);
 

cancel an open file transfer

#define mwFileTransfer_getSent ft   )     (mwFileTransfer_getFileSize(ft) - mwFileTransfer_getRemaining(ft))
 

count of bytes sent/received over this file transfer so far

#define mwFileTransfer_isCancelLocal ft   )     mwFileTransfer_isState((ft), mwFileTransfer_CANCEL_LOCAL)
 

#define mwFileTransfer_isCancelRemote ft   )     mwFileTransfer_isState((ft), mwFileTransfer_CANCEL_REMOTE)
 

#define mwFileTransfer_isDone ft   )     mwFileTransfer_isState((ft), mwFileTransfer_DONE)
 

#define mwFileTransfer_isNew ft   )     mwFileTransfer_isState((ft), mwFileTransfer_NEW)
 

#define mwFileTransfer_isOpen ft   )     mwFileTransfer_isState((ft), mwFileTransfer_OPEN)
 

#define mwFileTransfer_isPending ft   )     mwFileTransfer_isState((ft), mwFileTransfer_PENDING)
 

#define mwFileTransfer_isState ft,
state   )     (mwFileTransfer_getState(ft) == (state))
 

#define mwFileTransfer_reject ft   )     mwFileTransfer_close((ft), mwFileTransfer_REJECTED)
 

reject an incoming file transfer

#define mwService_FILE_TRANSFER   0x00000038
 


Enumeration Type Documentation

enum mwFileTranferCode
 

Enumeration values:
mwFileTransfer_SUCCESS 
mwFileTransfer_REJECTED 

enum mwFileTransferState
 

Enumeration values:
mwFileTransfer_NEW  file transfer is not open
mwFileTransfer_PENDING  file transfer is opening
mwFileTransfer_OPEN  file transfer is open
mwFileTransfer_CANCEL_LOCAL 
mwFileTransfer_CANCEL_REMOTE 
mwFileTransfer_DONE 
mwFileTransfer_ERROR  error in file transfer
mwFileTransfer_UNKNOWN  unknown state


Function Documentation

int mwFileTransfer_accept struct mwFileTransfer ft  ) 
 

accept an incoming file transfer

void mwFileTransfer_free struct mwFileTransfer ft  ) 
 

deallocate a file transfer.

will call mwFileTransfer_close if necessary

gpointer mwFileTransfer_getClientData struct mwFileTransfer ft  ) 
 

const char* mwFileTransfer_getFileName struct mwFileTransfer ft  ) 
 

the publicized file name.

Not necessarily related to any actual file on either system

guint32 mwFileTransfer_getFileSize struct mwFileTransfer ft  ) 
 

total bytes intended to be sent/received

const char* mwFileTransfer_getMessage struct mwFileTransfer ft  ) 
 

the message sent along with an offered file transfer

guint32 mwFileTransfer_getRemaining struct mwFileTransfer ft  ) 
 

bytes remaining to be received/send

struct mwServiceFileTransfer* mwFileTransfer_getService struct mwFileTransfer ft  ) 
 

enum mwFileTransferState mwFileTransfer_getState struct mwFileTransfer ft  ) 
 

the status of this file transfer

const struct mwIdBlock* mwFileTransfer_getUser struct mwFileTransfer ft  ) 
 

the user on the other end of the file transfer

struct mwFileTransfer* mwFileTransfer_new struct mwServiceFileTransfer srvc,
const struct mwIdBlock who,
const char *  msg,
const char *  filename,
guint32  filesize
 

int mwFileTransfer_offer struct mwFileTransfer ft  ) 
 

initiate an outgoing file transfer

void mwFileTransfer_removeClientData struct mwFileTransfer ft  ) 
 

void mwFileTransfer_setClientData struct mwFileTransfer ft,
gpointer  data,
GDestroyNotify  clean
 

struct mwFileTransferHandler* mwServiceFileTransfer_getHandler struct mwServiceFileTransfer srvc  ) 
 

struct mwServiceFileTransfer* mwServiceFileTransfer_new struct mwSession session,
struct mwFileTransferHandler handler
 


Generated on Fri May 27 19:49:37 2005 for meanwhile by  doxygen 1.3.9.1